/*! third party licenses: js/vendor.LICENSE.txt */ import{s as G,a as A,S as M}from"./chunk-DI55MBZ5-BUmmvRzW.chunk.mjs";import{_ as m,c as t,l as k,d as O,j as H,O as P,u as R}from"./NcSelect-DXLJbwym.chunk.mjs";import{s as v,l as U}from"./isEmpty-nTVdZyYD.chunk.mjs";import{G as C}from"./graph-DW1leGfv.chunk.mjs";import{l as I}from"./layout-0JowWxPT.chunk.mjs";import{l as W}from"./line-2ECJkxIB.chunk.mjs";import"./chunk-55IACEB6-DorbukSM.chunk.mjs";import"./chunk-QN33PNHL-BuaC_Ajj.chunk.mjs";import"./whiteboard-main.mjs";import"./index-Anv74-sp.chunk.mjs";import"./vendor-BeFBwUwf.chunk.mjs";import"./index-C0mkXnFg.chunk.mjs";import"./index-Bn0s6V7w.chunk.mjs";import"./index-vg7q3Iku.chunk.mjs";import"./translation-DoG5ZELJ-DKBzIEvm.chunk.mjs";import"./percentages-BXMCSKIN-Cw9SI0WV.chunk.mjs";import"./useJwtStore-B1DPLYgs.chunk.mjs";import"./_plugin-vue2_normalizer-CBCAj2XU.chunk.mjs";import"./_baseUniq-CE6homwJ.chunk.mjs";import"./union-S9f8F22c.chunk.mjs";import"./_basePickBy-0DU--7tw.chunk.mjs";import"./has-DJswI7NS.chunk.mjs";import"./zipObject-D21phg5E.chunk.mjs";import"./array-Cg_lHFoG.chunk.mjs";import"./path-i7Zvihw6.chunk.mjs";var F=m(e=>e.append("circle").attr("class","start-state").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit).attr("cy",t().state.padding+t().state.sizeUnit),"drawStartState"),J=m(e=>e.append("line").style("stroke","grey").style("stroke-dasharray","3").attr("x1",t().state.textHeight).attr("class","divider").attr("x2",t().state.textHeight*2).attr("y1",0).attr("y2",0),"drawDivider"),j=m((e,i)=>{const g=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+2*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),s=g.node().getBBox();return e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",s.width+2*t().state.padding).attr("height",s.height+2*t().state.padding).attr("rx",t().state.radius),g},"drawSimpleState"),Y=m((e,i)=>{const g=m(function(o,f,B){const w=o.append("tspan").attr("x",2*t().state.padding).text(f);B||w.attr("dy",t().state.textHeight)},"addTspan"),s=e.append("text").attr("x",2*t().state.padding).attr("y",t().state.textHeight+1.3*t().state.padding).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.descriptions[0]).node().getBBox(),r=s.height,c=e.append("text").attr("x",t().state.padding).attr("y",r+t().state.padding*.4+t().state.dividerMargin+t().state.textHeight).attr("class","state-description");let l=!0,a=!0;i.descriptions.forEach(function(o){l||(g(c,o,a),a=!1),l=!1});const d=e.append("line").attr("x1",t().state.padding).attr("y1",t().state.padding+r+t().state.dividerMargin/2).attr("y2",t().state.padding+r+t().state.dividerMargin/2).attr("class","descr-divider"),x=c.node().getBBox(),h=Math.max(x.width,s.width);return d.attr("x2",h+3*t().state.padding),e.insert("rect",":first-child").attr("x",t().state.padding).attr("y",t().state.padding).attr("width",h+2*t().state.padding).attr("height",x.height+r+2*t().state.padding).attr("rx",t().state.radius),e},"drawDescrState"),$=m((e,i,g)=>{const s=t().state.padding,r=2*t().state.padding,c=e.node().getBBox(),l=c.width,a=c.x,d=e.append("text").attr("x",0).attr("y",t().state.titleShift).attr("font-size",t().state.fontSize).attr("class","state-title").text(i.id),x=d.node().getBBox().width+r;let h=Math.max(x,l);h===l&&(h=h+r);let o;const f=e.node().getBBox();i.doc,o=a-s,x>l&&(o=(l-h)/2+s),Math.abs(a-f.x)l&&(o=a-(x-l)/2);const B=1-t().state.textHeight;return e.insert("rect",":first-child").attr("x",o).attr("y",B).attr("class",g?"alt-composit":"composit").attr("width",h).attr("height",f.height+t().state.textHeight+t().state.titleShift+1).attr("rx","0"),d.attr("x",o+s),x<=l&&d.attr("x",a+(h-r)/2-x/2+s),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",t().state.textHeight*3).attr("rx",t().state.radius),e.insert("rect",":first-child").attr("x",o).attr("y",t().state.titleShift-t().state.textHeight-t().state.padding).attr("width",h).attr("height",f.height+3+2*t().state.textHeight).attr("rx",t().state.radius),e},"addTitleAndBox"),X=m(e=>(e.append("circle").attr("class","end-state-outer").attr("r",t().state.sizeUnit+t().state.miniPadding).attr("cx",t().state.padding+t().state.sizeUnit+t().state.miniPadding).attr("cy",t().state.padding+t().state.sizeUnit+t().state.miniPadding),e.append("circle").attr("class","end-state-inner").attr("r",t().state.sizeUnit).attr("cx",t().state.padding+t().state.sizeUnit+2).attr("cy",t().state.padding+t().state.sizeUnit+2)),"drawEndState"),_=m((e,i)=>{let g=t().state.forkWidth,s=t().state.forkHeight;if(i.parentId){let r=g;g=s,s=r}return e.append("rect").style("stroke","black").style("fill","black").attr("width",g).attr("height",s).attr("x",t().state.padding).attr("y",t().state.padding)},"drawForkJoinState"),q=m((e,i,g,s)=>{let r=0;const c=s.append("text");c.style("text-anchor","start"),c.attr("class","noteText");let l=e.replace(/\r\n/g,"
");l=l.replace(/\n/g,"
");const a=l.split(H.lineBreakRegex);let d=1.25*t().state.noteMargin;for(const x of a){const h=x.trim();if(h.length>0){const o=c.append("tspan");if(o.text(h),d===0){const f=o.node().getBBox();d+=f.height}r+=d,o.attr("x",i+t().state.noteMargin),o.attr("y",g+r+1.25*t().state.noteMargin)}}return{textWidth:c.node().getBBox().width,textHeight:r}},"_drawLongText"),Z=m((e,i)=>{i.attr("class","state-note");const g=i.append("rect").attr("x",0).attr("y",t().state.padding),s=i.append("g"),{textWidth:r,textHeight:c}=q(e,0,0,s);return g.attr("height",c+2*t().state.noteMargin),g.attr("width",r+t().state.noteMargin*2),g},"drawNote"),T=m(function(e,i){const g=i.id,s={id:g,label:i.id,width:0,height:0},r=e.append("g").attr("id",g).attr("class","stateGroup");i.type==="start"&&F(r),i.type==="end"&&X(r),(i.type==="fork"||i.type==="join")&&_(r,i),i.type==="note"&&Z(i.note.text,r),i.type==="divider"&&J(r),i.type==="default"&&i.descriptions.length===0&&j(r,i),i.type==="default"&&i.descriptions.length>0&&Y(r,i);const c=r.node().getBBox();return s.width=c.width+2*t().state.padding,s.height=c.height+2*t().state.padding,s},"drawState"),D=0,K=m(function(e,i,g){const s=m(function(d){switch(d){case M.relationType.AGGREGATION:return"aggregation";case M.relationType.EXTENSION:return"extension";case M.relationType.COMPOSITION:return"composition";case M.relationType.DEPENDENCY:return"dependency"}},"getRelationType");i.points=i.points.filter(d=>!Number.isNaN(d.y));const r=i.points,c=W().x(function(d){return d.x}).y(function(d){return d.y}).curve(U),l=e.append("path").attr("d",c(r)).attr("id","edge"+D).attr("class","transition");let a="";if(t().state.arrowMarkerAbsolute&&(a=P(!0)),l.attr("marker-end","url("+a+"#"+s(M.relationType.DEPENDENCY)+"End)"),g.title!==void 0){const d=e.append("g").attr("class","stateLabel"),{x,y:h}=R.calcLabelPosition(i.points),o=H.getRows(g.title);let f=0;const B=[];let w=0,N=0;for(let u=0;u<=o.length;u++){const p=d.append("text").attr("text-anchor","middle").text(o[u]).attr("x",x).attr("y",h+f),y=p.node().getBBox();w=Math.max(w,y.width),N=Math.min(N,y.x),k.info(y.x,x,h+f),f===0&&(f=p.node().getBBox().height,k.info("Title height",f,h)),B.push(p)}let E=f*o.length;if(o.length>1){const u=(o.length-1)*f*.5;B.forEach((p,y)=>p.attr("y",h+y*f-u)),E=f*o.length}const n=d.node().getBBox();d.insert("rect",":first-child").attr("class","box").attr("x",x-w/2-t().state.padding/2).attr("y",h-E/2-t().state.padding/2-3.5).attr("width",w+t().state.padding).attr("height",E+t().state.padding),k.info(n)}D++},"drawEdge"),b,z={},Q=m(function(){},"setConf"),V=m(function(e){e.append("defs").append("marker").attr("id","dependencyEnd").attr("refX",19).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 19,7 L9,13 L14,7 L9,1 Z")},"insertMarkers"),tt=m(function(e,i,g,s){b=t().state;const r=t().securityLevel;let c;r==="sandbox"&&(c=v("#i"+i));const l=r==="sandbox"?v(c.nodes()[0].contentDocument.body):v("body"),a=r==="sandbox"?c.nodes()[0].contentDocument:document;k.debug("Rendering diagram "+e);const d=l.select(`[id='${i}']`);V(d);const x=s.db.getRootDoc();L(x,d,void 0,!1,l,a,s);const h=b.padding,o=d.node().getBBox(),f=o.width+h*2,B=o.height+h*2,w=f*1.75;O(d,B,w,b.useMaxWidth),d.attr("viewBox",`${o.x-b.padding} ${o.y-b.padding} `+f+" "+B)},"draw"),et=m(e=>e?e.length*b.fontSizeFactor:1,"getLabelWidth"),L=m((e,i,g,s,r,c,l)=>{const a=new C({compound:!0,multigraph:!0});let d,x=!0;for(d=0;d{const p=u.parentElement;let y=0,S=0;p&&(p.parentElement&&(y=p.parentElement.getBBox().width),S=parseInt(p.getAttribute("data-x-shift"),10),Number.isNaN(S)&&(S=0)),u.setAttribute("x1",0-S+8),u.setAttribute("x2",y-S-8)})):k.debug("No Node "+n+": "+JSON.stringify(a.node(n)))});let N=w.getBBox();a.edges().forEach(function(n){n!==void 0&&a.edge(n)!==void 0&&(k.debug("Edge "+n.v+" -> "+n.w+": "+JSON.stringify(a.edge(n))),K(i,a.edge(n),a.edge(n).relation))}),N=w.getBBox();const E={id:g||"root",label:g||"root",width:0,height:0};return E.width=N.width+2*b.padding,E.height=N.height+2*b.padding,k.debug("Doc rendered",E,a),E},"renderDoc"),at={setConf:Q,draw:tt},zt={parser:A,get db(){return new M(1)},renderer:at,styles:G,init:m(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{zt as diagram}; //# sourceMappingURL=stateDiagram-FKZM4ZOC-JowkH9ds.chunk.mjs.map