11 lines
33 KiB
JavaScript
Raw Normal View History

2026-05-31 13:21:13 +02:00
import{c as H}from"./chunk-KGFNY3KK.mjs";import{a as gt}from"./chunk-5IMINLNL.mjs";import{c as kt,d as ut}from"./chunk-T2UQINTJ.mjs";import{a as Y,b as B,c as rt,d as xt}from"./chunk-5VCL7Z4A.mjs";import{b as yt}from"./chunk-UY5QBCOK.mjs";import{f as mt}from"./chunk-INKRHTLW.mjs";import{p as W,t as ht}from"./chunk-QA3QBVWF.mjs";import{_ as U,t as $,x as K}from"./chunk-67TQ5CYL.mjs";import{$ as ft,G as N,H as at,J as et,K as nt,L as tt,P as st,S as ot,W as it,X as ct,Y as lt,Z as dt,_ as pt,b as y,h as E}from"./chunk-7W6UQGC5.mjs";import{a as d}from"./chunk-AQ6EADP3.mjs";var bt=d((r,t,a,s,o,n=!1,e)=>{t.arrowTypeStart&&wt(r,"start",t.arrowTypeStart,a,s,o,n,e),t.arrowTypeEnd&&wt(r,"end",t.arrowTypeEnd,a,s,o,n,e)},"addEdgeMarkers"),Ut={arrow_cross:{type:"cross",fill:!1},arrow_point:{type:"point",fill:!0},arrow_barb:{type:"barb",fill:!0},arrow_barb_neo:{type:"barb",fill:!0},arrow_circle:{type:"circle",fill:!1},aggregation:{type:"aggregation",fill:!1},extension:{type:"extension",fill:!1},composition:{type:"composition",fill:!0},dependency:{type:"dependency",fill:!0},lollipop:{type:"lollipop",fill:!1},only_one:{type:"onlyOne",fill:!1},zero_or_one:{type:"zeroOrOne",fill:!1},one_or_more:{type:"oneOrMore",fill:!1},zero_or_more:{type:"zeroOrMore",fill:!1},requirement_arrow:{type:"requirement_arrow",fill:!1},requirement_contains:{type:"requirement_contains",fill:!1}},Et=["cross","point","circle","lollipop","aggregation","extension","composition","dependency","barb"],wt=d((r,t,a,s,o,n,e=!1,i)=>{let c=Ut[a],l=c&&Et.includes(c.type);if(!c){y.warn(`Unknown arrow type: ${a}`);return}let m=c.type,p=`${o}_${n}-${m}${t==="start"?"Start":"End"}${e&&l?"-margin":""}`;if(i&&i.trim()!==""){let x=i.replace(/[^\dA-Za-z]/g,"_"),h=`${p}_${x}`;if(!document.getElementById(h)){let k=document.getElementById(p);if(k){let u=k.cloneNode(!0);u.id=h,u.querySelectorAll("path, circle, line").forEach(X=>{X.setAttribute("stroke",i),c.fill&&X.setAttribute("fill",i)}),k.parentNode?.appendChild(u)}}r.attr(`marker-${t}`,`url(${s}#${h})`)}else r.attr(`marker-${t}`,`url(${s}#${p})`)},"addEdgeMarker");var Wt=d(r=>typeof r=="string"?r:U()?.flowchart?.curve,"resolveEdgeCurveType"),I=new Map,M=new Map,_r=d(()=>{I.clear(),M.clear()},"clear"),T=d(r=>r?typeof r=="string"?r:r.reduce((t,a)=>t+";"+a,""):"","getLabelStyles"),Sr=d(async(r,t)=>{let a=U(),s=K(a),{labelStyles:o}=ut(t);t.labelStyle=o;let n=r.insert("g").attr("class","edgeLabel"),e=n.insert("g").attr("class","label").attr("data-id",t.id),i=t.labelType==="markdown",l=await mt(r,t.label,{style:T(t.labelStyle),useHtmlLabels:s,addSvgBackground:!0,isNode:!1,markdown:i,width:i?void 0:void 0},a);e.node().appendChild(l),y.info("abc82",t,t.labelType);let m=l.getBBox(),g=m;if(s){let p=l.children[0],x=E(l);m=p.getBoundingClientRect(),g=m,x.attr("width",m.width),x.attr("height",m.height)}else{let p=E(l).select("text").node();p&&typeof p.getBBox=="function"&&(g=p.getBBox())}e.attr("transform",Y(g,s)),I.set(t.id,n),t.width=m.width,t.height=m.height;let f;if(t.startLabelLeft){let p=r.insert("g").attr("class","edgeTerminals"),x=p.insert("g").attr("class","inner"),h=await H(x,t.startLabelLeft,T(t.labelStyle)||"",!1,!1);f=h;let k=h.getBBox();if(s){let u=h.children[0],b=E(h);k=u.getBoundingClientRect(),b.attr("width",k.width),b.attr("height",k.height)}x.attr("transform",Y(k,s)),M.get(t.id)||M.set(t.id,{}),M.get(t.id).startLeft=p,V(f,t.startLabelLeft)}if(t.startLabelRight){let p=r.insert("g").attr("class","edgeTerminals"),x=p.insert("g").attr("class","inner"),h=await H(x,t.startLabelRight,T(t.labelStyle)||"",!1,!1);f=h;let k=h.getBBox();if(s){let u=h.children[0],b=E(h);k=u.getBoundingClientRect(),b.attr("width",k.width),b.attr("height",k.height)}x.attr("transform",Y(k,s)),M.get(t.id)||M.set(t.id,{}),M.get(t.id).startRight=p,V(f,t.startLabelRight)}if(t.endLabelLeft){let p=r.insert("g").attr("class","edgeTerminals"),x=p.insert("g").attr("class","inner"),h=await H(p,t.endLabelLeft,T(t.labelStyle)||"",!1,!1);f=h;let k=h.getBBox();if(s){let u=h.children[0],b=E(h);k=u.getBoundingClientRect(),b.attr("width",k.width),b.attr("height",k.height)}x
outsidePoint: ${JSON.stringify(t)}
insidePoint : ${JSON.stringify(a)}
node : x:${r.x} y:${r.y} w:${r.width} h:${r.height}`);let s=r.x,o=r.y,n=Math.abs(s-a.x),e=r.width/2,i=a.x<t.x?e-n:e+n,c=r.height/2,l=Math.abs(t.y-a.y),m=Math.abs(t.x-a.x);if(Math.abs(o-t.y)*e>Math.abs(s-t.x)*c){let g=a.y<t.y?t.y-c-o:o-c-t.y;i=m*g/l;let f={x:a.x<t.x?a.x+i:a.x-m+i,y:a.y<t.y?a.y+l-g:a.y-l+g};return i===0&&(f.x=t.x,f.y=t.y),m===0&&(f.x=t.x),l===0&&(f.y=t.y),y.debug(`abc89 top/bottom calc, Q ${l}, q ${g}, R ${m}, r ${i}`,f),f}else{a.x<t.x?i=t.x-e-s:i=s-e-t.x;let g=l*i/m,f=a.x<t.x?a.x+m-i:a.x-m+i,p=a.y<t.y?a.y+g:a.y-g;return y.debug(`sides calc abc89, Q ${l}, q ${g}, R ${m}, r ${i}`,{_x:f,_y:p}),i===0&&(f=t.x,p=t.y),m===0&&(f=t.x),l===0&&(p=t.y),{x:f,y:p}}},"intersection"),Mt=d((r,t)=>{y.warn("abc88 cutPathAtIntersect",r,t);let a=[],s=r[0],o=!1;return r.forEach(n=>{if(y.info("abc88 checking point",n,t),!Xt(t,n)&&!o){let e=Yt(t,s,n);y.debug("abc88 inside",n,s,e),y.debug("abc88 intersection",e,t);let i=!1;a.forEach(c=>{i=i||c.x===e.x&&c.y===e.y}),a.some(c=>c.x===e.x&&c.y===e.y)?y.warn("abc88 no intersect",e,a):a.push(e),o=!0}else y.warn("abc88 outside",n,s),s=n,o||a.push(n)}),y.debug("returning points",a),a},"cutPathAtIntersect");function vt(r){let t=[],a=[];for(let s=1;s<r.length-1;s++){let o=r[s-1],n=r[s],e=r[s+1];(o.x===n.x&&n.y===e.y&&Math.abs(n.x-e.x)>5&&Math.abs(n.y-o.y)>5||o.y===n.y&&n.x===e.x&&Math.abs(n.x-o.x)>5&&Math.abs(n.y-e.y)>5)&&(t.push(n),a.push(s))}return{cornerPoints:t,cornerPointPositions:a}}d(vt,"extractCornerPoints");var Lt=d(function(r,t,a){let s=t.x-r.x,o=t.y-r.y,n=Math.sqrt(s*s+o*o),e=a/n;return{x:t.x-e*s,y:t.y-e*o}},"findAdjacentPoint"),Ht=d(function(r){let{cornerPointPositions:t}=vt(r),a=[];for(let s=0;s<r.length;s++)if(t.includes(s)){let o=r[s-1],n=r[s+1],e=r[s],i=Lt(o,e,5),c=Lt(n,e,5),l=c.x-i.x,m=c.y-i.y;a.push(i);let g=Math.sqrt(2)*2,f={x:e.x,y:e.y};if(Math.abs(n.x-o.x)>10&&Math.abs(n.y-o.y)>=10){y.debug("Corner point fixing",Math.abs(n.x-o.x),Math.abs(n.y-o.y));let p=5;e.x===i.x?f={x:l<0?i.x-p+g:i.x+p-g,y:m<0?i.y-g:i.y+g}:f={x:l<0?i.x-g:i.x+g,y:m<0?i.y-p+g:i.y+p-g}}else y.debug("Corner point skipping fixing",Math.abs(n.x-o.x),Math.abs(n.y-o.y));a.push(f,c)}else a.push(r[s]);return a},"fixCorners"),Bt=d((r,t,a)=>{let s=r-t-a,o=2,n=2,e=o+n,i=Math.floor(s/e),c=Array(i).fill(`${o} ${n}`).join(" ");return`0 ${t} ${c} ${a}`},"generateDashArray"),$r=d(function(r,t,a,s,o,n,e,i=!1){if(!e)throw new Error(`insertEdge: missing diagramId for edge "${t.id}" \u2014 edge IDs require a diagram prefix for uniqueness`);let{handDrawnSeed:c}=U(),l=t.points,m=!1,g=o;var f=n;let p=[];for(let _ in t.cssCompiledStyles)kt(_)||p.push(t.cssCompiledStyles[_]);y.debug("UIO intersect check",t.points,f.x,g.x),f.intersect&&g.intersect&&!i&&(l=l.slice(1,t.points.length-1),l.unshift(g.intersect(l[0])),y.debug("Last point UIO",t.start,"-->",t.end,l[l.length-1],f,f.intersect(l[l.length-1])),l.push(f.intersect(l[l.length-1])));let x=btoa(JSON.stringify(l));t.toCluster&&(y.info("to cluster abc88",a.get(t.toCluster)),l=Mt(t.points,a.get(t.toCluster).node),m=!0),t.fromCluster&&(y.debug("from cluster abc88",a.get(t.fromCluster),JSON.stringify(l,null,2)),l=Mt(l.reverse(),a.get(t.fromCluster).node).reverse(),m=!0);let h=l.filter(_=>!Number.isNaN(_.y)),k=Wt(t.curve);k!=="rounded"&&(h=Ht(h));let u=N;switch(k){case"linear":u=N;break;case"basis":u=tt;break;case"cardinal":u=st;break;case"bumpX":u=et;break;case"bumpY":u=nt;break;case"catmullRom":u=ot;break;case"monotoneX":u=it;break;case"monotoneY":u=ct;break;case"natural":u=lt;break;case"step":u=dt;break;case"stepAfter":u=ft;break;case"stepBefore":u=pt;break;case"rounded":u=N;break;default:u=tt}let{x:b,y:X}=xt(t),j=at().x(b).y(X).curve(u),L;switch(t.thickness){case"normal":L="edge-thickness-normal";break;case"thick":L="edge-thickness-thick";break;case"invisible":L="edge-thickness-invisible";break;default:L="edge-thickness-normal"}switch(t.pattern){case"solid":L+=" edge-pattern-solid";break;case"dotted":L+=" edge-pattern-dotted";break;case"dashed":L+=" edge-pattern-dashed";break;default:L+=" edge-pattern-solid"}let w,C=k==="rounded"?Tt(Ct(h,t),5):j(h),S=Array.isArray(t.st
L20,10
M20,10
L0,20`)},"requirement_arrow"),nr=d((r,t,a)=>{let s=$(),{themeVariables:o}=s,{strokeWidth:n}=o;r.append("defs").append("marker").attr("id",a+"_"+t+"-requirement_arrowEnd").attr("refX",20).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").attr("stroke-width",`${n}`).attr("viewBox","0 0 25 20").append("path").attr("d",`M0,0
L20,10
M20,10
L0,20`).attr("stroke-linejoin","miter")},"requirement_arrow_neo"),sr=d((r,t,a)=>{let s=r.append("defs").append("marker").attr("id",a+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").append("g");s.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),s.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),s.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10)},"requirement_contains"),or=d((r,t,a)=>{let s=$(),{themeVariables:o}=s,{strokeWidth:n}=o,e=r.append("defs").append("marker").attr("id",a+"_"+t+"-requirement_containsStart").attr("refX",0).attr("refY",10).attr("markerWidth",20).attr("markerHeight",20).attr("orient","auto").attr("markerUnits","userSpaceOnUse").append("g");e.append("circle").attr("cx",10).attr("cy",10).attr("r",9).attr("fill","none"),e.append("line").attr("x1",1).attr("x2",19).attr("y1",10).attr("y2",10),e.append("line").attr("y1",1).attr("y2",19).attr("x1",10).attr("x2",10),e.selectAll("*").attr("stroke-width",`${n}`)},"requirement_contains_neo"),ir={extension:At,composition:Rt,aggregation:qt,dependency:Qt,lollipop:Zt,point:Pt,circle:Nt,cross:Vt,barb:It,barbNeo:jt,only_one:Dt,zero_or_one:Gt,one_or_more:Jt,zero_or_more:Ft,only_one_neo:Kt,zero_or_one_neo:tr,one_or_more_neo:rr,zero_or_more_neo:ar,requirement_arrow:er,requirement_contains:sr,requirement_arrow_neo:nr,requirement_contains_neo:or},Yr=zt;export{_r as a,Sr as b,Or as c,$r as d,Yr as e};