27 lines
83 KiB
JavaScript
27 lines
83 KiB
JavaScript
|
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./c4Diagram-AAUBKEIU-BhUtgtBE.js","./dist-idVqPIzq.js","./package-Bop5TfAT.js","./runtime-core.esm-bundler-DO-WTVbd.js","./package-OvxnQO7z.css","./src-BrOGWJpF.js","./chunk-5ZQYHXKU-D-OgLpMs.js","./chunk-AGHRB4JF-Fz9kp2Fp.js","./chunk-CSCIHK7Q-VDPd5eNJ.js","./chunk-ND2GUHAM-zGgwlxna.js","./flowDiagram-I6XJVG4X-nqVkey0o.js","./chunk-O5CBEL6O-Bu7jDUJy.js","./channel-Dz5mnghj.js","./chunk-2J33WTMH-CruGLWY_.js","./chunk-3OPIFGDE-BBTvqaNI.js","./chunk-L5ZTLDWV-CzNJ_8is.js","./chunk-NZK2D7GU-Cte2JwiA.js","./rough.esm-DjrMDdlL.js","./chunk-55IACEB6-BXXbpqd4.js","./chunk-BSJP7CBP-BkJdmh17.js","./chunk-FMBD7UC4-CKA5OKZ8.js","./chunk-KSCS5N6A-BuXf0YOu.js","./chunk-LZXEDZCA-n9zJSIw5.js","./chunk-XPW4576I-SsWL9gHk.js","./erDiagram-TEJ5UH35-DEgxv-IW.js","./gitGraphDiagram-PVQCEYII-DoyI3hWK.js","./mermaid-parser.core-919mtcVP.js","./chunk-NNHCCRGN-DlpIbxXb.js","./chunk-4BX2VUAB-DnDF0gw2.js","./chunk-QZHKN3VN-DmWvf513.js","./ganttDiagram-6RSMTGT7-B5XdNYHP.js","./linear-DAeDjlp3.js","./defaultLocale-C8Fc0cco.js","./init-D6jRqBbL.js","./time-B8nkukJS.js","./infoDiagram-5YYISTIA-C0vYc3h2.js","./chunk-WU5MYG2G-h67ucwKy.js","./pieDiagram-4H26LBE5-CMzoHPw-.js","./ordinal-hYBb2elL.js","./arc-C_eH0vTw.js","./pie-CZr-MxNa.js","./quadrantDiagram-W4KKPZXB-BS8uQ6E6.js","./xychartDiagram-2RQKCTM6-AETQ-2hJ.js","./requirementDiagram-4Y6WPE33-pyX-Egau.js","./sequenceDiagram-3UESZ5HK-EhMFCxNn.js","./classDiagram-4FO5ZUOK-B-NZYxkE.js","./chunk-727SXJPM-DF6e3Zgf.js","./classDiagram-v2-Q7XG4LA2-B-NZYxkE.js","./stateDiagram-AJRCARHV-CBylKBpj.js","./dagre-Bx709z4p.js","./graphlib-B8gBHxth.js","./chunk-AQP2D5EJ-B3sX7UtP.js","./stateDiagram-v2-BHNVJYJU-f7X6eKbo.js","./journeyDiagram-JHISSGLW-Bls8b6p5.js","./timeline-definition-PNZ67QCA-BrR0Lwj6.js","./mindmap-definition-RKZ34NQL-jpsqOaHj.js","./kanban-definition-UN3LZRKU-D7NWNdGb.js","./sankeyDiagram-5OEKKPKP-BIl0S1dQ.js","./diagram-LMA3HP47-BlbmzDQ6.js","./diagram-2AECGRRQ-OITOieDL.js","./blockDiagram-GPEHLZMM-DkVCZJHC.js","./diagram-5GNKFQAL-CkpmTcRT.js","./architectureDiagram-3BPJPVTR-aQ-MRDKN.js","./cytoscape.esm-C8YCVR3_.js","./diagram-KO2AKTUF-Q-LQjcLw.js","./ishikawaDiagram-YF4QCWOH-CG_Ph_lH.js","./vennDiagram-CIIHVFJN-BkqtdITb.js","./diagram-OG6HWLK6-CcX1M4RU.js","./wardleyDiagram-YWT4CUSO-d1SlYFch.js"])))=>i.map(i=>d[i]);
|
||
|
|
import{D as e,r as t}from"./package-Bop5TfAT.js";import{i as n,n as r,r as i}from"./chunk-AGHRB4JF-Fz9kp2Fp.js";import{$ as a,C as o,E as s,I as c,L as l,N as u,P as d,Q as f,S as p,T as m,V as h,W as g,X as _,Z as v,_ as y,b,c as x,g as S,l as C,m as w,n as ee,p as te,q as ne,r as T,t as re,u as ie}from"./chunk-CSCIHK7Q-VDPd5eNJ.js";import{Q as E}from"./src-BrOGWJpF.js";import{G as ae,a as D,b as oe,f as se,g as ce,h as le,i as ue,o as de,v as fe,y as pe}from"./chunk-5ZQYHXKU-D-OgLpMs.js";import{t as me}from"./chunk-WU5MYG2G-h67ucwKy.js";import{n as he,t as ge}from"./chunk-XPW4576I-SsWL9gHk.js";import"./chunk-BSJP7CBP-BkJdmh17.js";import"./chunk-L5ZTLDWV-CzNJ_8is.js";import"./chunk-NZK2D7GU-Cte2JwiA.js";import{i as _e,o as ve}from"./chunk-O5CBEL6O-Bu7jDUJy.js";import"./chunk-3OPIFGDE-BBTvqaNI.js";import"./chunk-KSCS5N6A-BuXf0YOu.js";import{n as ye}from"./chunk-LZXEDZCA-n9zJSIw5.js";var be={rect:`rectangle`,circle:`ellipse`},xe={startOnLoad:!1,flowchart:{curve:`linear`},themeVariables:{fontSize:`20px`},maxEdges:500,maxTextSize:5e4},O=class{constructor({converter:e}){this.convert=(e,t)=>this.converter(e,{...t,fontSize:t.fontSize||20}),this.converter=e}},k;(function(e){e.ROUND=`round`,e.STADIUM=`stadium`,e.DOUBLECIRCLE=`doublecircle`,e.CIRCLE=`circle`,e.DIAMOND=`diamond`,e.CYLINDER=`cylinder`})(k||={});var A;(function(e){e.COLOR=`color`})(A||={});var j;(function(e){e.FILL=`fill`,e.STROKE=`stroke`,e.STROKE_WIDTH=`stroke-width`,e.STROKE_DASHARRAY=`stroke-dasharray`})(j||={});var Se=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.removeMarkdown=void 0,e.removeMarkdown=function(e,t){t===void 0&&(t={listUnicodeChar:``}),t||={},t.listUnicodeChar=t.hasOwnProperty(`listUnicodeChar`)?t.listUnicodeChar:!1,t.stripListLeaders=t.hasOwnProperty(`stripListLeaders`)?t.stripListLeaders:!0,t.gfm=t.hasOwnProperty(`gfm`)?t.gfm:!0,t.useImgAltText=t.hasOwnProperty(`useImgAltText`)?t.useImgAltText:!0,t.preserveLinks=t.hasOwnProperty(`preserveLinks`)?t.preserveLinks:!1;var n=e||``;n=n.replace(/^(-\s*?|\*\s*?|_\s*?){3,}\s*$/gm,``);try{t.stripListLeaders&&(n=t.listUnicodeChar?n.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,t.listUnicodeChar+` $1`):n.replace(/^([\s\t]*)([\*\-\+]|\d+\.)\s+/gm,`$1`)),t.gfm&&(n=n.replace(/\n={2,}/g,`
|
||
|
|
`).replace(/~{3}.*\n/g,``).replace(/~~/g,``).replace(/`{3}.*\n/g,``)),t.preserveLinks&&(n=n.replace(/\[(.*?)\][\[\(](.*?)[\]\)]/g,`$1 ($2)`)),n=n.replace(/<[^>]*>/g,``).replace(/^[=\-]{2,}\s*$/g,``).replace(/\[\^.+?\](\: .*?$)?/g,``).replace(/\s{0,2}\[.*?\]: .*?$/g,``).replace(/\!\[(.*?)\][\[\(].*?[\]\)]/g,t.useImgAltText?`$1`:``).replace(/\[(.*?)\][\[\(].*?[\]\)]/g,`$1`).replace(/^\s{0,3}>\s?/g,``).replace(/(^|\n)\s{0,3}>\s?/g,`
|
||
|
|
|
||
|
|
`).replace(/^\s{1,2}\[(.*?)\]: (\S+)( ".*?")?\s*$/g,``).replace(/^(\n)?\s{0,}#{1,6}\s+| {0,}(\n)?\s{0,}#{0,} {0,}(\n)?\s{0,}$/gm,`$1$2$3`).replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g,`$2`).replace(/([\*_]{1,3})(\S.*?\S{0,1})\1/g,`$2`).replace(/(`{3,})(.*?)\1/gm,`$2`).replace(/`(.+?)`/g,`$1`).replace(/\n{2,}/g,`
|
||
|
|
|
||
|
|
`)}catch(t){return console.error(t),e}return n}}))(),Ce={arrow_circle:{endArrowhead:`circle`},arrow_cross:{endArrowhead:`bar`},arrow_open:{endArrowhead:null,startArrowhead:null},double_arrow_circle:{endArrowhead:`circle`,startArrowhead:`circle`},double_arrow_cross:{endArrowhead:`bar`,startArrowhead:`bar`},double_arrow_point:{endArrowhead:`arrow`,startArrowhead:`arrow`}},we=e=>Ce[e],Te=e=>{let t=e.text;return e.labelType===`markdown`&&(t=(0,Se.removeMarkdown)(e.text)),Ee(t)},Ee=e=>e.replace(/\s?(fa|fab):[a-zA-Z0-9-]+/g,``),De=e=>{let t={};return Object.keys(e).forEach(n=>{switch(n){case j.FILL:t.backgroundColor=e[n],t.fillStyle=`solid`;break;case j.STROKE:t.strokeColor=e[n];break;case j.STROKE_WIDTH:t.strokeWidth=Number(e[n]?.split(`px`)[0]);break;case j.STROKE_DASHARRAY:t.strokeStyle=`dashed`;break}}),t},Oe=e=>{let t={};return Object.keys(e).forEach(n=>{switch(n){case A.COLOR:t.strokeColor=e[n];break}}),t},ke=(e,t)=>[e,t],Ae=32,je=.62,Me=12,Ne=12,Pe=(e,t)=>Math.max(20,Math.ceil(e.length*t*je)),Fe=(e,t,n,r)=>{let i=r||20;if(e!==k.CYLINDER||!t||t.includes(`
|
||
|
|
`))return i;let a=Math.max(20,n-Me);return Pe(t,i)<=a?i:Math.max(Ne,Math.floor(a/(t.length*je)))},Ie=e=>{let t={};e.subGraphs.map(n=>{n.nodeIds.forEach(r=>{t[n.id]={id:n.id,parent:null,isLeaf:!1},t[r]={id:r,parent:n.id,isLeaf:e.vertices[r]!==void 0}})});let n={};return[...Object.keys(e.vertices),...e.subGraphs.map(e=>e.id)].forEach(e=>{if(!t[e])return;let r=t[e],i=[];for(r.isLeaf||i.push(`subgraph_group_${r.id}`);r.parent;)i.push(`subgraph_group_${r.parent}`),r=t[r.parent];n[e]=i}),{getGroupIds:e=>n[e]||[],getParentId:e=>t[e]?t[e].parent:null}},Le=new O({converter:(e,t)=>{let n=[],r=t.fontSize,{getGroupIds:i,getParentId:a}=Ie(e);return e.subGraphs.reverse().forEach(e=>{let t=i(e.id),a=Te(e),o=Pe(a,r||16)+Ae*2,s=Math.max(e.width,o),c=e.x-(s-e.width)/2,l=De(e.containerStyle),u=Oe(e.labelStyle),d={id:e.id,type:`rectangle`,groupIds:t,x:c,y:e.y,width:s,height:e.height,label:{groupIds:t,text:a,fontSize:r,verticalAlign:`top`,...u},...l};n.push(d)}),Object.values(e.vertices).forEach(e=>{if(!e)return;let t=i(e.id),a=Te(e),o=Fe(e.type,a,e.width,r),s=De(e.containerStyle),c=Oe(e.labelStyle),l={id:e.id,type:`rectangle`,groupIds:t,x:e.x,y:e.y,width:e.width,height:e.height,strokeWidth:2,label:{groupIds:t,text:a,fontSize:o,...c},link:e.link||null,...s};switch(e.type){case k.STADIUM:l={...l,roundness:{type:3}};break;case k.ROUND:l={...l,roundness:{type:3}};break;case k.DOUBLECIRCLE:{t.push(`doublecircle_${e.id}}`);let r={type:`ellipse`,groupIds:t,x:e.x+5,y:e.y+5,width:e.width-10,height:e.height-10,strokeWidth:2,roundness:{type:3},label:{groupIds:t,text:a,fontSize:o,...c}};l={...l,groupIds:t,type:`ellipse`},n.push(r);break}case k.CIRCLE:l.type=`ellipse`;break;case k.DIAMOND:l.type=`diamond`;break}n.push(l)}),e.edges.forEach(e=>{let t=[],o=a(e.start),s=a(e.end);o&&o===s&&(t=i(o));let{startX:c,startY:l,reflectionPoints:u}=e,d=u.map(e=>ke(e.x-u[0].x,e.y-u[0].y)),f=we(e.type||`arrow_point`),p=n.find(t=>t.id===e.start),m=n.find(t=>t.id===e.end);if(!p||!m)return;let h={id:`${e.start}_${e.end}`,type:`arrow`,groupIds:t,x:c,y:l,strokeWidth:e.stroke===`thick`?4:2,strokeStyle:e.stroke===`dotted`?`dashed`:void 0,points:d,...e.text?{label:{text:Te(e),fontSize:r,groupIds:t}}:{},roundness:{type:2},...f,start:{id:p.id||``},end:{id:m.id||``}};n.push(h)}),{elements:n}}}),M=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce((e,t)=>(t&=63,t<36?e+=t.toString(36):t<62?e+=(t-26).toString(36).toUpperCase():t>62?e+=`-`:e+=`_`,e),``),Re=new O({converter:e=>{let t=M(),{width:n,height:r}=e,i={type:`image`,x:0,y:0,width:n,height:r,status:`saved`,fileId:t};return{files:{[t]:{id:t,mimeType:e.mimeType,dataURL:e.dataURL}},elements:[i]}}}),ze=(e,t)=>[e,t],Be=e=>e.replace(/\\n/g,`
|
||
|
|
`),N=e=>{let t={type:`line`,x:e.startX,y:e.startY,points:[ze(0,0),ze(e.endX-e.startX,e.endY-e.startY)],width:e.endX-e.startX,height:e.endY-e.startY,strokeStyle:e.strokeStyle||`solid`,strokeColor:e.strokeColor||`#000`,strokeWidth:e.strokeWidth||1};return e.groupId&&Object.assign(t,{groupIds:[e.groupId]}),e.id&&Object.assign(t,{id:e.id}),t},P=e=>{let t={type:`text`,x:e.x,y:e.y,width:e.width,height:e.height,text:Be(e.text)||``,fontSize:e.fontSize,verticalAlign:`top`,strokeColor:e.color};return e.groupId&&Object.assign(t,{groupIds:[e.groupId]}),e.id&&Object.assign(t,{id:e.id}),t},Ve=e=>{let t={text:Be(e?.label?.text||``),fontSize:e?.label?.fontSize,textAlign:e.label?.textAlign,verticalAlign:e.label?.verticalAlign||`middle`,strokeColor:e.label?.color||`#000`,...e.groupId?{groupIds:[e.groupId]}:{}},n={};e.type===`rectangle`&&e.subtype===`activation`&&(n={backgroundColor:`#e9ecef`,fillStyle:`solid`});let r={id:e.id,type:e.type,x:e.x,y:e.y,width:e.width,height:e.height,label:t,strokeStyle:e?.strokeStyle,strokeWidth:e?.strokeWidth,strokeColor:e?.strokeColor,backgroundColor:e?.bgColor,fillStyle:`solid`,...n};return e.groupId&&Object.assign(r,{groupIds:[e.groupId]}),r},He=e=>{let t={type:`arrow`,x:e.startX,y:e.startY,points:e.points?.map(([e,t])=>ze(e,t))||[ze(0,0),ze(e.endX-e.startX,e.endY-e.startY)],width:e.endX-e.startX,height:e.endY-e.startY,strokeStyle:e?.strokeStyle||`solid`,endArrowhead:e?.endArrowhead||null,startArrowhead:e?.startArrowhead||null,label:{text:Be(e?.label?.text||``),fontSize:16,textAlign:e?.label?.textAlign,verticalAlign:e?.label?.verticalAlign},roundness:{type:2},start:e.start,end:e.end};return e.groupId&&Object.assign(t,{groupIds:[e.groupId]}),t},Ue=10,We=16,Ge=24,Ke=4,qe=e=>{if(!e)return!0;let t=e.trim().toLowerCase();return t===`transparent`||t===`none`||t===`rgba(0,0,0,0)`||t===`rgba(0, 0, 0, 0)`},Je=(e,t)=>Math.max(20,Math.round(e.length*t*.6)),Ye=(e,t,n=!0)=>{let r=e,i=r.groupIds??[];if(i.includes(t)||(r.groupIds=[...i,t]),!n||!r.label)return;let a=r.label.groupIds??[];a.includes(t)||(r.label.groupIds=[...a,t])},Xe=new O({converter:e=>{let t=[],n=[];if(Object.values(e.nodes).forEach(e=>{!e||!e.length||e.forEach(e=>{let r;switch(e.type){case`line`:r=N(e);break;case`rectangle`:case`ellipse`:r=Ve(e);break;case`text`:r=P(e);break;default:throw`unknown type ${e.type}`}e.type===`rectangle`&&e?.subtype===`activation`?n.push(r):t.push(r)})}),Object.values(e.lines).forEach(e=>{e&&t.push(N(e))}),Object.values(e.arrows).forEach(e=>{e&&(t.push(He(e)),e.sequenceNumber&&t.push(Ve(e.sequenceNumber)))}),t.push(...n),e.loops){let{lines:n,texts:r,nodes:i}=e.loops;n.forEach(e=>{t.push(N(e))}),r.forEach(e=>{t.push(P(e))}),i.forEach(e=>{t.push(Ve(e))})}return e.groups&&e.groups.forEach(e=>{let{actorKeys:n,name:r}=e,i=1/0,a=1/0,o=0,s=0;if(!n.length)return;let c=t.filter(e=>{if(e.id){let t=e.id.indexOf(`-`),r=e.id.substring(0,t);return n.includes(r)}return!1});if(!c.length||(c.forEach(e=>{e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0||(i=Math.min(i,e.x),a=Math.min(a,e.y),o=Math.max(o,e.x+e.width),s=Math.max(s,e.y+e.height))}),!Number.isFinite(i)||!Number.isFinite(a)||!Number.isFinite(o)||!Number.isFinite(s)))return;let l=i-Ue,u=a-Ue,d=o-i+Ue*2,f=s-a+Ue*2,p=M(),m=M(),h=Ve({type:`rectangle`,x:l,y:u,width:d,height:f,bgColor:qe(e.fill)?void 0:e.fill,strokeColor:`#1f1f1f`,strokeWidth:1,id:p,groupId:m});if(t.unshift(h),t.forEach(e=>{e.id!==p&&(e.x===void 0||e.y===void 0||e.width===void 0||e.height===void 0||e.x>=i&&e.x+e.width<=o&&e.y>=a&&e.y+e.height<=s&&Ye(e,m))}),r){let e=P({type:`text`,id:M(),text:r,x:l+Ke,y:u-Ge,width:Je(r,We),height:24,fontSize:We,color:`#1f1f1f`,groupId:m});Ye(e,m,!1),t.push(e)}}),{elements:t}}}),Ze=new O({converter:e=>{let t=[];return e.nodes.forEach(e=>{!e||!e.length||e.forEach(e=>{let n;switch(e.type){case`line`:n=N(e);break;case`rectangle`:case`ellipse`:n=Ve(e);break;case`text`:n=P(e);break;default:throw`unknown type ${e.type}`}t.push(n)})}),Object.values(e.lines).forEach(e=>{e&&t.push(N(e))}),Object.values(e.arrows).forEach(e=>{if(!e)return;let n=He(e);t.push(n)}),Object.values(e.text
|
||
|
|
`):e.text,F,dt=()=>{if(F!==void 0)return F;if(typeof document>`u`)return F=null,F;try{F=document.createElement(`canvas`).getContext(`2d`)}catch{F=null}return F},I=(e,t)=>{let n=dt();return n?(n.font=`${t}px Excalifont, sans-serif`,n.measureText(e).width):e.length*t*.6},ft=(e,t,n)=>{if(I(e,t)<=n)return[e];let r=[],i=``;for(let a of e){let e=`${i}${a}`;if(i&&I(e,t)>n){r.push(i),i=a;continue}i=e}return i&&r.push(i),r},pt=(e,t,n)=>{if(!e.trim()||I(e,t)<=n)return e;let r=e.split(/\s+/).filter(Boolean),i=[],a=``;for(let e of r){let r=ft(e,t,n);for(let[e,o]of r.entries()){let r=a?`${a}${a&&e===0?` `:``}${o}`:o;if(I(r,t)<=n){a=r;continue}a&&i.push(a),a=o}r.length}return i.push(a),i.join(`
|
||
|
|
`)},mt=(e,t,n)=>{let r=e.map(e=>pt(e,t,n)).join(`
|
||
|
|
`).split(`
|
||
|
|
`);return{width:Math.max(...r.map(e=>I(e,t))),height:r.length*t*st}},ht=(e,t,n,r)=>{let i=e.split(`
|
||
|
|
`);for(let e=et;e>=tt;e-=nt){let{height:r}=mt(i,e,t);if(r<=n)return e}return r},gt=e=>{let t=ut(e);if(!t||ct.has(e.shape))return et;let n=Math.max(1,e.width-at),r=Math.max(1,e.height-ot),i=t.split(`
|
||
|
|
`);return i.length>1&&Math.max(...i.map(e=>I(e,et)))<=n?et:ht(t,n,r,i.length===1?et:tt)},_t=e=>{if(ct.has(e.shape))return;let t=ut(e);if(t)return{text:t,fontSize:gt(e),verticalAlign:e.shape===`rectWithTitle`||e.shape===`roundedWithTitle`?`top`:`middle`,...Oe(e.labelStyle)}},vt=e=>{let t=De(e.containerStyle),n=_t(e),r=e.shape===`choice`?`diamond`:e.shape===`stateStart`||e.shape===`stateEnd`?`ellipse`:`rectangle`,i=e.shape===`rect`||e.shape===`rectWithTitle`||e.shape===`roundedWithTitle`,a=e.shape===`stateStart`||e.shape===`fork`||e.shape===`join`,o=t.backgroundColor||t.strokeColor||rt,s=t.strokeColor||t.backgroundColor||rt;return{id:e.id,type:r,...lt(e)?{groupIds:lt(e)}:{},x:e.x,y:e.y,width:e.width,height:e.height,...n?{label:n}:{},...t,...i?{roundness:{type:3}}:{},...a?{backgroundColor:o,strokeColor:s,fillStyle:`solid`}:{}}},yt=e=>{if(!e.dividerLine)return null;let t=De(e.containerStyle);return{id:`${e.id}__divider`,type:`line`,x:e.dividerLine.startX,y:e.dividerLine.startY,width:e.dividerLine.endX-e.dividerLine.startX,height:e.dividerLine.endY-e.dividerLine.startY,points:[$e(0,0),$e(e.dividerLine.endX-e.dividerLine.startX,e.dividerLine.endY-e.dividerLine.startY)],strokeColor:t.strokeColor||`#000`,strokeWidth:t.strokeWidth||1}},bt=e=>{let t=De(e.containerStyle),n=Math.max(2,Math.min(e.width,e.height)*.32),r=e.endInnerColor||t.strokeColor||t.backgroundColor||rt;return{id:`${e.id}__inner`,type:`ellipse`,groupIds:lt(e),x:e.x+n,y:e.y+n,width:Math.max(1,e.width-n*2),height:Math.max(1,e.height-n*2),backgroundColor:r,strokeColor:r,fillStyle:`solid`,strokeWidth:1}},xt=e=>{let t=e.reflectionPoints.map((e,t,n)=>{let r=n[0];return t===0?$e(0,0):$e(e.x-r.x,e.y-r.y)});return{id:e.id,type:`arrow`,x:e.startX,y:e.startY,width:e.endX-e.startX,height:e.endY-e.startY,points:t,strokeColor:e.strokeColor||`#000`,strokeWidth:e.strokeWidth||2,strokeStyle:e.strokeStyle||`solid`,endArrowhead:e.isNoteEdge?null:`triangle`,roundness:{type:2},start:{id:e.start},end:{id:e.end},...e.text?{label:{text:e.text,fontSize:16}}:{}}},St=new O({converter:e=>{let t=[];return e.nodes.forEach(e=>{if(!e.isRenderable)return;let n=vt(e);t.push(n);let r=yt(e);r&&t.push(r),e.shape===`stateEnd`&&t.push(bt(e))}),e.edges.forEach(e=>{t.push(xt(e))}),{elements:t}}}),L=e=>{e=wt(e);let t=e.replace(/#(\d+);/g,`&#$1;`).replace(/#([a-z]+);/g,`&$1;`),n=document.createElement(`textarea`);return n.innerHTML=t,n.value},R=e=>{let t=e.getAttribute(`transform`)?.match(/translate\(([ \d.-]+),\s*([\d.-]+)\)/),n=0,r=0;return t&&(n=Number(t[1]),r=Number(t[2])),{transformX:n,transformY:r}},Ct=e=>{let t=e;return t=t.replace(/style.*:\S*#.*;/g,e=>e.substring(0,e.length-1)),t=t.replace(/classDef.*:\S*#.*;/g,e=>e.substring(0,e.length-1)),t=t.replace(/#\w+;/g,e=>{let t=e.substring(1,e.length-1);return/^\+?\d+$/.test(t)?`fl°°${t}¶ß`:`fl°${t}¶ß`}),t},wt=function(e){return e.replace(/fl°°/g,`#`).replace(/fl°/g,`&`).replace(/¶ß/g,`;`)},Tt=.5,Et=(e,t=Tt)=>{let n=[];return e.forEach(e=>{let r=n[n.length-1];if(!r){n.push(e);return}Math.hypot(e[0]-r[0],e[1]-r[1])<=t||n.push(e)}),n},Dt=e=>{let t=e.getAttribute(`d`);if(!t)return null;let n=Array.from(t.matchAll(/-?\d*\.?\d+(?:e[-+]?\d+)?/gi),e=>Number(e[0]));return n.length<4?null:{startX:n[0],startY:n[1],endX:n[n.length-2],endY:n[n.length-1]}},Ot=e=>{let t=e.getAttribute(`data-points`);if(!t){let t=Dt(e);return t?[{x:t.startX,y:t.startY},{x:t.endX,y:t.endY}]:[]}try{let e=atob(t),n=JSON.parse(e);return Array.isArray(n)?n.filter(e=>e&&typeof e.x==`number`&&typeof e.y==`number`&&Number.isFinite(e.x)&&Number.isFinite(e.y)):[]}catch{return[]}},kt=(e,t={x:0,y:0},n=`LM`)=>{if(e.tagName.toLowerCase()!==`path`)throw Error(`Invalid input: Expected an HTMLElement of tag "path", got ${e.tagName}`);let r=e.getAttribute(`d`);if(!r)throw Error(`Path element does not contain a "d" attribute`);let i=r.split(RegExp(`(?=[${n}])`)),a=i[0].substring(1).split(`,`).map(e=>parseFloat(e)),o=i[i.length-1].substring(1).split(`,`).map(e=>parseFloat(e)),s=i.map(e=>{let t=e[0],n=e.substring(1).split(`,`).map(e=>parseFloat(e));return t===`C`?{x:n[4],y:n[5],command:t}:{
|
||
|
|
`);let r=me(t),a=r.append(`g`);r.attr(`viewBox`,`0 0 2412 512`),x(r,100,512,!0),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m411.313,123.313c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32-9.375,9.375-20.688-20.688c-12.484-12.5-32.766-12.5-45.25,0l-16,16c-1.261,1.261-2.304,2.648-3.31,4.051-21.739-8.561-45.324-13.426-70.065-13.426-105.867,0-192,86.133-192,192s86.133,192 192,192 192-86.133 192-192c0-24.741-4.864-48.327-13.426-70.065 1.402-1.007 2.79-2.049 4.051-3.31l16-16c12.5-12.492 12.5-32.758 0-45.25l-20.688-20.688 9.375-9.375 32.001-31.999zm-219.313,100.687c-52.938,0-96,43.063-96,96 0,8.836-7.164,16-16,16s-16-7.164-16-16c0-70.578 57.422-128 128-128 8.836,0 16,7.164 16,16s-7.164,16-16,16z`),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m459.02,148.98c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l16,16c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16.001-16z`),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m340.395,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688 6.25-6.25 6.25-16.375 0-22.625l-16-16c-6.25-6.25-16.375-6.25-22.625,0s-6.25,16.375 0,22.625l15.999,16z`),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m400,64c8.844,0 16-7.164 16-16v-32c0-8.836-7.156-16-16-16-8.844,0-16,7.164-16,16v32c0,8.836 7.156,16 16,16z`),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m496,96.586h-32c-8.844,0-16,7.164-16,16 0,8.836 7.156,16 16,16h32c8.844,0 16-7.164 16-16 0-8.836-7.156-16-16-16z`),a.append(`path`).attr(`class`,`error-icon`).attr(`d`,`m436.98,75.605c3.125,3.125 7.219,4.688 11.313,4.688 4.094,0 8.188-1.563 11.313-4.688l32-32c6.25-6.25 6.25-16.375 0-22.625s-16.375-6.25-22.625,0l-32,32c-6.251,6.25-6.251,16.375-0.001,22.625z`),a.append(`text`).attr(`class`,`error-text`).attr(`x`,1440).attr(`y`,250).attr(`font-size`,`150px`).style(`text-anchor`,`middle`).text(`Syntax error in text`),a.append(`text`).attr(`class`,`error-text`).attr(`x`,1250).attr(`y`,400).attr(`font-size`,`100px`).style(`text-anchor`,`middle`).text(`mermaid version ${n}`)},`draw`)},tr=er,nr={db:{},renderer:er,parser:{parse:r(()=>{},`parse`)}},rr=`flowchart-elk`,ir={id:rr,detector:r((e,t={})=>/^\s*flowchart-elk/.test(e)||/^\s*(flowchart|graph)/.test(e)&&t?.flowchart?.defaultRenderer===`elk`?(t.layout=`elk`,!0):!1,`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./flowDiagram-I6XJVG4X-nqVkey0o.js`);return{diagram:e}},__vite__mapDeps([10,11,5,6,1,2,3,4,7,8,12,13,14,15,16,17,18,19,20,21,22,9,23]),import.meta.url);return{id:rr,diagram:e}},`loader`)},ar=`timeline`,or={id:ar,detector:r(e=>/^\s*timeline/.test(e),`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./timeline-definition-PNZ67QCA-BrR0Lwj6.js`);return{diagram:e}},__vite__mapDeps([54,5,39,6,1,2,3,4,7,8,36]),import.meta.url);return{id:ar,diagram:e}},`loader`)},sr=`mindmap`,cr={id:sr,detector:r(e=>/^\s*mindmap/.test(e),`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./mindmap-definition-RKZ34NQL-jpsqOaHj.js`);return{diagram:e}},__vite__mapDeps([55,11,5,6,1,2,3,4,7,8,13,14,15,16,17,18,19,21,22]),import.meta.url);return{id:sr,diagram:e}},`loader`)},lr=`kanban`,ur={id:lr,detector:r(e=>/^\s*kanban/.test(e),`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./kanban-definition-UN3LZRKU-D7NWNdGb.js`);return{diagram:e}},__vite__mapDeps([56,11,5,6,1,2,3,4,7,8,14,15,16,17,20,36,23]),import.meta.url);return{id:lr,diagram:e}},`loader`)},dr=`sankey`,fr={id:dr,detector:r(e=>/^\s*sankey(-beta)?/.test(e),`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./sankeyDiagram-5OEKKPKP-BIl0S1dQ.js`);return{diagram:e}},__vite__mapDeps([57,5,38,33,7,2,3,4,8]),import.meta.url);return{id:dr,diagram:e}},`loader`)},pr=`packet`,mr={id:pr,detector:r(e=>/^\s*packet(-beta)?/.test(e),`detector`),loader:r(async()=>{let{diagram:e}=await t(async()=>{let{diagram:e}=await import(`./diagram-LMA3HP4
|
||
|
|
`;try{p(i)}catch{let e=o(i);if(!e)throw new re(`Diagram ${i} not found.`);let{id:t,diagram:n}=await e();u(t,n)}let{db:a,parser:s,renderer:c,init:l}=p(i);return s.parser&&(s.parser.yy=a),a.clear?.(),l?.(r),n.title&&a.setDiagramTitle?.(n.title),await s.parse(t),new e(i,t,a,s,c)}async render(e,t){await this.renderer.draw(this.text,e,t,this)}getParser(){return this.parser}getType(){return this.type}},Br=[],Vr=r(()=>{Br.forEach(e=>{e()}),Br=[]},`attachFunctions`),Hr=r(e=>e.replace(/^\s*%%(?!{)[^\n]+\n?/gm,``).trimStart(),`cleanupComments`);function Ur(e){let t=e.match(y);if(!t)return{text:e,metadata:{}};let n=he(t[1],{schema:ge})??{};n=typeof n==`object`&&!Array.isArray(n)?n:{};let r={};return n.displayMode&&(r.displayMode=n.displayMode.toString()),n.title&&(r.title=n.title.toString()),n.config&&(r.config=n.config),{text:e.slice(t[0].length),metadata:r}}r(Ur,`extractFrontMatter`);var Wr=r(e=>e.replace(/\r\n?/g,`
|
||
|
|
`).replace(/<(\w+)([^>]*)>/g,(e,t,n)=>`<`+t+n.replace(/="([^"]*)"/g,`='$1'`)+`>`),`cleanupText`),Gr=r(e=>{let{text:t,metadata:n}=Ur(e),{displayMode:r,title:i,config:a={}}=n;return r&&(a.gantt||={},a.gantt.displayMode=r),{title:i,config:a,text:t}},`processFrontmatter`),Kr=r(e=>{let t=ce.detectInit(e)??{},n=ce.detectDirective(e,`wrap`);return Array.isArray(n)?t.wrap=n.some(({type:e})=>e===`wrap`):n?.type===`wrap`&&(t.wrap=!0),{text:le(e),directive:t}},`processDirectives`);function qr(e){let t=Gr(Wr(e)),n=Kr(t.text),r=ue(t.config,n.directive);return e=Hr(n.text),{code:e,title:t.title,config:r}}r(qr,`preprocessDiagram`);function Jr(e){let t=new TextEncoder().encode(e),n=Array.from(t,e=>String.fromCodePoint(e)).join(``);return btoa(n)}r(Jr,`toBase64`);var Yr=5e4,Xr=`graph TB;a[Maximum text size in diagram exceeded];style a fill:#faa`,Zr=`sandbox`,Qr=`loose`,$r=`http://www.w3.org/2000/svg`,ei=`http://www.w3.org/1999/xlink`,ti=`http://www.w3.org/1999/xhtml`,ni=`100%`,ri=`100%`,ii=`border:0;margin:0;`,ai=`margin:0`,oi=`allow-top-navigation-by-user-activation allow-popups`,si=`The "iframe" tag is not supported by your browser.`,ci=[`foreignobject`],li=[`dominant-baseline`];function ui(e){let t=qr(e);return c(),ee(t.config??{}),t}r(ui,`processAndSetConfigs`);async function di(e,t){Pr();try{let{code:t,config:n}=ui(e);return{diagramType:(await Ci(t)).type,config:n}}catch(e){if(t?.suppressErrors)return!1;throw e}}r(di,`parse`);var fi=r((e,t,n=[])=>`.${e} ${t} ${l(`{ ${n.join(` !important; `)} !important; }`)}`,`cssImportantStyles`),pi=r((e,t=new Map)=>{let n=new CSSStyleSheet;if(e.fontFamily!==void 0&&n.insertRule(`:root { --mermaid-font-family: ${e.fontFamily}}`,n.cssRules.length),e.altFontFamily!==void 0&&n.insertRule(`:root { --mermaid-alt-font-family: ${e.altFontFamily}}`,n.cssRules.length),t instanceof Map){let r=m(e)?[`> *`,`span`]:[`rect`,`polygon`,`ellipse`,`circle`,`path`];t.forEach(e=>{Nt(e.styles)||r.forEach(t=>{n.insertRule(fi(e.id,t,e.styles),n.cssRules.length)}),Nt(e.textStyles)||n.insertRule(fi(e.id,`tspan`,(e?.textStyles||[]).map(e=>e.replace(`color`,`fill`))),n.cssRules.length)})}let r=``;if(e.themeCSS!==void 0)if(typeof n.replaceSync==`function`){let t=new CSSStyleSheet;t.replaceSync(e.themeCSS),r=C(t)+`
|
||
|
|
`}else r+=`${e.themeCSS}
|
||
|
|
`;return r+C(n)},`createCssStyles`),mi=r((e,t)=>_n(fn(`${e}{${t}}`),yn([r(function(t,n,r,a){if(t.type===`rule`&&Array.isArray(t.props)){if(t.parent&&t.parent.type===`@keyframes`)return;t.props=t.props.map(t=>t.startsWith(e)?t:`${e} ${t}`)}else t.type.startsWith(`@`)&&([`@media`,`@supports`,`@layer`,`@scope`,`@container`,`@starting-style`,`@keyframes`].includes(t.type)||(i.warn(`Removing unsupported at-rule ${t.type} from CSS`),t.type=Pt))},`addNamespace`),vn])),`compileCSS`),hi=r((e,t,n,r)=>mi(r,_(t,pi(e,n),{...e.themeVariables,theme:e.theme,look:e.look},r)),`createUserStyles`),gi=r((e=``,t,n)=>{let r=e;return!n&&!t&&(r=r.replace(/marker-end="url\([\d+./:=?A-Za-z-]*?#/g,`marker-end="url(#`)),r=D(r),r=r.replace(/<br>/g,`<br/>`),r},`cleanUpSvgCode`),_i=r((e=``,t)=>`<iframe style="width:${ni};height:${t?.viewBox?.baseVal?.height?t.viewBox.baseVal.height+`px`:ri};${ii}" src="data:text/html;charset=UTF-8;base64,${Jr(`<body style="${ai}">${e}</body>`)}" sandbox="${oi}">
|
||
|
|
${si}
|
||
|
|
</iframe>`,`putIntoIFrame`),vi=r((e,t,n,r,i)=>{let a=e.append(`div`);a.attr(`id`,n),r&&a.attr(`style`,r);let o=a.append(`svg`).attr(`id`,t).attr(`width`,`100%`).attr(`xmlns`,$r);return i&&o.attr(`xmlns:xlink`,i),o.append(`g`),e},`appendDivSvgG`);function yi(e,t){return e.append(`iframe`).attr(`id`,t).attr(`style`,`width: 100%; height: 100%;`).attr(`sandbox`,``)}r(yi,`sandboxedIframe`);var bi=r((e,t,n,r)=>{e.getElementById(t)?.remove(),e.getElementById(n)?.remove(),e.getElementById(r)?.remove()},`removeExistingElements`),xi=r(async function(e,t,n){Pr();let o=ui(t);t=o.code;let s=b();i.debug(s),t.length>(s?.maxTextSize??Yr)&&(t=Xr);let c=`#${e}`,l=`i`+e,u=`#`+l,d=`d`+e,f=`#`+d,p=r(()=>{let e=E(h?u:f).node();e&&`remove`in e&&e.remove()},`removeTempElements`),m=E(document.body),h=s.securityLevel===Zr,g=s.securityLevel===Qr,_=s.fontFamily;n===void 0?(bi(document,e,d,l),h?(m=E(yi(E(document.body),l).nodes()[0].contentDocument.body),m.node().style.margin=`0`):m=E(`body`),vi(m,e,d)):(n&&(n.innerHTML=``),h?(m=E(yi(E(n),l).nodes()[0].contentDocument.body),m.node().style.margin=`0`):m=E(n),vi(m,e,d,`font-family: ${_}`,ei));let v,y;try{v=await zr.fromText(t,{title:o.title})}catch(e){if(s.suppressErrorRendering)throw p(),e;v=await zr.fromText(`error`),y=e}let x=m.select(f).node(),C=v.type,w=x.firstChild,ee=w.firstChild,te=v.renderer.getClasses?.(t,v),ne=hi(s,C,te,c),T=document.createElement(`style`);T.innerHTML=ne,w.insertBefore(T,ee);try{await v.renderer.draw(t,e,`11.15.0`,v)}catch(n){throw s.suppressErrorRendering?p():tr.draw(t,e,`11.15.0`),n}let re=m.select(`${f} svg`),ie=v.db.getAccTitle?.(),ae=v.db.getAccDescription?.();wi(C,re,ie,ae),m.select(`[id="${e}"]`).selectAll(`foreignobject > *`).attr(`xmlns`,ti);let D=m.select(f).node().innerHTML;if(i.debug(`config.arrowMarkerAbsolute`,s.arrowMarkerAbsolute),D=gi(D,h,S(s.arrowMarkerAbsolute)),h){let e=m.select(f+` svg`).node();D=_i(D,e)}else g||(D=a.sanitize(D,{ADD_TAGS:ci,ADD_ATTR:li,HTML_INTEGRATION_POINTS:{foreignobject:!0}}));if(Vr(),y)throw y;return p(),{diagramType:C,svg:D,bindFunctions:v.db.bindFunctions}},`render`);function Si(e={}){let t=T({},e);t?.fontFamily&&!t.themeVariables?.fontFamily&&(t.themeVariables||={},t.themeVariables.fontFamily=t.fontFamily),h(t),t?.theme&&t.theme in v?t.themeVariables=v[t.theme].getThemeVariables(t.themeVariables):t&&(t.themeVariables=v.default.getThemeVariables(t.themeVariables)),n((typeof t==`object`?ne(t):s()).logLevel),Pr()}r(Si,`initialize`);var Ci=r((e,t={})=>{let{code:n}=qr(e);return zr.fromText(n,t)},`getDiagramFromText`);function wi(e,t,n,r){Lr(t,e),Rr(t,n,r,t.attr(`id`))}r(wi,`addA11yInfo`);var K=Object.freeze({render:xi,parse:di,getDiagramFromText:Ci,initialize:Si,getConfig:b,setConfig:g,getSiteConfig:s,updateSiteConfig:f,reset:r(()=>{c()},`reset`),globalReset:r(()=>{c(ie)},`globalReset`),defaultConfig:ie});n(b().logLevel),c(b());var Ti=r((e,t,n)=>{i.warn(e),se(e)?(n&&n(e.str,e.hash),t.push({...e,message:e.str,error:e})):(n&&n(e),e instanceof Error&&t.push({str:e.message,message:e.message,hash:e.name,error:e}))},`handleError`),Ei=r(async function(e={querySelector:`.mermaid`}){try{await Di(e)}catch(t){if(se(t)&&i.error(t.str),q.parseError&&q.parseError(t),!e.suppressErrors)throw i.error(`Use the suppressErrors option to suppress these errors`),t}},`run`),Di=r(async function({postRenderCallback:e,querySelector:t,nodes:n}={querySelector:`.mermaid`}){let r=K.getConfig();i.debug(`${e?``:`No `}Callback function found`);let a;if(n)a=n;else if(t)a=document.querySelectorAll(t);else throw Error(`Nodes and querySelector are both undefined`);i.debug(`Found ${a.length} diagrams`),r?.startOnLoad!==void 0&&(i.debug(`Start On Load: `+r?.startOnLoad),K.updateSiteConfig({startOnLoad:r?.startOnLoad}));let o=new ce.InitIDGenerator(r.deterministicIds,r.deterministicIDSeed),s,c=[];for(let t of Array.from(a)){if(i.info(`Rendering diagram: `+t.id),t.getAttribute(`data-processed`))continue;t.setAttribute(`data-processed`,`true`);let n=`mermaid-${o.next()}`;s=t.innerHTML,s=ve(ce.entityDecode(s)).trim().replace(/<br\s*\/?>/gi,`<br/>`);let r=ce.detectInit(s);r&&
|
||
|
|
`):e.textContent?.trim()||``;if(!i)return;let a=e.getBBox(),{ty:o}=wa(e,t),s=parseFloat(getComputedStyle(e).fontSize||``);if(n&&(!Number.isFinite(s)||!s)){let t=e.querySelector(`div, span, p`);t&&(s=parseFloat(getComputedStyle(t).fontSize||``))}(!Number.isFinite(s)||s<=0)&&(s=Math.max(12,a.height*.6)),s*=.9;let c=Hi(e,l.color);T.push({section:Ba(e,d),text:L(i),x:a.x,y:a.y+o,width:g&&g.width?Math.max(g.width-8,a.width):a.width,height:a.height,fontSize:s,color:c})});let re=T.filter(e=>e.section===`header`).sort((e,t)=>e.y-t.y||e.x-t.x);if(!g.label){let e=re.length===0&&T.length===1?T:re;e.length>0&&(g.label={text:e.map(e=>e.text).join(`
|
||
|
|
`),fontSize:Math.max(...e.map(e=>e.fontSize)),color:e.find(e=>e.color)?.color,verticalAlign:`top`})}T.filter(e=>re.length>0?e.section!==`header`:!(g.label&&T.length===1)).forEach(e=>{let t=ra((g?.x||0)+4,e.y,e.text,{width:e.width,height:e.height,fontSize:e.fontSize,color:e.color,id:M(),groupId:c,metadata:{classId:s}});a.push(t)})}),{nodes:r,lines:i,text:a}},Ha=(e,t,n,r)=>{let i=Array.from(n.querySelectorAll(`.edgePaths path[data-edge="true"]:not([id^="edgeNote"]):not([id*="-cyclic-special-"])`));if(e.length===0)return{arrows:[],text:[]};let a=[],o=[],s=0;return e.forEach(e=>{let{id1:c,id2:l,relation:u}=e,d=t.find(e=>e.id===c),f=t.find(e=>e.id===l);if(!d)throw Error(`parseRelations: Cannot find node with id ${c}`);if(!f)throw Error(`parseRelations: Cannot find node with id ${l}`);let p=Sa(u.lineType),m=Ca(u.type1),h=Ca(u.type2),g;if(c===l){let t=La(c,n);if(!t.length)throw Error(`parseRelations: Cannot find rendered SVG edge for relation ${c} -> ${l}`);g=Pa(t,{strokeStyle:p,startArrowhead:m,endArrowhead:h,label:e.title?{text:e.title}:void 0,start:{type:`rectangle`,id:d.id},end:{type:`rectangle`,id:f.id}})}else{let t=i[s];if(!t)throw Error(`parseRelations: Cannot find rendered SVG edge for relation ${c} -> ${l}`);s+=1,g=Fa(t,{strokeStyle:p,startArrowhead:m,endArrowhead:h,label:e.title?{text:e.title}:void 0,start:{type:`rectangle`,id:d.id},end:{type:`rectangle`,id:f.id}})}a.push(g);let{relationTitle1:_,relationTitle2:v}=e,y=c===l,b,x;if(_&&_!==`none`){if(y){let e=za(g,`start`);e&&(b=e.x,x=e.y)}else switch(r){case`TB`:b=g.startX-20,g.endX<g.startX&&(b-=15),x=g.startY+15;break;case`BT`:b=g.startX+20,g.endX>g.startX&&(b+=15),x=g.startY-15;break;case`LR`:b=g.startX+20,x=g.startY+15,g.endY>g.startY&&(x+=15);break;case`RL`:b=g.startX-20,x=g.startY-15,g.startY>g.endY&&(x-=15);break;default:b=g.startX-20,x=g.startY+15}b??=g.startX-20,x??=g.startY+15;let e=ra(b,x,_,{fontSize:16});o.push(e)}if(v&&v!==`none`){if(y){let e=za(g,`end`);e&&(b=e.x,x=e.y)}else switch(r){case`TB`:b=g.endX+20,g.endX<g.startX&&(b+=15),x=g.endY-15;break;case`BT`:b=g.endX-20,g.endX>g.startX&&(b-=15),x=g.endY+15;break;case`LR`:b=g.endX-20,x=g.endY-15,g.endY>g.startY&&(x-=15);break;case`RL`:b=g.endX+20,x=g.endY+15,g.startY>g.endY&&(x+=15);break;default:b=g.endX+20,x=g.endY-15}b??=g.endX+20,x??=g.endY+15;let e=ra(b,x,v,{fontSize:16});o.push(e)}}),{arrows:a,text:o}},Ua=(e,t,n)=>{let r=[],i=[];return e.forEach((e,a)=>{let{id:o,text:s,class:c}=e,l=t.querySelector(`#${o}`);if(!l)throw Error(`Node with id ${o} not found!`);let{transformX:u,transformY:d}=R(l),f=l.firstChild,p=Z(f,`rectangle`,{id:o,subtype:`note`,label:{text:s}});if(Object.assign(p,{x:p.x+u,y:p.y+d}),r.push(p),c){let e=n.find(e=>e.id===c);if(!e)throw Error(`class node with id ${c} not found!`);let r=t.querySelector(`path[id="edgeNote${a+1}"][data-edge="true"]`);if(r){i.push(Ia(r,{strokeStyle:`dotted`,startArrowhead:null,endArrowhead:null,start:{id:p.id,type:`rectangle`},end:{id:e.id,type:`rectangle`}}));return}let o=p.x+(p.width||0)/2,s=p.y+(p.height||0),l=o,u=e.y,d=na(o,s,l,u,{strokeStyle:`dotted`,startArrowhead:null,endArrowhead:null,start:{id:p.id,type:`rectangle`},end:{id:e.id,type:`rectangle`}});i.push(d)}}),{notes:r,connectors:i}},Wa=(e,t)=>{let n=e.db,r=n.getDirection?.()||`TB`,i=[],a=[],o=[],s=[],c=n.getNamespaces?.()||[],l=n.getClasses?.()||{},u=l instanceof Map?Object.fromEntries(l):l;if(u&&Object.keys(u).length){let e=Va(u,t,typeof n.lookUpDomId==`function`?n.lookUpDomId.bind(n):void 0);i.push(e.nodes),a.push(...e.lines),o.push(...e.text),s.push(...e.nodes)}let{arrows:d,text:f}=Ha(n.getRelations?.()||[],s,t,r),{notes:p,connectors:m}=Ua(n.getNotes?.()||[],t,s);return i.push(p),d.push(...m),o.push(...f),{type:`class`,nodes:i,lines:a,arrows:d,text:o,namespaces:c}},Ga=18,Ka=e=>{let t={};return e&&e.forEach(e=>{Y(e).forEach(({property:e,value:n})=>{e&&n&&(t[e]=J(n))})}),t},qa=e=>{if(e==null||e===``)return;let t=typeof e==`number`?e:parseFloat(J(e));if(!(!Number.isFinite(t)||t<=0))return t},Ja=(e,t)=>{let n=0,r=0,i=e;for(;i&&i!==t;){let{transformX:e,transformY:t}=R(i);n+=e,r+=t,i=i.parentElement}retu
|
||
|
|
`):e.textContent?.trim()||``)},Xa=e=>{let t=e.querySelector(`text, foreignObject, div, span, p`)||e,n=parseFloat(getComputedStyle(t).fontSize||``);return(!Number.isFinite(n)||n<=0)&&(n=Math.max(12,e.getBBox().height*.75)),n},Za=(e,t,n)=>{let r=Ya(e);if(!r)return null;let i=e.getBBox(),{tx:a,ty:o}=Ja(e,t);return{className:e.getAttribute(`class`)||``,text:r,x:i.x+a,y:i.y+o,width:i.width,height:i.height,fontSize:Xa(e),color:Hi(e,n)}},Qa=(e,t,n,r,i,a,o)=>{let{tx:s,ty:c}=Ja(e,t),l=0,u=0,d=0,f=0;if(e.tagName.toLowerCase()===`line`)l=Number(e.getAttribute(`x1`))+s,u=Number(e.getAttribute(`y1`))+c,d=Number(e.getAttribute(`x2`))+s,f=Number(e.getAttribute(`y2`))+c;else{let t=Dt(e);if(!t)return null;l=t.startX+s,u=t.startY+c,d=t.endX+s,f=t.endY+c}let p={type:`line`,id:M(),groupId:n,startX:l,startY:u,endX:d,endY:f,metadata:{entityId:r}};return i&&X(i)&&i!==`none`&&(p.strokeColor=i),a!==void 0&&(p.strokeWidth=a),o&&(p.strokeStyle=o),p},$a=e=>{switch(e?.toLowerCase()){case`one`:return`cardinality_one`;case`many`:return`cardinality_many`;case`only_one`:return`cardinality_exactly_one`;case`one_or_more`:return`cardinality_one_or_many`;case`zero_or_one`:return`cardinality_zero_or_one`;case`zero_or_more`:return`cardinality_zero_or_many`;default:return null}},eo=e=>{switch(e){case`dotted`:return`dotted`;case`dashed`:return`dashed`;default:return`solid`}},to=(e,t)=>{let n=t.querySelector(`path[id="${e.id}"][data-edge="true"]`);return n?[n]:e.start===e.end?[`${e.start}-cyclic-special-1`,`${e.start}-cyclic-special-mid`,`${e.start}-cyclic-special-2`].map(e=>t.querySelector(`path[id="${e}"][data-edge="true"]`)).filter(e=>e!==null):[]},no=e=>{let t=[];return e.forEach(e=>{Ot(e).forEach(e=>{let n=t[t.length-1];n&&n.x===e.x&&n.y===e.y||t.push(e)})}),t},ro=(e,t)=>{let n=t.querySelector(`[id="${e.id}"]`);if(!n)throw Error(`ER entity ${e.id} not found in rendered SVG`);let r=e.attributes.length?M():void 0,i=n.getBBox(),{tx:a,ty:o}=Ja(n,t),s=Ka([...e.cssStyles||[],...e.cssCompiledStyles||[]]),c=J(s.fill||``),l=J(s.stroke||``),u=qa(s[`stroke-width`]),d=J(s[`stroke-dasharray`]||``),f=Array.from(n.querySelectorAll(`g.label`)).map(e=>Za(e,t,s.color)).filter(e=>e!==null),p=f.find(e=>e.className.includes(`name`))||f[0],m=f.filter(e=>e!==p),h=p?.text||L(e.alias||e.label||``),g={type:`rectangle`,id:e.id,groupId:r,x:i.x+a,y:i.y+o,width:i.width,height:i.height,label:{text:h,fontSize:e.attributes.length?Ga:p?.fontSize||16,color:p?.color,textAlign:`center`,verticalAlign:e.attributes.length?`top`:`middle`},metadata:{entityId:e.id,entityLabel:e.label,entityAlias:e.alias}};return X(c)&&c!==`none`&&(g.bgColor=c),X(l)&&l!==`none`&&(g.strokeColor=l),u&&Number.isFinite(u)&&u>0&&(g.strokeWidth=u),d&&d!==`none`&&(g.strokeStyle=`dashed`),{container:g,lines:Array.from(n.querySelectorAll(`.divider path, path.divider, line.divider`)).map(n=>Qa(n,t,r,e.id,g.strokeColor,g.strokeWidth,g.strokeStyle)).filter(e=>e!==null),text:m.map(t=>ra(t.x,t.y,t.text,{id:M(),groupId:r,width:t.width,height:t.height,fontSize:Ga,color:t.color,metadata:{entityId:e.id}}))}},io=(e,t)=>{let n=to(e,t);if(!n.length)throw Error(`ER relationship ${e.id} not found in rendered SVG`);let r=no(n);if(r.length<2)throw Error(`ER relationship ${e.id} is missing usable path points`);let i=r[0],a=r[r.length-1],o=n[0],s=J(o.getAttribute(`stroke`)||getComputedStyle(o).stroke||``),c=Number(o.getAttribute(`stroke-width`)||getComputedStyle(o).strokeWidth||1),l=na(i.x,i.y,a.x,a.y,{id:e.id,label:e.label?{text:L(e.label),fontSize:16,textAlign:`center`}:void 0,strokeStyle:eo(e.pattern),startArrowhead:$a(e.arrowTypeStart),endArrowhead:$a(e.arrowTypeEnd),start:{type:`rectangle`,id:e.start},end:{type:`rectangle`,id:e.end},points:r.map(e=>[e.x-i.x,e.y-i.y])});return X(s)&&s!==`none`&&(l.strokeColor=s),Number.isFinite(c)&&c>0&&(l.strokeWidth=c),l},ao=(e,t)=>{let n=e.getData(),r=n.nodes,i=n.edges,a=[],o=[],s=[];r.forEach(e=>{let n=ro(e,t);a.push(n.container),o.push(...n.lines),s.push(...n.text)});let c=i.map(e=>io(e,t));return{type:`erd`,nodes:[a],lines:o,arrows:c,text:s}},$=e=>{let t=J(e||``);return!t||t===`none`||t===`transpare
|
||
|
|
`)).join(`
|
||
|
|
`),wo=e=>e.description?(Array.isArray(e.description)?e.description:[e.description]).map(e=>L(e)).filter(e=>e.length>0):[],To=e=>{let t=new Set,n=e=>(e&&t.add(e),e),r=e=>n(e.find(e=>!t.has(e))||null);return t=>{let i=[`[id='${t.domId}']`,`[id='${t.id}']`,`[data-id='${t.id}']`];for(let t of i){let r=e.querySelector(t);if(r)return n(r)}switch(t.shape){case`divider`:return r(Array.from(e.querySelectorAll(`g.statediagram-cluster-alt`)));case`stateStart`:return r(Array.from(e.querySelectorAll(`g.node.default`)).filter(e=>e.querySelector(`circle.state-start`)));case`stateEnd`:return r(Array.from(e.querySelectorAll(`g.node.default`)).filter(e=>!e.querySelector(`circle.state-start`)));default:return null}}},Eo=(e,t)=>{switch(t){case`roundedWithTitle`:return e.querySelector(`rect.outer`)||e.querySelector(`rect`)||e;case`divider`:return e.querySelector(`rect.divider`)||e.querySelector(`rect`)||e;case`rectWithTitle`:return e.querySelector(`rect.outer`)||e.querySelector(`rect`)||e;case`stateStart`:return yo(Array.from(e.querySelectorAll(`circle, ellipse, path`)),`largest`)||e;case`stateEnd`:return yo(Array.from(e.querySelectorAll(`circle, ellipse, path`)),`largest`)||e;default:return e.querySelector(`rect, path, circle, ellipse, polygon`)||e}},Do=(e,t,n)=>{let r=n(e);if(!r)throw Error(`State node element not found for "${e.id}"`);let i=Eo(r,e.shape),a={},o={},s=[e.labelStyle,...e.cssCompiledStyles||[],...e.cssStyles||[]],c=uo(s);s.filter(Boolean).forEach(e=>{co(e,a,o)}),fo(i,a,c),po(r,o,c);let l=ho(i,t);return{id:e.id,shape:e.shape,text:Co(e),description:wo(e),x:l.x,y:l.y,width:l.width,height:l.height,parentId:e.parentId,position:e.position,containerStyle:a,labelStyle:o,dividerLine:e.shape===`rectWithTitle`?go(r,t):void 0,endInnerColor:e.shape===`stateEnd`?xo(r,c):void 0,isRenderable:e.shape!==`noteGroup`}},Oo=(e,t)=>{let n=t.querySelector(`[id='${e.id}']`);if(!n)return null;let{tx:r,ty:i}=mo(n,t),a=kt(n,{x:r,y:i},`MCL`);if(a.reflectionPoints.length<2)return null;let o={},s=(e,t)=>{switch(e){case j.STROKE:$(t)&&(o.strokeColor=J(t));break;case j.STROKE_WIDTH:{let e=parseFloat(J(t));Number.isFinite(e)&&e>0&&(o.strokeWidth=e);break}case j.STROKE_DASHARRAY:J(t)&&(o.strokeStyle=`dashed`);break}};[e.style].filter(Boolean).forEach(e=>{Y(e||``).forEach(({property:e,value:t})=>{s(e,t)})});let c=e.arrowhead===`none`||e.classes?.includes(`note-edge`);return{id:e.id,start:e.start,end:e.end,text:L(e.label||``),...a,strokeColor:o.strokeColor,strokeWidth:o.strokeWidth,strokeStyle:c?`dashed`:o.strokeStyle,isNoteEdge:c}},ko=(e,t)=>{let{nodes:n,edges:r}=e.getData(),i=To(t);return{type:`state`,nodes:n.map(e=>Do(e,t,i)),edges:r.map(e=>Oo(e,t)).filter(e=>e!==null)}},Ao=Promise.resolve(),jo=e=>{let t=Ao.then(e,e);return Ao=t.then(()=>void 0,()=>void 0),t},Mo=null,No=0,Po=e=>JSON.stringify(e),Fo=e=>{let t=e.querySelector(`svg`);if(!t)throw Error(`SVG element not found`);let n=t.getBoundingClientRect(),r=n.width,i=n.height;t.setAttribute(`width`,`${r}`),t.setAttribute(`height`,`${i}`);let a=unescape(encodeURIComponent(t.outerHTML));return{type:`graphImage`,mimeType:`image/svg+xml`,dataURL:`data:image/svg+xml;base64,${btoa(a)}`,width:r,height:i}},Io=async(e,t=xe)=>jo(async()=>{let n=t.themeVariables?.fontSize??xe.themeVariables.fontSize,r={...xe,...t,fontSize:n,themeVariables:{...xe.themeVariables,...t.themeVariables,fontSize:n}},i=Po(r);i!==Mo&&(Ri.initialize(r),Mo=i);let a=await Ri.mermaidAPI.getDiagramFromText(Ct(e)),o=`mermaid-to-excalidraw-${No++}`,s=document.createElement(`div`);s.setAttribute(`style`,`opacity: 0; position: fixed; z-index: -1; left: -99999px; top: -99999px;`);let c=`${o}-container`;s.id=c,document.getElementById(c)?.remove(),document.body.appendChild(s);try{let{svg:t}=await Ri.render(o,e,s);s.innerHTML=t;let n;try{switch(a.type){case`flowchart-v2`:case`graph`:n=ea(a.db,s);break;case`sequence`:n=_a(a,s);break;case`class`:case`classDiagram`:n=Wa(a,s);break;case`er`:n=ao(a.db,s);break;case`state`:case`stateDiagram`:n=ko(a.db,s);break;default:n=Fo(s)}}catch(e){console.error(`Error processing Mermaid diagram:`,e),n=Fo(s)}return n}finally{s
|