export const __rspack_esm_id="127";export const __rspack_esm_ids=["127"];export const __webpack_modules__={93490(e,t,r){r.d(t,{diagram:()=>eh});var i=r(50542),s=r(34478),o=r(71698),n=r(33520);r(81179);var a=r(13224),l=r(50476),d=r(47610),c=r(86632),f=r(92765),h=r(79723),p={L:"left",R:"right",T:"top",B:"bottom"},g={L:(0,l.K2)(e=>`${e},${e/2} 0,${e} 0,0`,"L"),R:(0,l.K2)(e=>`0,${e/2} ${e},0 ${e},${e}`,"R"),T:(0,l.K2)(e=>`0,0 ${e},0 ${e/2},${e}`,"T"),B:(0,l.K2)(e=>`${e/2},0 ${e},${e} 0,${e}`,"B")},u={L:(0,l.K2)((e,t)=>e-t+2,"L"),R:(0,l.K2)((e,t)=>e-2,"R"),T:(0,l.K2)((e,t)=>e-t+2,"T"),B:(0,l.K2)((e,t)=>e-2,"B")},m=(0,l.K2)(function(e){return k(e)?"L"===e?"R":"L":"T"===e?"B":"T"},"getOppositeArchitectureDirection"),y=(0,l.K2)(function(e){return"L"===e||"R"===e||"T"===e||"B"===e},"isArchitectureDirection"),k=(0,l.K2)(function(e){return"L"===e||"R"===e},"isArchitectureDirectionX"),x=(0,l.K2)(function(e){return"T"===e||"B"===e},"isArchitectureDirectionY"),w=(0,l.K2)(function(e,t){let r=k(e)&&x(t),i=x(e)&&k(t);return r||i},"isArchitectureDirectionXY"),b=(0,l.K2)(function(e){let t=e[0],r=e[1],i=k(t)&&x(r),s=x(t)&&k(r);return i||s},"isArchitecturePairXY"),v=(0,l.K2)(function(e){return"LL"!==e&&"RR"!==e&&"TT"!==e&&"BB"!==e},"isValidArchitectureDirectionPair"),$=(0,l.K2)(function(e,t){let r=`${e}${t}`;return v(r)?r:void 0},"getArchitectureDirectionPair"),K=(0,l.K2)(function([e,t],r){let i=r[0],s=r[1];if(k(i))if(x(s))return[e+("L"===i?-1:1),t+("T"===s?1:-1)];else return[e+("L"===i?-1:1),t];return k(s)?[e+("L"===s?1:-1),t+("T"===i?1:-1)]:[e,t+("T"===i?1:-1)]},"shiftPositionByArchitectureDirectionPair"),E=(0,l.K2)(function(e){return"LT"===e||"TL"===e?[1,1]:"BL"===e||"LB"===e?[1,-1]:"BR"===e||"RB"===e?[-1,-1]:[-1,1]},"getArchitectureDirectionXYFactors"),T=(0,l.K2)(function(e,t){return w(e,t)?"bend":k(e)?"horizontal":"vertical"},"getArchitectureDirectionAlignment"),D=(0,l.K2)(function(e){return"service"===e.type},"isArchitectureService"),L=(0,l.K2)(function(e){return"junction"===e.type},"isArchitectureJunction"),S=(0,l.K2)(e=>e.data(),"edgeData"),B=(0,l.K2)(e=>e.data(),"nodeData"),I=l.UI.architecture,j=new n.m(()=>({nodes:{},groups:{},edges:[],registeredIds:{},config:I,dataStructures:void 0,elements:{}})),A=(0,l.K2)(()=>{j.reset(),(0,l.IU)()},"clear"),R=(0,l.K2)(function({id:e,icon:t,in:r,title:i,iconText:s}){if(void 0!==j.records.registeredIds[e])throw Error(`The service id [${e}] is already in use by another ${j.records.registeredIds[e]}`);if(void 0!==r){if(e===r)throw Error(`The service [${e}] cannot be placed within itself`);if(void 0===j.records.registeredIds[r])throw Error(`The service [${e}]'s parent does not exist. Please make sure the parent is created before this service`);if("node"===j.records.registeredIds[r])throw Error(`The service [${e}]'s parent is not a group`)}j.records.registeredIds[e]="node",j.records.nodes[e]={id:e,type:"service",icon:t,iconText:s,title:i,edges:[],in:r}},"addService"),O=(0,l.K2)(()=>Object.values(j.records.nodes).filter(D),"getServices"),z=(0,l.K2)(function({id:e,in:t}){j.records.registeredIds[e]="node",j.records.nodes[e]={id:e,type:"junction",edges:[],in:t}},"addJunction"),M=(0,l.K2)(()=>Object.values(j.records.nodes).filter(L),"getJunctions"),P=(0,l.K2)(()=>Object.values(j.records.nodes),"getNodes"),_=(0,l.K2)(e=>j.records.nodes[e],"getNode"),G=(0,l.K2)(function({id:e,icon:t,in:r,title:i}){if(void 0!==j.records.registeredIds[e])throw Error(`The group id [${e}] is already in use by another ${j.records.registeredIds[e]}`);if(void 0!==r){if(e===r)throw Error(`The group [${e}] cannot be placed within itself`);if(void 0===j.records.registeredIds[r])throw Error(`The group [${e}]'s parent does not exist. Please make sure the parent is created before this group`);if("node"===j.records.registeredIds[r])throw Error(`The group [${e}]'s parent is not a group`)}j.records.registeredIds[e]="group",j.records.groups[e]={id:e,icon:t,title:i,in:r}},"addGroup"),Y=(0,l.K2)(()=>Object.values(j.records.groups),"getGroups"),Z=(0,l.K2)(function({lhsId:e,rhsId:t,lhsDir:r,rhsDir:i,lhsInto:s,rhsInto:o,lhsGroup:n,rhsGroup:a,title:l}){if(!y(r))throw Error(`Invalid direction given for left hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${r}`);if(!y(i))throw Error(`Invalid direction given for right hand side of edge ${e}--${t}. Expected (L,R,T,B) got ${i}`);if(void 0===j.records.nodes[e]&&void 0===j.records.groups[e])throw Error(`The left-hand id [${e}] does not yet exist. Please create the service/group before declaring an edge to it.`);if(void 0===j.records.nodes[t]&&void 0===j.records.groups[e])throw Error(`The right-hand id [${t}] does not yet exist. Please create the service/group before declaring an edge to it.`);let d=j.records.nodes[e].in,c=j.records.nodes[t].in;if(n&&d&&c&&d==c)throw Error(`The left-hand id [${e}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);if(a&&d&&c&&d==c)throw Error(`The right-hand id [${t}] is modified to traverse the group boundary, but the edge does not pass through two groups.`);j.records.edges.push({lhsId:e,lhsDir:r,lhsInto:s,lhsGroup:n,rhsId:t,rhsDir:i,rhsInto:o,rhsGroup:a,title:l}),j.records.nodes[e]&&j.records.nodes[t]&&(j.records.nodes[e].edges.push(j.records.edges[j.records.edges.length-1]),j.records.nodes[t].edges.push(j.records.edges[j.records.edges.length-1]))},"addEdge"),C=(0,l.K2)(()=>j.records.edges,"getEdges"),N=(0,l.K2)(()=>{if(void 0===j.records.dataStructures){let e={},t=Object.entries(j.records.nodes).reduce((t,[r,i])=>(t[r]=i.edges.reduce((t,i)=>{let s=_(i.lhsId)?.in,o=_(i.rhsId)?.in;if(s&&o&&s!==o){let t=T(i.lhsDir,i.rhsDir);"bend"!==t&&(e[s]??={},e[s][o]=t,e[o]??={},e[o][s]=t)}if(i.lhsId===r){let e=$(i.lhsDir,i.rhsDir);e&&(t[e]=i.rhsId)}else{let e=$(i.rhsDir,i.lhsDir);e&&(t[e]=i.lhsId)}return t},{}),t),{}),r=Object.keys(t)[0],i={[r]:1},s=Object.keys(t).reduce((e,t)=>t===r?e:{...e,[t]:1},{}),o=(0,l.K2)(e=>{let r={[e]:[0,0]},o=[e];for(;o.length>0;){let e=o.shift();if(e){i[e]=1,delete s[e];let n=t[e],[a,l]=r[e];Object.entries(n).forEach(([e,t])=>{i[t]||(r[t]=K([a,l],e),o.push(t))})}}return r},"BFS"),n=[o(r)];for(;Object.keys(s).length>0;)n.push(o(Object.keys(s)[0]));j.records.dataStructures={adjList:t,spatialMaps:n,groupAlignments:e}}return j.records.dataStructures},"getDataStructures"),X=(0,l.K2)((e,t)=>{j.records.elements[e]=t},"setElementForId"),q=(0,l.K2)(e=>j.records.elements[e],"getElementById"),J={clear:A,setDiagramTitle:l.ke,getDiagramTitle:l.ab,setAccTitle:l.SV,getAccTitle:l.iN,setAccDescription:l.EI,getAccDescription:l.m7,addService:R,getServices:O,addJunction:z,getJunctions:M,getNodes:P,getNode:_,addGroup:G,getGroups:Y,addEdge:Z,getEdges:C,setElementForId:X,getElementById:q,getDataStructures:N};function W(e){let t=(0,l.D7)().architecture;return t?.[e]?t[e]:I[e]}(0,l.K2)(W,"getConfigField");var F=(0,l.K2)((e,t)=>{(0,o.S)(e,t),e.groups.map(t.addGroup),e.services.map(e=>t.addService({...e,type:"service"})),e.junctions.map(e=>t.addJunction({...e,type:"junction"})),e.edges.map(t.addEdge)},"populateDb"),H={parse:(0,l.K2)(async e=>{let t=await (0,d.qg)("architecture",e);l.Rm.debug(t),F(t,J)},"parse")},V=(0,l.K2)(e=>` .edge { stroke-width: ${e.archEdgeWidth}; stroke: ${e.archEdgeColor}; fill: none; } .arrow { fill: ${e.archEdgeArrowColor}; } .node-bkg { fill: none; stroke: ${e.archGroupBorderColor}; stroke-width: ${e.archGroupBorderWidth}; stroke-dasharray: 8; } .node-icon-text { display: flex; align-items: center; } .node-icon-text > div { color: #fff; margin: 1px; height: fit-content; text-align: center; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; } `,"getStyles"),U=(0,l.K2)(e=>`${e}`,"wrapIcon"),Q={prefix:"mermaid-architecture",height:80,width:80,icons:{database:{body:U('')},server:{body:U('')},disk:{body:U('')},internet:{body:U('')},cloud:{body:U('')},unknown:i.Gc,blank:{body:U("")}}},ee=(0,l.K2)(async function(e,t){let r=W("padding"),i=W("iconSize"),o=i/2,n=i/6,a=n/2;await Promise.all(t.edges().map(async t=>{let{source:i,sourceDir:d,sourceArrow:c,sourceGroup:f,target:h,targetDir:p,targetArrow:m,targetGroup:y,label:v}=S(t),{x:K,y:T}=t[0].sourceEndpoint(),{x:D,y:L}=t[0].midpoint(),{x:B,y:I}=t[0].targetEndpoint(),j=r+4;if(f&&(k(d)?K+="L"===d?-j:j:T+="T"===d?-j:j+18),y&&(k(p)?B+="L"===p?-j:j:I+="T"===p?-j:j+18),f||J.getNode(i)?.type!=="junction"||(k(d)?K+="L"===d?o:-o:T+="T"===d?o:-o),y||J.getNode(h)?.type!=="junction"||(k(p)?B+="L"===p?o:-o:I+="T"===p?o:-o),t[0]._private.rscratch){let t=e.insert("g");if(t.insert("path").attr("d",`M ${K},${T} L ${D},${L} L${B},${I} `).attr("class","edge"),c){let e=k(d)?u[d](K,n):K-a,r=x(d)?u[d](T,n):T-a;t.insert("polygon").attr("points",g[d](n)).attr("transform",`translate(${e},${r})`).attr("class","arrow")}if(m){let e=k(p)?u[p](B,n):B-a,r=x(p)?u[p](I,n):I-a;t.insert("polygon").attr("points",g[p](n)).attr("transform",`translate(${e},${r})`).attr("class","arrow")}if(v){let e=w(d,p)?"XY":k(d)?"X":"Y",r=0;r="X"===e?Math.abs(K-B):"Y"===e?Math.abs(T-I)/1.5:Math.abs(K-B)/2;let i=t.append("g");if(await (0,s.GZ)(i,v,{useHtmlLabels:!1,width:r,classes:"architecture-service-label"},(0,l.D7)()),i.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),"X"===e)i.attr("transform","translate("+D+", "+L+")");else if("Y"===e)i.attr("transform","translate("+D+", "+L+") rotate(-90)");else if("XY"===e){let e=$(d,p);if(e&&b(e)){let t=i.node().getBoundingClientRect(),[r,s]=E(e);i.attr("dominant-baseline","auto").attr("transform",`rotate(${-1*r*s*45})`);let o=i.node().getBoundingClientRect();i.attr("transform",` translate(${D}, ${L-t.height/2}) translate(${r*o.width/2}, ${s*o.height/2}) rotate(${-1*r*s*45}, 0, ${t.height/2}) `)}}}}}))},"drawEdges"),et=(0,l.K2)(async function(e,t){let r=.75*W("padding"),o=W("fontSize"),n=W("iconSize")/2;await Promise.all(t.nodes().map(async t=>{let a=B(t);if("group"===a.type){let{h:d,w:c,x1:f,y1:h}=t.boundingBox();e.append("rect").attr("x",f+n).attr("y",h+n).attr("width",c).attr("height",d).attr("class","node-bkg");let p=e.append("g"),g=f,u=h;if(a.icon){let e=p.append("g");e.html(`${await (0,i.WY)(a.icon,{height:r,width:r,fallbackPrefix:Q.prefix})}`),e.attr("transform","translate("+(g+n+1)+", "+(u+n+1)+")"),g+=r,u+=o/2-1-2}if(a.label){let e=p.append("g");await (0,s.GZ)(e,a.label,{useHtmlLabels:!1,width:c,classes:"architecture-service-label"},(0,l.D7)()),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","start").attr("text-anchor","start"),e.attr("transform","translate("+(g+n+4)+", "+(u+n+2)+")")}}}))},"drawGroups"),er=(0,l.K2)(async function(e,t,r){for(let o of r){let r=t.append("g"),n=W("iconSize");if(o.title){let e=r.append("g");await (0,s.GZ)(e,o.title,{useHtmlLabels:!1,width:1.5*n,classes:"architecture-service-label"},(0,l.D7)()),e.attr("dy","1em").attr("alignment-baseline","middle").attr("dominant-baseline","middle").attr("text-anchor","middle"),e.attr("transform","translate("+n/2+", "+n+")")}let a=r.append("g");if(o.icon)a.html(`${await (0,i.WY)(o.icon,{height:n,width:n,fallbackPrefix:Q.prefix})}`);else if(o.iconText){a.html(`${await (0,i.WY)("blank",{height:n,width:n,fallbackPrefix:Q.prefix})}`);let e=a.append("g").append("foreignObject").attr("width",n).attr("height",n).append("div").attr("class","node-icon-text").attr("style",`height: ${n}px;`).append("div").html(o.iconText),t=parseInt(window.getComputedStyle(e.node(),null).getPropertyValue("font-size").replace(/\D/g,""))??16;e.attr("style",`-webkit-line-clamp: ${Math.floor((n-2)/t)};`)}else a.append("path").attr("class","node-bkg").attr("id","node-"+o.id).attr("d",`M0 ${n} v${-n} q0,-5 5,-5 h${n} q5,0 5,5 v${n} H0 Z`);r.attr("class","architecture-service");let{width:d,height:c}=r._groups[0][0].getBBox();o.width=d,o.height=c,e.setElementForId(o.id,r)}return 0},"drawServices"),ei=(0,l.K2)(function(e,t,r){r.forEach(r=>{let i=t.append("g"),s=W("iconSize");i.append("g").append("rect").attr("id","node-"+r.id).attr("fill-opacity","0").attr("width",s).attr("height",s),i.attr("class","architecture-junction");let{width:o,height:n}=i._groups[0][0].getBBox();i.width=o,i.height=n,e.setElementForId(r.id,i)})},"drawJunctions");function es(e,t){e.forEach(e=>{t.add({group:"nodes",data:{type:"service",id:e.id,icon:e.icon,label:e.title,parent:e.in,width:W("iconSize"),height:W("iconSize")},classes:"node-service"})})}function eo(e,t){e.forEach(e=>{t.add({group:"nodes",data:{type:"junction",id:e.id,parent:e.in,width:W("iconSize"),height:W("iconSize")},classes:"node-junction"})})}function en(e,t){t.nodes().map(t=>{let r=B(t);"group"===r.type||(r.x=t.position().x,r.y=t.position().y,e.getElementById(r.id).attr("transform","translate("+(r.x||0)+","+(r.y||0)+")"))})}function ea(e,t){e.forEach(e=>{t.add({group:"nodes",data:{type:"group",id:e.id,icon:e.icon,label:e.title,parent:e.in},classes:"node-group"})})}function el(e,t){e.forEach(e=>{let{lhsId:r,rhsId:i,lhsInto:s,lhsGroup:o,rhsInto:n,lhsDir:a,rhsDir:l,rhsGroup:d,title:c}=e,f=w(e.lhsDir,e.rhsDir)?"segments":"straight",h={id:`${r}-${i}`,label:c,source:r,sourceDir:a,sourceArrow:s,sourceGroup:o,sourceEndpoint:"L"===a?"0 50%":"R"===a?"100% 50%":"T"===a?"50% 0":"50% 100%",target:i,targetDir:l,targetArrow:n,targetGroup:d,targetEndpoint:"L"===l?"0 50%":"R"===l?"100% 50%":"T"===l?"50% 0":"50% 100%"};t.add({group:"edges",data:h,classes:f})})}function ed(e,t,r){let i=(0,l.K2)((e,t)=>Object.entries(e).reduce((e,[i,s])=>{let o=0,n=Object.entries(s);if(1===n.length)return e[i]=n[0][1],e;for(let s=0;s{let r={},s={};return Object.entries(t).forEach(([t,[i,o]])=>{let n=e.getNode(t)?.in??"default";r[o]??={},r[o][n]??=[],r[o][n].push(t),s[i]??={},s[i][n]??=[],s[i][n].push(t)}),{horiz:Object.values(i(r,"horizontal")).filter(e=>e.length>1),vert:Object.values(i(s,"vertical")).filter(e=>e.length>1)}}).reduce(([e,t],{horiz:r,vert:i})=>[[...e,...r],[...t,...i]],[[],[]]);return{horizontal:s,vertical:o}}function ec(e){let t=[],r=(0,l.K2)(e=>`${e[0]},${e[1]}`,"posToStr"),i=(0,l.K2)(e=>e.split(",").map(e=>parseInt(e)),"strToPos");return e.forEach(e=>{let s=Object.fromEntries(Object.entries(e).map(([e,t])=>[r(t),e])),o=[r([0,0])],n={},a={L:[-1,0],R:[1,0],T:[0,1],B:[0,-1]};for(;o.length>0;){let e=o.shift();if(e){n[e]=1;let l=s[e];if(l){let d=i(e);Object.entries(a).forEach(([e,i])=>{let a=r([d[0]+i[0],d[1]+i[1]]),c=s[a];c&&!n[a]&&(o.push(a),t.push({[p[e]]:c,[p[m(e)]]:l,gap:1.5*W("iconSize")}))})}}}}),t}function ef(e,t,r,i,s,{spatialMaps:o,groupAlignments:n}){return new Promise(a=>{let d=(0,h.Ltv)("body").append("div").attr("id","cy").attr("style","display:none"),f=(0,c.A)({container:document.getElementById("cy"),style:[{selector:"edge",style:{"curve-style":"straight",label:"data(label)","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"edge.segments",style:{"curve-style":"segments","segment-weights":"0","segment-distances":[.5],"edge-distances":"endpoints","source-endpoint":"data(sourceEndpoint)","target-endpoint":"data(targetEndpoint)"}},{selector:"node",style:{"compound-sizing-wrt-labels":"include"}},{selector:"node[label]",style:{"text-valign":"bottom","text-halign":"center","font-size":`${W("fontSize")}px`}},{selector:".node-service",style:{label:"data(label)",width:"data(width)",height:"data(height)"}},{selector:".node-junction",style:{width:"data(width)",height:"data(height)"}},{selector:".node-group",style:{padding:`${W("padding")}px`}}]});d.remove(),ea(r,f),es(e,f),eo(t,f),el(i,f);let p=ed(s,o,n),g=ec(o),u=f.layout({name:"fcose",quality:"proof",styleEnabled:!1,animate:!1,nodeDimensionsIncludeLabels:!1,idealEdgeLength(e){let[t,r]=e.connectedNodes(),{parent:i}=B(t),{parent:s}=B(r);return i===s?1.5*W("iconSize"):.5*W("iconSize")},edgeElasticity(e){let[t,r]=e.connectedNodes(),{parent:i}=B(t),{parent:s}=B(r);return i===s?.45:.001},alignmentConstraint:p,relativePlacementConstraint:g});u.one("layoutstop",()=>{function e(e,t,r,i){let s,o,{x:n,y:a}=e,{x:l,y:d}=t;o=(i-a+(n-r)*(a-d)/(n-l))/Math.sqrt(1+Math.pow((a-d)/(n-l),2)),s=Math.sqrt(Math.pow(i-a,2)+Math.pow(r-n,2)-Math.pow(o,2))/Math.sqrt(Math.pow(l-n,2)+Math.pow(d-a,2));let c=(l-n)*(i-a)-(d-a)*(r-n);switch(!0){case c>=0:c=1;break;case c<0:c=-1}let f=(l-n)*(r-n)+(d-a)*(i-a);switch(!0){case f>=0:f=1;break;case f<0:f=-1}return{distances:o=Math.abs(o)*c,weights:s*=f}}for(let t of((0,l.K2)(e,"getSegmentWeights"),f.startBatch(),Object.values(f.edges())))if(t.data?.()){let{x:r,y:i}=t.source().position(),{x:s,y:o}=t.target().position();if(r!==s&&i!==o){let r=t.sourceEndpoint(),i=t.targetEndpoint(),{sourceDir:s}=S(t),[o,n]=x(s)?[r.x,i.y]:[i.x,r.y],{weights:a,distances:l}=e(r,i,o,n);t.style("segment-distances",l),t.style("segment-weights",a)}}f.endBatch(),u.run()}),u.run(),f.ready(e=>{l.Rm.info("Ready",e),a(f)})})}(0,i.pC)([{name:Q.prefix,icons:Q}]),c.A.use(f),(0,l.K2)(es,"addServices"),(0,l.K2)(eo,"addJunctions"),(0,l.K2)(en,"positionNodes"),(0,l.K2)(ea,"addGroups"),(0,l.K2)(el,"addEdges"),(0,l.K2)(ed,"getAlignments"),(0,l.K2)(ec,"getRelativeConstraints"),(0,l.K2)(ef,"layoutArchitecture");var eh={parser:H,db:J,renderer:{draw:(0,l.K2)(async(e,t,r,i)=>{let s=i.db,o=s.getServices(),n=s.getJunctions(),d=s.getGroups(),c=s.getEdges(),f=s.getDataStructures(),h=(0,a.D)(t),p=h.append("g");p.attr("class","architecture-edges");let g=h.append("g");g.attr("class","architecture-services");let u=h.append("g");u.attr("class","architecture-groups"),await er(s,g,o),ei(s,g,n);let m=await ef(o,n,d,c,s,f);await ee(p,m),await et(u,m),en(s,m),(0,l.ot)(void 0,h,W("padding"),W("useMaxWidth"))},"draw")},styles:V}},71698(e,t,r){function i(e,t){e.accDescr&&t.setAccDescription?.(e.accDescr),e.accTitle&&t.setAccTitle?.(e.accTitle),e.title&&t.setDiagramTitle?.(e.title)}r.d(t,{S:()=>i}),(0,r(50476).K2)(i,"populateCommonDb")},33520(e,t,r){r.d(t,{m:()=>s});var i=r(50476),s=class{constructor(e){this.init=e,this.records=this.init()}static{(0,i.K2)(this,"ImperativeState")}reset(){this.records=this.init()}}}};