@zombie-mermaid/svg-renderer 4.0.0 → 4.2.0
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 +59 -43
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +1400 -1671
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/flowchart-parallel-edge-lanes-1308.test.ts +168 -0
- package/src/__tests__/pie-layout.test.ts +215 -0
- package/src/__tests__/pie-svg.test.ts +194 -0
- package/src/__tests__/svg-edge-to-own-cluster-1310.test.ts +32 -0
- package/src/class/renderer.ts +2 -2
- package/src/er/renderer.ts +2 -2
- package/src/generated/mono-font-subset.ts +32 -0
- package/src/index.ts +2 -0
- package/src/layout-engine/edge-bundling.ts +79 -0
- package/src/layout-engine/to-elk.ts +15 -5
- package/src/layout-engine.ts +5 -1
- package/src/pie/layout.ts +234 -0
- package/src/pie/renderer.ts +161 -0
- package/src/registry.ts +31 -1
- package/src/styles.ts +28 -1
- package/src/title-gaps.ts +17 -2
package/dist/index.cjs
CHANGED
|
@@ -1,16 +1,23 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser"),d=require("entities");function f(e){return c.f`M ${e.x} ${e.y}`}function p(e){return f(e[0])+e.slice(1).map(e=>c.f` L ${e.x} ${e.y}`).join(``)}function m(e){if(e.length<3)return p(e);let t=e[e.length-1],n=[f(e[0])],r=(e,t,n)=>c.f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+c.f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+c.f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(c.f` L ${(5*e[0].x+e[1].x)/6}`+c.f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(c.f` L ${t.x} ${t.y}`),n.join(``)}function h(e){if(e.length<3)return p(e);let t=[f(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(c.f` L ${i.x} ${i.y}`);continue}let l=Math.min(12,o/2,s/2),u=i.x-(i.x-r.x)/o*l,d=i.y-(i.y-r.y)/o*l,f=i.x+(a.x-i.x)/s*l,p=i.y+(a.y-i.y)/s*l;t.push(c.f` L ${u} ${d}`),t.push(c.f` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(c.f` L ${n.x} ${n.y}`),t.join(``)}function g(e,t){let n=[f(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(c.f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(c.f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(c.f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(c.f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function _(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return f(e[0]);switch(t){case`basis`:return m(e);case`natural`:return h(e);case`step`:return g(e,`mid`);case`stepBefore`:return g(e,`before`);case`stepAfter`:return g(e,`after`);default:return p(e)}}var v=null,y=null,b=20;function x(e=b){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function S(e){if(Array.isArray(e))return`[${e.map(S).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${S(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function C(){if(v&&y)return y;let e=[],t=globalThis.setTimeout;globalThis.setTimeout=(n,r)=>r===0?(e.push(n),0):t(n,r);let n=globalThis,r=`self`in n,i=n.self;if(r&&n.document===void 0&&delete n.self,v=new l.default,!v)throw Error(`ELKBundled construction unexpectedly produced no instance`);return r&&(n.self=i),globalThis.setTimeout=t,e.forEach(e=>e()),y=v.worker.worker,y}function w(e,t){let n=t,r=n?S(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=C(),a,o,s=i.onmessage;if(i.onmessage=e=>{e.data.error?o=e.data.error:a=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=s,o)throw o;if(!a)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,a),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return a}function T(e,t,n){return(0,c.measureTextWidth)(e,t,n)}function E(e,t){return e.length*t*.6}var D=`'JetBrains Mono'`,O=`${D}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,k={nodeLabel:13,edgeLabel:11,groupHeader:12};function A(e){return{nodeLabel:e?.nodeLabel??k.nodeLabel,edgeLabel:e?.edgeLabel??k.edgeLabel,groupHeader:e?.groupHeader??k.groupHeader}}var j={nodeLabel:500,edgeLabel:400,groupHeader:600},ee=12,M={horizontal:20,vertical:10,diamondExtra:24},N={outerBox:1,innerBox:.75,connector:1},P=`0.35em`,F={width:8,height:5},I={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:k};function L(e,t){let n=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target)return;let r=n.get(e.source);r?r.push(t):n.set(e.source,[t])});let r=new Set,i=new Set,a=new Set;for(let o of t??e.nodes.keys()){if(i.has(o))continue;let t=[{node:o,next:0}];for(i.add(o),a.add(o);t.length>0;){let o=t[t.length-1],s=n.get(o.node)??[];if(o.next>=s.length){a.delete(o.node),t.pop();continue}let c=s[o.next++],l=e.edges[c].target;a.has(l)?r.add(c):i.has(l)||(i.add(l),a.add(l),t.push({node:l,next:0}))}}return r}var te={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function ne(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function re(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function ie(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":re(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function ae(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var oe={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function se(e,t){let n=(0,c.measureMultilineText)(e,t.fontSize,j.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function R(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[se(e.label,e.labelStyle)]),t}var ce={"state-start":`FIRST`},le={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function ue(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var de={top:44,left:16,bottom:16,right:16},fe=new WeakMap;function pe(e,t){let n=fe.get(e);return n||(n=ue(e)||be(e.subgraphs)?new Set:L(e,t?.walkOrder),fe.set(e,n)),n}function me(e,t){for(let n=0;n<e.edges.length;n++){let r=e.edges[n];if(t.has(r.source)||t.has(r.target))return n}return 1/0}function he(e){return ne(e,te.flowchart)}function ge(e){return{...ie(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function _e(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:oe}}function ve(e,t,n,r){let i=(0,c.measureMultilineText)(t,r,j.nodeLabel),a=i.width+M.horizontal*2,o=i.height+M.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+M.diamondExtra;a=e,o=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(a*a+o*o))+8;a=n===`doublecircle`?e+12:e,o=a}return n===`hexagon`&&(a+=M.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=M.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`?{width:28,height:28}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var ye=` root`;function be(e){for(let t of e)if(t.direction!==void 0||be(t.children))return!0;return!1}function xe(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)xe(n,t)}function Se(e,t){let n=new Set;if(xe(e,n),n.size===0)return!0;let r=t=>n.has(t)||t===e.id;return!t.edges.some(e=>r(e.source)!==r(e.target))}function Ce(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function we(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function Te(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),De(t,i,a);let o=Oe(e.subgraphs),s=Ce(e.subgraphs),c=e=>e?s.get(e)??[]:[],l=new Map;l.set(null,[]);let u=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=o.get(n.source),i=o.get(n.target);if(r&&r===i){let e=l.get(r)??[];l.set(r,e),e.push({index:t,edge:n})}else!r&&!i?l.get(null).push({index:t,edge:n}):u.push({index:t,edge:n,srcChain:c(r),tgtChain:c(i)})}let d=be(e.subgraphs),f=[],p=[],m={...ge({direction:he(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(I.thoroughness),"elk.layered.highDegreeNodes.treatment":`true`,"elk.layered.highDegreeNodes.threshold":`8`,"elk.layered.compaction.postCompaction.strategy":`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...ue(e)?le:{},"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":d?`SEPARATE`:`INCLUDE_CHILDREN`},h=new Map,g=new Map;function _(e,t){let n=h.get(e)??new Set;h.set(e,n),n.add(t)}function v(e,t){let n=g.get(e)??[];g.set(e,n),n.push(t)}if(d)for(let{index:e,edge:t,srcChain:n,tgtChain:i}of u){let a=we(n,i),o=t.source;if(n.length>a){for(let r=n.length-1;r>=a;r--){let i=n[r],a=`${i}_out_${e}`;_(i,a);let o=r===n.length-1?t.source:`${n[r+1]}_out_${e}`;v(i,{id:`e${e}_s${r}`,sources:[o],targets:[a]})}o=`${n[a]}_out_${e}`}let s=t.target;if(i.length>a){for(let n=a;n<=i.length-1;n++){let r=i[n],a=`${r}_in_${e}`;_(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;v(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}v(a>0?n[a-1]:ye,R({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:_e(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=ve(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=ae(t,i,o.label),c=ue(e)?ce[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=ue(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(Ee(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return me(e,new Set([t.id]));let r=e.subgraphs[n-b],i=me(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return xe(r,a),me(e,a)}),n=f.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>f[e]);f.splice(0,f.length,...n)}let S=pe(e,n);for(let{index:e,edge:t}of l.get(null)){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=R({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_e(r)});n?.looseEdges?.has(e)&&(i.layoutOptions={...i.layoutOptions,"elk.layered.priority.straightness":`0`}),p.push(i)}if(d)for(let e of g.get(ye)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(R({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:_e(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Ee(e,t,n,r,i,a,o){let s=e.direction!==void 0&&Se(e,t)?e.direction:o,c=ge({direction:he(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:de}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[];for(let r of e.nodeIds){let e=t.nodes.get(r);if(e){let t=ve(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(ae(r,t,e.label))}}for(let o of[...e.children].reverse())d.push(Ee(o,t,n,r,i,a,s));let f=[],p=r.get(e.id)??[],m=pe(t);for(let{index:e,edge:t}of p)t.source!==t.target&&f.push(R({id:`e${e}`,source:m.has(e)?t.target:t.source,target:m.has(e)?t.source:t.target,label:t.label,labelStyle:_e(n)}));for(let t of a.get(e.id)??[])f.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:f}}function De(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),De(r,t,n)}function Oe(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function ke(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=Ae(e[0],e[1],t);else{let n=e.length-1;r[n]=Ae(e[n],e[n-1],t)}}return r}function Ae(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?Me(t,c,a)??a:Me(t,a,o)??a:t<=r?Me(t,s,c)??s:Me(t,o,s)??s}{let t=e.y;return l>0?t<=i?je(t,a,c)??c:je(t,c,s)??c:t<=i?je(t,a,o)??o:je(t,o,s)??o}}function je(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function Me(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}function Ne(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=I.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}if(l.size!==0)for(let e of t){if(e.points.length<2)continue;let t=l.get(e.source),n=l.get(e.target);if(t!=null){let n=e.points[0];r?(n.x+=t,e.points.length>1&&e.points[1].x===n.x-t&&(e.points[1].x+=t)):(n.y+=t,e.points.length>1&&e.points[1].y===n.y-t&&(e.points[1].y+=t))}if(n!=null){let t=e.points[e.points.length-1];if(r){if(t.x+=n,e.points.length>1){let r=e.points[e.points.length-2];r.x===t.x-n&&(r.x+=n)}}else if(t.y+=n,e.points.length>1){let r=e.points[e.points.length-2];r.y===t.y-n&&(r.y+=n)}}}}var Pe=.5;function Fe(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Pe,r=e.x+e.width-Pe,i=e.y+Pe,a=e.y+e.height-Pe;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Ie(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...Ie(e,t,i.children)));return r}function Le(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Ie(t,n,r).map(e=>e.id)),u=Ie(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}function Re(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[e,d]of u){if(d.length<2)continue;let u=d[0].style;if(d.some(e=>e.label||e.style!==u))continue;let f=i.get(e);if(!f)continue;let p=[];for(let e of d){let t=i.get(e.target);t&&(o?t.x>f.x+f.width:s?t.x+t.width<f.x:c?t.y+t.height<f.y:t.y>f.y+f.height)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x+f.width:f.x,s=h,c=i+((o?Math.min(...p.map(e=>e.node.x)):Math.max(...p.map(e=>e.node.x+e.node.width)))-i)/2;c=Le(c,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=o?r.x:r.x+r.width,u=r.y+r.height/2,d=[{x:i,y:s},{x:c,y:s},{x:c,y:u},{x:a,y:u}];Fe(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}else{let i=m,o=c?f.y:f.y+f.height,s=o+((c?Math.max(...p.map(e=>e.node.y+e.node.height)):Math.min(...p.map(e=>e.node.y)))-o)/2;s=Le(s,m,h,n,r);let l=[];for(let{edge:n,node:r}of p){let a=r.x+r.width/2,u=c?r.y+r.height:r.y,d=[{x:i,y:o},{x:i,y:s},{x:a,y:s},{x:a,y:u}];Fe(d,t,new Set([e,r.id]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[e,a]of d){if(a.length<2)continue;let u=a[0].style;if(a.some(e=>e.label||e.style!==u))continue;let d=i.get(e);if(!d)continue;let f=[];for(let e of a){let t=i.get(e.source);t&&(o?t.x+t.width<d.x:s?t.x>d.x+d.width:c?t.y>d.y+d.height:t.y+t.height<d.y)&&f.push({edge:e,node:t})}if(f.length<2)continue;let p=d.x+d.width/2,m=d.y+d.height/2;if(l){let i=o?d.x:d.x+d.width,a=m,s=o?Math.max(...f.map(e=>e.node.x+e.node.width)):Math.min(...f.map(e=>e.node.x)),c=s+(i-s)/2;c=Le(c,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let s=o?r.x+r.width:r.x,u=r.y+r.height/2,d=[{x:s,y:u},{x:c,y:u},{x:c,y:a},{x:i,y:a}];Fe(d,t,new Set([r.id,e]))&&l.push({edge:n,points:d})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}else{let i=p,a=c?d.y+d.height:d.y,o=c?Math.min(...f.map(e=>e.node.y)):Math.max(...f.map(e=>e.node.y+e.node.height)),s=o+(a-o)/2;s=Le(s,p,m,n,r);let l=[];for(let{edge:n,node:r}of f){let o=r.x+r.width/2,u=[{x:o,y:c?r.y:r.y+r.height},{x:o,y:s},{x:i,y:s},{x:i,y:a}];Fe(u,t,new Set([r.id,e]))&&l.push({edge:n,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t}}}function ze(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function Be(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var Ve=16,He=28,Ue=18,We=28,Ge=10;function Ke(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(We,e.height*.6)/2,a=He+t*Ue,o=[];for(let e=0;e<=Ve;e++){let t=Math.PI*e/Ve;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Ge,y:r}}}function qe(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=Ke(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:at(i,e),id:a.id,animate:a.animate})}}function Je(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(...Je(n.children));return t}function Ye(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)it(e,o);Xe(e,t,o,r,a,0,0);let s=Je(a);$e(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),Ne(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));qe(t,c,i),n&&Re(i,r,a,t.direction);for(let e of i){let t=c.get(e.source),n=c.get(e.target);t&&(e.points=ke(e.points,t,!0)),n&&(e.points=ke(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=F.width,f=I.padding;for(let e of i){for(let t of e.points)l=Math.max(l,t.x+d+f),u=Math.max(u,t.y+d+f);e.labelPosition&&(l=Math.max(l,e.labelPosition.x+60+f),u=Math.max(u,e.labelPosition.y+20+f))}return{width:l,height:u,nodes:r,edges:i,groups:a}}function Xe(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,l=(s.y??0)+o,u=s.width??0,d=s.height??0;if(n.has(s.id)){let a=[];Xe(s,t,n,r,a,e,l);let o=rt(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:l,width:u,height:d,children:a})}else{let a=t.nodes.get(s.id);if(a){let n=(0,c.resolveNodeStyle)(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:l,width:u,height:d,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&Xe(s,t,n,r,i,e,l)}}}function Ze(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function Qe(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function $e(e,t,n,r,i,a){let o=new Map;et(e,o,0,0);let s=new Map;nt(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??Qe(o));let f=tt(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=Qe(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:pe(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:at(e,t),id:i.id,animate:i.animate})}}function et(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;et(i,t,n+e,r+a)}}function tt(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function nt(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=Ze(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=ze(a,l,u),f=Be(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)nt(a,t,n+(a.x??0),r+(a.y??0),i)}function rt(e,t){for(let n of e){if(n.id===t)return n;let e=rt(n.children,t);if(e)return e}}function it(e,t){t.add(e.id);for(let n of e.children)it(n,t)}function at(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n}var ot=10,st=14,ct=14,lt=10,ut=24,dt=400,ft=new Set([`rectangle`,`rounded`,`subroutine`]);function pt(e){let t=e===`TD`||e===`TB`||e===`BT`,n=e===`BT`||e===`RL`?-1:1;return{span:e=>{let[r,i]=t?[e.y,e.y+e.height]:[e.x,e.x+e.width],a=n*r,o=n*i;return{a0:Math.min(a,o),a1:Math.max(a,o),c0:t?e.x:e.y,c1:t?e.x+e.width:e.y+e.height}},toPoint:({a:e,c:r})=>t?{x:r,y:n*e}:{x:n*e,y:r}}}function mt(e,t,n){let r=Math.min(e.a,t.a),i=Math.max(e.a,t.a),a=Math.min(e.c,t.c),o=Math.max(e.c,t.c);return i>n.a0&&r<n.a1&&o>n.c0&&a<n.c1}var ht=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function gt(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function _t(e,t,n){let r=e.c===t.c;for(let i=1;i<n.length;i++){let a=n[i-1],o=n[i];if(a.c===o.c===r){if(r){let n=Math.abs(e.c-a.c),r=Math.min(Math.max(e.a,t.a),Math.max(a.a,o.a))-Math.max(Math.min(e.a,t.a),Math.min(a.a,o.a));if(n<st&&r>0)return!0}else{let n=Math.abs(e.a-a.a),r=Math.min(Math.max(e.c,t.c),Math.max(a.c,o.c))-Math.max(Math.min(e.c,t.c),Math.min(a.c,o.c));if(n<st&&r>0)return!0}}}return!1}function vt(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.a===n.a&&e.c===n.c||t.push(n)}for(let e=t.length-2;e>0;e--){let n=t[e-1],r=t[e],i=t[e+1];(n.a===r.a&&r.a===i.a||n.c===r.c&&r.c===i.c)&&t.splice(e,1)}return t}var yt=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].a-e[n-1].a)+Math.abs(e[n].c-e[n-1].c);return t};function bt(e,t,n,r,i,a=[]){let o=pt(i),s=o.span(e),c=o.span(t),l=s.a1<=c.a0,u=c.a1<=s.a0;if(!l&&!u)return;let d=o.span(r),f={a0:d.a0+lt,a1:d.a1-lt,c0:d.c0+lt,c1:d.c1-lt},p=a.map(e=>e.map(e=>gt(o,e))),m=n.map(e=>ht(o.span(e),ot)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>ft.has(e.shape),v=e=>{for(let t of e)if(t.a<f.a0||t.a>f.a1||t.c<f.c0||t.c>f.c1)return!1;for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(n.a!==r.a&&n.c!==r.c||m.some(e=>mt(n,r,e))||mt(n,r,s)||mt(n,r,c)||p.some(e=>_t(n,r,e)))return!1}return!0},y=new Set([h(s),h(c),f.c0,f.c1]);for(let e of m)y.add(e.c0-1),y.add(e.c1+1);for(let e of[s,c])y.add(e.c0-ot),y.add(e.c1+ot);let b=(e,t,n)=>_(e)?n>=t.c0+4&&n<=t.c1-4:Math.abs(n-h(t))<.5,x=[];if(l){let n=(c.a0-s.a1)/2,r=s.a1+Math.min(ct,n),i=c.a0-Math.min(ct,n);for(let n of y){b(e,s,n)&&b(t,c,n)&&x.push([{a:s.a1,c:n},{a:c.a0,c:n}]),x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]),b(t,c,n)&&x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:c.a0,c:n}]),b(e,s,n)&&x.push([{a:s.a1,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]);let a=n>=s.c1?s.c1:n<=s.c0?s.c0:void 0;if(a!==void 0){let e=b(t,c,n)?[{a:c.a0,c:n}]:[{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}];x.push([{a:g(s),c:a},{a:g(s),c:n},...e])}}}else for(let t of y){let n=t>=c.c1?c.c1:t<=c.c0?c.c0:void 0;if(n===void 0)continue;b(e,s,t)&&x.push([{a:s.a0,c:t},{a:g(c),c:t},{a:g(c),c:n}]);let r=n===c.c1?s.c1:s.c0;x.push([{a:g(s),c:r},{a:g(s),c:t},{a:g(c),c:t},{a:g(c),c:n}])}let S,C=1/0;for(let t of x){let n=vt(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?dt:0,i=yt(n)+ut*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function xt(e){let t={x:e[0].x,y:e[0].y},n=-1;for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.abs(a.x-i.x)+Math.abs(a.y-i.y);o>n&&(n=o,t={x:(i.x+a.x)/2,y:(i.y+a.y)/2})}return t}var St=`__zm_spine__`,Ct=8,wt=6,Tt=12,Et=4,Dt=4,Ot=.25,kt=.02,At=40,jt=e=>e===`TD`||e===`TB`||e===`BT`,z=e=>e.startsWith(St);function Mt(e){return e.flatMap(e=>[e,...Mt(e.children)])}function B(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of B(n))t.add(e);return t}function Nt(e){if(e.subgraphs.length===0||ue(e)||be(e.subgraphs))return!1;for(let t of e.nodes.keys())if(z(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Mt(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...B(t)].some(t=>e.nodes.has(t)))}function Pt(e,t){let n=jt(t),r=e=>n?[e.y,e.y+e.height]:[e.x,e.x+e.width],i=[...e].sort((e,t)=>{let[n,i]=r(e),[a,o]=r(t);return(n+i)/2-(a+o)/2}),a=[];for(let e of i){let[t,n]=r(e),i=a[a.length-1];i&&t<i.end?(i.end=Math.min(i.end,n),i.ids.push(e.id)):a.push({end:n,ids:[e.id]})}(t===`BT`||t===`RL`)&&a.reverse();let o=new Map;return a.forEach((e,t)=>e.ids.forEach(e=>o.set(e,t))),o}function Ft(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...B(i)].filter(e=>t.has(e));if(e.length===0)continue;let a=e.map(e=>t.get(e)),o=Math.min(...a),s=Math.max(...a),c=new Map;for(let a=o;a<=s;a++){let o=e.filter(e=>t.get(e)===a).sort((e,t)=>n(e)-n(t));if(o.length>0)c.set(a,o[0]);else{let e=`${St}${i.id}__${a}`;r.ghosts.push({id:e,subgraph:i.id}),c.set(a,e)}}for(let e=o;e<s;e++){let t=c.get(e),n=c.get(e+1);!z(t)&&!z(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function It(e,t,n,r=()=>!1){let i=e=>{let n=[...B(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},a=e=>{let t=[...B(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},o=e.map(e=>({sg:e,at:i(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),s=[],c=-1/0;for(let{sg:e,at:t}of o){let n=s[s.length-1];n&&t[0]<=c?(n.push(e),c=Math.max(c,t[1])):(s.push([e]),c=t[1])}for(let t of s){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let i=[...t].sort((t,n)=>e.indexOf(n)-e.indexOf(t)),o=t.map(a).sort((e,t)=>e-t),s=i.map((e,t)=>o[t]-a(e));i.forEach((e,t)=>{for(let r of B(e))n.has(r)&&n.set(r,n.get(r)+s[t])})}for(let i of e)It(i.children,t,n,r)}function Lt(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=B(t);for(let e of i.get(t.id)??[])r.add(e);let o=[...r].filter(e=>a.has(e)),s=o.filter(e=>n.has(e));if(s.length===0)continue;let c=Math.min(...s.map(e=>n.get(e))),l=Math.max(...s.map(e=>n.get(e))),u=o.map(e=>a.get(e)),d=Math.min(...u),f=Math.max(...u),p=(d+f)/2,m=0;for(let t of e){if(r.has(t)||z(t))continue;let e=n.get(t);if(e===void 0||e<c||e>l)continue;m++;let i=a.get(t);a.set(t,i<=p?Math.min(i,d)-1-m*.001:Math.max(i,f)+1+m*.001)}}let o=new Map(e.map((e,t)=>[e,t]));return[...e].sort((e,t)=>a.get(e)-a.get(t)||o.get(e)-o.get(t))}var Rt=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function zt(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...B(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=Math.min(...a.map(e=>e.x))-de.left,s=Math.min(...a.map(e=>e.y))-de.top,l=Math.max(...a.map(e=>e.x+e.width))+de.right,u=Math.max(...a.map(e=>e.y+e.height))+de.bottom,d=(0,c.measureMultilineText)(e.label,n.groupHeader,j.groupHeader).width+24;return{id:e.id,label:e.label,x:o,y:s,width:Math.max(l-o,d),height:u-s,children:i}};return e.map(r)}var Bt=e=>e.flatMap(e=>[e,...Bt(e.children)]);function Vt(e,t,n,r,i,a){let o=jt(r),s=new Map(Mt(t).map(e=>[e.id,B(e)])),c=new Map,l=!1,u=[],d=e=>o?[e.x,e.x+e.width]:[e.y,e.y+e.height],f=e=>o?[e.y,e.y+e.height]:[e.x,e.x+e.width],p=([e,t],[n,r])=>Math.max(0,Math.min(t,r)-Math.max(e,n)),m=e=>({x:e.x-At,y:e.y-At,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Bt(e),_=new Map(g.map(e=>[e,m(e)])),v=(e,t,n,r)=>{let i=p(d(e),d(t)),a=p(f(e),f(t));if(i<=0||a<=0)return;let s=i<=a,c=s===o,l=e=>c?e.x:e.y,m=e=>c?e.x+e.width:e.y+e.height,h=e=>(l(e)+m(e))/2,g=h(n)<=h(r)?n:r;u.push({axis:c?`x`:`y`,amount:s?i:a,after:m(g)})};for(let e of g){let t=s.get(e.id),r=[...t].filter(e=>a.has(e)).map(e=>a.get(e)),o=new Set(r);for(let[s,u]of n){if(t.has(s))continue;if(o.has(a.get(s))||!Rt(r,a.get(s))){v(_.get(e),u,e,u);continue}let n=h(_.get(e),u);n<=0||(i.has(e.id)?c.set(e.id,Math.max(c.get(e.id)??0,n)):l=!0)}}let y=(e,t)=>Bt(e.children).includes(t);for(let e=0;e<g.length;e++)for(let t=e+1;t<g.length;t++){let n=g[e],r=g[t];y(n,r)||y(r,n)||v(_.get(n),r,n,r)}return{penetration:c,stuck:l,requests:u}}function Ht(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=t(i),o=Pt(a.nodes,e.direction),s=jt(e.direction),c=new Map(a.nodes.map(e=>[e.id,e])),l=e=>{let t=c.get(e);return s?t.x:t.y},u=Mt(e.subgraphs),d=Ft(u,o,l),f=new Map;for(let e of d.ghosts)f.set(e.subgraph,[...f.get(e.subgraph)??[],e.id]);let p=new Map(a.nodes.map(e=>[e.id,l(e.id)]));It(e.subgraphs,o,p,(t,n)=>{let r=B(t),i=B(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)});for(let e of d.ghosts){let t=[...B(u.find(t=>t.id===e.subgraph))].filter(e=>p.has(e)).map(e=>p.get(e));p.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let m=new Map(e.nodes);for(let e of d.ghosts)m.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let h=Lt([...m.keys()],p,o,u,f),g={...i,nodes:new Map(h.map(e=>[e,m.get(e)])),edges:[...e.edges,...d.edges]},_=new Set(d.edges.map((t,n)=>e.edges.length+n)),v=i=>{let a=new Map,s=new Map;for(let c=0;;c++){let l=new Map(d.ghosts.map(e=>[e.id,Ct+(a.get(e.subgraph)??0)])),p=t(g,{fixedWidths:l,looseEdges:_,detachedEdges:i,walkOrder:r,forceNodeOrder:!0}),m=new Map(p.nodes.filter(e=>!z(e.id)).map(e=>[e.id,e])),h=zt(e.subgraphs,m,n),v=Vt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o),{penetration:y,stuck:b}=v;if(b)return;if(y.size===0){for(let t=0;v.requests.length>0;t++){if(t===Tt)return;Gt(v.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...m.values()],p.edges),h=zt(e.subgraphs,m,n),v=Vt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o)}let t=Wt(e,i,m,h,u);return t&&Kt(p,[...m.values()],h,t)}if(c===wt)return;for(let[e,t]of y){let n=a.get(e)??0,r=s.get(e),i=r?(r.overlap-t)/(n-r.width):0,o=i>kt?i:Ot;s.set(e,{width:n,overlap:t}),a.set(e,n+t/o+Dt)}}},y=Ut(e,d,o,u);return(y.size>0?v(y):void 0)??v(new Set)}function Ut(e,t,n,r){let i=r.map(e=>{let t=B(e);return{inside:t,layers:new Set([...t].filter(e=>n.has(e)).map(e=>n.get(e)))}}),a=e=>{let t=n.get(e.source),r=n.get(e.target);return t===void 0||r===void 0||e.source===e.target?!1:i.some(({inside:n,layers:i})=>n.has(e.source)&&n.has(e.target)&&Array.from({length:Math.max(0,Math.abs(r-t)-1)},(e,n)=>Math.min(t,r)+1+n).some(e=>!i.has(e)))},o=new Set;e.edges.forEach((e,t)=>{a(e)&&o.add(t)});let s=new Map,c=e=>{e.source!==e.target&&(s.set(e.source,(s.get(e.source)??0)+1),s.set(e.target,(s.get(e.target)??0)+1))};e.edges.forEach((e,t)=>{o.has(t)||c(e)}),t.edges.forEach(c);for(let t of[...o]){let n=e.edges[t];(!s.get(n.source)||!s.get(n.target))&&o.delete(t)}return o}function Wt(e,t,n,r,i){let a=new Map(Bt(r).map(e=>[e.id,e])),o=[];for(let r of t){let t=e.edges[r],s=n.get(t.source),c=n.get(t.target),l=i.filter(e=>{let n=B(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>B(e).size-B(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=bt(s,c,[...n.values()].filter(e=>e!==s&&e!==c),u,e.direction,o.map(e=>e.points));if(!d)return;o.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:t.label?xt(d):void 0,inlineStyle:at(r,e),id:t.id,animate:t.animate})}return o}function Gt(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+Et,s=t.filter(e=>e[r]>=a),c=Math.min(...s.map(e=>e[r]));for(let e of s)e[r]+=o;let l=e=>{e[r]>=c&&(e[r]+=o)};for(let e of n)e.points.forEach(l),e.labelPosition&&l(e.labelPosition)}function Kt(e,t,n,r){let i=[...e.edges.filter(e=>!z(e.source)&&!z(e.target)),...r],a=Bt(n),o=[...t.map(e=>e.x),...a.map(e=>e.x),...i.flatMap(e=>e.points.map(e=>e.x))],s=[...t.map(e=>e.y),...a.map(e=>e.y),...i.flatMap(e=>e.points.map(e=>e.y))],c=I.padding-Math.min(...o),l=I.padding-Math.min(...s);for(let e of t)e.x+=c,e.y+=l;for(let e of a)e.x+=c,e.y+=l;for(let e of i){for(let t of e.points)t.x+=c,t.y+=l;e.labelPosition&&(e.labelPosition.x+=c,e.labelPosition.y+=l)}let u=0,d=0;for(let e of t)u=Math.max(u,e.x+e.width+I.padding),d=Math.max(d,e.y+e.height+I.padding);for(let e of a)u=Math.max(u,e.x+e.width+I.padding),d=Math.max(d,e.y+e.height+I.padding);for(let e of i){for(let t of e.points)u=Math.max(u,t.x+F.width+I.padding),d=Math.max(d,t.y+F.width+I.padding);e.labelPosition&&(u=Math.max(u,e.labelPosition.x+60+I.padding),d=Math.max(d,e.labelPosition.y+20+I.padding))}return{...e,nodes:t,edges:i,groups:n,width:u,height:d}}function qt(e,t={}){return Jt(e,t)}function Jt(e,t,n){let r={...I,...t,fontSizes:A(t.fontSizes)};return Ye(w(Te(e,r,n),t.layoutCache),e,r.mergeEdges)}function Yt(e,t={}){if(Nt(e)){let n=Ht(e,(e,n)=>Jt(e,t,n),A(t.fontSizes));if(n)return n}return qt(e,t)}function Xt(e,t={}){return Te(e,{...I,...t,fontSizes:A(t.fontSizes)})}var Zt=12,Qt=2;function $t(e){return e.flatMap(e=>[e,...$t(e.children)])}function en(e,t){let n=t.groupHeader+16;return $t(e).filter(e=>e.label!==``).map(e=>{let r=(0,c.measureMultilineText)(e.label,t.groupHeader,j.groupHeader);return{x:e.x+Zt-Qt,y:e.y+n/2-r.height/2-Qt,width:r.width+4,height:r.height+4}})}function tn(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=[-r,r,-i,i],o=[e.x-n.x,n.x+n.width-e.x,e.y-n.y,n.y+n.height-e.y],s=0,c=1;for(let e=0;e<4;e++){let t=a[e],n=o[e];if(t===0){if(n<0)return!1}else{let e=n/t;if(t<0?s=Math.max(s,e):c=Math.min(c,e),s>c)return!1}}return!0}function nn(e,t){let n=e.points;for(let e=0;e+1<n.length;e++)if(t.some(t=>tn(n[e],n[e+1],t)))return!0;return!1}function rn(e){let t=2166136261;for(let n of e.map(e=>`${e.x},${e.y},${e.width},${e.height}`).join(`;`))t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0).toString(36)}function an(e,t,n){let r=`zm-title-gap-${rn(e)}`;return{id:r,markup:` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map(e=>` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join(`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("@zombie-mermaid/core"),l=require("elkjs/lib/elk.bundled.js");l=s(l,1);let u=require("@zombie-mermaid/mermaid-parser"),d=require("entities");function f(e){return c.f`M ${e.x} ${e.y}`}function p(e){return f(e[0])+e.slice(1).map(e=>c.f` L ${e.x} ${e.y}`).join(``)}function m(e){if(e.length<3)return p(e);let t=e[e.length-1],n=[f(e[0])],r=(e,t,n)=>c.f` C ${(2*e.x+t.x)/3} ${(2*e.y+t.y)/3},`+c.f` ${(e.x+2*t.x)/3} ${(e.y+2*t.y)/3},`+c.f` ${(e.x+4*t.x+n.x)/6} ${(e.y+4*t.y+n.y)/6}`;n.push(c.f` L ${(5*e[0].x+e[1].x)/6}`+c.f` ${(5*e[0].y+e[1].y)/6}`);for(let t=2;t<e.length;t++)n.push(r(e[t-2],e[t-1],e[t]));return n.push(r(e[e.length-2],t,t)),n.push(c.f` L ${t.x} ${t.y}`),n.join(``)}function h(e){if(e.length<3)return p(e);let t=[f(e[0])];for(let n=1;n<e.length-1;n++){let r=e[n-1],i=e[n],a=e[n+1],o=Math.hypot(i.x-r.x,i.y-r.y),s=Math.hypot(a.x-i.x,a.y-i.y);if(o===0||s===0){t.push(c.f` L ${i.x} ${i.y}`);continue}let l=Math.min(12,o/2,s/2),u=i.x-(i.x-r.x)/o*l,d=i.y-(i.y-r.y)/o*l,f=i.x+(a.x-i.x)/s*l,p=i.y+(a.y-i.y)/s*l;t.push(c.f` L ${u} ${d}`),t.push(c.f` Q ${i.x} ${i.y}, ${f} ${p}`)}let n=e[e.length-1];return t.push(c.f` L ${n.x} ${n.y}`),t.join(``)}function g(e,t){let n=[f(e[0])],r=e.length-1;for(let i=0;i<r;i++){let a=e[i],o=e[i+1];if(i===r-1){n.push(c.f` L ${o.x} ${o.y}`);break}if(t===`before`)n.push(c.f` L ${a.x} ${o.y} L ${o.x} ${o.y}`);else if(t===`after`)n.push(c.f` L ${o.x} ${a.y} L ${o.x} ${o.y}`);else{let e=(a.y+o.y)/2;n.push(c.f` L ${a.x} ${e} L ${o.x} ${e} L ${o.x} ${o.y}`)}}return n.join(``)}function _(e,t=`linear`){if(e.length===0)return``;if(e.length===1)return f(e[0]);switch(t){case`basis`:return m(e);case`natural`:return h(e);case`step`:return g(e,`mid`);case`stepBefore`:return g(e,`before`);case`stepAfter`:return g(e,`after`);default:return p(e)}}var v=null,y=null,b=20;function x(e=b){if(!Number.isInteger(e)||e<1)throw Error(`createLayoutCache: maxSize must be a positive integer, got ${e}`);return{map:new Map,maxSize:e}}function S(e){if(Array.isArray(e))return`[${e.map(S).join(`,`)}]`;if(typeof e==`object`&&e){let t=e;return`{${Object.keys(t).sort().map(e=>`${JSON.stringify(e)}:${S(t[e])}`).join(`,`)}}`}return JSON.stringify(e)}function C(){if(v&&y)return y;let e=[],t=globalThis.setTimeout;globalThis.setTimeout=(n,r)=>r===0?(e.push(n),0):t(n,r);let n=globalThis,r=`self`in n,i=n.self;if(r&&n.document===void 0&&delete n.self,v=new l.default,!v)throw Error(`ELKBundled construction unexpectedly produced no instance`);return r&&(n.self=i),globalThis.setTimeout=t,e.forEach(e=>e()),y=v.worker.worker,y}function w(e,t){let n=t,r=n?S(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=C(),a,o,s=i.onmessage;if(i.onmessage=e=>{e.data.error?o=e.data.error:a=e.data.data},i.dispatcher.saveDispatch({data:{id:0,cmd:`layout`,graph:e}}),i.onmessage=s,o)throw o;if(!a)throw Error(`ELK layout did not return synchronously`);if(n&&r!==void 0&&(n.map.set(r,a),n.map.size>n.maxSize)){let e=n.map.keys().next().value;e!==void 0&&n.map.delete(e)}return a}var T=`JetBrains Mono NL`,E=`@font-face {
|
|
2
|
+
font-family: 'JetBrains Mono NL';
|
|
3
|
+
font-style: normal;
|
|
4
|
+
font-weight: 400;
|
|
5
|
+
font-display: swap;
|
|
6
|
+
src: url(data:font/woff2;base64,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) format('woff2');
|
|
7
|
+
unicode-range: U+0020-007E, U+00A0-00FF;
|
|
8
|
+
}`;function D(e,t,n){return(0,c.measureTextWidth)(e,t,n)}function O(e,t){return e.length*t*.6}var k=`'JetBrains Mono'`,A=`${k}, 'SF Mono', 'Fira Code', ui-monospace, monospace`,j={nodeLabel:13,edgeLabel:11,groupHeader:12};function M(e){return{nodeLabel:e?.nodeLabel??j.nodeLabel,edgeLabel:e?.edgeLabel??j.edgeLabel,groupHeader:e?.groupHeader??j.groupHeader}}var N={nodeLabel:500,edgeLabel:400,groupHeader:600},ee=12,P={horizontal:20,vertical:10,diamondExtra:24},F={outerBox:1,innerBox:.75,connector:1},I=`0.35em`,L={width:8,height:5};function te(e,t,n){return(0,c.buildStyleBlock)(e,t?{family:T,faceCss:E}:!1,n)}var R={font:`Inter`,padding:40,nodeSpacing:28,layerSpacing:48,mergeEdges:!0,thoroughness:3,fontSizes:j};function ne(e,t){let n=new Map;e.edges.forEach((e,t)=>{if(e.source===e.target)return;let r=n.get(e.source);r?r.push(t):n.set(e.source,[t])});let r=new Set,i=new Set,a=new Set;for(let o of t??e.nodes.keys()){if(i.has(o))continue;let t=[{node:o,next:0}];for(i.add(o),a.add(o);t.length>0;){let o=t[t.length-1],s=n.get(o.node)??[];if(o.next>=s.length){a.delete(o.node),t.pop();continue}let c=s[o.next++],l=e.edges[c].target;a.has(l)?r.add(c):i.has(l)||(i.add(l),a.add(l),t.push({node:l,next:0}))}}return r}var re={flowchart:`DOWN`,state:`DOWN`,class:`DOWN`,er:`DOWN`,c4:`DOWN`};function ie(e,t){switch(e){case`LR`:return`RIGHT`;case`RL`:return`LEFT`;case`BT`:return`UP`;case`TD`:case`TB`:return`DOWN`;default:return t}}function ae(e){let t=typeof e==`number`?{top:e,left:e,bottom:e,right:e}:e;return`[top=${t.top},left=${t.left},bottom=${t.bottom},right=${t.right}]`}function oe(e){return{"elk.algorithm":`layered`,"elk.direction":e.direction,"elk.spacing.nodeNode":String(e.nodeSpacing),"elk.layered.spacing.nodeNodeBetweenLayers":String(e.layerSpacing),"elk.padding":ae(e.padding),"elk.edgeRouting":`ORTHOGONAL`}}function se(e,t,n){let r={id:e,width:t.width,height:t.height};return n!==void 0&&(r.labels=[{text:n}]),r}var ce={"elk.edgeLabels.inline":`true`,"elk.edgeLabels.placement":`CENTER`};function le(e,t){let n=(0,c.measureMultilineText)(e,t.fontSize,N.edgeLabel),r={text:e,width:n.width+8,height:n.height+6};return t.layoutOptions&&(r.layoutOptions={...t.layoutOptions}),r}function z(e){let t={id:e.id,sources:[e.source],targets:[e.target]};return e.label&&(t.labels=[le(e.label,e.labelStyle)]),t}var ue={"state-start":`FIRST`},de={"elk.layered.cycleBreaking.strategy":`MODEL_ORDER`,"elk.layered.compaction.postCompaction.strategy":`NONE`};function fe(e){for(let t of e.nodes.values())if(t.shape===`state-start`||t.shape===`state-end`)return!0;return!1}var pe={top:44,left:16,bottom:16,right:16},me=new WeakMap;function he(e,t){let n=me.get(e);return n||(n=fe(e)||Se(e.subgraphs)?new Set:ne(e,t?.walkOrder),me.set(e,n)),n}function ge(e,t){for(let n=0;n<e.edges.length;n++){let r=e.edges[n];if(t.has(r.source)||t.has(r.target))return n}return 1/0}function _e(e){return ie(e,re.flowchart)}function ve(e){return{...oe(e),"elk.spacing.edgeEdge":`12`,"elk.layered.spacing.edgeEdgeBetweenLayers":`12`,"elk.layered.spacing.edgeNodeBetweenLayers":`12`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`,"elk.contentAlignment":`H_CENTER V_CENTER`}}function ye(e){return{fontSize:e.fontSizes.edgeLabel,layoutOptions:ce}}function be(e,t,n,r){let i=(0,c.measureMultilineText)(t,r,N.nodeLabel),a=i.width+P.horizontal*2,o=i.height+P.vertical*2;if(n===`diamond`){let e=Math.max(a,o)+P.diamondExtra;a=e,o=e}if(n===`circle`||n===`doublecircle`){let e=Math.ceil(Math.sqrt(a*a+o*o))+8;a=n===`doublecircle`?e+12:e,o=a}return n===`hexagon`&&(a+=P.horizontal),(n===`trapezoid`||n===`trapezoid-alt`||n===`parallelogram`||n===`parallelogram-alt`)&&(a+=P.horizontal),n===`asymmetric`&&(a+=12),n===`cylinder`&&(o+=14),n===`state-start`||n===`state-end`?{width:28,height:28}:(a=Math.max(a,60),o=Math.max(o,36),{width:a,height:o})}var xe=` root`;function Se(e){for(let t of e)if(t.direction!==void 0||Se(t.children))return!0;return!1}function Ce(e,t){for(let n of e.nodeIds)t.add(n);for(let n of e.children)Ce(n,t)}function we(e,t){let n=new Set;if(Ce(e,n),n.size===0)return!0;let r=t=>n.has(t)||t===e.id;return!t.edges.some(e=>r(e.source)!==r(e.target))}function Te(e){let t=new Map;function n(e,r){let i=[...r,e.id];t.set(e.id,i);for(let t of e.children)n(t,i)}for(let t of e)n(t,[]);return t}function Ee(e,t){let n=0;for(;n<e.length&&n<t.length&&e[n]===t[n];)n++;return n}function De(e,t,n){let r=t,i=new Set,a=new Set;for(let t of e.subgraphs)a.add(t.id),ke(t,i,a);let o=Ae(e.subgraphs),s=Te(e.subgraphs),c=e=>e?s.get(e)??[]:[],l=new Map;l.set(null,[]);let u=[];for(let t=0;t<e.edges.length;t++){let n=e.edges[t],r=o.get(n.source),i=o.get(n.target);if(r&&r===i){let e=l.get(r)??[];l.set(r,e),e.push({index:t,edge:n})}else!r&&!i?l.get(null).push({index:t,edge:n}):u.push({index:t,edge:n,srcChain:c(r),tgtChain:c(i)})}let d=Se(e.subgraphs),f=[],p=[],m={...ve({direction:_e(e.direction),nodeSpacing:r.nodeSpacing,layerSpacing:r.layerSpacing,padding:r.padding}),"elk.layered.thoroughness":String(R.thoroughness),"elk.layered.highDegreeNodes.treatment":`true`,"elk.layered.highDegreeNodes.threshold":`8`,"elk.layered.compaction.postCompaction.strategy":`LEFT_RIGHT_CONSTRAINT_LOCKING`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,...n?.forceNodeOrder?{"elk.layered.crossingMinimization.forceNodeModelOrder":`true`}:{},...fe(e)?de:{},"elk.layered.wrapping.strategy":`OFF`,"elk.hierarchyHandling":d?`SEPARATE`:`INCLUDE_CHILDREN`},h=new Map,g=new Map;function _(e,t){let n=h.get(e)??new Set;h.set(e,n),n.add(t)}function v(e,t){let n=g.get(e)??[];g.set(e,n),n.push(t)}if(d)for(let{index:e,edge:t,srcChain:n,tgtChain:i}of u){let a=Ee(n,i),o=t.source;if(n.length>a){for(let r=n.length-1;r>=a;r--){let i=n[r],a=`${i}_out_${e}`;_(i,a);let o=r===n.length-1?t.source:`${n[r+1]}_out_${e}`;v(i,{id:`e${e}_s${r}`,sources:[o],targets:[a]})}o=`${n[a]}_out_${e}`}let s=t.target;if(i.length>a){for(let n=a;n<=i.length-1;n++){let r=i[n],a=`${r}_in_${e}`;_(r,a);let o=n===i.length-1?t.target:`${i[n+1]}_in_${e}`;v(r,{id:`e${e}_t${n}`,sources:[a],targets:[o]})}s=`${i[a]}_in_${e}`}v(a>0?n[a-1]:xe,z({id:`e${e}`,source:o,target:s,label:t.label,labelStyle:ye(r)}))}for(let[t,o]of e.nodes)if(!i.has(t)&&!a.has(t)){let i=be(t,o.label,o.shape,r.fontSizes.nodeLabel),a=n?.fixedWidths?.get(t);a!==void 0&&(i.width=a);let s=se(t,i,o.label),c=fe(e)?ue[o.shape]:void 0;c!==void 0&&(s.layoutOptions={"elk.layered.layering.layerConstraint":c}),f.push(s)}let y=fe(e),b=f.length,x=y?e.subgraphs:[...e.subgraphs].reverse();for(let t of x)f.push(Oe(t,e,r,l,h,g,e.direction));if(y&&e.subgraphs.length>0){let t=f.map((t,n)=>{if(n<b)return ge(e,new Set([t.id]));let r=e.subgraphs[n-b],i=ge(e,new Set([r.id]));if(i!==1/0)return i;let a=new Set;return Ce(r,a),ge(e,a)}),n=f.map((e,t)=>t).sort((e,n)=>t[e]-t[n]||e-n).map(e=>f[e]);f.splice(0,f.length,...n)}let S=he(e,n);for(let{index:e,edge:t}of l.get(null)){if(t.source===t.target||n?.detachedEdges?.has(e))continue;let i=z({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:ye(r)});n?.looseEdges?.has(e)&&(i.layoutOptions={...i.layoutOptions,"elk.layered.priority.straightness":`0`}),p.push(i)}if(d)for(let e of g.get(xe)??[])p.push(e);else for(let{index:e,edge:t}of u)p.push(z({id:`e${e}`,source:S.has(e)?t.target:t.source,target:S.has(e)?t.source:t.target,label:t.label,labelStyle:ye(r)}));return{id:`root`,layoutOptions:m,children:f,edges:p}}function Oe(e,t,n,r,i,a,o){let s=e.direction!==void 0&&we(e,t)?e.direction:o,c=ve({direction:_e(s),nodeSpacing:n.nodeSpacing,layerSpacing:n.layerSpacing,padding:pe}),l,u=i.get(e.id);u&&u.size>0&&(l=[...u].map(e=>({id:e})));let d=[];for(let r of e.nodeIds){let e=t.nodes.get(r);if(e){let t=be(r,e.label,e.shape,n.fontSizes.nodeLabel);d.push(se(r,t,e.label))}}for(let o of[...e.children].reverse())d.push(Oe(o,t,n,r,i,a,s));let f=[],p=r.get(e.id)??[],m=he(t);for(let{index:e,edge:t}of p)t.source!==t.target&&f.push(z({id:`e${e}`,source:m.has(e)?t.target:t.source,target:m.has(e)?t.source:t.target,label:t.label,labelStyle:ye(n)}));for(let t of a.get(e.id)??[])f.push(t);return{id:e.id,layoutOptions:c,labels:e.label?[{text:e.label}]:void 0,ports:l,children:d,edges:f}}function ke(e,t,n){for(let n of e.nodeIds)t.add(n);for(let r of e.children)n.add(r.id),ke(r,t,n)}function Ae(e){let t=new Map;function n(e){for(let n of e.nodeIds)t.set(n,e.id);for(let t of e.children)n(t)}for(let t of e)n(t);return t}function je(e,t,n){if(e.length<2||t.shape===`rectangle`||t.shape===`rounded`||t.shape===`stadium`)return e;let r=[...e];if(t.shape===`diamond`){if(n)r[0]=Me(e[0],e[1],t);else{let n=e.length-1;r[n]=Me(e[n],e[n-1],t)}}return r}function Me(e,t,n){let r=n.x+n.width/2,i=n.y+n.height/2,a={x:r,y:n.y},o={x:n.x+n.width,y:i},s={x:r,y:n.y+n.height},c={x:n.x,y:i},l=e.x-t.x,u=e.y-t.y;if(Math.abs(l)<Math.abs(u)){let t=e.x;return u>0?t<=r?Pe(t,c,a)??a:Pe(t,a,o)??a:t<=r?Pe(t,s,c)??s:Pe(t,o,s)??s}{let t=e.y;return l>0?t<=i?Ne(t,a,c)??c:Ne(t,c,s)??c:t<=i?Ne(t,a,o)??o:Ne(t,o,s)??o}}function Ne(e,t,n){let r=n.y-t.y;if(Math.abs(r)<.001)return null;let i=(e-t.y)/r;return i<0||i>1?null:{x:t.x+i*(n.x-t.x),y:e}}function Pe(e,t,n){let r=n.x-t.x;if(Math.abs(r)<.001)return null;let i=(e-t.x)/r;return i<0||i>1?null:{x:e,y:t.y+i*(n.y-t.y)}}function Fe(e,t,n){if(e.length===0)return;let r=n===`LR`||n===`RL`,i=new Set;for(let e of t)i.add(`${e.source}:${e.target}`),i.add(`${e.target}:${e.source}`);let a=R.layerSpacing*.6,o=[...e].sort((e,t)=>r?e.x-t.x:e.y-t.y),s=[],c=[o[0]];for(let e=1;e<o.length;e++){let t=(r?o[e].x:o[e].y)-(r?o[e-1].x:o[e-1].y),n=c.some(t=>i.has(`${t.id}:${o[e].id}`));t<=a&&!n?c.push(o[e]):(s.push(c),c=[o[e]])}s.push(c);let l=new Map;for(let e of s){if(e.length<=1)continue;let t=e.map(e=>r?e.x:e.y),n=Math.min(...t),i=Math.max(...t);if(i-n<=1)continue;let a=(n+i)/2;for(let t of e){let e=a-(r?t.x:t.y);Math.abs(e)>.5&&(r?t.x=a:t.y=a,l.set(t.id,e))}}if(l.size!==0)for(let e of t){if(e.points.length<2)continue;let t=l.get(e.source),n=l.get(e.target);if(t!=null){let n=e.points[0];r?(n.x+=t,e.points.length>1&&e.points[1].x===n.x-t&&(e.points[1].x+=t)):(n.y+=t,e.points.length>1&&e.points[1].y===n.y-t&&(e.points[1].y+=t))}if(n!=null){let t=e.points[e.points.length-1];if(r){if(t.x+=n,e.points.length>1){let r=e.points[e.points.length-2];r.x===t.x-n&&(r.x+=n)}}else if(t.y+=n,e.points.length>1){let r=e.points[e.points.length-2];r.y===t.y-n&&(r.y+=n)}}}}var Ie=.5;function Le(e,t,n){for(let r=0;r<e.length-1;r++){let i=e[r],a=e[r+1],o=Math.min(i.x,a.x),s=Math.max(i.x,a.x),c=Math.min(i.y,a.y),l=Math.max(i.y,a.y);for(let e of t){if(n.has(e.id))continue;let t=e.x+Ie,r=e.x+e.width-Ie,i=e.y+Ie,a=e.y+e.height-Ie;if(!(t>=r||i>=a)&&o<r&&s>t&&c<a&&l>i)return!1}}return!0}function Re(e,t,n){let r=[];for(let i of n)e>=i.x&&e<=i.x+i.width&&t>=i.y&&t<=i.y+i.height&&(r.push(i),r.push(...Re(e,t,i.children)));return r}function ze(e,t,n,r,i){let a=i===`LR`,o=i===`RL`,s=i===`BT`,c=a||o,l=new Set(Re(t,n,r).map(e=>e.id)),u=Re(c?e:t,c?n:e,r).find(e=>!l.has(e.id));return u?a?u.x-12:o?u.x+u.width+12:s?u.y+u.height+12:u.y-12:e}var Be=2;function Ve(e,t,n,r,i){for(let a of e){if(t.has(a)||a.source===a.target)continue;let e=a.source===n?a.points[0]:a.target===n?a.points[a.points.length-1]:void 0;if(e&&Math.abs((i?e.x:e.y)-r)<=Be)return!0}return!1}function He(e,t,n,r){let i=new Map(t.map(e=>[e.id,e])),a=new Set,o=r===`LR`,s=r===`RL`,c=r===`BT`,l=o||s,u=new Map;for(let t of e){if(t.source===t.target)continue;let e=u.get(t.source)??[];u.set(t.source,e),e.push(t)}for(let[d,f]of u){if(f.length<2)continue;let u=f[0].style;if(f.some(e=>e.label||e.style!==u))continue;let p=i.get(d);if(!p)continue;let m=[];for(let e of f){let t=i.get(e.target);t&&(o?t.x>p.x+p.width:s?t.x+t.width<p.x:c?t.y+t.height<p.y:t.y>p.y+p.height)&&m.push({edge:e,node:t})}if(m.length<2)continue;let h=p.x+p.width/2,g=p.y+p.height/2;if(l){let i=o?p.x+p.width:p.x,s=g;if(Ve(e,new Set(m.map(e=>e.edge)),d,i,!0))continue;let c=i+((o?Math.min(...m.map(e=>e.node.x)):Math.max(...m.map(e=>e.node.x+e.node.width)))-i)/2;c=ze(c,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=o?n.x:n.x+n.width,a=n.y+n.height/2,u=[{x:i,y:s},{x:c,y:s},{x:c,y:a},{x:r,y:a}];Le(u,t,new Set([d,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}else{let i=h,o=c?p.y:p.y+p.height;if(Ve(e,new Set(m.map(e=>e.edge)),d,o,!1))continue;let s=o+((c?Math.max(...m.map(e=>e.node.y+e.node.height)):Math.min(...m.map(e=>e.node.y)))-o)/2;s=ze(s,h,g,n,r);let l=[];for(let{edge:e,node:n}of m){let r=n.x+n.width/2,a=c?n.y+n.height:n.y,u=[{x:i,y:o},{x:i,y:s},{x:r,y:s},{x:r,y:a}];Le(u,t,new Set([d,n.id]))&&l.push({edge:e,points:u})}if(l.length<2)continue;for(let{edge:e,points:t}of l)e.points=t,a.add(e)}}let d=new Map;for(let t of e){if(a.has(t)||t.source===t.target)continue;let e=d.get(t.target)??[];d.set(t.target,e),e.push(t)}for(let[a,u]of d){if(u.length<2)continue;let d=u[0].style;if(u.some(e=>e.label||e.style!==d))continue;let f=i.get(a);if(!f)continue;let p=[];for(let e of u){let t=i.get(e.source);t&&(o?t.x+t.width<f.x:s?t.x>f.x+f.width:c?t.y>f.y+f.height:t.y+t.height<f.y)&&p.push({edge:e,node:t})}if(p.length<2)continue;let m=f.x+f.width/2,h=f.y+f.height/2;if(l){let i=o?f.x:f.x+f.width,s=h;if(Ve(e,new Set(p.map(e=>e.edge)),a,i,!0))continue;let c=o?Math.max(...p.map(e=>e.node.x+e.node.width)):Math.min(...p.map(e=>e.node.x)),l=c+(i-c)/2;l=ze(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=o?n.x+n.width:n.x,c=n.y+n.height/2,d=[{x:r,y:c},{x:l,y:c},{x:l,y:s},{x:i,y:s}];Le(d,t,new Set([n.id,a]))&&u.push({edge:e,points:d})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}else{let i=m,o=c?f.y+f.height:f.y;if(Ve(e,new Set(p.map(e=>e.edge)),a,o,!1))continue;let s=c?Math.min(...p.map(e=>e.node.y)):Math.max(...p.map(e=>e.node.y+e.node.height)),l=s+(o-s)/2;l=ze(l,m,h,n,r);let u=[];for(let{edge:e,node:n}of p){let r=n.x+n.width/2,s=[{x:r,y:c?n.y:n.y+n.height},{x:r,y:l},{x:i,y:l},{x:i,y:o}];Le(s,t,new Set([n.id,a]))&&u.push({edge:e,points:s})}if(u.length<2)continue;for(let{edge:e,points:t}of u)e.points=t}}}function Ue(e,t=0,n=0){let r=[];if(!e.sections||e.sections.length===0)return r;let i=e.sections[0];if(r.push({x:i.startPoint.x+t,y:i.startPoint.y+n}),i.bendPoints)for(let e of i.bendPoints)r.push({x:e.x+t,y:e.y+n});return r.push({x:i.endPoint.x+t,y:i.endPoint.y+n}),r}function We(e,t=0,n=0){if(!e.labels||e.labels.length===0)return;let r=e.labels[0];if(r.x!=null&&r.y!=null)return{x:r.x+(r.width??0)/2+t,y:r.y+(r.height??0)/2+n}}var Ge=16,Ke=28,qe=18,Je=28,Ye=10;function Xe(e,t){let n=e.x+e.width,r=e.y+e.height/2,i=Math.min(Je,e.height*.6)/2,a=Ke+t*qe,o=[];for(let e=0;e<=Ge;e++){let t=Math.PI*e/Ge;o.push({x:n+a*Math.sin(t),y:r-i*Math.cos(t)})}return{points:o,labelPosition:{x:n+a+Ye,y:r}}}function Ze(e,t,n){let r=new Map;for(let i=0;i<e.edges.length;i++){let a=e.edges[i];if(a.source!==a.target)continue;let o=t.get(a.source);if(!o)continue;let s=r.get(o.id)??0;r.set(o.id,s+1);let{points:c,labelPosition:l}=Xe(o,s);n.push({source:a.source,target:a.target,label:a.label,style:a.style,hasArrowStart:a.hasArrowStart,hasArrowEnd:a.hasArrowEnd,points:c,labelPosition:a.label?l:void 0,inlineStyle:lt(i,e),id:a.id,animate:a.animate})}}function Qe(e){let t=[];for(let n of e)t.push({x:n.x,y:n.y,right:n.x+n.width,bottom:n.y+n.height}),t.push(...Qe(n.children));return t}function $e(e,t,n=!1){let r=[],i=[],a=[],o=new Set;for(let e of t.subgraphs)ct(e,o);et(e,t,o,r,a,0,0);let s=Qe(a);rt(e,t,i,0,0,s.length>0?{leftX:Math.min(...s.map(e=>e.x))-20,rightX:Math.max(...s.map(e=>e.right))+20}:void 0),Fe(r,i,t.direction);let c=new Map(r.map(e=>[e.id,e]));Ze(t,c,i),n&&He(i,r,a,t.direction);for(let e of i){let t=c.get(e.source),n=c.get(e.target);t&&(e.points=je(e.points,t,!0)),n&&(e.points=je(e.points,n,!1))}let l=e.width??800,u=e.height??600,d=L.width,f=R.padding;for(let e of i){for(let t of e.points)l=Math.max(l,t.x+d+f),u=Math.max(u,t.y+d+f);e.labelPosition&&(l=Math.max(l,e.labelPosition.x+60+f),u=Math.max(u,e.labelPosition.y+20+f))}return{width:l,height:u,nodes:r,edges:i,groups:a}}function et(e,t,n,r,i,a,o){if(e.children)for(let s of e.children){let e=(s.x??0)+a,l=(s.y??0)+o,u=s.width??0,d=s.height??0;if(n.has(s.id)){let a=[];et(s,t,n,r,a,e,l);let o=st(t.subgraphs,s.id);i.push({id:s.id,label:o?.label??``,x:e,y:l,width:u,height:d,children:a})}else{let a=t.nodes.get(s.id);if(a){let n=(0,c.resolveNodeStyle)(s.id,t),i=t.classAssignments.get(s.id);r.push({id:s.id,label:a.label,shape:a.shape,x:e,y:l,width:u,height:d,inlineStyle:n,className:i,interaction:t.interactions.get(s.id)})}s.children&&s.children.length>0&&et(s,t,n,r,i,e,l)}}}function tt(e){let t=/^e(\d+)$/.exec(e);if(t)return{edgeIndex:parseInt(t[1],10),role:`bridge`};let n=/^e(\d+)_([st])(\d+)$/.exec(e);if(n)return{edgeIndex:parseInt(n[1],10),role:n[2]===`s`?`source`:`target`,level:parseInt(n[3],10)}}function nt(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++){let r=e[n].x-e[n-1].x,i=e[n].y-e[n-1].y;t+=Math.sqrt(r*r+i*i)}let n=t/2;for(let t=1;t<e.length;t++){let r=e[t].x-e[t-1].x,i=e[t].y-e[t-1].y,a=Math.sqrt(r*r+i*i);if(n<=a){let o=n/a;return{x:e[t-1].x+o*r,y:e[t-1].y+o*i}}n-=a}return e[e.length-1]}function rt(e,t,n,r,i,a){let o=new Map;it(e,o,0,0);let s=new Map;ot(e,s,0,0,o);let c=0;for(let[e,r]of s){let i=t.edges[e];if(!i)continue;let o=[],s=e=>{!e||e.points.length===0||(o.length>0?o.push(...e.points.slice(1)):o.push(...e.points))},l=[...r.sourceHops.keys()].sort((e,t)=>t-e);for(let e of l)s(r.sourceHops.get(e));s(r.bridge);let u=[...r.targetHops.keys()].sort((e,t)=>e-t);for(let e of u)s(r.targetHops.get(e));let d;i.label&&o.length>=2&&(d=r.bridge?.labelPosition??nt(o));let f=at(o,a,c);f!==o&&c++,i.label&&f!==o&&f.length>=2&&(d=nt(f)),n.push({source:i.source,target:i.target,label:i.label,style:i.style,hasArrowStart:i.hasArrowStart,hasArrowEnd:i.hasArrowEnd,points:he(t).has(e)?[...f].reverse():f,labelPosition:d,inlineStyle:lt(e,t),id:i.id,animate:i.animate})}}function it(e,t,n,r){t.set(e.id,{x:n,y:r});for(let i of e.children??[]){let e=i.x??0,a=i.y??0;it(i,t,n+e,r+a)}}function at(e,t,n=0){if(e.length<2)return e;let r=!1;for(let t=1;t<e.length;t++){let n=Math.abs(e[t].x-e[t-1].x),i=Math.abs(e[t].y-e[t-1].y);if(n>1&&i>1){r=!0;break}}if(!r)return e;let i=[e[0]];for(let r=1;r<e.length;r++){let a=i[i.length-1],o=e[r],s=Math.abs(o.x-a.x),c=Math.abs(o.y-a.y);if(s>1&&c>1){if(t){let e=n%2==0,r=Math.floor(n/2)*12,s=e?t.rightX+r:t.leftX-r;i.push({x:s,y:a.y}),i.push({x:s,y:o.y})}else{let e=(a.y+o.y)/2;i.push({x:a.x,y:e}),i.push({x:o.x,y:e})}}i.push(o)}return i}function ot(e,t,n,r,i){if(e.edges)for(let a of e.edges){let e=tt(a.id);if(!e)continue;let{edgeIndex:o}=e,s=a.container,c=s?i.get(s):void 0,l=c?.x??n,u=c?.y??r,d=Ue(a,l,u),f=We(a,l,u),p=t.get(o)??{sourceHops:new Map,targetHops:new Map};t.set(o,p);let m={edgeIndex:o,points:d,labelPosition:f};e.role===`bridge`?p.bridge=m:e.role===`source`?p.sourceHops.set(e.level,m):p.targetHops.set(e.level,m)}if(e.children)for(let a of e.children)ot(a,t,n+(a.x??0),r+(a.y??0),i)}function st(e,t){for(let n of e){if(n.id===t)return n;let e=st(n.children,t);if(e)return e}}function ct(e,t){t.add(e.id);for(let n of e.children)ct(n,t)}function lt(e,t){let n,r=t.linkStyles.get(`default`);r&&(n={...r});let i=t.linkStyles.get(e);return i&&(n=n?{...n,...i}:{...i}),n}var ut=10,dt=14,ft=14,pt=10,mt=24,ht=400,gt=new Set([`rectangle`,`rounded`,`subroutine`]);function _t(e){let t=e===`TD`||e===`TB`||e===`BT`,n=e===`BT`||e===`RL`?-1:1;return{span:e=>{let[r,i]=t?[e.y,e.y+e.height]:[e.x,e.x+e.width],a=n*r,o=n*i;return{a0:Math.min(a,o),a1:Math.max(a,o),c0:t?e.x:e.y,c1:t?e.x+e.width:e.y+e.height}},toPoint:({a:e,c:r})=>t?{x:r,y:n*e}:{x:n*e,y:r}}}function vt(e,t,n){let r=Math.min(e.a,t.a),i=Math.max(e.a,t.a),a=Math.min(e.c,t.c),o=Math.max(e.c,t.c);return i>n.a0&&r<n.a1&&o>n.c0&&a<n.c1}var yt=(e,t)=>({a0:e.a0-t,a1:e.a1+t,c0:e.c0-t,c1:e.c1+t});function bt(e,t){let n=e.span({x:t.x,y:t.y,width:0,height:0});return{a:n.a0,c:n.c0}}function xt(e,t,n){let r=e.c===t.c;for(let i=1;i<n.length;i++){let a=n[i-1],o=n[i];if(a.c===o.c===r){if(r){let n=Math.abs(e.c-a.c),r=Math.min(Math.max(e.a,t.a),Math.max(a.a,o.a))-Math.max(Math.min(e.a,t.a),Math.min(a.a,o.a));if(n<dt&&r>0)return!0}else{let n=Math.abs(e.a-a.a),r=Math.min(Math.max(e.c,t.c),Math.max(a.c,o.c))-Math.max(Math.min(e.c,t.c),Math.min(a.c,o.c));if(n<dt&&r>0)return!0}}}return!1}function St(e){let t=[];for(let n of e){let e=t[t.length-1];e&&e.a===n.a&&e.c===n.c||t.push(n)}for(let e=t.length-2;e>0;e--){let n=t[e-1],r=t[e],i=t[e+1];(n.a===r.a&&r.a===i.a||n.c===r.c&&r.c===i.c)&&t.splice(e,1)}return t}var Ct=e=>{let t=0;for(let n=1;n<e.length;n++)t+=Math.abs(e[n].a-e[n-1].a)+Math.abs(e[n].c-e[n-1].c);return t};function wt(e,t,n,r,i,a=[]){let o=_t(i),s=o.span(e),c=o.span(t),l=s.a1<=c.a0,u=c.a1<=s.a0;if(!l&&!u)return;let d=o.span(r),f={a0:d.a0+pt,a1:d.a1-pt,c0:d.c0+pt,c1:d.c1-pt},p=a.map(e=>e.map(e=>bt(o,e))),m=n.map(e=>yt(o.span(e),ut)),h=e=>(e.c0+e.c1)/2,g=e=>(e.a0+e.a1)/2,_=e=>gt.has(e.shape),v=e=>{for(let t of e)if(t.a<f.a0||t.a>f.a1||t.c<f.c0||t.c>f.c1)return!1;for(let t=1;t<e.length;t++){let n=e[t-1],r=e[t];if(n.a!==r.a&&n.c!==r.c||m.some(e=>vt(n,r,e))||vt(n,r,s)||vt(n,r,c)||p.some(e=>xt(n,r,e)))return!1}return!0},y=new Set([h(s),h(c),f.c0,f.c1]);for(let e of m)y.add(e.c0-1),y.add(e.c1+1);for(let e of[s,c])y.add(e.c0-ut),y.add(e.c1+ut);let b=(e,t,n)=>_(e)?n>=t.c0+4&&n<=t.c1-4:Math.abs(n-h(t))<.5,x=[];if(l){let n=(c.a0-s.a1)/2,r=s.a1+Math.min(ft,n),i=c.a0-Math.min(ft,n);for(let n of y){b(e,s,n)&&b(t,c,n)&&x.push([{a:s.a1,c:n},{a:c.a0,c:n}]),x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]),b(t,c,n)&&x.push([{a:s.a1,c:h(s)},{a:r,c:h(s)},{a:r,c:n},{a:c.a0,c:n}]),b(e,s,n)&&x.push([{a:s.a1,c:n},{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}]);let a=n>=s.c1?s.c1:n<=s.c0?s.c0:void 0;if(a!==void 0){let e=b(t,c,n)?[{a:c.a0,c:n}]:[{a:i,c:n},{a:i,c:h(c)},{a:c.a0,c:h(c)}];x.push([{a:g(s),c:a},{a:g(s),c:n},...e])}}}else for(let t of y){let n=t>=c.c1?c.c1:t<=c.c0?c.c0:void 0;if(n===void 0)continue;b(e,s,t)&&x.push([{a:s.a0,c:t},{a:g(c),c:t},{a:g(c),c:n}]);let r=n===c.c1?s.c1:s.c0;x.push([{a:g(s),c:r},{a:g(s),c:t},{a:g(c),c:t},{a:g(c),c:n}])}let S,C=1/0;for(let t of x){let n=St(t);if(n.length<2||!v(n))continue;let r=e.shape===`diamond`&&n[0].a===s.a1?ht:0,i=Ct(n)+mt*(n.length-2)+r;i<C&&(S=n,C=i)}return S?.map(o.toPoint)}function Tt(e){let t={x:e[0].x,y:e[0].y},n=-1;for(let r=1;r<e.length;r++){let i=e[r-1],a=e[r],o=Math.abs(a.x-i.x)+Math.abs(a.y-i.y);o>n&&(n=o,t={x:(i.x+a.x)/2,y:(i.y+a.y)/2})}return t}var Et=`__zm_spine__`,Dt=8,Ot=6,kt=12,At=4,jt=4,Mt=.25,Nt=.02,Pt=40,Ft=e=>e===`TD`||e===`TB`||e===`BT`,It=e=>e.startsWith(Et);function Lt(e){return e.flatMap(e=>[e,...Lt(e.children)])}function B(e){let t=new Set(e.nodeIds);for(let n of e.children)for(let e of B(n))t.add(e);return t}function Rt(e){if(e.subgraphs.length===0||fe(e)||Se(e.subgraphs))return!1;for(let t of e.nodes.keys())if(It(t))return!1;for(let t of e.edges)if(!e.nodes.has(t.source)||!e.nodes.has(t.target))return!1;let t=Lt(e.subgraphs);return!t.some(t=>e.nodes.has(t.id))&&t.every(t=>[...B(t)].some(t=>e.nodes.has(t)))}function zt(e,t){let n=Ft(t),r=e=>n?[e.y,e.y+e.height]:[e.x,e.x+e.width],i=[...e].sort((e,t)=>{let[n,i]=r(e),[a,o]=r(t);return(n+i)/2-(a+o)/2}),a=[];for(let e of i){let[t,n]=r(e),i=a[a.length-1];i&&t<i.end?(i.end=Math.min(i.end,n),i.ids.push(e.id)):a.push({end:n,ids:[e.id]})}(t===`BT`||t===`RL`)&&a.reverse();let o=new Map;return a.forEach((e,t)=>e.ids.forEach(e=>o.set(e,t))),o}function Bt(e,t,n){let r={ghosts:[],edges:[]};for(let i of e){let e=[...B(i)].filter(e=>t.has(e));if(e.length===0)continue;let a=e.map(e=>t.get(e)),o=Math.min(...a),s=Math.max(...a),c=new Map;for(let a=o;a<=s;a++){let o=e.filter(e=>t.get(e)===a).sort((e,t)=>n(e)-n(t));if(o.length>0)c.set(a,o[0]);else{let e=`${Et}${i.id}__${a}`;r.ghosts.push({id:e,subgraph:i.id}),c.set(a,e)}}for(let e=o;e<s;e++){let t=c.get(e),n=c.get(e+1);!It(t)&&!It(n)||r.edges.push({source:t,target:n,style:`invisible`,hasArrowStart:!1,hasArrowEnd:!1})}}return r}function Vt(e,t,n,r=()=>!1){let i=e=>{let n=[...B(e)].filter(e=>t.has(e)).map(e=>t.get(e));return n.length>0?[Math.min(...n),Math.max(...n)]:void 0},a=e=>{let t=[...B(e)].filter(e=>n.has(e)).map(e=>n.get(e));return t.reduce((e,t)=>e+t,0)/t.length},o=e.map(e=>({sg:e,at:i(e)})).filter(e=>!!e.at).sort((e,t)=>e.at[0]-t.at[0]),s=[],c=-1/0;for(let{sg:e,at:t}of o){let n=s[s.length-1];n&&t[0]<=c?(n.push(e),c=Math.max(c,t[1])):(s.push([e]),c=t[1])}for(let t of s){if(t.length<2||t.some((e,n)=>t.slice(n+1).some(t=>r(e,t))))continue;let i=[...t].sort((t,n)=>e.indexOf(n)-e.indexOf(t)),o=t.map(a).sort((e,t)=>e-t),s=i.map((e,t)=>o[t]-a(e));i.forEach((e,t)=>{for(let r of B(e))n.has(r)&&n.set(r,n.get(r)+s[t])})}for(let i of e)Vt(i.children,t,n,r)}function Ht(e,t,n,r,i){let a=new Map(t);for(let t of r){let r=B(t);for(let e of i.get(t.id)??[])r.add(e);let o=[...r].filter(e=>a.has(e)),s=o.filter(e=>n.has(e));if(s.length===0)continue;let c=Math.min(...s.map(e=>n.get(e))),l=Math.max(...s.map(e=>n.get(e))),u=o.map(e=>a.get(e)),d=Math.min(...u),f=Math.max(...u),p=(d+f)/2,m=0;for(let t of e){if(r.has(t)||It(t))continue;let e=n.get(t);if(e===void 0||e<c||e>l)continue;m++;let i=a.get(t);a.set(t,i<=p?Math.min(i,d)-1-m*.001:Math.max(i,f)+1+m*.001)}}let o=new Map(e.map((e,t)=>[e,t]));return[...e].sort((e,t)=>a.get(e)-a.get(t)||o.get(e)-o.get(t))}var Ut=(e,t)=>t>=Math.min(...e)&&t<=Math.max(...e);function Wt(e,t,n){let r=e=>{let i=e.children.map(r),a=[...[...B(e)].flatMap(e=>{let n=t.get(e);return n?[n]:[]}),...i],o=Math.min(...a.map(e=>e.x))-pe.left,s=Math.min(...a.map(e=>e.y))-pe.top,l=Math.max(...a.map(e=>e.x+e.width))+pe.right,u=Math.max(...a.map(e=>e.y+e.height))+pe.bottom,d=(0,c.measureMultilineText)(e.label,n.groupHeader,N.groupHeader).width+24;return{id:e.id,label:e.label,x:o,y:s,width:Math.max(l-o,d),height:u-s,children:i}};return e.map(r)}var Gt=e=>e.flatMap(e=>[e,...Gt(e.children)]);function Kt(e,t,n,r,i,a){let o=Ft(r),s=new Map(Lt(t).map(e=>[e.id,B(e)])),c=new Map,l=!1,u=[],d=e=>o?[e.x,e.x+e.width]:[e.y,e.y+e.height],f=e=>o?[e.y,e.y+e.height]:[e.x,e.x+e.width],p=([e,t],[n,r])=>Math.max(0,Math.min(t,r)-Math.max(e,n)),m=e=>({x:e.x-Pt,y:e.y-Pt,width:e.width+80,height:e.height+80}),h=(e,t)=>p(f(e),f(t))>0?p(d(e),d(t)):0,g=Gt(e),_=new Map(g.map(e=>[e,m(e)])),v=(e,t,n,r)=>{let i=p(d(e),d(t)),a=p(f(e),f(t));if(i<=0||a<=0)return;let s=i<=a,c=s===o,l=e=>c?e.x:e.y,m=e=>c?e.x+e.width:e.y+e.height,h=e=>(l(e)+m(e))/2,g=h(n)<=h(r)?n:r;u.push({axis:c?`x`:`y`,amount:s?i:a,after:m(g)})};for(let e of g){let t=s.get(e.id),r=[...t].filter(e=>a.has(e)).map(e=>a.get(e)),o=new Set(r);for(let[s,u]of n){if(t.has(s))continue;if(o.has(a.get(s))||!Ut(r,a.get(s))){v(_.get(e),u,e,u);continue}let n=h(_.get(e),u);n<=0||(i.has(e.id)?c.set(e.id,Math.max(c.get(e.id)??0,n)):l=!0)}}let y=(e,t)=>Gt(e.children).includes(t);for(let e=0;e<g.length;e++)for(let t=e+1;t<g.length;t++){let n=g[e],r=g[t];y(n,r)||y(r,n)||v(_.get(n),r,n,r)}return{penetration:c,stuck:l,requests:u}}function qt(e,t,n){let r=[...e.nodes.keys()],i={...e,subgraphs:[]},a=t(i),o=zt(a.nodes,e.direction),s=Ft(e.direction),c=new Map(a.nodes.map(e=>[e.id,e])),l=e=>{let t=c.get(e);return s?t.x:t.y},u=Lt(e.subgraphs),d=Bt(u,o,l),f=new Map;for(let e of d.ghosts)f.set(e.subgraph,[...f.get(e.subgraph)??[],e.id]);let p=new Map(a.nodes.map(e=>[e.id,l(e.id)]));Vt(e.subgraphs,o,p,(t,n)=>{let r=B(t),i=B(n),a=(t,n)=>e.edges.some(e=>t.has(e.source)&&n.has(e.target));return a(r,i)&&a(i,r)});for(let e of d.ghosts){let t=[...B(u.find(t=>t.id===e.subgraph))].filter(e=>p.has(e)).map(e=>p.get(e));p.set(e.id,t.reduce((e,t)=>e+t,0)/t.length)}let m=new Map(e.nodes);for(let e of d.ghosts)m.set(e.id,{id:e.id,label:` `,shape:`rectangle`});let h=Ht([...m.keys()],p,o,u,f),g={...i,nodes:new Map(h.map(e=>[e,m.get(e)])),edges:[...e.edges,...d.edges]},_=new Set(d.edges.map((t,n)=>e.edges.length+n)),v=i=>{let a=new Map,s=new Map;for(let c=0;;c++){let l=new Map(d.ghosts.map(e=>[e.id,Dt+(a.get(e.subgraph)??0)])),p=t(g,{fixedWidths:l,looseEdges:_,detachedEdges:i,walkOrder:r,forceNodeOrder:!0}),m=new Map(p.nodes.filter(e=>!It(e.id)).map(e=>[e.id,e])),h=Wt(e.subgraphs,m,n),v=Kt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o),{penetration:y,stuck:b}=v;if(b)return;if(y.size===0){for(let t=0;v.requests.length>0;t++){if(t===kt)return;Xt(v.requests.reduce((e,t)=>t.amount>e.amount?t:e),[...m.values()],p.edges),h=Wt(e.subgraphs,m,n),v=Kt(h,e.subgraphs,m,e.direction,new Set(f.keys()),o)}let t=Yt(e,i,m,h,u);return t&&Zt(p,[...m.values()],h,t)}if(c===Ot)return;for(let[e,t]of y){let n=a.get(e)??0,r=s.get(e),i=r?(r.overlap-t)/(n-r.width):0,o=i>Nt?i:Mt;s.set(e,{width:n,overlap:t}),a.set(e,n+t/o+jt)}}},y=Jt(e,d,o,u);return(y.size>0?v(y):void 0)??v(new Set)}function Jt(e,t,n,r){let i=r.map(e=>{let t=B(e);return{inside:t,layers:new Set([...t].filter(e=>n.has(e)).map(e=>n.get(e)))}}),a=e=>{let t=n.get(e.source),r=n.get(e.target);return t===void 0||r===void 0||e.source===e.target?!1:i.some(({inside:n,layers:i})=>n.has(e.source)&&n.has(e.target)&&Array.from({length:Math.max(0,Math.abs(r-t)-1)},(e,n)=>Math.min(t,r)+1+n).some(e=>!i.has(e)))},o=new Set;e.edges.forEach((e,t)=>{a(e)&&o.add(t)});let s=new Map,c=e=>{e.source!==e.target&&(s.set(e.source,(s.get(e.source)??0)+1),s.set(e.target,(s.get(e.target)??0)+1))};e.edges.forEach((e,t)=>{o.has(t)||c(e)}),t.edges.forEach(c);for(let t of[...o]){let n=e.edges[t];(!s.get(n.source)||!s.get(n.target))&&o.delete(t)}return o}function Yt(e,t,n,r,i){let a=new Map(Gt(r).map(e=>[e.id,e])),o=[];for(let r of t){let t=e.edges[r],s=n.get(t.source),c=n.get(t.target),l=i.filter(e=>{let n=B(e);return n.has(t.source)&&n.has(t.target)}).sort((e,t)=>B(e).size-B(t).size)[0],u=l&&a.get(l.id);if(!s||!c||!u)return;let d=wt(s,c,[...n.values()].filter(e=>e!==s&&e!==c),u,e.direction,o.map(e=>e.points));if(!d)return;o.push({source:t.source,target:t.target,label:t.label,style:t.style,hasArrowStart:t.hasArrowStart,hasArrowEnd:t.hasArrowEnd,points:d,labelPosition:t.label?Tt(d):void 0,inlineStyle:lt(r,e),id:t.id,animate:t.animate})}return o}function Xt(e,t,n){let{axis:r,amount:i,after:a}=e,o=i+At,s=t.filter(e=>e[r]>=a),c=Math.min(...s.map(e=>e[r]));for(let e of s)e[r]+=o;let l=e=>{e[r]>=c&&(e[r]+=o)};for(let e of n)e.points.forEach(l),e.labelPosition&&l(e.labelPosition)}function Zt(e,t,n,r){let i=[...e.edges.filter(e=>!It(e.source)&&!It(e.target)),...r],a=Gt(n),o=[...t.map(e=>e.x),...a.map(e=>e.x),...i.flatMap(e=>e.points.map(e=>e.x))],s=[...t.map(e=>e.y),...a.map(e=>e.y),...i.flatMap(e=>e.points.map(e=>e.y))],c=R.padding-Math.min(...o),l=R.padding-Math.min(...s);for(let e of t)e.x+=c,e.y+=l;for(let e of a)e.x+=c,e.y+=l;for(let e of i){for(let t of e.points)t.x+=c,t.y+=l;e.labelPosition&&(e.labelPosition.x+=c,e.labelPosition.y+=l)}let u=0,d=0;for(let e of t)u=Math.max(u,e.x+e.width+R.padding),d=Math.max(d,e.y+e.height+R.padding);for(let e of a)u=Math.max(u,e.x+e.width+R.padding),d=Math.max(d,e.y+e.height+R.padding);for(let e of i){for(let t of e.points)u=Math.max(u,t.x+L.width+R.padding),d=Math.max(d,t.y+L.width+R.padding);e.labelPosition&&(u=Math.max(u,e.labelPosition.x+60+R.padding),d=Math.max(d,e.labelPosition.y+20+R.padding))}return{...e,nodes:t,edges:i,groups:n,width:u,height:d}}function Qt(e,t={}){return $t(e,t)}function $t(e,t,n){let r={...R,...t,fontSizes:M(t.fontSizes)};return $e(w(De(e,r,n),t.layoutCache),e,r.mergeEdges)}function en(e,t={}){let n=(0,c.withoutOwnClusterEdges)(e);if(Rt(n)){let e=qt(n,(e,n)=>$t(e,t,n),M(t.fontSizes));if(e)return e}return Qt(n,t)}function tn(e,t={}){return De(e,{...R,...t,fontSizes:M(t.fontSizes)})}var nn=12,rn=2;function an(e){return e.flatMap(e=>[e,...an(e.children)])}function on(e,t){let n=t.groupHeader+16;return an(e).filter(e=>e.label!==``).map(e=>{let r=(0,c.measureMultilineText)(e.label,t.groupHeader,N.groupHeader);return{x:e.x+nn-rn,y:e.y+n/2-r.height/2-rn,width:r.width+4,height:r.height+4}})}function sn(e,t,n){let r=t.x-e.x,i=t.y-e.y,a=[-r,r,-i,i],o=[e.x-n.x,n.x+n.width-e.x,e.y-n.y,n.y+n.height-e.y],s=0,c=1;for(let e=0;e<4;e++){let t=a[e],n=o[e];if(t===0){if(n<0)return!1}else{let e=n/t;if(t<0?s=Math.max(s,e):c=Math.min(c,e),s>c)return!1}}return!0}function cn(e){return{x:e.x+rn,y:e.y+rn,width:e.width-4,height:e.height-4}}function ln(e,t){let n=e.points,r=t.map(cn);for(let e=0;e+1<n.length;e++)if(r.some(t=>sn(n[e],n[e+1],t)))return!0;return!1}function un(e){let t=2166136261;for(let n of e.map(e=>`${e.x},${e.y},${e.width},${e.height}`).join(`;`))t=Math.imul(t^n.charCodeAt(0),16777619);return(t>>>0).toString(36)}function dn(e,t,n){let r=`zm-title-gap-${un(e)}`;return{id:r,markup:` <mask id="${r}" maskUnits="userSpaceOnUse" x="0" y="0" width="${t}" height="${n}">\n <rect x="0" y="0" width="${t}" height="${n}" fill="#fff" />\n${e.map(e=>` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" fill="#000" />`).join(`
|
|
9
|
+
`)}\n </mask>`}}function fn(e,t,n=`Inter`,r=!1,i=j,a=`linear`,o,s=!0,l=!0,u,d,f={}){let p=[],m=l&&e.nodes.some(e=>!!(0,c.safeHref)(e.interaction?.href));p.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,u,d,m,f.styleAttribute),o)),p.push((0,c.buildStyleBlock)(n,!1,f.nonce)),s&&e.edges.some(e=>e.animate)&&p.push(pn(f.nonce)),p.push(`<defs>`),p.push(mn());let h=new Set;for(let t of e.edges)t.inlineStyle?.stroke&&h.add(t.inlineStyle.stroke);for(let e of h)p.push(hn(e));let g=on(e.groups,i),_=new Set(e.edges.filter(e=>ln(e,g))),v;if(_.size>0){let t=dn(g,e.width,e.height);v=t.id,p.push(t.markup)}p.push(`</defs>`);for(let t of e.groups)p.push(vn(t,n,i));for(let t of e.edges)p.push(yn(t,a,s,_.has(t)?v:void 0));for(let t of e.edges)t.label&&p.push(xn(t,n,i));for(let t of e.nodes)p.push(Tn(t,n,i,l));return p.push(`</svg>`),p.join(`
|
|
10
|
+
`)}function pn(e){return[(0,c.styleOpenTag)(e),` @keyframes zm-edge-dash { to { stroke-dashoffset: -28; } }`,` .edge-animated { animation: zm-edge-dash 1s linear infinite; }`,` @media (prefers-reduced-motion: reduce) {`,` .edge-animated { animation: none; }`,` }`,`</style>`].join(`
|
|
11
|
+
`)}function mn(){return gn(`var(--_arrow)`,``)}function hn(e){return gn((0,c.escapeAttr)(e),c.f`-${_n(e)}`)}function gn(e,t){let n=L.width,r=L.height,i=n-1,a=c.f`fill="${e}" stroke="${e}" stroke-width="0.75" stroke-linejoin="round"`,o=c.f`<polygon points="0 0, ${n} ${r/2}, 0 ${r}" ${a} />`,s=(e,t)=>c.f` <marker id="${e}" markerWidth="${n}" markerHeight="${r}" refX="${i}" refY="${r/2}" orient="${t}">`+c.f`\n ${o}`+`
|
|
5
12
|
</marker>`;return s(c.f`arrowhead${t}`,`auto`)+`
|
|
6
|
-
`+s(c.f`arrowhead-start${t}`,`auto-start-reverse`)}function
|
|
7
|
-
`)}function
|
|
8
|
-
`)}\n`+`</g>`}function
|
|
9
|
-
`)}function
|
|
10
|
-
`)}function
|
|
11
|
-
`)}function Zn(e,t,n,r,i,a,o){let s=[c.f`${e+n*.42},${t}`,c.f`${e+n},${t}`,c.f`${e+n*.62},${t+r*.42}`,c.f`${e+n},${t+r*.42}`,c.f`${e+n*.3},${t+r}`,c.f`${e+n*.5},${t+r*.55}`,c.f`${e},${t+r*.55}`].join(` `);return c.f`<polygon points="${s}" ${V(i,a,o)} />`}function Qn(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return c.f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function $n(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return c.f`<circle cx="${i}" cy="${a}" r="${o}" `+c.f`fill="none" stroke="var(--_text)" stroke-width="${N.innerBox*2}" />`+c.f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function er(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=(0,c.escapeAttr)(e.inlineStyle?.color??(0,c.getReadableTextColor)(e.inlineStyle?.fill,`var(--_text)`)),o=c.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${j.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=c.f` style="font-family: ${(0,c.escapeAttr)(s)};"`),(0,c.renderMultilineText)(e.label,r,i,n.nodeLabel,o)}function tr(e){return(0,c.escapeAttr)(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function nr(e,t){return t===void 0?e:e.replace(`<svg `,c.f`<svg data-src="${tr(t)}" `)}var rr=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=ur(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function ir(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function ar(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var or=`(?<![\\w-])(var|color-mix)\\(`;function sr(e,t){let[n,...r]=ar(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function cr(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function lr(e){let t=ar(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=cr(r),o=cr(i);if(!a||!o)return null;let s=(0,c.parseCssColor)(a.color),l=(0,c.parseCssColor)(o.color);if(!s||!l)return null;let u=(0,c.mixSrgb)(s,l,a.pct,o.pct);return u?(0,c.formatCssColor)(u):null}function ur(e,t){let n=``,r=0,i=new RegExp(or,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=ir(e,c);if(l===-1)break;let u=ur(e.slice(c+1,l),t),d=o===`var`?sr(u,t):lr(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function dr(e,t){let n=new rr;for(let[e,r]of Object.entries(t))n.declare(e,r);return ur(e,n)}var fr=/(--[\w-]+)\s*:\s*([^;{}]+)/g,pr=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,mr=new Set([`data-src`]);function hr(e,t){fr.lastIndex=0;let n;for(;(n=fr.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function gr(e,t){return e.replace(pr,(e,n,r,i,a)=>{if(mr.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${ur(a.slice(1,-1),t)}${o}`})}function _r(e,t){let n=new rr;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&hr(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&hr(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=ur(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:gr(s,n),i=a+1}return r+e.slice(i)}var H={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12};function vr(e){return`note ${e}`}function yr(e){return`${e} link`}function br(e){return`namespace ${e}`}function xr(e){let t=new Set(e.classes.map(e=>e.id)),n=new Set,r=[];for(let[i,a]of e.namespaces.entries()){let e=[];for(let r of a.classIds)!t.has(r)||n.has(r)||(n.add(r),e.push(r));e.length>0&&r.push({id:br(i),name:a.name,classIds:e})}return r}function Sr(e,t){let n=new Map,r=new Map,i=A(t.fontSizes);for(let t of e.classes){let e=t.annotation?H.headerBaseHeight+H.annotationHeight:H.headerBaseHeight,r=t.attributes.length>0?t.attributes.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,a=t.methods.length>0?t.methods.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,o=T(t.label,i.nodeLabel,j.nodeLabel),s=Er(t.attributes),c=Er(t.methods),l=Math.max(H.minWidth,o+H.boxPadX*2,s+H.boxPadX*2,c+H.boxPadX*2),u=e+r+a;n.set(t.id,{width:l,height:u,headerHeight:e,attrHeight:r,methodHeight:a})}let a=xr(e),o=new Map;for(let e of a)for(let t of e.classIds)o.set(t,e.id);let s=new Map,l=[];for(let e of a){let t=T(e.name,H.namespaceTitleFontSize,j.groupHeader)+H.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":re({top:H.namespaceTitleHeight+H.namespacePad/2,left:H.namespacePad,bottom:H.namespacePad,right:H.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};s.set(e.id,n),l.push(n)}for(let[e,t]of n){let n=ae(e,t),r=s.get(o.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:i.edgeLabel},d=[];for(let[t,n]of e.relationships.entries())d.push(R({id:`e${t}`,source:n.from,target:n.to,label:n.label,labelStyle:u}));let f=new Set(n.keys());for(let[t,n]of e.notes.entries()){let e=vr(t),a=(0,c.measureMultilineText)(n.text,i.edgeLabel,j.edgeLabel),o={width:a.width+H.notePadX*2,height:a.height+H.notePadY*2};r.set(e,o),l.push(ae(e,o)),n.forClass!==void 0&&f.has(n.forClass)&&d.push(R({id:yr(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...ie({direction:ne(void 0,te.class),nodeSpacing:H.nodeSpacing,layerSpacing:H.layerSpacing,padding:H.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`},children:l,edges:d},classSizes:n,noteSizes:r,namespaces:a}}function Cr(e,t,n,r,i){let a=new Map;for(let e of t.classes)a.set(e.id,e);let o=new Set(i.map(e=>e.id)),s=new Map,l=[];for(let t of e.children??[])if(o.has(t.id)){let e=t.x??0,n=t.y??0;s.set(t.id,{x:e,y:n});for(let r of t.children??[])l.push({...r,x:(r.x??0)+e,y:(r.y??0)+n})}else l.push(t);let u=e=>{let t=e.container;return t&&s.get(t)||{x:0,y:0}},d=[];for(let t of i){let n=(e.children??[]).find(e=>e.id===t.id);n&&d.push({name:t.name,classIds:t.classIds,x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0})}let f=[];for(let e of l){let r=a.get(e.id);if(r){let i=n.get(r.id);if(!i)throw Error(`Missing computed size for class "${r.id}"`);f.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e.x??0,y:e.y??0,width:e.width??i.width,height:e.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(r.id),inlineStyle:(0,c.resolveNodeStyle)(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=m[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=ze(t,r.x,r.y),a=Be(t,r.x,r.y);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:i,labelPosition:a})}let h=new Map;for(let e of m.slice(t.relationships.length))h.set(e.id,e);let g=new Map;for(let e of l)g.set(e.id,e);let _=[];for(let[e,n]of t.notes.entries()){let t=vr(e),i=g.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=h.get(yr(t));_.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:ze(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:_,namespaces:d}}function wr(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let{elkGraph:n,classSizes:r,noteSizes:i,namespaces:a}=Sr(e,t);return Cr(w(n,t.layoutCache),e,r,i,a)}function Tr(e){return e.length*Math.ceil(E(`M`,H.memberFontSize))}function Er(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=Tr((0,u.formatClassMember)(n));e>t&&(t=e)}return t}var Dr={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Or(e,t,n=`Inter`,r=!1,i=k,a,o,s,l=!0,u={}){let d=[],f=l&&e.classes.some(e=>!!(0,c.safeHref)(e.interaction?.href));d.push(nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,f,u.styleAttribute),a)),d.push((0,c.buildStyleBlock)(n,!0,u.nonce)),d.push(`<defs>`),d.push(Ar()),d.push(`</defs>`);for(let t of e.namespaces)d.push(kr(t));for(let t of e.relationships)d.push(Lr(t));for(let t of e.notes)d.push(Ir(t));for(let t of e.classes)d.push(jr(t,i,l));for(let t of e.notes)d.push(Fr(t,i));for(let t of e.relationships)d.push(Br(t,i));return d.push(`</svg>`),d.join(`
|
|
12
|
-
`)}function
|
|
13
|
-
`)}function
|
|
13
|
+
`+s(c.f`arrowhead-start${t}`,`auto-start-reverse`)}function _n(e){return e.replace(/[^a-zA-Z0-9]/g,e=>e.charCodeAt(0).toString(16))}function vn(e,t,n){let r=n.groupHeader+16,i=[];i.push(c.f`<g class="subgraph" data-id="${(0,c.escapeAttr)(e.id)}" data-label="${(0,c.escapeAttr)(e.label)}">`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),i.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${r}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),i.push(` `+(0,c.renderMultilineText)(e.label,e.x+12,e.y+r/2,n.groupHeader,c.f`font-size="${n.groupHeader}" font-weight="${N.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.children)i.push(vn(r,t,n));return i.push(`</g>`),i.join(`
|
|
14
|
+
`)}function yn(e,t,n=!0,r){if(e.points.length<2)return``;let i=n&&(e.animate??!1),a=t!==`linear`,o=e.style===`invisible`,s=e.style===`dotted`?` stroke-dasharray="4 4"`:``,l=e.style===`thick`?F.connector*2:F.connector,u=o?`none`:(0,c.escapeAttr)(e.inlineStyle?.stroke??`var(--_line)`),d=(0,c.escapeAttr)(e.inlineStyle?.[`stroke-width`]??String(l)),f=e.inlineStyle?.stroke?c.f`-${_n(e.inlineStyle.stroke)}`:``,p=``;o||(e.hasArrowEnd&&(p+=c.f` marker-end="url(#arrowhead${f})"`),e.hasArrowStart&&(p+=c.f` marker-start="url(#arrowhead-start${f})"`));let m=[c.f`class="edge${i?` edge-animated`:``}"`,c.f`data-from="${(0,c.escapeAttr)(e.source)}"`,c.f`data-to="${(0,c.escapeAttr)(e.target)}"`,c.f`data-style="${e.style}"`,c.f`data-arrow-start="${e.hasArrowStart}"`,c.f`data-arrow-end="${e.hasArrowEnd}"`];e.label&&m.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.id&&m.push(c.f`data-id="${(0,c.escapeAttr)(e.id)}"`);let h=i&&!s?` stroke-dasharray="8 6"`:``,g=a?c.f`d="${_(e.points,t)}"`:c.f`points="${bn(e.points)}"`;return c.f`<${a?`path`:`polyline`} ${m.join(` `)} ${g} `+c.f`fill="none" stroke="${u}" `+c.f`stroke-width="${d}"${s}${h}${p}`+(r?c.f` mask="url(#${r})"`:``)+` />`}function bn(e){return e.map(e=>c.f`${e.x},${e.y}`).join(` `)}function xn(e,t,n){if(!e.label)return``;let r=e.label,i=e.labelPosition??Cn(e.points),a=(0,c.measureMultilineText)(r,n.edgeLabel,N.edgeLabel),o=(0,c.renderMultilineTextWithBackground)(r,i.x,i.y,a.width,a.height,n.edgeLabel,8,c.f`text-anchor="middle" font-size="${n.edgeLabel}" font-weight="${N.edgeLabel}" fill="var(--_text-sec)"`,`rx="2" ry="2" fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="1"`);return c.f`<g class="edge-label" data-from="${(0,c.escapeAttr)(e.source)}" data-to="${(0,c.escapeAttr)(e.target)}" data-label="${(0,c.escapeAttr)(r)}">\n`+c.f` ${o.replace(/\n/g,`
|
|
15
|
+
`)}\n`+`</g>`}function Sn(e,t){let n=e[t];if(!n)throw Error(c.f`edgeMidpoint: missing point at index ${t}`);return n}function Cn(e){if(e.length===0)return{x:0,y:0};if(e.length===1)return e[0];let t=0;for(let n=1;n<e.length;n++)t+=wn(Sn(e,n-1),Sn(e,n));let n=t/2;for(let t=1;t<e.length;t++){let r=Sn(e,t-1),i=Sn(e,t),a=wn(r,i);if(n<=a){let e=n/a;return{x:r.x+e*(i.x-r.x),y:r.y+e*(i.y-r.y)}}n-=a}return e[e.length-1]}function wn(e,t){return Math.sqrt((t.x-e.x)**2+(t.y-e.y)**2)}function Tn(e,t,n,r=!0){let i=En(e),a=or(e,t,n),o=[],s=(0,c.sanitizeClassName)(e.className),l=s?c.f`node ${s}`:`node`,u=e.interaction,d=[c.f`class="${l}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`,c.f`data-shape="${e.shape}"`];o.push(c.f`<g ${d.join(` `)}>`);let f=r?(0,c.safeHref)(u?.href):void 0,p=f?` `:` `;if(f){let e=u?.target?c.f` target="${(0,c.escapeAttr)(u.target)}"`:``;o.push(c.f` <a href="${(0,c.escapeAttr)(f)}"${e}>`)}return r&&u?.tooltip&&o.push(c.f`${p}<title>${(0,c.escapeXml)(u.tooltip)}</title>`),o.push(c.f`${p}${i.replace(/\n/g,c.f`\n${p}`)}`),a&&o.push(c.f`${p}${a.replace(/\n/g,c.f`\n${p}`)}`),f&&o.push(` </a>`),o.push(`</g>`),o.join(`
|
|
16
|
+
`)}function En(e){let{x:t,y:n,width:r,height:i,shape:a,inlineStyle:o}=e,s=(0,c.escapeAttr)(o?.fill??`var(--_node-fill)`),l=(0,c.escapeAttr)(o?.stroke??`var(--_node-stroke)`),u=(0,c.escapeAttr)(o?.[`stroke-width`]??String(F.innerBox));switch(a){case`diamond`:return jn(t,n,r,i,s,l,u);case`rounded`:return On(t,n,r,i,s,l,u);case`stadium`:return kn(t,n,r,i,s,l,u);case`circle`:return An(t,n,r,i,s,l,u);case`subroutine`:return Mn(t,n,r,i,s,l,u);case`doublecircle`:return Nn(t,n,r,i,s,l,u);case`hexagon`:return Pn(t,n,r,i,s,l,u);case`cylinder`:return Fn(t,n,r,i,s,l,u);case`asymmetric`:return In(t,n,r,i,s,l,u);case`trapezoid`:return Ln(t,n,r,i,s,l,u);case`trapezoid-alt`:return Rn(t,n,r,i,s,l,u);case`parallelogram`:return zn(t,n,r,i,s,l,u);case`parallelogram-alt`:return Bn(t,n,r,i,s,l,u);case`state-start`:return ir(t,n,r,i);case`state-end`:return ar(t,n,r,i);case`document`:return Vn(t,n,r,i,s,l,u);case`stacked-document`:return Hn(t,n,r,i,s,l,u,!0);case`stacked-process`:return Hn(t,n,r,i,s,l,u,!1);case`card`:return Un(t,n,r,i,s,l,u);case`lined-process`:return Wn(t,n,r,i,s,l,u);case`divided-process`:return Gn(t,n,r,i,s,l,u);case`window-pane`:return Kn(t,n,r,i,s,l,u);case`triangle`:return qn(t,n,r,i,s,l,u,!1);case`flipped-triangle`:return qn(t,n,r,i,s,l,u,!0);case`filled-circle`:return Jn(t,n,r,i,l);case`crossed-circle`:return Yn(t,n,r,i,s,l,u);case`fork-join`:return Xn(t,n,r,i,l);case`notched-pentagon`:return Zn(t,n,r,i,s,l,u);case`sloped-rectangle`:return Qn(t,n,r,i,s,l,u);case`flag`:return $n(t,n,r,i,s,l,u);case`bow-tie-rectangle`:return er(t,n,r,i,s,l,u);case`half-rounded-rectangle`:return tr(t,n,r,i,s,l,u);case`brace`:return nr(t,n,r,i,s,l,u,`left`);case`brace-right`:return nr(t,n,r,i,s,l,u,`right`);case`braces`:return nr(t,n,r,i,s,l,u,`both`);case`bolt`:return rr(t,n,r,i,s,l,u);case`text`:case`anchor`:return``;default:return Dn(t,n,r,i,s,l,u)}}function Dn(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function On(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="6" ry="6" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function kn(e,t,n,r,i,a,o){let s=r/2;return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="${s}" ry="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function An(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function jn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=n/2,d=r/2,f=[c.f`${s},${l-d}`,c.f`${s+u},${l}`,c.f`${s},${l+d}`,c.f`${s-u},${l}`].join(` `);return c.f`<polygon points="${f}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Mn(e,t,n,r,i,a,o){return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" `+c.f`rx="0" ry="0" fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+8}" y1="${t}" x2="${e+8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n-8}" y1="${t}" x2="${e+n-8}" y2="${t+r}" `+c.f`stroke="${a}" stroke-width="${o}" />`}function Nn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2,d=u-5;return c.f`<circle cx="${s}" cy="${l}" r="${u}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<circle cx="${s}" cy="${l}" r="${d}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Pn(e,t,n,r,i,a,o){let s=r/4,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r/2}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Fn(e,t,n,r,i,a,o){let s=e+n/2,l=t+7,u=r-14;return c.f`<rect x="${e}" y="${l}" width="${n}" height="${u}" `+c.f`fill="${i}" stroke="none" />`+c.f`\n<line x1="${e}" y1="${l}" x2="${e}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<line x1="${e+n}" y1="${l}" x2="${e+n}" y2="${l+u}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${t+r-7}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`+c.f`\n<ellipse cx="${s}" cy="${l}" rx="${n/2}" ry="${7}" `+c.f`fill="${i}" stroke="${a}" stroke-width="${o}" />`}function In(e,t,n,r,i,a,o){let s=[c.f`${e+12},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e+12},${t+r}`,c.f`${e},${t+r/2}`].join(` `);return c.f`<polygon points="${s}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Ln(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Rn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function zn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n-s},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function Bn(e,t,n,r,i,a,o){let s=n*.15,l=[c.f`${e},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+r}`,c.f`${e+s},${t+r}`].join(` `);return c.f`<polygon points="${l}" fill="${i}" stroke="${a}" stroke-width="${o}" />`}function V(e,t,n){return c.f`fill="${e}" stroke="${t}" stroke-width="${n}"`}function Vn(e,t,n,r,i,a,o){let s=Math.min(10,r*.16),l=t+r-s,u=c.f`M ${e} ${t} L ${e+n} ${t} L ${e+n} ${l} `+c.f`C ${e+n*.75} ${l+s*1.8} ${e+n*.25} ${l-s*.8} ${e} ${l} Z`;return c.f`<path d="${u}" ${V(i,a,o)} />`}function Hn(e,t,n,r,i,a,o,s){let l=n-10,u=r-10,d=[];for(let n=2;n>=1;n--)d.push(c.f`<rect x="${e+5*n}" y="${t+5*(2-n)}" width="${l}" height="${u}" `+c.f`${V(i,a,o)} />`);return d.push(s?Vn(e,t+10,l,u,i,a,o):c.f`<rect x="${e}" y="${t+10}" width="${l}" height="${u}" ${V(i,a,o)} />`),d.join(`
|
|
17
|
+
`)}function Un(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function Wn(e,t,n,r,i,a,o){let s=Math.min(12,n*.12);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${e+s}" y1="${t}" x2="${e+s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />`}function Gn(e,t,n,r,i,a,o){let s=t+Math.min(16,r*.3);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${e}" y1="${s}" x2="${e+n}" y2="${s}" stroke="${a}" stroke-width="${o}" />`}function Kn(e,t,n,r,i,a,o){let s=e+Math.min(16,n*.16),l=t+Math.min(14,r*.28);return c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" ${V(i,a,o)} />\n`+c.f`<line x1="${s}" y1="${t}" x2="${s}" y2="${t+r}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${e}" y1="${l}" x2="${e+n}" y2="${l}" stroke="${a}" stroke-width="${o}" />`}function qn(e,t,n,r,i,a,o,s){let l=s?[c.f`${e},${t}`,c.f`${e+n},${t}`,c.f`${e+n/2},${t+r}`]:[c.f`${e+n/2},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`];return c.f`<polygon points="${l.join(` `)}" ${V(i,a,o)} />`}function Jn(e,t,n,r,i){let a=Math.min(n,r)/2-2;return c.f`<circle cx="${e+n/2}" cy="${t+r/2}" r="${a}" fill="${i}" stroke="${i}" />`}function Yn(e,t,n,r,i,a,o){let s=e+n/2,l=t+r/2,u=Math.min(n,r)/2-2,d=u/Math.SQRT2;return c.f`<circle cx="${s}" cy="${l}" r="${u}" ${V(i,a,o)} />\n`+c.f`<line x1="${s-d}" y1="${l-d}" x2="${s+d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />\n`+c.f`<line x1="${s+d}" y1="${l-d}" x2="${s-d}" y2="${l+d}" stroke="${a}" stroke-width="${o}" />`}function Xn(e,t,n,r,i){let a=Math.min(8,r);return c.f`<rect x="${e}" y="${t+(r-a)/2}" width="${n}" height="${a}" fill="${i}" stroke="${i}" />`}function Zn(e,t,n,r,i,a,o){let s=Math.min(14,n*.12,r*.3),l=[c.f`${e+s},${t}`,c.f`${e+n-s},${t}`,c.f`${e+n},${t+s}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`,c.f`${e},${t+s}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function Qn(e,t,n,r,i,a,o){let s=Math.min(12,r*.3),l=[c.f`${e},${t+s}`,c.f`${e+n},${t}`,c.f`${e+n},${t+r}`,c.f`${e},${t+r}`].join(` `);return c.f`<polygon points="${l}" ${V(i,a,o)} />`}function $n(e,t,n,r,i,a,o){let s=Math.min(8,r*.14),l=c.f`M ${e} ${t+s} `+c.f`C ${e+n*.25} ${t-s} ${e+n*.75} ${t+s*2} ${e+n} ${t+s} `+c.f`L ${e+n} ${t+r-s} `+c.f`C ${e+n*.75} ${t+r+s} ${e+n*.25} ${t+r-s*2} ${e} ${t+r-s} Z`;return c.f`<path d="${l}" ${V(i,a,o)} />`}function er(e,t,n,r,i,a,o){let s=Math.min(14,n*.12),l=c.f`M ${e+s} ${t} L ${e+n} ${t} `+c.f`Q ${e+n-s*1.4} ${t+r/2} ${e+n} ${t+r} `+c.f`L ${e+s} ${t+r} `+c.f`Q ${e+s*1.4} ${t+r/2} ${e+s} ${t} Z`;return c.f`<path d="${l}" ${V(i,a,o)} />`}function tr(e,t,n,r,i,a,o){let s=r/2,l=Math.max(0,n-s),u=c.f`M ${e} ${t} L ${e+l} ${t} `+c.f`A ${s} ${s} 0 0 1 ${e+l} ${t+r} `+c.f`L ${e} ${t+r} Z`;return c.f`<path d="${u}" ${V(i,a,o)} />`}function nr(e,t,n,r,i,a,o,s){let l=Math.min(10,n*.12),u=[c.f`<rect x="${e}" y="${t}" width="${n}" height="${r}" fill="none" stroke="none" />`],d=c.f`M ${e+l} ${t} Q ${e} ${t} ${e} ${t+r*.25} `+c.f`Q ${e} ${t+r/2} ${e-l*.4} ${t+r/2} `+c.f`Q ${e} ${t+r/2} ${e} ${t+r*.75} `+c.f`Q ${e} ${t+r} ${e+l} ${t+r}`,f=c.f`M ${e+n-l} ${t} Q ${e+n} ${t} ${e+n} ${t+r*.25} `+c.f`Q ${e+n} ${t+r/2} ${e+n+l*.4} ${t+r/2} `+c.f`Q ${e+n} ${t+r/2} ${e+n} ${t+r*.75} `+c.f`Q ${e+n} ${t+r} ${e+n-l} ${t+r}`;return(s===`left`||s===`both`)&&u.push(c.f`<path d="${d}" fill="none" stroke="${a}" stroke-width="${o}" />`),(s===`right`||s===`both`)&&u.push(c.f`<path d="${f}" fill="none" stroke="${a}" stroke-width="${o}" />`),u.join(`
|
|
18
|
+
`)}function rr(e,t,n,r,i,a,o){let s=[c.f`${e+n*.42},${t}`,c.f`${e+n},${t}`,c.f`${e+n*.62},${t+r*.42}`,c.f`${e+n},${t+r*.42}`,c.f`${e+n*.3},${t+r}`,c.f`${e+n*.5},${t+r*.55}`,c.f`${e},${t+r*.55}`].join(` `);return c.f`<polygon points="${s}" ${V(i,a,o)} />`}function ir(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2;return c.f`<circle cx="${i}" cy="${a}" r="${o}" fill="var(--_text)" stroke="none" />`}function ar(e,t,n,r){let i=e+n/2,a=t+r/2,o=Math.min(n,r)/2-2,s=o-4;return c.f`<circle cx="${i}" cy="${a}" r="${o}" `+c.f`fill="none" stroke="var(--_text)" stroke-width="${F.innerBox*2}" />`+c.f`\n<circle cx="${i}" cy="${a}" r="${s}" fill="var(--_text)" stroke="none" />`}function or(e,t,n){if((e.shape===`state-start`||e.shape===`state-end`)&&!e.label)return``;let r=e.x+e.width/2,i=e.y+e.height/2,a=(0,c.escapeAttr)(e.inlineStyle?.color??(0,c.getReadableTextColor)(e.inlineStyle?.fill,`var(--_text)`)),o=c.f`text-anchor="middle" font-size="${n.nodeLabel}" font-weight="${N.nodeLabel}" fill="${a}"`,s=e.inlineStyle?.[`font-family`];return s&&(o+=c.f` style="font-family: ${(0,c.escapeAttr)(s)};"`),(0,c.renderMultilineText)(e.label,r,i,n.nodeLabel,o)}function sr(e){return(0,c.escapeAttr)(e).replace(/\r/g,` `).replace(/\n/g,` `).replace(/\t/g,`	`)}function cr(e,t){return t===void 0?e:e.replace(`<svg `,c.f`<svg data-src="${sr(t)}" `)}var lr=class{raw=new Map;resolved=new Map;inProgress=new Set;declare(e,t){this.raw.set(e,t),this.resolved.delete(e)}lookup(e){if(this.resolved.has(e))return this.resolved.get(e);let t=this.raw.get(e);if(t===void 0||this.inProgress.has(e))return;this.inProgress.add(e);let n=gr(t,this).trim();this.inProgress.delete(e);let r=!/\bvar\(|\bcolor-mix\(/.test(n);return this.resolved.set(e,r?n:void 0),r?n:void 0}};function ur(e,t){let n=0;for(let r=t;r<e.length;r++){let t=e[r];if(t===`(`)n++;else if(t===`)`&&(n--,n===0))return r}return-1}function dr(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i)),r=i+1)}return t.push(e.slice(r)),t}var fr=`(?<![\\w-])(var|color-mix)\\(`;function pr(e,t){let[n,...r]=dr(e),i=(n??``).trim(),a=t.lookup(i);return a===void 0?r.length>0?r.join(`,`).trim():null:a}function mr(e){let t=e.trim().split(/\s+/),n,r;for(let e of t)if(/^[\d.]+%$/.test(e)){if(r!==void 0)return null;r=Number(e.slice(0,-1))}else{if(n!==void 0)return null;n=e}return n===void 0?null:{color:n,pct:r}}function hr(e){let t=dr(e);if(t.length!==3)return null;let[n,r,i]=t;if(n===void 0||r===void 0||i===void 0||!/^\s*in\s+srgb\s*$/i.test(n))return null;let a=mr(r),o=mr(i);if(!a||!o)return null;let s=(0,c.parseCssColor)(a.color),l=(0,c.parseCssColor)(o.color);if(!s||!l)return null;let u=(0,c.mixSrgb)(s,l,a.pct,o.pct);return u?(0,c.formatCssColor)(u):null}function gr(e,t){let n=``,r=0,i=new RegExp(fr,`g`),a;for(;(a=i.exec(e))!==null;){let o=a[1];if(o===void 0)continue;let s=a.index,c=s+o.length,l=ur(e,c);if(l===-1)break;let u=gr(e.slice(c+1,l),t),d=o===`var`?pr(u,t):hr(u);n+=e.slice(r,s),n+=d??`${o}(${u})`,r=l+1,i.lastIndex=r}return n+e.slice(r)}function _r(e,t){let n=new lr;for(let[e,r]of Object.entries(t))n.declare(e,r);return gr(e,n)}var vr=/(--[\w-]+)\s*:\s*([^;{}]+)/g,yr=/(\s)([\w:.-]+)(=)("[^"]*"|'[^']*')/g,br=new Set([`data-src`]);function xr(e,t){vr.lastIndex=0;let n;for(;(n=vr.exec(e))!==null;){let[,e,r]=n;e!==void 0&&r!==void 0&&t.declare(e,r.trim())}}function Sr(e,t){return e.replace(yr,(e,n,r,i,a)=>{if(br.has(r))return e;let o=a[0]??`"`;return`${n}${r}${i}${o}${gr(a.slice(1,-1),t)}${o}`})}function Cr(e,t){let n=new lr;n.declare(`--bg`,t.bg),n.declare(`--fg`,t.fg),t.line&&n.declare(`--line`,t.line),t.accent&&n.declare(`--accent`,t.accent),t.muted&&n.declare(`--muted`,t.muted),t.surface&&n.declare(`--surface`,t.surface),t.border&&n.declare(`--border`,t.border);for(let t of e.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/g)){let e=t[1];e!==void 0&&xr(e,n)}for(let t of e.matchAll(/\sstyle=("[^"]*"|'[^']*')/g)){let e=t[1];e!==void 0&&xr(e.slice(1,-1),n)}let r=``,i=0;for(;i<e.length;){let t=e.indexOf(`<`,i);if(t===-1)break;if(r+=e.slice(i,t),e.startsWith(`<style`,t)){let a=e.indexOf(`>`,t),o=e.indexOf(`</style>`,t);if(a===-1||o===-1)break;r+=e.slice(t,a+1),r+=gr(e.slice(a+1,o),n),r+=`</style>`,i=o+8;continue}let a=-1,o=null;for(let n=t+1;n<e.length;n++){let t=e[n];if(o!==null)t===o&&(o=null);else if(t===`"`||t===`'`)o=t;else if(t===`>`){a=n;break}}if(a===-1)break;let s=e.slice(t,a+1);r+=s.startsWith(`<!`)||s.startsWith(`<?`)||s.startsWith(`</`)?s:Sr(s,n),i=a+1}return r+e.slice(i)}var H={padding:40,boxPadX:8,headerBaseHeight:32,annotationHeight:16,memberRowHeight:20,sectionPadY:8,emptySectionHeight:8,minWidth:120,memberFontSize:11,memberFontWeight:400,nodeSpacing:40,layerSpacing:60,notePadX:10,notePadY:6,namespaceTitleHeight:28,namespacePad:16,namespaceTitleFontSize:12};function wr(e){return`note ${e}`}function Tr(e){return`${e} link`}function Er(e){return`namespace ${e}`}function Dr(e){let t=new Set(e.classes.map(e=>e.id)),n=new Set,r=[];for(let[i,a]of e.namespaces.entries()){let e=[];for(let r of a.classIds)!t.has(r)||n.has(r)||(n.add(r),e.push(r));e.length>0&&r.push({id:Er(i),name:a.name,classIds:e})}return r}function Or(e,t){let n=new Map,r=new Map,i=M(t.fontSizes);for(let t of e.classes){let e=t.annotation?H.headerBaseHeight+H.annotationHeight:H.headerBaseHeight,r=t.attributes.length>0?t.attributes.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,a=t.methods.length>0?t.methods.length*H.memberRowHeight+H.sectionPadY:H.emptySectionHeight,o=D(t.label,i.nodeLabel,N.nodeLabel),s=Mr(t.attributes),c=Mr(t.methods),l=Math.max(H.minWidth,o+H.boxPadX*2,s+H.boxPadX*2,c+H.boxPadX*2),u=e+r+a;n.set(t.id,{width:l,height:u,headerHeight:e,attrHeight:r,methodHeight:a})}let a=Dr(e),o=new Map;for(let e of a)for(let t of e.classIds)o.set(t,e.id);let s=new Map,l=[];for(let e of a){let t=D(e.name,H.namespaceTitleFontSize,N.groupHeader)+H.namespacePad*2,n={id:e.id,children:[],layoutOptions:{"elk.padding":ae({top:H.namespaceTitleHeight+H.namespacePad/2,left:H.namespacePad,bottom:H.namespacePad,right:H.namespacePad}),"elk.nodeSize.constraints":`MINIMUM_SIZE`,"elk.nodeSize.minimum":`(${Math.ceil(t)}, 0)`}};s.set(e.id,n),l.push(n)}for(let[e,t]of n){let n=se(e,t),r=s.get(o.get(e)??``);r?.children?r.children.push(n):l.push(n)}let u={fontSize:i.edgeLabel},d=[];for(let[t,n]of e.relationships.entries())d.push(z({id:`e${t}`,source:n.from,target:n.to,label:n.label,labelStyle:u}));let f=new Set(n.keys());for(let[t,n]of e.notes.entries()){let e=wr(t),a=(0,c.measureMultilineText)(n.text,i.edgeLabel,N.edgeLabel),o={width:a.width+H.notePadX*2,height:a.height+H.notePadY*2};r.set(e,o),l.push(se(e,o)),n.forClass!==void 0&&f.has(n.forClass)&&d.push(z({id:Tr(e),source:e,target:n.forClass,labelStyle:u}))}return{elkGraph:{id:`root`,layoutOptions:{...oe({direction:ie(void 0,re.class),nodeSpacing:H.nodeSpacing,layerSpacing:H.layerSpacing,padding:H.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.hierarchyHandling":`INCLUDE_CHILDREN`,"elk.separateConnectedComponents":`false`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`},children:l,edges:d},classSizes:n,noteSizes:r,namespaces:a}}function kr(e,t,n,r,i){let a=new Map;for(let e of t.classes)a.set(e.id,e);let o=new Set(i.map(e=>e.id)),s=new Map,l=[];for(let t of e.children??[])if(o.has(t.id)){let e=t.x??0,n=t.y??0;s.set(t.id,{x:e,y:n});for(let r of t.children??[])l.push({...r,x:(r.x??0)+e,y:(r.y??0)+n})}else l.push(t);let u=e=>{let t=e.container;return t&&s.get(t)||{x:0,y:0}},d=[];for(let t of i){let n=(e.children??[]).find(e=>e.id===t.id);n&&d.push({name:t.name,classIds:t.classIds,x:n.x??0,y:n.y??0,width:n.width??0,height:n.height??0})}let f=[];for(let e of l){let r=a.get(e.id);if(r){let i=n.get(r.id);if(!i)throw Error(`Missing computed size for class "${r.id}"`);f.push({id:r.id,label:r.label,annotation:r.annotation,attributes:r.attributes,methods:r.methods,x:e.x??0,y:e.y??0,width:e.width??i.width,height:e.height??i.height,headerHeight:i.headerHeight,attrHeight:i.attrHeight,methodHeight:i.methodHeight,interaction:t.interactions.get(r.id),inlineStyle:(0,c.resolveNodeStyle)(r.id,t),className:t.classAssignments.get(r.id)})}}let p=[],m=e.edges??[];for(let[e,n]of t.relationships.entries()){let t=m[e];if(!t)throw Error(`Missing ELK edge for relationship ${e}`);let r=u(t),i=Ue(t,r.x,r.y),a=We(t,r.x,r.y);p.push({from:n.from,to:n.to,type:n.type,markerAt:n.markerAt,label:n.label,fromCardinality:n.fromCardinality,toCardinality:n.toCardinality,points:i,labelPosition:a})}let h=new Map;for(let e of m.slice(t.relationships.length))h.set(e.id,e);let g=new Map;for(let e of l)g.set(e.id,e);let _=[];for(let[e,n]of t.notes.entries()){let t=wr(e),i=g.get(t),a=r.get(t);if(!i||!a)throw Error(`Missing layout for note ${e}`);let o=h.get(Tr(t));_.push({id:t,text:n.text,...o&&n.forClass!==void 0?{forClass:n.forClass}:{},x:i.x??0,y:i.y??0,width:i.width??a.width,height:i.height??a.height,...o?{linkPoints:Ue(o,u(o).x,u(o).y)}:{}})}return{width:e.width??600,height:e.height??400,classes:f,relationships:p,notes:_,namespaces:d}}function Ar(e,t={}){if(e.classes.length===0&&e.notes.length===0)return{width:0,height:0,classes:[],relationships:[],notes:[],namespaces:[]};let{elkGraph:n,classSizes:r,noteSizes:i,namespaces:a}=Or(e,t);return kr(w(n,t.layoutCache),e,r,i,a)}function jr(e){return e.length*Math.ceil(O(`M`,H.memberFontSize))}function Mr(e){if(e.length===0)return 0;let t=0;for(let n of e){let e=jr((0,u.formatClassMember)(n));e>t&&(t=e)}return t}var Nr={memberSize:11,memberWeight:400,annotationSize:10,annotationWeight:500};function Pr(e,t,n=`Inter`,r=!1,i=j,a,o,s,l=!0,u={}){let d=[],f=l&&e.classes.some(e=>!!(0,c.safeHref)(e.interaction?.href));d.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,f,u.styleAttribute),a)),d.push(te(n,!0,u.nonce)),d.push(`<defs>`),d.push(Ir()),d.push(`</defs>`);for(let t of e.namespaces)d.push(Fr(t));for(let t of e.relationships)d.push(Ur(t));for(let t of e.notes)d.push(Hr(t));for(let t of e.classes)d.push(Lr(t,i,l));for(let t of e.notes)d.push(Vr(t,i));for(let t of e.relationships)d.push(Kr(t,i));return d.push(`</svg>`),d.join(`
|
|
19
|
+
`)}function Fr(e){let{x:t,y:n,width:r,height:i}=e,a=H.namespaceTitleHeight,o=F.outerBox;return[c.f`<g class="class-namespace" data-id="${(0,c.escapeAttr)(e.name)}" data-label="${(0,c.escapeAttr)(e.name)}">`,c.f` <rect x="${t}" y="${n}" width="${r}" height="${i}" rx="0" ry="0" fill="var(--_group-fill)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,c.f` <rect x="${t}" y="${n}" width="${r}" height="${a}" rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${o}" />`,c.f` <text x="${t+H.namespacePad}" y="${n+a/2}" dy="${I}" font-size="${H.namespaceTitleFontSize}" font-weight="${N.groupHeader}" fill="var(--_text-sec)">${Yr(e.name)}</text>`,`</g>`].join(`
|
|
20
|
+
`)}function Ir(){return` <marker id="cls-inherit" markerWidth="12" markerHeight="10" refX="12" refY="5" orient="auto-start-reverse">
|
|
14
21
|
<polygon points="0 0, 12 5, 0 10" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="1.5" />
|
|
15
22
|
</marker>
|
|
16
23
|
<marker id="cls-composition" markerWidth="18" markerHeight="14" refX="16.5" refY="7" orient="auto-start-reverse">
|
|
@@ -21,30 +28,30 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
21
28
|
</marker>
|
|
22
29
|
<marker id="cls-arrow" markerWidth="8" markerHeight="6" refX="8" refY="3" orient="auto-start-reverse">
|
|
23
30
|
<polyline points="0 0, 8 3, 0 6" fill="none" stroke="var(--_arrow)" stroke-width="1.5" />
|
|
24
|
-
</marker>`}function
|
|
25
|
-
`)}var
|
|
26
|
-
</g>`}function
|
|
27
|
-
`)}function
|
|
28
|
-
`)}function
|
|
29
|
-
`))}return d.length===0&&f.push(c.f` <text x="${r+a/2}" y="${p+l/2}" text-anchor="middle" dy="${
|
|
30
|
-
`)}function
|
|
31
|
-
`);i.push(c.f`<g><title>${
|
|
32
|
-
`)}function
|
|
33
|
-
`)}function
|
|
34
|
-
`)}function
|
|
35
|
-
`)}function
|
|
31
|
+
</marker>`}function Lr(e,t,n=!0){let{x:r,y:i,width:a,height:o,headerHeight:s,attrHeight:l,inlineStyle:u}=e,d=[],f=e.interaction,p=(0,c.escapeAttr)(u?.fill??`var(--_node-fill)`),m=(0,c.escapeAttr)(u?.stroke??`var(--_node-stroke)`),h=(0,c.escapeAttr)(u?.[`stroke-width`]??String(F.outerBox)),g=u?.fill?p:`var(--_group-hdr)`,_=u?.color?(0,c.escapeAttr)(u.color):u?.fill?(0,c.escapeAttr)((0,c.getReadableTextColor)(u.fill,`var(--_text)`)):void 0,v=e.annotation?c.f` data-annotation="${(0,c.escapeAttr)(e.annotation)}"`:``,y=(0,c.sanitizeClassName)(e.className),b=[c.f`class="${y?c.f`class-node ${y}`:`class-node`}"`,c.f`data-id="${(0,c.escapeAttr)(e.id)}"`,c.f`data-label="${(0,c.escapeAttr)(e.label)}"`];d.push(c.f`<g ${b.join(` `)}${v}>`);let x=n?(0,c.safeHref)(f?.href):void 0;if(x){let e=f?.target?c.f` target="${(0,c.escapeAttr)(f.target)}"`:``;d.push(c.f` <a href="${(0,c.escapeAttr)(x)}"${e}>`)}n&&f?.tooltip&&d.push(c.f` <title>${Yr(f.tooltip)}</title>`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="${p}" stroke="${m}" stroke-width="${h}" />`),d.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="${g}" stroke="${m}" stroke-width="${h}" />`);let S=i+s/2;if(e.annotation){let t=i+12;d.push(c.f` <text x="${r+a/2}" y="${t}" text-anchor="middle" dy="${I}" `+c.f`font-size="${Nr.annotationSize}" font-weight="${Nr.annotationWeight}" `+c.f`font-style="italic" fill="${_??`var(--_text-muted)`}"><<${Yr(e.annotation)}>></text>`),S=i+s/2+6}d.push(` `+(0,c.renderMultilineText)(e.label,r+a/2,S,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="${_??`var(--_text)`}"`));let C=i+s;d.push(c.f` <line x1="${r}" y1="${C}" x2="${r+a}" y2="${C}" `+c.f`stroke="${m}" stroke-width="${F.innerBox}" />`);for(let t=0;t<e.attributes.length;t++){let n=e.attributes[t],i=C+4+t*20+10;d.push(` `+zr(n,r+H.boxPadX,i,_))}let w=C+l;d.push(c.f` <line x1="${r}" y1="${w}" x2="${r+a}" y2="${w}" `+c.f`stroke="${m}" stroke-width="${F.innerBox}" />`);for(let t=0;t<e.methods.length;t++){let n=e.methods[t],i=w+4+t*20+10;d.push(` `+zr(n,r+H.boxPadX,i,_))}return x&&d.push(` </a>`),d.push(`</g>`),d.join(`
|
|
32
|
+
`)}var Rr=700;function zr(e,t,n,r){let i=e.isAbstract?` font-style="italic"`:``,a=e.isStatic?` text-decoration="underline"`:``,o=r??`var(--_text-faint)`,s=r??`var(--_text-sec)`,l=r??`var(--_text-muted)`,u=[];e.visibility&&u.push(c.f`<tspan fill="${s}" font-weight="${Rr}">${Yr(e.visibility)}</tspan><tspan fill="${o}"> </tspan>`);let d=e.isMethod?c.f`${e.name}(${e.params||``})`:e.name;return u.push(c.f`<tspan fill="${s}">${Yr(d)}</tspan>`),e.type&&(u.push(c.f`<tspan fill="${o}">: </tspan>`),u.push(c.f`<tspan fill="${l}">${Yr(e.type)}</tspan>`)),c.f`<text x="${t}" y="${n}" class="mono" dy="${I}" `+c.f`font-size="${Nr.memberSize}" font-weight="${Nr.memberWeight}"${i}${a}>`+c.f`${u.join(``)}</text>`}var Br=6;function Vr(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`,s=[c.f`${n},${r}`,c.f`${n+i-Br},${r}`,c.f`${n+i},${r+Br}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `),l=c.f`${n+i-Br},${r} ${n+i},${r+Br} `+c.f`${n+i-Br},${r+Br}`;return c.f`<g class="class-note"${o}>`+c.f`\n <polygon points="${s}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
33
|
+
</g>`}function Hr(e){if(!e.linkPoints||e.linkPoints.length<2)return``;let t=e.linkPoints.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.forClass===void 0?``:c.f` data-for="${(0,c.escapeAttr)(e.forClass)}"`;return c.f`<polyline class="class-note-link"${n} points="${t}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${F.connector}" stroke-dasharray="2 3" />`}function Ur(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.type===`dependency`||e.type===`realization`?` stroke-dasharray="6 4"`:``,r=Wr(e.type,e.markerAt),i=[`class="class-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`,c.f`data-type="${e.type}"`,c.f`data-marker-at="${e.markerAt}"`];return e.label&&i.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.fromCardinality&&i.push(c.f`data-from-cardinality="${(0,c.escapeAttr)(e.fromCardinality)}"`),e.toCardinality&&i.push(c.f`data-to-cardinality="${(0,c.escapeAttr)(e.toCardinality)}"`),c.f`<polyline ${i.join(` `)} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${F.connector}"${n}${r} />`}function Wr(e,t){let n=Gr(e);return n?t===`from`?c.f` marker-start="url(#${n})"`:c.f` marker-end="url(#${n})"`:``}function Gr(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`;default:return null}}function Kr(e,t){if(!e.label&&!e.fromCardinality&&!e.toCardinality||e.points.length<2)return``;let n=[];if(e.label){let r=e.labelPosition??qr(e.points);n.push((0,c.renderMultilineText)(e.label,r.x,r.y-8,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`))}if(e.fromCardinality&&e.points.length>=2){let r=e.points[0],i=e.points[1],a=Jr(r,i);n.push((0,c.renderMultilineText)(e.fromCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`))}if(e.toCardinality&&e.points.length>=2){let r=e.points[e.points.length-1],i=e.points[e.points.length-2],a=Jr(r,i);n.push((0,c.renderMultilineText)(e.toCardinality,r.x+a.x,r.y+a.y,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`))}return n.join(`
|
|
34
|
+
`)}function qr(e){return e.length===0?{x:0,y:0}:e[Math.floor(e.length/2)]}function Jr(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 Yr=c.escapeXml,U={padding:40,boxPadX:14,headerHeight:34,rowHeight:22,minWidth:140,attrFontSize:11,attrFontWeight:400,nodeSpacing:70,layerSpacing:90};function Xr(e){return e.length*Math.ceil(O(`M`,U.attrFontSize))}function Zr(e,t){let n=new Map,r=M(t.fontSizes);for(let t of e.entities){let e=D(t.label,r.nodeLabel,N.nodeLabel),i=0;for(let e of t.attributes){let t=Xr(`${e.type} ${e.name}${e.keys.length>0?` `+e.keys.join(`,`):``}`);t>i&&(i=t)}let a=Math.max(U.minWidth,e+U.boxPadX*2,i+U.boxPadX*2),o=U.headerHeight+Math.max(t.attributes.length,1)*U.rowHeight;n.set(t.id,{width:a,height:o})}let i=[];for(let[e,t]of n)i.push(se(e,t));let a={fontSize:r.edgeLabel},o=[];for(let[t,n]of e.relationships.entries())o.push(z({id:`e${t}`,source:n.entity1,target:n.entity2,label:n.label,labelStyle:a}));return{elkGraph:{id:`root`,layoutOptions:{...oe({direction:ie(e.direction,re.er),nodeSpacing:U.nodeSpacing,layerSpacing:U.layerSpacing,padding:U.padding}),"elk.edgeLabels.placement":`CENTER`,"elk.layered.considerModelOrder.strategy":`NODES_AND_EDGES`,"elk.layered.nodePlacement.bk.fixedAlignment":`BALANCED`},children:i,edges:o},entitySizes:n}}function Qr(e,t,n){let r=new Map;for(let e of t.entities)r.set(e.id,e);let i=[];for(let t of e.children??[]){let e=r.get(t.id);if(e){let r=n.get(e.id);if(!r)throw Error(`Missing computed size for entity "${e.id}"`);i.push({id:e.id,label:e.label,attributes:e.attributes,x:t.x??0,y:t.y??0,width:t.width??r.width,height:t.height??r.height,headerHeight:U.headerHeight,rowHeight:U.rowHeight})}}let a=[];for(let[n,r]of(e.edges??[]).entries()){let e=t.relationships[n],i=Ue(r);a.push({entity1:e.entity1,entity2:e.entity2,cardinality1:e.cardinality1,cardinality2:e.cardinality2,label:e.label,identifying:e.identifying,points:i})}return{width:e.width??600,height:e.height??400,entities:i,relationships:a}}function $r(e,t={}){if(e.entities.length===0)return{width:0,height:0,entities:[],relationships:[]};let{elkGraph:n,entitySizes:r}=Zr(e,t);return Qr(w(n,t.layoutCache),e,r)}var ei=70,W={attrSize:11,attrWeight:400,keySize:9,keyWeight:600};function ti(e,t,n=`Inter`,r=!1,i=j,a,o,s,l={}){let u=[];u.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push(te(n,!0,l.nonce)),u.push(`<defs>`),u.push(`</defs>`);for(let t of e.relationships)u.push(ii(t));for(let t of e.entities)u.push(ni(t,i));for(let t of e.relationships)u.push(oi(t));for(let t of e.relationships)u.push(ai(t,i));return u.push(`</svg>`),u.join(`
|
|
35
|
+
`)}function ni(e,t){let{id:n,x:r,y:i,width:a,height:o,headerHeight:s,rowHeight:l,label:u,attributes:d}=e,f=[];f.push(c.f`<g class="entity" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(u)}">`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${o}" `+c.f`rx="0" ry="0" fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),f.push(c.f` <rect x="${r}" y="${i}" width="${a}" height="${s}" `+c.f`rx="0" ry="0" fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),f.push(` `+(0,c.renderMultilineText)(u,r+a/2,i+s/2,t.nodeLabel,c.f`text-anchor="middle" font-size="${t.nodeLabel}" font-weight="700" fill="var(--_text)"`));let p=i+s;f.push(c.f` <line x1="${r}" y1="${p}" x2="${r+a}" y2="${p}" `+c.f`stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`);for(let e=0;e<d.length;e++){let t=d[e],n=p+e*l+l/2;f.push(` `+ri(t,r,n,a).replace(/\n/g,`
|
|
36
|
+
`))}return d.length===0&&f.push(c.f` <text x="${r+a/2}" y="${p+l/2}" text-anchor="middle" dy="${I}" `+c.f`font-size="${W.attrSize}" fill="var(--_text-faint)" font-style="italic">(no attributes)</text>`),f.push(`</g>`),f.join(`
|
|
37
|
+
`)}function ri(e,t,n,r){let i=[],a=e.comment&&e.comment.length>0;if(e.comment&&e.comment.length>0){let t=e.comment.replace(/<br\s*\/?>/gi,`
|
|
38
|
+
`);i.push(c.f`<g><title>${li(t)}</title>`)}let o=0;e.keys.length>0&&(o=D(e.keys.join(`,`),W.keySize,W.keyWeight)+8,i.push(c.f`<rect x="${t+6}" y="${n-7}" width="${o}" height="14" rx="2" ry="2" `+`fill="var(--_key-badge)" />`),i.push(c.f`<text x="${t+6+o/2}" y="${n}" text-anchor="middle" dy="${I}" `+c.f`font-size="${W.keySize}" font-weight="${W.keyWeight}" fill="var(--_text-sec)">${e.keys.join(`,`)}</text>`));let s=t+8+(o>0?o+6:0);i.push(c.f`<text x="${s}" y="${n}" class="mono" dy="${I}" `+c.f`font-size="${W.attrSize}" font-weight="${W.attrWeight}">`+c.f`<tspan fill="var(--_text-muted)">${li(e.type)}</tspan></text>`);let l=t+r-8;return i.push(c.f`<text x="${l}" y="${n}" class="mono" text-anchor="end" dy="${I}" `+c.f`font-size="${W.attrSize}" font-weight="${W.attrWeight}">`+c.f`<tspan fill="var(--_text-sec)">${li(e.name)}</tspan></text>`),a&&i.push(`</g>`),i.join(`
|
|
39
|
+
`)}function ii(e){if(e.points.length<2)return``;let t=e.points.map(e=>c.f`${e.x},${e.y}`).join(` `),n=e.identifying?``:` stroke-dasharray="6 4"`,r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,i=[`class="er-relationship"`,c.f`data-entity1="${(0,c.escapeAttr)(e.entity1)}"`,c.f`data-entity2="${(0,c.escapeAttr)(e.entity2)}"`,c.f`data-cardinality1="${e.cardinality1}"`,c.f`data-cardinality2="${e.cardinality2}"`,c.f`data-identifying="${e.identifying}"`];return c.f`<polyline ${i.join(` `)}${r} points="${t}" fill="none" stroke="var(--_line)" `+c.f`stroke-width="${F.connector}"${n} />`}function ai(e,t){if(!e.label||e.points.length<2)return``;let n=ci(e.points),r=(0,c.measureMultilineText)(e.label,t.edgeLabel,N.edgeLabel),i=r.width+8,a=r.height+6;return c.f`<rect x="${n.x-i/2}" y="${n.y-a/2}" width="${i}" height="${a}" rx="2" ry="2" `+`fill="var(--bg)" stroke="var(--_inner-stroke)" stroke-width="0.5" />`+c.f`\n${(0,c.renderMultilineText)(e.label,n.x,n.y,t.edgeLabel,c.f`text-anchor="middle" font-size="${t.edgeLabel}" font-weight="${N.edgeLabel}" fill="color-mix(in srgb, var(--fg) ${ei}%, var(--bg))"`)}`}function oi(e){if(e.points.length<2)return``;let t=[],n=e.points[0],r=e.points[1];t.push(si(n,r,e.cardinality1));let i=e.points[e.points.length-1],a=e.points[e.points.length-2];return t.push(si(i,a,e.cardinality2)),t.join(`
|
|
40
|
+
`)}function si(e,t,n){let r=[],i=F.connector+.25,a=e.x-t.x,o=e.y-t.y,s=Math.sqrt(a*a+o*o);if(s===0)return``;let l=a/s,u=o/s,d=-u,f=l,p=e.x-l*4,m=e.y-u*4,h=e.x-l*16,g=e.y-u*16,_=n===`one`||n===`zero-one`,v=n===`many`||n===`zero-many`,y=n===`zero-one`||n===`zero-many`;if(_){r.push(c.f`<line x1="${p+d*6}" y1="${m+f*6}" `+c.f`x2="${p-d*6}" y2="${m-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`);let e=p-l*4,t=m-u*4;r.push(c.f`<line x1="${e+d*6}" y1="${t+f*6}" `+c.f`x2="${e-d*6}" y2="${t-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(v){let e=p,t=m;r.push(c.f`<line x1="${e+d*7}" y1="${t+f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e}" y1="${t}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`),r.push(c.f`<line x1="${e-d*7}" y1="${t-f*7}" `+c.f`x2="${h}" y2="${g}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(n===`many`){let t=e.x-l*20,n=e.y-u*20;r.push(c.f`<line x1="${t+d*6}" y1="${n+f*6}" `+c.f`x2="${t-d*6}" y2="${n-f*6}" `+c.f`stroke="var(--_line)" stroke-width="${i}" />`)}if(y){let t=v?20:12,n=e.x-l*t,a=e.y-u*t;r.push(c.f`<circle cx="${n}" cy="${a}" r="4" `+c.f`fill="var(--bg)" stroke="var(--_line)" stroke-width="${i}" />`)}return r.join(`
|
|
41
|
+
`)}function ci(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 li=c.escapeXml,ui={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 di(e){return e+8}var fi=14,pi=4;function mi(e,t,n){return 14+(0,c.measureMultilineText)(e,t,n).height/2}function hi(e){return{...ui,actorHeight:e?.actorHeight??ui.actorHeight,headerGap:e?.headerGap??ui.headerGap,messageRowHeight:e?.messageRowHeight??ui.messageRowHeight,noteOffsetAfterMessage:e?.noteOffsetAfterMessage??ui.noteOffsetAfterMessage,noteStackGap:e?.noteStackGap??ui.noteStackGap}}function gi(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=M(t.fontSizes),i=e.actors.map(e=>{let t=D(e.label,r.nodeLabel,N.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?di(r.edgeLabel):0),d=n.padding+u,f=e.actors.map((e,t)=>({id:e.id,label:e.label,type:e.type,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=>e.type===`actor`?mi(e.label,r.nodeLabel,N.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+pi+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,D(t.text,r.edgeLabel,N.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,w=[],T=n.activationWidth/2;function E(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*T;w.push({actorId:e,x:a[c]-n.activationWidth/2+l,topY:i,bottomY:t,width:n.activationWidth,depth:o})}let k=new Map;for(let t of e.activations){let e=k.get(t.afterIndex)??[];e.push(t),k.set(t.afterIndex,e)}function A(e,t){for(let n of k.get(e)??[])n.kind===`start`?E(n.actorId,t):O(n.actorId,t)}A(-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&&E(o.to,_),o.deactivate&&O(o.from,_),A(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,D(e.text,r.edgeLabel,N.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*T;w.push({actorId:e,x:a[t]-n.activationWidth/2+o,topY:r,bottomY:_-n.messageRowHeight/2,width:n.activationWidth,depth:i})}w.sort((e,t)=>e.depth-t.depth);let j=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=D(`[${e.label}]`,r.edgeLabel,N.edgeLabel),a=m+8,o=a+n,s=D(t.label,r.edgeLabel,N.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}}),ee=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 j)F=Math.min(F,e.x),I=Math.max(I,e.x+e.width);for(let e of ee)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=D(e.label,r.edgeLabel,N.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 w)e.x+=L;for(let e of j)e.x+=L;for(let e of ee)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 te=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]+pi: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 R=I+L+n.padding;return{width:Math.max(R,200),height:Math.max(P,100),actors:f,lifelines:te,messages:v,activations:w,blocks:j,notes:ee,boxes:p}}function _i(e,t,n=`Inter`,r=!1,i=j,a,o,s,l={}){let u=[];u.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),u.push(`<defs>`),u.push(vi()),u.push(`</defs>`);for(let t of e.boxes)u.push(Ii(t,i));for(let t of e.blocks)u.push(Li(t,i));let d=Oi(e,i);for(let t of e.lifelines)u.push(Ai(t,d));for(let t of e.activations)u.push(Mi(t));for(let t of e.messages)u.push(Ni(t,i));for(let t of e.notes)u.push(Ri(t,i));for(let t of e.actors)u.push(yi(t,i));return u.push(`</svg>`),u.join(`
|
|
42
|
+
`)}function vi(){let e=L.width,t=L.height;return c.f` <marker id="seq-arrow" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+c.f`\n <polygon points="0 0, ${e} ${t/2}, 0 ${t}" fill="var(--_arrow)" />`+`
|
|
36
43
|
</marker>`+c.f`\n <marker id="seq-arrow-open" markerWidth="${e}" markerHeight="${t}" refX="${e}" refY="${t/2}" orient="auto-start-reverse">`+c.f`\n <polyline points="0 0, ${e} ${t/2}, 0 ${t}" fill="none" stroke="var(--_arrow)" stroke-width="1" />`+`
|
|
37
|
-
</marker>`}function
|
|
38
|
-
</g>`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o+14,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${
|
|
39
|
-
`)}var
|
|
40
|
-
`)[0]??``,t.edgeLabel,
|
|
41
|
-
`);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=
|
|
42
|
-
`)}function
|
|
43
|
-
`)}function
|
|
44
|
-
`)[0],o=
|
|
45
|
-
`)}function
|
|
46
|
-
</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 Ni(e,t={}){return e.horizontal?Fi(e):Pi(e)}function Pi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Ui(a.min,a.max),s=Wi(o),c=Math.max(...s.map(e=>T(e,G.axisLabelFontSize,G.axisLabelFontWeight)),G.yLabelWidth),l=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),u=G.padding+G.xLabelHeight+(n?G.axisTitlePad:0),d=G.padding+c+G.yLabelGap+(r?G.axisTitlePad:0),f=G.padding,p=G.plotWidth,m=G.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=Ii(e),y=e=>d+(e+.5)*(p/v),b=p/v,x=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},S=Bi(e,y,l+m,b),C=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-G.tickLength,ty:x(e),labelX:d-G.yLabelGap,labelY:x(e),textAnchor:`end`})),w=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),E=Li(e,v),D=e.series.map((e,t)=>t),O=Vi(e,y,x,b,a.min,E,D),k=Hi(e,y,x,E,D),A=G.padding+(t?G.titleHeight:0)+G.legendHeight/2,j=i?Ki(e,h/2,A,D):[],ee={x1:d,y1:l+m,x2:d+p,y2:l+m},M={x1:d,y1:l,x2:d,y2:l+m},N={ticks:S,line:ee,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-G.padding}}:{}},P={ticks:C,line:M,...e.yAxis.title?{title:{text:e.yAxis.title,x:G.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:G.padding+G.titleFontSize}:void 0,xAxis:N,yAxis:P,plotArea:_,bars:O,lines:k,gridLines:w,legend:j}}function Fi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Ui(a.min,a.max),s=Wi(o),c=Ii(e),l=Li(e,c),u=Math.max(...l.map(e=>T(e,G.axisLabelFontSize,G.axisLabelFontWeight)),40),d=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),f=G.padding+G.xLabelHeight+(r?G.axisTitlePad:0),p=G.padding+u+G.yLabelGap+(n?G.axisTitlePad:0),m=G.padding,h=G.plotWidth,g=G.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>{let t=(e-a.min)/(a.max-a.min||1);return p+t*h},x=g/c,S=e=>d+(e+.5)*x,C=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+G.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),w=l.map((e,t)=>({label:e,x:p,y:S(t),tx:p-G.tickLength,ty:S(t),labelX:p-G.yLabelGap,labelY:S(t),textAnchor:`end`})),E=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),D=e.series.map((e,t)=>t),O=e.series.filter(e=>e.type===`bar`).length,k=[];if(O>0){let t=x*(1-G.barPadRatio),n=O>1?(t-(O-1)*G.barGroupGap)/O:t,r=Math.min(n,G.maxBarWidth),i=O>1?r*O+G.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=S(e)-i/2+o*(r+G.barGroupGap),c=b(Math.max(t.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:n,width:Math.abs(c-u),height:r,value:t.data[e],label:l[e],seriesIndex:o,colorIndex:D[s]})}o++,s++}}let A=[],j=0,ee=0;for(let t of e.series){if(t.type!==`line`){ee++;continue}let e=t.data.map((e,t)=>({x:b(e),y:S(t),value:e,label:l[t]}));A.push({points:e,seriesIndex:j,colorIndex:D[ee]}),j++,ee++}let M={x1:p,y1:d+g,x2:p+h,y2:d+g},N={x1:p,y1:d,x2:p,y2:d+g},P={ticks:C,line:M,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-G.padding}}:{}},F={ticks:w,line:N,...e.xAxis.title?{title:{text:e.xAxis.title,x:G.padding+4,y:d+g/2,rotate:-90}}:{}},I=e.title?{text:e.title,x:_/2,y:G.padding+G.titleFontSize}:void 0,L=G.padding+(t?G.titleHeight:0)+G.legendHeight/2;return{width:_,height:v,horizontal:!0,title:I,xAxis:P,yAxis:F,plotArea:y,bars:k,lines:A,gridLines:E,legend:i?Ki(e,_/2,L,D):[]}}function Ii(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 Li(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)=>Gi(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Ri=8;function zi(e,t){let n=e.map(e=>T(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<Ri){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Bi(e,t,n,r){let i=Li(e,Ii(e)),a=zi(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 Vi(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 Hi(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 Ui(e,t){let n=t-e;if(n<=0)return[e];let r=n/6,i=10**Math.floor(Math.log10(r)),a=r/i,o;o=a<=1.5?i:a<=3?2*i:a<=7?5*i:10*i;let s=Math.ceil(e/o)*o,c=[];for(let e=s;e<=t+o*.001;e+=o)c.push(Math.round(e*1e10)/1e10);return c}function Wi(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 Gi(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Ki(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=T(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 qi(e,t,n=`Inter`,r=!1,i=!1,a,o,s,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=nr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute).replace(`<svg `,`<svg data-xychart-colors="${d}" `),a);u.push(f),u.push((0,c.buildStyleBlock)(n,!1,l.nonce));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=Ji(e,i,m,t.accent,t.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=e,v=e.xAxis.ticks.map(e=>e.x),y=e.horizontal?e.yAxis.ticks.map(e=>e.y):e.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${J(t)}" cy="${J(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,r=e.horizontal?Xi(t.x,t.y,t.width,t.height,K.barRadius):Yi(t.x,t.y,t.width,t.height,K.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),i){let e=ea(t.value),n=t.label?`${t.label}: ${e}`:e,r=$i(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${J(t.x)}" y="${J(t.y)}" width="${J(t.width)}" height="${J(t.height)}" fill="transparent"/><title>${Y(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=Zi(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(i||m){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=J(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(i&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.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=e.map(e=>({text:ea(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=Qi(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 t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;f+=`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${Y(d)}</title>${l}</g>`,k.push(f)}else if(i){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,i=ea(t.value),a=t.label?`${t.label}: ${i}`:i,o=$i(n,t.y-K.dotRadius,i),s=m?`<circle cx="${J(n)}" cy="${J(t.y)}" r="${K.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${Y(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;u.push(`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${P}" class="xychart-axis-title">${Y(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${P}" class="xychart-axis-title">${Y(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${K.titleSize}" font-weight="${K.titleWeight}" dy="${P}" class="xychart-title">${Y(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${K.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${K.legendSize}" font-weight="${K.legendWeight}" dy="${P}" class="xychart-label">${Y(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
47
|
-
`)}function
|
|
44
|
+
</marker>`}function yi(e,t){let{id:n,x:r,y:i,width:a,height:o,label:s,type:l}=e,u=[];if(u.push(c.f`<g class="actor" data-id="${(0,c.escapeAttr)(n)}" data-label="${(0,c.escapeAttr)(s)}" data-type="${l}">`),l===`actor`){let e=o/24*.9,n=r-12*e,a=i+(o-24*e)/2,l=F.outerBox/e,d=`var(--_line)`;u.push(c.f` <g transform="translate(${n},${a}) scale(${e})">`+c.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="${d}" stroke-width="${l}" />`+c.f`\n <path d="M15 10C15 11.6569 13.6569 13 12 13C10.3431 13 9 11.6569 9 10C9 8.34315 10.3431 7 12 7C13.6569 7 15 8.34315 15 10Z" fill="none" stroke="${d}" stroke-width="${l}" />`+c.f`\n <path d="M5.62842 18.3563C7.08963 17.0398 9.39997 16 12 16C14.6 16 16.9104 17.0398 18.3716 18.3563" fill="none" stroke="${d}" stroke-width="${l}" />`+`
|
|
45
|
+
</g>`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o+14,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${N.nodeLabel}" fill="var(--_text)"`))}else{let e=r-a/2;u.push(c.f` <rect x="${e}" y="${i}" width="${a}" height="${o}" rx="4" ry="4" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),u.push(` `+(0,c.renderMultilineText)(s,r,i+o/2,t.nodeLabel,c.f`font-size="${t.nodeLabel}" text-anchor="middle" font-weight="${N.nodeLabel}" fill="var(--_text)"`))}return u.push(`</g>`),u.join(`
|
|
46
|
+
`)}var bi=30,xi=20,Si=8,Ci=10,wi=18,Ti=3,Ei=2,Di=3;function Oi(e,t){let n=[],r=e=>(0,c.measureMultilineText)(e,t.edgeLabel,N.edgeLabel),i=(e,t,i)=>{let a=r(e);n.push({x0:t-a.width/2,x1:t+a.width/2,y0:i-a.height/2,y1:i+a.height/2})},a=(e,t,i)=>{let a=r(e);n.push({x0:t,x1:t+a.width,y0:i-a.height/2,y1:i+a.height/2})};for(let t of e.messages)t.label&&(t.isSelf?a(t.label,t.x1+bi+Si,t.y+xi/2):i(t.label,(t.x1+t.x2)/2,t.y-Ci));for(let r of e.blocks){let e=D(`${r.type}${r.label?` [${r.label}]`:``}`.split(`
|
|
47
|
+
`)[0]??``,t.edgeLabel,N.groupHeader)+16;n.push({x0:r.x,x1:r.x+e,y0:r.y,y1:r.y+wi});for(let e of r.dividers)e.label&&a(`[${e.label}]`,r.x+8,e.y+14)}return n}function ki(e,t){let n=t.filter(t=>e.x>t.x0-Ti&&e.x<t.x1+Ti&&t.y1+Ei>e.topY&&t.y0-Ei<e.bottomY).map(e=>[e.y0-Ei,e.y1+Ei]).sort((e,t)=>e[0]-t[0]),r=[],i=e.topY;for(let[e,t]of n)e-i>=Di&&r.push([i,e]),i=Math.max(i,t);return e.bottomY-i>=Di&&r.push([i,e.bottomY]),r.length>0?r:[[e.topY,e.bottomY]]}function Ai(e,t){let n=ki(e,t).map(([t,n])=>c.f`<line class="lifeline" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x1="${e.x}" y1="${t}" x2="${e.x}" y2="${n}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`).join(`
|
|
48
|
+
`);if(!e.destroyed)return n;let{x:r,bottomY:i}=e,a=ji;return n+c.f`\n<path class="destroy" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`d="M${r-a} ${i-a} L${r+a} ${i+a} M${r+a} ${i-a} L${r-a} ${i+a}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${F.outerBox}" stroke-linecap="round" />`}var ji=8;function Mi(e){return c.f`<rect class="activation" data-actor="${(0,c.escapeAttr)(e.actorId)}" `+c.f`x="${e.x}" y="${e.topY}" width="${e.width}" height="${e.bottomY-e.topY}" `+c.f`fill="var(--_node-fill)" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`}function Ni(e,t){let n=[],r=e.lineStyle===`dashed`?` stroke-dasharray="6 4"`:``,i=e.arrowHead===`filled`?`seq-arrow`:`seq-arrow-open`,a=e.bidirectional?c.f` marker-start="url(#${i})"`:``;if(n.push(c.f`<g class="message" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}" `+c.f`data-label="${(0,c.escapeAttr)(e.label)}" data-line-style="${e.lineStyle}" `+c.f`data-arrow-head="${e.arrowHead}" data-self="${e.isSelf}" data-bidirectional="${e.bidirectional}">`),e.isSelf){let o=bi,s=xi,l=Si;n.push(c.f` <polyline points="${e.x1},${e.y} ${e.x1+o},${e.y} ${e.x1+o},${e.y+s} ${e.x2},${e.y+s}" `+c.f`fill="none" stroke="var(--_line)" stroke-width="${F.connector}"${r} marker-end="url(#${i})"${a} />`),n.push(` `+(0,c.renderMultilineText)(e.label,e.x1+o+l,e.y+s/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`))}else{n.push(c.f` <line x1="${e.x1}" y1="${e.y}" x2="${e.x2}" y2="${e.y}" `+c.f`stroke="var(--_line)" stroke-width="${F.connector}"${r} marker-end="url(#${i})"${a} />`);let o=(e.x1+e.x2)/2;n.push(` `+(0,c.renderMultilineText)(e.label,o,e.y-Ci,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`))}return e.seqNumber!==void 0&&n.push(` `+Pi(e,t)),n.push(`</g>`),n.join(`
|
|
49
|
+
`)}function Pi(e,t){let n=Math.max(t.edgeLabel-2,8),r=e.bidirectional?e.x1+Math.sign(e.x2-e.x1)*(8+L.width):e.x1;return`<g class="seq-number">`+c.f`<circle cx="${r}" cy="${e.y}" r="${8}" fill="var(--bg)" stroke="var(--_arrow)" stroke-width="${F.innerBox}" />`+(0,c.renderMultilineText)(String(e.seqNumber),r,e.y,n,c.f`font-size="${n}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_arrow)"`)+`</g>`}var Fi=35;function Ii(e,t){let n=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``,r=e.color===void 0?``:c.f` data-color="${(0,c.escapeAttr)(e.color)}"`,i=e.color===void 0?`none`:c.f`color-mix(in srgb, ${(0,c.escapeAttr)(e.color)} ${Fi}%, var(--bg))`,a=[c.f`<g class="participant-box"${n}${r}>`,c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="4" ry="4" `+c.f`fill="${i}" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`];return e.label&&a.push(` `+(0,c.renderMultilineText)(e.label,e.x+e.width/2,e.y+di(t.edgeLabel)/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.groupHeader}" fill="var(--_text-sec)"`)),a.push(`</g>`),a.join(`
|
|
50
|
+
`)}function Li(e,t){let n=[],r=e.label?c.f` data-label="${(0,c.escapeAttr)(e.label)}"`:``;n.push(c.f`<g class="block" data-type="${(0,c.escapeAttr)(e.type)}"${r}>`),n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" `+c.f`rx="0" ry="0" fill="none" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`);let i=c.f`${e.type}${e.label?c.f` [${e.label}]`:``}`,a=i.split(`
|
|
51
|
+
`)[0],o=D(a,t.edgeLabel,N.groupHeader)+16,s=wi;n.push(c.f` <rect x="${e.x}" y="${e.y}" width="${o}" height="${s}" `+c.f`fill="var(--_group-hdr)" stroke="var(--_node-stroke)" stroke-width="${F.outerBox}" />`),n.push(` `+(0,c.renderMultilineText)(i,e.x+6,e.y+s/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" font-weight="${N.groupHeader}" fill="var(--_text-sec)"`));for(let r of e.dividers)n.push(c.f` <line x1="${e.x}" y1="${r.y}" x2="${e.x+e.width}" y2="${r.y}" `+`stroke="var(--_line)" stroke-width="0.75" stroke-dasharray="6 4" />`),r.label&&n.push(` `+(0,c.renderMultilineText)(c.f`[${r.label}]`,e.x+8,r.y+14,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="start" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`));return n.push(`</g>`),n.join(`
|
|
52
|
+
`)}function Ri(e,t){let{x:n,y:r,width:i,height:a}=e,o=e.actors&&e.actors.length>0?c.f` data-actors="${e.actors.map(c.escapeAttr).join(`,`)}"`:``,s=e.position?c.f` data-position="${(0,c.escapeAttr)(e.position)}"`:``,l=[c.f`${n},${r}`,c.f`${n+i-6},${r}`,c.f`${n+i},${r+6}`,c.f`${n+i},${r+a}`,c.f`${n},${r+a}`].join(` `);return c.f`<g class="note"${s}${o}>`+c.f`\n <polygon points="${l}" `+c.f`fill="var(--bg)" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`+c.f`\n <polygon points="${n+i-6},${r} ${n+i},${r+6} ${n+i-6},${r+6}" `+c.f`fill="var(--_inner-stroke)" stroke="var(--_node-stroke)" stroke-width="${F.innerBox}" />`+c.f`\n ${(0,c.renderMultilineText)(e.text,n+i/2,r+a/2,t.edgeLabel,c.f`font-size="${t.edgeLabel}" text-anchor="middle" font-weight="${N.edgeLabel}" fill="var(--_text-muted)"`)}`+`
|
|
53
|
+
</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 zi(e,t={}){return e.horizontal?Vi(e):Bi(e)}function Bi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Yi(a.min,a.max),s=Xi(o),c=Math.max(...s.map(e=>D(e,G.axisLabelFontSize,G.axisLabelFontWeight)),G.yLabelWidth),l=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),u=G.padding+G.xLabelHeight+(n?G.axisTitlePad:0),d=G.padding+c+G.yLabelGap+(r?G.axisTitlePad:0),f=G.padding,p=G.plotWidth,m=G.plotHeight,h=d+p+f,g=l+m+u,_={x:d,y:l,width:p,height:m},v=Hi(e),y=e=>d+(e+.5)*(p/v),b=p/v,x=e=>{let t=(e-a.min)/(a.max-a.min||1);return l+m-t*m},S=Ki(e,y,l+m,b),C=o.map((e,t)=>({label:s[t],x:d,y:x(e),tx:d-G.tickLength,ty:x(e),labelX:d-G.yLabelGap,labelY:x(e),textAnchor:`end`})),w=o.map(e=>({x1:d,y1:x(e),x2:d+p,y2:x(e)})),T=Ui(e,v),E=e.series.map((e,t)=>t),O=qi(e,y,x,b,a.min,T,E),k=Ji(e,y,x,T,E),A=G.padding+(t?G.titleHeight:0)+G.legendHeight/2,j=i?Qi(e,h/2,A,E):[],M={x1:d,y1:l+m,x2:d+p,y2:l+m},N={x1:d,y1:l,x2:d,y2:l+m},ee={ticks:S,line:M,...e.xAxis.title?{title:{text:e.xAxis.title,x:d+p/2,y:g-G.padding}}:{}},P={ticks:C,line:N,...e.yAxis.title?{title:{text:e.yAxis.title,x:G.padding+4,y:l+m/2,rotate:-90}}:{}};return{width:h,height:g,title:e.title?{text:e.title,x:h/2,y:G.padding+G.titleFontSize}:void 0,xAxis:ee,yAxis:P,plotArea:_,bars:O,lines:k,gridLines:w,legend:j}}function Vi(e){let t=!!e.title,n=!!e.xAxis.title,r=!!e.yAxis.title,i=e.series.length>1,a=e.yAxis.range;if(!a)throw Error(`XY chart: y-axis range was not set by the parser`);let o=Yi(a.min,a.max),s=Xi(o),c=Hi(e),l=Ui(e,c),u=Math.max(...l.map(e=>D(e,G.axisLabelFontSize,G.axisLabelFontWeight)),40),d=G.padding+(t?G.titleHeight:0)+(i?G.legendHeight:0),f=G.padding+G.xLabelHeight+(r?G.axisTitlePad:0),p=G.padding+u+G.yLabelGap+(n?G.axisTitlePad:0),m=G.padding,h=G.plotWidth,g=G.plotHeight,_=p+h+m,v=d+g+f,y={x:p,y:d,width:h,height:g},b=e=>{let t=(e-a.min)/(a.max-a.min||1);return p+t*h},x=g/c,S=e=>d+(e+.5)*x,C=o.map((e,t)=>({label:s[t],x:b(e),y:d+g,tx:b(e),ty:d+g+G.tickLength,labelX:b(e),labelY:d+g+18,textAnchor:`middle`})),w=l.map((e,t)=>({label:e,x:p,y:S(t),tx:p-G.tickLength,ty:S(t),labelX:p-G.yLabelGap,labelY:S(t),textAnchor:`end`})),T=o.map(e=>({x1:b(e),y1:d,x2:b(e),y2:d+g})),E=e.series.map((e,t)=>t),O=e.series.filter(e=>e.type===`bar`).length,k=[];if(O>0){let t=x*(1-G.barPadRatio),n=O>1?(t-(O-1)*G.barGroupGap)/O:t,r=Math.min(n,G.maxBarWidth),i=O>1?r*O+G.barGroupGap*(O-1):r,o=0,s=0;for(let t of e.series){if(t.type!==`bar`){s++;continue}for(let e=0;e<t.data.length;e++){let n=S(e)-i/2+o*(r+G.barGroupGap),c=b(Math.max(t.data[e],a.min)),u=b(Math.max(0,a.min));k.push({x:Math.min(u,c),y:n,width:Math.abs(c-u),height:r,value:t.data[e],label:l[e],seriesIndex:o,colorIndex:E[s]})}o++,s++}}let A=[],j=0,M=0;for(let t of e.series){if(t.type!==`line`){M++;continue}let e=t.data.map((e,t)=>({x:b(e),y:S(t),value:e,label:l[t]}));A.push({points:e,seriesIndex:j,colorIndex:E[M]}),j++,M++}let N={x1:p,y1:d+g,x2:p+h,y2:d+g},ee={x1:p,y1:d,x2:p,y2:d+g},P={ticks:C,line:N,...e.yAxis.title?{title:{text:e.yAxis.title,x:p+h/2,y:v-G.padding}}:{}},F={ticks:w,line:ee,...e.xAxis.title?{title:{text:e.xAxis.title,x:G.padding+4,y:d+g/2,rotate:-90}}:{}},I=e.title?{text:e.title,x:_/2,y:G.padding+G.titleFontSize}:void 0,L=G.padding+(t?G.titleHeight:0)+G.legendHeight/2;return{width:_,height:v,horizontal:!0,title:I,xAxis:P,yAxis:F,plotArea:y,bars:k,lines:A,gridLines:T,legend:i?Qi(e,_/2,L,E):[]}}function Hi(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 Ui(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)=>Zi(n+i*t))}return Array.from({length:t},(e,t)=>String(t+1))}var Wi=8;function Gi(e,t){let n=e.map(e=>D(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<Wi){i=!1;break}if(i)return r}return Math.max(1,e.length)}function Ki(e,t,n,r){let i=Ui(e,Hi(e)),a=Gi(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 qi(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 Ji(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 Yi(e,t){let n=t-e;if(n<=0)return[e];let r=n/6,i=10**Math.floor(Math.log10(r)),a=r/i,o;o=a<=1.5?i:a<=3?2*i:a<=7?5*i:10*i;let s=Math.ceil(e/o)*o,c=[];for(let e=s;e<=t+o*.001;e+=o)c.push(Math.round(e*1e10)/1e10);return c}function Xi(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 Zi(e){return Number.isInteger(e)?String(e):e.toFixed(+(Math.abs(e)<10))}function Qi(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=D(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 $i(e,t,n=`Inter`,r=!1,i=!1,a,o,s,l={}){let u=[],d=Math.max(0,...e.bars.map(e=>e.colorIndex),...e.lines.map(e=>e.colorIndex)),f=cr((0,c.svgOpenTag)(e.width,e.height,t,r,o,s,void 0,l.styleAttribute).replace(`<svg `,`<svg data-xychart-colors="${d}" `),a);u.push(f),u.push((0,c.buildStyleBlock)(n,!1,l.nonce));let p=Math.max(...e.lines.map(e=>e.points.length),0),m=p>0&&p<=12,{style:h,defs:g}=ea(e,i,m,t.accent,t.bg,l.nonce);u.push(h),g&&u.push(g);let{plotArea:_}=e,v=e.xAxis.ticks.map(e=>e.x),y=e.horizontal?e.yAxis.ticks.map(e=>e.y):e.gridLines.map(e=>e.y1),b=v.length>1?Math.abs(v[1]-v[0]):_.width/6,x=y.length>1?Math.abs(y[1]-y[0]):_.height/6,S=b/Math.max(1,Math.round(b/20)),C=x/Math.max(1,Math.round(x/20)),w=v[0]??_.x,T=y[0]??_.y,E=w-Math.ceil((w-_.x)/S)*S,D=T-Math.ceil((T-_.y)/C)*C;for(let e=D;e<=_.y+_.height+.5;e+=C)for(let t=E;t<=_.x+_.width+.5;t+=S)u.push(`<circle cx="${J(t)}" cy="${J(e)}" r="1.5" class="xychart-grid"/>`);let O=[];for(let t of e.bars){let n=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,r=e.horizontal?na(t.x,t.y,t.width,t.height,K.barRadius):ta(t.x,t.y,t.width,t.height,K.barRadius);if(u.push(`<path d="${r}" class="xychart-bar xychart-color-${t.colorIndex}"${n}/>`),i){let e=oa(t.value),n=t.label?`${t.label}: ${e}`:e,r=aa(t.x+t.width/2,t.y,e);O.push(`<g class="xychart-bar-group"><rect x="${J(t.x)}" y="${J(t.y)}" width="${J(t.width)}" height="${J(t.height)}" fill="transparent"/><title>${Y(n)}</title>`+r+`</g>`)}}for(let t of e.lines){if(t.points.length===0)continue;let e=ra(t.points);u.push(`<path d="${e}" class="xychart-line-shadow xychart-color-${t.colorIndex}" transform="translate(0,2)"/>`),u.push(`<path d="${e}" class="xychart-line xychart-color-${t.colorIndex}"/>`)}let k=[];if(i||m){let t=new Map;for(let n of e.legend)n.type===`line`&&t.set(n.seriesIndex,n.label);let n=new Map;for(let t of e.lines)for(let e of t.points){let r=J(e.x),i=n.get(r)??[];n.set(r,i),i.push({x:e.x,y:e.y,value:e.value,label:e.label,seriesIndex:t.seriesIndex,colorIndex:t.colorIndex})}for(let e of n.values()){let n=e[0].x,r=e[0].label||``;if(i&&e.length>1){let i=Math.min(...e.map(e=>e.y)),a=Math.max(...e.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=e.map(e=>({text:oa(e.value),legendLabel:t.get(e.seriesIndex)||`Line ${e.seriesIndex+1}`})),l=ia(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 t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;f+=`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`}f+=`<title>${Y(d)}</title>${l}</g>`,k.push(f)}else if(i){let t=e[0],r=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`,i=oa(t.value),a=t.label?`${t.label}: ${i}`:i,o=aa(n,t.y-K.dotRadius,i),s=m?`<circle cx="${J(n)}" cy="${J(t.y)}" r="${K.dotRadius*3}" fill="transparent" class="xychart-hit"/>`:``;k.push(`<g class="xychart-dot-group">${s}<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${r}/><title>${Y(a)}</title>${o}</g>`)}else for(let t of e){let e=` data-value="${t.value}"${t.label?` data-label="${Y(t.label)}"`:``}`;u.push(`<circle cx="${J(t.x)}" cy="${J(t.y)}" r="${K.dotRadius}" class="xychart-dot xychart-color-${t.colorIndex}"${e}/>`)}}}for(let t of e.xAxis.ticks)t.label!==``&&u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${I}" class="xychart-label">${Y(t.label)}</text>`);for(let t of e.yAxis.ticks)u.push(`<text x="${t.labelX}" y="${t.labelY}" text-anchor="${t.textAnchor}" font-size="${K.labelSize}" font-weight="${K.labelWeight}" dy="${I}" class="xychart-label">${Y(t.label)}</text>`);if(e.xAxis.title){let t=e.xAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${I}" class="xychart-axis-title">${Y(t.text)}</text>`)}if(e.yAxis.title){let t=e.yAxis.title,n=t.rotate?` transform="rotate(${t.rotate},${t.x},${t.y})"`:``;u.push(`<text x="${t.x}" y="${t.y}" text-anchor="middle"${n} font-size="${K.axisTitleSize}" font-weight="${K.axisTitleWeight}" dy="${I}" class="xychart-axis-title">${Y(t.text)}</text>`)}e.title&&u.push(`<text x="${e.title.x}" y="${e.title.y}" text-anchor="middle" font-size="${K.titleSize}" font-weight="${K.titleWeight}" dy="${I}" class="xychart-title">${Y(e.title.text)}</text>`);for(let t of e.legend){if(t.type===`bar`)u.push(`<rect x="${t.x}" y="${t.y-7}" width="14" height="14" rx="3" class="xychart-bar xychart-color-${t.colorIndex}"/>`);else{let e=t.y;u.push(`<line x1="${t.x}" y1="${e}" x2="${t.x+14}" y2="${e}" stroke-width="${K.lineWidth}" stroke-linecap="round" class="xychart-legend-line xychart-color-${t.colorIndex}"/>`)}u.push(`<text x="${t.x+14+6}" y="${t.y}" text-anchor="start" font-size="${K.legendSize}" font-weight="${K.legendWeight}" dy="${I}" class="xychart-label">${Y(t.label)}</text>`)}for(let e of O)u.push(e);for(let e of k)u.push(e);return u.push(`</svg>`),u.join(`
|
|
54
|
+
`)}function ea(e,t,n,r,i,a){let o=r??u.CHART_ACCENT_FALLBACK,s=new Set;for(let t of e.bars)s.add(t.colorIndex);for(let t of e.lines)s.add(t.colorIndex);let l=[];for(let e of[...s].sort((e,t)=>e-t)){let t=e===0?`var(--accent, ${u.CHART_ACCENT_FALLBACK})`:(0,u.getSeriesColor)(e,o,i);l.push(` --xychart-color-${e}: ${t};`),l.push(` --xychart-bar-fill-${e}: color-mix(in srgb, var(--bg) 75%, var(--xychart-color-${e}) 25%);`)}let d=[];for(let e of[...s].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=t?`
|
|
48
55
|
.xychart-tip { opacity: 0; pointer-events: none; }
|
|
49
56
|
.xychart-tip-bg { fill: var(--_text); filter: drop-shadow(0 1px 3px color-mix(in srgb, var(--fg) 20%, transparent)); }
|
|
50
57
|
.xychart-tip-text { fill: var(--bg); font-size: ${q.fontSize}px; font-weight: ${q.fontWeight}; }
|
|
@@ -62,12 +69,21 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.
|
|
|
62
69
|
.xychart-title { fill: var(--_text); }${p}
|
|
63
70
|
${d.join(`
|
|
64
71
|
`)}${f}
|
|
65
|
-
</style>`,defs:``}}function
|
|
66
|
-
`)
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
`).map(e=>e.trim())),n=Ya((0,c.splitStatementsByLine)(e));if(n.length===0)throw Error(`Empty mermaid diagram`);let r=n[0],i=/^stateDiagram(-v2)?\s*$/i.test(r.text)?Qa(n):Za(n);return i.initConfig=t,i}function Za(e){let t=e[0];if(t===void 0)throw Error(`parseFlowchart called with no lines`);let n=t.text,r=n.match(/^(?:graph|flowchart)\s+(TD|TB|LR|BT|RL)\s*$/i);if(!r){let e=n.match(/^(?:graph|flowchart)\b\s*(.*)$/i);if(e){let r=e[1].trim();throw Error(r.length>0?`Line ${t.line}: Invalid direction "${r}" in header "${n}". Expected one of: TD, TB, LR, BT, RL.`:`Line ${t.line}: Missing direction in header "${n}". Expected e.g. "graph TD" or "flowchart LR" — one of: TD, TB, LR, BT, RL.`)}let r=qa(n),i=r&&r.toLowerCase()!==n.trim().toLowerCase()?` Did you mean "${r}"?`:``;throw Error(`Line ${t.line}: Invalid mermaid header: "${n}".${i} Supported headers: ${Ka}.`)}let i={direction:(0,c.toDirection)(r[1]),nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},a=[];for(let t=1;t<e.length;t++){let n=e[t].text;if((0,c.tryApplyClassDef)(n,i)||(0,c.tryApplyClassAssignment)(n,i)||(0,c.tryApplyStyleStatement)(n,i))continue;if(/^click\s+/i.test(n)){fo(n,i);continue}if(mo(n,i))continue;let r=n.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(r){let e=r[1].trim(),t=(0,c.parseStyleProps)(r[2]);if(e==="default")i.linkStyles.set(`default`,{...i.linkStyles.get(`default`),...t});else{let n=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of n)isNaN(e)||i.linkStyles.set(e,{...i.linkStyles.get(e),...t})}continue}let o=n.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(o&&a.length>0){a[a.length-1].direction=(0,c.toDirection)(o[1]);continue}let s=n.match(/^subgraph\s+(.+)$/);if(s){let e=s[1].trim(),t=e.match(/^([^\s[]+)\s*\[(.+)\]$/),n,r;t?(n=t[1],r=(0,c.normalizeBrTags)(Ga(t[2]))):(r=(0,c.normalizeBrTags)(Ga(e)),n=r.replace(/\s+/g,`_`).replace(/[^\p{L}\p{N}_-]/gu,``));let i={id:n,label:r,nodeIds:[],children:[]};a.push(i);continue}if(n===`end`){let e=a.pop();e&&(a.length>0?a[a.length-1].children.push(e):i.subgraphs.push(e));continue}vo(n,i,a)}return i}function Qa(e){let t={direction:`TD`,nodes:new Map,edges:[],subgraphs:[],classDefs:new Map,classAssignments:new Map,nodeStyles:new Map,linkStyles:new Map,interactions:new Map},n=[],r=new Set,i=0,a=0;for(let o=1;o<e.length;o++){let s=e[o].text;if((0,c.tryApplyClassDef)(s,t)||(0,c.tryApplyClassAssignment)(s,t)||(0,c.tryApplyStyleStatement)(s,t))continue;let l=s.match(/^direction\s+(TD|TB|LR|BT|RL)\s*$/i);if(l){n.length>0?n[n.length-1].direction=(0,c.toDirection)(l[1]):t.direction=(0,c.toDirection)(l[1]);continue}let u=s.match(/^linkStyle\s+(default|[\d,\s]+)\s+(.+)$/);if(u){let e=u[1].trim(),n=(0,c.parseStyleProps)(u[2]);if(e==="default")t.linkStyles.set(`default`,{...t.linkStyles.get(`default`),...n});else{let r=e.split(`,`).map(e=>parseInt(e.trim(),10));for(let e of r)isNaN(e)||t.linkStyles.set(e,{...t.linkStyles.get(e),...n})}continue}if(mo(s,t))continue;let d=s.match(/^state\s+(?:"([^"]+)"\s+as\s+)?([\w\p{L}]+)\s*\{$/u);if(d){let e=d[1]??d[2],i=d[2],a={id:i,label:e,nodeIds:[],children:[]};n.push(a),r.add(i),t.nodes.delete(i);continue}if(s===`}`){let e=n.pop();e&&(n.length>0?n[n.length-1].children.push(e):t.subgraphs.push(e));continue}let f=s.match(/^state\s+"([^"]+)"\s+as\s+([\w\p{L}]+)\s*$/u);if(f){let e=(0,c.normalizeBrTags)(f[1]),r=f[2];$a(t,n,r,e);continue}let p=s.match(/^(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?\s*(?:([\w-]+)@)?-->\s*(\[\*\]|[\w\p{L}-]+)(?::::([\w][\w-]*))?(?:\s*:\s*(.+))?$/u);if(p){let e=p[1],o=p[2],s=p[3],l=p[4],u=p[5],d=p[6]?.trim(),f=d?(0,c.normalizeBrTags)(d):void 0;e===`[*]`?(i++,e=`_start${i>1?i:``}`,eo(t,n,{id:e,label:``,shape:`state-start`})):r.has(e)||to(t,n,e),l===`[*]`?(a++,l=`_end${a>1?a:``}`,eo(t,n,{id:l,label:``,shape:`state-end`})):r.has(l)||to(t,n,l),o!==void 0&&t.classAssignments.set(e,o),u!==void 0&&t.classAssignments.set(l,u),t.edges.push({source:e,target:l,label:f,style:`solid`,hasArrowStart:!1,hasArrowEnd:!0,...s===void 0?{}:{id:s}});continue}let m=s.match(/^([\w\p{L}-]+):::([\w][\w-]*)\s*$/u);if(m){let e=m[1];r.has(e)||to(t,n,e),t.classAssignments.set(e,m[2]);continue}let h=s.match(/^([\w\p{L}-]+)\s*:\s*(.+)$/u);if(h){let e=h[1];$a(t,n,e,(0,c.normalizeBrTags)(h[2].trim()));continue}}for(let e of t.classAssignments.keys())!t.nodes.has(e)&&!r.has(e)&&to(t,[],e);return t}function $a(e,t,n,r){let i=e.nodes.get(n);i&&(i.label=r),eo(e,t,{id:n,label:r,shape:`rounded`})}function eo(e,t,n){if(e.nodes.has(n.id)||e.nodes.set(n.id,n),t.length>0){let e=t[t.length-1];e.nodeIds.includes(n.id)||e.nodeIds.push(n.id)}}function to(e,t,n){if(!e.nodes.has(n))eo(e,t,{id:n,label:n,shape:`rounded`});else if(t.length>0){let e=t[t.length-1];e.nodeIds.includes(n)||e.nodeIds.push(n)}}var no=/^(<|o|x)?(-{2,}|={2,}|-\.+-|~{3,})(>|o|x)?(?:\|([^|]*)\|)?/,ro=new Set([`--`,`==`]);function io(e){if(e===`o`)return`circle`;if(e===`x`)return`cross`}var ao=/^(<|o|x)?(--|-\.|==)\s+(.+?)\s+(-{2,}[>ox]|={2,}[>ox]|\.+-[>ox]|-{3,}|={3,}|-\.+-)/,oo=[{regex:/^([\w\p{L}-]+)\(\(\(((?:"[^"]*"|(?!\)\)\)).)+)\)\)\)/u,shape:`doublecircle`},{regex:/^([\w\p{L}-]+)\(\[((?:"[^"]*"|(?!\]\)).)+)\]\)/u,shape:`stadium`},{regex:/^([\w\p{L}-]+)\(\(((?:"[^"]*"|(?!\)\)).)+)\)\)/u,shape:`circle`},{regex:/^([\w\p{L}-]+)\[\[((?:"[^"]*"|(?!\]\]).)+)\]\]/u,shape:`subroutine`},{regex:/^([\w\p{L}-]+)\[\(((?:"[^"]*"|(?!\)\]).)+)\)\]/u,shape:`cylinder`},{regex:/^([\w\p{L}-]+)\[\/((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`\\`?`trapezoid`:`parallelogram`},{regex:/^([\w\p{L}-]+)\[\\((?:"[^"]*"|(?![\\/]\]).)+)([\\/])\]/u,shape:e=>e===`/`?`trapezoid-alt`:`parallelogram-alt`},{regex:/^([\w\p{L}-]+)>((?:"[^"]*"|(?!\]).)+)\]/u,shape:`asymmetric`},{regex:/^([\w\p{L}-]+)\{\{((?:"[^"]*"|(?!\}\}).)+)\}\}/u,shape:`hexagon`},{regex:/^([\w\p{L}-]+)\[((?:"[^"]*"|(?!\]).)+)\]/u,shape:`rectangle`},{regex:/^([\w\p{L}-]+)\(((?:"[^"]*"|(?!\)).)+)\)/u,shape:`rounded`},{regex:/^([\w\p{L}-]+)\{((?:"[^"]*"|(?!\}).)+)\}/u,shape:`diamond`}],so=/^([\w\p{L}]+(?:-[\w\p{L}]+)*)/u,co=/^([\w\p{L}-]+)(?=@\{)/u;function lo(e){if(e.shape)return(0,u.resolveShapeName)(e.shape)??`rectangle`;if(e.icon!==void 0||e.img!==void 0)switch(e.form?.toLowerCase()){case`circle`:return`circle`;case`rounded`:return`rounded`;default:return`rectangle`}return`rectangle`}function uo(e,t){return t.label!==void 0&&t.label.length>0?t.label:t.icon?t.icon:t.img?t.img:e}function fo(e,t){(0,c.applyClickStatement)(e,t.interactions)}var po=/^([\w-]+)(?=@\{)/;function mo(e,t){let n=e.match(po);if(!n||!t.edges.some(e=>e.id===n[1]))return!1;let r=(0,u.matchExpandedBlock)(e.slice(n[1].length));return r?(ho(t,n[1],(0,u.parseExpandedMeta)(r.body)),!0):!1}function ho(e,t,n){for(let r of e.edges)r.id===t&&(n.animate!==void 0&&(r.animate=n.animate.toLowerCase()!==`false`),n.animation!==void 0&&(r.animate=!0))}var go=/^:::([\w][\w-]*)/,_o=/^([\w\p{L}-]+):::([\w][\w-]*)/u;function vo(e,t,n){let r=e.trim(),i=yo(r,t,n);if(!i||i.ids.length===0)return;r=i.remaining.trim();let a=i.ids;for(;r.length>0;){let e,i,o,s,l,u,d,f=r.match(/^([\w-]+)@(?=[-=<~ox])/);f&&(d=f[1],r=r.slice(f[0].length));let p=r.match(no),m=p?.[2],h=p?.[1],g=p?.[3];if(p&&m!==void 0&&!(h===void 0&&g===void 0&&ro.has(m))){e=h!==void 0,l=io(h);let t=p[4]?.trim();s=t?(0,c.normalizeBrTags)(t):void 0,r=r.slice(p[0].length).trim(),i=wo(m),o=g!==void 0,u=io(g)}else{let t=r.match(ao);if(!t)break;e=!!t[1],l=io(t[1]);let n=t[3].trim();s=n?(0,c.normalizeBrTags)(n):void 0;let a=t[2],d=t[4];r=r.slice(t[0].length).trim(),i=To(a,d),u=io(d.slice(-1)),o=d.endsWith(`>`)||u!==void 0}let _=yo(r,t,n);if(!_||_.ids.length===0)break;r=_.remaining.trim();for(let n of a)for(let r of _.ids)t.edges.push({source:n,target:r,label:s,style:i,hasArrowStart:e,hasArrowEnd:o,...l===void 0?{}:{startMarker:l},...u===void 0?{}:{endMarker:u},...d===void 0?{}:{id:d}});a=_.ids}}function yo(e,t,n){let r=bo(e,t,n);if(!r)return null;let i=[r.id],a=r.remaining.trim();for(;a.startsWith(`&`);){a=a.slice(1).trim();let e=bo(a,t,n);if(!e)break;i.push(e.id),a=e.remaining.trim()}return{ids:i,remaining:a}}function bo(e,t,n){let r=null,i=e,a,o=i.match(_o);o&&(a=o[2],i=o[1]+i.slice(o[0].length));let s=i.match(co);if(s){let e=s[1],a=(0,u.matchExpandedBlock)(i.slice(e.length));if(a){let o=(0,u.parseExpandedMeta)(a.body);xo(t,n,{id:e,label:(0,c.normalizeBrTags)(uo(e,o)),shape:lo(o)}),r=e,i=i.slice(e.length+a.length)}}if(r===null)for(let{regex:e,shape:a}of oo){let o=i.match(e);if(o){r=o[1];let e=(0,c.normalizeBrTags)(o[2]),s=typeof a==`function`?a(o[3]??``):a;xo(t,n,{id:r,label:e,shape:s}),i=i.slice(o[0].length);break}}if(r===null){let e=i.match(so);e&&(r=e[1],t.nodes.has(r)?So(t,n,r)||Co(n,r):xo(t,n,{id:r,label:r,shape:`rectangle`}),i=i.slice(e[0].length))}if(r===null)return null;a&&t.classAssignments.set(r,a);let l=i.match(go);return l&&(t.classAssignments.set(r,l[1]),i=i.slice(l[0].length)),{id:r,remaining:i}}function xo(e,t,n){e.nodes.has(n.id)||e.nodes.set(n.id,n),Co(t,n.id)}function So(e,t,n){let r=e=>e.nodeIds.includes(n)||e.children.some(r);return e.subgraphs.some(r)||t.some(r)}function Co(e,t){if(e.length>0){let n=e[e.length-1];n.nodeIds.includes(t)||n.nodeIds.push(t)}}function wo(e){return e.startsWith(`~`)?`invisible`:e.includes(`.`)?`dotted`:e.startsWith(`=`)?`thick`:`solid`}function To(e,t){return e.includes(`.`)||t.includes(`.`)?`dotted`:e.startsWith(`=`)||t.startsWith(`=`)?`thick`:`solid`}var Eo={type:`xychart`,parse:u.parseXYChart,layoutForSvg:Ni,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return qi(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},Do={type:`sequence`,parse:u.parseSequenceDiagram,layoutForSvg:ui,renderSvg(e,t){return di(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function Oo(e){return(e.interactivity??`static`)!==`none`}function ko(e){return(e.interactivity??`static`)===`full`}var Ao={type:`class`,parse:u.parseClassDiagram,layoutForSvg:wr,renderSvg(e,t,n){return Or(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,Oo(n),t.emit)}},jo={type:`er`,parse:u.parseErDiagram,layoutForSvg(e,t){return qr((0,c.withDirectionOverride)(e,t.direction),t)},renderSvg(e,t){return Yr(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Mo={type:`flowchart`,parse:(e,t)=>Xa(t),layoutForSvg(e,t){return{graph:Yt((0,c.withDirectionOverride)(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return on(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,ko(n),Oo(n),t.title,t.decorative,t.emit)}},No={type:`c4`,parse:u.parseC4Diagram,layoutForSvg(e,t){return Fa(e,t)},renderSvg(e,t){return Ia(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},Po={xychart:Eo,er:jo,sequence:Do,class:Ao,flowchart:Mo,architecture:{type:`architecture`,parse:u.parseArchitecture,layoutForSvg(e,t){return{graph:qt((0,c.withDirectionOverride)((0,u.architectureToGraph)(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:Mo.renderSvg},c4:No};function Fo(e){return{bg:e.bg??c.DEFAULTS.bg,fg:e.fg??c.DEFAULTS.fg,line:e.line,accent:e.accent,muted:e.muted,surface:e.surface,border:e.border}}function Io(e={}){return(0,c.themeStyleDeclarations)(Fo(e),e.transparent)}function Lo(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function Ro(e,t={}){let n=zo(e,t);return t.resolveColors?_r(n,Fo(t)):n}function zo(e,t){let n=(0,d.decodeXML)(e),r=Fo(t),i=t.font??`Inter`;(0,c.setMonospaceMetrics)((0,c.isMonospaceFont)(i));let a=t.transparent??!1,o=A(t.fontSizes),s=(0,c.detectDiagramType)(n),l=t.embedSource?e:void 0,u=t.title,f=t.decorative,p=Lo(t),m=(0,c.splitStatements)(n),h=Po[s],g=h.parse(m,n),_=h.layoutForSvg(g,t),v={colors:r,font:i,transparent:a,fontSizes:o,embedSource:l,title:u,decorative:f,emit:p};return h.renderSvg(_,v,t)}async function Bo(e,t={}){return Ro(e,t)}var Vo=Ro,Ho=Bo;exports.ACTOR_LABEL_OFFSET=oi,exports.ARROW_HEAD=F,exports.CLS=H,exports.ELK_DIRECTION_FALLBACK=te,exports.FONT_SIZES=k,exports.FONT_WEIGHTS=j,exports.GROUP_HEADER_CONTENT_PAD=ee,exports.INLINE_CENTERED_EDGE_LABEL=oe,exports.MONO_FONT=D,exports.MONO_FONT_STACK=O,exports.NODE_PADDING=M,exports.STROKE_WIDTHS=N,exports.TEXT_BASELINE_SHIFT=P,exports.baseElkLayoutOptions=ie,exports.boxLabelHeight=ai,exports.buildElkEdge=R,exports.buildElkEdgeLabel=se,exports.buildElkLeafNode=ae,exports.classNoteId=vr,exports.clipEdgeToShape=ke,exports.convertToElkFormat=Xt,exports.createLayoutCache=x,exports.directionToElk=ne,exports.elkLayoutSync=w,exports.elkPadding=re,exports.estimateMonoTextWidth=E,exports.estimateTextWidth=T,exports.evaluateCssColorValue=dr,exports.extractEdgeLabelPosition=Be,exports.extractEdgePoints=ze,exports.formatTickLabels=Wi,exports.layoutClassDiagramSync=wr,exports.layoutErDiagramSync=qr,exports.layoutFlowchartSync=Yt,exports.layoutGraphSync=qt,exports.layoutSequenceDiagram=ui,exports.layoutXYChart=Ni,exports.niceTickValues=Ui,exports.pointsToPath=_,exports.renderClassSvg=Or,exports.renderErSvg=Yr,exports.renderMermaid=Ho,exports.renderMermaidSVG=Ro,exports.renderMermaidSVGAsync=Bo,exports.renderMermaidSync=Vo,exports.renderSequenceSvg=di,exports.renderSvg=on,exports.renderXYChartSvg=qi,exports.resolveCssColors=_r,exports.resolveFontSizes=A,exports.smoothCurvePath=Zi,exports.themeCssVariables=Io,exports.withDataSrc=nr,exports.xLabelStep=zi;
|
|
72
|
+
</style>`,defs:``}}function ta(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 na(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 ra(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 ia(e,t,n,r){let i=D(n,q.fontSize,600),a=Math.max(...r.map(e=>{let t=D(e.legendLabel,q.fontSize,q.fontWeight),n=D(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="${I}" 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="${I}" 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="${I}" class="xychart-tip xychart-tip-text">${Y(e.text)}</text>`;return m}function aa(e,t,n){let r=D(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="${I}" class="xychart-tip xychart-tip-text">${Y(n)}</text>`}function oa(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,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`)}var X={height:450,margin:40,legendRectSize:18,legendSpacing:4,textPosition:.75,outerStrokeWidth:2,titleFontSize:25,sectionFontSize:17,legendFontSize:17,fontWeight:400,paletteSize:12,minPercent:1},sa=Math.PI*2;function Z(e){return String(Math.round(e*100)/100)}function ca(e,t,n,r){return{x:e+n*Math.sin(r),y:t-n*Math.cos(r)}}function la(e,t,n,r,i){if(i-r>=sa-1e-9)return`M${Z(e)},${Z(t-n)}A${Z(n)},${Z(n)},0,1,1,${Z(e)},${Z(t+n)}A${Z(n)},${Z(n)},0,1,1,${Z(e)},${Z(t-n)}Z`;let a=ca(e,t,n,r),o=ca(e,t,n,i),s=+(i-r>Math.PI);return`M${Z(a.x)},${Z(a.y)}A${Z(n)},${Z(n)},0,${s},1,${Z(o.x)},${Z(o.y)}L${Z(e)},${Z(t)}Z`}function ua(e,t,n){return n?`${e} [${String(t)}]`:e}function da(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=u*d/2,p=a+12*X.legendRectSize,m=e.slices.map(t=>ua(t.label,t.value,e.showData)),h=Math.max(0,...m.map(e=>D(e,X.legendFontSize,X.fontWeight))),g=d>0?r+X.margin+X.legendRectSize+X.legendSpacing+h:r+X.margin,_=e.title??``,v=_.length>0?D(_,X.titleFontSize,X.fontWeight):0,y=a-v/2,b=a+v/2,x=Math.min(0,y),S=Math.max(g,b),C=o-f,w=o+(d-1)*u-f+X.legendRectSize,T=d>0?Math.min(0,C):0,E=d>0?Math.max(n,w):n,O=-x,k=-T,A=a+O,j=o+k,M=[],N=0,ee=i*X.textPosition;for(let{slice:e,colorIndex:t}of c){let n=N,r=N+e.value/l*sa;N=r;let a=ca(A,j,ee,(n+r)/2);M.push({label:e.label,value:e.value,colorIndex:t,startAngle:n,endAngle:r,path:la(A,j,i,n,r),percentText:`${(e.value/s*100).toFixed(0)}%`,labelX:a.x,labelY:a.y})}let P=m.map((e,t)=>{let n=p+O,r=o+t*u-f+k;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(S-x),height:Math.ceil(E-T),cx:A,cy:j,radius:i,outerRadius:i+X.outerStrokeWidth/2,title:_.length>0?{text:_,x:A,y:j-(n-50)/2}:void 0,slices:M,legend:P,accTitle:e.accTitle,accDescr:e.accDescr}}function Q(e){return String(Math.round(e*100)/100)}function fa(e,t,n){return e===0?`var(--accent, ${u.CHART_ACCENT_FALLBACK})`:(0,u.getSeriesColor)(e,t??u.CHART_ACCENT_FALLBACK,n)}function pa(e,t,n){let r=new Set;for(let t of e.slices)r.add(t.colorIndex);for(let t of e.legend)r.add(t.colorIndex);let i=[...r].sort((e,t)=>e-t),a=i.map(e=>` --pie-color-${e}: ${fa(e,t.accent,t.bg)};`),o=i.map(e=>` .pie-color-${e} { fill: var(--pie-color-${e}); }\n rect.pie-color-${e} { stroke: var(--pie-color-${e}); }`),s=a.length>0?`\n svg {\n${a.join(`
|
|
73
|
+
`)}\n }`:``;return`${(0,c.styleOpenTag)(n)}
|
|
74
|
+
.pie-outer { fill: none; stroke: var(--fg); stroke-width: ${X.outerStrokeWidth}px; }
|
|
75
|
+
.pie-slice { stroke: var(--fg); stroke-width: 2px; opacity: 0.7; }
|
|
76
|
+
.pie-slice-label { fill: var(--_text); font-size: ${X.sectionFontSize}px; font-weight: ${X.fontWeight}; }
|
|
77
|
+
.pie-title { fill: var(--_text); font-size: ${X.titleFontSize}px; font-weight: ${X.fontWeight}; }
|
|
78
|
+
.pie-legend-text { fill: var(--_text); font-size: ${X.legendFontSize}px; font-weight: ${X.fontWeight}; }${s}
|
|
79
|
+
${o.join(`
|
|
80
|
+
`)}
|
|
81
|
+
</style>`}function ma(e,t,n=`Inter`,r=!1,i,a,o,s={}){let l=[];l.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,a??e.accTitle,o,void 0,s.styleAttribute,e.accDescr),i)),l.push((0,c.buildStyleBlock)(n,!1,s.nonce)),l.push(pa(e,t,s.nonce)),l.push(`<circle cx="${Q(e.cx)}" cy="${Q(e.cy)}" r="${Q(e.outerRadius)}" class="pie-outer"/>`);for(let t of e.slices)l.push(`<path d="${t.path}" class="pie-slice pie-color-${t.colorIndex}" data-label="${(0,c.escapeAttr)(t.label)}" data-value="${t.value}"/>`);for(let t of e.slices)l.push(`<text x="${Q(t.labelX)}" y="${Q(t.labelY)}" text-anchor="middle" class="pie-slice-label">${(0,c.escapeXml)(t.percentText)}</text>`);e.title&&l.push(`<text x="${Q(e.title.x)}" y="${Q(e.title.y)}" text-anchor="middle" class="pie-title">${(0,c.escapeXml)(e.title.text)}</text>`);for(let t of e.legend)l.push(`<g class="pie-legend"><rect x="${Q(t.x)}" y="${Q(t.y)}" width="${t.size}" height="${t.size}" class="pie-legend-swatch pie-color-${t.colorIndex}"/><text x="${Q(t.textX)}" y="${Q(t.textY)}" class="pie-legend-text">${(0,c.escapeXml)(t.text)}</text></g>`);return l.push(`</svg>`),l.join(`
|
|
82
|
+
`)}var ha=2048,ga=[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],_a=[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 va(e,t){let n=e.codePointAt(0);if(!(n<32||n>126))return(t?_a:ga)[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},ya=$.width-2*$.shapePadding;function ba(e,t,n){let r=[];for(let i of e.split(`
|
|
83
|
+
`)){let e=``;for(let a of i.split(/\s+/).filter(Boolean)){let i=e?`${e} ${a}`:a;e&&Ea(i,n,400)>t?(r.push(e),e=a):e=i}r.push(e)}return r}function xa(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 Sa(e,t){return e*$.nameLine+$.typeLine+Ca(t)}function Ca(e){return e===0?0:$.descrLine+(e-1)*$.descrExtraLine}function wa(e){let t=e/2;return{rx:t,ry:t/(2.5+e/50)}}function Ta(e){let t=e/2;return{rx:t/(2.5+e/50),ry:t}}function Ea(e,t,n){let r=0;for(let i of e){let e=va(i,n>=600);r+=e===void 0?D(i,t,n)*$.textScale:e*t}return r}function Da(e,t,n,r){let i=Sa(t,n),a=i+2*$.shapePadding,o=Math.max($.width,r+2*$.shapePadding);if(e.kind===`person`)return{width:o,height:xa(o).pillTop+a,textHeight:i};if(e.shape===`db`){let{ry:e}=wa(o);return{width:o,height:a+2*e-$.dbTrim,textHeight:i}}if(e.shape===`queue`){let e=i+$.queueExtra,{rx:t}=Ta(e);return{width:o+3*t,height:e,textHeight:i}}return{width:o,height:a,textHeight:i}}function Oa(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}}}function ka(){return{next:{cnt:0}}}function Aa(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 ja(e,t,n,r){let i=e[t];e[t]=i===void 0?n:r(n,i)}function Ma(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,ja(e,`startx`,r,Math.min),ja(e,`starty`,a,Math.min),ja(e,`stopx`,i,Math.max),ja(e,`stopy`,o,Math.max),ja(e.next,`startx`,r,Math.min),ja(e.next,`starty`,a,Math.min),ja(e.next,`stopx`,i,Math.max),ja(e.next,`stopy`,o,Math.max)}function Na(e){let t=ba(e.label,ya,$.nameSize),n=e.description?ba(e.description,ya,$.descrSize):[],r=Math.max(...t.map(e=>Ea(e,$.nameSize,700)),Ea((0,u.c4TypeLine)(e),$.typeSize,400),...n.map(e=>Ea(e,$.descrSize,400)));return{el:e,nameLines:t,descriptionLines:n,x:0,y:0,...Da(e,t.length,n.length,r)}}function Pa(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 Fa(e){let t=new Map,n=[],r=$.diagramMarginX,i=$.diagramMarginY,a=(e,n)=>{for(let r of n){let n=Na(r);t.set(r.alias,n),Ma(e,n)}e.stopx+=$.shapeMargin,e.stopy+=$.shapeMargin},o=(e,t,s)=>{let c=ka();c.widthLimit=e.widthLimit/Math.min($.boundaryInRow,t.length);for(let[l,d]of t.entries()){let t=d.boundary,f=0,p=f+8;f=p+$.boundaryLabelHeight;let m;t&&(0,u.c4BoundaryTypeLine)(t)&&(m=f+5,f=m+$.boundaryTypeHeight);let h;if(t?.description&&(h=f+20,f=h+$.boundaryDescrHeight),t||(f=$.rootHeadingHeight),l===0||l%$.boundaryInRow===0){let t=e.startx+$.diagramMarginX,n=e.stopy+$.diagramMarginY+f;Aa(c,t,t,n,n)}else{let e=c.stopx===c.startx?c.startx:c.stopx+$.diagramMarginX;Aa(c,e,e,c.starty,c.starty)}if(d.elements.length>0&&a(c,d.elements),d.children.length>0&&o(c,d.children,s+1),t){let e=c.stopx-c.startx,r=c.stopy-c.starty;e===0&&(e=$.width),r===0&&(r=f+$.shapeMargin),n.push({alias:t.alias,label:t.label,...t.type?{type:t.type}:{},...t.description?{description:t.description}:{},x:c.startx,y:c.starty,width:e,height:r,depth:s,labelY:p,...m===void 0?{}:{typeY:m},...h===void 0?{}:{descrY:h}})}e.stopy=Math.max(c.stopy+$.shapeMargin,e.stopy),e.stopx=Math.max(c.stopx+$.shapeMargin,e.stopx),r=Math.max(r,e.stopx),i=Math.max(i,e.stopy)}},s=ka();return Aa(s,$.diagramMarginX,$.diagramMarginX,$.diagramMarginY,$.diagramMarginY),s.widthLimit=$.screenWidth,o(s,[e],-1),{elements:t,boundaries:n,maxX:r,maxY:i}}function Ia(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 La(e,t){let n=xa(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 za({x:r,y:i},t,f.map(e=>({x:r+e.x,y:i+e.y})))}function Ra(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 za(e,t,n){let r,i=1/0;return n.forEach((a,o)=>{let s=Ra(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 Ba=1e-6;function Va(e,t){let n=Ia(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=wa(e.width),s=n.x-r,c=Math.abs(s)<e.width/2-Ba||Math.abs(Math.abs(s)-e.width/2)<=Ba&&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 Ha(e,t){let n=Ia(e,t),r=e.x+e.width/2,i=e.y+e.height/2,{rx:a,ry:o}=Ta(e.height),s=n.y-i,c=Math.abs(s)<e.height/2-Ba||Math.abs(Math.abs(s)-e.height/2)<=Ba&&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 Ua(e,t){let n=e.el;return n?.kind===`person`?La(e,t):n?.shape===`db`?Va(e,t):n?.shape===`queue`?Ha(e,t):Ia(e,t)}var Wa=e=>({x:e.x+e.width/2,y:e.y+e.height/2});function Ga(e,t,n,r){let i=n.get(e.from),a=n.get(e.to),o=Ua(i,Wa(a)),s=Ua(a,Wa(i)),c=s.x-o.x,l=s.y-o.y,d=e=>({x:e.x,y:e.y+r}),f={...e,points:[d(o),d(s)]};if(t>0&&(f.curve=d({x:o.x+c/2-c/4,y:o.y+l/2})),(0,u.c4RelLabelLines)(e).length>0){let t={x:Math.min(o.x,s.x)+Math.abs(c)/2,y:Math.min(o.y,s.y)+Math.abs(l)/2},n=(0,u.c4RelLabelLines)(e)[0],r=e.label!==``||e.index!==void 0?Ea(n??``,$.messageSize,400):0;if(f.labelPosition=d({x:t.x+r/2,y:t.y}),e.technology){let n=Ea(`[${e.technology}]`,$.messageSize,400);f.technologyX=t.x+Math.max(r,n)/2}}return f}var Ka=2,qa=2;function Ja(e,t){let n=e.labelPosition;return n?(0,u.c4RelLabelLines)(e).map((r,i,a)=>({cx:(e.technology!==void 0&&i===a.length-1&&e.technologyX!==void 0?e.technologyX:n.x)+t,cy:n.y+(i===0?0:$.messageSize+5),w:Ea(r,$.messageSize,400),h:$.messageSize})):[]}var Ya=(e,t)=>Math.abs(e.cx-t.cx)<(e.w+t.w)/2+Ka&&Math.abs(e.cy-t.cy)<(e.h+t.h)/2+Ka;function Xa(e,t,n){let r=e.points[0],i=e.points[e.points.length-1];if(!e.labelPosition||!r||!i)return;let a=i.x-r.x,o=i.y-r.y,s=Math.hypot(a,o);if(s===0)return;let c=a/s,l=o/s,u=r=>{let i=Ja(e,r*c).map(e=>({...e,cy:e.cy+r*l}));return i.some(e=>[...t,...n].some(t=>Ya(e,t)))?void 0:i};for(let t=0;t<=s/2;t+=qa)for(let r of t===0?[1]:[1,-1]){let i=u(r*t);if(i){t!==0&&(e.labelPosition={x:e.labelPosition.x+r*t*c,y:e.labelPosition.y+r*t*l},e.technologyX!==void 0&&(e.technologyX+=r*t*c)),n.push(...i);return}}n.push(...Ja(e,0))}function Za(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=Fa(Pa(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)=>Ga(e,t,s,i)),l=a.map(e=>({cx:e.x+e.width/2,cy:e.y+e.height/2,w:e.width+12,h:e.height+12})),u=[];for(let e of c)Xa(e,l,u);let d=n.maxX+$.diagramMarginX,f=n.maxY+$.diagramMarginY+r,p={variant:e.variant,width:d,height:f,elements:a,boundaries:o,relationships:c};return e.title&&(p.title=e.title,p.titlePosition={x:(n.maxX-$.diagramMarginX)/2-4*$.diagramMarginX,y:$.diagramMarginY+$.diagramMarginY+i}),p}function Qa(e,t,n=`Inter`,r=!1,i=j,a,o,s,l={}){let u=[];u.push(cr((0,c.svgOpenTag)(e.width,e.height,t,r,o??e.title,s,void 0,l.styleAttribute),a)),u.push((0,c.buildStyleBlock)(n,!1,l.nonce)),e.title&&e.titlePosition&&u.push(c.f`<text class="c4-title" x="${e.titlePosition.x}" y="${e.titlePosition.y}" dy="${I}" `+c.f`font-size="16" fill="var(--_text)">${(0,c.escapeXml)(e.title)}</text>`);for(let t of e.boundaries)u.push(eo(t));for(let t of e.elements)u.push(to(t));for(let t of e.relationships)u.push(oo(t)),u.push(so(t));return u.push(`</svg>`),u.filter(Boolean).join(`
|
|
84
|
+
`)}function $a(e,t,n,r,i){return c.f` <text x="${t}" y="${n}" text-anchor="middle" dy="${I}" font-size="${r}" `+c.f`${i}>${(0,c.escapeXml)(e)}</text>`}function eo(e){let t=[];t.push(c.f`<g class="c4-boundary" data-id="${(0,c.escapeAttr)(e.alias)}" data-label="${(0,c.escapeAttr)(e.label)}" data-depth="${e.depth}">`),t.push(c.f` <rect x="${e.x}" y="${e.y}" width="${e.width}" height="${e.height}" rx="2.5" ry="2.5" `+`fill="none" stroke="var(--_text)" stroke-width="1" stroke-dasharray="7,7" />`);let n=e.x+e.width/2;t.push($a(e.label,n,e.y+(e.labelY??8),$.boundarySize+2,`font-weight="700" fill="var(--_text)"`));let r=(0,u.c4BoundaryTypeLine)({alias:e.alias,label:e.label,...e.type?{type:e.type}:{},elementAliases:[],children:[]});return r&&e.typeY!==void 0&&t.push($a(r,n,e.y+e.typeY,$.boundarySize,`fill="var(--_text)"`)),e.description&&e.descrY!==void 0&&t.push($a(e.description,n,e.y+e.descrY,$.boundarySize-2,`fill="var(--_text)"`)),t.push(`</g>`),t.join(`
|
|
85
|
+
`)}function to(e){let t=Oa(e),{x:n,y:r,width:i,height:a}=e,o=n+i/2,s=Sa(e.nameLines.length,e.descriptionLines.length),l=[];l.push(c.f`<g class="c4-element" data-id="${(0,c.escapeAttr)(e.alias)}" data-kind="${e.kind}" data-shape="${e.shape}" `+c.f`data-external="${e.external}" data-label="${(0,c.escapeAttr)(e.label)}">`);let d,f=o;if(e.kind===`person`)l.push(...no(e,t)),d=r+xa(i).pillTop+$.shapePadding;else if(e.shape===`db`){l.push(...ro(e,t));let{ry:n}=wa(i);d=r+(2*n+a)/2-s/2}else if(e.shape===`queue`){l.push(...io(e,t));let{rx:n}=Ta(a);f=o-n,d=r+a/2-s/2}else l.push(c.f` <rect x="${n}" y="${r}" width="${i}" height="${a}" rx="${$.cornerRadius}" ry="${$.cornerRadius}" `+c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}" />`),d=r+$.shapePadding;let p=d;for(let n of e.nameLines)l.push($a(n,f,p+$.nameLine/2,$.nameSize,c.f`font-weight="700" fill="${t.text}"`)),p+=$.nameLine;return l.push($a((0,u.c4TypeLine)(e),f,p+$.typeLine/2,$.typeSize,c.f`fill="${t.text}"`)),p+=$.typeLine,e.descriptionLines.forEach((e,n)=>{l.push($a(e,f,p+$.descrLine/2+n*$.descrExtraLine,$.descrSize,c.f`fill="${t.text}"`))}),p+=Ca(e.descriptionLines.length),l.push(`</g>`),l.join(`
|
|
86
|
+
`)}function no(e,t){let{x:n,width:r}=e,{rx:i,headRadius:a,pillTop:o}=xa(r,e.height),s=e.y,l=n+r/2,u=s+o,d=e.y+e.height-u,f=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[c.f` <rect x="${n}" y="${u}" width="${r}" height="${d}" rx="${i}" ry="${i}" ${f} />`,c.f` <circle cx="${l}" cy="${s+a}" r="${a}" ${f} />`]}function ro(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=wa(i),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[c.f` <path d="M ${n} ${r+s} L ${n} ${r+a-s} A ${o} ${s} 0 0 0 ${n+i} ${r+a-s} L ${n+i} ${r+s} Z" ${l} />`,c.f` <ellipse cx="${n+o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function io(e,t){let{x:n,y:r,width:i,height:a}=e,{rx:o,ry:s}=Ta(a),l=c.f`fill="${t.fill}" stroke="${t.stroke}" stroke-width="${$.strokeWidth}"`;return[c.f` <path d="M ${n+i-o} ${r} H ${n+o} A ${o} ${s} 0 0 0 ${n+o} ${r+a} H ${n+i-o} Z" ${l} />`,c.f` <ellipse cx="${n+i-o}" cy="${r+s}" rx="${o}" ry="${s}" ${l} />`]}function ao(e,t){let n=e.x-t.x,r=e.y-t.y,i=Math.hypot(n,r);if(i===0)return``;let a=n/i,o=r/i,s=e.x-a*10,l=e.y-o*10;return c.f`<polygon class="c4-arrowhead" points="${e.x},${e.y} ${s-o*5},${l+a*5} ${s+o*5},${l-a*5}" `+`fill="var(--_text)" />`}function oo(e){let[t,n]=[e.points[0],e.points[e.points.length-1]];if(!t||!n||t===n)return``;let r=[`class="c4-relationship"`,c.f`data-from="${(0,c.escapeAttr)(e.from)}"`,c.f`data-to="${(0,c.escapeAttr)(e.to)}"`];e.label&&r.push(c.f`data-label="${(0,c.escapeAttr)(e.label)}"`),e.technology&&r.push(c.f`data-technology="${(0,c.escapeAttr)(e.technology)}"`);let i=e.curve?c.f`M ${t.x},${t.y} Q ${e.curve.x},${e.curve.y} ${n.x},${n.y}`:c.f`M ${t.x},${t.y} L ${n.x},${n.y}`,a=c.f`<path ${r.join(` `)} d="${i}" fill="none" stroke="var(--_text)" stroke-width="1" />`,o=e.curve??t,s=e.curve??n,l=ao(n,o),u=ao(t,s);return[a,...e.bidirectional?[l,u]:[e.reversed?u:l]].filter(Boolean).join(`
|
|
87
|
+
`)}function so(e){let t=(0,u.c4RelLabelLines)(e);if(t.length===0||!e.labelPosition)return``;let{x:n,y:r}=e.labelPosition,i=[c.f`<g class="c4-relationship-label" data-from="${(0,c.escapeAttr)(e.from)}" data-to="${(0,c.escapeAttr)(e.to)}">`];return t.forEach((a,o)=>{let s=e.technology!==void 0&&o===t.length-1,c=r+(o===0?0:$.messageSize+5);i.push($a(a,s&&e.technologyX!==void 0?e.technologyX:n,c,$.messageSize,s?`font-style="italic" fill="var(--_text)"`:`fill="var(--_text)"`))}),i.push(`</g>`),i.join(`
|
|
88
|
+
`)}var co={type:`xychart`,parse:u.parseXYChart,layoutForSvg:zi,renderSvg(e,t,n){let r=n.interactivity===void 0?n.interactive??!1:n.interactivity===`full`;return $i(e,t.colors,t.font,t.transparent,r,t.embedSource,t.title,t.decorative,t.emit)}},lo={type:`sequence`,parse:u.parseSequenceDiagram,layoutForSvg:gi,renderSvg(e,t){return _i(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}};function uo(e){return(e.interactivity??`static`)!==`none`}function fo(e){return(e.interactivity??`static`)===`full`}var po={type:`class`,parse:u.parseClassDiagram,layoutForSvg:Ar,renderSvg(e,t,n){return Pr(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,uo(n),t.emit)}},mo={type:`er`,parse:u.parseErDiagram,layoutForSvg(e,t){return $r((0,c.withDirectionOverride)(e,t.direction),t)},renderSvg(e,t){return ti(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},ho={type:`flowchart`,parse:(e,t)=>(0,u.parseMermaid)(t),layoutForSvg(e,t){return{graph:en((0,c.withDirectionOverride)(e,t.direction),t),curve:t.curve??e.initConfig?.curve??`linear`}},renderSvg(e,t,n){return fn(e.graph,t.colors,t.font,t.transparent,t.fontSizes,e.curve,t.embedSource,fo(n),uo(n),t.title,t.decorative,t.emit)}},go={type:`c4`,parse:u.parseC4Diagram,layoutForSvg(e,t){return Za(e,t)},renderSvg(e,t){return Qa(e,t.colors,t.font,t.transparent,t.fontSizes,t.embedSource,t.title,t.decorative,t.emit)}},_o={xychart:co,er:mo,sequence:lo,class:po,flowchart:ho,architecture:{type:`architecture`,parse:u.parseArchitecture,layoutForSvg(e,t){return{graph:Qt((0,c.withDirectionOverride)((0,u.architectureToGraph)(e),t.direction),t),curve:t.curve??`linear`}},renderSvg:ho.renderSvg},c4:go,pie:{type:`pie`,parse:(e,t)=>(0,u.parsePieChart)(t),layoutForSvg:da,renderSvg(e,t){return ma(e,t.colors,t.font,t.transparent,t.embedSource,t.title,t.decorative,t.emit)}}};function vo(e){return{bg:e.bg??c.DEFAULTS.bg,fg:e.fg??c.DEFAULTS.fg,line:e.line,accent:e.accent,muted:e.muted,surface:e.surface,border:e.border}}function yo(e={}){return(0,c.themeStyleDeclarations)(vo(e),e.transparent)}function bo(e){return{nonce:e.nonce,styleAttribute:e.styleAttribute}}function xo(e,t={}){let n=So(e,t);return t.resolveColors?Cr(n,vo(t)):n}function So(e,t){let n=(0,d.decodeXML)(e),r=vo(t),i=t.font??`Inter`;(0,c.setMonospaceMetrics)((0,c.isMonospaceFont)(i));let a=t.transparent??!1,o=M(t.fontSizes),s=(0,c.detectDiagramType)(n),l=t.embedSource?e:void 0,u=t.title,f=t.decorative,p=bo(t),m=(0,c.splitStatements)(n),h=_o[s],g=h.parse(m,n),_=h.layoutForSvg(g,t),v={colors:r,font:i,transparent:a,fontSizes:o,embedSource:l,title:u,decorative:f,emit:p};return h.renderSvg(_,v,t)}async function Co(e,t={}){return xo(e,t)}var wo=xo,To=Co;exports.ACTOR_LABEL_OFFSET=fi,exports.ARROW_HEAD=L,exports.CLS=H,exports.ELK_DIRECTION_FALLBACK=re,exports.FONT_SIZES=j,exports.FONT_WEIGHTS=N,exports.GROUP_HEADER_CONTENT_PAD=ee,exports.INLINE_CENTERED_EDGE_LABEL=ce,exports.MONO_FONT=k,exports.MONO_FONT_STACK=A,exports.NODE_PADDING=P,exports.PIE=X,exports.STROKE_WIDTHS=F,exports.TEXT_BASELINE_SHIFT=I,exports.baseElkLayoutOptions=oe,exports.boxLabelHeight=di,exports.buildElkEdge=z,exports.buildElkEdgeLabel=le,exports.buildElkLeafNode=se,exports.buildSvgStyleBlock=te,exports.classNoteId=wr,exports.clipEdgeToShape=je,exports.convertToElkFormat=tn,exports.createLayoutCache=x,exports.directionToElk=ie,exports.elkLayoutSync=w,exports.elkPadding=ae,exports.estimateMonoTextWidth=O,exports.estimateTextWidth=D,exports.evaluateCssColorValue=_r,exports.extractEdgeLabelPosition=We,exports.extractEdgePoints=Ue,exports.formatTickLabels=Xi,exports.layoutClassDiagramSync=Ar,exports.layoutErDiagramSync=$r,exports.layoutFlowchartSync=en,exports.layoutGraphSync=Qt,exports.layoutPieChart=da,exports.layoutSequenceDiagram=gi,exports.layoutXYChart=zi,exports.niceTickValues=Yi,exports.pieColorValue=fa,exports.pointsToPath=_,exports.renderClassSvg=Pr,exports.renderErSvg=ti,exports.renderMermaid=To,exports.renderMermaidSVG=xo,exports.renderMermaidSVGAsync=Co,exports.renderMermaidSync=wo,exports.renderPieSvg=ma,exports.renderSequenceSvg=_i,exports.renderSvg=fn,exports.renderXYChartSvg=$i,exports.resolveCssColors=Cr,exports.resolveFontSizes=M,exports.smoothCurvePath=ra,exports.themeCssVariables=yo,exports.withDataSrc=cr,exports.xLabelStep=Gi;
|
|
73
89
|
//# sourceMappingURL=index.cjs.map
|