@diagrammo/dgmo 0.44.0 → 0.44.1

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/cli.cjs CHANGED
@@ -209,7 +209,7 @@ Task
209
209
  `);for(let n of e){let r=n.trim();if(!r||r.startsWith("//"))continue;let o=ze(r);if(o)return o.chartType;break}return N0(t)?"sequence":G0(t)?"flowchart":H0(t)?"class":F0(t)?"er":O0(t)?"state":U0(t)?"sitemap":Y0(t)?"org":MA(t)?"c4":NA(t)?"gantt":J0(t)?"pert":null}function Kw(t){return qw.get(t.toLowerCase())?.category??null}function GX(t){let e=qw.get(t.toLowerCase());return e?EA(e.parse):!1}function Zw(){return tw.map(t=>t.id)}function uf(t){let e=$X(t);return{diagnostics:LN(e.diagnostics),chartType:e.chartType}}function $X(t){let e=Jc(t);if(!e){let o=HX(t);if(o){let a=lo(t).diagnostics;return{diagnostics:[o,...a],chartType:null}}return{diagnostics:lo(t).diagnostics,chartType:null}}let n=OX.get(e);return n?{diagnostics:[...n(t).diagnostics,...vA(t)],chartType:e}:{diagnostics:[...lo(t).diagnostics,...vA(t)],chartType:e}}function HX(t){let e=t.split(`
210
210
  `);for(let n=0;n<e.length;n++){let r=e[n].trim();if(!r||r.startsWith("#")||r.startsWith("//"))continue;let o=r.match(/^(\w[\w-]*)\s*:\s*(.*)$/);if(!o)return null;let a=o[1].toLowerCase(),i=o[2].trim();if(LA.has(a)){let l=i?`${a} ${i}`:a;return Rt(n+1,`Remove the colon \u2014 use '${l}' instead of '${r}'. DGMO chart types don't use colons.`)}let s=be(a,[...LA]);return s?Rt(n+1,`Unknown chart type: ${a}. ${s} Also, DGMO chart types don't use colons.`):null}return null}function vA(t){return t.split(`
211
211
  `).filter(r=>r.trim()&&!r.trim().startsWith("#")&&!r.trim().startsWith("//")).length<=1?[Rt(1,"No content after chart type declaration.","warning")]:[]}var IX,PX,DX,Ag,Qw,kA,OX,LA,ff=st(()=>{"use strict";_c();Vu();zu();Uu();Xu();ju();qu();ef();Ui();Hn();un();U_();SA();IX=/^\d+(?:\.\d+)?(?:min|bd|d|w|m|q|y|h)(?:\?)?\s+/,PX=/^\d{4}-\d{2}-\d{2}(?:\s\d{2}:\d{2})?\s+/;DX=/\bis\s+an?\s+(person|system|container|component)\b/i;Ag=Object.fromEntries(tw.map(t=>[t.id,t.description])),Qw=jw.map(t=>[t.id,t.parse]),kA=Qw.map(([t])=>t),OX=new Map(Qw),LA=new Set(kA)});function Qr(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function WX(t,e,n,r){let o=[],a=t.pill;o.push(`<rect width="${t.width}" height="${t.height}" rx="${Se/2}" fill="${Qr(n)}"/>`),o.push(`<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" rx="${a.height/2}" fill="${Qr(e.bg)}"/>`,`<rect x="${a.x}" y="${a.y}" width="${a.width}" height="${a.height}" rx="${a.height/2}" fill="none" stroke="${Qr(r)}" stroke-width="0.75"/>`),o.push(`<text x="${a.x+a.width/2}" y="${Se/2+cr/2-2}" font-size="${cr}" font-weight="500" fill="${Qr(e.text)}" text-anchor="middle" font-family="${Qr(Pt)}">${Qr(t.groupName)}</text>`);for(let i of t.entries){let s=i.displayValue??i.value,l=i.width!=null?`<rect x="${i.x}" y="${i.y}" width="${i.width}" height="${Se}" fill="transparent"/>`:"";o.push(`<g data-legend-entry="${Qr(i.value.toLowerCase())}" data-series-name="${Qr(i.value)}" style="cursor:pointer">`+l+`<circle cx="${i.dotCx}" cy="${i.dotCy}" r="${Er}" fill="${Qr(i.color)}"/><text x="${i.textX}" y="${i.dotCy+Xn/2-1}" font-size="${Xn}" fill="${Qr(e.textMuted)}" font-family="${Qr(Pt)}">${Qr(s)}</text></g>`)}return`<g transform="translate(${t.x},${t.y})" data-legend-group="${Qr(qt(t.groupName))}" style="cursor:pointer">${o.join("")}</g>`}function FX(t,e,n){return`<g transform="translate(${t.x},${t.y})" data-legend-group="${Qr(qt(t.groupName))}" style="cursor:pointer"><rect width="${t.width}" height="${t.height}" rx="${t.height/2}" fill="${Qr(n)}"/><text x="${t.width/2}" y="${t.height/2+cr/2-2}" font-size="${cr}" font-weight="500" fill="${Qr(e.textMuted)}" text-anchor="middle" font-family="${Qr(Pt)}">${Qr(t.groupName)}</text></g>`}function CA(t,e){if(t.length===0)return{svg:"",height:0,width:0};let{palette:n,isDark:r,containerWidth:o,activeGroup:a,className:i}=e,s=o>0?o:1200,d=kl({groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},{activeGroup:a??null},s);if(!d.activeCapsule&&d.pills.length===0)return{svg:"",height:0,width:0};let u=r?Ot(n.surface,n.bg,50):Ot(n.surface,n.bg,30),f=Ot(n.textMuted,n.bg,50),p=[],m=0,g=1/0,h=0,S=(x,N,L,A)=>{g=Math.min(g,x),h=Math.max(h,x+L),m=Math.max(m,N+A)};if(d.activeCapsule){let x=d.activeCapsule;p.push(WX(x,n,u,f)),S(x.x,x.y,x.width,x.height)}for(let x of d.pills)p.push(FX(x,n,u)),S(x.x,x.y,x.width,x.height);let y=i?` class="${Qr(i)}"`:"",b=a?` data-legend-active="${Qr(a.toLowerCase())}"`:"";return{svg:`<g${y}${b}>${p.join("")}</g>`,height:m,width:h-(g===1/0?0:g)}}var _A=st(()=>{"use strict";je();Tr();_o();tn();an()});function cn(t){return isFinite(t)?Math.abs(t)>=1e3?t.toLocaleString("en-US"):String(Math.round(t*100)/100):""}function Rg(t,e,n,r,o,a,i){return pf(t,sg(e,n),r,o,a,i)}function pf(t,e,n,r,o,a){let i=o?40:0;if(e.length===0)return o?i+12:24;let s=8+i,{svg:l,height:c}=CA(e,{palette:n,isDark:r,containerWidth:a,activeGroup:e[0].name,className:"chart-legend"}),d=t.node();return d&&l&&d.insertAdjacentHTML("beforeend",`<g transform="translate(0,${s})">${l}</g>`),s+c+14}function ns(t,e){let r=t?22:0,o=e.length?Math.max(...e.map(a=>_t(a,Lo))):0;return Math.max(56,16+r+o+14)}function Xs(t,e,n,r,o){e&&t.append("text").attr("x",n).attr("y",r).attr("text-anchor","middle").attr("fill",o).attr("font-size",AA).attr("font-family",Pt).attr("font-weight",600).text(e)}function rs(t,e,n,r,o){e&&t.append("text").attr("transform",`translate(${r},${n}) rotate(-90)`).attr("text-anchor","middle").attr("fill",o).attr("font-size",AA).attr("font-family",Pt).attr("font-weight",600).text(e)}function Vr(t,e){let n=(t.attr("class")??"").split(/\s+/).filter(Boolean);return n.includes("dgmo-datum")||n.push("dgmo-datum"),t.attr("class",n.join(" ")),e.line!=null&&t.attr("data-line-number",e.line),e.key!=null&&t.attr("data-emph-key",e.key),e.name!=null&&t.attr("data-name",e.name),e.value!=null&&t.attr("data-value",String(e.value)),e.color!=null&&t.attr("data-color",e.color),t}function Dl(t,e,n,r,o,a="middle"){t.append("text").attr("x",n).attr("y",r).attr("text-anchor",a).attr("fill",o).attr("font-size",BX).attr("font-family",Pt).text(e)}var AA,Lo,BX,ra=st(()=>{"use strict";an();en();nf();_A();AA=13,Lo=12,BX=12});function RA(t,e){let n=[t.value];for(let r=1;r<e;r++)n.push(t.extraValues?.[r-1]??0);return n}function IA(t,e,n,r,o,a,i,s,l,c){let d=e.data,u=e.seriesNames?.length?e.seriesNames:[e.series??""],f=e.barLayout==="stack",p=e.barLayout==="group",m=f||p?Math.max(1,u.length,1+Math.max(0,...d.map(H=>H.extraValues?.length??0))):1,g=e.orientation==="horizontal",h=m>1,S=e.solidFill===!0,y=(H,G,D)=>D||(h?o[H%o.length]:o[G%o.length]),b=H=>S?H:ie(a,H,i),E=Rg(t,e,o,a,i,c,n),x=d.map(H=>RA(H,m)),N=f?yc(x,H=>H.reduce((G,D)=>G+D,0))??0:yc(x,H=>yc(H)??0)??0,L=N===0?1:N,A=g?d.map(H=>H.label):[cn(L),cn(L/2)],C={top:E+8,right:32,bottom:64,left:ns(e.ylabel,A)},k=n-C.left-C.right,w=r-C.top-C.bottom,v=g,M=v?[C.top,C.top+w]:[C.left,C.left+k],_=yl().domain(d.map(H=>H.label)).range(M).padding(.3),T=v?[C.left,C.left+k]:[C.top+w,C.top],R=ir().domain([0,L]).nice().range(T);for(let H of R.ticks(6))if(v){let G=R(H);t.append("line").attr("x1",G).attr("x2",G).attr("y1",C.top).attr("y2",C.top+w).attr("stroke",l).attr("stroke-opacity",H===0?.6:.25),t.append("text").attr("x",G).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(cn(H))}else{let G=R(H);t.append("line").attr("x1",C.left).attr("x2",C.left+k).attr("y1",G).attr("y2",G).attr("stroke",l).attr("stroke-opacity",H===0?.6:.25),t.append("text").attr("x",C.left-10).attr("y",G+4).attr("text-anchor","end").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(cn(H))}for(let H of d){let G=(_(H.label)??0)+_.bandwidth()/2;v?t.append("text").attr("x",C.left-10).attr("y",G+4).attr("text-anchor","end").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(H.label):t.append("text").attr("x",G).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(H.label)}let O=R(0),I=f?null:yl().domain(u.map((H,G)=>G)).range([0,_.bandwidth()]).padding(.12);d.forEach((H,G)=>{let D=_(H.label)??0,W=RA(H,m),V=0;W.forEach((P,F)=>{let Y=y(F,G,m===1?H.color:void 0),z=b(Y),j=u[F]??"",K={line:H.lineNumber,key:h?j:H.label,name:h?`${H.label} \xB7 ${j}`:H.label,value:P,color:Y};if(f){if(v){let $=R(V),U=R(V+P);Ig(t,Math.min($,U),D,Math.abs(U-$),_.bandwidth(),z,Y,K),Math.abs(U-$)>26&&Dl(t,cn(P),($+U)/2,D+_.bandwidth()/2+4,s)}else{let $=R(V),U=R(V+P);Ig(t,D,Math.min($,U),_.bandwidth(),Math.abs(U-$),z,Y,K),Math.abs(U-$)>18&&Dl(t,cn(P),D+_.bandwidth()/2,($+U)/2+4,s)}V+=P}else{let $=I(F)??0,U=I.bandwidth();if(v){let X=R(P);Ig(t,Math.min(O,X),D+$,Math.abs(X-O),U,z,Y,K),Dl(t,cn(P),X+6,D+$+U/2+4,s,"start")}else{let X=R(P);Ig(t,D+$,Math.min(O,X),U,Math.abs(O-X),z,Y,K),Dl(t,cn(P),D+$+U/2,X-6,s)}}})}),Xs(t,e.xlabel,C.left+k/2,C.top+w+46,s),rs(t,e.ylabel,C.top+w/2,20,s)}function Ig(t,e,n,r,o,a,i,s){let l=t.append("rect").attr("x",e).attr("y",n).attr("width",r).attr("height",o).attr("fill",a).attr("stroke",i).attr("stroke-width",1.5);Vr(l,s)}var PA=st(()=>{"use strict";Xa();To();an();tn();ra()});function DA(t,e){return e===0?t.value:t.extraValues?.[e-1]??0}function GA(t,e,n,r,o,a,i,s,l,c,d){let u=e.data,f=e.fill===!0,p=e.seriesNames?.length?e.seriesNames:[e.series??""],m=Math.max(1,p.length,1+Math.max(0,...u.map(I=>I.extraValues?.length??0))),g=I=>e.seriesNameColors?.[I]??o[I%o.length],h=I=>e.seriesAxes?.[I]??"left",S=(e.seriesAxes??[]).includes("right"),y=I=>{let H=[];for(let G=0;G<m;G++)h(G)===I&&H.push(G);return H.length===1?g(H[0]):void 0},b=Rg(t,e,o,a,i,d,n),E=I=>{let H=1/0,G=-1/0;for(let D of u)for(let W=0;W<m;W++)if(h(W)===I){let V=DA(D,W);H=Math.min(H,V),G=Math.max(G,V)}return isFinite(H)?(H>0&&(H=0),H===G&&(G=H+1),[H,G]):[0,1]},[x,N]=E("left"),[L,A]=S?E("right"):[0,1],C={top:b+8,right:S?ns(e.yrlabel,[cn(A),cn(L)]):32,bottom:64,left:ns(e.ylabel,[cn(N),cn(x)])},k=n-C.left-C.right,w=r-C.top-C.bottom,v=vs().domain(u.map(I=>I.label)).range([C.left,C.left+k]).padding(.5),M=ir().domain([x,N]).nice().range([C.top+w,C.top]),_=S?ir().domain([L,A]).nice().range([C.top+w,C.top]):null,T=I=>S&&h(I)==="right"&&_?_:M,R=S?y("left"):void 0,O=y("right");e.eras?.length&&e.eras.forEach((I,H)=>{let G=v(I.start),D=v(I.end);if(G==null||D==null)return;let W=I.color??o[H%o.length];t.append("rect").attr("x",Math.min(G,D)).attr("y",C.top).attr("width",Math.abs(D-G)).attr("height",w).attr("fill",Ot(W,c,12)),t.append("text").attr("x",(G+D)/2).attr("y",C.top+14).attr("text-anchor","middle").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).attr("opacity",.8).text(I.label)});for(let I of M.ticks(6)){let H=M(I);t.append("line").attr("x1",C.left).attr("x2",C.left+k).attr("y1",H).attr("y2",H).attr("stroke",l).attr("stroke-opacity",I===0?.6:.25),t.append("text").attr("class","dgmo-tick").attr("x",C.left-10).attr("y",H+4).attr("text-anchor","end").attr("fill",R??s).attr("font-size",Lo).attr("font-family",Pt).text(cn(I))}if(S&&_)for(let I of _.ticks(6))t.append("text").attr("class","dgmo-tick").attr("x",C.left+k+10).attr("y",_(I)+4).attr("text-anchor","start").attr("fill",O??s).attr("font-size",Lo).attr("font-family",Pt).text(cn(I));for(let I of u)t.append("text").attr("class","dgmo-tick").attr("x",v(I.label)??0).attr("y",C.top+w+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(I.label);t.append("rect").attr("class","dgmo-plot-rect").attr("x",C.left).attr("y",C.top).attr("width",k).attr("height",w).attr("fill","transparent");for(let I=0;I<m;I++){let H=g(I),G=T(I),D=p[I]??`Series ${I+1}`,W=u.map((z,j)=>({label:z.label,v:DA(z,I),xIndex:j,lineNumber:z.lineNumber})),V=t.append("g").attr("class","dgmo-series").attr("data-series-index",I).attr("data-series-name",D).attr("data-axis",h(I)).attr("data-color",H),P=e.seriesNameLineNumbers?.[I];if(P!==void 0&&V.attr("data-line-number",P),f){let z=Du().x(j=>v(j.label)??0).y0(G(Math.max(G.domain()[0],0))).y1(j=>G(j.v));V.append("path").attr("class","dgmo-series-area").attr("d",z(W)??"").attr("fill",ie(a,H,i)).attr("stroke","none")}let F=Qn().x(z=>v(z.label)??0).y(z=>G(z.v));V.append("path").attr("class","dgmo-series-line").attr("d",F(W)??"").attr("fill","none").attr("stroke",H).attr("stroke-width",2.5).attr("stroke-linejoin","round").attr("stroke-linecap","round");let Y=Ot(H,s,60);for(let z of W)V.append("circle").attr("class","dgmo-pt").attr("data-series-index",I).attr("data-series-name",D).attr("data-color",H).attr("data-x-index",z.xIndex).attr("data-x-label",z.label).attr("data-value",z.v).attr("data-line-number",z.lineNumber).attr("cx",v(z.label)??0).attr("cy",G(z.v)).attr("r",3.5).attr("fill",c).attr("stroke",H).attr("stroke-width",2),e.noValue||Dl(t,cn(z.v),v(z.label)??0,G(z.v)-10,Y)}Xs(t,e.xlabel,C.left+k/2,C.top+w+46,s),rs(t,e.ylabel,C.top+w/2,20,R??s),S&&(rs(t,e.yrlabel,C.top+w/2,n-18,O??s),t.append("rect").attr("class","dgmo-axis-legend").attr("data-axis-legend","left").attr("x",0).attr("y",C.top).attr("width",C.left).attr("height",w).attr("fill","transparent").attr("style","cursor:pointer"),t.append("rect").attr("class","dgmo-axis-legend").attr("data-axis-legend","right").attr("x",C.left+k).attr("y",C.top).attr("width",C.right).attr("height",w).attr("fill","transparent").attr("style","cursor:pointer"))}var OA=st(()=>{"use strict";Xa();So();an();tn();ra()});function $A(t,e,n,r,o,a,i,s){let l=e.data.filter(N=>N.value>0);if(l.length===0)return;let c=e.hole,d=c!==void 0,u=e.solidFill===!0,f=l.reduce((N,L)=>N+L.value,0),p=n/2,m=s+12,g=m+(r-m)/2,h=Math.min(n/2-220,(r-m)/2-40),S=mc(o,l.length),y=(N,L)=>L??S[N%S.length],b=Jx().sort(null).value(N=>N.value)(l.map(N=>({value:N.value}))),E=Nl().innerRadius(d?h*c:0).outerRadius(h),x=t.append("g").attr("transform",`translate(${p},${g})`);b.forEach((N,L)=>{let A=y(L,l[L].color),C=u?A:ie(o,A,a),k=Math.round(l[L].value/f*100),w=x.append("path").attr("d",E(N)??"").attr("fill",C).attr("stroke",A).attr("stroke-width",1.5);Vr(w,{line:l[L].lineNumber,key:l[L].label,name:l[L].label,value:`${cn(l[L].value)} (${k}%)`,color:A});let v=(N.startAngle+N.endAngle)/2-Math.PI/2,M=Math.cos(v)>=0,_=Math.cos(v)*h,T=Math.sin(v)*h,R=Math.cos(v)*(h+16),O=Math.sin(v)*(h+16),I=R+(M?28:-28),H=e.noName?"":l[L].label,G=[e.noValue?"":cn(l[L].value),e.noPercent?"":`(${k}%)`].filter(Boolean).join(" "),D=[H,G].filter(Boolean).join(" \u2014 ");D&&(x.append("polyline").attr("points",`${_},${T} ${R},${O} ${I},${O}`).attr("fill","none").attr("stroke",A).attr("stroke-width",1),x.append("text").attr("x",I+(M?4:-4)).attr("y",O+4).attr("text-anchor",M?"start":"end").attr("fill",i).attr("font-size",YX).attr("font-family",Pt).text(D))}),d&&!e.noCenterTotal&&x.append("text").attr("text-anchor","middle").attr("y",8).attr("fill",i).attr("font-size",26).attr("font-weight",700).attr("font-family",Pt).text(cn(f))}var YX,HA=st(()=>{"use strict";So();tn();an();ra();YX=14});function Jw(t,e){return e===0?t.value:t.extraValues?.[e-1]??0}function FA(t,e,n,r,o,a,i,s,l,c){let d=e.data,u=d.length;if(u<3)return;let f=e.solidFill===!0,p=e.seriesNames?.length?e.seriesNames:[e.series??""],m=Math.max(1,p.length,1+Math.max(0,...d.map(C=>C.extraValues?.length??0))),g=m>1,h=C=>g?e.seriesNameColors?.[C]??o[C%o.length]:e.color??e.seriesNameColors?.[0]??a.primary,S=[];for(let C of d)for(let k=0;k<m;k++)S.push(Jw(C,k));let y=Math.max(...S)*1.15||1,b=n/2,E=c+8,x=E+(r-E)/2,N=Math.min(n/2-130,(r-E)/2-50),L=C=>-Math.PI/2+C*2*Math.PI/u,A=(C,k)=>[b+Math.cos(L(C))*k,x+Math.sin(L(C))*k];for(let C=1;C<=WA;C++){let k=N*C/WA,w=d.map((v,M)=>A(M,k).join(",")).join(" ");t.append("polygon").attr("points",w).attr("fill","none").attr("stroke",l).attr("stroke-opacity",.4)}d.forEach((C,k)=>{let[w,v]=A(k,N);t.append("line").attr("x1",b).attr("y1",x).attr("x2",w).attr("y2",v).attr("stroke",l).attr("stroke-opacity",.4);let[M,_]=A(k,N+18),T=Math.cos(L(k));t.append("text").attr("x",M).attr("y",_+4).attr("text-anchor",Math.abs(T)<.3?"middle":T>0?"start":"end").attr("fill",s).attr("font-size",14).attr("font-family",Pt).text(d[k].label)});for(let C=0;C<m;C++){let k=h(C),w=p[C]??`Series ${C+1}`,v=t.append("g").attr("class","dgmo-series").attr("data-series-index",C).attr("data-series-name",w).attr("data-color",k),M=e.seriesNameLineNumbers?.[C];M!==void 0&&v.attr("data-line-number",M);let _=d.map((T,R)=>A(R,Jw(T,C)/y*N).join(",")).join(" ");v.append("polygon").attr("points",_).attr("fill",f||g?k:ie(a,k,i)).attr("fill-opacity",f?.6:g?.2:1).attr("stroke",k).attr("stroke-width",2),d.forEach((T,R)=>{let O=Jw(T,C),[I,H]=A(R,O/y*N),G=v.append("circle").attr("cx",I).attr("cy",H).attr("r",4).attr("fill",k);Vr(G,{line:T.lineNumber,key:g?`${w}\0${T.label}`:T.label,name:g?`${w} \u2014 ${T.label}`:T.label,value:cn(O),color:k}),e.noValue||v.append("text").attr("x",I).attr("y",H-8).attr("text-anchor","middle").attr("fill",s).attr("font-size",12).attr("font-family",Pt).text(cn(O))})}}var WA,BA=st(()=>{"use strict";an();tn();ra();WA=5});function YA(t,e,n,r,o,a,i,s){let l=e.data.filter(x=>x.value>0),c=l.length;if(c===0)return;let d=e.solidFill===!0,u=l.reduce((x,N)=>x+N.value,0),f=Math.max(...l.map(x=>x.value))||1,p=n/2,m=s+8,g=m+(r-m)/2,h=Math.min(n/2-200,(r-m)/2-40),S=h*.14,y=mc(o,c),b=t.append("g").attr("transform",`translate(${p},${g})`),E=2*Math.PI/c;l.forEach((x,N)=>{let L=x.color??y[N%y.length],A=S+x.value/f*(h-S),C=N*E,k=C+E,w=Nl().innerRadius(S).outerRadius(A).startAngle(C).endAngle(k),v=Math.round(x.value/u*100),M=b.append("path").attr("d",w({})??"").attr("fill",d?L:ie(o,L,a)).attr("stroke",L).attr("stroke-width",2);Vr(M,{line:x.lineNumber,key:x.label,name:x.label,value:`${cn(x.value)} (${v}%)`,color:L});let _=C+E/2-Math.PI/2,T=Math.cos(_)>=0,R=Math.cos(_)*(h+14),O=Math.sin(_)*(h+14),I=e.noName?"":x.label,H=[e.noValue?"":cn(x.value),e.noPercent?"":`(${v}%)`].filter(Boolean).join(" "),G=[I,H].filter(Boolean).join(" \u2014 ");G&&b.append("text").attr("x",R+(T?4:-4)).attr("y",O+4).attr("text-anchor",T?"start":"end").attr("fill",i).attr("font-size",13).attr("font-family",Pt).text(G)})}var VA=st(()=>{"use strict";So();an();tn();ra()});function zA(t,e,n,r,o,a,i,s,l){let c=[...e.data].sort((N,L)=>L.value-N.value),d=c.length;if(d===0)return;let u=e.solidFill===!0,f=n*.2,p=n*.6,m=n/2,g=l+8,y=(r-30-g)/d,b=c[0].value||1,E=p*.08,x=N=>Math.max(E,N/b*p);c.forEach((N,L)=>{let A=N.color??o[e.data.indexOf(N)%o.length],C=u?A:ie(a,A,i),k=x(N.value),w=L<d-1?x(c[L+1].value):E,v=g+L*y,M=v+y,_=t.append("polygon").attr("points",`${m-k/2},${v} ${m+k/2},${v} ${m+w/2},${M} ${m-w/2},${M}`).attr("fill",C).attr("stroke",A).attr("stroke-width",2);Vr(_,{line:N.lineNumber,key:N.label,name:N.label,value:cn(N.value),color:A});let T=(v+M)/2;e.noName||(t.append("line").attr("x1",f-8).attr("y1",T).attr("x2",m-k/2).attr("y2",T).attr("stroke",s).attr("stroke-opacity",.3),t.append("text").attr("x",f-12).attr("y",T+4).attr("text-anchor","end").attr("fill",s).attr("font-size",13).attr("font-family",Pt).text(N.label)),e.noValue||(t.append("line").attr("x1",m+k/2).attr("y1",T).attr("x2",f+p+8).attr("y2",T).attr("stroke",s).attr("stroke-opacity",.3),t.append("text").attr("x",f+p+12).attr("y",T+4).attr("text-anchor","start").attr("fill",s).attr("font-size",13).attr("font-family",Pt).text(cn(N.value)))})}var UA=st(()=>{"use strict";an();tn();ra()});function XA(t,e,n,r,o,a,i,s,l){let c=e.heatmapRows??[];if(c.length===0)return;let d=Math.max(e.columns?.length??0,...c.map(_=>_.values.length)),u=c.length,f=e.columns??[],p=1/0,m=-1/0;for(let _ of c)for(let T of _.values)p=Math.min(p,T),m=Math.max(m,T);let g=e.solidFill===!0,h=[ie(o,o.primary,a,{solid:g}),ie(o,o.colors.cyan,a,{solid:g}),ie(o,o.colors.yellow,a,{solid:g}),ie(o,o.colors.orange,a,{solid:g})],S=_=>{let T=Math.max(0,Math.min(1,_)),R=1/(h.length-1),O=Math.min(h.length-2,Math.floor(T/R)),I=(T-O*R)/R;return Ot(h[O+1],h[O],I*100)},y=_=>{let{h:T,s:R}=hu(_),O=Math.min(75,Math.max(R+25,50));return qp(T,O,a?72:30)},E=20+(Math.max(0,...c.map(_=>_t(_.label,13)))+16),x=l+28,N=24,L=24,A=n-E-N,C=r-x-L,k=A/d,w=C/u,v=Math.max(11,Math.min(18,Math.min(k,w)*.28)),M=f.some(_=>_t(_,12)>k*.85);f.forEach((_,T)=>{let R=E+T*k+k/2,O=t.append("text").attr("fill",i).attr("font-size",12).attr("font-family",Pt).text(_);M?O.attr("transform",`translate(${R},${x-8}) rotate(-40)`).attr("text-anchor","start"):O.attr("x",R).attr("y",x-8).attr("text-anchor","middle")}),c.forEach((_,T)=>{t.append("text").attr("x",E-10).attr("y",x+T*w+w/2+4).attr("text-anchor","end").attr("fill",i).attr("font-size",13).attr("font-family",Pt).text(_.label),_.values.forEach((R,O)=>{let I=m===p?.5:(R-p)/(m-p),H=S(I),G=f[O]??`Col ${O+1}`,D=t.append("rect").attr("x",E+O*k).attr("y",x+T*w).attr("width",k).attr("height",w).attr("fill",H).attr("stroke",s).attr("stroke-width",2);Vr(D,{line:_.lineNumber,key:_.label,name:`${_.label} \xB7 ${G}`,value:cn(R),color:H}),e.noValue||t.append("text").attr("x",E+O*k+k/2).attr("y",x+T*w+w/2+v/3).attr("text-anchor","middle").attr("fill",y(H)).attr("font-size",v).attr("font-weight",600).attr("font-family",Pt).text(cn(R))})})}var jA=st(()=>{"use strict";an();tn();en();ra()});function KA(t,e,n,r,o,a,i,s,l,c){let d=e.scatterPoints??[];if(d.length===0)return;let u=e.solidFill===!0,f=d.some(M=>M.size!==void 0),p=[...new Set(d.map(M=>M.category).filter(Boolean))],m=(M,_)=>e.categoryColors?.[M]??o[_%o.length],g=new Map(p.map((M,_)=>[M,_])),h=d.map(M=>M.x),S=d.map(M=>M.y),y=Math.min(...h),b=Math.max(...h),E=Math.min(...S),x=Math.max(...S),N=(b-y)*.1||1,L=(x-E)*.1||1,A={top:c+8,right:32,bottom:64,left:ns(e.ylabel,[cn(Math.ceil(x+L)),cn(Math.floor(E-L))])},C=n-A.left-A.right,k=r-A.top-A.bottom,w=ir().domain([Math.floor(y-N),Math.ceil(b+N)]).range([A.left,A.left+C]),v=ir().domain([Math.floor(E-L),Math.ceil(x+L)]).range([A.top+k,A.top]);t.append("rect").attr("class","dgmo-plot-rect").attr("x",A.left).attr("y",A.top).attr("width",C).attr("height",k).attr("fill","transparent").attr("pointer-events","none");for(let M of v.ticks(6)){let _=v(M);t.append("line").attr("x1",A.left).attr("x2",A.left+C).attr("y1",_).attr("y2",_).attr("stroke",l).attr("stroke-opacity",.25),t.append("text").attr("class","dgmo-tick").attr("x",A.left-10).attr("y",_+4).attr("text-anchor","end").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(cn(M))}for(let M of w.ticks(6)){let _=w(M);t.append("line").attr("x1",_).attr("x2",_).attr("y1",A.top).attr("y2",A.top+k).attr("stroke",l).attr("stroke-opacity",.25),t.append("text").attr("class","dgmo-tick").attr("x",_).attr("y",A.top+k+18).attr("text-anchor","middle").attr("fill",s).attr("font-size",Lo).attr("font-family",Pt).text(cn(M))}d.forEach((M,_)=>{let T=M.color??(M.category?m(M.category,g.get(M.category)??0):o[_%o.length]),R=(f?M.size??qA:qA)/2,O=t.append("circle").attr("cx",w(M.x)).attr("cy",v(M.y)).attr("r",R).attr("fill",u?T:ie(a,T,i)).attr("fill-opacity",VX).attr("stroke",T).attr("stroke-width",2);Vr(O,{line:M.lineNumber,key:M.name,name:M.category?`${M.name} \xB7 ${M.category}`:M.name,value:`(${cn(M.x)}, ${cn(M.y)})`,color:T}),O.attr("data-axval-x",cn(M.x)).attr("data-axval-y",cn(M.y)),M.category&&O.attr("data-category",M.category),e.noName||t.append("text").attr("x",w(M.x)).attr("y",v(M.y)-R-5).attr("text-anchor","middle").attr("fill",s).attr("font-size",11).attr("font-family",Pt).text(M.name)}),Xs(t,e.xlabel,A.left+C/2,A.top+k+46,s),rs(t,e.ylabel,A.top+k/2,20,s)}var VX,qA,ZA=st(()=>{"use strict";Xa();an();tn();ra();VX=.65,qA=15});function QA(t,e,n,r,o,a,i,s){let l=e.links??[];if(l.length===0)return;let c=e.solidFill===!0,d=Array.from(new Set(l.flatMap(C=>[C.source,C.target]))),u=new Map;d.forEach((C,k)=>u.set(C,{name:C,rank:0,value:0,order:k,x:0,y:0,h:0,raw:e.nodeColors?.[C]??o[k%o.length]}));for(let C=0;C<d.length;C++){let k=!1;for(let w of l){let v=u.get(w.source),M=u.get(w.target);M.rank<v.rank+1&&(M.rank=v.rank+1,k=!0)}if(!k)break}for(let C of u.values()){let k=l.filter(v=>v.source===C.name).reduce((v,M)=>v+M.value,0),w=l.filter(v=>v.target===C.name).reduce((v,M)=>v+M.value,0);C.value=Math.max(k,w,1)}let f=Math.max(...[...u.values()].map(C=>C.rank)),p=Array.from({length:f+1},()=>[]);for(let C of u.values())p[C.rank].push(C);let m=16,g=s+8,h=n-m-16-_t("M",14),S=r-g-24,y=1/0;for(let C of p){let k=C.reduce((v,M)=>v+M.value,0),w=S-(C.length-1)*tE;k>0&&(y=Math.min(y,w/k))}isFinite(y)||(y=1);let b=C=>m+(f===0?0:C*(h-Pg)/f),E=C=>{C.sort((v,M)=>v.order-M.order);let k=C.reduce((v,M)=>v+M.value*y,0)+(C.length-1)*tE,w=g+(S-k)/2;for(let v of C)v.h=v.value*y,v.x=b(v.rank),v.y=w,w+=v.h+tE};p.forEach(E);let x=C=>C.y+C.h/2;for(let C=0;C<6;C++){let k=C%2===0,w=k?[...p.keys()]:[...p.keys()].reverse();for(let v of w){for(let M of p[v]){let _=k?l.filter(T=>T.target===M.name).map(T=>u.get(T.source)):l.filter(T=>T.source===M.name).map(T=>u.get(T.target));M.order=_.length?_.reduce((T,R)=>T+x(R),0)/_.length:x(M)}E(p[v])}}let N=new Map,L=new Map;for(let C of u.values())N.set(C.name,C.y),L.set(C.name,C.y);let A=[...l].sort((C,k)=>{let w=u.get(C.source),v=u.get(k.source);return w.y!==v.y?w.y-v.y:u.get(C.target).y-u.get(k.target).y});for(let C of A){let k=u.get(C.source),w=u.get(C.target),v=C.value*y,M=N.get(k.name),_=L.get(w.name);N.set(k.name,M+v),L.set(w.name,_+v);let T=k.x+Pg,R=w.x,O=T+(R-T)*.5,I=C.color??k.raw,H=c?I:Ot(I,a,45),G=t.append("path").attr("d",`M${T},${M} C${O},${M} ${O},${_} ${R},${_} L${R},${_+v} C${O},${_+v} ${O},${M+v} ${T},${M+v} Z`).attr("fill",H).attr("fill-opacity",.6);Vr(G,{line:C.lineNumber,key:`link:${k.name}\0${w.name}`,name:`${k.name} \u2192 ${w.name}`,value:String(C.value),color:k.raw})}for(let C of u.values()){let k=l.find(M=>M.source===C.name||M.target===C.name)?.lineNumber,w=t.append("rect").attr("x",C.x).attr("y",C.y).attr("width",Pg).attr("height",Math.max(1,C.h)).attr("fill",c?C.raw:Ot(C.raw,a,75)).attr("stroke",C.raw).attr("stroke-width",1);Vr(w,{...k!==void 0&&{line:k},key:`node:${C.name}`,name:C.name,value:String(C.value),color:C.raw});let v=C.rank===f;t.append("text").attr("x",v?C.x-6:C.x+Pg+6).attr("y",C.y+C.h/2+4).attr("text-anchor",v?"end":"start").attr("fill",i).attr("font-size",13).attr("font-family",Pt).text(C.name)}}var Pg,tE,JA=st(()=>{"use strict";an();tn();en();ra();Pg=20,tE=14});function tR(t,e,n,r,o,a,i,s,l){let c=e.links??[];if(c.length===0)return;let d=e.solidFill===!0,u=Array.from(new Set(c.flatMap(L=>[L.source,L.target]))),f=u.length,p=new Map(u.map((L,A)=>[L,A])),m=L=>o[L%o.length],g=l+8,h=n/2,S=g+(r-g)/2,y=Math.max(0,...u.map(L=>_t(L,14))),b=Math.min(n/2-y-60,(r-g)/2-50),E=L=>-Math.PI/2+L*2*Math.PI/f,x=L=>[h+Math.cos(E(L))*b,S+Math.sin(E(L))*b],N=new Set;for(let L of c)c.some(A=>A.source===L.target&&A.target===L.source&&A!==L)&&N.add(`${L.source}\0${L.target}`);for(let L of c){let A=p.get(L.source),C=p.get(L.target),[k,w]=x(A),[v,M]=x(C),_=N.has(`${L.source}\0${L.target}`),T=.3,R=_?L.source<L.target?T+.15:T-.15:T,O=(k+v)/2,I=(w+M)/2,H=O+(h-O)*R*2,G=I+(S-I)*R*2,D=Math.max(1,Math.min(L.value/20,10)),W=m(A),V=t.append("path").attr("d",`M${k},${w} Q${H},${G} ${v},${M}`).attr("fill","none").attr("stroke",W).attr("stroke-width",D).attr("stroke-opacity",.6);if(Vr(V,{line:L.lineNumber,key:`edge:${L.source} ${L.target}`,name:`${L.source} \u2192 ${L.target}`,value:String(L.value),color:W}),L.directed){let P=Math.atan2(M-G,v-H),F=11,Y=v-Math.cos(P)*10,z=M-Math.sin(P)*10,j=P+Math.PI-.4,K=P+Math.PI+.4;t.append("polygon").attr("points",`${Y},${z} ${Y+Math.cos(j)*F},${z+Math.sin(j)*F} ${Y+Math.cos(K)*F},${z+Math.sin(K)*F}`).attr("fill",W).attr("fill-opacity",.7)}}u.forEach((L,A)=>{let[C,k]=x(A),w=m(A),v=t.append("circle").attr("cx",C).attr("cy",k).attr("r",10).attr("fill",d?w:ie(a,w,i)).attr("stroke",w).attr("stroke-width",2);Vr(v,{key:`node:${L}`,name:L,color:w});let M=Math.cos(E(A)),_=C+M*16,T=k+Math.sin(E(A))*16;t.append("text").attr("x",_).attr("y",T+4).attr("text-anchor",Math.abs(M)<.3?"middle":M>0?"start":"end").attr("fill",s).attr("font-size",14).attr("font-family",Pt).text(L)})}var eR=st(()=>{"use strict";an();tn();en();ra()});function nR(t,e){try{let n=t.replace(/\bpi\b/gi,String(Math.PI)).replace(/\be\b/g,String(Math.E)).replace(/\bsin\s*\(/gi,"Math.sin(").replace(/\bcos\s*\(/gi,"Math.cos(").replace(/\btan\s*\(/gi,"Math.tan(").replace(/\bln\s*\(/gi,"Math.log(").replace(/\blog\s*\(/gi,"Math.log10(").replace(/\bexp\s*\(/gi,"Math.exp(").replace(/\bsqrt\s*\(/gi,"Math.sqrt(").replace(/\babs\s*\(/gi,"Math.abs(").replace(/\bx\b/gi,`(${e})`).replace(/\^/g,"**"),r=new Function(`return ${n}`)();return typeof r=="number"&&isFinite(r)?r:NaN}catch{return NaN}}var rR=st(()=>{"use strict"});function aR(t,e,n,r,o,a,i,s){let l=e.functions??[];if(l.length===0)return;let c=e.xRange??{min:-10,max:10},d=(c.max-c.min)/oR,u=[];for(let x=0;x<=oR;x++)u.push(c.min+x*d);let f=l.map((x,N)=>({color:x.color??o[N%o.length],name:x.name,line:x.lineNumber,pts:u.map(L=>[L,nR(x.expression,L)])})),p=1/0,m=-1/0;for(let x of f)for(let[,N]of x.pts)isFinite(N)&&(p=Math.min(p,N),m=Math.max(m,N));isFinite(p)||(p=-1,m=1),p===m&&(m=p+1);let g={top:s+8,right:32,bottom:64,left:ns(e.ylabel,[cn(m),cn(p)])},h=n-g.left-g.right,S=r-g.top-g.bottom,y=ir().domain([c.min,c.max]).range([g.left,g.left+h]),b=ir().domain([p,m]).nice().range([g.top+S,g.top]);for(let x of b.ticks(8)){let N=b(x);t.append("line").attr("x1",g.left).attr("x2",g.left+h).attr("y1",N).attr("y2",N).attr("stroke",i).attr("stroke-opacity",x===0?.6:.2),t.append("text").attr("class","dgmo-tick").attr("x",g.left-10).attr("y",N+4).attr("text-anchor","end").attr("fill",a).attr("font-size",Lo).attr("font-family",Pt).text(cn(x))}for(let x of y.ticks(10)){let N=y(x);t.append("line").attr("x1",N).attr("x2",N).attr("y1",g.top).attr("y2",g.top+S).attr("stroke",i).attr("stroke-opacity",x===0?.6:.2),t.append("text").attr("class","dgmo-tick").attr("x",N).attr("y",g.top+S+18).attr("text-anchor","middle").attr("fill",a).attr("font-size",Lo).attr("font-family",Pt).text(cn(x))}let E=Qn().defined(x=>isFinite(x[1])&&x[1]>=p-1&&x[1]<=m+1).x(x=>y(x[0])).y(x=>b(x[1]));for(let x of f){let N=t.append("path").attr("d",E(x.pts)??"").attr("fill","none").attr("stroke",x.color).attr("stroke-width",2.5).attr("stroke-linejoin","round");Vr(N,{line:x.line,key:x.name,name:x.name,color:x.color})}Xs(t,e.xlabel,g.left+h/2,g.top+S+46,a),rs(t,e.ylabel,g.top+S/2,20,a)}var oR,iR=st(()=>{"use strict";Xa();So();an();rR();ra();oR=200});var cR={};ye(cR,{D3_DATA_CHART_TYPES:()=>lR,renderDataChartD3:()=>nE,supportsD3DataChart:()=>zX});function zX(t){return lR.has(t)}function UX(t){for(let e of t.split(`
212
- `)){let n=e.trim();if(!(!n||n.startsWith("//")))return n.split(/\s+/)[0].toLowerCase()}return""}async function nE(t,e,n,r){let o=await zn(e,n),a=e==="dark",i=r?.width&&r.width>0?Math.round(r.width):pr,s=r?.height&&r.height>0?Math.round(r.height):br,l=ar(i,s),c=za(l,o,{width:i,height:s});if(!c)return document.body.removeChild(l),"";let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:g,colors:h}=c;return XX(d,t,o,a,u,f,p,m,g,h)?Un(l,e,o):(document.body.removeChild(l),"")}function XX(t,e,n,r,o,a,i,s,l,c){let d=UX(e),f=eE.has(d)?null:Ws(e,n);if(f&&!f.error&&f.data.length>0&&sR.has(f.type)){let h=!f.noTitle&&!!f.title;switch(h&&co(t,f.title,f.titleLineNumber,o,i),f.type){case"bar":return IA(t,f,o,a,c,n,r,i,s,h),!0;case"line":return GA(t,f,o,a,c,n,r,i,s,l,h),!0;case"pie":return $A(t,f,o,a,n,r,i,h?52:24),!0;case"radar":{let S=sg(f,c),y=pf(t,S,n,r,h,o);return FA(t,f,o,a,c,n,r,i,s,y),!0}case"polar-area":return YA(t,f,o,a,n,r,i,h?52:24),!0}}let p=Fs(e,n);if(p.error||!eE.has(p.type))return!1;let m=lr(n),g=!p.noTitle&&!!p.title;switch(g&&co(t,p.title,p.titleLineNumber,o,i),p.type){case"funnel":return zA(t,p,o,a,m,n,r,i,g?52:24),!0;case"heatmap":return XA(t,p,o,a,n,r,i,l,g?52:24),!0;case"scatter":{let h=aw(p,m),S=pf(t,h,n,r,g,o);return KA(t,p,o,a,m,n,r,i,s,S),!0}case"sankey":return QA(t,p,o,a,m,l,i,g?52:24),!0;case"chord":return tR(t,p,o,a,m,n,r,i,g?52:24),!0;case"function":{let h=aw(p,m),S=pf(t,h,n,r,g,o);return aR(t,p,o,a,m,i,s,S),!0}default:return!1}}var sR,eE,lR,rE=st(()=>{"use strict";ag();nf();nf();tn();Xi();ra();PA();OA();HA();BA();VA();UA();jA();ZA();JA();eR();iR();sR=new Set(["bar","line","pie","radar","polar-area"]),eE=new Set(["funnel","heatmap","scatter","sankey","chord","function"]),lR=new Set([...sR,...eE])});function td(t,e){let n=t.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("rx",e.rx).attr("fill",e.fill).attr("stroke",e.stroke).attr("stroke-width",e.strokeWidth);e.dashed&&n.attr("stroke-dasharray","6 3"),t.append("text").attr("x",e.width/2).attr("y",e.headerHeight/2+e.labelFontSize/2-2).attr("text-anchor","middle").attr("fill",e.labelColor).attr("font-size",e.labelFontSize).attr("font-weight","bold").text(e.label);let r=e.meta;if(!r||r.rows.length===0)return;t.append("line").attr("x1",0).attr("y1",e.headerHeight).attr("x2",e.width).attr("y2",e.headerHeight).attr("stroke",r.separatorColor).attr("stroke-opacity",.3).attr("stroke-width",1);let o=r.keyX??10,a=Math.max(...r.rows.map(([l])=>_t(`${l}: `,r.fontSize))),i=o+a,s=e.headerHeight+r.separatorGap+r.fontSize;for(let l=0;l<r.rows.length;l++){let[c,d]=r.rows[l],u=s+l*r.lineHeight;t.append("text").attr("x",o).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(`${c}: `),t.append("text").attr("x",i).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(d)}}function oE(t,e){t.append("clipPath").attr("id",e.clipId).append("rect").attr("width",e.width).attr("height",e.height).attr("rx",e.rx),t.append("rect").attr("x",e.inset).attr("y",e.height-e.barHeight).attr("width",e.width-e.inset*2).attr("height",e.barHeight).attr("fill",e.fill).attr("clip-path",`url(#${e.clipId})`).attr("class",e.className)}var Dg=st(()=>{"use strict";en()});var SR={};ye(SR,{clearEventLineMuted:()=>lj,focusEventLine:()=>ER,renderEventLine:()=>fE,renderEventLineForExport:()=>hj});function fE(t,e,n,r,o,a,i){if(e.events.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let s=a?.width??t.clientWidth,l=a?.height??t.clientHeight;if(s<=0||l<=0)return;let c=!!a,d=c?new Set:pE(t),f=lr(n)[0],p=Wr(e.tagGroups,void 0,i),m=!!e.title&&!e.options.noTitle,g=e.tagGroups.length>0&&p!==null&&!e.options.noLegend,h=m?jX:0,y=h+(g?qX:0),b=new Map(e.eras.map(rt=>[rt.name,rt])),E=new Set(e.eras.filter(rt=>rt.collapsed).map(rt=>rt.name)),x=e.events.some(rt=>rt.era&&b.has(rt.era)),N=e.events.some(rt=>rt.era&&b.has(rt.era)&&!E.has(rt.era)),L=e.options.side,A=L==="alternate",C=A||L==="above"?"below":"above",k=[],w=new Set;for(let rt of e.events){let pt=rt.era;pt&&E.has(pt)?w.has(pt)||(w.add(pt),k.push({kind:"era",era:b.get(pt),members:e.events.filter(gt=>gt.era===pt)})):k.push({kind:"event",event:rt})}let v=Math.max(8,Math.floor((oo-Gl*2)/(Ol*Bo))),M=(rt,pt)=>28+(pt?dR:0)+(rt.length>0?6+rt.length*xR:0)+(rt.length>0?Gl:6),_=rt=>{if(!p)return f;let pt=sr(rt.metadata,e.tagGroups,p);return pt&&pt!==ej?On(pt,n)??pt:f},T=0,R=k.map(rt=>{let pt=A?T++%2===0?"above":"below":L;if(rt.kind==="event"){let $t=rt.event,ft=_($t),Wt=ie(n,ft,r,{solid:!1}),ge=Le(Wt,n.textOnFillLight,n.textOnFillDark),ne=yR($t.description,v);return{kind:"event",event:$t,era:null,members:[],label:$t.label,date:$t.date,dateValue:$t.dateValue,future:$t.future,futureSpan:$t.futureSpan,lineNumber:$t.lineNumber,eraName:$t.era,color:ft,cardFill:Wt,titleColor:ge,lines:ne,bulletColors:[],bulletMeta:[],cardH:M(ne,!!$t.date),x:0,side:pt,lane:0,left:0,spanHalf:0}}let gt=rt.era,dt=rt.members.map(_),ut=p!=null&&dt.length>0&&dt.every($t=>$t===dt[0])&&dt[0]!==f,yt=gt.color?On(gt.color,n)??n.text:ut?dt[0]:n.text,vt=Ot(yt,or(n,r),10),Gt=Le(vt,n.textOnFillLight,n.textOnFillDark),Xt=null,bt=null;for(let $t of rt.members)$t.dateValue!==null&&((Xt===null||$t.dateValue<Xt)&&(Xt=$t.dateValue),(bt===null||$t.dateValue>bt)&&(bt=$t.dateValue));let Mt=Xt!==null&&bt!==null?(Xt+bt)/2:null,zt=rt.members.filter($t=>!dj($t.metadata,d)),xt=zt.map($t=>`\u2022 ${$t.date?`${$t.future?"TBD":Ki($t.date)} `:""}${$t.label}`),Nt=zt.map(_),Dt=zt.map($t=>$t.metadata),Vt=yR(xt,v);return{kind:"era",event:null,era:gt,members:rt.members,label:gt.name,date:null,dateValue:Mt,future:!1,futureSpan:null,lineNumber:gt.lineNumber,eraName:gt.name,color:yt,cardFill:vt,titleColor:Gt,lines:Vt,bulletColors:Nt,bulletMeta:Dt,cardH:M(Vt,!1),x:0,side:pt,lane:0,left:0,spanHalf:0}}),O=e.options.scale&&R.every(rt=>rt.dateValue!==null),I=s-Gg*2,H=16,G=8,D=64,W=16,V=[],P=[],F=()=>{if(!P.length)return;let rt=P.map(pt=>pt.dateValue);V.push({kind:"run",events:P,lo:Math.min(...rt),hi:Math.max(...rt)}),P=[]};for(let rt of R)rt.kind==="era"?(F(),V.push({kind:"capsule",p:rt})):P.push(rt);F();let Y=V.reduce((rt,pt)=>rt+(pt.kind==="run"?pt.hi-pt.lo:0),0),z=rt=>{if(O){let pt=Y>0?I*rt/Y:0,gt={above:-1/0,below:-1/0},dt=Gg;for(let vt of V)if(vt.kind==="capsule"){let Gt=dt+D/2,Xt=Math.max(oo/2+6,gt[vt.p.side]+Og+oo/2);Gt<Xt&&(dt+=Xt-Gt,Gt=Xt),vt.p.x=Gt,vt.p.spanHalf=D/2,gt[vt.p.side]=Gt+oo/2,dt+=D+W}else{for(let Gt of vt.events)Gt.x=dt+(Gt.dateValue-vt.lo)*pt,Gt.spanHalf=0;dt+=(vt.hi-vt.lo)*pt+W}let ut=-1/0,yt=null;for(let vt of[...R].sort((Gt,Xt)=>Gt.x-Xt.x)){if(vt.kind==="era"){ut=vt.x+vt.spanHalf,yt=null;continue}if(vt.dateValue===yt){vt.x=ut;continue}vt.x<ut+H&&(vt.x=ut+H),ut=vt.x,yt=vt.dateValue}}else{R.forEach(dt=>{dt.spanHalf=0});let pt=R.length,gt=pt>1?Math.max(JX,I/(pt-1)):0;R.forEach((dt,ut)=>{dt.x=Gg+ut*gt})}if(O){let pt=oo+Og;for(let gt=0;gt<8;gt++){let dt=!1;for(let ut of["above","below"]){let yt=R.filter(vt=>vt.side===ut).sort((vt,Gt)=>vt.x-Gt.x);for(let vt=1;vt<yt.length;vt++){let Gt=yt[vt];if(Gt.kind!=="event")continue;let Xt=yt[vt-1];if(Xt.kind==="event"&&Gt.dateValue===Xt.dateValue)continue;let bt=Xt.x+pt;if(bt<=Gt.x)continue;let Mt=yt[vt+1],zt=Mt?.kind==="era"?Mt.x-pt:1/0,xt=Math.min(bt,zt);xt>Gt.x+.5&&(Gt.x=xt,dt=!0)}}if(!dt)break}}for(let pt of["above","below"]){let gt=R.filter(ut=>ut.side===pt).sort((ut,yt)=>ut.x-yt.x),dt=[];for(let ut=0;ut<gt.length;ut++){let yt=gt[ut],vt=gt[ut+1],Xt=yt.kind!=="era"&&!!vt&&vt.x-yt.x<oo+Og?yt.x-oo+aE:yt.x-oo/2,bt=yt.x-aE,Mt=yt.x-oo+aE,zt=dt.length,xt=Math.max(Xt,Mt);for(let Nt=0;Nt<dt.length;Nt++){let Dt=Math.max(Xt,dt[Nt]+Og,Mt);if(Dt<=bt){zt=Nt,xt=Dt;break}}yt.lane=zt,yt.left=Math.max(6,xt),dt[zt]=yt.left+oo}}},j=()=>{let rt=Math.max(s,Math.max(...R.map(Dt=>Dt.x+Dt.spanHalf))+Gg,Math.max(...R.map(Dt=>Dt.left+oo))+6),pt={above:[],below:[]};for(let Dt of["above","below"]){let Vt=[];for(let Wt of R)Wt.side===Dt&&(Vt[Wt.lane]=Math.max(Vt[Wt.lane]??0,Wt.cardH));let $t=[],ft=0;for(let Wt=0;Wt<Vt.length;Wt++)$t[Wt]=ft,ft+=(Vt[Wt]??0)+tj;pt[Dt]=$t}let gt=Dt=>(Dt.side==="above"?KX:ZX)+(pt[Dt.side][Dt.lane]??0),dt=Dt=>Math.max(0,...R.filter(Vt=>Vt.side===Dt).map(Vt=>gt(Vt)+Vt.cardH)),ut=dt("above"),yt=dt("below"),vt=ut+(N&&C==="above"?uR:0),Gt=yt+(N&&C==="below"?uR:0),Xt=14,bt=14,Mt=y+Xt+vt,zt=C==="above"?Mt-(ut+14):Mt+(yt+14),xt=Mt+Gt+bt,Nt=c?xt:Math.max(l,xt);return{contentW:rt,contentH:xt,totalH:Nt,spineY:Mt,eraBaseY:zt,laneNear:gt}},K=Number(globalThis.process?.env?.DGMO_EVT_STRETCH),$;if(Number.isFinite(K)&&K>0)z(K),$=j();else{z(1),$=j();let rt=s/l,pt=gt=>gt.contentW/gt.contentH;if(O&&$.contentH>l&&pt($)<rt){z(G);let gt=j();if(pt(gt)<=rt)$=gt;else{let dt=1,ut=G;for(let yt=0;yt<8;yt++){let vt=(dt+ut)/2;z(vt),pt(j())>=rt?ut=vt:dt=vt}z(ut),$=j()}}}let{contentW:U,totalH:X,spineY:q,eraBaseY:et,laneNear:tt}=$,B=It(t).append("svg").attr("width",U).attr("height",X).attr("viewBox",`0 0 ${U} ${X}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c||B.append("style").text(aj),B.append("rect").attr("width",U).attr("height",X).attr("fill",n.bg),m){let rt=B.append("text").attr("class","chart-title").attr("x",U/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber){let pt=e.titleLineNumber;rt.style("cursor","pointer").on("click",()=>o(pt))}}if(g){let rt=B.append("g").attr("transform",`translate(0, ${h})`),pt=e.tagGroups.map(gt=>({name:gt.name,entries:gt.entries.map(dt=>({value:dt.value,color:On(dt.color,n)??dt.color}))}));mn(rt,{groups:pt,palette:n,isDark:r,width:U,mode:c?"export":"preview",activeGroup:p}),c||cj(rt)}let Q=Math.min(...R.map(rt=>rt.x-rt.spanHalf)),ot=Math.max(...R.map(rt=>rt.x+rt.spanHalf)),Z=Q-20,lt=ot+20,nt=O&&R.some(rt=>rt.future&&!rt.futureSpan),J=R.length?Math.max(Z,...R.filter(rt=>!rt.future).map(rt=>rt.x+rt.spanHalf)):lt,at=nt?J:lt;B.append("line").attr("x1",Z).attr("y1",q).attr("x2",at).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round"),nt&&B.append("line").attr("x1",at).attr("y1",q).attr("x2",lt).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round").attr("stroke-opacity",.45).attr("stroke-dasharray","2 6");let it=R.map(rt=>{let pt=rt.side==="above"?q-tt(rt):q+tt(rt),gt=rt.side==="above"?pt-rt.cardH:pt;return{p:rt,near:pt,top:gt}}),Lt=(rt,pt)=>{let gt=Math.min(q,pt),dt=Math.max(q,pt);return it.some(ut=>ut.p!==rt&&rt.x>ut.p.left&&rt.x<ut.p.left+oo&&dt>ut.top&&gt<ut.top+ut.p.cardH)},Tt=rt=>q+oj*(rt.side==="above"?-1:1);for(let{p:rt,near:pt}of it){let gt=rt.kind==="era"?Tt(rt):q,dt=B.append("line").attr("class","dgmo-event-leader").attr("x1",rt.x).attr("y1",gt).attr("x2",rt.x).attr("y2",pt).attr("stroke",rt.color).attr("stroke-width",1.5).attr("stroke-opacity",Lt(rt,pt)?.18:rt.future?.4:.65);sE(dt,rt)}let At=0;for(let{p:rt,top:pt}of it){let gt=rt.left,dt=B.append("g").attr("class","dgmo-event-card").attr("transform",`translate(${gt}, ${pt})`).attr("data-line-number",rt.lineNumber);if(sE(dt,rt),rt.kind==="era"&&dt.attr("data-era",rt.era.name).attr("data-era-collapsed","true"),o){let vt=rt.lineNumber;dt.style("cursor","pointer").on("click",()=>o(vt)),dt.append("rect").attr("x",0).attr("y",0).attr("width",oo).attr("height",rt.cardH).attr("fill","transparent").attr("pointer-events","all")}let ut=rt.kind==="event"&&rt.date?rt.future?"TBD":Ki(rt.date):null,yt=ut?dR:0;if(e.options.noBox){let vt=rt.side==="below",Gt=vt?0:rt.cardH-28,Xt=vt?0:rt.cardH-28-yt,bt=28+yt,Mt=`dgmo-evt-shelf-${At++}`;dt.append("clipPath").attr("id",Mt).append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("rx",iE),dt.append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("clip-path",`url(#${Mt})`).attr("fill",Ot(rt.color,or(n,r),nj));let zt=vt?Xt:Xt+bt-iE;if(dt.append("rect").attr("x",0).attr("y",zt).attr("width",oo).attr("height",iE).attr("clip-path",`url(#${Mt})`).attr("fill",rt.color).attr("fill-opacity",rt.future?.4:1),dt.append("text").attr("x",Gl).attr("y",Gt+28/2+13/2-2).attr("fill",rt.color).attr("font-family",Pt).attr("font-size",13).attr("font-weight",700).text(rt.label),ut&&dt.append("text").attr("x",Gl).attr("y",(vt?28:Gt-yt)+$g+2).attr("fill",Ot(n.text,n.bg,55)).attr("font-family",Pt).attr("font-size",$g).attr("font-weight",600).text(ut),rt.lines.length>0){let xt=vt?lE+yt+Ol:Gl+Ol;bR(dt,rt.lines,n.text,n,xt,rt.bulletColors,rt.bulletMeta)}}else td(dt,{width:oo,height:rt.cardH,rx:6,fill:rt.cardFill,stroke:rt.color,strokeWidth:1.5,label:rt.label,labelColor:rt.titleColor,labelFontSize:13,headerHeight:28}),ut&&dt.append("text").attr("x",oo/2).attr("y",28+$g+1).attr("text-anchor","middle").attr("fill",Ot(rt.titleColor,rt.cardFill,60)).attr("font-family",Pt).attr("font-size",$g).attr("font-weight",600).text(ut),rt.lines.length>0&&(dt.append("line").attr("x1",0).attr("y1",28+yt).attr("x2",oo).attr("y2",28+yt).attr("stroke",rt.titleColor).attr("stroke-opacity",.3).attr("stroke-width",1),bR(dt,rt.lines,rt.titleColor,n,lE+yt+Ol,rt.bulletColors,rt.bulletMeta))}for(let rt of R){if(rt.kind==="era"){let gt=rt.color,dt=Math.max(16,rt.spanHalf),ut=Q-20,yt=ot+20,vt=Math.max(ut,rt.x-dt),Gt=Math.min(yt,rt.x+dt),Xt=Tt(rt),bt=B.append("g").attr("class","dgmo-event-era").attr("data-era",rt.era.name).attr("data-era-collapsed","true").attr("data-line-number",rt.lineNumber);if(o){let zt=Math.min(Xt,q)-4,xt=Math.max(Xt,q)+8;bt.append("rect").attr("x",vt).attr("y",zt).attr("width",Gt-vt).attr("height",xt-zt).attr("fill","transparent").attr("pointer-events","all")}bt.append("path").attr("d",`M${vt},${q} L${vt},${Xt} L${Gt},${Xt} L${Gt},${q}`).attr("fill","none").attr("stroke",gt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round");let Mt=(vt+Gt)/2;bt.append("line").attr("x1",Mt-Fg/2).attr("y1",q).attr("x2",Mt+Fg/2).attr("y2",q).attr("stroke",n.bg).attr("stroke-width",5).attr("stroke-linecap","butt");for(let zt of yj(Mt,q))bt.append("path").attr("d",zt).attr("fill","none").attr("stroke",n.text).attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round");if(o){let zt=rt.lineNumber;bt.style("cursor","pointer").on("click",()=>o(zt))}continue}let pt=B.append("circle").attr("class","dgmo-event-dot").attr("cx",rt.x).attr("cy",q).attr("r",QX).attr("fill",rt.future?n.bg:rt.color).attr("stroke",rt.future?rt.color:n.bg).attr("stroke-width",2).attr("data-line-number",rt.lineNumber);sE(pt,rt)}if(x){let rt=[],pt=null;for(let yt of R){let vt=yt.eraName;if(vt&&b.has(vt)){if(pt===vt&&rt.length>0){let Gt=rt[rt.length-1];Gt.firstX=Math.min(Gt.firstX,yt.x),Gt.lastX=Math.max(Gt.lastX,yt.x)}else rt.push({era:b.get(vt),collapsed:yt.kind==="era",firstX:yt.x,lastX:yt.x});pt=vt}else pt=null}let gt=yt=>Math.max(4,Math.min(U-4,yt)),dt=C==="above"?1:-1,ut=rt.filter(yt=>!yt.collapsed).map(yt=>({run:yt,x0:gt(yt.firstX-pR),x1:gt(yt.lastX+pR)})).sort((yt,vt)=>yt.run.firstX-vt.run.firstX);for(let yt=1;yt<ut.length;yt++){let vt=ut[yt-1],Gt=ut[yt];if(vt.x1<=Gt.x0)continue;let Xt=(vt.run.lastX+Gt.run.firstX)/2;vt.x1=Math.max(vt.run.lastX,Math.min(vt.x1,Xt-mR)),Gt.x0=Math.min(Gt.run.firstX,Math.max(Gt.x0,Xt+mR))}for(let{run:yt,x0:vt,x1:Gt}of ut){let Xt=!yt.era.color,bt=Xt?n.text:On(yt.era.color,n)??n.text,Mt=Xt?.5:.85,zt=et,xt=B.append("g").attr("class","dgmo-event-era").attr("data-era",yt.era.name).attr("data-era-collapsed",String(yt.collapsed)).attr("data-line-number",yt.era.lineNumber);if(xt.append("path").attr("d",`M${vt},${zt+fR*dt} L${vt},${zt} L${Gt},${zt} L${Gt},${zt+fR*dt}`).attr("fill","none").attr("stroke",bt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",Mt),xt.append("text").attr("x",(yt.firstX+yt.lastX)/2).attr("y",C==="above"?zt-6:zt+hR+4).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",hR).attr("font-weight",700).attr("fill",bt).attr("fill-opacity",Xt?.85:1).text(yt.era.name),o){let Nt=yt.era.lineNumber;xt.style("cursor","pointer").on("click",()=>o(Nt))}}}if(!c){let rt=B.node();gj(rt),rt&&(mj(t,rt,()=>fE(t,e,n,r,o,a,i)),uj(t,rt))}}function sE(t,e){if(t.attr("data-evt",e.lineNumber),e.eraName&&t.attr("data-evt-era",e.eraName),e.event)for(let[n,r]of Object.entries(e.event.metadata))t.attr(`data-tag-${n.toLowerCase()}`,String(r).toLowerCase())}function sj(t){t.querySelectorAll(`.${js},.${$l},.${Bg}`).forEach(e=>e.classList.remove(js,$l,Bg))}function ed(t,e){if(sj(t),!e)return;let n=[...t.querySelectorAll(ij)];if(e.kind==="event"){let l=c=>c.getAttribute("data-evt")===e.id;if(!n.some(l))return;n.forEach(c=>c.classList.add(l(c)?js:$l));return}if(e.kind==="era"){let l=c=>c.getAttribute("data-evt-era")===e.name||c.classList.contains("dgmo-event-era")&&c.getAttribute("data-era")===e.name;if(!n.some(l))return;n.forEach(c=>{l(c)?c.classList.contains("dgmo-event-era")&&c.classList.add(Bg):c.classList.add($l)});return}let r=`data-tag-${e.group}`,o=l=>l.getAttribute(r)===e.value,a=[...t.querySelectorAll(".dgmo-evt-bullet")],i=new Set;for(let l of a){if(!o(l))continue;let c=l.closest(".dgmo-event-card"),d=c?.getAttribute("data-era")??c?.getAttribute("data-evt-era");d&&i.add(d)}if(!n.some(o)&&i.size===0)return;let s=l=>{let c=l.getAttribute("data-era")??l.getAttribute("data-evt-era");return!!c&&i.has(c)};n.forEach(l=>{!o(l)&&!s(l)&&l.classList.add($l)});for(let l of a)o(l)||l.classList.add($l)}function Wg(t){let e=t.getAttribute(cE);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function lj(t){t.removeAttribute(uE)}function ER(t,e){let n=t.querySelector("svg");n&&(e?n.setAttribute(cE,JSON.stringify(e)):n.removeAttribute(cE),ed(n,e))}function pE(t){let e=t.getAttribute(uE);if(!e)return new Set;try{return new Set(JSON.parse(e))}catch{return new Set}}function cj(t){t.selectAll("[data-legend-entry]").each(function(){let r;try{r=this.getBBox()}catch{return}!r.width||!r.height||It(this).insert("rect",":first-child").attr("x",r.x-6).attr("y",r.y-7).attr("width",r.width+12).attr("height",r.height+14).attr("fill","transparent").attr("data-legend-hit","")})}function dj(t,e){if(e.size===0)return!1;for(let[n,r]of Object.entries(t))if(e.has(`${n.toLowerCase()}:${String(r).toLowerCase()}`))return!0;return!1}function uj(t,e){let n=pE(t),r=o=>{for(let a of n){let i=a.indexOf(":");if(i<0)continue;let s=a.slice(0,i),l=a.slice(i+1);if(o.getAttribute(`data-tag-${s}`)===l)return!0}return!1};e.querySelectorAll(".dgmo-event-card,.dgmo-event-leader").forEach(o=>o.classList.toggle(mf,r(o))),e.querySelectorAll("[data-legend-entry]").forEach(o=>{let a=o.closest("[data-legend-group]")?.getAttribute("data-legend-group"),i=o.getAttribute("data-legend-entry");fj(o,!!a&&n.has(`${a}:${i}`))})}function fj(t,e){t.classList.toggle(wR,e);let n=t.querySelector("circle");if(n)if(e)n.hasAttribute("data-fill0")||n.setAttribute("data-fill0",n.getAttribute("fill")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",n.getAttribute("data-fill0")||"currentColor"),n.setAttribute("stroke-width","1.5");else{let r=n.getAttribute("data-fill0");r!==null&&n.setAttribute("fill",r),n.removeAttribute("stroke"),n.removeAttribute("stroke-width")}}function pj(t,e,n){let r=pE(t),o=`${e}:${n}`;r.has(o)?r.delete(o):r.add(o),t.setAttribute(uE,JSON.stringify([...r]))}function mj(t,e,n){e.addEventListener("click",r=>{let o=r.target;if(!o||typeof o.closest!="function")return;let a=o.closest("[data-legend-entry]");if(!a)return;let i=a.getAttribute("data-legend-entry"),s=a.closest("[data-legend-group]")?.getAttribute("data-legend-group");if(!s||!i)return;pj(t,s,i);let l=Wg(e);n(),l&&ER(t,l),typeof CustomEvent<"u"&&t.dispatchEvent(new CustomEvent("dgmo-event-line-rerender"))})}function gj(t){t&&(t.addEventListener("mouseover",e=>{let n=e.target;if(!n||typeof n.closest!="function")return;let r=n.closest("[data-legend-entry]");if(r){let i=r.getAttribute("data-legend-entry"),s=r.closest("[data-legend-group]")?.getAttribute("data-legend-group");ed(t,s&&i?{kind:"tag",group:s,value:i}:Wg(t));return}let o=n.closest(".dgmo-event-era");if(o){ed(t,{kind:"era",name:o.getAttribute("data-era")??""});return}let a=n.closest("[data-evt]");if(a){let i=a.getAttribute("data-era");ed(t,i?{kind:"era",name:i}:{kind:"event",id:a.getAttribute("data-evt")??""});return}ed(t,Wg(t))}),t.addEventListener("mouseout",e=>{let n=e.relatedTarget;(!n||!t.contains(n))&&ed(t,Wg(t))}))}function hj(t,e,n,r,o,a){fE(t,e,n,r,void 0,o,a)}function yj(t,e){let o=a=>{let i="";for(let s=0;s<=48;s++){let l=s/48,c=e-gR+l*2*gR,d=a+rj*Math.sin(l*Math.PI*2);i+=`${s===0?"M":"L"}${d.toFixed(2)},${c.toFixed(2)}`,s<48&&(i+=" ")}return i};return[o(t-Fg/2),o(t+Fg/2)]}function yR(t,e){let n=[];for(let r of t){if(r===""){n.push({text:"",kind:"plain"});continue}n.push(...Ko([r],e))}return n}function bR(t,e,n,r,o=lE+Ol,a=[],i=[]){let s=o,l=0,c=n,d=null,u=f=>{if(d){f.attr("class","dgmo-evt-bullet");for(let[p,m]of Object.entries(d))f.attr(`data-tag-${p.toLowerCase()}`,String(m).toLowerCase())}};for(let f of e){let p=f.kind==="bullet-first"||f.kind==="bullet-cont",m=Gl+(p?12:0);if(f.kind==="bullet-first"){c=a[l]??n,d=i[l]??null,l++;let h=t.append("text").attr("x",Gl).attr("y",s).attr("text-anchor","start").attr("fill",c).attr("font-family",Pt).attr("font-size",Ol).attr("font-weight",700).text("\u2022");u(h)}else p||(c=n,d=null);let g=t.append("text").attr("x",m).attr("y",s).attr("text-anchor","start").attr("fill",p?c:n).attr("font-family",Pt).attr("font-size",Ol);p&&u(g),bn(g,f.text,r),s+=xR}}var oo,Gg,jX,qX,KX,ZX,Ol,xR,Gl,lE,QX,JX,tj,ej,aE,Og,dR,$g,nj,iE,uR,fR,pR,mR,gR,rj,Fg,oj,hR,js,$l,Bg,mf,wR,uE,aj,ij,cE,LR=st(()=>{"use strict";qn();an();tn();wr();Dg();Ro();en();Ds();Br();m0();je();oo=210,Gg=58,jX=48,qX=34,KX=46,ZX=46,Ol=11.5,xR=16,Gl=9,lE=34,QX=5.5,JX=96,tj=16,ej="#999999",aE=18,Og=6,dR=15,$g=10,nj=13,iE=4,uR=30,fR=8,pR=14,mR=3,gR=6,rj=2.6,Fg=5,oj=13,hR=11.5,js="dgmo-evt-hl",$l="dgmo-evt-dim",Bg="dgmo-evt-era-hl",mf="dgmo-evt-collapsed",wR="dgmo-evt-off",uE="data-evt-hidden",aj=`.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${$l}{opacity:.2}.dgmo-event-dot.${js}{transform:scale(1.55)}.dgmo-event-leader.${js}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${js}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${Bg}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${mf},.dgmo-event-leader.${mf}{opacity:0;pointer-events:none}.dgmo-event-card.${mf}.${js},.dgmo-event-leader.${mf}.${js}{opacity:1;pointer-events:auto}[data-legend-entry].${wR} text{text-decoration:line-through;opacity:.5}`;ij=".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era",cE="data-evt-pin"});var kR={};ye(kR,{renderVersionControl:()=>MR,renderVersionControlForExport:()=>Sj});function xj(t,e){return t.length>e?t.slice(0,e-1)+"\u2026":t}function hE(t,e,n,r,o,a,i){let s=Math.hypot(n-t,r-e),l=Math.hypot(o-n,a-r),c=Math.max(2,Math.min(i,s-1,l-1)),d=(n-t)/(s||1),u=(r-e)/(s||1),f=(o-n)/(l||1),p=(a-r)/(l||1);return`M${t},${e} L${n-d*c},${r-u*c} Q${n},${r} ${n+f*c},${r+p*c} L${o},${a}`}function MR(t,e,n,r,o,a){if(e.nodes.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.nodes,s=e.options.direction!=="LR",l=new Map(e.branches.map(D=>[D.name,D])),c=lr(n),d=D=>D.colorToken?On(D.colorToken,n)??c[D.lane%c.length]:c[D.lane%c.length],u=D=>d(l.get(D.branch)),f=D=>i[D],p=D=>D.kind==="cherry"?"\u21E0 ":D.kind==="merge"?"\u21F2 ":"",m=new Map;for(let D of i){let W=D.id,V=p(D)+xj(D.message||"(empty)",26),P=(W?W.length*6.6+8:0)+V.length*6.9+8;m.set(D.key,{sha:W,msg:V,lw:P})}let g=Math.max(0,...[...m.values()].map(D=>D.lw)),h=new Map,S=(D,W)=>{h.has(D)||h.set(D,[]),h.get(D).push(W)};if(!e.options.noLabels)for(let D of i)D.tag&&S(D.key,{kind:"tag",label:D.tag,w:D.tag.length*6.6+16});for(let D of e.refs)D.atKey!=null&&(D.head?S(D.atKey,{kind:"head",label:"HEAD",w:46}):S(D.atKey,{kind:"ref",label:D.name,remote:D.remote,w:D.name.length*6.2+18}));for(let D of e.notes)D.anchorKey!=null&&S(D.anchorKey,{kind:"note",label:NR[D.num-1]??`#${D.num}`,w:19});let y=Math.max(0,...[...h.values()].map(D=>D.length)),b=e.branches.length,E=i.length,x=new Map,N=[],L,A,C,k,w=0,v=Math.cos(yE*Math.PI/180),M=Math.sin(yE*Math.PI/180);if(s){C=24;let D=C+32,W=52,V=96;k=78;for(let F of i)x.set(F.key,{x:k+F.lane*V,y:D+F.seq*W});let P=k+(b-1)*V+28;for(let F of i){let Y=x.get(F.key);N.push({node:F,kind:"msg",diag:!1,x:P,y:Y.y,anchor:"start",leader:{x1:Y.x+Zo+2,y1:Y.y,x2:P-6,y2:Y.y}}),(h.get(F.key)??[]).forEach((j,K)=>N.push({node:F,kind:j.kind,label:j.label,remote:j.remote,w:j.w,x:Y.x-Zo-12-j.w/2-K*4,y:Y.y,anchor:"middle"}))}L=P+g+16,A=D+(E-1)*W+22}else{C=Math.max(4,...e.branches.map(z=>z.name.length))*7.5+18;let W=C+34,V=86,P=54;k=16+y*vR+14;for(let z of i)x.set(z.key,{x:W+z.seq*V,y:k+z.lane*P});let Y=k+(b-1)*P+26;for(let z of i){let j=x.get(z.key);N.push({node:z,kind:"msg",diag:!0,x:j.x,y:Y,anchor:"start",leader:{x1:j.x,y1:j.y+Zo,x2:j.x,y2:Y-3}}),(h.get(z.key)??[]).forEach(($,U)=>N.push({node:z,kind:$.kind,label:$.label,remote:$.remote,w:$.w,x:j.x,y:j.y-Zo-12-U*vR,anchor:"middle"}))}for(let z of e.branches){if(!z.ab||z.ab.ahead+z.ab.behind===0||z.tip==null)continue;let j=x.get(z.tip);N.push({node:f(z.tip),kind:"ab",label:wj(z.ab),x:j.x+Zo+10,y:j.y,anchor:"start"})}L=Math.max(W+(E-1)*V+Zo+70,...[...x.entries()].map(([z,j])=>j.x+m.get(z).lw*v))+18,A=Y+g*M+12*v+16,e.notes.length&&(w=A+4,A+=8+e.notes.length*16+8)}let _=!!e.title,T=_?bj:0,R=Math.round(L),O=Math.round(A+T),I=!!a,H=It(t).append("svg").attr("width",R).attr("height",O).attr("viewBox",`0 0 ${R} ${O}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(H.append("rect").attr("width",R).attr("height",O).attr("fill",n.bg),_){let D=H.append("text").attr("class","chart-title").attr("x",R/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber&&!I){let W=e.titleLineNumber;D.style("cursor","pointer").on("click",()=>o(W))}}let G=H.append("g").attr("transform",`translate(0, ${T})`);Ej(G,e,n,s,x,N,m,u,f,C,k,w,o&&!I?o:void 0)}function wj(t){let e=[];return t.ahead&&e.push("\u2191"+t.ahead),t.behind&&e.push("\u2193"+t.behind),e.join(" ")}function Ej(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=e.nodes,m=E=>o.get(E),g=(E,x)=>r?{x:m(x.key).x,y:m(E.key).y}:{x:m(E.key).x,y:m(x.key).y},h=(E,x)=>r?{x:m(E.key).x,y:m(x.key).y}:{x:m(x.key).x,y:m(E.key).y},S=E=>E.ghost?.32:1,y=(E,x,N,L)=>{let A=m(E.key),C=m(x.key),k=h(E,x);if(t.append("path").attr("d",hE(A.x,A.y,k.x,k.y,C.x,C.y,gE)).attr("fill","none").attr("stroke",N).attr("stroke-width",2).attr("stroke-dasharray","2 4").attr("opacity",.8),L){let w=C.x-k.x,v=C.y-k.y,M=Math.hypot(w,v)||1,_=w/M,T=v/M,R=-T,O=_,I=4;t.append("path").attr("d",`M${C.x},${C.y} L${C.x-_*I*2+R*I},${C.y-T*I*2+O*I} L${C.x-_*I*2-R*I},${C.y-T*I*2-O*I} Z`).attr("fill",N).attr("opacity",.8)}};for(let E of p){let x=s(E),N=S(E),L=m(E.key);if(E.prev!=null){let A=m(E.prev),C=t.append("line").attr("x1",A.x).attr("y1",A.y).attr("x2",L.x).attr("y2",L.y).attr("stroke",x).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",N);E.ghost&&C.attr("stroke-dasharray","5 5")}if(E.parent!=null){let A=l(E.parent),C=g(A,E),k=m(A.key),w=t.append("path").attr("d",hE(k.x,k.y,C.x,C.y,L.x,L.y,gE)).attr("fill","none").attr("stroke",x).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",N);E.ghost&&w.attr("stroke-dasharray","5 5")}if(E.mergeFrom!=null){let A=l(E.mergeFrom),C=h(A,E),k=m(A.key);t.append("path").attr("d",hE(k.x,k.y,C.x,C.y,L.x,L.y,gE)).attr("fill","none").attr("stroke",s(A)).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",.92*N)}E.cherryFrom!=null&&y(l(E.cherryFrom),E,s(l(E.cherryFrom)),!1),E.revertFrom!=null&&y(l(E.revertFrom),E,x,!1),E.squashFrom!=null&&y(l(E.squashFrom),E,n.textMuted,!0),E.movedTo!=null&&y(E,l(E.movedTo),n.textMuted,!0)}if(!e.options.noLanes)for(let E of e.branches){let x=null;for(let A of p)A.branch===E.name&&(x===null||A.seq<x.seq)&&(x=A);if(!x)continue;let N=m(x.key),L=s(x);r?t.append("text").attr("x",N.x).attr("y",14).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",800).attr("fill",L).text(E.name):t.append("text").attr("x",c).attr("y",N.y+4).attr("text-anchor","end").attr("font-size",12.5).attr("font-weight",800).attr("fill",L).text(E.name)}for(let E of p){let x=s(E),N=m(E.key),L=A=>{A.attr("data-line-number",E.lineNumber),A.attr("data-branch",E.branch),f&&A.style("cursor","pointer").on("click",()=>f(E.lineNumber))};if(E.ghost){L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo-1).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",2).attr("opacity",.4));continue}E.type==="highlight"?L(t.append("rect").attr("x",N.x-Zo).attr("y",N.y-Zo).attr("width",Zo*2).attr("height",Zo*2).attr("rx",3.5).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3)):E.type==="reverse"?(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),L(t.append("path").attr("d",`M${N.x-3.6},${N.y-3.6} L${N.x+3.6},${N.y+3.6} M${N.x+3.6},${N.y-3.6} L${N.x-3.6},${N.y+3.6}`).attr("stroke",x).attr("stroke-width",2).attr("stroke-linecap","round").attr("fill","none"))):E.kind==="merge"?(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",3).attr("fill",x))):L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3))}let b=(E,x,N,L,A,C,k,w,v=700)=>{let M=t.append("rect").attr("x",E-N/2).attr("y",x-8.5).attr("width",N).attr("height",17).attr("rx",8.5).attr("fill",A);k&&(M.attr("stroke",k).attr("stroke-width",1.3),w&&M.attr("stroke-dasharray","3 2")),t.append("text").attr("x",E).attr("y",x+4).attr("text-anchor","middle").attr("font-size",10.5).attr("font-weight",v).attr("fill",C).text(L)};for(let E of a){let x=E.node,N=s(x);if(E.leader&&t.append("line").attr("x1",E.leader.x1).attr("y1",E.leader.y1).attr("x2",E.leader.x2).attr("y2",E.leader.y2).attr("stroke",N).attr("stroke-width",1).attr("opacity",.34*S(x)),E.kind==="tag")b(E.x,E.y,E.w,E.label,N,n.bg);else if(E.kind==="head")b(E.x,E.y,E.w,"HEAD",n.text,n.bg,void 0,!1,800);else if(E.kind==="ref")b(E.x,E.y,E.w,E.label,n.bg,N,N,E.remote);else if(E.kind==="note")t.append("circle").attr("cx",E.x).attr("cy",E.y).attr("r",8.5).attr("fill",N),t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor","middle").attr("font-size",11).attr("fill",n.bg).text(E.label);else if(E.kind==="ab")t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor","start").attr("font-size",11).attr("font-weight",700).attr("fill",N).text(E.label);else{let L=i.get(x.key),A=x.ghost,C=A?n.textMuted:N,k=E.diag?t.append("text").attr("transform",`translate(${E.x},${E.y}) rotate(${yE})`).attr("font-size",12).attr("opacity",A?.55:1):t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor",E.anchor).attr("font-size",12).attr("opacity",A?.55:1);L.sha&&k.append("tspan").attr("font-family","ui-monospace, monospace").attr("font-size",11).attr("fill",n.textMuted).text(L.sha+" "),k.append("tspan").attr("fill",C).attr("font-weight",x.kind==="cherry"?400:700).attr("font-style",x.kind==="cherry"?"italic":"normal").text(L.msg)}}if(u&&e.notes.length){let E=u+14;for(let x of e.notes){let N=t.append("text").attr("x",12).attr("y",E).attr("font-size",11.5);N.append("tspan").attr("fill",n.text).attr("font-weight",800).text((NR[x.num-1]??`#${x.num}`)+" "),N.append("tspan").attr("fill",n.textMuted).text(x.text),E+=16}}}function Sj(t,e,n,r,o){MR(t,e,n,r,void 0,o)}var mE,Zo,gE,yE,vR,NR,bj,TR=st(()=>{"use strict";qn();an();tn();wr();mE=5.5,Zo=8,gE=13,yE=32,vR=19,NR="\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468",bj=40});function Lj(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function CR(){return this.eachAfter(Lj)}var _R=st(()=>{"use strict"});function AR(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}var RR=st(()=>{"use strict"});function IR(t,e){for(var n=this,r=[n],o,a,i=-1;n=r.pop();)if(t.call(e,n,++i,this),o=n.children)for(a=o.length-1;a>=0;--a)r.push(o[a]);return this}var PR=st(()=>{"use strict"});function DR(t,e){for(var n=this,r=[n],o=[],a,i,s,l=-1;n=r.pop();)if(o.push(n),a=n.children)for(i=0,s=a.length;i<s;++i)r.push(a[i]);for(;n=o.pop();)t.call(e,n,++l,this);return this}var GR=st(()=>{"use strict"});function OR(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}var $R=st(()=>{"use strict"});function HR(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}var WR=st(()=>{"use strict"});function FR(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}var BR=st(()=>{"use strict"});function YR(t){for(var e=this,n=vj(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function vj(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}var VR=st(()=>{"use strict"});function zR(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}var UR=st(()=>{"use strict"});function XR(){return Array.from(this)}var jR=st(()=>{"use strict"});function qR(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}var KR=st(()=>{"use strict"});function ZR(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}var QR=st(()=>{"use strict"});function*JR(){var t=this,e,n=[t],r,o,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,a=r.length;o<a;++o)n.push(r[o]);while(n.length)}var tI=st(()=>{"use strict"});function Ci(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=kj)):e===void 0&&(e=Mj);for(var n=new Hl(t),r,o=[n],a,i,s,l;r=o.pop();)if((i=e(r.data))&&(l=(i=Array.from(i)).length))for(r.children=i,s=l-1;s>=0;--s)o.push(a=i[s]=new Hl(i[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Cj)}function Nj(){return Ci(this).eachBefore(Tj)}function Mj(t){return t.children}function kj(t){return Array.isArray(t)?t[1]:null}function Tj(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Cj(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Hl(t){this.data=t,this.depth=this.height=0,this.parent=null}var bE=st(()=>{"use strict";_R();RR();PR();GR();$R();WR();BR();VR();UR();jR();KR();QR();tI();Hl.prototype=Ci.prototype={constructor:Hl,count:CR,each:AR,eachAfter:DR,eachBefore:IR,find:OR,sum:HR,sort:FR,path:YR,ancestors:zR,descendants:XR,leaves:qR,links:ZR,copy:Nj,[Symbol.iterator]:JR}});function eI(t){if(typeof t!="function")throw new Error;return t}var nI=st(()=>{"use strict"});function nd(){return 0}function rd(t){return function(){return t}}var rI=st(()=>{"use strict"});function Yg(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}var xE=st(()=>{"use strict"});function Vg(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)i=a[s],i.y0=n,i.y1=o,i.x0=e,i.x1=e+=i.value*c}var wE=st(()=>{"use strict"});function EE(){var t=1,e=1,n=0,r=!1;function o(i){var s=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/s,i.eachBefore(a(e,s)),r&&i.eachBefore(Yg),i}function a(i,s){return function(l){l.children&&Vg(l,l.x0,i*(l.depth+1)/s,l.x1,i*(l.depth+2)/s);var c=l.x0,d=l.y0,u=l.x1-n,f=l.y1-n;u<c&&(c=u=(c+u)/2),f<d&&(d=f=(d+f)/2),l.x0=c,l.y0=d,l.x1=u,l.y1=f}}return o.round=function(i){return arguments.length?(r=!!i,o):r},o.size=function(i){return arguments.length?(t=+i[0],e=+i[1],o):[t,e]},o.padding=function(i){return arguments.length?(n=+i,o):n},o}var oI=st(()=>{"use strict";xE();wE()});function _j(t,e){return t.parent===e.parent?1:2}function SE(t){var e=t.children;return e?e[0]:t.t}function LE(t){var e=t.children;return e?e[e.length-1]:t.t}function Aj(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Rj(t){for(var e=0,n=0,r=t.children,o=r.length,a;--o>=0;)a=r[o],a.z+=e,a.m+=e,e+=a.s+(n+=a.c)}function Ij(t,e,n){return t.a.parent===e.parent?t.a:n}function zg(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Pj(t){for(var e=new zg(t,0),n,r=[e],o,a,i,s;n=r.pop();)if(a=n._.children)for(n.children=new Array(s=a.length),i=s-1;i>=0;--i)r.push(o=n.children[i]=new zg(a[i],i)),o.parent=n;return(e.parent=new zg(null,0)).children=[e],e}function vE(){var t=_j,e=1,n=1,r=null;function o(c){var d=Pj(c);if(d.eachAfter(a),d.parent.m=-d.z,d.eachBefore(i),r)c.eachBefore(l);else{var u=c,f=c,p=c;c.eachBefore(function(y){y.x<u.x&&(u=y),y.x>f.x&&(f=y),y.depth>p.depth&&(p=y)});var m=u===f?1:t(u,f)/2,g=m-u.x,h=e/(f.x+m+g),S=n/(p.depth||1);c.eachBefore(function(y){y.x=(y.x+g)*h,y.y=y.depth*S})}return c}function a(c){var d=c.children,u=c.parent.children,f=c.i?u[c.i-1]:null;if(d){Rj(c);var p=(d[0].z+d[d.length-1].z)/2;f?(c.z=f.z+t(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+t(c._,f._));c.parent.A=s(c,f,c.parent.A||u[0])}function i(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function s(c,d,u){if(d){for(var f=c,p=c,m=d,g=f.parent.children[0],h=f.m,S=p.m,y=m.m,b=g.m,E;m=LE(m),f=SE(f),m&&f;)g=SE(g),p=LE(p),p.a=c,E=m.z+y-f.z-h+t(m._,f._),E>0&&(Aj(Ij(m,c,u),c,E),h+=E,S+=E),y+=m.m,h+=f.m,b+=g.m,S+=p.m;m&&!LE(p)&&(p.t=m,p.m+=y-S),f&&!SE(g)&&(g.t=f,g.m+=h-b,u=c)}return u}function l(c){c.x*=e,c.y=c.depth*n}return o.separation=function(c){return arguments.length?(t=c,o):t},o.size=function(c){return arguments.length?(r=!1,e=+c[0],n=+c[1],o):r?null:[e,n]},o.nodeSize=function(c){return arguments.length?(r=!0,e=+c[0],n=+c[1],o):r?[e,n]:null},o}var aI=st(()=>{"use strict";bE();zg.prototype=Object.create(Hl.prototype)});function iI(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(o-n)/t.value;++s<l;)i=a[s],i.x0=e,i.x1=r,i.y0=n,i.y1=n+=i.value*c}var sI=st(()=>{"use strict"});function Gj(t,e,n,r,o,a){for(var i=[],s=e.children,l,c,d=0,u=0,f=s.length,p,m,g=e.value,h,S,y,b,E,x,N;d<f;){p=o-n,m=a-r;do h=s[u++].value;while(!h&&u<f);for(S=y=h,x=Math.max(m/p,p/m)/(g*t),N=h*h*x,E=Math.max(y/N,N/S);u<f;++u){if(h+=c=s[u].value,c<S&&(S=c),c>y&&(y=c),N=h*h*x,b=Math.max(y/N,N/S),b>E){h-=c;break}E=b}i.push(l={value:h,dice:p<m,children:s.slice(d,u)}),l.dice?Vg(l,n,r,o,g?r+=m*h/g:a):iI(l,n,r,g?n+=p*h/g:o,a),g-=h,d=u}return i}var Dj,gf,NE=st(()=>{"use strict";wE();sI();Dj=(1+Math.sqrt(5))/2;gf=(function t(e){function n(r,o,a,i,s){Gj(e,r,o,a,i,s)}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Dj)});function ME(){var t=gf,e=!1,n=1,r=1,o=[0],a=nd,i=nd,s=nd,l=nd,c=nd;function d(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(u),o=[0],e&&f.eachBefore(Yg),f}function u(f){var p=o[f.depth],m=f.x0+p,g=f.y0+p,h=f.x1-p,S=f.y1-p;h<m&&(m=h=(m+h)/2),S<g&&(g=S=(g+S)/2),f.x0=m,f.y0=g,f.x1=h,f.y1=S,f.children&&(p=o[f.depth+1]=a(f)/2,m+=c(f)-p,g+=i(f)-p,h-=s(f)-p,S-=l(f)-p,h<m&&(m=h=(m+h)/2),S<g&&(g=S=(g+S)/2),t(f,m,g,h,S))}return d.round=function(f){return arguments.length?(e=!!f,d):e},d.size=function(f){return arguments.length?(n=+f[0],r=+f[1],d):[n,r]},d.tile=function(f){return arguments.length?(t=eI(f),d):t},d.padding=function(f){return arguments.length?d.paddingInner(f).paddingOuter(f):d.paddingInner()},d.paddingInner=function(f){return arguments.length?(a=typeof f=="function"?f:rd(+f),d):a},d.paddingOuter=function(f){return arguments.length?d.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):d.paddingTop()},d.paddingTop=function(f){return arguments.length?(i=typeof f=="function"?f:rd(+f),d):i},d.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:rd(+f),d):s},d.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:rd(+f),d):l},d.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:rd(+f),d):c},d}var lI=st(()=>{"use strict";xE();NE();nI();rI()});var Ug=st(()=>{"use strict";bE();oI();aI();lI();NE()});var bI={};ye(bI,{layoutOrg:()=>_E});function qg(t,e){let n=0;for(let r of t.children){n+=(r.isContainer?0:1)+qg(r,e);let o=e?.get(r.id);o&&(n+=o)}return n}function hf(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function Yj(t,e){let n=_t(t,Oj);for(let[r,o]of Object.entries(e)){let a=_t(`${r}: ${o}`,$j);a>n&&(n=a)}return Math.max(Bj,Math.ceil(n)+Fj*2)}function Vj(t){let e=Object.keys(t).length;return e===0?cI+dI:cI+Wj+e*Hj+dI}function jg(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n,t.isContainer)}function gI(t,e,n,r,o){return t.map(a=>{let i=hf(a.metadata,n),s=e?.get(a.id);if(!a.isContainer&&o&&!(s!=null&&s>0)){let l=qg(a,e);l>0&&(i[r??"Sub-node Count"]=String(l))}return{orgNode:a,children:gI(a.children,e,n,r,o),width:Yj(a.label,i),height:Vj(i)}})}function hI(t){let e=0;for(let n of t.children)e+=1+hI(n);return e}function yI(t){for(let i of t.children)yI(i);if(t.children.length<=2)return;let e=t.children.map(i=>({child:i,weight:hI(i)})).sort((i,s)=>s.weight-i.weight),n=new Array(e.length),r=Math.floor((e.length-1)/2),o=r,a=r;for(let i=0;i<e.length;i++){let s=e[i];i===0?n[r]=s.child:i%2===1?(a++,n[a]=s.child):(o--,n[o]=s.child)}t.children=n}function mI(t,e,n){let r=[];for(let o of t){if(o.entries.length===0)continue;let a=n?.get(qt(o.name)),i=a?o.entries.filter(f=>a.has(f.value.toLowerCase())):o.entries;if(i.length===0)continue;let s=Fe(o.name,cr)+po,l=s,c=0;for(let f of i)c+=Er*2+kr+Fe(f.value,Xn)+Kr;let d=e?Co+wi:0,u=In*2+s+4+d+c;r.push({name:o.name,...o.alias!==void 0&&{alias:o.alias},entries:i.map(f=>({value:f.value,color:f.color})),x:0,y:0,width:u,height:Se,minifiedWidth:l,minifiedHeight:Se})}return r}function zj(t,e){let n=[],r=o=>{n.push(o);for(let a of o.children)r(a)};for(let o of t)r(o);wa(n,e,o=>o.isContainer)}function _E(t,e,n,r,o){if(t.roots.length===0){let $=r!==void 0,U=mI(t.tagGroups,$);if(U.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let X=ti,q=0;for(let et of U)et.x=ti,et.y=X,X+=Se+Bn,et.width>q&&(q=et.width);return{nodes:[],edges:[],containers:[],legend:U,width:q+ti*2,height:X-Bn+ti}}zj(t.roots,t.tagGroups);let a=t.options["sub-node-label"]??void 0,i=["yes","on"].includes(t.options["show-sub-node-count"]?.toLowerCase()??""),s=gI(t.roots,e,r,a,i),l;s.length===1?l=s[0]:l={orgNode:{id:"__virtual_root__",label:"",metadata:{},children:t.roots,parentId:null,isContainer:!1,lineNumber:0},children:s,width:0,height:0};let c=0,d=0,u=[],f=$=>{$.orgNode.id!=="__virtual_root__"&&(u.push($),$.width>c&&(c=$.width),$.height>d&&(d=$.height));for(let U of $.children)f(U)};f(l);for(let $ of u)$.width=c;let p=new Map,m=$=>{for(let U of $.children)m(U);if($.orgNode.isContainer&&$.children.length>0&&$.children.every(U=>U.children.length===0)){let U=`__stack_${$.orgNode.id}`;p.set($.orgNode.id,{children:[...$.children],placeholderId:U});let X=Math.max(...$.children.map(et=>et.width));for(let et of $.children)et.width=X;let q=$.children.reduce((et,tt)=>et+tt.height,0)+($.children.length-1)*pI;$.children=[{orgNode:{id:U,label:"",metadata:{},children:[],parentId:$.orgNode.id,isContainer:!1,lineNumber:0},children:[],width:X,height:q}]}};m(l),yI(l);let g=Ci(l,$=>$.children);vE().nodeSize([c+uI,d+kE])(g);{let $=g.descendants().filter(tt=>tt.data.orgNode.id!=="__virtual_root__"),U=new Map;for(let tt of $){if(tt.data.orgNode.id.startsWith("__stack_"))continue;let B=U.get(tt.depth)??0;tt.data.height>B&&U.set(tt.depth,tt.data.height)}let X=Math.max(...U.keys(),0),q=new Map,et=s.length===1?0:1;q.set(et,0);for(let tt=et+1;tt<=X;tt++){let B=U.get(tt-1)??d,Q=q.get(tt-1)??0;q.set(tt,Q+B+kE)}for(let tt of g.descendants())tt.data.orgNode.id!=="__virtual_root__"&&(tt.y=q.get(tt.depth)??tt.y)}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.isContainer||!$.children||$.children.length===0)continue;let X=$.children[0].y-$.y,q=Object.keys($.data.orgNode.metadata).length,tt=TE+q*CE+15,B=X-tt;if(B<=0)continue;let Q=ot=>{if(ot.children)for(let Z of ot.children)Z.y-=B,Q(Z)};Q($)}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.isContainer||!$.children||$.children.length===0||!$.children.every(Q=>Q.data.orgNode.isContainer))continue;let U=$.y+$.data.height,q=Math.min(...$.children.map(Q=>Q.y))-U,et=kE*.6,tt=q-et;if(tt<=0)continue;let B=Q=>{if(Q.y-=tt,Q.children)for(let ot of Q.children)B(ot)};for(let Q of $.children)B(Q)}{let $=q=>{let et=q.x-q.data.width/2,tt=q.x+q.data.width/2;if(q.children)for(let B of q.children){let Q=$(B);Q.minX<et&&(et=Q.minX),Q.maxX>tt&&(tt=Q.maxX)}return q.data.orgNode.isContainer&&(et-=Xg,tt+=Xg),{minX:et,maxX:tt}},U=(q,et)=>{q.x+=et,q.children&&q.children.forEach(tt=>U(tt,et))},X=g.descendants().filter(q=>q.children&&q.children.length>=2).sort((q,et)=>et.depth-q.depth);for(let q of X){let et=q.children,tt=et.map(lt=>{let nt=$(lt);return{relLeft:nt.minX-lt.x,relRight:nt.maxX-lt.x}}),B=(et[0].x+et[et.length-1].x)/2,Q=[0];for(let lt=1;lt<et.length;lt++){let nt=Q[lt-1]+tt[lt-1].relRight;Q[lt]=nt+uI-tt[lt].relLeft}let ot=(Q[0]+Q[Q.length-1])/2,Z=B-ot;for(let lt=0;lt<et.length;lt++){let J=Q[lt]+Z-et[lt].x;Math.abs(J)>.001&&U(et[lt],J)}}}{let $=g.descendants().filter(U=>U.children&&U.children.length>=1&&U.data.orgNode.id!=="__virtual_root__").sort((U,X)=>X.depth-U.depth);for(let U of $){let X=U.children.map(et=>et.x),q=(Math.min(...X)+Math.max(...X))/2;U.x=q}}let S=[],y=[],b=1/0,E=-1/0,x=1/0,N=-1/0,L=[];for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode.id.replace("__stack_",""),X=p.get(U);if(!X)continue;let q=$.y;for(let et of X.children)L.push({orgNode:et.orgNode,width:et.width,height:et.height,cx:$.x,cy:q}),q+=et.height+pI}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.width,X=$.data.height,q=$.x,et=$.y;q-U/2<b&&(b=q-U/2),q+U/2>E&&(E=q+U/2),et<x&&(x=et),et+X>N&&(N=et+X)}for(let $ of L)$.cx-$.width/2<b&&(b=$.cx-$.width/2),$.cx+$.width/2>E&&(E=$.cx+$.width/2),$.cy<x&&(x=$.cy),$.cy+$.height>N&&(N=$.cy+$.height);let A=-b+ti,C=-x+ti,k=a??"Sub-node Count";for(let $ of L){let U=e?.get($.orgNode.id),X=hf($.orgNode.metadata,r);if(!$.orgNode.isContainer&&i&&!(U!=null&&U>0)){let tt=qg($.orgNode,e);tt>0&&(X[k]=String(tt))}let q=jg($.orgNode,t.tagGroups,n??null),et=$.orgNode.children.length>0||U!=null&&U>0||void 0;S.push({id:$.orgNode.id,label:$.orgNode.label,metadata:X,tagMetadata:{...$.orgNode.metadata},isContainer:$.orgNode.isContainer,lineNumber:$.orgNode.lineNumber,...q!==void 0&&{color:q},x:$.cx+A,y:$.cy+C,width:$.width,height:$.height,...U!==void 0&&{hiddenCount:U},...et!==void 0&&{hasChildren:et}})}let w=new Map;for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode,X=$.data.width,q=$.data.height,et=$.x+A,tt=$.y+C,B=e?.get(U.id),Q=hf(U.metadata,r);if(!U.isContainer&&i&&!(B!=null&&B>0)){let nt=qg(U,e);nt>0&&(Q[k]=String(nt))}let ot=jg(U,t.tagGroups,n??null),Z=$.children!=null&&$.children.length>0||B!=null&&B>0||void 0;S.push({id:U.id,label:U.label,metadata:Q,tagMetadata:{...U.metadata},isContainer:U.isContainer,lineNumber:U.lineNumber,...ot!==void 0&&{color:ot},x:et,y:tt,width:X,height:q,...B!==void 0&&{hiddenCount:B},...Z!==void 0&&{hasChildren:Z}});let lt=$.parent?.data.orgNode.isContainer&&$.parent.children&&$.parent.children.length>0;if($.parent&&$.parent.data.orgNode.id!=="__virtual_root__"&&!lt){let nt=$.parent.data.orgNode.id;if(!w.has(nt)){let J=$.parent.x+A,at=$.parent.y+C,it=$.parent.data.height;w.set(nt,{parentX:J,parentBottomY:at+it,children:[]})}w.get(nt).children.push({id:U.id,x:et,topY:tt})}}for(let[$,U]of w){let{parentX:X,parentBottomY:q,children:et}=U;if(et.length===1){let tt=et[0],B=(q+tt.topY)/2;y.push({sourceId:$,targetId:tt.id,points:[{x:X,y:q},{x:X,y:B},{x:tt.x,y:B},{x:tt.x,y:tt.topY}]})}else{let tt=(q+et[0].topY)/2,B=et.map(Z=>Z.x),Q=Math.min(...B),ot=Math.max(...B);y.push({sourceId:$,targetId:$,points:[{x:X,y:q},{x:X,y:tt}]}),y.push({sourceId:$,targetId:$,points:[{x:Q,y:tt},{x:ot,y:tt}]});for(let Z of et)y.push({sourceId:$,targetId:Z.id,points:[{x:Z.x,y:tt},{x:Z.x,y:Z.topY}]})}}let v=g.descendants().filter($=>$.data.orgNode.id!=="__virtual_root__"&&$.data.orgNode.isContainer),M=new Map,_=[],T=60;for(let $ of v){if($.children&&$.children.length>0)continue;let U=$.x+A,X=$.y+C,q=Object.keys($.data.orgNode.metadata).length,et=TE+q*CE,tt=$.data.width,B=Math.max(et+fI,T),Q=U-tt/2,ot=X;M.set($.data.orgNode.id,{minX:Q,maxX:Q+tt,minY:ot,maxY:ot+B});let Z=e?.get($.data.orgNode.id),lt=hf($.data.orgNode.metadata,r),nt=jg($.data.orgNode,t.tagGroups,n??null),J=Z!=null&&Z>0||void 0;_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...nt!==void 0&&{color:nt},metadata:lt,tagMetadata:{...$.data.orgNode.metadata},x:Q,y:ot,width:tt,height:B,labelHeight:et,...Z!==void 0&&{hiddenCount:Z},...J!==void 0&&{hasChildren:J}})}let R=v.filter($=>$.children&&$.children.length>0);R.sort(($,U)=>U.depth-$.depth);for(let $ of R){let U=[],X=pt=>{if(pt.children)for(let gt of pt.children)U.push(gt),X(gt)};if(X($),U.length===0)continue;let q=1/0,et=-1/0,tt=-1/0;for(let pt of U){let gt=M.get(pt.data.orgNode.id);if(gt)gt.minX<q&&(q=gt.minX),gt.maxX>et&&(et=gt.maxX),gt.maxY>tt&&(tt=gt.maxY);else if(pt.data.orgNode.id.startsWith("__stack_")){let dt=pt.data.orgNode.id.replace("__stack_","");if(p.get(dt))for(let yt of L){if(yt.orgNode.parentId!==dt)continue;let vt=yt.cx+A,Gt=yt.cy+C;vt-yt.width/2<q&&(q=vt-yt.width/2),vt+yt.width/2>et&&(et=vt+yt.width/2),Gt+yt.height>tt&&(tt=Gt+yt.height)}}else{let dt=pt.data.width,ut=pt.data.height,yt=pt.x+A,vt=pt.y+C;yt-dt/2<q&&(q=yt-dt/2),yt+dt/2>et&&(et=yt+dt/2),vt+ut>tt&&(tt=vt+ut)}}let B=$.x+A,Q=$.y+C,ot=Object.keys($.data.orgNode.metadata).length,Z=TE+ot*CE,lt=Q,nt=tt-Q+fI,J=q-Xg,at=et-q+Xg*2,it=Math.max(at,$.data.width),Lt=it>at?B-it/2:J;M.set($.data.orgNode.id,{minX:Lt,maxX:Lt+it,minY:lt,maxY:lt+nt});let Tt=e?.get($.data.orgNode.id),At=hf($.data.orgNode.metadata,r),rt=jg($.data.orgNode,t.tagGroups,n??null);_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...rt!==void 0&&{color:rt},metadata:At,tagMetadata:{...$.data.orgNode.metadata},x:Lt,y:lt,width:it,height:nt,labelHeight:Z,...Tt!==void 0&&{hiddenCount:Tt},hasChildren:!0})}_.reverse();let O=b,I=E,H=N;for(let $ of _){let U=$.x-A,X=U+$.width,q=$.y-C+$.height;U<O&&(O=U),X>I&&(I=X),q>H&&(H=q)}let G=I-O+ti*2,D=H-x+ti*2,W=new Map;for(let $ of t.tagGroups){let U=qt($.name),X=new Set,q=et=>{!et.isContainer&&et.metadata[U]&&X.add(et.metadata[U].toLowerCase());for(let tt of et.children)q(tt)};for(let et of t.roots)q(et);W.set(U,X)}let V=r!==void 0,P=mI(t.tagGroups,V,W),F=G,Y=D,z=n!=null?P.filter($=>$.name.toLowerCase()===n.toLowerCase()):P,j=o&&n==null,K=$=>n!=null||j?$.width:$.minifiedWidth;if(z.length>0){let $=Se+Bn;for(let et of S)et.y+=$;for(let et of _)et.y+=$;for(let et of y)for(let tt of et.points)tt.y+=$;let U=z.reduce((et,tt)=>et+K(tt),0)+(z.length-1)*Bn,X=ti;for(let et of z)et.x=X,et.y=ti,X+=K(et)+Bn;Y+=$;let q=U+ti*2;q>F&&(F=q)}return{nodes:S,edges:y,containers:_,legend:P,width:F,height:Y}}var Oj,$j,Hj,cI,Wj,Fj,dI,Bj,uI,kE,ti,Xg,fI,TE,CE,pI,AE=st(()=>{"use strict";je();Ug();je();Tr();en();Oj=13,$j=11,Hj=16,cI=28,Wj=6,Fj=20,dI=10,Bj=140,uI=30,kE=50,ti=40,Xg=24,fI=24,TE=28,CE=16,pI=20});function xI(t,e){let n=0;for(let r of e.getChildren(t))n+=(e.countsAsHidden(r)?1:0)+xI(r,e);return n}function wI(t,e,n,r){for(let o of t){let a=r.getChildren(o);e.has(r.getId(o))&&a.length>0&&n.set(r.getId(o),xI(o,r)),wI(a,e,n,r)}}function EI(t,e,n){for(let r of n.getChildren(t))EI(r,e,n);e.has(n.getId(t))&&n.getChildren(t).length>0&&n.setChildren(t,[])}function od(t,e,n){let r=new Map;wI(t,e,r,n);let o=t.map(a=>n.clone(a));for(let a of o)EI(a,e,n);return{roots:o,hiddenCounts:r}}function SI(t,e){let n=new Set,r=o=>{for(let a of o)n.add(e.getId(a)),r(e.getChildren(a))};return r(t),n}var yf=st(()=>{"use strict"});var vI={};ye(vI,{collapseOrgTree:()=>Xj,focusOrgTree:()=>jj});function Kg(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(Kg),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function Xj(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=od(t.roots,e,Uj);return{parsed:{...t,roots:n},hiddenCounts:r}}function LI(t,e,n){for(let r of t){if(r.id===e)return{node:r,path:n};let o=LI(r.children,e,[...n,{id:r.id,label:r.label,lineNumber:r.lineNumber,...r.color!==void 0&&{color:r.color},metadata:{...r.metadata},isContainer:r.isContainer}]);if(o)return o}return null}function jj(t,e){let n=LI(t.roots,e,[]);if(!n)return null;if(t.roots.some(a=>a.id===e))return{parsed:{...t,roots:[Kg(n.node)]},ancestorPath:[]};let o=Kg(n.node);return o.parentId=null,{parsed:{...t,roots:[o]},ancestorPath:n.path}}var Uj,NI=st(()=>{"use strict";yf();Uj={getId:t=>t.id,getChildren:t=>t.children,clone:Kg,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer}});function ad(t,e,n){let r=document.createElement("div");r.style.width=`${t}px`,r.style.height=`${e}px`,r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);try{return n(r)}finally{document.body.removeChild(r)}}function id(t,e){let n=t.querySelector("svg");return n?(e==="transparent"&&(n.style.background="none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.fontFamily=Pt,n.querySelectorAll("[data-export-ignore]").forEach(r=>r.remove()),n.outerHTML):""}var Zg=st(()=>{"use strict";an()});var AI={};ye(AI,{renderOrg:()=>_I,renderOrgForExport:()=>i9});function o9(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function MI(t,e){return e??t.primary}function a9(t,e,n){return n?Ot(n,or(t,e),10):Ot(t.surface,t.bg,40)}function kI(t,e){return e??t.textMuted}function _I(t,e,n,r,o,a,i,s,l,c,d){It(t).selectAll(":not([data-d3-tooltip])").remove();let u=i?.width??t.clientWidth,f=i?.height??t.clientHeight;if(u<=0||f<=0)return;let p=Ee.identity(),m=p.aesthetic(RE),g=p.structural(CI),h=p.text(13),S=p.text(11),y=p.structural(16),b=p.structural(28),E=p.structural(6),x=p.structural(1.5),N=p.structural(1.5),L=p.structural(6),A=p.structural(8),C=p.text(13),k=p.text(11),w=p.structural(16),v=p.structural(28),M=p.structural(6),_=p.structural(0),T=p.structural(Jj),R=p.text(t9),O=p.structural(e9),I=p.structural(n9),H=p.aesthetic(r9),G=!!e.title&&e.options["no-title"]!=="on",D=G?g:0,W=n.nodes.length===0,V=n.legend.length>0,P=Se+Bn,F=!i&&V&&!W,Y=F?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Co+wi},u)+H:0,z=!i&&G,j=z?g:0,K=!i&&c&&c.length>0,$=K?c.length*O+I:0,U=n.width,X=n.height+(z?0:D)+$;F&&(X-=P);let q=f-m*2-Y-j,et=(u-m*2)/U,tt=q/X,B=Math.min(Qj,et,tt),Q=U*B,ot=(u-Q)/2,Z=F?m+Y+j:m+j,lt=It(t).append("svg").attr("width",u).attr("height",f).attr("viewBox",`0 0 ${u} ${f}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);p.isBelowFloor&&lt.attr("width","100%");let nt=lt.append("g").attr("transform",`translate(${ot}, ${Z}) scale(${B})`);if(G){let rt=z?lt:nt,pt=z?u/2:U/2,gt=z?m+20:20,dt=rt.append("text").attr("x",pt).attr("y",gt).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",20).attr("font-weight","700").attr("class","org-title chart-title").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(dt.attr("data-line-number",e.titleLineNumber),a&&dt.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let J=(z?0:D)+$,at=nt.append("g").attr("transform",`translate(0, ${J})`),it=new Map;for(let rt of e.tagGroups)it.set(qt(rt.name),rt.name);let Lt=new Set(e.roots.map(rt=>rt.id)),Tt=e.options?.color==="off";for(let rt of n.containers){let pt=at.append("g").attr("transform",`translate(${rt.x}, ${rt.y})`).attr("class","org-container").attr("data-line-number",String(rt.lineNumber));if(s){let yt=qt(s),vt=rt.tagMetadata[yt];vt&&pt.attr(`data-tag-${yt}`,vt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let gt=a9(r,o,Tt?void 0:rt.color),dt=kI(r,Tt?void 0:rt.color);pt.append("rect").attr("x",0).attr("y",0).attr("width",rt.width).attr("height",rt.height).attr("rx",A).attr("fill",gt).attr("stroke",dt).attr("stroke-opacity",.35).attr("stroke-width",N),pt.append("text").attr("x",rt.width/2).attr("y",v/2+C/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",C).attr("font-weight","bold").text(rt.label);let ut=Object.entries(rt.metadata);if(ut.length>0){let yt=ut.map(([bt])=>it.get(bt)??bt),Gt=10+Math.max(...yt.map(bt=>_t(`${bt}: `,k))),Xt=v+k-2;for(let bt=0;bt<ut.length;bt++){let[,Mt]=ut[bt],zt=yt[bt],xt=Xt+bt*w;pt.append("text").attr("x",10).attr("y",xt).attr("fill",r.textMuted).attr("font-size",k).text(`${zt}: `),pt.append("text").attr("x",Gt).attr("y",xt).attr("fill",r.text).attr("font-size",k).text(Mt)}}if(!i&&rt.hiddenCount&&rt.hiddenCount>0&&oE(pt,{width:rt.width,height:rt.height,barHeight:M,inset:_,rx:A,fill:kI(r,Tt?void 0:rt.color),clipId:`clip-${rt.nodeId}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!Lt.has(rt.nodeId)){let Gt=rt.width-14-5,bt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.nodeId).attr("data-export-ignore","true").attr("transform",`translate(${Gt}, 5)`);bt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let Mt=Le(gt,r.textOnFillLight,r.textOnFillDark),zt=14/2,xt=14/2;bt.append("circle").attr("cx",zt).attr("cy",xt).attr("r",14/2-1).attr("fill","none").attr("stroke",Mt).attr("stroke-width",1.5),bt.append("circle").attr("cx",zt).attr("cy",xt).attr("r",2).attr("fill",Mt)}}for(let rt of n.edges){if(rt.points.length<2)continue;let pt=[];pt.push(`M ${rt.points[0].x} ${rt.points[0].y}`);for(let gt=1;gt<rt.points.length;gt++)pt.push(`L ${rt.points[gt].x} ${rt.points[gt].y}`);at.append("path").attr("d",pt.join(" ")).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",x).attr("class","org-edge").attr("data-from",rt.sourceId).attr("data-to",rt.targetId)}let At=new Set(n.containers.map(rt=>rt.nodeId));for(let rt of n.nodes){if(At.has(rt.id))continue;let pt=at.append("g").attr("transform",`translate(${rt.x-rt.width/2}, ${rt.y})`).attr("class","org-node").attr("data-line-number",String(rt.lineNumber)).attr("data-node-id",rt.id);if(s){let Gt=qt(s),Xt=rt.tagMetadata[Gt];Xt&&pt.attr(`data-tag-${Gt}`,Xt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let gt=e.options["solid-fill"]==="on",dt=o9(r,o,Tt?void 0:rt.color,gt),ut=MI(r,Tt?void 0:rt.color),yt=Le(dt,r.textOnFillLight,r.textOnFillDark),vt=Object.entries(rt.metadata);if(td(pt,{width:rt.width,height:rt.height,rx:L,fill:dt,stroke:ut,strokeWidth:N,...rt.isContainer&&{dashed:!0},label:rt.label,labelColor:yt,labelFontSize:h,headerHeight:b,...vt.length>0&&{meta:{rows:vt.map(([Gt,Xt])=>[it.get(Gt)??Gt,Xt]),fontSize:S,lineHeight:y,separatorGap:E,separatorColor:gt?yt:ut,textColor:yt}}}),!i&&rt.hiddenCount&&rt.hiddenCount>0&&oE(pt,{width:rt.width,height:rt.height,barHeight:M,inset:_,rx:L,fill:gt?yt:MI(r,Tt?void 0:rt.color),clipId:`clip-${rt.id}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!Lt.has(rt.id)){let bt=rt.width-14-5,zt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.id).attr("data-export-ignore","true").attr("transform",`translate(${bt}, 5)`);zt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let xt=yt,Nt=14/2,Dt=14/2;zt.append("circle").attr("cx",Nt).attr("cy",Dt).attr("r",14/2-1).attr("fill","none").attr("stroke",xt).attr("stroke-width",1.5),zt.append("circle").attr("cx",Nt).attr("cy",Dt).attr("r",2).attr("fill",xt)}}if(K){let rt=n.nodes.find(ut=>Lt.has(ut.id)),pt=rt?null:n.containers.find(ut=>Lt.has(ut.nodeId)),gt=rt?rt.x:pt?pt.x+pt.width/2:null,dt=rt?rt.y:pt?pt.y:null;if(gt!==null&&dt!==null){let ut=dt-I,yt=at.append("g").attr("class","org-ancestor-trail"),vt=c.length,Gt=[];for(let bt=0;bt<vt;bt++){let Mt=vt-1-bt;Gt.push(ut-Mt*O)}let Xt=Gt[0];yt.append("line").attr("x1",gt).attr("y1",Xt).attr("x2",gt).attr("y2",dt).attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.4);for(let bt=0;bt<vt;bt++){let Mt=c[bt],zt=Gt[bt],Nt=Mt.color??sr(Mt.metadata,[...e.tagGroups],s??null,Mt.isContainer)??r.textMuted,Dt=yt.append("g").attr("class","org-ancestor-node").attr("data-focus-ancestor",Mt.id).style("cursor","pointer").attr("transform",`translate(${gt}, ${zt})`);Dt.append("rect").attr("x",-T-2).attr("y",-T-2).attr("width",120).attr("height",T*2+4).attr("fill","transparent"),Dt.append("circle").attr("cx",0).attr("cy",0).attr("r",T).attr("fill",Nt),Dt.append("text").attr("x",T+6).attr("y",R*.35).attr("fill",r.textMuted).attr("font-size",R).text(Mt.label),Dt.on("mouseenter",function(){It(this).select("circle").attr("r",T+1),It(this).select("text").attr("fill",r.text)}).on("mouseleave",function(){It(this).select("circle").attr("r",T),It(this).select("text").attr("fill",r.textMuted)})}}}if(F||W||i&&V){let rt=n.legend.map(ut=>({name:ut.name,entries:ut.entries.map(yt=>({value:yt.value,color:yt.color}))})),pt=F?Co+wi:0,gt=F?lt.append("g").attr("class","org-legend-fixed").attr("transform",`translate(0, ${m+j})`):at.append("g"),dt;if(W){for(let ut of n.legend){let yt={groups:[{name:ut.name,entries:ut.entries.map(Gt=>({value:Gt.value,color:Gt.color}))}],position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview"},vt=gt.append("g").attr("transform",`translate(${ut.x}, ${ut.y})`);mn(vt,{...yt,palette:r,isDark:o,width:ut.width,activeGroup:ut.name}),vt.selectAll("[data-legend-group]").classed("org-legend-group",!0)}dt=null}else dt=mn(gt,{...{groups:rt,position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview",capsulePillAddonWidth:pt},palette:r,isDark:o,width:F?u:n.width,activeGroup:s??null}),gt.selectAll("[data-legend-group]").classed("org-legend-group",!0);if(F&&dt){let ut=dt.getLayout();if(ut.activeCapsule?.addonX!=null){let yt=ut.activeCapsule,vt=qt(yt.groupName),Gt=l?.has(vt)??!1,Xt=gt.select(`[data-legend-group="${vt}"]`);if(!Xt.empty()){let bt=yt.addonX,Mt=(Se-Co)/2,zt=6,xt=Xt.append("g").attr("class","org-legend-eye").attr("data-legend-visibility",vt).style("cursor","pointer").attr("opacity",Gt?.4:.7);xt.append("rect").attr("x",bt-zt).attr("y",Mt-zt).attr("width",Co+zt*2).attr("height",Co+zt*2).attr("fill","transparent").attr("pointer-events","all"),xt.append("path").attr("d",Gt?Rm:Am).attr("transform",`translate(${bt}, ${Mt})`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}}function i9(t,e,n){let r=Fc(t,n);if(r.error)return"";let o=r.options?.hide,a=o?new Set(o.split(",").map(u=>u.trim().toLowerCase())):void 0,i=_E(r,void 0,void 0,a),s=e==="dark",l=r.title&&r.options["no-title"]!=="on"?CI:0,c=i.width+RE*2,d=i.height+RE*2+l;return ad(c,d,u=>(_I(u,r,i,n,s,void 0,{width:c,height:d}),id(u,e)))}var RE,Qj,CI,Jj,t9,e9,n9,r9,RI=st(()=>{"use strict";je();qn();an();Zg();mr();tn();je();ju();AE();Tr();Br();Dg();en();_o();RE=20,Qj=3,CI=30,Jj=4,t9=11,e9=22,n9=16,r9=8});function II(t,e){t[e]?t[e]++:t[e]=1}function PI(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function bf(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let i=o;o=a,a=i}return o+""+a+""+(r===void 0?"\0":r)}function u9(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let s=o;o=a,a=s}let i={v:o,w:a};return r&&(i.name=r),i}function DE(t,e){return bf(t,e.v,e.w,e.name)}function p9(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:m9(t),edges:g9(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function m9(t){return t.nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function g9(t){return t.edges().map(e=>{let n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function h9(t){let e=new Na(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}function KI(t,e,n,r){return b9(t,String(e),n||y9,r||function(o){return t.outEdges(o)})}function b9(t,e,n,r){let o={},a,i=0,s=t.nodes(),l=function(u){let f=n(u);o[u.v].distance+f<o[u.w].distance&&(o[u.w]={distance:o[u.v].distance+f,predecessor:u.v},a=!0)},c=function(){s.forEach(function(u){r(u).forEach(function(f){let p=f.v===u?f.v:f.w,m=p===f.v?f.w:f.v;l({v:p,w:m})})})};s.forEach(function(u){let f=u===e?0:Number.POSITIVE_INFINITY;o[u]={distance:f,predecessor:""}});let d=s.length;for(let u=1;u<d&&(a=!1,i++,c(),!!a);u++);if(i===d-1&&(a=!1,c(),a))throw new Error("The graph contains a negative weight cycle");return o}function x9(t){let e={},n=[],r;function o(a){a in e||(e[a]=!0,r.push(a),t.successors(a).forEach(o),t.predecessors(a).forEach(o))}return t.nodes().forEach(function(a){r=[],o(a),r.length&&n.push(r)}),n}function Jg(t,e,n,r){let o=function(a){return t.outEdges(a)};return E9(t,String(e),n||w9,r||o)}function E9(t,e,n,r){let o={},a=new ZI,i,s,l=function(c){let d=c.v!==i?c.v:c.w,u=o[d],f=n(c),p=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+c+" Weight: "+f);p<u.distance&&(u.distance=p,u.predecessor=i,a.decrease(d,p))};for(t.nodes().forEach(function(c){let d=c===e?0:Number.POSITIVE_INFINITY;o[c]={distance:d,predecessor:""},a.add(c,d)});a.size()>0&&(i=a.removeMin(),s=o[i],s.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}function S9(t,e,n){return t.nodes().reduce(function(r,o){return r[o]=Jg(t,o,e,n),r},{})}function QI(t){let e=0,n=[],r={},o=[];function a(i){let s=r[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(l){l in r?r[l].onStack&&(s.lowlink=Math.min(s.lowlink,r[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,r[l].lowlink))}),s.lowlink===s.index){let l=[],c;do c=n.pop(),r[c].onStack=!1,l.push(c);while(i!==c);o.push(l)}}return t.nodes().forEach(function(i){i in r||a(i)}),o}function L9(t){return QI(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}function N9(t,e,n){return M9(t,e||v9,n||function(r){return t.outEdges(r)})}function M9(t,e,n){let r={},o=t.nodes();return o.forEach(function(a){r[a]={},r[a][a]={distance:0,predecessor:""},o.forEach(function(i){a!==i&&(r[a][i]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(i){let s=i.v===a?i.w:i.v,l=e(i);r[a][s]={distance:l,predecessor:a}})}),o.forEach(function(a){let i=r[a];o.forEach(function(s){let l=r[s];o.forEach(function(c){let d=l[a],u=i[c],f=l[c],p=d.distance+u.distance;p<f.distance&&(f.distance=p,f.predecessor=u.predecessor)})})}),r}function JI(t){let e={},n={},r=[];function o(a){if(a in n)throw new th;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(o),delete n[a],r.push(a))}if(t.sinks().forEach(o),Object.keys(e).length!==t.nodeCount())throw new th;return r}function k9(t){try{JI(t)}catch(e){if(e instanceof th)return!1;throw e}return!0}function T9(t,e,n,r,o){Array.isArray(e)||(e=[e]);let a=(s=>{var l;return(l=t.isDirected()?t.successors(s):t.neighbors(s))!=null?l:[]}),i={};return e.forEach(function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);o=tP(t,s,n==="post",i,a,r,o)}),o}function tP(t,e,n,r,o,a,i){return e in r||(r[e]=!0,n||(i=a(i,e)),o(e).forEach(function(s){i=tP(t,s,n,r,o,a,i)}),n&&(i=a(i,e))),i}function eP(t,e,n){return T9(t,e,n,function(r,o){return r.push(o),r},[])}function C9(t,e){return eP(t,e,"post")}function _9(t,e){return eP(t,e,"pre")}function A9(t,e){let n=new Na,r={},o=new ZI,a;function i(l){let c=l.v===a?l.w:l.v,d=o.priority(c);if(d!==void 0){let u=e(l);u<d&&(r[c]=a,o.decrease(c,u))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(l){o.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),o.decrease(t.nodes()[0],0);let s=!1;for(;o.size()>0;){if(a=o.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(a).forEach(i)}return n}function R9(t,e,n,r){return I9(t,e,n,r??(o=>{let a=t.outEdges(o);return a??[]}))}function I9(t,e,n,r){if(n===void 0)return Jg(t,e,n,r);let o=!1,a=t.nodes();for(let i=0;i<a.length;i++){let s=r(a[i]);for(let l=0;l<s.length;l++){let c=s[l],d=c.v===a[i]?c.v:c.w,u=d===c.v?c.w:c.v;n({v:d,w:u})<0&&(o=!0)}if(o)return KI(t,e,n,r)}return Jg(t,e,n,r)}function dd(t,e,n,r){let o=r;for(;t.hasNode(o);)o=YE(r);return n.dummy=e,t.setNode(o,n),o}function P9(t){let e=new Na().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},o=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),e}function nP(t){let e=new Na({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function DI(t,e){let n=t.x,r=t.y,o=e.x-n,a=e.y-r,i=t.width/2,s=t.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let l,c;return Math.abs(a)*i>Math.abs(o)*s?(a<0&&(s=-s),l=s*o/a,c=s):(o<0&&(i=-i),l=i,c=i*a/o),{x:n+l,y:r+c}}function wf(t){let e=xf(oP(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),o=r.rank;o!==void 0&&(e[o]||(e[o]=[]),e[o][r.order]=n)}),e}function D9(t){let e=t.nodes().map(r=>{let o=t.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=_i(Math.min,e);t.nodes().forEach(r=>{let o=t.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function G9(t){let e=t.nodes().map(i=>t.node(i).rank).filter(i=>i!==void 0),n=_i(Math.min,e),r=[];t.nodes().forEach(i=>{let s=t.node(i).rank-n;r[s]||(r[s]=[]),r[s].push(i)});let o=0,a=t.graph().nodeRankFactor;Array.from(r).forEach((i,s)=>{i===void 0&&s%a!==0?--o:i!==void 0&&o&&i.forEach(l=>t.node(l).rank+=o)})}function GI(t,e,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),dd(t,"border",o,e)}function O9(t,e=rP){let n=[];for(let r=0;r<t.length;r+=e){let o=t.slice(r,r+e);n.push(o)}return n}function _i(t,e){if(e.length>rP){let n=O9(e);return t(...n.map(r=>t(...r)))}else return t(...e)}function oP(t){let e=t.nodes().map(n=>{let r=t.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return _i(Math.max,e)}function $9(t,e){let n={lhs:[],rhs:[]};return t.forEach(r=>{e(r)?n.lhs.push(r):n.rhs.push(r)}),n}function aP(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function iP(t,e){return e()}function YE(t){let e=++H9;return t+(""+e)}function xf(t,e,n=1){e==null&&(e=t,t=0);let r=a=>a<e;n<0&&(r=a=>e<a);let o=[];for(let a=t;r(a);a+=n)o.push(a);return o}function eh(t,e){let n={};for(let r of e)t[r]!==void 0&&(n[r]=t[r]);return n}function nh(t,e){let n;return typeof e=="string"?n=r=>r[e]:n=e,Object.entries(t).reduce((r,[o,a])=>(r[o]=n(a,o),r),{})}function W9(t,e){return t.reduce((n,r,o)=>(n[r]=e[o],n),{})}function OI(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Y9(t,e){if(t!=="_next"&&t!=="_prev")return e}function U9(t,e){if(t.nodeCount()<=1)return[];let n=j9(t,e||z9);return X9(n.graph,n.buckets,n.zeroIdx).flatMap(r=>t.outEdges(r.v,r.w)||[])}function X9(t,e,n){var r;let o=[],a=e[e.length-1],i=e[0],s;for(;t.nodeCount();){for(;s=i.dequeue();)GE(t,e,n,s);for(;s=a.dequeue();)GE(t,e,n,s);if(t.nodeCount()){for(let l=e.length-2;l>0;--l)if(s=(r=e[l])==null?void 0:r.dequeue(),s){o=o.concat(GE(t,e,n,s,!0)||[]);break}}}return o}function GE(t,e,n,r,o){let a=[],i=o?a:void 0;return(t.inEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=t.node(s.v);o&&a.push({v:s.v,w:s.w}),c.out-=l,FE(e,n,c)}),(t.outEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=s.w,d=t.node(c);d.in-=l,FE(e,n,d)}),t.removeNode(r.v),i}function j9(t,e){let n=new Na,r=0,o=0;t.nodes().forEach(s=>{n.setNode(s,{v:s,in:0,out:0})}),t.edges().forEach(s=>{let l=n.edge(s.v,s.w)||0,c=e(s),d=l+c;n.setEdge(s.v,s.w,d);let u=n.node(s.v),f=n.node(s.w);o=Math.max(o,u.out+=c),r=Math.max(r,f.in+=c)});let a=q9(o+r+3).map(()=>new V9),i=r+1;return n.nodes().forEach(s=>{FE(a,i,n.node(s))}),{graph:n,buckets:a,zeroIdx:i}}function FE(t,e,n){var r,o,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(o=t[t.length-1])==null||o.enqueue(n):(r=t[0])==null||r.enqueue(n)}function q9(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function K9(t){(t.graph().acyclicer==="greedy"?U9(t,e(t)):Z9(t)).forEach(n=>{let r=t.edge(n);t.removeEdge(n),r.forwardName=n.name,r.reversed=!0,t.setEdge(n.w,n.v,r,YE("rev"))});function e(n){return r=>n.edge(r).weight}}function Z9(t){let e=[],n={},r={};function o(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,t.outEdges(a).forEach(i=>{Object.hasOwn(n,i.w)?e.push(i):o(i.w)}),delete n[a])}return t.nodes().forEach(o),e}function Q9(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}function J9(t){t.graph().dummyChains=[],t.edges().forEach(e=>tq(t,e))}function tq(t,e){let n=e.v,r=t.node(n).rank,o=e.w,a=t.node(o).rank,i=e.name,s=t.edge(e),l=s.labelRank;if(a===r+1)return;t.removeEdge(e);let c,d,u;for(u=0,++r;r<a;++u,++r)s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:r},c=dd(t,"edge",d,"_d"),r===l&&(d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos),t.setEdge(n,c,{weight:s.weight},i),u===0&&t.graph().dummyChains.push(c),n=c;t.setEdge(n,o,{weight:s.weight},i)}function eq(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeLabel,o;for(t.setEdge(n.edgeObj,r);n.dummy;)o=t.successors(e)[0],t.removeNode(e),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),e=o,n=t.node(e)})}function VE(t){let e={};function n(r){let o=t.node(r);if(Object.hasOwn(e,r))return o.rank;e[r]=!0;let a=t.outEdges(r),i=a?a.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-t.edge(l).minlen):[],s=_i(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}t.sources().forEach(n)}function cd(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function nq(t){let e=new Na({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=t.nodeCount();e.setNode(r,{});let a,i;for(;rq(e,t)<o&&(a=oq(e,t),!!a);)i=e.hasNode(a.v)?cd(t,a):-cd(t,a),aq(e,t,i);return e}function rq(t,e){function n(r){let o=e.nodeEdges(r);o&&o.forEach(a=>{let i=a.v,s=r===i?a.w:i;!t.hasNode(s)&&!cd(e,a)&&(t.setNode(s,{}),t.setEdge(r,s,{}),n(s))})}return t.nodes().forEach(n),t.nodeCount()}function oq(t,e){return e.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(o=cd(e,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function aq(t,e,n){t.nodes().forEach(r=>e.node(r).rank+=n)}function Wl(t){t=P9(t),VE(t);let e=sP(t);UE(e),zE(e,t);let n,r;for(;n=dP(e);)r=uP(e,t,n),fP(e,t,n,r)}function zE(t,e){let n=sq(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(r=>cq(t,e,r))}function cq(t,e,n){let r=t.node(n).parent,o=t.edge(n,r);o.cutvalue=lP(t,e,n)}function lP(t,e,n){let r=t.node(n).parent,o=!0,a=e.edge(n,r),i=0;a||(o=!1,a=e.edge(r,n)),i=a.weight;let s=e.nodeEdges(n);return s&&s.forEach(l=>{let c=l.v===n,d=c?l.w:l.v;if(d!==r){let u=c===o,f=e.edge(l).weight;if(i+=u?f:-f,uq(t,n,d)){let p=t.edge(n,d).cutvalue;i+=u?-p:p}}}),i}function UE(t,e){arguments.length<2&&(e=t.nodes()[0]),cP(t,{},1,e)}function cP(t,e,n,r,o){let a=n,i=t.node(r);e[r]=!0;let s=t.neighbors(r);return s&&s.forEach(l=>{Object.hasOwn(e,l)||(n=cP(t,e,n,l,r))}),i.low=a,i.lim=n++,o?i.parent=o:delete i.parent,n}function dP(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function uP(t,e,n){let r=n.v,o=n.w;e.hasEdge(r,o)||(r=n.w,o=n.v);let a=t.node(r),i=t.node(o),s=a,l=!1;return a.lim>i.lim&&(s=i,l=!0),e.edges().filter(c=>l===$I(t,t.node(c.v),s)&&l!==$I(t,t.node(c.w),s)).reduce((c,d)=>cd(e,d)<cd(e,c)?d:c)}function fP(t,e,n,r){let o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),UE(t),zE(t,e),dq(t,e)}function dq(t,e){let n=t.nodes().find(o=>!t.node(o).parent);if(!n)return;let r=iq(t,[n]);r=r.slice(1),r.forEach(o=>{let a=t.node(o).parent,i=e.edge(o,a),s=!1;i||(i=e.edge(a,o),s=!0),e.node(o).rank=e.node(a).rank+(s?i.minlen:-i.minlen)})}function uq(t,e,n){return t.hasEdge(e,n)}function $I(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function pq(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":HI(t);break;case"tight-tree":gq(t);break;case"longest-path":mq(t);break;case"none":break;default:HI(t)}}function gq(t){VE(t),sP(t)}function HI(t){lq(t)}function yq(t){let e=xq(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),o=r.edgeObj,a=bq(t,e,o.v,o.w),i=a.path,s=a.lca,l=0,c=i[l],d=!0;for(;n!==o.w;){if(r=t.node(n),d){for(;(c=i[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(i[l+1]).minRank<=r.rank;)l++;c=i[l]}c!==void 0&&t.setParent(n,c),n=t.successors(n)[0]}})}function bq(t,e,n,r){let o=[],a=[],i=Math.min(e[n].low,e[r].low),s=Math.max(e[n].lim,e[r].lim),l;l=n;do l=t.parent(l),o.push(l);while(l&&(e[l].low>i||s>e[l].lim));let c=l,d=r;for(;(d=t.parent(d))!==c;)a.push(d);return{path:o.concat(a.reverse()),lca:c}}function xq(t){let e={},n=0;function r(o){let a=n;t.children(o).forEach(r),e[o]={low:a,lim:n++}}return t.children(rh).forEach(r),e}function wq(t){let e=dd(t,"root",{},"_root"),n=Eq(t),r=Object.values(n),o=_i(Math.max,r)-1,a=2*o+1;t.graph().nestingRoot=e,t.edges().forEach(s=>t.edge(s).minlen*=a);let i=Sq(t)+1;t.children(rh).forEach(s=>pP(t,e,a,i,o,n,s)),t.graph().nodeRankFactor=a}function pP(t,e,n,r,o,a,i){var s;let l=t.children(i);if(!l.length){i!==e&&t.setEdge(e,i,{weight:0,minlen:n});return}let c=GI(t,"_bt"),d=GI(t,"_bb"),u=t.node(i);t.setParent(c,i),u.borderTop=c,t.setParent(d,i),u.borderBottom=d,l.forEach(f=>{var p;pP(t,e,n,r,o,a,f);let m=t.node(f),g=m.borderTop?m.borderTop:f,h=m.borderBottom?m.borderBottom:f,S=m.borderTop?r:2*r,y=g!==h?1:o-((p=a[i])!=null?p:0)+1;t.setEdge(c,g,{weight:S,minlen:y,nestingEdge:!0}),t.setEdge(h,d,{weight:S,minlen:y,nestingEdge:!0})}),t.parent(i)||t.setEdge(e,c,{weight:0,minlen:o+((s=a[i])!=null?s:0)})}function Eq(t){let e={};function n(r,o){let a=t.children(r);a&&a.length&&a.forEach(i=>n(i,o+1)),e[r]=o}return t.children(rh).forEach(r=>n(r,1)),e}function Sq(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function Lq(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}function Nq(t){function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let a=o.minRank,i=o.maxRank+1;a<i;++a)WI(t,"borderLeft","_bl",n,o,a),WI(t,"borderRight","_br",n,o,a)}}t.children(rh).forEach(e)}function WI(t,e,n,r,o,a){let i={width:0,height:0,rank:a,borderType:e},s=o[e][a-1],l=dd(t,"border",i,n);o[e][a]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function Mq(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&mP(t)}function kq(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&Tq(t),(n==="lr"||n==="rl")&&(Cq(t),mP(t))}function mP(t){t.nodes().forEach(e=>FI(t.node(e))),t.edges().forEach(e=>FI(t.edge(e)))}function FI(t){let e=t.width;t.width=t.height,t.height=e}function Tq(t){t.nodes().forEach(e=>OE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(OE),Object.hasOwn(r,"y")&&OE(r)})}function OE(t){t.y=-t.y}function Cq(t){t.nodes().forEach(e=>$E(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach($E),Object.hasOwn(r,"x")&&$E(r)})}function $E(t){let e=t.x;t.x=t.y,t.y=e}function _q(t){let e={},n=t.nodes().filter(s=>!t.children(s).length),r=n.map(s=>t.node(s).rank),o=_i(Math.max,r),a=xf(o+1).map(()=>[]);function i(s){if(e[s])return;e[s]=!0;let l=t.node(s);a[l.rank].push(s);let c=t.successors(s);c&&c.forEach(i)}return n.sort((s,l)=>t.node(s).rank-t.node(l).rank).forEach(i),a}function Aq(t,e){let n=0;for(let r=1;r<e.length;++r)n+=Rq(t,e[r-1],e[r]);return n}function Rq(t,e,n){let r=W9(n,n.map((c,d)=>d)),o=e.flatMap(c=>{let d=t.outEdges(c);return d?d.map(u=>({pos:r[u.w],weight:t.edge(u).weight})).sort((u,f)=>u.pos-f.pos):[]}),a=1;for(;a<n.length;)a<<=1;let i=2*a-1;a-=1;let s=new Array(i).fill(0),l=0;return o.forEach(c=>{let d=c.pos+a;s[d]+=c.weight;let u=0;for(;d>0;)d%2&&(u+=s[d+1]),d=d-1>>1,s[d]+=c.weight;l+=c.weight*u}),l}function Iq(t,e=[]){return e.map(n=>{let r=t.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((a,i)=>{let s=t.edge(i),l=t.node(i.v);return{sum:a.sum+s.weight*l.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Pq(t,e){let n={};t.forEach((o,a)=>{let i={indegree:0,in:[],out:[],vs:[o.v],i:a};o.barycenter!==void 0&&(i.barycenter=o.barycenter,i.weight=o.weight),n[o.v]=i}),e.edges().forEach(o=>{let a=n[o.v],i=n[o.w];a!==void 0&&i!==void 0&&(i.indegree++,a.out.push(i))});let r=Object.values(n).filter(o=>!o.indegree);return Dq(r)}function Dq(t){let e=[];function n(o){return a=>{a.merged||(a.barycenter===void 0||o.barycenter===void 0||a.barycenter>=o.barycenter)&&Gq(o,a)}}function r(o){return a=>{a.in.push(o),--a.indegree===0&&t.push(a)}}for(;t.length;){let o=t.pop();e.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return e.filter(o=>!o.merged).map(o=>eh(o,["vs","i","barycenter","weight"]))}function Gq(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}function Oq(t,e){let n=$9(t,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,u)=>u.i-d.i),a=[],i=0,s=0,l=0;r.sort($q(!!e)),l=BI(a,o,l),r.forEach(d=>{l+=d.vs.length,a.push(d.vs),i+=d.barycenter*d.weight,s+=d.weight,l=BI(a,o,l)});let c={vs:a.flat(1)};return s&&(c.barycenter=i/s,c.weight=s),c}function BI(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}function $q(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function gP(t,e,n,r){let o=t.children(e),a=t.node(e),i=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};i&&(o=o.filter(f=>f!==i&&f!==s));let c=Iq(t,o);c.forEach(f=>{if(t.children(f.v).length){let p=gP(t,f.v,n,r);l[f.v]=p,Object.hasOwn(p,"barycenter")&&Wq(f,p)}});let d=Pq(c,n);Hq(d,l);let u=Oq(d,r);if(i&&s){u.vs=[i,u.vs,s].flat(1);let f=t.predecessors(i);if(f&&f.length){let p=t.node(f[0]),m=t.predecessors(s),g=t.node(m[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+g.order)/(u.weight+2),u.weight+=2}}return u}function Hq(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(r=>e[r]?e[r].vs:r)})}function Wq(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function Fq(t,e,n,r){r||(r=t.nodes());let o=Bq(t),a=new Na({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(i=>t.node(i));return r.forEach(i=>{let s=t.node(i),l=t.parent(i);if(s.rank===e||s.minRank<=e&&e<=s.maxRank){a.setNode(i),a.setParent(i,l||o);let c=t[n](i);c&&c.forEach(d=>{let u=d.v===i?d.w:d.v,f=a.edge(u,i),p=f!==void 0?f.weight:0;a.setEdge(u,i,{weight:t.edge(d).weight+p})}),Object.hasOwn(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]})}}),a}function Bq(t){let e;for(;t.hasNode(e=YE("_root")););return e}function Yq(t,e,n){let r={},o;n.forEach(a=>{let i=t.parent(a),s,l;for(;i;){if(s=t.parent(i),s?(l=r[s],r[s]=i):(l=o,o=i),l&&l!==i){e.setEdge(l,i);return}i=s}})}function hP(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,hP);return}let n=oP(t),r=YI(t,xf(1,n+1),"inEdges"),o=YI(t,xf(n-1,-1,-1),"outEdges"),a=_q(t);if(VI(t,a),e.disableOptimalOrderHeuristic)return;let i=Number.POSITIVE_INFINITY,s,l=e.constraints||[];for(let c=0,d=0;d<4;++c,++d){Vq(c%2?r:o,c%4>=2,l),a=wf(t);let u=Aq(t,a);u<i?(d=0,s=Object.assign({},a),i=u):u===i&&(s=structuredClone(a))}VI(t,s)}function YI(t,e,n){let r=new Map,o=(a,i)=>{r.has(a)||r.set(a,[]),r.get(a).push(i)};for(let a of t.nodes()){let i=t.node(a);if(typeof i.rank=="number"&&o(i.rank,a),typeof i.minRank=="number"&&typeof i.maxRank=="number")for(let s=i.minRank;s<=i.maxRank;s++)s!==i.rank&&o(s,a)}return e.map(function(a){return Fq(t,a,n,r.get(a)||[])})}function Vq(t,e,n){let r=new Na;t.forEach(function(o){n.forEach(s=>r.setEdge(s.left,s.right));let a=o.graph().root,i=gP(o,a,r,e);i.vs.forEach((s,l)=>o.node(s).order=l),Yq(o,r,i.vs)})}function VI(t,e){Object.values(e).forEach(n=>n.forEach((r,o)=>t.node(r).order=o))}function zq(t,e){let n={};function r(o,a){let i=0,s=0,l=o.length,c=a[a.length-1];return a.forEach((d,u)=>{let f=Xq(t,d),p=f?t.node(f).order:l;(f||d===c)&&(a.slice(s,u+1).forEach(m=>{let g=t.predecessors(m);g&&g.forEach(h=>{let S=t.node(h),y=S.order;(y<i||p<y)&&!(S.dummy&&t.node(m).dummy)&&yP(n,h,m)})}),s=u+1,i=p)}),a}return e.length&&e.reduce(r),n}function Uq(t,e){let n={};function r(a,i,s,l,c){xf(i,s).forEach(d=>{let u=a[d];if(u!==void 0&&t.node(u).dummy){let f=t.predecessors(u);f&&f.forEach(p=>{if(p===void 0)return;let m=t.node(p);m.dummy&&(m.order<l||m.order>c)&&yP(n,p,u)})}})}function o(a,i){let s=-1,l=-1,c=0;return i.forEach((d,u)=>{if(t.node(d).dummy==="border"){let f=t.predecessors(d);if(f&&f.length){let p=f[0];if(p===void 0)return;l=t.node(p).order,r(i,c,u,s,l),c=u,s=l}}r(i,c,i.length,l,a.length)}),i}return e.length&&e.reduce(o),n}function Xq(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(r=>t.node(r).dummy)}}function yP(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];r||(t[e]=r={}),r[n]=!0}function jq(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];return r!==void 0&&Object.hasOwn(r,n)}function qq(t,e,n,r){let o={},a={},i={};return e.forEach(s=>{s.forEach((l,c)=>{o[l]=l,a[l]=l,i[l]=c})}),e.forEach(s=>{let l=-1;s.forEach(c=>{let d=r(c);if(d&&d.length){let u=d.sort((p,m)=>{let g=i[p],h=i[m];return(g!==void 0?g:0)-(h!==void 0?h:0)}),f=(u.length-1)/2;for(let p=Math.floor(f),m=Math.ceil(f);p<=m;++p){let g=u[p];if(g===void 0)continue;let h=i[g];if(h!==void 0&&a[c]===c&&l<h&&!jq(n,c,g)){let S=o[g];S!==void 0&&(a[g]=c,a[c]=o[c]=S,l=h)}}}})}),{root:o,align:a}}function Kq(t,e,n,r,o=!1){let a={},i=Zq(t,e,n,o),s=o?"borderLeft":"borderRight";function l(p,m){let g=i.nodes().slice(),h={},S=g.pop();for(;S;){if(h[S])p(S);else{h[S]=!0,g.push(S);for(let y of m(S))g.push(y)}S=g.pop()}}function c(p){let m=i.inEdges(p);m?a[p]=m.reduce((g,h)=>{var S;let y=(S=a[h.v])!=null?S:0,b=i.edge(h);return Math.max(g,y+(b!==void 0?b:0))},0):a[p]=0}function d(p){let m=i.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=m.reduce((S,y)=>{let b=a[y.w],E=i.edge(y);return Math.min(S,(b!==void 0?b:0)-(E!==void 0?E:0))},Number.POSITIVE_INFINITY));let h=t.node(p);g!==Number.POSITIVE_INFINITY&&h.borderType!==s&&(a[p]=Math.max(a[p]!==void 0?a[p]:0,g))}function u(p){return i.predecessors(p)||[]}function f(p){return i.successors(p)||[]}return l(c,u),l(d,f),Object.keys(r).forEach(p=>{var m;let g=n[p];g!==void 0&&(a[p]=(m=a[g])!=null?m:0)}),a}function Zq(t,e,n,r){let o=new Na,a=t.graph(),i=nK(a.nodesep,a.edgesep,r);return e.forEach(s=>{let l;s.forEach(c=>{let d=n[c];if(d!==void 0){if(o.setNode(d),l!==void 0){let u=n[l];if(u!==void 0){let f=o.edge(u,d);o.setEdge(u,d,Math.max(i(t,c,l),f||0))}}l=c}})}),o}function Qq(t,e){return Object.values(e).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,l])=>{let c=rK(t,s)/2;o=Math.max(l+c,o),a=Math.min(l-c,a)});let i=o-a;return i<n[0]&&(n=[i,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function Jq(t,e){let n=Object.values(e),r=_i(Math.min,n),o=_i(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(i=>{let s=a+i,l=t[s];if(!l||l===e)return;let c=Object.values(l),d=r-_i(Math.min,c);i!=="l"&&(d=o-_i(Math.max,c)),d&&(t[s]=nh(l,u=>u+d))})})}function tK(t,e=void 0){let n=t.ul;return n?nh(n,(r,o)=>{var a,i;if(e){let l=e.toLowerCase(),c=t[l];if(c&&c[o]!==void 0)return c[o]}let s=Object.values(t).map(l=>{let c=l[o];return c!==void 0?c:0}).sort((l,c)=>l-c);return(((a=s[1])!=null?a:0)+((i=s[2])!=null?i:0))/2}):{}}function eK(t){let e=wf(t),n=Object.assign(zq(t,e),Uq(t,e)),r={},o;["u","d"].forEach(i=>{o=i==="u"?e:Object.values(e).reverse(),["l","r"].forEach(s=>{s==="r"&&(o=o.map(d=>Object.values(d).reverse()));let l=qq(t,o,n,d=>(i==="u"?t.predecessors(d):t.successors(d))||[]),c=Kq(t,o,l.root,l.align,s==="r");s==="r"&&(c=nh(c,d=>-d)),r[i+s]=c})});let a=Qq(t,r);return Jq(r,a),tK(r,t.graph().align)}function nK(t,e,n){return(r,o,a)=>{let i=r.node(o),s=r.node(a),l=0,c;if(l+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":c=-i.width/2;break;case"r":c=i.width/2;break}if(c&&(l+=n?c:-c),c=void 0,l+=(i.dummy?e:t)/2,l+=(s.dummy?e:t)/2,l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=s.width/2;break;case"r":c=-s.width/2;break}return c&&(l+=n?c:-c),l}}function rK(t,e){return t.node(e).width}function oK(t){t=nP(t),aK(t),Object.entries(eK(t)).forEach(([e,n])=>t.node(e).x=n)}function aK(t){let e=wf(t),n=t.graph(),r=n.ranksep,o=n.rankalign,a=0;e.forEach(i=>{let s=i.reduce((l,c)=>{var d;let u=(d=t.node(c).height)!=null?d:0;return l>u?l:u},0);i.forEach(l=>{let c=t.node(l);o==="top"?c.y=a+c.height/2:o==="bottom"?c.y=a+s-c.height/2:c.y=a+s/2}),a+=s+r})}function iK(t,e={}){let n=e.debugTiming?aP:iP;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>hK(t));return n(" runLayout",()=>sK(r,n,e)),n(" updateInputGraph",()=>lK(t,r)),r})}function sK(t,e,n){e(" makeSpaceForEdgeLabels",()=>yK(t)),e(" removeSelfEdges",()=>MK(t)),e(" acyclic",()=>K9(t)),e(" nestingGraph.run",()=>wq(t)),e(" rank",()=>fq(nP(t))),e(" injectEdgeLabelProxies",()=>bK(t)),e(" removeEmptyRanks",()=>G9(t)),e(" nestingGraph.cleanup",()=>Lq(t)),e(" normalizeRanks",()=>D9(t)),e(" assignRankMinMax",()=>xK(t)),e(" removeEdgeLabelProxies",()=>wK(t)),e(" normalize.run",()=>J9(t)),e(" parentDummyChains",()=>hq(t)),e(" addBorderSegments",()=>vq(t)),e(" order",()=>hP(t,n)),e(" insertSelfEdges",()=>kK(t)),e(" adjustCoordinateSystem",()=>Mq(t)),e(" position",()=>oK(t)),e(" positionSelfEdges",()=>TK(t)),e(" removeBorderNodes",()=>NK(t)),e(" normalize.undo",()=>eq(t)),e(" fixupEdgeLabelCoords",()=>LK(t)),e(" undoCoordinateSystem",()=>kq(t)),e(" translateGraph",()=>EK(t)),e(" assignNodeIntersects",()=>SK(t)),e(" reversePoints",()=>vK(t)),e(" acyclic.undo",()=>Q9(t))}function lK(t,e){t.nodes().forEach(n=>{let r=t.node(n),o=e.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,e.children(n).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(n=>{let r=t.edge(n),o=e.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function hK(t){let e=new Na({multigraph:!0,compound:!0}),n=WE(t.graph());return e.setGraph(Object.assign({},dK,HE(n,cK),eh(n,uK))),t.nodes().forEach(r=>{let o=WE(t.node(r)),a=HE(o,fK);Object.keys(zI).forEach(s=>{a[s]===void 0&&(a[s]=zI[s])}),e.setNode(r,a);let i=t.parent(r);i!==void 0&&e.setParent(r,i)}),t.edges().forEach(r=>{let o=WE(t.edge(r));e.setEdge(r,Object.assign({},mK,HE(o,pK),eh(o,gK)))}),e}function yK(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function bK(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let r=t.node(e.v),o={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};dd(t,"edge-proxy",o,"_ep")}})}function xK(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}function wK(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let r=n;t.edge(r.e).labelRank=n.rank,t.removeNode(e)}})}function EK(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,a=t.graph(),i=a.marginx||0,s=a.marginy||0;function l(c){let d=c.x,u=c.y,f=c.width,p=c.height;e=Math.min(e,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,u-p/2),o=Math.max(o,u+p/2)}t.nodes().forEach(c=>l(t.node(c))),t.edges().forEach(c=>{let d=t.edge(c);Object.hasOwn(d,"x")&&l(d)}),e-=i,r-=s,t.nodes().forEach(c=>{let d=t.node(c);d.x-=e,d.y-=r}),t.edges().forEach(c=>{let d=t.edge(c);d.points.forEach(u=>{u.x-=e,u.y-=r}),Object.hasOwn(d,"x")&&(d.x-=e),Object.hasOwn(d,"y")&&(d.y-=r)}),a.width=n-e+i,a.height=o-r+s}function SK(t){t.edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),a,i;n.points?(a=n.points[0],i=n.points[n.points.length-1]):(n.points=[],a=o,i=r),n.points.unshift(DI(r,a)),n.points.push(DI(o,i))})}function LK(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function vK(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function NK(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),i=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(i.x-a.x),n.height=Math.abs(o.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function MK(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function kK(t){wf(t).forEach(e=>{let n=0;e.forEach((r,o)=>{let a=t.node(r);a.order=o+n,(a.selfEdges||[]).forEach(i=>{dd(t,"selfedge",{width:i.label.width,height:i.label.height,rank:a.rank,order:o+ ++n,e:i.e,label:i.label},"_se")}),delete a.selfEdges})})}function TK(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let r=n,o=t.node(r.e.v),a=o.x+o.width/2,i=o.y,s=n.x-a,l=o.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],r.label.x=n.x,r.label.y=n.y}})}function HE(t,e){return nh(eh(t,e),Number)}function WE(t){let e={};return t&&Object.entries(t).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=r}),e}function CK(t){let e=wf(t),n=new Na({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+t.node(r).rank)}),t.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),e.forEach((r,o)=>{let a="layer"+o;n.setNode(a,{rank:"same"}),r.reduce((i,s)=>(n.setEdge(i,s,{style:"invis"}),s))}),n}var UI,s9,l9,c9,XI,d9,jI,Na,f9,qI,BE,y9,ZI,w9,v9,th,rP,H9,rh,F9,B9,V9,z9,sP,iq,sq,lq,fq,mq,hq,vq,cK,dK,uK,fK,zI,pK,mK,gK,_K,rr,os=st(()=>{"use strict";UI=Object.defineProperty,s9=(t,e,n)=>e in t?UI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l9=(t,e)=>{for(var n in e)UI(t,n,{get:e[n],enumerable:!0})},c9=(t,e,n)=>s9(t,typeof e!="symbol"?e+"":e,n),XI={};l9(XI,{Graph:()=>Na,alg:()=>BE,json:()=>qI,version:()=>f9});d9=Object.defineProperty,jI=(t,e)=>{for(var n in e)d9(t,n,{get:e[n],enumerable:!0})},Na=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let r of this.successors(t))n.add(r);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,a])=>{t(o)&&e.setNode(o,a)}),Object.values(this._edgeObjs).forEach(o=>{e.hasNode(o.v)&&e.hasNode(o.w)&&e.setEdge(o,this.edge(o))});let n={},r=o=>{let a=this.parent(o);return!a||e.hasNode(a)?(n[o]=a??void 0,a??void 0):a in n?n[a]:r(a)};return this._isCompound&&e.nodes().forEach(o=>e.setParent(o,r(o))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,r)=>(e!==void 0?this.setEdge(n,r,e):this.setEdge(n,r),r)),this}setEdge(t,e,n,r){let o,a,i,s,l=!1;typeof t=="object"&&t!==null&&"v"in t?(o=t.v,a=t.w,i=t.name,arguments.length===2&&(s=e,l=!0)):(o=t,a=e,i=r,arguments.length>2&&(s=n,l=!0)),o=""+o,a=""+a,i!==void 0&&(i=""+i);let c=bf(this._isDirected,o,a,i);if(c in this._edgeLabels)return l&&(this._edgeLabels[c]=s),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(a),this._edgeLabels[c]=l?s:this._defaultEdgeLabelFn(o,a,i);let d=u9(this._isDirected,o,a,i);return o=d.v,a=d.w,Object.freeze(d),this._edgeObjs[c]=d,II(this._preds[a],o),II(this._sucs[o],a),this._in[a][c]=d,this._out[o][c]=d,this._edgeCount++,this}edge(t,e,n){let r=arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(t,e,n){let r=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof r!="object"?{label:r}:r}hasEdge(t,e,n){return(arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let r=arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n),o=this._edgeObjs[r];if(o){let a=o.v,i=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],PI(this._preds[i],a),PI(this._sucs[a],i),delete this._in[i][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let r=Object.values(t);return n?r.filter(o=>o.v===e&&o.w===n||o.v===n&&o.w===e):r}};f9="4.0.1",qI={};jI(qI,{read:()=>h9,write:()=>p9});BE={};jI(BE,{CycleException:()=>th,bellmanFord:()=>KI,components:()=>x9,dijkstra:()=>Jg,dijkstraAll:()=>S9,findCycles:()=>L9,floydWarshall:()=>N9,isAcyclic:()=>k9,postorder:()=>C9,preorder:()=>_9,prim:()=>A9,shortestPaths:()=>R9,tarjan:()=>QI,topsort:()=>JI});y9=()=>1;ZI=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,r=String(t);if(!(r in n)){let o=this._arr,a=o.length;return n[r]=a,o.push({key:r,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let r=this._arr[n].priority;if(e>r)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${r} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,r=n+1,o=t;n<e.length&&(o=e[n].priority<e[o].priority?n:o,r<e.length&&(o=e[r].priority<e[o].priority?r:o),o!==t&&(this._swap(t,o),this._heapify(o)))}_decrease(t){let e=this._arr,n=e[t].priority,r;for(;t!==0&&(r=t>>1,!(e[r].priority<n));)this._swap(t,r),t=r}_swap(t,e){let n=this._arr,r=this._keyIndices,o=n[t],a=n[e];n[t]=a,n[e]=o,r[a.key]=t,r[o.key]=e}},w9=()=>1;v9=()=>1;th=class extends Error{constructor(...t){super(...t)}};rP=65535;H9=0;rh="\0",F9="3.0.0",B9=class{constructor(){c9(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return OI(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&OI(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,Y9)),n=n._prev;return"["+t.join(", ")+"]"}};V9=B9,z9=()=>1;sP=nq;({preorder:iq,postorder:sq}=BE),lq=Wl;Wl.initLowLimValues=UE;Wl.initCutValues=zE;Wl.calcCutValue=lP;Wl.leaveEdge=dP;Wl.enterEdge=uP;Wl.exchangeEdges=fP;fq=pq;mq=VE;hq=yq;vq=Nq;cK=["nodesep","edgesep","ranksep","marginx","marginy"],dK={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},uK=["acyclicer","ranker","rankdir","align","rankalign"],fK=["width","height","rank"],zI={width:0,height:0},pK=["minlen","weight","width","height","labeloffset"],mK={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},gK=["labelpos"];_K={graphlib:XI,version:F9,layout:iK,debug:CK,util:{time:aP,notime:iP}},rr=_K;});var qE={};ye(qE,{layoutSitemap:()=>FK});function xP(t,e,n,r,o,a){let i=o-t,s=a-e;if(i===0&&s===0)return{x:t,y:e};let l=n/2,c=r/2,d=i!==0?l/Math.abs(i):1/0,u=s!==0?c/Math.abs(s):1/0,f=Math.min(d,u);return{x:t+i*f,y:e+s*f}}function GK(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function OK(t,e,n){let r=_t(t,AK);for(let[o,a]of Object.entries(e)){let i=_t(`${o}: ${a}`,bP);i>r&&(r=i)}if(n)for(let o of n){let a=_t(o,bP);a>r&&(r=a)}return Math.max(NP,Math.ceil(r)+vP*2)}function $K(t,e=0){let r=Object.keys(t).length+e;return r===0?wP+EP:wP+PK+r*IK+EP}function LP(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n,t.isContainer)}function WK(t,e){let n=[];for(let r of t){if(r.entries.length===0)continue;let o=e?.get(qt(r.name)),a=o?r.entries.filter(u=>o.has(u.value.toLowerCase())):r.entries;if(a.length===0)continue;let i=Fe(r.name,cr)+po,s=i,l=0;for(let u of a)l+=Er*2+kr+Fe(u.value,Xn)+Kr;let c=Co+wi,d=In*2+i+4+c+l;n.push({name:r.name,...r.alias!==void 0&&{alias:r.alias},entries:a.map(u=>({value:u.value,color:u.color})),x:0,y:0,width:d,height:Se,minifiedWidth:s,minifiedHeight:Se})}return n}function jE(t,e,n,r,o,a){for(let i of t){let s=GK(i.metadata,o);if(i.isContainer){let l=Object.keys(s).length,c=MP+l*kP;a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:Math.max(NP,_t(i.label,RK)+vP*2),height:c+XE}),jE(i.children,i.id,n,r,o,a)}else a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:OK(i.label,s,i.description),height:$K(s,i.description?.length??0)}),i.children.length>0&&jE(i.children,e,i.id,r,o,a)}}function FK(t,e,n,r,o){if(t.roots.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let a=[],i=v=>{a.push(v);for(let M of v.children)i(M)};for(let v of t.roots)i(v);wa(a,t.tagGroups,v=>v.isContainer);let s=[];jE(t.roots,null,null,e,r,s);let l=new Map;for(let v of s)l.set(v.sitemapNode.id,v);let c=new rr.graphlib.Graph({compound:!0,multigraph:!0});c.setGraph({rankdir:t.direction,nodesep:50,ranksep:60,edgesep:30,marginx:Fl,marginy:Fl}),c.setDefaultEdgeLabel(()=>({}));let d=new Set,u=new Set,f=new Set;for(let v of s)v.sitemapNode.isContainer?(d.add(v.sitemapNode.id),(e?.get(v.sitemapNode.id)??0)>0&&f.add(v.sitemapNode.id)):u.add(v.sitemapNode.id);let p=0,m=0;for(let v of s)v.sitemapNode.isContainer||(v.width>p&&(p=v.width),v.height>m&&(m=v.height));for(let v of s){let M=v.sitemapNode;if(M.isContainer)if(f.has(M.id)){let _=Math.max(v.width,p),T=Math.max(v.height,m);c.setNode(M.id,{label:M.label,width:_,height:T})}else c.setNode(M.id,{label:M.label,paddingLeft:SP,paddingRight:SP,paddingTop:DK,paddingBottom:XE});else c.setNode(M.id,{label:M.label,width:v.width,height:v.height})}for(let v of s)v.parentContainerId&&!f.has(v.parentContainerId)&&c.setParent(v.sitemapNode.id,v.parentContainerId);let g=new Set;for(let v of d)f.has(v)||g.add(v);let h=[];for(let v=0;v<t.edges.length;v++){let M=t.edges[v];if(!(!c.hasNode(M.sourceId)||!c.hasNode(M.targetId))){if(g.has(M.sourceId)||g.has(M.targetId)){h.push(v);continue}c.setEdge(M.sourceId,M.targetId,{label:M.label??"",minlen:1},`e${v}`)}}rr.layout(c);let S=[],y=[];for(let v of s){let M=v.sitemapNode;if(M.isContainer)continue;let _=c.node(M.id);if(!_)continue;let T=e?.get(M.id),R=LP(M,t.tagGroups,n??null);S.push({id:M.id,label:M.label,metadata:v.meta,tagMetadata:v.fullMeta,...M.description!==void 0&&{description:[...M.description]},isContainer:!1,lineNumber:M.lineNumber,...R!==void 0&&{color:R},x:_.x,y:_.y-_.height/2,width:_.width,height:_.height,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}for(let v of s){let M=v.sitemapNode;if(!M.isContainer)continue;let _=c.node(M.id),T=e?.get(M.id),R=Object.keys(v.meta).length,O=MP+R*kP,I=LP(M,t.tagGroups,n??null);if(_)y.push({nodeId:M.id,label:M.label,lineNumber:M.lineNumber,...I!==void 0&&{color:I},metadata:v.meta,tagMetadata:v.fullMeta,x:_.x-_.width/2,y:_.y-_.height/2,width:_.width,height:_.height,labelHeight:O,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}});else{let H=f.has(M.id),G=H?Math.max(v.width,p):v.width,D=H?v.height:O+XE,W=H?Math.max(D,m):D;y.push({nodeId:M.id,label:M.label,lineNumber:M.lineNumber,...I!==void 0&&{color:I},metadata:v.meta,tagMetadata:v.fullMeta,x:Fl,y:Fl,width:G,height:W,labelHeight:O,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}}let b=new Set(h),E=[];for(let v=0;v<t.edges.length;v++){let M=t.edges[v];if(!c.hasNode(M.sourceId)||!c.hasNode(M.targetId))continue;let _;if(b.has(v)){let T=c.node(M.sourceId),R=c.node(M.targetId);if(!T||!R)continue;let O=xP(T.x,T.y,T.width,T.height,R.x,R.y),I=xP(R.x,R.y,R.width,R.height,T.x,T.y),H=(O.x+I.x)/2,G=(O.y+I.y)/2;_=[O,{x:H,y:G},I]}else{let T=c.edge({v:M.sourceId,w:M.targetId,name:`e${v}`});if(!T)continue;_=T.points??[]}E.push({sourceId:M.sourceId,targetId:M.targetId,points:_,...M.label!==void 0&&{label:M.label},lineNumber:M.lineNumber,...b.has(v)&&{deferred:!0}})}{let v=new Set([...u,...f]),M=new Map;for(let G of v)M.set(G,G);let _=G=>{for(;M.get(G)!==G;)M.set(G,M.get(M.get(G))),G=M.get(G);return G},T=(G,D)=>{let W=_(G),V=_(D);W!==V&&M.set(W,V)};for(let G of t.edges)v.has(G.sourceId)&&v.has(G.targetId)&&T(G.sourceId,G.targetId);let R=s.find(G=>!G.sitemapNode.isContainer)?.sitemapNode.id,O=R?_(R):null,I=new Set;for(let G of v)O&&_(G)!==O&&I.add(G);let H=new Set;for(let G of d){if(f.has(G)){I.has(G)&&H.add(G);continue}let D=s.filter(W=>!W.sitemapNode.isContainer&&W.parentContainerId===G);D.length>0&&D.every(W=>I.has(W.sitemapNode.id))&&H.add(G)}if(I.size>0){let G=t.direction==="TB",D=0,W=0,V=1/0,P=1/0;for(let K of S)I.has(K.id)||(D=Math.max(D,K.x+K.width/2),W=Math.max(W,K.y+K.height),V=Math.min(V,K.y),P=Math.min(P,K.x-K.width/2));for(let K of y)H.has(K.nodeId)||(D=Math.max(D,K.x+K.width),W=Math.max(W,K.y+K.height),V=Math.min(V,K.y),P=Math.min(P,K.x));let F=1/0,Y=1/0,z=0,j=0;for(let K of S)I.has(K.id)&&(F=Math.min(F,K.x-K.width/2),Y=Math.min(Y,K.y),z=Math.max(z,K.x+K.width/2),j=Math.max(j,K.y+K.height));for(let K of y)H.has(K.nodeId)&&(F=Math.min(F,K.x),Y=Math.min(Y,K.y),z=Math.max(z,K.x+K.width),j=Math.max(j,K.y+K.height));if(F!==1/0){let K=HK*2,$,U;if(G?($=D+K-F,U=(V===1/0?0:V)-Y):($=(P===1/0?0:P)-F,U=W+K-Y),$!==0||U!==0){for(let X of S)I.has(X.id)&&(X.x+=$,X.y+=U);for(let X of y)H.has(X.nodeId)&&(X.x+=$,X.y+=U);for(let X of E){let q=I.has(X.sourceId),et=I.has(X.targetId);if(q||et)for(let tt of X.points)tt.x+=$,tt.y+=U}}}}}let x=0,N=0;for(let v of S){let M=v.x+v.width/2,_=v.y+v.height;M>x&&(x=M),_>N&&(N=_)}for(let v of y){let M=v.x+v.width,_=v.y+v.height;M>x&&(x=M),_>N&&(N=_)}for(let v of E)for(let M of v.points)M.x>x&&(x=M.x),M.y>N&&(N=M.y);x+=Fl,N+=Fl;let L=new Map;for(let v of t.tagGroups){let M=qt(v.name),_=new Set,T=R=>{!R.isContainer&&R.metadata[M]&&_.add(R.metadata[M].toLowerCase());for(let O of R.children)T(O)};for(let R of t.roots)T(R);L.set(M,_)}let A=WK(t.tagGroups,L),C=n!=null?A.filter(v=>v.name.toLowerCase()===n.toLowerCase()):A,k=o&&n==null,w=v=>n!=null||k?v.width:v.minifiedWidth;if(C.length>0){let v=Se+Bn,M=C.reduce((O,I)=>O+w(I),0)+(C.length-1)*Bn,_=M+Fl*2;_>x&&(x=_);let T=(x-M)/2,R=N+Bn;for(let O of C)O.x=T,O.y=R,T+=w(O)+Bn;N+=v}return{nodes:S,edges:E,containers:y,legend:A,width:x,height:N}}var AK,bP,RK,IK,wP,PK,vP,EP,NP,Fl,SP,DK,XE,MP,kP,HK,KE=st(()=>{"use strict";je();os();je();Tr();en();AK=13,bP=11,RK=13;IK=16,wP=28,PK=6,vP=20,EP=10,NP=140,Fl=40,SP=24,DK=40,XE=24,MP=28,kP=16;HK=20});function BK(t,e){let n=new Map,r=o=>{for(let a of o)for(let i of e.getChildren(a))n.set(e.getId(i),e.getId(a)),r([i])};return r(t),n}function TP(t,e,n,r){let o=t;for(;;){let a=e.get(o);if(!a)return null;if(n.has(a)&&r.has(a))return a;o=a}}function CP(t,e,n,r,o,a){let i=SI(e,o),s=BK(t,o),l=[];for(let c of n){let d=a.getSource(c),u=a.getTarget(c),f=i.has(d),p=i.has(u);if(f&&p){l.push(a.withEndpoints(c,d,u));continue}if(!f){let m=TP(d,s,i,r);if(!m)continue;d=m}if(!p){let m=TP(u,s,i,r);if(!m)continue;u=m}d!==u&&l.push(a.withEndpoints(c,d,u))}return l}var _P=st(()=>{"use strict";yf()});var IP={};ye(IP,{collapseSitemapTree:()=>VK});function RP(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(RP),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function VK(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=od(t.roots,e,AP),o=CP(t.roots,n,t.edges,e,AP,YK);return{parsed:{...t,roots:n,edges:o},hiddenCounts:r}}var AP,YK,PP=st(()=>{"use strict";yf();_P();AP={getId:t=>t.id,getChildren:t=>t.children,clone:RP,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer},YK={getSource:t=>t.sourceId,getTarget:t=>t.targetId,withEndpoints:(t,e,n)=>({...t,sourceId:e,targetId:n})}});var OP={};ye(OP,{renderSitemap:()=>GP,renderSitemapForExport:()=>n7});function KK(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function ZK(t,e){return e??t.primary}function QK(t,e,n){return n?Ot(n,or(t,e),10):Ot(t.surface,t.bg,40)}function JK(t,e){return e??t.textMuted}function GP(t,e,n,r,o,a,i,s,l,c){It(t).selectAll(":not([data-d3-tooltip])").remove();let d=i?.width??t.clientWidth,u=i?.height??t.clientHeight;if(d<=0||u<=0)return;let f=Ee.identity(),p=f.aesthetic(zK),m=f.text(13),g=f.text(11),h=f.structural(16),S=f.structural(28),y=f.structural(6),b=f.structural(1.5),E=f.structural(1.5),x=f.text(jK),N=f.text(13),L=f.text(11),A=f.structural(16),C=f.structural(28),k=f.text(20),w=f.structural(XK),v=f.structural(6),M=f.aesthetic(qK),_=n.legend.length>0,T=Se+Bn,R=!!e.title&&e.options["no-title"]!=="on",O=!i&&_,I=O&&R,H=I?w:0,G=f.structural(O?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Co+wi},d):Se),D=O?G+M:0,W=H+D,V=0,P=!I&&R?w:0,F=n.width,Y=n.height+P;O&&(Y-=T);let z=u-p*2-W-V,j=(d-p*2)/F,K=z/Y,$=Math.min(UK,j,K),U=F*$,X=(d-U)/2,q=p+W,et=It(t).append("svg").attr("width",d).attr("height",u).attr("viewBox",`0 0 ${d} ${u}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);f.isBelowFloor&&et.attr("width","100%");let tt=et.append("defs");tt.append("marker").attr("id","sm-arrow").attr("viewBox",`0 0 ${qs} ${Ai}`).attr("refX",qs).attr("refY",Ai/2).attr("markerWidth",qs).attr("markerHeight",Ai).attr("orient","auto").append("polygon").attr("points",`0,0 ${qs},${Ai/2} 0,${Ai}`).attr("fill",r.textMuted);let B=new Set;for(let J of B){let at=`sm-arrow-${J.replace("#","")}`;tt.append("marker").attr("id",at).attr("viewBox",`0 0 ${qs} ${Ai}`).attr("refX",qs).attr("refY",Ai/2).attr("markerWidth",qs).attr("markerHeight",Ai).attr("orient","auto").append("polygon").attr("points",`0,0 ${qs},${Ai/2} 0,${Ai}`).attr("fill",J)}let Q=et.append("g").attr("transform",`translate(${X}, ${q}) scale(${$})`);if(!I&&R){let J=Q.append("text").attr("x",F/2).attr("y",k).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").attr("class","sitemap-title chart-title");e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}let ot=O?-T:0,Z=Q.append("g").attr("transform",`translate(0, ${P+ot})`),lt=new Map,nt=new Map;for(let J of e.tagGroups){lt.set(qt(J.name),J.name);for(let at of J.entries)nt.set(`${qt(J.name)}:${at.value.toLowerCase()}`,at.color)}for(let J of n.containers){let at=Z.append("g").attr("transform",`translate(${J.x}, ${J.y})`).attr("class","sitemap-container").attr("data-line-number",String(J.lineNumber));if(J.hasChildren&&at.attr("data-node-toggle",J.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)).attr("aria-label",J.label),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let At=qt(s),rt=J.tagMetadata[At];rt&&at.attr(`data-tag-${At}`,rt.toLowerCase())}let it=QK(r,o,J.color),Lt=JK(r,J.color);at.append("rect").attr("x",0).attr("y",0).attr("width",J.width).attr("height",J.height).attr("rx",8).attr("fill",it).attr("stroke",Lt).attr("stroke-opacity",.35).attr("stroke-width",E),at.append("text").attr("x",J.width/2).attr("y",C/2+N/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",N).attr("font-weight","bold").text(J.label);let Tt=Object.entries(J.metadata);if(Tt.length>0){let At=Tt.map(([dt])=>lt.get(dt)??dt),pt=10+Math.max(...At.map(dt=>_t(`${dt}: `,L))),gt=C+L-2;for(let dt=0;dt<Tt.length;dt++){let[ut,yt]=Tt[dt],vt=At[dt],Gt=gt+dt*A,Xt=nt.get(`${ut}:${yt.toLowerCase()}`)??r.text;at.append("text").attr("x",10).attr("y",Gt).attr("fill",r.textMuted).attr("font-size",L).text(`${vt}: `),at.append("text").attr("x",pt).attr("y",Gt).attr("fill",Xt).attr("font-size",L).text(yt)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let At=`clip-${J.nodeId}`;at.append("clipPath").attr("id",At).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",8),at.append("rect").attr("y",J.height-v).attr("width",J.width).attr("height",v).attr("fill",Lt).attr("clip-path",`url(#${At})`).attr("class","sitemap-collapse-bar")}}for(let J of n.edges){if(J.points.length<2)continue;let at=Z.append("g").attr("class","sitemap-edge-group").attr("data-line-number",String(J.lineNumber)).attr("data-from",J.sourceId).attr("data-to",J.targetId),it=r.textMuted,Lt="sm-arrow",At=(J.deferred?e7:t7)(J.points);if(At&&at.append("path").attr("d",At).attr("fill","none").attr("stroke",it).attr("stroke-width",b).attr("marker-end",`url(#${Lt})`).attr("class","sitemap-edge"),J.label&&J.points.length>=2){let rt=J.points[Math.floor(J.points.length/2)],pt=_t(J.label,x)+10,gt=x+6;at.append("rect").attr("x",rt.x-pt/2).attr("y",rt.y-gt/2-1).attr("width",pt).attr("height",gt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","sitemap-edge-label-bg"),at.append("text").attr("x",rt.x).attr("y",rt.y+4).attr("text-anchor","middle").attr("fill",it).attr("font-size",x).attr("class","sitemap-edge-label").text(J.label)}}for(let J of n.nodes){let at=Z.append("g").attr("transform",`translate(${J.x-J.width/2}, ${J.y})`).attr("class","sitemap-node").attr("data-line-number",String(J.lineNumber)).attr("data-node-id",J.id);if(J.hasChildren&&at.attr("data-node-toggle",J.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let pt=qt(s),gt=J.tagMetadata[pt];gt&&at.attr(`data-tag-${pt}`,gt.toLowerCase())}let it=e.options["solid-fill"]==="on",Lt=KK(r,o,J.color,it),Tt=ZK(r,J.color),At=Le(Lt,r.textOnFillLight,r.textOnFillDark);td(at,{width:J.width,height:J.height,rx:6,fill:Lt,stroke:Tt,strokeWidth:E,label:J.label,labelColor:At,labelFontSize:m,headerHeight:S});let rt=Object.entries(J.metadata);if(rt.length>0){at.append("line").attr("x1",0).attr("y1",S).attr("x2",J.width).attr("y2",S).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let pt=rt.map(([ut])=>lt.get(ut)??ut),dt=10+Math.max(...pt.map(ut=>_t(`${ut}: `,g)));for(let ut=0;ut<rt.length;ut++){let[yt,vt]=rt[ut],Gt=pt[ut],Xt=S+y+(ut+1)*h-4,bt=nt.get(`${yt}:${vt.toLowerCase()}`),Mt=it?At:bt??At;at.append("text").attr("x",10).attr("y",Xt).attr("fill",At).attr("font-size",g).text(`${Gt}:`),at.append("text").attr("x",dt).attr("y",Xt).attr("fill",Mt).attr("font-size",g).text(vt)}}if(J.description&&J.description.length>0){let pt=Object.keys(J.metadata).length,gt=pt>0?S+y+pt*h:S;at.append("line").attr("x1",0).attr("y1",gt).attr("x2",J.width).attr("y2",gt).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let dt=S+y+pt*h;for(let ut=0;ut<J.description.length;ut++){let yt=ea(J.description[ut]),vt=dt+(ut+1)*h-4,Gt=at.append("text").attr("x",10).attr("y",vt).attr("fill",At).attr("font-size",g);bn(Gt,yt,r,g)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let pt=`clip-${J.id}`;at.append("clipPath").attr("id",pt).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",6),at.append("rect").attr("y",J.height-v).attr("width",J.width).attr("height",v).attr("fill",it?At:J.color??r.primary).attr("opacity",.5).attr("clip-path",`url(#${pt})`)}}if(i&&_&&DP(Z,n.legend,r,o,s,void 0,l,c),I){let J=et.append("text").attr("x",d/2).attr("y",p+k).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").attr("class","sitemap-title chart-title").style("font-family",Pt);e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}if(O){let J=et.append("g").attr("class","sitemap-legend-fixed").attr("transform",`translate(0, ${p+H})`);s&&J.attr("data-legend-active",s.toLowerCase()),DP(J,n.legend,r,o,s,d,l,c)}}function DP(t,e,n,r,o,a,i,s){if(e.length===0)return;let l=e.map(p=>({name:p.name,entries:p.entries.map(m=>({value:m.value,color:m.color}))})),c=a!=null,d=c?Co+wi:0,u=a??e[0].x+(e[0].width??200),f=mn(t,{groups:l,activeGroup:o??null,mode:s?"export":"preview",capsulePillAddonWidth:d,palette:n,isDark:r,width:u});if(t.selectAll("[data-legend-group]").classed("sitemap-legend-group",!0),c){let p=f.getLayout();if(p.activeCapsule?.addonX!=null){let m=p.activeCapsule,g=qt(m.groupName),h=i?.has(g)??!1,S=t.select(`[data-legend-group="${g}"]`);if(!S.empty()){let y=m.addonX,b=(Se-Co)/2,E=6,x=S.append("g").attr("class","sitemap-legend-eye").attr("data-legend-visibility",g).style("cursor","pointer").attr("opacity",h?.4:.7);x.append("rect").attr("x",y-E).attr("y",b-E).attr("width",Co+E*2).attr("height",Co+E*2).attr("fill","transparent").attr("pointer-events","all"),x.append("path").attr("d",h?Rm:Am).attr("transform",`translate(${y}, ${b})`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}async function n7(t,e,n){let{parseSitemap:r}=await Promise.resolve().then(()=>(qu(),j0)),{layoutSitemap:o}=await Promise.resolve().then(()=>(KE(),qE)),{getPalette:a}=await Promise.resolve().then(()=>(Va(),yx)),i=e==="dark",s=n??(i?a("nord").dark:a("nord").light),l=r(t,s);if(l.error||l.roots.length===0)return"";let c=o(l,void 0,null,void 0,!0),d=20,u=l.title?30:0,f=c.width+d*2,p=c.height+d*2+u,m=document.createElement("div");m.style.width=`${f}px`,m.style.height=`${p}px`,m.style.position="absolute",m.style.left="-9999px",document.body.appendChild(m),GP(m,l,c,s,i,void 0,{width:f,height:p});let g=m.querySelector("svg");if(!g)return document.body.removeChild(m),"";e==="transparent"?g.style.background="none":g.style.background||(g.style.background=s.bg),g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.style.fontFamily=Pt;let h=g.outerHTML;return document.body.removeChild(m),h}var zK,UK,XK,qs,Ai,jK,qK,t7,e7,$P=st(()=>{"use strict";je();qn();So();an();tn();Ro();Za();en();Tr();Br();_o();mr();Dg();zK=20,UK=3,XK=30,qs=10,Ai=7,jK=11,qK=8;t7=Qn().x(t=>t.x).y(t=>t.y).curve(fo),e7=Qn().x(t=>t.x).y(t=>t.y).curve(ji)});function oh(t){return t.toLowerCase()===r7}var r7,HP=st(()=>{"use strict";r7="archive"});var XP={};ye(XP,{renderKanban:()=>UP,renderKanbanForExport:()=>o7});function ph(t,e,n){let r=[];for(let o of e){if(n?.includes(o.name.toLowerCase()))continue;let i=t.tags[qt(o.name)]??o.defaultValue;if(!i)continue;let s=o.entries.find(l=>l.value.toLowerCase()===i.toLowerCase());r.push({label:o.name,value:i,...s?.color!==void 0&&{color:s.color}})}return r}function VP(t,e,n){if(!n)return t.color;let r=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!r)return t.color;let a=t.tags[qt(r.name)]??r.defaultValue;return a?r.entries.find(s=>s.value.toLowerCase()===a.toLowerCase())?.color:void 0}function zP(t,e,n,r,o=Ef,a=ch,i=dh,s=JE,l=ah,c=ih,d=lh,u=md,f=pd,p=fd,m=ud,g=uh,h=sh,S=ZE,y=Sf,b=fh){let x=!!t.title&&t.options["no-title"]!=="on"?a+8:0,N=o+x,L=[],A=0,C=t.columns.filter(M=>!oh(M.name));for(let M of C){if(n?.has(M.id)??!1){L.push({x:0,y:N,width:b,height:0,column:M,cardLayouts:[]});continue}let T=_t(M.name,s),R=[],O=l+c;for(let G of M.cards){let D=_t(G.title,i);T=Math.max(T,D+d*2);let W=ph(G,t.tagGroups,r),V=W.length+G.details.length,P=V>0?f+1+u+V*p:0,F=m+u+P;for(let Y of W){let z=_t(`${Y.label}: ${Y.value}`,g)+d*2;T=Math.max(T,z)}R.push({x:c,y:O,width:0,height:F,card:G}),O+=F+h}let I=Math.max(S,T+c*2);for(let G of R)G.width=I-c*2;let H=O+c;A=Math.max(A,H),L.push({x:0,y:N,width:I,height:H,column:M,cardLayouts:R})}let k=o;for(let M of L)M.x=k,M.height=A,k+=M.width+y;let w=k-y+o,v=N+A+o;return{columns:L,totalWidth:w,totalHeight:v}}function UP(t,e,n,r,o){let a=o?.exportDims,i=o?.activeTagGroup??null,s=o?.onSwimlaneChange,l=o?.collapsedLanes,c=o?.collapsedColumns??new Set(e.columns.filter(B=>B.collapsed).map(B=>B.id)),d=o?.compactMeta??!1,u=e.options["solid-fill"]==="on",f=o?.currentSwimlaneGroup??null,p=f?e.tagGroups.find(B=>B.name.toLowerCase()===f.toLowerCase())??null:null,m=[];d&&(i&&m.push(i.toLowerCase()),f&&m.push(f.toLowerCase()));let g=e.columns.filter(B=>!oh(B.name)),h=Math.max(1,g.length),S=h*ZE+(h-1)*Sf+2*Ef,y=a?.width??t.getBoundingClientRect().width,b=a||y<=0?Ee.identity():Ee.from(y,S),E=b.aesthetic(Ef),x=b.aesthetic(Sf),N=b.structural(ah),L=b.aesthetic(ih),A=b.structural(ZE),C=b.structural(ud),k=b.structural(fd),w=b.structural(pd),v=b.aesthetic(sh),M=b.structural(6),_=b.aesthetic(lh),T=b.aesthetic(md),R=b.structural(QE),O=b.structural(ch),I=b.text(JE),H=b.text(dh),G=b.text(uh),D=b.text(FP),W=b.structural(BP),V=b.structural(YP),P=b.structural(fh),F=b.structural(t1),Y=b.text(20),z=b.structural(e1),j=b.aesthetic(n1),K=zP(e,n,c,m,E,O,H,I,N,L,_,T,w,k,C,G,v,A,x,P),$=a?.width??K.totalWidth,U=a?.height??K.totalHeight;t.innerHTML="";let X=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",$).attr("height",U).attr("viewBox",`0 0 ${$} ${U}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",Pt).style("background",n.bg);b.isBelowFloor&&X.attr("width","100%");let q=!!e.title&&e.options["no-title"]!=="on";if(q&&X.append("text").attr("class","chart-title").attr("data-line-number",e.titleLineNumber??0).attr("x",E).attr("y",E+Y).attr("font-size",Y).attr("font-weight","700").attr("fill",n.text).text(e.title),e.tagGroups.length>0){let B=q?Fe(e.title,Y)+16:0,Q=E+B,ot={groups:e.tagGroups,position:{placement:"top-center",titleRelation:"inline-with-title"},mode:o?.exportMode?"export":"preview"},Z=Cr(ot,$-Q-E),lt=E+(Y-Z)/2,nt=X.append("g").attr("class","kanban-legend").attr("transform",`translate(${Q},${lt})`),at=!!s&&!a?{onGroupRendered:(it,Lt,Tt)=>{let At=p?.name.toLowerCase()===it.toLowerCase(),rt=Fe(it,11),pt=Tt?10+rt+6:8+rt+4,gt=(Se-7)/2,dt=a7(Lt,pt,gt,At,n);dt.append("title").text(`Group by ${it}`),dt.style("cursor","pointer").on("click",ut=>{ut.stopPropagation(),s?.(At?null:it)})}}:void 0;mn(nt,{...ot,palette:n,isDark:r,width:$-Q-E,activeGroup:i??null,...at!==void 0&&{callbacks:at}})}if(p){l7(X,e,K,p,n,r,i,l,c,m,E,O,z,x,P,N,L,C,T,v,F,j,w,k,I,W,V,D,M,_,R,H,G);return}let et=r?Ot(n.surface,n.bg,50):Ot(n.surface,n.bg,30),tt=r?Ot(n.surface,n.bg,70):Ot(n.surface,n.bg,50);for(let B of K.columns){let Q=B.column,ot=c?.has(Q.id)??!1,Z=X.append("g").attr("class","kanban-column").attr("data-column-id",Q.id).attr("data-line-number",Q.lineNumber),lt=et,nt=Q.color?ie(n,Q.color,r,{solid:u}):tt,J=Q.color?Le(nt,n.textOnFillLight,n.textOnFillDark):n.text;if(ot){Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",P).attr("height",B.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",P).attr("height",N).attr("rx",V).attr("fill",nt),Z.append("text").attr("x",B.x+P/2).attr("y",B.y+N/2+D/2-1).attr("font-size",D).attr("font-weight","bold").attr("fill",Q.color?J:n.textMuted).attr("text-anchor","middle").text(String(Q.cards.length)),Z.append("text").attr("x",B.x+P/2).attr("y",B.y+N+L).attr("font-size",H).attr("font-weight","bold").attr("fill",n.text).attr("text-anchor","middle").attr("writing-mode","tb").text(Q.name);continue}Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",B.width).attr("height",B.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",B.width).attr("height",N).attr("rx",V).attr("fill",nt),Z.append("text").attr("x",B.x+L).attr("y",B.y+N/2+I/2-2).attr("font-size",I).attr("font-weight","bold").attr("fill",J).text(Q.name);{let at=Q.wipLimit!=null&&Q.cards.length>Q.wipLimit,it=Q.wipLimit!=null?`${Q.cards.length}/${Q.wipLimit}`:String(Q.cards.length);Z.append("text").attr("x",B.x+B.width-L).attr("y",B.y+N/2+D/2-1).attr("text-anchor","end").attr("font-size",D).attr("fill",at?n.colors.red:Q.color?J:n.textMuted).attr("font-weight",at?"bold":"normal").text(it)}for(let at of B.cardLayouts){let it=at.card,Lt=VP(it,e.tagGroups,i??null),Tt=ph(it,e.tagGroups,m),At=Tt.length>0||it.details.length>0,rt=ie(n,Lt??n.primary,r,{solid:u}),pt=Lt??n.textMuted,gt=Le(rt,n.textOnFillLight,n.textOnFillDark),dt=Z.append("g").attr("class","kanban-card").attr("data-card-id",it.id).attr("data-line-number",it.lineNumber);if(i){let Gt=qt(i),Xt=it.tags[Gt],bt=e.tagGroups.find(zt=>zt.name.toLowerCase()===Gt),Mt=Xt??bt?.defaultValue;Mt&&dt.attr(`data-tag-${Gt}`,Mt.toLowerCase())}let ut=B.x+at.x,yt=B.y+at.y;dt.append("rect").attr("x",ut).attr("y",yt).attr("width",at.width).attr("height",at.height).attr("rx",M).attr("fill",rt).attr("stroke",pt).attr("stroke-width",R);let vt=dt.append("text").attr("x",ut+_).attr("y",yt+T+H).attr("font-size",H).attr("font-weight","500").attr("fill",gt);if(bn(vt,it.title,n,H),At){let Gt=yt+C;dt.append("line").attr("x1",ut).attr("y1",Gt).attr("x2",ut+at.width).attr("y2",Gt).attr("stroke",u?gt:pt).attr("stroke-opacity",.3).attr("stroke-width",1);let Xt=Gt+w+G;for(let bt of Tt){dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",G).attr("fill",gt).text(`${bt.label}: `);let Mt=_t(`${bt.label}: `,G);dt.append("text").attr("x",ut+_+Mt).attr("y",Xt).attr("font-size",G).attr("fill",gt).text(bt.value),Xt+=k}for(let bt of it.details){let Mt=dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",G).attr("fill",gt);bn(Mt,bt,n,G),Xt+=k}}}}}function o7(t,e,n){let r=zc(t,n);if(r.error||r.columns.length===0)return"";let o=e==="dark",a=zP(r,n),i=document.createElement("div");return UP(i,r,n,o,{exportDims:{width:a.totalWidth,height:a.totalHeight},exportMode:!0}),i.querySelector("svg")?.outerHTML??""}function a7(t,e,n,r,o){let a=t.append("g").attr("class","kanban-swimlane-icon").attr("transform",`translate(${e}, ${n})`);a.append("rect").attr("x",-5).attr("y",-5).attr("width",22).attr("height",18).attr("fill","transparent");let i=r?o.primary:o.textMuted,s=r?1:.35,l=[8,12,6],c=2,d=3;for(let u=0;u<l.length;u++)a.append("rect").attr("x",0).attr("y",u*d).attr("width",l[u]).attr("height",c).attr("rx",1).attr("fill",i).attr("opacity",s);return a}function i7(t,e){let n=qt(e.name),r=new Map;for(let a of e.entries)r.set(a.value.toLowerCase(),{laneName:a.value,laneColor:a.color,isFallback:!1,cellsByColumn:{}});let o=`__no_${n}__`;for(let a of t)for(let i of a.cards){let s=i.tags[n]??e.defaultValue,l;s&&r.has(s.toLowerCase())?l=s.toLowerCase():(r.has(o)||r.set(o,{laneName:`No ${e.name}`,isFallback:!0,cellsByColumn:{}}),l=o);let c=r.get(l);(c.cellsByColumn[a.id]??=[]).push(i)}return Array.from(r.values())}function WP(t,e,n,r=pd,o=md,a=fd,i=ud){let l=ph(t,e,n).length+t.details.length,c=l>0?r+1+o+l*a:0;return i+o+c}function s7(t,e,n,r,o,a,i=Ef,s=ch,l=e1,c=Sf,d=fh,u=ah,f=ih,p=ud,m=md,g=sh,h=t1,S=n1,y=pd,b=fd){let E=t.title&&t.options["no-title"]!=="on"?s+8:0,x=i+E,N=[],L=i+l;for(let M of n.columns){let T=o?.has(M.column.id)??!1?d:M.width;N.push({column:M.column,x:L,width:T}),L+=T+c}let A=L-c+i,C=[],k=x+u+f,w=p+m+g;for(let M of e){if(r?.has(M.laneName)??!1){let H=N.map(G=>({column:G.column,cards:M.cellsByColumn[G.column.id]??[],cardLayouts:[]}));C.push({bucket:M,y:k,height:h,cells:H}),k+=h+S;continue}let T=w,R=[];for(let H of N){let G=o?.has(H.column.id)??!1,D=M.cellsByColumn[H.column.id]??[];if(G){R.push({column:H.column,cards:D,h:0});continue}let W=0;for(let V of D)W+=WP(V,t.tagGroups,a,y,m,b,p)+g;W=Math.max(W-(D.length>0?g:0),0),R.push({column:H.column,cards:D,h:W}),W>T&&(T=W)}let O=Math.max(T,w),I=R.map((H,G)=>{let D=N[G];if(o?.has(D.column.id)??!1)return{column:H.column,cards:H.cards,cardLayouts:[]};let V=[],P=0;for(let F of H.cards){let Y=WP(F,t.tagGroups,a,y,m,b,p);V.push({x:D.x+f,y:k+P,width:D.width-f*2,height:Y,card:F}),P+=Y+g}return{column:H.column,cards:H.cards,cardLayouts:V}});C.push({bucket:M,y:k,height:O,cells:I}),k+=O+S}let v=k-S+f+i;return{columnXs:N,lanes:C,totalWidth:A,totalHeight:v,startY:x}}function l7(t,e,n,r,o,a,i,s,l,c,d=Ef,u=ch,f=e1,p=Sf,m=fh,g=ah,h=ih,S=ud,y=md,b=sh,E=t1,x=n1,N=pd,L=fd,A=JE,C=BP,k=YP,w=FP,v=6,M=lh,_=QE,T=dh,R=uh){let O=e.columns.filter(P=>!oh(P.name)),I=i7(O,r),H=s7(e,I,n,s,l,c,d,u,f,p,m,g,h,S,y,b,E,x,N,L),G=parseFloat(t.attr("width")||"0"),D=parseFloat(t.attr("height")||"0");H.totalWidth>G&&(t.attr("width",H.totalWidth),t.attr("viewBox",`0 0 ${H.totalWidth} ${Math.max(D,H.totalHeight)}`)),H.totalHeight>D&&(t.attr("height",H.totalHeight),t.attr("viewBox",`0 0 ${Math.max(G,H.totalWidth)} ${H.totalHeight}`));let W=a?Ot(o.surface,o.bg,50):Ot(o.surface,o.bg,30),V=a?Ot(o.surface,o.bg,70):Ot(o.surface,o.bg,50);for(let P of H.columnXs){let F=P.column,Y=l?.has(F.id)??!1,z=t.append("g").attr("class","kanban-column kanban-column-header").attr("data-column-id",F.id).attr("data-line-number",F.lineNumber),j=F.color?ie(o,F.color,a,{solid:e.options["solid-fill"]==="on"}):V;if(z.append("rect").attr("x",P.x).attr("y",H.startY).attr("width",P.width).attr("height",g).attr("rx",k).attr("fill",j),Y)z.append("text").attr("x",P.x+P.width/2).attr("y",H.startY+g/2+w/2-1).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String(F.cards.length));else{z.append("text").attr("x",P.x+h).attr("y",H.startY+g/2+A/2-2).attr("font-size",A).attr("font-weight","bold").attr("fill",o.text).text(F.name);let K=F.wipLimit!=null&&F.cards.length>F.wipLimit,$=F.wipLimit!=null?`${F.cards.length}/${F.wipLimit}`:String(F.cards.length);z.append("text").attr("x",P.x+P.width-h).attr("y",H.startY+g/2+w/2-1).attr("text-anchor","end").attr("font-size",w).attr("fill",K?o.colors.red:o.textMuted).attr("font-weight",K?"bold":"normal").text($)}}for(let P of H.lanes){let F=s?.has(P.bucket.laneName)??!1,Y=t.append("g").attr("class","kanban-lane").attr("data-lane-name",P.bucket.laneName),z=Y.append("g").attr("class","kanban-lane-header").attr("transform",`translate(${d}, ${P.y-h})`);z.append("rect").attr("x",0).attr("y",0).attr("width",f-8).attr("height",P.height+h*2).attr("rx",C).attr("fill",W);let j=10,K=P.cells.reduce(($,U)=>$+U.cards.length,0);if(P.bucket.laneColor&&(z.append("circle").attr("cx",j+4).attr("cy",16).attr("r",4).attr("fill",P.bucket.laneColor),j+=14),F?z.append("text").attr("x",j).attr("y",20).attr("font-size",10).attr("fill",o.textMuted).text(`${P.bucket.laneName} (${K})`):z.append("text").attr("x",j).attr("y",20).attr("font-size",12).attr("font-weight","bold").attr("fill",P.bucket.isFallback?o.textMuted:o.text).text(P.bucket.laneName),F)for(let $ of P.cells){let U=l?.has($.column.id)??!1;if($.cards.length>0){let X=H.columnXs.find(tt=>tt.column.id===$.column.id);if(!X)continue;let q=P.bucket.laneColor?Ot(P.bucket.laneColor,o.bg,a?40:28):Ot(o.textMuted,o.bg,a?28:22),et=U?m-8:X.width-h*2;Y.append("rect").attr("x",X.x+(U?4:h)).attr("y",P.y).attr("width",et).attr("height",18).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+(U?4:h)+et/2).attr("y",P.y+13).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}}if(Y.append("line").attr("x1",d+f).attr("x2",H.totalWidth-d).attr("y1",P.y+P.height+h).attr("y2",P.y+P.height+h).attr("stroke",o.border??o.textMuted).attr("stroke-opacity",.4).attr("stroke-width",1),!F)for(let $ of P.cells){if((l?.has($.column.id)??!1)&&$.cards.length>0){let X=H.columnXs.find(q=>q.column.id===$.column.id);if(X){let q=P.bucket.laneColor?Ot(P.bucket.laneColor,o.bg,a?40:28):Ot(o.textMuted,o.bg,a?28:22);Y.append("rect").attr("x",X.x+4).attr("y",P.y).attr("width",m-8).attr("height",22).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+m/2).attr("y",P.y+16).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}continue}for(let X of $.cardLayouts)c7(Y,X,e.tagGroups,i,o,a,c,e.options["solid-fill"]==="on",v,M,y,_,T,R,S,N,L)}}}function c7(t,e,n,r,o,a,i,s,l=6,c=lh,d=md,u=QE,f=dh,p=uh,m=ud,g=pd,h=fd){let S=e.card,y=VP(S,n,r),b=ph(S,n,i),E=b.length>0||S.details.length>0,x=ie(o,y??o.primary,a,{...s!==void 0&&{solid:s}}),N=y??o.textMuted,L=Le(x,o.textOnFillLight,o.textOnFillDark),A=t.append("g").attr("class","kanban-card").attr("data-card-id",S.id).attr("data-line-number",S.lineNumber);if(r){let v=qt(r),M=n.find(T=>T.name.toLowerCase()===v),_=S.tags[v]??M?.defaultValue;_&&A.attr(`data-tag-${v}`,_.toLowerCase())}let C=e.x,k=e.y;A.append("rect").attr("x",C).attr("y",k).attr("width",e.width).attr("height",e.height).attr("rx",l).attr("fill",x).attr("stroke",N).attr("stroke-width",u);let w=A.append("text").attr("x",C+c).attr("y",k+d+f).attr("font-size",f).attr("font-weight","500").attr("fill",L);if(bn(w,S.title,o,f),E){let v=k+m;A.append("line").attr("x1",C).attr("y1",v).attr("x2",C+e.width).attr("y2",v).attr("stroke",N).attr("stroke-opacity",.3).attr("stroke-width",1);let M=v+g+p;for(let _ of b){A.append("text").attr("x",C+c).attr("y",M).attr("font-size",p).attr("fill",o.textMuted).text(`${_.label}: `);let T=_t(`${_.label}: `,p);A.append("text").attr("x",C+c+T).attr("y",M).attr("font-size",p).attr("fill",L).text(_.value),M+=h}for(let _ of S.details){let T=A.append("text").attr("x",C+c).attr("y",M).attr("font-size",p).attr("fill",o.textMuted);bn(T,_,o,p),M+=h}}}var Ef,Sf,ah,ih,ZE,ud,fd,pd,sh,lh,md,QE,ch,JE,dh,uh,FP,BP,YP,fh,t1,e1,n1,jP=st(()=>{"use strict";je();qn();an();tn();Ro();ug();HP();Tr();_o();Br();mr();en();Ef=20,Sf=16,ah=36,ih=12,ZE=200,ud=24,fd=14,pd=4,sh=8,lh=10,md=6,QE=1.5,ch=30,JE=13,dh=12,uh=10,FP=10,BP=8,YP=8,fh=40,t1=26;e1=140,n1=14});var KP={};ye(KP,{layoutClassDiagram:()=>o1});function g7(t){let e=t.members.filter(d=>!d.isMethod),n=t.members.filter(d=>d.isMethod),r=t.modifier==="enum",o=_t(t.name,p7);t.modifier&&(o=Math.max(o,_t(`\xAB${t.modifier}\xBB`,qP)));for(let d of t.members){let u=d.name;d.isMethod?(u+=`(${d.params??""})`,d.type&&(u+=`: ${d.type}`)):d.type&&(u+=`: ${d.type}`),u=`+ ${u}`,o=Math.max(o,_t(u,qP))}let a=Math.max(d7,o+u7),i=f7+(t.modifier?m7:0),s;if(r){let d=t.members;d.length>0?s=gd*2+d.length*r1+hd:s=hd+gd}else e.length>0?s=gd*2+e.length*r1+hd:s=hd+gd;let l=0;r||(n.length>0?l=gd*2+n.length*r1+hd:l=hd+gd);let c=i+s+l;return{width:a,height:c,headerHeight:i,fieldsHeight:s,methodsHeight:l}}function o1(t,e){if(t.classes.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new rr.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,edgesep:20}),n.setDefaultEdgeLabel(()=>({}));let r=new Map;for(let x of t.classes){let N=g7(x);r.set(x.id,N),n.setNode(x.id,{label:x.name,width:N.width,height:N.height})}for(let x of t.relationships)n.setEdge(x.source,x.target,{label:x.label??""});rr.layout(n);let a=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.classes.map(x=>({id:x.id,label:x.name}))),i=Dc(t.classes.map(x=>{let N=n.node(x.id);return{id:x.id,x:N.x,y:N.y,width:N.width,height:N.height}}),a,"TB",e?.collapsedNotes),s=t.classes.map(x=>{let N=n.node(x.id),L=r.get(x.id),A=i.get(x.id);return{...x,x:N.x,y:N.y,width:L.width,height:L.height,headerHeight:L.headerHeight,fieldsHeight:L.fieldsHeight,methodsHeight:L.methodsHeight,...A&&{note:A}}}),l=t.relationships.map(x=>{let N=n.edge(x.source,x.target);return{source:x.source,target:x.target,type:x.type,points:N?.points??[],...x.label!==void 0&&{label:x.label},lineNumber:x.lineNumber}}),c=1/0,d=1/0,u=-1/0,f=-1/0,p=(x,N,L,A)=>{x<c&&(c=x),N<d&&(d=N),L>u&&(u=L),A>f&&(f=A)};for(let x of s)p(x.x-x.width/2,x.y-x.height/2,x.x+x.width/2,x.y+x.height/2),x.note&&!x.note.collapsed&&p(x.x+x.note.x,x.y+x.note.y,x.x+x.note.x+x.note.width,x.y+x.note.y+x.note.height);Number.isFinite(c)||(c=0,d=0,u=0,f=0);let{shiftX:m,shiftY:g}=Gs(c,d),h=m!==0||g!==0,S=h?s.map(x=>({...x,x:x.x+m,y:x.y+g})):s,y=h?l.map(x=>({...x,points:x.points.map(N=>({x:N.x+m,y:N.y+g}))})):l,b=u+m+40,E=f+g+40;return{nodes:S,edges:y,width:b,height:E}}var d7,u7,f7,p7,qP,m7,r1,gd,hd,a1=st(()=>{"use strict";os();en();Zi();d7=140,u7=24,f7=36,p7=13,qP=11,m7=16,r1=18,gd=8,hd=1});var nD={};ye(nD,{renderClassDiagram:()=>eD,renderClassDiagramForExport:()=>R7});function JP(t,e,n){if(n)return e.textMuted;switch(t){case"interface":return e.colors.blue;case"abstract":return e.colors.purple;case"enum":return e.colors.yellow;default:return e.colors.teal}}function L7(t,e,n,r,o,a){let i=r??JP(n,t,o);return ie(t,i,e,{...a!==void 0&&{solid:a}})}function v7(t,e,n,r){return n??JP(e,t,r)}function tD(t){if(t.options?.["no-auto-color"])return[];let e=new Set;for(let n of t.classes)n.color||e.add(n.modifier??"class");return M7.filter(n=>e.has(n)).map(n=>N7[n])}function k7(t){return t??"class"}function QP(t){switch(t){case"public":return"+";case"private":return"-";case"protected":return"#"}}function C7(t){return t==="implements"||t==="depends"}function _7(t){switch(t){case"extends":return"cd-arrow-inherit";case"implements":return"cd-arrow-implement";case"composes":return"cd-arrow-compose";case"aggregates":return"cd-arrow-aggregate";case"depends":return"cd-arrow-depend";case"associates":return"cd-arrow-assoc"}}function A7(t){return t==="composes"||t==="aggregates"}function eD(t,e,n,r,o,a,i,s,l){It(t).selectAll(":not([data-d3-tooltip])").remove();let c=i?.width??t.clientWidth,d=i?.height??t.clientHeight;if(c<=0||d<=0)return;let u=Ee.identity(),f=u.aesthetic(i1),p=u.text(y7),m=u.text(b7),g=u.text(x7),h=u.structural(1.5),S=u.structural(1.5),y=u.structural(w7),b=u.structural(E7),E=u.structural(S7),x=u.text(20),N=u.structural(30),L=u.structural(Se),A=tD(e),C=A.length>1,k=!!e.title&&e.options["no-title"]!=="on",w=k?40:0,M=u.aesthetic(8),_=C?L+M:0,T=n.width,R=n.height,O=d-w-_,I=(c-f*2)/T,H=(O-f*2)/R,G=Math.min(h7,I,H),D=T*G,W=(c-D)/2,V=w+_+f,P=It(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);u.isBelowFloor&&P.attr("width","100%");let F=P.append("defs"),Y=12,z=8;F.append("marker").attr("id","cd-arrow-inherit").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-implement").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1);let j=12,K=8;if(F.append("marker").attr("id","cd-arrow-compose").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-aggregate").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-depend").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),F.append("marker").attr("id","cd-arrow-assoc").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),k){let X=P.append("text").attr("class","chart-title").attr("x",c/2).attr("y",N).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",x).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(X.attr("data-line-number",e.titleLineNumber),a&&X.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let $=s!==!1;if(C){let X=[{name:ZP,entries:A.map(et=>({value:et.label,color:r.colors[et.colorKey]}))}],q=P.append("g").attr("class","cd-legend").attr("transform",`translate(0,${w})`);mn(q,{groups:X,activeGroup:$?ZP:null,mode:l?"export":"preview",palette:r,isDark:o,width:c})}let U=P.append("g").attr("transform",`translate(${W}, ${V}) scale(${G})`);for(let X of n.edges){if(X.points.length<2)continue;let q=U.append("g").attr("class","cd-edge-group").attr("data-line-number",String(X.lineNumber)).attr("data-source",X.source).attr("data-target",X.target),et=r.textMuted,tt=_7(X.type),B=C7(X.type),Q=A7(X.type),ot=T7(X.points);if(ot){let Z=q.append("path").attr("d",ot).attr("fill","none").attr("stroke",et).attr("stroke-width",h).attr("class","cd-edge");B&&Z.attr("stroke-dasharray","6 3"),Q?Z.attr("marker-start",`url(#${tt})`):Z.attr("marker-end",`url(#${tt})`)}if(X.label){let Z=Math.floor(X.points.length/2),lt=X.points[Z],nt=_t(X.label,g)+8,J=16;q.append("rect").attr("x",lt.x-nt/2).attr("y",lt.y-J/2-1).attr("width",nt).attr("height",J).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","cd-edge-label-bg"),q.append("text").attr("x",lt.x).attr("y",lt.y+4).attr("text-anchor","middle").attr("fill",et).attr("font-size",g).attr("class","cd-edge-label").text(X.label)}}for(let X of n.nodes){let q=U.append("g").attr("transform",`translate(${X.x}, ${X.y})`).attr("class","cd-class").attr("data-line-number",String(X.lineNumber)).attr("data-node-id",X.id).attr("data-cd-type",k7(X.modifier));a&&q.style("cursor","pointer").on("click",()=>{a(X.lineNumber)});let et=X.width,tt=X.height,B=!!e.options?.["no-auto-color"],ot=C&&!$&&!X.color?r.primary:X.color,Z=e.options?.["solid-fill"]==="on",lt=L7(r,o,X.modifier,ot,B,Z),nt=v7(r,X.modifier,ot,B),J=Le(lt,r.textOnFillLight,r.textOnFillDark);q.append("rect").attr("x",-et/2).attr("y",-tt/2).attr("width",et).attr("height",tt).attr("rx",3).attr("ry",3).attr("fill",lt).attr("stroke",nt).attr("stroke-width",S);let at=-tt/2,it=at+X.headerHeight/2;if(X.modifier){let rt=`\xAB${X.modifier}\xBB`;q.append("text").attr("x",0).attr("y",it-6).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).attr("font-style","italic").text(rt),q.append("text").attr("x",0).attr("y",it+10).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").attr("font-style",X.modifier==="abstract"?"italic":"normal").text(X.name)}else q.append("text").attr("x",0).attr("y",it).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").text(X.name);at+=X.headerHeight;let Lt=X.modifier==="enum",Tt=X.members.filter(rt=>!rt.isMethod),At=X.members.filter(rt=>rt.isMethod);if(Lt){q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5);let rt=at+b;for(let pt of X.members)q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).text(pt.name),rt+=y}else{if(q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),Tt.length>0){let rt=at+b;for(let pt of Tt){let dt=`${QP(pt.visibility)} ${pt.name}`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}if(at+=X.fieldsHeight,q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),At.length>0){let rt=at+b;for(let pt of At){let dt=`${QP(pt.visibility)} ${pt.name}(${pt.params??""})`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}}if(X.note)if(X.note.collapsed)vi(q,{x:et/2-Vo-3,y:-tt/2+Vo+3},r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber});else{let[rt,pt,gt,dt]=Si({width:et,height:tt},X.note);Ei(q,rt,pt,gt,dt,r),Li(q,{x:X.note.x,y:X.note.y,width:X.note.width,height:X.note.height},X.note.lines,r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber,interactive:!0})}}}function R7(t,e,n){let r=Hc(t,n);if(r.error||r.classes.length===0)return"";let o=o1(r),a=e==="dark",l=tD(r).length>1?Se+8:0,c=o.width+i1*2,d=o.height+i1*2+(r.title?40:0)+l;return ad(c,d,u=>(eD(u,r,o,n,a,void 0,{width:c,height:d},!0,!0),id(u,e)))}var i1,h7,y7,b7,x7,w7,E7,S7,N7,M7,ZP,T7,rD=st(()=>{"use strict";qn();So();an();Zg();Tr();Br();tn();Uu();a1();mr();en();Ni();i1=20,h7=3,y7=13,b7=11,x7=11,w7=18,E7=8,S7=10;N7={class:{label:"Class",colorKey:"teal"},abstract:{label:"Abstract",colorKey:"purple"},interface:{label:"Interface",colorKey:"blue"},enum:{label:"Enum",colorKey:"yellow"}},M7=["class","abstract","interface","enum"];ZP="Type";T7=Qn().x(t=>t.x).y(t=>t.y).curve(fo)});var aD={};ye(aD,{layoutERDiagram:()=>c1});function F7(t){let e=_t(t.name,P7);for(let i of t.columns){let s=i.name;i.type&&(s+=`: ${i.type}`);let l=_t(s,D7);i.constraints.length>0&&(l+=O7),e=Math.max(e,l)}let n=Math.max(s1,e+I7),r=l1,o=0;t.columns.length>0&&(o=H7*2+t.columns.length*$7+W7);let a=r+o+(o===0?4:0);return{width:n,height:a,headerHeight:r,columnsHeight:o}}function B7(t,e){let n=new Map;for(let a of t)n.set(a,new Set);for(let a of e)n.get(a.source)?.add(a.target),n.get(a.target)?.add(a.source);let r=new Set,o=[];for(let a of t){if(r.has(a))continue;let i=[],s=[a];for(;s.length>0;){let l=s.shift();if(!r.has(l)){r.add(l),i.push(l);for(let c of n.get(l)??[])r.has(c)||s.push(c)}}o.push(i)}return o}function Y7(t,e,n){let r=new Map,o=new Map;if(t.length===1){let d=t[0],u=n.get(d.id);return r.set(d.id,{x:u.width/2,y:u.height/2,...u}),{nodePositions:r,edgePoints:o,width:u.width,height:u.height}}let a=new rr.graphlib.Graph({multigraph:!0});a.setGraph({rankdir:"LR",nodesep:40,ranksep:80,edgesep:20}),a.setDefaultEdgeLabel(()=>({}));for(let d of t){let u=n.get(d.id);a.setNode(d.id,{width:u.width,height:u.height})}for(let d of e)a.setEdge(d.source,d.target,{label:d.label??""},String(d.lineNumber));rr.layout(a);let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of t){let u=a.node(d.id),f=n.get(d.id);i=Math.min(i,u.x-f.width/2),s=Math.min(s,u.y-f.height/2),l=Math.max(l,u.x+f.width/2),c=Math.max(c,u.y+f.height/2)}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));for(let f of u?.points??[])i=Math.min(i,f.x),s=Math.min(s,f.y),l=Math.max(l,f.x),c=Math.max(c,f.y);if(d.label&&(u?.points??[]).length>0){let f=u.points,p=f[Math.floor(f.length/2)],m=(_t(d.label,G7)+8)/2;i=Math.min(i,p.x-m),l=Math.max(l,p.x+m)}}for(let d of t){let u=a.node(d.id),f=n.get(d.id);r.set(d.id,{x:u.x-i,y:u.y-s,...f})}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));o.set(d.lineNumber,(u?.points??[]).map(f=>({x:f.x-i,y:f.y-s})))}return{nodePositions:r,edgePoints:o,width:Math.max(0,l-i),height:Math.max(0,c-s)}}function V7(t){if(t.length===0)return[];let e=[...t].sort((l,c)=>{let d=l.compIds.length>1?1:0,u=c.compIds.length>1?1:0;return d!==u?u-d:c.compLayout.height-l.compLayout.height}),n=t.reduce((l,c)=>l+(c.compLayout.width||s1)*(c.compLayout.height||l1),0),r=Math.max(Math.sqrt(n)*1.5,e[0].compLayout.width),o=[],a=0,i=0,s=0;for(let l of e){let c=l.compLayout.width||s1,d=l.compLayout.height||l1;a>0&&a+c>r&&(i+=s+oD,a=0,s=0),o.push({compIds:l.compIds,compLayout:l.compLayout,offsetX:a,offsetY:i}),a+=c+oD,s=Math.max(s,d)}return o}function c1(t,e){if(t.tables.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new Map;for(let C of t.tables)n.set(C.id,F7(C));let r=B7(t.tables.map(C=>C.id),t.relationships),o=new Map(t.tables.map(C=>[C.id,C])),a=r.map(C=>{let k=C.map(v=>o.get(v)),w=t.relationships.filter(v=>C.includes(v.source));return{compIds:C,compLayout:Y7(k,w,n)}}),i=V7(a),s=new Map;for(let C of i)for(let k of C.compIds)s.set(k,C);let l=new Map;for(let C of i)for(let k of C.compLayout.edgePoints.keys())l.set(k,C);let c=t.tables.map(C=>{let k=s.get(C.id),w=k.compLayout.nodePositions.get(C.id);return{...C,x:w.x+k.offsetX+yd,y:w.y+k.offsetY+yd,width:w.width,height:w.height,headerHeight:w.headerHeight,columnsHeight:w.columnsHeight}}),d=t.relationships.map(C=>{let k=l.get(C.lineNumber),w=k?.compLayout.edgePoints.get(C.lineNumber)??[];return{source:C.source,target:C.target,cardinality:C.cardinality,points:w.map(v=>({x:v.x+(k?.offsetX??0)+yd,y:v.y+(k?.offsetY??0)+yd})),...C.label!==void 0&&{label:C.label},lineNumber:C.lineNumber}}),f=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.tables.map(C=>({id:C.id,label:C.name}))),p=Dc(c.map(C=>({id:C.id,x:C.x,y:C.y,width:C.width,height:C.height})),f,"TB",e?.collapsedNotes),m=c.map(C=>{let k=p.get(C.id);return k?{...C,note:k}:C}),g=1/0,h=1/0,S=-1/0,y=-1/0,b=(C,k,w,v)=>{C<g&&(g=C),k<h&&(h=k),w>S&&(S=w),v>y&&(y=v)};for(let C of m)b(C.x-C.width/2,C.y-C.height/2,C.x+C.width/2,C.y+C.height/2),C.note&&!C.note.collapsed&&b(C.x+C.note.x,C.y+C.note.y,C.x+C.note.x+C.note.width,C.y+C.note.y+C.note.height);for(let C of d)for(let k of C.points)b(k.x,k.y,k.x,k.y);Number.isFinite(g)||(g=0,h=0,S=0,y=0);let{shiftX:E,shiftY:x}=Gs(g,h),N=E!==0||x!==0,L=N?m.map(C=>({...C,x:C.x+E,y:C.y+x})):m,A=N?d.map(C=>({...C,points:C.points.map(k=>({x:k.x+E,y:k.y+x}))})):d;return{nodes:L,edges:A,width:S+E+yd,height:y+x+yd}}var s1,I7,l1,P7,D7,G7,O7,$7,H7,W7,yd,oD,d1=st(()=>{"use strict";os();en();Zi();s1=140,I7=24,l1=36,P7=13,D7=11,G7=11,O7=16,$7=18,H7=8,W7=1,yd=30,oD=60});function lD(t,e){let n=new Map;if(t.length===0)return n;let r={};for(let f of t)r[f.id]=0;for(let f of e)f.source!==f.target&&(f.cardinality.from==="1"&&f.cardinality.to!=="1"&&(r[f.source]=(r[f.source]??0)+1),f.cardinality.to==="1"&&f.cardinality.from!=="1"&&(r[f.target]=(r[f.target]??0)+1));let o=new Map;for(let f of e)f.source!==f.target&&(f.cardinality.from==="*"&&(o.has(f.source)||o.set(f.source,new Set),o.get(f.source).add(f.target)),f.cardinality.to==="*"&&(o.has(f.target)||o.set(f.target,new Set),o.get(f.target).add(f.source)));let a=new Set;for(let[f,p]of o)p.size>=2&&a.add(f);let i=Object.values(r),s=i.reduce((f,p)=>f+p,0)/i.length,l=i.reduce((f,p)=>f+(p-s)**2,0)/i.length,c=Math.sqrt(l),d=[...i].sort((f,p)=>f-p),u=d.length%2===0?(d[d.length/2-1]+d[d.length/2])/2:d[Math.floor(d.length/2)];for(let f of t){let p=f.id,m=f.columns,g=m.filter(M=>M.constraints.includes("fk")),h=m.filter(M=>M.constraints.includes("pk")&&M.constraints.includes("fk")),S=g.length,y=m.length===0?0:S/m.length,b=r[p]??0,E=f.name.toLowerCase(),x=e.filter(M=>(M.source===p||M.target===p)&&M.source!==M.target),N=e.some(M=>M.source===p&&M.target===p),L=new Set;for(let M of x)L.add(M.source===p?M.target:M.source);if(N&&x.length===0){n.set(p,"self-referential");continue}let A=h.length>=2&&L.size===1,C=y>=.6&&!A,k=h.length>=2&&L.size>=2,w=a.has(p);if(C||k||w){n.set(p,"junction");continue}if(y>=.4&&y<.6&&h.length<2&&!a.has(p)){n.set(p,"ambiguous");continue}if(z7.some(M=>E.endsWith(M))&&m.length<=6&&S<=1&&b>u){n.set(p,"lookup");continue}if(t.length>=6&&b>0&&b>s+1.5*c&&b>=2*s){n.set(p,"hub");continue}if(S>0){n.set(p,"dependent");continue}n.set(p,"core")}return n}var u1,iD,sD,z7,cD=st(()=>{"use strict";u1={core:"green",dependent:"blue",junction:"red",ambiguous:"purple",lookup:"yellow",hub:"orange","self-referential":"teal",unclassified:"gray"},iD={core:"Core entity",dependent:"Dependent",junction:"Junction / M:M",ambiguous:"Bridge",lookup:"Lookup / Reference",hub:"Hub","self-referential":"Self-referential",unclassified:"Unclassified"},sD=["core","dependent","junction","ambiguous","lookup","hub","self-referential","unclassified"],z7=["_type","_status","_code","_category"]});var pD={};ye(pD,{renderERDiagram:()=>fD,renderERDiagramForExport:()=>tZ});function Q7(t){switch(t){case"pk":return"\u2666";case"fk":return"\u2192";case"unique":return"\u25C6";case"nullable":return"\u25CB"}}function dD(t,e,n,r,o,a,i=uD,s=1.5){let l=e.x-n.x,c=e.y-n.y,d=Math.sqrt(l*l+c*c);if(d===0)return;let u=l/d,f=c/d,p=-f,m=u,g=s+.5;if(a){let b=e.x-u*15,E=e.y-f*15,x=r==="1"?"1":r==="*"?"*":"0..1";t.append("text").attr("x",b+p*12).attr("y",E+m*12).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",o).attr("font-size",i).text(x);return}let h=14,S=9;if(r==="1"){let y=e.x-u*h,b=e.y-f*h;t.append("line").attr("x1",y+p*S).attr("y1",b+m*S).attr("x2",y-p*S).attr("y2",b-m*S).attr("stroke",o).attr("stroke-width",g)}else if(r==="*"){let E=e.x-u*18,x=e.y-f*18,N=e.x-u*5,L=e.y-f*5;t.append("line").attr("x1",E).attr("y1",x).attr("x2",N+p*S).attr("y2",L+m*S).attr("stroke",o).attr("stroke-width",g),t.append("line").attr("x1",E).attr("y1",x).attr("x2",N-p*S).attr("y2",L-m*S).attr("stroke",o).attr("stroke-width",g),t.append("line").attr("x1",E).attr("y1",x).attr("x2",N).attr("y2",L).attr("stroke",o).attr("stroke-width",g)}else if(r==="?"){let b=h+10+2,E=e.x-u*b,x=e.y-f*b;t.append("circle").attr("cx",E).attr("cy",x).attr("r",5).attr("fill","none").attr("stroke",o).attr("stroke-width",g);let N=e.x-u*h,L=e.y-f*h;t.append("line").attr("x1",N+p*S).attr("y1",L+m*S).attr("x2",N-p*S).attr("y2",L-m*S).attr("stroke",o).attr("stroke-width",g)}}function fD(t,e,n,r,o,a,i,s,l,c){It(t).selectAll(":not([data-d3-tooltip])").remove();let d=e.tagGroups.length===0&&n.nodes.every(z=>!z.color),u=8,f=e.tagGroups.length>0,p=d?Se+u:f?Se+u:0,m=!!e.title&&e.options["no-title"]!=="on",g=m?40:0,h=n.width,S=n.height,y=Ee.identity(),b=y.aesthetic(f1),E=y.text(X7),x=y.text(j7),N=y.text(uD),L=y.structural(1.5),A=y.structural(1.5),C=y.structural(q7),k=y.structural(K7),w=y.structural(Z7),v=y.text(20),M=y.structural(30),_=h+b*2,T=S+g+p+b*2,R,O,I,H,G;if(i){R=i.width??_,O=i.height??T;let z=O-g-p,j=(R-b*2)/h,K=(z-b*2)/S;I=Math.min(U7,j,K);let $=h*I;H=(R-$)/2,G=g+p+b}else R=_,O=T,I=1,H=b,G=g+p+b;if(R<=0||O<=0)return;let D=It(t).append("svg").attr("width",i?R:"100%").attr("height",i?O:"100%").attr("viewBox",`0 0 ${R} ${O}`).attr("preserveAspectRatio","xMidYMid meet").style("font-family",Pt);if(m){let z=D.append("text").attr("class","chart-title").attr("x",R/2).attr("y",M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",v).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(z.attr("data-line-number",e.titleLineNumber),a&&z.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let W=D.append("g").attr("transform",`translate(${H}, ${G}) scale(${I})`),V=lr(r),P=d?lD([...e.tables],[...e.relationships]):null,F=P!==null&&(l??!0),Y=e.options.notation==="labels";for(let z of n.edges){if(z.points.length<2)continue;let j=W.append("g").attr("class","er-edge-group").attr("data-line-number",String(z.lineNumber)).attr("data-source",z.source).attr("data-target",z.target),K=r.textMuted,$=J7(z.points);$&&j.append("path").attr("d",$).attr("fill","none").attr("stroke",K).attr("stroke-width",L).attr("class","er-edge");let U=z.points;if(dD(j,U[0],U[1],z.cardinality.from,K,Y,N,L),dD(j,U[U.length-1],U[U.length-2],z.cardinality.to,K,Y,N,L),z.label){let X=Math.floor(U.length/2),q=U[X],et=_t(z.label,N)+8,tt=16;j.append("rect").attr("x",q.x-et/2).attr("y",q.y-tt/2-1).attr("width",et).attr("height",tt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","er-edge-label-bg"),j.append("text").attr("x",q.x).attr("y",q.y+4).attr("text-anchor","middle").attr("fill",K).attr("font-size",N).attr("class","er-edge-label").text(z.label)}}for(let z=0;z<n.nodes.length;z++){let j=n.nodes[z],K=sr(j.metadata,[...e.tagGroups],s??null),$=F?r.colors[u1[P.get(j.id)??"unclassified"]]:P?r.primary:void 0,U=j.color??K??$??V[z%V.length],X=W.append("g").attr("transform",`translate(${j.x}, ${j.y})`).attr("class","er-table").attr("data-line-number",String(j.lineNumber)).attr("data-node-id",j.id);if(s){let lt=qt(s),nt=j.metadata[lt];nt&&X.attr(`data-tag-${lt}`,nt.toLowerCase())}if(P){let lt=P.get(j.id);lt&&X.attr("data-er-role",lt)}a&&X.style("cursor","pointer").on("click",()=>{a(j.lineNumber)});let q=j.width,et=j.height,tt=ie(r,U,o,{solid:e.options["solid-fill"]==="on"}),B=U,Q=Le(tt,r.textOnFillLight,r.textOnFillDark);X.append("rect").attr("x",-q/2).attr("y",-et/2).attr("width",q).attr("height",et).attr("rx",3).attr("ry",3).attr("fill",tt).attr("stroke",B).attr("stroke-width",A);let ot=-et/2,Z=ot+j.headerHeight/2;if(X.append("text").attr("x",0).attr("y",Z).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",Q).attr("font-size",E).attr("font-weight","bold").text(j.name),ot+=j.headerHeight,j.columns.length>0){X.append("line").attr("x1",-q/2).attr("y1",ot).attr("x2",q/2).attr("y2",ot).attr("stroke",B).attr("stroke-width",.5).attr("stroke-opacity",.5);let lt=ot+k;for(let nt of j.columns){let J=-q/2+w,at=nt.constraints[0];at&&X.append("text").attr("x",J).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(Q7(at));let it=-q/2+w+(at?16:0),Lt=nt.name;nt.type&&(Lt+=`: ${nt.type}`),X.append("text").attr("x",it).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(Lt),lt+=C}}if(j.note)if(j.note.collapsed)vi(X,{x:q/2-Vo-3,y:-et/2+Vo+3},r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber});else{let[lt,nt,J,at]=Si({width:q,height:et},j.note);Ei(X,lt,nt,J,at,r),Li(X,{x:j.note.x,y:j.note.y,width:j.note.width,height:j.note.height},j.note.lines,r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber,interactive:!0})}}if(e.tagGroups.length>0){let z=b+g,j=D.append("g").attr("class","er-tag-legend").attr("transform",`translate(0,${z})`);mn(j,{groups:e.tagGroups,activeGroup:s??null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),j.selectAll("[data-legend-group]").classed("er-legend-group",!0)}if(P){let z=sD.filter(j=>{for(let K of P.values())if(K===j)return!0;return!1});if(z.length>0){let j=b+g,K=[{name:"Role",entries:z.map(U=>({value:iD[U],color:r.colors[u1[U]]}))}],$=D.append("g").attr("class","er-semantic-legend").attr("transform",`translate(0,${j})`);mn($,{groups:K,activeGroup:F?"Role":null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),$.selectAll("[data-legend-group]").classed("er-legend-group",!0)}}}function tZ(t,e,n){let r=Wc(t,n);if(r.error||r.tables.length===0)return"";let o=c1(r),a=e==="dark",i=document.createElement("div"),s=o.width+f1*2,l=o.height+f1*2+(r.title&&r.options["no-title"]!=="on"?40:0);i.style.width=`${s}px`,i.style.height=`${l}px`,i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i);try{fD(i,r,o,n,a,void 0,{width:s,height:l},void 0,void 0,!0);let c=i.querySelector("svg");return c?(e==="transparent"&&(c.style.background="none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.fontFamily=Pt,c.outerHTML):""}finally{document.body.removeChild(i)}}var f1,U7,X7,j7,uD,q7,K7,Z7,J7,mD=st(()=>{"use strict";je();qn();So();an();tn();Va();je();Tr();Br();mr();en();Ni();Xu();d1();cD();f1=20,U7=3,X7=13,j7=11,uD=11,q7=18,K7=8,Z7=10;J7=Qn().x(t=>t.x).y(t=>t.y).curve(fo)});var ED={};ye(ED,{renderBoxesAndLines:()=>wD,renderBoxesAndLinesForExport:()=>gZ});function uZ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t[r-1],a=t[r],i=r+1<t.length?t[r+1]:"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function mh(t,e,n){let r=e-xD*2,o=t.split(/(\s+|-)/),a=[];for(let s of o)!s||/^\s+$/.test(s)||s==="-"||a.push(...uZ(s));for(let s=nZ;s>=gh;s--){if(r<_t("MM",s))continue;let l=[],c="";for(let p of a){let m=c?`${c} ${p}`:p;_t(m,s)<=r?c=m:(c&&l.push(c),c=p)}c&&l.push(c);let d=p=>_t(p,s)<=r;if(l.length<=n&&l.every(d))return{lines:l,fontSize:s};if(l.length<=n)return{lines:l.map(m=>d(m)?m:nr(m,s,r)),fontSize:s};let u=l.slice(0,n).map(p=>d(p)?p:nr(p,s,r)),f=u[n-1];return f.endsWith("\u2026")||(u[n-1]=nr(f+"\u2026",s,r)),{lines:u,fontSize:s}}return{lines:[nr(t,gh,r)],fontSize:gh}}function fZ(t,e,n,r,o,a,i){let s=Ot(r.bg,r.text,o?90:95);if(a.active){if(t.value===void 0){let h=Le(s,r.textOnFillLight,r.textOnFillDark);return{fill:s,stroke:a.hue,text:h}}let f=a.fillForValue(t.value),p=ie(r,f,o,{...i!==void 0&&{solid:i}}),m=a.twoColor?f:a.hue,g=Le(p,r.textOnFillLight,r.textOnFillDark);return{fill:p,stroke:m,text:g}}let l=sr(t.metadata,[...e],n);if(l){let f=ie(r,l,o,{...i!==void 0&&{solid:i}}),p=l,m=Le(f,r.textOnFillLight,r.textOnFillDark);return{fill:f,stroke:p,text:m}}let c=Ot(r.bg,r.text,o?90:95),d=Ot(r.text,r.bg,o?60:40),u=r.text;return{fill:c,stroke:d,text:u}}function pZ(t,e,n,r){if(Object.keys(t.metadata).length>0&&n!=null){let a=sr(t.metadata,[...e],n);if(a)return a}return r.textMuted}function mZ(t,e){for(let n of e){let r=`bl-arrow-${n.replace("#","")}`;if(!t.select(`#${r}`).empty())continue;t.append("marker").attr("id",r).attr("viewBox",`0 0 ${Ks*2} ${Ri*2}`).attr("refX",Ks*2).attr("refY",Ri).attr("markerWidth",Ks).attr("markerHeight",Ri).attr("orient","auto").append("polygon").attr("points",`0,0 ${Ks*2},${Ri} 0,${Ri*2}`).attr("fill",n);let o=`bl-arrow-rev-${n.replace("#","")}`;t.select(`#${o}`).empty()&&t.append("marker").attr("id",o).attr("viewBox",`0 0 ${Ks*2} ${Ri*2}`).attr("refX",0).attr("refY",Ri).attr("markerWidth",Ks).attr("markerHeight",Ri).attr("orient","auto").append("polygon").attr("points",`${Ks*2},0 0,${Ri} ${Ks*2},${Ri*2}`).attr("fill",n)}}function wD(t,e,n,r,o,a){let{onClickItem:i,exportDims:s,activeTagGroup:l,hiddenTagValues:c,hideDescriptions:d,controlsExpanded:u,onToggleDescriptions:f,onToggleControlsExpand:p,exportMode:m=!1,controlsHost:g,rampDomain:h}=a??{};It(t).selectAll(":not([data-d3-tooltip])").remove();let S=s?.width??t.clientWidth,y=s?.height??t.clientHeight;if(S<=0||y<=0)return;let b=Ee.identity(),E=b.aesthetic(eZ),x=b.text(gh),N=b.text(rZ),L=b.structural(1.5),A=b.structural(1.5),C=b.structural(oZ),k=b.text(gD),w=b.text(iZ),v=b.structural(sZ),M=b.text(20),_=b.structural(30),T=e.nodes.filter(ft=>ft.value!==void 0).map(ft=>ft.value),R=T.length>0,O=h?.min??(R?Math.min(...T):0),I=h?.max??Math.max(...T),H=On(e.boxMetricColor??"",r)??r.primary,G=e.boxMetricLowColor?On(e.boxMetricLowColor,r)??void 0:void 0,D=o?Ot(r.surface,r.text,28):r.bg,W=Ot(H,D,p1),V=ft=>{let Wt=I>O?(ft-O)/(I-O):1;if(G!==void 0)return Kp(G,H,Wt,{isDark:o});let ge=p1+Math.max(0,Math.min(1,Wt))*(100-p1);return Ot(H,D,ge)},P=R?e.boxMetric?.trim()||"Value":null,F=ft=>{let Wt=ft.trim().toLowerCase();if(Wt===""||Wt==="none")return null;let ge=e.tagGroups.find(ne=>ne.name.toLowerCase()===Wt);return ge?ge.name:Wt===P?.toLowerCase()?P:ft},Y=l,z;Y!==void 0?z=Y===null?null:F(Y):e.options["active-tag"]!==void 0?z=F(e.options["active-tag"]):z=P??(e.tagGroups.length>0?e.tagGroups[0].name:null);let j=P!==null&&z===P,K=P!==null?{name:P,entries:[],gradient:{min:O,max:I,low:G??W,high:H}}:null,$=[...K?[K]:[],...e.tagGroups],U=e.nodes.some(ft=>ft.description&&ft.description.length>0),q=$.length>0||U&&g!=="app"?b.structural(Cr({groups:$,position:{placement:"top-center",titleRelation:"below-title"},mode:m?"export":"preview"},S)):0,et=c??e.initialHiddenTagValues,tt=new Map;for(let ft of e.nodes)tt.set(ft.label,ft);let B=new Map;for(let ft of n.nodes)B.set(ft.label,ft);let Q=!!e.title&&e.options["no-title"]!=="on",ot=Q?40:0,Z=e.nodes.some(ft=>ft.description&&ft.description.length>0),nt=$.length>0||Z&&f?q+8:0,J=new Set(n.groups.map(ft=>ft.label)),at=0;for(let ft of e.groups)ft.children.some(Wt=>J.has(Wt))&&(at+=v);let it=n.width,Lt=n.height+ot+nt+at,Tt=S/(it+E*2),At=y/(Lt+E*2),rt=Math.min(Tt,At,3),pt=0,gt=0;if(e.nodePositions&&e.nodePositions.size>0){let ft=1/0,Wt=1/0,ge=-1/0,ne=-1/0,se=(Zt,Ie)=>{Zt<ft&&(ft=Zt),Zt>ge&&(ge=Zt),Ie<Wt&&(Wt=Ie),Ie>ne&&(ne=Ie)};for(let Zt of n.nodes)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.groups)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.edges)for(let Ie of Zt.points)se(Ie.x,Ie.y);Number.isFinite(ft)&&(pt=(n.width-ge-ft)/2,gt=(n.height-ne-Wt)/2)}let dt=(S-it*rt)/2+pt*rt,ut=E+ot+nt+gt*rt,yt=It(t).append("svg").attr("width",S).attr("height",y).attr("viewBox",`0 0 ${S} ${y}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt).style("background",r.bg);b.isBelowFloor&&yt.attr("width","100%");let vt=yt.append("defs");Q&&yt.append("text").attr("x",S/2).attr("y",_).attr("text-anchor","middle").attr("font-size",M).attr("font-weight","700").attr("fill",r.text).text(e.title);let Gt=yt.append("g").attr("transform",`translate(${dt},${ut}) scale(${rt})`),Xt=new Set,bt=new Map;for(let ft=0;ft<n.edges.length;ft++){let Wt=pZ(n.edges[ft],e.tagGroups,z,r);Xt.add(Wt),bt.set(ft,Wt)}mZ(vt,Xt);let Mt=[...n.groups].sort((ft,Wt)=>Wt.width*Wt.height-ft.width*ft.height),zt=new Set(n.groups.map(ft=>ft.label)),xt=new Set;for(let ft of e.groups)for(let Wt of ft.children)zt.has(Wt)&&xt.add(ft.label);for(let ft of Mt){let Wt=ft.x-ft.width/2,ge=!ft.collapsed&&xt.has(ft.label),ne=ge?ft.y-ft.height/2-v:ft.y-ft.height/2,se=ge?ft.height+v:ft.height,Zt=Gt.append("g").attr("class",ft.collapsed?"bl-group bl-group-collapsed":"bl-group").attr("data-line-number",String(ft.lineNumber)).attr("data-node-id",ft.label).attr("data-group-toggle",ft.label).style("cursor","pointer");if(ft.collapsed){let Ie=or(r,o),Ht=r.border;Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",Ie).attr("stroke",Ht).attr("stroke-width",A);let Qt=`bl-clip-${ft.label.replace(/[[\]\s]/g,"")}`;Zt.append("clipPath").attr("id",Qt).append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf),Zt.append("rect").attr("x",Wt).attr("y",ne+ft.height-C).attr("width",ft.width).attr("height",C).attr("fill",Ht).attr("clip-path",`url(#${Qt})`).attr("class","bl-collapse-bar");let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=mh(ft.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("class","bl-group-label").attr("x",ft.x).attr("y",ft.y-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",Pt).attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",r.text).text(fe.lines[ae])}else Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",se).attr("rx",yD).attr("ry",yD).attr("fill",Ot(r.surface,r.bg,40)).attr("stroke",r.textMuted).attr("stroke-width",1).attr("stroke-opacity",.35),Zt.append("text").attr("class","bl-group-label").attr("x",Wt+ft.width/2).attr("y",ne+18).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",w).attr("font-weight","600").attr("fill",r.text).text(ft.label)}for(let ft=0;ft<n.edges.length;ft++){let Wt=n.edges[ft],ge=bt.get(ft)??r.textMuted;if(et.size>0){let Qt=!1;for(let[Ut,fe]of et){let de=Wt.metadata[Ut];if(de&&fe.has(de.toLowerCase())){Qt=!0;break}}if(Qt)continue}if(Wt.source===Wt.target){let Qt=B.get(Wt.source);if(Qt){let Ut=Gt.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),fe=`bl-arrow-${ge.replace("#","")}`,de=Qt.x,te=Qt.y,ae=Qt.width/2,Te=Qt.height/2,Je=20,ln=de+ae,Ve=te+Te*.4,Ce=de+ae*.4,ee=te+Te,oe=ln+ae+Je,Be=Ve,fn=Ce,An=ee+Te+Je;Ut.append("path").attr("class","bl-edge").attr("d",`M ${ln} ${Ve} C ${oe} ${Be}, ${fn} ${An}, ${Ce} ${ee}`).attr("fill","none").attr("stroke",ge).attr("stroke-width",L).attr("marker-end",`url(#${fe})`)}continue}let ne;if(Wt.yOffset!==0&&Wt.parallelCount>1){let Qt=B.get(Wt.source),Ut=B.get(Wt.target),fe=Qt?.y??Wt.points[0]?.y??0,de=Ut?.y??Wt.points[Wt.points.length-1]?.y??0,te=Wt.points[0]?.x??0,ae=Wt.points[Wt.points.length-1]?.x??0,Te=(te+ae)/2,Je=(fe+de)/2;ne=[{x:te,y:fe},{x:te+(Te-te)*.3,y:fe+Wt.yOffset*.5},{x:Te,y:Je+Wt.yOffset},{x:ae-(ae-Te)*.3,y:de+Wt.yOffset*.5},{x:ae,y:de}]}else ne=Wt.points.map(Qt=>({x:Qt.x,y:Qt.y}));if(ne.length<2)continue;let se=Gt.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),Zt=`bl-arrow-${ge.replace("#","")}`,Ie=Wt.straight?dZ:e.direction==="TB"?cZ:lZ,Ht=se.append("path").attr("class","bl-edge").attr("d",Ie(ne)??"").attr("fill","none").attr("stroke",ge).attr("stroke-width",L).attr("marker-end",`url(#${Zt})`);if(Wt.bidirectional){let Qt=`bl-arrow-rev-${ge.replace("#","")}`;Ht.attr("marker-start",`url(#${Qt})`)}}for(let ft of n.nodes){let Wt=tt.get(ft.label);if(!Wt)continue;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=Wt.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ge=e.options["solid-fill"]==="on",ne=fZ(Wt,e.tagGroups,z,r,o,{active:j,hue:H,twoColor:G!==void 0,fillForValue:V},ge),se=ge?ne.text:ne.stroke,Zt=Gt.append("g").attr("class","bl-node").attr("transform",`translate(${ft.x},${ft.y})`).attr("data-line-number",Wt.lineNumber).attr("data-node-id",Wt.label).style("cursor",i?"pointer":"default").style("--bl-node-stroke",ne.stroke);for(let[Ut,fe]of Object.entries(Wt.metadata))Zt.attr(`data-tag-${Ut.toLowerCase()}`,fe.toLowerCase());Wt.value!==void 0&&Zt.attr("data-value",Wt.value),i&&Zt.on("click",Ut=>{Ut.target?.closest("a")||i(Wt.lineNumber)});let Ie=-ft.width/2,Ht=-ft.height/2;Zt.append("rect").attr("x",Ie).attr("y",Ht).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",ne.fill).attr("stroke",ne.stroke).attr("stroke-width",A);let Qt=Wt.description;if(Qt&&Qt.length>0&&!d){let fe=mh(Wt.label,ft.width,3),de=fe.lines,te=fe.fontSize*1.3,ae=de.length*te,Te=ae+12,Je=-ft.height/2+Te/2;for(let Rn=0;Rn<de.length;Rn++)Zt.append("text").attr("x",0).attr("y",Je-ae/2+te/2+Rn*te).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(de[Rn]);let ln=-ft.height/2+Te;Zt.append("line").attr("x1",-ft.width/2).attr("y1",ln).attr("x2",ft.width/2).attr("y2",ln).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1);let Ve=ln+4+k,Ce=ft.width-xD*2,ee=Math.floor(Ce/(k*Bo)),oe=k*aZ,Be=Rn=>Rn.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").replace(/https?:\/\/\S+/g,Dn=>Dn.slice(0,20)).length,fn=[];for(let Rn of Qt){let Dn=Rn.startsWith("- ")?"\u2022 "+Rn.slice(2):Rn;Dn=Dn.replace(/\bhttps?\s+([\w][\w.-]+\.[a-z]{2,}(?:\/\S*)?)/gi,(Rr,dr)=>`https://${dr}`),fn.push(Dn)}let An=Ko(fn,ee,Be),We=An.length>hD,kn=We?An.slice(0,hD):An,Kn=-ft.width/2+6,xo=Kn+10,Lr=Ss(ne.fill)>.5?r.textMuted:Ot(ne.text,ne.fill,75);for(let Rn=0;Rn<kn.length;Rn++){let Dn=kn[Rn],Rr=Dn.text;We&&Rn===kn.length-1&&(Rr=_t(Rr,k)>=Ce?nr(Rr,k,Ce):Rr+"\u2026");let dr=Ve+Rn*oe;Dn.kind==="bullet-first"&&Zt.append("text").attr("x",Kn).attr("y",dr).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size",k).attr("fill",Lr).text("\u2022");let Ur=Dn.kind==="bullet-first"||Dn.kind==="bullet-cont",Jn=Zt.append("text").attr("x",Ur?xo:0).attr("y",dr).attr("text-anchor",Ur?"start":"middle").attr("dominant-baseline","central").attr("font-size",gD).attr("fill",Lr);bn(Jn,Rr,r,k)}if(We){let Rn=Qt.join(" "),Dn=Rn.length>200?Rn.slice(0,199)+"\u2026":Rn;Zt.append("title").text(Dn)}if(e.showValues&&Wt.value!==void 0){let Rn=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value);Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",Ve+kn.length*oe).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",bD).attr("font-weight","600").attr("fill",ne.text).text(Rn)}}else if(e.showValues&&Wt.value!==void 0){let Ut=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value),fe=ft.height/2,de=-ft.height/2+fe,te=mh(Wt.label,ft.width,2),ae=te.fontSize*1.3,Te=te.lines.length*ae,Je=-ft.height/2+fe/2;for(let ln=0;ln<te.lines.length;ln++)Zt.append("text").attr("x",0).attr("y",Je-Te/2+ae/2+ln*ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",te.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(te.lines[ln]);Zt.append("line").attr("x1",-ft.width/2).attr("y1",de).attr("x2",ft.width/2).attr("y2",de).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1),Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",(de+ft.height/2)/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",bD).attr("fill",ne.text).attr("opacity",.85).text(Ut)}else{let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=mh(Wt.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("x",0).attr("y",-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",ne.text).text(fe.lines[ae])}if(ft.note)if(ft.note.collapsed)vi(Zt,{x:ft.width/2-Vo-3,y:-ft.height/2+Vo+3},r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber});else{let[Ut,fe,de,te]=Si({width:ft.width,height:ft.height},ft.note);Ei(Zt,Ut,fe,de,te,r),Li(Zt,{x:ft.note.x,y:ft.note.y,width:ft.note.width,height:ft.note.height},ft.note.lines,r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber,interactive:!0})}}let Nt=Gt.append("g").attr("class","bl-edge-labels"),Dt=N*1.3;for(let ft of n.edges){if(!ft.labelLines||ft.labelLines.length===0||ft.labelX===void 0||ft.labelY===void 0)continue;let Wt=ft.labelX,ge=ft.labelY;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=ft.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ne=ft.labelWidth??0,se=ft.labelHeight??N+6,Zt=ft.labelLines,Ie=Nt.append("g").attr("class","bl-edge-label").attr("data-line-number",String(ft.lineNumber));Ie.append("rect").attr("x",Wt-ne/2).attr("y",ge-se/2).attr("width",ne).attr("height",se).attr("rx",3).attr("fill",r.bg).attr("opacity",.72);let Ht=Ie.append("text").attr("x",Wt).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",N).attr("fill",r.textMuted),Qt=ge-(Zt.length-1)/2*Dt+N/3;Zt.forEach((Ut,fe)=>{Ht.append("tspan").attr("x",Wt).attr("y",Qt+fe*Dt).text(Ut)})}let Vt=e.nodes.some(ft=>ft.description&&ft.description.length>0);if($.length>0||Vt&&g!=="app"){let ft;Vt&&(f||g==="app")&&(ft={toggles:[{id:"descriptions",type:"toggle",label:"Descriptions",active:!d,onToggle:()=>{}}]});let Wt={...p!==void 0&&{onControlsExpand:p},onControlsToggle:(ne,se)=>{ne==="descriptions"&&f&&f(se)}},ge=yt.append("g").attr("transform",`translate(0,${ot+4})`);mn(ge,{groups:$,activeGroup:z,mode:m?"export":"preview",showInactivePills:!0,...ft!==void 0&&{controlsGroup:ft},...g!==void 0&&{controlsHost:g},...u!==void 0&&{controlsExpanded:u},callbacks:Wt,palette:r,isDark:o,width:S}),ge.selectAll("[data-legend-group]").classed("bl-legend-group",!0)}if(!s&&!m){let Wt=yt.append("g").attr("class","bl-focus-icon").attr("data-export-ignore","true").style("display","none").style("pointer-events","auto").style("cursor","pointer");Wt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let ge=14/2,ne=14/2;Wt.append("circle").attr("cx",ge).attr("cy",ne).attr("r",14/2-1).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1.5),Wt.append("circle").attr("cx",ge).attr("cy",ne).attr("r",2).attr("fill",r.textMuted)}}function gZ(t,e,n,r,o,a){wD(t,e,n,r,o,{...a?.exportDims!==void 0&&{exportDims:a.exportDims},...a?.activeTagGroup!==void 0&&{activeTagGroup:a.activeTagGroup},...a?.hiddenTagValues!==void 0&&{hiddenTagValues:a.hiddenTagValues},...a?.exportMode!==void 0&&{exportMode:a.exportMode}})}var eZ,nZ,gh,rZ,Lf,oZ,Ks,Ri,gD,aZ,hD,xD,yD,iZ,sZ,p1,bD,lZ,cZ,dZ,SD=st(()=>{"use strict";qn();Ni();So();an();Br();_o();tn();wr();je();Ro();Ds();mr();en();eZ=20,nZ=11,gh=9,rZ=11,Lf=8,oZ=4,Ks=5,Ri=4,gD=10,aZ=1.4,hD=6,xD=12,yD=8,iZ=14,sZ=32,p1=15,bD=11,lZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),cZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),dZ=Qn().x(t=>t.x).y(t=>t.y).curve(ji)});function h1(t,e=bh,n=ND){let r=Cn(t,e,n,{hardBreak:!0});if(r.length>m1){let a=r.slice(0,m1-1),i=r.slice(m1-1).join(" ");a.push(nr(i,e,n)),r=a}let o=0;for(let a of r){let i=_t(a,e);i>o&&(o=i)}return{lines:r,width:o+2*yZ,height:r.length*e*hZ+2*bZ}}function EZ(t){return g1(t,.5).p}function g1(t,e){if(t.length===0)return{p:{x:0,y:0},nx:0,ny:1};if(t.length===1)return{p:{x:t[0].x,y:t[0].y},nx:0,ny:1};let n=[],r=0;for(let i=1;i<t.length;i++){let s=Math.hypot(t[i].x-t[i-1].x,t[i].y-t[i-1].y);n.push(s),r+=s}let o=r*Math.max(0,Math.min(1,e));for(let i=1;i<t.length;i++){let s=n[i-1];if(o<=s||i===t.length-1){let l=s===0?0:Math.min(1,o/s),c=t[i-1].x,d=t[i-1].y,u=t[i].x,f=t[i].y,p=u-c,m=f-d,g=Math.hypot(p,m)||1;return{p:{x:c+p*l,y:d+m*l},nx:-m/g,ny:p/g}}o-=s}let a=t[t.length-1];return{p:{x:a.x,y:a.y},nx:0,ny:1}}function vD(t,e,n,r){return{minX:t-n/2,minY:e-r/2,maxX:t+n/2,maxY:e+r/2}}function yh(t,e,n,r,o,a){let i=t-n/2-a,s=e-r/2-a,l=t+n/2+a,c=e+r/2+a;for(let d of o)if(i<d.maxX&&l>d.minX&&s<d.maxY&&c>d.minY)return!0;return!1}function SZ(){let t=[.5];for(let e=1;e<=wZ;e++){let n=e*.08;.5-n>=.12&&t.push(.5-n),.5+n<=.88&&t.push(.5+n)}return t}function LZ(t,e,n,r){let o=SZ();for(let a of o){let{p:i}=g1(n,a);if(!yh(i.x,i.y,t,e,r,hh))return i}for(let a=LD;a<=xZ;a+=LD)for(let i of o){let{p:s,nx:l,ny:c}=g1(n,i);for(let d of[-1,1]){let u=s.x+l*a*d,f=s.y+c*a*d;if(!yh(u,f,t,e,r,hh))return{x:u,y:f}}}return null}function vZ(t){for(let r=0;r<8;r++){let o=!1;for(let a=0;a<t.length;a++)for(let i=a+1;i<t.length;i++){let s=t[a],l=t[i],c=Math.abs(s.cx-l.cx),d=Math.abs(s.cy-l.cy),u=(s.w+l.w)/2+4-c,f=(s.h+l.h)/2+4-d;if(u>0&&f>0){let p=f/2+1;s.cy<l.cy?(s.cy-=p,l.cy+=p):(s.cy+=p,l.cy-=p),o=!0}}if(!o)break}}function y1(t,e){let n=e?.fontSize??bh,r=e?.maxWidth??ND,o=[];for(let l of t.nodes)o.push(vD(l.x,l.y,l.width,l.height));for(let l of t.groups)l.collapsed&&o.push(vD(l.x,l.y,l.width,l.height));let a=[];t.edges.forEach((l,c)=>{if(!l.label||l.points.length<2)return;let d=h1(l.label,n,r),u=EZ(l.points),f=u.y;l.parallelCount>1&&l.yOffset!==0&&(f+=(l.yOffset<0?-1:1)*(d.height/2)),a.push({edgeIdx:c,cx:u.x,cy:f,w:d.width,h:d.height,lines:d.lines,resolved:!0})});for(let l of a){if(!yh(l.cx,l.cy,l.w,l.h,o,hh))continue;let c=t.edges[l.edgeIdx],d=LZ(l.w,l.h,c.points,o);d?(l.cx=d.x,l.cy=d.y):l.resolved=!1}vZ(a);for(let l of a)yh(l.cx,l.cy,l.w,l.h,o,hh)&&(l.resolved=!1);let i=new Map;for(let l of a)i.set(l.edgeIdx,l);let s=t.edges.map((l,c)=>{let d=i.get(c);return d?{...l,labelX:d.cx,labelY:d.cy,labelWidth:d.w,labelHeight:d.h,labelLines:d.lines}:l});return{layout:{...t,edges:s},unresolved:a.filter(l=>!l.resolved).map(l=>l.edgeIdx)}}var bh,ND,m1,hZ,yZ,bZ,hh,LD,xZ,wZ,b1=st(()=>{"use strict";en();bh=11,ND=160,m1=3,hZ=1.3,yZ=6,bZ=3,hh=4,LD=8,xZ=40,wZ=9});function AZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function MD(t,e,n){if(t.groups.length>0)return[];let r=t.nodes.length;if(r<3||r>40)return[];let o=t.direction==="TB",a=n?.nodesep??NZ,i=n?.ranksep??MZ,s=n?.backEdgeSide??"nearest",l=n?.restarts??(r<=14?28:r<=25?14:6),c=n?.keepK??3,d=t.nodes.map($=>$.label),u=new Set(d),f=t.edges.map(($,U)=>({e:$,i:U})).filter(({e:$})=>u.has($.source)&&u.has($.target)&&$.source!==$.target);if(f.length===0)return[];let p=new Map;for(let $ of d)p.set($,[]);for(let{e:$,i:U}of f)p.get($.source).push({to:$.target,idx:U});let m=new Set,g=new Map;for(let $ of d)g.set($,0);let h=$=>{g.set($,1);for(let{to:U,idx:X}of p.get($)){let q=g.get(U);q===1?m.add(X):q===0&&h(U)}g.set($,2)};for(let $ of d)g.get($)===0&&h($);let S=f.map(({e:$,i:U})=>m.has(U)?{from:$.target,to:$.source,idx:U,rev:!0}:{from:$.source,to:$.target,idx:U,rev:!1}),y=new Map,b=new Map;for(let $ of d)y.set($,[]),b.set($,0);for(let $ of S)y.get($.from).push($.to),b.set($.to,(b.get($.to)??0)+1);let E=new Map;for(let $ of d)E.set($,0);let x=d.filter($=>(b.get($)??0)===0),N=new Map(b),L=[];for(;x.length;){let $=x.shift();L.push($);for(let U of y.get($))E.set(U,Math.max(E.get(U),E.get($)+1)),N.set(U,N.get(U)-1),N.get(U)===0&&x.push(U)}if(L.length!==d.length)return[];let A=Math.max(...d.map($=>E.get($))),C=new Map;for(let $ of t.nodes){let U=e.get($.label)??{width:Ma,height:aa};C.set($.label,{id:$.label,dummy:!1,rank:E.get($.label),cross:0,thick:o?U.width:U.height,depth:o?U.height:U.width,realW:U.width,realH:U.height})}let k=[],w=[],v=[];for(let $ of S){if($.rev){v.push({edgeIdx:$.idx,src:$.to,tgt:$.from});continue}let U=E.get($.from),X=E.get($.to),q=[$.from],et=$.from;for(let tt=U+1;tt<X;tt++){let B=`__d${$.idx}_${tt}`;C.set(B,{id:B,dummy:!0,rank:tt,cross:0,thick:kZ,depth:0,realW:0,realH:0}),k.push({a:et,b:B}),q.push(B),et=B}k.push({a:et,b:$.to}),q.push($.to),w.push({edgeIdx:$.idx,chain:$.rev?q.slice().reverse():q})}let M=Array.from({length:A+1},()=>[]);for(let $ of C.values())M[$.rank].push($.id);let _=new Map,T=new Map;for(let $ of C.keys())_.set($,[]),T.set($,[]);for(let $ of k)T.get($.a).push($.b),_.get($.b).push($.a);let R=new Map,O=$=>{for(let U of C.keys())R.set(U,$.get(U))},I=$=>{if(!M[$+1])return 0;let X=[];for(let et of M[$]){let tt=R.get(et);for(let B of T.get(et))X.push({p:tt,q:R.get(B)})}let q=0;for(let et=0;et<X.length;et++)for(let tt=et+1;tt<X.length;tt++){let B=X[et],Q=X[tt];(B.p-Q.p)*(B.q-Q.q)<0&&q++}return q},H=()=>{let $=0;for(let U=0;U<A;U++)$+=I(U);return $},G=$=>{if($.length===0)return-1;$.sort((et,tt)=>et-tt);let U=Math.floor($.length/2);if($.length%2===1)return $[U];if($.length===2)return($[0]+$[1])/2;let X=$[U-1]-$[0],q=$[$.length-1]-$[U];return X+q===0?($[U-1]+$[U])/2:($[U-1]*q+$[U]*X)/(X+q)},D=($,U)=>{let X=M[$],q=U?_:T,et=new Map;for(let Z of X)et.set(Z,G(q.get(Z).map(lt=>R.get(lt))));let tt=X.filter(Z=>et.get(Z)>=0).sort((Z,lt)=>et.get(Z)-et.get(lt)),B=new Array(X.length).fill(null);for(let Z of X)et.get(Z)<0&&(B[R.get(Z)]=Z);let Q=0;for(let Z=0;Z<B.length;Z++)B[Z]===null&&(B[Z]=tt[Q++]);let ot=B;ot.forEach((Z,lt)=>R.set(Z,lt)),M[$]=ot},W=()=>{let $=!0,U=0;for(;$&&U++<12;){$=!1;for(let X=0;X<=A;X++){let q=M[X];for(let et=0;et<q.length-1;et++){let tt=(X>0?I(X-1):0)+(X<A?I(X):0),B=q[et],Q=q[et+1];q[et]=Q,q[et+1]=B,R.set(Q,et),R.set(B,et+1),(X>0?I(X-1):0)+(X<A?I(X):0)<tt?$=!0:(q[et]=B,q[et+1]=Q,R.set(B,et),R.set(Q,et+1))}}}},V=$=>{let U=$===0?null:AZ($);for(let X=0;X<=A;X++){let q=M[X].slice();if(U)for(let et=q.length-1;et>0;et--){let tt=Math.floor(U()*(et+1));[q[et],q[tt]]=[q[tt],q[et]]}M[X]=q,q.forEach((et,tt)=>R.set(et,tt))}},P=[];for(let $=0;$<l;$++){V($);let U=H(),X=new Map(R);for(let et=0;et<8;et++){if(et%2===0)for(let Q=1;Q<=A;Q++)D(Q,!0);else for(let Q=A-1;Q>=0;Q--)D(Q,!1);W();let B=H();if(B<U&&(U=B,X=new Map(R)),B===0)break}O(X);for(let et=0;et<=A;et++)M[et].sort((tt,B)=>R.get(tt)-R.get(B));let q=M.map(et=>et.join(",")).join("|");P.some(et=>et.sig===q)||P.push({sig:q,cross:U,order:new Map(X)})}P.sort(($,U)=>$.cross-U.cross);let F=P.slice(0,c);if(F.length===0)return[];let Y=[];for(let $ of F){O($.order);let U=Array.from({length:A+1},()=>[]);for(let X of C.values())U[X.rank].push(X.id);for(let X=0;X<=A;X++)U[X].sort((q,et)=>$.order.get(q)-$.order.get(et));Y.push(z(U))}return Y;function z($){let U=$.map(xt=>Math.max(0,...xt.map(Nt=>C.get(Nt).depth))),X=[],q=Bl;for(let xt=0;xt<=A;xt++)X[xt]=q+U[xt]/2,q+=U[xt]+i;for(let xt=0;xt<=A;xt++){let Nt=Bl;for(let Dt of $[xt]){let Vt=C.get(Dt);Vt.cross=Nt+Vt.thick/2,Nt+=Vt.thick+a}}let et=18;for(let xt=0;xt<et;xt++){let Dt=xt%2===0?Array.from({length:A+1},(Vt,$t)=>$t):Array.from({length:A+1},(Vt,$t)=>A-$t);for(let Vt of Dt){let $t=$[Vt],ft=$t.map(Wt=>{let ge=C.get(Wt),ne=0,se=0;for(let Zt of _.get(Wt)){let Ie=j(ge,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}for(let Zt of T.get(Wt)){let Ie=j(ge,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}return ne>0?se/ne:ge.cross});K($t,ft)}}let tt=1/0;for(let xt of C.values())tt=Math.min(tt,xt.cross-xt.thick/2);let B=Bl-tt;for(let xt of C.values())xt.cross+=B;let Q=xt=>o?{x:xt.cross,y:X[xt.rank]}:{x:X[xt.rank],y:xt.cross},ot=t.nodes.map(xt=>{let Nt=C.get(xt.label),Dt=Q(Nt);return{label:xt.label,x:Dt.x,y:Dt.y,width:Nt.realW,height:Nt.realH}}),Z=new Map;for(let xt of w)Z.set(xt.edgeIdx,xt.chain);let lt=1/0,nt=-1/0;for(let xt of C.values())xt.dummy||(lt=Math.min(lt,xt.cross-xt.thick/2),nt=Math.max(nt,xt.cross+xt.thick/2));let J=34,at=28,it=xt=>s==="left"?-1:s==="right"||C.get(xt.src).cross-C.get(xt.tgt).cross>=0?1:-1,Lt=v.map(xt=>({...xt,side:it(xt),span:Math.abs(C.get(xt.src).rank-C.get(xt.tgt).rank)})).sort((xt,Nt)=>xt.side-Nt.side||xt.span-Nt.span),Tt=new Map;for(let xt of Lt)Tt.set(xt.side,(Tt.get(xt.side)??0)+1);let At=new Map,rt=new Map,pt=xt=>Math.max(0,xt/2-6),gt=new Map,dt=new Map;{let xt=new Map;for(let Nt of Lt){let Dt=`${Nt.side}|${Nt.tgt}`,Vt=xt.get(Dt)??0;xt.set(Dt,Vt+1),gt.set(Nt.edgeIdx,Vt)}for(let[Nt,Dt]of xt)dt.set(Nt,Dt)}for(let xt of Lt){let Nt=xt.side,Dt=At.get(Nt)??0;At.set(Nt,Dt+1);let Vt=Tt.get(Nt),$t=C.get(xt.src),ft=C.get(xt.tgt),Wt=Nt>0?nt+J+Dt*at:lt-J-Dt*at,ge=X[$t.rank],ne=X[ft.rank],se=Vt>1?(Dt+1)/(Vt+1):0,Zt=ge+se*pt($t.depth),Ie=ne-se*pt(ft.depth),Ht=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae},Qt=10,Ut=$t.cross+Nt*($t.thick/2+Qt),fe=ft.cross+Nt*(ft.thick/2+Qt),de=gt.get(xt.edgeIdx),te=dt.get(`${Nt}|${xt.tgt}`);if(te>1&&de>0){let ae=ne-(ft.depth/2+J+(de-1)*at),Te=ft.cross+Nt*pt(ft.thick)*(de/te);rt.set(xt.edgeIdx,[Ht($t.cross,ge),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,ae),Ht(Te,ae),Ht(ft.cross,ne)])}else rt.set(xt.edgeIdx,[Ht($t.cross,ge),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,Ie),Ht(fe,Ie),Ht(ft.cross,ne)])}let ut=[];for(let xt=0;xt<t.edges.length;xt++){let Nt=t.edges[xt];if(!u.has(Nt.source)||!u.has(Nt.target))continue;let Dt;if(Nt.source===Nt.target){let Vt=Q(C.get(Nt.source));Dt=[Vt,Vt]}else if(rt.has(xt))Dt=rt.get(xt);else{let Vt=Z.get(xt);if(!Vt)continue;Dt=Vt.map($t=>Q(C.get($t)))}ut.push({source:Nt.source,target:Nt.target,...Nt.label!==void 0&&{label:Nt.label},bidirectional:Nt.bidirectional,lineNumber:Nt.lineNumber,points:Dt,yOffset:0,parallelCount:1,metadata:Nt.metadata})}let yt=1/0,vt=1/0,Gt=-1/0,Xt=-1/0;for(let xt of ot)yt=Math.min(yt,xt.x-xt.width/2),vt=Math.min(vt,xt.y-xt.height/2),Gt=Math.max(Gt,xt.x+xt.width/2),Xt=Math.max(Xt,xt.y+xt.height/2);for(let xt of ut)for(let Nt of xt.points)yt=Math.min(yt,Nt.x),vt=Math.min(vt,Nt.y),Gt=Math.max(Gt,Nt.x),Xt=Math.max(Xt,Nt.y);let bt=Bl-yt,Mt=Bl-vt,zt=bt!==0||Mt!==0?{nodes:ot.map(xt=>({...xt,x:xt.x+bt,y:xt.y+Mt})),edges:ut.map(xt=>({...xt,points:xt.points.map(Nt=>({x:Nt.x+bt,y:Nt.y+Mt}))}))}:{nodes:ot,edges:ut};return{nodes:zt.nodes,edges:zt.edges,groups:[],width:Gt+bt+Bl,height:Xt+Mt+Bl}}function j($,U){return $.dummy&&U.dummy?_Z:$.dummy||U.dummy?CZ:TZ}function K($,U){let X=$.length;if(X===0)return;let q=$.map(ot=>C.get(ot).thick/2),et=[0];for(let ot=1;ot<X;ot++)et[ot]=et[ot-1]+q[ot-1]+a+q[ot];let tt=U.map((ot,Z)=>ot-et[Z]),B=[];for(let ot=0;ot<X;ot++){let Z={pos:tt[ot],count:1,sumOffset:tt[ot],first:ot};for(;B.length&&B[B.length-1].pos>=Z.pos;){let lt=B.pop(),nt=lt.count+Z.count,J=lt.sumOffset+Z.sumOffset;Z={pos:J/nt,count:nt,sumOffset:J,first:lt.first}}B.push(Z)}let Q=new Array(X);for(let ot of B)for(let Z=0;Z<ot.count;Z++)Q[ot.first+Z]=ot.pos;for(let ot=0;ot<X;ot++)C.get($[ot]).cross=Q[ot]+et[ot]}}var NZ,MZ,kZ,Bl,TZ,CZ,_Z,kD=st(()=>{"use strict";vf();NZ=50,MZ=60,kZ=10,Bl=40,TZ=1,CZ=2,_Z=8});function WZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function FZ(t){if(t.length===0)return-1;t.sort((o,a)=>o-a);let e=Math.floor(t.length/2);if(t.length%2===1)return t[e];if(t.length===2)return(t[0]+t[1])/2;let n=t[e-1]-t[0],r=t[t.length-1]-t[e];return n+r===0?(t[e-1]+t[e])/2:(t[e-1]*r+t[e]*n)/(n+r)}function xh(t,e){let n=new Map;for(let l of t)n.set(l,[]);for(let l of e)n.get(l.from)?.push({to:l.to,idx:l.idx});let r=new Set,o=new Map;for(let l of t)o.set(l,0);let a=[],i=l=>{a.push(l);let c=new Map;for(;a.length;){let d=a[a.length-1];o.get(d)===0&&o.set(d,1);let u=n.get(d),f=c.get(d)??0,p=!1;for(;f<u.length;f++){let{to:m,idx:g}=u[f],h=o.get(m);if(h===1)r.add(g);else if(h===0){c.set(d,f+1),a.push(m),p=!0;break}}p||(c.set(d,u.length),o.set(d,2),a.pop())}};for(let l of t)o.get(l)===0&&i(l);return{dag:e.map(l=>r.has(l.idx)?{from:l.to,to:l.from,idx:l.idx,rev:!0}:{from:l.from,to:l.to,idx:l.idx,rev:!1})}}function TD(t,e){let n=new Map,r=new Map;for(let l of t)n.set(l,[]),r.set(l,0);for(let l of e)n.get(l.from).push(l.to),r.set(l.to,(r.get(l.to)??0)+1);let o=new Map;for(let l of t)o.set(l,0);let a=t.filter(l=>(r.get(l)??0)===0),i=new Map(r),s=0;for(;a.length;){let l=a.shift();s++;for(let c of n.get(l))o.set(c,Math.max(o.get(c),o.get(l)+1)),i.set(c,i.get(c)-1),i.get(c)===0&&a.push(c)}return s===t.length?o:null}function _D(t,e,n){if(t.groups.length===0)return[];let r=t.nodes.length;if(r<3||r>60)return[];let o=t.direction==="TB",a=t.nodes.map(tt=>tt.label),i=new Set(a);for(let tt of t.edges)if(tt.source.startsWith("__group_")||tt.target.startsWith("__group_"))return[];let s=new Map(t.groups.map(tt=>[tt.label,tt])),l=new Map;for(let tt of t.groups)for(let B of tt.children)i.has(B)&&l.set(B,tt.label);let c=tt=>{let B=tt,Q=new Set;for(;;){let ot=s.get(B);if(!ot?.parentGroup||Q.has(B))return B;Q.add(B),B=ot.parentGroup}},d=tt=>{let B=l.get(tt);if(!B)return[];let Q=[B],ot=B,Z=new Set([B]);for(;;){let lt=s.get(ot);if(!lt?.parentGroup||Z.has(lt.parentGroup))break;Q.push(lt.parentGroup),Z.add(lt.parentGroup),ot=lt.parentGroup}return Q.reverse()},u="\0node\0",f=tt=>{let B=l.get(tt);return B?c(B):u+tt},p=t.edges.map((tt,B)=>({e:tt,i:B})).filter(({e:tt})=>i.has(tt.source)&&i.has(tt.target)&&tt.source!==tt.target);if(p.length===0)return[];let m=new Map;for(let tt of a)m.set(tt,f(tt));let g=Array.from(new Set(a.map(tt=>m.get(tt)))),h=p.filter(({e:tt})=>m.get(tt.source)!==m.get(tt.target)).map(({e:tt,i:B})=>({from:m.get(tt.source),to:m.get(tt.target),idx:B})),{dag:S}=xh(g,h),y=TD(g,S.map(tt=>({from:tt.from,to:tt.to})));if(!y)return[];let b=new Map,E=new Map;for(let tt of a){let B=m.get(tt);(E.get(B)??E.set(B,[]).get(B)).push(tt)}for(let[tt,B]of E){let Q=new Set(B),ot=p.filter(({e:nt})=>m.get(nt.source)===tt&&m.get(nt.target)===tt&&Q.has(nt.source)&&Q.has(nt.target)).map(({e:nt,i:J})=>({from:nt.source,to:nt.target,idx:J})),{dag:Z}=xh(B,ot),lt=TD(B,Z.map(nt=>({from:nt.from,to:nt.to})));if(!lt)return[];for(let nt of B)b.set(nt,lt.get(nt))}let x=Math.max(...g.map(tt=>y.get(tt))),N=Array.from({length:x+1},()=>1);for(let tt of g){let B=Math.max(...E.get(tt).map(ot=>b.get(ot)+1)),Q=y.get(tt);N[Q]=Math.max(N[Q],B)}let L=[],A=0;for(let tt=0;tt<=x;tt++)L[tt]=A,A+=N[tt];let C=new Set(L.slice(1)),k=new Map;for(let tt of a)k.set(tt,L[y.get(m.get(tt))]+b.get(tt));let w=Math.max(...a.map(tt=>k.get(tt))),v=new Map;for(let tt of t.nodes){let B=e.get(tt.label)??{width:Ma,height:aa};v.set(tt.label,{id:tt.label,dummy:!1,rank:k.get(tt.label),cross:0,thick:o?B.width:B.height,depth:o?B.height:B.width,realW:B.width,realH:B.height,unit:m.get(tt.label),path:d(tt.label)})}let M=[],_=[],T=[],R=[];for(let{e:tt,i:B}of p){let Q=k.get(tt.source),ot=k.get(tt.target);if(Q===ot){R.push({edgeIdx:B,a:tt.source,b:tt.target});continue}if(ot<Q){T.push({edgeIdx:B,src:tt.source,tgt:tt.target});continue}let Z=[tt.source],lt=tt.source;for(let nt=Q+1;nt<ot;nt++){let J=`__d${B}_${nt}`;v.set(J,{id:J,dummy:!0,rank:nt,cross:0,thick:PZ,depth:0,realW:0,realH:0,unit:u+J,path:[]}),_.push({a:lt,b:J}),Z.push(J),lt=J}_.push({a:lt,b:tt.target}),Z.push(tt.target),M.push({edgeIdx:B,chain:Z})}let O=Array.from({length:w+1},()=>[]);for(let tt of v.values())O[tt.rank].push(tt.id);let I=new Map,H=new Map;for(let tt of v.keys())I.set(tt,[]),H.set(tt,[]);for(let tt of _)H.get(tt.a).push(tt.b),I.get(tt.b).push(tt.a);let G=new Map,D=tt=>{if(!O[tt+1])return 0;let Q=[];for(let Z of O[tt]){let lt=G.get(Z);for(let nt of H.get(Z))Q.push({p:lt,q:G.get(nt)})}let ot=0;for(let Z=0;Z<Q.length;Z++)for(let lt=Z+1;lt<Q.length;lt++){let nt=Q[Z],J=Q[lt];(nt.p-J.p)*(nt.q-J.q)<0&&ot++}return ot},W=()=>{let tt=0;for(let B=0;B<w;B++)tt+=D(B);return tt},V=(tt,B)=>{let Q=O[tt],ot=B?I:H,Z=new Map;for(let it of Q)Z.set(it,FZ(ot.get(it).map(Lt=>G.get(Lt))));let lt=Q.filter(it=>Z.get(it)>=0).sort((it,Lt)=>Z.get(it)-Z.get(Lt)),nt=new Array(Q.length).fill(null);for(let it of Q)Z.get(it)<0&&(nt[G.get(it)]=it);let J=0;for(let it=0;it<nt.length;it++)nt[it]===null&&(nt[it]=lt[J++]);let at=nt;at.forEach((it,Lt)=>G.set(it,Lt)),O[tt]=at},P=()=>{let tt=!0,B=0;for(;tt&&B++<12;){tt=!1;for(let Q=0;Q<=w;Q++){let ot=O[Q];for(let Z=0;Z<ot.length-1;Z++){let lt=(Q>0?D(Q-1):0)+(Q<w?D(Q):0),nt=ot[Z],J=ot[Z+1];ot[Z]=J,ot[Z+1]=nt,G.set(J,Z),G.set(nt,Z+1),(Q>0?D(Q-1):0)+(Q<w?D(Q):0)<lt?tt=!0:(ot[Z]=nt,ot[Z+1]=J,G.set(nt,Z),G.set(J,Z+1))}}}},F=tt=>{let B=tt===0?null:WZ(tt);for(let Q=0;Q<=w;Q++){let ot=O[Q].slice();if(B)for(let Z=ot.length-1;Z>0;Z--){let lt=Math.floor(B()*(Z+1));[ot[Z],ot[lt]]=[ot[lt],ot[Z]]}O[Q]=ot,ot.forEach((Z,lt)=>G.set(Z,lt))}},Y=n?.restarts??(r<=16?20:r<=30?12:6),z=n?.keepK??3,j=[];for(let tt=0;tt<Y;tt++){F(tt);let B=W(),Q=new Map(G);for(let Z=0;Z<8;Z++){if(Z%2===0)for(let nt=1;nt<=w;nt++)V(nt,!0);else for(let nt=w-1;nt>=0;nt--)V(nt,!1);P();let lt=W();if(lt<B&&(B=lt,Q=new Map(G)),lt===0)break}for(let[Z,lt]of Q)G.set(Z,lt);for(let Z=0;Z<=w;Z++)O[Z].sort((lt,nt)=>G.get(lt)-G.get(nt));let ot=O.map(Z=>Z.join(",")).join("|");j.some(Z=>Z.sig===ot)||j.push({sig:ot,cross:B,order:new Map(Q)})}j.sort((tt,B)=>tt.cross-B.cross);let K=j.slice(0,z);if(K.length===0)return[];let $=[];for(let tt of K){for(let[Q,ot]of tt.order)G.set(Q,ot);let B=Array.from({length:w+1},()=>[]);for(let Q of v.values())B[Q.rank].push(Q.id);for(let Q=0;Q<=w;Q++)B[Q].sort((ot,Z)=>tt.order.get(ot)-tt.order.get(Z));$.push(et(B))}return $;function U(tt,B){return tt.dummy&&B.dummy?HZ:tt.dummy||B.dummy?$Z:OZ}function X(tt,B,Q){let ot=tt.length;if(ot===0)return;let Z=[0];for(let at=1;at<ot;at++)Z[at]=Z[at-1]+Q[at];let lt=B.map((at,it)=>at-Z[it]),nt=[];for(let at=0;at<ot;at++){let it={pos:lt[at],count:1,sumOffset:lt[at],first:at};for(;nt.length&&nt[nt.length-1].pos>=it.pos;){let Lt=nt.pop(),Tt=Lt.count+it.count,At=Lt.sumOffset+it.sumOffset;it={pos:At/Tt,count:Tt,sumOffset:At,first:Lt.first}}nt.push(it)}let J=new Array(ot);for(let at of nt)for(let it=0;it<at.count;it++)J[at.first+it]=at.pos;for(let at=0;at<ot;at++)v.get(tt[at]).cross=J[at]+Z[at]}function q(tt,B){let Q=tt.thick/2+B.thick/2+RZ;if(tt.dummy||B.dummy)return Q;if(tt.unit!==B.unit)return Q+2*bd+DZ;let ot=tt.path[tt.path.length-1],Z=B.path[B.path.length-1];return ot!==Z&&(ot||Z)?Q+2*bd:Q}function et(tt){let B=tt.map(Ht=>Math.max(0,...Ht.map(Qt=>v.get(Qt).depth))),Q=[],ot=Zs;for(let Ht=0;Ht<=w;Ht++)Ht>0&&(ot+=IZ+(C.has(Ht)?GZ:0)),Q[Ht]=ot+B[Ht]/2,ot+=B[Ht];let Z=Ht=>Ht.map((Qt,Ut)=>Ut===0?0:q(v.get(Ht[Ut-1]),v.get(Qt)));for(let Ht=0;Ht<=w;Ht++){let Qt=tt[Ht],Ut=Z(Qt),fe=Zs;for(let de=0;de<Qt.length;de++){let te=v.get(Qt[de]);fe+=Ut[de],te.cross=de===0?Zs+te.thick/2:fe}}let lt=18;for(let Ht=0;Ht<lt;Ht++){let Ut=Ht%2===0?Array.from({length:w+1},(fe,de)=>de):Array.from({length:w+1},(fe,de)=>w-de);for(let fe of Ut){let de=tt[fe],te=de.map(ae=>{let Te=v.get(ae),Je=0,ln=0;for(let Ve of I.get(ae)){let Ce=U(Te,v.get(Ve));Je+=Ce,ln+=Ce*v.get(Ve).cross}for(let Ve of H.get(ae)){let Ce=U(Te,v.get(Ve));Je+=Ce,ln+=Ce*v.get(Ve).cross}return Je>0?ln/Je:Te.cross});X(de,te,Z(de))}}let nt=1/0;for(let Ht of v.values())nt=Math.min(nt,Ht.cross-Ht.thick/2);let J=Zs-nt;for(let Ht of v.values())Ht.cross+=J;let at=Ht=>o?{x:Ht.cross,y:Q[Ht.rank]}:{x:Q[Ht.rank],y:Ht.cross},it=t.nodes.map(Ht=>{let Qt=v.get(Ht.label),Ut=at(Qt);return{label:Ht.label,x:Ut.x,y:Ut.y,width:Qt.realW,height:Qt.realH}}),Lt=new Map;for(let Ht of M)Lt.set(Ht.edgeIdx,Ht.chain);let Tt=1/0,At=-1/0;for(let Ht of v.values())Ht.dummy||(Tt=Math.min(Tt,Ht.cross-Ht.thick/2),At=Math.max(At,Ht.cross+Ht.thick/2));let rt=34,pt=28,gt=Ht=>Math.max(0,Ht/2-6),dt=Ht=>v.get(Ht.src).cross-v.get(Ht.tgt).cross>=0?1:-1,ut=T.map(Ht=>({...Ht,side:dt(Ht),span:Math.abs(v.get(Ht.src).rank-v.get(Ht.tgt).rank)})).sort((Ht,Qt)=>Ht.side-Qt.side||Ht.span-Qt.span),yt=new Map;for(let Ht of ut)yt.set(Ht.side,(yt.get(Ht.side)??0)+1);let vt=new Map,Gt=new Map;for(let Ht of ut){let Qt=Ht.side,Ut=vt.get(Qt)??0;vt.set(Qt,Ut+1);let fe=yt.get(Qt),de=v.get(Ht.src),te=v.get(Ht.tgt),ae=Qt>0?At+rt+Ut*pt:Tt-rt-Ut*pt,Te=Q[de.rank],Je=Q[te.rank],ln=fe>1?(Ut+1)/(fe+1):0,Ve=Te-ln*gt(de.depth),Ce=Je+ln*gt(te.depth),ee=(An,We)=>o?{x:An,y:We}:{x:We,y:An},oe=10,Be=de.cross+Qt*(de.thick/2+oe),fn=te.cross+Qt*(te.thick/2+oe);Gt.set(Ht.edgeIdx,[ee(de.cross,Te),ee(Be,Ve),ee(ae,Ve),ee(ae,Ce),ee(fn,Ce),ee(te.cross,Je)])}let Xt=new Map;for(let Ht of R){let Qt=v.get(Ht.a),Ut=v.get(Ht.b),fe=Q[Qt.rank],de=fe-(Qt.depth/2+26),te=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae};Xt.set(Ht.edgeIdx,[te(Qt.cross,fe),te(Qt.cross,de),te(Ut.cross,de),te(Ut.cross,fe)])}let bt=[];for(let Ht=0;Ht<t.edges.length;Ht++){let Qt=t.edges[Ht];if(!i.has(Qt.source)||!i.has(Qt.target))continue;let Ut;if(Qt.source===Qt.target){let fe=at(v.get(Qt.source));Ut=[fe,fe]}else if(Gt.has(Ht))Ut=Gt.get(Ht);else if(Xt.has(Ht))Ut=Xt.get(Ht);else{let fe=Lt.get(Ht);if(!fe)continue;Ut=fe.map(de=>at(v.get(de)))}bt.push({source:Qt.source,target:Qt.target,...Qt.label!==void 0&&{label:Qt.label},bidirectional:Qt.bidirectional,lineNumber:Qt.lineNumber,points:Ut,yOffset:0,parallelCount:1,metadata:Qt.metadata})}let Mt=new Map(it.map(Ht=>[Ht.label,{l:Ht.x-Ht.width/2,r:Ht.x+Ht.width/2,t:Ht.y-Ht.height/2,b:Ht.y+Ht.height/2}])),zt=Ht=>{let Qt=0,Ut=Ht,fe=new Set;for(;Ut&&!fe.has(Ut);)fe.add(Ut),Ut=s.get(Ut)?.parentGroup,Ut&&Qt++;return Qt},xt=new Map;for(let Ht of t.groups)Ht.parentGroup&&(xt.get(Ht.parentGroup)??xt.set(Ht.parentGroup,[]).get(Ht.parentGroup)).push(Ht.label);let Nt=new Map,Dt=[...t.groups].sort((Ht,Qt)=>zt(Qt.label)-zt(Ht.label)),Vt=[];for(let Ht of Dt){let Qt=1/0,Ut=-1/0,fe=1/0,de=-1/0,te=Ve=>{Qt=Math.min(Qt,Ve.l),Ut=Math.max(Ut,Ve.r),fe=Math.min(fe,Ve.t),de=Math.max(de,Ve.b)};for(let Ve of Ht.children){let Ce=Mt.get(Ve);Ce&&te(Ce)}for(let Ve of xt.get(Ht.label)??[]){let Ce=Nt.get(Ve);Ce&&te(Ce)}if(!Number.isFinite(Qt))continue;let ae=Qt-bd,Te=Ut+bd,Je=fe-CD,ln=de+bd;Nt.set(Ht.label,{l:ae,r:Te,t:Je,b:ln}),Vt.push({label:Ht.label,lineNumber:Ht.lineNumber,x:(ae+Te)/2,y:(Je+ln)/2,width:Te-ae,height:ln-Je,collapsed:!1,childCount:Ht.children.length})}let $t=1/0,ft=1/0,Wt=-1/0,ge=-1/0,ne=(Ht,Qt,Ut,fe)=>{$t=Math.min($t,Ht),ft=Math.min(ft,Qt),Wt=Math.max(Wt,Ut),ge=Math.max(ge,fe)};for(let Ht of it)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);for(let Ht of bt)for(let Qt of Ht.points)ne(Qt.x,Qt.y,Qt.x,Qt.y);for(let Ht of Vt)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);let se=Zs-$t,Zt=Zs-ft,Ie=se!==0||Zt!==0;return{nodes:Ie?it.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):it,edges:Ie?bt.map(Ht=>({...Ht,points:Ht.points.map(Qt=>({x:Qt.x+se,y:Qt.y+Zt}))})):bt,groups:Ie?Vt.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):Vt,width:Wt+se+Zs,height:ge+Zt+Zs}}}var RZ,IZ,PZ,Zs,bd,CD,DZ,GZ,OZ,$Z,HZ,x1=st(()=>{"use strict";vf();RZ=50,IZ=60,PZ=10,Zs=40,bd=16,CD=32,DZ=24,GZ=CD+2*bd,OZ=1,$Z=2,HZ=8});var $D={};ye($D,{countEdgeNearMiss:()=>nQ,countEdgeNodePierces:()=>GD,countEdgeOverlaps:()=>DD,countGroupOverlaps:()=>Eh,countSplineCrossings:()=>PD,deroutePierces:()=>w1,detectEdgeNodePierces:()=>S1,detectEdgeOverlaps:()=>wh,detectGroupOverlaps:()=>rQ,layoutBoxesAndLinesSearch:()=>sQ,separateGroupBands:()=>OD});function XZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function jZ(t,e){let n=t.slice();for(let r=n.length-1;r>0;r--){let o=Math.floor(e()*(r+1));[n[r],n[o]]=[n[o],n[r]]}return n}function ZZ(t){let e=t.match(KZ)??[],n=[],r=0,o=0,a=0,i="",s=()=>parseFloat(e[r++]),l=(c,d,u,f)=>{for(let p=0;p<=1;p+=.12){let m=1-p;u?n.push({x:m*m*m*c.x+3*m*m*p*d.x+3*m*p*p*u.x+p*p*p*f.x,y:m*m*m*c.y+3*m*m*p*d.y+3*m*p*p*u.y+p*p*p*f.y}):n.push({x:m*m*c.x+2*m*p*d.x+p*p*f.x,y:m*m*c.y+2*m*p*d.y+p*p*f.y})}};for(;r<e.length;){let c=e[r];if(/[MLQC]/i.test(c)&&(i=c,r++),i==="M"||i==="L"){let d=s(),u=s();n.push({x:d,y:u}),o=d,a=u}else if(i==="Q"){let d={x:s(),y:s()},u={x:s(),y:s()};l({x:o,y:a},d,null,u),o=u.x,a=u.y}else if(i==="C"){let d={x:s(),y:s()},u={x:s(),y:s()},f={x:s(),y:s()};l({x:o,y:a},d,u,f),o=f.x,a=f.y}else r++}return n}function E1(t){let e=t.edges,n=AD.get(e);if(n)return n;let r=t.edges.map(o=>{let a=o.points.length>=2?ZZ(qZ(o.points)??""):[],i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of a)d.x<i&&(i=d.x),d.x>l&&(l=d.x),d.y<s&&(s=d.y),d.y>c&&(c=d.y);return{pts:a,x0:i,y0:s,x1:l,y1:c}});return AD.set(e,r),r}function QZ(t,e,n,r){let o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(Math.abs(o)<1e-9)return null;let a=((n.x-t.x)*(r.y-n.y)-(n.y-t.y)*(r.x-n.x))/o,i=((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))/o;return a>0&&a<1&&i>0&&i<1?{x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)}:null}function PD(t,e=1/0){let n=new Map;for(let s of t.nodes)n.set(s.label,{x:s.x,y:s.y});for(let s of t.groups)s.collapsed&&n.set("__group_"+s.label,{x:s.x,y:s.y});let r=E1(t),o=t.edges,a=34,i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){let c=r[s],d=r[l];if(c.pts.length<2||d.pts.length<2||c.x1<d.x0||d.x1<c.x0||c.y1<d.y0||d.y1<c.y0)continue;let u=o[s],f=o[l],p,m;(u.source===f.source||u.source===f.target)&&(p=n.get(u.source)),(u.target===f.source||u.target===f.target)&&(m=n.get(u.target));let g=[],h=c.pts,S=d.pts;for(let y=1;y<h.length;y++){let b=h[y-1],E=h[y],x=b.x<E.x?b.x:E.x,N=b.x>E.x?b.x:E.x,L=b.y<E.y?b.y:E.y,A=b.y>E.y?b.y:E.y;for(let C=1;C<S.length;C++){let k=S[C-1],w=S[C];if(N<(k.x<w.x?k.x:w.x)||(k.x>w.x?k.x:w.x)<x||A<(k.y<w.y?k.y:w.y)||(k.y>w.y?k.y:w.y)<L)continue;let v=QZ(b,E,k,w);v&&(p&&Math.hypot(v.x-p.x,v.y-p.y)<a||m&&Math.hypot(v.x-m.x,v.y-m.y)<a||g.some(M=>Math.hypot(M.x-v.x,M.y-v.y)<6)||g.push(v))}}if(i+=g.length,i>e)return i}return i}function JZ(t,e,n){let r=n.x-e.x,o=n.y-e.y,a=r*r+o*o;if(a<1e-9)return Math.hypot(t.x-e.x,t.y-e.y);let i=((t.x-e.x)*r+(t.y-e.y)*o)/a;return i=Math.max(0,Math.min(1,i)),Math.hypot(t.x-(e.x+i*r),t.y-(e.y+i*o))}function tQ(t,e){let n=1/0;for(let r=1;r<e.length;r++)n=Math.min(n,JZ(t,e[r-1],e[r]));return n}function RD(t,e){let n=Math.max(e.x-e.w/2-t.x,0,t.x-(e.x+e.w/2)),r=Math.max(e.y-e.h/2-t.y,0,t.y-(e.y+e.h/2));return Math.hypot(n,r)}function wh(t,e){let n=e?.dist??8,r=e?.minLen??16,o=e?.nodeClear??12,a=new Map;for(let c of t.nodes)a.set(c.label,{x:c.x,y:c.y,w:c.width,h:c.height});for(let c of t.groups)c.collapsed&&a.set("__group_"+c.label,{x:c.x,y:c.y,w:c.width,h:c.height});let i=E1(t),s=t.edges,l=[];for(let c=0;c<i.length;c++)for(let d=c+1;d<i.length;d++){let u=i[c],f=i[d];if(u.pts.length<2||f.pts.length<2||u.x1+n<f.x0||f.x1+n<u.x0||u.y1+n<f.y0||f.y1+n<u.y0)continue;let p=s[c],m=s[d],g,h;(p.source===m.source||p.source===m.target)&&(g=a.get(p.source)),(p.target===m.source||p.target===m.target)&&(h=a.get(p.target));let S=[],y=0,b=()=>{y>=r&&S.length>=2&&l.push({mid:S[Math.floor(S.length/2)],length:y,pts:S.slice()}),S=[],y=0};for(let E of u.pts)!(g!==void 0&&RD(E,g)<o||h!==void 0&&RD(E,h)<o)&&tQ(E,f.pts)<n?(S.length&&(y+=Math.hypot(E.x-S[S.length-1].x,E.y-S[S.length-1].y)),S.push(E)):b();b()}return l}function DD(t,e){return wh(t,e).length}function S1(t,e){let n=e?.inset??6,r=e?.minPts??2,o=[];for(let l of t.nodes)o.push({key:l.label,x:l.x,y:l.y,w:l.width,h:l.height});for(let l of t.groups)l.collapsed&&o.push({key:"__group_"+l.label,x:l.x,y:l.y,w:l.width,h:l.height});let a=(l,c)=>Math.abs(l.x-c.x)<c.w/2-n&&Math.abs(l.y-c.y)<c.h/2-n,i=[],s=E1(t);return t.edges.forEach((l,c)=>{if(l.points.length<2)return;let d=s[c].pts;for(let u of o){if(u.key===l.source||u.key===l.target||"__group_"+u.key===l.source||"__group_"+u.key===l.target)continue;let f=d.filter(p=>a(p,u));f.length>=r&&i.push({edgeIdx:c,node:u.key,pts:f})}}),i}function GD(t,e){return S1(t,e).length}function w1(t){let e=S1(t);if(!e.length)return t;let n=new Map;for(let a of t.nodes)n.set(a.label,{x:a.x,y:a.y,w:a.width,h:a.height});for(let a of t.groups)a.collapsed&&n.set("__group_"+a.label,{x:a.x,y:a.y,w:a.width,h:a.height});let r=new Map;for(let a of e){let i=r.get(a.edgeIdx);i?i.push(a.node):r.set(a.edgeIdx,[a.node])}let o=t.edges.map((a,i)=>{let s=r.get(i);if(!s)return a;let l=a.points.map(c=>({x:c.x,y:c.y}));for(let c of s){let d=n.get(c);d&&(l=eQ(l,d))}return{...a,points:l}});return{...t,edges:o}}function eQ(t,e){if(t.length<2)return t;let n={x:e.x,y:e.y},r=-1,o=0,a=1/0,i=t[0];for(let x=0;x<t.length-1;x++){let N=t[x],L=t[x+1],A=L.x-N.x,C=L.y-N.y,k=A*A+C*C||1e-9,w=((n.x-N.x)*A+(n.y-N.y)*C)/k;w=Math.max(0,Math.min(1,w));let v={x:N.x+w*A,y:N.y+w*C},M=Math.hypot(v.x-n.x,v.y-n.y);M<a&&(a=M,r=x,o=w,i=v)}if(r<0)return t;let s=i.x-n.x,l=i.y-n.y;Math.hypot(s,l)<1&&(e.w<=e.h?(s=1,l=0):(s=0,l=1));let c=Math.hypot(s,l)||1;s/=c,l/=c;let d=t[r],u=t[r+1],f=u.x-d.x,p=u.y-d.y,m=Math.hypot(f,p)||1;f/=m,p/=m;let g=Math.hypot(e.w,e.h)/2+18,h=Math.hypot(e.w,e.h)/2,S={x:i.x-f*h+s*g*.5,y:i.y-p*h+l*g*.5},y={x:n.x+s*g,y:n.y+l*g},b={x:i.x+f*h+s*g*.5,y:i.y+p*h+l*g*.5},E=t.slice(0,r+1);return E.push(S,y,b),E.push(...t.slice(r+1)),E}function nQ(t,e){let n=e?.near??14,r=e?.tight??8,o=e?.minLen??18,a=wh(t,{dist:n,minLen:o}).length,i=wh(t,{dist:r,minLen:o}).length;return Math.max(0,a-i)}function rQ(t,e){let n=e?.margin??4,r=t.groups.map(s=>({label:s.label,l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Nf}:s),i=new Set;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&(i.add(r[s].label),i.add(r[l].label))}return[...i]}function Eh(t,e){let n=e?.margin??4,r=t.groups.map(s=>({l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Nf}:s),i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&i++}return i}function OD(t,e){if(t.groups.some(T=>T.collapsed)||Eh(t)===0)return t;let n=new Map;for(let T of e.groups)n.set(T.label,T.parentGroup);let r=T=>{let R=T,O=new Set;for(;;){let I=n.get(R);if(!I||O.has(I))return R;O.add(R),R=I}},o=e.groups.filter(T=>!T.parentGroup).map(T=>T.label);if(o.length<2)return t;let a=new Map;for(let T of e.groups)for(let R of T.children)e.groups.some(O=>O.label===R)||a.set(R,r(T.label));let i=e.direction==="TB"?"x":"y",s=new Map(t.groups.map(T=>[T.label,T])),l=o.map(T=>{let R=s.get(T),O=(i==="y"?R.height:R.width)/2,I=(i==="y"?R.y:R.x)-O,H=(i==="y"?R.y:R.x)+O,G=e.groups.some(D=>D.parentGroup===T);return i==="y"&&G&&(I-=Nf),{label:T,lo:I,hi:H,c:(I+H)/2}});l.sort((T,R)=>T.c-R.c);let c=16,d=l.map(T=>(T.hi-T.lo)/2),u=[0];for(let T=1;T<l.length;T++)u[T]=u[T-1]+d[T-1]+c+d[T];let f=l.map((T,R)=>T.c-u[R]),p=[];for(let T=0;T<l.length;T++){let R={pos:f[T],count:1,sum:f[T],first:T};for(;p.length&&p[p.length-1].pos>=R.pos;){let O=p.pop(),I=O.count+R.count,H=O.sum+R.sum;R={pos:H/I,count:I,sum:H,first:O.first}}p.push(R)}let m=new Array(l.length);for(let T of p)for(let R=0;R<T.count;R++)m[T.first+R]=T.pos+u[T.first+R];let g=new Map,h=!1;if(l.forEach((T,R)=>{let O=m[R]-T.c;g.set(T.label,O),Math.abs(O)>.5&&(h=!0)}),!h)return t;let S=T=>{if(T.startsWith("__group_"))return g.get(r(T.slice(8)))??0;let R=a.get(T);return R?g.get(R)??0:0},y=(T,R)=>i==="y"?{x:T.x,y:T.y+R}:{x:T.x+R,y:T.y},b=t.nodes.map(T=>{let R=S(T.label);return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),E=t.groups.map(T=>{let R=g.get(r(T.label))??0;return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),x=t.edges.map(T=>{let R=S(T.source),O=S(T.target);if(!R&&!O)return T;let I=T.points.length,H=T.points.map((G,D)=>{let W=I>1?D/(I-1):0;return y(G,R*(1-W)+O*W)});return{...T,points:H}}),N=1/0,L=1/0,A=-1/0,C=-1/0,k=(T,R)=>{T<N&&(N=T),T>A&&(A=T),R<L&&(L=R),R>C&&(C=R)};for(let T of b)k(T.x-T.width/2,T.y-T.height/2),k(T.x+T.width/2,T.y+T.height/2);for(let T of E)k(T.x-T.width/2,T.y-T.height/2-Nf),k(T.x+T.width/2,T.y+T.height/2);for(let T of x)for(let R of T.points)k(R.x,R.y);let w=40,v=w-N,M=w-L,_=v!==0||M!==0;return{nodes:_?b.map(T=>({...T,x:T.x+v,y:T.y+M})):b,groups:_?E.map(T=>({...T,x:T.x+v,y:T.y+M})):E,edges:_?x.map(T=>({...T,points:T.points.map(R=>({x:R.x+v,y:R.y+M}))})):x,width:A-N+2*w,height:C-L+2*w}}function oQ(t,e,n,r){let o=e.x-t.x,a=e.y-t.y,i=r.x-n.x,s=r.y-n.y,l=o*s-a*i;if(Math.abs(l)<1e-9)return!1;let c=((n.x-t.x)*s-(n.y-t.y)*i)/l,d=((n.x-t.x)*a-(n.y-t.y)*o)/l;return c>.001&&c<.999&&d>.001&&d<.999}function ID(t){let e=t.edges.filter(o=>o.points.length>=2),n=e.map(o=>{let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let c of o.points)c.x<a&&(a=c.x),c.x>s&&(s=c.x),c.y<i&&(i=c.y),c.y>l&&(l=c.y);return{x0:a,y0:i,x1:s,y1:l}}),r=0;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++){let i=e[o],s=e[a];if(i.source===s.source||i.source===s.target||i.target===s.source||i.target===s.target)continue;let l=n[o],c=n[a];if(l.x1<c.x0||c.x1<l.x0||l.y1<c.y0||c.y1<l.y0)continue;let d=i.points,u=s.points,f=!1;for(let p=0;p<d.length-1&&!f;p++)for(let m=0;m<u.length-1;m++)if(oQ(d[p],d[p+1],u[m],u[m+1])){f=!0;break}f&&r++}return r}function aQ(t,e){if(!e?.size)return 0;let n=0,r=0;for(let o of t.nodes){let a=e.get(o.label);a&&(n+=Math.hypot(o.x-a.x,o.y-a.y),r++)}return r?n/r:0}function iQ(t){let e=0;for(let n of t.edges)for(let r=1;r<n.points.length;r++)e+=Math.hypot(n.points[r].x-n.points[r-1].x,n.points[r].y-n.points[r-1].y);return e}async function sQ(t,e,n){let r=n?.hideDescriptions??!1,o=n?.reserveEdgeLabels??!1,a=n?.onProgress,i=a?()=>new Promise(nt=>setTimeout(nt)):()=>{},s=150,l=30,c=performance.now(),d=c,u=new Set;if(e){let nt=new Set;for(let J of e.originalGroups)t.groups.some(at=>at.label===J.label)||nt.add(J.label);for(let J of nt){let it=e.originalGroups.find(Lt=>Lt.label===J)?.parentGroup;(!it||!nt.has(it))&&u.add(J)}}let f=new Map,p=0;for(let nt of t.nodes){let J=r?{width:Ma,height:aa}:L1(nt,t.showValues===!0);f.set(nt.label,J),!r&&nt.description&&nt.description.length>0&&(p=Math.max(p,J.height))}if(p>0){for(let nt of t.nodes)if(nt.description&&nt.description.length>0){let J=f.get(nt.label);f.set(nt.label,{width:J.width,height:p})}}let m=nt=>`__group_${nt}`,g=t.direction==="TB"?"TB":"LR",h=new Set(t.nodes.map(nt=>nt.label)),S=new Map,y=new Map;for(let nt of t.groups)if(S.set(nt.label,nt.children.filter(J=>h.has(J))),nt.parentGroup){let J=y.get(nt.parentGroup)??[];J.push(nt.label),y.set(nt.parentGroup,J)}let b=new Map,E=nt=>{let J=b.get(nt);if(J)return J;b.set(nt,[]);let at=[...S.get(nt)??[]];for(let it of y.get(nt)??[])at.push(...E(it));return b.set(nt,at),at},x=new Map,N=new Map;for(let nt of t.groups){let J=E(nt.label);if(J.length===0)continue;let at=new Set(J),it=new Map;for(let gt of t.edges)if(at.has(gt.source)&&at.has(gt.target)){let dt=it.get(gt.target)??[];dt.push(gt.source),it.set(gt.target,dt)}let Lt=new Map,Tt=new Set,At=gt=>{let dt=Lt.get(gt);if(dt!==void 0)return dt;if(Tt.has(gt))return 0;Tt.add(gt);let ut=0;for(let yt of it.get(gt)??[])ut=Math.max(ut,At(yt)+1);return Tt.delete(gt),Lt.set(gt,ut),ut},rt=J[0],pt=J[0];for(let gt of J)At(gt)>At(rt)&&(rt=gt),At(gt)<At(pt)&&(pt=gt);x.set(m(nt.label),rt),N.set(m(nt.label),pt)}let L=nt=>x.get(nt)??nt,A=nt=>N.get(nt)??nt,C=nt=>`${nt.source}->${nt.target}#${nt.lineNumber}`,k=(nt,J)=>{let at=J.x-nt.x,it=J.y-nt.y,Lt=at===0?1/0:nt.w/2/Math.abs(at),Tt=it===0?1/0:nt.h/2/Math.abs(it),At=Math.min(Lt,Tt);return Number.isFinite(At)?{x:nt.x+at*At,y:nt.y+it*At}:{x:nt.x,y:nt.y}},w=(nt,J)=>Math.abs(nt.x-J.x)<=J.w/2&&Math.abs(nt.y-J.y)<=J.h/2,v=t.nodePositions,M=new Set(t.groups.map(nt=>nt.label)),_=t.groups.every(nt=>!nt.parentGroup&&!nt.children.some(J=>M.has(J))),T=new Set((e?.originalGroups??t.groups).map(nt=>nt.label)),R=u.size===0||v!==void 0&&e!==void 0&&[...u].every(nt=>{let J=e.originalGroups.find(at=>at.label===nt);return!J||J.parentGroup?!1:J.children.every(at=>v.has(at)&&!T.has(at))}),O=v!==void 0&&(t.nodes.length>0||u.size>0)&&t.nodes.every(nt=>v.has(nt.label))&&_&&R;function I(nt){let J=new Map,at=[];if(e)for(let Nt of u){let Dt=e.originalGroups.find(se=>se.label===Nt);if(!Dt)continue;let Vt=1/0,$t=1/0,ft=-1/0,Wt=-1/0;for(let se of Dt.children){let Zt=nt.get(se);Zt&&(Vt=Math.min(Vt,Zt.x),ft=Math.max(ft,Zt.x),$t=Math.min($t,Zt.y),Wt=Math.max(Wt,Zt.y))}if(!Number.isFinite(Vt))continue;let ge=(Vt+ft)/2,ne=($t+Wt)/2;J.set(`__group_${Nt}`,{x:ge,y:ne}),at.push({label:Nt,lineNumber:Dt.lineNumber,childCount:e.collapsedChildCounts.get(Nt)??Dt.children.length,x:ge,y:ne})}let it=Nt=>nt.get(Nt)??J.get(Nt),Lt=Nt=>{let Dt=it(Nt),Vt=f.get(Nt)??{width:Ma,height:aa};return{x:Dt.x,y:Dt.y,w:Vt.width,h:Vt.height}},Tt=t.nodes.map(Nt=>{let Dt=Lt(Nt.label);return{label:Nt.label,x:Dt.x,y:Dt.y,width:Dt.w,height:Dt.h}}),At=t.edges.flatMap(Nt=>{let Dt=it(Nt.source),Vt=it(Nt.target);if(!Dt||!Vt)return[];let $t=Lt(Nt.source),ft=Lt(Nt.target),Wt=k($t,Vt),ge=k(ft,Dt);return[{source:Nt.source,target:Nt.target,...Nt.label!==void 0&&{label:Nt.label},bidirectional:Nt.bidirectional,lineNumber:Nt.lineNumber,points:[Wt,ge],yOffset:0,parallelCount:1,metadata:Nt.metadata,straight:!0}]}),rt=16,pt=new Map(Tt.map(Nt=>[Nt.label,Nt])),gt=[];for(let Nt of t.groups){let Dt=1/0,Vt=1/0,$t=-1/0,ft=-1/0;for(let Zt of Nt.children){let Ie=pt.get(Zt);Ie&&(Dt=Math.min(Dt,Ie.x-Ie.width/2),$t=Math.max($t,Ie.x+Ie.width/2),Vt=Math.min(Vt,Ie.y-Ie.height/2),ft=Math.max(ft,Ie.y+Ie.height/2))}if(!Number.isFinite(Dt))continue;let Wt=Dt-rt,ge=$t+rt,ne=Vt-Nf,se=ft+rt;gt.push({label:Nt.label,lineNumber:Nt.lineNumber,x:(Wt+ge)/2,y:(ne+se)/2,width:ge-Wt,height:se-ne,collapsed:!1,childCount:Nt.children.length})}for(let Nt of at)gt.push({label:Nt.label,lineNumber:Nt.lineNumber,x:Nt.x,y:Nt.y,width:Ma,height:aa,collapsed:!0,childCount:Nt.childCount});let dt=40,ut=1/0,yt=1/0,vt=-1/0,Gt=-1/0,Xt=(Nt,Dt)=>{Nt<ut&&(ut=Nt),Nt>vt&&(vt=Nt),Dt<yt&&(yt=Dt),Dt>Gt&&(Gt=Dt)};for(let Nt of Tt)Xt(Nt.x-Nt.width/2,Nt.y-Nt.height/2),Xt(Nt.x+Nt.width/2,Nt.y+Nt.height/2);for(let Nt of At)for(let Dt of Nt.points)Xt(Dt.x,Dt.y);for(let Nt of gt)Xt(Nt.x-Nt.width/2,Nt.y-Nt.height/2),Xt(Nt.x+Nt.width/2,Nt.y+Nt.height/2);let bt=2,Mt=ut<dt-bt?dt-ut:0,zt=yt<dt-bt?dt-yt:0,xt=Mt!==0||zt!==0;return{nodes:xt?Tt.map(Nt=>({...Nt,x:Nt.x+Mt,y:Nt.y+zt})):Tt,edges:xt?At.map(Nt=>({...Nt,points:Nt.points.map(Dt=>({x:Dt.x+Mt,y:Dt.y+zt}))})):At,groups:xt?gt.map(Nt=>({...Nt,x:Nt.x+Mt,y:Nt.y+zt})):gt,width:vt+Mt+dt,height:Gt+zt+dt}}function H(nt){let J=nt.seed===void 0?null:XZ(nt.seed+1),at=dt=>J?jZ(dt,J):dt.slice(),it=new rr.graphlib.Graph({compound:!0,multigraph:!0});it.setGraph({rankdir:g,ranker:nt.ranker,nodesep:nt.nodesep,ranksep:nt.ranksep,edgesep:20,marginx:40,marginy:40}),it.setDefaultEdgeLabel(()=>({}));for(let dt of at(t.groups))it.setNode(m(dt.label),{label:dt.label});for(let dt of at(t.nodes)){let ut=f.get(dt.label);it.setNode(dt.label,{width:ut.width,height:ut.height})}for(let dt of u)it.setNode(m(dt),{width:Ma,height:aa});for(let dt of t.groups){dt.parentGroup&&it.hasNode(m(dt.parentGroup))&&it.setParent(m(dt.label),m(dt.parentGroup));for(let ut of at(dt.children))it.hasNode(ut)&&it.setParent(ut,m(dt.label))}if(e)for(let dt of u){let ut=e.originalGroups.find(yt=>yt.label===dt);ut?.parentGroup&&!u.has(ut.parentGroup)&&it.hasNode(m(ut.parentGroup))&&it.setParent(m(dt),m(ut.parentGroup))}for(let dt of at(t.edges)){let ut=L(dt.source),yt=A(dt.target);if(ut!==yt&&it.hasNode(ut)&&it.hasNode(yt)){let vt={};if(o&&dt.label){let Gt=h1(dt.label,bh);vt={width:Gt.width,height:Gt.height,labelpos:"c"}}it.setEdge(ut,yt,vt,C(dt))}}rr.layout(it);let Lt=t.nodes.map(dt=>{let ut=it.node(dt.label);return{label:dt.label,x:ut.x,y:ut.y,width:ut.width,height:ut.height}}),Tt=t.groups.map(dt=>{let ut=it.node(m(dt.label));return{label:dt.label,lineNumber:dt.lineNumber,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!1,childCount:dt.children.length}});for(let dt of u){let ut=it.node(m(dt));Tt.push({label:dt,lineNumber:0,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!0,childCount:e?.collapsedChildCounts.get(dt)??0})}let At=new Map;for(let dt of t.groups){let ut=it.node(m(dt.label));ut&&At.set(m(dt.label),{x:ut.x,y:ut.y,w:ut.width,h:ut.height})}let rt=(dt,ut,yt)=>{if(dt.length<2)return dt;let vt=dt,Gt=At.get(ut);if(Gt){let bt=0;for(;bt<vt.length-1&&w(vt[bt],Gt);)bt++;vt=[k(Gt,vt[bt]),...vt.slice(bt)]}let Xt=At.get(yt);if(Xt){let bt=vt.length-1;for(;bt>0&&w(vt[bt],Xt);)bt--;vt=[...vt.slice(0,bt+1),k(Xt,vt[bt])]}return vt},pt=t.edges.flatMap(dt=>{let ut=L(dt.source),yt=A(dt.target),vt=C(dt);if(ut===yt||!it.hasEdge(ut,yt,vt))return[];let Gt=it.edge(ut,yt,vt),Xt=rt(Gt?.points??[],dt.source,dt.target);return[{source:dt.source,target:dt.target,...dt.label!==void 0&&{label:dt.label},bidirectional:dt.bidirectional,lineNumber:dt.lineNumber,points:Xt,yOffset:0,parallelCount:1,metadata:dt.metadata}]}),gt=it.graph();return{nodes:Lt,edges:pt,groups:Tt,width:gt.width??800,height:gt.height??600}}if(O)return I(v);let G=t.nodes.length,D=n?.seeds??(G<=12?80:G<=22?40:G<=35?22:10),W=n?.refineK??6,V=n?.lambda??BZ,P=n?.previousPositions,F=["network-simplex","tight-tree","longest-path"],Y=[{nodesep:50,ranksep:60},{nodesep:34,ranksep:46},{nodesep:66,ranksep:82}],z=[];for(let nt of F)for(let J of Y)z.push({ranker:nt,...J});for(let nt=0;nt<D;nt++)z.push({ranker:"network-simplex",nodesep:50,ranksep:60,seed:nt});let j=(nt,J)=>{let at=PD(nt,J);return at>J?1/0:at+DD(nt)+GD(nt)+Eh(nt)},K=(nt,J)=>J*1e6+iQ(nt)+V*aQ(nt,P)*10,$=z.length+Math.min(n?.refineK??6,z.length),U=0,X=async nt=>{if(!a)return;a(++U,$,nt);let J=performance.now();J-c>s&&J-d>l&&(d=J,await i())},q=[];for(let nt of z){try{q.push(H(nt))}catch{}await X("Optimizing layout")}if(!q.length)return H({ranker:"network-simplex",nodesep:50,ranksep:60});let et=[];try{et=MD(t,f)}catch{}if(t.groups.length>0&&u.size===0)try{et=et.concat(_D(t,f))}catch{}let tt=new Map;for(let nt of q)tt.set(nt,K(nt,ID(nt)));q.sort((nt,J)=>tt.get(nt)-tt.get(J));let B=Math.min(W,q.length),Q=q[0],ot=1/0,Z=1/0,lt=nt=>{let J=j(nt,Z);if(J===1/0)return;let at=K(nt,J);at<ot&&(ot=at,Z=J,Q=nt)};for(let nt of q.slice(0,B))lt(nt),await X("Refining layout");if(Z>=YZ&&G<=VZ){let nt=[];for(let at=D;at<D+zZ;at++)try{nt.push(H({ranker:"network-simplex",nodesep:50,ranksep:60,seed:at}))}catch{}let J=new Map;for(let at of nt)J.set(at,K(at,ID(at)));nt.sort((at,it)=>J.get(at)-J.get(it));for(let at of nt.slice(0,UZ))lt(at)}for(let nt of et){let J=[nt],at=w1(nt);at!==nt&&J.push(at);for(let it of J){let Lt=j(it,Z-1);Lt<Z&&(Z=Lt,Q=it)}}if(Z>0){let nt=w1(Q);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}if(Z>0&&Eh(Q)>0){let nt=OD(Q,t);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}return Q}var BZ,YZ,VZ,zZ,UZ,qZ,KZ,AD,Nf,HD=st(()=>{"use strict";os();So();vf();kD();x1();b1();BZ=4,YZ=4,VZ=45,zZ=18,UZ=10;qZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),KZ=/[MLQC]|-?\d*\.?\d+(?:e-?\d+)?/gi;AD=new WeakMap;Nf=32});var zD={};ye(zD,{NODE_HEIGHT:()=>aa,NODE_WIDTH:()=>Ma,computeNodeSize:()=>L1,layoutBoxesAndLines:()=>bQ});function hQ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t.charAt(r-1),a=t.charAt(r),i=r+1<t.length?t.charAt(r+1):"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function yQ(t,e=Ma){let n=t.split(/[\s-]+/),r=[];for(let a of n)a&&r.push(...hQ(a));let o=e-24;for(let a=13;a>=9;a--){if(o<_t("MM",a))continue;let i=1,s="";for(let l of r){let c=s?`${s} ${l}`:l;_t(c,a)<=o?s=c:(i++,s=l)}if(i<=N1)return Math.min(i,N1)}return N1}function L1(t,e){if(!t.description||t.description.length===0)return{width:Ma,height:aa};let n=dQ,o=yQ(t.label,n)*13*fQ+pQ,a=n-24,i=0;for(let c of t.description)_t(c,v1)<=a?i+=1:i+=Cn(c,v1,a,{hardBreak:!0}).length;i=Math.min(i,uQ);let s=i*v1*YD,l=o+VD+M1+s+M1+(e?gQ:0);return{width:n,height:Math.max(aa,l)}}async function bQ(t,e,n){let{layoutBoxesAndLinesSearch:r}=await Promise.resolve().then(()=>(HD(),$D)),o={...n?.hideDescriptions!==void 0&&{hideDescriptions:n.hideDescriptions},...n?.previousPositions!==void 0&&{previousPositions:n.previousPositions},...n?.onProgress!==void 0&&{onProgress:n.onProgress}},a=await r(t,e,o),i=y1(BD(a));if(i.unresolved.length>0){let s=await r(t,e,{...o,reserveEdgeLabels:!0}),l=y1(BD(s));l.unresolved.length<i.unresolved.length&&(i=l)}return xQ(i.layout,t,n?.collapsedNotes)}function xQ(t,e,n){let o=e.options?.["no-notes"]==="on"||!e.notes?new Map:no(e.notes,e.nodes.map(y=>({id:y.label,label:y.label})));if(o.size===0)return t;let a=Dc(t.nodes.map(y=>({id:y.label,x:y.x,y:y.y,width:y.width,height:y.height})),o,e.direction==="TB"?"TB":"LR",n),i=t.nodes.map(y=>{let b=a.get(y.label);return b?{...y,note:b}:y}),s=1/0,l=1/0,c=-1/0,d=-1/0,u=(y,b,E,x)=>{y<s&&(s=y),b<l&&(l=b),E>c&&(c=E),x>d&&(d=x)};for(let y of i)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2),y.note&&!y.note.collapsed&&u(y.x+y.note.x,y.y+y.note.y,y.x+y.note.x+y.note.width,y.y+y.note.y+y.note.height);for(let y of t.groups)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2);if(!Number.isFinite(s))return{...t,nodes:i};let{shiftX:f,shiftY:p}=Gs(s,l),m=f!==0||p!==0,g=m?i.map(y=>({...y,x:y.x+f,y:y.y+p})):i,h=m?t.edges.map(y=>({...y,points:y.points.map(b=>({x:b.x+f,y:b.y+p})),...y.labelX!==void 0&&{labelX:y.labelX+f},...y.labelY!==void 0&&{labelY:y.labelY+p}})):t.edges,S=m?t.groups.map(y=>({...y,x:y.x+f,y:y.y+p})):t.groups;return{nodes:g,edges:h,groups:S,width:c+f+WD,height:d+p+WD}}function BD(t){let e=new Map;if(t.edges.forEach((o,a)=>{let[i,s]=o.source<o.target?[o.source,o.target]:[o.target,o.source],l=`${i}\0${s}`,c=e.get(l);c?c.push(a):e.set(l,[a])}),[...e.values()].every(o=>o.length<2))return t;let n=new Array(t.edges.length).fill(0),r=new Array(t.edges.length).fill(1);for(let o of e.values()){let a=o.slice(0,FD);for(let i of o.slice(FD))r[i]=0;a.length<2||a.forEach((i,s)=>{n[i]=(s-(a.length-1)/2)*lQ,r[i]=a.length})}return{...t,edges:t.edges.map((o,a)=>({...o,yOffset:n[a],parallelCount:r[a]}))}}var WD,FD,lQ,cQ,aa,Ma,dQ,v1,YD,M1,VD,uQ,N1,fQ,pQ,mQ,gQ,vf=st(()=>{"use strict";en();b1();Zi();WD=40,FD=5,lQ=22,cQ=1.618,aa=60,Ma=Math.round(aa*cQ),dQ=140,v1=10,YD=1.4,M1=8,VD=4,uQ=6,N1=3,fQ=1.3,pQ=12,mQ=11,gQ=VD+mQ*YD+M1});var nG={};ye(nG,{layoutSwimlane:()=>SQ});function EQ(t){return t==="exclusive"||t==="parallel"?{w:XD,h:XD}:t==="terminal"?{w:jD,h:jD}:{w:T1,h:tG}}function JD(t,e,n,r){let o=new Map,a=new Map;for(let c of t)o.set(c,[]),a.set(c,0);for(let c of e)o.get(c.from)?.push(c.to),a.set(c.to,(a.get(c.to)??0)+1);let i=new Map(t.map(c=>[c,0])),s=new Map;for(let c of t)s.set(c,new Map);let l=t.filter(c=>(a.get(c)??0)===0);for(let c=0;c<l.length;c++){let d=l[c],u=n(d),f=s.get(d),p=r?.get(d);p!==void 0&&(i.get(d)??0)<p&&i.set(d,p);let m=f.get(u);m!==void 0&&(i.get(d)??0)<=m&&i.set(d,m+1);let g=i.get(d),h=new Map(f);h.set(u,Math.max(h.get(u)??-1,g));for(let S of o.get(d)??[]){let y=g+(n(S)===u?1:0);y>(i.get(S)??0)&&i.set(S,y);let b=s.get(S);for(let[x,N]of h)N>(b.get(x)??-1)&&b.set(x,N);let E=(a.get(S)??0)-1;a.set(S,E),E===0&&l.push(S)}}return i}function SQ(t){let n=t.direction==="LR",r=new Map(t.nodes.map(B=>[B.id,B])),o=t.nodes.map(B=>B.id),a=new Map(t.nodes.map(B=>[B.id,EQ(B.shape)])),i=B=>{let Q=a.get(B);return n?Q.w:Q.h},s=B=>{let Q=a.get(B);return n?Q.h:Q.w},l=t.edges.map((B,Q)=>({from:B.source,to:B.target,idx:Q})).filter(B=>B.from!==B.to&&r.has(B.from)&&r.has(B.to)),{dag:c}=xh(o,l),d=B=>r.get(B).lane,u=JD(o,c.map(B=>({from:B.from,to:B.to})),d),f=new Map;for(let B of o)f.set(B,u.get(B)??0);{let B=new Map(t.lanes.map((Z,lt)=>[Z.id,lt])),Q=c.map(Z=>({from:Z.from,to:Z.to})),ot=new Map;for(let Z=0;Z<o.length;Z++){let lt=!1;for(let nt of l)if(!((f.get(nt.to)??0)>=(f.get(nt.from)??0)))for(let J of[nt.from,nt.to]){let at=f.get(J),it=B.get(d(J));for(let Lt of o)Lt===nt.from||Lt===nt.to||f.get(Lt)===at&&((B.get(d(Lt))??0)<=it||(ot.get(Lt)??0)<=at&&(ot.set(Lt,at+1),lt=!0))}if(!lt)break;f=JD(o,Q,d,ot)}}let p=Array.from(new Set(o.map(B=>f.get(B)))).sort((B,Q)=>B-Q),m=new Map(p.map((B,Q)=>[B,Q])),g=p.length,h=B=>m.get(f.get(B))??0,S=qD+Sh,y=Array.from({length:g},()=>0);for(let B of o){let Q=h(B);y[Q]=Math.max(y[Q],i(B))}let b=[],E=[];{let B=S;for(let Q=0;Q<g;Q++){let ot=Math.max(y[Q],T1);E[Q]=ot,b[Q]=B+ot/2,B+=ot+UD}}let x=B=>b[B]+E[B]/2+UD/2,N=(g>0?b[g-1]+Math.max(y[g-1],T1)/2:S)+Sh,L=(t.phases.length?KD:0)+Sh,A=new Map;for(let B of t.nodes){let Q=`${B.lane}\0${h(B.id)}`;(A.get(Q)??A.set(Q,[]).get(Q)).push(B.id)}let C=(B,Q)=>{let ot=A.get(`${B}\0${Q}`)??[];return ot.length===0?0:ot.reduce((Z,lt)=>Z+s(lt),0)+k1*(ot.length-1)},k=new Map,w=new Map,v=new Map;{let B=L;for(let Q of t.lanes){let ot=0;for(let lt=0;lt<g;lt++)ot=Math.max(ot,C(Q.id,lt));let Z=Math.max(wQ,ot+2*eG);k.set(Q.id,B),w.set(Q.id,Z),v.set(Q.id,B+Z/2),B+=Z}}let M=(()=>{let B=L;for(let Q of t.lanes)B+=w.get(Q.id);return B})(),_=new Map,T=new Map;for(let[B,Q]of A){let ot=B.indexOf("\0"),Z=B.slice(0,ot),lt=v.get(Z)??L,nt=Q.reduce((at,it)=>at+s(it),0)+k1*(Q.length-1),J=lt-nt/2;for(let at of Q){let it=s(at);T.set(at,J+it/2),J+=it+k1,_.set(at,b[h(at)])}}let R=0;for(let B of l)(f.get(B.to)??0)<(f.get(B.from)??0)&&R++;let I=R>0?ZD+QD*(R-1):0,H=M+I+Sh,G=(B,Q)=>n?{x:B,y:Q}:{x:Q,y:B},D=t.nodes.map(B=>{let Q=a.get(B.id),ot=G(_.get(B.id),T.get(B.id));return{id:B.id,label:B.label,shape:B.shape,event:B.event,lane:B.lane,...B.phase!==void 0&&{phase:B.phase},...B.color!==void 0&&{color:B.color},tags:B.tags,x:ot.x,y:ot.y,width:Q.w,height:Q.h,lineNumber:B.lineNumber}}),W=16,V=new Array(t.edges.length).fill(0);{let B=new Map;t.edges.forEach((Q,ot)=>{let Z=r.get(Q.source),lt=r.get(Q.target);if(!Z||!lt||Z.id===lt.id)return;let nt=f.get(Z.id)??0;if((f.get(lt.id)??0)<=nt||Math.abs((T.get(Z.id)??0)-(T.get(lt.id)??0))<.5)return;let at=`${Q.target}\0${nt}`;(B.get(at)??B.set(at,[]).get(at)).push(ot)});for(let Q of B.values())Q.length<2||(Q.sort((ot,Z)=>(T.get(t.edges[ot].source)??0)-(T.get(t.edges[Z].source)??0)),Q.forEach((ot,Z)=>{V[ot]=(Z-(Q.length-1)/2)*W}))}let P=4,F=(B,Q,ot,Z,lt,nt)=>{let J=1/0;for(let Tt of o){if(Tt===B)continue;let At=i(Tt)/2+P;if(Math.abs(_.get(Tt)-Q)>=At)continue;let rt=s(Tt)/2,pt=T.get(Tt);pt+rt<=ot||pt-rt>=Z||(J=Math.min(J,pt-rt))}if(J===1/0)return{flow:Q};let at=lt-1,it=lt<g-1?lt:-1,Lt=nt<Q?at:it;return Lt<0&&(Lt=nt<Q?it:at),Lt<0?{flow:Q}:{flow:x(Lt),jogCross:(ot+J)/2}},Y=0,z=[];t.edges.forEach((B,Q)=>{let ot=r.get(B.source),Z=r.get(B.target);if(!ot||!Z||ot.id===Z.id)return;let lt=_.get(ot.id),nt=T.get(ot.id),J=_.get(Z.id),at=T.get(Z.id),it=i(ot.id)/2,Lt=i(Z.id)/2,Tt=s(ot.id)/2,At=s(Z.id)/2,rt=f.get(ot.id)??0,pt=f.get(Z.id)??0,gt,dt=!1;if(pt>rt){let ut=lt+it,yt=J-Lt;if(Math.abs(nt-at)<.5)gt=[G(ut,nt),G(yt,at)];else{let vt=(ut+yt)/2+V[Q];gt=[G(ut,nt),G(vt,nt),G(vt,at),G(yt,at)]}}else if(pt===rt){let ut=at>=nt,yt=nt+(ut?Tt:-Tt),vt=at+(ut?-At:At);if(Math.abs(lt-J)<.5)gt=[G(lt,yt),G(J,vt)];else{let Gt=(yt+vt)/2;gt=[G(lt,yt),G(lt,Gt),G(J,Gt),G(J,vt)]}}else{dt=!0;let ut=M+ZD+QD*Y;Y++;let yt=nt+Tt,vt=at+At,Gt=F(ot.id,lt,yt,ut,h(ot.id),J),Xt=F(Z.id,J,vt,ut,h(Z.id),lt);gt=[G(lt,yt),...Gt.jogCross!==void 0?[G(lt,Gt.jogCross),G(Gt.flow,Gt.jogCross)]:[],G(Gt.flow,ut),G(Xt.flow,ut),...Xt.jogCross!==void 0?[G(Xt.flow,Xt.jogCross),G(J,Xt.jogCross)]:[],G(J,vt)]}z.push({source:B.source,target:B.target,...B.label!==void 0&&{label:B.label},points:gt,back:dt,lineNumber:B.lineNumber})});let j=(B,Q,ot,Z)=>n?{x:B,y:ot,width:Q,height:Z}:{x:ot,y:B,width:Z,height:Q},K=t.lanes.map(B=>{let Q=j(0,N,k.get(B.id),w.get(B.id));return{id:B.id,label:B.label,...B.color!==void 0&&{color:B.color},...Q,headerSize:qD,lineNumber:B.lineNumber}}),$=new Map(t.phases.map((B,Q)=>[B.id,Q])),U=Array.from({length:g},()=>{});for(let B of t.nodes){if(B.phase===void 0)continue;let Q=$.get(B.phase);if(Q===void 0)continue;let ot=h(B.id),Z=U[ot];(Z===void 0||Q<Z)&&(U[ot]=Q)}let X=Array.from({length:g},()=>0),q=0;for(let B=0;B<g;B++){let Q=U[B];Q!==void 0&&Q>q&&(q=Q),X[B]=q}let et=(B,Q)=>(b[B]+b[Q])/2,tt=[];if(t.phases.length>0&&g>0){let B=0;for(let Q=1;Q<=g;Q++)if(Q===g||X[Q]!==X[B]){let ot=B,Z=Q-1,lt=t.phases[X[B]],nt=ot===0?0:et(ot-1,ot),J=Z===g-1?N:et(Z,Z+1);tt.push({id:lt.id,label:lt.label,...j(nt,J-nt,0,H),headerSize:KD,lineNumber:lt.lineNumber}),B=Q}}return{nodes:D,edges:z,lanes:K,phases:tt,width:n?N:H,height:n?H:N}}var Sh,UD,T1,tG,XD,jD,k1,eG,wQ,qD,KD,ZD,QD,rG=st(()=>{"use strict";x1();Sh=30,UD=64,T1=124,tG=44,XD=56,jD=40,k1=16,eG=22,wQ=tG+2*eG,qD=116,KD=30,ZD=28,QD=18});function xd(t,e){let{idPrefix:n,width:r,height:o,baseFill:a,colors:i}=e,s=(l,c)=>{t.append("marker").attr("id",l).attr("viewBox",`0 0 ${r} ${o}`).attr("refX",r).attr("refY",o/2).attr("markerWidth",r).attr("markerHeight",o).attr("orient","auto").append("polygon").attr("points",`0,0 ${r},${o/2} 0,${o}`).attr("fill",c)};s(`${n}-arrow`,a);for(let l of i??[])s(`${n}-arrow-${l.replace("#","")}`,l)}var Lh=st(()=>{"use strict"});var lG={};ye(lG,{renderSwimlaneForExport:()=>AQ});function CQ(t,e){if(t.length<3)return t.map((o,a)=>`${a?"L":"M"}${o.x} ${o.y}`).join(" ");let n=`M${t[0].x} ${t[0].y}`;for(let o=1;o<t.length-1;o++){let a=t[o-1],i=t[o],s=t[o+1],l=Math.hypot(i.x-a.x,i.y-a.y),c=Math.hypot(s.x-i.x,s.y-i.y);if(l<.01||c<.01){n+=` L${i.x} ${i.y}`;continue}let d=Math.min(e,l/2,c/2),u=i.x-(i.x-a.x)/l*d,f=i.y-(i.y-a.y)/l*d,p=i.x+(s.x-i.x)/c*d,m=i.y+(s.y-i.y)/c*d;n+=` L${u} ${f} Q${i.x} ${i.y} ${p} ${m}`}let r=t[t.length-1];return n+=` L${r.x} ${r.y}`,n}function _Q(t,e,n,r,o,a){let i=o-n,s=a-r,l=i*i+s*s,c=l>0?((t-n)*i+(e-r)*s)/l:0;return c=Math.max(0,Math.min(1,c)),Math.hypot(t-(n+c*i),e-(r+c*s))}function iG(t,e,n,r,o={}){let a=Math.min(n,r)/2,i=Math.min(o.tl??0,a),s=Math.min(o.tr??0,a),l=Math.min(o.br??0,a),c=Math.min(o.bl??0,a);return[`M${t+i},${e}`,`H${t+n-s}`,s?`A${s},${s} 0 0 1 ${t+n},${e+s}`:"",`V${e+r-l}`,l?`A${l},${l} 0 0 1 ${t+n-l},${e+r}`:"",`H${t+c}`,c?`A${c},${c} 0 0 1 ${t},${e+r-c}`:"",`V${e+i}`,i?`A${i},${i} 0 0 1 ${t+i},${e}`:"","Z"].join(" ")}function AQ(t,e,n,r,o,a={}){It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.title?40:0,s=a.exportDims?.width??n.width,l=(a.exportDims?.height??n.height)+0,c=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",s).attr("height",l).attr("viewBox",`0 0 ${s} ${l}`).style("font-family",Pt),d=c.append("defs"),u=or(r,o),f={error:r.colors.red,success:r.colors.green,terminate:r.text,neutral:r.border};xd(d,{idPrefix:"sw",width:kQ,height:TQ,baseFill:r.textMuted,colors:[f.error,f.success]});let p=c.append("g").attr("transform",`translate(0, ${i})`);e.title&&c.append("text").attr("x",s/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).text(e.title);let m=new Map;e.lanes.forEach((k,w)=>{let v=k.color??On(fl[w%fl.length],r)??r.border;m.set(k.id,v)});let g=e.direction==="LR",h=e.options["solid-fill"]==="on",S=k=>Ot(k,u,9),y=k=>{for(let w of n.lanes){let v=g?w.y:w.x,M=v+(g?w.height:w.width);if(k>=v&&k<=M)return S(m.get(w.id)??r.border)}return u},b=p.append("g").attr("class","dgmo-swimlane-lanes");for(let k of n.lanes){let w=m.get(k.id)??r.border,v=g?k.x:k.x+Nh,M=g?k.y+Nh:k.y,_=g?k.width:k.width-Nh*2,T=g?k.height-Nh*2:k.height;b.append("path").attr("d",iG(v,M,_,T,{tl:as,tr:as,br:as,bl:as})).attr("fill",Ot(w,u,9)).attr("stroke",Ot(r.border,u,60)).attr("stroke-width",1).attr("data-line-number",String(k.lineNumber));let R=g?k.headerSize:_,O=g?T:k.headerSize;b.append("path").attr("d",iG(v,M,R,O,g?{tl:as,bl:as}:{tl:as,tr:as})).attr("fill",Ot(w,u,16)).attr("opacity",.6),b.append("text").attr("x",g?v+12:v+_/2).attr("y",g?M+T/2:M+k.headerSize/2).attr("text-anchor",g?"start":"middle").attr("dominant-baseline","middle").attr("font-size",LQ).attr("font-weight","700").attr("fill",Ot(w,r.text,55)).text(k.label)}let E=p.append("g").attr("class","dgmo-swimlane-phases");n.phases.forEach((k,w)=>{w%2===1&&E.append("rect").attr("x",k.x).attr("y",k.y).attr("width",k.width).attr("height",k.height).attr("rx",as).attr("fill",r.text).attr("opacity",.05).attr("pointer-events","none"),E.append("text").attr("x",g?k.x+k.width/2:k.headerSize/2).attr("y",g?k.headerSize/2:k.y+k.height/2).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",vQ).attr("font-weight","700").attr("letter-spacing","0.06em").attr("fill",r.textMuted).attr("data-line-number",String(k.lineNumber)).text(k.label)});let x=a.activeTagGroup??null,N=k=>{if(x){let v=qt(x);if(k.tags[v]){let M=sr(k.tags,[...e.tagGroups],x);if(M&&M!=="#999999")return{fill:h?M:Ot(M,u,22),stroke:M}}}if(k.shape==="terminal")return k.event==="error"?{fill:h?f.error:Ot(f.error,u,22),stroke:f.error}:k.event==="success"?{fill:h?f.success:Ot(f.success,u,22),stroke:f.success}:k.event==="terminate"?{fill:Ot(r.text,u,30),stroke:r.text}:{fill:r.bg,stroke:r.textMuted};if(k.shape==="exclusive"||k.shape==="parallel")return{fill:Ot(r.surface,u,80),stroke:r.textMuted};let w=m.get(k.lane)??r.border;return{fill:h?w:Ot(w,u,20),stroke:Ot(w,r.text,40)}},L=new Map(n.nodes.map(k=>[k.id,k])),A=p.append("g").attr("class","dgmo-swimlane-edges");for(let k of n.edges){let w=L.get(k.target),v=r.textMuted,M="sw-arrow";w?.shape==="terminal"&&w.event==="error"?(v=f.error,M=`sw-arrow-${f.error.replace("#","")}`):w?.shape==="terminal"&&w.event==="success"&&(v=f.success,M=`sw-arrow-${f.success.replace("#","")}`);let _=CQ(k.points,MQ);if(A.append("path").attr("d",_).attr("fill","none").attr("stroke",v).attr("stroke-width",NQ).attr("stroke-dasharray",k.back?"5 4":null).attr("marker-end",`url(#${M})`).attr("data-line-number",String(k.lineNumber)),k.label){let T=[],R=0;for(let q=0;q<k.points.length-1;q++){let et=k.points[q],tt=k.points[q+1],B=Math.abs(tt.x-et.x)+Math.abs(tt.y-et.y);T.push(B),R+=B}let O=R/2,I=0;for(let q=0;q<T.length;q++){if(O<=T[q]||q===T.length-1){I=q;break}O-=T[q]}let H=k.points[I],G=k.points[I+1]??H,D=T[I]>0?O/T[I]:.5,W={x:H.x+(G.x-H.x)*D,y:H.y+(G.y-H.y)*D},V=Math.abs(G.x-H.x)>=Math.abs(G.y-H.y),P=7,F=(q,et)=>{let tt=1/0;for(let B of n.edges)if(B!==k)for(let Q=0;Q<B.points.length-1;Q++){let ot=_Q(q,et,B.points[Q].x,B.points[Q].y,B.points[Q+1].x,B.points[Q+1].y);ot<tt&&(tt=ot)}return tt},Y=k.label.length*oG*.6,z=(q,et,tt)=>{let B=tt===0?[q-Y/2,q,q+Y/2]:[q,q+tt*Y/2,q+tt*Y];return Math.min(...B.map(Q=>F(Q,et)))},j=10,K,$,U,X;if(V){let q=z(W.x,W.y-P,0),et=z(W.x,W.y+P,0),tt=q<j&&et>q;K=W.x,$=W.y+(tt?P:-P),U="middle",X=tt?"hanging":"auto"}else{let q=z(W.x+P,W.y,1),et=z(W.x-P,W.y,-1),tt=q<j&&et>q;K=W.x+(tt?-P:P),$=W.y,U=tt?"end":"start",X="middle"}A.append("text").attr("x",K).attr("y",$).attr("text-anchor",U).attr("dominant-baseline",X).attr("font-size",oG).attr("fill",v===r.textMuted?r.textMuted:v).attr("stroke",y($)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}}let C=p.append("g").attr("class","dgmo-swimlane-nodes");for(let k of n.nodes){let{fill:w,stroke:v}=N(k),M=C.append("g").attr("data-line-number",String(k.lineNumber)).attr("data-lane",k.lane),_=k.x,T=k.y;if(k.shape==="exclusive"||k.shape==="parallel"){let R=k.width/2;if(M.append("polygon").attr("points",`${_},${T-R} ${_+R},${T} ${_},${T+R} ${_-R},${T}`).attr("fill",w).attr("stroke",v).attr("stroke-width",C1),k.shape==="parallel"){let O=r.textMuted;M.append("line").attr("x1",_).attr("y1",T-R/2.4).attr("x2",_).attr("y2",T+R/2.4).attr("stroke",O).attr("stroke-width",2.4),M.append("line").attr("x1",_-R/2.4).attr("y1",T).attr("x2",_+R/2.4).attr("y2",T).attr("stroke",O).attr("stroke-width",2.4),M.append("text").attr("x",_).attr("y",T+R+12).attr("text-anchor","middle").attr("font-size",vh-1).attr("fill",r.textMuted).attr("stroke",y(T+R+12)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}else sG(M,k.label,_,T,r.text,vh-1,!0,y(T))}else if(k.shape==="terminal"){let R=k.width/2;M.append("circle").attr("cx",_).attr("cy",T).attr("r",R).attr("fill",w).attr("stroke",v).attr("stroke-width",k.event==="none"?C1:2.4),k.event==="success"&&M.append("circle").attr("cx",_).attr("cy",T).attr("r",R-4).attr("fill","none").attr("stroke",v).attr("stroke-width",1);let O=!1;for(let H of n.edges){let G=H.target===k.id?H.points[H.points.length-1]:H.source===k.id?H.points[0]:void 0;G&&G.y>T+R*.5&&(O=!0)}let I=O?T-R-6:T+R+12;M.append("text").attr("x",_).attr("y",I).attr("text-anchor","middle").attr("font-size",vh-1).attr("fill",r.text).attr("stroke",y(I)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}else{M.append("rect").attr("x",_-k.width/2).attr("y",T-k.height/2).attr("width",k.width).attr("height",k.height).attr("rx",aG).attr("fill",w).attr("stroke",v).attr("stroke-width",C1),k.shape==="subprocess"&&M.append("rect").attr("x",_-k.width/2+3).attr("y",T-k.height/2+3).attr("width",k.width-6).attr("height",k.height-6).attr("rx",aG-2).attr("fill","none").attr("stroke",v).attr("stroke-width",1);let R=Le(w,r.textOnFillLight,r.textOnFillDark);sG(M,k.label,_,T,R,vh)}}}function RQ(t,e){let n=[],r="";for(let o of t)r===""?r=o:r.length+1+o.length<=e?r+=" "+o:(n.push(r),r=o);return r&&n.push(r),n}function sG(t,e,n,r,o,a,i=!1,s){let l=e.split(/\s+/),c;if(i)c=l.length===1?[e]:RQ(l,7);else if(e.length<=14||l.length===1)c=[e];else{let f=Math.ceil(l.length/2);c=[l.slice(0,f).join(" "),l.slice(f).join(" ")]}let d=a*1.2,u=r-(c.length-1)*d/2;c.forEach((f,p)=>{let m=t.append("text").attr("x",n).attr("y",u+p*d).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",a).attr("fill",o);s&&m.attr("stroke",s).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke"),m.text(f)})}var vh,LQ,vQ,oG,aG,C1,NQ,MQ,kQ,TQ,as,Nh,cG=st(()=>{"use strict";qn();an();Lh();tn();wr();je();vh=12,LQ=12,vQ=12,oG=11,aG=8,C1=1.5,NQ=1.6,MQ=11,kQ=9,TQ=6.4,as=10,Nh=2});function PQ(t){let e=[],n=t.split(/(\s+)/);for(let r of n){if(/^\s+$/.test(r))continue;let o=r.split(/(?<=-)(?=\S)/);e.push(...o)}return e}function dG(t,e,n,r){let o=e-A1,a=[],i="";for(let s of t){let l=i&&!i.endsWith("-")?" ":"",c=i+l+s;if(_t(c,n)<=o)i=c;else if(!i)i=s;else{if(a.push(i),a.length>=r)return null;i=s}}return i&&a.push(i),a.length>r?null:a}function uG(t,e,n){let r=e-A1,o=[...t],a=o[o.length-1];return _t(a,n)>r&&(o[o.length-1]=nr(a,n,r)),o}function fG(t,e,n,r,o=pG){if(!t)return{lines:[""],fontSize:n};let a=PQ(t);for(let c=n;c>=r;c--){let d=dG(a,e,c,o);if(d)return{lines:uG(d,e,c),fontSize:c}}let i=dG(a,e,r,999)??[t],s=i.slice(0,o),l=uG(s,e,r);if(i.length>o){let c=l[l.length-1];if(!c.endsWith("\u2026")){let d=e-A1;_t(c+"\u2026",r)>d?l[l.length-1]=nr(c,r,d):l[l.length-1]=c+"\u2026"}}return{lines:l,fontSize:r}}function OQ(t){return Math.max(mG,DQ-t*GQ)}function Mh(t,e,n,r,o){let a=OQ(n),i=fG(t,r,a,mG,pG),s=[],l=_1;if(!o&&e&&e.length>0){let c=IQ;for(let d of e){if(c<=0)break;let u=ea(d),f=fG(u,r,_1,_1,c);s.push(...f.lines),c-=f.lines.length,l=f.fontSize}}return{labelLines:i.lines,labelFontSize:i.fontSize,descLines:s,descFontSize:l}}var A1,pG,IQ,DQ,mG,GQ,_1,R1=st(()=>{"use strict";Za();en();A1=16,pG=3,IQ=2;DQ=17,mG=9,GQ=3,_1=10});var hG={};ye(hG,{layoutMindmap:()=>Th});function Th(t,e,n){let r=t.roots;if(r.length===0)return{nodes:[],edges:[],width:0,height:0};let o=n?.hiddenCounts??new Map,a=n?.activeTagGroup??null,i=n?.hideDescriptions??!1,s=n?.ctx??Ee.identity(),l={rootWidth:s.structural($Q),depth1Width:s.structural(HQ),leafWidth:s.structural(WQ),hGap:s.aesthetic(zQ),vGap:s.aesthetic(UQ),margin:s.aesthetic(XQ),multiRootGap:s.aesthetic(jQ)};eJ(r);let c=[],d=f=>{for(let p of f)c.push(p),d(p.children)};d(r),wa(c,t.tagGroups);let u=t.tagGroups;return r.length===1?gG(r[0],o,i,u,a,l):qQ(r,t,o,i,u,a,l)}function gG(t,e,n,r=[],o=null,a){let i=[],s=G1(0,a),l=O1(t,n,a),c=t.children,{right:d,left:u}=QQ(c,n,a),f=kh(d,1,n,a),p=kh(u,1,n,a),m=Math.max(f,p,l),g=0,h=m/2-l/2;i.push({node:t,x:g,y:h,width:s,height:l,depth:0,direction:"right",subtreeHeight:m});let S=h+l/2,y=g+s+a.hGap;I1(d,y,S,1,"right",n,i,a);let b=g-a.hGap;return I1(u,b,S,1,"left",n,i,a),ZQ(i,e,n,t,r,o,a)}function qQ(t,e,n,r,o,a,i){let s=[];for(let p of t)s.push(gG(p,n,r,o,a,i));let l=s.reduce((p,m)=>p+m.width,0)+i.multiRootGap*(s.length-1),c=Math.max(...s.map(p=>p.height)),d=[],u=[],f=0;for(let p of s){let m=(c-p.height)/2;for(let g of p.nodes)d.push({...g,x:g.x+f,y:g.y+m});for(let g of p.edges)u.push({sourceId:g.sourceId,targetId:g.targetId,path:JQ(g.path,f,m)});f+=p.width+i.multiRootGap}return{nodes:d,edges:u,width:l,height:c}}function I1(t,e,n,r,o,a,i,s){if(t.length===0)return;let l=kh(t,r,a,s),c=n-l/2;for(let d of t){let u=G1(r,s),f=O1(d,a,s),p=D1(d,r,a,s),m=c+p/2-f/2,g=o==="right"?e:e-u;if(i.push({node:d,x:g,y:m,width:u,height:f,depth:r,direction:o,subtreeHeight:p}),d.children.length>0){let h=m+f/2,S=o==="right"?g+u+s.hGap:g-s.hGap;I1(d.children,S,h,r+1,o,a,i,s)}c+=p+s.vGap}}function kh(t,e,n,r){if(t.length===0)return 0;let o=0;for(let a of t)o+=D1(a,e,n,r);return o+=r.vGap*(t.length-1),o}function D1(t,e,n,r){let o=O1(t,n,r);if(t.children.length===0)return o;let a=kh(t.children,e+1,n,r);return Math.max(o,a)}function KQ(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n)}function ZQ(t,e,n,r,o=[],a=null,i){let s=1/0,l=1/0,c=-1/0,d=-1/0;for(let E of t)s=Math.min(s,E.x),l=Math.min(l,E.y),c=Math.max(c,E.x+E.width),d=Math.max(d,E.y+E.height);let u=-s+i.margin,f=-l+i.margin,p=c-s+i.margin*2,m=d-l+i.margin*2,g=new Map;for(let E of t)g.set(E.node.id,E);let h=[],S=[];for(let E of t){let x=KQ(E.node,o,a),N=e.get(E.node.id);h.push({id:E.node.id,label:E.node.label,...E.node.description!==void 0&&{description:[...E.node.description]},metadata:{...E.node.metadata},lineNumber:E.node.lineNumber,...x!==void 0&&{color:x},x:E.x+u,y:E.y+f,width:E.width,height:E.height,depth:E.depth,angle:0,radius:0,...N!==void 0&&{hiddenCount:N},hasChildren:e.has(E.node.id)||E.node.children.length>0})}let y=new Map;for(let E of t)if(E.node.parentId){let x=y.get(E.node.parentId)??[];x.push(E),y.set(E.node.parentId,x)}let b=[];for(let[E,x]of y){let N=x.filter(A=>A.direction==="right"),L=x.filter(A=>A.direction==="left");N.length>0&&b.push([E,N]),L.length>0&&b.push([E,L])}for(let[E,x]of b){let N=g.get(E),L=N.x+u,A=N.y+f,C=x[0].direction==="left",k=C?L:L+N.width,w=A+N.height/2,v=x[0],M=C?v.x+u+v.width:v.x+u,_=(k+M)/2;if(x.length===1){let T=x[0],R=C?T.x+u+T.width:T.x+u,O=T.y+f+T.height/2;S.push({sourceId:E,targetId:T.node.id,path:`M ${k} ${w} L ${_} ${w} L ${_} ${O} L ${R} ${O}`})}else{S.push({sourceId:E,targetId:E,path:`M ${k} ${w} L ${_} ${w}`});let T=x.map(I=>I.y+f+I.height/2),R=Math.min(...T),O=Math.max(...T);S.push({sourceId:E,targetId:E,path:`M ${_} ${R} L ${_} ${O}`});for(let I=0;I<x.length;I++){let H=x[I],G=C?H.x+u+H.width:H.x+u,D=T[I];S.push({sourceId:E,targetId:H.node.id,path:`M ${_} ${D} L ${G} ${D}`})}}}return{nodes:h,edges:S,width:p,height:m}}function QQ(t,e,n){if(t.length<=1)return{right:[...t],left:[]};if(t.length===2)return{right:[t[0]],left:[t[1]]};let r=t.map((l,c)=>({index:c,node:l,height:D1(l,1,e,n)})),o=[],a=[],i=0,s=0;for(let l of r)i<=s?(o.push(l.node),i+=l.height):(a.push(l.node),s+=l.height);return{right:o,left:a}}function JQ(t,e,n){return e===0&&n===0?t:t.replace(/([ML])\s*([\d.e+-]+)\s+([\d.e+-]+)/g,(r,o,a,i)=>`${o} ${parseFloat(a)+e} ${parseFloat(i)+n}`)}function G1(t,e){return t===0?e.rootWidth:t===1?e.depth1Width:e.leafWidth}function O1(t,e,n){let r=tJ(t),o=G1(r,n),a=Mh(t.label,t.description?[...t.description]:void 0,r,o,e),i=a.labelLines.length,l=(i<=1?FQ:BQ*i)+VQ;return a.descLines.length>0&&(l+=YQ*a.descLines.length+4),l}function tJ(t){return P1.get(t.id)??0}function eJ(t){P1.clear();let e=(n,r)=>{for(let o of n)P1.set(o.id,r),e(o.children,r+1)};e(t,0)}var $Q,HQ,WQ,FQ,BQ,YQ,VQ,zQ,UQ,XQ,jQ,P1,$1=st(()=>{"use strict";je();R1();mr();$Q=180,HQ=150,WQ=120,FQ=28,BQ=18,YQ=14,VQ=10,zQ=40,UQ=12,XQ=40,jQ=60;P1=new Map});var bG={};ye(bG,{collapseMindmapTree:()=>rJ});function yG(t){return{id:t.id,label:t.label,...t.description!==void 0&&{description:[...t.description]},metadata:{...t.metadata},children:t.children.map(yG),parentId:t.parentId,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color},...t.collapsed!==void 0&&{collapsed:t.collapsed}}}function rJ(t,e){return e.size===0?{roots:[...t],hiddenCounts:new Map}:od(t,e,nJ)}var nJ,xG=st(()=>{"use strict";yf();nJ={getId:t=>t.id,getChildren:t=>t.children,clone:yG,setChildren:(t,e)=>{t.children=e},countsAsHidden:()=>!0}});var SG={};ye(SG,{renderMindmap:()=>EG,renderMindmapForExport:()=>uJ});function sJ(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function lJ(t,e){return e??t.primary}function dJ(t,e){let n=cJ[t];return n&&n in e.colors?e.colors[n]:e.colors.gray}function EG(t,e,n,r,o,a,i,s,l,c,d){let u=!!i,f=i?.width??(t.getBoundingClientRect().width||800),p=i?.height??(t.getBoundingClientRect().height||600);It(t).selectAll("*").remove();let m=It(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt),g=d?.controlsHost==="app",h=!!d?.onToggleColorByDepth||!!d?.onToggleDescriptions,S=e.tagGroups.length>0||h&&!g,y=!u&&S,b=y?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},f)+Bn:0,E=!!e.title&&e.options["no-title"]!=="on",x=!u&&E,N=x?wG:0,L=f,A=p-wd*2-b-N,C=u?Ee.identity():Ee.fromBox(L,n.width,A,n.height),k=n;if(C.factor<1){let O=new Map;for(let H of n.nodes)H.hiddenCount!=null&&H.hiddenCount>0&&O.set(H.id,H.hiddenCount);let I=H=>Th(e,r,{interactive:!u,...O.size>0&&{hiddenCounts:O},activeTagGroup:c??null,...l!==void 0&&{hideDescriptions:l},ctx:H});k=I(C);for(let H=0;H<3&&!C.isBelowFloor;H++){let G=Math.min(L/k.width,A/k.height);if(G>=.999)break;C=Ee.fromFactor(C.factor*G),k=I(C)}}let w=u?1:Math.min(1,k.width>0?L/k.width:1,k.height>0?A/k.height:1),v=k.width*w,M=k.height*w,_=Math.max(0,(L-v)/2),T=wd+b+N+Math.max(0,(A-M)/2),R=m.append("g").attr("transform",`translate(${_}, ${T})${w<1?` scale(${w})`:""}`);if(C.isBelowFloor&&m.attr("width","100%"),E){let O=x?m:R,I=x?f/2:k.width/2,H=x?wd+20:20,G=O.append("text").attr("x",I).attr("y",H).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("class","chart-title").text(e.title);e.titleLineNumber&&G.attr("data-line-number",e.titleLineNumber),a&&e.titleLineNumber&&G.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))}if(y){let O=m.append("g").attr("class","mindmap-legend-fixed").attr("transform",`translate(0, ${wd+N})`),I=new Map;for(let P of k.nodes)for(let F of e.tagGroups){let Y=F.name.toLowerCase(),z=P.metadata[Y];z&&(I.has(Y)||I.set(Y,new Set),I.get(Y).add(z.toLowerCase()))}let H=[];d?.onToggleDescriptions&&H.push({id:"descriptions",type:"toggle",label:"Descriptions",active:!l,onToggle:P=>d.onToggleDescriptions(P)}),d?.onToggleColorByDepth&&H.push({id:"depth-colors",type:"toggle",label:"Depth Colors",active:d.colorByDepth??!1,onToggle:d.onToggleColorByDepth});let G=H.length>0?{toggles:H}:void 0,D={groups:e.tagGroups.map(P=>{let F=I.get(P.name.toLowerCase());return{name:P.name,...P.alias!==void 0&&{alias:P.alias},entries:P.entries.filter(Y=>F?.has(Y.value.toLowerCase())).map(Y=>({value:Y.value,color:Y.color}))}}),position:{placement:"top-center",titleRelation:"below-title"},mode:d?.exportMode?"export":"preview",...G!==void 0&&{controlsGroup:G},...d?.controlsHost!==void 0&&{controlsHost:d.controlsHost}},W={text:r.text,textMuted:r.textMuted,bg:r.bg,surface:r.surface,primary:r.primary},V={...d?.onToggleControlsExpand!==void 0&&{onControlsExpand:d.onToggleControlsExpand},onControlsToggle:(P,F)=>{P==="depth-colors"&&d?.onToggleColorByDepth&&d.onToggleColorByDepth(F),P==="descriptions"&&d?.onToggleDescriptions&&d.onToggleDescriptions(F)}};mn(O,{...D,palette:W,isDark:o,width:f,activeGroup:d?.colorByDepth?null:c!==void 0?c:e.options["active-tag"]??null,hiddenAttributes:new Set,...d?.controlsExpanded!==void 0&&{controlsExpanded:d.controlsExpanded},callbacks:V})}for(let O of k.edges)R.append("path").attr("class","mindmap-edge").attr("d",O.path).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.5);for(let O of k.nodes){let I=O.radius===0&&k.nodes.indexOf(O)===0,H=I?iJ:1.5,G=d?.colorByDepth?dJ(O.depth,r):O.color,D=sJ(r,o,G,e.options["solid-fill"]==="on"),W=lJ(r,G),V=Le(D,r.textOnFillLight,r.textOnFillDark),P=R.append("g").attr("class","mindmap-node").attr("data-line-number",O.lineNumber);if(c){let B=qt(c),Q=O.metadata[B];Q&&P.attr(`data-tag-${B}`,Q.toLowerCase())}O.hasChildren&&P.attr("data-node-toggle",O.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",O.hiddenCount!=null&&O.hiddenCount>0?"false":"true").attr("aria-label",O.label),P.append("rect").attr("x",O.x).attr("y",O.y).attr("width",O.width).attr("height",O.height).attr("rx",Ch).attr("ry",Ch).attr("fill",D).attr("stroke",W).attr("stroke-width",H);let F=O.hiddenCount!=null&&O.hiddenCount>0,Y=!l&&!!O.description&&!F,z=Mh(O.label,O.description,O.depth,O.width,l||F),{labelLines:j,labelFontSize:K,descLines:$,descFontSize:U}=z,X=j.length,q=X<=1?oJ:H1*X,et=Y?q:O.height,tt=O.x+O.width/2;if(X<=1){let B=O.y+et/2+K*.35;P.append("text").attr("x",tt).attr("y",B).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",V).text(j[0])}else{let B=H1*(X-1),Q=O.y+et/2-B/2+K*.35,ot=P.append("text").attr("x",tt).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",V);for(let Z=0;Z<j.length;Z++)ot.append("tspan").attr("x",tt).attr("y",Q+Z*H1).text(j[Z])}if((j.length>1||j[0]!==O.label)&&P.append("title").text(O.label),Y&&$.length>0){let B=O.y+q;if(P.append("line").attr("x1",O.x).attr("y1",B).attr("x2",O.x+O.width).attr("y2",B).attr("stroke",W).attr("stroke-opacity",.3).attr("stroke-width",1),$.length<=1){let Q=B+4+U,ot=ea($[0]),Z=P.append("text").attr("x",tt).attr("y",Q).attr("text-anchor","middle").attr("font-size",U).attr("fill",V);bn(Z,ot,r,U)}else{let Q=B+4+U;for(let ot=0;ot<$.length;ot++){let Z=ea($[ot]),lt=P.append("text").attr("x",tt).attr("y",Q+ot*aJ).attr("text-anchor","middle").attr("font-size",U).attr("fill",V);bn(lt,Z,r,U)}}}if(!u&&O.hiddenCount!=null&&O.hiddenCount>0){let B=`collapse-clip-${O.id}`;R.append("defs").append("clipPath").attr("id",B).append("rect").attr("x",O.x).attr("y",O.y).attr("width",O.width).attr("height",O.height).attr("rx",Ch).attr("ry",Ch),P.append("rect").attr("class","collapse-bar").attr("x",O.x).attr("y",O.y+O.height-6).attr("width",O.width).attr("height",6).attr("fill",W).attr("clip-path",`url(#${B})`)}a&&P.style("cursor","pointer").on("click",B=>{O.hasChildren&&s?(B.stopPropagation(),s(O.id)):a(O.lineNumber)}),u||P.on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)})}}function uJ(t,e,n){let r=Zc(t,n);if(r.error)return"";let o=e==="dark",a=r.options["no-descriptions"]==="true",i=Th(r,n,{interactive:!1,hideDescriptions:a}),s=r.title&&r.options["no-title"]!=="on"?wG:0,l=i.width+wd*2,c=i.height+wd*2+s;return ad(l,c,d=>(EG(d,r,i,n,o,void 0,{width:l,height:c},void 0,a),id(d,e)))}var wd,wG,oJ,H1,aJ,Ch,iJ,cJ,LG=st(()=>{"use strict";je();qn();an();Zg();tn();Eg();$1();R1();Ro();Za();Br();Tr();_o();mr();wd=20,wG=30,oJ=28,H1=18,aJ=14,Ch=6,iJ=2.5;cJ=["red","orange","yellow","green","blue","purple","teal","cyan"]});var TG={};ye(TG,{layoutWireframe:()=>LJ});function LJ(t,e,n,r=!0){W1=r?kG:hJ;let o=t.formFactor==="mobile"?pJ:fJ,a=n??o,i=t.title&&t.options["no-title"]!=="on"?xJ:0,s=a-NG*2,l=vJ(t.roots,s,t.formFactor),c=0;for(let p of l)c=Math.max(c,p.y+p.height);let d=[],u=c+24;for(let p of t.modals){let m=Math.min(s*.7,600),g=(s-m)/2,h=Ed(p,g,u,m);d.push(h),u+=h.height+24}let f=(d.length>0?d[d.length-1].y+d[d.length-1].height:c)+NG*2+i;return{width:a,height:f,titleHeight:i,nodes:l,modalNodes:d}}function vJ(t,e,n){let r=[],o=0,a=[],i=[];for(let s of t){let l=s.label.toLowerCase().split(/\s+/)[0];MG.has(l)||n==="mobile"?(i.length>0&&(a.push(i),i=[]),a.push([s])):i.push(s)}i.length>0&&a.push(i);for(let s of a){if(s.length===1&&n!=="mobile"){let l=s[0],c=l.label.toLowerCase().split(/\s+/)[0];if(MG.has(c)){let d=Ed(l,0,o,e);c==="header"||c==="top"?d.height=Math.max(d.height,EJ):d.height=Math.max(d.height,SJ),r.push(d),o+=d.height+16;continue}}if(n==="mobile"||s.length===1)for(let l of s){let c=Ed(l,0,o,e);r.push(c),o+=c.height+16}else{let l=NJ(s,e),c=0,d=0,u=[];for(let f=0;f<s.length;f++){let p=l[f],m=Ed(s[f],c,o,p);u.push(m),d=Math.max(d,m.height),c+=p+12}for(let f of u)f.height=d;r.push(...u),o+=d+16}}return r}function NJ(t,e){let r=(t.length-1)*12,o=e-r,a=new Array(t.length).fill(0),i=0,s=0;for(let l=0;l<t.length;l++){let c=t[l].label.toLowerCase().split(/\s+/)[0],d=wJ[c];d!==void 0&&d>0?(a[l]=o*d,i+=a[l]):s++}if(s>0){let c=Math.max(0,o-i)/s;for(let d=0;d<a.length;d++)a[d]===0&&(a[d]=Math.max(40,c))}for(let l=0;l<a.length;l++)a[l]=Math.max(40,a[l]);return a}function Ed(t,e,n,r){let o={id:t.id,x:e,y:n,width:r,height:0,element:t,children:[]},a=t.type==="nav"||t.type==="tabs";if(!t.isContainer||t.children.length===0||a)return o.height=kJ(t),o;let i=t.metadata._inlineRow==="true"||t.metadata._labelField==="true",s=i?0:W1,l=i?0:yJ,c=i?0:bJ,d=r-c*2,u=c;if(t.orientation==="horizontal"){let f=MJ(t.children,d),p=u,m=0,g=[];for(let h=0;h<t.children.length;h++){let S=t.children[h],y=f[h],b=Ed(S,p,s,y);g.push(b),o.children.push(b),m=Math.max(m,b.height),p+=y+8}for(let h of g)h.height=m;o.height=s+m+l}else{let f=s,p=CJ(t.children);p>0&&(o.fieldAlignX=p);for(let m of t.children){let g=Ed(m,u,f,d);o.children.push(g),f+=g.height+TJ(m)}o.height=f+l}return t.states.includes("collapsed")&&(o.height=W1,o.children=[]),o}function MJ(t,e){let r=(t.length-1)*8,o=Math.max(40,(e-r)/t.length);return t.map(()=>o)}function kJ(t){return t.type==="heading"?t.headingLevel===2?_h.subheading??36:_h.heading??48:t.type==="textInput"&&t.fieldVariant==="textarea"?80:t.type==="table"?32+(t.tableData?.length||t.tableRows||0)*28+8:t.type==="image"?t.imageHint==="round"||t.imageHint==="wide"?80:_h.image??120:t.metadata._labelField==="true"?36:_h[t.type]??24}function TJ(t){return t.type==="heading"&&t.headingLevel===2?vG.subheading??12:vG[t.type]??8}function CJ(t){let e=0,n=0;for(let r of t)if(r.metadata._labelField==="true"&&r.children.length>=2){let o=r.children[0],a=_t(o.label,gJ);e=Math.max(e,a),n++}return n<2?0:e+mJ}var fJ,pJ,mJ,gJ,_h,vG,kG,hJ,yJ,W1,bJ,NG,xJ,wJ,MG,EJ,SJ,CG=st(()=>{"use strict";en();fJ=1200,pJ=375,mJ=16,gJ=13,_h={textInput:36,button:40,dropdown:36,checkbox:24,radio:24,heading:48,subheading:36,divider:24,text:22,listItem:24,image:120,progress:28,chart:160,alert:40,nav:44,tabs:44},vG={heading:16,subheading:12,divider:12,textInput:8,dropdown:8,checkbox:8,radio:8,button:8,text:12,listItem:4,group:16,image:12,progress:12,chart:16,alert:12,nav:12,tabs:12,table:16},kG=32,hJ=10,yJ=12,W1=kG,bJ=12,NG=20,xJ=40,wJ={sidebar:.25,side:.25,left:.25,right:.25,main:0,content:0,center:0},MG=new Set(["header","top","footer","bottom"]),EJ=60,SJ=40});var DG={};ye(DG,{renderWireframe:()=>RJ});function AJ(t,e){let n=_J[t];return n?n(e):null}function IG(t,e){for(let n of t.states){let r=AJ(n,e);if(r)return r}return null}function RJ(t,e,n,r,o,a,i,s,l){let c=l??{},d=c.exportDims??i,u=c.theme??s;It(t).selectAll(":not([data-d3-tooltip])").remove();let f=!!d,p=d?.width??t.clientWidth,m=d?.height??t.clientHeight,g=f?Ee.identity():Ee.from(p,n.width),h=It(t).append("svg").attr("viewBox",`0 0 ${n.width} ${n.height}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);f?h.attr("width",p).attr("height",m):h.attr("width","100%").attr("height","auto").style("display","block");let S={palette:r,isTransparent:u==="transparent",isDark:o,showGroupLabels:c.showGroupLabels??!0,solid:e.options["solid-fill"]==="on"};S.isTransparent||h.append("rect").attr("width",n.width).attr("height",n.height).attr("fill",r.bg).attr("rx",8);let y=h.append("g").attr("transform","translate(20, 20)"),b=0,E=!!e.title&&e.options["no-title"]!=="on",x=g.text(20);f&&E&&(y.append("text").attr("x",0).attr("y",x).attr("fill",r.text).attr("font-size",x).attr("font-weight","700").text(e.title),b=n.titleHeight);let N=y.append("g").attr("transform",`translate(0, ${b})`);for(let L of n.nodes)kf(N,L,S,0);if(n.modalNodes.length>0){let L=N.append("g").attr("class","wireframe-modals");for(let A of n.modalNodes)ZJ(L,A,S)}}function kf(t,e,n,r){let o=e.element,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",o.lineNumber);if(o.states.includes("disabled")&&a.attr("opacity",.5),o.isSkeleton&&o.type!=="skeleton"){PG(a,e,n);return}switch(o.type){case"group":IJ(a,e,n,r);break;case"textInput":PJ(a,e,n);break;case"button":DJ(a,e,n);break;case"dropdown":GJ(a,e,n);break;case"checkbox":OJ(a,e,n);break;case"radio":$J(a,e,n);break;case"heading":HJ(a,e,n);break;case"divider":WJ(a,e,n);break;case"text":AG(a,e,n);break;case"listItem":FJ(a,e,n);break;case"nav":BJ(a,e,n);break;case"tabs":YJ(a,e,n);break;case"table":VJ(a,e,n);break;case"image":UJ(a,e,n);break;case"skeleton":XJ(a,e,n);break;case"alert":jJ(a,e,n);break;case"progress":qJ(a,e,n);break;case"chart":KJ(a,e,n);break;default:AG(a,e,n)}}function IJ(t,e,n,r){let{palette:o,isTransparent:a}=n,i=e.element;if(i.metadata._inlineRow==="true"||i.metadata._labelField==="true"){for(let d of e.children)kf(t,d,n,r);return}let s=[12,7,4,2],l=s[Math.min(r,s.length-1)],c=Ot(o.textMuted,o.bg,l);if(a?t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",o.border).attr("stroke-width",1).attr("rx",Mf):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("stroke",o.border).attr("stroke-width",1).attr("rx",Mf),i.label&&n.showGroupLabels&&t.append("text").attr("x",10).attr("y",18).attr("fill",o.textMuted).attr("font-size",11).attr("font-weight","600").attr("letter-spacing","0.5px").text(i.label.toUpperCase()),i.states.includes("collapsed")){t.append("text").attr("x",e.width-20).attr("y",18).attr("fill",o.textMuted).attr("font-size",12).attr("opacity",.6).text("\u25B6");return}i.states.includes("scrollable")&&t.append("rect").attr("x",e.width-6).attr("y",28).attr("width",3).attr("height",Math.min(e.height-36,40)).attr("fill",o.border).attr("rx",1.5);for(let d of e.children)kf(t,d,n,r+1)}function PJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=e.height;if(t.append("rect").attr("width",e.width).attr("height",i).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",RG),a.fieldVariant==="password"?t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.text).attr("font-size",16).text("\u2022 \u2022 \u2022 \u2022 \u2022 \u2022"):t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.textMuted).attr("font-size",13).text(a.label||"Text input"),a.fieldVariant!=="password"){let s=Math.min(_t(a.label||"Text input",13)+14,e.width-20);t.append("line").attr("x1",s).attr("y1",8).attr("x2",s).attr("y2",i-8).attr("stroke",r.primary).attr("stroke-width",1.5).attr("opacity",.6)}if(a.fieldVariant==="textarea")for(let s=0;s<3;s++)t.append("line").attr("x1",e.width-12+s*3).attr("y1",i-4).attr("x2",e.width-4).attr("y2",i-12+s*3).attr("stroke",r.border).attr("stroke-width",1)}function DJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.states.includes("ghost"),s=IG(a,r),c=a.states.includes("primary")?r.primary:r.secondary,d=r.bg;s&&(c=s),i||o?(t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",c).attr("stroke-width",1.5).attr("rx",_G),d=c):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("rx",_G),t.append("text").attr("x",e.width/2).attr("y",e.height/2+4).attr("fill",d).attr("font-size",13).attr("font-weight","600").attr("text-anchor","middle").text(a.label)}function GJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",RG),t.append("text").attr("x",10).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(a.label||(a.options?.[0]??"Select..."));let i=e.width-16,s=e.height/2;t.append("path").attr("d",`M${i-4},${s-2} L${i},${s+2} L${i+4},${s-2}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5)}function OJ(t,e,n){let{palette:r}=n,o=e.element;if(o.states.includes("toggle")){let l=e.height/2;t.append("rect").attr("x",0).attr("y",l-18/2).attr("width",32).attr("height",18).attr("rx",18/2).attr("fill",o.checked?r.primary:r.border),t.append("circle").attr("cx",o.checked?32-18/2:18/2).attr("cy",l).attr("r",18/2-2).attr("fill",r.bg),o.label&&t.append("text").attr("x",40).attr("y",l+4).attr("fill",r.text).attr("font-size",13).text(o.label)}else{let s=e.height/2;t.append("rect").attr("x",0).attr("y",s-16/2).attr("width",16).attr("height",16).attr("fill",o.checked?r.primary:"none").attr("stroke",o.checked?r.primary:r.border).attr("rx",3),o.checked&&t.append("path").attr("d",`M3,${s} L6,${s+3} L13,${s-4}`).attr("fill","none").attr("stroke",r.bg).attr("stroke-width",2),o.label&&t.append("text").attr("x",24).attr("y",s+4).attr("fill",r.text).attr("font-size",13).text(o.label)}}function $J(t,e,n){let{palette:r}=n,o=e.element,a=8,i=e.height/2;t.append("circle").attr("cx",a).attr("cy",i).attr("r",a).attr("fill","none").attr("stroke",o.selected?r.primary:r.border).attr("stroke-width",1.5),o.selected&&t.append("circle").attr("cx",a).attr("cy",i).attr("r",4).attr("fill",r.primary),t.append("text").attr("x",a*2+8).attr("y",i+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function HJ(t,e,n){let{palette:r}=n,o=e.element,a=o.headingLevel===1;t.append("text").attr("x",0).attr("y",a?28:22).attr("fill",r.text).attr("font-size",a?22:16).attr("font-weight","bold").text(o.label)}function WJ(t,e,n){let{palette:r}=n;t.append("line").attr("x1",0).attr("y1",e.height/2).attr("x2",e.width).attr("y2",e.height/2).attr("stroke",r.border).attr("stroke-width",1)}function AG(t,e,n){let{palette:r}=n,o=e.element;if(o.metadata._labelField==="true"&&o.children.length>=2){for(let i of e.children)kf(t,i,n,0);return}let a=o.labelFor?r.textMuted:r.text;t.append("text").attr("x",0).attr("y",15).attr("fill",a).attr("font-size",13).text(o.label)}function FJ(t,e,n){let{palette:r}=n,o=e.element;t.append("circle").attr("cx",4).attr("cy",e.height/2).attr("r",2.5).attr("fill",r.textMuted),t.append("text").attr("x",14).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function BJ(t,e,n){let{palette:r}=n,o=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",Ot(r.textMuted,r.bg,8)).attr("rx",4);let a=12;for(let i of o.children){let s=i.states.includes("active");t.append("text").attr("x",a).attr("y",e.height/2+4).attr("fill",s?r.primary:r.text).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label);let l=_t(i.label,13);s&&t.append("line").attr("x1",a).attr("y1",e.height-4).attr("x2",a+l).attr("y2",e.height-4).attr("stroke",r.primary).attr("stroke-width",2),a+=l+24}}function YJ(t,e,n){let{palette:r}=n,o=e.element;t.append("line").attr("x1",0).attr("y1",e.height-1).attr("x2",e.width).attr("y2",e.height-1).attr("stroke",r.border).attr("stroke-width",1);let a=0;for(let i of o.children){let s=i.states.includes("active"),l=_t(i.label,13)+24;s&&t.append("line").attr("x1",a).attr("y1",e.height-1).attr("x2",a+l).attr("y2",e.height-1).attr("stroke",r.primary).attr("stroke-width",2),t.append("text").attr("x",a+12).attr("y",e.height/2+4).attr("fill",s?r.primary:r.textMuted).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label),a+=l}}function VJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.tableHeaders||[],s=a.tableData||[],l=a.tableRows!==void 0&&a.tableCols!==void 0,c=i.length||a.tableCols||3,d=e.width/c,u=32,f=28;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",r.border).attr("rx",4),t.append("rect").attr("width",e.width).attr("height",u).attr("fill",o?"none":Ot(r.textMuted,r.bg,8)).attr("rx",4);for(let m=0;m<c;m++){let g=i[m]||`Col ${m+1}`;t.append("text").attr("x",m*d+10).attr("y",u/2+4).attr("fill",r.text).attr("font-size",12).attr("font-weight","600").text(g)}t.append("line").attr("x1",0).attr("y1",u).attr("x2",e.width).attr("y2",u).attr("stroke",r.border);let p=l?a.tableRows||3:s.length;for(let m=0;m<p;m++){let g=u+m*f;m>0&&t.append("line").attr("x1",0).attr("y1",g).attr("x2",e.width).attr("y2",g).attr("stroke",r.border).attr("opacity",.3);for(let h=0;h<c;h++)if(l)t.append("rect").attr("x",h*d+10).attr("y",g+8).attr("width",d*.6).attr("height",12).attr("fill",r.textMuted).attr("opacity",.25).attr("rx",2);else if(s[m]){let S=s[m][h]||"";zJ(t,S,h*d+10,g,d-20,f,n)}}}function zJ(t,e,n,r,o,a,i){let{palette:s}=i,l=e.trim(),c=l.match(/^\(([^)]+)\)(?:\s*\|\s*(.+))?$/);if(c){let d=c[1],u=c[2]?.trim().toLowerCase(),f=u==="ghost",m=u==="destructive"?s.destructive:s.primary,g=Math.min(_t(d,10)+16,o),h=20,S=r+(a-h)/2;f?(t.append("rect").attr("x",n).attr("y",S).attr("width",g).attr("height",h).attr("fill","none").attr("stroke",m).attr("stroke-width",1).attr("rx",3),t.append("text").attr("x",n+g/2).attr("y",S+h/2+3).attr("fill",m).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d)):(t.append("rect").attr("x",n).attr("y",S).attr("width",g).attr("height",h).attr("fill",m).attr("rx",3),t.append("text").attr("x",n+g/2).attr("y",S+h/2+3).attr("fill",s.bg).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d));return}if(/^<\s*x?\s*>$/.test(l)){let d=/x/i.test(l),u=12,f=n,p=r+(a-u)/2;t.append("rect").attr("x",f).attr("y",p).attr("width",u).attr("height",u).attr("fill",d?s.primary:"none").attr("stroke",d?s.primary:s.border).attr("rx",2),d&&t.append("path").attr("d",`M${f+2},${p+u/2} L${f+4},${p+u/2+2} L${f+10},${p+2}`).attr("fill","none").attr("stroke",s.bg).attr("stroke-width",1.5);return}t.append("text").attr("x",n).attr("y",r+a/2+4).attr("fill",s.text).attr("font-size",12).text(l)}function UJ(t,e,n){let{palette:r,isTransparent:o}=n;if(e.element.imageHint==="round"){let s=Math.min(e.width,e.height)/2,l=e.width/2,c=e.height/2;t.append("circle").attr("cx",l).attr("cy",c).attr("r",s).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",r.border),t.append("line").attr("x1",l-s*.7).attr("y1",c-s*.7).attr("x2",l+s*.7).attr("y2",c+s*.7).attr("stroke",r.border),t.append("line").attr("x1",l+s*.7).attr("y1",c-s*.7).attr("x2",l-s*.7).attr("y2",c+s*.7).attr("stroke",r.border)}else t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",r.border).attr("rx",4),t.append("line").attr("x1",0).attr("y1",0).attr("x2",e.width).attr("y2",e.height).attr("stroke",r.border),t.append("line").attr("x1",e.width).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke",r.border)}function XJ(t,e,n){for(let r of e.children)PG(t,r,n)}function PG(t,e,n){let{palette:r,isTransparent:o}=n,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`);o?a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.1).attr("rx",4):a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.2).attr("rx",4)}function jJ(t,e,n){let{palette:r,isDark:o,isTransparent:a}=n,i=e.element,s=IG(i,r)||r.accent,l=a?null:ie(r,s,o,{solid:n.solid});l&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",l).attr("rx",4),t.append("rect").attr("width",3).attr("height",e.height).attr("fill",s).attr("rx",1.5),a&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",s).attr("rx",4);let c=l?Le(l,r.textOnFillLight,r.textOnFillDark):r.text;t.append("text").attr("x",12).attr("y",e.height/2+4).attr("fill",c).attr("font-size",13).text(i.label)}function qJ(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.progressValue??0,s=8,l=e.height/2;t.append("rect").attr("width",e.width-40).attr("height",s).attr("y",l-s/2).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",o?r.border:"none").attr("rx",s/2);let c=(e.width-40)*i/100;c>0&&t.append("rect").attr("width",c).attr("height",s).attr("y",l-s/2).attr("fill",r.primary).attr("rx",s/2),t.append("text").attr("x",e.width-32).attr("y",l+4).attr("fill",r.textMuted).attr("font-size",11).text(`${i}%`)}function KJ(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.chartHint||"line";t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Ot(r.textMuted,r.bg,8)).attr("stroke",r.border).attr("rx",4);let s=20,l=20,c=e.width-s*2,d=e.height-l*2;if(i==="line"){let f=[[0,d*.7],[c*.2,d*.4],[c*.4,d*.6],[c*.6,d*.2],[c*.8,d*.3],[c,d*.1]].map(([p,m],g)=>g===0?`M${s+p},${l+m}`:`L${s+p},${l+m}`).join(" ");t.append("path").attr("d",f).attr("fill","none").attr("stroke",r.primary).attr("stroke-width",2)}else if(i==="bar"){let f=c/10,p=[.6,.8,.5,.9,.7];for(let m=0;m<5;m++){let g=d*p[m];t.append("rect").attr("x",s+m*(c/5)+f/2).attr("y",l+d-g).attr("width",f).attr("height",g).attr("fill",r.primary).attr("opacity",.7).attr("rx",2)}}else if(i==="pie"){let u=e.width/2,f=e.height/2,p=Math.min(c,d)/2,m=[.35,.25,.2,.2],g=[r.primary,r.secondary,r.accent,r.border],h=0;for(let S=0;S<m.length;S++){let y=h+m[S]*Math.PI*2,b=u+p*Math.cos(h),E=f+p*Math.sin(h),x=u+p*Math.cos(y),N=f+p*Math.sin(y),L=m[S]>.5?1:0;t.append("path").attr("d",`M${u},${f} L${b},${E} A${p},${p} 0 ${L},1 ${x},${N} Z`).attr("fill",g[S]).attr("opacity",.7),h=y}}}function ZJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",a.lineNumber);o||i.append("rect").attr("x",4).attr("y",4).attr("width",e.width).attr("height",e.height).attr("fill","rgba(0,0,0,0.1)").attr("rx",Mf),i.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.surface).attr("stroke",r.border).attr("rx",Mf),i.append("rect").attr("width",e.width).attr("height",36).attr("fill",o?"none":Ot(r.textMuted,r.bg,15)).attr("rx",Mf),i.append("text").attr("x",12).attr("y",24).attr("fill",r.text).attr("font-size",14).attr("font-weight","600").text(a.label||"Modal");let s=e.width-16;i.append("text").attr("x",s).attr("y",24).attr("fill",r.textMuted).attr("font-size",16).text("\xD7");for(let l of e.children){let c=i.append("g").attr("transform","translate(0, 36)");kf(c,l,n,1)}}var RG,_G,Mf,_J,GG=st(()=>{"use strict";qn();an();tn();en();mr();RG=4,_G=6,Mf=8,_J={destructive:t=>t.destructive,success:t=>t.colors.green,warning:t=>t.colors.yellow,info:t=>t.colors.blue}});var VG={};ye(VG,{collectCardMetadata:()=>Dh,computeC4NodeDimensions:()=>Yl,layoutC4Components:()=>z1,layoutC4Containers:()=>V1,layoutC4Context:()=>Y1,layoutC4Deployment:()=>U1,rollUpContextRelationships:()=>BG});function Ih(t,e,n,r){let o=0;for(let a of t){let i=e.get(a.source),s=e.get(a.target);if(i==null||s==null)continue;let l=Math.abs(i-s),c=Math.min(n.get(a.source)??1,n.get(a.target)??1);o+=l*c}if(r)for(let a of t){let i=r.get(a.source),s=r.get(a.target);if(!i||!s)continue;let l=e.get(a.source)??0,c=e.get(a.target)??0,d=i.y,u=s.y;if(d===u)continue;let f=Math.min(l,c),p=Math.max(l,c),m=Math.min(d,u),g=Math.max(d,u);for(let[h,S]of r){if(h===a.source||h===a.target)continue;let y=e.get(h)??0,b=S.y,E=S.width/2,x=S.height/2;y+E>f&&y-E<p&&b+x>m&&b-x<g&&(o+=ott)}}return o}function Ph(t,e,n){if(e.length<2)return;let r=new Map;for(let s of e)r.set(s.source,(r.get(s.source)??0)+1),r.set(s.target,(r.get(s.target)??0)+1);let o=new Map;for(let s of t.nodes()){let l=is(t,s);l&&o.set(s,{y:l.y,width:l.width,height:l.height})}let a=new Map;for(let s of t.nodes()){let l=is(t,s);if(!l)continue;let c=Math.round(l.y);a.has(c)||a.set(c,[]),a.get(c).push(s)}for(let[,s]of a)s.sort((l,c)=>is(t,l).x-is(t,c).x);let i=!1;for(let[,s]of a){if(s.length<2)continue;let l=[];if(n&&n.size>0){let c=new Map,d=[];for(let u of s){let f=n.get(u);f?(c.has(f)||c.set(f,[]),c.get(f).push(u)):d.push(u)}for(let u of c.values())u.length>=2&&l.push(u);d.length>=2&&l.push(d)}else l.push(s);for(let c of l){if(c.length<2)continue;let d=c.map(g=>is(t,g).x).sort((g,h)=>g-h),u=new Map;for(let g of t.nodes()){let h=is(t,g);h&&u.set(g,h.x)}let f=Ih(e,u,r,o),p=[...c],m=f;if(c.length<=8){let g=att(c);for(let h of g){let S=new Map(u);for(let b=0;b<h.length;b++)S.set(h[b],d[b]);let y=Ih(e,S,r,o);y<m&&(m=y,p=[...h])}}else{let g=[...c],h=!0,S=0;for(;h&&S<10;){h=!1,S++;for(let y=0;y<g.length-1;y++){let b=new Map(u);for(let L=0;L<g.length;L++)b.set(g[L],d[L]);let E=Ih(e,b,r,o);[g[y],g[y+1]]=[g[y+1],g[y]];let x=new Map(u);for(let L=0;L<g.length;L++)x.set(g[L],d[L]);let N=Ih(e,x,r,o);N<E?(h=!0,N<m&&(m=N,p=[...g])):[g[y],g[y+1]]=[g[y+1],g[y]]}}}if(p.some((g,h)=>g!==c[h])){for(let g=0;g<p.length;g++){is(t,p[g]).x=d[g];let h=s.indexOf(c[g]);h>=0&&(s[h]=p[g])}i=!0}}}if(i)for(let s of e){let l=QJ(t,s.source,s.target);if(!l)continue;let c=is(t,s.source),d=is(t,s.target);if(!c||!d)continue;let u={x:c.x,y:c.y+c.height/2},f={x:d.x,y:d.y-d.height/2},p=(u.y+f.y)/2;l.points=[u,{x:u.x,y:p},{x:f.x,y:p},f]}}function att(t){let e=[],n=[...t],r=n.length,o=new Array(r).fill(0);e.push([...n]);let a=0;for(;a<r;)o[a]<a?(a%2===0?[n[0],n[a]]=[n[a],n[0]]:[n[o[a]],n[a]]=[n[a],n[o[a]]],e.push([...n]),o[a]++,a=0):(o[a]=0,a++);return e}function F1(t){let e=new Map;function n(r,o){e.set(r.name,o);for(let a of r.children)n(a,o);for(let a of r.groups)for(let i of a.children)n(i,o)}for(let r of t)n(r,r.name);return e}function B1(t,e){let n=[];function r(o){for(let a of o.relationships)n.push({sourceName:o.name,rel:a});for(let a of o.children)r(a);for(let a of o.groups)for(let i of a.children)r(i)}for(let o of t)r(o);return n}function BG(t){let e=F1(t.elements),n=B1(t.elements,e),r=new Set(t.elements.map(c=>c.name)),o=new Set,a=[],i=[];for(let{sourceName:c,rel:d}of n){let u=e.get(c)??c,f=e.get(d.target)??d.target;if(u===f)continue;let p={sourceName:u,targetName:f,...d.label!==void 0&&{label:d.label},...d.technology!==void 0&&{technology:d.technology},arrowType:d.arrowType,lineNumber:d.lineNumber};if(r.has(c)&&c===u){let m=`${u}\u2192${f}`;o.add(m),a.push(p)}else i.push(p)}let s=[...a],l=new Set(o);for(let c of i){let d=`${c.sourceName}\u2192${c.targetName}`;l.has(d)||(l.add(d),s.push(c))}return s}function Sd(t,e,n,r){let o=t.metadata.color;if(o)return o;if(!n)return;let a=e.find(c=>c.name.toLowerCase()===n.toLowerCase());if(!a)return;let i=qt(a.name),s=t.metadata[i];if(!s&&r){for(let c of r)if(s=c.metadata[i],s)break}let l=s??a.defaultValue;return l?a.entries.find(c=>c.value.toLowerCase()===l.toLowerCase())?.color??"#999999":"#999999"}function Dh(t){let e=[],n=t.tech??t.technology;n&&e.push({key:"Technology",value:n});for(let[r,o]of Object.entries(t)){if(itt.has(r.toLowerCase()))continue;let a=r.charAt(0).toUpperCase()+r.slice(1);e.push({key:a,value:o})}return e}function Yl(t,e){let n=_t(t.name,ett)+Rh*2,r=Math.max(JJ,Math.min(OG,n));if(e?.showTechnology){let i=Ah+HG,s=t.description?.join(`
212
+ `)){let n=e.trim();if(!(!n||n.startsWith("//")))return n.split(/\s+/)[0].toLowerCase()}return""}async function nE(t,e,n,r){let o=await zn(e,n),a=e==="dark",i=r?.width&&r.width>0?Math.round(r.width):pr,s=r?.height&&r.height>0?Math.round(r.height):br,l=ar(i,s),c=za(l,o,{width:i,height:s});if(!c)return document.body.removeChild(l),"";let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:g,colors:h}=c;return XX(d,t,o,a,u,f,p,m,g,h)?Un(l,e,o):(document.body.removeChild(l),"")}function XX(t,e,n,r,o,a,i,s,l,c){let d=UX(e),f=eE.has(d)?null:Ws(e,n);if(f&&!f.error&&f.data.length>0&&sR.has(f.type)){let h=!f.noTitle&&!!f.title;switch(h&&co(t,f.title,f.titleLineNumber,o,i),f.type){case"bar":return IA(t,f,o,a,c,n,r,i,s,h),!0;case"line":return GA(t,f,o,a,c,n,r,i,s,l,h),!0;case"pie":return $A(t,f,o,a,n,r,i,h?52:24),!0;case"radar":{let S=sg(f,c),y=pf(t,S,n,r,h,o);return FA(t,f,o,a,c,n,r,i,s,y),!0}case"polar-area":return YA(t,f,o,a,n,r,i,h?52:24),!0}}let p=Fs(e,n);if(p.error||!eE.has(p.type))return!1;let m=lr(n),g=!p.noTitle&&!!p.title;switch(g&&co(t,p.title,p.titleLineNumber,o,i),p.type){case"funnel":return zA(t,p,o,a,m,n,r,i,g?52:24),!0;case"heatmap":return XA(t,p,o,a,n,r,i,l,g?52:24),!0;case"scatter":{let h=aw(p,m),S=pf(t,h,n,r,g,o);return KA(t,p,o,a,m,n,r,i,s,S),!0}case"sankey":return QA(t,p,o,a,m,l,i,g?52:24),!0;case"chord":return tR(t,p,o,a,m,n,r,i,g?52:24),!0;case"function":{let h=aw(p,m),S=pf(t,h,n,r,g,o);return aR(t,p,o,a,m,i,s,S),!0}default:return!1}}var sR,eE,lR,rE=st(()=>{"use strict";ag();nf();nf();tn();Xi();ra();PA();OA();HA();BA();VA();UA();jA();ZA();JA();eR();iR();sR=new Set(["bar","line","pie","radar","polar-area"]),eE=new Set(["funnel","heatmap","scatter","sankey","chord","function"]),lR=new Set([...sR,...eE])});function td(t,e){let n=t.append("rect").attr("x",0).attr("y",0).attr("width",e.width).attr("height",e.height).attr("rx",e.rx).attr("fill",e.fill).attr("stroke",e.stroke).attr("stroke-width",e.strokeWidth);e.dashed&&n.attr("stroke-dasharray","6 3"),t.append("text").attr("x",e.width/2).attr("y",e.headerHeight/2+e.labelFontSize/2-2).attr("text-anchor","middle").attr("fill",e.labelColor).attr("font-size",e.labelFontSize).attr("font-weight","bold").text(e.label);let r=e.meta;if(!r||r.rows.length===0)return;t.append("line").attr("x1",0).attr("y1",e.headerHeight).attr("x2",e.width).attr("y2",e.headerHeight).attr("stroke",r.separatorColor).attr("stroke-opacity",.3).attr("stroke-width",1);let o=r.keyX??10,a=Math.max(...r.rows.map(([l])=>_t(`${l}: `,r.fontSize))),i=o+a,s=e.headerHeight+r.separatorGap+r.fontSize;for(let l=0;l<r.rows.length;l++){let[c,d]=r.rows[l],u=s+l*r.lineHeight;t.append("text").attr("x",o).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(`${c}: `),t.append("text").attr("x",i).attr("y",u).attr("fill",r.textColor).attr("font-size",r.fontSize).text(d)}}function oE(t,e){t.append("clipPath").attr("id",e.clipId).append("rect").attr("width",e.width).attr("height",e.height).attr("rx",e.rx),t.append("rect").attr("x",e.inset).attr("y",e.height-e.barHeight).attr("width",e.width-e.inset*2).attr("height",e.barHeight).attr("fill",e.fill).attr("clip-path",`url(#${e.clipId})`).attr("class",e.className)}var Dg=st(()=>{"use strict";en()});var SR={};ye(SR,{clearEventLineMuted:()=>lj,focusEventLine:()=>ER,renderEventLine:()=>fE,renderEventLineForExport:()=>hj});function fE(t,e,n,r,o,a,i){if(e.events.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let s=a?.width??t.clientWidth,l=a?.height??t.clientHeight;if(s<=0||l<=0)return;let c=!!a,d=c?new Set:pE(t),f=lr(n)[0],p=Wr(e.tagGroups,void 0,i),m=!!e.title&&!e.options.noTitle,g=e.tagGroups.length>0&&p!==null&&!e.options.noLegend,h=m?jX:0,y=h+(g?qX:0),b=new Map(e.eras.map(rt=>[rt.name,rt])),E=new Set(e.eras.filter(rt=>rt.collapsed).map(rt=>rt.name)),x=e.events.some(rt=>rt.era&&b.has(rt.era)),N=e.events.some(rt=>rt.era&&b.has(rt.era)&&!E.has(rt.era)),L=e.options.side,A=L==="alternate",C=A||L==="above"?"below":"above",k=[],w=new Set;for(let rt of e.events){let pt=rt.era;pt&&E.has(pt)?w.has(pt)||(w.add(pt),k.push({kind:"era",era:b.get(pt),members:e.events.filter(gt=>gt.era===pt)})):k.push({kind:"event",event:rt})}let v=Math.max(8,Math.floor((oo-Gl*2)/(Ol*Bo))),M=(rt,pt)=>28+(pt?dR:0)+(rt.length>0?6+rt.length*xR:0)+(rt.length>0?Gl:6),_=rt=>{if(!p)return f;let pt=sr(rt.metadata,e.tagGroups,p);return pt&&pt!==ej?On(pt,n)??pt:f},T=0,R=k.map(rt=>{let pt=A?T++%2===0?"above":"below":L;if(rt.kind==="event"){let $t=rt.event,ft=_($t),Wt=ie(n,ft,r,{solid:!1}),ge=Le(Wt,n.textOnFillLight,n.textOnFillDark),ne=yR($t.description,v);return{kind:"event",event:$t,era:null,members:[],label:$t.label,date:$t.date,dateValue:$t.dateValue,future:$t.future,futureSpan:$t.futureSpan,lineNumber:$t.lineNumber,eraName:$t.era,color:ft,cardFill:Wt,titleColor:ge,lines:ne,bulletColors:[],bulletMeta:[],cardH:M(ne,!!$t.date),x:0,side:pt,lane:0,left:0,spanHalf:0}}let gt=rt.era,dt=rt.members.map(_),ut=p!=null&&dt.length>0&&dt.every($t=>$t===dt[0])&&dt[0]!==f,yt=gt.color?On(gt.color,n)??n.text:ut?dt[0]:n.text,vt=Ot(yt,or(n,r),10),Gt=Le(vt,n.textOnFillLight,n.textOnFillDark),Xt=null,bt=null;for(let $t of rt.members)$t.dateValue!==null&&((Xt===null||$t.dateValue<Xt)&&(Xt=$t.dateValue),(bt===null||$t.dateValue>bt)&&(bt=$t.dateValue));let Mt=Xt!==null&&bt!==null?(Xt+bt)/2:null,zt=rt.members.filter($t=>!dj($t.metadata,d)),xt=zt.map($t=>`\u2022 ${$t.date?`${$t.future?"TBD":Ki($t.date)} `:""}${$t.label}`),Nt=zt.map(_),Dt=zt.map($t=>$t.metadata),Vt=yR(xt,v);return{kind:"era",event:null,era:gt,members:rt.members,label:gt.name,date:null,dateValue:Mt,future:!1,futureSpan:null,lineNumber:gt.lineNumber,eraName:gt.name,color:yt,cardFill:vt,titleColor:Gt,lines:Vt,bulletColors:Nt,bulletMeta:Dt,cardH:M(Vt,!1),x:0,side:pt,lane:0,left:0,spanHalf:0}}),O=e.options.scale&&R.every(rt=>rt.dateValue!==null),I=s-Gg*2,H=16,G=8,D=64,W=16,V=[],P=[],F=()=>{if(!P.length)return;let rt=P.map(pt=>pt.dateValue);V.push({kind:"run",events:P,lo:Math.min(...rt),hi:Math.max(...rt)}),P=[]};for(let rt of R)rt.kind==="era"?(F(),V.push({kind:"capsule",p:rt})):P.push(rt);F();let Y=V.reduce((rt,pt)=>rt+(pt.kind==="run"?pt.hi-pt.lo:0),0),z=rt=>{if(O){let pt=Y>0?I*rt/Y:0,gt={above:-1/0,below:-1/0},dt=Gg;for(let vt of V)if(vt.kind==="capsule"){let Gt=dt+D/2,Xt=Math.max(oo/2+6,gt[vt.p.side]+Og+oo/2);Gt<Xt&&(dt+=Xt-Gt,Gt=Xt),vt.p.x=Gt,vt.p.spanHalf=D/2,gt[vt.p.side]=Gt+oo/2,dt+=D+W}else{for(let Gt of vt.events)Gt.x=dt+(Gt.dateValue-vt.lo)*pt,Gt.spanHalf=0;dt+=(vt.hi-vt.lo)*pt+W}let ut=-1/0,yt=null;for(let vt of[...R].sort((Gt,Xt)=>Gt.x-Xt.x)){if(vt.kind==="era"){ut=vt.x+vt.spanHalf,yt=null;continue}if(vt.dateValue===yt){vt.x=ut;continue}vt.x<ut+H&&(vt.x=ut+H),ut=vt.x,yt=vt.dateValue}}else{R.forEach(dt=>{dt.spanHalf=0});let pt=R.length,gt=pt>1?Math.max(JX,I/(pt-1)):0;R.forEach((dt,ut)=>{dt.x=Gg+ut*gt})}if(O){let pt=oo+Og;for(let gt=0;gt<8;gt++){let dt=!1;for(let ut of["above","below"]){let yt=R.filter(vt=>vt.side===ut).sort((vt,Gt)=>vt.x-Gt.x);for(let vt=1;vt<yt.length;vt++){let Gt=yt[vt];if(Gt.kind!=="event")continue;let Xt=yt[vt-1];if(Xt.kind==="event"&&Gt.dateValue===Xt.dateValue)continue;let bt=Xt.x+pt;if(bt<=Gt.x)continue;let Mt=yt[vt+1],zt=Mt?.kind==="era"?Mt.x-pt:1/0,xt=Math.min(bt,zt);xt>Gt.x+.5&&(Gt.x=xt,dt=!0)}}if(!dt)break}}for(let pt of["above","below"]){let gt=R.filter(ut=>ut.side===pt).sort((ut,yt)=>ut.x-yt.x),dt=[];for(let ut=0;ut<gt.length;ut++){let yt=gt[ut],vt=gt[ut+1],Xt=yt.kind!=="era"&&!!vt&&vt.x-yt.x<oo+Og?yt.x-oo+aE:yt.x-oo/2,bt=yt.x-aE,Mt=yt.x-oo+aE,zt=dt.length,xt=Math.max(Xt,Mt);for(let Nt=0;Nt<dt.length;Nt++){let Dt=Math.max(Xt,dt[Nt]+Og,Mt);if(Dt<=bt){zt=Nt,xt=Dt;break}}yt.lane=zt,yt.left=Math.max(6,xt),dt[zt]=yt.left+oo}}},j=()=>{let rt=Math.max(s,Math.max(...R.map(Dt=>Dt.x+Dt.spanHalf))+Gg,Math.max(...R.map(Dt=>Dt.left+oo))+6),pt={above:[],below:[]};for(let Dt of["above","below"]){let Vt=[];for(let Wt of R)Wt.side===Dt&&(Vt[Wt.lane]=Math.max(Vt[Wt.lane]??0,Wt.cardH));let $t=[],ft=0;for(let Wt=0;Wt<Vt.length;Wt++)$t[Wt]=ft,ft+=(Vt[Wt]??0)+tj;pt[Dt]=$t}let gt=Dt=>(Dt.side==="above"?KX:ZX)+(pt[Dt.side][Dt.lane]??0),dt=Dt=>Math.max(0,...R.filter(Vt=>Vt.side===Dt).map(Vt=>gt(Vt)+Vt.cardH)),ut=dt("above"),yt=dt("below"),vt=ut+(N&&C==="above"?uR:0),Gt=yt+(N&&C==="below"?uR:0),Xt=14,bt=14,Mt=y+Xt+vt,zt=C==="above"?Mt-(ut+14):Mt+(yt+14),xt=Mt+Gt+bt,Nt=c?xt:Math.max(l,xt);return{contentW:rt,contentH:xt,totalH:Nt,spineY:Mt,eraBaseY:zt,laneNear:gt}},K=Number(globalThis.process?.env?.DGMO_EVT_STRETCH),$;if(Number.isFinite(K)&&K>0)z(K),$=j();else{z(1),$=j();let rt=s/l,pt=gt=>gt.contentW/gt.contentH;if(O&&$.contentH>l&&pt($)<rt){z(G);let gt=j();if(pt(gt)<=rt)$=gt;else{let dt=1,ut=G;for(let yt=0;yt<8;yt++){let vt=(dt+ut)/2;z(vt),pt(j())>=rt?ut=vt:dt=vt}z(ut),$=j()}}}let{contentW:U,totalH:X,spineY:q,eraBaseY:et,laneNear:tt}=$,B=It(t).append("svg").attr("width",U).attr("height",X).attr("viewBox",`0 0 ${U} ${X}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c||B.append("style").text(aj),m){let rt=B.append("text").attr("class","chart-title").attr("x",U/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber){let pt=e.titleLineNumber;rt.style("cursor","pointer").on("click",()=>o(pt))}}if(g){let rt=B.append("g").attr("transform",`translate(0, ${h})`),pt=e.tagGroups.map(gt=>({name:gt.name,entries:gt.entries.map(dt=>({value:dt.value,color:On(dt.color,n)??dt.color}))}));mn(rt,{groups:pt,palette:n,isDark:r,width:U,mode:c?"export":"preview",activeGroup:p}),c||cj(rt)}let Q=Math.min(...R.map(rt=>rt.x-rt.spanHalf)),ot=Math.max(...R.map(rt=>rt.x+rt.spanHalf)),Z=Q-20,lt=ot+20,nt=O&&R.some(rt=>rt.future&&!rt.futureSpan),J=R.length?Math.max(Z,...R.filter(rt=>!rt.future).map(rt=>rt.x+rt.spanHalf)):lt,at=nt?J:lt;B.append("line").attr("x1",Z).attr("y1",q).attr("x2",at).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round"),nt&&B.append("line").attr("x1",at).attr("y1",q).attr("x2",lt).attr("y2",q).attr("stroke",n.text).attr("stroke-width",2.5).attr("stroke-linecap","round").attr("stroke-opacity",.45).attr("stroke-dasharray","2 6");let it=R.map(rt=>{let pt=rt.side==="above"?q-tt(rt):q+tt(rt),gt=rt.side==="above"?pt-rt.cardH:pt;return{p:rt,near:pt,top:gt}}),Lt=(rt,pt)=>{let gt=Math.min(q,pt),dt=Math.max(q,pt);return it.some(ut=>ut.p!==rt&&rt.x>ut.p.left&&rt.x<ut.p.left+oo&&dt>ut.top&&gt<ut.top+ut.p.cardH)},Tt=rt=>q+oj*(rt.side==="above"?-1:1);for(let{p:rt,near:pt}of it){let gt=rt.kind==="era"?Tt(rt):q,dt=B.append("line").attr("class","dgmo-event-leader").attr("x1",rt.x).attr("y1",gt).attr("x2",rt.x).attr("y2",pt).attr("stroke",rt.color).attr("stroke-width",1.5).attr("stroke-opacity",Lt(rt,pt)?.18:rt.future?.4:.65);sE(dt,rt)}let At=0;for(let{p:rt,top:pt}of it){let gt=rt.left,dt=B.append("g").attr("class","dgmo-event-card").attr("transform",`translate(${gt}, ${pt})`).attr("data-line-number",rt.lineNumber);if(sE(dt,rt),rt.kind==="era"&&dt.attr("data-era",rt.era.name).attr("data-era-collapsed","true"),o){let vt=rt.lineNumber;dt.style("cursor","pointer").on("click",()=>o(vt)),dt.append("rect").attr("x",0).attr("y",0).attr("width",oo).attr("height",rt.cardH).attr("fill","transparent").attr("pointer-events","all")}let ut=rt.kind==="event"&&rt.date?rt.future?"TBD":Ki(rt.date):null,yt=ut?dR:0;if(e.options.noBox){let vt=rt.side==="below",Gt=vt?0:rt.cardH-28,Xt=vt?0:rt.cardH-28-yt,bt=28+yt,Mt=`dgmo-evt-shelf-${At++}`;dt.append("clipPath").attr("id",Mt).append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("rx",iE),dt.append("rect").attr("x",0).attr("y",Xt).attr("width",oo).attr("height",bt).attr("clip-path",`url(#${Mt})`).attr("fill",Ot(rt.color,or(n,r),nj));let zt=vt?Xt:Xt+bt-iE;if(dt.append("rect").attr("x",0).attr("y",zt).attr("width",oo).attr("height",iE).attr("clip-path",`url(#${Mt})`).attr("fill",rt.color).attr("fill-opacity",rt.future?.4:1),dt.append("text").attr("x",Gl).attr("y",Gt+28/2+13/2-2).attr("fill",rt.color).attr("font-family",Pt).attr("font-size",13).attr("font-weight",700).text(rt.label),ut&&dt.append("text").attr("x",Gl).attr("y",(vt?28:Gt-yt)+$g+2).attr("fill",Ot(n.text,n.bg,55)).attr("font-family",Pt).attr("font-size",$g).attr("font-weight",600).text(ut),rt.lines.length>0){let xt=vt?lE+yt+Ol:Gl+Ol;bR(dt,rt.lines,n.text,n,xt,rt.bulletColors,rt.bulletMeta)}}else td(dt,{width:oo,height:rt.cardH,rx:6,fill:rt.cardFill,stroke:rt.color,strokeWidth:1.5,label:rt.label,labelColor:rt.titleColor,labelFontSize:13,headerHeight:28}),ut&&dt.append("text").attr("x",oo/2).attr("y",28+$g+1).attr("text-anchor","middle").attr("fill",Ot(rt.titleColor,rt.cardFill,60)).attr("font-family",Pt).attr("font-size",$g).attr("font-weight",600).text(ut),rt.lines.length>0&&(dt.append("line").attr("x1",0).attr("y1",28+yt).attr("x2",oo).attr("y2",28+yt).attr("stroke",rt.titleColor).attr("stroke-opacity",.3).attr("stroke-width",1),bR(dt,rt.lines,rt.titleColor,n,lE+yt+Ol,rt.bulletColors,rt.bulletMeta))}for(let rt of R){if(rt.kind==="era"){let gt=rt.color,dt=Math.max(16,rt.spanHalf),ut=Q-20,yt=ot+20,vt=Math.max(ut,rt.x-dt),Gt=Math.min(yt,rt.x+dt),Xt=Tt(rt),bt=B.append("g").attr("class","dgmo-event-era").attr("data-era",rt.era.name).attr("data-era-collapsed","true").attr("data-line-number",rt.lineNumber);if(o){let zt=Math.min(Xt,q)-4,xt=Math.max(Xt,q)+8;bt.append("rect").attr("x",vt).attr("y",zt).attr("width",Gt-vt).attr("height",xt-zt).attr("fill","transparent").attr("pointer-events","all")}bt.append("path").attr("d",`M${vt},${q} L${vt},${Xt} L${Gt},${Xt} L${Gt},${q}`).attr("fill","none").attr("stroke",gt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round");let Mt=(vt+Gt)/2;bt.append("line").attr("x1",Mt-Fg/2).attr("y1",q).attr("x2",Mt+Fg/2).attr("y2",q).attr("stroke",n.bg).attr("stroke-width",5).attr("stroke-linecap","butt");for(let zt of yj(Mt,q))bt.append("path").attr("d",zt).attr("fill","none").attr("stroke",n.text).attr("stroke-width",2).attr("stroke-linecap","round").attr("stroke-linejoin","round");if(o){let zt=rt.lineNumber;bt.style("cursor","pointer").on("click",()=>o(zt))}continue}let pt=B.append("circle").attr("class","dgmo-event-dot").attr("cx",rt.x).attr("cy",q).attr("r",QX).attr("fill",rt.future?n.bg:rt.color).attr("stroke",rt.future?rt.color:n.bg).attr("stroke-width",2).attr("data-line-number",rt.lineNumber);sE(pt,rt)}if(x){let rt=[],pt=null;for(let yt of R){let vt=yt.eraName;if(vt&&b.has(vt)){if(pt===vt&&rt.length>0){let Gt=rt[rt.length-1];Gt.firstX=Math.min(Gt.firstX,yt.x),Gt.lastX=Math.max(Gt.lastX,yt.x)}else rt.push({era:b.get(vt),collapsed:yt.kind==="era",firstX:yt.x,lastX:yt.x});pt=vt}else pt=null}let gt=yt=>Math.max(4,Math.min(U-4,yt)),dt=C==="above"?1:-1,ut=rt.filter(yt=>!yt.collapsed).map(yt=>({run:yt,x0:gt(yt.firstX-pR),x1:gt(yt.lastX+pR)})).sort((yt,vt)=>yt.run.firstX-vt.run.firstX);for(let yt=1;yt<ut.length;yt++){let vt=ut[yt-1],Gt=ut[yt];if(vt.x1<=Gt.x0)continue;let Xt=(vt.run.lastX+Gt.run.firstX)/2;vt.x1=Math.max(vt.run.lastX,Math.min(vt.x1,Xt-mR)),Gt.x0=Math.min(Gt.run.firstX,Math.max(Gt.x0,Xt+mR))}for(let{run:yt,x0:vt,x1:Gt}of ut){let Xt=!yt.era.color,bt=Xt?n.text:On(yt.era.color,n)??n.text,Mt=Xt?.5:.85,zt=et,xt=B.append("g").attr("class","dgmo-event-era").attr("data-era",yt.era.name).attr("data-era-collapsed",String(yt.collapsed)).attr("data-line-number",yt.era.lineNumber);if(xt.append("path").attr("d",`M${vt},${zt+fR*dt} L${vt},${zt} L${Gt},${zt} L${Gt},${zt+fR*dt}`).attr("fill","none").attr("stroke",bt).attr("stroke-width",1.5).attr("stroke-linecap","round").attr("stroke-linejoin","round").attr("stroke-opacity",Mt),xt.append("text").attr("x",(yt.firstX+yt.lastX)/2).attr("y",C==="above"?zt-6:zt+hR+4).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",hR).attr("font-weight",700).attr("fill",bt).attr("fill-opacity",Xt?.85:1).text(yt.era.name),o){let Nt=yt.era.lineNumber;xt.style("cursor","pointer").on("click",()=>o(Nt))}}}if(!c){let rt=B.node();gj(rt),rt&&(mj(t,rt,()=>fE(t,e,n,r,o,a,i)),uj(t,rt))}}function sE(t,e){if(t.attr("data-evt",e.lineNumber),e.eraName&&t.attr("data-evt-era",e.eraName),e.event)for(let[n,r]of Object.entries(e.event.metadata))t.attr(`data-tag-${n.toLowerCase()}`,String(r).toLowerCase())}function sj(t){t.querySelectorAll(`.${js},.${$l},.${Bg}`).forEach(e=>e.classList.remove(js,$l,Bg))}function ed(t,e){if(sj(t),!e)return;let n=[...t.querySelectorAll(ij)];if(e.kind==="event"){let l=c=>c.getAttribute("data-evt")===e.id;if(!n.some(l))return;n.forEach(c=>c.classList.add(l(c)?js:$l));return}if(e.kind==="era"){let l=c=>c.getAttribute("data-evt-era")===e.name||c.classList.contains("dgmo-event-era")&&c.getAttribute("data-era")===e.name;if(!n.some(l))return;n.forEach(c=>{l(c)?c.classList.contains("dgmo-event-era")&&c.classList.add(Bg):c.classList.add($l)});return}let r=`data-tag-${e.group}`,o=l=>l.getAttribute(r)===e.value,a=[...t.querySelectorAll(".dgmo-evt-bullet")],i=new Set;for(let l of a){if(!o(l))continue;let c=l.closest(".dgmo-event-card"),d=c?.getAttribute("data-era")??c?.getAttribute("data-evt-era");d&&i.add(d)}if(!n.some(o)&&i.size===0)return;let s=l=>{let c=l.getAttribute("data-era")??l.getAttribute("data-evt-era");return!!c&&i.has(c)};n.forEach(l=>{!o(l)&&!s(l)&&l.classList.add($l)});for(let l of a)o(l)||l.classList.add($l)}function Wg(t){let e=t.getAttribute(cE);if(!e)return null;try{return JSON.parse(e)}catch{return null}}function lj(t){t.removeAttribute(uE)}function ER(t,e){let n=t.querySelector("svg");n&&(e?n.setAttribute(cE,JSON.stringify(e)):n.removeAttribute(cE),ed(n,e))}function pE(t){let e=t.getAttribute(uE);if(!e)return new Set;try{return new Set(JSON.parse(e))}catch{return new Set}}function cj(t){t.selectAll("[data-legend-entry]").each(function(){let r;try{r=this.getBBox()}catch{return}!r.width||!r.height||It(this).insert("rect",":first-child").attr("x",r.x-6).attr("y",r.y-7).attr("width",r.width+12).attr("height",r.height+14).attr("fill","transparent").attr("data-legend-hit","")})}function dj(t,e){if(e.size===0)return!1;for(let[n,r]of Object.entries(t))if(e.has(`${n.toLowerCase()}:${String(r).toLowerCase()}`))return!0;return!1}function uj(t,e){let n=pE(t),r=o=>{for(let a of n){let i=a.indexOf(":");if(i<0)continue;let s=a.slice(0,i),l=a.slice(i+1);if(o.getAttribute(`data-tag-${s}`)===l)return!0}return!1};e.querySelectorAll(".dgmo-event-card,.dgmo-event-leader").forEach(o=>o.classList.toggle(mf,r(o))),e.querySelectorAll("[data-legend-entry]").forEach(o=>{let a=o.closest("[data-legend-group]")?.getAttribute("data-legend-group"),i=o.getAttribute("data-legend-entry");fj(o,!!a&&n.has(`${a}:${i}`))})}function fj(t,e){t.classList.toggle(wR,e);let n=t.querySelector("circle");if(n)if(e)n.hasAttribute("data-fill0")||n.setAttribute("data-fill0",n.getAttribute("fill")??""),n.setAttribute("fill","none"),n.setAttribute("stroke",n.getAttribute("data-fill0")||"currentColor"),n.setAttribute("stroke-width","1.5");else{let r=n.getAttribute("data-fill0");r!==null&&n.setAttribute("fill",r),n.removeAttribute("stroke"),n.removeAttribute("stroke-width")}}function pj(t,e,n){let r=pE(t),o=`${e}:${n}`;r.has(o)?r.delete(o):r.add(o),t.setAttribute(uE,JSON.stringify([...r]))}function mj(t,e,n){e.addEventListener("click",r=>{let o=r.target;if(!o||typeof o.closest!="function")return;let a=o.closest("[data-legend-entry]");if(!a)return;let i=a.getAttribute("data-legend-entry"),s=a.closest("[data-legend-group]")?.getAttribute("data-legend-group");if(!s||!i)return;pj(t,s,i);let l=Wg(e);n(),l&&ER(t,l),typeof CustomEvent<"u"&&t.dispatchEvent(new CustomEvent("dgmo-event-line-rerender"))})}function gj(t){t&&(t.addEventListener("mouseover",e=>{let n=e.target;if(!n||typeof n.closest!="function")return;let r=n.closest("[data-legend-entry]");if(r){let i=r.getAttribute("data-legend-entry"),s=r.closest("[data-legend-group]")?.getAttribute("data-legend-group");ed(t,s&&i?{kind:"tag",group:s,value:i}:Wg(t));return}let o=n.closest(".dgmo-event-era");if(o){ed(t,{kind:"era",name:o.getAttribute("data-era")??""});return}let a=n.closest("[data-evt]");if(a){let i=a.getAttribute("data-era");ed(t,i?{kind:"era",name:i}:{kind:"event",id:a.getAttribute("data-evt")??""});return}ed(t,Wg(t))}),t.addEventListener("mouseout",e=>{let n=e.relatedTarget;(!n||!t.contains(n))&&ed(t,Wg(t))}))}function hj(t,e,n,r,o,a){fE(t,e,n,r,void 0,o,a)}function yj(t,e){let o=a=>{let i="";for(let s=0;s<=48;s++){let l=s/48,c=e-gR+l*2*gR,d=a+rj*Math.sin(l*Math.PI*2);i+=`${s===0?"M":"L"}${d.toFixed(2)},${c.toFixed(2)}`,s<48&&(i+=" ")}return i};return[o(t-Fg/2),o(t+Fg/2)]}function yR(t,e){let n=[];for(let r of t){if(r===""){n.push({text:"",kind:"plain"});continue}n.push(...Ko([r],e))}return n}function bR(t,e,n,r,o=lE+Ol,a=[],i=[]){let s=o,l=0,c=n,d=null,u=f=>{if(d){f.attr("class","dgmo-evt-bullet");for(let[p,m]of Object.entries(d))f.attr(`data-tag-${p.toLowerCase()}`,String(m).toLowerCase())}};for(let f of e){let p=f.kind==="bullet-first"||f.kind==="bullet-cont",m=Gl+(p?12:0);if(f.kind==="bullet-first"){c=a[l]??n,d=i[l]??null,l++;let h=t.append("text").attr("x",Gl).attr("y",s).attr("text-anchor","start").attr("fill",c).attr("font-family",Pt).attr("font-size",Ol).attr("font-weight",700).text("\u2022");u(h)}else p||(c=n,d=null);let g=t.append("text").attr("x",m).attr("y",s).attr("text-anchor","start").attr("fill",p?c:n).attr("font-family",Pt).attr("font-size",Ol);p&&u(g),bn(g,f.text,r),s+=xR}}var oo,Gg,jX,qX,KX,ZX,Ol,xR,Gl,lE,QX,JX,tj,ej,aE,Og,dR,$g,nj,iE,uR,fR,pR,mR,gR,rj,Fg,oj,hR,js,$l,Bg,mf,wR,uE,aj,ij,cE,LR=st(()=>{"use strict";qn();an();tn();wr();Dg();Ro();en();Ds();Br();m0();je();oo=210,Gg=58,jX=48,qX=34,KX=46,ZX=46,Ol=11.5,xR=16,Gl=9,lE=34,QX=5.5,JX=96,tj=16,ej="#999999",aE=18,Og=6,dR=15,$g=10,nj=13,iE=4,uR=30,fR=8,pR=14,mR=3,gR=6,rj=2.6,Fg=5,oj=13,hR=11.5,js="dgmo-evt-hl",$l="dgmo-evt-dim",Bg="dgmo-evt-era-hl",mf="dgmo-evt-collapsed",wR="dgmo-evt-off",uE="data-evt-hidden",aj=`.dgmo-event-dot{transition:transform .12s ease;transform-box:fill-box;transform-origin:center}.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era{transition:opacity .12s ease,filter .12s ease}.dgmo-event-dot,.dgmo-event-card,.dgmo-event-era{cursor:default}[data-legend-entry]{cursor:pointer}.${$l}{opacity:.2}.dgmo-event-dot.${js}{transform:scale(1.55)}.dgmo-event-leader.${js}{stroke-opacity:1;stroke-width:2.5}.dgmo-event-card.${js}{filter:drop-shadow(0 2px 5px rgba(0,0,0,.22))}.dgmo-event-era.${Bg}{filter:drop-shadow(0 1px 2px rgba(0,0,0,.28))}.dgmo-event-card.${mf},.dgmo-event-leader.${mf}{opacity:0;pointer-events:none}.dgmo-event-card.${mf}.${js},.dgmo-event-leader.${mf}.${js}{opacity:1;pointer-events:auto}[data-legend-entry].${wR} text{text-decoration:line-through;opacity:.5}`;ij=".dgmo-event-dot,.dgmo-event-leader,.dgmo-event-card,.dgmo-event-era",cE="data-evt-pin"});var kR={};ye(kR,{renderVersionControl:()=>MR,renderVersionControlForExport:()=>Sj});function xj(t,e){return t.length>e?t.slice(0,e-1)+"\u2026":t}function hE(t,e,n,r,o,a,i){let s=Math.hypot(n-t,r-e),l=Math.hypot(o-n,a-r),c=Math.max(2,Math.min(i,s-1,l-1)),d=(n-t)/(s||1),u=(r-e)/(s||1),f=(o-n)/(l||1),p=(a-r)/(l||1);return`M${t},${e} L${n-d*c},${r-u*c} Q${n},${r} ${n+f*c},${r+p*c} L${o},${a}`}function MR(t,e,n,r,o,a){if(e.nodes.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.nodes,s=e.options.direction!=="LR",l=new Map(e.branches.map(D=>[D.name,D])),c=lr(n),d=D=>D.colorToken?On(D.colorToken,n)??c[D.lane%c.length]:c[D.lane%c.length],u=D=>d(l.get(D.branch)),f=D=>i[D],p=D=>D.kind==="cherry"?"\u21E0 ":D.kind==="merge"?"\u21F2 ":"",m=new Map;for(let D of i){let W=D.id,V=p(D)+xj(D.message||"(empty)",26),P=(W?W.length*6.6+8:0)+V.length*6.9+8;m.set(D.key,{sha:W,msg:V,lw:P})}let g=Math.max(0,...[...m.values()].map(D=>D.lw)),h=new Map,S=(D,W)=>{h.has(D)||h.set(D,[]),h.get(D).push(W)};if(!e.options.noLabels)for(let D of i)D.tag&&S(D.key,{kind:"tag",label:D.tag,w:D.tag.length*6.6+16});for(let D of e.refs)D.atKey!=null&&(D.head?S(D.atKey,{kind:"head",label:"HEAD",w:46}):S(D.atKey,{kind:"ref",label:D.name,remote:D.remote,w:D.name.length*6.2+18}));for(let D of e.notes)D.anchorKey!=null&&S(D.anchorKey,{kind:"note",label:NR[D.num-1]??`#${D.num}`,w:19});let y=Math.max(0,...[...h.values()].map(D=>D.length)),b=e.branches.length,E=i.length,x=new Map,N=[],L,A,C,k,w=0,v=Math.cos(yE*Math.PI/180),M=Math.sin(yE*Math.PI/180);if(s){C=24;let D=C+32,W=52,V=96;k=78;for(let F of i)x.set(F.key,{x:k+F.lane*V,y:D+F.seq*W});let P=k+(b-1)*V+28;for(let F of i){let Y=x.get(F.key);N.push({node:F,kind:"msg",diag:!1,x:P,y:Y.y,anchor:"start",leader:{x1:Y.x+Zo+2,y1:Y.y,x2:P-6,y2:Y.y}}),(h.get(F.key)??[]).forEach((j,K)=>N.push({node:F,kind:j.kind,label:j.label,remote:j.remote,w:j.w,x:Y.x-Zo-12-j.w/2-K*4,y:Y.y,anchor:"middle"}))}L=P+g+16,A=D+(E-1)*W+22}else{C=Math.max(4,...e.branches.map(z=>z.name.length))*7.5+18;let W=C+34,V=86,P=54;k=16+y*vR+14;for(let z of i)x.set(z.key,{x:W+z.seq*V,y:k+z.lane*P});let Y=k+(b-1)*P+26;for(let z of i){let j=x.get(z.key);N.push({node:z,kind:"msg",diag:!0,x:j.x,y:Y,anchor:"start",leader:{x1:j.x,y1:j.y+Zo,x2:j.x,y2:Y-3}}),(h.get(z.key)??[]).forEach(($,U)=>N.push({node:z,kind:$.kind,label:$.label,remote:$.remote,w:$.w,x:j.x,y:j.y-Zo-12-U*vR,anchor:"middle"}))}for(let z of e.branches){if(!z.ab||z.ab.ahead+z.ab.behind===0||z.tip==null)continue;let j=x.get(z.tip);N.push({node:f(z.tip),kind:"ab",label:wj(z.ab),x:j.x+Zo+10,y:j.y,anchor:"start"})}L=Math.max(W+(E-1)*V+Zo+70,...[...x.entries()].map(([z,j])=>j.x+m.get(z).lw*v))+18,A=Y+g*M+12*v+16,e.notes.length&&(w=A+4,A+=8+e.notes.length*16+8)}let _=!!e.title,T=_?bj:0,R=Math.round(L),O=Math.round(A+T),I=!!a,H=It(t).append("svg").attr("width",R).attr("height",O).attr("viewBox",`0 0 ${R} ${O}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(H.append("rect").attr("width",R).attr("height",O).attr("fill",n.bg),_){let D=H.append("text").attr("class","chart-title").attr("x",R/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").attr("data-line-number",e.titleLineNumber??1).text(e.title);if(o&&e.titleLineNumber&&!I){let W=e.titleLineNumber;D.style("cursor","pointer").on("click",()=>o(W))}}let G=H.append("g").attr("transform",`translate(0, ${T})`);Ej(G,e,n,s,x,N,m,u,f,C,k,w,o&&!I?o:void 0)}function wj(t){let e=[];return t.ahead&&e.push("\u2191"+t.ahead),t.behind&&e.push("\u2193"+t.behind),e.join(" ")}function Ej(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=e.nodes,m=E=>o.get(E),g=(E,x)=>r?{x:m(x.key).x,y:m(E.key).y}:{x:m(E.key).x,y:m(x.key).y},h=(E,x)=>r?{x:m(E.key).x,y:m(x.key).y}:{x:m(x.key).x,y:m(E.key).y},S=E=>E.ghost?.32:1,y=(E,x,N,L)=>{let A=m(E.key),C=m(x.key),k=h(E,x);if(t.append("path").attr("d",hE(A.x,A.y,k.x,k.y,C.x,C.y,gE)).attr("fill","none").attr("stroke",N).attr("stroke-width",2).attr("stroke-dasharray","2 4").attr("opacity",.8),L){let w=C.x-k.x,v=C.y-k.y,M=Math.hypot(w,v)||1,_=w/M,T=v/M,R=-T,O=_,I=4;t.append("path").attr("d",`M${C.x},${C.y} L${C.x-_*I*2+R*I},${C.y-T*I*2+O*I} L${C.x-_*I*2-R*I},${C.y-T*I*2-O*I} Z`).attr("fill",N).attr("opacity",.8)}};for(let E of p){let x=s(E),N=S(E),L=m(E.key);if(E.prev!=null){let A=m(E.prev),C=t.append("line").attr("x1",A.x).attr("y1",A.y).attr("x2",L.x).attr("y2",L.y).attr("stroke",x).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",N);E.ghost&&C.attr("stroke-dasharray","5 5")}if(E.parent!=null){let A=l(E.parent),C=g(A,E),k=m(A.key),w=t.append("path").attr("d",hE(k.x,k.y,C.x,C.y,L.x,L.y,gE)).attr("fill","none").attr("stroke",x).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",N);E.ghost&&w.attr("stroke-dasharray","5 5")}if(E.mergeFrom!=null){let A=l(E.mergeFrom),C=h(A,E),k=m(A.key);t.append("path").attr("d",hE(k.x,k.y,C.x,C.y,L.x,L.y,gE)).attr("fill","none").attr("stroke",s(A)).attr("stroke-width",mE).attr("stroke-linecap","round").attr("opacity",.92*N)}E.cherryFrom!=null&&y(l(E.cherryFrom),E,s(l(E.cherryFrom)),!1),E.revertFrom!=null&&y(l(E.revertFrom),E,x,!1),E.squashFrom!=null&&y(l(E.squashFrom),E,n.textMuted,!0),E.movedTo!=null&&y(E,l(E.movedTo),n.textMuted,!0)}if(!e.options.noLanes)for(let E of e.branches){let x=null;for(let A of p)A.branch===E.name&&(x===null||A.seq<x.seq)&&(x=A);if(!x)continue;let N=m(x.key),L=s(x);r?t.append("text").attr("x",N.x).attr("y",14).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",800).attr("fill",L).text(E.name):t.append("text").attr("x",c).attr("y",N.y+4).attr("text-anchor","end").attr("font-size",12.5).attr("font-weight",800).attr("fill",L).text(E.name)}for(let E of p){let x=s(E),N=m(E.key),L=A=>{A.attr("data-line-number",E.lineNumber),A.attr("data-branch",E.branch),f&&A.style("cursor","pointer").on("click",()=>f(E.lineNumber))};if(E.ghost){L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo-1).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",2).attr("opacity",.4));continue}E.type==="highlight"?L(t.append("rect").attr("x",N.x-Zo).attr("y",N.y-Zo).attr("width",Zo*2).attr("height",Zo*2).attr("rx",3.5).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3)):E.type==="reverse"?(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),L(t.append("path").attr("d",`M${N.x-3.6},${N.y-3.6} L${N.x+3.6},${N.y+3.6} M${N.x+3.6},${N.y-3.6} L${N.x-3.6},${N.y+3.6}`).attr("stroke",x).attr("stroke-width",2).attr("stroke-linecap","round").attr("fill","none"))):E.kind==="merge"?(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",n.bg).attr("stroke",x).attr("stroke-width",3),L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",3).attr("fill",x))):L(t.append("circle").attr("cx",N.x).attr("cy",N.y).attr("r",Zo).attr("fill",x).attr("stroke",n.bg).attr("stroke-width",3))}let b=(E,x,N,L,A,C,k,w,v=700)=>{let M=t.append("rect").attr("x",E-N/2).attr("y",x-8.5).attr("width",N).attr("height",17).attr("rx",8.5).attr("fill",A);k&&(M.attr("stroke",k).attr("stroke-width",1.3),w&&M.attr("stroke-dasharray","3 2")),t.append("text").attr("x",E).attr("y",x+4).attr("text-anchor","middle").attr("font-size",10.5).attr("font-weight",v).attr("fill",C).text(L)};for(let E of a){let x=E.node,N=s(x);if(E.leader&&t.append("line").attr("x1",E.leader.x1).attr("y1",E.leader.y1).attr("x2",E.leader.x2).attr("y2",E.leader.y2).attr("stroke",N).attr("stroke-width",1).attr("opacity",.34*S(x)),E.kind==="tag")b(E.x,E.y,E.w,E.label,N,n.bg);else if(E.kind==="head")b(E.x,E.y,E.w,"HEAD",n.text,n.bg,void 0,!1,800);else if(E.kind==="ref")b(E.x,E.y,E.w,E.label,n.bg,N,N,E.remote);else if(E.kind==="note")t.append("circle").attr("cx",E.x).attr("cy",E.y).attr("r",8.5).attr("fill",N),t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor","middle").attr("font-size",11).attr("fill",n.bg).text(E.label);else if(E.kind==="ab")t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor","start").attr("font-size",11).attr("font-weight",700).attr("fill",N).text(E.label);else{let L=i.get(x.key),A=x.ghost,C=A?n.textMuted:N,k=E.diag?t.append("text").attr("transform",`translate(${E.x},${E.y}) rotate(${yE})`).attr("font-size",12).attr("opacity",A?.55:1):t.append("text").attr("x",E.x).attr("y",E.y+4).attr("text-anchor",E.anchor).attr("font-size",12).attr("opacity",A?.55:1);L.sha&&k.append("tspan").attr("font-family","ui-monospace, monospace").attr("font-size",11).attr("fill",n.textMuted).text(L.sha+" "),k.append("tspan").attr("fill",C).attr("font-weight",x.kind==="cherry"?400:700).attr("font-style",x.kind==="cherry"?"italic":"normal").text(L.msg)}}if(u&&e.notes.length){let E=u+14;for(let x of e.notes){let N=t.append("text").attr("x",12).attr("y",E).attr("font-size",11.5);N.append("tspan").attr("fill",n.text).attr("font-weight",800).text((NR[x.num-1]??`#${x.num}`)+" "),N.append("tspan").attr("fill",n.textMuted).text(x.text),E+=16}}}function Sj(t,e,n,r,o){MR(t,e,n,r,void 0,o)}var mE,Zo,gE,yE,vR,NR,bj,TR=st(()=>{"use strict";qn();an();tn();wr();mE=5.5,Zo=8,gE=13,yE=32,vR=19,NR="\u2460\u2461\u2462\u2463\u2464\u2465\u2466\u2467\u2468",bj=40});function Lj(t){var e=0,n=t.children,r=n&&n.length;if(!r)e=1;else for(;--r>=0;)e+=n[r].value;t.value=e}function CR(){return this.eachAfter(Lj)}var _R=st(()=>{"use strict"});function AR(t,e){let n=-1;for(let r of this)t.call(e,r,++n,this);return this}var RR=st(()=>{"use strict"});function IR(t,e){for(var n=this,r=[n],o,a,i=-1;n=r.pop();)if(t.call(e,n,++i,this),o=n.children)for(a=o.length-1;a>=0;--a)r.push(o[a]);return this}var PR=st(()=>{"use strict"});function DR(t,e){for(var n=this,r=[n],o=[],a,i,s,l=-1;n=r.pop();)if(o.push(n),a=n.children)for(i=0,s=a.length;i<s;++i)r.push(a[i]);for(;n=o.pop();)t.call(e,n,++l,this);return this}var GR=st(()=>{"use strict"});function OR(t,e){let n=-1;for(let r of this)if(t.call(e,r,++n,this))return r}var $R=st(()=>{"use strict"});function HR(t){return this.eachAfter(function(e){for(var n=+t(e.data)||0,r=e.children,o=r&&r.length;--o>=0;)n+=r[o].value;e.value=n})}var WR=st(()=>{"use strict"});function FR(t){return this.eachBefore(function(e){e.children&&e.children.sort(t)})}var BR=st(()=>{"use strict"});function YR(t){for(var e=this,n=vj(e,t),r=[e];e!==n;)e=e.parent,r.push(e);for(var o=r.length;t!==n;)r.splice(o,0,t),t=t.parent;return r}function vj(t,e){if(t===e)return t;var n=t.ancestors(),r=e.ancestors(),o=null;for(t=n.pop(),e=r.pop();t===e;)o=t,t=n.pop(),e=r.pop();return o}var VR=st(()=>{"use strict"});function zR(){for(var t=this,e=[t];t=t.parent;)e.push(t);return e}var UR=st(()=>{"use strict"});function XR(){return Array.from(this)}var jR=st(()=>{"use strict"});function qR(){var t=[];return this.eachBefore(function(e){e.children||t.push(e)}),t}var KR=st(()=>{"use strict"});function ZR(){var t=this,e=[];return t.each(function(n){n!==t&&e.push({source:n.parent,target:n})}),e}var QR=st(()=>{"use strict"});function*JR(){var t=this,e,n=[t],r,o,a;do for(e=n.reverse(),n=[];t=e.pop();)if(yield t,r=t.children)for(o=0,a=r.length;o<a;++o)n.push(r[o]);while(n.length)}var tI=st(()=>{"use strict"});function Ci(t,e){t instanceof Map?(t=[void 0,t],e===void 0&&(e=kj)):e===void 0&&(e=Mj);for(var n=new Hl(t),r,o=[n],a,i,s,l;r=o.pop();)if((i=e(r.data))&&(l=(i=Array.from(i)).length))for(r.children=i,s=l-1;s>=0;--s)o.push(a=i[s]=new Hl(i[s])),a.parent=r,a.depth=r.depth+1;return n.eachBefore(Cj)}function Nj(){return Ci(this).eachBefore(Tj)}function Mj(t){return t.children}function kj(t){return Array.isArray(t)?t[1]:null}function Tj(t){t.data.value!==void 0&&(t.value=t.data.value),t.data=t.data.data}function Cj(t){var e=0;do t.height=e;while((t=t.parent)&&t.height<++e)}function Hl(t){this.data=t,this.depth=this.height=0,this.parent=null}var bE=st(()=>{"use strict";_R();RR();PR();GR();$R();WR();BR();VR();UR();jR();KR();QR();tI();Hl.prototype=Ci.prototype={constructor:Hl,count:CR,each:AR,eachAfter:DR,eachBefore:IR,find:OR,sum:HR,sort:FR,path:YR,ancestors:zR,descendants:XR,leaves:qR,links:ZR,copy:Nj,[Symbol.iterator]:JR}});function eI(t){if(typeof t!="function")throw new Error;return t}var nI=st(()=>{"use strict"});function nd(){return 0}function rd(t){return function(){return t}}var rI=st(()=>{"use strict"});function Yg(t){t.x0=Math.round(t.x0),t.y0=Math.round(t.y0),t.x1=Math.round(t.x1),t.y1=Math.round(t.y1)}var xE=st(()=>{"use strict"});function Vg(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(r-e)/t.value;++s<l;)i=a[s],i.y0=n,i.y1=o,i.x0=e,i.x1=e+=i.value*c}var wE=st(()=>{"use strict"});function EE(){var t=1,e=1,n=0,r=!1;function o(i){var s=i.height+1;return i.x0=i.y0=n,i.x1=t,i.y1=e/s,i.eachBefore(a(e,s)),r&&i.eachBefore(Yg),i}function a(i,s){return function(l){l.children&&Vg(l,l.x0,i*(l.depth+1)/s,l.x1,i*(l.depth+2)/s);var c=l.x0,d=l.y0,u=l.x1-n,f=l.y1-n;u<c&&(c=u=(c+u)/2),f<d&&(d=f=(d+f)/2),l.x0=c,l.y0=d,l.x1=u,l.y1=f}}return o.round=function(i){return arguments.length?(r=!!i,o):r},o.size=function(i){return arguments.length?(t=+i[0],e=+i[1],o):[t,e]},o.padding=function(i){return arguments.length?(n=+i,o):n},o}var oI=st(()=>{"use strict";xE();wE()});function _j(t,e){return t.parent===e.parent?1:2}function SE(t){var e=t.children;return e?e[0]:t.t}function LE(t){var e=t.children;return e?e[e.length-1]:t.t}function Aj(t,e,n){var r=n/(e.i-t.i);e.c-=r,e.s+=n,t.c+=r,e.z+=n,e.m+=n}function Rj(t){for(var e=0,n=0,r=t.children,o=r.length,a;--o>=0;)a=r[o],a.z+=e,a.m+=e,e+=a.s+(n+=a.c)}function Ij(t,e,n){return t.a.parent===e.parent?t.a:n}function zg(t,e){this._=t,this.parent=null,this.children=null,this.A=null,this.a=this,this.z=0,this.m=0,this.c=0,this.s=0,this.t=null,this.i=e}function Pj(t){for(var e=new zg(t,0),n,r=[e],o,a,i,s;n=r.pop();)if(a=n._.children)for(n.children=new Array(s=a.length),i=s-1;i>=0;--i)r.push(o=n.children[i]=new zg(a[i],i)),o.parent=n;return(e.parent=new zg(null,0)).children=[e],e}function vE(){var t=_j,e=1,n=1,r=null;function o(c){var d=Pj(c);if(d.eachAfter(a),d.parent.m=-d.z,d.eachBefore(i),r)c.eachBefore(l);else{var u=c,f=c,p=c;c.eachBefore(function(y){y.x<u.x&&(u=y),y.x>f.x&&(f=y),y.depth>p.depth&&(p=y)});var m=u===f?1:t(u,f)/2,g=m-u.x,h=e/(f.x+m+g),S=n/(p.depth||1);c.eachBefore(function(y){y.x=(y.x+g)*h,y.y=y.depth*S})}return c}function a(c){var d=c.children,u=c.parent.children,f=c.i?u[c.i-1]:null;if(d){Rj(c);var p=(d[0].z+d[d.length-1].z)/2;f?(c.z=f.z+t(c._,f._),c.m=c.z-p):c.z=p}else f&&(c.z=f.z+t(c._,f._));c.parent.A=s(c,f,c.parent.A||u[0])}function i(c){c._.x=c.z+c.parent.m,c.m+=c.parent.m}function s(c,d,u){if(d){for(var f=c,p=c,m=d,g=f.parent.children[0],h=f.m,S=p.m,y=m.m,b=g.m,E;m=LE(m),f=SE(f),m&&f;)g=SE(g),p=LE(p),p.a=c,E=m.z+y-f.z-h+t(m._,f._),E>0&&(Aj(Ij(m,c,u),c,E),h+=E,S+=E),y+=m.m,h+=f.m,b+=g.m,S+=p.m;m&&!LE(p)&&(p.t=m,p.m+=y-S),f&&!SE(g)&&(g.t=f,g.m+=h-b,u=c)}return u}function l(c){c.x*=e,c.y=c.depth*n}return o.separation=function(c){return arguments.length?(t=c,o):t},o.size=function(c){return arguments.length?(r=!1,e=+c[0],n=+c[1],o):r?null:[e,n]},o.nodeSize=function(c){return arguments.length?(r=!0,e=+c[0],n=+c[1],o):r?[e,n]:null},o}var aI=st(()=>{"use strict";bE();zg.prototype=Object.create(Hl.prototype)});function iI(t,e,n,r,o){for(var a=t.children,i,s=-1,l=a.length,c=t.value&&(o-n)/t.value;++s<l;)i=a[s],i.x0=e,i.x1=r,i.y0=n,i.y1=n+=i.value*c}var sI=st(()=>{"use strict"});function Gj(t,e,n,r,o,a){for(var i=[],s=e.children,l,c,d=0,u=0,f=s.length,p,m,g=e.value,h,S,y,b,E,x,N;d<f;){p=o-n,m=a-r;do h=s[u++].value;while(!h&&u<f);for(S=y=h,x=Math.max(m/p,p/m)/(g*t),N=h*h*x,E=Math.max(y/N,N/S);u<f;++u){if(h+=c=s[u].value,c<S&&(S=c),c>y&&(y=c),N=h*h*x,b=Math.max(y/N,N/S),b>E){h-=c;break}E=b}i.push(l={value:h,dice:p<m,children:s.slice(d,u)}),l.dice?Vg(l,n,r,o,g?r+=m*h/g:a):iI(l,n,r,g?n+=p*h/g:o,a),g-=h,d=u}return i}var Dj,gf,NE=st(()=>{"use strict";wE();sI();Dj=(1+Math.sqrt(5))/2;gf=(function t(e){function n(r,o,a,i,s){Gj(e,r,o,a,i,s)}return n.ratio=function(r){return t((r=+r)>1?r:1)},n})(Dj)});function ME(){var t=gf,e=!1,n=1,r=1,o=[0],a=nd,i=nd,s=nd,l=nd,c=nd;function d(f){return f.x0=f.y0=0,f.x1=n,f.y1=r,f.eachBefore(u),o=[0],e&&f.eachBefore(Yg),f}function u(f){var p=o[f.depth],m=f.x0+p,g=f.y0+p,h=f.x1-p,S=f.y1-p;h<m&&(m=h=(m+h)/2),S<g&&(g=S=(g+S)/2),f.x0=m,f.y0=g,f.x1=h,f.y1=S,f.children&&(p=o[f.depth+1]=a(f)/2,m+=c(f)-p,g+=i(f)-p,h-=s(f)-p,S-=l(f)-p,h<m&&(m=h=(m+h)/2),S<g&&(g=S=(g+S)/2),t(f,m,g,h,S))}return d.round=function(f){return arguments.length?(e=!!f,d):e},d.size=function(f){return arguments.length?(n=+f[0],r=+f[1],d):[n,r]},d.tile=function(f){return arguments.length?(t=eI(f),d):t},d.padding=function(f){return arguments.length?d.paddingInner(f).paddingOuter(f):d.paddingInner()},d.paddingInner=function(f){return arguments.length?(a=typeof f=="function"?f:rd(+f),d):a},d.paddingOuter=function(f){return arguments.length?d.paddingTop(f).paddingRight(f).paddingBottom(f).paddingLeft(f):d.paddingTop()},d.paddingTop=function(f){return arguments.length?(i=typeof f=="function"?f:rd(+f),d):i},d.paddingRight=function(f){return arguments.length?(s=typeof f=="function"?f:rd(+f),d):s},d.paddingBottom=function(f){return arguments.length?(l=typeof f=="function"?f:rd(+f),d):l},d.paddingLeft=function(f){return arguments.length?(c=typeof f=="function"?f:rd(+f),d):c},d}var lI=st(()=>{"use strict";xE();NE();nI();rI()});var Ug=st(()=>{"use strict";bE();oI();aI();lI();NE()});var bI={};ye(bI,{layoutOrg:()=>_E});function qg(t,e){let n=0;for(let r of t.children){n+=(r.isContainer?0:1)+qg(r,e);let o=e?.get(r.id);o&&(n+=o)}return n}function hf(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function Yj(t,e){let n=_t(t,Oj);for(let[r,o]of Object.entries(e)){let a=_t(`${r}: ${o}`,$j);a>n&&(n=a)}return Math.max(Bj,Math.ceil(n)+Fj*2)}function Vj(t){let e=Object.keys(t).length;return e===0?cI+dI:cI+Wj+e*Hj+dI}function jg(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n,t.isContainer)}function gI(t,e,n,r,o){return t.map(a=>{let i=hf(a.metadata,n),s=e?.get(a.id);if(!a.isContainer&&o&&!(s!=null&&s>0)){let l=qg(a,e);l>0&&(i[r??"Sub-node Count"]=String(l))}return{orgNode:a,children:gI(a.children,e,n,r,o),width:Yj(a.label,i),height:Vj(i)}})}function hI(t){let e=0;for(let n of t.children)e+=1+hI(n);return e}function yI(t){for(let i of t.children)yI(i);if(t.children.length<=2)return;let e=t.children.map(i=>({child:i,weight:hI(i)})).sort((i,s)=>s.weight-i.weight),n=new Array(e.length),r=Math.floor((e.length-1)/2),o=r,a=r;for(let i=0;i<e.length;i++){let s=e[i];i===0?n[r]=s.child:i%2===1?(a++,n[a]=s.child):(o--,n[o]=s.child)}t.children=n}function mI(t,e,n){let r=[];for(let o of t){if(o.entries.length===0)continue;let a=n?.get(qt(o.name)),i=a?o.entries.filter(f=>a.has(f.value.toLowerCase())):o.entries;if(i.length===0)continue;let s=Fe(o.name,cr)+po,l=s,c=0;for(let f of i)c+=Er*2+kr+Fe(f.value,Xn)+Kr;let d=e?Co+wi:0,u=In*2+s+4+d+c;r.push({name:o.name,...o.alias!==void 0&&{alias:o.alias},entries:i.map(f=>({value:f.value,color:f.color})),x:0,y:0,width:u,height:Se,minifiedWidth:l,minifiedHeight:Se})}return r}function zj(t,e){let n=[],r=o=>{n.push(o);for(let a of o.children)r(a)};for(let o of t)r(o);wa(n,e,o=>o.isContainer)}function _E(t,e,n,r,o){if(t.roots.length===0){let $=r!==void 0,U=mI(t.tagGroups,$);if(U.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let X=ti,q=0;for(let et of U)et.x=ti,et.y=X,X+=Se+Bn,et.width>q&&(q=et.width);return{nodes:[],edges:[],containers:[],legend:U,width:q+ti*2,height:X-Bn+ti}}zj(t.roots,t.tagGroups);let a=t.options["sub-node-label"]??void 0,i=["yes","on"].includes(t.options["show-sub-node-count"]?.toLowerCase()??""),s=gI(t.roots,e,r,a,i),l;s.length===1?l=s[0]:l={orgNode:{id:"__virtual_root__",label:"",metadata:{},children:t.roots,parentId:null,isContainer:!1,lineNumber:0},children:s,width:0,height:0};let c=0,d=0,u=[],f=$=>{$.orgNode.id!=="__virtual_root__"&&(u.push($),$.width>c&&(c=$.width),$.height>d&&(d=$.height));for(let U of $.children)f(U)};f(l);for(let $ of u)$.width=c;let p=new Map,m=$=>{for(let U of $.children)m(U);if($.orgNode.isContainer&&$.children.length>0&&$.children.every(U=>U.children.length===0)){let U=`__stack_${$.orgNode.id}`;p.set($.orgNode.id,{children:[...$.children],placeholderId:U});let X=Math.max(...$.children.map(et=>et.width));for(let et of $.children)et.width=X;let q=$.children.reduce((et,tt)=>et+tt.height,0)+($.children.length-1)*pI;$.children=[{orgNode:{id:U,label:"",metadata:{},children:[],parentId:$.orgNode.id,isContainer:!1,lineNumber:0},children:[],width:X,height:q}]}};m(l),yI(l);let g=Ci(l,$=>$.children);vE().nodeSize([c+uI,d+kE])(g);{let $=g.descendants().filter(tt=>tt.data.orgNode.id!=="__virtual_root__"),U=new Map;for(let tt of $){if(tt.data.orgNode.id.startsWith("__stack_"))continue;let B=U.get(tt.depth)??0;tt.data.height>B&&U.set(tt.depth,tt.data.height)}let X=Math.max(...U.keys(),0),q=new Map,et=s.length===1?0:1;q.set(et,0);for(let tt=et+1;tt<=X;tt++){let B=U.get(tt-1)??d,Q=q.get(tt-1)??0;q.set(tt,Q+B+kE)}for(let tt of g.descendants())tt.data.orgNode.id!=="__virtual_root__"&&(tt.y=q.get(tt.depth)??tt.y)}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.isContainer||!$.children||$.children.length===0)continue;let X=$.children[0].y-$.y,q=Object.keys($.data.orgNode.metadata).length,tt=TE+q*CE+15,B=X-tt;if(B<=0)continue;let Q=ot=>{if(ot.children)for(let Z of ot.children)Z.y-=B,Q(Z)};Q($)}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.isContainer||!$.children||$.children.length===0||!$.children.every(Q=>Q.data.orgNode.isContainer))continue;let U=$.y+$.data.height,q=Math.min(...$.children.map(Q=>Q.y))-U,et=kE*.6,tt=q-et;if(tt<=0)continue;let B=Q=>{if(Q.y-=tt,Q.children)for(let ot of Q.children)B(ot)};for(let Q of $.children)B(Q)}{let $=q=>{let et=q.x-q.data.width/2,tt=q.x+q.data.width/2;if(q.children)for(let B of q.children){let Q=$(B);Q.minX<et&&(et=Q.minX),Q.maxX>tt&&(tt=Q.maxX)}return q.data.orgNode.isContainer&&(et-=Xg,tt+=Xg),{minX:et,maxX:tt}},U=(q,et)=>{q.x+=et,q.children&&q.children.forEach(tt=>U(tt,et))},X=g.descendants().filter(q=>q.children&&q.children.length>=2).sort((q,et)=>et.depth-q.depth);for(let q of X){let et=q.children,tt=et.map(lt=>{let nt=$(lt);return{relLeft:nt.minX-lt.x,relRight:nt.maxX-lt.x}}),B=(et[0].x+et[et.length-1].x)/2,Q=[0];for(let lt=1;lt<et.length;lt++){let nt=Q[lt-1]+tt[lt-1].relRight;Q[lt]=nt+uI-tt[lt].relLeft}let ot=(Q[0]+Q[Q.length-1])/2,Z=B-ot;for(let lt=0;lt<et.length;lt++){let J=Q[lt]+Z-et[lt].x;Math.abs(J)>.001&&U(et[lt],J)}}}{let $=g.descendants().filter(U=>U.children&&U.children.length>=1&&U.data.orgNode.id!=="__virtual_root__").sort((U,X)=>X.depth-U.depth);for(let U of $){let X=U.children.map(et=>et.x),q=(Math.min(...X)+Math.max(...X))/2;U.x=q}}let S=[],y=[],b=1/0,E=-1/0,x=1/0,N=-1/0,L=[];for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||!$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode.id.replace("__stack_",""),X=p.get(U);if(!X)continue;let q=$.y;for(let et of X.children)L.push({orgNode:et.orgNode,width:et.width,height:et.height,cx:$.x,cy:q}),q+=et.height+pI}for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.width,X=$.data.height,q=$.x,et=$.y;q-U/2<b&&(b=q-U/2),q+U/2>E&&(E=q+U/2),et<x&&(x=et),et+X>N&&(N=et+X)}for(let $ of L)$.cx-$.width/2<b&&(b=$.cx-$.width/2),$.cx+$.width/2>E&&(E=$.cx+$.width/2),$.cy<x&&(x=$.cy),$.cy+$.height>N&&(N=$.cy+$.height);let A=-b+ti,C=-x+ti,k=a??"Sub-node Count";for(let $ of L){let U=e?.get($.orgNode.id),X=hf($.orgNode.metadata,r);if(!$.orgNode.isContainer&&i&&!(U!=null&&U>0)){let tt=qg($.orgNode,e);tt>0&&(X[k]=String(tt))}let q=jg($.orgNode,t.tagGroups,n??null),et=$.orgNode.children.length>0||U!=null&&U>0||void 0;S.push({id:$.orgNode.id,label:$.orgNode.label,metadata:X,tagMetadata:{...$.orgNode.metadata},isContainer:$.orgNode.isContainer,lineNumber:$.orgNode.lineNumber,...q!==void 0&&{color:q},x:$.cx+A,y:$.cy+C,width:$.width,height:$.height,...U!==void 0&&{hiddenCount:U},...et!==void 0&&{hasChildren:et}})}let w=new Map;for(let $ of g.descendants()){if($.data.orgNode.id==="__virtual_root__"||$.data.orgNode.id.startsWith("__stack_"))continue;let U=$.data.orgNode,X=$.data.width,q=$.data.height,et=$.x+A,tt=$.y+C,B=e?.get(U.id),Q=hf(U.metadata,r);if(!U.isContainer&&i&&!(B!=null&&B>0)){let nt=qg(U,e);nt>0&&(Q[k]=String(nt))}let ot=jg(U,t.tagGroups,n??null),Z=$.children!=null&&$.children.length>0||B!=null&&B>0||void 0;S.push({id:U.id,label:U.label,metadata:Q,tagMetadata:{...U.metadata},isContainer:U.isContainer,lineNumber:U.lineNumber,...ot!==void 0&&{color:ot},x:et,y:tt,width:X,height:q,...B!==void 0&&{hiddenCount:B},...Z!==void 0&&{hasChildren:Z}});let lt=$.parent?.data.orgNode.isContainer&&$.parent.children&&$.parent.children.length>0;if($.parent&&$.parent.data.orgNode.id!=="__virtual_root__"&&!lt){let nt=$.parent.data.orgNode.id;if(!w.has(nt)){let J=$.parent.x+A,at=$.parent.y+C,it=$.parent.data.height;w.set(nt,{parentX:J,parentBottomY:at+it,children:[]})}w.get(nt).children.push({id:U.id,x:et,topY:tt})}}for(let[$,U]of w){let{parentX:X,parentBottomY:q,children:et}=U;if(et.length===1){let tt=et[0],B=(q+tt.topY)/2;y.push({sourceId:$,targetId:tt.id,points:[{x:X,y:q},{x:X,y:B},{x:tt.x,y:B},{x:tt.x,y:tt.topY}]})}else{let tt=(q+et[0].topY)/2,B=et.map(Z=>Z.x),Q=Math.min(...B),ot=Math.max(...B);y.push({sourceId:$,targetId:$,points:[{x:X,y:q},{x:X,y:tt}]}),y.push({sourceId:$,targetId:$,points:[{x:Q,y:tt},{x:ot,y:tt}]});for(let Z of et)y.push({sourceId:$,targetId:Z.id,points:[{x:Z.x,y:tt},{x:Z.x,y:Z.topY}]})}}let v=g.descendants().filter($=>$.data.orgNode.id!=="__virtual_root__"&&$.data.orgNode.isContainer),M=new Map,_=[],T=60;for(let $ of v){if($.children&&$.children.length>0)continue;let U=$.x+A,X=$.y+C,q=Object.keys($.data.orgNode.metadata).length,et=TE+q*CE,tt=$.data.width,B=Math.max(et+fI,T),Q=U-tt/2,ot=X;M.set($.data.orgNode.id,{minX:Q,maxX:Q+tt,minY:ot,maxY:ot+B});let Z=e?.get($.data.orgNode.id),lt=hf($.data.orgNode.metadata,r),nt=jg($.data.orgNode,t.tagGroups,n??null),J=Z!=null&&Z>0||void 0;_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...nt!==void 0&&{color:nt},metadata:lt,tagMetadata:{...$.data.orgNode.metadata},x:Q,y:ot,width:tt,height:B,labelHeight:et,...Z!==void 0&&{hiddenCount:Z},...J!==void 0&&{hasChildren:J}})}let R=v.filter($=>$.children&&$.children.length>0);R.sort(($,U)=>U.depth-$.depth);for(let $ of R){let U=[],X=pt=>{if(pt.children)for(let gt of pt.children)U.push(gt),X(gt)};if(X($),U.length===0)continue;let q=1/0,et=-1/0,tt=-1/0;for(let pt of U){let gt=M.get(pt.data.orgNode.id);if(gt)gt.minX<q&&(q=gt.minX),gt.maxX>et&&(et=gt.maxX),gt.maxY>tt&&(tt=gt.maxY);else if(pt.data.orgNode.id.startsWith("__stack_")){let dt=pt.data.orgNode.id.replace("__stack_","");if(p.get(dt))for(let yt of L){if(yt.orgNode.parentId!==dt)continue;let vt=yt.cx+A,Gt=yt.cy+C;vt-yt.width/2<q&&(q=vt-yt.width/2),vt+yt.width/2>et&&(et=vt+yt.width/2),Gt+yt.height>tt&&(tt=Gt+yt.height)}}else{let dt=pt.data.width,ut=pt.data.height,yt=pt.x+A,vt=pt.y+C;yt-dt/2<q&&(q=yt-dt/2),yt+dt/2>et&&(et=yt+dt/2),vt+ut>tt&&(tt=vt+ut)}}let B=$.x+A,Q=$.y+C,ot=Object.keys($.data.orgNode.metadata).length,Z=TE+ot*CE,lt=Q,nt=tt-Q+fI,J=q-Xg,at=et-q+Xg*2,it=Math.max(at,$.data.width),Lt=it>at?B-it/2:J;M.set($.data.orgNode.id,{minX:Lt,maxX:Lt+it,minY:lt,maxY:lt+nt});let Tt=e?.get($.data.orgNode.id),At=hf($.data.orgNode.metadata,r),rt=jg($.data.orgNode,t.tagGroups,n??null);_.push({nodeId:$.data.orgNode.id,label:$.data.orgNode.label,lineNumber:$.data.orgNode.lineNumber,...rt!==void 0&&{color:rt},metadata:At,tagMetadata:{...$.data.orgNode.metadata},x:Lt,y:lt,width:it,height:nt,labelHeight:Z,...Tt!==void 0&&{hiddenCount:Tt},hasChildren:!0})}_.reverse();let O=b,I=E,H=N;for(let $ of _){let U=$.x-A,X=U+$.width,q=$.y-C+$.height;U<O&&(O=U),X>I&&(I=X),q>H&&(H=q)}let G=I-O+ti*2,D=H-x+ti*2,W=new Map;for(let $ of t.tagGroups){let U=qt($.name),X=new Set,q=et=>{!et.isContainer&&et.metadata[U]&&X.add(et.metadata[U].toLowerCase());for(let tt of et.children)q(tt)};for(let et of t.roots)q(et);W.set(U,X)}let V=r!==void 0,P=mI(t.tagGroups,V,W),F=G,Y=D,z=n!=null?P.filter($=>$.name.toLowerCase()===n.toLowerCase()):P,j=o&&n==null,K=$=>n!=null||j?$.width:$.minifiedWidth;if(z.length>0){let $=Se+Bn;for(let et of S)et.y+=$;for(let et of _)et.y+=$;for(let et of y)for(let tt of et.points)tt.y+=$;let U=z.reduce((et,tt)=>et+K(tt),0)+(z.length-1)*Bn,X=ti;for(let et of z)et.x=X,et.y=ti,X+=K(et)+Bn;Y+=$;let q=U+ti*2;q>F&&(F=q)}return{nodes:S,edges:y,containers:_,legend:P,width:F,height:Y}}var Oj,$j,Hj,cI,Wj,Fj,dI,Bj,uI,kE,ti,Xg,fI,TE,CE,pI,AE=st(()=>{"use strict";je();Ug();je();Tr();en();Oj=13,$j=11,Hj=16,cI=28,Wj=6,Fj=20,dI=10,Bj=140,uI=30,kE=50,ti=40,Xg=24,fI=24,TE=28,CE=16,pI=20});function xI(t,e){let n=0;for(let r of e.getChildren(t))n+=(e.countsAsHidden(r)?1:0)+xI(r,e);return n}function wI(t,e,n,r){for(let o of t){let a=r.getChildren(o);e.has(r.getId(o))&&a.length>0&&n.set(r.getId(o),xI(o,r)),wI(a,e,n,r)}}function EI(t,e,n){for(let r of n.getChildren(t))EI(r,e,n);e.has(n.getId(t))&&n.getChildren(t).length>0&&n.setChildren(t,[])}function od(t,e,n){let r=new Map;wI(t,e,r,n);let o=t.map(a=>n.clone(a));for(let a of o)EI(a,e,n);return{roots:o,hiddenCounts:r}}function SI(t,e){let n=new Set,r=o=>{for(let a of o)n.add(e.getId(a)),r(e.getChildren(a))};return r(t),n}var yf=st(()=>{"use strict"});var vI={};ye(vI,{collapseOrgTree:()=>Xj,focusOrgTree:()=>jj});function Kg(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(Kg),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function Xj(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=od(t.roots,e,Uj);return{parsed:{...t,roots:n},hiddenCounts:r}}function LI(t,e,n){for(let r of t){if(r.id===e)return{node:r,path:n};let o=LI(r.children,e,[...n,{id:r.id,label:r.label,lineNumber:r.lineNumber,...r.color!==void 0&&{color:r.color},metadata:{...r.metadata},isContainer:r.isContainer}]);if(o)return o}return null}function jj(t,e){let n=LI(t.roots,e,[]);if(!n)return null;if(t.roots.some(a=>a.id===e))return{parsed:{...t,roots:[Kg(n.node)]},ancestorPath:[]};let o=Kg(n.node);return o.parentId=null,{parsed:{...t,roots:[o]},ancestorPath:n.path}}var Uj,NI=st(()=>{"use strict";yf();Uj={getId:t=>t.id,getChildren:t=>t.children,clone:Kg,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer}});function ad(t,e,n){let r=document.createElement("div");r.style.width=`${t}px`,r.style.height=`${e}px`,r.style.position="absolute",r.style.left="-9999px",document.body.appendChild(r);try{return n(r)}finally{document.body.removeChild(r)}}function id(t,e){let n=t.querySelector("svg");return n?(e==="transparent"&&(n.style.background="none"),n.setAttribute("xmlns","http://www.w3.org/2000/svg"),n.style.fontFamily=Pt,n.querySelectorAll("[data-export-ignore]").forEach(r=>r.remove()),n.outerHTML):""}var Zg=st(()=>{"use strict";an()});var AI={};ye(AI,{renderOrg:()=>_I,renderOrgForExport:()=>i9});function o9(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function MI(t,e){return e??t.primary}function a9(t,e,n){return n?Ot(n,or(t,e),10):Ot(t.surface,t.bg,40)}function kI(t,e){return e??t.textMuted}function _I(t,e,n,r,o,a,i,s,l,c,d){It(t).selectAll(":not([data-d3-tooltip])").remove();let u=i?.width??t.clientWidth,f=i?.height??t.clientHeight;if(u<=0||f<=0)return;let p=Ee.identity(),m=p.aesthetic(RE),g=p.structural(CI),h=p.text(13),S=p.text(11),y=p.structural(16),b=p.structural(28),E=p.structural(6),x=p.structural(1.5),N=p.structural(1.5),L=p.structural(6),A=p.structural(8),C=p.text(13),k=p.text(11),w=p.structural(16),v=p.structural(28),M=p.structural(6),_=p.structural(0),T=p.structural(Jj),R=p.text(t9),O=p.structural(e9),I=p.structural(n9),H=p.aesthetic(r9),G=!!e.title&&e.options["no-title"]!=="on",D=G?g:0,W=n.nodes.length===0,V=n.legend.length>0,P=Se+Bn,F=!i&&V&&!W,Y=F?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Co+wi},u)+H:0,z=!i&&G,j=z?g:0,K=!i&&c&&c.length>0,$=K?c.length*O+I:0,U=n.width,X=n.height+(z?0:D)+$;F&&(X-=P);let q=f-m*2-Y-j,et=(u-m*2)/U,tt=q/X,B=Math.min(Qj,et,tt),Q=U*B,ot=(u-Q)/2,Z=F?m+Y+j:m+j,lt=It(t).append("svg").attr("width",u).attr("height",f).attr("viewBox",`0 0 ${u} ${f}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);p.isBelowFloor&&lt.attr("width","100%");let nt=lt.append("g").attr("transform",`translate(${ot}, ${Z}) scale(${B})`);if(G){let rt=z?lt:nt,pt=z?u/2:U/2,gt=z?m+20:20,dt=rt.append("text").attr("x",pt).attr("y",gt).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",20).attr("font-weight","700").attr("class","org-title chart-title").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(dt.attr("data-line-number",e.titleLineNumber),a&&dt.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let J=(z?0:D)+$,at=nt.append("g").attr("transform",`translate(0, ${J})`),it=new Map;for(let rt of e.tagGroups)it.set(qt(rt.name),rt.name);let Lt=new Set(e.roots.map(rt=>rt.id)),Tt=e.options?.color==="off";for(let rt of n.containers){let pt=at.append("g").attr("transform",`translate(${rt.x}, ${rt.y})`).attr("class","org-container").attr("data-line-number",String(rt.lineNumber));if(s){let yt=qt(s),vt=rt.tagMetadata[yt];vt&&pt.attr(`data-tag-${yt}`,vt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let gt=a9(r,o,Tt?void 0:rt.color),dt=kI(r,Tt?void 0:rt.color);pt.append("rect").attr("x",0).attr("y",0).attr("width",rt.width).attr("height",rt.height).attr("rx",A).attr("fill",gt).attr("stroke",dt).attr("stroke-opacity",.35).attr("stroke-width",N),pt.append("text").attr("x",rt.width/2).attr("y",v/2+C/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",C).attr("font-weight","bold").text(rt.label);let ut=Object.entries(rt.metadata);if(ut.length>0){let yt=ut.map(([bt])=>it.get(bt)??bt),Gt=10+Math.max(...yt.map(bt=>_t(`${bt}: `,k))),Xt=v+k-2;for(let bt=0;bt<ut.length;bt++){let[,Mt]=ut[bt],zt=yt[bt],xt=Xt+bt*w;pt.append("text").attr("x",10).attr("y",xt).attr("fill",r.textMuted).attr("font-size",k).text(`${zt}: `),pt.append("text").attr("x",Gt).attr("y",xt).attr("fill",r.text).attr("font-size",k).text(Mt)}}if(!i&&rt.hiddenCount&&rt.hiddenCount>0&&oE(pt,{width:rt.width,height:rt.height,barHeight:M,inset:_,rx:A,fill:kI(r,Tt?void 0:rt.color),clipId:`clip-${rt.nodeId}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!Lt.has(rt.nodeId)){let Gt=rt.width-14-5,bt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.nodeId).attr("data-export-ignore","true").attr("transform",`translate(${Gt}, 5)`);bt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let Mt=Le(gt,r.textOnFillLight,r.textOnFillDark),zt=14/2,xt=14/2;bt.append("circle").attr("cx",zt).attr("cy",xt).attr("r",14/2-1).attr("fill","none").attr("stroke",Mt).attr("stroke-width",1.5),bt.append("circle").attr("cx",zt).attr("cy",xt).attr("r",2).attr("fill",Mt)}}for(let rt of n.edges){if(rt.points.length<2)continue;let pt=[];pt.push(`M ${rt.points[0].x} ${rt.points[0].y}`);for(let gt=1;gt<rt.points.length;gt++)pt.push(`L ${rt.points[gt].x} ${rt.points[gt].y}`);at.append("path").attr("d",pt.join(" ")).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",x).attr("class","org-edge").attr("data-from",rt.sourceId).attr("data-to",rt.targetId)}let At=new Set(n.containers.map(rt=>rt.nodeId));for(let rt of n.nodes){if(At.has(rt.id))continue;let pt=at.append("g").attr("transform",`translate(${rt.x-rt.width/2}, ${rt.y})`).attr("class","org-node").attr("data-line-number",String(rt.lineNumber)).attr("data-node-id",rt.id);if(s){let Gt=qt(s),Xt=rt.tagMetadata[Gt];Xt&&pt.attr(`data-tag-${Gt}`,Xt.toLowerCase())}rt.hasChildren&&pt.attr("data-node-toggle",rt.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!rt.hiddenCount)).attr("aria-label",rt.label),a&&pt.style("cursor","pointer").on("click",()=>{a(rt.lineNumber)});let gt=e.options["solid-fill"]==="on",dt=o9(r,o,Tt?void 0:rt.color,gt),ut=MI(r,Tt?void 0:rt.color),yt=Le(dt,r.textOnFillLight,r.textOnFillDark),vt=Object.entries(rt.metadata);if(td(pt,{width:rt.width,height:rt.height,rx:L,fill:dt,stroke:ut,strokeWidth:N,...rt.isContainer&&{dashed:!0},label:rt.label,labelColor:yt,labelFontSize:h,headerHeight:b,...vt.length>0&&{meta:{rows:vt.map(([Gt,Xt])=>[it.get(Gt)??Gt,Xt]),fontSize:S,lineHeight:y,separatorGap:E,separatorColor:gt?yt:ut,textColor:yt}}}),!i&&rt.hiddenCount&&rt.hiddenCount>0&&oE(pt,{width:rt.width,height:rt.height,barHeight:M,inset:_,rx:L,fill:gt?yt:MI(r,Tt?void 0:rt.color),clipId:`clip-${rt.id}`,className:"org-collapse-bar"}),!i&&rt.hasChildren&&!Lt.has(rt.id)){let bt=rt.width-14-5,zt=pt.append("g").attr("class","org-focus-icon").attr("data-focus-node",rt.id).attr("data-export-ignore","true").attr("transform",`translate(${bt}, 5)`);zt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let xt=yt,Nt=14/2,Dt=14/2;zt.append("circle").attr("cx",Nt).attr("cy",Dt).attr("r",14/2-1).attr("fill","none").attr("stroke",xt).attr("stroke-width",1.5),zt.append("circle").attr("cx",Nt).attr("cy",Dt).attr("r",2).attr("fill",xt)}}if(K){let rt=n.nodes.find(ut=>Lt.has(ut.id)),pt=rt?null:n.containers.find(ut=>Lt.has(ut.nodeId)),gt=rt?rt.x:pt?pt.x+pt.width/2:null,dt=rt?rt.y:pt?pt.y:null;if(gt!==null&&dt!==null){let ut=dt-I,yt=at.append("g").attr("class","org-ancestor-trail"),vt=c.length,Gt=[];for(let bt=0;bt<vt;bt++){let Mt=vt-1-bt;Gt.push(ut-Mt*O)}let Xt=Gt[0];yt.append("line").attr("x1",gt).attr("y1",Xt).attr("x2",gt).attr("y2",dt).attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.4);for(let bt=0;bt<vt;bt++){let Mt=c[bt],zt=Gt[bt],Nt=Mt.color??sr(Mt.metadata,[...e.tagGroups],s??null,Mt.isContainer)??r.textMuted,Dt=yt.append("g").attr("class","org-ancestor-node").attr("data-focus-ancestor",Mt.id).style("cursor","pointer").attr("transform",`translate(${gt}, ${zt})`);Dt.append("rect").attr("x",-T-2).attr("y",-T-2).attr("width",120).attr("height",T*2+4).attr("fill","transparent"),Dt.append("circle").attr("cx",0).attr("cy",0).attr("r",T).attr("fill",Nt),Dt.append("text").attr("x",T+6).attr("y",R*.35).attr("fill",r.textMuted).attr("font-size",R).text(Mt.label),Dt.on("mouseenter",function(){It(this).select("circle").attr("r",T+1),It(this).select("text").attr("fill",r.text)}).on("mouseleave",function(){It(this).select("circle").attr("r",T),It(this).select("text").attr("fill",r.textMuted)})}}}if(F||W||i&&V){let rt=n.legend.map(ut=>({name:ut.name,entries:ut.entries.map(yt=>({value:yt.value,color:yt.color}))})),pt=F?Co+wi:0,gt=F?lt.append("g").attr("class","org-legend-fixed").attr("transform",`translate(0, ${m+j})`):at.append("g"),dt;if(W){for(let ut of n.legend){let yt={groups:[{name:ut.name,entries:ut.entries.map(Gt=>({value:Gt.value,color:Gt.color}))}],position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview"},vt=gt.append("g").attr("transform",`translate(${ut.x}, ${ut.y})`);mn(vt,{...yt,palette:r,isDark:o,width:ut.width,activeGroup:ut.name}),vt.selectAll("[data-legend-group]").classed("org-legend-group",!0)}dt=null}else dt=mn(gt,{...{groups:rt,position:{placement:"top-center",titleRelation:"below-title"},mode:d?"export":"preview",capsulePillAddonWidth:pt},palette:r,isDark:o,width:F?u:n.width,activeGroup:s??null}),gt.selectAll("[data-legend-group]").classed("org-legend-group",!0);if(F&&dt){let ut=dt.getLayout();if(ut.activeCapsule?.addonX!=null){let yt=ut.activeCapsule,vt=qt(yt.groupName),Gt=l?.has(vt)??!1,Xt=gt.select(`[data-legend-group="${vt}"]`);if(!Xt.empty()){let bt=yt.addonX,Mt=(Se-Co)/2,zt=6,xt=Xt.append("g").attr("class","org-legend-eye").attr("data-legend-visibility",vt).style("cursor","pointer").attr("opacity",Gt?.4:.7);xt.append("rect").attr("x",bt-zt).attr("y",Mt-zt).attr("width",Co+zt*2).attr("height",Co+zt*2).attr("fill","transparent").attr("pointer-events","all"),xt.append("path").attr("d",Gt?Rm:Am).attr("transform",`translate(${bt}, ${Mt})`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}}function i9(t,e,n){let r=Fc(t,n);if(r.error)return"";let o=r.options?.hide,a=o?new Set(o.split(",").map(u=>u.trim().toLowerCase())):void 0,i=_E(r,void 0,void 0,a),s=e==="dark",l=r.title&&r.options["no-title"]!=="on"?CI:0,c=i.width+RE*2,d=i.height+RE*2+l;return ad(c,d,u=>(_I(u,r,i,n,s,void 0,{width:c,height:d}),id(u,e)))}var RE,Qj,CI,Jj,t9,e9,n9,r9,RI=st(()=>{"use strict";je();qn();an();Zg();mr();tn();je();ju();AE();Tr();Br();Dg();en();_o();RE=20,Qj=3,CI=30,Jj=4,t9=11,e9=22,n9=16,r9=8});function II(t,e){t[e]?t[e]++:t[e]=1}function PI(t,e){t[e]!==void 0&&!--t[e]&&delete t[e]}function bf(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let i=o;o=a,a=i}return o+""+a+""+(r===void 0?"\0":r)}function u9(t,e,n,r){let o=""+e,a=""+n;if(!t&&o>a){let s=o;o=a,a=s}let i={v:o,w:a};return r&&(i.name=r),i}function DE(t,e){return bf(t,e.v,e.w,e.name)}function p9(t){let e={options:{directed:t.isDirected(),multigraph:t.isMultigraph(),compound:t.isCompound()},nodes:m9(t),edges:g9(t)},n=t.graph();return n!==void 0&&(e.value=structuredClone(n)),e}function m9(t){return t.nodes().map(e=>{let n=t.node(e),r=t.parent(e),o={v:e};return n!==void 0&&(o.value=n),r!==void 0&&(o.parent=r),o})}function g9(t){return t.edges().map(e=>{let n=t.edge(e),r={v:e.v,w:e.w};return e.name!==void 0&&(r.name=e.name),n!==void 0&&(r.value=n),r})}function h9(t){let e=new Na(t.options);return t.value!==void 0&&e.setGraph(t.value),t.nodes.forEach(n=>{e.setNode(n.v,n.value),n.parent&&e.setParent(n.v,n.parent)}),t.edges.forEach(n=>{e.setEdge({v:n.v,w:n.w,name:n.name},n.value)}),e}function KI(t,e,n,r){return b9(t,String(e),n||y9,r||function(o){return t.outEdges(o)})}function b9(t,e,n,r){let o={},a,i=0,s=t.nodes(),l=function(u){let f=n(u);o[u.v].distance+f<o[u.w].distance&&(o[u.w]={distance:o[u.v].distance+f,predecessor:u.v},a=!0)},c=function(){s.forEach(function(u){r(u).forEach(function(f){let p=f.v===u?f.v:f.w,m=p===f.v?f.w:f.v;l({v:p,w:m})})})};s.forEach(function(u){let f=u===e?0:Number.POSITIVE_INFINITY;o[u]={distance:f,predecessor:""}});let d=s.length;for(let u=1;u<d&&(a=!1,i++,c(),!!a);u++);if(i===d-1&&(a=!1,c(),a))throw new Error("The graph contains a negative weight cycle");return o}function x9(t){let e={},n=[],r;function o(a){a in e||(e[a]=!0,r.push(a),t.successors(a).forEach(o),t.predecessors(a).forEach(o))}return t.nodes().forEach(function(a){r=[],o(a),r.length&&n.push(r)}),n}function Jg(t,e,n,r){let o=function(a){return t.outEdges(a)};return E9(t,String(e),n||w9,r||o)}function E9(t,e,n,r){let o={},a=new ZI,i,s,l=function(c){let d=c.v!==i?c.v:c.w,u=o[d],f=n(c),p=s.distance+f;if(f<0)throw new Error("dijkstra does not allow negative edge weights. Bad edge: "+c+" Weight: "+f);p<u.distance&&(u.distance=p,u.predecessor=i,a.decrease(d,p))};for(t.nodes().forEach(function(c){let d=c===e?0:Number.POSITIVE_INFINITY;o[c]={distance:d,predecessor:""},a.add(c,d)});a.size()>0&&(i=a.removeMin(),s=o[i],s.distance!==Number.POSITIVE_INFINITY);)r(i).forEach(l);return o}function S9(t,e,n){return t.nodes().reduce(function(r,o){return r[o]=Jg(t,o,e,n),r},{})}function QI(t){let e=0,n=[],r={},o=[];function a(i){let s=r[i]={onStack:!0,lowlink:e,index:e++};if(n.push(i),t.successors(i).forEach(function(l){l in r?r[l].onStack&&(s.lowlink=Math.min(s.lowlink,r[l].index)):(a(l),s.lowlink=Math.min(s.lowlink,r[l].lowlink))}),s.lowlink===s.index){let l=[],c;do c=n.pop(),r[c].onStack=!1,l.push(c);while(i!==c);o.push(l)}}return t.nodes().forEach(function(i){i in r||a(i)}),o}function L9(t){return QI(t).filter(function(e){return e.length>1||e.length===1&&t.hasEdge(e[0],e[0])})}function N9(t,e,n){return M9(t,e||v9,n||function(r){return t.outEdges(r)})}function M9(t,e,n){let r={},o=t.nodes();return o.forEach(function(a){r[a]={},r[a][a]={distance:0,predecessor:""},o.forEach(function(i){a!==i&&(r[a][i]={distance:Number.POSITIVE_INFINITY,predecessor:""})}),n(a).forEach(function(i){let s=i.v===a?i.w:i.v,l=e(i);r[a][s]={distance:l,predecessor:a}})}),o.forEach(function(a){let i=r[a];o.forEach(function(s){let l=r[s];o.forEach(function(c){let d=l[a],u=i[c],f=l[c],p=d.distance+u.distance;p<f.distance&&(f.distance=p,f.predecessor=u.predecessor)})})}),r}function JI(t){let e={},n={},r=[];function o(a){if(a in n)throw new th;a in e||(n[a]=!0,e[a]=!0,t.predecessors(a).forEach(o),delete n[a],r.push(a))}if(t.sinks().forEach(o),Object.keys(e).length!==t.nodeCount())throw new th;return r}function k9(t){try{JI(t)}catch(e){if(e instanceof th)return!1;throw e}return!0}function T9(t,e,n,r,o){Array.isArray(e)||(e=[e]);let a=(s=>{var l;return(l=t.isDirected()?t.successors(s):t.neighbors(s))!=null?l:[]}),i={};return e.forEach(function(s){if(!t.hasNode(s))throw new Error("Graph does not have node: "+s);o=tP(t,s,n==="post",i,a,r,o)}),o}function tP(t,e,n,r,o,a,i){return e in r||(r[e]=!0,n||(i=a(i,e)),o(e).forEach(function(s){i=tP(t,s,n,r,o,a,i)}),n&&(i=a(i,e))),i}function eP(t,e,n){return T9(t,e,n,function(r,o){return r.push(o),r},[])}function C9(t,e){return eP(t,e,"post")}function _9(t,e){return eP(t,e,"pre")}function A9(t,e){let n=new Na,r={},o=new ZI,a;function i(l){let c=l.v===a?l.w:l.v,d=o.priority(c);if(d!==void 0){let u=e(l);u<d&&(r[c]=a,o.decrease(c,u))}}if(t.nodeCount()===0)return n;t.nodes().forEach(function(l){o.add(l,Number.POSITIVE_INFINITY),n.setNode(l)}),o.decrease(t.nodes()[0],0);let s=!1;for(;o.size()>0;){if(a=o.removeMin(),a in r)n.setEdge(a,r[a]);else{if(s)throw new Error("Input graph is not connected: "+t);s=!0}t.nodeEdges(a).forEach(i)}return n}function R9(t,e,n,r){return I9(t,e,n,r??(o=>{let a=t.outEdges(o);return a??[]}))}function I9(t,e,n,r){if(n===void 0)return Jg(t,e,n,r);let o=!1,a=t.nodes();for(let i=0;i<a.length;i++){let s=r(a[i]);for(let l=0;l<s.length;l++){let c=s[l],d=c.v===a[i]?c.v:c.w,u=d===c.v?c.w:c.v;n({v:d,w:u})<0&&(o=!0)}if(o)return KI(t,e,n,r)}return Jg(t,e,n,r)}function dd(t,e,n,r){let o=r;for(;t.hasNode(o);)o=YE(r);return n.dummy=e,t.setNode(o,n),o}function P9(t){let e=new Na().setGraph(t.graph());return t.nodes().forEach(n=>e.setNode(n,t.node(n))),t.edges().forEach(n=>{let r=e.edge(n.v,n.w)||{weight:0,minlen:1},o=t.edge(n);e.setEdge(n.v,n.w,{weight:r.weight+o.weight,minlen:Math.max(r.minlen,o.minlen)})}),e}function nP(t){let e=new Na({multigraph:t.isMultigraph()}).setGraph(t.graph());return t.nodes().forEach(n=>{t.children(n).length||e.setNode(n,t.node(n))}),t.edges().forEach(n=>{e.setEdge(n,t.edge(n))}),e}function DI(t,e){let n=t.x,r=t.y,o=e.x-n,a=e.y-r,i=t.width/2,s=t.height/2;if(!o&&!a)throw new Error("Not possible to find intersection inside of the rectangle");let l,c;return Math.abs(a)*i>Math.abs(o)*s?(a<0&&(s=-s),l=s*o/a,c=s):(o<0&&(i=-i),l=i,c=i*a/o),{x:n+l,y:r+c}}function wf(t){let e=xf(oP(t)+1).map(()=>[]);return t.nodes().forEach(n=>{let r=t.node(n),o=r.rank;o!==void 0&&(e[o]||(e[o]=[]),e[o][r.order]=n)}),e}function D9(t){let e=t.nodes().map(r=>{let o=t.node(r).rank;return o===void 0?Number.MAX_VALUE:o}),n=_i(Math.min,e);t.nodes().forEach(r=>{let o=t.node(r);Object.hasOwn(o,"rank")&&(o.rank-=n)})}function G9(t){let e=t.nodes().map(i=>t.node(i).rank).filter(i=>i!==void 0),n=_i(Math.min,e),r=[];t.nodes().forEach(i=>{let s=t.node(i).rank-n;r[s]||(r[s]=[]),r[s].push(i)});let o=0,a=t.graph().nodeRankFactor;Array.from(r).forEach((i,s)=>{i===void 0&&s%a!==0?--o:i!==void 0&&o&&i.forEach(l=>t.node(l).rank+=o)})}function GI(t,e,n,r){let o={width:0,height:0};return arguments.length>=4&&(o.rank=n,o.order=r),dd(t,"border",o,e)}function O9(t,e=rP){let n=[];for(let r=0;r<t.length;r+=e){let o=t.slice(r,r+e);n.push(o)}return n}function _i(t,e){if(e.length>rP){let n=O9(e);return t(...n.map(r=>t(...r)))}else return t(...e)}function oP(t){let e=t.nodes().map(n=>{let r=t.node(n).rank;return r===void 0?Number.MIN_VALUE:r});return _i(Math.max,e)}function $9(t,e){let n={lhs:[],rhs:[]};return t.forEach(r=>{e(r)?n.lhs.push(r):n.rhs.push(r)}),n}function aP(t,e){let n=Date.now();try{return e()}finally{console.log(t+" time: "+(Date.now()-n)+"ms")}}function iP(t,e){return e()}function YE(t){let e=++H9;return t+(""+e)}function xf(t,e,n=1){e==null&&(e=t,t=0);let r=a=>a<e;n<0&&(r=a=>e<a);let o=[];for(let a=t;r(a);a+=n)o.push(a);return o}function eh(t,e){let n={};for(let r of e)t[r]!==void 0&&(n[r]=t[r]);return n}function nh(t,e){let n;return typeof e=="string"?n=r=>r[e]:n=e,Object.entries(t).reduce((r,[o,a])=>(r[o]=n(a,o),r),{})}function W9(t,e){return t.reduce((n,r,o)=>(n[r]=e[o],n),{})}function OI(t){t._prev._next=t._next,t._next._prev=t._prev,delete t._next,delete t._prev}function Y9(t,e){if(t!=="_next"&&t!=="_prev")return e}function U9(t,e){if(t.nodeCount()<=1)return[];let n=j9(t,e||z9);return X9(n.graph,n.buckets,n.zeroIdx).flatMap(r=>t.outEdges(r.v,r.w)||[])}function X9(t,e,n){var r;let o=[],a=e[e.length-1],i=e[0],s;for(;t.nodeCount();){for(;s=i.dequeue();)GE(t,e,n,s);for(;s=a.dequeue();)GE(t,e,n,s);if(t.nodeCount()){for(let l=e.length-2;l>0;--l)if(s=(r=e[l])==null?void 0:r.dequeue(),s){o=o.concat(GE(t,e,n,s,!0)||[]);break}}}return o}function GE(t,e,n,r,o){let a=[],i=o?a:void 0;return(t.inEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=t.node(s.v);o&&a.push({v:s.v,w:s.w}),c.out-=l,FE(e,n,c)}),(t.outEdges(r.v)||[]).forEach(s=>{let l=t.edge(s),c=s.w,d=t.node(c);d.in-=l,FE(e,n,d)}),t.removeNode(r.v),i}function j9(t,e){let n=new Na,r=0,o=0;t.nodes().forEach(s=>{n.setNode(s,{v:s,in:0,out:0})}),t.edges().forEach(s=>{let l=n.edge(s.v,s.w)||0,c=e(s),d=l+c;n.setEdge(s.v,s.w,d);let u=n.node(s.v),f=n.node(s.w);o=Math.max(o,u.out+=c),r=Math.max(r,f.in+=c)});let a=q9(o+r+3).map(()=>new V9),i=r+1;return n.nodes().forEach(s=>{FE(a,i,n.node(s))}),{graph:n,buckets:a,zeroIdx:i}}function FE(t,e,n){var r,o,a;n.out?n.in?(a=t[n.out-n.in+e])==null||a.enqueue(n):(o=t[t.length-1])==null||o.enqueue(n):(r=t[0])==null||r.enqueue(n)}function q9(t){let e=[];for(let n=0;n<t;n++)e.push(n);return e}function K9(t){(t.graph().acyclicer==="greedy"?U9(t,e(t)):Z9(t)).forEach(n=>{let r=t.edge(n);t.removeEdge(n),r.forwardName=n.name,r.reversed=!0,t.setEdge(n.w,n.v,r,YE("rev"))});function e(n){return r=>n.edge(r).weight}}function Z9(t){let e=[],n={},r={};function o(a){Object.hasOwn(r,a)||(r[a]=!0,n[a]=!0,t.outEdges(a).forEach(i=>{Object.hasOwn(n,i.w)?e.push(i):o(i.w)}),delete n[a])}return t.nodes().forEach(o),e}function Q9(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.reversed){t.removeEdge(e);let r=n.forwardName;delete n.reversed,delete n.forwardName,t.setEdge(e.w,e.v,n,r)}})}function J9(t){t.graph().dummyChains=[],t.edges().forEach(e=>tq(t,e))}function tq(t,e){let n=e.v,r=t.node(n).rank,o=e.w,a=t.node(o).rank,i=e.name,s=t.edge(e),l=s.labelRank;if(a===r+1)return;t.removeEdge(e);let c,d,u;for(u=0,++r;r<a;++u,++r)s.points=[],d={width:0,height:0,edgeLabel:s,edgeObj:e,rank:r},c=dd(t,"edge",d,"_d"),r===l&&(d.width=s.width,d.height=s.height,d.dummy="edge-label",d.labelpos=s.labelpos),t.setEdge(n,c,{weight:s.weight},i),u===0&&t.graph().dummyChains.push(c),n=c;t.setEdge(n,o,{weight:s.weight},i)}function eq(t){t.graph().dummyChains.forEach(e=>{let n=t.node(e),r=n.edgeLabel,o;for(t.setEdge(n.edgeObj,r);n.dummy;)o=t.successors(e)[0],t.removeNode(e),r.points.push({x:n.x,y:n.y}),n.dummy==="edge-label"&&(r.x=n.x,r.y=n.y,r.width=n.width,r.height=n.height),e=o,n=t.node(e)})}function VE(t){let e={};function n(r){let o=t.node(r);if(Object.hasOwn(e,r))return o.rank;e[r]=!0;let a=t.outEdges(r),i=a?a.map(l=>l==null?Number.POSITIVE_INFINITY:n(l.w)-t.edge(l).minlen):[],s=_i(Math.min,i);return s===Number.POSITIVE_INFINITY&&(s=0),o.rank=s}t.sources().forEach(n)}function cd(t,e){return t.node(e.w).rank-t.node(e.v).rank-t.edge(e).minlen}function nq(t){let e=new Na({directed:!1}),n=t.nodes();if(n.length===0)throw new Error("Graph must have at least one node");let r=n[0],o=t.nodeCount();e.setNode(r,{});let a,i;for(;rq(e,t)<o&&(a=oq(e,t),!!a);)i=e.hasNode(a.v)?cd(t,a):-cd(t,a),aq(e,t,i);return e}function rq(t,e){function n(r){let o=e.nodeEdges(r);o&&o.forEach(a=>{let i=a.v,s=r===i?a.w:i;!t.hasNode(s)&&!cd(e,a)&&(t.setNode(s,{}),t.setEdge(r,s,{}),n(s))})}return t.nodes().forEach(n),t.nodeCount()}function oq(t,e){return e.edges().reduce((n,r)=>{let o=Number.POSITIVE_INFINITY;return t.hasNode(r.v)!==t.hasNode(r.w)&&(o=cd(e,r)),o<n[0]?[o,r]:n},[Number.POSITIVE_INFINITY,null])[1]}function aq(t,e,n){t.nodes().forEach(r=>e.node(r).rank+=n)}function Wl(t){t=P9(t),VE(t);let e=sP(t);UE(e),zE(e,t);let n,r;for(;n=dP(e);)r=uP(e,t,n),fP(e,t,n,r)}function zE(t,e){let n=sq(t,t.nodes());n=n.slice(0,n.length-1),n.forEach(r=>cq(t,e,r))}function cq(t,e,n){let r=t.node(n).parent,o=t.edge(n,r);o.cutvalue=lP(t,e,n)}function lP(t,e,n){let r=t.node(n).parent,o=!0,a=e.edge(n,r),i=0;a||(o=!1,a=e.edge(r,n)),i=a.weight;let s=e.nodeEdges(n);return s&&s.forEach(l=>{let c=l.v===n,d=c?l.w:l.v;if(d!==r){let u=c===o,f=e.edge(l).weight;if(i+=u?f:-f,uq(t,n,d)){let p=t.edge(n,d).cutvalue;i+=u?-p:p}}}),i}function UE(t,e){arguments.length<2&&(e=t.nodes()[0]),cP(t,{},1,e)}function cP(t,e,n,r,o){let a=n,i=t.node(r);e[r]=!0;let s=t.neighbors(r);return s&&s.forEach(l=>{Object.hasOwn(e,l)||(n=cP(t,e,n,l,r))}),i.low=a,i.lim=n++,o?i.parent=o:delete i.parent,n}function dP(t){return t.edges().find(e=>t.edge(e).cutvalue<0)}function uP(t,e,n){let r=n.v,o=n.w;e.hasEdge(r,o)||(r=n.w,o=n.v);let a=t.node(r),i=t.node(o),s=a,l=!1;return a.lim>i.lim&&(s=i,l=!0),e.edges().filter(c=>l===$I(t,t.node(c.v),s)&&l!==$I(t,t.node(c.w),s)).reduce((c,d)=>cd(e,d)<cd(e,c)?d:c)}function fP(t,e,n,r){let o=n.v,a=n.w;t.removeEdge(o,a),t.setEdge(r.v,r.w,{}),UE(t),zE(t,e),dq(t,e)}function dq(t,e){let n=t.nodes().find(o=>!t.node(o).parent);if(!n)return;let r=iq(t,[n]);r=r.slice(1),r.forEach(o=>{let a=t.node(o).parent,i=e.edge(o,a),s=!1;i||(i=e.edge(a,o),s=!0),e.node(o).rank=e.node(a).rank+(s?i.minlen:-i.minlen)})}function uq(t,e,n){return t.hasEdge(e,n)}function $I(t,e,n){return n.low<=e.lim&&e.lim<=n.lim}function pq(t){let e=t.graph().ranker;if(typeof e=="function")return e(t);switch(e){case"network-simplex":HI(t);break;case"tight-tree":gq(t);break;case"longest-path":mq(t);break;case"none":break;default:HI(t)}}function gq(t){VE(t),sP(t)}function HI(t){lq(t)}function yq(t){let e=xq(t);t.graph().dummyChains.forEach(n=>{let r=t.node(n),o=r.edgeObj,a=bq(t,e,o.v,o.w),i=a.path,s=a.lca,l=0,c=i[l],d=!0;for(;n!==o.w;){if(r=t.node(n),d){for(;(c=i[l])!==s&&t.node(c).maxRank<r.rank;)l++;c===s&&(d=!1)}if(!d){for(;l<i.length-1&&t.node(i[l+1]).minRank<=r.rank;)l++;c=i[l]}c!==void 0&&t.setParent(n,c),n=t.successors(n)[0]}})}function bq(t,e,n,r){let o=[],a=[],i=Math.min(e[n].low,e[r].low),s=Math.max(e[n].lim,e[r].lim),l;l=n;do l=t.parent(l),o.push(l);while(l&&(e[l].low>i||s>e[l].lim));let c=l,d=r;for(;(d=t.parent(d))!==c;)a.push(d);return{path:o.concat(a.reverse()),lca:c}}function xq(t){let e={},n=0;function r(o){let a=n;t.children(o).forEach(r),e[o]={low:a,lim:n++}}return t.children(rh).forEach(r),e}function wq(t){let e=dd(t,"root",{},"_root"),n=Eq(t),r=Object.values(n),o=_i(Math.max,r)-1,a=2*o+1;t.graph().nestingRoot=e,t.edges().forEach(s=>t.edge(s).minlen*=a);let i=Sq(t)+1;t.children(rh).forEach(s=>pP(t,e,a,i,o,n,s)),t.graph().nodeRankFactor=a}function pP(t,e,n,r,o,a,i){var s;let l=t.children(i);if(!l.length){i!==e&&t.setEdge(e,i,{weight:0,minlen:n});return}let c=GI(t,"_bt"),d=GI(t,"_bb"),u=t.node(i);t.setParent(c,i),u.borderTop=c,t.setParent(d,i),u.borderBottom=d,l.forEach(f=>{var p;pP(t,e,n,r,o,a,f);let m=t.node(f),g=m.borderTop?m.borderTop:f,h=m.borderBottom?m.borderBottom:f,S=m.borderTop?r:2*r,y=g!==h?1:o-((p=a[i])!=null?p:0)+1;t.setEdge(c,g,{weight:S,minlen:y,nestingEdge:!0}),t.setEdge(h,d,{weight:S,minlen:y,nestingEdge:!0})}),t.parent(i)||t.setEdge(e,c,{weight:0,minlen:o+((s=a[i])!=null?s:0)})}function Eq(t){let e={};function n(r,o){let a=t.children(r);a&&a.length&&a.forEach(i=>n(i,o+1)),e[r]=o}return t.children(rh).forEach(r=>n(r,1)),e}function Sq(t){return t.edges().reduce((e,n)=>e+t.edge(n).weight,0)}function Lq(t){let e=t.graph();t.removeNode(e.nestingRoot),delete e.nestingRoot,t.edges().forEach(n=>{t.edge(n).nestingEdge&&t.removeEdge(n)})}function Nq(t){function e(n){let r=t.children(n),o=t.node(n);if(r.length&&r.forEach(e),Object.hasOwn(o,"minRank")){o.borderLeft=[],o.borderRight=[];for(let a=o.minRank,i=o.maxRank+1;a<i;++a)WI(t,"borderLeft","_bl",n,o,a),WI(t,"borderRight","_br",n,o,a)}}t.children(rh).forEach(e)}function WI(t,e,n,r,o,a){let i={width:0,height:0,rank:a,borderType:e},s=o[e][a-1],l=dd(t,"border",i,n);o[e][a]=l,t.setParent(l,r),s&&t.setEdge(s,l,{weight:1})}function Mq(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="lr"||n==="rl")&&mP(t)}function kq(t){var e;let n=(e=t.graph().rankdir)==null?void 0:e.toLowerCase();(n==="bt"||n==="rl")&&Tq(t),(n==="lr"||n==="rl")&&(Cq(t),mP(t))}function mP(t){t.nodes().forEach(e=>FI(t.node(e))),t.edges().forEach(e=>FI(t.edge(e)))}function FI(t){let e=t.width;t.width=t.height,t.height=e}function Tq(t){t.nodes().forEach(e=>OE(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach(OE),Object.hasOwn(r,"y")&&OE(r)})}function OE(t){t.y=-t.y}function Cq(t){t.nodes().forEach(e=>$E(t.node(e))),t.edges().forEach(e=>{var n;let r=t.edge(e);(n=r.points)==null||n.forEach($E),Object.hasOwn(r,"x")&&$E(r)})}function $E(t){let e=t.x;t.x=t.y,t.y=e}function _q(t){let e={},n=t.nodes().filter(s=>!t.children(s).length),r=n.map(s=>t.node(s).rank),o=_i(Math.max,r),a=xf(o+1).map(()=>[]);function i(s){if(e[s])return;e[s]=!0;let l=t.node(s);a[l.rank].push(s);let c=t.successors(s);c&&c.forEach(i)}return n.sort((s,l)=>t.node(s).rank-t.node(l).rank).forEach(i),a}function Aq(t,e){let n=0;for(let r=1;r<e.length;++r)n+=Rq(t,e[r-1],e[r]);return n}function Rq(t,e,n){let r=W9(n,n.map((c,d)=>d)),o=e.flatMap(c=>{let d=t.outEdges(c);return d?d.map(u=>({pos:r[u.w],weight:t.edge(u).weight})).sort((u,f)=>u.pos-f.pos):[]}),a=1;for(;a<n.length;)a<<=1;let i=2*a-1;a-=1;let s=new Array(i).fill(0),l=0;return o.forEach(c=>{let d=c.pos+a;s[d]+=c.weight;let u=0;for(;d>0;)d%2&&(u+=s[d+1]),d=d-1>>1,s[d]+=c.weight;l+=c.weight*u}),l}function Iq(t,e=[]){return e.map(n=>{let r=t.inEdges(n);if(!r||!r.length)return{v:n};{let o=r.reduce((a,i)=>{let s=t.edge(i),l=t.node(i.v);return{sum:a.sum+s.weight*l.order,weight:a.weight+s.weight}},{sum:0,weight:0});return{v:n,barycenter:o.sum/o.weight,weight:o.weight}}})}function Pq(t,e){let n={};t.forEach((o,a)=>{let i={indegree:0,in:[],out:[],vs:[o.v],i:a};o.barycenter!==void 0&&(i.barycenter=o.barycenter,i.weight=o.weight),n[o.v]=i}),e.edges().forEach(o=>{let a=n[o.v],i=n[o.w];a!==void 0&&i!==void 0&&(i.indegree++,a.out.push(i))});let r=Object.values(n).filter(o=>!o.indegree);return Dq(r)}function Dq(t){let e=[];function n(o){return a=>{a.merged||(a.barycenter===void 0||o.barycenter===void 0||a.barycenter>=o.barycenter)&&Gq(o,a)}}function r(o){return a=>{a.in.push(o),--a.indegree===0&&t.push(a)}}for(;t.length;){let o=t.pop();e.push(o),o.in.reverse().forEach(n(o)),o.out.forEach(r(o))}return e.filter(o=>!o.merged).map(o=>eh(o,["vs","i","barycenter","weight"]))}function Gq(t,e){let n=0,r=0;t.weight&&(n+=t.barycenter*t.weight,r+=t.weight),e.weight&&(n+=e.barycenter*e.weight,r+=e.weight),t.vs=e.vs.concat(t.vs),t.barycenter=n/r,t.weight=r,t.i=Math.min(e.i,t.i),e.merged=!0}function Oq(t,e){let n=$9(t,d=>Object.hasOwn(d,"barycenter")),r=n.lhs,o=n.rhs.sort((d,u)=>u.i-d.i),a=[],i=0,s=0,l=0;r.sort($q(!!e)),l=BI(a,o,l),r.forEach(d=>{l+=d.vs.length,a.push(d.vs),i+=d.barycenter*d.weight,s+=d.weight,l=BI(a,o,l)});let c={vs:a.flat(1)};return s&&(c.barycenter=i/s,c.weight=s),c}function BI(t,e,n){let r;for(;e.length&&(r=e[e.length-1]).i<=n;)e.pop(),t.push(r.vs),n++;return n}function $q(t){return(e,n)=>e.barycenter<n.barycenter?-1:e.barycenter>n.barycenter?1:t?n.i-e.i:e.i-n.i}function gP(t,e,n,r){let o=t.children(e),a=t.node(e),i=a?a.borderLeft:void 0,s=a?a.borderRight:void 0,l={};i&&(o=o.filter(f=>f!==i&&f!==s));let c=Iq(t,o);c.forEach(f=>{if(t.children(f.v).length){let p=gP(t,f.v,n,r);l[f.v]=p,Object.hasOwn(p,"barycenter")&&Wq(f,p)}});let d=Pq(c,n);Hq(d,l);let u=Oq(d,r);if(i&&s){u.vs=[i,u.vs,s].flat(1);let f=t.predecessors(i);if(f&&f.length){let p=t.node(f[0]),m=t.predecessors(s),g=t.node(m[0]);Object.hasOwn(u,"barycenter")||(u.barycenter=0,u.weight=0),u.barycenter=(u.barycenter*u.weight+p.order+g.order)/(u.weight+2),u.weight+=2}}return u}function Hq(t,e){t.forEach(n=>{n.vs=n.vs.flatMap(r=>e[r]?e[r].vs:r)})}function Wq(t,e){t.barycenter!==void 0?(t.barycenter=(t.barycenter*t.weight+e.barycenter*e.weight)/(t.weight+e.weight),t.weight+=e.weight):(t.barycenter=e.barycenter,t.weight=e.weight)}function Fq(t,e,n,r){r||(r=t.nodes());let o=Bq(t),a=new Na({compound:!0}).setGraph({root:o}).setDefaultNodeLabel(i=>t.node(i));return r.forEach(i=>{let s=t.node(i),l=t.parent(i);if(s.rank===e||s.minRank<=e&&e<=s.maxRank){a.setNode(i),a.setParent(i,l||o);let c=t[n](i);c&&c.forEach(d=>{let u=d.v===i?d.w:d.v,f=a.edge(u,i),p=f!==void 0?f.weight:0;a.setEdge(u,i,{weight:t.edge(d).weight+p})}),Object.hasOwn(s,"minRank")&&a.setNode(i,{borderLeft:s.borderLeft[e],borderRight:s.borderRight[e]})}}),a}function Bq(t){let e;for(;t.hasNode(e=YE("_root")););return e}function Yq(t,e,n){let r={},o;n.forEach(a=>{let i=t.parent(a),s,l;for(;i;){if(s=t.parent(i),s?(l=r[s],r[s]=i):(l=o,o=i),l&&l!==i){e.setEdge(l,i);return}i=s}})}function hP(t,e={}){if(typeof e.customOrder=="function"){e.customOrder(t,hP);return}let n=oP(t),r=YI(t,xf(1,n+1),"inEdges"),o=YI(t,xf(n-1,-1,-1),"outEdges"),a=_q(t);if(VI(t,a),e.disableOptimalOrderHeuristic)return;let i=Number.POSITIVE_INFINITY,s,l=e.constraints||[];for(let c=0,d=0;d<4;++c,++d){Vq(c%2?r:o,c%4>=2,l),a=wf(t);let u=Aq(t,a);u<i?(d=0,s=Object.assign({},a),i=u):u===i&&(s=structuredClone(a))}VI(t,s)}function YI(t,e,n){let r=new Map,o=(a,i)=>{r.has(a)||r.set(a,[]),r.get(a).push(i)};for(let a of t.nodes()){let i=t.node(a);if(typeof i.rank=="number"&&o(i.rank,a),typeof i.minRank=="number"&&typeof i.maxRank=="number")for(let s=i.minRank;s<=i.maxRank;s++)s!==i.rank&&o(s,a)}return e.map(function(a){return Fq(t,a,n,r.get(a)||[])})}function Vq(t,e,n){let r=new Na;t.forEach(function(o){n.forEach(s=>r.setEdge(s.left,s.right));let a=o.graph().root,i=gP(o,a,r,e);i.vs.forEach((s,l)=>o.node(s).order=l),Yq(o,r,i.vs)})}function VI(t,e){Object.values(e).forEach(n=>n.forEach((r,o)=>t.node(r).order=o))}function zq(t,e){let n={};function r(o,a){let i=0,s=0,l=o.length,c=a[a.length-1];return a.forEach((d,u)=>{let f=Xq(t,d),p=f?t.node(f).order:l;(f||d===c)&&(a.slice(s,u+1).forEach(m=>{let g=t.predecessors(m);g&&g.forEach(h=>{let S=t.node(h),y=S.order;(y<i||p<y)&&!(S.dummy&&t.node(m).dummy)&&yP(n,h,m)})}),s=u+1,i=p)}),a}return e.length&&e.reduce(r),n}function Uq(t,e){let n={};function r(a,i,s,l,c){xf(i,s).forEach(d=>{let u=a[d];if(u!==void 0&&t.node(u).dummy){let f=t.predecessors(u);f&&f.forEach(p=>{if(p===void 0)return;let m=t.node(p);m.dummy&&(m.order<l||m.order>c)&&yP(n,p,u)})}})}function o(a,i){let s=-1,l=-1,c=0;return i.forEach((d,u)=>{if(t.node(d).dummy==="border"){let f=t.predecessors(d);if(f&&f.length){let p=f[0];if(p===void 0)return;l=t.node(p).order,r(i,c,u,s,l),c=u,s=l}}r(i,c,i.length,l,a.length)}),i}return e.length&&e.reduce(o),n}function Xq(t,e){if(t.node(e).dummy){let n=t.predecessors(e);if(n)return n.find(r=>t.node(r).dummy)}}function yP(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];r||(t[e]=r={}),r[n]=!0}function jq(t,e,n){if(e>n){let o=e;e=n,n=o}let r=t[e];return r!==void 0&&Object.hasOwn(r,n)}function qq(t,e,n,r){let o={},a={},i={};return e.forEach(s=>{s.forEach((l,c)=>{o[l]=l,a[l]=l,i[l]=c})}),e.forEach(s=>{let l=-1;s.forEach(c=>{let d=r(c);if(d&&d.length){let u=d.sort((p,m)=>{let g=i[p],h=i[m];return(g!==void 0?g:0)-(h!==void 0?h:0)}),f=(u.length-1)/2;for(let p=Math.floor(f),m=Math.ceil(f);p<=m;++p){let g=u[p];if(g===void 0)continue;let h=i[g];if(h!==void 0&&a[c]===c&&l<h&&!jq(n,c,g)){let S=o[g];S!==void 0&&(a[g]=c,a[c]=o[c]=S,l=h)}}}})}),{root:o,align:a}}function Kq(t,e,n,r,o=!1){let a={},i=Zq(t,e,n,o),s=o?"borderLeft":"borderRight";function l(p,m){let g=i.nodes().slice(),h={},S=g.pop();for(;S;){if(h[S])p(S);else{h[S]=!0,g.push(S);for(let y of m(S))g.push(y)}S=g.pop()}}function c(p){let m=i.inEdges(p);m?a[p]=m.reduce((g,h)=>{var S;let y=(S=a[h.v])!=null?S:0,b=i.edge(h);return Math.max(g,y+(b!==void 0?b:0))},0):a[p]=0}function d(p){let m=i.outEdges(p),g=Number.POSITIVE_INFINITY;m&&(g=m.reduce((S,y)=>{let b=a[y.w],E=i.edge(y);return Math.min(S,(b!==void 0?b:0)-(E!==void 0?E:0))},Number.POSITIVE_INFINITY));let h=t.node(p);g!==Number.POSITIVE_INFINITY&&h.borderType!==s&&(a[p]=Math.max(a[p]!==void 0?a[p]:0,g))}function u(p){return i.predecessors(p)||[]}function f(p){return i.successors(p)||[]}return l(c,u),l(d,f),Object.keys(r).forEach(p=>{var m;let g=n[p];g!==void 0&&(a[p]=(m=a[g])!=null?m:0)}),a}function Zq(t,e,n,r){let o=new Na,a=t.graph(),i=nK(a.nodesep,a.edgesep,r);return e.forEach(s=>{let l;s.forEach(c=>{let d=n[c];if(d!==void 0){if(o.setNode(d),l!==void 0){let u=n[l];if(u!==void 0){let f=o.edge(u,d);o.setEdge(u,d,Math.max(i(t,c,l),f||0))}}l=c}})}),o}function Qq(t,e){return Object.values(e).reduce((n,r)=>{let o=Number.NEGATIVE_INFINITY,a=Number.POSITIVE_INFINITY;Object.entries(r).forEach(([s,l])=>{let c=rK(t,s)/2;o=Math.max(l+c,o),a=Math.min(l-c,a)});let i=o-a;return i<n[0]&&(n=[i,r]),n},[Number.POSITIVE_INFINITY,null])[1]}function Jq(t,e){let n=Object.values(e),r=_i(Math.min,n),o=_i(Math.max,n);["u","d"].forEach(a=>{["l","r"].forEach(i=>{let s=a+i,l=t[s];if(!l||l===e)return;let c=Object.values(l),d=r-_i(Math.min,c);i!=="l"&&(d=o-_i(Math.max,c)),d&&(t[s]=nh(l,u=>u+d))})})}function tK(t,e=void 0){let n=t.ul;return n?nh(n,(r,o)=>{var a,i;if(e){let l=e.toLowerCase(),c=t[l];if(c&&c[o]!==void 0)return c[o]}let s=Object.values(t).map(l=>{let c=l[o];return c!==void 0?c:0}).sort((l,c)=>l-c);return(((a=s[1])!=null?a:0)+((i=s[2])!=null?i:0))/2}):{}}function eK(t){let e=wf(t),n=Object.assign(zq(t,e),Uq(t,e)),r={},o;["u","d"].forEach(i=>{o=i==="u"?e:Object.values(e).reverse(),["l","r"].forEach(s=>{s==="r"&&(o=o.map(d=>Object.values(d).reverse()));let l=qq(t,o,n,d=>(i==="u"?t.predecessors(d):t.successors(d))||[]),c=Kq(t,o,l.root,l.align,s==="r");s==="r"&&(c=nh(c,d=>-d)),r[i+s]=c})});let a=Qq(t,r);return Jq(r,a),tK(r,t.graph().align)}function nK(t,e,n){return(r,o,a)=>{let i=r.node(o),s=r.node(a),l=0,c;if(l+=i.width/2,Object.hasOwn(i,"labelpos"))switch(i.labelpos.toLowerCase()){case"l":c=-i.width/2;break;case"r":c=i.width/2;break}if(c&&(l+=n?c:-c),c=void 0,l+=(i.dummy?e:t)/2,l+=(s.dummy?e:t)/2,l+=s.width/2,Object.hasOwn(s,"labelpos"))switch(s.labelpos.toLowerCase()){case"l":c=s.width/2;break;case"r":c=-s.width/2;break}return c&&(l+=n?c:-c),l}}function rK(t,e){return t.node(e).width}function oK(t){t=nP(t),aK(t),Object.entries(eK(t)).forEach(([e,n])=>t.node(e).x=n)}function aK(t){let e=wf(t),n=t.graph(),r=n.ranksep,o=n.rankalign,a=0;e.forEach(i=>{let s=i.reduce((l,c)=>{var d;let u=(d=t.node(c).height)!=null?d:0;return l>u?l:u},0);i.forEach(l=>{let c=t.node(l);o==="top"?c.y=a+c.height/2:o==="bottom"?c.y=a+s-c.height/2:c.y=a+s/2}),a+=s+r})}function iK(t,e={}){let n=e.debugTiming?aP:iP;return n("layout",()=>{let r=n(" buildLayoutGraph",()=>hK(t));return n(" runLayout",()=>sK(r,n,e)),n(" updateInputGraph",()=>lK(t,r)),r})}function sK(t,e,n){e(" makeSpaceForEdgeLabels",()=>yK(t)),e(" removeSelfEdges",()=>MK(t)),e(" acyclic",()=>K9(t)),e(" nestingGraph.run",()=>wq(t)),e(" rank",()=>fq(nP(t))),e(" injectEdgeLabelProxies",()=>bK(t)),e(" removeEmptyRanks",()=>G9(t)),e(" nestingGraph.cleanup",()=>Lq(t)),e(" normalizeRanks",()=>D9(t)),e(" assignRankMinMax",()=>xK(t)),e(" removeEdgeLabelProxies",()=>wK(t)),e(" normalize.run",()=>J9(t)),e(" parentDummyChains",()=>hq(t)),e(" addBorderSegments",()=>vq(t)),e(" order",()=>hP(t,n)),e(" insertSelfEdges",()=>kK(t)),e(" adjustCoordinateSystem",()=>Mq(t)),e(" position",()=>oK(t)),e(" positionSelfEdges",()=>TK(t)),e(" removeBorderNodes",()=>NK(t)),e(" normalize.undo",()=>eq(t)),e(" fixupEdgeLabelCoords",()=>LK(t)),e(" undoCoordinateSystem",()=>kq(t)),e(" translateGraph",()=>EK(t)),e(" assignNodeIntersects",()=>SK(t)),e(" reversePoints",()=>vK(t)),e(" acyclic.undo",()=>Q9(t))}function lK(t,e){t.nodes().forEach(n=>{let r=t.node(n),o=e.node(n);r&&(r.x=o.x,r.y=o.y,r.order=o.order,r.rank=o.rank,e.children(n).length&&(r.width=o.width,r.height=o.height))}),t.edges().forEach(n=>{let r=t.edge(n),o=e.edge(n);r.points=o.points,Object.hasOwn(o,"x")&&(r.x=o.x,r.y=o.y)}),t.graph().width=e.graph().width,t.graph().height=e.graph().height}function hK(t){let e=new Na({multigraph:!0,compound:!0}),n=WE(t.graph());return e.setGraph(Object.assign({},dK,HE(n,cK),eh(n,uK))),t.nodes().forEach(r=>{let o=WE(t.node(r)),a=HE(o,fK);Object.keys(zI).forEach(s=>{a[s]===void 0&&(a[s]=zI[s])}),e.setNode(r,a);let i=t.parent(r);i!==void 0&&e.setParent(r,i)}),t.edges().forEach(r=>{let o=WE(t.edge(r));e.setEdge(r,Object.assign({},mK,HE(o,pK),eh(o,gK)))}),e}function yK(t){let e=t.graph();e.ranksep/=2,t.edges().forEach(n=>{let r=t.edge(n);r.minlen*=2,r.labelpos.toLowerCase()!=="c"&&(e.rankdir==="TB"||e.rankdir==="BT"?r.width+=r.labeloffset:r.height+=r.labeloffset)})}function bK(t){t.edges().forEach(e=>{let n=t.edge(e);if(n.width&&n.height){let r=t.node(e.v),o={rank:(t.node(e.w).rank-r.rank)/2+r.rank,e};dd(t,"edge-proxy",o,"_ep")}})}function xK(t){let e=0;t.nodes().forEach(n=>{let r=t.node(n);r.borderTop&&(r.minRank=t.node(r.borderTop).rank,r.maxRank=t.node(r.borderBottom).rank,e=Math.max(e,r.maxRank))}),t.graph().maxRank=e}function wK(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="edge-proxy"){let r=n;t.edge(r.e).labelRank=n.rank,t.removeNode(e)}})}function EK(t){let e=Number.POSITIVE_INFINITY,n=0,r=Number.POSITIVE_INFINITY,o=0,a=t.graph(),i=a.marginx||0,s=a.marginy||0;function l(c){let d=c.x,u=c.y,f=c.width,p=c.height;e=Math.min(e,d-f/2),n=Math.max(n,d+f/2),r=Math.min(r,u-p/2),o=Math.max(o,u+p/2)}t.nodes().forEach(c=>l(t.node(c))),t.edges().forEach(c=>{let d=t.edge(c);Object.hasOwn(d,"x")&&l(d)}),e-=i,r-=s,t.nodes().forEach(c=>{let d=t.node(c);d.x-=e,d.y-=r}),t.edges().forEach(c=>{let d=t.edge(c);d.points.forEach(u=>{u.x-=e,u.y-=r}),Object.hasOwn(d,"x")&&(d.x-=e),Object.hasOwn(d,"y")&&(d.y-=r)}),a.width=n-e+i,a.height=o-r+s}function SK(t){t.edges().forEach(e=>{let n=t.edge(e),r=t.node(e.v),o=t.node(e.w),a,i;n.points?(a=n.points[0],i=n.points[n.points.length-1]):(n.points=[],a=o,i=r),n.points.unshift(DI(r,a)),n.points.push(DI(o,i))})}function LK(t){t.edges().forEach(e=>{let n=t.edge(e);if(Object.hasOwn(n,"x"))switch((n.labelpos==="l"||n.labelpos==="r")&&(n.width-=n.labeloffset),n.labelpos){case"l":n.x-=n.width/2+n.labeloffset;break;case"r":n.x+=n.width/2+n.labeloffset;break}})}function vK(t){t.edges().forEach(e=>{let n=t.edge(e);n.reversed&&n.points.reverse()})}function NK(t){t.nodes().forEach(e=>{if(t.children(e).length){let n=t.node(e),r=t.node(n.borderTop),o=t.node(n.borderBottom),a=t.node(n.borderLeft[n.borderLeft.length-1]),i=t.node(n.borderRight[n.borderRight.length-1]);n.width=Math.abs(i.x-a.x),n.height=Math.abs(o.y-r.y),n.x=a.x+n.width/2,n.y=r.y+n.height/2}}),t.nodes().forEach(e=>{t.node(e).dummy==="border"&&t.removeNode(e)})}function MK(t){t.edges().forEach(e=>{if(e.v===e.w){let n=t.node(e.v);n.selfEdges||(n.selfEdges=[]),n.selfEdges.push({e,label:t.edge(e)}),t.removeEdge(e)}})}function kK(t){wf(t).forEach(e=>{let n=0;e.forEach((r,o)=>{let a=t.node(r);a.order=o+n,(a.selfEdges||[]).forEach(i=>{dd(t,"selfedge",{width:i.label.width,height:i.label.height,rank:a.rank,order:o+ ++n,e:i.e,label:i.label},"_se")}),delete a.selfEdges})})}function TK(t){t.nodes().forEach(e=>{let n=t.node(e);if(n.dummy==="selfedge"){let r=n,o=t.node(r.e.v),a=o.x+o.width/2,i=o.y,s=n.x-a,l=o.height/2;t.setEdge(r.e,r.label),t.removeNode(e),r.label.points=[{x:a+2*s/3,y:i-l},{x:a+5*s/6,y:i-l},{x:a+s,y:i},{x:a+5*s/6,y:i+l},{x:a+2*s/3,y:i+l}],r.label.x=n.x,r.label.y=n.y}})}function HE(t,e){return nh(eh(t,e),Number)}function WE(t){let e={};return t&&Object.entries(t).forEach(([n,r])=>{typeof n=="string"&&(n=n.toLowerCase()),e[n]=r}),e}function CK(t){let e=wf(t),n=new Na({compound:!0,multigraph:!0}).setGraph({});return t.nodes().forEach(r=>{n.setNode(r,{label:r}),n.setParent(r,"layer"+t.node(r).rank)}),t.edges().forEach(r=>n.setEdge(r.v,r.w,{},r.name)),e.forEach((r,o)=>{let a="layer"+o;n.setNode(a,{rank:"same"}),r.reduce((i,s)=>(n.setEdge(i,s,{style:"invis"}),s))}),n}var UI,s9,l9,c9,XI,d9,jI,Na,f9,qI,BE,y9,ZI,w9,v9,th,rP,H9,rh,F9,B9,V9,z9,sP,iq,sq,lq,fq,mq,hq,vq,cK,dK,uK,fK,zI,pK,mK,gK,_K,rr,os=st(()=>{"use strict";UI=Object.defineProperty,s9=(t,e,n)=>e in t?UI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,l9=(t,e)=>{for(var n in e)UI(t,n,{get:e[n],enumerable:!0})},c9=(t,e,n)=>s9(t,typeof e!="symbol"?e+"":e,n),XI={};l9(XI,{Graph:()=>Na,alg:()=>BE,json:()=>qI,version:()=>f9});d9=Object.defineProperty,jI=(t,e)=>{for(var n in e)d9(t,n,{get:e[n],enumerable:!0})},Na=class{constructor(t){this._isDirected=!0,this._isMultigraph=!1,this._isCompound=!1,this._nodes={},this._in={},this._preds={},this._out={},this._sucs={},this._edgeObjs={},this._edgeLabels={},this._nodeCount=0,this._edgeCount=0,this._defaultNodeLabelFn=()=>{},this._defaultEdgeLabelFn=()=>{},t&&(this._isDirected="directed"in t?t.directed:!0,this._isMultigraph="multigraph"in t?t.multigraph:!1,this._isCompound="compound"in t?t.compound:!1),this._isCompound&&(this._parent={},this._children={},this._children["\0"]={})}isDirected(){return this._isDirected}isMultigraph(){return this._isMultigraph}isCompound(){return this._isCompound}setGraph(t){return this._label=t,this}graph(){return this._label}setDefaultNodeLabel(t){return typeof t!="function"?this._defaultNodeLabelFn=()=>t:this._defaultNodeLabelFn=t,this}nodeCount(){return this._nodeCount}nodes(){return Object.keys(this._nodes)}sources(){return this.nodes().filter(t=>Object.keys(this._in[t]).length===0)}sinks(){return this.nodes().filter(t=>Object.keys(this._out[t]).length===0)}setNodes(t,e){return t.forEach(n=>{e!==void 0?this.setNode(n,e):this.setNode(n)}),this}setNode(t,e){return t in this._nodes?(arguments.length>1&&(this._nodes[t]=e),this):(this._nodes[t]=arguments.length>1?e:this._defaultNodeLabelFn(t),this._isCompound&&(this._parent[t]="\0",this._children[t]={},this._children["\0"][t]=!0),this._in[t]={},this._preds[t]={},this._out[t]={},this._sucs[t]={},++this._nodeCount,this)}node(t){return this._nodes[t]}hasNode(t){return t in this._nodes}removeNode(t){if(t in this._nodes){let e=n=>this.removeEdge(this._edgeObjs[n]);delete this._nodes[t],this._isCompound&&(this._removeFromParentsChildList(t),delete this._parent[t],this.children(t).forEach(n=>{this.setParent(n)}),delete this._children[t]),Object.keys(this._in[t]).forEach(e),delete this._in[t],delete this._preds[t],Object.keys(this._out[t]).forEach(e),delete this._out[t],delete this._sucs[t],--this._nodeCount}return this}setParent(t,e){if(!this._isCompound)throw new Error("Cannot set parent in a non-compound graph");if(e===void 0)e="\0";else{e+="";for(let n=e;n!==void 0;n=this.parent(n))if(n===t)throw new Error("Setting "+e+" as parent of "+t+" would create a cycle");this.setNode(e)}return this.setNode(t),this._removeFromParentsChildList(t),this._parent[t]=e,this._children[e][t]=!0,this}parent(t){if(this._isCompound){let e=this._parent[t];if(e!=="\0")return e}}children(t="\0"){if(this._isCompound){let e=this._children[t];if(e)return Object.keys(e)}else{if(t==="\0")return this.nodes();if(this.hasNode(t))return[]}return[]}predecessors(t){let e=this._preds[t];if(e)return Object.keys(e)}successors(t){let e=this._sucs[t];if(e)return Object.keys(e)}neighbors(t){let e=this.predecessors(t);if(e){let n=new Set(e);for(let r of this.successors(t))n.add(r);return Array.from(n.values())}}isLeaf(t){let e;return this.isDirected()?e=this.successors(t):e=this.neighbors(t),e.length===0}filterNodes(t){let e=new this.constructor({directed:this._isDirected,multigraph:this._isMultigraph,compound:this._isCompound});e.setGraph(this.graph()),Object.entries(this._nodes).forEach(([o,a])=>{t(o)&&e.setNode(o,a)}),Object.values(this._edgeObjs).forEach(o=>{e.hasNode(o.v)&&e.hasNode(o.w)&&e.setEdge(o,this.edge(o))});let n={},r=o=>{let a=this.parent(o);return!a||e.hasNode(a)?(n[o]=a??void 0,a??void 0):a in n?n[a]:r(a)};return this._isCompound&&e.nodes().forEach(o=>e.setParent(o,r(o))),e}setDefaultEdgeLabel(t){return typeof t!="function"?this._defaultEdgeLabelFn=()=>t:this._defaultEdgeLabelFn=t,this}edgeCount(){return this._edgeCount}edges(){return Object.values(this._edgeObjs)}setPath(t,e){return t.reduce((n,r)=>(e!==void 0?this.setEdge(n,r,e):this.setEdge(n,r),r)),this}setEdge(t,e,n,r){let o,a,i,s,l=!1;typeof t=="object"&&t!==null&&"v"in t?(o=t.v,a=t.w,i=t.name,arguments.length===2&&(s=e,l=!0)):(o=t,a=e,i=r,arguments.length>2&&(s=n,l=!0)),o=""+o,a=""+a,i!==void 0&&(i=""+i);let c=bf(this._isDirected,o,a,i);if(c in this._edgeLabels)return l&&(this._edgeLabels[c]=s),this;if(i!==void 0&&!this._isMultigraph)throw new Error("Cannot set a named edge when isMultigraph = false");this.setNode(o),this.setNode(a),this._edgeLabels[c]=l?s:this._defaultEdgeLabelFn(o,a,i);let d=u9(this._isDirected,o,a,i);return o=d.v,a=d.w,Object.freeze(d),this._edgeObjs[c]=d,II(this._preds[a],o),II(this._sucs[o],a),this._in[a][c]=d,this._out[o][c]=d,this._edgeCount++,this}edge(t,e,n){let r=arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n);return this._edgeLabels[r]}edgeAsObj(t,e,n){let r=arguments.length===1?this.edge(t):this.edge(t,e,n);return typeof r!="object"?{label:r}:r}hasEdge(t,e,n){return(arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n))in this._edgeLabels}removeEdge(t,e,n){let r=arguments.length===1?DE(this._isDirected,t):bf(this._isDirected,t,e,n),o=this._edgeObjs[r];if(o){let a=o.v,i=o.w;delete this._edgeLabels[r],delete this._edgeObjs[r],PI(this._preds[i],a),PI(this._sucs[a],i),delete this._in[i][r],delete this._out[a][r],this._edgeCount--}return this}inEdges(t,e){return this.isDirected()?this.filterEdges(this._in[t],t,e):this.nodeEdges(t,e)}outEdges(t,e){return this.isDirected()?this.filterEdges(this._out[t],t,e):this.nodeEdges(t,e)}nodeEdges(t,e){if(t in this._nodes)return this.filterEdges({...this._in[t],...this._out[t]},t,e)}_removeFromParentsChildList(t){delete this._children[this._parent[t]][t]}filterEdges(t,e,n){if(!t)return;let r=Object.values(t);return n?r.filter(o=>o.v===e&&o.w===n||o.v===n&&o.w===e):r}};f9="4.0.1",qI={};jI(qI,{read:()=>h9,write:()=>p9});BE={};jI(BE,{CycleException:()=>th,bellmanFord:()=>KI,components:()=>x9,dijkstra:()=>Jg,dijkstraAll:()=>S9,findCycles:()=>L9,floydWarshall:()=>N9,isAcyclic:()=>k9,postorder:()=>C9,preorder:()=>_9,prim:()=>A9,shortestPaths:()=>R9,tarjan:()=>QI,topsort:()=>JI});y9=()=>1;ZI=class{constructor(){this._arr=[],this._keyIndices={}}size(){return this._arr.length}keys(){return this._arr.map(t=>t.key)}has(t){return t in this._keyIndices}priority(t){let e=this._keyIndices[t];if(e!==void 0)return this._arr[e].priority}min(){if(this.size()===0)throw new Error("Queue underflow");return this._arr[0].key}add(t,e){let n=this._keyIndices,r=String(t);if(!(r in n)){let o=this._arr,a=o.length;return n[r]=a,o.push({key:r,priority:e}),this._decrease(a),!0}return!1}removeMin(){this._swap(0,this._arr.length-1);let t=this._arr.pop();return delete this._keyIndices[t.key],this._heapify(0),t.key}decrease(t,e){let n=this._keyIndices[t];if(n===void 0)throw new Error(`Key not found: ${t}`);let r=this._arr[n].priority;if(e>r)throw new Error(`New priority is greater than current priority. Key: ${t} Old: ${r} New: ${e}`);this._arr[n].priority=e,this._decrease(n)}_heapify(t){let e=this._arr,n=2*t,r=n+1,o=t;n<e.length&&(o=e[n].priority<e[o].priority?n:o,r<e.length&&(o=e[r].priority<e[o].priority?r:o),o!==t&&(this._swap(t,o),this._heapify(o)))}_decrease(t){let e=this._arr,n=e[t].priority,r;for(;t!==0&&(r=t>>1,!(e[r].priority<n));)this._swap(t,r),t=r}_swap(t,e){let n=this._arr,r=this._keyIndices,o=n[t],a=n[e];n[t]=a,n[e]=o,r[a.key]=t,r[o.key]=e}},w9=()=>1;v9=()=>1;th=class extends Error{constructor(...t){super(...t)}};rP=65535;H9=0;rh="\0",F9="3.0.0",B9=class{constructor(){c9(this,"_sentinel");let t={};t._next=t._prev=t,this._sentinel=t}dequeue(){let t=this._sentinel,e=t._prev;if(e!==t)return OI(e),e}enqueue(t){let e=this._sentinel;t._prev&&t._next&&OI(t),t._next=e._next,e._next._prev=t,e._next=t,t._prev=e}toString(){let t=[],e=this._sentinel,n=e._prev;for(;n!==e;)t.push(JSON.stringify(n,Y9)),n=n._prev;return"["+t.join(", ")+"]"}};V9=B9,z9=()=>1;sP=nq;({preorder:iq,postorder:sq}=BE),lq=Wl;Wl.initLowLimValues=UE;Wl.initCutValues=zE;Wl.calcCutValue=lP;Wl.leaveEdge=dP;Wl.enterEdge=uP;Wl.exchangeEdges=fP;fq=pq;mq=VE;hq=yq;vq=Nq;cK=["nodesep","edgesep","ranksep","marginx","marginy"],dK={ranksep:50,edgesep:20,nodesep:50,rankdir:"TB",rankalign:"center"},uK=["acyclicer","ranker","rankdir","align","rankalign"],fK=["width","height","rank"],zI={width:0,height:0},pK=["minlen","weight","width","height","labeloffset"],mK={minlen:1,weight:1,width:0,height:0,labeloffset:10,labelpos:"r"},gK=["labelpos"];_K={graphlib:XI,version:F9,layout:iK,debug:CK,util:{time:aP,notime:iP}},rr=_K;});var qE={};ye(qE,{layoutSitemap:()=>FK});function xP(t,e,n,r,o,a){let i=o-t,s=a-e;if(i===0&&s===0)return{x:t,y:e};let l=n/2,c=r/2,d=i!==0?l/Math.abs(i):1/0,u=s!==0?c/Math.abs(s):1/0,f=Math.min(d,u);return{x:t+i*f,y:e+s*f}}function GK(t,e){if(!e||e.size===0)return t;let n={};for(let[r,o]of Object.entries(t))e.has(r)||(n[r]=o);return n}function OK(t,e,n){let r=_t(t,AK);for(let[o,a]of Object.entries(e)){let i=_t(`${o}: ${a}`,bP);i>r&&(r=i)}if(n)for(let o of n){let a=_t(o,bP);a>r&&(r=a)}return Math.max(NP,Math.ceil(r)+vP*2)}function $K(t,e=0){let r=Object.keys(t).length+e;return r===0?wP+EP:wP+PK+r*IK+EP}function LP(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n,t.isContainer)}function WK(t,e){let n=[];for(let r of t){if(r.entries.length===0)continue;let o=e?.get(qt(r.name)),a=o?r.entries.filter(u=>o.has(u.value.toLowerCase())):r.entries;if(a.length===0)continue;let i=Fe(r.name,cr)+po,s=i,l=0;for(let u of a)l+=Er*2+kr+Fe(u.value,Xn)+Kr;let c=Co+wi,d=In*2+i+4+c+l;n.push({name:r.name,...r.alias!==void 0&&{alias:r.alias},entries:a.map(u=>({value:u.value,color:u.color})),x:0,y:0,width:d,height:Se,minifiedWidth:s,minifiedHeight:Se})}return n}function jE(t,e,n,r,o,a){for(let i of t){let s=GK(i.metadata,o);if(i.isContainer){let l=Object.keys(s).length,c=MP+l*kP;a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:Math.max(NP,_t(i.label,RK)+vP*2),height:c+XE}),jE(i.children,i.id,n,r,o,a)}else a.push({sitemapNode:i,parentContainerId:e,parentPageId:n,meta:s,fullMeta:{...i.metadata},width:OK(i.label,s,i.description),height:$K(s,i.description?.length??0)}),i.children.length>0&&jE(i.children,e,i.id,r,o,a)}}function FK(t,e,n,r,o){if(t.roots.length===0)return{nodes:[],edges:[],containers:[],legend:[],width:0,height:0};let a=[],i=v=>{a.push(v);for(let M of v.children)i(M)};for(let v of t.roots)i(v);wa(a,t.tagGroups,v=>v.isContainer);let s=[];jE(t.roots,null,null,e,r,s);let l=new Map;for(let v of s)l.set(v.sitemapNode.id,v);let c=new rr.graphlib.Graph({compound:!0,multigraph:!0});c.setGraph({rankdir:t.direction,nodesep:50,ranksep:60,edgesep:30,marginx:Fl,marginy:Fl}),c.setDefaultEdgeLabel(()=>({}));let d=new Set,u=new Set,f=new Set;for(let v of s)v.sitemapNode.isContainer?(d.add(v.sitemapNode.id),(e?.get(v.sitemapNode.id)??0)>0&&f.add(v.sitemapNode.id)):u.add(v.sitemapNode.id);let p=0,m=0;for(let v of s)v.sitemapNode.isContainer||(v.width>p&&(p=v.width),v.height>m&&(m=v.height));for(let v of s){let M=v.sitemapNode;if(M.isContainer)if(f.has(M.id)){let _=Math.max(v.width,p),T=Math.max(v.height,m);c.setNode(M.id,{label:M.label,width:_,height:T})}else c.setNode(M.id,{label:M.label,paddingLeft:SP,paddingRight:SP,paddingTop:DK,paddingBottom:XE});else c.setNode(M.id,{label:M.label,width:v.width,height:v.height})}for(let v of s)v.parentContainerId&&!f.has(v.parentContainerId)&&c.setParent(v.sitemapNode.id,v.parentContainerId);let g=new Set;for(let v of d)f.has(v)||g.add(v);let h=[];for(let v=0;v<t.edges.length;v++){let M=t.edges[v];if(!(!c.hasNode(M.sourceId)||!c.hasNode(M.targetId))){if(g.has(M.sourceId)||g.has(M.targetId)){h.push(v);continue}c.setEdge(M.sourceId,M.targetId,{label:M.label??"",minlen:1},`e${v}`)}}rr.layout(c);let S=[],y=[];for(let v of s){let M=v.sitemapNode;if(M.isContainer)continue;let _=c.node(M.id);if(!_)continue;let T=e?.get(M.id),R=LP(M,t.tagGroups,n??null);S.push({id:M.id,label:M.label,metadata:v.meta,tagMetadata:v.fullMeta,...M.description!==void 0&&{description:[...M.description]},isContainer:!1,lineNumber:M.lineNumber,...R!==void 0&&{color:R},x:_.x,y:_.y-_.height/2,width:_.width,height:_.height,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}for(let v of s){let M=v.sitemapNode;if(!M.isContainer)continue;let _=c.node(M.id),T=e?.get(M.id),R=Object.keys(v.meta).length,O=MP+R*kP,I=LP(M,t.tagGroups,n??null);if(_)y.push({nodeId:M.id,label:M.label,lineNumber:M.lineNumber,...I!==void 0&&{color:I},metadata:v.meta,tagMetadata:v.fullMeta,x:_.x-_.width/2,y:_.y-_.height/2,width:_.width,height:_.height,labelHeight:O,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}});else{let H=f.has(M.id),G=H?Math.max(v.width,p):v.width,D=H?v.height:O+XE,W=H?Math.max(D,m):D;y.push({nodeId:M.id,label:M.label,lineNumber:M.lineNumber,...I!==void 0&&{color:I},metadata:v.meta,tagMetadata:v.fullMeta,x:Fl,y:Fl,width:G,height:W,labelHeight:O,...T!==void 0&&{hiddenCount:T},...(M.children.length>0||T!=null&&T>0)&&{hasChildren:!0}})}}let b=new Set(h),E=[];for(let v=0;v<t.edges.length;v++){let M=t.edges[v];if(!c.hasNode(M.sourceId)||!c.hasNode(M.targetId))continue;let _;if(b.has(v)){let T=c.node(M.sourceId),R=c.node(M.targetId);if(!T||!R)continue;let O=xP(T.x,T.y,T.width,T.height,R.x,R.y),I=xP(R.x,R.y,R.width,R.height,T.x,T.y),H=(O.x+I.x)/2,G=(O.y+I.y)/2;_=[O,{x:H,y:G},I]}else{let T=c.edge({v:M.sourceId,w:M.targetId,name:`e${v}`});if(!T)continue;_=T.points??[]}E.push({sourceId:M.sourceId,targetId:M.targetId,points:_,...M.label!==void 0&&{label:M.label},lineNumber:M.lineNumber,...b.has(v)&&{deferred:!0}})}{let v=new Set([...u,...f]),M=new Map;for(let G of v)M.set(G,G);let _=G=>{for(;M.get(G)!==G;)M.set(G,M.get(M.get(G))),G=M.get(G);return G},T=(G,D)=>{let W=_(G),V=_(D);W!==V&&M.set(W,V)};for(let G of t.edges)v.has(G.sourceId)&&v.has(G.targetId)&&T(G.sourceId,G.targetId);let R=s.find(G=>!G.sitemapNode.isContainer)?.sitemapNode.id,O=R?_(R):null,I=new Set;for(let G of v)O&&_(G)!==O&&I.add(G);let H=new Set;for(let G of d){if(f.has(G)){I.has(G)&&H.add(G);continue}let D=s.filter(W=>!W.sitemapNode.isContainer&&W.parentContainerId===G);D.length>0&&D.every(W=>I.has(W.sitemapNode.id))&&H.add(G)}if(I.size>0){let G=t.direction==="TB",D=0,W=0,V=1/0,P=1/0;for(let K of S)I.has(K.id)||(D=Math.max(D,K.x+K.width/2),W=Math.max(W,K.y+K.height),V=Math.min(V,K.y),P=Math.min(P,K.x-K.width/2));for(let K of y)H.has(K.nodeId)||(D=Math.max(D,K.x+K.width),W=Math.max(W,K.y+K.height),V=Math.min(V,K.y),P=Math.min(P,K.x));let F=1/0,Y=1/0,z=0,j=0;for(let K of S)I.has(K.id)&&(F=Math.min(F,K.x-K.width/2),Y=Math.min(Y,K.y),z=Math.max(z,K.x+K.width/2),j=Math.max(j,K.y+K.height));for(let K of y)H.has(K.nodeId)&&(F=Math.min(F,K.x),Y=Math.min(Y,K.y),z=Math.max(z,K.x+K.width),j=Math.max(j,K.y+K.height));if(F!==1/0){let K=HK*2,$,U;if(G?($=D+K-F,U=(V===1/0?0:V)-Y):($=(P===1/0?0:P)-F,U=W+K-Y),$!==0||U!==0){for(let X of S)I.has(X.id)&&(X.x+=$,X.y+=U);for(let X of y)H.has(X.nodeId)&&(X.x+=$,X.y+=U);for(let X of E){let q=I.has(X.sourceId),et=I.has(X.targetId);if(q||et)for(let tt of X.points)tt.x+=$,tt.y+=U}}}}}let x=0,N=0;for(let v of S){let M=v.x+v.width/2,_=v.y+v.height;M>x&&(x=M),_>N&&(N=_)}for(let v of y){let M=v.x+v.width,_=v.y+v.height;M>x&&(x=M),_>N&&(N=_)}for(let v of E)for(let M of v.points)M.x>x&&(x=M.x),M.y>N&&(N=M.y);x+=Fl,N+=Fl;let L=new Map;for(let v of t.tagGroups){let M=qt(v.name),_=new Set,T=R=>{!R.isContainer&&R.metadata[M]&&_.add(R.metadata[M].toLowerCase());for(let O of R.children)T(O)};for(let R of t.roots)T(R);L.set(M,_)}let A=WK(t.tagGroups,L),C=n!=null?A.filter(v=>v.name.toLowerCase()===n.toLowerCase()):A,k=o&&n==null,w=v=>n!=null||k?v.width:v.minifiedWidth;if(C.length>0){let v=Se+Bn,M=C.reduce((O,I)=>O+w(I),0)+(C.length-1)*Bn,_=M+Fl*2;_>x&&(x=_);let T=(x-M)/2,R=N+Bn;for(let O of C)O.x=T,O.y=R,T+=w(O)+Bn;N+=v}return{nodes:S,edges:E,containers:y,legend:A,width:x,height:N}}var AK,bP,RK,IK,wP,PK,vP,EP,NP,Fl,SP,DK,XE,MP,kP,HK,KE=st(()=>{"use strict";je();os();je();Tr();en();AK=13,bP=11,RK=13;IK=16,wP=28,PK=6,vP=20,EP=10,NP=140,Fl=40,SP=24,DK=40,XE=24,MP=28,kP=16;HK=20});function BK(t,e){let n=new Map,r=o=>{for(let a of o)for(let i of e.getChildren(a))n.set(e.getId(i),e.getId(a)),r([i])};return r(t),n}function TP(t,e,n,r){let o=t;for(;;){let a=e.get(o);if(!a)return null;if(n.has(a)&&r.has(a))return a;o=a}}function CP(t,e,n,r,o,a){let i=SI(e,o),s=BK(t,o),l=[];for(let c of n){let d=a.getSource(c),u=a.getTarget(c),f=i.has(d),p=i.has(u);if(f&&p){l.push(a.withEndpoints(c,d,u));continue}if(!f){let m=TP(d,s,i,r);if(!m)continue;d=m}if(!p){let m=TP(u,s,i,r);if(!m)continue;u=m}d!==u&&l.push(a.withEndpoints(c,d,u))}return l}var _P=st(()=>{"use strict";yf()});var IP={};ye(IP,{collapseSitemapTree:()=>VK});function RP(t){return{id:t.id,label:t.label,metadata:{...t.metadata},children:t.children.map(RP),parentId:t.parentId,isContainer:t.isContainer,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color}}}function VK(t,e){if(e.size===0)return{parsed:t,hiddenCounts:new Map};let{roots:n,hiddenCounts:r}=od(t.roots,e,AP),o=CP(t.roots,n,t.edges,e,AP,YK);return{parsed:{...t,roots:n,edges:o},hiddenCounts:r}}var AP,YK,PP=st(()=>{"use strict";yf();_P();AP={getId:t=>t.id,getChildren:t=>t.children,clone:RP,setChildren:(t,e)=>{t.children=e},countsAsHidden:t=>!t.isContainer},YK={getSource:t=>t.sourceId,getTarget:t=>t.targetId,withEndpoints:(t,e,n)=>({...t,sourceId:e,targetId:n})}});var OP={};ye(OP,{renderSitemap:()=>GP,renderSitemapForExport:()=>n7});function KK(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function ZK(t,e){return e??t.primary}function QK(t,e,n){return n?Ot(n,or(t,e),10):Ot(t.surface,t.bg,40)}function JK(t,e){return e??t.textMuted}function GP(t,e,n,r,o,a,i,s,l,c){It(t).selectAll(":not([data-d3-tooltip])").remove();let d=i?.width??t.clientWidth,u=i?.height??t.clientHeight;if(d<=0||u<=0)return;let f=Ee.identity(),p=f.aesthetic(zK),m=f.text(13),g=f.text(11),h=f.structural(16),S=f.structural(28),y=f.structural(6),b=f.structural(1.5),E=f.structural(1.5),x=f.text(jK),N=f.text(13),L=f.text(11),A=f.structural(16),C=f.structural(28),k=f.text(20),w=f.structural(XK),v=f.structural(6),M=f.aesthetic(qK),_=n.legend.length>0,T=Se+Bn,R=!!e.title&&e.options["no-title"]!=="on",O=!i&&_,I=O&&R,H=I?w:0,G=f.structural(O?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview",capsulePillAddonWidth:Co+wi},d):Se),D=O?G+M:0,W=H+D,V=0,P=!I&&R?w:0,F=n.width,Y=n.height+P;O&&(Y-=T);let z=u-p*2-W-V,j=(d-p*2)/F,K=z/Y,$=Math.min(UK,j,K),U=F*$,X=(d-U)/2,q=p+W,et=It(t).append("svg").attr("width",d).attr("height",u).attr("viewBox",`0 0 ${d} ${u}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);f.isBelowFloor&&et.attr("width","100%");let tt=et.append("defs");tt.append("marker").attr("id","sm-arrow").attr("viewBox",`0 0 ${qs} ${Ai}`).attr("refX",qs).attr("refY",Ai/2).attr("markerWidth",qs).attr("markerHeight",Ai).attr("orient","auto").append("polygon").attr("points",`0,0 ${qs},${Ai/2} 0,${Ai}`).attr("fill",r.textMuted);let B=new Set;for(let J of B){let at=`sm-arrow-${J.replace("#","")}`;tt.append("marker").attr("id",at).attr("viewBox",`0 0 ${qs} ${Ai}`).attr("refX",qs).attr("refY",Ai/2).attr("markerWidth",qs).attr("markerHeight",Ai).attr("orient","auto").append("polygon").attr("points",`0,0 ${qs},${Ai/2} 0,${Ai}`).attr("fill",J)}let Q=et.append("g").attr("transform",`translate(${X}, ${q}) scale(${$})`);if(!I&&R){let J=Q.append("text").attr("x",F/2).attr("y",k).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").attr("class","sitemap-title chart-title");e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}let ot=O?-T:0,Z=Q.append("g").attr("transform",`translate(0, ${P+ot})`),lt=new Map,nt=new Map;for(let J of e.tagGroups){lt.set(qt(J.name),J.name);for(let at of J.entries)nt.set(`${qt(J.name)}:${at.value.toLowerCase()}`,at.color)}for(let J of n.containers){let at=Z.append("g").attr("transform",`translate(${J.x}, ${J.y})`).attr("class","sitemap-container").attr("data-line-number",String(J.lineNumber));if(J.hasChildren&&at.attr("data-node-toggle",J.nodeId).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)).attr("aria-label",J.label),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let At=qt(s),rt=J.tagMetadata[At];rt&&at.attr(`data-tag-${At}`,rt.toLowerCase())}let it=QK(r,o,J.color),Lt=JK(r,J.color);at.append("rect").attr("x",0).attr("y",0).attr("width",J.width).attr("height",J.height).attr("rx",8).attr("fill",it).attr("stroke",Lt).attr("stroke-opacity",.35).attr("stroke-width",E),at.append("text").attr("x",J.width/2).attr("y",C/2+N/2-2).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",N).attr("font-weight","bold").text(J.label);let Tt=Object.entries(J.metadata);if(Tt.length>0){let At=Tt.map(([dt])=>lt.get(dt)??dt),pt=10+Math.max(...At.map(dt=>_t(`${dt}: `,L))),gt=C+L-2;for(let dt=0;dt<Tt.length;dt++){let[ut,yt]=Tt[dt],vt=At[dt],Gt=gt+dt*A,Xt=nt.get(`${ut}:${yt.toLowerCase()}`)??r.text;at.append("text").attr("x",10).attr("y",Gt).attr("fill",r.textMuted).attr("font-size",L).text(`${vt}: `),at.append("text").attr("x",pt).attr("y",Gt).attr("fill",Xt).attr("font-size",L).text(yt)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let At=`clip-${J.nodeId}`;at.append("clipPath").attr("id",At).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",8),at.append("rect").attr("y",J.height-v).attr("width",J.width).attr("height",v).attr("fill",Lt).attr("clip-path",`url(#${At})`).attr("class","sitemap-collapse-bar")}}for(let J of n.edges){if(J.points.length<2)continue;let at=Z.append("g").attr("class","sitemap-edge-group").attr("data-line-number",String(J.lineNumber)).attr("data-from",J.sourceId).attr("data-to",J.targetId),it=r.textMuted,Lt="sm-arrow",At=(J.deferred?e7:t7)(J.points);if(At&&at.append("path").attr("d",At).attr("fill","none").attr("stroke",it).attr("stroke-width",b).attr("marker-end",`url(#${Lt})`).attr("class","sitemap-edge"),J.label&&J.points.length>=2){let rt=J.points[Math.floor(J.points.length/2)],pt=_t(J.label,x)+10,gt=x+6;at.append("rect").attr("x",rt.x-pt/2).attr("y",rt.y-gt/2-1).attr("width",pt).attr("height",gt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","sitemap-edge-label-bg"),at.append("text").attr("x",rt.x).attr("y",rt.y+4).attr("text-anchor","middle").attr("fill",it).attr("font-size",x).attr("class","sitemap-edge-label").text(J.label)}}for(let J of n.nodes){let at=Z.append("g").attr("transform",`translate(${J.x-J.width/2}, ${J.y})`).attr("class","sitemap-node").attr("data-line-number",String(J.lineNumber)).attr("data-node-id",J.id);if(J.hasChildren&&at.attr("data-node-toggle",J.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!J.hiddenCount)),a&&at.style("cursor","pointer").on("click",()=>a(J.lineNumber)),s){let pt=qt(s),gt=J.tagMetadata[pt];gt&&at.attr(`data-tag-${pt}`,gt.toLowerCase())}let it=e.options["solid-fill"]==="on",Lt=KK(r,o,J.color,it),Tt=ZK(r,J.color),At=Le(Lt,r.textOnFillLight,r.textOnFillDark);td(at,{width:J.width,height:J.height,rx:6,fill:Lt,stroke:Tt,strokeWidth:E,label:J.label,labelColor:At,labelFontSize:m,headerHeight:S});let rt=Object.entries(J.metadata);if(rt.length>0){at.append("line").attr("x1",0).attr("y1",S).attr("x2",J.width).attr("y2",S).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let pt=rt.map(([ut])=>lt.get(ut)??ut),dt=10+Math.max(...pt.map(ut=>_t(`${ut}: `,g)));for(let ut=0;ut<rt.length;ut++){let[yt,vt]=rt[ut],Gt=pt[ut],Xt=S+y+(ut+1)*h-4,bt=nt.get(`${yt}:${vt.toLowerCase()}`),Mt=it?At:bt??At;at.append("text").attr("x",10).attr("y",Xt).attr("fill",At).attr("font-size",g).text(`${Gt}:`),at.append("text").attr("x",dt).attr("y",Xt).attr("fill",Mt).attr("font-size",g).text(vt)}}if(J.description&&J.description.length>0){let pt=Object.keys(J.metadata).length,gt=pt>0?S+y+pt*h:S;at.append("line").attr("x1",0).attr("y1",gt).attr("x2",J.width).attr("y2",gt).attr("stroke",it?At:Tt).attr("stroke-opacity",.3);let dt=S+y+pt*h;for(let ut=0;ut<J.description.length;ut++){let yt=ea(J.description[ut]),vt=dt+(ut+1)*h-4,Gt=at.append("text").attr("x",10).attr("y",vt).attr("fill",At).attr("font-size",g);bn(Gt,yt,r,g)}}if(!i&&J.hiddenCount&&J.hiddenCount>0){let pt=`clip-${J.id}`;at.append("clipPath").attr("id",pt).append("rect").attr("width",J.width).attr("height",J.height).attr("rx",6),at.append("rect").attr("y",J.height-v).attr("width",J.width).attr("height",v).attr("fill",it?At:J.color??r.primary).attr("opacity",.5).attr("clip-path",`url(#${pt})`)}}if(i&&_&&DP(Z,n.legend,r,o,s,void 0,l,c),I){let J=et.append("text").attr("x",d/2).attr("y",p+k).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",k).attr("font-weight","700").attr("class","sitemap-title chart-title").style("font-family",Pt);e.titleLineNumber&&(J.attr("data-line-number",e.titleLineNumber),a&&J.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))),J.text(e.title)}if(O){let J=et.append("g").attr("class","sitemap-legend-fixed").attr("transform",`translate(0, ${p+H})`);s&&J.attr("data-legend-active",s.toLowerCase()),DP(J,n.legend,r,o,s,d,l,c)}}function DP(t,e,n,r,o,a,i,s){if(e.length===0)return;let l=e.map(p=>({name:p.name,entries:p.entries.map(m=>({value:m.value,color:m.color}))})),c=a!=null,d=c?Co+wi:0,u=a??e[0].x+(e[0].width??200),f=mn(t,{groups:l,activeGroup:o??null,mode:s?"export":"preview",capsulePillAddonWidth:d,palette:n,isDark:r,width:u});if(t.selectAll("[data-legend-group]").classed("sitemap-legend-group",!0),c){let p=f.getLayout();if(p.activeCapsule?.addonX!=null){let m=p.activeCapsule,g=qt(m.groupName),h=i?.has(g)??!1,S=t.select(`[data-legend-group="${g}"]`);if(!S.empty()){let y=m.addonX,b=(Se-Co)/2,E=6,x=S.append("g").attr("class","sitemap-legend-eye").attr("data-legend-visibility",g).style("cursor","pointer").attr("opacity",h?.4:.7);x.append("rect").attr("x",y-E).attr("y",b-E).attr("width",Co+E*2).attr("height",Co+E*2).attr("fill","transparent").attr("pointer-events","all"),x.append("path").attr("d",h?Rm:Am).attr("transform",`translate(${y}, ${b})`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2).attr("stroke-linecap","round").attr("stroke-linejoin","round")}}}}async function n7(t,e,n){let{parseSitemap:r}=await Promise.resolve().then(()=>(qu(),j0)),{layoutSitemap:o}=await Promise.resolve().then(()=>(KE(),qE)),{getPalette:a}=await Promise.resolve().then(()=>(Va(),yx)),i=e==="dark",s=n??(i?a("nord").dark:a("nord").light),l=r(t,s);if(l.error||l.roots.length===0)return"";let c=o(l,void 0,null,void 0,!0),d=20,u=l.title?30:0,f=c.width+d*2,p=c.height+d*2+u,m=document.createElement("div");m.style.width=`${f}px`,m.style.height=`${p}px`,m.style.position="absolute",m.style.left="-9999px",document.body.appendChild(m),GP(m,l,c,s,i,void 0,{width:f,height:p});let g=m.querySelector("svg");if(!g)return document.body.removeChild(m),"";e==="transparent"?g.style.background="none":g.style.background||(g.style.background=s.bg),g.setAttribute("xmlns","http://www.w3.org/2000/svg"),g.style.fontFamily=Pt;let h=g.outerHTML;return document.body.removeChild(m),h}var zK,UK,XK,qs,Ai,jK,qK,t7,e7,$P=st(()=>{"use strict";je();qn();So();an();tn();Ro();Za();en();Tr();Br();_o();mr();Dg();zK=20,UK=3,XK=30,qs=10,Ai=7,jK=11,qK=8;t7=Qn().x(t=>t.x).y(t=>t.y).curve(fo),e7=Qn().x(t=>t.x).y(t=>t.y).curve(ji)});function oh(t){return t.toLowerCase()===r7}var r7,HP=st(()=>{"use strict";r7="archive"});var XP={};ye(XP,{renderKanban:()=>UP,renderKanbanForExport:()=>o7});function ph(t,e,n){let r=[];for(let o of e){if(n?.includes(o.name.toLowerCase()))continue;let i=t.tags[qt(o.name)]??o.defaultValue;if(!i)continue;let s=o.entries.find(l=>l.value.toLowerCase()===i.toLowerCase());r.push({label:o.name,value:i,...s?.color!==void 0&&{color:s.color}})}return r}function VP(t,e,n){if(!n)return t.color;let r=e.find(s=>s.name.toLowerCase()===n.toLowerCase());if(!r)return t.color;let a=t.tags[qt(r.name)]??r.defaultValue;return a?r.entries.find(s=>s.value.toLowerCase()===a.toLowerCase())?.color:void 0}function zP(t,e,n,r,o=Ef,a=ch,i=dh,s=JE,l=ah,c=ih,d=lh,u=md,f=pd,p=fd,m=ud,g=uh,h=sh,S=ZE,y=Sf,b=fh){let x=!!t.title&&t.options["no-title"]!=="on"?a+8:0,N=o+x,L=[],A=0,C=t.columns.filter(M=>!oh(M.name));for(let M of C){if(n?.has(M.id)??!1){L.push({x:0,y:N,width:b,height:0,column:M,cardLayouts:[]});continue}let T=_t(M.name,s),R=[],O=l+c;for(let G of M.cards){let D=_t(G.title,i);T=Math.max(T,D+d*2);let W=ph(G,t.tagGroups,r),V=W.length+G.details.length,P=V>0?f+1+u+V*p:0,F=m+u+P;for(let Y of W){let z=_t(`${Y.label}: ${Y.value}`,g)+d*2;T=Math.max(T,z)}R.push({x:c,y:O,width:0,height:F,card:G}),O+=F+h}let I=Math.max(S,T+c*2);for(let G of R)G.width=I-c*2;let H=O+c;A=Math.max(A,H),L.push({x:0,y:N,width:I,height:H,column:M,cardLayouts:R})}let k=o;for(let M of L)M.x=k,M.height=A,k+=M.width+y;let w=k-y+o,v=N+A+o;return{columns:L,totalWidth:w,totalHeight:v}}function UP(t,e,n,r,o){let a=o?.exportDims,i=o?.activeTagGroup??null,s=o?.onSwimlaneChange,l=o?.collapsedLanes,c=o?.collapsedColumns??new Set(e.columns.filter(B=>B.collapsed).map(B=>B.id)),d=o?.compactMeta??!1,u=e.options["solid-fill"]==="on",f=o?.currentSwimlaneGroup??null,p=f?e.tagGroups.find(B=>B.name.toLowerCase()===f.toLowerCase())??null:null,m=[];d&&(i&&m.push(i.toLowerCase()),f&&m.push(f.toLowerCase()));let g=e.columns.filter(B=>!oh(B.name)),h=Math.max(1,g.length),S=h*ZE+(h-1)*Sf+2*Ef,y=a?.width??t.getBoundingClientRect().width,b=a||y<=0?Ee.identity():Ee.from(y,S),E=b.aesthetic(Ef),x=b.aesthetic(Sf),N=b.structural(ah),L=b.aesthetic(ih),A=b.structural(ZE),C=b.structural(ud),k=b.structural(fd),w=b.structural(pd),v=b.aesthetic(sh),M=b.structural(6),_=b.aesthetic(lh),T=b.aesthetic(md),R=b.structural(QE),O=b.structural(ch),I=b.text(JE),H=b.text(dh),G=b.text(uh),D=b.text(FP),W=b.structural(BP),V=b.structural(YP),P=b.structural(fh),F=b.structural(t1),Y=b.text(20),z=b.structural(e1),j=b.aesthetic(n1),K=zP(e,n,c,m,E,O,H,I,N,L,_,T,w,k,C,G,v,A,x,P),$=a?.width??K.totalWidth,U=a?.height??K.totalHeight;t.innerHTML="";let X=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",$).attr("height",U).attr("viewBox",`0 0 ${$} ${U}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",Pt).style("background",n.bg);b.isBelowFloor&&X.attr("width","100%");let q=!!e.title&&e.options["no-title"]!=="on";if(q&&X.append("text").attr("class","chart-title").attr("data-line-number",e.titleLineNumber??0).attr("x",E).attr("y",E+Y).attr("font-size",Y).attr("font-weight","700").attr("fill",n.text).text(e.title),e.tagGroups.length>0){let B=q?Fe(e.title,Y)+16:0,Q=E+B,ot={groups:e.tagGroups,position:{placement:"top-center",titleRelation:"inline-with-title"},mode:o?.exportMode?"export":"preview"},Z=Cr(ot,$-Q-E),lt=E+(Y-Z)/2,nt=X.append("g").attr("class","kanban-legend").attr("transform",`translate(${Q},${lt})`),at=!!s&&!a?{onGroupRendered:(it,Lt,Tt)=>{let At=p?.name.toLowerCase()===it.toLowerCase(),rt=Fe(it,11),pt=Tt?10+rt+6:8+rt+4,gt=(Se-7)/2,dt=a7(Lt,pt,gt,At,n);dt.append("title").text(`Group by ${it}`),dt.style("cursor","pointer").on("click",ut=>{ut.stopPropagation(),s?.(At?null:it)})}}:void 0;mn(nt,{...ot,palette:n,isDark:r,width:$-Q-E,activeGroup:i??null,...at!==void 0&&{callbacks:at}})}if(p){l7(X,e,K,p,n,r,i,l,c,m,E,O,z,x,P,N,L,C,T,v,F,j,w,k,I,W,V,D,M,_,R,H,G);return}let et=r?Ot(n.surface,n.bg,50):Ot(n.surface,n.bg,30),tt=r?Ot(n.surface,n.bg,70):Ot(n.surface,n.bg,50);for(let B of K.columns){let Q=B.column,ot=c?.has(Q.id)??!1,Z=X.append("g").attr("class","kanban-column").attr("data-column-id",Q.id).attr("data-line-number",Q.lineNumber),lt=et,nt=Q.color?ie(n,Q.color,r,{solid:u}):tt,J=Q.color?Le(nt,n.textOnFillLight,n.textOnFillDark):n.text;if(ot){Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",P).attr("height",B.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",P).attr("height",N).attr("rx",V).attr("fill",nt),Z.append("text").attr("x",B.x+P/2).attr("y",B.y+N/2+D/2-1).attr("font-size",D).attr("font-weight","bold").attr("fill",Q.color?J:n.textMuted).attr("text-anchor","middle").text(String(Q.cards.length)),Z.append("text").attr("x",B.x+P/2).attr("y",B.y+N+L).attr("font-size",H).attr("font-weight","bold").attr("fill",n.text).attr("text-anchor","middle").attr("writing-mode","tb").text(Q.name);continue}Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",B.width).attr("height",B.height).attr("rx",W).attr("fill",lt),Z.append("rect").attr("x",B.x).attr("y",B.y).attr("width",B.width).attr("height",N).attr("rx",V).attr("fill",nt),Z.append("text").attr("x",B.x+L).attr("y",B.y+N/2+I/2-2).attr("font-size",I).attr("font-weight","bold").attr("fill",J).text(Q.name);{let at=Q.wipLimit!=null&&Q.cards.length>Q.wipLimit,it=Q.wipLimit!=null?`${Q.cards.length}/${Q.wipLimit}`:String(Q.cards.length);Z.append("text").attr("x",B.x+B.width-L).attr("y",B.y+N/2+D/2-1).attr("text-anchor","end").attr("font-size",D).attr("fill",at?n.colors.red:Q.color?J:n.textMuted).attr("font-weight",at?"bold":"normal").text(it)}for(let at of B.cardLayouts){let it=at.card,Lt=VP(it,e.tagGroups,i??null),Tt=ph(it,e.tagGroups,m),At=Tt.length>0||it.details.length>0,rt=ie(n,Lt??n.primary,r,{solid:u}),pt=Lt??n.textMuted,gt=Le(rt,n.textOnFillLight,n.textOnFillDark),dt=Z.append("g").attr("class","kanban-card").attr("data-card-id",it.id).attr("data-line-number",it.lineNumber);if(i){let Gt=qt(i),Xt=it.tags[Gt],bt=e.tagGroups.find(zt=>zt.name.toLowerCase()===Gt),Mt=Xt??bt?.defaultValue;Mt&&dt.attr(`data-tag-${Gt}`,Mt.toLowerCase())}let ut=B.x+at.x,yt=B.y+at.y;dt.append("rect").attr("x",ut).attr("y",yt).attr("width",at.width).attr("height",at.height).attr("rx",M).attr("fill",rt).attr("stroke",pt).attr("stroke-width",R);let vt=dt.append("text").attr("x",ut+_).attr("y",yt+T+H).attr("font-size",H).attr("font-weight","500").attr("fill",gt);if(bn(vt,it.title,n,H),At){let Gt=yt+C;dt.append("line").attr("x1",ut).attr("y1",Gt).attr("x2",ut+at.width).attr("y2",Gt).attr("stroke",u?gt:pt).attr("stroke-opacity",.3).attr("stroke-width",1);let Xt=Gt+w+G;for(let bt of Tt){dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",G).attr("fill",gt).text(`${bt.label}: `);let Mt=_t(`${bt.label}: `,G);dt.append("text").attr("x",ut+_+Mt).attr("y",Xt).attr("font-size",G).attr("fill",gt).text(bt.value),Xt+=k}for(let bt of it.details){let Mt=dt.append("text").attr("x",ut+_).attr("y",Xt).attr("font-size",G).attr("fill",gt);bn(Mt,bt,n,G),Xt+=k}}}}}function o7(t,e,n){let r=zc(t,n);if(r.error||r.columns.length===0)return"";let o=e==="dark",a=zP(r,n),i=document.createElement("div");return UP(i,r,n,o,{exportDims:{width:a.totalWidth,height:a.totalHeight},exportMode:!0}),i.querySelector("svg")?.outerHTML??""}function a7(t,e,n,r,o){let a=t.append("g").attr("class","kanban-swimlane-icon").attr("transform",`translate(${e}, ${n})`);a.append("rect").attr("x",-5).attr("y",-5).attr("width",22).attr("height",18).attr("fill","transparent");let i=r?o.primary:o.textMuted,s=r?1:.35,l=[8,12,6],c=2,d=3;for(let u=0;u<l.length;u++)a.append("rect").attr("x",0).attr("y",u*d).attr("width",l[u]).attr("height",c).attr("rx",1).attr("fill",i).attr("opacity",s);return a}function i7(t,e){let n=qt(e.name),r=new Map;for(let a of e.entries)r.set(a.value.toLowerCase(),{laneName:a.value,laneColor:a.color,isFallback:!1,cellsByColumn:{}});let o=`__no_${n}__`;for(let a of t)for(let i of a.cards){let s=i.tags[n]??e.defaultValue,l;s&&r.has(s.toLowerCase())?l=s.toLowerCase():(r.has(o)||r.set(o,{laneName:`No ${e.name}`,isFallback:!0,cellsByColumn:{}}),l=o);let c=r.get(l);(c.cellsByColumn[a.id]??=[]).push(i)}return Array.from(r.values())}function WP(t,e,n,r=pd,o=md,a=fd,i=ud){let l=ph(t,e,n).length+t.details.length,c=l>0?r+1+o+l*a:0;return i+o+c}function s7(t,e,n,r,o,a,i=Ef,s=ch,l=e1,c=Sf,d=fh,u=ah,f=ih,p=ud,m=md,g=sh,h=t1,S=n1,y=pd,b=fd){let E=t.title&&t.options["no-title"]!=="on"?s+8:0,x=i+E,N=[],L=i+l;for(let M of n.columns){let T=o?.has(M.column.id)??!1?d:M.width;N.push({column:M.column,x:L,width:T}),L+=T+c}let A=L-c+i,C=[],k=x+u+f,w=p+m+g;for(let M of e){if(r?.has(M.laneName)??!1){let H=N.map(G=>({column:G.column,cards:M.cellsByColumn[G.column.id]??[],cardLayouts:[]}));C.push({bucket:M,y:k,height:h,cells:H}),k+=h+S;continue}let T=w,R=[];for(let H of N){let G=o?.has(H.column.id)??!1,D=M.cellsByColumn[H.column.id]??[];if(G){R.push({column:H.column,cards:D,h:0});continue}let W=0;for(let V of D)W+=WP(V,t.tagGroups,a,y,m,b,p)+g;W=Math.max(W-(D.length>0?g:0),0),R.push({column:H.column,cards:D,h:W}),W>T&&(T=W)}let O=Math.max(T,w),I=R.map((H,G)=>{let D=N[G];if(o?.has(D.column.id)??!1)return{column:H.column,cards:H.cards,cardLayouts:[]};let V=[],P=0;for(let F of H.cards){let Y=WP(F,t.tagGroups,a,y,m,b,p);V.push({x:D.x+f,y:k+P,width:D.width-f*2,height:Y,card:F}),P+=Y+g}return{column:H.column,cards:H.cards,cardLayouts:V}});C.push({bucket:M,y:k,height:O,cells:I}),k+=O+S}let v=k-S+f+i;return{columnXs:N,lanes:C,totalWidth:A,totalHeight:v,startY:x}}function l7(t,e,n,r,o,a,i,s,l,c,d=Ef,u=ch,f=e1,p=Sf,m=fh,g=ah,h=ih,S=ud,y=md,b=sh,E=t1,x=n1,N=pd,L=fd,A=JE,C=BP,k=YP,w=FP,v=6,M=lh,_=QE,T=dh,R=uh){let O=e.columns.filter(P=>!oh(P.name)),I=i7(O,r),H=s7(e,I,n,s,l,c,d,u,f,p,m,g,h,S,y,b,E,x,N,L),G=parseFloat(t.attr("width")||"0"),D=parseFloat(t.attr("height")||"0");H.totalWidth>G&&(t.attr("width",H.totalWidth),t.attr("viewBox",`0 0 ${H.totalWidth} ${Math.max(D,H.totalHeight)}`)),H.totalHeight>D&&(t.attr("height",H.totalHeight),t.attr("viewBox",`0 0 ${Math.max(G,H.totalWidth)} ${H.totalHeight}`));let W=a?Ot(o.surface,o.bg,50):Ot(o.surface,o.bg,30),V=a?Ot(o.surface,o.bg,70):Ot(o.surface,o.bg,50);for(let P of H.columnXs){let F=P.column,Y=l?.has(F.id)??!1,z=t.append("g").attr("class","kanban-column kanban-column-header").attr("data-column-id",F.id).attr("data-line-number",F.lineNumber),j=F.color?ie(o,F.color,a,{solid:e.options["solid-fill"]==="on"}):V;if(z.append("rect").attr("x",P.x).attr("y",H.startY).attr("width",P.width).attr("height",g).attr("rx",k).attr("fill",j),Y)z.append("text").attr("x",P.x+P.width/2).attr("y",H.startY+g/2+w/2-1).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String(F.cards.length));else{z.append("text").attr("x",P.x+h).attr("y",H.startY+g/2+A/2-2).attr("font-size",A).attr("font-weight","bold").attr("fill",o.text).text(F.name);let K=F.wipLimit!=null&&F.cards.length>F.wipLimit,$=F.wipLimit!=null?`${F.cards.length}/${F.wipLimit}`:String(F.cards.length);z.append("text").attr("x",P.x+P.width-h).attr("y",H.startY+g/2+w/2-1).attr("text-anchor","end").attr("font-size",w).attr("fill",K?o.colors.red:o.textMuted).attr("font-weight",K?"bold":"normal").text($)}}for(let P of H.lanes){let F=s?.has(P.bucket.laneName)??!1,Y=t.append("g").attr("class","kanban-lane").attr("data-lane-name",P.bucket.laneName),z=Y.append("g").attr("class","kanban-lane-header").attr("transform",`translate(${d}, ${P.y-h})`);z.append("rect").attr("x",0).attr("y",0).attr("width",f-8).attr("height",P.height+h*2).attr("rx",C).attr("fill",W);let j=10,K=P.cells.reduce(($,U)=>$+U.cards.length,0);if(P.bucket.laneColor&&(z.append("circle").attr("cx",j+4).attr("cy",16).attr("r",4).attr("fill",P.bucket.laneColor),j+=14),F?z.append("text").attr("x",j).attr("y",20).attr("font-size",10).attr("fill",o.textMuted).text(`${P.bucket.laneName} (${K})`):z.append("text").attr("x",j).attr("y",20).attr("font-size",12).attr("font-weight","bold").attr("fill",P.bucket.isFallback?o.textMuted:o.text).text(P.bucket.laneName),F)for(let $ of P.cells){let U=l?.has($.column.id)??!1;if($.cards.length>0){let X=H.columnXs.find(tt=>tt.column.id===$.column.id);if(!X)continue;let q=P.bucket.laneColor?Ot(P.bucket.laneColor,o.bg,a?40:28):Ot(o.textMuted,o.bg,a?28:22),et=U?m-8:X.width-h*2;Y.append("rect").attr("x",X.x+(U?4:h)).attr("y",P.y).attr("width",et).attr("height",18).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+(U?4:h)+et/2).attr("y",P.y+13).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}}if(Y.append("line").attr("x1",d+f).attr("x2",H.totalWidth-d).attr("y1",P.y+P.height+h).attr("y2",P.y+P.height+h).attr("stroke",o.border??o.textMuted).attr("stroke-opacity",.4).attr("stroke-width",1),!F)for(let $ of P.cells){if((l?.has($.column.id)??!1)&&$.cards.length>0){let X=H.columnXs.find(q=>q.column.id===$.column.id);if(X){let q=P.bucket.laneColor?Ot(P.bucket.laneColor,o.bg,a?40:28):Ot(o.textMuted,o.bg,a?28:22);Y.append("rect").attr("x",X.x+4).attr("y",P.y).attr("width",m-8).attr("height",22).attr("rx",4).attr("fill",q),Y.append("text").attr("x",X.x+m/2).attr("y",P.y+16).attr("font-size",w).attr("font-weight","bold").attr("fill",o.textMuted).attr("text-anchor","middle").text(String($.cards.length))}continue}for(let X of $.cardLayouts)c7(Y,X,e.tagGroups,i,o,a,c,e.options["solid-fill"]==="on",v,M,y,_,T,R,S,N,L)}}}function c7(t,e,n,r,o,a,i,s,l=6,c=lh,d=md,u=QE,f=dh,p=uh,m=ud,g=pd,h=fd){let S=e.card,y=VP(S,n,r),b=ph(S,n,i),E=b.length>0||S.details.length>0,x=ie(o,y??o.primary,a,{...s!==void 0&&{solid:s}}),N=y??o.textMuted,L=Le(x,o.textOnFillLight,o.textOnFillDark),A=t.append("g").attr("class","kanban-card").attr("data-card-id",S.id).attr("data-line-number",S.lineNumber);if(r){let v=qt(r),M=n.find(T=>T.name.toLowerCase()===v),_=S.tags[v]??M?.defaultValue;_&&A.attr(`data-tag-${v}`,_.toLowerCase())}let C=e.x,k=e.y;A.append("rect").attr("x",C).attr("y",k).attr("width",e.width).attr("height",e.height).attr("rx",l).attr("fill",x).attr("stroke",N).attr("stroke-width",u);let w=A.append("text").attr("x",C+c).attr("y",k+d+f).attr("font-size",f).attr("font-weight","500").attr("fill",L);if(bn(w,S.title,o,f),E){let v=k+m;A.append("line").attr("x1",C).attr("y1",v).attr("x2",C+e.width).attr("y2",v).attr("stroke",N).attr("stroke-opacity",.3).attr("stroke-width",1);let M=v+g+p;for(let _ of b){A.append("text").attr("x",C+c).attr("y",M).attr("font-size",p).attr("fill",o.textMuted).text(`${_.label}: `);let T=_t(`${_.label}: `,p);A.append("text").attr("x",C+c+T).attr("y",M).attr("font-size",p).attr("fill",L).text(_.value),M+=h}for(let _ of S.details){let T=A.append("text").attr("x",C+c).attr("y",M).attr("font-size",p).attr("fill",o.textMuted);bn(T,_,o,p),M+=h}}}var Ef,Sf,ah,ih,ZE,ud,fd,pd,sh,lh,md,QE,ch,JE,dh,uh,FP,BP,YP,fh,t1,e1,n1,jP=st(()=>{"use strict";je();qn();an();tn();Ro();ug();HP();Tr();_o();Br();mr();en();Ef=20,Sf=16,ah=36,ih=12,ZE=200,ud=24,fd=14,pd=4,sh=8,lh=10,md=6,QE=1.5,ch=30,JE=13,dh=12,uh=10,FP=10,BP=8,YP=8,fh=40,t1=26;e1=140,n1=14});var KP={};ye(KP,{layoutClassDiagram:()=>o1});function g7(t){let e=t.members.filter(d=>!d.isMethod),n=t.members.filter(d=>d.isMethod),r=t.modifier==="enum",o=_t(t.name,p7);t.modifier&&(o=Math.max(o,_t(`\xAB${t.modifier}\xBB`,qP)));for(let d of t.members){let u=d.name;d.isMethod?(u+=`(${d.params??""})`,d.type&&(u+=`: ${d.type}`)):d.type&&(u+=`: ${d.type}`),u=`+ ${u}`,o=Math.max(o,_t(u,qP))}let a=Math.max(d7,o+u7),i=f7+(t.modifier?m7:0),s;if(r){let d=t.members;d.length>0?s=gd*2+d.length*r1+hd:s=hd+gd}else e.length>0?s=gd*2+e.length*r1+hd:s=hd+gd;let l=0;r||(n.length>0?l=gd*2+n.length*r1+hd:l=hd+gd);let c=i+s+l;return{width:a,height:c,headerHeight:i,fieldsHeight:s,methodsHeight:l}}function o1(t,e){if(t.classes.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new rr.graphlib.Graph;n.setGraph({rankdir:"TB",nodesep:60,ranksep:80,edgesep:20}),n.setDefaultEdgeLabel(()=>({}));let r=new Map;for(let x of t.classes){let N=g7(x);r.set(x.id,N),n.setNode(x.id,{label:x.name,width:N.width,height:N.height})}for(let x of t.relationships)n.setEdge(x.source,x.target,{label:x.label??""});rr.layout(n);let a=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.classes.map(x=>({id:x.id,label:x.name}))),i=Dc(t.classes.map(x=>{let N=n.node(x.id);return{id:x.id,x:N.x,y:N.y,width:N.width,height:N.height}}),a,"TB",e?.collapsedNotes),s=t.classes.map(x=>{let N=n.node(x.id),L=r.get(x.id),A=i.get(x.id);return{...x,x:N.x,y:N.y,width:L.width,height:L.height,headerHeight:L.headerHeight,fieldsHeight:L.fieldsHeight,methodsHeight:L.methodsHeight,...A&&{note:A}}}),l=t.relationships.map(x=>{let N=n.edge(x.source,x.target);return{source:x.source,target:x.target,type:x.type,points:N?.points??[],...x.label!==void 0&&{label:x.label},lineNumber:x.lineNumber}}),c=1/0,d=1/0,u=-1/0,f=-1/0,p=(x,N,L,A)=>{x<c&&(c=x),N<d&&(d=N),L>u&&(u=L),A>f&&(f=A)};for(let x of s)p(x.x-x.width/2,x.y-x.height/2,x.x+x.width/2,x.y+x.height/2),x.note&&!x.note.collapsed&&p(x.x+x.note.x,x.y+x.note.y,x.x+x.note.x+x.note.width,x.y+x.note.y+x.note.height);Number.isFinite(c)||(c=0,d=0,u=0,f=0);let{shiftX:m,shiftY:g}=Gs(c,d),h=m!==0||g!==0,S=h?s.map(x=>({...x,x:x.x+m,y:x.y+g})):s,y=h?l.map(x=>({...x,points:x.points.map(N=>({x:N.x+m,y:N.y+g}))})):l,b=u+m+40,E=f+g+40;return{nodes:S,edges:y,width:b,height:E}}var d7,u7,f7,p7,qP,m7,r1,gd,hd,a1=st(()=>{"use strict";os();en();Zi();d7=140,u7=24,f7=36,p7=13,qP=11,m7=16,r1=18,gd=8,hd=1});var nD={};ye(nD,{renderClassDiagram:()=>eD,renderClassDiagramForExport:()=>R7});function JP(t,e,n){if(n)return e.textMuted;switch(t){case"interface":return e.colors.blue;case"abstract":return e.colors.purple;case"enum":return e.colors.yellow;default:return e.colors.teal}}function L7(t,e,n,r,o,a){let i=r??JP(n,t,o);return ie(t,i,e,{...a!==void 0&&{solid:a}})}function v7(t,e,n,r){return n??JP(e,t,r)}function tD(t){if(t.options?.["no-auto-color"])return[];let e=new Set;for(let n of t.classes)n.color||e.add(n.modifier??"class");return M7.filter(n=>e.has(n)).map(n=>N7[n])}function k7(t){return t??"class"}function QP(t){switch(t){case"public":return"+";case"private":return"-";case"protected":return"#"}}function C7(t){return t==="implements"||t==="depends"}function _7(t){switch(t){case"extends":return"cd-arrow-inherit";case"implements":return"cd-arrow-implement";case"composes":return"cd-arrow-compose";case"aggregates":return"cd-arrow-aggregate";case"depends":return"cd-arrow-depend";case"associates":return"cd-arrow-assoc"}}function A7(t){return t==="composes"||t==="aggregates"}function eD(t,e,n,r,o,a,i,s,l){It(t).selectAll(":not([data-d3-tooltip])").remove();let c=i?.width??t.clientWidth,d=i?.height??t.clientHeight;if(c<=0||d<=0)return;let u=Ee.identity(),f=u.aesthetic(i1),p=u.text(y7),m=u.text(b7),g=u.text(x7),h=u.structural(1.5),S=u.structural(1.5),y=u.structural(w7),b=u.structural(E7),E=u.structural(S7),x=u.text(20),N=u.structural(30),L=u.structural(Se),A=tD(e),C=A.length>1,k=!!e.title&&e.options["no-title"]!=="on",w=k?40:0,M=u.aesthetic(8),_=C?L+M:0,T=n.width,R=n.height,O=d-w-_,I=(c-f*2)/T,H=(O-f*2)/R,G=Math.min(h7,I,H),D=T*G,W=(c-D)/2,V=w+_+f,P=It(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt);u.isBelowFloor&&P.attr("width","100%");let F=P.append("defs"),Y=12,z=8;F.append("marker").attr("id","cd-arrow-inherit").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-implement").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polygon").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1);let j=12,K=8;if(F.append("marker").attr("id","cd-arrow-compose").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.textMuted).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-aggregate").attr("viewBox",`0 0 ${j} ${K}`).attr("refX",0).attr("refY",K/2).attr("markerWidth",j).attr("markerHeight",K).attr("orient","auto").append("polygon").attr("points",`${j/2},0 ${j},${K/2} ${j/2},${K} 0,${K/2}`).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1),F.append("marker").attr("id","cd-arrow-depend").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),F.append("marker").attr("id","cd-arrow-assoc").attr("viewBox",`0 0 ${Y} ${z}`).attr("refX",Y).attr("refY",z/2).attr("markerWidth",Y).attr("markerHeight",z).attr("orient","auto").append("polyline").attr("points",`0,0 ${Y},${z/2} 0,${z}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5),k){let X=P.append("text").attr("class","chart-title").attr("x",c/2).attr("y",N).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",x).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(X.attr("data-line-number",e.titleLineNumber),a&&X.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let $=s!==!1;if(C){let X=[{name:ZP,entries:A.map(et=>({value:et.label,color:r.colors[et.colorKey]}))}],q=P.append("g").attr("class","cd-legend").attr("transform",`translate(0,${w})`);mn(q,{groups:X,activeGroup:$?ZP:null,mode:l?"export":"preview",palette:r,isDark:o,width:c})}let U=P.append("g").attr("transform",`translate(${W}, ${V}) scale(${G})`);for(let X of n.edges){if(X.points.length<2)continue;let q=U.append("g").attr("class","cd-edge-group").attr("data-line-number",String(X.lineNumber)).attr("data-source",X.source).attr("data-target",X.target),et=r.textMuted,tt=_7(X.type),B=C7(X.type),Q=A7(X.type),ot=T7(X.points);if(ot){let Z=q.append("path").attr("d",ot).attr("fill","none").attr("stroke",et).attr("stroke-width",h).attr("class","cd-edge");B&&Z.attr("stroke-dasharray","6 3"),Q?Z.attr("marker-start",`url(#${tt})`):Z.attr("marker-end",`url(#${tt})`)}if(X.label){let Z=Math.floor(X.points.length/2),lt=X.points[Z],nt=_t(X.label,g)+8,J=16;q.append("rect").attr("x",lt.x-nt/2).attr("y",lt.y-J/2-1).attr("width",nt).attr("height",J).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","cd-edge-label-bg"),q.append("text").attr("x",lt.x).attr("y",lt.y+4).attr("text-anchor","middle").attr("fill",et).attr("font-size",g).attr("class","cd-edge-label").text(X.label)}}for(let X of n.nodes){let q=U.append("g").attr("transform",`translate(${X.x}, ${X.y})`).attr("class","cd-class").attr("data-line-number",String(X.lineNumber)).attr("data-node-id",X.id).attr("data-cd-type",k7(X.modifier));a&&q.style("cursor","pointer").on("click",()=>{a(X.lineNumber)});let et=X.width,tt=X.height,B=!!e.options?.["no-auto-color"],ot=C&&!$&&!X.color?r.primary:X.color,Z=e.options?.["solid-fill"]==="on",lt=L7(r,o,X.modifier,ot,B,Z),nt=v7(r,X.modifier,ot,B),J=Le(lt,r.textOnFillLight,r.textOnFillDark);q.append("rect").attr("x",-et/2).attr("y",-tt/2).attr("width",et).attr("height",tt).attr("rx",3).attr("ry",3).attr("fill",lt).attr("stroke",nt).attr("stroke-width",S);let at=-tt/2,it=at+X.headerHeight/2;if(X.modifier){let rt=`\xAB${X.modifier}\xBB`;q.append("text").attr("x",0).attr("y",it-6).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).attr("font-style","italic").text(rt),q.append("text").attr("x",0).attr("y",it+10).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").attr("font-style",X.modifier==="abstract"?"italic":"normal").text(X.name)}else q.append("text").attr("x",0).attr("y",it).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",J).attr("font-size",p).attr("font-weight","bold").text(X.name);at+=X.headerHeight;let Lt=X.modifier==="enum",Tt=X.members.filter(rt=>!rt.isMethod),At=X.members.filter(rt=>rt.isMethod);if(Lt){q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5);let rt=at+b;for(let pt of X.members)q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m).text(pt.name),rt+=y}else{if(q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),Tt.length>0){let rt=at+b;for(let pt of Tt){let dt=`${QP(pt.visibility)} ${pt.name}`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}if(at+=X.fieldsHeight,q.append("line").attr("x1",-et/2).attr("y1",at).attr("x2",et/2).attr("y2",at).attr("stroke",Z?J:nt).attr("stroke-width",.5).attr("stroke-opacity",.5),At.length>0){let rt=at+b;for(let pt of At){let dt=`${QP(pt.visibility)} ${pt.name}(${pt.params??""})`;pt.type&&(dt+=`: ${pt.type}`);let ut=q.append("text").attr("x",-et/2+E).attr("y",rt+y/2).attr("dominant-baseline","central").attr("fill",J).attr("font-size",m);pt.isStatic&&ut.attr("text-decoration","underline"),ut.text(dt),rt+=y}}}if(X.note)if(X.note.collapsed)vi(q,{x:et/2-Vo-3,y:-tt/2+Vo+3},r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber});else{let[rt,pt,gt,dt]=Si({width:et,height:tt},X.note);Ei(q,rt,pt,gt,dt,r),Li(q,{x:X.note.x,y:X.note.y,width:X.note.width,height:X.note.height},X.note.lines,r,{isDark:o,...X.note.color&&{color:X.note.color},lineNumber:X.note.lineNumber,endLineNumber:X.note.endLineNumber,interactive:!0})}}}function R7(t,e,n){let r=Hc(t,n);if(r.error||r.classes.length===0)return"";let o=o1(r),a=e==="dark",l=tD(r).length>1?Se+8:0,c=o.width+i1*2,d=o.height+i1*2+(r.title?40:0)+l;return ad(c,d,u=>(eD(u,r,o,n,a,void 0,{width:c,height:d},!0,!0),id(u,e)))}var i1,h7,y7,b7,x7,w7,E7,S7,N7,M7,ZP,T7,rD=st(()=>{"use strict";qn();So();an();Zg();Tr();Br();tn();Uu();a1();mr();en();Ni();i1=20,h7=3,y7=13,b7=11,x7=11,w7=18,E7=8,S7=10;N7={class:{label:"Class",colorKey:"teal"},abstract:{label:"Abstract",colorKey:"purple"},interface:{label:"Interface",colorKey:"blue"},enum:{label:"Enum",colorKey:"yellow"}},M7=["class","abstract","interface","enum"];ZP="Type";T7=Qn().x(t=>t.x).y(t=>t.y).curve(fo)});var aD={};ye(aD,{layoutERDiagram:()=>c1});function F7(t){let e=_t(t.name,P7);for(let i of t.columns){let s=i.name;i.type&&(s+=`: ${i.type}`);let l=_t(s,D7);i.constraints.length>0&&(l+=O7),e=Math.max(e,l)}let n=Math.max(s1,e+I7),r=l1,o=0;t.columns.length>0&&(o=H7*2+t.columns.length*$7+W7);let a=r+o+(o===0?4:0);return{width:n,height:a,headerHeight:r,columnsHeight:o}}function B7(t,e){let n=new Map;for(let a of t)n.set(a,new Set);for(let a of e)n.get(a.source)?.add(a.target),n.get(a.target)?.add(a.source);let r=new Set,o=[];for(let a of t){if(r.has(a))continue;let i=[],s=[a];for(;s.length>0;){let l=s.shift();if(!r.has(l)){r.add(l),i.push(l);for(let c of n.get(l)??[])r.has(c)||s.push(c)}}o.push(i)}return o}function Y7(t,e,n){let r=new Map,o=new Map;if(t.length===1){let d=t[0],u=n.get(d.id);return r.set(d.id,{x:u.width/2,y:u.height/2,...u}),{nodePositions:r,edgePoints:o,width:u.width,height:u.height}}let a=new rr.graphlib.Graph({multigraph:!0});a.setGraph({rankdir:"LR",nodesep:40,ranksep:80,edgesep:20}),a.setDefaultEdgeLabel(()=>({}));for(let d of t){let u=n.get(d.id);a.setNode(d.id,{width:u.width,height:u.height})}for(let d of e)a.setEdge(d.source,d.target,{label:d.label??""},String(d.lineNumber));rr.layout(a);let i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of t){let u=a.node(d.id),f=n.get(d.id);i=Math.min(i,u.x-f.width/2),s=Math.min(s,u.y-f.height/2),l=Math.max(l,u.x+f.width/2),c=Math.max(c,u.y+f.height/2)}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));for(let f of u?.points??[])i=Math.min(i,f.x),s=Math.min(s,f.y),l=Math.max(l,f.x),c=Math.max(c,f.y);if(d.label&&(u?.points??[]).length>0){let f=u.points,p=f[Math.floor(f.length/2)],m=(_t(d.label,G7)+8)/2;i=Math.min(i,p.x-m),l=Math.max(l,p.x+m)}}for(let d of t){let u=a.node(d.id),f=n.get(d.id);r.set(d.id,{x:u.x-i,y:u.y-s,...f})}for(let d of e){let u=a.edge(d.source,d.target,String(d.lineNumber));o.set(d.lineNumber,(u?.points??[]).map(f=>({x:f.x-i,y:f.y-s})))}return{nodePositions:r,edgePoints:o,width:Math.max(0,l-i),height:Math.max(0,c-s)}}function V7(t){if(t.length===0)return[];let e=[...t].sort((l,c)=>{let d=l.compIds.length>1?1:0,u=c.compIds.length>1?1:0;return d!==u?u-d:c.compLayout.height-l.compLayout.height}),n=t.reduce((l,c)=>l+(c.compLayout.width||s1)*(c.compLayout.height||l1),0),r=Math.max(Math.sqrt(n)*1.5,e[0].compLayout.width),o=[],a=0,i=0,s=0;for(let l of e){let c=l.compLayout.width||s1,d=l.compLayout.height||l1;a>0&&a+c>r&&(i+=s+oD,a=0,s=0),o.push({compIds:l.compIds,compLayout:l.compLayout,offsetX:a,offsetY:i}),a+=c+oD,s=Math.max(s,d)}return o}function c1(t,e){if(t.tables.length===0)return{nodes:[],edges:[],width:0,height:0};let n=new Map;for(let C of t.tables)n.set(C.id,F7(C));let r=B7(t.tables.map(C=>C.id),t.relationships),o=new Map(t.tables.map(C=>[C.id,C])),a=r.map(C=>{let k=C.map(v=>o.get(v)),w=t.relationships.filter(v=>C.includes(v.source));return{compIds:C,compLayout:Y7(k,w,n)}}),i=V7(a),s=new Map;for(let C of i)for(let k of C.compIds)s.set(k,C);let l=new Map;for(let C of i)for(let k of C.compLayout.edgePoints.keys())l.set(k,C);let c=t.tables.map(C=>{let k=s.get(C.id),w=k.compLayout.nodePositions.get(C.id);return{...C,x:w.x+k.offsetX+yd,y:w.y+k.offsetY+yd,width:w.width,height:w.height,headerHeight:w.headerHeight,columnsHeight:w.columnsHeight}}),d=t.relationships.map(C=>{let k=l.get(C.lineNumber),w=k?.compLayout.edgePoints.get(C.lineNumber)??[];return{source:C.source,target:C.target,cardinality:C.cardinality,points:w.map(v=>({x:v.x+(k?.offsetX??0)+yd,y:v.y+(k?.offsetY??0)+yd})),...C.label!==void 0&&{label:C.label},lineNumber:C.lineNumber}}),f=t.options?.["no-notes"]==="on"||!t.notes?new Map:no(t.notes,t.tables.map(C=>({id:C.id,label:C.name}))),p=Dc(c.map(C=>({id:C.id,x:C.x,y:C.y,width:C.width,height:C.height})),f,"TB",e?.collapsedNotes),m=c.map(C=>{let k=p.get(C.id);return k?{...C,note:k}:C}),g=1/0,h=1/0,S=-1/0,y=-1/0,b=(C,k,w,v)=>{C<g&&(g=C),k<h&&(h=k),w>S&&(S=w),v>y&&(y=v)};for(let C of m)b(C.x-C.width/2,C.y-C.height/2,C.x+C.width/2,C.y+C.height/2),C.note&&!C.note.collapsed&&b(C.x+C.note.x,C.y+C.note.y,C.x+C.note.x+C.note.width,C.y+C.note.y+C.note.height);for(let C of d)for(let k of C.points)b(k.x,k.y,k.x,k.y);Number.isFinite(g)||(g=0,h=0,S=0,y=0);let{shiftX:E,shiftY:x}=Gs(g,h),N=E!==0||x!==0,L=N?m.map(C=>({...C,x:C.x+E,y:C.y+x})):m,A=N?d.map(C=>({...C,points:C.points.map(k=>({x:k.x+E,y:k.y+x}))})):d;return{nodes:L,edges:A,width:S+E+yd,height:y+x+yd}}var s1,I7,l1,P7,D7,G7,O7,$7,H7,W7,yd,oD,d1=st(()=>{"use strict";os();en();Zi();s1=140,I7=24,l1=36,P7=13,D7=11,G7=11,O7=16,$7=18,H7=8,W7=1,yd=30,oD=60});function lD(t,e){let n=new Map;if(t.length===0)return n;let r={};for(let f of t)r[f.id]=0;for(let f of e)f.source!==f.target&&(f.cardinality.from==="1"&&f.cardinality.to!=="1"&&(r[f.source]=(r[f.source]??0)+1),f.cardinality.to==="1"&&f.cardinality.from!=="1"&&(r[f.target]=(r[f.target]??0)+1));let o=new Map;for(let f of e)f.source!==f.target&&(f.cardinality.from==="*"&&(o.has(f.source)||o.set(f.source,new Set),o.get(f.source).add(f.target)),f.cardinality.to==="*"&&(o.has(f.target)||o.set(f.target,new Set),o.get(f.target).add(f.source)));let a=new Set;for(let[f,p]of o)p.size>=2&&a.add(f);let i=Object.values(r),s=i.reduce((f,p)=>f+p,0)/i.length,l=i.reduce((f,p)=>f+(p-s)**2,0)/i.length,c=Math.sqrt(l),d=[...i].sort((f,p)=>f-p),u=d.length%2===0?(d[d.length/2-1]+d[d.length/2])/2:d[Math.floor(d.length/2)];for(let f of t){let p=f.id,m=f.columns,g=m.filter(M=>M.constraints.includes("fk")),h=m.filter(M=>M.constraints.includes("pk")&&M.constraints.includes("fk")),S=g.length,y=m.length===0?0:S/m.length,b=r[p]??0,E=f.name.toLowerCase(),x=e.filter(M=>(M.source===p||M.target===p)&&M.source!==M.target),N=e.some(M=>M.source===p&&M.target===p),L=new Set;for(let M of x)L.add(M.source===p?M.target:M.source);if(N&&x.length===0){n.set(p,"self-referential");continue}let A=h.length>=2&&L.size===1,C=y>=.6&&!A,k=h.length>=2&&L.size>=2,w=a.has(p);if(C||k||w){n.set(p,"junction");continue}if(y>=.4&&y<.6&&h.length<2&&!a.has(p)){n.set(p,"ambiguous");continue}if(z7.some(M=>E.endsWith(M))&&m.length<=6&&S<=1&&b>u){n.set(p,"lookup");continue}if(t.length>=6&&b>0&&b>s+1.5*c&&b>=2*s){n.set(p,"hub");continue}if(S>0){n.set(p,"dependent");continue}n.set(p,"core")}return n}var u1,iD,sD,z7,cD=st(()=>{"use strict";u1={core:"green",dependent:"blue",junction:"red",ambiguous:"purple",lookup:"yellow",hub:"orange","self-referential":"teal",unclassified:"gray"},iD={core:"Core entity",dependent:"Dependent",junction:"Junction / M:M",ambiguous:"Bridge",lookup:"Lookup / Reference",hub:"Hub","self-referential":"Self-referential",unclassified:"Unclassified"},sD=["core","dependent","junction","ambiguous","lookup","hub","self-referential","unclassified"],z7=["_type","_status","_code","_category"]});var pD={};ye(pD,{renderERDiagram:()=>fD,renderERDiagramForExport:()=>tZ});function Q7(t){switch(t){case"pk":return"\u2666";case"fk":return"\u2192";case"unique":return"\u25C6";case"nullable":return"\u25CB"}}function dD(t,e,n,r,o,a,i=uD,s=1.5){let l=e.x-n.x,c=e.y-n.y,d=Math.sqrt(l*l+c*c);if(d===0)return;let u=l/d,f=c/d,p=-f,m=u,g=s+.5;if(a){let b=e.x-u*15,E=e.y-f*15,x=r==="1"?"1":r==="*"?"*":"0..1";t.append("text").attr("x",b+p*12).attr("y",E+m*12).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",o).attr("font-size",i).text(x);return}let h=14,S=9;if(r==="1"){let y=e.x-u*h,b=e.y-f*h;t.append("line").attr("x1",y+p*S).attr("y1",b+m*S).attr("x2",y-p*S).attr("y2",b-m*S).attr("stroke",o).attr("stroke-width",g)}else if(r==="*"){let E=e.x-u*18,x=e.y-f*18,N=e.x-u*5,L=e.y-f*5;t.append("line").attr("x1",E).attr("y1",x).attr("x2",N+p*S).attr("y2",L+m*S).attr("stroke",o).attr("stroke-width",g),t.append("line").attr("x1",E).attr("y1",x).attr("x2",N-p*S).attr("y2",L-m*S).attr("stroke",o).attr("stroke-width",g),t.append("line").attr("x1",E).attr("y1",x).attr("x2",N).attr("y2",L).attr("stroke",o).attr("stroke-width",g)}else if(r==="?"){let b=h+10+2,E=e.x-u*b,x=e.y-f*b;t.append("circle").attr("cx",E).attr("cy",x).attr("r",5).attr("fill","none").attr("stroke",o).attr("stroke-width",g);let N=e.x-u*h,L=e.y-f*h;t.append("line").attr("x1",N+p*S).attr("y1",L+m*S).attr("x2",N-p*S).attr("y2",L-m*S).attr("stroke",o).attr("stroke-width",g)}}function fD(t,e,n,r,o,a,i,s,l,c){It(t).selectAll(":not([data-d3-tooltip])").remove();let d=e.tagGroups.length===0&&n.nodes.every(z=>!z.color),u=8,f=e.tagGroups.length>0,p=d?Se+u:f?Se+u:0,m=!!e.title&&e.options["no-title"]!=="on",g=m?40:0,h=n.width,S=n.height,y=Ee.identity(),b=y.aesthetic(f1),E=y.text(X7),x=y.text(j7),N=y.text(uD),L=y.structural(1.5),A=y.structural(1.5),C=y.structural(q7),k=y.structural(K7),w=y.structural(Z7),v=y.text(20),M=y.structural(30),_=h+b*2,T=S+g+p+b*2,R,O,I,H,G;if(i){R=i.width??_,O=i.height??T;let z=O-g-p,j=(R-b*2)/h,K=(z-b*2)/S;I=Math.min(U7,j,K);let $=h*I;H=(R-$)/2,G=g+p+b}else R=_,O=T,I=1,H=b,G=g+p+b;if(R<=0||O<=0)return;let D=It(t).append("svg").attr("width",i?R:"100%").attr("height",i?O:"100%").attr("viewBox",`0 0 ${R} ${O}`).attr("preserveAspectRatio","xMidYMid meet").style("font-family",Pt);if(m){let z=D.append("text").attr("class","chart-title").attr("x",R/2).attr("y",M).attr("text-anchor","middle").attr("fill",r.text).attr("font-size",v).attr("font-weight","700").style("cursor",a&&e.titleLineNumber?"pointer":"default").text(e.title);e.titleLineNumber&&(z.attr("data-line-number",e.titleLineNumber),a&&z.on("click",()=>a(e.titleLineNumber)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)}))}let W=D.append("g").attr("transform",`translate(${H}, ${G}) scale(${I})`),V=lr(r),P=d?lD([...e.tables],[...e.relationships]):null,F=P!==null&&(l??!0),Y=e.options.notation==="labels";for(let z of n.edges){if(z.points.length<2)continue;let j=W.append("g").attr("class","er-edge-group").attr("data-line-number",String(z.lineNumber)).attr("data-source",z.source).attr("data-target",z.target),K=r.textMuted,$=J7(z.points);$&&j.append("path").attr("d",$).attr("fill","none").attr("stroke",K).attr("stroke-width",L).attr("class","er-edge");let U=z.points;if(dD(j,U[0],U[1],z.cardinality.from,K,Y,N,L),dD(j,U[U.length-1],U[U.length-2],z.cardinality.to,K,Y,N,L),z.label){let X=Math.floor(U.length/2),q=U[X],et=_t(z.label,N)+8,tt=16;j.append("rect").attr("x",q.x-et/2).attr("y",q.y-tt/2-1).attr("width",et).attr("height",tt).attr("rx",3).attr("fill",r.bg).attr("opacity",.85).attr("class","er-edge-label-bg"),j.append("text").attr("x",q.x).attr("y",q.y+4).attr("text-anchor","middle").attr("fill",K).attr("font-size",N).attr("class","er-edge-label").text(z.label)}}for(let z=0;z<n.nodes.length;z++){let j=n.nodes[z],K=sr(j.metadata,[...e.tagGroups],s??null),$=F?r.colors[u1[P.get(j.id)??"unclassified"]]:P?r.primary:void 0,U=j.color??K??$??V[z%V.length],X=W.append("g").attr("transform",`translate(${j.x}, ${j.y})`).attr("class","er-table").attr("data-line-number",String(j.lineNumber)).attr("data-node-id",j.id);if(s){let lt=qt(s),nt=j.metadata[lt];nt&&X.attr(`data-tag-${lt}`,nt.toLowerCase())}if(P){let lt=P.get(j.id);lt&&X.attr("data-er-role",lt)}a&&X.style("cursor","pointer").on("click",()=>{a(j.lineNumber)});let q=j.width,et=j.height,tt=ie(r,U,o,{solid:e.options["solid-fill"]==="on"}),B=U,Q=Le(tt,r.textOnFillLight,r.textOnFillDark);X.append("rect").attr("x",-q/2).attr("y",-et/2).attr("width",q).attr("height",et).attr("rx",3).attr("ry",3).attr("fill",tt).attr("stroke",B).attr("stroke-width",A);let ot=-et/2,Z=ot+j.headerHeight/2;if(X.append("text").attr("x",0).attr("y",Z).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",Q).attr("font-size",E).attr("font-weight","bold").text(j.name),ot+=j.headerHeight,j.columns.length>0){X.append("line").attr("x1",-q/2).attr("y1",ot).attr("x2",q/2).attr("y2",ot).attr("stroke",B).attr("stroke-width",.5).attr("stroke-opacity",.5);let lt=ot+k;for(let nt of j.columns){let J=-q/2+w,at=nt.constraints[0];at&&X.append("text").attr("x",J).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(Q7(at));let it=-q/2+w+(at?16:0),Lt=nt.name;nt.type&&(Lt+=`: ${nt.type}`),X.append("text").attr("x",it).attr("y",lt+C/2).attr("dominant-baseline","central").attr("fill",Q).attr("font-size",x).text(Lt),lt+=C}}if(j.note)if(j.note.collapsed)vi(X,{x:q/2-Vo-3,y:-et/2+Vo+3},r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber});else{let[lt,nt,J,at]=Si({width:q,height:et},j.note);Ei(X,lt,nt,J,at,r),Li(X,{x:j.note.x,y:j.note.y,width:j.note.width,height:j.note.height},j.note.lines,r,{isDark:o,...j.note.color&&{color:j.note.color},lineNumber:j.note.lineNumber,endLineNumber:j.note.endLineNumber,interactive:!0})}}if(e.tagGroups.length>0){let z=b+g,j=D.append("g").attr("class","er-tag-legend").attr("transform",`translate(0,${z})`);mn(j,{groups:e.tagGroups,activeGroup:s??null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),j.selectAll("[data-legend-group]").classed("er-legend-group",!0)}if(P){let z=sD.filter(j=>{for(let K of P.values())if(K===j)return!0;return!1});if(z.length>0){let j=b+g,K=[{name:"Role",entries:z.map(U=>({value:iD[U],color:r.colors[u1[U]]}))}],$=D.append("g").attr("class","er-semantic-legend").attr("transform",`translate(0,${j})`);mn($,{groups:K,activeGroup:F?"Role":null,mode:c?"export":"preview",palette:r,isDark:o,width:R}),$.selectAll("[data-legend-group]").classed("er-legend-group",!0)}}}function tZ(t,e,n){let r=Wc(t,n);if(r.error||r.tables.length===0)return"";let o=c1(r),a=e==="dark",i=document.createElement("div"),s=o.width+f1*2,l=o.height+f1*2+(r.title&&r.options["no-title"]!=="on"?40:0);i.style.width=`${s}px`,i.style.height=`${l}px`,i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i);try{fD(i,r,o,n,a,void 0,{width:s,height:l},void 0,void 0,!0);let c=i.querySelector("svg");return c?(e==="transparent"&&(c.style.background="none"),c.setAttribute("xmlns","http://www.w3.org/2000/svg"),c.style.fontFamily=Pt,c.outerHTML):""}finally{document.body.removeChild(i)}}var f1,U7,X7,j7,uD,q7,K7,Z7,J7,mD=st(()=>{"use strict";je();qn();So();an();tn();Va();je();Tr();Br();mr();en();Ni();Xu();d1();cD();f1=20,U7=3,X7=13,j7=11,uD=11,q7=18,K7=8,Z7=10;J7=Qn().x(t=>t.x).y(t=>t.y).curve(fo)});var ED={};ye(ED,{renderBoxesAndLines:()=>wD,renderBoxesAndLinesForExport:()=>gZ});function uZ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t[r-1],a=t[r],i=r+1<t.length?t[r+1]:"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function mh(t,e,n){let r=e-xD*2,o=t.split(/(\s+|-)/),a=[];for(let s of o)!s||/^\s+$/.test(s)||s==="-"||a.push(...uZ(s));for(let s=nZ;s>=gh;s--){if(r<_t("MM",s))continue;let l=[],c="";for(let p of a){let m=c?`${c} ${p}`:p;_t(m,s)<=r?c=m:(c&&l.push(c),c=p)}c&&l.push(c);let d=p=>_t(p,s)<=r;if(l.length<=n&&l.every(d))return{lines:l,fontSize:s};if(l.length<=n)return{lines:l.map(m=>d(m)?m:nr(m,s,r)),fontSize:s};let u=l.slice(0,n).map(p=>d(p)?p:nr(p,s,r)),f=u[n-1];return f.endsWith("\u2026")||(u[n-1]=nr(f+"\u2026",s,r)),{lines:u,fontSize:s}}return{lines:[nr(t,gh,r)],fontSize:gh}}function fZ(t,e,n,r,o,a,i){let s=Ot(r.bg,r.text,o?90:95);if(a.active){if(t.value===void 0){let h=Le(s,r.textOnFillLight,r.textOnFillDark);return{fill:s,stroke:a.hue,text:h}}let f=a.fillForValue(t.value),p=ie(r,f,o,{...i!==void 0&&{solid:i}}),m=a.twoColor?f:a.hue,g=Le(p,r.textOnFillLight,r.textOnFillDark);return{fill:p,stroke:m,text:g}}let l=sr(t.metadata,[...e],n);if(l){let f=ie(r,l,o,{...i!==void 0&&{solid:i}}),p=l,m=Le(f,r.textOnFillLight,r.textOnFillDark);return{fill:f,stroke:p,text:m}}let c=Ot(r.bg,r.text,o?90:95),d=Ot(r.text,r.bg,o?60:40),u=r.text;return{fill:c,stroke:d,text:u}}function pZ(t,e,n,r){if(Object.keys(t.metadata).length>0&&n!=null){let a=sr(t.metadata,[...e],n);if(a)return a}return r.textMuted}function mZ(t,e){for(let n of e){let r=`bl-arrow-${n.replace("#","")}`;if(!t.select(`#${r}`).empty())continue;t.append("marker").attr("id",r).attr("viewBox",`0 0 ${Ks*2} ${Ri*2}`).attr("refX",Ks*2).attr("refY",Ri).attr("markerWidth",Ks).attr("markerHeight",Ri).attr("orient","auto").append("polygon").attr("points",`0,0 ${Ks*2},${Ri} 0,${Ri*2}`).attr("fill",n);let o=`bl-arrow-rev-${n.replace("#","")}`;t.select(`#${o}`).empty()&&t.append("marker").attr("id",o).attr("viewBox",`0 0 ${Ks*2} ${Ri*2}`).attr("refX",0).attr("refY",Ri).attr("markerWidth",Ks).attr("markerHeight",Ri).attr("orient","auto").append("polygon").attr("points",`${Ks*2},0 0,${Ri} ${Ks*2},${Ri*2}`).attr("fill",n)}}function wD(t,e,n,r,o,a){let{onClickItem:i,exportDims:s,activeTagGroup:l,hiddenTagValues:c,hideDescriptions:d,controlsExpanded:u,onToggleDescriptions:f,onToggleControlsExpand:p,exportMode:m=!1,controlsHost:g,rampDomain:h}=a??{};It(t).selectAll(":not([data-d3-tooltip])").remove();let S=s?.width??t.clientWidth,y=s?.height??t.clientHeight;if(S<=0||y<=0)return;let b=Ee.identity(),E=b.aesthetic(eZ),x=b.text(gh),N=b.text(rZ),L=b.structural(1.5),A=b.structural(1.5),C=b.structural(oZ),k=b.text(gD),w=b.text(iZ),v=b.structural(sZ),M=b.text(20),_=b.structural(30),T=e.nodes.filter(ft=>ft.value!==void 0).map(ft=>ft.value),R=T.length>0,O=h?.min??(R?Math.min(...T):0),I=h?.max??Math.max(...T),H=On(e.boxMetricColor??"",r)??r.primary,G=e.boxMetricLowColor?On(e.boxMetricLowColor,r)??void 0:void 0,D=o?Ot(r.surface,r.text,28):r.bg,W=Ot(H,D,p1),V=ft=>{let Wt=I>O?(ft-O)/(I-O):1;if(G!==void 0)return Kp(G,H,Wt,{isDark:o});let ge=p1+Math.max(0,Math.min(1,Wt))*(100-p1);return Ot(H,D,ge)},P=R?e.boxMetric?.trim()||"Value":null,F=ft=>{let Wt=ft.trim().toLowerCase();if(Wt===""||Wt==="none")return null;let ge=e.tagGroups.find(ne=>ne.name.toLowerCase()===Wt);return ge?ge.name:Wt===P?.toLowerCase()?P:ft},Y=l,z;Y!==void 0?z=Y===null?null:F(Y):e.options["active-tag"]!==void 0?z=F(e.options["active-tag"]):z=P??(e.tagGroups.length>0?e.tagGroups[0].name:null);let j=P!==null&&z===P,K=P!==null?{name:P,entries:[],gradient:{min:O,max:I,low:G??W,high:H}}:null,$=[...K?[K]:[],...e.tagGroups],U=e.nodes.some(ft=>ft.description&&ft.description.length>0),q=$.length>0||U&&g!=="app"?b.structural(Cr({groups:$,position:{placement:"top-center",titleRelation:"below-title"},mode:m?"export":"preview"},S)):0,et=c??e.initialHiddenTagValues,tt=new Map;for(let ft of e.nodes)tt.set(ft.label,ft);let B=new Map;for(let ft of n.nodes)B.set(ft.label,ft);let Q=!!e.title&&e.options["no-title"]!=="on",ot=Q?40:0,Z=e.nodes.some(ft=>ft.description&&ft.description.length>0),nt=$.length>0||Z&&f?q+8:0,J=new Set(n.groups.map(ft=>ft.label)),at=0;for(let ft of e.groups)ft.children.some(Wt=>J.has(Wt))&&(at+=v);let it=n.width,Lt=n.height+ot+nt+at,Tt=S/(it+E*2),At=y/(Lt+E*2),rt=Math.min(Tt,At,3),pt=0,gt=0;if(e.nodePositions&&e.nodePositions.size>0){let ft=1/0,Wt=1/0,ge=-1/0,ne=-1/0,se=(Zt,Ie)=>{Zt<ft&&(ft=Zt),Zt>ge&&(ge=Zt),Ie<Wt&&(Wt=Ie),Ie>ne&&(ne=Ie)};for(let Zt of n.nodes)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.groups)se(Zt.x-Zt.width/2,Zt.y-Zt.height/2),se(Zt.x+Zt.width/2,Zt.y+Zt.height/2);for(let Zt of n.edges)for(let Ie of Zt.points)se(Ie.x,Ie.y);Number.isFinite(ft)&&(pt=(n.width-ge-ft)/2,gt=(n.height-ne-Wt)/2)}let dt=(S-it*rt)/2+pt*rt,ut=E+ot+nt+gt*rt,yt=It(t).append("svg").attr("width",S).attr("height",y).attr("viewBox",`0 0 ${S} ${y}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt).style("background",r.bg);b.isBelowFloor&&yt.attr("width","100%");let vt=yt.append("defs");Q&&yt.append("text").attr("x",S/2).attr("y",_).attr("text-anchor","middle").attr("font-size",M).attr("font-weight","700").attr("fill",r.text).text(e.title);let Gt=yt.append("g").attr("transform",`translate(${dt},${ut}) scale(${rt})`),Xt=new Set,bt=new Map;for(let ft=0;ft<n.edges.length;ft++){let Wt=pZ(n.edges[ft],e.tagGroups,z,r);Xt.add(Wt),bt.set(ft,Wt)}mZ(vt,Xt);let Mt=[...n.groups].sort((ft,Wt)=>Wt.width*Wt.height-ft.width*ft.height),zt=new Set(n.groups.map(ft=>ft.label)),xt=new Set;for(let ft of e.groups)for(let Wt of ft.children)zt.has(Wt)&&xt.add(ft.label);for(let ft of Mt){let Wt=ft.x-ft.width/2,ge=!ft.collapsed&&xt.has(ft.label),ne=ge?ft.y-ft.height/2-v:ft.y-ft.height/2,se=ge?ft.height+v:ft.height,Zt=Gt.append("g").attr("class",ft.collapsed?"bl-group bl-group-collapsed":"bl-group").attr("data-line-number",String(ft.lineNumber)).attr("data-node-id",ft.label).attr("data-group-toggle",ft.label).style("cursor","pointer");if(ft.collapsed){let Ie=or(r,o),Ht=r.border;Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",Ie).attr("stroke",Ht).attr("stroke-width",A);let Qt=`bl-clip-${ft.label.replace(/[[\]\s]/g,"")}`;Zt.append("clipPath").attr("id",Qt).append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf),Zt.append("rect").attr("x",Wt).attr("y",ne+ft.height-C).attr("width",ft.width).attr("height",C).attr("fill",Ht).attr("clip-path",`url(#${Qt})`).attr("class","bl-collapse-bar");let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=mh(ft.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("class","bl-group-label").attr("x",ft.x).attr("y",ft.y-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",Pt).attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",r.text).text(fe.lines[ae])}else Zt.append("rect").attr("x",Wt).attr("y",ne).attr("width",ft.width).attr("height",se).attr("rx",yD).attr("ry",yD).attr("fill",Ot(r.surface,r.bg,40)).attr("stroke",r.textMuted).attr("stroke-width",1).attr("stroke-opacity",.35),Zt.append("text").attr("class","bl-group-label").attr("x",Wt+ft.width/2).attr("y",ne+18).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",w).attr("font-weight","600").attr("fill",r.text).text(ft.label)}for(let ft=0;ft<n.edges.length;ft++){let Wt=n.edges[ft],ge=bt.get(ft)??r.textMuted;if(et.size>0){let Qt=!1;for(let[Ut,fe]of et){let de=Wt.metadata[Ut];if(de&&fe.has(de.toLowerCase())){Qt=!0;break}}if(Qt)continue}if(Wt.source===Wt.target){let Qt=B.get(Wt.source);if(Qt){let Ut=Gt.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),fe=`bl-arrow-${ge.replace("#","")}`,de=Qt.x,te=Qt.y,ae=Qt.width/2,Te=Qt.height/2,Je=20,ln=de+ae,Ve=te+Te*.4,Ce=de+ae*.4,ee=te+Te,oe=ln+ae+Je,Be=Ve,fn=Ce,An=ee+Te+Je;Ut.append("path").attr("class","bl-edge").attr("d",`M ${ln} ${Ve} C ${oe} ${Be}, ${fn} ${An}, ${Ce} ${ee}`).attr("fill","none").attr("stroke",ge).attr("stroke-width",L).attr("marker-end",`url(#${fe})`)}continue}let ne;if(Wt.yOffset!==0&&Wt.parallelCount>1){let Qt=B.get(Wt.source),Ut=B.get(Wt.target),fe=Qt?.y??Wt.points[0]?.y??0,de=Ut?.y??Wt.points[Wt.points.length-1]?.y??0,te=Wt.points[0]?.x??0,ae=Wt.points[Wt.points.length-1]?.x??0,Te=(te+ae)/2,Je=(fe+de)/2;ne=[{x:te,y:fe},{x:te+(Te-te)*.3,y:fe+Wt.yOffset*.5},{x:Te,y:Je+Wt.yOffset},{x:ae-(ae-Te)*.3,y:de+Wt.yOffset*.5},{x:ae,y:de}]}else ne=Wt.points.map(Qt=>({x:Qt.x,y:Qt.y}));if(ne.length<2)continue;let se=Gt.append("g").attr("class","bl-edge-group").attr("data-line-number",String(Wt.lineNumber)).attr("data-from",Wt.source).attr("data-to",Wt.target),Zt=`bl-arrow-${ge.replace("#","")}`,Ie=Wt.straight?dZ:e.direction==="TB"?cZ:lZ,Ht=se.append("path").attr("class","bl-edge").attr("d",Ie(ne)??"").attr("fill","none").attr("stroke",ge).attr("stroke-width",L).attr("marker-end",`url(#${Zt})`);if(Wt.bidirectional){let Qt=`bl-arrow-rev-${ge.replace("#","")}`;Ht.attr("marker-start",`url(#${Qt})`)}}for(let ft of n.nodes){let Wt=tt.get(ft.label);if(!Wt)continue;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=Wt.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ge=e.options["solid-fill"]==="on",ne=fZ(Wt,e.tagGroups,z,r,o,{active:j,hue:H,twoColor:G!==void 0,fillForValue:V},ge),se=ge?ne.text:ne.stroke,Zt=Gt.append("g").attr("class","bl-node").attr("transform",`translate(${ft.x},${ft.y})`).attr("data-line-number",Wt.lineNumber).attr("data-node-id",Wt.label).style("cursor",i?"pointer":"default").style("--bl-node-stroke",ne.stroke);for(let[Ut,fe]of Object.entries(Wt.metadata))Zt.attr(`data-tag-${Ut.toLowerCase()}`,fe.toLowerCase());Wt.value!==void 0&&Zt.attr("data-value",Wt.value),i&&Zt.on("click",Ut=>{Ut.target?.closest("a")||i(Wt.lineNumber)});let Ie=-ft.width/2,Ht=-ft.height/2;Zt.append("rect").attr("x",Ie).attr("y",Ht).attr("width",ft.width).attr("height",ft.height).attr("rx",Lf).attr("ry",Lf).attr("fill",ne.fill).attr("stroke",ne.stroke).attr("stroke-width",A);let Qt=Wt.description;if(Qt&&Qt.length>0&&!d){let fe=mh(Wt.label,ft.width,3),de=fe.lines,te=fe.fontSize*1.3,ae=de.length*te,Te=ae+12,Je=-ft.height/2+Te/2;for(let Rn=0;Rn<de.length;Rn++)Zt.append("text").attr("x",0).attr("y",Je-ae/2+te/2+Rn*te).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(de[Rn]);let ln=-ft.height/2+Te;Zt.append("line").attr("x1",-ft.width/2).attr("y1",ln).attr("x2",ft.width/2).attr("y2",ln).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1);let Ve=ln+4+k,Ce=ft.width-xD*2,ee=Math.floor(Ce/(k*Bo)),oe=k*aZ,Be=Rn=>Rn.replace(/\[([^\]]+)\]\([^)]+\)/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/`(.+?)`/g,"$1").replace(/https?:\/\/\S+/g,Dn=>Dn.slice(0,20)).length,fn=[];for(let Rn of Qt){let Dn=Rn.startsWith("- ")?"\u2022 "+Rn.slice(2):Rn;Dn=Dn.replace(/\bhttps?\s+([\w][\w.-]+\.[a-z]{2,}(?:\/\S*)?)/gi,(Rr,dr)=>`https://${dr}`),fn.push(Dn)}let An=Ko(fn,ee,Be),We=An.length>hD,kn=We?An.slice(0,hD):An,Kn=-ft.width/2+6,xo=Kn+10,Lr=Ss(ne.fill)>.5?r.textMuted:Ot(ne.text,ne.fill,75);for(let Rn=0;Rn<kn.length;Rn++){let Dn=kn[Rn],Rr=Dn.text;We&&Rn===kn.length-1&&(Rr=_t(Rr,k)>=Ce?nr(Rr,k,Ce):Rr+"\u2026");let dr=Ve+Rn*oe;Dn.kind==="bullet-first"&&Zt.append("text").attr("x",Kn).attr("y",dr).attr("text-anchor","start").attr("dominant-baseline","central").attr("font-size",k).attr("fill",Lr).text("\u2022");let Ur=Dn.kind==="bullet-first"||Dn.kind==="bullet-cont",Jn=Zt.append("text").attr("x",Ur?xo:0).attr("y",dr).attr("text-anchor",Ur?"start":"middle").attr("dominant-baseline","central").attr("font-size",gD).attr("fill",Lr);bn(Jn,Rr,r,k)}if(We){let Rn=Qt.join(" "),Dn=Rn.length>200?Rn.slice(0,199)+"\u2026":Rn;Zt.append("title").text(Dn)}if(e.showValues&&Wt.value!==void 0){let Rn=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value);Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",Ve+kn.length*oe).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",bD).attr("font-weight","600").attr("fill",ne.text).text(Rn)}}else if(e.showValues&&Wt.value!==void 0){let Ut=e.boxMetric?`${e.boxMetric}: ${Wt.value}`:String(Wt.value),fe=ft.height/2,de=-ft.height/2+fe,te=mh(Wt.label,ft.width,2),ae=te.fontSize*1.3,Te=te.lines.length*ae,Je=-ft.height/2+fe/2;for(let ln=0;ln<te.lines.length;ln++)Zt.append("text").attr("x",0).attr("y",Je-Te/2+ae/2+ln*ae).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",te.fontSize).attr("font-weight","bold").attr("fill",ne.text).text(te.lines[ln]);Zt.append("line").attr("x1",-ft.width/2).attr("y1",de).attr("x2",ft.width/2).attr("y2",de).attr("stroke",se).attr("stroke-opacity",.3).attr("stroke-width",1),Zt.append("text").attr("class","bl-node-value").attr("x",0).attr("y",(de+ft.height/2)/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",bD).attr("fill",ne.text).attr("opacity",.85).text(Ut)}else{let Ut=Math.max(2,Math.floor((ft.height-16)/(x*1.3))),fe=mh(Wt.label,ft.width,Ut),de=fe.fontSize*1.3,te=fe.lines.length*de;for(let ae=0;ae<fe.lines.length;ae++)Zt.append("text").attr("x",0).attr("y",-te/2+de/2+ae*de).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",fe.fontSize).attr("font-weight","600").attr("fill",ne.text).text(fe.lines[ae])}if(ft.note)if(ft.note.collapsed)vi(Zt,{x:ft.width/2-Vo-3,y:-ft.height/2+Vo+3},r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber});else{let[Ut,fe,de,te]=Si({width:ft.width,height:ft.height},ft.note);Ei(Zt,Ut,fe,de,te,r),Li(Zt,{x:ft.note.x,y:ft.note.y,width:ft.note.width,height:ft.note.height},ft.note.lines,r,{isDark:o,...ft.note.color&&{color:ft.note.color},lineNumber:ft.note.lineNumber,endLineNumber:ft.note.endLineNumber,interactive:!0})}}let Nt=Gt.append("g").attr("class","bl-edge-labels"),Dt=N*1.3;for(let ft of n.edges){if(!ft.labelLines||ft.labelLines.length===0||ft.labelX===void 0||ft.labelY===void 0)continue;let Wt=ft.labelX,ge=ft.labelY;if(et.size>0){let Ut=!1;for(let[fe,de]of et){let te=ft.metadata[fe];if(te&&de.has(te.toLowerCase())){Ut=!0;break}}if(Ut)continue}let ne=ft.labelWidth??0,se=ft.labelHeight??N+6,Zt=ft.labelLines,Ie=Nt.append("g").attr("class","bl-edge-label").attr("data-line-number",String(ft.lineNumber));Ie.append("rect").attr("x",Wt-ne/2).attr("y",ge-se/2).attr("width",ne).attr("height",se).attr("rx",3).attr("fill",r.bg).attr("opacity",.72);let Ht=Ie.append("text").attr("x",Wt).attr("text-anchor","middle").attr("font-family",Pt).attr("font-size",N).attr("fill",r.textMuted),Qt=ge-(Zt.length-1)/2*Dt+N/3;Zt.forEach((Ut,fe)=>{Ht.append("tspan").attr("x",Wt).attr("y",Qt+fe*Dt).text(Ut)})}let Vt=e.nodes.some(ft=>ft.description&&ft.description.length>0);if($.length>0||Vt&&g!=="app"){let ft;Vt&&(f||g==="app")&&(ft={toggles:[{id:"descriptions",type:"toggle",label:"Descriptions",active:!d,onToggle:()=>{}}]});let Wt={...p!==void 0&&{onControlsExpand:p},onControlsToggle:(ne,se)=>{ne==="descriptions"&&f&&f(se)}},ge=yt.append("g").attr("transform",`translate(0,${ot+4})`);mn(ge,{groups:$,activeGroup:z,mode:m?"export":"preview",showInactivePills:!0,...ft!==void 0&&{controlsGroup:ft},...g!==void 0&&{controlsHost:g},...u!==void 0&&{controlsExpanded:u},callbacks:Wt,palette:r,isDark:o,width:S}),ge.selectAll("[data-legend-group]").classed("bl-legend-group",!0)}if(!s&&!m){let Wt=yt.append("g").attr("class","bl-focus-icon").attr("data-export-ignore","true").style("display","none").style("pointer-events","auto").style("cursor","pointer");Wt.append("rect").attr("x",-3).attr("y",-3).attr("width",20).attr("height",20).attr("fill","transparent");let ge=14/2,ne=14/2;Wt.append("circle").attr("cx",ge).attr("cy",ne).attr("r",14/2-1).attr("fill",r.bg).attr("stroke",r.textMuted).attr("stroke-width",1.5),Wt.append("circle").attr("cx",ge).attr("cy",ne).attr("r",2).attr("fill",r.textMuted)}}function gZ(t,e,n,r,o,a){wD(t,e,n,r,o,{...a?.exportDims!==void 0&&{exportDims:a.exportDims},...a?.activeTagGroup!==void 0&&{activeTagGroup:a.activeTagGroup},...a?.hiddenTagValues!==void 0&&{hiddenTagValues:a.hiddenTagValues},...a?.exportMode!==void 0&&{exportMode:a.exportMode}})}var eZ,nZ,gh,rZ,Lf,oZ,Ks,Ri,gD,aZ,hD,xD,yD,iZ,sZ,p1,bD,lZ,cZ,dZ,SD=st(()=>{"use strict";qn();Ni();So();an();Br();_o();tn();wr();je();Ro();Ds();mr();en();eZ=20,nZ=11,gh=9,rZ=11,Lf=8,oZ=4,Ks=5,Ri=4,gD=10,aZ=1.4,hD=6,xD=12,yD=8,iZ=14,sZ=32,p1=15,bD=11,lZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),cZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),dZ=Qn().x(t=>t.x).y(t=>t.y).curve(ji)});function h1(t,e=bh,n=ND){let r=Cn(t,e,n,{hardBreak:!0});if(r.length>m1){let a=r.slice(0,m1-1),i=r.slice(m1-1).join(" ");a.push(nr(i,e,n)),r=a}let o=0;for(let a of r){let i=_t(a,e);i>o&&(o=i)}return{lines:r,width:o+2*yZ,height:r.length*e*hZ+2*bZ}}function EZ(t){return g1(t,.5).p}function g1(t,e){if(t.length===0)return{p:{x:0,y:0},nx:0,ny:1};if(t.length===1)return{p:{x:t[0].x,y:t[0].y},nx:0,ny:1};let n=[],r=0;for(let i=1;i<t.length;i++){let s=Math.hypot(t[i].x-t[i-1].x,t[i].y-t[i-1].y);n.push(s),r+=s}let o=r*Math.max(0,Math.min(1,e));for(let i=1;i<t.length;i++){let s=n[i-1];if(o<=s||i===t.length-1){let l=s===0?0:Math.min(1,o/s),c=t[i-1].x,d=t[i-1].y,u=t[i].x,f=t[i].y,p=u-c,m=f-d,g=Math.hypot(p,m)||1;return{p:{x:c+p*l,y:d+m*l},nx:-m/g,ny:p/g}}o-=s}let a=t[t.length-1];return{p:{x:a.x,y:a.y},nx:0,ny:1}}function vD(t,e,n,r){return{minX:t-n/2,minY:e-r/2,maxX:t+n/2,maxY:e+r/2}}function yh(t,e,n,r,o,a){let i=t-n/2-a,s=e-r/2-a,l=t+n/2+a,c=e+r/2+a;for(let d of o)if(i<d.maxX&&l>d.minX&&s<d.maxY&&c>d.minY)return!0;return!1}function SZ(){let t=[.5];for(let e=1;e<=wZ;e++){let n=e*.08;.5-n>=.12&&t.push(.5-n),.5+n<=.88&&t.push(.5+n)}return t}function LZ(t,e,n,r){let o=SZ();for(let a of o){let{p:i}=g1(n,a);if(!yh(i.x,i.y,t,e,r,hh))return i}for(let a=LD;a<=xZ;a+=LD)for(let i of o){let{p:s,nx:l,ny:c}=g1(n,i);for(let d of[-1,1]){let u=s.x+l*a*d,f=s.y+c*a*d;if(!yh(u,f,t,e,r,hh))return{x:u,y:f}}}return null}function vZ(t){for(let r=0;r<8;r++){let o=!1;for(let a=0;a<t.length;a++)for(let i=a+1;i<t.length;i++){let s=t[a],l=t[i],c=Math.abs(s.cx-l.cx),d=Math.abs(s.cy-l.cy),u=(s.w+l.w)/2+4-c,f=(s.h+l.h)/2+4-d;if(u>0&&f>0){let p=f/2+1;s.cy<l.cy?(s.cy-=p,l.cy+=p):(s.cy+=p,l.cy-=p),o=!0}}if(!o)break}}function y1(t,e){let n=e?.fontSize??bh,r=e?.maxWidth??ND,o=[];for(let l of t.nodes)o.push(vD(l.x,l.y,l.width,l.height));for(let l of t.groups)l.collapsed&&o.push(vD(l.x,l.y,l.width,l.height));let a=[];t.edges.forEach((l,c)=>{if(!l.label||l.points.length<2)return;let d=h1(l.label,n,r),u=EZ(l.points),f=u.y;l.parallelCount>1&&l.yOffset!==0&&(f+=(l.yOffset<0?-1:1)*(d.height/2)),a.push({edgeIdx:c,cx:u.x,cy:f,w:d.width,h:d.height,lines:d.lines,resolved:!0})});for(let l of a){if(!yh(l.cx,l.cy,l.w,l.h,o,hh))continue;let c=t.edges[l.edgeIdx],d=LZ(l.w,l.h,c.points,o);d?(l.cx=d.x,l.cy=d.y):l.resolved=!1}vZ(a);for(let l of a)yh(l.cx,l.cy,l.w,l.h,o,hh)&&(l.resolved=!1);let i=new Map;for(let l of a)i.set(l.edgeIdx,l);let s=t.edges.map((l,c)=>{let d=i.get(c);return d?{...l,labelX:d.cx,labelY:d.cy,labelWidth:d.w,labelHeight:d.h,labelLines:d.lines}:l});return{layout:{...t,edges:s},unresolved:a.filter(l=>!l.resolved).map(l=>l.edgeIdx)}}var bh,ND,m1,hZ,yZ,bZ,hh,LD,xZ,wZ,b1=st(()=>{"use strict";en();bh=11,ND=160,m1=3,hZ=1.3,yZ=6,bZ=3,hh=4,LD=8,xZ=40,wZ=9});function AZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function MD(t,e,n){if(t.groups.length>0)return[];let r=t.nodes.length;if(r<3||r>40)return[];let o=t.direction==="TB",a=n?.nodesep??NZ,i=n?.ranksep??MZ,s=n?.backEdgeSide??"nearest",l=n?.restarts??(r<=14?28:r<=25?14:6),c=n?.keepK??3,d=t.nodes.map($=>$.label),u=new Set(d),f=t.edges.map(($,U)=>({e:$,i:U})).filter(({e:$})=>u.has($.source)&&u.has($.target)&&$.source!==$.target);if(f.length===0)return[];let p=new Map;for(let $ of d)p.set($,[]);for(let{e:$,i:U}of f)p.get($.source).push({to:$.target,idx:U});let m=new Set,g=new Map;for(let $ of d)g.set($,0);let h=$=>{g.set($,1);for(let{to:U,idx:X}of p.get($)){let q=g.get(U);q===1?m.add(X):q===0&&h(U)}g.set($,2)};for(let $ of d)g.get($)===0&&h($);let S=f.map(({e:$,i:U})=>m.has(U)?{from:$.target,to:$.source,idx:U,rev:!0}:{from:$.source,to:$.target,idx:U,rev:!1}),y=new Map,b=new Map;for(let $ of d)y.set($,[]),b.set($,0);for(let $ of S)y.get($.from).push($.to),b.set($.to,(b.get($.to)??0)+1);let E=new Map;for(let $ of d)E.set($,0);let x=d.filter($=>(b.get($)??0)===0),N=new Map(b),L=[];for(;x.length;){let $=x.shift();L.push($);for(let U of y.get($))E.set(U,Math.max(E.get(U),E.get($)+1)),N.set(U,N.get(U)-1),N.get(U)===0&&x.push(U)}if(L.length!==d.length)return[];let A=Math.max(...d.map($=>E.get($))),C=new Map;for(let $ of t.nodes){let U=e.get($.label)??{width:Ma,height:aa};C.set($.label,{id:$.label,dummy:!1,rank:E.get($.label),cross:0,thick:o?U.width:U.height,depth:o?U.height:U.width,realW:U.width,realH:U.height})}let k=[],w=[],v=[];for(let $ of S){if($.rev){v.push({edgeIdx:$.idx,src:$.to,tgt:$.from});continue}let U=E.get($.from),X=E.get($.to),q=[$.from],et=$.from;for(let tt=U+1;tt<X;tt++){let B=`__d${$.idx}_${tt}`;C.set(B,{id:B,dummy:!0,rank:tt,cross:0,thick:kZ,depth:0,realW:0,realH:0}),k.push({a:et,b:B}),q.push(B),et=B}k.push({a:et,b:$.to}),q.push($.to),w.push({edgeIdx:$.idx,chain:$.rev?q.slice().reverse():q})}let M=Array.from({length:A+1},()=>[]);for(let $ of C.values())M[$.rank].push($.id);let _=new Map,T=new Map;for(let $ of C.keys())_.set($,[]),T.set($,[]);for(let $ of k)T.get($.a).push($.b),_.get($.b).push($.a);let R=new Map,O=$=>{for(let U of C.keys())R.set(U,$.get(U))},I=$=>{if(!M[$+1])return 0;let X=[];for(let et of M[$]){let tt=R.get(et);for(let B of T.get(et))X.push({p:tt,q:R.get(B)})}let q=0;for(let et=0;et<X.length;et++)for(let tt=et+1;tt<X.length;tt++){let B=X[et],Q=X[tt];(B.p-Q.p)*(B.q-Q.q)<0&&q++}return q},H=()=>{let $=0;for(let U=0;U<A;U++)$+=I(U);return $},G=$=>{if($.length===0)return-1;$.sort((et,tt)=>et-tt);let U=Math.floor($.length/2);if($.length%2===1)return $[U];if($.length===2)return($[0]+$[1])/2;let X=$[U-1]-$[0],q=$[$.length-1]-$[U];return X+q===0?($[U-1]+$[U])/2:($[U-1]*q+$[U]*X)/(X+q)},D=($,U)=>{let X=M[$],q=U?_:T,et=new Map;for(let Z of X)et.set(Z,G(q.get(Z).map(lt=>R.get(lt))));let tt=X.filter(Z=>et.get(Z)>=0).sort((Z,lt)=>et.get(Z)-et.get(lt)),B=new Array(X.length).fill(null);for(let Z of X)et.get(Z)<0&&(B[R.get(Z)]=Z);let Q=0;for(let Z=0;Z<B.length;Z++)B[Z]===null&&(B[Z]=tt[Q++]);let ot=B;ot.forEach((Z,lt)=>R.set(Z,lt)),M[$]=ot},W=()=>{let $=!0,U=0;for(;$&&U++<12;){$=!1;for(let X=0;X<=A;X++){let q=M[X];for(let et=0;et<q.length-1;et++){let tt=(X>0?I(X-1):0)+(X<A?I(X):0),B=q[et],Q=q[et+1];q[et]=Q,q[et+1]=B,R.set(Q,et),R.set(B,et+1),(X>0?I(X-1):0)+(X<A?I(X):0)<tt?$=!0:(q[et]=B,q[et+1]=Q,R.set(B,et),R.set(Q,et+1))}}}},V=$=>{let U=$===0?null:AZ($);for(let X=0;X<=A;X++){let q=M[X].slice();if(U)for(let et=q.length-1;et>0;et--){let tt=Math.floor(U()*(et+1));[q[et],q[tt]]=[q[tt],q[et]]}M[X]=q,q.forEach((et,tt)=>R.set(et,tt))}},P=[];for(let $=0;$<l;$++){V($);let U=H(),X=new Map(R);for(let et=0;et<8;et++){if(et%2===0)for(let Q=1;Q<=A;Q++)D(Q,!0);else for(let Q=A-1;Q>=0;Q--)D(Q,!1);W();let B=H();if(B<U&&(U=B,X=new Map(R)),B===0)break}O(X);for(let et=0;et<=A;et++)M[et].sort((tt,B)=>R.get(tt)-R.get(B));let q=M.map(et=>et.join(",")).join("|");P.some(et=>et.sig===q)||P.push({sig:q,cross:U,order:new Map(X)})}P.sort(($,U)=>$.cross-U.cross);let F=P.slice(0,c);if(F.length===0)return[];let Y=[];for(let $ of F){O($.order);let U=Array.from({length:A+1},()=>[]);for(let X of C.values())U[X.rank].push(X.id);for(let X=0;X<=A;X++)U[X].sort((q,et)=>$.order.get(q)-$.order.get(et));Y.push(z(U))}return Y;function z($){let U=$.map(xt=>Math.max(0,...xt.map(Nt=>C.get(Nt).depth))),X=[],q=Bl;for(let xt=0;xt<=A;xt++)X[xt]=q+U[xt]/2,q+=U[xt]+i;for(let xt=0;xt<=A;xt++){let Nt=Bl;for(let Dt of $[xt]){let Vt=C.get(Dt);Vt.cross=Nt+Vt.thick/2,Nt+=Vt.thick+a}}let et=18;for(let xt=0;xt<et;xt++){let Dt=xt%2===0?Array.from({length:A+1},(Vt,$t)=>$t):Array.from({length:A+1},(Vt,$t)=>A-$t);for(let Vt of Dt){let $t=$[Vt],ft=$t.map(Wt=>{let ge=C.get(Wt),ne=0,se=0;for(let Zt of _.get(Wt)){let Ie=j(ge,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}for(let Zt of T.get(Wt)){let Ie=j(ge,C.get(Zt));ne+=Ie,se+=Ie*C.get(Zt).cross}return ne>0?se/ne:ge.cross});K($t,ft)}}let tt=1/0;for(let xt of C.values())tt=Math.min(tt,xt.cross-xt.thick/2);let B=Bl-tt;for(let xt of C.values())xt.cross+=B;let Q=xt=>o?{x:xt.cross,y:X[xt.rank]}:{x:X[xt.rank],y:xt.cross},ot=t.nodes.map(xt=>{let Nt=C.get(xt.label),Dt=Q(Nt);return{label:xt.label,x:Dt.x,y:Dt.y,width:Nt.realW,height:Nt.realH}}),Z=new Map;for(let xt of w)Z.set(xt.edgeIdx,xt.chain);let lt=1/0,nt=-1/0;for(let xt of C.values())xt.dummy||(lt=Math.min(lt,xt.cross-xt.thick/2),nt=Math.max(nt,xt.cross+xt.thick/2));let J=34,at=28,it=xt=>s==="left"?-1:s==="right"||C.get(xt.src).cross-C.get(xt.tgt).cross>=0?1:-1,Lt=v.map(xt=>({...xt,side:it(xt),span:Math.abs(C.get(xt.src).rank-C.get(xt.tgt).rank)})).sort((xt,Nt)=>xt.side-Nt.side||xt.span-Nt.span),Tt=new Map;for(let xt of Lt)Tt.set(xt.side,(Tt.get(xt.side)??0)+1);let At=new Map,rt=new Map,pt=xt=>Math.max(0,xt/2-6),gt=new Map,dt=new Map;{let xt=new Map;for(let Nt of Lt){let Dt=`${Nt.side}|${Nt.tgt}`,Vt=xt.get(Dt)??0;xt.set(Dt,Vt+1),gt.set(Nt.edgeIdx,Vt)}for(let[Nt,Dt]of xt)dt.set(Nt,Dt)}for(let xt of Lt){let Nt=xt.side,Dt=At.get(Nt)??0;At.set(Nt,Dt+1);let Vt=Tt.get(Nt),$t=C.get(xt.src),ft=C.get(xt.tgt),Wt=Nt>0?nt+J+Dt*at:lt-J-Dt*at,ge=X[$t.rank],ne=X[ft.rank],se=Vt>1?(Dt+1)/(Vt+1):0,Zt=ge+se*pt($t.depth),Ie=ne-se*pt(ft.depth),Ht=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae},Qt=10,Ut=$t.cross+Nt*($t.thick/2+Qt),fe=ft.cross+Nt*(ft.thick/2+Qt),de=gt.get(xt.edgeIdx),te=dt.get(`${Nt}|${xt.tgt}`);if(te>1&&de>0){let ae=ne-(ft.depth/2+J+(de-1)*at),Te=ft.cross+Nt*pt(ft.thick)*(de/te);rt.set(xt.edgeIdx,[Ht($t.cross,ge),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,ae),Ht(Te,ae),Ht(ft.cross,ne)])}else rt.set(xt.edgeIdx,[Ht($t.cross,ge),Ht(Ut,Zt),Ht(Wt,Zt),Ht(Wt,Ie),Ht(fe,Ie),Ht(ft.cross,ne)])}let ut=[];for(let xt=0;xt<t.edges.length;xt++){let Nt=t.edges[xt];if(!u.has(Nt.source)||!u.has(Nt.target))continue;let Dt;if(Nt.source===Nt.target){let Vt=Q(C.get(Nt.source));Dt=[Vt,Vt]}else if(rt.has(xt))Dt=rt.get(xt);else{let Vt=Z.get(xt);if(!Vt)continue;Dt=Vt.map($t=>Q(C.get($t)))}ut.push({source:Nt.source,target:Nt.target,...Nt.label!==void 0&&{label:Nt.label},bidirectional:Nt.bidirectional,lineNumber:Nt.lineNumber,points:Dt,yOffset:0,parallelCount:1,metadata:Nt.metadata})}let yt=1/0,vt=1/0,Gt=-1/0,Xt=-1/0;for(let xt of ot)yt=Math.min(yt,xt.x-xt.width/2),vt=Math.min(vt,xt.y-xt.height/2),Gt=Math.max(Gt,xt.x+xt.width/2),Xt=Math.max(Xt,xt.y+xt.height/2);for(let xt of ut)for(let Nt of xt.points)yt=Math.min(yt,Nt.x),vt=Math.min(vt,Nt.y),Gt=Math.max(Gt,Nt.x),Xt=Math.max(Xt,Nt.y);let bt=Bl-yt,Mt=Bl-vt,zt=bt!==0||Mt!==0?{nodes:ot.map(xt=>({...xt,x:xt.x+bt,y:xt.y+Mt})),edges:ut.map(xt=>({...xt,points:xt.points.map(Nt=>({x:Nt.x+bt,y:Nt.y+Mt}))}))}:{nodes:ot,edges:ut};return{nodes:zt.nodes,edges:zt.edges,groups:[],width:Gt+bt+Bl,height:Xt+Mt+Bl}}function j($,U){return $.dummy&&U.dummy?_Z:$.dummy||U.dummy?CZ:TZ}function K($,U){let X=$.length;if(X===0)return;let q=$.map(ot=>C.get(ot).thick/2),et=[0];for(let ot=1;ot<X;ot++)et[ot]=et[ot-1]+q[ot-1]+a+q[ot];let tt=U.map((ot,Z)=>ot-et[Z]),B=[];for(let ot=0;ot<X;ot++){let Z={pos:tt[ot],count:1,sumOffset:tt[ot],first:ot};for(;B.length&&B[B.length-1].pos>=Z.pos;){let lt=B.pop(),nt=lt.count+Z.count,J=lt.sumOffset+Z.sumOffset;Z={pos:J/nt,count:nt,sumOffset:J,first:lt.first}}B.push(Z)}let Q=new Array(X);for(let ot of B)for(let Z=0;Z<ot.count;Z++)Q[ot.first+Z]=ot.pos;for(let ot=0;ot<X;ot++)C.get($[ot]).cross=Q[ot]+et[ot]}}var NZ,MZ,kZ,Bl,TZ,CZ,_Z,kD=st(()=>{"use strict";vf();NZ=50,MZ=60,kZ=10,Bl=40,TZ=1,CZ=2,_Z=8});function WZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function FZ(t){if(t.length===0)return-1;t.sort((o,a)=>o-a);let e=Math.floor(t.length/2);if(t.length%2===1)return t[e];if(t.length===2)return(t[0]+t[1])/2;let n=t[e-1]-t[0],r=t[t.length-1]-t[e];return n+r===0?(t[e-1]+t[e])/2:(t[e-1]*r+t[e]*n)/(n+r)}function xh(t,e){let n=new Map;for(let l of t)n.set(l,[]);for(let l of e)n.get(l.from)?.push({to:l.to,idx:l.idx});let r=new Set,o=new Map;for(let l of t)o.set(l,0);let a=[],i=l=>{a.push(l);let c=new Map;for(;a.length;){let d=a[a.length-1];o.get(d)===0&&o.set(d,1);let u=n.get(d),f=c.get(d)??0,p=!1;for(;f<u.length;f++){let{to:m,idx:g}=u[f],h=o.get(m);if(h===1)r.add(g);else if(h===0){c.set(d,f+1),a.push(m),p=!0;break}}p||(c.set(d,u.length),o.set(d,2),a.pop())}};for(let l of t)o.get(l)===0&&i(l);return{dag:e.map(l=>r.has(l.idx)?{from:l.to,to:l.from,idx:l.idx,rev:!0}:{from:l.from,to:l.to,idx:l.idx,rev:!1})}}function TD(t,e){let n=new Map,r=new Map;for(let l of t)n.set(l,[]),r.set(l,0);for(let l of e)n.get(l.from).push(l.to),r.set(l.to,(r.get(l.to)??0)+1);let o=new Map;for(let l of t)o.set(l,0);let a=t.filter(l=>(r.get(l)??0)===0),i=new Map(r),s=0;for(;a.length;){let l=a.shift();s++;for(let c of n.get(l))o.set(c,Math.max(o.get(c),o.get(l)+1)),i.set(c,i.get(c)-1),i.get(c)===0&&a.push(c)}return s===t.length?o:null}function _D(t,e,n){if(t.groups.length===0)return[];let r=t.nodes.length;if(r<3||r>60)return[];let o=t.direction==="TB",a=t.nodes.map(tt=>tt.label),i=new Set(a);for(let tt of t.edges)if(tt.source.startsWith("__group_")||tt.target.startsWith("__group_"))return[];let s=new Map(t.groups.map(tt=>[tt.label,tt])),l=new Map;for(let tt of t.groups)for(let B of tt.children)i.has(B)&&l.set(B,tt.label);let c=tt=>{let B=tt,Q=new Set;for(;;){let ot=s.get(B);if(!ot?.parentGroup||Q.has(B))return B;Q.add(B),B=ot.parentGroup}},d=tt=>{let B=l.get(tt);if(!B)return[];let Q=[B],ot=B,Z=new Set([B]);for(;;){let lt=s.get(ot);if(!lt?.parentGroup||Z.has(lt.parentGroup))break;Q.push(lt.parentGroup),Z.add(lt.parentGroup),ot=lt.parentGroup}return Q.reverse()},u="\0node\0",f=tt=>{let B=l.get(tt);return B?c(B):u+tt},p=t.edges.map((tt,B)=>({e:tt,i:B})).filter(({e:tt})=>i.has(tt.source)&&i.has(tt.target)&&tt.source!==tt.target);if(p.length===0)return[];let m=new Map;for(let tt of a)m.set(tt,f(tt));let g=Array.from(new Set(a.map(tt=>m.get(tt)))),h=p.filter(({e:tt})=>m.get(tt.source)!==m.get(tt.target)).map(({e:tt,i:B})=>({from:m.get(tt.source),to:m.get(tt.target),idx:B})),{dag:S}=xh(g,h),y=TD(g,S.map(tt=>({from:tt.from,to:tt.to})));if(!y)return[];let b=new Map,E=new Map;for(let tt of a){let B=m.get(tt);(E.get(B)??E.set(B,[]).get(B)).push(tt)}for(let[tt,B]of E){let Q=new Set(B),ot=p.filter(({e:nt})=>m.get(nt.source)===tt&&m.get(nt.target)===tt&&Q.has(nt.source)&&Q.has(nt.target)).map(({e:nt,i:J})=>({from:nt.source,to:nt.target,idx:J})),{dag:Z}=xh(B,ot),lt=TD(B,Z.map(nt=>({from:nt.from,to:nt.to})));if(!lt)return[];for(let nt of B)b.set(nt,lt.get(nt))}let x=Math.max(...g.map(tt=>y.get(tt))),N=Array.from({length:x+1},()=>1);for(let tt of g){let B=Math.max(...E.get(tt).map(ot=>b.get(ot)+1)),Q=y.get(tt);N[Q]=Math.max(N[Q],B)}let L=[],A=0;for(let tt=0;tt<=x;tt++)L[tt]=A,A+=N[tt];let C=new Set(L.slice(1)),k=new Map;for(let tt of a)k.set(tt,L[y.get(m.get(tt))]+b.get(tt));let w=Math.max(...a.map(tt=>k.get(tt))),v=new Map;for(let tt of t.nodes){let B=e.get(tt.label)??{width:Ma,height:aa};v.set(tt.label,{id:tt.label,dummy:!1,rank:k.get(tt.label),cross:0,thick:o?B.width:B.height,depth:o?B.height:B.width,realW:B.width,realH:B.height,unit:m.get(tt.label),path:d(tt.label)})}let M=[],_=[],T=[],R=[];for(let{e:tt,i:B}of p){let Q=k.get(tt.source),ot=k.get(tt.target);if(Q===ot){R.push({edgeIdx:B,a:tt.source,b:tt.target});continue}if(ot<Q){T.push({edgeIdx:B,src:tt.source,tgt:tt.target});continue}let Z=[tt.source],lt=tt.source;for(let nt=Q+1;nt<ot;nt++){let J=`__d${B}_${nt}`;v.set(J,{id:J,dummy:!0,rank:nt,cross:0,thick:PZ,depth:0,realW:0,realH:0,unit:u+J,path:[]}),_.push({a:lt,b:J}),Z.push(J),lt=J}_.push({a:lt,b:tt.target}),Z.push(tt.target),M.push({edgeIdx:B,chain:Z})}let O=Array.from({length:w+1},()=>[]);for(let tt of v.values())O[tt.rank].push(tt.id);let I=new Map,H=new Map;for(let tt of v.keys())I.set(tt,[]),H.set(tt,[]);for(let tt of _)H.get(tt.a).push(tt.b),I.get(tt.b).push(tt.a);let G=new Map,D=tt=>{if(!O[tt+1])return 0;let Q=[];for(let Z of O[tt]){let lt=G.get(Z);for(let nt of H.get(Z))Q.push({p:lt,q:G.get(nt)})}let ot=0;for(let Z=0;Z<Q.length;Z++)for(let lt=Z+1;lt<Q.length;lt++){let nt=Q[Z],J=Q[lt];(nt.p-J.p)*(nt.q-J.q)<0&&ot++}return ot},W=()=>{let tt=0;for(let B=0;B<w;B++)tt+=D(B);return tt},V=(tt,B)=>{let Q=O[tt],ot=B?I:H,Z=new Map;for(let it of Q)Z.set(it,FZ(ot.get(it).map(Lt=>G.get(Lt))));let lt=Q.filter(it=>Z.get(it)>=0).sort((it,Lt)=>Z.get(it)-Z.get(Lt)),nt=new Array(Q.length).fill(null);for(let it of Q)Z.get(it)<0&&(nt[G.get(it)]=it);let J=0;for(let it=0;it<nt.length;it++)nt[it]===null&&(nt[it]=lt[J++]);let at=nt;at.forEach((it,Lt)=>G.set(it,Lt)),O[tt]=at},P=()=>{let tt=!0,B=0;for(;tt&&B++<12;){tt=!1;for(let Q=0;Q<=w;Q++){let ot=O[Q];for(let Z=0;Z<ot.length-1;Z++){let lt=(Q>0?D(Q-1):0)+(Q<w?D(Q):0),nt=ot[Z],J=ot[Z+1];ot[Z]=J,ot[Z+1]=nt,G.set(J,Z),G.set(nt,Z+1),(Q>0?D(Q-1):0)+(Q<w?D(Q):0)<lt?tt=!0:(ot[Z]=nt,ot[Z+1]=J,G.set(nt,Z),G.set(J,Z+1))}}}},F=tt=>{let B=tt===0?null:WZ(tt);for(let Q=0;Q<=w;Q++){let ot=O[Q].slice();if(B)for(let Z=ot.length-1;Z>0;Z--){let lt=Math.floor(B()*(Z+1));[ot[Z],ot[lt]]=[ot[lt],ot[Z]]}O[Q]=ot,ot.forEach((Z,lt)=>G.set(Z,lt))}},Y=n?.restarts??(r<=16?20:r<=30?12:6),z=n?.keepK??3,j=[];for(let tt=0;tt<Y;tt++){F(tt);let B=W(),Q=new Map(G);for(let Z=0;Z<8;Z++){if(Z%2===0)for(let nt=1;nt<=w;nt++)V(nt,!0);else for(let nt=w-1;nt>=0;nt--)V(nt,!1);P();let lt=W();if(lt<B&&(B=lt,Q=new Map(G)),lt===0)break}for(let[Z,lt]of Q)G.set(Z,lt);for(let Z=0;Z<=w;Z++)O[Z].sort((lt,nt)=>G.get(lt)-G.get(nt));let ot=O.map(Z=>Z.join(",")).join("|");j.some(Z=>Z.sig===ot)||j.push({sig:ot,cross:B,order:new Map(Q)})}j.sort((tt,B)=>tt.cross-B.cross);let K=j.slice(0,z);if(K.length===0)return[];let $=[];for(let tt of K){for(let[Q,ot]of tt.order)G.set(Q,ot);let B=Array.from({length:w+1},()=>[]);for(let Q of v.values())B[Q.rank].push(Q.id);for(let Q=0;Q<=w;Q++)B[Q].sort((ot,Z)=>tt.order.get(ot)-tt.order.get(Z));$.push(et(B))}return $;function U(tt,B){return tt.dummy&&B.dummy?HZ:tt.dummy||B.dummy?$Z:OZ}function X(tt,B,Q){let ot=tt.length;if(ot===0)return;let Z=[0];for(let at=1;at<ot;at++)Z[at]=Z[at-1]+Q[at];let lt=B.map((at,it)=>at-Z[it]),nt=[];for(let at=0;at<ot;at++){let it={pos:lt[at],count:1,sumOffset:lt[at],first:at};for(;nt.length&&nt[nt.length-1].pos>=it.pos;){let Lt=nt.pop(),Tt=Lt.count+it.count,At=Lt.sumOffset+it.sumOffset;it={pos:At/Tt,count:Tt,sumOffset:At,first:Lt.first}}nt.push(it)}let J=new Array(ot);for(let at of nt)for(let it=0;it<at.count;it++)J[at.first+it]=at.pos;for(let at=0;at<ot;at++)v.get(tt[at]).cross=J[at]+Z[at]}function q(tt,B){let Q=tt.thick/2+B.thick/2+RZ;if(tt.dummy||B.dummy)return Q;if(tt.unit!==B.unit)return Q+2*bd+DZ;let ot=tt.path[tt.path.length-1],Z=B.path[B.path.length-1];return ot!==Z&&(ot||Z)?Q+2*bd:Q}function et(tt){let B=tt.map(Ht=>Math.max(0,...Ht.map(Qt=>v.get(Qt).depth))),Q=[],ot=Zs;for(let Ht=0;Ht<=w;Ht++)Ht>0&&(ot+=IZ+(C.has(Ht)?GZ:0)),Q[Ht]=ot+B[Ht]/2,ot+=B[Ht];let Z=Ht=>Ht.map((Qt,Ut)=>Ut===0?0:q(v.get(Ht[Ut-1]),v.get(Qt)));for(let Ht=0;Ht<=w;Ht++){let Qt=tt[Ht],Ut=Z(Qt),fe=Zs;for(let de=0;de<Qt.length;de++){let te=v.get(Qt[de]);fe+=Ut[de],te.cross=de===0?Zs+te.thick/2:fe}}let lt=18;for(let Ht=0;Ht<lt;Ht++){let Ut=Ht%2===0?Array.from({length:w+1},(fe,de)=>de):Array.from({length:w+1},(fe,de)=>w-de);for(let fe of Ut){let de=tt[fe],te=de.map(ae=>{let Te=v.get(ae),Je=0,ln=0;for(let Ve of I.get(ae)){let Ce=U(Te,v.get(Ve));Je+=Ce,ln+=Ce*v.get(Ve).cross}for(let Ve of H.get(ae)){let Ce=U(Te,v.get(Ve));Je+=Ce,ln+=Ce*v.get(Ve).cross}return Je>0?ln/Je:Te.cross});X(de,te,Z(de))}}let nt=1/0;for(let Ht of v.values())nt=Math.min(nt,Ht.cross-Ht.thick/2);let J=Zs-nt;for(let Ht of v.values())Ht.cross+=J;let at=Ht=>o?{x:Ht.cross,y:Q[Ht.rank]}:{x:Q[Ht.rank],y:Ht.cross},it=t.nodes.map(Ht=>{let Qt=v.get(Ht.label),Ut=at(Qt);return{label:Ht.label,x:Ut.x,y:Ut.y,width:Qt.realW,height:Qt.realH}}),Lt=new Map;for(let Ht of M)Lt.set(Ht.edgeIdx,Ht.chain);let Tt=1/0,At=-1/0;for(let Ht of v.values())Ht.dummy||(Tt=Math.min(Tt,Ht.cross-Ht.thick/2),At=Math.max(At,Ht.cross+Ht.thick/2));let rt=34,pt=28,gt=Ht=>Math.max(0,Ht/2-6),dt=Ht=>v.get(Ht.src).cross-v.get(Ht.tgt).cross>=0?1:-1,ut=T.map(Ht=>({...Ht,side:dt(Ht),span:Math.abs(v.get(Ht.src).rank-v.get(Ht.tgt).rank)})).sort((Ht,Qt)=>Ht.side-Qt.side||Ht.span-Qt.span),yt=new Map;for(let Ht of ut)yt.set(Ht.side,(yt.get(Ht.side)??0)+1);let vt=new Map,Gt=new Map;for(let Ht of ut){let Qt=Ht.side,Ut=vt.get(Qt)??0;vt.set(Qt,Ut+1);let fe=yt.get(Qt),de=v.get(Ht.src),te=v.get(Ht.tgt),ae=Qt>0?At+rt+Ut*pt:Tt-rt-Ut*pt,Te=Q[de.rank],Je=Q[te.rank],ln=fe>1?(Ut+1)/(fe+1):0,Ve=Te-ln*gt(de.depth),Ce=Je+ln*gt(te.depth),ee=(An,We)=>o?{x:An,y:We}:{x:We,y:An},oe=10,Be=de.cross+Qt*(de.thick/2+oe),fn=te.cross+Qt*(te.thick/2+oe);Gt.set(Ht.edgeIdx,[ee(de.cross,Te),ee(Be,Ve),ee(ae,Ve),ee(ae,Ce),ee(fn,Ce),ee(te.cross,Je)])}let Xt=new Map;for(let Ht of R){let Qt=v.get(Ht.a),Ut=v.get(Ht.b),fe=Q[Qt.rank],de=fe-(Qt.depth/2+26),te=(ae,Te)=>o?{x:ae,y:Te}:{x:Te,y:ae};Xt.set(Ht.edgeIdx,[te(Qt.cross,fe),te(Qt.cross,de),te(Ut.cross,de),te(Ut.cross,fe)])}let bt=[];for(let Ht=0;Ht<t.edges.length;Ht++){let Qt=t.edges[Ht];if(!i.has(Qt.source)||!i.has(Qt.target))continue;let Ut;if(Qt.source===Qt.target){let fe=at(v.get(Qt.source));Ut=[fe,fe]}else if(Gt.has(Ht))Ut=Gt.get(Ht);else if(Xt.has(Ht))Ut=Xt.get(Ht);else{let fe=Lt.get(Ht);if(!fe)continue;Ut=fe.map(de=>at(v.get(de)))}bt.push({source:Qt.source,target:Qt.target,...Qt.label!==void 0&&{label:Qt.label},bidirectional:Qt.bidirectional,lineNumber:Qt.lineNumber,points:Ut,yOffset:0,parallelCount:1,metadata:Qt.metadata})}let Mt=new Map(it.map(Ht=>[Ht.label,{l:Ht.x-Ht.width/2,r:Ht.x+Ht.width/2,t:Ht.y-Ht.height/2,b:Ht.y+Ht.height/2}])),zt=Ht=>{let Qt=0,Ut=Ht,fe=new Set;for(;Ut&&!fe.has(Ut);)fe.add(Ut),Ut=s.get(Ut)?.parentGroup,Ut&&Qt++;return Qt},xt=new Map;for(let Ht of t.groups)Ht.parentGroup&&(xt.get(Ht.parentGroup)??xt.set(Ht.parentGroup,[]).get(Ht.parentGroup)).push(Ht.label);let Nt=new Map,Dt=[...t.groups].sort((Ht,Qt)=>zt(Qt.label)-zt(Ht.label)),Vt=[];for(let Ht of Dt){let Qt=1/0,Ut=-1/0,fe=1/0,de=-1/0,te=Ve=>{Qt=Math.min(Qt,Ve.l),Ut=Math.max(Ut,Ve.r),fe=Math.min(fe,Ve.t),de=Math.max(de,Ve.b)};for(let Ve of Ht.children){let Ce=Mt.get(Ve);Ce&&te(Ce)}for(let Ve of xt.get(Ht.label)??[]){let Ce=Nt.get(Ve);Ce&&te(Ce)}if(!Number.isFinite(Qt))continue;let ae=Qt-bd,Te=Ut+bd,Je=fe-CD,ln=de+bd;Nt.set(Ht.label,{l:ae,r:Te,t:Je,b:ln}),Vt.push({label:Ht.label,lineNumber:Ht.lineNumber,x:(ae+Te)/2,y:(Je+ln)/2,width:Te-ae,height:ln-Je,collapsed:!1,childCount:Ht.children.length})}let $t=1/0,ft=1/0,Wt=-1/0,ge=-1/0,ne=(Ht,Qt,Ut,fe)=>{$t=Math.min($t,Ht),ft=Math.min(ft,Qt),Wt=Math.max(Wt,Ut),ge=Math.max(ge,fe)};for(let Ht of it)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);for(let Ht of bt)for(let Qt of Ht.points)ne(Qt.x,Qt.y,Qt.x,Qt.y);for(let Ht of Vt)ne(Ht.x-Ht.width/2,Ht.y-Ht.height/2,Ht.x+Ht.width/2,Ht.y+Ht.height/2);let se=Zs-$t,Zt=Zs-ft,Ie=se!==0||Zt!==0;return{nodes:Ie?it.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):it,edges:Ie?bt.map(Ht=>({...Ht,points:Ht.points.map(Qt=>({x:Qt.x+se,y:Qt.y+Zt}))})):bt,groups:Ie?Vt.map(Ht=>({...Ht,x:Ht.x+se,y:Ht.y+Zt})):Vt,width:Wt+se+Zs,height:ge+Zt+Zs}}}var RZ,IZ,PZ,Zs,bd,CD,DZ,GZ,OZ,$Z,HZ,x1=st(()=>{"use strict";vf();RZ=50,IZ=60,PZ=10,Zs=40,bd=16,CD=32,DZ=24,GZ=CD+2*bd,OZ=1,$Z=2,HZ=8});var $D={};ye($D,{countEdgeNearMiss:()=>nQ,countEdgeNodePierces:()=>GD,countEdgeOverlaps:()=>DD,countGroupOverlaps:()=>Eh,countSplineCrossings:()=>PD,deroutePierces:()=>w1,detectEdgeNodePierces:()=>S1,detectEdgeOverlaps:()=>wh,detectGroupOverlaps:()=>rQ,layoutBoxesAndLinesSearch:()=>sQ,separateGroupBands:()=>OD});function XZ(t){return()=>{t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function jZ(t,e){let n=t.slice();for(let r=n.length-1;r>0;r--){let o=Math.floor(e()*(r+1));[n[r],n[o]]=[n[o],n[r]]}return n}function ZZ(t){let e=t.match(KZ)??[],n=[],r=0,o=0,a=0,i="",s=()=>parseFloat(e[r++]),l=(c,d,u,f)=>{for(let p=0;p<=1;p+=.12){let m=1-p;u?n.push({x:m*m*m*c.x+3*m*m*p*d.x+3*m*p*p*u.x+p*p*p*f.x,y:m*m*m*c.y+3*m*m*p*d.y+3*m*p*p*u.y+p*p*p*f.y}):n.push({x:m*m*c.x+2*m*p*d.x+p*p*f.x,y:m*m*c.y+2*m*p*d.y+p*p*f.y})}};for(;r<e.length;){let c=e[r];if(/[MLQC]/i.test(c)&&(i=c,r++),i==="M"||i==="L"){let d=s(),u=s();n.push({x:d,y:u}),o=d,a=u}else if(i==="Q"){let d={x:s(),y:s()},u={x:s(),y:s()};l({x:o,y:a},d,null,u),o=u.x,a=u.y}else if(i==="C"){let d={x:s(),y:s()},u={x:s(),y:s()},f={x:s(),y:s()};l({x:o,y:a},d,u,f),o=f.x,a=f.y}else r++}return n}function E1(t){let e=t.edges,n=AD.get(e);if(n)return n;let r=t.edges.map(o=>{let a=o.points.length>=2?ZZ(qZ(o.points)??""):[],i=1/0,s=1/0,l=-1/0,c=-1/0;for(let d of a)d.x<i&&(i=d.x),d.x>l&&(l=d.x),d.y<s&&(s=d.y),d.y>c&&(c=d.y);return{pts:a,x0:i,y0:s,x1:l,y1:c}});return AD.set(e,r),r}function QZ(t,e,n,r){let o=(e.x-t.x)*(r.y-n.y)-(e.y-t.y)*(r.x-n.x);if(Math.abs(o)<1e-9)return null;let a=((n.x-t.x)*(r.y-n.y)-(n.y-t.y)*(r.x-n.x))/o,i=((n.x-t.x)*(e.y-t.y)-(n.y-t.y)*(e.x-t.x))/o;return a>0&&a<1&&i>0&&i<1?{x:t.x+a*(e.x-t.x),y:t.y+a*(e.y-t.y)}:null}function PD(t,e=1/0){let n=new Map;for(let s of t.nodes)n.set(s.label,{x:s.x,y:s.y});for(let s of t.groups)s.collapsed&&n.set("__group_"+s.label,{x:s.x,y:s.y});let r=E1(t),o=t.edges,a=34,i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){let c=r[s],d=r[l];if(c.pts.length<2||d.pts.length<2||c.x1<d.x0||d.x1<c.x0||c.y1<d.y0||d.y1<c.y0)continue;let u=o[s],f=o[l],p,m;(u.source===f.source||u.source===f.target)&&(p=n.get(u.source)),(u.target===f.source||u.target===f.target)&&(m=n.get(u.target));let g=[],h=c.pts,S=d.pts;for(let y=1;y<h.length;y++){let b=h[y-1],E=h[y],x=b.x<E.x?b.x:E.x,N=b.x>E.x?b.x:E.x,L=b.y<E.y?b.y:E.y,A=b.y>E.y?b.y:E.y;for(let C=1;C<S.length;C++){let k=S[C-1],w=S[C];if(N<(k.x<w.x?k.x:w.x)||(k.x>w.x?k.x:w.x)<x||A<(k.y<w.y?k.y:w.y)||(k.y>w.y?k.y:w.y)<L)continue;let v=QZ(b,E,k,w);v&&(p&&Math.hypot(v.x-p.x,v.y-p.y)<a||m&&Math.hypot(v.x-m.x,v.y-m.y)<a||g.some(M=>Math.hypot(M.x-v.x,M.y-v.y)<6)||g.push(v))}}if(i+=g.length,i>e)return i}return i}function JZ(t,e,n){let r=n.x-e.x,o=n.y-e.y,a=r*r+o*o;if(a<1e-9)return Math.hypot(t.x-e.x,t.y-e.y);let i=((t.x-e.x)*r+(t.y-e.y)*o)/a;return i=Math.max(0,Math.min(1,i)),Math.hypot(t.x-(e.x+i*r),t.y-(e.y+i*o))}function tQ(t,e){let n=1/0;for(let r=1;r<e.length;r++)n=Math.min(n,JZ(t,e[r-1],e[r]));return n}function RD(t,e){let n=Math.max(e.x-e.w/2-t.x,0,t.x-(e.x+e.w/2)),r=Math.max(e.y-e.h/2-t.y,0,t.y-(e.y+e.h/2));return Math.hypot(n,r)}function wh(t,e){let n=e?.dist??8,r=e?.minLen??16,o=e?.nodeClear??12,a=new Map;for(let c of t.nodes)a.set(c.label,{x:c.x,y:c.y,w:c.width,h:c.height});for(let c of t.groups)c.collapsed&&a.set("__group_"+c.label,{x:c.x,y:c.y,w:c.width,h:c.height});let i=E1(t),s=t.edges,l=[];for(let c=0;c<i.length;c++)for(let d=c+1;d<i.length;d++){let u=i[c],f=i[d];if(u.pts.length<2||f.pts.length<2||u.x1+n<f.x0||f.x1+n<u.x0||u.y1+n<f.y0||f.y1+n<u.y0)continue;let p=s[c],m=s[d],g,h;(p.source===m.source||p.source===m.target)&&(g=a.get(p.source)),(p.target===m.source||p.target===m.target)&&(h=a.get(p.target));let S=[],y=0,b=()=>{y>=r&&S.length>=2&&l.push({mid:S[Math.floor(S.length/2)],length:y,pts:S.slice()}),S=[],y=0};for(let E of u.pts)!(g!==void 0&&RD(E,g)<o||h!==void 0&&RD(E,h)<o)&&tQ(E,f.pts)<n?(S.length&&(y+=Math.hypot(E.x-S[S.length-1].x,E.y-S[S.length-1].y)),S.push(E)):b();b()}return l}function DD(t,e){return wh(t,e).length}function S1(t,e){let n=e?.inset??6,r=e?.minPts??2,o=[];for(let l of t.nodes)o.push({key:l.label,x:l.x,y:l.y,w:l.width,h:l.height});for(let l of t.groups)l.collapsed&&o.push({key:"__group_"+l.label,x:l.x,y:l.y,w:l.width,h:l.height});let a=(l,c)=>Math.abs(l.x-c.x)<c.w/2-n&&Math.abs(l.y-c.y)<c.h/2-n,i=[],s=E1(t);return t.edges.forEach((l,c)=>{if(l.points.length<2)return;let d=s[c].pts;for(let u of o){if(u.key===l.source||u.key===l.target||"__group_"+u.key===l.source||"__group_"+u.key===l.target)continue;let f=d.filter(p=>a(p,u));f.length>=r&&i.push({edgeIdx:c,node:u.key,pts:f})}}),i}function GD(t,e){return S1(t,e).length}function w1(t){let e=S1(t);if(!e.length)return t;let n=new Map;for(let a of t.nodes)n.set(a.label,{x:a.x,y:a.y,w:a.width,h:a.height});for(let a of t.groups)a.collapsed&&n.set("__group_"+a.label,{x:a.x,y:a.y,w:a.width,h:a.height});let r=new Map;for(let a of e){let i=r.get(a.edgeIdx);i?i.push(a.node):r.set(a.edgeIdx,[a.node])}let o=t.edges.map((a,i)=>{let s=r.get(i);if(!s)return a;let l=a.points.map(c=>({x:c.x,y:c.y}));for(let c of s){let d=n.get(c);d&&(l=eQ(l,d))}return{...a,points:l}});return{...t,edges:o}}function eQ(t,e){if(t.length<2)return t;let n={x:e.x,y:e.y},r=-1,o=0,a=1/0,i=t[0];for(let x=0;x<t.length-1;x++){let N=t[x],L=t[x+1],A=L.x-N.x,C=L.y-N.y,k=A*A+C*C||1e-9,w=((n.x-N.x)*A+(n.y-N.y)*C)/k;w=Math.max(0,Math.min(1,w));let v={x:N.x+w*A,y:N.y+w*C},M=Math.hypot(v.x-n.x,v.y-n.y);M<a&&(a=M,r=x,o=w,i=v)}if(r<0)return t;let s=i.x-n.x,l=i.y-n.y;Math.hypot(s,l)<1&&(e.w<=e.h?(s=1,l=0):(s=0,l=1));let c=Math.hypot(s,l)||1;s/=c,l/=c;let d=t[r],u=t[r+1],f=u.x-d.x,p=u.y-d.y,m=Math.hypot(f,p)||1;f/=m,p/=m;let g=Math.hypot(e.w,e.h)/2+18,h=Math.hypot(e.w,e.h)/2,S={x:i.x-f*h+s*g*.5,y:i.y-p*h+l*g*.5},y={x:n.x+s*g,y:n.y+l*g},b={x:i.x+f*h+s*g*.5,y:i.y+p*h+l*g*.5},E=t.slice(0,r+1);return E.push(S,y,b),E.push(...t.slice(r+1)),E}function nQ(t,e){let n=e?.near??14,r=e?.tight??8,o=e?.minLen??18,a=wh(t,{dist:n,minLen:o}).length,i=wh(t,{dist:r,minLen:o}).length;return Math.max(0,a-i)}function rQ(t,e){let n=e?.margin??4,r=t.groups.map(s=>({label:s.label,l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Nf}:s),i=new Set;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&(i.add(r[s].label),i.add(r[l].label))}return[...i]}function Eh(t,e){let n=e?.margin??4,r=t.groups.map(s=>({l:s.x-s.width/2,r:s.x+s.width/2,t:s.y-s.height/2,b:s.y+s.height/2})),o=(s,l)=>s.l<=l.l+n&&s.r>=l.r-n&&s.t<=l.t+n&&s.b>=l.b-n,a=r.map((s,l)=>r.some((d,u)=>u!==l&&o(s,d))?{...s,t:s.t-Nf}:s),i=0;for(let s=0;s<r.length;s++)for(let l=s+1;l<r.length;l++){if(o(r[s],r[l])||o(r[l],r[s]))continue;let c=a[s],d=a[l],u=Math.max(c.l-d.r,d.l-c.r),f=Math.max(c.t-d.b,d.t-c.b);Math.max(u,f)<n&&i++}return i}function OD(t,e){if(t.groups.some(T=>T.collapsed)||Eh(t)===0)return t;let n=new Map;for(let T of e.groups)n.set(T.label,T.parentGroup);let r=T=>{let R=T,O=new Set;for(;;){let I=n.get(R);if(!I||O.has(I))return R;O.add(R),R=I}},o=e.groups.filter(T=>!T.parentGroup).map(T=>T.label);if(o.length<2)return t;let a=new Map;for(let T of e.groups)for(let R of T.children)e.groups.some(O=>O.label===R)||a.set(R,r(T.label));let i=e.direction==="TB"?"x":"y",s=new Map(t.groups.map(T=>[T.label,T])),l=o.map(T=>{let R=s.get(T),O=(i==="y"?R.height:R.width)/2,I=(i==="y"?R.y:R.x)-O,H=(i==="y"?R.y:R.x)+O,G=e.groups.some(D=>D.parentGroup===T);return i==="y"&&G&&(I-=Nf),{label:T,lo:I,hi:H,c:(I+H)/2}});l.sort((T,R)=>T.c-R.c);let c=16,d=l.map(T=>(T.hi-T.lo)/2),u=[0];for(let T=1;T<l.length;T++)u[T]=u[T-1]+d[T-1]+c+d[T];let f=l.map((T,R)=>T.c-u[R]),p=[];for(let T=0;T<l.length;T++){let R={pos:f[T],count:1,sum:f[T],first:T};for(;p.length&&p[p.length-1].pos>=R.pos;){let O=p.pop(),I=O.count+R.count,H=O.sum+R.sum;R={pos:H/I,count:I,sum:H,first:O.first}}p.push(R)}let m=new Array(l.length);for(let T of p)for(let R=0;R<T.count;R++)m[T.first+R]=T.pos+u[T.first+R];let g=new Map,h=!1;if(l.forEach((T,R)=>{let O=m[R]-T.c;g.set(T.label,O),Math.abs(O)>.5&&(h=!0)}),!h)return t;let S=T=>{if(T.startsWith("__group_"))return g.get(r(T.slice(8)))??0;let R=a.get(T);return R?g.get(R)??0:0},y=(T,R)=>i==="y"?{x:T.x,y:T.y+R}:{x:T.x+R,y:T.y},b=t.nodes.map(T=>{let R=S(T.label);return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),E=t.groups.map(T=>{let R=g.get(r(T.label))??0;return R?{...T,...i==="y"?{y:T.y+R}:{x:T.x+R}}:T}),x=t.edges.map(T=>{let R=S(T.source),O=S(T.target);if(!R&&!O)return T;let I=T.points.length,H=T.points.map((G,D)=>{let W=I>1?D/(I-1):0;return y(G,R*(1-W)+O*W)});return{...T,points:H}}),N=1/0,L=1/0,A=-1/0,C=-1/0,k=(T,R)=>{T<N&&(N=T),T>A&&(A=T),R<L&&(L=R),R>C&&(C=R)};for(let T of b)k(T.x-T.width/2,T.y-T.height/2),k(T.x+T.width/2,T.y+T.height/2);for(let T of E)k(T.x-T.width/2,T.y-T.height/2-Nf),k(T.x+T.width/2,T.y+T.height/2);for(let T of x)for(let R of T.points)k(R.x,R.y);let w=40,v=w-N,M=w-L,_=v!==0||M!==0;return{nodes:_?b.map(T=>({...T,x:T.x+v,y:T.y+M})):b,groups:_?E.map(T=>({...T,x:T.x+v,y:T.y+M})):E,edges:_?x.map(T=>({...T,points:T.points.map(R=>({x:R.x+v,y:R.y+M}))})):x,width:A-N+2*w,height:C-L+2*w}}function oQ(t,e,n,r){let o=e.x-t.x,a=e.y-t.y,i=r.x-n.x,s=r.y-n.y,l=o*s-a*i;if(Math.abs(l)<1e-9)return!1;let c=((n.x-t.x)*s-(n.y-t.y)*i)/l,d=((n.x-t.x)*a-(n.y-t.y)*o)/l;return c>.001&&c<.999&&d>.001&&d<.999}function ID(t){let e=t.edges.filter(o=>o.points.length>=2),n=e.map(o=>{let a=1/0,i=1/0,s=-1/0,l=-1/0;for(let c of o.points)c.x<a&&(a=c.x),c.x>s&&(s=c.x),c.y<i&&(i=c.y),c.y>l&&(l=c.y);return{x0:a,y0:i,x1:s,y1:l}}),r=0;for(let o=0;o<e.length;o++)for(let a=o+1;a<e.length;a++){let i=e[o],s=e[a];if(i.source===s.source||i.source===s.target||i.target===s.source||i.target===s.target)continue;let l=n[o],c=n[a];if(l.x1<c.x0||c.x1<l.x0||l.y1<c.y0||c.y1<l.y0)continue;let d=i.points,u=s.points,f=!1;for(let p=0;p<d.length-1&&!f;p++)for(let m=0;m<u.length-1;m++)if(oQ(d[p],d[p+1],u[m],u[m+1])){f=!0;break}f&&r++}return r}function aQ(t,e){if(!e?.size)return 0;let n=0,r=0;for(let o of t.nodes){let a=e.get(o.label);a&&(n+=Math.hypot(o.x-a.x,o.y-a.y),r++)}return r?n/r:0}function iQ(t){let e=0;for(let n of t.edges)for(let r=1;r<n.points.length;r++)e+=Math.hypot(n.points[r].x-n.points[r-1].x,n.points[r].y-n.points[r-1].y);return e}async function sQ(t,e,n){let r=n?.hideDescriptions??!1,o=n?.reserveEdgeLabels??!1,a=n?.onProgress,i=a?()=>new Promise(nt=>setTimeout(nt)):()=>{},s=150,l=30,c=performance.now(),d=c,u=new Set;if(e){let nt=new Set;for(let J of e.originalGroups)t.groups.some(at=>at.label===J.label)||nt.add(J.label);for(let J of nt){let it=e.originalGroups.find(Lt=>Lt.label===J)?.parentGroup;(!it||!nt.has(it))&&u.add(J)}}let f=new Map,p=0;for(let nt of t.nodes){let J=r?{width:Ma,height:aa}:L1(nt,t.showValues===!0);f.set(nt.label,J),!r&&nt.description&&nt.description.length>0&&(p=Math.max(p,J.height))}if(p>0){for(let nt of t.nodes)if(nt.description&&nt.description.length>0){let J=f.get(nt.label);f.set(nt.label,{width:J.width,height:p})}}let m=nt=>`__group_${nt}`,g=t.direction==="TB"?"TB":"LR",h=new Set(t.nodes.map(nt=>nt.label)),S=new Map,y=new Map;for(let nt of t.groups)if(S.set(nt.label,nt.children.filter(J=>h.has(J))),nt.parentGroup){let J=y.get(nt.parentGroup)??[];J.push(nt.label),y.set(nt.parentGroup,J)}let b=new Map,E=nt=>{let J=b.get(nt);if(J)return J;b.set(nt,[]);let at=[...S.get(nt)??[]];for(let it of y.get(nt)??[])at.push(...E(it));return b.set(nt,at),at},x=new Map,N=new Map;for(let nt of t.groups){let J=E(nt.label);if(J.length===0)continue;let at=new Set(J),it=new Map;for(let gt of t.edges)if(at.has(gt.source)&&at.has(gt.target)){let dt=it.get(gt.target)??[];dt.push(gt.source),it.set(gt.target,dt)}let Lt=new Map,Tt=new Set,At=gt=>{let dt=Lt.get(gt);if(dt!==void 0)return dt;if(Tt.has(gt))return 0;Tt.add(gt);let ut=0;for(let yt of it.get(gt)??[])ut=Math.max(ut,At(yt)+1);return Tt.delete(gt),Lt.set(gt,ut),ut},rt=J[0],pt=J[0];for(let gt of J)At(gt)>At(rt)&&(rt=gt),At(gt)<At(pt)&&(pt=gt);x.set(m(nt.label),rt),N.set(m(nt.label),pt)}let L=nt=>x.get(nt)??nt,A=nt=>N.get(nt)??nt,C=nt=>`${nt.source}->${nt.target}#${nt.lineNumber}`,k=(nt,J)=>{let at=J.x-nt.x,it=J.y-nt.y,Lt=at===0?1/0:nt.w/2/Math.abs(at),Tt=it===0?1/0:nt.h/2/Math.abs(it),At=Math.min(Lt,Tt);return Number.isFinite(At)?{x:nt.x+at*At,y:nt.y+it*At}:{x:nt.x,y:nt.y}},w=(nt,J)=>Math.abs(nt.x-J.x)<=J.w/2&&Math.abs(nt.y-J.y)<=J.h/2,v=t.nodePositions,M=new Set(t.groups.map(nt=>nt.label)),_=t.groups.every(nt=>!nt.parentGroup&&!nt.children.some(J=>M.has(J))),T=new Set((e?.originalGroups??t.groups).map(nt=>nt.label)),R=u.size===0||v!==void 0&&e!==void 0&&[...u].every(nt=>{let J=e.originalGroups.find(at=>at.label===nt);return!J||J.parentGroup?!1:J.children.every(at=>v.has(at)&&!T.has(at))}),O=v!==void 0&&(t.nodes.length>0||u.size>0)&&t.nodes.every(nt=>v.has(nt.label))&&_&&R;function I(nt){let J=new Map,at=[];if(e)for(let Nt of u){let Dt=e.originalGroups.find(se=>se.label===Nt);if(!Dt)continue;let Vt=1/0,$t=1/0,ft=-1/0,Wt=-1/0;for(let se of Dt.children){let Zt=nt.get(se);Zt&&(Vt=Math.min(Vt,Zt.x),ft=Math.max(ft,Zt.x),$t=Math.min($t,Zt.y),Wt=Math.max(Wt,Zt.y))}if(!Number.isFinite(Vt))continue;let ge=(Vt+ft)/2,ne=($t+Wt)/2;J.set(`__group_${Nt}`,{x:ge,y:ne}),at.push({label:Nt,lineNumber:Dt.lineNumber,childCount:e.collapsedChildCounts.get(Nt)??Dt.children.length,x:ge,y:ne})}let it=Nt=>nt.get(Nt)??J.get(Nt),Lt=Nt=>{let Dt=it(Nt),Vt=f.get(Nt)??{width:Ma,height:aa};return{x:Dt.x,y:Dt.y,w:Vt.width,h:Vt.height}},Tt=t.nodes.map(Nt=>{let Dt=Lt(Nt.label);return{label:Nt.label,x:Dt.x,y:Dt.y,width:Dt.w,height:Dt.h}}),At=t.edges.flatMap(Nt=>{let Dt=it(Nt.source),Vt=it(Nt.target);if(!Dt||!Vt)return[];let $t=Lt(Nt.source),ft=Lt(Nt.target),Wt=k($t,Vt),ge=k(ft,Dt);return[{source:Nt.source,target:Nt.target,...Nt.label!==void 0&&{label:Nt.label},bidirectional:Nt.bidirectional,lineNumber:Nt.lineNumber,points:[Wt,ge],yOffset:0,parallelCount:1,metadata:Nt.metadata,straight:!0}]}),rt=16,pt=new Map(Tt.map(Nt=>[Nt.label,Nt])),gt=[];for(let Nt of t.groups){let Dt=1/0,Vt=1/0,$t=-1/0,ft=-1/0;for(let Zt of Nt.children){let Ie=pt.get(Zt);Ie&&(Dt=Math.min(Dt,Ie.x-Ie.width/2),$t=Math.max($t,Ie.x+Ie.width/2),Vt=Math.min(Vt,Ie.y-Ie.height/2),ft=Math.max(ft,Ie.y+Ie.height/2))}if(!Number.isFinite(Dt))continue;let Wt=Dt-rt,ge=$t+rt,ne=Vt-Nf,se=ft+rt;gt.push({label:Nt.label,lineNumber:Nt.lineNumber,x:(Wt+ge)/2,y:(ne+se)/2,width:ge-Wt,height:se-ne,collapsed:!1,childCount:Nt.children.length})}for(let Nt of at)gt.push({label:Nt.label,lineNumber:Nt.lineNumber,x:Nt.x,y:Nt.y,width:Ma,height:aa,collapsed:!0,childCount:Nt.childCount});let dt=40,ut=1/0,yt=1/0,vt=-1/0,Gt=-1/0,Xt=(Nt,Dt)=>{Nt<ut&&(ut=Nt),Nt>vt&&(vt=Nt),Dt<yt&&(yt=Dt),Dt>Gt&&(Gt=Dt)};for(let Nt of Tt)Xt(Nt.x-Nt.width/2,Nt.y-Nt.height/2),Xt(Nt.x+Nt.width/2,Nt.y+Nt.height/2);for(let Nt of At)for(let Dt of Nt.points)Xt(Dt.x,Dt.y);for(let Nt of gt)Xt(Nt.x-Nt.width/2,Nt.y-Nt.height/2),Xt(Nt.x+Nt.width/2,Nt.y+Nt.height/2);let bt=2,Mt=ut<dt-bt?dt-ut:0,zt=yt<dt-bt?dt-yt:0,xt=Mt!==0||zt!==0;return{nodes:xt?Tt.map(Nt=>({...Nt,x:Nt.x+Mt,y:Nt.y+zt})):Tt,edges:xt?At.map(Nt=>({...Nt,points:Nt.points.map(Dt=>({x:Dt.x+Mt,y:Dt.y+zt}))})):At,groups:xt?gt.map(Nt=>({...Nt,x:Nt.x+Mt,y:Nt.y+zt})):gt,width:vt+Mt+dt,height:Gt+zt+dt}}function H(nt){let J=nt.seed===void 0?null:XZ(nt.seed+1),at=dt=>J?jZ(dt,J):dt.slice(),it=new rr.graphlib.Graph({compound:!0,multigraph:!0});it.setGraph({rankdir:g,ranker:nt.ranker,nodesep:nt.nodesep,ranksep:nt.ranksep,edgesep:20,marginx:40,marginy:40}),it.setDefaultEdgeLabel(()=>({}));for(let dt of at(t.groups))it.setNode(m(dt.label),{label:dt.label});for(let dt of at(t.nodes)){let ut=f.get(dt.label);it.setNode(dt.label,{width:ut.width,height:ut.height})}for(let dt of u)it.setNode(m(dt),{width:Ma,height:aa});for(let dt of t.groups){dt.parentGroup&&it.hasNode(m(dt.parentGroup))&&it.setParent(m(dt.label),m(dt.parentGroup));for(let ut of at(dt.children))it.hasNode(ut)&&it.setParent(ut,m(dt.label))}if(e)for(let dt of u){let ut=e.originalGroups.find(yt=>yt.label===dt);ut?.parentGroup&&!u.has(ut.parentGroup)&&it.hasNode(m(ut.parentGroup))&&it.setParent(m(dt),m(ut.parentGroup))}for(let dt of at(t.edges)){let ut=L(dt.source),yt=A(dt.target);if(ut!==yt&&it.hasNode(ut)&&it.hasNode(yt)){let vt={};if(o&&dt.label){let Gt=h1(dt.label,bh);vt={width:Gt.width,height:Gt.height,labelpos:"c"}}it.setEdge(ut,yt,vt,C(dt))}}rr.layout(it);let Lt=t.nodes.map(dt=>{let ut=it.node(dt.label);return{label:dt.label,x:ut.x,y:ut.y,width:ut.width,height:ut.height}}),Tt=t.groups.map(dt=>{let ut=it.node(m(dt.label));return{label:dt.label,lineNumber:dt.lineNumber,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!1,childCount:dt.children.length}});for(let dt of u){let ut=it.node(m(dt));Tt.push({label:dt,lineNumber:0,x:ut.x,y:ut.y,width:ut.width,height:ut.height,collapsed:!0,childCount:e?.collapsedChildCounts.get(dt)??0})}let At=new Map;for(let dt of t.groups){let ut=it.node(m(dt.label));ut&&At.set(m(dt.label),{x:ut.x,y:ut.y,w:ut.width,h:ut.height})}let rt=(dt,ut,yt)=>{if(dt.length<2)return dt;let vt=dt,Gt=At.get(ut);if(Gt){let bt=0;for(;bt<vt.length-1&&w(vt[bt],Gt);)bt++;vt=[k(Gt,vt[bt]),...vt.slice(bt)]}let Xt=At.get(yt);if(Xt){let bt=vt.length-1;for(;bt>0&&w(vt[bt],Xt);)bt--;vt=[...vt.slice(0,bt+1),k(Xt,vt[bt])]}return vt},pt=t.edges.flatMap(dt=>{let ut=L(dt.source),yt=A(dt.target),vt=C(dt);if(ut===yt||!it.hasEdge(ut,yt,vt))return[];let Gt=it.edge(ut,yt,vt),Xt=rt(Gt?.points??[],dt.source,dt.target);return[{source:dt.source,target:dt.target,...dt.label!==void 0&&{label:dt.label},bidirectional:dt.bidirectional,lineNumber:dt.lineNumber,points:Xt,yOffset:0,parallelCount:1,metadata:dt.metadata}]}),gt=it.graph();return{nodes:Lt,edges:pt,groups:Tt,width:gt.width??800,height:gt.height??600}}if(O)return I(v);let G=t.nodes.length,D=n?.seeds??(G<=12?80:G<=22?40:G<=35?22:10),W=n?.refineK??6,V=n?.lambda??BZ,P=n?.previousPositions,F=["network-simplex","tight-tree","longest-path"],Y=[{nodesep:50,ranksep:60},{nodesep:34,ranksep:46},{nodesep:66,ranksep:82}],z=[];for(let nt of F)for(let J of Y)z.push({ranker:nt,...J});for(let nt=0;nt<D;nt++)z.push({ranker:"network-simplex",nodesep:50,ranksep:60,seed:nt});let j=(nt,J)=>{let at=PD(nt,J);return at>J?1/0:at+DD(nt)+GD(nt)+Eh(nt)},K=(nt,J)=>J*1e6+iQ(nt)+V*aQ(nt,P)*10,$=z.length+Math.min(n?.refineK??6,z.length),U=0,X=async nt=>{if(!a)return;a(++U,$,nt);let J=performance.now();J-c>s&&J-d>l&&(d=J,await i())},q=[];for(let nt of z){try{q.push(H(nt))}catch{}await X("Optimizing layout")}if(!q.length)return H({ranker:"network-simplex",nodesep:50,ranksep:60});let et=[];try{et=MD(t,f)}catch{}if(t.groups.length>0&&u.size===0)try{et=et.concat(_D(t,f))}catch{}let tt=new Map;for(let nt of q)tt.set(nt,K(nt,ID(nt)));q.sort((nt,J)=>tt.get(nt)-tt.get(J));let B=Math.min(W,q.length),Q=q[0],ot=1/0,Z=1/0,lt=nt=>{let J=j(nt,Z);if(J===1/0)return;let at=K(nt,J);at<ot&&(ot=at,Z=J,Q=nt)};for(let nt of q.slice(0,B))lt(nt),await X("Refining layout");if(Z>=YZ&&G<=VZ){let nt=[];for(let at=D;at<D+zZ;at++)try{nt.push(H({ranker:"network-simplex",nodesep:50,ranksep:60,seed:at}))}catch{}let J=new Map;for(let at of nt)J.set(at,K(at,ID(at)));nt.sort((at,it)=>J.get(at)-J.get(it));for(let at of nt.slice(0,UZ))lt(at)}for(let nt of et){let J=[nt],at=w1(nt);at!==nt&&J.push(at);for(let it of J){let Lt=j(it,Z-1);Lt<Z&&(Z=Lt,Q=it)}}if(Z>0){let nt=w1(Q);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}if(Z>0&&Eh(Q)>0){let nt=OD(Q,t);nt!==Q&&j(nt,Z-1)<Z&&(Q=nt)}return Q}var BZ,YZ,VZ,zZ,UZ,qZ,KZ,AD,Nf,HD=st(()=>{"use strict";os();So();vf();kD();x1();b1();BZ=4,YZ=4,VZ=45,zZ=18,UZ=10;qZ=Qn().x(t=>t.x).y(t=>t.y).curve(fo),KZ=/[MLQC]|-?\d*\.?\d+(?:e-?\d+)?/gi;AD=new WeakMap;Nf=32});var zD={};ye(zD,{NODE_HEIGHT:()=>aa,NODE_WIDTH:()=>Ma,computeNodeSize:()=>L1,layoutBoxesAndLines:()=>bQ});function hQ(t){let e=[],n=0;for(let r=1;r<t.length;r++){let o=t.charAt(r-1),a=t.charAt(r),i=r+1<t.length?t.charAt(r+1):"",s=o>="a"&&o<="z"&&a>="A"&&a<="Z",l=o>="A"&&o<="Z"&&a>="A"&&a<="Z"&&i>="a"&&i<="z";(s||l)&&(e.push(t.slice(n,r)),n=r)}return e.push(t.slice(n)),e.length>1?e:[t]}function yQ(t,e=Ma){let n=t.split(/[\s-]+/),r=[];for(let a of n)a&&r.push(...hQ(a));let o=e-24;for(let a=13;a>=9;a--){if(o<_t("MM",a))continue;let i=1,s="";for(let l of r){let c=s?`${s} ${l}`:l;_t(c,a)<=o?s=c:(i++,s=l)}if(i<=N1)return Math.min(i,N1)}return N1}function L1(t,e){if(!t.description||t.description.length===0)return{width:Ma,height:aa};let n=dQ,o=yQ(t.label,n)*13*fQ+pQ,a=n-24,i=0;for(let c of t.description)_t(c,v1)<=a?i+=1:i+=Cn(c,v1,a,{hardBreak:!0}).length;i=Math.min(i,uQ);let s=i*v1*YD,l=o+VD+M1+s+M1+(e?gQ:0);return{width:n,height:Math.max(aa,l)}}async function bQ(t,e,n){let{layoutBoxesAndLinesSearch:r}=await Promise.resolve().then(()=>(HD(),$D)),o={...n?.hideDescriptions!==void 0&&{hideDescriptions:n.hideDescriptions},...n?.previousPositions!==void 0&&{previousPositions:n.previousPositions},...n?.onProgress!==void 0&&{onProgress:n.onProgress}},a=await r(t,e,o),i=y1(BD(a));if(i.unresolved.length>0){let s=await r(t,e,{...o,reserveEdgeLabels:!0}),l=y1(BD(s));l.unresolved.length<i.unresolved.length&&(i=l)}return xQ(i.layout,t,n?.collapsedNotes)}function xQ(t,e,n){let o=e.options?.["no-notes"]==="on"||!e.notes?new Map:no(e.notes,e.nodes.map(y=>({id:y.label,label:y.label})));if(o.size===0)return t;let a=Dc(t.nodes.map(y=>({id:y.label,x:y.x,y:y.y,width:y.width,height:y.height})),o,e.direction==="TB"?"TB":"LR",n),i=t.nodes.map(y=>{let b=a.get(y.label);return b?{...y,note:b}:y}),s=1/0,l=1/0,c=-1/0,d=-1/0,u=(y,b,E,x)=>{y<s&&(s=y),b<l&&(l=b),E>c&&(c=E),x>d&&(d=x)};for(let y of i)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2),y.note&&!y.note.collapsed&&u(y.x+y.note.x,y.y+y.note.y,y.x+y.note.x+y.note.width,y.y+y.note.y+y.note.height);for(let y of t.groups)u(y.x-y.width/2,y.y-y.height/2,y.x+y.width/2,y.y+y.height/2);if(!Number.isFinite(s))return{...t,nodes:i};let{shiftX:f,shiftY:p}=Gs(s,l),m=f!==0||p!==0,g=m?i.map(y=>({...y,x:y.x+f,y:y.y+p})):i,h=m?t.edges.map(y=>({...y,points:y.points.map(b=>({x:b.x+f,y:b.y+p})),...y.labelX!==void 0&&{labelX:y.labelX+f},...y.labelY!==void 0&&{labelY:y.labelY+p}})):t.edges,S=m?t.groups.map(y=>({...y,x:y.x+f,y:y.y+p})):t.groups;return{nodes:g,edges:h,groups:S,width:c+f+WD,height:d+p+WD}}function BD(t){let e=new Map;if(t.edges.forEach((o,a)=>{let[i,s]=o.source<o.target?[o.source,o.target]:[o.target,o.source],l=`${i}\0${s}`,c=e.get(l);c?c.push(a):e.set(l,[a])}),[...e.values()].every(o=>o.length<2))return t;let n=new Array(t.edges.length).fill(0),r=new Array(t.edges.length).fill(1);for(let o of e.values()){let a=o.slice(0,FD);for(let i of o.slice(FD))r[i]=0;a.length<2||a.forEach((i,s)=>{n[i]=(s-(a.length-1)/2)*lQ,r[i]=a.length})}return{...t,edges:t.edges.map((o,a)=>({...o,yOffset:n[a],parallelCount:r[a]}))}}var WD,FD,lQ,cQ,aa,Ma,dQ,v1,YD,M1,VD,uQ,N1,fQ,pQ,mQ,gQ,vf=st(()=>{"use strict";en();b1();Zi();WD=40,FD=5,lQ=22,cQ=1.618,aa=60,Ma=Math.round(aa*cQ),dQ=140,v1=10,YD=1.4,M1=8,VD=4,uQ=6,N1=3,fQ=1.3,pQ=12,mQ=11,gQ=VD+mQ*YD+M1});var nG={};ye(nG,{layoutSwimlane:()=>SQ});function EQ(t){return t==="exclusive"||t==="parallel"?{w:XD,h:XD}:t==="terminal"?{w:jD,h:jD}:{w:T1,h:tG}}function JD(t,e,n,r){let o=new Map,a=new Map;for(let c of t)o.set(c,[]),a.set(c,0);for(let c of e)o.get(c.from)?.push(c.to),a.set(c.to,(a.get(c.to)??0)+1);let i=new Map(t.map(c=>[c,0])),s=new Map;for(let c of t)s.set(c,new Map);let l=t.filter(c=>(a.get(c)??0)===0);for(let c=0;c<l.length;c++){let d=l[c],u=n(d),f=s.get(d),p=r?.get(d);p!==void 0&&(i.get(d)??0)<p&&i.set(d,p);let m=f.get(u);m!==void 0&&(i.get(d)??0)<=m&&i.set(d,m+1);let g=i.get(d),h=new Map(f);h.set(u,Math.max(h.get(u)??-1,g));for(let S of o.get(d)??[]){let y=g+(n(S)===u?1:0);y>(i.get(S)??0)&&i.set(S,y);let b=s.get(S);for(let[x,N]of h)N>(b.get(x)??-1)&&b.set(x,N);let E=(a.get(S)??0)-1;a.set(S,E),E===0&&l.push(S)}}return i}function SQ(t){let n=t.direction==="LR",r=new Map(t.nodes.map(B=>[B.id,B])),o=t.nodes.map(B=>B.id),a=new Map(t.nodes.map(B=>[B.id,EQ(B.shape)])),i=B=>{let Q=a.get(B);return n?Q.w:Q.h},s=B=>{let Q=a.get(B);return n?Q.h:Q.w},l=t.edges.map((B,Q)=>({from:B.source,to:B.target,idx:Q})).filter(B=>B.from!==B.to&&r.has(B.from)&&r.has(B.to)),{dag:c}=xh(o,l),d=B=>r.get(B).lane,u=JD(o,c.map(B=>({from:B.from,to:B.to})),d),f=new Map;for(let B of o)f.set(B,u.get(B)??0);{let B=new Map(t.lanes.map((Z,lt)=>[Z.id,lt])),Q=c.map(Z=>({from:Z.from,to:Z.to})),ot=new Map;for(let Z=0;Z<o.length;Z++){let lt=!1;for(let nt of l)if(!((f.get(nt.to)??0)>=(f.get(nt.from)??0)))for(let J of[nt.from,nt.to]){let at=f.get(J),it=B.get(d(J));for(let Lt of o)Lt===nt.from||Lt===nt.to||f.get(Lt)===at&&((B.get(d(Lt))??0)<=it||(ot.get(Lt)??0)<=at&&(ot.set(Lt,at+1),lt=!0))}if(!lt)break;f=JD(o,Q,d,ot)}}let p=Array.from(new Set(o.map(B=>f.get(B)))).sort((B,Q)=>B-Q),m=new Map(p.map((B,Q)=>[B,Q])),g=p.length,h=B=>m.get(f.get(B))??0,S=qD+Sh,y=Array.from({length:g},()=>0);for(let B of o){let Q=h(B);y[Q]=Math.max(y[Q],i(B))}let b=[],E=[];{let B=S;for(let Q=0;Q<g;Q++){let ot=Math.max(y[Q],T1);E[Q]=ot,b[Q]=B+ot/2,B+=ot+UD}}let x=B=>b[B]+E[B]/2+UD/2,N=(g>0?b[g-1]+Math.max(y[g-1],T1)/2:S)+Sh,L=(t.phases.length?KD:0)+Sh,A=new Map;for(let B of t.nodes){let Q=`${B.lane}\0${h(B.id)}`;(A.get(Q)??A.set(Q,[]).get(Q)).push(B.id)}let C=(B,Q)=>{let ot=A.get(`${B}\0${Q}`)??[];return ot.length===0?0:ot.reduce((Z,lt)=>Z+s(lt),0)+k1*(ot.length-1)},k=new Map,w=new Map,v=new Map;{let B=L;for(let Q of t.lanes){let ot=0;for(let lt=0;lt<g;lt++)ot=Math.max(ot,C(Q.id,lt));let Z=Math.max(wQ,ot+2*eG);k.set(Q.id,B),w.set(Q.id,Z),v.set(Q.id,B+Z/2),B+=Z}}let M=(()=>{let B=L;for(let Q of t.lanes)B+=w.get(Q.id);return B})(),_=new Map,T=new Map;for(let[B,Q]of A){let ot=B.indexOf("\0"),Z=B.slice(0,ot),lt=v.get(Z)??L,nt=Q.reduce((at,it)=>at+s(it),0)+k1*(Q.length-1),J=lt-nt/2;for(let at of Q){let it=s(at);T.set(at,J+it/2),J+=it+k1,_.set(at,b[h(at)])}}let R=0;for(let B of l)(f.get(B.to)??0)<(f.get(B.from)??0)&&R++;let I=R>0?ZD+QD*(R-1):0,H=M+I+Sh,G=(B,Q)=>n?{x:B,y:Q}:{x:Q,y:B},D=t.nodes.map(B=>{let Q=a.get(B.id),ot=G(_.get(B.id),T.get(B.id));return{id:B.id,label:B.label,shape:B.shape,event:B.event,lane:B.lane,...B.phase!==void 0&&{phase:B.phase},...B.color!==void 0&&{color:B.color},tags:B.tags,x:ot.x,y:ot.y,width:Q.w,height:Q.h,lineNumber:B.lineNumber}}),W=16,V=new Array(t.edges.length).fill(0);{let B=new Map;t.edges.forEach((Q,ot)=>{let Z=r.get(Q.source),lt=r.get(Q.target);if(!Z||!lt||Z.id===lt.id)return;let nt=f.get(Z.id)??0;if((f.get(lt.id)??0)<=nt||Math.abs((T.get(Z.id)??0)-(T.get(lt.id)??0))<.5)return;let at=`${Q.target}\0${nt}`;(B.get(at)??B.set(at,[]).get(at)).push(ot)});for(let Q of B.values())Q.length<2||(Q.sort((ot,Z)=>(T.get(t.edges[ot].source)??0)-(T.get(t.edges[Z].source)??0)),Q.forEach((ot,Z)=>{V[ot]=(Z-(Q.length-1)/2)*W}))}let P=4,F=(B,Q,ot,Z,lt,nt)=>{let J=1/0;for(let Tt of o){if(Tt===B)continue;let At=i(Tt)/2+P;if(Math.abs(_.get(Tt)-Q)>=At)continue;let rt=s(Tt)/2,pt=T.get(Tt);pt+rt<=ot||pt-rt>=Z||(J=Math.min(J,pt-rt))}if(J===1/0)return{flow:Q};let at=lt-1,it=lt<g-1?lt:-1,Lt=nt<Q?at:it;return Lt<0&&(Lt=nt<Q?it:at),Lt<0?{flow:Q}:{flow:x(Lt),jogCross:(ot+J)/2}},Y=0,z=[];t.edges.forEach((B,Q)=>{let ot=r.get(B.source),Z=r.get(B.target);if(!ot||!Z||ot.id===Z.id)return;let lt=_.get(ot.id),nt=T.get(ot.id),J=_.get(Z.id),at=T.get(Z.id),it=i(ot.id)/2,Lt=i(Z.id)/2,Tt=s(ot.id)/2,At=s(Z.id)/2,rt=f.get(ot.id)??0,pt=f.get(Z.id)??0,gt,dt=!1;if(pt>rt){let ut=lt+it,yt=J-Lt;if(Math.abs(nt-at)<.5)gt=[G(ut,nt),G(yt,at)];else{let vt=(ut+yt)/2+V[Q];gt=[G(ut,nt),G(vt,nt),G(vt,at),G(yt,at)]}}else if(pt===rt){let ut=at>=nt,yt=nt+(ut?Tt:-Tt),vt=at+(ut?-At:At);if(Math.abs(lt-J)<.5)gt=[G(lt,yt),G(J,vt)];else{let Gt=(yt+vt)/2;gt=[G(lt,yt),G(lt,Gt),G(J,Gt),G(J,vt)]}}else{dt=!0;let ut=M+ZD+QD*Y;Y++;let yt=nt+Tt,vt=at+At,Gt=F(ot.id,lt,yt,ut,h(ot.id),J),Xt=F(Z.id,J,vt,ut,h(Z.id),lt);gt=[G(lt,yt),...Gt.jogCross!==void 0?[G(lt,Gt.jogCross),G(Gt.flow,Gt.jogCross)]:[],G(Gt.flow,ut),G(Xt.flow,ut),...Xt.jogCross!==void 0?[G(Xt.flow,Xt.jogCross),G(J,Xt.jogCross)]:[],G(J,vt)]}z.push({source:B.source,target:B.target,...B.label!==void 0&&{label:B.label},points:gt,back:dt,lineNumber:B.lineNumber})});let j=(B,Q,ot,Z)=>n?{x:B,y:ot,width:Q,height:Z}:{x:ot,y:B,width:Z,height:Q},K=t.lanes.map(B=>{let Q=j(0,N,k.get(B.id),w.get(B.id));return{id:B.id,label:B.label,...B.color!==void 0&&{color:B.color},...Q,headerSize:qD,lineNumber:B.lineNumber}}),$=new Map(t.phases.map((B,Q)=>[B.id,Q])),U=Array.from({length:g},()=>{});for(let B of t.nodes){if(B.phase===void 0)continue;let Q=$.get(B.phase);if(Q===void 0)continue;let ot=h(B.id),Z=U[ot];(Z===void 0||Q<Z)&&(U[ot]=Q)}let X=Array.from({length:g},()=>0),q=0;for(let B=0;B<g;B++){let Q=U[B];Q!==void 0&&Q>q&&(q=Q),X[B]=q}let et=(B,Q)=>(b[B]+b[Q])/2,tt=[];if(t.phases.length>0&&g>0){let B=0;for(let Q=1;Q<=g;Q++)if(Q===g||X[Q]!==X[B]){let ot=B,Z=Q-1,lt=t.phases[X[B]],nt=ot===0?0:et(ot-1,ot),J=Z===g-1?N:et(Z,Z+1);tt.push({id:lt.id,label:lt.label,...j(nt,J-nt,0,H),headerSize:KD,lineNumber:lt.lineNumber}),B=Q}}return{nodes:D,edges:z,lanes:K,phases:tt,width:n?N:H,height:n?H:N}}var Sh,UD,T1,tG,XD,jD,k1,eG,wQ,qD,KD,ZD,QD,rG=st(()=>{"use strict";x1();Sh=30,UD=64,T1=124,tG=44,XD=56,jD=40,k1=16,eG=22,wQ=tG+2*eG,qD=116,KD=30,ZD=28,QD=18});function xd(t,e){let{idPrefix:n,width:r,height:o,baseFill:a,colors:i}=e,s=(l,c)=>{t.append("marker").attr("id",l).attr("viewBox",`0 0 ${r} ${o}`).attr("refX",r).attr("refY",o/2).attr("markerWidth",r).attr("markerHeight",o).attr("orient","auto").append("polygon").attr("points",`0,0 ${r},${o/2} 0,${o}`).attr("fill",c)};s(`${n}-arrow`,a);for(let l of i??[])s(`${n}-arrow-${l.replace("#","")}`,l)}var Lh=st(()=>{"use strict"});var lG={};ye(lG,{renderSwimlaneForExport:()=>AQ});function CQ(t,e){if(t.length<3)return t.map((o,a)=>`${a?"L":"M"}${o.x} ${o.y}`).join(" ");let n=`M${t[0].x} ${t[0].y}`;for(let o=1;o<t.length-1;o++){let a=t[o-1],i=t[o],s=t[o+1],l=Math.hypot(i.x-a.x,i.y-a.y),c=Math.hypot(s.x-i.x,s.y-i.y);if(l<.01||c<.01){n+=` L${i.x} ${i.y}`;continue}let d=Math.min(e,l/2,c/2),u=i.x-(i.x-a.x)/l*d,f=i.y-(i.y-a.y)/l*d,p=i.x+(s.x-i.x)/c*d,m=i.y+(s.y-i.y)/c*d;n+=` L${u} ${f} Q${i.x} ${i.y} ${p} ${m}`}let r=t[t.length-1];return n+=` L${r.x} ${r.y}`,n}function _Q(t,e,n,r,o,a){let i=o-n,s=a-r,l=i*i+s*s,c=l>0?((t-n)*i+(e-r)*s)/l:0;return c=Math.max(0,Math.min(1,c)),Math.hypot(t-(n+c*i),e-(r+c*s))}function iG(t,e,n,r,o={}){let a=Math.min(n,r)/2,i=Math.min(o.tl??0,a),s=Math.min(o.tr??0,a),l=Math.min(o.br??0,a),c=Math.min(o.bl??0,a);return[`M${t+i},${e}`,`H${t+n-s}`,s?`A${s},${s} 0 0 1 ${t+n},${e+s}`:"",`V${e+r-l}`,l?`A${l},${l} 0 0 1 ${t+n-l},${e+r}`:"",`H${t+c}`,c?`A${c},${c} 0 0 1 ${t},${e+r-c}`:"",`V${e+i}`,i?`A${i},${i} 0 0 1 ${t+i},${e}`:"","Z"].join(" ")}function AQ(t,e,n,r,o,a={}){It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.title?40:0,s=a.exportDims?.width??n.width,l=(a.exportDims?.height??n.height)+0,c=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",s).attr("height",l).attr("viewBox",`0 0 ${s} ${l}`).style("font-family",Pt),d=c.append("defs"),u=or(r,o),f={error:r.colors.red,success:r.colors.green,terminate:r.text,neutral:r.border};xd(d,{idPrefix:"sw",width:kQ,height:TQ,baseFill:r.textMuted,colors:[f.error,f.success]});let p=c.append("g").attr("transform",`translate(0, ${i})`);e.title&&c.append("text").attr("x",s/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).text(e.title);let m=new Map;e.lanes.forEach((k,w)=>{let v=k.color??On(fl[w%fl.length],r)??r.border;m.set(k.id,v)});let g=e.direction==="LR",h=e.options["solid-fill"]==="on",S=k=>Ot(k,u,9),y=k=>{for(let w of n.lanes){let v=g?w.y:w.x,M=v+(g?w.height:w.width);if(k>=v&&k<=M)return S(m.get(w.id)??r.border)}return u},b=p.append("g").attr("class","dgmo-swimlane-lanes");for(let k of n.lanes){let w=m.get(k.id)??r.border,v=g?k.x:k.x+Nh,M=g?k.y+Nh:k.y,_=g?k.width:k.width-Nh*2,T=g?k.height-Nh*2:k.height;b.append("path").attr("d",iG(v,M,_,T,{tl:as,tr:as,br:as,bl:as})).attr("fill",Ot(w,u,9)).attr("stroke",Ot(r.border,u,60)).attr("stroke-width",1).attr("data-line-number",String(k.lineNumber));let R=g?k.headerSize:_,O=g?T:k.headerSize;b.append("path").attr("d",iG(v,M,R,O,g?{tl:as,bl:as}:{tl:as,tr:as})).attr("fill",Ot(w,u,16)).attr("opacity",.6),b.append("text").attr("x",g?v+12:v+_/2).attr("y",g?M+T/2:M+k.headerSize/2).attr("text-anchor",g?"start":"middle").attr("dominant-baseline","middle").attr("font-size",LQ).attr("font-weight","700").attr("fill",Ot(w,r.text,55)).text(k.label)}let E=p.append("g").attr("class","dgmo-swimlane-phases");n.phases.forEach((k,w)=>{w%2===1&&E.append("rect").attr("x",k.x).attr("y",k.y).attr("width",k.width).attr("height",k.height).attr("rx",as).attr("fill",r.text).attr("opacity",.05).attr("pointer-events","none"),E.append("text").attr("x",g?k.x+k.width/2:k.headerSize/2).attr("y",g?k.headerSize/2:k.y+k.height/2).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",vQ).attr("font-weight","700").attr("letter-spacing","0.06em").attr("fill",r.textMuted).attr("data-line-number",String(k.lineNumber)).text(k.label)});let x=a.activeTagGroup??null,N=k=>{if(x){let v=qt(x);if(k.tags[v]){let M=sr(k.tags,[...e.tagGroups],x);if(M&&M!=="#999999")return{fill:h?M:Ot(M,u,22),stroke:M}}}if(k.shape==="terminal")return k.event==="error"?{fill:h?f.error:Ot(f.error,u,22),stroke:f.error}:k.event==="success"?{fill:h?f.success:Ot(f.success,u,22),stroke:f.success}:k.event==="terminate"?{fill:Ot(r.text,u,30),stroke:r.text}:{fill:r.bg,stroke:r.textMuted};if(k.shape==="exclusive"||k.shape==="parallel")return{fill:Ot(r.surface,u,80),stroke:r.textMuted};let w=m.get(k.lane)??r.border;return{fill:h?w:Ot(w,u,20),stroke:Ot(w,r.text,40)}},L=new Map(n.nodes.map(k=>[k.id,k])),A=p.append("g").attr("class","dgmo-swimlane-edges");for(let k of n.edges){let w=L.get(k.target),v=r.textMuted,M="sw-arrow";w?.shape==="terminal"&&w.event==="error"?(v=f.error,M=`sw-arrow-${f.error.replace("#","")}`):w?.shape==="terminal"&&w.event==="success"&&(v=f.success,M=`sw-arrow-${f.success.replace("#","")}`);let _=CQ(k.points,MQ);if(A.append("path").attr("d",_).attr("fill","none").attr("stroke",v).attr("stroke-width",NQ).attr("stroke-dasharray",k.back?"5 4":null).attr("marker-end",`url(#${M})`).attr("data-line-number",String(k.lineNumber)),k.label){let T=[],R=0;for(let q=0;q<k.points.length-1;q++){let et=k.points[q],tt=k.points[q+1],B=Math.abs(tt.x-et.x)+Math.abs(tt.y-et.y);T.push(B),R+=B}let O=R/2,I=0;for(let q=0;q<T.length;q++){if(O<=T[q]||q===T.length-1){I=q;break}O-=T[q]}let H=k.points[I],G=k.points[I+1]??H,D=T[I]>0?O/T[I]:.5,W={x:H.x+(G.x-H.x)*D,y:H.y+(G.y-H.y)*D},V=Math.abs(G.x-H.x)>=Math.abs(G.y-H.y),P=7,F=(q,et)=>{let tt=1/0;for(let B of n.edges)if(B!==k)for(let Q=0;Q<B.points.length-1;Q++){let ot=_Q(q,et,B.points[Q].x,B.points[Q].y,B.points[Q+1].x,B.points[Q+1].y);ot<tt&&(tt=ot)}return tt},Y=k.label.length*oG*.6,z=(q,et,tt)=>{let B=tt===0?[q-Y/2,q,q+Y/2]:[q,q+tt*Y/2,q+tt*Y];return Math.min(...B.map(Q=>F(Q,et)))},j=10,K,$,U,X;if(V){let q=z(W.x,W.y-P,0),et=z(W.x,W.y+P,0),tt=q<j&&et>q;K=W.x,$=W.y+(tt?P:-P),U="middle",X=tt?"hanging":"auto"}else{let q=z(W.x+P,W.y,1),et=z(W.x-P,W.y,-1),tt=q<j&&et>q;K=W.x+(tt?-P:P),$=W.y,U=tt?"end":"start",X="middle"}A.append("text").attr("x",K).attr("y",$).attr("text-anchor",U).attr("dominant-baseline",X).attr("font-size",oG).attr("fill",v===r.textMuted?r.textMuted:v).attr("stroke",y($)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}}let C=p.append("g").attr("class","dgmo-swimlane-nodes");for(let k of n.nodes){let{fill:w,stroke:v}=N(k),M=C.append("g").attr("data-line-number",String(k.lineNumber)).attr("data-lane",k.lane),_=k.x,T=k.y;if(k.shape==="exclusive"||k.shape==="parallel"){let R=k.width/2;if(M.append("polygon").attr("points",`${_},${T-R} ${_+R},${T} ${_},${T+R} ${_-R},${T}`).attr("fill",w).attr("stroke",v).attr("stroke-width",C1),k.shape==="parallel"){let O=r.textMuted;M.append("line").attr("x1",_).attr("y1",T-R/2.4).attr("x2",_).attr("y2",T+R/2.4).attr("stroke",O).attr("stroke-width",2.4),M.append("line").attr("x1",_-R/2.4).attr("y1",T).attr("x2",_+R/2.4).attr("y2",T).attr("stroke",O).attr("stroke-width",2.4),M.append("text").attr("x",_).attr("y",T+R+12).attr("text-anchor","middle").attr("font-size",vh-1).attr("fill",r.textMuted).attr("stroke",y(T+R+12)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}else sG(M,k.label,_,T,r.text,vh-1,!0,y(T))}else if(k.shape==="terminal"){let R=k.width/2;M.append("circle").attr("cx",_).attr("cy",T).attr("r",R).attr("fill",w).attr("stroke",v).attr("stroke-width",k.event==="none"?C1:2.4),k.event==="success"&&M.append("circle").attr("cx",_).attr("cy",T).attr("r",R-4).attr("fill","none").attr("stroke",v).attr("stroke-width",1);let O=!1;for(let H of n.edges){let G=H.target===k.id?H.points[H.points.length-1]:H.source===k.id?H.points[0]:void 0;G&&G.y>T+R*.5&&(O=!0)}let I=O?T-R-6:T+R+12;M.append("text").attr("x",_).attr("y",I).attr("text-anchor","middle").attr("font-size",vh-1).attr("fill",r.text).attr("stroke",y(I)).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke").text(k.label)}else{M.append("rect").attr("x",_-k.width/2).attr("y",T-k.height/2).attr("width",k.width).attr("height",k.height).attr("rx",aG).attr("fill",w).attr("stroke",v).attr("stroke-width",C1),k.shape==="subprocess"&&M.append("rect").attr("x",_-k.width/2+3).attr("y",T-k.height/2+3).attr("width",k.width-6).attr("height",k.height-6).attr("rx",aG-2).attr("fill","none").attr("stroke",v).attr("stroke-width",1);let R=Le(w,r.textOnFillLight,r.textOnFillDark);sG(M,k.label,_,T,R,vh)}}}function RQ(t,e){let n=[],r="";for(let o of t)r===""?r=o:r.length+1+o.length<=e?r+=" "+o:(n.push(r),r=o);return r&&n.push(r),n}function sG(t,e,n,r,o,a,i=!1,s){let l=e.split(/\s+/),c;if(i)c=l.length===1?[e]:RQ(l,7);else if(e.length<=14||l.length===1)c=[e];else{let f=Math.ceil(l.length/2);c=[l.slice(0,f).join(" "),l.slice(f).join(" ")]}let d=a*1.2,u=r-(c.length-1)*d/2;c.forEach((f,p)=>{let m=t.append("text").attr("x",n).attr("y",u+p*d).attr("text-anchor","middle").attr("dominant-baseline","middle").attr("font-size",a).attr("fill",o);s&&m.attr("stroke",s).attr("stroke-width",3.5).attr("stroke-linejoin","round").attr("paint-order","stroke"),m.text(f)})}var vh,LQ,vQ,oG,aG,C1,NQ,MQ,kQ,TQ,as,Nh,cG=st(()=>{"use strict";qn();an();Lh();tn();wr();je();vh=12,LQ=12,vQ=12,oG=11,aG=8,C1=1.5,NQ=1.6,MQ=11,kQ=9,TQ=6.4,as=10,Nh=2});function PQ(t){let e=[],n=t.split(/(\s+)/);for(let r of n){if(/^\s+$/.test(r))continue;let o=r.split(/(?<=-)(?=\S)/);e.push(...o)}return e}function dG(t,e,n,r){let o=e-A1,a=[],i="";for(let s of t){let l=i&&!i.endsWith("-")?" ":"",c=i+l+s;if(_t(c,n)<=o)i=c;else if(!i)i=s;else{if(a.push(i),a.length>=r)return null;i=s}}return i&&a.push(i),a.length>r?null:a}function uG(t,e,n){let r=e-A1,o=[...t],a=o[o.length-1];return _t(a,n)>r&&(o[o.length-1]=nr(a,n,r)),o}function fG(t,e,n,r,o=pG){if(!t)return{lines:[""],fontSize:n};let a=PQ(t);for(let c=n;c>=r;c--){let d=dG(a,e,c,o);if(d)return{lines:uG(d,e,c),fontSize:c}}let i=dG(a,e,r,999)??[t],s=i.slice(0,o),l=uG(s,e,r);if(i.length>o){let c=l[l.length-1];if(!c.endsWith("\u2026")){let d=e-A1;_t(c+"\u2026",r)>d?l[l.length-1]=nr(c,r,d):l[l.length-1]=c+"\u2026"}}return{lines:l,fontSize:r}}function OQ(t){return Math.max(mG,DQ-t*GQ)}function Mh(t,e,n,r,o){let a=OQ(n),i=fG(t,r,a,mG,pG),s=[],l=_1;if(!o&&e&&e.length>0){let c=IQ;for(let d of e){if(c<=0)break;let u=ea(d),f=fG(u,r,_1,_1,c);s.push(...f.lines),c-=f.lines.length,l=f.fontSize}}return{labelLines:i.lines,labelFontSize:i.fontSize,descLines:s,descFontSize:l}}var A1,pG,IQ,DQ,mG,GQ,_1,R1=st(()=>{"use strict";Za();en();A1=16,pG=3,IQ=2;DQ=17,mG=9,GQ=3,_1=10});var hG={};ye(hG,{layoutMindmap:()=>Th});function Th(t,e,n){let r=t.roots;if(r.length===0)return{nodes:[],edges:[],width:0,height:0};let o=n?.hiddenCounts??new Map,a=n?.activeTagGroup??null,i=n?.hideDescriptions??!1,s=n?.ctx??Ee.identity(),l={rootWidth:s.structural($Q),depth1Width:s.structural(HQ),leafWidth:s.structural(WQ),hGap:s.aesthetic(zQ),vGap:s.aesthetic(UQ),margin:s.aesthetic(XQ),multiRootGap:s.aesthetic(jQ)};eJ(r);let c=[],d=f=>{for(let p of f)c.push(p),d(p.children)};d(r),wa(c,t.tagGroups);let u=t.tagGroups;return r.length===1?gG(r[0],o,i,u,a,l):qQ(r,t,o,i,u,a,l)}function gG(t,e,n,r=[],o=null,a){let i=[],s=G1(0,a),l=O1(t,n,a),c=t.children,{right:d,left:u}=QQ(c,n,a),f=kh(d,1,n,a),p=kh(u,1,n,a),m=Math.max(f,p,l),g=0,h=m/2-l/2;i.push({node:t,x:g,y:h,width:s,height:l,depth:0,direction:"right",subtreeHeight:m});let S=h+l/2,y=g+s+a.hGap;I1(d,y,S,1,"right",n,i,a);let b=g-a.hGap;return I1(u,b,S,1,"left",n,i,a),ZQ(i,e,n,t,r,o,a)}function qQ(t,e,n,r,o,a,i){let s=[];for(let p of t)s.push(gG(p,n,r,o,a,i));let l=s.reduce((p,m)=>p+m.width,0)+i.multiRootGap*(s.length-1),c=Math.max(...s.map(p=>p.height)),d=[],u=[],f=0;for(let p of s){let m=(c-p.height)/2;for(let g of p.nodes)d.push({...g,x:g.x+f,y:g.y+m});for(let g of p.edges)u.push({sourceId:g.sourceId,targetId:g.targetId,path:JQ(g.path,f,m)});f+=p.width+i.multiRootGap}return{nodes:d,edges:u,width:l,height:c}}function I1(t,e,n,r,o,a,i,s){if(t.length===0)return;let l=kh(t,r,a,s),c=n-l/2;for(let d of t){let u=G1(r,s),f=O1(d,a,s),p=D1(d,r,a,s),m=c+p/2-f/2,g=o==="right"?e:e-u;if(i.push({node:d,x:g,y:m,width:u,height:f,depth:r,direction:o,subtreeHeight:p}),d.children.length>0){let h=m+f/2,S=o==="right"?g+u+s.hGap:g-s.hGap;I1(d.children,S,h,r+1,o,a,i,s)}c+=p+s.vGap}}function kh(t,e,n,r){if(t.length===0)return 0;let o=0;for(let a of t)o+=D1(a,e,n,r);return o+=r.vGap*(t.length-1),o}function D1(t,e,n,r){let o=O1(t,n,r);if(t.children.length===0)return o;let a=kh(t.children,e+1,n,r);return Math.max(o,a)}function KQ(t,e,n){return t.color?t.color:sr(t.metadata,[...e],n)}function ZQ(t,e,n,r,o=[],a=null,i){let s=1/0,l=1/0,c=-1/0,d=-1/0;for(let E of t)s=Math.min(s,E.x),l=Math.min(l,E.y),c=Math.max(c,E.x+E.width),d=Math.max(d,E.y+E.height);let u=-s+i.margin,f=-l+i.margin,p=c-s+i.margin*2,m=d-l+i.margin*2,g=new Map;for(let E of t)g.set(E.node.id,E);let h=[],S=[];for(let E of t){let x=KQ(E.node,o,a),N=e.get(E.node.id);h.push({id:E.node.id,label:E.node.label,...E.node.description!==void 0&&{description:[...E.node.description]},metadata:{...E.node.metadata},lineNumber:E.node.lineNumber,...x!==void 0&&{color:x},x:E.x+u,y:E.y+f,width:E.width,height:E.height,depth:E.depth,angle:0,radius:0,...N!==void 0&&{hiddenCount:N},hasChildren:e.has(E.node.id)||E.node.children.length>0})}let y=new Map;for(let E of t)if(E.node.parentId){let x=y.get(E.node.parentId)??[];x.push(E),y.set(E.node.parentId,x)}let b=[];for(let[E,x]of y){let N=x.filter(A=>A.direction==="right"),L=x.filter(A=>A.direction==="left");N.length>0&&b.push([E,N]),L.length>0&&b.push([E,L])}for(let[E,x]of b){let N=g.get(E),L=N.x+u,A=N.y+f,C=x[0].direction==="left",k=C?L:L+N.width,w=A+N.height/2,v=x[0],M=C?v.x+u+v.width:v.x+u,_=(k+M)/2;if(x.length===1){let T=x[0],R=C?T.x+u+T.width:T.x+u,O=T.y+f+T.height/2;S.push({sourceId:E,targetId:T.node.id,path:`M ${k} ${w} L ${_} ${w} L ${_} ${O} L ${R} ${O}`})}else{S.push({sourceId:E,targetId:E,path:`M ${k} ${w} L ${_} ${w}`});let T=x.map(I=>I.y+f+I.height/2),R=Math.min(...T),O=Math.max(...T);S.push({sourceId:E,targetId:E,path:`M ${_} ${R} L ${_} ${O}`});for(let I=0;I<x.length;I++){let H=x[I],G=C?H.x+u+H.width:H.x+u,D=T[I];S.push({sourceId:E,targetId:H.node.id,path:`M ${_} ${D} L ${G} ${D}`})}}}return{nodes:h,edges:S,width:p,height:m}}function QQ(t,e,n){if(t.length<=1)return{right:[...t],left:[]};if(t.length===2)return{right:[t[0]],left:[t[1]]};let r=t.map((l,c)=>({index:c,node:l,height:D1(l,1,e,n)})),o=[],a=[],i=0,s=0;for(let l of r)i<=s?(o.push(l.node),i+=l.height):(a.push(l.node),s+=l.height);return{right:o,left:a}}function JQ(t,e,n){return e===0&&n===0?t:t.replace(/([ML])\s*([\d.e+-]+)\s+([\d.e+-]+)/g,(r,o,a,i)=>`${o} ${parseFloat(a)+e} ${parseFloat(i)+n}`)}function G1(t,e){return t===0?e.rootWidth:t===1?e.depth1Width:e.leafWidth}function O1(t,e,n){let r=tJ(t),o=G1(r,n),a=Mh(t.label,t.description?[...t.description]:void 0,r,o,e),i=a.labelLines.length,l=(i<=1?FQ:BQ*i)+VQ;return a.descLines.length>0&&(l+=YQ*a.descLines.length+4),l}function tJ(t){return P1.get(t.id)??0}function eJ(t){P1.clear();let e=(n,r)=>{for(let o of n)P1.set(o.id,r),e(o.children,r+1)};e(t,0)}var $Q,HQ,WQ,FQ,BQ,YQ,VQ,zQ,UQ,XQ,jQ,P1,$1=st(()=>{"use strict";je();R1();mr();$Q=180,HQ=150,WQ=120,FQ=28,BQ=18,YQ=14,VQ=10,zQ=40,UQ=12,XQ=40,jQ=60;P1=new Map});var bG={};ye(bG,{collapseMindmapTree:()=>rJ});function yG(t){return{id:t.id,label:t.label,...t.description!==void 0&&{description:[...t.description]},metadata:{...t.metadata},children:t.children.map(yG),parentId:t.parentId,lineNumber:t.lineNumber,...t.color!==void 0&&{color:t.color},...t.collapsed!==void 0&&{collapsed:t.collapsed}}}function rJ(t,e){return e.size===0?{roots:[...t],hiddenCounts:new Map}:od(t,e,nJ)}var nJ,xG=st(()=>{"use strict";yf();nJ={getId:t=>t.id,getChildren:t=>t.children,clone:yG,setChildren:(t,e)=>{t.children=e},countsAsHidden:()=>!0}});var SG={};ye(SG,{renderMindmap:()=>EG,renderMindmapForExport:()=>uJ});function sJ(t,e,n,r){let o=n??t.primary;return ie(t,o,e,{...r!==void 0&&{solid:r}})}function lJ(t,e){return e??t.primary}function dJ(t,e){let n=cJ[t];return n&&n in e.colors?e.colors[n]:e.colors.gray}function EG(t,e,n,r,o,a,i,s,l,c,d){let u=!!i,f=i?.width??(t.getBoundingClientRect().width||800),p=i?.height??(t.getBoundingClientRect().height||600);It(t).selectAll("*").remove();let m=It(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").style("font-family",Pt),g=d?.controlsHost==="app",h=!!d?.onToggleColorByDepth||!!d?.onToggleDescriptions,S=e.tagGroups.length>0||h&&!g,y=!u&&S,b=y?Cr({groups:e.tagGroups,position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},f)+Bn:0,E=!!e.title&&e.options["no-title"]!=="on",x=!u&&E,N=x?wG:0,L=f,A=p-wd*2-b-N,C=u?Ee.identity():Ee.fromBox(L,n.width,A,n.height),k=n;if(C.factor<1){let O=new Map;for(let H of n.nodes)H.hiddenCount!=null&&H.hiddenCount>0&&O.set(H.id,H.hiddenCount);let I=H=>Th(e,r,{interactive:!u,...O.size>0&&{hiddenCounts:O},activeTagGroup:c??null,...l!==void 0&&{hideDescriptions:l},ctx:H});k=I(C);for(let H=0;H<3&&!C.isBelowFloor;H++){let G=Math.min(L/k.width,A/k.height);if(G>=.999)break;C=Ee.fromFactor(C.factor*G),k=I(C)}}let w=u?1:Math.min(1,k.width>0?L/k.width:1,k.height>0?A/k.height:1),v=k.width*w,M=k.height*w,_=Math.max(0,(L-v)/2),T=wd+b+N+Math.max(0,(A-M)/2),R=m.append("g").attr("transform",`translate(${_}, ${T})${w<1?` scale(${w})`:""}`);if(C.isBelowFloor&&m.attr("width","100%"),E){let O=x?m:R,I=x?f/2:k.width/2,H=x?wd+20:20,G=O.append("text").attr("x",I).attr("y",H).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("class","chart-title").text(e.title);e.titleLineNumber&&G.attr("data-line-number",e.titleLineNumber),a&&e.titleLineNumber&&G.style("cursor","pointer").on("click",()=>a(e.titleLineNumber))}if(y){let O=m.append("g").attr("class","mindmap-legend-fixed").attr("transform",`translate(0, ${wd+N})`),I=new Map;for(let P of k.nodes)for(let F of e.tagGroups){let Y=F.name.toLowerCase(),z=P.metadata[Y];z&&(I.has(Y)||I.set(Y,new Set),I.get(Y).add(z.toLowerCase()))}let H=[];d?.onToggleDescriptions&&H.push({id:"descriptions",type:"toggle",label:"Descriptions",active:!l,onToggle:P=>d.onToggleDescriptions(P)}),d?.onToggleColorByDepth&&H.push({id:"depth-colors",type:"toggle",label:"Depth Colors",active:d.colorByDepth??!1,onToggle:d.onToggleColorByDepth});let G=H.length>0?{toggles:H}:void 0,D={groups:e.tagGroups.map(P=>{let F=I.get(P.name.toLowerCase());return{name:P.name,...P.alias!==void 0&&{alias:P.alias},entries:P.entries.filter(Y=>F?.has(Y.value.toLowerCase())).map(Y=>({value:Y.value,color:Y.color}))}}),position:{placement:"top-center",titleRelation:"below-title"},mode:d?.exportMode?"export":"preview",...G!==void 0&&{controlsGroup:G},...d?.controlsHost!==void 0&&{controlsHost:d.controlsHost}},W={text:r.text,textMuted:r.textMuted,bg:r.bg,surface:r.surface,primary:r.primary},V={...d?.onToggleControlsExpand!==void 0&&{onControlsExpand:d.onToggleControlsExpand},onControlsToggle:(P,F)=>{P==="depth-colors"&&d?.onToggleColorByDepth&&d.onToggleColorByDepth(F),P==="descriptions"&&d?.onToggleDescriptions&&d.onToggleDescriptions(F)}};mn(O,{...D,palette:W,isDark:o,width:f,activeGroup:d?.colorByDepth?null:c!==void 0?c:e.options["active-tag"]??null,hiddenAttributes:new Set,...d?.controlsExpanded!==void 0&&{controlsExpanded:d.controlsExpanded},callbacks:V})}for(let O of k.edges)R.append("path").attr("class","mindmap-edge").attr("d",O.path).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5).attr("stroke-opacity",.5);for(let O of k.nodes){let I=O.radius===0&&k.nodes.indexOf(O)===0,H=I?iJ:1.5,G=d?.colorByDepth?dJ(O.depth,r):O.color,D=sJ(r,o,G,e.options["solid-fill"]==="on"),W=lJ(r,G),V=Le(D,r.textOnFillLight,r.textOnFillDark),P=R.append("g").attr("class","mindmap-node").attr("data-line-number",O.lineNumber);if(c){let B=qt(c),Q=O.metadata[B];Q&&P.attr(`data-tag-${B}`,Q.toLowerCase())}O.hasChildren&&P.attr("data-node-toggle",O.id).attr("tabindex","0").attr("role","button").attr("aria-expanded",O.hiddenCount!=null&&O.hiddenCount>0?"false":"true").attr("aria-label",O.label),P.append("rect").attr("x",O.x).attr("y",O.y).attr("width",O.width).attr("height",O.height).attr("rx",Ch).attr("ry",Ch).attr("fill",D).attr("stroke",W).attr("stroke-width",H);let F=O.hiddenCount!=null&&O.hiddenCount>0,Y=!l&&!!O.description&&!F,z=Mh(O.label,O.description,O.depth,O.width,l||F),{labelLines:j,labelFontSize:K,descLines:$,descFontSize:U}=z,X=j.length,q=X<=1?oJ:H1*X,et=Y?q:O.height,tt=O.x+O.width/2;if(X<=1){let B=O.y+et/2+K*.35;P.append("text").attr("x",tt).attr("y",B).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",V).text(j[0])}else{let B=H1*(X-1),Q=O.y+et/2-B/2+K*.35,ot=P.append("text").attr("x",tt).attr("text-anchor","middle").attr("font-size",K).attr("font-weight",I?"bold":"normal").attr("fill",V);for(let Z=0;Z<j.length;Z++)ot.append("tspan").attr("x",tt).attr("y",Q+Z*H1).text(j[Z])}if((j.length>1||j[0]!==O.label)&&P.append("title").text(O.label),Y&&$.length>0){let B=O.y+q;if(P.append("line").attr("x1",O.x).attr("y1",B).attr("x2",O.x+O.width).attr("y2",B).attr("stroke",W).attr("stroke-opacity",.3).attr("stroke-width",1),$.length<=1){let Q=B+4+U,ot=ea($[0]),Z=P.append("text").attr("x",tt).attr("y",Q).attr("text-anchor","middle").attr("font-size",U).attr("fill",V);bn(Z,ot,r,U)}else{let Q=B+4+U;for(let ot=0;ot<$.length;ot++){let Z=ea($[ot]),lt=P.append("text").attr("x",tt).attr("y",Q+ot*aJ).attr("text-anchor","middle").attr("font-size",U).attr("fill",V);bn(lt,Z,r,U)}}}if(!u&&O.hiddenCount!=null&&O.hiddenCount>0){let B=`collapse-clip-${O.id}`;R.append("defs").append("clipPath").attr("id",B).append("rect").attr("x",O.x).attr("y",O.y).attr("width",O.width).attr("height",O.height).attr("rx",Ch).attr("ry",Ch),P.append("rect").attr("class","collapse-bar").attr("x",O.x).attr("y",O.y+O.height-6).attr("width",O.width).attr("height",6).attr("fill",W).attr("clip-path",`url(#${B})`)}a&&P.style("cursor","pointer").on("click",B=>{O.hasChildren&&s?(B.stopPropagation(),s(O.id)):a(O.lineNumber)}),u||P.on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)})}}function uJ(t,e,n){let r=Zc(t,n);if(r.error)return"";let o=e==="dark",a=r.options["no-descriptions"]==="true",i=Th(r,n,{interactive:!1,hideDescriptions:a}),s=r.title&&r.options["no-title"]!=="on"?wG:0,l=i.width+wd*2,c=i.height+wd*2+s;return ad(l,c,d=>(EG(d,r,i,n,o,void 0,{width:l,height:c},void 0,a),id(d,e)))}var wd,wG,oJ,H1,aJ,Ch,iJ,cJ,LG=st(()=>{"use strict";je();qn();an();Zg();tn();Eg();$1();R1();Ro();Za();Br();Tr();_o();mr();wd=20,wG=30,oJ=28,H1=18,aJ=14,Ch=6,iJ=2.5;cJ=["red","orange","yellow","green","blue","purple","teal","cyan"]});var TG={};ye(TG,{layoutWireframe:()=>LJ});function LJ(t,e,n,r=!0){W1=r?kG:hJ;let o=t.formFactor==="mobile"?pJ:fJ,a=n??o,i=t.title&&t.options["no-title"]!=="on"?xJ:0,s=a-NG*2,l=vJ(t.roots,s,t.formFactor),c=0;for(let p of l)c=Math.max(c,p.y+p.height);let d=[],u=c+24;for(let p of t.modals){let m=Math.min(s*.7,600),g=(s-m)/2,h=Ed(p,g,u,m);d.push(h),u+=h.height+24}let f=(d.length>0?d[d.length-1].y+d[d.length-1].height:c)+NG*2+i;return{width:a,height:f,titleHeight:i,nodes:l,modalNodes:d}}function vJ(t,e,n){let r=[],o=0,a=[],i=[];for(let s of t){let l=s.label.toLowerCase().split(/\s+/)[0];MG.has(l)||n==="mobile"?(i.length>0&&(a.push(i),i=[]),a.push([s])):i.push(s)}i.length>0&&a.push(i);for(let s of a){if(s.length===1&&n!=="mobile"){let l=s[0],c=l.label.toLowerCase().split(/\s+/)[0];if(MG.has(c)){let d=Ed(l,0,o,e);c==="header"||c==="top"?d.height=Math.max(d.height,EJ):d.height=Math.max(d.height,SJ),r.push(d),o+=d.height+16;continue}}if(n==="mobile"||s.length===1)for(let l of s){let c=Ed(l,0,o,e);r.push(c),o+=c.height+16}else{let l=NJ(s,e),c=0,d=0,u=[];for(let f=0;f<s.length;f++){let p=l[f],m=Ed(s[f],c,o,p);u.push(m),d=Math.max(d,m.height),c+=p+12}for(let f of u)f.height=d;r.push(...u),o+=d+16}}return r}function NJ(t,e){let r=(t.length-1)*12,o=e-r,a=new Array(t.length).fill(0),i=0,s=0;for(let l=0;l<t.length;l++){let c=t[l].label.toLowerCase().split(/\s+/)[0],d=wJ[c];d!==void 0&&d>0?(a[l]=o*d,i+=a[l]):s++}if(s>0){let c=Math.max(0,o-i)/s;for(let d=0;d<a.length;d++)a[d]===0&&(a[d]=Math.max(40,c))}for(let l=0;l<a.length;l++)a[l]=Math.max(40,a[l]);return a}function Ed(t,e,n,r){let o={id:t.id,x:e,y:n,width:r,height:0,element:t,children:[]},a=t.type==="nav"||t.type==="tabs";if(!t.isContainer||t.children.length===0||a)return o.height=kJ(t),o;let i=t.metadata._inlineRow==="true"||t.metadata._labelField==="true",s=i?0:W1,l=i?0:yJ,c=i?0:bJ,d=r-c*2,u=c;if(t.orientation==="horizontal"){let f=MJ(t.children,d),p=u,m=0,g=[];for(let h=0;h<t.children.length;h++){let S=t.children[h],y=f[h],b=Ed(S,p,s,y);g.push(b),o.children.push(b),m=Math.max(m,b.height),p+=y+8}for(let h of g)h.height=m;o.height=s+m+l}else{let f=s,p=CJ(t.children);p>0&&(o.fieldAlignX=p);for(let m of t.children){let g=Ed(m,u,f,d);o.children.push(g),f+=g.height+TJ(m)}o.height=f+l}return t.states.includes("collapsed")&&(o.height=W1,o.children=[]),o}function MJ(t,e){let r=(t.length-1)*8,o=Math.max(40,(e-r)/t.length);return t.map(()=>o)}function kJ(t){return t.type==="heading"?t.headingLevel===2?_h.subheading??36:_h.heading??48:t.type==="textInput"&&t.fieldVariant==="textarea"?80:t.type==="table"?32+(t.tableData?.length||t.tableRows||0)*28+8:t.type==="image"?t.imageHint==="round"||t.imageHint==="wide"?80:_h.image??120:t.metadata._labelField==="true"?36:_h[t.type]??24}function TJ(t){return t.type==="heading"&&t.headingLevel===2?vG.subheading??12:vG[t.type]??8}function CJ(t){let e=0,n=0;for(let r of t)if(r.metadata._labelField==="true"&&r.children.length>=2){let o=r.children[0],a=_t(o.label,gJ);e=Math.max(e,a),n++}return n<2?0:e+mJ}var fJ,pJ,mJ,gJ,_h,vG,kG,hJ,yJ,W1,bJ,NG,xJ,wJ,MG,EJ,SJ,CG=st(()=>{"use strict";en();fJ=1200,pJ=375,mJ=16,gJ=13,_h={textInput:36,button:40,dropdown:36,checkbox:24,radio:24,heading:48,subheading:36,divider:24,text:22,listItem:24,image:120,progress:28,chart:160,alert:40,nav:44,tabs:44},vG={heading:16,subheading:12,divider:12,textInput:8,dropdown:8,checkbox:8,radio:8,button:8,text:12,listItem:4,group:16,image:12,progress:12,chart:16,alert:12,nav:12,tabs:12,table:16},kG=32,hJ=10,yJ=12,W1=kG,bJ=12,NG=20,xJ=40,wJ={sidebar:.25,side:.25,left:.25,right:.25,main:0,content:0,center:0},MG=new Set(["header","top","footer","bottom"]),EJ=60,SJ=40});var DG={};ye(DG,{renderWireframe:()=>RJ});function AJ(t,e){let n=_J[t];return n?n(e):null}function IG(t,e){for(let n of t.states){let r=AJ(n,e);if(r)return r}return null}function RJ(t,e,n,r,o,a,i,s,l){let c=l??{},d=c.exportDims??i,u=c.theme??s;It(t).selectAll(":not([data-d3-tooltip])").remove();let f=!!d,p=d?.width??t.clientWidth,m=d?.height??t.clientHeight,g=f?Ee.identity():Ee.from(p,n.width),h=It(t).append("svg").attr("viewBox",`0 0 ${n.width} ${n.height}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);f?h.attr("width",p).attr("height",m):h.attr("width","100%").attr("height","auto").style("display","block");let S={palette:r,isTransparent:u==="transparent",isDark:o,showGroupLabels:c.showGroupLabels??!0,solid:e.options["solid-fill"]==="on"};S.isTransparent||h.append("rect").attr("width",n.width).attr("height",n.height).attr("fill",r.bg).attr("rx",8);let y=h.append("g").attr("transform","translate(20, 20)"),b=0,E=!!e.title&&e.options["no-title"]!=="on",x=g.text(20);f&&E&&(y.append("text").attr("x",0).attr("y",x).attr("fill",r.text).attr("font-size",x).attr("font-weight","700").text(e.title),b=n.titleHeight);let N=y.append("g").attr("transform",`translate(0, ${b})`);for(let L of n.nodes)kf(N,L,S,0);if(n.modalNodes.length>0){let L=N.append("g").attr("class","wireframe-modals");for(let A of n.modalNodes)ZJ(L,A,S)}}function kf(t,e,n,r){let o=e.element,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",o.lineNumber);if(o.states.includes("disabled")&&a.attr("opacity",.5),o.isSkeleton&&o.type!=="skeleton"){PG(a,e,n);return}switch(o.type){case"group":IJ(a,e,n,r);break;case"textInput":PJ(a,e,n);break;case"button":DJ(a,e,n);break;case"dropdown":GJ(a,e,n);break;case"checkbox":OJ(a,e,n);break;case"radio":$J(a,e,n);break;case"heading":HJ(a,e,n);break;case"divider":WJ(a,e,n);break;case"text":AG(a,e,n);break;case"listItem":FJ(a,e,n);break;case"nav":BJ(a,e,n);break;case"tabs":YJ(a,e,n);break;case"table":VJ(a,e,n);break;case"image":UJ(a,e,n);break;case"skeleton":XJ(a,e,n);break;case"alert":jJ(a,e,n);break;case"progress":qJ(a,e,n);break;case"chart":KJ(a,e,n);break;default:AG(a,e,n)}}function IJ(t,e,n,r){let{palette:o,isTransparent:a}=n,i=e.element;if(i.metadata._inlineRow==="true"||i.metadata._labelField==="true"){for(let d of e.children)kf(t,d,n,r);return}let s=[12,7,4,2],l=s[Math.min(r,s.length-1)],c=Ot(o.textMuted,o.bg,l);if(a?t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",o.border).attr("stroke-width",1).attr("rx",Mf):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("stroke",o.border).attr("stroke-width",1).attr("rx",Mf),i.label&&n.showGroupLabels&&t.append("text").attr("x",10).attr("y",18).attr("fill",o.textMuted).attr("font-size",11).attr("font-weight","600").attr("letter-spacing","0.5px").text(i.label.toUpperCase()),i.states.includes("collapsed")){t.append("text").attr("x",e.width-20).attr("y",18).attr("fill",o.textMuted).attr("font-size",12).attr("opacity",.6).text("\u25B6");return}i.states.includes("scrollable")&&t.append("rect").attr("x",e.width-6).attr("y",28).attr("width",3).attr("height",Math.min(e.height-36,40)).attr("fill",o.border).attr("rx",1.5);for(let d of e.children)kf(t,d,n,r+1)}function PJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=e.height;if(t.append("rect").attr("width",e.width).attr("height",i).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",RG),a.fieldVariant==="password"?t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.text).attr("font-size",16).text("\u2022 \u2022 \u2022 \u2022 \u2022 \u2022"):t.append("text").attr("x",10).attr("y",i/2+4).attr("fill",r.textMuted).attr("font-size",13).text(a.label||"Text input"),a.fieldVariant!=="password"){let s=Math.min(_t(a.label||"Text input",13)+14,e.width-20);t.append("line").attr("x1",s).attr("y1",8).attr("x2",s).attr("y2",i-8).attr("stroke",r.primary).attr("stroke-width",1.5).attr("opacity",.6)}if(a.fieldVariant==="textarea")for(let s=0;s<3;s++)t.append("line").attr("x1",e.width-12+s*3).attr("y1",i-4).attr("x2",e.width-4).attr("y2",i-12+s*3).attr("stroke",r.border).attr("stroke-width",1)}function DJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.states.includes("ghost"),s=IG(a,r),c=a.states.includes("primary")?r.primary:r.secondary,d=r.bg;s&&(c=s),i||o?(t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",c).attr("stroke-width",1.5).attr("rx",_G),d=c):t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",c).attr("rx",_G),t.append("text").attr("x",e.width/2).attr("y",e.height/2+4).attr("fill",d).attr("font-size",13).attr("font-weight","600").attr("text-anchor","middle").text(a.label)}function GJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.bg).attr("stroke",r.border).attr("rx",RG),t.append("text").attr("x",10).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(a.label||(a.options?.[0]??"Select..."));let i=e.width-16,s=e.height/2;t.append("path").attr("d",`M${i-4},${s-2} L${i},${s+2} L${i+4},${s-2}`).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1.5)}function OJ(t,e,n){let{palette:r}=n,o=e.element;if(o.states.includes("toggle")){let l=e.height/2;t.append("rect").attr("x",0).attr("y",l-18/2).attr("width",32).attr("height",18).attr("rx",18/2).attr("fill",o.checked?r.primary:r.border),t.append("circle").attr("cx",o.checked?32-18/2:18/2).attr("cy",l).attr("r",18/2-2).attr("fill",r.bg),o.label&&t.append("text").attr("x",40).attr("y",l+4).attr("fill",r.text).attr("font-size",13).text(o.label)}else{let s=e.height/2;t.append("rect").attr("x",0).attr("y",s-16/2).attr("width",16).attr("height",16).attr("fill",o.checked?r.primary:"none").attr("stroke",o.checked?r.primary:r.border).attr("rx",3),o.checked&&t.append("path").attr("d",`M3,${s} L6,${s+3} L13,${s-4}`).attr("fill","none").attr("stroke",r.bg).attr("stroke-width",2),o.label&&t.append("text").attr("x",24).attr("y",s+4).attr("fill",r.text).attr("font-size",13).text(o.label)}}function $J(t,e,n){let{palette:r}=n,o=e.element,a=8,i=e.height/2;t.append("circle").attr("cx",a).attr("cy",i).attr("r",a).attr("fill","none").attr("stroke",o.selected?r.primary:r.border).attr("stroke-width",1.5),o.selected&&t.append("circle").attr("cx",a).attr("cy",i).attr("r",4).attr("fill",r.primary),t.append("text").attr("x",a*2+8).attr("y",i+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function HJ(t,e,n){let{palette:r}=n,o=e.element,a=o.headingLevel===1;t.append("text").attr("x",0).attr("y",a?28:22).attr("fill",r.text).attr("font-size",a?22:16).attr("font-weight","bold").text(o.label)}function WJ(t,e,n){let{palette:r}=n;t.append("line").attr("x1",0).attr("y1",e.height/2).attr("x2",e.width).attr("y2",e.height/2).attr("stroke",r.border).attr("stroke-width",1)}function AG(t,e,n){let{palette:r}=n,o=e.element;if(o.metadata._labelField==="true"&&o.children.length>=2){for(let i of e.children)kf(t,i,n,0);return}let a=o.labelFor?r.textMuted:r.text;t.append("text").attr("x",0).attr("y",15).attr("fill",a).attr("font-size",13).text(o.label)}function FJ(t,e,n){let{palette:r}=n,o=e.element;t.append("circle").attr("cx",4).attr("cy",e.height/2).attr("r",2.5).attr("fill",r.textMuted),t.append("text").attr("x",14).attr("y",e.height/2+4).attr("fill",r.text).attr("font-size",13).text(o.label)}function BJ(t,e,n){let{palette:r}=n,o=e.element;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",Ot(r.textMuted,r.bg,8)).attr("rx",4);let a=12;for(let i of o.children){let s=i.states.includes("active");t.append("text").attr("x",a).attr("y",e.height/2+4).attr("fill",s?r.primary:r.text).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label);let l=_t(i.label,13);s&&t.append("line").attr("x1",a).attr("y1",e.height-4).attr("x2",a+l).attr("y2",e.height-4).attr("stroke",r.primary).attr("stroke-width",2),a+=l+24}}function YJ(t,e,n){let{palette:r}=n,o=e.element;t.append("line").attr("x1",0).attr("y1",e.height-1).attr("x2",e.width).attr("y2",e.height-1).attr("stroke",r.border).attr("stroke-width",1);let a=0;for(let i of o.children){let s=i.states.includes("active"),l=_t(i.label,13)+24;s&&t.append("line").attr("x1",a).attr("y1",e.height-1).attr("x2",a+l).attr("y2",e.height-1).attr("stroke",r.primary).attr("stroke-width",2),t.append("text").attr("x",a+12).attr("y",e.height/2+4).attr("fill",s?r.primary:r.textMuted).attr("font-size",13).attr("font-weight",s?"600":"normal").text(i.label),a+=l}}function VJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=a.tableHeaders||[],s=a.tableData||[],l=a.tableRows!==void 0&&a.tableCols!==void 0,c=i.length||a.tableCols||3,d=e.width/c,u=32,f=28;t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",r.border).attr("rx",4),t.append("rect").attr("width",e.width).attr("height",u).attr("fill",o?"none":Ot(r.textMuted,r.bg,8)).attr("rx",4);for(let m=0;m<c;m++){let g=i[m]||`Col ${m+1}`;t.append("text").attr("x",m*d+10).attr("y",u/2+4).attr("fill",r.text).attr("font-size",12).attr("font-weight","600").text(g)}t.append("line").attr("x1",0).attr("y1",u).attr("x2",e.width).attr("y2",u).attr("stroke",r.border);let p=l?a.tableRows||3:s.length;for(let m=0;m<p;m++){let g=u+m*f;m>0&&t.append("line").attr("x1",0).attr("y1",g).attr("x2",e.width).attr("y2",g).attr("stroke",r.border).attr("opacity",.3);for(let h=0;h<c;h++)if(l)t.append("rect").attr("x",h*d+10).attr("y",g+8).attr("width",d*.6).attr("height",12).attr("fill",r.textMuted).attr("opacity",.25).attr("rx",2);else if(s[m]){let S=s[m][h]||"";zJ(t,S,h*d+10,g,d-20,f,n)}}}function zJ(t,e,n,r,o,a,i){let{palette:s}=i,l=e.trim(),c=l.match(/^\(([^)]+)\)(?:\s*\|\s*(.+))?$/);if(c){let d=c[1],u=c[2]?.trim().toLowerCase(),f=u==="ghost",m=u==="destructive"?s.destructive:s.primary,g=Math.min(_t(d,10)+16,o),h=20,S=r+(a-h)/2;f?(t.append("rect").attr("x",n).attr("y",S).attr("width",g).attr("height",h).attr("fill","none").attr("stroke",m).attr("stroke-width",1).attr("rx",3),t.append("text").attr("x",n+g/2).attr("y",S+h/2+3).attr("fill",m).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d)):(t.append("rect").attr("x",n).attr("y",S).attr("width",g).attr("height",h).attr("fill",m).attr("rx",3),t.append("text").attr("x",n+g/2).attr("y",S+h/2+3).attr("fill",s.bg).attr("font-size",10).attr("font-weight","600").attr("text-anchor","middle").text(d));return}if(/^<\s*x?\s*>$/.test(l)){let d=/x/i.test(l),u=12,f=n,p=r+(a-u)/2;t.append("rect").attr("x",f).attr("y",p).attr("width",u).attr("height",u).attr("fill",d?s.primary:"none").attr("stroke",d?s.primary:s.border).attr("rx",2),d&&t.append("path").attr("d",`M${f+2},${p+u/2} L${f+4},${p+u/2+2} L${f+10},${p+2}`).attr("fill","none").attr("stroke",s.bg).attr("stroke-width",1.5);return}t.append("text").attr("x",n).attr("y",r+a/2+4).attr("fill",s.text).attr("font-size",12).text(l)}function UJ(t,e,n){let{palette:r,isTransparent:o}=n;if(e.element.imageHint==="round"){let s=Math.min(e.width,e.height)/2,l=e.width/2,c=e.height/2;t.append("circle").attr("cx",l).attr("cy",c).attr("r",s).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",r.border),t.append("line").attr("x1",l-s*.7).attr("y1",c-s*.7).attr("x2",l+s*.7).attr("y2",c+s*.7).attr("stroke",r.border),t.append("line").attr("x1",l+s*.7).attr("y1",c-s*.7).attr("x2",l-s*.7).attr("y2",c+s*.7).attr("stroke",r.border)}else t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",r.border).attr("rx",4),t.append("line").attr("x1",0).attr("y1",0).attr("x2",e.width).attr("y2",e.height).attr("stroke",r.border),t.append("line").attr("x1",e.width).attr("y1",0).attr("x2",0).attr("y2",e.height).attr("stroke",r.border)}function XJ(t,e,n){for(let r of e.children)PG(t,r,n)}function PG(t,e,n){let{palette:r,isTransparent:o}=n,a=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`);o?a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.1).attr("rx",4):a.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",r.border).attr("opacity",.2).attr("rx",4)}function jJ(t,e,n){let{palette:r,isDark:o,isTransparent:a}=n,i=e.element,s=IG(i,r)||r.accent,l=a?null:ie(r,s,o,{solid:n.solid});l&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",l).attr("rx",4),t.append("rect").attr("width",3).attr("height",e.height).attr("fill",s).attr("rx",1.5),a&&t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill","none").attr("stroke",s).attr("rx",4);let c=l?Le(l,r.textOnFillLight,r.textOnFillDark):r.text;t.append("text").attr("x",12).attr("y",e.height/2+4).attr("fill",c).attr("font-size",13).text(i.label)}function qJ(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.progressValue??0,s=8,l=e.height/2;t.append("rect").attr("width",e.width-40).attr("height",s).attr("y",l-s/2).attr("fill",o?"none":Ot(r.border,r.bg,30)).attr("stroke",o?r.border:"none").attr("rx",s/2);let c=(e.width-40)*i/100;c>0&&t.append("rect").attr("width",c).attr("height",s).attr("y",l-s/2).attr("fill",r.primary).attr("rx",s/2),t.append("text").attr("x",e.width-32).attr("y",l+4).attr("fill",r.textMuted).attr("font-size",11).text(`${i}%`)}function KJ(t,e,n){let{palette:r,isTransparent:o}=n,i=e.element.chartHint||"line";t.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":Ot(r.textMuted,r.bg,8)).attr("stroke",r.border).attr("rx",4);let s=20,l=20,c=e.width-s*2,d=e.height-l*2;if(i==="line"){let f=[[0,d*.7],[c*.2,d*.4],[c*.4,d*.6],[c*.6,d*.2],[c*.8,d*.3],[c,d*.1]].map(([p,m],g)=>g===0?`M${s+p},${l+m}`:`L${s+p},${l+m}`).join(" ");t.append("path").attr("d",f).attr("fill","none").attr("stroke",r.primary).attr("stroke-width",2)}else if(i==="bar"){let f=c/10,p=[.6,.8,.5,.9,.7];for(let m=0;m<5;m++){let g=d*p[m];t.append("rect").attr("x",s+m*(c/5)+f/2).attr("y",l+d-g).attr("width",f).attr("height",g).attr("fill",r.primary).attr("opacity",.7).attr("rx",2)}}else if(i==="pie"){let u=e.width/2,f=e.height/2,p=Math.min(c,d)/2,m=[.35,.25,.2,.2],g=[r.primary,r.secondary,r.accent,r.border],h=0;for(let S=0;S<m.length;S++){let y=h+m[S]*Math.PI*2,b=u+p*Math.cos(h),E=f+p*Math.sin(h),x=u+p*Math.cos(y),N=f+p*Math.sin(y),L=m[S]>.5?1:0;t.append("path").attr("d",`M${u},${f} L${b},${E} A${p},${p} 0 ${L},1 ${x},${N} Z`).attr("fill",g[S]).attr("opacity",.7),h=y}}}function ZJ(t,e,n){let{palette:r,isTransparent:o}=n,a=e.element,i=t.append("g").attr("transform",`translate(${e.x}, ${e.y})`).attr("data-line-number",a.lineNumber);o||i.append("rect").attr("x",4).attr("y",4).attr("width",e.width).attr("height",e.height).attr("fill","rgba(0,0,0,0.1)").attr("rx",Mf),i.append("rect").attr("width",e.width).attr("height",e.height).attr("fill",o?"none":r.surface).attr("stroke",r.border).attr("rx",Mf),i.append("rect").attr("width",e.width).attr("height",36).attr("fill",o?"none":Ot(r.textMuted,r.bg,15)).attr("rx",Mf),i.append("text").attr("x",12).attr("y",24).attr("fill",r.text).attr("font-size",14).attr("font-weight","600").text(a.label||"Modal");let s=e.width-16;i.append("text").attr("x",s).attr("y",24).attr("fill",r.textMuted).attr("font-size",16).text("\xD7");for(let l of e.children){let c=i.append("g").attr("transform","translate(0, 36)");kf(c,l,n,1)}}var RG,_G,Mf,_J,GG=st(()=>{"use strict";qn();an();tn();en();mr();RG=4,_G=6,Mf=8,_J={destructive:t=>t.destructive,success:t=>t.colors.green,warning:t=>t.colors.yellow,info:t=>t.colors.blue}});var VG={};ye(VG,{collectCardMetadata:()=>Dh,computeC4NodeDimensions:()=>Yl,layoutC4Components:()=>z1,layoutC4Containers:()=>V1,layoutC4Context:()=>Y1,layoutC4Deployment:()=>U1,rollUpContextRelationships:()=>BG});function Ih(t,e,n,r){let o=0;for(let a of t){let i=e.get(a.source),s=e.get(a.target);if(i==null||s==null)continue;let l=Math.abs(i-s),c=Math.min(n.get(a.source)??1,n.get(a.target)??1);o+=l*c}if(r)for(let a of t){let i=r.get(a.source),s=r.get(a.target);if(!i||!s)continue;let l=e.get(a.source)??0,c=e.get(a.target)??0,d=i.y,u=s.y;if(d===u)continue;let f=Math.min(l,c),p=Math.max(l,c),m=Math.min(d,u),g=Math.max(d,u);for(let[h,S]of r){if(h===a.source||h===a.target)continue;let y=e.get(h)??0,b=S.y,E=S.width/2,x=S.height/2;y+E>f&&y-E<p&&b+x>m&&b-x<g&&(o+=ott)}}return o}function Ph(t,e,n){if(e.length<2)return;let r=new Map;for(let s of e)r.set(s.source,(r.get(s.source)??0)+1),r.set(s.target,(r.get(s.target)??0)+1);let o=new Map;for(let s of t.nodes()){let l=is(t,s);l&&o.set(s,{y:l.y,width:l.width,height:l.height})}let a=new Map;for(let s of t.nodes()){let l=is(t,s);if(!l)continue;let c=Math.round(l.y);a.has(c)||a.set(c,[]),a.get(c).push(s)}for(let[,s]of a)s.sort((l,c)=>is(t,l).x-is(t,c).x);let i=!1;for(let[,s]of a){if(s.length<2)continue;let l=[];if(n&&n.size>0){let c=new Map,d=[];for(let u of s){let f=n.get(u);f?(c.has(f)||c.set(f,[]),c.get(f).push(u)):d.push(u)}for(let u of c.values())u.length>=2&&l.push(u);d.length>=2&&l.push(d)}else l.push(s);for(let c of l){if(c.length<2)continue;let d=c.map(g=>is(t,g).x).sort((g,h)=>g-h),u=new Map;for(let g of t.nodes()){let h=is(t,g);h&&u.set(g,h.x)}let f=Ih(e,u,r,o),p=[...c],m=f;if(c.length<=8){let g=att(c);for(let h of g){let S=new Map(u);for(let b=0;b<h.length;b++)S.set(h[b],d[b]);let y=Ih(e,S,r,o);y<m&&(m=y,p=[...h])}}else{let g=[...c],h=!0,S=0;for(;h&&S<10;){h=!1,S++;for(let y=0;y<g.length-1;y++){let b=new Map(u);for(let L=0;L<g.length;L++)b.set(g[L],d[L]);let E=Ih(e,b,r,o);[g[y],g[y+1]]=[g[y+1],g[y]];let x=new Map(u);for(let L=0;L<g.length;L++)x.set(g[L],d[L]);let N=Ih(e,x,r,o);N<E?(h=!0,N<m&&(m=N,p=[...g])):[g[y],g[y+1]]=[g[y+1],g[y]]}}}if(p.some((g,h)=>g!==c[h])){for(let g=0;g<p.length;g++){is(t,p[g]).x=d[g];let h=s.indexOf(c[g]);h>=0&&(s[h]=p[g])}i=!0}}}if(i)for(let s of e){let l=QJ(t,s.source,s.target);if(!l)continue;let c=is(t,s.source),d=is(t,s.target);if(!c||!d)continue;let u={x:c.x,y:c.y+c.height/2},f={x:d.x,y:d.y-d.height/2},p=(u.y+f.y)/2;l.points=[u,{x:u.x,y:p},{x:f.x,y:p},f]}}function att(t){let e=[],n=[...t],r=n.length,o=new Array(r).fill(0);e.push([...n]);let a=0;for(;a<r;)o[a]<a?(a%2===0?[n[0],n[a]]=[n[a],n[0]]:[n[o[a]],n[a]]=[n[a],n[o[a]]],e.push([...n]),o[a]++,a=0):(o[a]=0,a++);return e}function F1(t){let e=new Map;function n(r,o){e.set(r.name,o);for(let a of r.children)n(a,o);for(let a of r.groups)for(let i of a.children)n(i,o)}for(let r of t)n(r,r.name);return e}function B1(t,e){let n=[];function r(o){for(let a of o.relationships)n.push({sourceName:o.name,rel:a});for(let a of o.children)r(a);for(let a of o.groups)for(let i of a.children)r(i)}for(let o of t)r(o);return n}function BG(t){let e=F1(t.elements),n=B1(t.elements,e),r=new Set(t.elements.map(c=>c.name)),o=new Set,a=[],i=[];for(let{sourceName:c,rel:d}of n){let u=e.get(c)??c,f=e.get(d.target)??d.target;if(u===f)continue;let p={sourceName:u,targetName:f,...d.label!==void 0&&{label:d.label},...d.technology!==void 0&&{technology:d.technology},arrowType:d.arrowType,lineNumber:d.lineNumber};if(r.has(c)&&c===u){let m=`${u}\u2192${f}`;o.add(m),a.push(p)}else i.push(p)}let s=[...a],l=new Set(o);for(let c of i){let d=`${c.sourceName}\u2192${c.targetName}`;l.has(d)||(l.add(d),s.push(c))}return s}function Sd(t,e,n,r){let o=t.metadata.color;if(o)return o;if(!n)return;let a=e.find(c=>c.name.toLowerCase()===n.toLowerCase());if(!a)return;let i=qt(a.name),s=t.metadata[i];if(!s&&r){for(let c of r)if(s=c.metadata[i],s)break}let l=s??a.defaultValue;return l?a.entries.find(c=>c.value.toLowerCase()===l.toLowerCase())?.color??"#999999":"#999999"}function Dh(t){let e=[],n=t.tech??t.technology;n&&e.push({key:"Technology",value:n});for(let[r,o]of Object.entries(t)){if(itt.has(r.toLowerCase()))continue;let a=r.charAt(0).toUpperCase()+r.slice(1);e.push({key:a,value:o})}return e}function Yl(t,e){let n=_t(t.name,ett)+Rh*2,r=Math.max(JJ,Math.min(OG,n));if(e?.showTechnology){let i=Ah+HG,s=t.description?.join(`
213
213
  `);if(s){let c=r-Rh*2,d=Cn(s,FG,c);i+=d.length*WG}let l=Dh(t.metadata);if(l.length>0){i+=$G,i+=l.length*ntt;let c=Math.max(...l.map(d=>_t(`${d.key}: ${d.value}`,rtt)+Rh*2));c>r&&(r=Math.min(OG,c))}return i+=Ah,{width:r,height:i}}let o=Ah+ttt+$G+HG,a=t.description?.join(`
214
214
  `);if(a){let i=r-Rh*2,s=Cn(a,FG,i);o+=s.length*WG}return o+=Ah,{width:r,height:o}}function Gh(t){let e=[];for(let n of t){let r=[];for(let i of n.entries)r.push({value:i.value,color:i.color});if(r.length===0)continue;let o=Fe(n.name,cr)+po*2,a=In;for(let i of r)a+=Er*2+kr+Fe(i.value,Xn)+Kr;a+=In,e.push({name:n.name,entries:r,x:0,y:0,width:o+a,height:Se})}return e}function Oh(t){let e=new Map;for(let i of t)(i.label||i.technology)&&e.set(i.sourceName,(e.get(i.sourceName)??0)+1);let n=Math.max(0,...e.values()),r=Math.max(80,60+n*20),o=Math.max(140,100+n*35),a=Math.max(30,20+n*8);return{nodesep:r,ranksep:o,edgesep:a}}function Y1(t,e){let n=t.elements.filter(S=>S.type==="person"||S.type==="system");if(n.length===0)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let r=BG(t),o=Oh(r),a=new rr.graphlib.Graph;a.setGraph({rankdir:"TB",nodesep:o.nodesep,ranksep:o.ranksep,edgesep:o.edgesep}),a.setDefaultEdgeLabel(()=>({}));let i=new Map;for(let S of n){i.set(S.name,S);let y=Yl(S);a.setNode(S.name,{width:y.width,height:y.height})}let s=[];for(let S of r)i.has(S.sourceName)&&i.has(S.targetName)&&(s.push(S),a.setEdge(S.sourceName,S.targetName,{label:S.label??""}));rr.layout(a),Ph(a,s.map(S=>({source:S.sourceName,target:S.targetName})));let l=n.map(S=>{let y=a.node(S.name),b=Sd(S,t.tagGroups,e??null),E=S.children.some(L=>L.type==="container")||S.groups.some(L=>L.children.some(A=>A.type==="container")),x=S.description?.join(`
215
215
  `),N=E||S.importPath?!0:void 0;return{id:S.name,name:S.name,type:S.type,...x!==void 0&&{description:x},metadata:S.metadata,lineNumber:S.lineNumber,...b!==void 0&&{color:b},...N!==void 0&&{drillable:N},...S.importPath!==void 0&&{importPath:S.importPath},x:y.x,y:y.y,width:y.width,height:y.height}}),c=s.map(S=>{let y=a.edge(S.sourceName,S.targetName);return{source:S.sourceName,target:S.targetName,arrowType:S.arrowType,...S.label!==void 0&&{label:S.label},...S.technology!==void 0&&{technology:S.technology},lineNumber:S.lineNumber,points:y?.points??[]}}),d=1/0,u=1/0,f=-1/0,p=-1/0;for(let S of l){let y=S.x-S.width/2,b=S.y-S.height/2,E=S.x+S.width/2,x=S.y+S.height/2;y<d&&(d=y),b<u&&(u=b),E>f&&(f=E),x>p&&(p=x)}for(let S of c)for(let y of S.points)y.x<d&&(d=y.x),y.y<u&&(u=y.y),y.x>f&&(f=y.x),y.y>p&&(p=y.y);if(l.length>0){let S=Ar-d,y=Ar-u;for(let b of l)b.x+=S,b.y+=y;for(let b of c)for(let E of b.points)E.x+=S,E.y+=y}let m=l.length>0?f-d+Ar*2:0,g=l.length>0?p-u+Ar*2:0,h=Gh(t.tagGroups);if(h.length>0){let S=g+Ar,y=Ar;for(let x of h)x.x=y,x.y=S,y+=x.width+12;let b=y,E=S+Se;b>m&&(m=b),E>g&&(g=E)}return{nodes:l,edges:c,legend:h,groupBoundaries:[],width:m,height:g}}function V1(t,e,n){let r=t.elements.find(D=>D.name.toLowerCase()===e.toLowerCase());if(!r)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let o=[];for(let D of r.children)D.type==="container"&&o.push(D);for(let D of r.groups)for(let W of D.children)W.type==="container"&&o.push(W);if(o.length===0)return{nodes:[],edges:[],legend:[],groupBoundaries:[],width:0,height:0};let a=new Set(o.map(D=>D.name.toLowerCase())),i=new Map;for(let D of t.elements)i.set(D.name.toLowerCase(),D);let s=new Set;for(let D of o)for(let W of D.relationships){let V=W.target.toLowerCase();a.has(V)||s.add(V)}let l=F1(t.elements),c=B1(t.elements,l);for(let{sourceName:D,rel:W}of c){let V=l.get(D)??D;V.toLowerCase()!==r.name.toLowerCase()&&a.has(W.target.toLowerCase())&&s.add(V.toLowerCase())}let d=[];for(let D of s){let W=i.get(D);W&&d.push(W)}let u=new Map;for(let D of r.groups)for(let W of D.children)W.type==="container"&&u.set(W.name,{name:D.name,lineNumber:D.lineNumber});let f=u.size>0,p=f?new rr.graphlib.Graph({compound:!0}):new rr.graphlib.Graph;if(p.setDefaultEdgeLabel(()=>({})),f){let D=new Set;for(let{name:W}of u.values())D.has(W)||(D.add(W),p.setNode("__group_"+W,{}))}let m=new Map;for(let D of o){m.set(D.name,D);let W=Yl(D,{showTechnology:!0});p.setNode(D.name,{width:W.width,height:W.height});let V=u.get(D.name);V&&p.setParent(D.name,"__group_"+V.name)}for(let D of d){m.set(D.name,D);let W=Yl(D);p.setNode(D.name,{width:W.width,height:W.height})}let g=[],h=new Set;for(let D of o)for(let W of D.relationships){if(!m.get(W.target))continue;let P=`${D.name}\u2192${W.target}`;h.has(P)||(h.add(P),g.push({sourceName:D.name,targetName:W.target,...W.label!==void 0&&{label:W.label},...W.technology!==void 0&&{technology:W.technology},arrowType:W.arrowType,lineNumber:W.lineNumber}))}for(let{sourceName:D,rel:W}of c){let V=l.get(D)??D;if(V.toLowerCase()!==r.name.toLowerCase()&&a.has(W.target.toLowerCase())){if(!m.get(V))continue;let F=`${V}\u2192${W.target}`;h.has(F)||(h.add(F),g.push({sourceName:V,targetName:W.target,...W.label!==void 0&&{label:W.label},...W.technology!==void 0&&{technology:W.technology},arrowType:W.arrowType,lineNumber:W.lineNumber}))}}let S=Oh(g);p.setGraph({rankdir:"TB",nodesep:S.nodesep,ranksep:S.ranksep,edgesep:S.edgesep});for(let D of g)m.has(D.sourceName)&&m.has(D.targetName)&&p.setEdge(D.sourceName,D.targetName,{label:D.label??""});rr.layout(p);let y=f?new Map([...u.entries()].map(([D,W])=>[D,W.name])):void 0;Ph(p,g.filter(D=>m.has(D.sourceName)&&m.has(D.targetName)).map(D=>({source:D.sourceName,target:D.targetName})),y);let b=[];for(let D of o){let W=p.node(D.name),V=Sd(D,t.tagGroups,n??null),P=D.metadata.tech??D.metadata.technology,F=D.children.some(j=>j.type==="component")||D.groups.some(j=>j.children.some(K=>K.type==="component")),Y=D.description?.join(`
@@ -306,7 +306,7 @@ poi Tokyo
306
306
  poi Tokyo`},DUPLICATE_REGION:{code:"W_MAP_DUPLICATE_REGION",severity:"warning",chartType:"map",title:"Duplicate region",message:t=>`Duplicate region "${t.name??""}" \u2014 last definition wins.`,hint:"The same region is defined twice \u2014 remove the earlier definition.",example:`map
307
307
  California heat: 1
308
308
  California heat: 9`},REGION_AMBIGUOUS:{code:"W_MAP_REGION_AMBIGUOUS",severity:"warning",chartType:"map",title:"Region is both a country and a US state",message:t=>`"${t.name??""}" is both a country and a US state \u2014 resolved as ${t.layer??""} (${t.chosenId??""}). Pin it with an ISO code (${t.stateId??""} / ${t.countryId??""}) or name + scope ("${t.name??""} US" / "${t.name??""} ${t.countryId??""}").`,hint:"The name collides between a country and a US state \u2014 pin it with an ISO code or a `US` / `US-XX` scope.",example:`map
309
- Georgia heat: 2`}},dW=Object.values(sa)});function SL(t){return t}var LL=st(()=>{"use strict"});function Ay(t){if(t==null)return SL;var e,n,r=t.scale[0],o=t.scale[1],a=t.translate[0],i=t.translate[1];return function(s,l){l||(e=n=0);var c=2,d=s.length,u=new Array(d);for(u[0]=(e+=s[0])*r+a,u[1]=(n+=s[1])*o+i;c<d;)u[c]=s[c],++c;return u}}var Ry=st(()=>{"use strict";LL()});var vL=st(()=>{"use strict";Ry()});function uW(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}var fW=st(()=>{"use strict"});function jl(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return pW(t,n)})}:pW(t,e)}function pW(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,a=NL(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:a}:r==null?{type:"Feature",id:n,properties:o,geometry:a}:{type:"Feature",id:n,bbox:r,properties:o,geometry:a}}function NL(t,e){var n=Ay(t.transform),r=t.arcs;function o(d,u){u.length&&u.pop();for(var f=r[d<0?~d:d],p=0,m=f.length;p<m;++p)u.push(n(f[p],p));d<0&&uW(u,m)}function a(d){return n(d)}function i(d){for(var u=[],f=0,p=d.length;f<p;++f)o(d[f],u);return u.length<2&&u.push(u[0]),u}function s(d){for(var u=i(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(s)}function c(d){var u=d.type,f;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(c)};case"Point":f=a(d.coordinates);break;case"MultiPoint":f=d.coordinates.map(a);break;case"LineString":f=i(d.arcs);break;case"MultiLineString":f=d.arcs.map(i);break;case"Polygon":f=l(d.arcs);break;case"MultiPolygon":f=d.arcs.map(l);break;default:return null}return{type:u,coordinates:f}}return c(e)}var Iy=st(()=>{"use strict";fW();Ry()});var ML=st(()=>{"use strict"});var mW=st(()=>{"use strict";Iy();ML()});var gW=st(()=>{"use strict";Iy();ML()});function kL(t,e){for(var n=0,r=t.length;n<r;){var o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var hW=st(()=>{"use strict"});function TL(t){var e={},n=t.map(function(){return[]});function r(g,h){g.forEach(function(S){S<0&&(S=~S);var y=e[S];y?y.push(h):e[S]=[h]})}function o(g,h){g.forEach(function(S){r(S,h)})}function a(g,h){g.type==="GeometryCollection"?g.geometries.forEach(function(S){a(S,h)}):g.type in i&&i[g.type](g.arcs,h)}var i={LineString:r,MultiLineString:o,Polygon:o,MultiPolygon:function(g,h){g.forEach(function(S){o(S,h)})}};t.forEach(a);for(var s in e)for(var l=e[s],c=l.length,d=0;d<c;++d)for(var u=d+1;u<c;++u){var f=l[d],p=l[u],m;(m=n[f])[s=kL(m,p)]!==p&&m.splice(s,0,p),(m=n[p])[s=kL(m,f)]!==f&&m.splice(s,0,f)}return n}var yW=st(()=>{"use strict";hW()});var CL=st(()=>{"use strict";LL()});var bW=st(()=>{"use strict";vL();CL()});var _L=st(()=>{"use strict";vL();Iy();mW();gW();yW();bW();Ry();CL()});function SW(t){return t>1?0:t<-1?wn:Math.acos(t)}function Do(t){return t>1?yo:t<-1?-yo:Math.asin(t)}var xn,Py,wn,yo,Wd,jr,Dr,jn,Ln,Dy,la,_n,xW,wW,Mn,Fd,bo,EW,Sr=st(()=>{"use strict";xn=1e-6,Py=1e-12,wn=Math.PI,yo=wn/2,Wd=wn/4,jr=wn*2,Dr=180/wn,jn=wn/180,Ln=Math.abs,Dy=Math.atan,la=Math.atan2,_n=Math.cos,xW=Math.exp,wW=Math.log,Mn=Math.sin,Fd=Math.sign||function(t){return t>0?1:t<0?-1:0},bo=Math.sqrt,EW=Math.tan});function Gr(){}var ql=st(()=>{"use strict"});function Gy(t,e){t&&vW.hasOwnProperty(t.type)&&vW[t.type](t,e)}function AL(t,e,n){var r=-1,o=t.length-n,a;for(e.lineStart();++r<o;)a=t[r],e.point(a[0],a[1],a[2]);e.lineEnd()}function NW(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)AL(t[n],e,1);e.polygonEnd()}function $a(t,e){t&&LW.hasOwnProperty(t.type)?LW[t.type](t,e):Gy(t,e)}var LW,vW,Kf=st(()=>{"use strict";LW={Feature:function(t,e){Gy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)Gy(n[r].geometry,e)}},vW={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){AL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)AL(n[r],e,0)},Polygon:function(t,e){NW(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)NW(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)Gy(n[r],e)}}});function aat(){ai.point=sat}function iat(){TW(MW,kW)}function sat(t,e){ai.point=TW,MW=t,kW=e,t*=jn,e*=jn,RL=t,IL=_n(e=e/2+Wd),PL=Mn(e)}function TW(t,e){t*=jn,e*=jn,e=e/2+Wd;var n=t-RL,r=n>=0?1:-1,o=r*n,a=_n(e),i=Mn(e),s=PL*i,l=IL*a+s*_n(o),c=s*r*Mn(o);Zf.add(la(c,l)),RL=t,IL=a,PL=i}function DL(t){return Oy=new qr,$a(t,ai),Oy*2}var Zf,Oy,MW,kW,RL,IL,PL,ai,GL=st(()=>{"use strict";To();Sr();ql();Kf();Zf=new qr,Oy=new qr,ai={point:Gr,lineStart:Gr,lineEnd:Gr,polygonStart:function(){Zf=new qr,ai.lineStart=aat,ai.lineEnd=iat},polygonEnd:function(){var t=+Zf;Oy.add(t<0?jr+t:t),this.lineStart=this.lineEnd=this.point=Gr},sphere:function(){Oy.add(jr)}}});function Kl(t){return[la(t[1],t[0]),Do(t[2])]}function Ha(t){var e=t[0],n=t[1],r=_n(n);return[r*_n(e),r*Mn(e),Mn(n)]}function Qf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function cs(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function $y(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Jf(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Zl(t){var e=bo(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Bd=st(()=>{"use strict";Sr()});function OL(t,e){il.push(us=[Or=t,zr=t]),e<Jo&&(Jo=e),e>da&&(da=e)}function PW(t,e){var n=Ha([t*jn,e*jn]);if(Yd){var r=cs(Yd,n),o=[r[1],-r[0],0],a=cs(o,r);Zl(a),a=Kl(a);var i=t-Ql,s=i>0?1:-1,l=a[0]*Dr*s,c,d=Ln(i)>180;d^(s*Ql<l&&l<s*t)?(c=a[1]*Dr,c>da&&(da=c)):(l=(l+360)%360-180,d^(s*Ql<l&&l<s*t)?(c=-a[1]*Dr,c<Jo&&(Jo=c)):(e<Jo&&(Jo=e),e>da&&(da=e))),d?t<Ql?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t):zr>=Or?(t<Or&&(Or=t),t>zr&&(zr=t)):t>Ql?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t)}else il.push(us=[Or=t,zr=t]);e<Jo&&(Jo=e),e>da&&(da=e),Yd=n,Ql=t}function CW(){ds.point=PW}function _W(){us[0]=Or,us[1]=zr,ds.point=OL,Yd=null}function DW(t,e){if(Yd){var n=t-Ql;tp.add(Ln(n)>180?n+(n>0?360:-360):n)}else RW=t,IW=e;ai.point(t,e),PW(t,e)}function lat(){ai.lineStart()}function cat(){DW(RW,IW),ai.lineEnd(),Ln(tp)>xn&&(Or=-(zr=180)),us[0]=Or,us[1]=zr,Yd=null}function ca(t,e){return(e-=t)<0?e+360:e}function dat(t,e){return t[0]-e[0]}function AW(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function fs(t){var e,n,r,o,a,i,s;if(da=zr=-(Or=Jo=1/0),il=[],$a(t,ds),n=il.length){for(il.sort(dat),e=1,r=il[0],a=[r];e<n;++e)o=il[e],AW(r,o[0])||AW(r,o[1])?(ca(r[0],o[1])>ca(r[0],r[1])&&(r[1]=o[1]),ca(o[0],r[1])>ca(r[0],r[1])&&(r[0]=o[0])):a.push(r=o);for(i=-1/0,n=a.length-1,e=0,r=a[n];e<=n;r=o,++e)o=a[e],(s=ca(r[1],o[0]))>i&&(i=s,Or=o[0],zr=r[1])}return il=us=null,Or===1/0||Jo===1/0?[[NaN,NaN],[NaN,NaN]]:[[Or,Jo],[zr,da]]}var Or,Jo,zr,da,Ql,RW,IW,Yd,tp,il,us,ds,GW=st(()=>{"use strict";To();GL();Bd();Sr();Kf();ds={point:OL,lineStart:CW,lineEnd:_W,polygonStart:function(){ds.point=DW,ds.lineStart=lat,ds.lineEnd=cat,tp=new qr,ai.polygonStart()},polygonEnd:function(){ai.polygonEnd(),ds.point=OL,ds.lineStart=CW,ds.lineEnd=_W,Zf<0?(Or=-(zr=180),Jo=-(da=90)):tp>xn?da=90:tp<-xn&&(Jo=-90),us[0]=Or,us[1]=zr},sphere:function(){Or=-(zr=180),Jo=-(da=90)}}});function ep(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}var $L=st(()=>{"use strict"});function HL(t,e){return Ln(t)>wn&&(t-=Math.round(t/jr)*jr),[t,e]}function WL(t,e,n){return(t%=jr)?e||n?ep($W(t),HW(e,n)):$W(t):e||n?HW(e,n):HL}function OW(t){return function(e,n){return e+=t,Ln(e)>wn&&(e-=Math.round(e/jr)*jr),[e,n]}}function $W(t){var e=OW(t);return e.invert=OW(-t),e}function HW(t,e){var n=_n(t),r=Mn(t),o=_n(e),a=Mn(e);function i(s,l){var c=_n(l),d=_n(s)*c,u=Mn(s)*c,f=Mn(l),p=f*n+d*r;return[la(u*o-p*a,d*n-f*r),Do(p*o+u*a)]}return i.invert=function(s,l){var c=_n(l),d=_n(s)*c,u=Mn(s)*c,f=Mn(l),p=f*o-u*a;return[la(u*o+f*a,d*n+p*r),Do(p*n-d*r)]},i}function WW(t){t=WL(t[0]*jn,t[1]*jn,t.length>2?t[2]*jn:0);function e(n){return n=t(n[0]*jn,n[1]*jn),n[0]*=Dr,n[1]*=Dr,n}return e.invert=function(n){return n=t.invert(n[0]*jn,n[1]*jn),n[0]*=Dr,n[1]*=Dr,n},e}var FL=st(()=>{"use strict";$L();Sr();HL.invert=HL});function BW(t,e,n,r,o,a){if(n){var i=_n(e),s=Mn(e),l=r*n;o==null?(o=e+r*jr,a=e-l/2):(o=FW(i,o),a=FW(i,a),(r>0?o<a:o>a)&&(o+=r*jr));for(var c,d=o;r>0?d>a:d<a;d-=l)c=Kl([i,-s*_n(d),-s*Mn(d)]),t.point(c[0],c[1])}}function FW(t,e){e=Ha(e),e[0]-=t,Zl(e);var n=SW(-e[1]);return((-e[2]<0?-n:n)+jr-xn)%jr}var YW=st(()=>{"use strict";Bd();Sr()});function Hy(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Gr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}var BL=st(()=>{"use strict";ql()});function Vd(t,e){return Ln(t[0]-e[0])<xn&&Ln(t[1]-e[1])<xn}var YL=st(()=>{"use strict";Sr()});function Wy(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Fy(t,e,n,r,o){var a=[],i=[],s,l;if(t.forEach(function(m){if(!((g=m.length-1)<=0)){var g,h=m[0],S=m[g],y;if(Vd(h,S)){if(!h[2]&&!S[2]){for(o.lineStart(),s=0;s<g;++s)o.point((h=m[s])[0],h[1]);o.lineEnd();return}S[0]+=2*xn}a.push(y=new Wy(h,m,null,!0)),i.push(y.o=new Wy(h,null,y,!1)),a.push(y=new Wy(S,m,null,!1)),i.push(y.o=new Wy(S,null,y,!0))}}),!!a.length){for(i.sort(e),VW(a),VW(i),s=0,l=i.length;s<l;++s)i[s].e=n=!n;for(var c=a[0],d,u;;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;d=f.z,o.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,l=d.length;s<l;++s)o.point((u=d[s])[0],u[1]);else r(f.x,f.n.x,1,o);f=f.n}else{if(p)for(d=f.p.z,s=d.length-1;s>=0;--s)o.point((u=d[s])[0],u[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,d=f.z,p=!p}while(!f.v);o.lineEnd()}}}function VW(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}var VL=st(()=>{"use strict";YL();Sr()});function zL(t){return Ln(t[0])<=wn?t[0]:Fd(t[0])*((Ln(t[0])+wn)%jr-wn)}function zW(t,e){var n=zL(e),r=e[1],o=Mn(r),a=[Mn(n),-_n(n),0],i=0,s=0,l=new qr;o===1?r=yo+xn:o===-1&&(r=-yo-xn);for(var c=0,d=t.length;c<d;++c)if(f=(u=t[c]).length)for(var u,f,p=u[f-1],m=zL(p),g=p[1]/2+Wd,h=Mn(g),S=_n(g),y=0;y<f;++y,m=E,h=N,S=L,p=b){var b=u[y],E=zL(b),x=b[1]/2+Wd,N=Mn(x),L=_n(x),A=E-m,C=A>=0?1:-1,k=C*A,w=k>wn,v=h*N;if(l.add(la(v*C*Mn(k),S*L+v*_n(k))),i+=w?A+C*jr:A,w^m>=n^E>=n){var M=cs(Ha(p),Ha(b));Zl(M);var _=cs(a,M);Zl(_);var T=(w^A>=0?-1:1)*Do(_[2]);(r>T||r===T&&(M[0]||M[1]))&&(s+=w^A>=0?1:-1)}}return(i<-xn||i<xn&&l<-Py)^s&1}var UW=st(()=>{"use strict";To();Bd();Sr()});function By(t,e,n,r){return function(o){var a=e(o),i=Hy(),s=e(i),l=!1,c,d,u,f={point:p,lineStart:g,lineEnd:h,polygonStart:function(){f.point=S,f.lineStart=y,f.lineEnd=b,d=[],c=[]},polygonEnd:function(){f.point=p,f.lineStart=g,f.lineEnd=h,d=bc(d);var E=zW(c,r);d.length?(l||(o.polygonStart(),l=!0),Fy(d,fat,E,n,o)):E&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),d=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function p(E,x){t(E,x)&&o.point(E,x)}function m(E,x){a.point(E,x)}function g(){f.point=m,a.lineStart()}function h(){f.point=p,a.lineEnd()}function S(E,x){u.push([E,x]),s.point(E,x)}function y(){s.lineStart(),u=[]}function b(){S(u[0][0],u[0][1]),s.lineEnd();var E=s.clean(),x=i.result(),N,L=x.length,A,C,k;if(u.pop(),c.push(u),u=null,!!L){if(E&1){if(C=x[0],(A=C.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),N=0;N<A;++N)o.point((k=C[N])[0],k[1]);o.lineEnd()}return}L>1&&E&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(uat))}}return f}}function uat(t){return t.length>1}function fat(t,e){return((t=t.x)[0]<0?t[1]-yo-xn:yo-t[1])-((e=e.x)[0]<0?e[1]-yo-xn:yo-e[1])}var UL=st(()=>{"use strict";BL();VL();Sr();UW();To()});function pat(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(a,i){var s=a>0?wn:-wn,l=Ln(a-e);Ln(l-wn)<xn?(t.point(e,n=(n+i)/2>0?yo:-yo),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),o=0):r!==s&&l>=wn&&(Ln(e-r)<xn&&(e-=r*xn),Ln(a-s)<xn&&(a-=s*xn),n=mat(e,n,a,i),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),o=0),t.point(e=a,n=i),r=s},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function mat(t,e,n,r){var o,a,i=Mn(t-n);return Ln(i)>xn?Dy((Mn(e)*(a=_n(r))*Mn(n)-Mn(r)*(o=_n(e))*Mn(t))/(o*a*i)):(e+r)/2}function gat(t,e,n,r){var o;if(t==null)o=n*yo,r.point(-wn,o),r.point(0,o),r.point(wn,o),r.point(wn,0),r.point(wn,-o),r.point(0,-o),r.point(-wn,-o),r.point(-wn,0),r.point(-wn,o);else if(Ln(t[0]-e[0])>xn){var a=t[0]<e[0]?wn:-wn;o=n*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(e[0],e[1])}var XL,XW=st(()=>{"use strict";UL();Sr();XL=By(function(){return!0},pat,gat,[-wn,-yo])});function jW(t){var e=_n(t),n=2*jn,r=e>0,o=Ln(e)>xn;function a(d,u,f,p){BW(p,t,n,f,d,u)}function i(d,u){return _n(d)*_n(u)>e}function s(d){var u,f,p,m,g;return{lineStart:function(){m=p=!1,g=1},point:function(h,S){var y=[h,S],b,E=i(h,S),x=r?E?0:c(h,S):E?c(h+(h<0?wn:-wn),S):0;if(!u&&(m=p=E)&&d.lineStart(),E!==p&&(b=l(u,y),(!b||Vd(u,b)||Vd(y,b))&&(y[2]=1)),E!==p)g=0,E?(d.lineStart(),b=l(y,u),d.point(b[0],b[1])):(b=l(u,y),d.point(b[0],b[1],2),d.lineEnd()),u=b;else if(o&&u&&r^E){var N;!(x&f)&&(N=l(y,u,!0))&&(g=0,r?(d.lineStart(),d.point(N[0][0],N[0][1]),d.point(N[1][0],N[1][1]),d.lineEnd()):(d.point(N[1][0],N[1][1]),d.lineEnd(),d.lineStart(),d.point(N[0][0],N[0][1],3)))}E&&(!u||!Vd(u,y))&&d.point(y[0],y[1]),u=y,p=E,f=x},lineEnd:function(){p&&d.lineEnd(),u=null},clean:function(){return g|(m&&p)<<1}}}function l(d,u,f){var p=Ha(d),m=Ha(u),g=[1,0,0],h=cs(p,m),S=Qf(h,h),y=h[0],b=S-y*y;if(!b)return!f&&d;var E=e*S/b,x=-e*y/b,N=cs(g,h),L=Jf(g,E),A=Jf(h,x);$y(L,A);var C=N,k=Qf(L,C),w=Qf(C,C),v=k*k-w*(Qf(L,L)-1);if(!(v<0)){var M=bo(v),_=Jf(C,(-k-M)/w);if($y(_,L),_=Kl(_),!f)return _;var T=d[0],R=u[0],O=d[1],I=u[1],H;R<T&&(H=T,T=R,R=H);var G=R-T,D=Ln(G-wn)<xn,W=D||G<xn;if(!D&&I<O&&(H=O,O=I,I=H),W?D?O+I>0^_[1]<(Ln(_[0]-T)<xn?O:I):O<=_[1]&&_[1]<=I:G>wn^(T<=_[0]&&_[0]<=R)){var V=Jf(C,(-k+M)/w);return $y(V,L),[_,Kl(V)]}}}function c(d,u){var f=r?t:wn-t,p=0;return d<-f?p|=1:d>f&&(p|=2),u<-f?p|=4:u>f&&(p|=8),p}return By(i,s,a,r?[0,-t]:[-wn,t-wn])}var qW=st(()=>{"use strict";Bd();YW();Sr();YL();UL()});function KW(t,e,n,r,o,a){var i=t[0],s=t[1],l=e[0],c=e[1],d=0,u=1,f=l-i,p=c-s,m;if(m=n-i,!(!f&&m>0)){if(m/=f,f<0){if(m<d)return;m<u&&(u=m)}else if(f>0){if(m>u)return;m>d&&(d=m)}if(m=o-i,!(!f&&m<0)){if(m/=f,f<0){if(m>u)return;m>d&&(d=m)}else if(f>0){if(m<d)return;m<u&&(u=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<d)return;m<u&&(u=m)}else if(p>0){if(m>u)return;m>d&&(d=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>u)return;m>d&&(d=m)}else if(p>0){if(m<d)return;m<u&&(u=m)}return d>0&&(t[0]=i+d*f,t[1]=s+d*p),u<1&&(e[0]=i+u*f,e[1]=s+u*p),!0}}}}}var ZW=st(()=>{"use strict"});function jL(t,e,n,r){function o(c,d){return t<=c&&c<=n&&e<=d&&d<=r}function a(c,d,u,f){var p=0,m=0;if(c==null||(p=i(c,u))!==(m=i(d,u))||l(c,d)<0^u>0)do f.point(p===0||p===3?t:n,p>1?r:e);while((p=(p+u+4)%4)!==m);else f.point(d[0],d[1])}function i(c,d){return Ln(c[0]-t)<xn?d>0?0:3:Ln(c[0]-n)<xn?d>0?2:1:Ln(c[1]-e)<xn?d>0?1:0:d>0?3:2}function s(c,d){return l(c.x,d.x)}function l(c,d){var u=i(c,1),f=i(d,1);return u!==f?u-f:u===0?d[1]-c[1]:u===1?c[0]-d[0]:u===2?c[1]-d[1]:d[0]-c[0]}return function(c){var d=c,u=Hy(),f,p,m,g,h,S,y,b,E,x,N,L={point:A,lineStart:v,lineEnd:M,polygonStart:k,polygonEnd:w};function A(T,R){o(T,R)&&d.point(T,R)}function C(){for(var T=0,R=0,O=p.length;R<O;++R)for(var I=p[R],H=1,G=I.length,D=I[0],W,V,P=D[0],F=D[1];H<G;++H)W=P,V=F,D=I[H],P=D[0],F=D[1],V<=r?F>r&&(P-W)*(r-V)>(F-V)*(t-W)&&++T:F<=r&&(P-W)*(r-V)<(F-V)*(t-W)&&--T;return T}function k(){d=u,f=[],p=[],N=!0}function w(){var T=C(),R=N&&T,O=(f=bc(f)).length;(R||O)&&(c.polygonStart(),R&&(c.lineStart(),a(null,null,1,c),c.lineEnd()),O&&Fy(f,s,T,a,c),c.polygonEnd()),d=c,f=p=m=null}function v(){L.point=_,p&&p.push(m=[]),x=!0,E=!1,y=b=NaN}function M(){f&&(_(g,h),S&&E&&u.rejoin(),f.push(u.result())),L.point=A,E&&d.lineEnd()}function _(T,R){var O=o(T,R);if(p&&m.push([T,R]),x)g=T,h=R,S=O,x=!1,O&&(d.lineStart(),d.point(T,R));else if(O&&E)d.point(T,R);else{var I=[y=Math.max(Yy,Math.min(np,y)),b=Math.max(Yy,Math.min(np,b))],H=[T=Math.max(Yy,Math.min(np,T)),R=Math.max(Yy,Math.min(np,R))];KW(I,H,t,e,n,r)?(E||(d.lineStart(),d.point(I[0],I[1])),d.point(H[0],H[1]),O||d.lineEnd(),N=!1):O&&(d.lineStart(),d.point(T,R),N=!1)}y=T,b=R,E=O}return L}}var np,Yy,QW=st(()=>{"use strict";Sr();BL();ZW();VL();To();np=1e9,Yy=-np});var rp,qL=st(()=>{"use strict";rp=t=>t});function hat(){sl.point=yat}function yat(t,e){sl.point=eF,JW=QL=t,tF=JL=e}function eF(t,e){ZL.add(JL*t-QL*e),QL=t,JL=e}function bat(){eF(JW,tF)}var KL,ZL,JW,tF,QL,JL,sl,tv,nF=st(()=>{"use strict";To();Sr();ql();KL=new qr,ZL=new qr,sl={point:Gr,lineStart:Gr,lineEnd:Gr,polygonStart:function(){sl.lineStart=hat,sl.lineEnd=bat},polygonEnd:function(){sl.lineStart=sl.lineEnd=sl.point=Gr,KL.add(Ln(ZL)),ZL=new qr},result:function(){var t=KL/2;return KL=new qr,t}};tv=sl});function wat(t,e){t<zd&&(zd=t),t>op&&(op=t),e<Vy&&(Vy=e),e>zy&&(zy=e)}var zd,Vy,op,zy,xat,Ud,ev=st(()=>{"use strict";ql();zd=1/0,Vy=zd,op=-zd,zy=op,xat={point:wat,lineStart:Gr,lineEnd:Gr,polygonStart:Gr,polygonEnd:Gr,result:function(){var t=[[zd,Vy],[op,zy]];return op=zy=-(Vy=zd=1/0),t}};Ud=xat});function Jl(t,e){nv+=t,rv+=e,++ap}function rF(){ii.point=Eat}function Eat(t,e){ii.point=Sat,Jl(Hi=t,Wi=e)}function Sat(t,e){var n=t-Hi,r=e-Wi,o=bo(n*n+r*r);Uy+=o*(Hi+t)/2,Xy+=o*(Wi+e)/2,Xd+=o,Jl(Hi=t,Wi=e)}function oF(){ii.point=Jl}function Lat(){ii.point=Nat}function vat(){sF(aF,iF)}function Nat(t,e){ii.point=sF,Jl(aF=Hi=t,iF=Wi=e)}function sF(t,e){var n=t-Hi,r=e-Wi,o=bo(n*n+r*r);Uy+=o*(Hi+t)/2,Xy+=o*(Wi+e)/2,Xd+=o,o=Wi*t-Hi*e,ov+=o*(Hi+t),av+=o*(Wi+e),ip+=o*3,Jl(Hi=t,Wi=e)}var nv,rv,ap,Uy,Xy,Xd,ov,av,ip,aF,iF,Hi,Wi,ii,iv,lF=st(()=>{"use strict";Sr();nv=0,rv=0,ap=0,Uy=0,Xy=0,Xd=0,ov=0,av=0,ip=0,ii={point:Jl,lineStart:rF,lineEnd:oF,polygonStart:function(){ii.lineStart=Lat,ii.lineEnd=vat},polygonEnd:function(){ii.point=Jl,ii.lineStart=rF,ii.lineEnd=oF},result:function(){var t=ip?[ov/ip,av/ip]:Xd?[Uy/Xd,Xy/Xd]:ap?[nv/ap,rv/ap]:[NaN,NaN];return nv=rv=ap=Uy=Xy=Xd=ov=av=ip=0,t}};iv=ii});function jy(t){this._context=t}var cF=st(()=>{"use strict";Sr();ql();jy.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,jr);break}}},result:Gr}});function Mat(t,e){qy.point=fF,dF=sp=t,uF=lp=e}function fF(t,e){sp-=t,lp-=e,lv.add(bo(sp*sp+lp*lp)),sp=t,lp=e}var lv,sv,dF,uF,sp,lp,qy,cv,pF=st(()=>{"use strict";To();Sr();ql();lv=new qr,qy={point:Gr,lineStart:function(){qy.point=Mat},lineEnd:function(){sv&&fF(dF,uF),qy.point=Gr},polygonStart:function(){sv=!0},polygonEnd:function(){sv=null},result:function(){var t=+lv;return lv=new qr,t}};cv=qy});function yF(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function kat(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return yF;if(e!==mF){let n=10**e;mF=e,Ky=function(o){let a=1;this._+=o[0];for(let i=o.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+o[a]}}return Ky}var mF,Ky,gF,hF,jd,bF=st(()=>{"use strict";jd=class{constructor(e){this._append=e==null?yF:kat(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==gF||this._append!==Ky){let r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,gF=r,Ky=this._append,hF=this._,this._=o}this._+=hF;break}}}result(){let e=this._;return this._="",e.length?e:null}}});function Wa(t,e){let n=3,r=4.5,o,a;function i(s){return s&&(typeof r=="function"&&a.pointRadius(+r.apply(this,arguments)),$a(s,o(a))),a.result()}return i.area=function(s){return $a(s,o(tv)),tv.result()},i.measure=function(s){return $a(s,o(cv)),cv.result()},i.bounds=function(s){return $a(s,o(Ud)),Ud.result()},i.centroid=function(s){return $a(s,o(iv)),iv.result()},i.projection=function(s){return arguments.length?(o=s==null?(t=null,rp):(t=s).stream,i):t},i.context=function(s){return arguments.length?(a=s==null?(e=null,new jd(n)):new jy(e=s),typeof r!="function"&&a.pointRadius(r),i):e},i.pointRadius=function(s){return arguments.length?(r=typeof s=="function"?s:(a.pointRadius(+s),+s),i):r},i.digits=function(s){if(!arguments.length)return n;if(s==null)n=null;else{let l=Math.floor(s);if(!(l>=0))throw new RangeError(`invalid digits: ${s}`);n=l}return e===null&&(a=new jd(n)),i},i.projection(t).digits(n).context(e)}var xF=st(()=>{"use strict";qL();Kf();nF();ev();lF();cF();pF();bF()});function Zy(t){return{stream:qd(t)}}function qd(t){return function(e){var n=new dv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function dv(){}var Qy=st(()=>{"use strict";dv.prototype={constructor:dv,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}});function uv(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),$a(n,t.stream(Ud)),e(Ud.result()),r!=null&&t.clipExtent(r),t}function fv(t,e,n){return uv(t,function(r){var o=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=Math.min(o/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+e[0][0]+(o-i*(r[1][0]+r[0][0]))/2,l=+e[0][1]+(a-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,l])},n)}function wF(t,e,n){return fv(t,[[0,0],e],n)}function EF(t,e,n){return uv(t,function(r){var o=+e,a=o/(r[1][0]-r[0][0]),i=(o-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([i,s])},n)}function SF(t,e,n){return uv(t,function(r){var o=+e,a=o/(r[1][1]-r[0][1]),i=-a*r[0][0],s=(o-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([i,s])},n)}var LF=st(()=>{"use strict";Kf();ev()});function pv(t,e){return+e?_at(t,e):Cat(t)}function Cat(t){return qd({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function _at(t,e){function n(r,o,a,i,s,l,c,d,u,f,p,m,g,h){var S=c-r,y=d-o,b=S*S+y*y;if(b>4*e&&g--){var E=i+f,x=s+p,N=l+m,L=bo(E*E+x*x+N*N),A=Do(N/=L),C=Ln(Ln(N)-1)<xn||Ln(a-u)<xn?(a+u)/2:la(x,E),k=t(C,A),w=k[0],v=k[1],M=w-r,_=v-o,T=y*M-S*_;(T*T/b>e||Ln((S*M+y*_)/b-.5)>.3||i*f+s*p+l*m<Tat)&&(n(r,o,a,i,s,l,w,v,C,E/=L,x/=L,N,g,h),h.point(w,v),n(w,v,C,E,x,N,c,d,u,f,p,m,g,h))}}return function(r){var o,a,i,s,l,c,d,u,f,p,m,g,h={point:S,lineStart:y,lineEnd:E,polygonStart:function(){r.polygonStart(),h.lineStart=x},polygonEnd:function(){r.polygonEnd(),h.lineStart=y}};function S(A,C){A=t(A,C),r.point(A[0],A[1])}function y(){u=NaN,h.point=b,r.lineStart()}function b(A,C){var k=Ha([A,C]),w=t(A,C);n(u,f,d,p,m,g,u=w[0],f=w[1],d=A,p=k[0],m=k[1],g=k[2],vF,r),r.point(u,f)}function E(){h.point=S,r.lineEnd()}function x(){y(),h.point=N,h.lineEnd=L}function N(A,C){b(o=A,C),a=u,i=f,s=p,l=m,c=g,h.point=b}function L(){n(u,f,d,p,m,g,a,i,o,s,l,c,vF,r),h.lineEnd=E,E()}return h}}var vF,Tat,NF=st(()=>{"use strict";Bd();Sr();Qy();vF=16,Tat=_n(30*jn)});function Rat(t){return qd({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function Iat(t,e,n,r,o){function a(i,s){return i*=r,s*=o,[e+t*i,n-t*s]}return a.invert=function(i,s){return[(i-e)/t*r,(n-s)/t*o]},a}function MF(t,e,n,r,o,a){if(!a)return Iat(t,e,n,r,o);var i=_n(a),s=Mn(a),l=i*t,c=s*t,d=i/t,u=s/t,f=(s*n-i*e)/t,p=(s*e+i*n)/t;function m(g,h){return g*=r,h*=o,[l*g-c*h+e,n-c*g-l*h]}return m.invert=function(g,h){return[r*(d*g-u*h+f),o*(p-u*g-d*h)]},m}function ps(t){return mv(function(){return t})()}function mv(t){var e,n=150,r=480,o=250,a=0,i=0,s=0,l=0,c=0,d,u=0,f=1,p=1,m=null,g=XL,h=null,S,y,b,E=rp,x=.5,N,L,A,C,k;function w(T){return A(T[0]*jn,T[1]*jn)}function v(T){return T=A.invert(T[0],T[1]),T&&[T[0]*Dr,T[1]*Dr]}w.stream=function(T){return C&&k===T?C:C=Aat(Rat(d)(g(N(E(k=T)))))},w.preclip=function(T){return arguments.length?(g=T,m=void 0,_()):g},w.postclip=function(T){return arguments.length?(E=T,h=S=y=b=null,_()):E},w.clipAngle=function(T){return arguments.length?(g=+T?jW(m=T*jn):(m=null,XL),_()):m*Dr},w.clipExtent=function(T){return arguments.length?(E=T==null?(h=S=y=b=null,rp):jL(h=+T[0][0],S=+T[0][1],y=+T[1][0],b=+T[1][1]),_()):h==null?null:[[h,S],[y,b]]},w.scale=function(T){return arguments.length?(n=+T,M()):n},w.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],M()):[r,o]},w.center=function(T){return arguments.length?(a=T[0]%360*jn,i=T[1]%360*jn,M()):[a*Dr,i*Dr]},w.rotate=function(T){return arguments.length?(s=T[0]%360*jn,l=T[1]%360*jn,c=T.length>2?T[2]%360*jn:0,M()):[s*Dr,l*Dr,c*Dr]},w.angle=function(T){return arguments.length?(u=T%360*jn,M()):u*Dr},w.reflectX=function(T){return arguments.length?(f=T?-1:1,M()):f<0},w.reflectY=function(T){return arguments.length?(p=T?-1:1,M()):p<0},w.precision=function(T){return arguments.length?(N=pv(L,x=T*T),_()):bo(x)},w.fitExtent=function(T,R){return fv(w,T,R)},w.fitSize=function(T,R){return wF(w,T,R)},w.fitWidth=function(T,R){return EF(w,T,R)},w.fitHeight=function(T,R){return SF(w,T,R)};function M(){var T=MF(n,0,0,f,p,u).apply(null,e(a,i)),R=MF(n,r-T[0],o-T[1],f,p,u);return d=WL(s,l,c),L=ep(e,R),A=ep(d,L),N=pv(L,x),_()}function _(){return C=k=null,w}return function(){return e=t.apply(this,arguments),w.invert=e.invert&&v,M()}}var Aat,Kd=st(()=>{"use strict";XW();qW();QW();$L();qL();Sr();FL();Qy();LF();NF();Aat=qd({point:function(t,e){this.stream.point(t*jn,e*jn)}})});function kF(t){var e=0,n=wn/3,r=mv(t),o=r(e,n);return o.parallels=function(a){return arguments.length?r(e=a[0]*jn,n=a[1]*jn):[e*Dr,n*Dr]},o}var TF=st(()=>{"use strict";Sr();Kd()});function CF(t){var e=_n(t);function n(r,o){return[r*e,Mn(o)/e]}return n.invert=function(r,o){return[r/e,Do(o*e)]},n}var _F=st(()=>{"use strict";Sr()});function AF(t,e){var n=Mn(t),r=(n+Mn(e))/2;if(Ln(r)<xn)return CF(t);var o=1+n*(2*r-n),a=bo(o)/r;function i(s,l){var c=bo(o-2*r*Mn(l))/r;return[c*Mn(s*=r),a-c*_n(s)]}return i.invert=function(s,l){var c=a-l,d=la(s,Ln(c))*Fd(c);return c*r<0&&(d-=wn*Fd(s)*Fd(c)),[d/r,Do((o-(s*s+c*c)*r*r)/(2*r))]},i}function cp(){return kF(AF).scale(155.424).center([0,33.6442])}var RF=st(()=>{"use strict";Sr();TF();_F()});function Jy(t,e){return[t,wW(EW((yo+e)/2))]}function tb(){return Pat(Jy).scale(961/jr)}function Pat(t){var e=ps(t),n=e.center,r=e.scale,o=e.translate,a=e.clipExtent,i=null,s,l,c;e.scale=function(u){return arguments.length?(r(u),d()):r()},e.translate=function(u){return arguments.length?(o(u),d()):o()},e.center=function(u){return arguments.length?(n(u),d()):n()},e.clipExtent=function(u){return arguments.length?(u==null?i=s=l=c=null:(i=+u[0][0],s=+u[0][1],l=+u[1][0],c=+u[1][1]),d()):i==null?null:[[i,s],[l,c]]};function d(){var u=wn*r(),f=e(WW(e.rotate()).invert([0,0]));return a(i==null?[[f[0]-u,f[1]-u],[f[0]+u,f[1]+u]]:t===Jy?[[Math.max(f[0]-u,i),s],[Math.min(f[0]+u,l),c]]:[[i,Math.max(f[1]-u,s)],[l,Math.min(f[1]+u,c)]])}return d()}var IF=st(()=>{"use strict";Sr();FL();Kd();Jy.invert=function(t,e){return[t,2*Dy(xW(e))-yo]}});function eb(t,e){return[t,e]}function nb(){return ps(eb).scale(152.63)}var PF=st(()=>{"use strict";Kd();eb.invert=eb});function gv(t,e){var n=Do(rb*Mn(e)),r=n*n,o=r*r*r;return[t*_n(n)/(rb*(dp+3*up*r+o*(7*fp+9*pp*r))),n*(dp+up*r+o*(fp+pp*r))]}function hv(){return ps(gv).scale(177.158)}var dp,up,fp,pp,rb,Dat,DF=st(()=>{"use strict";Kd();Sr();dp=1.340264,up=-.081106,fp=893e-6,pp=.003796,rb=bo(3)/2,Dat=12;gv.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,a=0,i,s,l;a<Dat&&(s=n*(dp+up*r+o*(fp+pp*r))-e,l=dp+3*up*r+o*(7*fp+9*pp*r),n-=i=s/l,r=n*n,o=r*r*r,!(Ln(i)<Py));++a);return[rb*t*(dp+3*up*r+o*(7*fp+9*pp*r))/_n(n),Do(Mn(n)/rb)]}});function yv(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function bv(){return ps(yv).scale(175.295)}var GF=st(()=>{"use strict";Kd();Sr();yv.invert=function(t,e){var n=e,r=25,o;do{var a=n*n,i=a*a;n-=o=(n*(1.007226+a*(.015085+i*(-.044475+.028874*a-.005916*i)))-e)/(1.007226+a*(.015085*3+i*(-.044475*7+.028874*9*a-.005916*11*i)))}while(Ln(o)>xn&&--r>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}});var ob=st(()=>{"use strict";GL();GW();xF();RF();DF();PF();IF();GF();Qy()});function Zd(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function xv(t){let e=new Map;for(let n of Zd(t).geometries){let r=si(n.properties.name);e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}for(let n of Zd(t).geometries){let r=n.id.toLowerCase();e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}return e}function wv(t){let e=OF.get(t);if(e)return e;let n=Zd(t).geometries,r=TL(n),o=new Map;n.forEach((i,s)=>{if(!i.type||i.type==="null")return;let l=o.get(i.id);l||(l=new Set,o.set(i.id,l));for(let c of r[s]??[]){let d=n[c]?.id;d&&d!==i.id&&l.add(d)}});let a=new Map;for(let[i,s]of o)a.set(i,[...s].sort());return OF.set(t,a),a}function Ev(t){return Zd(t).geometries.map(e=>{let n=jl(t,e);return{type:"Feature",id:e.id,properties:e.properties,geometry:n.geometry}})}function $F(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let i=n[o][0],s=n[o][1],l=n[a][0],c=n[a][1];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function HF(t,e,n){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r][0],i=n[r][1],s=n[o][0],l=n[o][1];if(t<Math.min(a,s)-mp||t>Math.max(a,s)+mp||e<Math.min(i,l)-mp||e>Math.max(i,l)+mp)continue;let c=(s-a)*(e-i)-(l-i)*(t-a);if(Math.abs(c)<=mp)return!0}return!1}function gp(t,e,n){let r=t;if(!r)return!1;let o=r.type==="Polygon"?[r.coordinates]:r.type==="MultiPolygon"?r.coordinates:[];for(let a of o){if(!a.length)continue;if(HF(e,n,a[0]))return!0;if(!$F(e,n,a[0]))continue;let i=!1;for(let s=1;s<a.length;s++)if($F(e,n,a[s])&&!HF(e,n,a[s])){i=!0;break}if(!i)return!0}return!1}function WF(t,e,n){let r=t[0],o=t[1],a=null;for(let s of e)if(gp(s.geometry,r,o)){a={iso:s.id,name:s.properties.name};break}let i=null;if(a?.iso==="US"&&n){for(let s of n)if(gp(s.geometry,r,o)){i={iso:s.id,name:s.properties.name};break}}return{country:a,state:i}}function hp(t,e){let n=Zd(t).geometries.find(a=>a.id===e);if(!n)return null;let r=jl(t,n),o=fs(r);return!o||!Number.isFinite(o[0][0])?null:[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]}function $at(t){let e=t.geometry??t,n=e.type,r=e.coordinates;return n==="Polygon"?[{type:"Feature",geometry:{type:"Polygon",coordinates:r}}]:n==="MultiPolygon"?r.map(o=>({type:"Feature",geometry:{type:"Polygon",coordinates:o}})):[]}function Hat(t,e){let n=Math.max(0,t[0][0]-e[1][0],e[0][0]-t[1][0]),r=Math.max(0,t[0][1]-e[1][1],e[0][1]-t[1][1]);return Math.max(n,r)}function yp(t,e){let n=Zd(t).geometries.find(u=>u.id===e);if(!n)return null;let r=jl(t,n),o=$at(r);if(o.length<=1)return hp(t,e);let a=o.map(u=>{let f=fs(u);if(!f||!Number.isFinite(f[0][0]))return null;let p=f[1][0]<f[0][0];return{bbox:[[f[0][0],f[0][1]],[f[1][0],f[1][1]]],area:DL(u),wraps:p}}).filter(u=>u!==null);if(a.length<=1||a.some(u=>u.wraps))return hp(t,e);let i=Math.max(...a.map(u=>u.area)),s=a.find(u=>u.area===i),l=[[s.bbox[0][0],s.bbox[0][1]],[s.bbox[1][0],s.bbox[1][1]]],c=a.filter(u=>u!==s),d=!0;for(;d;){d=!1;for(let u=c.length-1;u>=0;u--){let f=c[u],p=Hat(f.bbox,l)<=Gat,m=f.area>=Oat*i;(p||m)&&(l[0][0]=Math.min(l[0][0],f.bbox[0][0]),l[0][1]=Math.min(l[0][1],f.bbox[0][1]),l[1][0]=Math.max(l[1][0],f.bbox[1][0]),l[1][1]=Math.max(l[1][1],f.bbox[1][1]),c.splice(u,1),d=!0)}}return l}function ab(t,e){let n=[],r=[];for(let l of t)n.push(l[0][1],l[1][1]),r.push(l[0][0],l[1][0]);for(let[l,c]of e)r.push(l),n.push(c);if(!n.length)return null;let o=Math.min(...n),a=Math.max(...n),{west:i,east:s}=Wat(r);return[[i,o],[s,a]]}function Wat(t){let e=[...new Set(t)].sort((a,i)=>a-i);if(e.length===1)return{west:e[0],east:e[0]};let n=-1,r=-1;for(let a=1;a<e.length;a++){let i=e[a]-e[a-1];i>n&&(n=i,r=a)}return e[0]+360-e[e.length-1]>=n?{west:e[0],east:e[e.length-1]}:{west:e[r],east:e[r-1]+360}}var si,OF,mp,Gat,Oat,Sv=st(()=>{"use strict";_L();ob();si=t=>t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim();OF=new WeakMap;mp=1e-9;Gat=10,Oat=.25});var Nv={};ye(Nv,{isSubNationalUsExtent:()=>jF,resolveMap:()=>tit});function jat(t,e){return e?Lv:Math.max(Uat,Math.min(Lv,Lv-Xat*t))}function YF(t){return(t[1][0]-t[0][0])*(t[1][1]-t[0][1])}function jF(t){return t?YF(t)/YF(Kat)<Zat:!1}function vv(t){if(!t)return null;let e=t.toUpperCase();return Qat.has(e)?`US-${e}`:null}function zF(t,e){return t<15||t>72?!1:e>=-180&&e<=-64||e>=172}function UF(t,e){return t>=14&&t<=72&&e>=-141&&e<=-52}function Jat(t){return t[0][0]<=-179&&t[1][0]>=179&&t[0][1]<=-89&&t[1][1]>=89}function tit(t,e){let n=[...t.diagnostics],r=new Set,o={title:t.title,...t.directives.caption!==void 0&&{caption:t.directives.caption},tagGroups:[...t.tagGroups],directives:{...t.directives},basemaps:{world:"detail",subdivisions:[]},regions:[],pois:[],edges:[],routes:[],extent:[[-180,-85],[180,85]],projection:"equirectangular",poiFrameContainers:[],diagnostics:n,error:t.error},a=xv(e.worldCoarse),i=xv(e.usStates),s=[...[...a.values()].map(Z=>Z.name),...[...i.values()].map(Z=>Z.name)],l=t.directives.locale?.toUpperCase(),c=l?l.split("-")[0]:void 0,d=l&&/^[A-Z]{2}-/.test(l)?l:void 0,u=c==="US"||t.regions.some(Z=>{let lt=si(Z.name);return i.has(lt)&&!a.has(lt)})||t.regions.some(Z=>Z.scope==="US"||Z.scope?.startsWith("US-")||vv(Z.scope)!==null)||t.pois.some(Z=>Z.pos.kind==="name"&&(Z.pos.scope?.startsWith("US-")||vv(Z.pos.scope)!==null)),f=[],p=new Map,m=!1,g=!1,h=!1,S=[];for(let Z of t.regions){let lt=si(Z.name),nt=a.get(lt)??(VF[lt]?a.get(VF[lt]):void 0),J=i.get(lt),at=null,it=Z.scope;if(it){let At=it==="US"||it.startsWith("US-");if(At&&J){if(it.startsWith("US-")&&J.id!==it){n.push(Me(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it,iso:J.id}));continue}at={...J,layer:"us-state"}}else if(!At&&nt)at={...nt,layer:"country"};else{n.push(Me(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it}));continue}}else nt&&J?u?at={...J,layer:"us-state"}:(at={...nt,layer:"country"},n.push(Me(sa.REGION_AMBIGUOUS,Z.lineNumber,{name:Z.name,layer:at.layer,chosenId:at.id,stateId:J.id,countryId:nt.id}))):J?at={...J,layer:"us-state"}:nt&&(at={...nt,layer:"country"});if(!at){let At=be(Z.name,s);n.push(Me(sa.UNKNOWN_SUBDIVISION,Z.lineNumber,{name:Z.name,hint:At}));continue}at.layer==="us-state"&&(m=!0,at.id==="US-AK"&&(g=!0),at.id==="US-HI"&&(h=!0),S.push({topo:"us",id:at.id}));let Lt={iso:at.id,name:at.name,layer:at.layer,...Z.value!==void 0&&{value:Z.value},...Z.color!==void 0&&{color:Z.color},tags:Z.tags,meta:Z.meta,lineNumber:Z.lineNumber},Tt=p.get(at.id);Tt!==void 0?(n.push(Me(sa.DUPLICATE_REGION,Z.lineNumber,{name:at.name})),f[Tt]=Lt):(p.set(at.id,f.length),f.push(Lt))}let y=new Map,b=[],E=(Z,lt,nt)=>{let J=y.get(Z);if(J){if(lt.implicit&&!J.implicit)return;!lt.implicit&&!J.implicit&&n.push(Me(sa.DUPLICATE_POI,nt,{id:Z}));let at=b.indexOf(J);at>=0&&(b[at]=lt)}else b.push(lt);y.set(Z,lt)},x=(Z,lt,nt,J,at)=>{let it=si(Z),Lt=e.gazetteer.byName[it];if(!Lt?.length){let pt=e.gazetteer.alt[it];pt!==void 0&&(Lt=[pt])}if(!Lt?.length){let pt=e.airports?.airportIata?.[it];if(pt!==void 0){let ut=e.airports.airports[pt];if(ut)return{kind:"ok",lat:ut[0],lon:ut[1],iso:ut[2]}}if(/^[A-Za-z]{3}$/.test(Z)){let ut=Z.toUpperCase();return n.push(Me(sa.UNKNOWN_AIRPORT_CODE,nt,{code:ut})),{kind:"miss"}}let gt=e.gazetteer.cities.map(ut=>ut[4]),dt=be(Z,gt);return n.push(Me(sa.UNKNOWN_PLACE,nt,{name:Z,hint:dt})),{kind:"miss"}}let Tt=Lt.map(pt=>e.gazetteer.cities[pt]),At=lt??J;if(At){let pt=vv(At),gt=/^[A-Za-z]{2}-/.test(At)?At:pt,dt=Tt.filter(ut=>gt?ut[5]===gt:ut[2]===At);if(dt.length)Tt=dt;else if(lt)return n.push(Me(sa.SCOPE_MISS,nt,{name:Z,scope:lt,place:!0})),{kind:"miss"}}if(Tt.length>1){if(!at&&!At)return{kind:"defer"};Tt=[...Tt].sort((pt,gt)=>gt[3]-pt[3]),lt||n.push(Me(sa.AMBIGUOUS_NAME,nt,{name:Z}))}let rt=Tt[0];if(e.airports?.airportIata?.[it]!==void 0&&!r.has(it)){r.add(it);let pt=Z.toUpperCase();n.push(Me(sa.AIRPORT_SHADOWED_BY_CITY,nt,{name:Z,code:pt}))}return{kind:"ok",lat:rt[0],lon:rt[1],iso:rt[2]}},N=(Z,lt)=>lt?si(lt):Z.kind==="coords"?`@${Z.lat},${Z.lon}`:si(Z.name),L=[],A=!1,C=!1,k=Z=>{Z&&(L.push(Z),Z==="US"&&(A=!0),Z!=="US"&&Z!=="CA"&&Z!=="MX"&&(C=!0))},w=[];for(let Z of t.pois){if(Z.pos.kind==="coords"){zF(Z.pos.lat,Z.pos.lon)?A=!0:UF(Z.pos.lat,Z.pos.lon)||(C=!0),_(Z.pos.lat,Z.pos.lon,Z);continue}let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,void 0,!1);lt.kind==="ok"?(k(lt.iso),_(lt.lat,lt.lon,Z)):lt.kind==="defer"&&w.push(Z)}let v=c??eit(f,L)??void 0,M=d??v;for(let Z of w){if(Z.pos.kind!=="name")continue;let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,M,!0);lt.kind==="ok"&&(k(lt.iso),_(lt.lat,lt.lon,Z))}function _(Z,lt,nt){let J=N(nt.pos,nt.alias),at=nt.pos.kind==="name"?nt.pos.name:nt.alias,it={id:J,...at!==void 0&&{name:at},lat:Z,lon:lt,...nt.label!==void 0&&{label:nt.label},...nt.color!==void 0&&{color:nt.color},tags:nt.tags,meta:nt.meta,lineNumber:nt.lineNumber};E(J,it,nt.lineNumber)}let T=new Map;for(let Z of b){let lt=Z.name?si(Z.name):void 0;lt&&lt!==Z.id&&!T.has(lt)&&T.set(lt,Z.id)}let R=(Z,lt)=>{let nt=si(Z);if(y.has(nt))return nt;let J=T.get(nt);if(J)return J;let at=x(Z,void 0,lt,v,!0);if(at.kind!=="ok")return null;k(at.iso);let it={id:nt,name:Z,lat:at.lat,lon:at.lon,tags:{},meta:{},lineNumber:lt,implicit:!0};return E(nt,it,lt),nt},O=[];for(let Z of t.edges){let lt=R(Z.from,Z.lineNumber),nt=R(Z.to,Z.lineNumber);!lt||!nt||O.push({fromId:lt,toId:nt,...Z.label!==void 0&&{label:Z.label},directed:Z.directed,style:Z.style,meta:Z.meta,tags:Z.tags,lineNumber:Z.lineNumber})}let I=(Z,lt,nt,J,at,it)=>{let Lt=at!==void 0?{value:at}:{};if(Z.kind==="coords"){let pt=lt?si(lt):`@${Z.lat},${Z.lon}`;return zF(Z.lat,Z.lon)?A=!0:UF(Z.lat,Z.lon)||(C=!0),y.has(pt)||E(pt,{id:pt,...lt!==void 0&&{name:lt},lat:Z.lat,lon:Z.lon,...nt!==void 0&&{label:nt},tags:J,meta:Lt,lineNumber:it},it),pt}let Tt=si(Z.name);if(y.has(Tt))return Tt;let At=T.get(Tt);if(At)return At;let rt=x(Z.name,Z.scope,it,M,!0);return rt.kind!=="ok"?null:(k(rt.iso),E(Tt,{id:Tt,name:Z.name,lat:rt.lat,lon:rt.lon,...nt!==void 0&&{label:nt},tags:J,meta:Lt,lineNumber:it},it),Tt)},H=[];for(let Z of t.routes){let lt=I(Z.origin,Z.originAlias,Z.originLabel,Z.originTags,Z.originValue,Z.lineNumber);if(!lt)continue;let nt=[lt],J=[],at=lt;for(let it of Z.legs){let Lt=I(it.dest,it.destAlias,it.destLabel,{},void 0,it.lineNumber);Lt&&(J.push({fromId:at,toId:Lt,...it.label!==void 0&&{label:it.label},style:it.style,...it.value!==void 0&&{value:it.value},tags:it.tags,lineNumber:it.lineNumber}),nt.includes(Lt)||nt.push(Lt),at=Lt)}H.push({stopIds:nt,legs:J,lineNumber:Z.lineNumber})}let G=m||A||c==="US",D=!C&&!f.some(Z=>Z.layer==="country"&&!["US","CA","MX"].includes(Z.iso))&&G,W=[];(m||D)&&W.push("us-states");let V=[];for(let Z of S){let lt=hp(e.usStates,Z.id);lt&&V.push(lt)}for(let Z of f)if(Z.layer==="country"){let lt=yp(e.worldCoarse,Z.iso);lt&&V.push(lt)}let P=b.map(Z=>[Z.lon,Z.lat]),F=ab(V,P),Y=jF(F),z=c==="US"&&!d,j=[[-180,-85],[180,85]],K=f.length>0?Yat:FF,$=F?XF(F,K):j,U=b.length>0&&f.length===0,X=[];if(U){let Z=Ev(e.worldDetail),lt=Ev(e.usStates),nt=new Set,J=[];for(let it of b){let{country:Lt,state:Tt}=WF([it.lon,it.lat],Z,lt),At=Tt?.iso??Lt?.iso;if(!At||nt.has(At))continue;nt.add(At),X.push(At);let rt=Tt?hp(e.usStates,At):D?null:yp(e.worldCoarse,At);rt&&!Jat(rt)&&J.push(rt)}let at=ab(J,P);at&&($=XF(nit(at,P,D),FF))}if(U||Y&&D){let Z=($[0][0]+$[1][0])/2,lt=($[0][1]+$[1][1])/2,nt=$[1][0]-$[0][0],J=$[1][1]-$[0][1],at=Math.max(nt,J);if(at>0&&at<BF){let it=BF/at,Lt=nt*it/2,Tt=J*it/2;$=[[Z-Lt,lt-Tt],[Z+Lt,lt+Tt]]}}let q=$[1][0]-$[0][0],et=$[1][1]-$[0][1],tt=Math.max(q,et),B=Math.max(Math.abs($[0][1]),Math.abs($[1][1])),Q=D&&Y&&!U&&!g&&!h&&!z,ot;return D&&q<qat&&(U||Q)?ot="mercator":D?ot="albers-usa":tt>Fat||B>Bat?ot="equirectangular":ot="conic-equal-area",q>=180&&($=[[-180,Math.min($[0][1],Vat)],[180,Math.max($[1][1],zat)]]),o.regions=f,o.pois=b,o.edges=O,o.routes=H,o.basemaps={world:"detail",subdivisions:W},o.extent=$,o.projection=ot,o.poiFrameContainers=X,o.error=t.error??rit(n),o}function eit(t,e){let n=new Map;for(let a of t){let i=a.layer==="us-state"?"US":a.iso;n.set(i,(n.get(i)??0)+1)}for(let a of e)n.set(a,(n.get(a)??0)+1);let r,o=0;for(let[a,i]of[...n.entries()].sort((s,l)=>s[0]<l[0]?-1:1))i>o&&(o=i,r=a);return r}function nit(t,e,n){let r=ab([],e);if(!r)return t;let[[o,a],[i,s]]=t,[[l,c],[d,u]]=r,f=jat(Math.max(d-l,u-c),n);a=Math.max(a,c-f),s=Math.min(s,u+f);let p=l-f,m=d+f;return o=o>=-180&&o<=l?Math.max(o,p):p,i=i<=180&&i>=d?Math.min(i,m):m,[[o,a],[i,s]]}function XF(t,e){let n=(t[1][0]-t[0][0])*e||1,r=(t[1][1]-t[0][1])*e||1;return[[Math.max(-180,t[0][0]-n),Math.max(-90,t[0][1]-r)],[Math.min(540,t[1][0]+n),Math.min(90,t[1][1]+r)]]}function rit(t){let e=t.find(n=>n.severity==="error");return e?Ge(e):null}var Fat,Bat,FF,Yat,Vat,zat,BF,Lv,Uat,Xat,qat,Kat,Zat,VF,Qat,Mv=st(()=>{"use strict";un();EL();Sv();Fat=90,Bat=80,FF=.05,Yat=.12,Vat=-58,zat=78,BF=7,Lv=8,Uat=3,Xat=.3;qat=48,Kat=[[-125,25],[-66,49]],Zat=.4;VF={"united states":"united states of america",usa:"united states of america",america:"united states of america",uk:"united kingdom","western sahara":"w. sahara","democratic republic of the congo":"dem. rep. congo","dr congo":"dem. rep. congo",drc:"dem. rep. congo","dominican republic":"dominican rep.","falkland islands":"falkland is.","ivory coast":"cote d'ivoire","central african republic":"central african rep.","equatorial guinea":"eq. guinea","solomon islands":"solomon is.","bosnia and herzegovina":"bosnia and herz.","south sudan":"s. sudan","north macedonia":"macedonia","czech republic":"czechia"},Qat=new Set(["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"])});function ib(t){let e=t.ramp,n=e?{name:e.metric?.trim()||"Value",entries:[],gradient:{min:e.min,max:e.max,low:e.low,high:e.high}}:null,r=t.tagGroups.filter(o=>o.entries.length>0).map(o=>({name:o.name,entries:[...o.entries]}));return[...n?[n]:[],...r]}function sb(t,e){return{groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:e,showEmptyGroups:!1,showInactivePills:!0}}function qF(t,e){return(t?50:0)+(e?20:0)+oit}function KF(t,e){if(!t)return 0;let n=ib(t);if(n.length===0)return 0;let r=sb(n,e.mode),o={activeGroup:t.activeGroup},{height:a}=kl(r,o,e.width);return a<=0?0:qF(e.hasTitle,e.hasSubtitle)+a+ait}function ZF(t,e){if(!t)return null;let n=ib(t);if(n.length===0)return null;let r=sb(n,e.mode),o={activeGroup:t.activeGroup},{width:a,height:i}=kl(r,o,e.width);return i<=0||a<=0?null:{x:(e.width-a)/2,y:qF(e.hasTitle,e.hasSubtitle),width:a,height:i}}var oit,ait,kv=st(()=>{"use strict";_o();oit=8,ait=10});function QF(t,e){let n=[...t].sort(),r=new Map,o=-1;for(let a of n){let i=new Set;for(let l of e.get(a)??[]){let c=r.get(l);c!==void 0&&i.add(c)}let s=0;for(;i.has(s);)s++;r.set(a,s),s>o&&(o=s)}return{byIso:r,huesNeeded:o+1}}var JF=st(()=>{"use strict"});function Av(t){return t>=90?"world":t>=20?"continental":t>=5?"regional":"local"}function Rv(t,e,n){let r={world:10,continental:9,regional:7,local:6},o=Math.floor(Math.sqrt(Math.max(0,t*e))/105);return Math.max(0,Math.min(o,r[n]))}function fit(t,e,n){switch(n){case"world":return t<=1&&(e==="ocean"||e==="sea");case"continental":return t<=2;case"regional":return t<=3;case"local":return t<=4}}function nB(t,e,n){return!!t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]>=0&&t[0]<=e&&t[1]>=0&&t[1]<=n}function Qd(t,e,n=ms){let r=e>0?Math.max(0,t.length-1)*e:0;return Fe(t,n)+r+2*iit}function pit(t,e){let n=t.split(/\s+/).filter(Boolean);if(n.length<=1)return[t];let r=n.length>=4?3:2,o=n.length,a=null;for(let i=0;i<1<<o-1;i++){let s=[],l=[n[0]];for(let u=1;u<o;u++)i&1<<u-1?(s.push(l.join(" ")),l=[n[u]]):l.push(n[u]);if(s.push(l.join(" ")),s.length>r)continue;let c=Math.round(Math.max(...s.map(u=>Qd(u,e)))),d=Qd(s[0],e);(!a||c<a.cost||c===a.cost&&s.length<a.lines.length||c===a.cost&&s.length===a.lines.length&&d>a.head)&&(a={lines:s,cost:c,head:d})}return a?.lines??[t]}function mit(t,e,n,r,o=ms){let a=o+2,i=Math.max(...n.map(l=>Qd(l,r,o))),s=(n.length-1)*a+o+2*_v;return{x:t-i/2,y:e-s/2,w:i,h:s}}function git(t,e,n){return t.x>=0&&t.y>=0&&t.x+t.w<=e&&t.y+t.h<=n}function hit(t,e,n){return t.x-n<e.x+e.w&&t.x+t.w+n>e.x&&t.y-n<e.y+e.h&&t.y+t.h+n>e.y}function iB(t){let{projection:e,dLonSpan:n,dLatSpan:r,width:o,height:a,waterBodies:i,countries:s,palette:l,countryTone:c,waterTone:d,project:u,collides:f,overLand:p}=t,m=Av(Math.max(n,r)),g=Rv(o,a,m);if(g<=0)return[];let h=d??Ot(l.colors.blue,l.textMuted,50),S=c??l.textMuted,y=l.bg,b=[],E=[o/2,a/2];for(let R of i?.entries??[]){let[O,I,H,G,D,W]=R;if(!fit(G,D,m))continue;let V=pit(H,Cv),P=[[I,O]];for(let K of W??[])P.push([K[1],K[0]]);let F=null,Y=1/0,z=null,j=1/0;for(let[K,$]of P){let U=u(K,$);if(!U||!Number.isFinite(U[0])||!Number.isFinite(U[1]))continue;let X=(U[0]-E[0])**2+(U[1]-E[1])**2;X<j&&(j=X,z=U),nB(U,o,a)&&X<Y&&(Y=X,F=U)}if(!F&&G===0&&z){let K=Math.max(0,-z[0],z[0]-o),$=Math.max(0,-z[1],z[1]-a);if(K<=o*tB&&$<=a*tB){let U=Math.max(...V.map(et=>Qd(et,Cv)))/2,X=((V.length-1)*Tv+ms+2*_v)/2,q=lit;F=[Math.min(Math.max(z[0],U+q),o-U-q),Math.min(Math.max(z[1],X+q),a-X-q)]}}F&&b.push({text:H,lines:V,cx:F[0],cy:F[1],italic:!0,letterSpacing:Cv,color:h,fontSize:ms,sort:(G<=1?0:2e3)+G*10+uit[D]})}let x=s.map(R=>{let[O,I,H,G]=R.bbox,D=H-O,W=G-I;return{c:R,w:D,h:W,area:D*W}}).filter(R=>Number.isFinite(R.area)&&R.area>0).sort((R,O)=>O.area-R.area),N=Math.sqrt(Math.max(1,o*a)),L=0;for(let R of x){let{c:O,w:I,h:H,area:G}=R;if(!O.curatedAnchor&&I>o*.66&&H>a*.66||!nB(O.anchor,o,a))continue;let D=Math.sqrt(G)/N,W=Math.min(1,Math.max(0,(D-eB)/(dit-eB))),V=Math.round(ms+W*(cit-ms)),P=S,F=O.name;Qd(F,0,V)>I||V+2*_v>H||b.push({text:F,lines:[F],cx:O.anchor[0],cy:O.anchor[1],italic:!1,letterSpacing:0,color:P,fontSize:V,...O.bordering?{bordering:!0}:{},...O.positions?{positions:O.positions}:{},sort:1e3+L++})}b.sort((R,O)=>R.sort-O.sort);let A=[],C=[],k=b.reduce((R,O)=>R+(!O.italic&&!O.bordering?1:0),0),w=g-Math.min(2,k),v=0,M=0,_=(R,O,I)=>{let H=mit(R,O,I.lines,I.letterSpacing,I.fontSize);if(!git(H,o,a))return null;if(I.italic&&p){let D=O-(I.lines.length-1)/2*Tv;if(I.lines.some((V,P)=>{let F=Qd(V,I.letterSpacing),Y=R-F/2+2,z=R+F/2-2,j=[Y,(Y+R)/2,R,(R+z)/2,z],K=D+P*Tv;return[K,K-ms*.4,K-ms*.8].some($=>j.some(U=>p(U,$)))}))return null}return f(H)||C.some(G=>hit(H,G,sit))?null:H},T=R=>{let O=R.positions??[[R.cx,R.cy]];for(let[I,H]of O){let G=_(I,H,R);if(G)return C.push(G),A.push({x:I,y:H,text:R.text,anchor:"middle",color:R.color,halo:!1,haloColor:y,fontSize:R.fontSize,italic:R.italic,letterSpacing:R.letterSpacing,...R.lines.length>1?{lines:R.lines}:{},lineNumber:0}),!0}return!1};for(let R of b)R.bordering&&T(R);for(let R of b)if(!R.bordering){if(M>=g)break;R.italic&&v>=w||T(R)&&(M++,R.italic&&v++)}return A}var ms,Tv,iit,_v,Cv,sit,lit,tB,cit,eB,dit,rB,oB,aB,uit,sB=st(()=>{"use strict";tn();Tr();ms=11,Tv=ms+2,iit=4,_v=3,Cv=1.5,sit=4,lit=8,tB=.35,cit=22,eB=.06,dit=.32,rB=4,oB=5,aB=3,uit={ocean:0,sea:1,gulf:2,bay:3,strait:4,channel:5,sound:6}});function cB(){let t=lB*lB;return Zy({lineStart(){let e=this;e._has=!1,e._pending=!1,e.stream.lineStart()},point(e,n){let r=this;if(r._lx=e,r._ly=n,r._has){let o=e-r._ex,a=n-r._ey;if(o*o+a*a<t){r._pending=!0;return}}r.stream.point(e,n),r._ex=e,r._ey=n,r._has=!0,r._pending=!1},lineEnd(){let e=this;e._pending&&e.stream.point(e._lx,e._ly),e._pending=!1,e.stream.lineEnd()}})}function Kit(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function Zit(t,e){let n=a=>{let i=a.geometry;return i?i.type==="Polygon"?[i.coordinates]:i.type==="MultiPolygon"?i.coordinates:null:null},r=n(t),o=n(e);return!r||!o?t:{...t,geometry:{type:"MultiPolygon",coordinates:[...r,...o]}}}function Jd(t){let e=xB.get(t);if(e)return e;let n=new Map;for(let r of Kit(t).geometries){let o=jl(t,r);if(!o.geometry)continue;let a={...o,id:r.id},i=n.get(r.id);n.set(r.id,i?Zit(i,a):a)}return xB.set(t,n),n}function Qit(t){let{geometry:e,bounds:n,project:r,width:o,height:a,curated:i}=t,s=n[0][0],l=n[0][1],c=n[1][0],d=n[1][1];if(![s,l,c,d].every(Number.isFinite)||c<=s||d<=l)return Gv(i,r);let u=oB,f=[],p=[];for(let A=0;A<u;A++){f[A]=[];let C=s+(A+.5)/u*(c-s);for(let k=0;k<u;k++){let w=l+(k+.5)/u*(d-l),v=gp(e,C,w);if(f[A][k]=v,!v)continue;let M=r(C,w);!M||!Number.isFinite(M[0])||!Number.isFinite(M[1])||M[0]<0||M[0]>o||M[1]<0||M[1]>a||p.push({i:A,j:k,lon:C,lat:w,sx:M[0],sy:M[1]})}}if(!p.length)return Gv(i,r);let m=p.reduce((A,C)=>A+C.sx,0)/p.length,g=p.reduce((A,C)=>A+C.sy,0)/p.length,h=A=>{let C=0;for(let k=-1;k<=1;k++)for(let w=-1;w<=1;w++){if(k===0&&w===0)continue;let v=A.i+k,M=A.j+w;v>=0&&v<u&&M>=0&&M<u&&f[v][M]&&C++}return C},S=A=>(A.sx-m)**2+(A.sy-g)**2,y=p.reduce((A,C)=>A+C.lon,0)/p.length,b=p.reduce((A,C)=>A+C.lat,0)/p.length,E=r(y,b),x=gp(e,y,b)&&E&&Number.isFinite(E[0])&&Number.isFinite(E[1])&&E[0]>=0&&E[0]<=o&&E[1]>=0&&E[1]<=a?[{lonLat:[y,b],screen:[E[0],E[1]]}]:[],N=[...p].sort((A,C)=>h(C)-h(A)||S(A)-S(C)).map(A=>({lonLat:[A.lon,A.lat],screen:[A.sx,A.sy]}));return[...i?Gv(i,r):[],...x,...N].slice(0,rB)}function Gv(t,e){if(!t)return[];let n=e(t[0],t[1]);return!n||!Number.isFinite(n[0])||!Number.isFinite(n[1])?[]:[{lonLat:[t[0],t[1]],screen:[n[0],n[1]]}]}function nst(t,e){switch(t){case"albers-usa":return Jit();case"conic-equal-area":{let n=e[0][1],r=e[1][1];return cp().parallels([n+(r-n)/6,n+(r-n)*5/6]).center([0,(n+r)/2])}case"mercator":return tb();case"equal-earth":return hv();case"equirectangular":return nb();case"natural-earth":return bv();default:return nb()}}function ast(t,e=!1,n=!1){return Ot(t.colors.blue,t.bg,e?Nit:vit)}function ist(t,e,n=!1){return Ot(t.colors.green,t.bg,e?Lit:Sit)}function bp(t,e){let n=t.basemaps.subdivisions.includes("us-states"),r=(t.projection==="albers-usa"||t.projection==="mercator")&&n&&!!e.naLand,o=r||t.basemaps.world==="detail"?e.worldDetail:e.worldCoarse,a=new Map(Jd(o));if(r&&e.naLand){let[p,m,g,h]=[-140,10,-52,66],S=Jd(e.naLand);for(let[y,b]of S){let E=a.get(y);if(!E)continue;let[[x,N],[L,A]]=fs(E);x>=p&&L<=g&&N>=m&&A<=h&&a.set(y,{...b,properties:E.properties})}}let i=n?Jd(e.usStates):null,s=()=>{let[[p,m],[g,h]]=t.extent,S=16,y=[];for(let b=0;b<=S;b++){let E=b/S,x=p+(g-p)*E,N=m+(h-m)*E;y.push([x,m],[x,h],[p,N],[g,N])}return{type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:y}}},l;if(t.projection==="albers-usa"&&i){l=[...i.entries()].filter(([m])=>!Hv.has(m)).map(([,m])=>m);let p=t.pois.filter(m=>!Ov(m.lon,m.lat)&&!$v(m.lon,m.lat)).map(m=>[m.lon,m.lat]);p.length>0&&l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:p}});for(let m of t.regions)if(m.layer==="country"&&(m.iso==="CA"||m.iso==="MX")){let g=a.get(m.iso);g&&l.push(g)}}else l=[s()];let c={type:"FeatureCollection",features:l},d=nst(t.projection,t.extent);if(t.projection!=="albers-usa"){let p=(t.extent[0][0]+t.extent[1][0])/2;p>180&&(p-=360),d.rotate([-p,0])}let u=fs(c),f=u[1][0]-u[0][0]>=270||u[1][1]-u[0][1]>=130;return{projection:d,fitTarget:c,fitIsGlobal:f,worldLayer:a,usLayer:i,usCrisp:r,wantsUsStates:n,worldTopo:o}}function xp(t){let e=[],n=[],r=/([MLZ])([^MLZ]*)/g,o;for(;o=r.exec(t);){if(o[1]==="Z"){n.length&&e.push(n),n=[];continue}o[1]==="M"&&n.length&&(e.push(n),n=[]);let a=o[2].split(/[ ,]+/).map(Number);for(let i=0;i+1<a.length;i+=2){let s=a[i],l=a[i+1];Number.isFinite(s)&&Number.isFinite(l)&&n.push([s,l])}}return n.length&&e.push(n),e}function sst(t,e,n){let r=xp(t);if(r.length<=1)return t;let o=.75,a=.003*e*n,i=f=>{let p=0;for(let m=0;m<f.length;m++){let g=f[m],h=f[(m+1)%f.length];p+=g[0]*h[1]-h[0]*g[1]}return Math.abs(p)/2},s=r.map(i),l=Math.max(...s),c=(f,p)=>Math.abs(f[0])<=o&&Math.abs(p[0])<=o||Math.abs(f[0]-e)<=o&&Math.abs(p[0]-e)<=o,d=!1,u=r.filter((f,p)=>s[p]>=l||s[p]>=a?!0:f.some((g,h)=>c(g,f[(h+1)%f.length]))?(d=!0,!1):!0);return d?u.map(f=>f.map((p,m)=>(m?"L":"M")+p[0]+","+p[1]).join("")+"Z").join(""):t}function lst(t,e,n,r){if(t.projection!=="albers-usa"||!t.basemaps.subdivisions.includes("us-states")||!(n>0)||!(r>0))return!1;let o=t.regions.some(p=>p.iso==="US-AK")||t.pois.some(p=>Ov(p.lon,p.lat)),a=t.regions.some(p=>p.iso==="US-HI")||t.pois.some(p=>$v(p.lon,p.lat));if(o||a)return!1;let{projection:i,fitTarget:s,usLayer:l}=bp(t,e);if(!l||![...l.keys()].some(p=>!Hv.has(p)))return!1;i.fitSize([1e3,1e3],s);let c=Wa(i).bounds(s),d=(c[1][0]-c[0][0])/(c[1][1]-c[0][1]);if(!(d>0))return!1;let u=n/r;return Math.max(u/d,d/u)>yit}function dst(t,e){let n=wB.get(t);n||(n=new Map,wB.set(t,n));let r=n.get(e);if(!r&&(r=new Map,n.set(e,r),n.size>cst)){let o=n.keys().next().value;o!==void 0&&n.delete(o)}return r}function Wv(t,e,n,r){let{palette:o,isDark:a}=r,{width:i,height:s}=n,l=t;lst(l,e,i,s)&&(l={...l,projection:"conic-equal-area"});let{projection:c,fitTarget:d,fitIsGlobal:u,worldLayer:f,usLayer:p,usCrisp:m,worldTopo:g}=bp(l,e),h=p!==null,S=a?Ot(o.border,o.text,65):Ot(o.text,o.bg,78),y=l.regions.filter(mt=>mt.value!==void 0).map(mt=>mt.value),b=y.length>0?Math.min(...y):0,E=Math.max(...y),x=On(l.directives.regionMetricColor??"",o)??o.colors.red,N=l.directives.regionMetricLowColor?On(l.directives.regionMetricLowColor,o)??void 0:void 0,L=y.length>0,A=L?l.directives.regionMetric?.trim()||"Value":null,C=mt=>{let St=mt.trim().toLowerCase();if(St==="none")return null;if(St===A?.toLowerCase())return A;let Bt=l.tagGroups.find(kt=>kt.name.toLowerCase()===St);return Bt?Bt.name:mt},k=new Set;for(let mt of l.tagGroups){let St=mt.name.toLowerCase();(l.regions.some(Bt=>Bt.tags[St])||l.pois.some(Bt=>Bt.tags[St]))&&k.add(mt.name)}let w=l.tagGroups.find(mt=>k.has(mt.name))?.name??null,v=r.activeGroup,M;v!==void 0?M=v===null?null:C(v):l.directives.activeTag!==void 0?M=C(l.directives.activeTag):M=A??w??l.tagGroups[0]?.name??null;let _=A!==null&&M===A,T=_||M!==null&&k.has(M),R=ist(o,a,T),O=ast(o,a,T),I=Ot(S,O,45),H=Ot(o.colors.gray,o.bg,T?a?Bit:Fit:a?Wit:Hit),G=(mt,...St)=>{let Bt=kt=>St.every(Jt=>gl(kt,Jt)>=pB);if(Bt(mt))return mt;for(let kt=10;kt<=100;kt+=10){let Jt=Ot(o.text,mt,kt);if(Bt(Jt))return Jt}return o.text},D=G(o.textMuted,R,O),W=G(Ot(o.colors.blue,o.textMuted,50),O,R),V=l.regions.some(mt=>mt.color!==void 0),P=l.directives.noColorize!==!0&&!L&&!V&&k.size===0,F=new Map;if(P){let mt=new Map,St=re=>{for(let[pe,ce]of re){let ke=mt.get(pe);ke?ke.push(...ce):mt.set(pe,[...ce])}};if(St(wv(g)),p){St(wv(e.usStates));for(let[re,pe]of Object.entries(ost)){let ce=mt.get(re);if(ce)for(let ke of pe){let $e=mt.get(ke);$e&&(ce.push(ke),$e.push(re))}}}let{byIso:Bt,huesNeeded:kt}=QF([...mt.keys()],mt),Jt=Lk(o,kt,a);for(let[re,pe]of Bt)F.set(re,Jt[pe])}let Y=mt=>Ot(mt,o.text,35),z=a?Ot(o.surface,o.text,28):o.bg,j=Ot(x,z,Pv),K=mt=>{let St=E>b?(mt-b)/(E-b):1;if(N!==void 0)return Kp(N,x,St,{isDark:a});let Bt=Pv+Math.max(0,Math.min(1,St))*(100-Pv);return Ot(x,z,Bt)},$=(mt,St)=>{if(!St)return null;let Bt=l.tagGroups.find(re=>re.name.toLowerCase()===St.toLowerCase());if(!Bt)return null;let kt=mt[qt(Bt.name)]??Bt.defaultValue;if(!kt)return null;let Jt=Bt.entries.find(re=>re.value.toLowerCase()===kt.toLowerCase());return Jt?.color?Ot(Jt.color,o.bg,a?gB:mB):null},U=mt=>{let St=mt?On(mt,o):null;return St?Ot(St,o.bg,a?gB:mB):null},X=mt=>{let St=U(mt.color);return St||(_?mt.value!==void 0?K(mt.value):R:P?(mt.iso&&F.get(mt.iso))??R:$(mt.tags,M)??R)},q=new Map(l.regions.map(mt=>[mt.iso,mt])),et=null;if(!l.directives.noLegend){let mt=l.tagGroups.map(St=>({name:St.name,entries:St.entries.map(Bt=>({value:Bt.value,color:Bt.color}))}));(mt.length>0||L)&&(et={tagGroups:mt,activeGroup:M,...L&&{ramp:{...l.directives.regionMetric!==void 0&&{metric:l.directives.regionMetric},min:b,max:E,low:N??j,high:x}}})}let tt=l.directives.noTitle?null:l.title,B=16,Q=Go;if(tt&&l.pois.length>0){let mt=(l.subtitle?50:30)+20/2;Q=Math.max(Go,mt+B)}let ot=KF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});ot>Q&&(Q=ot);let Z=[];if(tt){let mt=l.subtitle?2:1,St=Math.max(Fe(tt,20),l.subtitle?Fe(l.subtitle,20):0)+40;Z.push({x:i/2-St/2,y:10,w:St,h:20*(mt+.5)})}let lt=ZF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});lt&&Z.push({x:lt.x,y:lt.y,w:lt.width,h:lt.height});let nt=r._calloutReserve,J=Go+(nt?.left??0),at=i-Go-(nt?.right??0),it=Q+(nt?.top??0),Lt=s-Go-(nt?.bottom??0),Tt=[[J,it],[Math.max(J+1,at),Math.max(it+1,Lt)]];if(c.fitExtent(Tt,d),!u&&l.projection!=="albers-usa"&&l.regions.length>0){let mt=1/0,St=-1/0;for(let Bt of l.regions){let kt=Bt.iso?yp(e.worldCoarse,Bt.iso):null;if(kt)for(let Jt of[kt[0][0],kt[1][0]])for(let re of[kt[0][1],kt[1][1]]){let pe=c([Jt,re]);pe&&Number.isFinite(pe[1])&&(pe[1]<mt&&(mt=pe[1]),pe[1]>St&&(St=pe[1]))}}if(mt<St){let Bt=it,kt=Lt,Jt=(Bt+kt)/2-(mt+St)/2,re=Bt-mt,pe=kt-St;re<=pe&&(Jt=Math.max(re,Math.min(pe,Jt)));let[ce,ke]=c.translate();c.translate([ce,ke+Jt])}}if(!u&&l.projection==="albers-usa"){let mt=Wa(c).bounds(d);if(Number.isFinite(mt[0][1])){let St=Lt-it-(mt[1][1]-mt[0][1]);if(St>0){let Bt=mt[0][1]-it,kt=St*.3-Bt,[Jt,re]=c.translate();c.translate([Jt,re+kt])}}}let At,rt,pt=null;if(u&&!r.preferContain){let mt=Wa(c).bounds(d),St=mt[0][0],Bt=mt[0][1],kt=mt[1][0]-St,Jt=mt[1][1]-Bt,re=l.title&&l.pois.length>0||ot>0?Q:0,pe=0,ce=re,ke=kt>0?i/kt:1,$e=Jt>0?(s-re)/Jt:1;pt={sx:ke,sy:$e,ox:pe,oy:ce,bx0:St,by0:Bt};let ct=(Yt,Et)=>[pe+(Yt-St)*ke,ce+(Et-Bt)*$e],ht=c,wt=Zy({point(Yt,Et){let[Ft,Kt]=ct(Yt,Et);this.stream.point(Ft,Kt)}}),Ct=cB();At=Wa({stream:Yt=>ht.stream(wt.stream(Ct.stream(Yt)))}).digits(Iv),rt=(Yt,Et)=>{let Ft=ht([Yt,Et]);return Ft?ct(Ft[0],Ft[1]):null}}else{c.clipExtent([[0,0],[i,s]]);let mt=cB();At=Wa({stream:St=>c.stream(mt.stream(St))}).digits(Iv),rt=(St,Bt)=>c([St,Bt])??null}let gt=dst(t,JSON.stringify([i,s,[[-100,40],[-120,37],[-80,40],[0,0],[60,30],[-60,-30],[150,60],[-150,-60],[100,-40],[-30,50]].map(([mt,St])=>rt(mt,St))])),dt=[],ut=[],yt=[],vt=l.regions.some(mt=>mt.iso==="US-AK")||l.pois.some(mt=>Ov(mt.lon,mt.lat)),Gt=l.regions.some(mt=>mt.iso==="US-HI")||l.pois.some(mt=>$v(mt.lon,mt.lat));if(l.projection==="albers-usa"&&p&&(vt||Gt)){let Bt=s-Go,kt=8,Jt=new Map,re=(ht,wt)=>{let Ct=c([ht,wt]);if(!Ct)return;let Yt=Math.floor(Ct[0]/kt),Et=Jt.get(Yt);(Et===void 0||Ct[1]>Et)&&Jt.set(Yt,Ct[1])},pe=ht=>{if(Array.isArray(ht)&&typeof ht[0]=="number")re(ht[0],ht[1]);else if(Array.isArray(ht))for(let wt of ht)pe(wt)};for(let[ht,wt]of p)Hv.has(ht)||pe(wt.geometry.coordinates);let ce=ht=>{let wt=Math.floor(ht/kt),Ct=-1/0;for(let Yt=wt-1;Yt<=wt+1;Yt++){let Et=Jt.get(Yt);Et!==void 0&&Et>Ct&&(Ct=Et)}return Ct},ke=(ht,wt)=>{let Yt=-1/0;for(let Et=0;Et<=24;Et++){let Ft=ce(ht+(wt-ht)*Et/24);Ft>Yt&&(Yt=Ft)}return Yt},$e=(ht,wt,Ct,Yt)=>{let Et=p.get(ht);if(!Et)return Ct;let Ft=Ct,Kt=Math.min(Yt,i-Go-Ft-16);if(Kt<24)return Ct;let ue=Ft+Kt+16,_e=ke(Ft,ue),ve=_e>-1/0?_e+12:Bt-s*.42;wt.fitWidth(Kt,Et);let Re=Wa(wt).bounds(Et),sn=(Number.isFinite(Re[0][0])?Re[1][1]-Re[0][1]:Kt)+16,Pe=ve,qe=Math.min(Pe+sn,Bt);qe-Pe<sn&&(Pe=qe-sn),wt.fitExtent([[Ft+8,Pe+8],[ue-8,qe-8]],Et);let Ae=Wa(wt).digits(Iv),Ze=Ae(Et)??"";if(!Ze)return ue;let Oe;if(ht==="US-AK"){let Ir=f.get("CA"),zo=Ir?Ae(Ir)??"":"";zo&&(Oe={d:zo,fill:P?F.get("CA")??H:H})}let Ke=q.get(ht),De=P?F.get(ht)??R:R,En=-1;Ke?.layer==="us-state"&&(De=X(Ke),En=Ke.lineNumber),dt.push({x:Ft,y:Pe,w:ue-Ft,h:qe-Pe,points:[[Ft,Pe],[ue,Pe],[ue,qe],[Ft,qe]],projection:wt,...Oe&&{contextLand:Oe}}),ut.push({id:ht,d:Ze,fill:De,stroke:P?Y(De):S,lineNumber:En,layer:"us-state",...Ke?.value!==void 0&&{value:Ke.value},...Ke&&Object.keys(Ke.tags).length>0&&{tags:Ke.tags}});let Tn=Wa(wt).centroid(Et);if(Number.isFinite(Tn[0])){let Ir=Et.properties?.name??ht;yt.push({x:Tn[0],y:Tn[1],iso:ht,name:Ir,lineNumber:En})}return ue},ct=Go;vt&&(ct=$e("US-AK",tst(),Go,i*.18)),Gt&&$e("US-HI",est(),vt?ct+24:Go,i*.12)}let Xt=l.projection==="albers-usa"&&!!p,bt=Xt?fs(d):l.extent,Mt=bt[1][0]-bt[0][0],zt=bt[1][1]-bt[0][1],xt=Mt>=270||zt>=130,Nt=(bt[0][0]+bt[1][0])/2,Dt=mt=>{let St=mt;for(;St<Nt-180;)St+=360;for(;St>Nt+180;)St-=360;return St},Vt=mt=>{let St=1/0,Bt=-1/0,kt=1/0,Jt=-1/0,re=[];for(let[Ct]of mt){let Yt=Dt(Ct);re.push(Yt),Yt<St&&(St=Yt),Yt>Bt&&(Bt=Yt),Ct<kt&&(kt=Ct),Ct>Jt&&(Jt=Ct)}re.sort((Ct,Yt)=>Ct-Yt);let pe=0;for(let Ct=1;Ct<re.length;Ct++)pe=Math.max(pe,re[Ct]-re[Ct-1]);re.length>1&&(pe=Math.max(pe,re[0]+360-re[re.length-1]));let ce=360-pe;if(ce>270||Jt-kt>180&&ce<90)return!1;let ke=1/0,$e=1/0,ct=-1/0,ht=-1/0,wt=!1;for(let[Ct,Yt]of mt){let Et=rt(Ct,Yt);!Et||!Number.isFinite(Et[0])||!Number.isFinite(Et[1])||(wt=!0,Et[0]<ke&&(ke=Et[0]),Et[0]>ct&&(ct=Et[0]),Et[1]<$e&&($e=Et[1]),Et[1]>ht&&(ht=Et[1]))}return wt?!(ct<0||ke>i||ht<0||$e>s):!1},$t=mt=>{if(xt)return mt;let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Bt=St.coordinates[0];return Vt(Bt)?mt:null}if(St.type==="MultiPolygon"){let Bt=St.coordinates,kt=Bt.filter(Jt=>Vt(Jt[0]));return kt.length?kt.length===Bt.length?mt:{...mt,geometry:{...St,coordinates:kt}}:null}return mt},ft=100,Wt=mt=>{let St=mt.map(([ce])=>ce).sort((ce,ke)=>ce-ke);if(St.length<2)return!1;let Bt=-1,kt=0;for(let ce=1;ce<St.length;ce++){let ke=St[ce]-St[ce-1];ke>Bt&&(Bt=ke,kt=ce)}if(St[0]+360-St[St.length-1]>=Bt)return!1;let re=360-Bt;return St[kt-1]+360>180&&re<ft},ge=mt=>{let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Bt=St.coordinates[0];return Wt(Bt)?null:mt}if(St.type==="MultiPolygon"){let Bt=St.coordinates,kt=Bt.filter(Jt=>!Wt(Jt[0]));return kt.length?kt.length===Bt.length?mt:{...mt,geometry:{...St,coordinates:kt}}:null}return mt},ne=[],se=(mt,St,Bt)=>{for(let[kt,Jt]of mt){if(St==="us-state"&&h&&l.projection==="albers-usa"&&rst.has(kt)||St==="country"&&h&&kt==="US"||St==="country"&&kt==="AQ"&&!q.has("AQ"))continue;let re=q.get(kt),pe=St+":"+kt,ce=gt.get(pe);if(ce===void 0){let Kt=Bt?$t(Jt):ge(Jt);if(!Kt){gt.set(pe,null);continue}let ue=At(Kt)??"",_e=u?sst(ue,i,s):ue;if(!_e){gt.set(pe,null);continue}let ve=Dv[kt],Re=ve?rt(ve[0],ve[1]):At.centroid(Kt),Xe=Re!=null&&Number.isFinite(Re[0])&&Number.isFinite(Re[1]);ce={d:_e,cx:Xe?Re[0]:void 0,cy:Xe?Re[1]:void 0},gt.set(pe,ce)}else if(ce===null)continue;let ke=ce.d,$e=ce.cx!==void 0&&ce.cy!==void 0,ct=re?.layer===St,wt=St==="country"&&h&&kt!=="US"?H:R,Ct=P?F.get(kt)??wt:wt,Yt,Et=-1,Ft="base";ct?(Ct=X(re),Et=re.lineNumber,Ft=St,Yt=re.name):Yt=Jt.properties?.name,ne.push({id:kt,d:ke,fill:Ct,stroke:P?Y(Ct):S,lineNumber:Et,layer:Ft,...Yt!==void 0&&{label:Yt},...$e&&{labelX:ce.cx,labelY:ce.cy},...ct&&re.value!==void 0&&{value:re.value},...ct&&Object.keys(re.tags).length>0&&{tags:re.tags}})}};se(f,"country",!xt),p&&se(p,"us-state",!Xt&&!xt);let Zt=m&&e.naLakes?e.naLakes:e.lakes;if(Zt)for(let[,mt]of Jd(Zt)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At(St)??"";Bt&&ne.push({id:"lake",d:Bt,fill:O,stroke:I,lineNumber:-1,layer:"base"})}let Ie=(mt,St,Bt)=>{let kt=!1;for(let Jt of Bt)for(let re=0,pe=Jt.length-1;re<Jt.length;pe=re++){let[ce,ke]=Jt[re],[$e,ct]=Jt[pe];ke>St!=ct>St&&mt<($e-ce)*(St-ke)/(ct-ke)+ce&&(kt=!kt)}return kt},Ht=[...ne,...ut].map(mt=>{let St=xp(mt.d),Bt=1/0,kt=1/0,Jt=-1/0,re=-1/0;for(let pe of St)for(let ce of pe)ce[0]<Bt&&(Bt=ce[0]),ce[0]>Jt&&(Jt=ce[0]),ce[1]<kt&&(kt=ce[1]),ce[1]>re&&(re=ce[1]);return mt.bbox=[Bt,kt,Jt,re],mt.rings=St,{fill:mt.fill,rings:St,minX:Bt,minY:kt,maxX:Jt,maxY:re}}),Qt=(mt,St)=>{let Bt=O;for(let kt of Ht)mt<kt.minX||mt>kt.maxX||St<kt.minY||St>kt.maxY||Ie(mt,St,kt.rings)&&(Bt=kt.fill);return Bt},Ut=mt=>{let St=gl(mt,o.textOnFillDark)>=gl(mt,o.textOnFillLight)?o.textOnFillDark:o.textOnFillLight,Bt=St===o.textOnFillLight?o.textOnFillDark:o.textOnFillLight;return{color:St,halo:gl(mt,St)<pB,haloColor:Bt}},fe=l.directives.noRelief!==!0,de=[],te=null;if(fe&&e.mountainRanges){for(let[,mt]of Jd(e.mountainRanges)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At.area(St);if(!Number.isFinite(Bt)||Bt<Tit)continue;let kt=At.bounds(St);if(kt[1][0]-kt[0][0]<hB||kt[1][1]-kt[0][1]<hB)continue;let Jt=At(St)??"";Jt&&de.push({d:Jt})}if(de.length){let mt=a?o.bg:o.text,St=a?o.text:o.bg,Bt=P?a?o.surface:o.bg:R,kt=Ss(Bt),Jt=Math.abs(kt-Ss(mt))>.04?mt:St;te={color:Ot(Jt,Bt,Ait),spacing:Cit,width:_it}}}let ae=null;if(l.directives.noCoastline!==!0){let mt=Math.min(i,s);ae={color:Ot(S,O,$it),lines:Array.from({length:yB},(St,Bt)=>({d:(Rit+Bt*Iit)*mt,thickness:Pit*mt,opacity:bB+(Dit-bB)*Bt/(yB-1)})),minExtent:(xt?Oit:Git)*mt}}let Te=Ot(o.colors.blue,O,32),Je=[];if(e.rivers)for(let[,mt]of Jd(e.rivers)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At(St)??"";Bt&&Je.push({d:Bt,color:Te,width:Mit})}let ln=l.pois.map(mt=>Number(mt.meta.size)).filter(mt=>Number.isFinite(mt)&&mt>0),Ve=ln.length?Math.min(...ln):0,Ce=ln.length?Math.max(...ln):0,ee=mt=>{let St=Number(mt.meta.size);if(!Number.isFinite(St)||St<=0||Ce<=0)return bit;let Bt=Ce>Ve?(Math.sqrt(St)-Math.sqrt(Ve))/(Math.sqrt(Ce)-Math.sqrt(Ve)):1;return lb+Math.max(0,Math.min(1,Bt))*(dB-lb)},oe=mt=>{let St=Math.max(0,Math.min(1,(mt-lb)/(dB-lb)));return uB-St*(uB-xit)},Be=mt=>{let St=mt.color?On(mt.color,o):null;if(St)return{fill:St,stroke:Ot(St,o.text,18)};for(let Bt of l.tagGroups){let kt=mt.tags[qt(Bt.name)];if(!kt)continue;let re=Bt.entries.find(pe=>pe.value.toLowerCase()===kt.toLowerCase())?.color;if(re)return{fill:re,stroke:Ot(re,o.text,18)}}return{fill:o.colors.orange,stroke:Ot(o.colors.orange,o.text,18)}},fn=mt=>{for(let St of l.tagGroups){let Bt=mt[qt(St.name)];if(!Bt)continue;let kt=St.entries.find(Jt=>Jt.value.toLowerCase()===Bt.toLowerCase());if(kt?.color)return kt.color}return null},An=new Map,We=new Set;for(let mt of l.routes)mt.stopIds.forEach((St,Bt)=>{Bt===0&&We.add(St),An.has(St)||An.set(St,Bt+1)});let kn=new Map,Kn=[],xo=[...l.pois].sort((mt,St)=>mt.lineNumber-St.lineNumber||(mt.id<St.id?-1:1)),Lr=[];for(let mt of xo){let St=rt(mt.lon,mt.lat);St&&Lr.push({p:mt,xy:St})}let Rn=(mt,St,Bt,kt)=>{let{fill:Jt,stroke:re}=Be(mt.p),pe=ee(mt.p);kn.set(mt.p.id,{cx:St,cy:Bt,r:pe});let ce=An.get(mt.p.id);Kn.push({id:mt.p.id,cx:St,cy:Bt,r:pe,fill:Jt,fillOpacity:oe(pe),stroke:re,lineNumber:mt.p.lineNumber,implicit:!!mt.p.implicit,isOrigin:We.has(mt.p.id),...ce!==void 0&&{routeNumber:ce},...Object.keys(mt.p.tags).length>0&&{tags:mt.p.tags},...kt!==void 0&&{clusterId:kt}})},Dn=[],Rr=new Set;for(let mt of l.edges)Rr.add(mt.fromId),Rr.add(mt.toId);for(let mt of l.routes)mt.stopIds.forEach(St=>Rr.add(St));let dr=mt=>ee(mt.p);for(let mt of Lr)Rr.has(mt.p.id)&&Rn(mt,mt.xy[0],mt.xy[1]);let Ur=[];for(let mt of Lr){if(Rr.has(mt.p.id))continue;let St=dr(mt),Bt=Ur.find(kt=>kt.some(Jt=>Math.hypot(Jt.xy[0]-mt.xy[0],Jt.xy[1]-mt.xy[1])<(St+dr(Jt))*zit));Bt?Bt.push(mt):Ur.push([mt])}for(let mt of Ur){if(mt.length===1){Rn(mt[0],mt[0].xy[0],mt[0].xy[1]);continue}let St=mt[0].p.id,Bt=mt.reduce((Et,Ft)=>Et+Ft.xy[0],0)/mt.length,kt=mt.reduce((Et,Ft)=>Et+Ft.xy[1],0)/mt.length,Jt=Math.max(...mt.map(dr)),re=2*Jt+Xit,pe=Math.max(Yit,re/(2*Math.sin(Math.PI/Math.max(mt.length,2)))),ce=mt.map((Et,Ft)=>{if(mt.length<=Uit){let _e=-Math.PI/2+Ft*2*Math.PI/mt.length;return{e:Et,mx:Bt+Math.cos(_e)*pe,my:kt+Math.sin(_e)*pe}}let Kt=Ft*Vit,ue=pe*Math.sqrt((Ft+1)/mt.length);return{e:Et,mx:Bt+Math.cos(Kt)*ue,my:kt+Math.sin(Kt)*ue}}),ke=Bt-Jt,$e=Bt+Jt,ct=kt-Jt,ht=kt+Jt;for(let{mx:Et,my:Ft,e:Kt}of ce){let ue=dr(Kt);ke=Math.min(ke,Et-ue),$e=Math.max($e,Et+ue),ct=Math.min(ct,Ft-ue),ht=Math.max(ht,Ft+ue)}let wt=0,Ct=0;ke+wt<2&&(wt=2-ke),$e+wt>i-2&&(wt=i-2-$e),ct+Ct<2&&(Ct=2-ct),ht+Ct>s-2&&(Ct=s-2-ht);let Yt=[];for(let{e:Et,mx:Ft,my:Kt}of ce){let ue=Ft+wt,_e=Kt+Ct;Rn(Et,ue,_e,St),Yt.push({x2:ue,y2:_e,color:Be(Et.p).fill})}Dn.push({id:St,cx:Bt+wt,cy:kt+Ct,count:mt.length,hitR:pe+Jt+6,legs:Yt})}let Jn=[],io=1.5,Oo=(mt,St,Bt,kt,Jt,re,pe)=>{if(Jt!==0)return Jt;let ce=re*qit;return pe&&Bt*(mt-pe.x)+kt*(St-pe.y)<0?-ce:ce},rc=(mt,St,Bt,kt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2,ce=St.cx-mt.cx,ke=St.cy-mt.cy,$e=Math.hypot(ce,ke)||1,ct=Math.min(mt.r+io,$e*.45),ht=Math.min(St.r+io,$e*.45);if(!Bt&&kt===0){let sn=ce/$e,Pe=ke/$e,qe=mt.cx+sn*ct,Ae=mt.cy+Pe*ct,Ze=St.cx-sn*ht,Oe=St.cy-Pe*ht;return`M${qe},${Ae}L${Ze},${Oe}`}let wt=-ke/$e,Ct=ce/$e,Yt=Oo(re,pe,wt,Ct,kt,$e,Jt),Et=re+wt*Yt,Ft=pe+Ct*Yt,Kt=Math.hypot(Et-mt.cx,Ft-mt.cy)||1,ue=Math.hypot(St.cx-Et,St.cy-Ft)||1,_e=mt.cx+(Et-mt.cx)/Kt*ct,ve=mt.cy+(Ft-mt.cy)/Kt*ct,Re=St.cx-(St.cx-Et)/ue*ht,Xe=St.cy-(St.cy-Ft)/ue*ht;return`M${_e},${ve}Q${Et},${Ft} ${Re},${Xe}`},ci=(mt,St,Bt,kt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2;if(!Bt&&kt===0)return{x:re,y:pe-4};let ce=St.cx-mt.cx,ke=St.cy-mt.cy,$e=Math.hypot(ce,ke)||1,ct=-ke/$e,ht=ce/$e,wt=Oo(re,pe,ct,ht,kt,$e,Jt),Ct=wt*.5+Math.sign(wt||1)*8;return{x:re+ct*Ct,y:pe+ht*Ct}},Mo=l.routes.flatMap(mt=>mt.legs).map(mt=>Number(mt.value)).filter(mt=>Number.isFinite(mt)&&mt>0),pa=Mo.length?Math.min(...Mo):0,ma=Mo.length?Math.max(...Mo):0,di=mt=>{if(!Number.isFinite(mt)||mt<=0||ma<=0)return tc;let St=ma>pa?(mt-pa)/(ma-pa):1;return tc+St*(fB-tc)};for(let mt of l.routes){let St=mt.stopIds.map(kt=>kn.get(kt)).filter(kt=>!!kt),Bt=St.length>=3?{x:St.reduce((kt,Jt)=>kt+Jt.cx,0)/St.length,y:St.reduce((kt,Jt)=>kt+Jt.cy,0)/St.length}:void 0;for(let kt of mt.legs){let Jt=kn.get(kt.fromId),re=kn.get(kt.toId);if(!Jt||!re)continue;let pe=ci(Jt,re,kt.style==="arc",0,Bt),ce={curved:kt.style==="arc",offset:0,center:Bt,labelX:pe.x,labelY:pe.y},ke=kt.label!==void 0?Ut(Qt(ce.labelX,ce.labelY)):void 0,$e=Number(kt.value);Jn.push({d:rc(Jt,re,ce.curved,ce.offset,ce.center),width:di($e),color:fn(kt.tags)??Ot(o.text,o.bg,72),arrow:!0,fromId:kt.fromId,toId:kt.toId,...Number.isFinite($e)&&$e>0&&{value:$e},...Object.keys(kt.tags).length>0&&{tags:kt.tags},lineNumber:kt.lineNumber,...kt.label!==void 0&&{label:kt.label,labelX:ce.labelX,labelY:ce.labelY,labelColor:ke.color,labelHalo:ke.halo,labelHaloColor:ke.haloColor}})}}let ga=l.edges.map(mt=>Number(mt.meta.width)).filter(mt=>Number.isFinite(mt)&&mt>0),ui=ga.length?Math.min(...ga):0,fi=ga.length?Math.max(...ga):0,cl=mt=>{let St=Number(mt.meta.width);if(!Number.isFinite(St)||St<=0||fi<=0)return tc;let Bt=fi>ui?(St-ui)/(fi-ui):1;return tc+Bt*(fB-tc)},Ya=new Map;for(let mt of l.edges){let St=[mt.fromId,mt.toId].sort().join(" "),Bt=Ya.get(St);Bt?Bt.push(mt):Ya.set(St,[mt])}for(let mt of Ya.values()){let St=[...mt].sort((kt,Jt)=>kt.lineNumber-Jt.lineNumber),Bt=St.length;St.forEach((kt,Jt)=>{let re=kn.get(kt.fromId),pe=kn.get(kt.toId);if(!re||!pe)return;let ce=Bt>1?(Jt-(Bt-1)/2)*jit:0,ke=kt.style==="arc"||Bt>1,$e=ci(re,pe,ke,ce),ct={curved:ke,offset:ce,labelX:$e.x,labelY:$e.y},ht=kt.label!==void 0?Ut(Qt(ct.labelX,ct.labelY)):void 0,wt=Number(kt.meta.width);Jn.push({d:rc(re,pe,ct.curved,ct.offset),width:cl(kt),color:fn(kt.tags)??Ot(o.text,o.bg,66),arrow:kt.directed,fromId:kt.fromId,toId:kt.toId,...Number.isFinite(wt)&&wt>0&&{value:wt},...Object.keys(kt.tags).length>0&&{tags:kt.tags},lineNumber:kt.lineNumber,...kt.label!==void 0&&{label:kt.label,labelX:ct.labelX,labelY:ct.labelY,labelColor:ht.color,labelHalo:ht.halo,labelHaloColor:ht.haloColor}})})}let vr=[],ha=[...Z],hs=[],Fi=Kn.map(mt=>({cx:mt.cx,cy:mt.cy,r:mt.r})),ou=[];for(let mt of Jn){let St=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(mt.d);if(!St)continue;let Bt=+St[1],kt=+St[2];if(St[3]!==void 0)ou.push([Bt,kt,+St[3],+St[4]]);else{let Jt=+St[5],re=+St[6],pe=+St[7],ce=+St[8],ke=8,$e=Bt,ct=kt;for(let ht=1;ht<=ke;ht++){let wt=ht/ke,Ct=1-wt,Yt=Ct*Ct*Bt+2*Ct*wt*Jt+wt*wt*pe,Et=Ct*Ct*kt+2*Ct*wt*re+wt*wt*ce;ou.push([$e,ct,Yt,Et]),$e=Yt,ct=Et}}}let Bi=mt=>Fi.some(St=>Wu(mt,St))||ha.some(St=>Ea(mt,St))||ou.some(St=>w0(St[0],St[1],St[2],St[3],mt)),pi=l.directives.noRegionLabels!==!0,mi=new Set,to=l.directives.noRegionValue!==!0&&_,au=mt=>to&&mt!==void 0?Im(mt):void 0,oc=i<kit,Yi=l.projection==="mercator"&&l.basemaps.subdivisions.includes("us-states")&&_,iu=6,ac=3,yr=1,ya=(mt,St=xr)=>Fe(mt,St)+2*iu,$o=xr+2*ac,ys=(mt,St,Bt=xr)=>Math.max(ya(mt,Bt),St?Fe(St,Math.round(Bt*.82))+2*iu:0),su=(mt,St=xr)=>{let Bt=St+2*ac;return mt?Bt+yr+Math.round(St*.82):Bt},Ap=22,ic=.06,sc=.32,lu=18,Hb=13,cu=15,Wb=Math.sqrt(Math.max(1,i*s)),Fb=(mt,St)=>{let Bt=Math.sqrt(Math.max(0,mt*St))/Wb;return Math.min(1,Math.max(0,(Bt-ic)/(sc-ic)))},du=(mt,St,Bt,kt,Jt,re,pe=xr,ce)=>{let{color:ke,haloColor:$e}=Ut(kt),ct=ce??ke,ht=Math.round(pe*.82),wt=Math.max(Fe(Bt,pe),re?Fe(re,ht):0)/2,Ct=[St-pe*.55,St-pe*.1].some(Yt=>Qt(mt-wt,Yt)!==kt||Qt(mt+wt,Yt)!==kt);vr.push({x:mt,y:St,text:Bt,anchor:"middle",color:ct,halo:ce?!1:Ct,haloColor:$e,...pe!==xr&&{fontSize:pe},...re!==void 0&&{valueLine:re},lineNumber:Jt})},bs=2,ta=(mt,St,Bt,kt,Jt=xr)=>{let re=Math.round(Jt*.82),pe=Math.max(Fe(Bt,Jt),kt?Fe(kt,re):0)+2*bs,ce=kt?Jt+yr+re:Jt;return{x:mt-pe/2,y:St-ce/2,w:pe,h:ce}};if(pi){let mt=new Set(l.poiFrameContainers),St=ne.map(Et=>{let Ft=mt.has(Et.id);if(Et.layer==="base"&&!Ft||Et.label===void 0)return null;let Kt=Et.layer==="us-state"||Et.id.startsWith("US-"),ue=Kt?p?.get(Et.id):f.get(Et.id);if(!ue)return null;let[[_e,ve],[Re,Xe]]=At.bounds(ue),sn=Re-_e,Pe=Xe-ve,qe=Kt&&!Yi?Et.id.replace(/^US-/,""):void 0,Ae=qe!==void 0?oc?[qe,Et.label]:Ft?[Et.label]:[Et.label,qe]:[Et.label],Ze=Kt?void 0:Dv[Et.id],Oe=Ze?rt(Ze[0],Ze[1]):At.centroid(ue);return!Oe||!Number.isFinite(Oe[0])?null:{r:Et,c:Oe,boxW:sn,boxH:Pe,area:sn*Pe,candidates:Ae}}).filter(Et=>Et!==null).sort((Et,Ft)=>Ft.area-Et.area||Et.r.lineNumber-Ft.r.lineNumber),Bt=[...Z],kt=[],Jt=Et=>Et===O||Et===R||Et===H,re=14,pe=Kn.map(Et=>({x:Et.cx-Et.r-re,y:Et.cy-Et.r-re,w:2*(Et.r+re),h:2*(Et.r+re)})),ce=Math.max(46,Math.min(i,s)*.11),ke=4,$e=9,ct=6,ht=ce*3,wt=ct,Ct=(Et,Ft,Kt,ue)=>{let _e=Math.atan2(ue,Kt),ve=ht;for(let Re=-2;Re<=2;Re++){let Xe=_e+Re*Math.PI/4,sn=Math.cos(Xe),Pe=Math.sin(Xe),qe=ct;for(;qe<=ht;qe+=ct){let Ae=Et+sn*qe,Ze=Ft+Pe*qe;if(Ae<Go||Ze<Q||Ae>i-Go||Ze>s-Go||Qt(Ae,Ze)!==O)break}qe<ve&&(ve=qe)}return ve},Yt=(Et,Ft,Kt,ue,_e,ve=xr,Re=$e,Xe=ce)=>{let sn=ys(ue,_e,ve),Pe=su(_e!==void 0,ve),qe=Math.SQRT1_2,Ae=[[0,-1],[0,1],[1,0],[-1,0],[qe,-qe],[qe,qe],[-qe,-qe],[-qe,qe]],Ze=null;for(let[Oe,Ke]of Ae){let De=Et,En=Ft,Tn=0,Ir=Math.ceil(Xe/ke)+1;for(;Tn<Ir&&Qt(De,En)===Kt;)De+=Oe*ke,En+=Ke*ke,Tn++;if(Qt(De,En)===Kt)continue;let zo=(Math.abs(Oe)*sn+Math.abs(Ke)*Pe)/2,so=De+Oe*(Re+zo),ba=En+Ke*(Re+zo),Nr={x:so-sn/2,y:ba-Pe/2,w:sn,h:Pe};if(Nr.x<Go||Nr.y<Q||Nr.x+Nr.w>i-Go||Nr.y+Nr.h>s-Go)continue;let ul=[Nr.x+2,so,Nr.x+Nr.w-2],xN=[Nr.y+2,ba,Nr.y+Nr.h-2],jt=!0;for(let gn of ul)for(let pn of xN)if(!Jt(Qt(gn,pn))){jt=!1;break}if(!jt||Bt.some(gn=>Ea(Nr,gn))||pe.some(gn=>Ea(Nr,gn))||Fi.some(gn=>Wu(Nr,gn)))continue;let he=so-Oe*(sn/2),Ne=ba-Ke*(Pe/2),xe=Math.hypot(he-Et,Ne-Ft);if(xe>Xe||kt.some(gn=>JC(Et,Ft,he,Ne,gn[0],gn[1],gn[2],gn[3]))||Bt.some(gn=>w0(Et,Ft,he,Ne,gn)))continue;let rn=Ct(so,ba,Oe,Ke);(Ze===null||rn>Ze.clear+wt||rn>=Ze.clear-wt&&xe<Ze.len)&&(Ze={x:so,y:ba,rect:Nr,leader:[Et,Ft,he,Ne],len:xe,clear:rn})}return Ze?{x:Ze.x,y:Ze.y,rect:Ze.rect,leader:Ze.leader}:null};for(let{r:Et,c:Ft,boxW:Kt,boxH:ue,candidates:_e}of St){let ve=au(Et.value),Re=De=>!Bt.some(En=>Ea(De,En)),Xe=De=>!pe.some(En=>Ea(De,En)),sn=q.has(Et.id),Pe=(De,En,Tn)=>{let Ir=Fe(Tn,xr)/2;return Qt(De-Ir,En)===Et.fill&&Qt(De+Ir,En)===Et.fill};if(sn&&ve===void 0&&Et.label!==void 0){let De=_e[0],En=-1;for(let Tn=lu;Tn>=xr;Tn--){if(Fe(De,Tn)>Kt||Tn+2*ac>ue)continue;let Ir=ta(Ft[0],Ft[1],De,void 0,Tn);if(!Re(Ir)||!Xe(Ir)||Bi(Ir))continue;let zo=Fe(De,Tn)/2;if(!(Qt(Ft[0]-zo,Ft[1])!==Et.fill||Qt(Ft[0]+zo,Ft[1])!==Et.fill)){En=Tn;break}}if(En>=Hb){let Tn=ta(Ft[0],Ft[1],De,void 0,En);Bt.push(Tn),du(Ft[0],Ft[1],De,Et.fill,Et.lineNumber,void 0,En),mi.add(Et.id),hs.push({label:vr[vr.length-1],rect:Tn})}else{let Tn=Yt(Ft[0],Ft[1],Et.fill,Et.label,void 0,cu,$e+cu,ce*2.2);if(Tn){Bt.push(Tn.rect),kt.push(Tn.leader);let Ir=Ot(Et.fill,o.text,60);vr.push({x:Tn.x,y:Tn.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,fontSize:cu,leader:{x1:Tn.leader[0],y1:Tn.leader[1],x2:Tn.leader[2],y2:Tn.leader[3]},leaderColor:Ir,calloutDot:{x:Ft[0],y:Ft[1],color:Ir},lineNumber:Et.lineNumber}),mi.add(Et.id)}}continue}let qe=[{x:Ft[0],y:Ft[1],guard:!1}];ve&&qe.push({x:Ft[0],y:Ft[1]+ue*.26,guard:!0},{x:Ft[0],y:Ft[1]-ue*.26,guard:!0},{x:Ft[0]+Kt*.26,y:Ft[1],guard:!0},{x:Ft[0]-Kt*.26,y:Ft[1],guard:!0},{x:Ft[0]+Kt*.22,y:Ft[1]+ue*.22,guard:!0},{x:Ft[0]-Kt*.22,y:Ft[1]+ue*.22,guard:!0},{x:Ft[0]+Kt*.22,y:Ft[1]-ue*.22,guard:!0},{x:Ft[0]-Kt*.22,y:Ft[1]-ue*.22,guard:!0});let Ae;for(let De of qe)if(!(De.guard&&Qt(De.x,De.y)!==Et.fill)){for(let En of _e){let Tn=ta(De.x,De.y,En);if(ve&&ys(En,ve)<=Kt&&su(!0)<=ue){let Ir=ta(De.x,De.y,En,ve);if(Re(Ir)&&Xe(Tn)&&Pe(De.x,De.y,En)){Ae={text:En,valueLine:ve,ax:De.x,ay:De.y};break}}if(ya(En)<=Kt&&$o<=ue&&Re(Tn)&&Xe(Tn)&&(ve===void 0||Pe(De.x,De.y,En))){Ae={text:En,ax:De.x,ay:De.y};break}}if(Ae)break}if(Ae===void 0&&Et.label!==void 0&&sn){let De=Yt(Ft[0],Ft[1],Et.fill,Et.label,ve);if(De){Bt.push(De.rect),kt.push(De.leader);let En=Ot(Et.fill,o.text,60);vr.push({x:De.x,y:De.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,...ve!==void 0&&{valueLine:ve},leader:{x1:De.leader[0],y1:De.leader[1],x2:De.leader[2],y2:De.leader[3]},leaderColor:En,calloutDot:{x:Ft[0],y:Ft[1],color:En},lineNumber:Et.lineNumber}),mi.add(Et.id)}continue}if(Ae===void 0)continue;let Ze=Et.value===void 0&&Et.layer==="base",Oe=xr;if(Ze){let De=Fb(Kt,ue),En=Math.round(xr+De*(Ap-xr)),Tn=Ae.valueLine!==void 0,Ir=so=>{let ba=Fe(Ae.text,so)/2;return[Ae.ax-ba,Ae.ax+ba].every(Nr=>{let ul=Qt(Nr,Ae.ay);return ul===Et.fill||Jt(ul)})},zo=-1;for(let so=En;so>=xr;so--){if(ys(Ae.text,Ae.valueLine,so)>Kt||su(Tn,so)>ue)continue;let ba=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,so),Nr=ta(Ae.ax,Ae.ay,Ae.text,void 0,so);if(!(!Re(ba)||!Xe(Nr)||Bi(Nr))&&Ir(so)){zo=so;break}}if(zo<0){if(!mt.has(Et.id))continue;Oe=xr}else Oe=zo}let Ke=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,Oe);Bt.push(Ke),du(Ae.ax,Ae.ay,Ae.text,Et.fill,Et.lineNumber,Ae.valueLine,Oe,Ze?D:void 0),mi.add(Et.id),hs.push({label:vr[vr.length-1],rect:Ke})}for(let Et of yt){let Ft=oc?Et.iso.replace(/^US-/,""):Et.name,Kt=q.get(Et.iso),ue=au(Kt?.value);du(Et.x,Et.y,Ft,Kt?X(Kt):R,Et.lineNumber,ue),mi.add(Et.iso),hs.push({label:vr[vr.length-1],rect:ta(Et.x,Et.y,Ft,ue)})}}if(l.directives.noPoiLabels!==!0){let mt=[...Kn].filter(jt=>jt.clusterId===void 0).sort((jt,he)=>jt.lineNumber-he.lineNumber||(jt.id<he.id?-1:1)),St=new Map(l.pois.map(jt=>[jt.id,jt])),Bt=jt=>{let he=St.get(jt.id);return he?.label??he?.name??jt.id},kt=xr*1.25,Jt=jt=>{let he=Bt(jt);return{text:he,w:Fe(he,xr)}},re=3,pe=Math.max(20,Math.round(Math.min(i,s)*.03)),ce=new Map;for(let jt of Kn){if(jt.clusterId===void 0)continue;let he=ce.get(jt.clusterId);he?he.push(jt):ce.set(jt.clusterId,[jt])}let ke=(jt,he,Ne)=>{switch(Ne){case"right":return{x:jt.cx+jt.r+re,y:jt.cy-kt/2,w:he,h:kt};case"left":return{x:jt.cx-jt.r-re-he,y:jt.cy-kt/2,w:he,h:kt};case"above":return{x:jt.cx-he/2,y:jt.cy-jt.r-re-kt,w:he,h:kt};case"below":return{x:jt.cx-he/2,y:jt.cy+jt.r+re,w:he,h:kt};case"below-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy+xe,w:he,h:kt}}case"below-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-he,y:jt.cy+xe,w:he,h:kt}}case"above-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy-xe-kt,w:he,h:kt}}case"above-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-he,y:jt.cy-xe-kt,w:he,h:kt}}}},$e=(jt,he,Ne,xe,rn)=>{let on=ke(jt,Ne,xe);ha.push(on);let gn=xe==="right"||xe==="below-right"||xe==="above-right",pn=xe==="left"||xe==="below-left"||xe==="above-left",dn=gn?"start":pn?"end":"middle",Gn=gn?on.x:pn?on.x+Ne:jt.cx;vr.push({x:Gn,y:on.y+kt/2+xr/3,text:he,anchor:dn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,lineNumber:jt.lineNumber,...rn!==void 0&&{clusterMember:rn}})},ct=(jt,he,Ne)=>{let xe=ke(jt,he,Ne);return xe.x>=0&&xe.x+xe.w<=i&&xe.y>=0&&xe.y+xe.h<=s&&!Bi(xe)},ht=30,wt=[];for(let jt of mt){let he=wt.find(Ne=>Ne.some(xe=>Math.hypot(xe.cx-jt.cx,xe.cy-jt.cy)<ht));he?he.push(jt):wt.push([jt])}let Yt=kt+3,Et=16,Ft=jt=>jt.map(he=>({p:he,...Jt(he)})).sort((he,Ne)=>he.p.cy-Ne.p.cy||(he.text<Ne.text?-1:1)),Kt=(jt,he)=>{let Ne=Math.min(...jt.map(Gn=>Gn.p.cx-Gn.p.r)),xe=Math.max(...jt.map(Gn=>Gn.p.cx+Gn.p.r)),rn=Math.max(...jt.map(Gn=>Gn.w)),on=(Math.min(...jt.map(Gn=>Gn.p.cy))+Math.max(...jt.map(Gn=>Gn.p.cy)))/2,gn=he==="right"?Math.min(xe+Et,i-pe-rn):Math.max(Ne-Et,pe+rn),pn=jt.length*Yt,dn=on-pn/2;return dn=Math.max(pe,Math.min(dn,s-pn-pe)),jt.map((Gn,Ho)=>{let Uo=dn+Ho*Yt+Yt/2;return{o:Gn,colX:gn,rowCy:Uo,rect:{x:he==="right"?gn:gn-Gn.w,y:Uo-kt/2,w:Gn.w,h:kt}}})},ue=(jt,he)=>Kt(jt,he).every(({rect:Ne})=>Ne.x>=0&&Ne.x+Ne.w<=i&&Ne.y>=0&&Ne.y+Ne.h<=s&&!Bi(Ne)),_e=1e3,ve=jt=>{let he=[jt.x+jt.w*.15,jt.x+jt.w*.5,jt.x+jt.w*.85],Ne=[jt.y+jt.h*.25,jt.y+jt.h*.75],xe=0;for(let gn of he)for(let pn of Ne)Qt(gn,pn)===O&&xe++;let rn=xe/(he.length*Ne.length),on=Math.max(0,Math.min(jt.x,i-(jt.x+jt.w),jt.y,s-(jt.y+jt.h)));return _e*rn+on*.1},Re=(jt,he)=>{let Ne=Kt(jt,he);return Ne.length===0?-1/0:Ne.reduce((xe,{rect:rn})=>xe+ve(rn),0)/Ne.length},Xe=jt=>Re(jt,"right")>=Re(jt,"left")?"right":"left",sn=(jt,he,Ne)=>{for(let{o:xe,colX:rn,rowCy:on,rect:gn}of Kt(jt,he))ha.push(gn),vr.push({x:rn,y:on+xr/3,text:xe.text,anchor:he==="right"?"start":"end",color:o.text,halo:!1,haloColor:o.bg,leader:{x1:xe.p.cx,y1:xe.p.cy,x2:he==="right"?rn-2:rn+2,y2:on},leaderColor:xe.p.fill,poiId:xe.p.id,lineNumber:xe.p.lineNumber,...Ne!==void 0&&{clusterMember:Ne}})},Pe=jt=>{let{text:he,w:Ne}=Jt(jt),xe=jt.cx+jt.r+re,rn="start";xe+Ne>i&&(xe=jt.cx-jt.r-re-Ne,rn="end");let on=Math.max(0,Math.min(jt.cy-kt/2,s-kt));vr.push({x:rn==="start"?xe:xe+Ne,y:on+kt/2+xr/3,text:he,anchor:rn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,hidden:!0,lineNumber:jt.lineNumber})},qe=4,Ae=(jt,he,Ne)=>{let xe=jt.cx-he,rn=jt.cy-Ne;return Math.abs(rn)>=Math.abs(xe)?rn<=0?"above":"below":xe<0?"left":"right"},Ze=(jt,he)=>{let Ne=Dn.find(on=>on.id===he);if(!Ne||jt.length>qe)return!1;let xe=[],rn=[];for(let{p:on,text:gn,w:pn}of jt){let dn=Ae(on,Ne.cx,Ne.cy),Ho=[dn,...["above","below","right","left"].filter(Uo=>Uo!==dn)].find(Uo=>{let $r=ke(on,pn,Uo);return $r.x>=0&&$r.x+$r.w<=i&&$r.y>=0&&$r.y+$r.h<=s&&!Bi($r)&&!xe.some(lc=>Ea(lc,$r))});if(Ho===void 0)return!1;xe.push(ke(on,pn,Ho)),rn.push({p:on,text:gn,w:pn,side:Ho})}for(let{p:on,text:gn,w:pn,side:dn}of rn)$e(on,gn,pn,dn,he);return!0};for(let[jt,he]of ce){if(he.length===0)continue;let Ne=Ft(he);if(Ze(Ne,jt))continue;let xe=ue(Ne,"right"),rn=ue(Ne,"left"),on=xe&&rn?Xe(Ne):xe?"right":rn?"left":Xe(Ne);sn(Ne,on,jt)}let Oe=48,Ke=8,De=.25,En=(jt,he,Ne,xe,rn,on)=>{let gn=rn-Ne,pn=on-xe,dn=gn*gn+pn*pn,Gn=dn>0?((jt-Ne)*gn+(he-xe)*pn)/dn:0;return Gn=Math.max(0,Math.min(1,Gn)),Math.hypot(jt-(Ne+Gn*gn),he-(xe+Gn*pn))},Tn=(jt,he)=>{let Ne=jt.x+jt.w/2,xe=jt.y+jt.h/2,rn=Oe;for(let on of Kn)on.id!==he&&(rn=Math.min(rn,Math.hypot(on.cx-Ne,on.cy-xe)-on.r));for(let on of ou)rn=Math.min(rn,En(Ne,xe,on[0],on[1],on[2],on[3]));return Math.max(0,rn)},Ir={right:160,left:160,above:100,below:100,"below-right":0,"below-left":0,"above-right":0,"above-left":0},zo=Object.keys(Ir),so=(jt,he,Ne)=>{let xe=ke(jt,he,Ne);return Ke*Tn(xe,jt.id)+De*ve(xe)+Ir[Ne]},ba=wit*Math.min(i,s),Nr=[];for(let jt of wt){let he=Ft(jt);if(jt.length===1){let{p:pn,text:dn,w:Gn}=he[0],Ho=zo.filter($r=>ct(pn,Gn,$r)).map($r=>({s:$r,v:so(pn,Gn,$r)}));if(Ho.length===0){sn(he,Xe(he));continue}let Uo=Ho.reduce(($r,lc)=>lc.v>$r.v?lc:$r).s;$e(pn,dn,Gn,Uo);continue}let Ne=Math.min(...he.map(pn=>pn.p.cx-pn.p.r)),xe=Math.max(...he.map(pn=>pn.p.cx+pn.p.r)),rn=Math.min(...he.map(pn=>pn.p.cy)),on=Math.max(...he.map(pn=>pn.p.cy));Math.hypot(xe-Ne,on-rn)>ba||he.length>Eit?he.forEach(pn=>Pe(pn.p)):Nr.push(he)}for(let jt of Nr){let he=["right","left"].filter(xe=>ue(jt,xe)),Ne=he.length>1?Xe(jt):he[0];Ne?sn(jt,Ne):jt.forEach(xe=>Pe(xe.p))}let ul=r._poiClearancePass??0;if(ul<4&&Kn.length>0){let jt=pe,he=Math.floor(i*.3),Ne=Math.floor(s*.3),xe=new Map(Kn.map(dn=>[dn.id,dn])),rn=0,on=0,gn=0,pn=0;for(let dn of Kn)rn=Math.max(rn,jt-(dn.cx-dn.r)),on=Math.max(on,dn.cx+dn.r+jt-i),gn=Math.max(gn,jt-(dn.cy-dn.r)),pn=Math.max(pn,dn.cy+dn.r+jt-s);for(let dn of vr){if(dn.poiId===void 0)continue;let Gn=xe.get(dn.poiId);if(!Gn)continue;if(dn.hidden||dn.leader){let C4=dn.hidden?Jt(Gn).w:Fe(dn.text,xr),wN=Gn.r+Et+C4+jt;Gn.cx>=i/2?on=Math.max(on,Gn.cx+wN-i):rn=Math.max(rn,wN-Gn.cx);continue}let Ho=Fe(dn.text,xr),Uo=dn.anchor==="start"?dn.x:dn.anchor==="end"?dn.x-Ho:dn.x-Ho/2,$r=dn.y-xr/3-kt/2,lc=Uo+Ho,T4=$r+kt;rn=Math.max(rn,jt-Uo),on=Math.max(on,lc+jt-i),gn=Math.max(gn,jt-$r),pn=Math.max(pn,T4+jt-s)}if(rn=Math.min(Math.max(0,Math.ceil(rn)),he),on=Math.min(Math.max(0,Math.ceil(on)),he),gn=Math.min(Math.max(0,Math.ceil(gn)),Ne),pn=Math.min(Math.max(0,Math.ceil(pn)),Ne),rn>=1||on>=1||gn>=1||pn>=1){let dn=r._calloutReserve,Gn=Math.min((dn?.left??0)+rn,he),Ho=Math.min((dn?.right??0)+on,he),Uo=Math.min((dn?.top??0)+gn,Ne),$r=Math.min((dn?.bottom??0)+pn,Ne);return Wv(l,e,n,{...r,_poiClearancePass:ul+1,_calloutReserve:{...Gn>0&&{left:Gn},...Ho>0&&{right:Ho},...Uo>0&&{top:Uo},...$r>0&&{bottom:$r}}})}}}if(hs.length>0){let St=vr.filter(Bt=>Bt.poiId!==void 0&&Bt.hidden!==!0).map(Bt=>{let kt=Fe(Bt.text,xr);return{x:(Bt.anchor==="start"?Bt.x:Bt.anchor==="end"?Bt.x-kt:Bt.x-kt/2)-2,y:Bt.y-xr,w:kt+4,h:xr*1.4+4}});for(let Bt of hs)if(St.some(kt=>Ea(kt,Bt.rect))){let kt=vr.indexOf(Bt.label);kt>=0&&vr.splice(kt,1)}}if(Jn.some(mt=>mt.label!==void 0)){let mt=vr.filter(kt=>!kt.hidden).map(kt=>{let Jt=ya(kt.text);return{x:kt.anchor==="start"?kt.x:kt.anchor==="end"?kt.x-Jt:kt.x-Jt/2,y:kt.y-$o/2,w:Jt,h:$o}}),St=[],Bt=[.5,.42,.58,.34,.66,.28,.72];for(let kt=0;kt<Jn.length;kt++){let Jt=Jn[kt];if(Jt.label===void 0)continue;let re=kn.get(Jt.fromId),pe=kn.get(Jt.toId);if(!re||!pe)continue;let ce=ya(Jt.label),ke=pe.cx-re.cx,$e=pe.cy-re.cy,ct=Math.hypot(ke,$e)||1,ht=-$e/ct,wt=ke/ct,Ct=$o+2,Yt=Jt.width??tc,Et=Yt/2+$o/2+3,Ft=Yt>=4?[Et,-Et,Et+Ct,-(Et+Ct),0]:[0,Ct,-Ct,2*Ct,-2*Ct],Kt=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(Jt.d),ue=Ae=>{if(Kt?.[5]!==void 0){let Ze=1-Ae;return[Ze*Ze*+Kt[1]+2*Ze*Ae*+Kt[5]+Ae*Ae*+Kt[7],Ze*Ze*+Kt[2]+2*Ze*Ae*+Kt[6]+Ae*Ae*+Kt[8]]}return Kt?.[3]!==void 0?[+Kt[1]+(+Kt[3]-+Kt[1])*Ae,+Kt[2]+(+Kt[4]-+Kt[2])*Ae]:[re.cx+ke*Ae,re.cy+$e*Ae]},_e=[];for(let Ae of Ft)for(let Ze of Bt){let[Oe,Ke]=ue(Ze);_e.push([Oe+ht*Ae,Ke+wt*Ae-4])}let ve=([Ae,Ze])=>{let Oe={x:Ae-ce/2,y:Ze-$o/2,w:ce,h:$o};return!(Oe.x<0||Oe.x+ce>i||Oe.y<0||Oe.y+Oe.h>s||Fi.some(Ke=>Wu(Oe,Ke))||mt.some(Ke=>Ea(Ke,Oe))||St.some(Ke=>Ea(Ke,Oe)))},Re=ue(.5),[Xe,sn]=_e.find(ve)??[Re[0],Re[1]-4],Pe=Ut(Qt(Xe,sn));Jn[kt]={...Jt,labelX:Xe,labelY:sn,labelColor:Pe.color,labelHalo:Pe.halo,labelHaloColor:Pe.haloColor};let qe={x:Xe-ce/2,y:sn-$o/2,w:ce,h:$o};St.push(qe),ha.push(qe)}}if(l.directives.noContextLabels!==!0){for(let ct of vr){if(ct.hidden)continue;let ht=ya(ct.text),wt=ct.anchor==="start"?ct.x:ct.anchor==="end"?ct.x-ht:ct.x-ht/2;ha.push({x:wt,y:ct.y-$o/2,w:ht,h:$o})}for(let ct of dt)ha.push({x:ct.x,y:ct.y,w:ct.w,h:ct.h});let mt=[],St=[];for(let ct of f.values()){let ht=typeof ct.id=="string"?ct.id:String(ct.id??"");if(!ht||q.has(ht)||mi.has(ht)||h&&ht==="US")continue;let wt=!1;for(let ve of q.keys())if(ve.startsWith(ht+"-")){wt=!0;break}if(wt)continue;let Ct=At.bounds(ct),[Yt,Et]=Ct[0],[Ft,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Ft))continue;let ue=Dv[ht],_e=ue?rt(ue[0],ue[1]):At.centroid(ct);St.push({f:ct,iso:ht,name:ct.properties?.name??ht,bbox:[Yt,Et,Ft,Kt],anchor:_e&&Number.isFinite(_e[0])?[_e[0],_e[1]]:null,curatedLngLat:ue??null,area:(Ft-Yt)*(Kt-Et)})}let Bt=Av(Math.max(Mt,zt)),kt=Rv(i,s,Bt),Jt=Bt!=="world",re=kt+aB,pe=St.map((ct,ht)=>({idx:ht,area:ct.area})).filter(ct=>Number.isFinite(ct.area)&&ct.area>0).sort((ct,ht)=>ht.area-ct.area).slice(0,re),ce=new Set(pe.map(ct=>ct.idx));for(let ct=0;ct<St.length;ct++){let ht=St[ct],wt=ht.anchor,Ct;if(ce.has(ct)&&wt){let Yt=fs(ht.f),Et=Qit({geometry:ht.f.geometry,bounds:Yt,project:rt,width:i,height:s,curated:ht.curatedLngLat});Et.length&&(Ct=Et.map(Ft=>Ft.screen),wt=Ct[0])}mt.push({name:ht.name,bbox:ht.bbox,anchor:wt,curatedAnchor:!!ht.curatedLngLat,bordering:Jt,...Ct?{positions:Ct}:{}})}let ke=(l.poiFrameContainers??[]).some(ct=>ct.startsWith("US-"));if(p&&ke)for(let[ct,ht]of p){if(q.has(ct)||mi.has(ct))continue;let wt=$t(ht);if(!wt)continue;let Ct=At.bounds(wt),[Yt,Et]=Ct[0],[Ft,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Ft))continue;let ue=At.centroid(wt);mt.push({name:ht.properties?.name??ct,bbox:[Yt,Et,Ft,Kt],anchor:ue&&Number.isFinite(ue[0])?[ue[0],ue[1]]:null})}let $e=iB({projection:l.projection,dLonSpan:Mt,dLatSpan:zt,width:i,height:s,waterBodies:e.waterBodies,countries:mt,palette:o,countryTone:D,waterTone:W,project:rt,collides:Bi,overLand:(ct,ht)=>Qt(ct,ht)!==O});vr.push(...$e)}let dl=[];if(l.directives.noCities!==!0){let ce=Math.log10(5e4),ke=Math.log10(15e6)-ce,$e=wt=>wt>5e4?.7+Math.min(1,(Math.log10(wt)-ce)/ke)*(2.6-.7):.7,ct=Kn.map(wt=>({x:wt.cx,y:wt.cy})),ht=[...e.gazetteer.cities].sort((wt,Ct)=>Ct[3]-wt[3]);for(let wt of ht){if(dl.length>=220)break;let Ct=wt[0],Yt=wt[1],Et=rt(Yt,Ct);if(!Et)continue;let[Ft,Kt]=Et;if(Ft<0||Ft>i||Kt<0||Kt>s)continue;let ue=!1;for(let _e of ct){let ve=_e.x-Ft,Re=_e.y-Kt;if(ve*ve+Re*Re<144){ue=!0;break}}ue||(ct.push({x:Ft,y:Kt}),dl.push({cx:Ft,cy:Kt,r:$e(wt[3])}))}}return{width:i,height:s,background:O,title:tt,...l.subtitle!==void 0&&{subtitle:l.subtitle},...l.caption!==void 0&&{caption:l.caption},regions:ne,rivers:Je,relief:de,reliefHatch:te,coastlineStyle:ae,legs:Jn,pois:Kn,cityDots:dl,clusters:Dn,labels:vr,legend:et,insets:dt,insetRegions:ut,projection:c,stretch:pt,diagnostics:[]}}var Go,Iv,lB,yit,Pv,bit,lb,dB,uB,xit,tc,fB,xr,Dv,wit,Eit,pB,Sit,Lit,mB,gB,vit,Nit,Mit,kit,Tit,hB,Cit,_it,Ait,yB,Rit,Iit,Pit,bB,Dit,Git,Oit,$it,Hit,Wit,Fit,Bit,Yit,Vit,zit,Uit,Xit,jit,qit,xB,Jit,tst,est,rst,Ov,$v,ost,Hv,wB,cst,Fv=st(()=>{"use strict";je();ob();_L();tn();Sv();JF();wr();E0();Tr();f0();kv();sB();Go=24,Iv=1,lB=.6,yit=1.25;Pv=15,bit=6,lb=4,dB=22,uB=.92,xit=.55,tc=1.25,fB=8,xr=11,Dv={US:[-98.5,39.5],RU:[45,58]},wit=.18,Eit=7,pB=4.5,Sit=12,Lit=24,mB=60,gB=68,vit=24,Nit=24,Mit=1.3,kit=480,Tit=12,hB=2,Cit=1.5,_it=.2,Ait=26,yB=5,Rit=.0016,Iit=.0028,Pit=.0014,bB=.5,Dit=.1,Git=6e-4,Oit=6e-4,$it=32,Hit=30,Wit=62,Fit=28,Bit=16,Yit=9,Vit=2.399963229728653,zit=1,Uit=8,Xit=4,jit=16,qit=.18;xB=new WeakMap;Jit=()=>cp().parallels([29.5,45.5]).rotate([96,0]),tst=()=>cp().rotate([154,0]).center([-2,58.5]).parallels([55,65]),est=()=>tb();rst=new Set(["US-AK","US-HI"]),Ov=(t,e)=>e>=51&&(t<=-129||t>=172),$v=(t,e)=>e>=18&&e<=23&&t>=-161&&t<=-154,ost={CA:["US-AK","US-WA","US-ID","US-MT","US-ND","US-MN","US-MI","US-NY","US-VT","US-NH","US-ME"],MX:["US-CA","US-AZ","US-NM","US-TX"]},Hv=new Set(["US-AK","US-HI","US-AS","US-GU","US-MP","US-PR","US-VI"]);wB=new WeakMap,cst=8});var MB={};ye(MB,{renderMap:()=>NB,renderMapForExport:()=>mst});function ust(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let[i,s]=n[o],[l,c]=n[a];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function EB(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e+"Z"}function SB(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e}function fst(t,e){if(!e)return[EB(t)];let n=t.length,r=.75,o=p=>Math.abs(p)<=r,a=p=>Math.abs(p-e.w)<=r,i=p=>Math.abs(p)<=r,s=p=>Math.abs(p-e.h)<=r,l=(p,m)=>o(p[0])&&o(m[0])||a(p[0])&&a(m[0])||i(p[1])&&i(m[1])||s(p[1])&&s(m[1]),c=-1;for(let p=0;p<n;p++)if(l(t[p],t[(p+1)%n])){c=p;break}if(c===-1)return[EB(t)];let d=[],u=[],f=(c+1)%n;for(let p=0;p<n;p++){let m=(f+p)%n,g=t[m],h=t[(m+1)%n];if(l(g,h)){u.length>=2&&d.push(SB(u)),u=[];continue}u.length===0&&u.push(g),u.push(h)}return u.length>=2&&d.push(SB(u)),d}function LB(t,e,n){let r=[];for(let o of t){let a=o.rings??xp(o.d);for(let i=0;i<a.length;i++){let s=a[i];if(s.length<3)continue;let l=1/0,c=1/0,d=-1/0,u=-1/0;for(let[g,h]of s)g<l&&(l=g),g>d&&(d=g),h<c&&(c=h),h>u&&(u=h);if(Math.max(d-l,u-c)<e)continue;let[f,p]=s[0],m=0;for(let g=0;g<a.length;g++)g!==i&&ust(f,p,a[g])&&m++;m%2!==1&&r.push(...fst(s,n))}}return r}function vB(t,e,n,r,o,a){let i=r.join(" ");if(!i)return;e.append("path").attr("id",n).attr("d",i).attr("fill","none");let s=`#${n}`,l=[...o.lines].sort((c,d)=>d.d-c.d);for(let c of l)t.append("use").attr("href",s).attr("stroke",o.color).attr("stroke-width",2*(c.d+c.thickness)).attr("stroke-opacity",c.opacity).attr("stroke-linejoin","round").attr("stroke-linecap","round"),t.append("use").attr("href",s).attr("stroke",a).attr("stroke-width",2*c.d).attr("stroke-linejoin","round").attr("stroke-linecap","round")}function NB(t,e,n,r,o,a,i,s){It(t).selectAll(":not([data-d3-tooltip])").remove();let l=i?.width??t.clientWidth,c=i?.height??t.clientHeight;if(l<=0||c<=0)return;let d=Wv(e,n,{width:l,height:c},{palette:r,isDark:o,preferContain:i?.preferContain??!1,legendMode:i?"export":"preview",...s!==void 0&&{activeGroup:s}}),u=It(t).append("svg").attr("width",l).attr("height",c).attr("viewBox",`0 0 ${l} ${c}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt).style("background",d.background);u.append("rect").attr("width",l).attr("height",c).attr("fill",d.background);let f=u.append("defs"),p=pst++,m=w=>`${w}__m${p}`,g=w=>Math.min(15,7+w*.95),h=r.bg,S=u.append("g").attr("class","dgmo-map-regions"),y=(w,v,M)=>{let _=w.append("path").attr("d",v.d).attr("fill",v.fill).attr("stroke",v.stroke).attr("stroke-width",M);if(v.label&&_.attr("data-region-name",v.label),v.id&&v.id!=="lake"&&_.attr("data-iso",v.id),v.labelX!==void 0&&v.labelY!==void 0&&_.attr("data-label-x",v.labelX).attr("data-label-y",v.labelY),v.layer!=="base"&&(_.classed("dgmo-map-region",!0).attr("data-region",v.id),v.value!==void 0&&_.attr("data-value",v.value),v.tags))for(let[T,R]of Object.entries(v.tags))_.attr(`data-tag-${T.toLowerCase()}`,R.toLowerCase());v.lineNumber>=0&&(_.attr("data-line-number",v.lineNumber),a&&_.style("cursor","pointer").on("click",()=>a(v.lineNumber)))};for(let w of d.regions)y(S,w,.5);if(d.relief.length&&d.reliefHatch){let w=d.reliefHatch,v=m("dgmo-relief-clip"),M=m("dgmo-relief-land"),_=f.append("clipPath").attr("id",v);for(let O of d.relief)_.append("path").attr("d",O.d);let T=f.append("clipPath").attr("id",M);for(let O of d.regions)O.id!=="lake"&&T.append("path").attr("d",O.d);let R=u.append("g").attr("clip-path",`url(#${M})`).style("pointer-events","none").append("g").attr("class","dgmo-map-relief").attr("clip-path",`url(#${v})`).attr("stroke",w.color).attr("stroke-width",w.width).attr("vector-effect","non-scaling-stroke");for(let O=w.spacing;O<c;O+=w.spacing)R.append("line").attr("x1",0).attr("y1",O).attr("x2",l).attr("y2",O)}if(d.coastlineStyle){let w=d.coastlineStyle,v=m("dgmo-map-water-mask"),M=f.append("mask").attr("id",v).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c);M.append("rect").attr("x",0).attr("y",0).attr("width",l).attr("height",c).attr("fill","white");let _=d.regions.filter(I=>I.id!=="lake").map(I=>I.d).join(" "),T=d.regions.filter(I=>I.id==="lake").map(I=>I.d).join(" ");if(_&&M.append("path").attr("d",_).attr("fill","black"),T&&M.append("path").attr("d",T).attr("fill","white"),d.insets.length){let I=Math.max(0,...w.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";M.append("path").attr("d",G).attr("fill","black").attr("stroke","black").attr("stroke-width",2*I).attr("stroke-linejoin","round")}}let R=u.append("g").attr("class","dgmo-map-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${v})`);vB(R,f,m("dgmo-map-coast"),LB(d.regions,w.minExtent,{w:l,h:c}),w,d.background);let O=new Map;for(let I of d.regions){let H=O.get(I.stroke);H?H.push(I.d):O.set(I.stroke,[I.d])}for(let[I,H]of O)R.append("path").attr("d",H.join(" ")).attr("stroke",I).attr("stroke-width",.5).attr("stroke-linejoin","round")}if(d.rivers.length){let w=u.append("g").attr("class","dgmo-map-rivers").attr("fill","none").style("pointer-events","none");for(let v of d.rivers)w.append("path").attr("d",v.d).attr("stroke",v.color).attr("stroke-width",v.width).attr("stroke-linecap","round").attr("stroke-linejoin","round")}if(d.cityDots.length){let w=u.append("g").attr("class","dgmo-map-cities").attr("fill",r.textMuted).attr("fill-opacity",.28).style("pointer-events","none");for(let v of d.cityDots)w.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",v.r)}let b=!i&&!e.directives.noClusterPois,E=d.labels.filter(w=>w.poiId!==void 0&&!w.hidden);if(E.length){let w=m("dgmo-map-label-patch-blur");f.append("filter").attr("id",w).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%").append("feGaussianBlur").attr("in","SourceGraphic").attr("stdDeviation",2.5);let v=8,M=(_,T,R)=>{if(!_.length)return;let I=f.append("mask").attr("id",T).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c).append("g").attr("filter",`url(#${w})`),H=[];for(let D of _){let W=D.lines&&D.lines.length>1,V=W?Math.max(...D.lines.map(K=>_t(K,Fa))):_t(D.text,Fa),P=W?D.lines.length*(Fa+2):Fa,F=D.anchor==="start"?D.x+V/2:D.anchor==="end"?D.x-V/2:D.x,Y=D.y-Fa*.3,z=V+8,j=P+6;I.append("rect").attr("x",F-z/2).attr("y",Y-j/2).attr("width",z).attr("height",j).attr("rx",j/2).attr("fill","white"),H.push({x0:F-z/2-v,y0:Y-j/2-v,x1:F+z/2+v,y1:Y+j/2+v})}let G=u.append("g").attr("class","dgmo-map-label-patch").attr("mask",`url(#${T})`).style("pointer-events","none");R!==void 0&&G.attr("data-cluster-deco",R);for(let D of d.regions){let W,V,P,F;if(D.bbox)[W,V,P,F]=D.bbox;else{W=1/0,V=1/0,P=-1/0,F=-1/0;for(let z of xp(D.d))for(let[j,K]of z)j<W&&(W=j),j>P&&(P=j),K<V&&(V=K),K>F&&(F=K)}H.some(z=>W<=z.x1&&P>=z.x0&&V<=z.y1&&F>=z.y0)&&G.append("path").attr("d",D.d).attr("fill",D.fill)}};if(b){M(E.filter(R=>R.clusterMember===void 0),m("dgmo-map-label-patch"));let _=new Map;for(let R of E){if(R.clusterMember===void 0)continue;let O=_.get(R.clusterMember);O?O.push(R):_.set(R.clusterMember,[R])}let T=0;for(let[R,O]of _)M(O,m(`dgmo-map-label-patch-c${T++}`),R)}else M(E,m("dgmo-map-label-patch"))}if(d.insets.length){let w=u.append("g").attr("class","dgmo-map-insets");d.insets.forEach((v,M)=>{let _=v.points.map((T,R)=>`${R?"L":"M"}${T[0]},${T[1]}`).join("")+"Z";if(w.append("path").attr("d",_).attr("fill",d.background).attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round"),v.contextLand){let T=m(`dgmo-map-inset-clip-${M}`);f.append("clipPath").attr("id",T).append("path").attr("d",_),w.append("path").attr("d",v.contextLand.d).attr("fill",v.contextLand.fill).attr("clip-path",`url(#${T})`)}});for(let v of d.insetRegions)y(w,v,.5);if(d.coastlineStyle){let v=d.coastlineStyle,M=m("dgmo-map-inset-water-mask"),_=f.append("mask").attr("id",M).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c),T=Math.max(0,...v.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";_.append("path").attr("d",G).attr("fill","white").attr("stroke","black").attr("stroke-width",2*T).attr("stroke-linejoin","round")}d.insets.forEach((H,G)=>{H.contextLand&&_.append("path").attr("d",H.contextLand.d).attr("fill","black").attr("clip-path",`url(#${m(`dgmo-map-inset-clip-${G}`)})`)});for(let H of d.insetRegions)H.id!=="lake"&&_.append("path").attr("d",H.d).attr("fill","black");for(let H of d.insetRegions)H.id==="lake"&&_.append("path").attr("d",H.d).attr("fill","white");let R=m("dgmo-map-inset-water-clip"),O=f.append("clipPath").attr("id",R);for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";O.append("path").attr("d",G)}let I=w.append("g").attr("clip-path",`url(#${R})`).append("g").attr("class","dgmo-map-inset-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${M})`);vB(I,f,m("dgmo-map-inset-coast"),LB(d.insetRegions,v.minExtent),v,d.background);for(let H of d.insetRegions)I.append("path").attr("d",H.d).attr("stroke",H.stroke).attr("stroke-width",.5).attr("stroke-linejoin","round")}for(let v of d.insets){let M=v.points.map((_,T)=>`${T?"L":"M"}${_[0]},${_[1]}`).join("")+"Z";w.append("path").attr("d",M).attr("fill","none").attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round").style("pointer-events","none")}}let x=(w,v)=>{v<1||(w.attr("data-line-number",v),a&&w.style("cursor","pointer").on("click",()=>a(v)))},N=u.append("g").attr("class","dgmo-map-legs").attr("fill","none"),L=w=>{let v=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(w);if(!v)return null;let M=+v[1],_=+v[2],T,R,O,I;v[3]!==void 0?(T=+v[3],R=+v[4],O=M,I=_):(T=+v[7],R=+v[8],O=+v[5],I=+v[6]);let H=T-O,G=R-I,D=Math.hypot(H,G);return D>0?{ex:T,ey:R,tx:H/D,ty:G/D}:null};d.legs.forEach(w=>{let v=w.arrow?L(w.d):null,M=w.d,_=null;if(v){let R=g(w.width),O=Math.max(R*.5,w.width*.6+1),I=v.ex-v.tx*R,H=v.ey-v.ty*R,G=-v.ty,D=v.tx;_=`M${I+G*O},${H+D*O}L${v.ex},${v.ey}L${I-G*O},${H-D*O}z`,M=w.d.replace(/(-?[\d.]+),(-?[\d.]+)$/,`${I.toFixed(2)},${H.toFixed(2)}`)}let T=N.append("path").attr("d",M).attr("stroke",w.color).attr("stroke-width",w.width).attr("stroke-linecap","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[R,O]of Object.entries(w.tags))T.attr(`data-tag-${R.toLowerCase()}`,O.toLowerCase());if(x(T,w.lineNumber),w.value!==void 0&&(T.attr("data-value",w.value),T.append("title").text(w.label!==void 0?`${w.label}: ${w.value}`:`${w.value}`)),_){let R=N.append("path").attr("d",_).attr("fill",w.color).attr("stroke",w.color).attr("stroke-width",1).attr("stroke-linejoin","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[O,I]of Object.entries(w.tags))R.attr(`data-tag-${O.toLowerCase()}`,I.toLowerCase())}if(w.label!==void 0&&w.labelX!==void 0){let R=wp(N,w.labelX,w.labelY??0,w.label,"middle",w.labelColor??r.textMuted,w.labelHaloColor??h,w.labelHalo??!0,Fa-1);x(R,w.lineNumber)}});let A=u.append("g").attr("class","dgmo-map-spider");for(let w of d.clusters){b&&A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.hitR).attr("fill","transparent").attr("data-cluster-hit",w.id).style("cursor","pointer");for(let v of w.legs)A.append("line").attr("x1",w.cx).attr("y1",w.cy).attr("x2",v.x2).attr("y2",v.y2).attr("stroke",v.color).attr("stroke-width",1).attr("data-cluster-deco",w.id).style("pointer-events","none");A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",2).attr("fill",Ot(r.textMuted,r.bg,40)).attr("data-cluster-deco",w.id).style("pointer-events","none")}let C=u.append("g").attr("class","dgmo-map-pois");for(let w of d.pois){w.isOrigin&&C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r+3).attr("fill","none").attr("stroke",w.stroke).attr("stroke-width",1.5);let v=C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r).attr("fill",w.fill).attr("fill-opacity",w.fillOpacity).attr("stroke",w.stroke).attr("stroke-width",1).attr("data-line-number",w.lineNumber).attr("data-poi",w.id);if(w.clusterId!==void 0&&v.attr("data-cluster-member",w.clusterId),w.tags)for(let[M,_]of Object.entries(w.tags))v.attr(`data-tag-${M.toLowerCase()}`,_.toLowerCase());a&&v.style("cursor","pointer").on("click",()=>a(w.lineNumber)),w.routeNumber!==void 0&&wp(C,w.cx,w.cy+3,String(w.routeNumber),"middle",r.bg,w.fill,!1,Fa-2)}let k=u.append("g").attr("class","dgmo-map-labels");for(let w of d.labels){if(w.hidden){if(i)continue;wp(k,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing).attr("data-poi",w.poiId??null).attr("data-poi-hidden","").style("opacity",0).style("pointer-events","none");continue}if(w.leader){let M=k.append("line").attr("x1",w.leader.x1).attr("y1",w.leader.y1).attr("x2",w.leader.x2).attr("y2",w.leader.y2).attr("stroke",w.leaderColor??Ot(r.textMuted,r.bg,60)).attr("stroke-width",w.leaderColor?1:.75);w.poiId!==void 0&&M.attr("data-poi",w.poiId),w.clusterMember!==void 0&&M.attr("data-cluster-member",w.clusterMember),x(M,w.lineNumber)}w.calloutDot&&k.append("circle").attr("cx",w.calloutDot.x).attr("cy",w.calloutDot.y).attr("r",2.5).attr("fill",w.calloutDot.color).attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",.75);let v=wp(k,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing,w.lines,w.valueLine);w.poiId!==void 0&&v.attr("data-poi",w.poiId).style("cursor","default"),w.clusterMember!==void 0&&v.attr("data-cluster-member",w.clusterMember),x(v,w.lineNumber)}if(b&&d.clusters.length){let w=u.append("g").attr("class","dgmo-map-cluster-badges");for(let v of d.clusters){let M=w.append("g").attr("data-cluster",v.id).style("opacity",0).style("pointer-events","none"),_=9;M.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",_).attr("fill",Ot(r.textMuted,r.bg,35)).attr("stroke",r.textMuted).attr("stroke-width",1),M.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",_+2.5).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1);let T=_+2.5;for(let R of v.legs){let O=Math.atan2(R.y2-v.cy,R.x2-v.cx);M.append("circle").attr("class","dgmo-map-cluster-bead").attr("cx",v.cx+T*Math.cos(O)).attr("cy",v.cy+T*Math.sin(O)).attr("r",1.8).attr("fill",R.color).attr("stroke",r.bg).attr("stroke-width",.5)}wp(M,v.cx,v.cy+3,String(v.count),"middle",r.text,r.bg,!1,Fa)}}if(d.legend){let w=(d.title?50:0)+(d.subtitle?20:0)+8,v=u.append("g").attr("class","dgmo-map-legend").attr("transform",`translate(0, ${w})`),M=ib(d.legend);if(M.length>0){let _=sb(M,i?"export":"preview");mn(v,{..._,palette:r,isDark:o,width:l,activeGroup:d.legend.activeGroup})}}d.title&&u.append("text").attr("class","dgmo-map-title").attr("x",l/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.title),d.subtitle&&u.append("text").attr("class","dgmo-map-subtitle").attr("x",l/2).attr("y",50).attr("text-anchor","middle").attr("font-size",Fa+1).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.subtitle),d.caption&&u.append("text").attr("x",l/2).attr("y",c-8).attr("text-anchor","middle").attr("font-size",Fa).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.caption)}function mst(t,e,n,r,o,a){NB(t,e,n,r,o,void 0,a)}function wp(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=t.append("text").attr("x",e).attr("y",n).attr("text-anchor",o).attr("font-size",l).attr("fill",a);if(u&&u.length>1){let m=l+2,g=-((u.length-1)/2)*m;u.forEach((h,S)=>{p.append("tspan").attr("x",e).attr("dy",S===0?g:m).text(h)})}else if(f!==void 0){let m=Math.round(l*.82);p.append("tspan").attr("x",e).attr("dy",-l*.28).text(r),p.append("tspan").attr("x",e).attr("dy",l*.92).attr("font-size",m).attr("fill-opacity",.72).text(f)}else p.text(r);return c&&p.attr("font-style","italic"),d&&p.attr("letter-spacing",d),s&&p.attr("paint-order","stroke fill").attr("stroke",i).attr("stroke-width",2).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-opacity",.55),p}var Fa,pst,kB=st(()=>{"use strict";qn();an();tn();en();Br();kv();Fv();Fa=11;pst=0});var AB={};ye(AB,{mapContentAspect:()=>_B,mapExportDimensions:()=>Est});function _B(t,e,n=wst){let{projection:r,fitTarget:o}=bp(t,e);r.fitSize([n,n],o);let a=Wa(r).bounds(o),i=a[1][0]-a[0][0],s=a[1][1]-a[0][1],l=i/s;return Number.isFinite(l)&&l>0?l:xst}function Est(t,e,n=1200,r){let o=r!==void 0&&Number.isFinite(r)&&r>0,a=o?r:_B(t,e),s=!o&&bp(t,e).fitIsGlobal?a/bst:a,l=o?a:Math.max(yst,Math.min(hst,s)),c=n,d=Math.round(c/l),u=0;if(t.title&&t.pois.length>0){let m=(t.subtitle?50:30)+20/2;u+=Math.max(TB,m+gst)-TB}let f=!1;return d-u<CB&&(d=Math.round(u+CB),f=!0),{width:c,height:d,preferContain:o?f:l!==s||f}}var TB,gst,hst,yst,bst,CB,xst,wst,RB=st(()=>{"use strict";ob();Fv();TB=24,gst=16,hst=3,yst=.9,bst=1.12,CB=200,xst=1.5,wst=1e3});var Vv={};ye(Vv,{loadMapData:()=>Yv});async function Sst(){let[{readFile:t},{fileURLToPath:e},{dirname:n,resolve:r}]=await Promise.all([import("fs/promises"),import("url"),import("path")]);return{readFile:t,fileURLToPath:e,dirname:n,resolve:r}}async function li(t,e,n){return JSON.parse(await t.readFile(t.resolve(e,n),"utf8"))}async function Lst(t,e){for(let n of IB){let r=t.resolve(e,n);try{return await t.readFile(t.resolve(r,Ba.gazetteer),"utf8"),r}catch{}}throw new Error(`map data assets not found near ${e} (looked in ${IB.join(", ")}). Run \`pnpm build:map-data\` and \`pnpm build\`.`)}function vst(t){let e=n=>!!n&&n.type==="Topology"&&!!n.objects;if(!e(t.worldCoarse)||!e(t.worldDetail)||!e(t.usStates)||!t.gazetteer||!Array.isArray(t.gazetteer.cities)||!t.gazetteer.byName)throw new Error("map data assets are malformed (failed shape validation)");return t}function Nst(t){try{let e=Mst.url;if(e)return t.dirname(t.fileURLToPath(e))}catch{}return typeof __dirname<"u"?__dirname:process.cwd()}function Yv(){return Bv??=(async()=>{let t=await Sst(),e=await Lst(t,Nst(t)),[n,r,o,a,i,s,l,c,d,u,f]=await Promise.all([li(t,e,Ba.worldCoarse),li(t,e,Ba.worldDetail),li(t,e,Ba.usStates),li(t,e,Ba.lakes).catch(()=>{}),li(t,e,Ba.rivers).catch(()=>{}),li(t,e,Ba.mountainRanges).catch(()=>{}),li(t,e,Ba.naLand).catch(()=>{}),li(t,e,Ba.naLakes).catch(()=>{}),li(t,e,Ba.waterBodies).catch(()=>{}),li(t,e,Ba.airports).catch(()=>{}),li(t,e,Ba.gazetteer)]);return vst({worldCoarse:n,worldDetail:r,usStates:o,gazetteer:f,...a&&{lakes:a},...i&&{rivers:i},...s&&{mountainRanges:s},...l&&{naLand:l},...c&&{naLakes:c},...d&&{waterBodies:d},...u&&{airports:u}})})().catch(t=>{throw Bv=void 0,t}),Bv}var Mst,Ba,IB,Bv,cb=st(()=>{"use strict";Mst={};Ba={worldCoarse:"world-coarse.json",worldDetail:"world-detail.json",usStates:"us-states.json",lakes:"lakes.json",rivers:"rivers.json",mountainRanges:"mountain-ranges.json",naLand:"na-land.json",naLakes:"na-lakes.json",waterBodies:"water-bodies.json",airports:"airports.json",gazetteer:"gazetteer.json"},IB=["./data","./map-data","../map-data","../src/map/data"]});var FB={};ye(FB,{renderPyramid:()=>WB,renderPyramidForExport:()=>Gst});function WB(t,e,n,r,o,a){if(e.layers.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(kst),p=c.aesthetic(zv),m=e.layers.some(T=>T.description.length>0),g=!!e.title&&e.options["no-title"]!=="on",h=g?f:0,S=h+p,y=s-p,b=Math.max(60,y-S),E=i*Tst,x=i-E*2,N=e.layers.length,L=GB({width:i,usableWidth:x,sideMargin:E,bodyTop:S,bodyHeight:b,layers:e.layers,hasDescription:m,alternate:!1}),C=L.wraps.some(T=>T.overflows)&&m&&N>=2,k=C?GB({width:i,usableWidth:x,sideMargin:E,bodyTop:S,bodyHeight:b,layers:e.layers,hasDescription:!0,alternate:!0}):L,w=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c.isBelowFloor&&w.attr("width","100%"),w.append("style").text(".pyramid-desc-full{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-short{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-full{display:inline}.dgmo-pyramid-hidden{display:none}"),w.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),g){let T=w.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&T.on("click",()=>o(e.titleLineNumber))}let v=lr(n),M=(T,R)=>{if(T.color){let O=On(T.color,n);if(O)return O}return v[R%v.length]},_=w.append("g").attr("class","pyramid-body");for(let T=0;T<N;T++){let R=e.layers[T],O=k.pyramidTop+T*k.layerH,I=O+k.layerH,H=OB(T,N,k.baseWidth,e.inverted),G=OB(T+1,N,k.baseWidth,e.inverted),D=[[k.pyramidCx-H,O],[k.pyramidCx+H,O],[k.pyramidCx+G,I],[k.pyramidCx-G,I]].map($=>`${$[0]},${$[1]}`).join(" "),W=M(R,T),V=ie(n,W,r,{solid:e.options["solid-fill"]==="on"}),P=_.append("g").attr("class","pyramid-layer").attr("data-line-number",R.lineNumber);if(o){let $=R.lineNumber;P.style("cursor","pointer").on("click",()=>o($))}P.append("polygon").attr("points",D).attr("fill",V).attr("stroke",W).attr("stroke-width",2);let F=(O+I)/2,Y=Le(V,n.textOnFillLight,n.textOnFillDark),z=Math.min(H,G)*2>_t(R.label,k.labelFont),j=Y===n.textOnFillLight?n.textOnFillDark:n.textOnFillLight,K=P.append("text").attr("x",k.pyramidCx).attr("y",F).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",Y).attr("font-family",Pt).attr("font-size",k.labelFont).attr("font-weight",600);if(z||K.attr("paint-order","stroke fill").attr("stroke",j).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.6),bn(K,R.label,n),R.description.length>0){let $=C?T%2===0?"right":"left":"right",U=k.wraps[T];Ost(_,R,$,U,k,F,W,n,h+zv,s-zv,o)}}}function Gst(t,e,n,r,o){WB(t,e,n,r,void 0,o)}function GB(t){let{width:e,usableWidth:n,sideMargin:r,bodyTop:o,bodyHeight:a,layers:i,hasDescription:s,alternate:l}=t,c=i.length,u=n*(s?l?Ast:_st:Cst),f=a/PB,p=Math.min(u,f),m=p*PB,g;s?l?g=e/2:g=r+u/2:g=e/2;let h=o+(a-m)/2,S=m/c,y=$B(Math.round(S*.38),Rst,Ist),b=$B(Math.round(S*.22),Pst,Dst),E=Math.round(b*1.35),x=g+p/2,N=g-p/2,L=x+DB,A=L+db+ub,C=Math.max(80,e-r-A),k=N-DB-db,w=Math.max(80,k-ub-r),v=r,M=i.map((_,T)=>{if(_.description.length===0)return{allLines:[],overflows:!1,shortLineCount:0};let O=(l?T%2===0?"right":"left":"right")==="right"?C:w,I=Wst(_.description,O,b),H=Math.max(1,Math.floor(S/E)-0),G=I.length>H,D=G?H:I.length;return{allLines:I,overflows:G,shortLineCount:D}});return{alternate:l,baseWidth:p,pyramidCx:g,pyramidTop:h,pyramidH:m,layerH:S,labelFont:y,descFont:b,descLineHeight:E,rightTextX:A,rightTextWidth:C,leftTextX:v,leftTextWidth:w,rightAccentX:L,leftAccentX:k,wraps:M}}function OB(t,e,n,r){return(!r?t/e:(e-t)/e)*n/2}function Ost(t,e,n,r,o,a,i,s,l,c,d){let{descFont:u,descLineHeight:f}=o,p=n==="right"?o.rightAccentX:o.leftAccentX,m=n==="right"?o.rightTextX:o.leftTextX,g=n==="right"?"start":"end",h=n==="right"?m:o.leftAccentX-ub,S=o.leftAccentX-ub,y=L=>{if(n==="right")return o.rightTextX;let A=0;for(let C of L)(C.kind==="bullet-first"||C.kind==="bullet-cont")&&(A=Math.max(A,_t(C.text,u)));return S-A-HB},b=c-l,E=Math.max(1,Math.floor(b/f)),x=$st(r.allLines,E);if(!r.overflows){Uv({parentG:t,layer:e,lines:r.allLines,className:"pyramid-desc",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(r.allLines),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"});return}let N=Hst(r);Uv({parentG:t,layer:e,lines:N,className:"pyramid-desc pyramid-desc-short",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(N),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"}),Uv({parentG:t,layer:e,lines:x,className:"pyramid-desc pyramid-desc-full",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(x),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"full"})}function $st(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function Hst(t){if(!t.overflows)return t.allLines.slice();let e=t.allLines.slice(0,t.shortLineCount);if(e.length===0)return[];let n=e[e.length-1];return e[e.length-1]={...n,text:n.text.endsWith("\u2026")?n.text:`${n.text} \u2026`},e}function Uv(t){let{parentG:e,layer:n,lines:r,className:o,accentX:a,accentColor:i,textX:s,textAnchor:l,bulletColLeftX:c,midY:d,descFont:u,descLineHeight:f,palette:p,topBound:m,bottomBound:g,onClickItem:h,variant:S}=t;if(r.length===0)return;let y=r.length*f,b=d-y/2+f/2,E=Math.max(4,Math.round(u*.3)),x=b-f/2-E,N=b+(r.length-1)*f+f/2+E,L=0;x<m?L=m-x:N>g&&(L=g-N),b+=L;let A=b-f/2-E,C=y+E*2,k=e.append("g").attr("class",o).attr("data-line-number",n.lineNumber).attr("data-variant",S);if(h){let w=n.lineNumber;k.style("cursor","pointer").on("click",()=>h(w))}k.append("rect").attr("x",a).attr("y",A).attr("width",db).attr("height",C).attr("rx",db/2).attr("fill",i);for(let w=0;w<r.length;w++){let v=r[w],M=b+w*f,_=v.kind==="bullet-first"||v.kind==="bullet-cont";v.kind==="bullet-first"&&k.append("text").attr("x",c).attr("y",M).attr("dy","0.35em").attr("text-anchor","start").attr("fill",p.text).attr("font-family",Pt).attr("font-size",u).attr("font-weight",w===0?500:400).text("\u2022");let T=k.append("text").attr("x",_?c+HB:s).attr("y",M).attr("dy","0.35em").attr("text-anchor",_?"start":l).attr("fill",p.text).attr("font-family",Pt).attr("font-size",u).attr("font-weight",w===0?500:400);bn(T,v.text,p)}}function Wst(t,e,n){let r=n*Bo,o=Math.max(8,Math.floor(e/r)),a=t.map(s=>s.startsWith("- ")?"\u2022 "+s.slice(2):s),i=[];for(let s of a){if(s===""){i.push({text:"",kind:"plain"});continue}i.push(...Ko([s],o))}return i}function $B(t,e,n){return Math.max(e,Math.min(n,t))}var kst,Tst,zv,Cst,_st,Ast,PB,DB,db,ub,HB,Rst,Ist,Pst,Dst,BB=st(()=>{"use strict";qn();an();tn();wr();Ro();en();Ds();mr();kst=50,Tst=.03,zv=16,Cst=.78,_st=.58,Ast=.42,PB=.85,DB=28,db=3,ub=12,HB=10,Rst=12,Ist=22,Pst=11,Dst=15});var KB={};ye(KB,{renderRing:()=>qB,renderRingForExport:()=>Zst});function qB(t,e,n,r,o,a){if(e.layers.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Fst),p=c.aesthetic(Yst),m=e.layers.length,g=e.layers.some(U=>U.description.length>0),h=!!e.title&&e.options["no-title"]!=="on",y=(h?f:0)+p,b=s-p,E=Math.max(60,b-y),x=i*Bst,N=i-x*2,L=g?zst:Vst,A=N*L,w=Math.min(A,E)/2,v=w/m,M=y+E/2,_=g?x+N*L/2:i/2,T=_+w+Ust,R=T+Xv+Xst,O=Math.max(80,i-x-R),I=Math.round(v*.45),H=I>=UB,G=jB(I,UB,qst),D=g?jB(Math.round(O/30),XB,Kst):XB,W=Math.round(D*1.35),V=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c.isBelowFloor&&V.attr("width","100%"),V.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),h){let U=V.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&U.on("click",()=>o(e.titleLineNumber))}let P=lr(n),F=(U,X)=>{if(U.color){let q=On(U.color,n);if(q)return q}return P[X%P.length]},Y=e.options["solid-fill"]==="on",z=e.layers.map((U,X)=>F(U,X)),j=z.map(U=>ie(n,U,r,{solid:Y})),K=V.append("g").attr("class","ring-body"),$=n.text;for(let U=0;U<m;U++){let X=e.layers[U],q=(U+1)*v,et=U*v,tt=j[U],B=K.append("g").attr("class","ring-layer").attr("data-line-number",X.lineNumber);if(o){let Q=X.lineNumber;B.style("cursor","pointer").on("click",()=>o(Q))}if(U===0)B.append("circle").attr("cx",_).attr("cy",M).attr("r",q).attr("fill",tt).attr("stroke",$).attr("stroke-width",YB).attr("stroke-opacity",VB);else{let Q=`M ${_-q} ${M} A ${q} ${q} 0 1 0 ${_+q} ${M} A ${q} ${q} 0 1 0 ${_-q} ${M} M ${_-et} ${M} A ${et} ${et} 0 1 0 ${_+et} ${M} A ${et} ${et} 0 1 0 ${_-et} ${M} Z`;B.append("path").attr("d",Q).attr("fill-rule","evenodd").attr("fill",tt).attr("stroke",$).attr("stroke-width",YB).attr("stroke-opacity",VB)}}if(H){let U=V.append("g").attr("class","ring-labels");for(let X=0;X<m;X++){let q=e.layers[X],et=j[X],B=X===0?M:M-(X+.5)*v,Q=G,ot=Le(et,n.textOnFillLight,n.textOnFillDark),lt=U.append("g").attr("class","ring-label-group").attr("data-line-number",q.lineNumber).append("text").attr("class","ring-label").attr("x",_).attr("y",B).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",ot).attr("font-family",Pt).attr("font-size",Q).attr("font-weight",600).style("pointer-events","none");bn(lt,q.label,n,Q)}}(g||!H)&&Qst({parentG:V.append("g").attr("class","ring-descriptions"),layers:e.layers,colors:z,accentX:T,textX:R,textWidth:O,topY:y,bottomY:b,descFont:D,descLineHeight:W,palette:n,...o!==void 0&&{onClickItem:o}})}function Zst(t,e,n,r,o){qB(t,e,n,r,void 0,o)}function Qst(t){let{parentG:e,layers:n,colors:r,accentX:o,textX:a,textWidth:i,topY:s,bottomY:l,descFont:c,descLineHeight:d,palette:u,onClickItem:f}=t,p=Math.max(8,Math.floor(i/(c*Bo))),m=Math.round(c*1.3),g=Math.max(8,Math.round(c*.6)),h=l-s,S=L=>{let A=n.map(w=>Jst(Ko(w.description.slice(),p),L)),C=A.map(w=>m+w.length*d),k=C.reduce((w,v)=>w+v,0)+g*Math.max(0,n.length-1);return{wraps:A,blockHeights:C,totalH:k}},y=S(zB);for(let L=zB-1;L>=0&&y.totalH>h;L--)y=S(L);let{wraps:b,blockHeights:E,totalH:x}=y,N=s+Math.max(0,(h-x)/2);for(let L=0;L<n.length;L++){let A=n[L],C=b[L],k=E[L],w=e.append("g").attr("class","ring-desc").attr("data-line-number",A.lineNumber);if(f){let _=A.lineNumber;w.style("cursor","pointer").on("click",()=>f(_))}w.append("rect").attr("x",o).attr("y",N).attr("width",Xv).attr("height",k).attr("rx",Xv/2).attr("fill",r[L]);let v=w.append("text").attr("x",a).attr("y",N+Math.round(m*.7)).attr("text-anchor","start").attr("fill",u.text).attr("font-family",Pt).attr("font-size",c).attr("font-weight",600);bn(v,A.label,u,c);let M=N+m+Math.round(d*.4);for(let _ of C){let T=_.kind==="bullet-first"||_.kind==="bullet-cont";_.kind==="bullet-first"&&w.append("text").attr("x",a).attr("y",M).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",Pt).attr("font-size",c).text("\u2022");let R=w.append("text").attr("x",T?a+jst:a).attr("y",M).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",Pt).attr("font-size",c);bn(R,_.text,u,c),M+=d}N+=k+g}}function Jst(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function jB(t,e,n){return Math.max(e,Math.min(n,t))}var Fst,Bst,Yst,Vst,zst,Ust,Xv,Xst,jst,YB,VB,zB,UB,qst,XB,Kst,ZB=st(()=>{"use strict";qn();an();tn();wr();Ro();en();Ds();mr();Fst=50,Bst=.03,Yst=16,Vst=.78,zst=.58,Ust=28,Xv=3,Xst=12,jst=10,YB=1,VB=.4,zB=4,UB=12,qst=22,XB=11,Kst=15});function JB(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>JB(e))}}function tlt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function QB(t,e){let n=t*.32,r=t/(Math.max(1,e)+1);return Math.min(n,r)}function t3(t,e){let n=e.maxDepth??1/0,r=Math.max(1,e.radius),o={label:"__root",children:t.map(m=>JB(m))},a=Ci(o).sum(m=>m.children?.length?0:m.value??0),i=a.value??0;if(i<=0)return{cells:[],total:0,discRadius:e.discRadius??QB(r,1),maxDepthReached:0,isEmpty:!0};let s=EE().size([2*Math.PI,1])(a),l=s.height,c=Math.min(r-1,e.discRadius??QB(r,l)),u=Math.max(1,r-c)/Math.max(1,l);(s.children??[]).forEach((m,g)=>{m.each(h=>{h._topIndex=g})});let f=[],p=0;for(let m of s.descendants()){if(m.depth===0||m.depth>n)continue;let g=!!m.children&&m.children.length>0;m.depth>p&&(p=m.depth);let h=[],S=m;for(;S&&S.depth>0;)h.unshift(S.data.label),S=S.parent;let y=c+(m.depth-1)*u,b=c+m.depth*u,E=tlt(m);f.push({node:m.data.ref??null,label:m.data.label,startAngle:m.x0,endAngle:m.x1,innerR:y,outerR:b,depth:m.depth,value:m.value??0,isContainer:g,isCollapsed:!1,topIndex:m._topIndex??0,pctOfRoot:i>0?(m.value??0)/i:0,pctOfParent:m.parent&&(m.parent.value??0)>0?(m.value??0)/(m.parent.value??1):1,...E!==void 0&&{heat:E},path:h,...m.data.lineNumber!==void 0&&{lineNumber:m.data.lineNumber}})}return{cells:f,total:i,discRadius:c,maxDepthReached:p,isEmpty:!1}}var e3=st(()=>{"use strict";Ug()});function elt(t,e,n){if(e<=1)return t;let r=Math.max(55,100-(e-1)*18);return Ot(t,n,r)}function pb(t,e){let n=e??t.defaultColorMode;return n==="tag"&&t.tagGroups.length===0&&(n=t.hasHeat?"heat":"branch"),n==="heat"&&!t.hasHeat&&(n="branch"),n}function mb(t,e){if(e.mode==="heat")return t.heat!==void 0&&e.heat?e.heat.scale(t.heat):jv;if(e.mode==="tag")return t.node?sr(t.node.metadata,e.tagGroups,e.activeGroup)??jv:jv;let n=t.path[0]??t.label,r=(e.rootIndexByLabel.get(n)??t.topIndex)+e.colorOffset,o=e.seriesColors[r%e.seriesColors.length];return elt(o,t.depth,e.bg)}function gb(t,e){if(!t.hasHeat)return null;let n=[],r=f=>{for(let p of f)typeof p.heat=="number"&&n.push(p.heat),r(p.children)};if(r(t.roots),n.length===0)return null;let o=Math.min(...n),a=Math.max(...n),i=o<0&&a>0,s=e.surface,l=t.options.heatColors.map(f=>On(f,e)??f).filter(f=>!!f),c,d;if(l.length>=2){c=[l[0],s,l[1]];let f=i?0:(o+a)/2;d=[o,f,a]}else l.length===1?(c=[s,l[0]],d=[o,a]):i?(c=[e.colors.red,s,e.colors.green],d=[o,0,a]):(c=[s,e.primary],d=[o,a]);if(d[0]===d[d.length-1]){let f=c[c.length-1];return{scale:()=>f,min:o,max:a,stops:c,signed:i}}let u=ir().domain(d).range(c).clamp(!0);return{scale:f=>nlt(u(f)),min:o,max:a,stops:c,signed:i}}function nlt(t){if(t.startsWith("#"))return t;let e=t.match(/rgba?\(([^)]+)\)/);if(!e)return t;let n=e[1].split(",").map(o=>Math.round(parseFloat(o))),r=o=>Math.max(0,Math.min(255,o||0)).toString(16).padStart(2,"0");return`#${r(n[0]??0)}${r(n[1]??0)}${r(n[2]??0)}`}function tu(t){let e=Math.abs(t);return e>=1e9?fb(t/1e9)+"B":e>=1e6?fb(t/1e6)+"M":e>=1e3?fb(t/1e3)+"k":fb(Math.round(t*100)/100)}function fb(t){return parseFloat(t.toFixed(t<10&&!Number.isInteger(t)?1:0)).toString()}function Ep(t){let e=t*100;return e>=10?`${Math.round(e)}%`:e>=1?`${e.toFixed(0)}%`:`${e.toFixed(1)}%`}function hb(t,e,n,r,o){let a=[],i=new Map,s=null;if(e.tagGroups.length>0){let l=e.tagGroups[0],c=new Set,d=u=>{for(let f of u){let p=f.metadata[qt(l.name)];p&&c.add(p.toLowerCase()),d(f.children)}};d(e.roots),a.push({name:l.name,entries:l.entries.filter(u=>c.has(u.value.toLowerCase())).map(u=>({value:u.value,color:u.color}))}),i.set(l.name,"tag"),t==="tag"&&(s=l.name)}if(n){let l=e.options.heatLabel??"Value";a.push({name:l,entries:[],gradient:{min:n.min,max:n.max,low:n.stops[0],high:n.stops[n.stops.length-1]}}),i.set(l,"heat"),t==="heat"&&(s=l)}return a.push({name:"Branch",entries:e.roots.map((l,c)=>({value:l.label,color:r[(c+o)%r.length]}))}),i.set("Branch","branch"),(t==="branch"||s===null)&&(s="Branch"),{groups:a,activeGroup:s,modeByName:i}}var jv,qv=st(()=>{"use strict";Xa();wr();tn();je();jv="#cbd5e1"});var o3={};ye(o3,{renderTreemapRadial:()=>r3,renderTreemapRadialForExport:()=>alt});function alt(t,e,n,r,o,a){r3(t,e,n,r,o,{exportMode:!0,...a})}function r3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=a.exportMode??!1,u=lr(n),f=gb(e,n),p=c.noLegend?null:hb(l,e,f,u,a.colorOffset??0),g=(p?Cr({groups:p.groups,position:n3,mode:"preview"},i)+Bn:0)+yb,h=Math.max(1,i-yb*2),S=Math.max(1,s-g-yb),y=Math.max(1,Math.min(h,S)/2-yb),b=i/2,E=g+S/2,x=t3(e.roots,{radius:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),N=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap dgmo-treemap-radial").style("font-family",Pt),L=N.append("defs");N.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg);let A=N.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${E})`),C=e.tagGroups.length>0?e.tagGroups[0].name:null,k=new Map(e.roots.map((_,T)=>[_.label,T])),w={mode:l,heat:f,tagGroups:e.tagGroups,activeGroup:C,rootIndexByLabel:k,seriesColors:u,colorOffset:a.colorOffset??0,bg:n.bg},v=Nl().startAngle(_=>_.startAngle).endAngle(_=>_.endAngle).innerRadius(_=>_.innerR).outerRadius(_=>_.outerR).padAngle(.004).padRadius(y),M=0;if(!x.isEmpty)for(let _ of x.cells){let T=mb(_,w),R=A.append("g").attr("class","dgmo-treemap-cell").attr("data-node-path",_.path.join(" / "));if(_.lineNumber!==void 0&&R.attr("data-line-number",_.lineNumber),_.heat!==void 0&&R.attr("data-heat",_.heat),_.node&&C){let O=qt(C),I=_.node.metadata[O];I&&R.attr(`data-tag-${O}`,I)}R.append("path").attr("class",_.isContainer?"dgmo-treemap-arc branch":"dgmo-treemap-arc").attr("d",v(_)??"").attr("fill",T).attr("stroke",n.bg).attr("stroke-width",1),slt(R,L,`dgmo-arc-lbl-${M++}`,_,c,n,T)}if(ilt(A,e,x.discRadius,x.total,x.isEmpty,n),p){let _=N.append("g").attr("class","dgmo-treemap-legend").attr("transform","translate(0, 0)");mn(_,{groups:p.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:d?"export":"preview",position:n3,activeGroup:p.activeGroup,showInactivePills:!d,showEmptyGroups:!d})}}function ilt(t,e,n,r,o,a){let i=t.append("g").attr("class","dgmo-treemap-disc");i.append("circle").attr("r",n).attr("fill",a.surface).attr("stroke",a.bg).attr("stroke-width",1);let s=Le(a.surface,a.textOnFillLight,a.textOnFillDark),l=n*1.7;if(o){i.append("text").attr("class","dgmo-treemap-empty").attr("text-anchor","middle").attr("y",4).attr("fill",s).attr("font-size",bb(13,n)).text(xb("No values to chart",l,13));return}let c=e.title??"",d=tu(r),u=bb(15,n),f=bb(22,n);if(c){let p=i.append("text").attr("class","dgmo-treemap-disc-title").attr("text-anchor","middle").attr("y",-4).attr("fill",s).attr("font-size",u).attr("font-weight",600).text(xb(c,l,u));e.titleLineNumber!==null&&p.attr("data-line-number",e.titleLineNumber)}i.append("text").attr("class","dgmo-treemap-disc-total").attr("text-anchor","middle").attr("y",c?u:8).attr("fill",s).attr("font-size",f).attr("font-weight",700).text(xb(d,l,f))}function slt(t,e,n,r,o,a,i){let s=r.endAngle-r.startAngle;if(s<rlt)return;let l=r.outerR-r.innerR;if(l<10)return;let c=Le(i,a.textOnFillLight,a.textOnFillDark),d=(r.innerR+r.outerR)/2,u=bb(13,l),p=[o.noValues?"":tu(r.value),o.noPercent?"":Ep(r.pctOfRoot)].filter(Boolean).join(" \xB7 "),m=p?`${r.label} ${p}`:r.label,g=s*d*.94,h=u,S=_t(m,u);S>g&&(h=Math.max(olt,Math.floor(u*g/S)));let y=xb(m,g,h);y&&llt(t,e,n,r,d,h,y,c)}function llt(t,e,n,r,o,a,i,s){let l=(r.startAngle+r.endAngle)/2,c=l>Math.PI/2&&l<3*Math.PI/2,d=c?o+a*.32:o-a*.32,[u,f]=c?[r.endAngle,r.startAngle]:[r.startAngle,r.endAngle],p=Math.sin(u)*d,m=-Math.cos(u)*d,g=Math.sin(f)*d,h=-Math.cos(f)*d,S=c?0:1,y=`M ${p.toFixed(2)} ${m.toFixed(2)} A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 ${S} ${g.toFixed(2)} ${h.toFixed(2)}`;e.append("path").attr("id",n).attr("d",y),t.append("text").attr("class","dgmo-treemap-label").attr("font-size",a).attr("font-weight",600).attr("fill",s).append("textPath").attr("href",`#${n}`).attr("startOffset","50%").attr("text-anchor","middle").text(i)}function bb(t,e){return Math.max(8,Math.min(t,Math.round(e*.9)))}function xb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var yb,n3,rlt,olt,a3=st(()=>{"use strict";qn();So();an();tn();je();en();Br();_o();Tr();e3();qv();yb=12,n3={placement:"top-center",titleRelation:"below-title"},rlt=6*Math.PI/180,olt=8});function i3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>i3(e))}}function clt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function s3(t,e){let n=e.maxDepth??1/0,r={label:"__root",children:t.map(l=>i3(l))},o=Ci(r).sum(l=>l.children?.length?0:l.value??0).sort((l,c)=>(c.value??0)-(l.value??0)),a=ME().tile(gf).size([e.width,e.height]).paddingOuter(e.paddingOuter??3).paddingTop(e.headerH>0?e.headerH:e.paddingInner??2).paddingInner(e.paddingInner??2).round(!0)(o),i=a.value??0;(a.children??[]).forEach((l,c)=>{l.each(d=>{d._topIndex=c})});let s=[];for(let l of a.descendants()){if(l.depth===0||l.depth>n)continue;let c=!!l.children&&l.children.length>0,d=c&&l.depth>=n,u=c&&!d,f=[],p=l;for(;p&&p.depth>0;)f.unshift(p.data.label),p=p.parent;let m=clt(l);s.push({node:l.data.ref??null,label:l.data.label,x0:l.x0,y0:l.y0,x1:l.x1,y1:l.y1,depth:l.depth,value:l.value??0,isContainer:u,isCollapsed:d,topIndex:l._topIndex??0,pctOfRoot:i>0?(l.value??0)/i:0,pctOfParent:l.parent&&(l.parent.value??0)>0?(l.value??0)/(l.parent.value??1):1,...m!==void 0&&{heat:m},path:f,...l.data.lineNumber!==void 0&&{lineNumber:l.data.lineNumber}})}return{cells:s,total:i}}var l3=st(()=>{"use strict";Ug()});var f3={};ye(f3,{renderTreemap:()=>u3,renderTreemapForExport:()=>plt});function plt(t,e,n,r,o,a){u3(t,e,n,r,o,{exportMode:!0,...a})}function u3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=c.solidFill,u=a.exportMode??!1,f=lr(n),p=!!e.title,m=p?ult:0,g=gb(e,n),h=c.noLegend?null:hb(l,e,g,f,a.colorOffset??0),S=h?Cr({groups:h.groups,position:c3,mode:"preview"},i)+Bn:0,y=c.noHeaders?0:dlt,b=wb,E=m+S+wb,x=Math.max(1,i-wb*2),N=Math.max(1,s-E-wb),L=s3(e.roots,{width:x,height:N,headerH:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),A=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap").style("font-family",Pt);if(A.append("style").text(".dgmo-treemap-focus{opacity:.3;transition:opacity .12s}.dgmo-treemap-cell:hover .dgmo-treemap-focus{opacity:.7}"),A.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),p){let T=A.append("text").attr("class","chart-title").attr("x",i/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&T.attr("data-line-number",e.titleLineNumber)}let C=A.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${E})`),k=f,w=a.colorOffset??0,v=e.tagGroups.length>0?e.tagGroups[0].name:null,M=new Map(e.roots.map((T,R)=>[T.label,R])),_={mode:l,heat:g,tagGroups:e.tagGroups,activeGroup:v,rootIndexByLabel:M,seriesColors:k,colorOffset:w,bg:n.bg};for(let T of L.cells){let R=Math.max(0,T.x1-T.x0),O=Math.max(0,T.y1-T.y0);if(R<=0||O<=0)continue;let I=mb(T,_),H=T.isContainer||d?I:Ot(I,n.bg,flt),G=T.isContainer||T.isCollapsed,D=C.append("g").attr("class","dgmo-treemap-cell").attr("transform",`translate(${T.x0},${T.y0})`).attr("data-node-path",T.path.join(" / "));if(T.lineNumber!==void 0&&D.attr("data-line-number",T.lineNumber),T.heat!==void 0&&D.attr("data-heat",T.heat),T.node&&v){let Y=qt(v),z=T.node.metadata[Y];z&&D.attr(`data-tag-${Y}`,z)}let W=D.append("rect").attr("class",T.isContainer?"dgmo-treemap-rect branch":"dgmo-treemap-rect").attr("width",R).attr("height",O).attr("rx",2).attr("fill",H).attr("fill-opacity",1).attr("stroke",n.bg).attr("stroke-width",T.isContainer?1:0);if(G&&a.onClickItem&&T.lineNumber!==void 0){let Y=T.lineNumber;W.style("cursor","pointer").on("click",()=>a.onClickItem(Y))}let V=Le(H,n.textOnFillLight,n.textOnFillDark);if(T.isContainer&&y>0&&R>34&&O>y){let Y=[];c.noValues||Y.push(tu(T.value)),c.noPercent||Y.push(Ep(T.pctOfRoot));let z=Y.join(" \xB7 "),j=G?16:4,K=z.length>0&&R>110,$=K?_t(z,10.5):0,U=R-8-j-(K?$+10:0);D.append("text").attr("class","dgmo-treemap-header").attr("x",6).attr("y",13).attr("font-size",11).attr("font-weight",700).attr("fill",V).text(Sb(T.label,Math.max(0,U),11)),K&&D.append("text").attr("class","dgmo-treemap-header-value").attr("x",R-j-4).attr("y",13).attr("text-anchor","end").attr("font-size",10.5).attr("fill",V).attr("opacity",.75).text(z)}let P=Math.max(4,Math.min(14,Math.floor(Math.min(R,O)/5))),F=7;if(!T.isContainer&&R>=2*P+8&&O>=2*P+8){let Y=R-2*P;if(_t(T.label,F)*1.06>Y&&O>R*1.25&&O-2*P>Y){mlt(D,T.label,R,O,P,V),G&&R>30&&O>22&&d3(D,R,V,9);continue}let j=Lp(Math.round(Math.min(R/3.6,O/3.4)),F,72),K=_t(T.label,j)*1.06;K>Y&&(j=Math.max(F,Math.floor(j*Y/K)));let U=.95-Lp((j-F)/(72-F),0,1)*.5,X=Lp(Math.round(j*.42),11,28),q=Math.max(.45,U-.1),et=P+Math.round(j*.78);D.append("text").attr("class","dgmo-treemap-label").attr("x",P).attr("y",et).attr("font-size",j).attr("font-weight",600).attr("fill",V).attr("opacity",U).text(Sb(T.label,Y,j));let tt=[c.noValues?"":tu(T.value),c.noPercent?"":Ep(T.pctOfRoot)].filter(Boolean),B=tt.join(" \xB7 "),Q=et,ot=(Z,lt,nt,J)=>{D.append("text").attr("class","dgmo-treemap-value").attr("x",P).attr("y",lt).attr("font-size",nt).attr("fill",V).attr("opacity",J).text(Z)};if(B){let Z=_t(B,X)<=Y,lt=et+Eb(j,X),nt=lt+Sp(X)<=O-P;if(Z&&nt)ot(B,lt,X,q);else if(Z){let J=Lp(Math.round(j*.5),11,Math.max(11,X)),at=Sb(T.label,Y,j),it=_t(at,j)*1.12,Lt=Math.max(12,Math.round(j*.25));P+it+Lt+_t(B,J)<=R-P&&D.append("text").attr("class","dgmo-treemap-value").attr("x",P+it+Lt).attr("y",Q).attr("font-size",J).attr("fill",V).attr("opacity",q).text(B)}else if(tt.length===2){let J=Eb(j,X);et+J+Sp(X)<=O-P&&(et+=J,ot(tt[0],et,X,q));let at=Math.max(10,Math.round(X*.9)),it=Eb(X,at);et+it+Sp(at)<=O-P&&(et+=it,ot(tt[1],et,at,q))}else{let J=et+Eb(j,X);J+Sp(X)<=O-P&&ot(B,J,X,q)}}}G&&R>30&&O>22&&d3(D,R,V,9)}if(h){let T=A.append("g").attr("class","dgmo-treemap-legend").attr("transform",`translate(0, ${m})`);mn(T,{groups:h.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:u?"export":"preview",position:c3,activeGroup:h.activeGroup,showInactivePills:!u,showEmptyGroups:!u,...a.onSelectMode!==void 0&&{callbacks:{onGroupToggle:R=>{let O=h.modeByName.get(R);O&&a.onSelectMode(O)}}}})}}function d3(t,e,n,r){let a=e-4.5-5,i=t.append("g").attr("class","dgmo-treemap-focus").attr("data-export-ignore","true");i.append("rect").attr("x",a-9).attr("y",r-9).attr("width",18).attr("height",18).attr("fill","transparent"),i.append("circle").attr("cx",a).attr("cy",r).attr("r",4.5).attr("fill","none").attr("stroke",n).attr("stroke-width",1.25),i.append("circle").attr("cx",a).attr("cy",r).attr("r",1.4).attr("fill",n)}function mlt(t,e,n,r,o,a){let s=r-2*o,l=n-2*o,c=Lp(Math.round(Math.min(l/.8,14)),6,22),d=_t(e,c)*1.06;d>s&&(c=Math.max(6,Math.floor(c*s/d)));let u=Sb(e,s,c);u&&t.append("text").attr("class","dgmo-treemap-label").attr("transform",`translate(${n/2},${r/2}) rotate(-90)`).attr("y",Math.round(c*.28)).attr("text-anchor","middle").attr("font-size",c).attr("font-weight",600).attr("fill",a).attr("opacity",.95).text(u)}function Sp(t){return Math.ceil(t*.26)}function Eb(t,e,n=4){return Sp(t)+n+Math.round(e*.72)}function Lp(t,e,n){return Math.max(e,Math.min(n,t))}function Sb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var wb,dlt,ult,flt,c3,p3=st(()=>{"use strict";qn();an();tn();je();en();Br();_o();Tr();l3();qv();wb=12,dlt=18,ult=36,flt=50,c3={placement:"top-center",titleRelation:"below-title"}});function g3(t,e={}){let n=e.collapsed??new Set,r=y3(t,0,0,null,n);return{width:r.w,height:r.h,items:r.items}}function Zv(t){return Math.max(1,...t.rows.map(e=>e.reduce((n,r)=>n+(r.span||1),0)))}function ylt(t){return Math.max(Jv,Math.min(glt,_t(t.label,hlt)+2*vp+14))}function h3(t){let e=Jv;for(let n of t.rows)for(let r of n){if(!Ja(r))continue;let o=r.grid?blt(r.grid)+2*vp:ylt(r);e=Math.max(e,o/(r.span||1))}return e}function blt(t){let e=t.cols??Zv(t);return e*h3(t)+(e+1)*vo}function y3(t,e,n,r,o){let a=t.cols??Zv(t),i=r??h3(t),s=a*i+(a+1)*vo,l=n+vo,c=[],d=e+vo;for(let f of t.rows){let p=e+vo,m=Kv,g=[];for(let h of f){let S=h.span||1,y=S*i+(S-1)*vo;if(!Ja(h)){g.push({type:"empty",x:p,y:l,w:y,h:Kv}),p+=y+vo,d=Math.max(d,p-vo);continue}if(h.grid&&o.has(h.id)){let b={type:"collapsed",x:p,y:l,w:y,h:m3,label:h.label,node:h,lineNumber:h.lineNumber};g.push(b),m=Math.max(m,m3),p+=y+vo,d=Math.max(d,p-vo);continue}if(h.grid){let b=h.grid.cols??Zv(h.grid),E=Math.max(Jv*.66,(y-2*vp-(b+1)*vo)/b),x=y3(h.grid,p+vp,l+Lb,E,o),N=Lb+x.h+vp;g.push({type:"container",x:p,y:l,w:y,h:N,label:h.label,node:h,lineNumber:h.lineNumber,inner:x.items}),m=Math.max(m,N),p+=y+vo,d=Math.max(d,p-vo);continue}g.push({type:"leaf",x:p,y:l,w:y,h:Kv,label:h.label,node:h,lineNumber:h.lineNumber}),p+=y+vo,d=Math.max(d,p-vo)}c.push(...g),l+=m+vo}let u=Math.max(s,d-e+vo);return{x:e,y:n,w:u,h:l-n,items:c}}var vo,vp,Kv,Lb,m3,Qv,Jv,glt,hlt,b3=st(()=>{"use strict";en();kg();vo=12,vp=10,Kv=46,Lb=28,m3=46,Qv=6,Jv=104,glt=250,hlt=13});var v3={};ye(v3,{authoredCollapsedIds:()=>L3,renderBlock:()=>E3,renderBlockForExport:()=>Elt});function Elt(t,e,n,r,o,a){E3(t,e,n,r,o,{exportMode:!0,...a})}function E3(t,e,n,r,o,a={}){if(e.error||e.top.rows.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.options,s=!!e.title,l=s?xlt:0,c=a.collapsed??L3(e),d=g3(e.top,{collapsed:c}),u=i.noLegend?null:Nlt(e),f,p;a.exportMode?f=Math.max(d.width,wlt)+eu*2:f=o?.width??t.clientWidth;let m=u?Cr({groups:u.groups,position:x3,mode:"preview"},f)+Bn:0,g=l+m+eu;if(a.exportMode?p=g+d.height+eu:p=o?.height??t.clientHeight,f<=0||p<=0)return;let h=eu,S=Math.max(1,f-eu*2),y=Math.max(1,p-g-eu),b=Math.min(1,S/d.width,y/d.height),E=h+(S-d.width*b)/2,x=g,N=It(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-block").style("font-family",Pt);if(N.append("rect").attr("width",f).attr("height",p).attr("fill",n.bg),s){let k=N.append("text").attr("class","chart-title").attr("x",f/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&k.attr("data-line-number",e.titleLineNumber)}let L=e.tagGroups.length>0?e.tagGroups[0].name:null,A=Ot(n.text,n.bg,22),C=N.append("g").attr("class","dgmo-block-cells").attr("transform",`translate(${E},${x}) scale(${b})`);if(S3(C,d.items,{palette:n,tagGroups:e.tagGroups,activeGroup:L,activeKey:L?qt(L):null,neutral:A,solidFill:i.solidFill,onToggle:a.onToggle}),u){let k=N.append("g").attr("class","dgmo-block-legend").attr("transform",`translate(0, ${l})`);mn(k,{groups:u.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:f,mode:a.exportMode?"export":"preview",position:x3,activeGroup:u.activeGroup})}}function Slt(t,e){return!t||!e.activeGroup?null:sr(t.metadata,e.tagGroups,e.activeGroup)??null}function tN(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}function S3(t,e,n,r=[]){let{palette:o,solidFill:a}=n;for(let i of e){if(i.type==="empty"){t.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",7).attr("fill","none").attr("stroke",n.neutral).attr("stroke-width",1).attr("stroke-dasharray","3 4").attr("opacity",.7);continue}let s=i.node,l=[...r,s.id],c=Slt(s,n),d=c??n.neutral,u=t.append("g").attr("class","dgmo-block-cell").attr("data-block-id",s.id).attr("data-block-path",l.join(" / "));if(i.lineNumber!==void 0&&u.attr("data-line-number",i.lineNumber),n.activeKey){let p=s.metadata[n.activeKey];p&&u.attr(`data-tag-${n.activeKey}`,p)}if(i.type==="collapsed"){let p=c?a?c:Ot(c,o.bg,12):o.surface,m=`dgmo-block-clip-${Llt++}`;u.append("clipPath").attr("id",m).append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+4).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",700).attr("fill",o.text).text(tN(i.label??"",i.w-24,12.5)),u.append("rect").attr("x",i.x).attr("y",i.y+i.h-Qv).attr("width",i.w).attr("height",Qv).attr("fill",a&&c?o.text:d).attr("clip-path",`url(#${m})`),w3(u,i,n,i.h);continue}if(i.type==="container"){let p=c?a?c:Ot(c,o.bg,7):o.surface;u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5);let m=Math.min(i.w,i.h*2.5),g=Math.max(13,Math.min(20,Math.round(13+(m-220)/70))),S=.92-(g-13)/7*.3,y=i.y+Math.round(g*.7)+7;u.append("text").attr("x",i.x+i.w/2).attr("y",y).attr("text-anchor","middle").attr("font-size",g).attr("font-weight",700).attr("fill",o.text).attr("opacity",S).text(tN(i.label??"",i.w-24,g)),w3(u,i,n,Lb),i.inner&&S3(t,i.inner,n,l);continue}let f=c?a?c:Ot(c,o.bg,14):o.bg;u.attr("data-leaf","true"),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",8).attr("fill",f).attr("stroke",d).attr("stroke-width",1.25),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+5).attr("text-anchor","middle").attr("font-size",13).attr("font-weight",600).attr("fill",o.text).text(tN(i.label??"",i.w-16,13))}}function w3(t,e,n,r){if(!n.onToggle||!e.node||e.lineNumber===void 0)return;let o=e.node.id,a=e.lineNumber;t.append("rect").attr("x",e.x).attr("y",e.y).attr("width",e.w).attr("height",r).attr("rx",10).attr("fill","transparent").style("cursor","pointer").on("click",()=>n.onToggle(o,a))}function L3(t){let e=new Set;return vlt(t,e),e}function vlt(t,e){let n=r=>{for(let o of r.rows)for(let a of o)Ja(a)&&(a.collapsed&&a.grid&&e.add(a.id),a.grid&&n(a.grid))};n(t.top)}function Nlt(t){if(t.tagGroups.length===0)return null;let e=t.tagGroups[0],n=qt(e.name),r=new Set,o=i=>{for(let s of i.rows)for(let l of s)if(Ja(l)){let c=l.metadata[n];c&&r.add(c.toLowerCase()),l.grid&&o(l.grid)}};o(t.top);let a=e.entries.filter(i=>r.has(i.value.toLowerCase())).map(i=>({value:i.value,color:i.color}));return a.length===0?null:{groups:[{name:e.name,entries:a}],activeGroup:e.name}}var eu,xlt,wlt,x3,Llt,N3=st(()=>{"use strict";qn();an();tn();je();Br();_o();Tr();en();kg();b3();eu=12,xlt=36,wlt=220,x3={placement:"top-center",titleRelation:"below-title"};Llt=0});var $3={};ye($3,{MARKER_LABELS:()=>Nb,renderRaci:()=>G3,renderRaciForExport:()=>Jlt});function Mlt(t){let e=new Map;if(t.diagnostics.length===0)return e;let n=[];for(let r of t.tasksWithoutPhase)n.push(r);for(let r of t.phases)for(let o of r.tasks)n.push(o);for(let r of t.diagnostics){if(r.line<=0)continue;let o=n.find(s=>r.line>=s.lineNumber&&r.line<=s.endLineNumber);if(!o)continue;let a=e.get(o.id);a?r.line<a.firstLine&&(a.firstLine=r.line):(a={errors:[],warnings:[],firstLine:r.line},e.set(o.id,a));let i={line:r.line,message:r.message};r.severity==="error"?a.errors.push(i):a.warnings.push(i)}return e}function klt(t){let e=t.match(/^Task '[^']*'\s+(.+)$/);if(e){let n=e[1];return n.charAt(0).toUpperCase()+n.slice(1)}return t.replace(/\s+on task '[^']*'/,"")}function Tlt(t,e,n,r,o){let a=Math.min(o,n/2,r/2);return`M ${t} ${e+a} A ${a} ${a} 0 0 1 ${t+a} ${e} H ${t+n-a} A ${a} ${a} 0 0 1 ${t+n} ${e+a} V ${e+r} H ${t} Z`}function _3(t,e){let n=new Map(e.map((r,o)=>[r,o]));return[...t].sort((r,o)=>(n.get(r)??99)-(n.get(o)??99))}function eN(t,e){return e.colors[C3[t%C3.length]]}function oN(t,e){switch(t){case"R":return e.colors.green;case"A":return e.colors.red;case"S":return e.colors.teal;case"C":return e.colors.yellow;case"I":return e.colors.gray;case"D":return e.colors.purple}}function G3(t,e,n,r,o,a){let i=typeof o=="function"?{onClickLine:o}:o??{},s=i.onClickLine,l=i.onMarkerDragStart,c=i.hideLegend??!1,d=i.collapsedPhases??new Set,u=(i.hideTitle??!1)||e.options["no-title"]==="on";It(t).selectAll(":not([data-d3-tooltip])").remove();let f=a?.width??t.clientWidth,p=a?.height??t.clientHeight;if(f<=0||p<=0)return;let m=[...es(e)];if(m.length===0&&e.phases.length===0)return;let g=e.options["solid-fill"]==="on",h=or(n,r),S=Math.max(1,e.roles.length),y=S*T3+k3+2*M3,b=a?Ee.identity():Ee.from(f,y),E=b.text(20),x=b.structural(30),N=b.aesthetic(M3),L=b.aesthetic(_lt),A=b.structural(Clt),C=b.structural($lt),k=b.structural(A3),w=b.structural(Hlt),v=b.structural(Wlt),M=b.structural(k3),_=b.structural(Flt),T=b.structural(T3),R=b.structural(Blt),O=b.text(D3),I=b.text(jlt),H=b.text(qlt),G=b.text(Ult),D=b.text(P3),W=b.structural(Ylt),V=b.structural(Vlt),P=b.structural(zlt),F=b.structural(Alt),Y=b.structural(Rlt),z=b.structural(Ilt),j=b.structural(Plt),K=b.aesthetic(Dlt),$=b.text(Glt),U=b.text(Olt),X=b.structural(R3),q=b.structural(I3),et=b.structural(1.5),tt=b.structural(Klt),B=Math.max(0,f-2*N),Q=Math.max(_,Math.min(T,Math.floor((B-v)/S))),ot=B-Q*S;ot>M&&(ot=M,Q=Math.max(_,Math.floor((B-ot)/S))),ot<v&&(ot=v);let Z=Mlt(e),lt=[];for(let te of e.tasksWithoutPhase)lt.push({kind:"task",task:te});for(let te of e.phases){let ae=d.has(te.id);if(lt.push({kind:"phase",phase:te,collapsed:ae}),!ae)for(let Te of te.tasks)lt.push({kind:"task",task:Te})}let J=!u||!c?A:L,at=(A-F)/2,it=J+L,Tt=it+C,At=[],rt=ot-16,pt=new Map;for(let te of lt)if(te.kind==="task"){let ae=Z.get(te.task.id);pt.set(te.task.id,O3(te.task,ae,rt,O,D,k,q,X))}for(let te of lt)if(At.push(Tt),te.kind==="phase")Tt+=w;else{let ae=pt.get(te.task.id);Tt+=ae?.rowHeight??k}let gt=Tt+P,dt=gt+L,ut=a?dt:Math.max(p,dt),yt=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",f).attr("height",ut).attr("viewBox",`0 0 ${f} ${ut}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",Pt).style("background","transparent");b.isBelowFloor&&yt.attr("width","100%");let vt=Nb[e.variant],Gt=Object.keys(vt).filter(te=>vt[te]!==void 0),Xt=Gt.length,bt=Y*Math.max(0,Xt-1),Mt=Gt.reduce((te,ae)=>Math.max(te,_t(vt[ae]??"",$)),0),zt=Math.max(z,Math.ceil(36+Mt+8)),xt=Xt*zt+bt,Nt=Xt*j+bt,Dt=e.title&&!u?_t(e.title,E):0,Vt="full",$t=xt,ft=zt;c?$t=0:B-Dt-K<xt&&(Vt="letters",$t=Nt,ft=j);let Wt=N+B-$t,ge=c?B:Wt-N-K;e.title&&!u&&yt.append("text").attr("x",N).attr("y",x).attr("text-anchor","start").attr("font-size",E).attr("font-weight","700").attr("fill",n.text).text(nr(e.title,E,ge)),!c&&Xt>0&&Qlt(yt,Gt,e.variant,Wt,at,Vt,ft,n,h,g,l,Y,F,tt,et,U,$);let ne=te=>N+ot+te*Q,se=gt-it;if(e.phases.length===0){let te=yt.append("g").attr("class","raci-row-bands");lt.forEach((ae,Te)=>{if(ae.kind!=="task")return;let Je=e.tasksWithoutPhase.indexOf(ae.task);if(Je<0)return;let ln=At[Te],Ve=pt.get(ae.task.id)?.rowHeight??k;te.append("rect").attr("class","raci-row-band").attr("data-task-id",ae.task.id).attr("x",N).attr("y",ln+2).attr("width",B).attr("height",Ve-4).attr("rx",6).attr("fill",Ot(eN(Je,n),h,12))})}let Zt=yt.append("g").attr("class","raci-columns");e.roles.forEach((te,ae)=>{let Te=ne(ae)+V,Je=Q-2*V,ln=e.roleColors[ae]??eN(ae,n),Ve=Ot(ln,or(n,r),16),Ce=Ot(ln,or(n,r),30),ee=Zt.append("g").attr("class","raci-column").attr("data-role-id",te);ee.append("rect").attr("class","raci-column-body").attr("x",Te).attr("y",it).attr("width",Je).attr("height",se).attr("rx",W).attr("fill",Ve),ee.append("path").attr("class","raci-column-header").attr("d",Tlt(Te,it,Je,C,W)).attr("fill",Ce);let oe=ne(ae)+Q/2;ee.append("text").attr("class","raci-column-label").attr("x",oe).attr("y",it+C/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",I).attr("font-weight",600).attr("fill",n.text).text(nr(e.roleDisplayNames[ae]??"",I,Q-2*R))});let Ie=Z.size>0,Ht=22,Qt=V+4,Ut=Q-2*Qt,fe=!0;for(let te of lt)if(!(te.kind!=="phase"||!te.collapsed)){for(let ae of e.roles){let Te=new Set;for(let Ve of te.phase.tasks){let Ce=Ve.roleAssignments.find(ee=>ee.id===ae);if(Ce)for(let ee of Ce.markers)Te.add(ee)}if(Te.size===0)continue;let Je=Np*Math.max(0,Te.size-1);if((Ut-Je)/Te.size<Ht){fe=!1;break}}if(!fe)break}for(let te=0;te<lt.length;te++){let ae=lt[te],Te=At[te];if(ae.kind==="phase"){let Je=e.phases.indexOf(ae.phase);tct(yt,ae.phase,N,Te,B,n,ae.collapsed,eN(Math.max(0,Je),n),e.roles,ne,Q,e.variant,h,g,fe,w,H,V,tt)}else ect(yt,ae.task,e,N,Te,ot,ne,Q,n,h,g,Z,Ie,pt.get(ae.task.id),s,l,O,D,R,k,V,tt,et,G,$,q,X)}m.some(te=>te.roleAssignments.some(ae=>ae.markers.length>0))||yt.append("text").attr("x",f/2).attr("y",dt-L-2).attr("text-anchor","middle").attr("font-size",12).attr("fill",n.textMuted).text("Drag a marker from the legend onto any cell. Drag a marker out to remove."),Zlt(yt)}function Zlt(t){let e=t.node();if(!e)return;let n=null,r=a=>{let i=a;for(;i&&i!==e;){let s=i.getAttribute&&i.getAttribute("data-role-id");if(s)return s;i=i.parentElement}return null},o=a=>{a!==n&&(n&&t.selectAll(`.raci-cell[data-role-id="${n}"], .raci-column[data-role-id="${n}"]`).classed("raci-col-active",!1),n=a,a?(t.attr("data-hover-col",a),t.selectAll(`.raci-cell[data-role-id="${a}"], .raci-column[data-role-id="${a}"]`).classed("raci-col-active",!0)):t.attr("data-hover-col",null))};t.on("mouseover",a=>o(r(a.target))),t.on("mouseleave",()=>o(null))}function Qlt(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h){if(e.length===0)return;let S=Nb[n],y=t.append("g").attr("class","raci-legend").attr("aria-label",`${n.toUpperCase()} marker legend`);e.forEach((b,E)=>{let x=r+E*(i+u),N=oN(b,s),L=S[b],A=y.append("g").attr("class","raci-legend-chip").attr("data-marker",b).style("cursor","grab");if(a==="letters"){let _=c?N:Ot(N,l,vb),T=c?Ot(N,l,70):N;A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",_).attr("stroke",T).attr("stroke-width",m),A.append("text").attr("x",x+i/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",700).attr("fill",c?Le(_,s.textOnFillLight,s.textOnFillDark):s.text).text(b);return}let C=c?N:Ot(N,l,vb),k=Ot(N,l,70);A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",C).attr("stroke",k).attr("stroke-width",m);let w=4,v=24,M=c?Ot(N,l,70):Ot(N,l,55);A.append("rect").attr("x",x+w).attr("y",o+w).attr("width",v).attr("height",f-2*w).attr("rx",4).attr("fill",M),A.append("text").attr("x",x+w+v/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",700).attr("fill",c?Le(M,s.textOnFillLight,s.textOnFillDark):s.text).text(b),A.append("text").attr("x",x+w+v+8).attr("y",o+f/2).attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",600).attr("fill",s.text).text(nr(L,h,i-v-w*2-12))})}function Jlt(t,e,n,r,o){G3(t,e,n,r,{},o)}function tct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h,S,y){let b=t.append("g").attr("class","raci-phase").attr("data-section",`phase-${e.id}`).attr("data-section-toggle","").attr("data-line-number",String(e.lineNumber)).attr("data-phase-id",e.id).attr("data-collapsed",i?"1":"0").style("cursor","pointer"),E=Ot(e.color??s,a.bg,30);b.append("rect").attr("x",n).attr("y",r+4).attr("width",o).attr("height",g-8).attr("fill",E).attr("rx",4);let x=n+12,N=r+g/2;if(b.append("text").attr("x",x).attr("y",N).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",Pt).attr("font-size",9).attr("fill",a.text).attr("opacity",.6).text(i?"\u25B6":"\u25BC"),b.append("text").attr("x",n+26).attr("y",r+(g-4)/2+2).attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",600).attr("fill",a.text).text(e.displayName),i){let L=e.tasks.length;if(L>0){let _=_t(e.displayName,h);b.append("text").attr("x",n+26+_+10).attr("y",r+(g-4)/2+2).attr("dominant-baseline","central").attr("font-size",h-1).attr("font-weight",500).attr("fill",a.textMuted).text(`${L} ${L===1?"task":"tasks"}`)}if(!m)return;let A=Qc[u].alphabet,C=S+4,k=d-2*C,w=24,v=13,M=r+(g-w)/2;l.forEach((_,T)=>{let R=new Set;for(let D of e.tasks){let W=D.roleAssignments.find(V=>V.id===_);if(W)for(let V of W.markers)R.add(V)}if(R.size===0)return;let O=_3([...R],A),I=Np*Math.max(0,O.length-1),H=(k-I)/O.length,G=c(T)+C;O.forEach((D,W)=>{let V=G+W*(H+Np),P=oN(D,a),F=p?P:Ot(P,f,vb),Y=p?Ot(P,f,70):P,z=b.append("g").attr("class","raci-phase-summary");z.append("rect").attr("x",V).attr("y",M).attr("width",H).attr("height",w).attr("rx",y).attr("fill",F).attr("stroke",Y).attr("stroke-width",1.25),z.append("text").attr("x",V+H/2).attr("y",M+w/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",v).attr("font-weight",700).attr("fill",p?Le(F,a.textOnFillLight,a.textOnFillDark):a.text).text(D)})})}}function ect(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h,S,y,b,E,x,N,L,A,C,k){let w=t.append("g").attr("class","raci-task-row").attr("data-task-id",e.id).attr("data-line-number",String(e.lineNumber)),v=r+8,M=a-16,_=p??O3(e,u?.get(e.id),M,h,S,b,C,k),{nameLines:T,descLines:R,violations:O,rowHeight:I}=_,H=w.append("g").attr("class","raci-task-label-area");H.append("rect").attr("class","raci-task-label-zone").attr("x",r).attr("y",o).attr("width",a).attr("height",I).attr("fill","transparent").attr("pointer-events","all");let G=o+h/2+6,D=H.append("text").attr("class","raci-task-label").attr("x",v).attr("y",G).attr("dominant-baseline","central").attr("font-size",h).attr("fill",l.text);T.forEach((F,Y)=>{let z=D.append("tspan").attr("x",v).text(F);Y>0&&z.attr("dy",nN)});let W=G+Math.max(0,T.length-1)*nN+h/2+4+C;if(R.length>0){let F=H.append("text").attr("class","raci-task-description").attr("x",v).attr("y",W).attr("dominant-baseline","central").attr("font-size",S).attr("fill",l.textMuted);R.forEach((Y,z)=>{let j=F.append("tspan").attr("x",v).text(Y);z>0&&j.attr("dy",rN)}),W+=R.length*rN}for(let F of O){let Y=F.severity==="error"?l.colors.red:l.colors.orange,z=H.append("g").attr("class","raci-violation-line").attr("data-severity",F.severity).style("cursor",m?"pointer":"default"),j=h-2,K=z.append("text").attr("x",v).attr("y",W).attr("dominant-baseline","central").attr("font-size",j).attr("fill",Y);if(F.lines.forEach(($,U)=>{nct($).forEach((q,et)=>{let tt=K.append("tspan").text(q.text);U>0&&et===0&&tt.attr("x",v).attr("dy",k),q.bold&&tt.attr("font-weight",700)})}),m){let $=F.sourceLine;z.on("click",U=>{U.stopPropagation(),m($)})}W+=F.lines.length*k}let V=new Map;for(let F of e.roleAssignments)V.set(F.id,F.markers);let P=Qc[n.variant].alphabet;n.roles.forEach((F,Y)=>{let z=E+4,j=i(Y)+z,K=o+y,$=s-2*z,U=b-2*y,X=V.get(F)??[],q=_3(X,P),et=e.roleAssignments.find(Z=>Z.id===F),tt=w.append("g").attr("class","raci-cell").attr("data-task-id",e.id).attr("data-role-id",F);et&&tt.attr("data-line-number",String(et.lineNumber)),tt.append("rect").attr("class","raci-cell-hit").attr("x",i(Y)+E).attr("y",o).attr("width",s-2*E).attr("height",b).attr("fill","transparent").attr("pointer-events","all");let B=Np*(q.length-1),Q=q.length>0?($-B)/q.length:0,ot=Nb[n.variant];q.forEach((Z,lt)=>{let nt=oN(Z,l),J=d?nt:Ot(nt,c,vb),at=nt,it=j+lt*(Q+Np),Lt=tt.append("g").attr("class","raci-marker-slice").attr("data-marker",Z).style("cursor","grab");Lt.append("rect").attr("x",it).attr("y",K).attr("width",Q).attr("height",U).attr("rx",x).attr("fill",J).attr("stroke",at).attr("stroke-width",N);let Tt=ot[Z]??Z,rt=_t(Tt,A)+16<=Q,pt=rt?Tt:Z,gt=rt?A:L;Lt.append("text").attr("x",it+Q/2).attr("y",K+U/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",gt).attr("font-weight",Xlt).attr("fill",d?Le(J,l.textOnFillLight,l.textOnFillDark):l.text).text(pt)}),tt.append("rect").attr("class","raci-cell-drop-preview").attr("x",j).attr("y",K).attr("width",$).attr("height",U).attr("rx",x).attr("fill","transparent").attr("stroke","transparent").attr("pointer-events","none"),m&&et&&tt.on("click",()=>m(et.lineNumber))})}function O3(t,e,n,r=D3,o=P3,a=A3,i=I3,s=R3){let l=Cn(t.displayName,r,n,{hardBreak:!0}),c=t.description?.trim()??"",d=c.length>0?c.split(`
309
+ Georgia heat: 2`}},dW=Object.values(sa)});function SL(t){return t}var LL=st(()=>{"use strict"});function Ay(t){if(t==null)return SL;var e,n,r=t.scale[0],o=t.scale[1],a=t.translate[0],i=t.translate[1];return function(s,l){l||(e=n=0);var c=2,d=s.length,u=new Array(d);for(u[0]=(e+=s[0])*r+a,u[1]=(n+=s[1])*o+i;c<d;)u[c]=s[c],++c;return u}}var Ry=st(()=>{"use strict";LL()});var vL=st(()=>{"use strict";Ry()});function uW(t,e){for(var n,r=t.length,o=r-e;o<--r;)n=t[o],t[o++]=t[r],t[r]=n}var fW=st(()=>{"use strict"});function jl(t,e){return typeof e=="string"&&(e=t.objects[e]),e.type==="GeometryCollection"?{type:"FeatureCollection",features:e.geometries.map(function(n){return pW(t,n)})}:pW(t,e)}function pW(t,e){var n=e.id,r=e.bbox,o=e.properties==null?{}:e.properties,a=NL(t,e);return n==null&&r==null?{type:"Feature",properties:o,geometry:a}:r==null?{type:"Feature",id:n,properties:o,geometry:a}:{type:"Feature",id:n,bbox:r,properties:o,geometry:a}}function NL(t,e){var n=Ay(t.transform),r=t.arcs;function o(d,u){u.length&&u.pop();for(var f=r[d<0?~d:d],p=0,m=f.length;p<m;++p)u.push(n(f[p],p));d<0&&uW(u,m)}function a(d){return n(d)}function i(d){for(var u=[],f=0,p=d.length;f<p;++f)o(d[f],u);return u.length<2&&u.push(u[0]),u}function s(d){for(var u=i(d);u.length<4;)u.push(u[0]);return u}function l(d){return d.map(s)}function c(d){var u=d.type,f;switch(u){case"GeometryCollection":return{type:u,geometries:d.geometries.map(c)};case"Point":f=a(d.coordinates);break;case"MultiPoint":f=d.coordinates.map(a);break;case"LineString":f=i(d.arcs);break;case"MultiLineString":f=d.arcs.map(i);break;case"Polygon":f=l(d.arcs);break;case"MultiPolygon":f=d.arcs.map(l);break;default:return null}return{type:u,coordinates:f}}return c(e)}var Iy=st(()=>{"use strict";fW();Ry()});var ML=st(()=>{"use strict"});var mW=st(()=>{"use strict";Iy();ML()});var gW=st(()=>{"use strict";Iy();ML()});function kL(t,e){for(var n=0,r=t.length;n<r;){var o=n+r>>>1;t[o]<e?n=o+1:r=o}return n}var hW=st(()=>{"use strict"});function TL(t){var e={},n=t.map(function(){return[]});function r(g,h){g.forEach(function(S){S<0&&(S=~S);var y=e[S];y?y.push(h):e[S]=[h]})}function o(g,h){g.forEach(function(S){r(S,h)})}function a(g,h){g.type==="GeometryCollection"?g.geometries.forEach(function(S){a(S,h)}):g.type in i&&i[g.type](g.arcs,h)}var i={LineString:r,MultiLineString:o,Polygon:o,MultiPolygon:function(g,h){g.forEach(function(S){o(S,h)})}};t.forEach(a);for(var s in e)for(var l=e[s],c=l.length,d=0;d<c;++d)for(var u=d+1;u<c;++u){var f=l[d],p=l[u],m;(m=n[f])[s=kL(m,p)]!==p&&m.splice(s,0,p),(m=n[p])[s=kL(m,f)]!==f&&m.splice(s,0,f)}return n}var yW=st(()=>{"use strict";hW()});var CL=st(()=>{"use strict";LL()});var bW=st(()=>{"use strict";vL();CL()});var _L=st(()=>{"use strict";vL();Iy();mW();gW();yW();bW();Ry();CL()});function SW(t){return t>1?0:t<-1?wn:Math.acos(t)}function Do(t){return t>1?yo:t<-1?-yo:Math.asin(t)}var xn,Py,wn,yo,Wd,jr,Dr,jn,Ln,Dy,la,_n,xW,wW,Mn,Fd,bo,EW,Sr=st(()=>{"use strict";xn=1e-6,Py=1e-12,wn=Math.PI,yo=wn/2,Wd=wn/4,jr=wn*2,Dr=180/wn,jn=wn/180,Ln=Math.abs,Dy=Math.atan,la=Math.atan2,_n=Math.cos,xW=Math.exp,wW=Math.log,Mn=Math.sin,Fd=Math.sign||function(t){return t>0?1:t<0?-1:0},bo=Math.sqrt,EW=Math.tan});function Gr(){}var ql=st(()=>{"use strict"});function Gy(t,e){t&&vW.hasOwnProperty(t.type)&&vW[t.type](t,e)}function AL(t,e,n){var r=-1,o=t.length-n,a;for(e.lineStart();++r<o;)a=t[r],e.point(a[0],a[1],a[2]);e.lineEnd()}function NW(t,e){var n=-1,r=t.length;for(e.polygonStart();++n<r;)AL(t[n],e,1);e.polygonEnd()}function $a(t,e){t&&LW.hasOwnProperty(t.type)?LW[t.type](t,e):Gy(t,e)}var LW,vW,Kf=st(()=>{"use strict";LW={Feature:function(t,e){Gy(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,r=-1,o=n.length;++r<o;)Gy(n[r].geometry,e)}},vW={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)t=n[r],e.point(t[0],t[1],t[2])},LineString:function(t,e){AL(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)AL(n[r],e,0)},Polygon:function(t,e){NW(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,r=-1,o=n.length;++r<o;)NW(n[r],e)},GeometryCollection:function(t,e){for(var n=t.geometries,r=-1,o=n.length;++r<o;)Gy(n[r],e)}}});function aat(){ai.point=sat}function iat(){TW(MW,kW)}function sat(t,e){ai.point=TW,MW=t,kW=e,t*=jn,e*=jn,RL=t,IL=_n(e=e/2+Wd),PL=Mn(e)}function TW(t,e){t*=jn,e*=jn,e=e/2+Wd;var n=t-RL,r=n>=0?1:-1,o=r*n,a=_n(e),i=Mn(e),s=PL*i,l=IL*a+s*_n(o),c=s*r*Mn(o);Zf.add(la(c,l)),RL=t,IL=a,PL=i}function DL(t){return Oy=new qr,$a(t,ai),Oy*2}var Zf,Oy,MW,kW,RL,IL,PL,ai,GL=st(()=>{"use strict";To();Sr();ql();Kf();Zf=new qr,Oy=new qr,ai={point:Gr,lineStart:Gr,lineEnd:Gr,polygonStart:function(){Zf=new qr,ai.lineStart=aat,ai.lineEnd=iat},polygonEnd:function(){var t=+Zf;Oy.add(t<0?jr+t:t),this.lineStart=this.lineEnd=this.point=Gr},sphere:function(){Oy.add(jr)}}});function Kl(t){return[la(t[1],t[0]),Do(t[2])]}function Ha(t){var e=t[0],n=t[1],r=_n(n);return[r*_n(e),r*Mn(e),Mn(n)]}function Qf(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function cs(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function $y(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Jf(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function Zl(t){var e=bo(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}var Bd=st(()=>{"use strict";Sr()});function OL(t,e){il.push(us=[Or=t,zr=t]),e<Jo&&(Jo=e),e>da&&(da=e)}function PW(t,e){var n=Ha([t*jn,e*jn]);if(Yd){var r=cs(Yd,n),o=[r[1],-r[0],0],a=cs(o,r);Zl(a),a=Kl(a);var i=t-Ql,s=i>0?1:-1,l=a[0]*Dr*s,c,d=Ln(i)>180;d^(s*Ql<l&&l<s*t)?(c=a[1]*Dr,c>da&&(da=c)):(l=(l+360)%360-180,d^(s*Ql<l&&l<s*t)?(c=-a[1]*Dr,c<Jo&&(Jo=c)):(e<Jo&&(Jo=e),e>da&&(da=e))),d?t<Ql?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t):zr>=Or?(t<Or&&(Or=t),t>zr&&(zr=t)):t>Ql?ca(Or,t)>ca(Or,zr)&&(zr=t):ca(t,zr)>ca(Or,zr)&&(Or=t)}else il.push(us=[Or=t,zr=t]);e<Jo&&(Jo=e),e>da&&(da=e),Yd=n,Ql=t}function CW(){ds.point=PW}function _W(){us[0]=Or,us[1]=zr,ds.point=OL,Yd=null}function DW(t,e){if(Yd){var n=t-Ql;tp.add(Ln(n)>180?n+(n>0?360:-360):n)}else RW=t,IW=e;ai.point(t,e),PW(t,e)}function lat(){ai.lineStart()}function cat(){DW(RW,IW),ai.lineEnd(),Ln(tp)>xn&&(Or=-(zr=180)),us[0]=Or,us[1]=zr,Yd=null}function ca(t,e){return(e-=t)<0?e+360:e}function dat(t,e){return t[0]-e[0]}function AW(t,e){return t[0]<=t[1]?t[0]<=e&&e<=t[1]:e<t[0]||t[1]<e}function fs(t){var e,n,r,o,a,i,s;if(da=zr=-(Or=Jo=1/0),il=[],$a(t,ds),n=il.length){for(il.sort(dat),e=1,r=il[0],a=[r];e<n;++e)o=il[e],AW(r,o[0])||AW(r,o[1])?(ca(r[0],o[1])>ca(r[0],r[1])&&(r[1]=o[1]),ca(o[0],r[1])>ca(r[0],r[1])&&(r[0]=o[0])):a.push(r=o);for(i=-1/0,n=a.length-1,e=0,r=a[n];e<=n;r=o,++e)o=a[e],(s=ca(r[1],o[0]))>i&&(i=s,Or=o[0],zr=r[1])}return il=us=null,Or===1/0||Jo===1/0?[[NaN,NaN],[NaN,NaN]]:[[Or,Jo],[zr,da]]}var Or,Jo,zr,da,Ql,RW,IW,Yd,tp,il,us,ds,GW=st(()=>{"use strict";To();GL();Bd();Sr();Kf();ds={point:OL,lineStart:CW,lineEnd:_W,polygonStart:function(){ds.point=DW,ds.lineStart=lat,ds.lineEnd=cat,tp=new qr,ai.polygonStart()},polygonEnd:function(){ai.polygonEnd(),ds.point=OL,ds.lineStart=CW,ds.lineEnd=_W,Zf<0?(Or=-(zr=180),Jo=-(da=90)):tp>xn?da=90:tp<-xn&&(Jo=-90),us[0]=Or,us[1]=zr},sphere:function(){Or=-(zr=180),Jo=-(da=90)}}});function ep(t,e){function n(r,o){return r=t(r,o),e(r[0],r[1])}return t.invert&&e.invert&&(n.invert=function(r,o){return r=e.invert(r,o),r&&t.invert(r[0],r[1])}),n}var $L=st(()=>{"use strict"});function HL(t,e){return Ln(t)>wn&&(t-=Math.round(t/jr)*jr),[t,e]}function WL(t,e,n){return(t%=jr)?e||n?ep($W(t),HW(e,n)):$W(t):e||n?HW(e,n):HL}function OW(t){return function(e,n){return e+=t,Ln(e)>wn&&(e-=Math.round(e/jr)*jr),[e,n]}}function $W(t){var e=OW(t);return e.invert=OW(-t),e}function HW(t,e){var n=_n(t),r=Mn(t),o=_n(e),a=Mn(e);function i(s,l){var c=_n(l),d=_n(s)*c,u=Mn(s)*c,f=Mn(l),p=f*n+d*r;return[la(u*o-p*a,d*n-f*r),Do(p*o+u*a)]}return i.invert=function(s,l){var c=_n(l),d=_n(s)*c,u=Mn(s)*c,f=Mn(l),p=f*o-u*a;return[la(u*o+f*a,d*n+p*r),Do(p*n-d*r)]},i}function WW(t){t=WL(t[0]*jn,t[1]*jn,t.length>2?t[2]*jn:0);function e(n){return n=t(n[0]*jn,n[1]*jn),n[0]*=Dr,n[1]*=Dr,n}return e.invert=function(n){return n=t.invert(n[0]*jn,n[1]*jn),n[0]*=Dr,n[1]*=Dr,n},e}var FL=st(()=>{"use strict";$L();Sr();HL.invert=HL});function BW(t,e,n,r,o,a){if(n){var i=_n(e),s=Mn(e),l=r*n;o==null?(o=e+r*jr,a=e-l/2):(o=FW(i,o),a=FW(i,a),(r>0?o<a:o>a)&&(o+=r*jr));for(var c,d=o;r>0?d>a:d<a;d-=l)c=Kl([i,-s*_n(d),-s*Mn(d)]),t.point(c[0],c[1])}}function FW(t,e){e=Ha(e),e[0]-=t,Zl(e);var n=SW(-e[1]);return((-e[2]<0?-n:n)+jr-xn)%jr}var YW=st(()=>{"use strict";Bd();Sr()});function Hy(){var t=[],e;return{point:function(n,r,o){e.push([n,r,o])},lineStart:function(){t.push(e=[])},lineEnd:Gr,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}var BL=st(()=>{"use strict";ql()});function Vd(t,e){return Ln(t[0]-e[0])<xn&&Ln(t[1]-e[1])<xn}var YL=st(()=>{"use strict";Sr()});function Wy(t,e,n,r){this.x=t,this.z=e,this.o=n,this.e=r,this.v=!1,this.n=this.p=null}function Fy(t,e,n,r,o){var a=[],i=[],s,l;if(t.forEach(function(m){if(!((g=m.length-1)<=0)){var g,h=m[0],S=m[g],y;if(Vd(h,S)){if(!h[2]&&!S[2]){for(o.lineStart(),s=0;s<g;++s)o.point((h=m[s])[0],h[1]);o.lineEnd();return}S[0]+=2*xn}a.push(y=new Wy(h,m,null,!0)),i.push(y.o=new Wy(h,null,y,!1)),a.push(y=new Wy(S,m,null,!1)),i.push(y.o=new Wy(S,null,y,!0))}}),!!a.length){for(i.sort(e),VW(a),VW(i),s=0,l=i.length;s<l;++s)i[s].e=n=!n;for(var c=a[0],d,u;;){for(var f=c,p=!0;f.v;)if((f=f.n)===c)return;d=f.z,o.lineStart();do{if(f.v=f.o.v=!0,f.e){if(p)for(s=0,l=d.length;s<l;++s)o.point((u=d[s])[0],u[1]);else r(f.x,f.n.x,1,o);f=f.n}else{if(p)for(d=f.p.z,s=d.length-1;s>=0;--s)o.point((u=d[s])[0],u[1]);else r(f.x,f.p.x,-1,o);f=f.p}f=f.o,d=f.z,p=!p}while(!f.v);o.lineEnd()}}}function VW(t){if(e=t.length){for(var e,n=0,r=t[0],o;++n<e;)r.n=o=t[n],o.p=r,r=o;r.n=o=t[0],o.p=r}}var VL=st(()=>{"use strict";YL();Sr()});function zL(t){return Ln(t[0])<=wn?t[0]:Fd(t[0])*((Ln(t[0])+wn)%jr-wn)}function zW(t,e){var n=zL(e),r=e[1],o=Mn(r),a=[Mn(n),-_n(n),0],i=0,s=0,l=new qr;o===1?r=yo+xn:o===-1&&(r=-yo-xn);for(var c=0,d=t.length;c<d;++c)if(f=(u=t[c]).length)for(var u,f,p=u[f-1],m=zL(p),g=p[1]/2+Wd,h=Mn(g),S=_n(g),y=0;y<f;++y,m=E,h=N,S=L,p=b){var b=u[y],E=zL(b),x=b[1]/2+Wd,N=Mn(x),L=_n(x),A=E-m,C=A>=0?1:-1,k=C*A,w=k>wn,v=h*N;if(l.add(la(v*C*Mn(k),S*L+v*_n(k))),i+=w?A+C*jr:A,w^m>=n^E>=n){var M=cs(Ha(p),Ha(b));Zl(M);var _=cs(a,M);Zl(_);var T=(w^A>=0?-1:1)*Do(_[2]);(r>T||r===T&&(M[0]||M[1]))&&(s+=w^A>=0?1:-1)}}return(i<-xn||i<xn&&l<-Py)^s&1}var UW=st(()=>{"use strict";To();Bd();Sr()});function By(t,e,n,r){return function(o){var a=e(o),i=Hy(),s=e(i),l=!1,c,d,u,f={point:p,lineStart:g,lineEnd:h,polygonStart:function(){f.point=S,f.lineStart=y,f.lineEnd=b,d=[],c=[]},polygonEnd:function(){f.point=p,f.lineStart=g,f.lineEnd=h,d=bc(d);var E=zW(c,r);d.length?(l||(o.polygonStart(),l=!0),Fy(d,fat,E,n,o)):E&&(l||(o.polygonStart(),l=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),l&&(o.polygonEnd(),l=!1),d=c=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function p(E,x){t(E,x)&&o.point(E,x)}function m(E,x){a.point(E,x)}function g(){f.point=m,a.lineStart()}function h(){f.point=p,a.lineEnd()}function S(E,x){u.push([E,x]),s.point(E,x)}function y(){s.lineStart(),u=[]}function b(){S(u[0][0],u[0][1]),s.lineEnd();var E=s.clean(),x=i.result(),N,L=x.length,A,C,k;if(u.pop(),c.push(u),u=null,!!L){if(E&1){if(C=x[0],(A=C.length-1)>0){for(l||(o.polygonStart(),l=!0),o.lineStart(),N=0;N<A;++N)o.point((k=C[N])[0],k[1]);o.lineEnd()}return}L>1&&E&2&&x.push(x.pop().concat(x.shift())),d.push(x.filter(uat))}}return f}}function uat(t){return t.length>1}function fat(t,e){return((t=t.x)[0]<0?t[1]-yo-xn:yo-t[1])-((e=e.x)[0]<0?e[1]-yo-xn:yo-e[1])}var UL=st(()=>{"use strict";BL();VL();Sr();UW();To()});function pat(t){var e=NaN,n=NaN,r=NaN,o;return{lineStart:function(){t.lineStart(),o=1},point:function(a,i){var s=a>0?wn:-wn,l=Ln(a-e);Ln(l-wn)<xn?(t.point(e,n=(n+i)/2>0?yo:-yo),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),t.point(a,n),o=0):r!==s&&l>=wn&&(Ln(e-r)<xn&&(e-=r*xn),Ln(a-s)<xn&&(a-=s*xn),n=mat(e,n,a,i),t.point(r,n),t.lineEnd(),t.lineStart(),t.point(s,n),o=0),t.point(e=a,n=i),r=s},lineEnd:function(){t.lineEnd(),e=n=NaN},clean:function(){return 2-o}}}function mat(t,e,n,r){var o,a,i=Mn(t-n);return Ln(i)>xn?Dy((Mn(e)*(a=_n(r))*Mn(n)-Mn(r)*(o=_n(e))*Mn(t))/(o*a*i)):(e+r)/2}function gat(t,e,n,r){var o;if(t==null)o=n*yo,r.point(-wn,o),r.point(0,o),r.point(wn,o),r.point(wn,0),r.point(wn,-o),r.point(0,-o),r.point(-wn,-o),r.point(-wn,0),r.point(-wn,o);else if(Ln(t[0]-e[0])>xn){var a=t[0]<e[0]?wn:-wn;o=n*a/2,r.point(-a,o),r.point(0,o),r.point(a,o)}else r.point(e[0],e[1])}var XL,XW=st(()=>{"use strict";UL();Sr();XL=By(function(){return!0},pat,gat,[-wn,-yo])});function jW(t){var e=_n(t),n=2*jn,r=e>0,o=Ln(e)>xn;function a(d,u,f,p){BW(p,t,n,f,d,u)}function i(d,u){return _n(d)*_n(u)>e}function s(d){var u,f,p,m,g;return{lineStart:function(){m=p=!1,g=1},point:function(h,S){var y=[h,S],b,E=i(h,S),x=r?E?0:c(h,S):E?c(h+(h<0?wn:-wn),S):0;if(!u&&(m=p=E)&&d.lineStart(),E!==p&&(b=l(u,y),(!b||Vd(u,b)||Vd(y,b))&&(y[2]=1)),E!==p)g=0,E?(d.lineStart(),b=l(y,u),d.point(b[0],b[1])):(b=l(u,y),d.point(b[0],b[1],2),d.lineEnd()),u=b;else if(o&&u&&r^E){var N;!(x&f)&&(N=l(y,u,!0))&&(g=0,r?(d.lineStart(),d.point(N[0][0],N[0][1]),d.point(N[1][0],N[1][1]),d.lineEnd()):(d.point(N[1][0],N[1][1]),d.lineEnd(),d.lineStart(),d.point(N[0][0],N[0][1],3)))}E&&(!u||!Vd(u,y))&&d.point(y[0],y[1]),u=y,p=E,f=x},lineEnd:function(){p&&d.lineEnd(),u=null},clean:function(){return g|(m&&p)<<1}}}function l(d,u,f){var p=Ha(d),m=Ha(u),g=[1,0,0],h=cs(p,m),S=Qf(h,h),y=h[0],b=S-y*y;if(!b)return!f&&d;var E=e*S/b,x=-e*y/b,N=cs(g,h),L=Jf(g,E),A=Jf(h,x);$y(L,A);var C=N,k=Qf(L,C),w=Qf(C,C),v=k*k-w*(Qf(L,L)-1);if(!(v<0)){var M=bo(v),_=Jf(C,(-k-M)/w);if($y(_,L),_=Kl(_),!f)return _;var T=d[0],R=u[0],O=d[1],I=u[1],H;R<T&&(H=T,T=R,R=H);var G=R-T,D=Ln(G-wn)<xn,W=D||G<xn;if(!D&&I<O&&(H=O,O=I,I=H),W?D?O+I>0^_[1]<(Ln(_[0]-T)<xn?O:I):O<=_[1]&&_[1]<=I:G>wn^(T<=_[0]&&_[0]<=R)){var V=Jf(C,(-k+M)/w);return $y(V,L),[_,Kl(V)]}}}function c(d,u){var f=r?t:wn-t,p=0;return d<-f?p|=1:d>f&&(p|=2),u<-f?p|=4:u>f&&(p|=8),p}return By(i,s,a,r?[0,-t]:[-wn,t-wn])}var qW=st(()=>{"use strict";Bd();YW();Sr();YL();UL()});function KW(t,e,n,r,o,a){var i=t[0],s=t[1],l=e[0],c=e[1],d=0,u=1,f=l-i,p=c-s,m;if(m=n-i,!(!f&&m>0)){if(m/=f,f<0){if(m<d)return;m<u&&(u=m)}else if(f>0){if(m>u)return;m>d&&(d=m)}if(m=o-i,!(!f&&m<0)){if(m/=f,f<0){if(m>u)return;m>d&&(d=m)}else if(f>0){if(m<d)return;m<u&&(u=m)}if(m=r-s,!(!p&&m>0)){if(m/=p,p<0){if(m<d)return;m<u&&(u=m)}else if(p>0){if(m>u)return;m>d&&(d=m)}if(m=a-s,!(!p&&m<0)){if(m/=p,p<0){if(m>u)return;m>d&&(d=m)}else if(p>0){if(m<d)return;m<u&&(u=m)}return d>0&&(t[0]=i+d*f,t[1]=s+d*p),u<1&&(e[0]=i+u*f,e[1]=s+u*p),!0}}}}}var ZW=st(()=>{"use strict"});function jL(t,e,n,r){function o(c,d){return t<=c&&c<=n&&e<=d&&d<=r}function a(c,d,u,f){var p=0,m=0;if(c==null||(p=i(c,u))!==(m=i(d,u))||l(c,d)<0^u>0)do f.point(p===0||p===3?t:n,p>1?r:e);while((p=(p+u+4)%4)!==m);else f.point(d[0],d[1])}function i(c,d){return Ln(c[0]-t)<xn?d>0?0:3:Ln(c[0]-n)<xn?d>0?2:1:Ln(c[1]-e)<xn?d>0?1:0:d>0?3:2}function s(c,d){return l(c.x,d.x)}function l(c,d){var u=i(c,1),f=i(d,1);return u!==f?u-f:u===0?d[1]-c[1]:u===1?c[0]-d[0]:u===2?c[1]-d[1]:d[0]-c[0]}return function(c){var d=c,u=Hy(),f,p,m,g,h,S,y,b,E,x,N,L={point:A,lineStart:v,lineEnd:M,polygonStart:k,polygonEnd:w};function A(T,R){o(T,R)&&d.point(T,R)}function C(){for(var T=0,R=0,O=p.length;R<O;++R)for(var I=p[R],H=1,G=I.length,D=I[0],W,V,P=D[0],F=D[1];H<G;++H)W=P,V=F,D=I[H],P=D[0],F=D[1],V<=r?F>r&&(P-W)*(r-V)>(F-V)*(t-W)&&++T:F<=r&&(P-W)*(r-V)<(F-V)*(t-W)&&--T;return T}function k(){d=u,f=[],p=[],N=!0}function w(){var T=C(),R=N&&T,O=(f=bc(f)).length;(R||O)&&(c.polygonStart(),R&&(c.lineStart(),a(null,null,1,c),c.lineEnd()),O&&Fy(f,s,T,a,c),c.polygonEnd()),d=c,f=p=m=null}function v(){L.point=_,p&&p.push(m=[]),x=!0,E=!1,y=b=NaN}function M(){f&&(_(g,h),S&&E&&u.rejoin(),f.push(u.result())),L.point=A,E&&d.lineEnd()}function _(T,R){var O=o(T,R);if(p&&m.push([T,R]),x)g=T,h=R,S=O,x=!1,O&&(d.lineStart(),d.point(T,R));else if(O&&E)d.point(T,R);else{var I=[y=Math.max(Yy,Math.min(np,y)),b=Math.max(Yy,Math.min(np,b))],H=[T=Math.max(Yy,Math.min(np,T)),R=Math.max(Yy,Math.min(np,R))];KW(I,H,t,e,n,r)?(E||(d.lineStart(),d.point(I[0],I[1])),d.point(H[0],H[1]),O||d.lineEnd(),N=!1):O&&(d.lineStart(),d.point(T,R),N=!1)}y=T,b=R,E=O}return L}}var np,Yy,QW=st(()=>{"use strict";Sr();BL();ZW();VL();To();np=1e9,Yy=-np});var rp,qL=st(()=>{"use strict";rp=t=>t});function hat(){sl.point=yat}function yat(t,e){sl.point=eF,JW=QL=t,tF=JL=e}function eF(t,e){ZL.add(JL*t-QL*e),QL=t,JL=e}function bat(){eF(JW,tF)}var KL,ZL,JW,tF,QL,JL,sl,tv,nF=st(()=>{"use strict";To();Sr();ql();KL=new qr,ZL=new qr,sl={point:Gr,lineStart:Gr,lineEnd:Gr,polygonStart:function(){sl.lineStart=hat,sl.lineEnd=bat},polygonEnd:function(){sl.lineStart=sl.lineEnd=sl.point=Gr,KL.add(Ln(ZL)),ZL=new qr},result:function(){var t=KL/2;return KL=new qr,t}};tv=sl});function wat(t,e){t<zd&&(zd=t),t>op&&(op=t),e<Vy&&(Vy=e),e>zy&&(zy=e)}var zd,Vy,op,zy,xat,Ud,ev=st(()=>{"use strict";ql();zd=1/0,Vy=zd,op=-zd,zy=op,xat={point:wat,lineStart:Gr,lineEnd:Gr,polygonStart:Gr,polygonEnd:Gr,result:function(){var t=[[zd,Vy],[op,zy]];return op=zy=-(Vy=zd=1/0),t}};Ud=xat});function Jl(t,e){nv+=t,rv+=e,++ap}function rF(){ii.point=Eat}function Eat(t,e){ii.point=Sat,Jl(Hi=t,Wi=e)}function Sat(t,e){var n=t-Hi,r=e-Wi,o=bo(n*n+r*r);Uy+=o*(Hi+t)/2,Xy+=o*(Wi+e)/2,Xd+=o,Jl(Hi=t,Wi=e)}function oF(){ii.point=Jl}function Lat(){ii.point=Nat}function vat(){sF(aF,iF)}function Nat(t,e){ii.point=sF,Jl(aF=Hi=t,iF=Wi=e)}function sF(t,e){var n=t-Hi,r=e-Wi,o=bo(n*n+r*r);Uy+=o*(Hi+t)/2,Xy+=o*(Wi+e)/2,Xd+=o,o=Wi*t-Hi*e,ov+=o*(Hi+t),av+=o*(Wi+e),ip+=o*3,Jl(Hi=t,Wi=e)}var nv,rv,ap,Uy,Xy,Xd,ov,av,ip,aF,iF,Hi,Wi,ii,iv,lF=st(()=>{"use strict";Sr();nv=0,rv=0,ap=0,Uy=0,Xy=0,Xd=0,ov=0,av=0,ip=0,ii={point:Jl,lineStart:rF,lineEnd:oF,polygonStart:function(){ii.lineStart=Lat,ii.lineEnd=vat},polygonEnd:function(){ii.point=Jl,ii.lineStart=rF,ii.lineEnd=oF},result:function(){var t=ip?[ov/ip,av/ip]:Xd?[Uy/Xd,Xy/Xd]:ap?[nv/ap,rv/ap]:[NaN,NaN];return nv=rv=ap=Uy=Xy=Xd=ov=av=ip=0,t}};iv=ii});function jy(t){this._context=t}var cF=st(()=>{"use strict";Sr();ql();jy.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){this._line===0&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:{this._context.moveTo(t,e),this._point=1;break}case 1:{this._context.lineTo(t,e);break}default:{this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,jr);break}}},result:Gr}});function Mat(t,e){qy.point=fF,dF=sp=t,uF=lp=e}function fF(t,e){sp-=t,lp-=e,lv.add(bo(sp*sp+lp*lp)),sp=t,lp=e}var lv,sv,dF,uF,sp,lp,qy,cv,pF=st(()=>{"use strict";To();Sr();ql();lv=new qr,qy={point:Gr,lineStart:function(){qy.point=Mat},lineEnd:function(){sv&&fF(dF,uF),qy.point=Gr},polygonStart:function(){sv=!0},polygonEnd:function(){sv=null},result:function(){var t=+lv;return lv=new qr,t}};cv=qy});function yF(t){let e=1;this._+=t[0];for(let n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function kat(t){let e=Math.floor(t);if(!(e>=0))throw new RangeError(`invalid digits: ${t}`);if(e>15)return yF;if(e!==mF){let n=10**e;mF=e,Ky=function(o){let a=1;this._+=o[0];for(let i=o.length;a<i;++a)this._+=Math.round(arguments[a]*n)/n+o[a]}}return Ky}var mF,Ky,gF,hF,jd,bF=st(()=>{"use strict";jd=class{constructor(e){this._append=e==null?yF:kat(e),this._radius=4.5,this._=""}pointRadius(e){return this._radius=+e,this}polygonStart(){this._line=0}polygonEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){this._line===0&&(this._+="Z"),this._point=NaN}point(e,n){switch(this._point){case 0:{this._append`M${e},${n}`,this._point=1;break}case 1:{this._append`L${e},${n}`;break}default:{if(this._append`M${e},${n}`,this._radius!==gF||this._append!==Ky){let r=this._radius,o=this._;this._="",this._append`m0,${r}a${r},${r} 0 1,1 0,${-2*r}a${r},${r} 0 1,1 0,${2*r}z`,gF=r,Ky=this._append,hF=this._,this._=o}this._+=hF;break}}}result(){let e=this._;return this._="",e.length?e:null}}});function Wa(t,e){let n=3,r=4.5,o,a;function i(s){return s&&(typeof r=="function"&&a.pointRadius(+r.apply(this,arguments)),$a(s,o(a))),a.result()}return i.area=function(s){return $a(s,o(tv)),tv.result()},i.measure=function(s){return $a(s,o(cv)),cv.result()},i.bounds=function(s){return $a(s,o(Ud)),Ud.result()},i.centroid=function(s){return $a(s,o(iv)),iv.result()},i.projection=function(s){return arguments.length?(o=s==null?(t=null,rp):(t=s).stream,i):t},i.context=function(s){return arguments.length?(a=s==null?(e=null,new jd(n)):new jy(e=s),typeof r!="function"&&a.pointRadius(r),i):e},i.pointRadius=function(s){return arguments.length?(r=typeof s=="function"?s:(a.pointRadius(+s),+s),i):r},i.digits=function(s){if(!arguments.length)return n;if(s==null)n=null;else{let l=Math.floor(s);if(!(l>=0))throw new RangeError(`invalid digits: ${s}`);n=l}return e===null&&(a=new jd(n)),i},i.projection(t).digits(n).context(e)}var xF=st(()=>{"use strict";qL();Kf();nF();ev();lF();cF();pF();bF()});function Zy(t){return{stream:qd(t)}}function qd(t){return function(e){var n=new dv;for(var r in t)n[r]=t[r];return n.stream=e,n}}function dv(){}var Qy=st(()=>{"use strict";dv.prototype={constructor:dv,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}}});function uv(t,e,n){var r=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),r!=null&&t.clipExtent(null),$a(n,t.stream(Ud)),e(Ud.result()),r!=null&&t.clipExtent(r),t}function fv(t,e,n){return uv(t,function(r){var o=e[1][0]-e[0][0],a=e[1][1]-e[0][1],i=Math.min(o/(r[1][0]-r[0][0]),a/(r[1][1]-r[0][1])),s=+e[0][0]+(o-i*(r[1][0]+r[0][0]))/2,l=+e[0][1]+(a-i*(r[1][1]+r[0][1]))/2;t.scale(150*i).translate([s,l])},n)}function wF(t,e,n){return fv(t,[[0,0],e],n)}function EF(t,e,n){return uv(t,function(r){var o=+e,a=o/(r[1][0]-r[0][0]),i=(o-a*(r[1][0]+r[0][0]))/2,s=-a*r[0][1];t.scale(150*a).translate([i,s])},n)}function SF(t,e,n){return uv(t,function(r){var o=+e,a=o/(r[1][1]-r[0][1]),i=-a*r[0][0],s=(o-a*(r[1][1]+r[0][1]))/2;t.scale(150*a).translate([i,s])},n)}var LF=st(()=>{"use strict";Kf();ev()});function pv(t,e){return+e?_at(t,e):Cat(t)}function Cat(t){return qd({point:function(e,n){e=t(e,n),this.stream.point(e[0],e[1])}})}function _at(t,e){function n(r,o,a,i,s,l,c,d,u,f,p,m,g,h){var S=c-r,y=d-o,b=S*S+y*y;if(b>4*e&&g--){var E=i+f,x=s+p,N=l+m,L=bo(E*E+x*x+N*N),A=Do(N/=L),C=Ln(Ln(N)-1)<xn||Ln(a-u)<xn?(a+u)/2:la(x,E),k=t(C,A),w=k[0],v=k[1],M=w-r,_=v-o,T=y*M-S*_;(T*T/b>e||Ln((S*M+y*_)/b-.5)>.3||i*f+s*p+l*m<Tat)&&(n(r,o,a,i,s,l,w,v,C,E/=L,x/=L,N,g,h),h.point(w,v),n(w,v,C,E,x,N,c,d,u,f,p,m,g,h))}}return function(r){var o,a,i,s,l,c,d,u,f,p,m,g,h={point:S,lineStart:y,lineEnd:E,polygonStart:function(){r.polygonStart(),h.lineStart=x},polygonEnd:function(){r.polygonEnd(),h.lineStart=y}};function S(A,C){A=t(A,C),r.point(A[0],A[1])}function y(){u=NaN,h.point=b,r.lineStart()}function b(A,C){var k=Ha([A,C]),w=t(A,C);n(u,f,d,p,m,g,u=w[0],f=w[1],d=A,p=k[0],m=k[1],g=k[2],vF,r),r.point(u,f)}function E(){h.point=S,r.lineEnd()}function x(){y(),h.point=N,h.lineEnd=L}function N(A,C){b(o=A,C),a=u,i=f,s=p,l=m,c=g,h.point=b}function L(){n(u,f,d,p,m,g,a,i,o,s,l,c,vF,r),h.lineEnd=E,E()}return h}}var vF,Tat,NF=st(()=>{"use strict";Bd();Sr();Qy();vF=16,Tat=_n(30*jn)});function Rat(t){return qd({point:function(e,n){var r=t(e,n);return this.stream.point(r[0],r[1])}})}function Iat(t,e,n,r,o){function a(i,s){return i*=r,s*=o,[e+t*i,n-t*s]}return a.invert=function(i,s){return[(i-e)/t*r,(n-s)/t*o]},a}function MF(t,e,n,r,o,a){if(!a)return Iat(t,e,n,r,o);var i=_n(a),s=Mn(a),l=i*t,c=s*t,d=i/t,u=s/t,f=(s*n-i*e)/t,p=(s*e+i*n)/t;function m(g,h){return g*=r,h*=o,[l*g-c*h+e,n-c*g-l*h]}return m.invert=function(g,h){return[r*(d*g-u*h+f),o*(p-u*g-d*h)]},m}function ps(t){return mv(function(){return t})()}function mv(t){var e,n=150,r=480,o=250,a=0,i=0,s=0,l=0,c=0,d,u=0,f=1,p=1,m=null,g=XL,h=null,S,y,b,E=rp,x=.5,N,L,A,C,k;function w(T){return A(T[0]*jn,T[1]*jn)}function v(T){return T=A.invert(T[0],T[1]),T&&[T[0]*Dr,T[1]*Dr]}w.stream=function(T){return C&&k===T?C:C=Aat(Rat(d)(g(N(E(k=T)))))},w.preclip=function(T){return arguments.length?(g=T,m=void 0,_()):g},w.postclip=function(T){return arguments.length?(E=T,h=S=y=b=null,_()):E},w.clipAngle=function(T){return arguments.length?(g=+T?jW(m=T*jn):(m=null,XL),_()):m*Dr},w.clipExtent=function(T){return arguments.length?(E=T==null?(h=S=y=b=null,rp):jL(h=+T[0][0],S=+T[0][1],y=+T[1][0],b=+T[1][1]),_()):h==null?null:[[h,S],[y,b]]},w.scale=function(T){return arguments.length?(n=+T,M()):n},w.translate=function(T){return arguments.length?(r=+T[0],o=+T[1],M()):[r,o]},w.center=function(T){return arguments.length?(a=T[0]%360*jn,i=T[1]%360*jn,M()):[a*Dr,i*Dr]},w.rotate=function(T){return arguments.length?(s=T[0]%360*jn,l=T[1]%360*jn,c=T.length>2?T[2]%360*jn:0,M()):[s*Dr,l*Dr,c*Dr]},w.angle=function(T){return arguments.length?(u=T%360*jn,M()):u*Dr},w.reflectX=function(T){return arguments.length?(f=T?-1:1,M()):f<0},w.reflectY=function(T){return arguments.length?(p=T?-1:1,M()):p<0},w.precision=function(T){return arguments.length?(N=pv(L,x=T*T),_()):bo(x)},w.fitExtent=function(T,R){return fv(w,T,R)},w.fitSize=function(T,R){return wF(w,T,R)},w.fitWidth=function(T,R){return EF(w,T,R)},w.fitHeight=function(T,R){return SF(w,T,R)};function M(){var T=MF(n,0,0,f,p,u).apply(null,e(a,i)),R=MF(n,r-T[0],o-T[1],f,p,u);return d=WL(s,l,c),L=ep(e,R),A=ep(d,L),N=pv(L,x),_()}function _(){return C=k=null,w}return function(){return e=t.apply(this,arguments),w.invert=e.invert&&v,M()}}var Aat,Kd=st(()=>{"use strict";XW();qW();QW();$L();qL();Sr();FL();Qy();LF();NF();Aat=qd({point:function(t,e){this.stream.point(t*jn,e*jn)}})});function kF(t){var e=0,n=wn/3,r=mv(t),o=r(e,n);return o.parallels=function(a){return arguments.length?r(e=a[0]*jn,n=a[1]*jn):[e*Dr,n*Dr]},o}var TF=st(()=>{"use strict";Sr();Kd()});function CF(t){var e=_n(t);function n(r,o){return[r*e,Mn(o)/e]}return n.invert=function(r,o){return[r/e,Do(o*e)]},n}var _F=st(()=>{"use strict";Sr()});function AF(t,e){var n=Mn(t),r=(n+Mn(e))/2;if(Ln(r)<xn)return CF(t);var o=1+n*(2*r-n),a=bo(o)/r;function i(s,l){var c=bo(o-2*r*Mn(l))/r;return[c*Mn(s*=r),a-c*_n(s)]}return i.invert=function(s,l){var c=a-l,d=la(s,Ln(c))*Fd(c);return c*r<0&&(d-=wn*Fd(s)*Fd(c)),[d/r,Do((o-(s*s+c*c)*r*r)/(2*r))]},i}function cp(){return kF(AF).scale(155.424).center([0,33.6442])}var RF=st(()=>{"use strict";Sr();TF();_F()});function Jy(t,e){return[t,wW(EW((yo+e)/2))]}function tb(){return Pat(Jy).scale(961/jr)}function Pat(t){var e=ps(t),n=e.center,r=e.scale,o=e.translate,a=e.clipExtent,i=null,s,l,c;e.scale=function(u){return arguments.length?(r(u),d()):r()},e.translate=function(u){return arguments.length?(o(u),d()):o()},e.center=function(u){return arguments.length?(n(u),d()):n()},e.clipExtent=function(u){return arguments.length?(u==null?i=s=l=c=null:(i=+u[0][0],s=+u[0][1],l=+u[1][0],c=+u[1][1]),d()):i==null?null:[[i,s],[l,c]]};function d(){var u=wn*r(),f=e(WW(e.rotate()).invert([0,0]));return a(i==null?[[f[0]-u,f[1]-u],[f[0]+u,f[1]+u]]:t===Jy?[[Math.max(f[0]-u,i),s],[Math.min(f[0]+u,l),c]]:[[i,Math.max(f[1]-u,s)],[l,Math.min(f[1]+u,c)]])}return d()}var IF=st(()=>{"use strict";Sr();FL();Kd();Jy.invert=function(t,e){return[t,2*Dy(xW(e))-yo]}});function eb(t,e){return[t,e]}function nb(){return ps(eb).scale(152.63)}var PF=st(()=>{"use strict";Kd();eb.invert=eb});function gv(t,e){var n=Do(rb*Mn(e)),r=n*n,o=r*r*r;return[t*_n(n)/(rb*(dp+3*up*r+o*(7*fp+9*pp*r))),n*(dp+up*r+o*(fp+pp*r))]}function hv(){return ps(gv).scale(177.158)}var dp,up,fp,pp,rb,Dat,DF=st(()=>{"use strict";Kd();Sr();dp=1.340264,up=-.081106,fp=893e-6,pp=.003796,rb=bo(3)/2,Dat=12;gv.invert=function(t,e){for(var n=e,r=n*n,o=r*r*r,a=0,i,s,l;a<Dat&&(s=n*(dp+up*r+o*(fp+pp*r))-e,l=dp+3*up*r+o*(7*fp+9*pp*r),n-=i=s/l,r=n*n,o=r*r*r,!(Ln(i)<Py));++a);return[rb*t*(dp+3*up*r+o*(7*fp+9*pp*r))/_n(n),Do(Mn(n)/rb)]}});function yv(t,e){var n=e*e,r=n*n;return[t*(.8707-.131979*n+r*(-.013791+r*(.003971*n-.001529*r))),e*(1.007226+n*(.015085+r*(-.044475+.028874*n-.005916*r)))]}function bv(){return ps(yv).scale(175.295)}var GF=st(()=>{"use strict";Kd();Sr();yv.invert=function(t,e){var n=e,r=25,o;do{var a=n*n,i=a*a;n-=o=(n*(1.007226+a*(.015085+i*(-.044475+.028874*a-.005916*i)))-e)/(1.007226+a*(.015085*3+i*(-.044475*7+.028874*9*a-.005916*11*i)))}while(Ln(o)>xn&&--r>0);return[t/(.8707+(a=n*n)*(-.131979+a*(-.013791+a*a*a*(.003971-.001529*a)))),n]}});var ob=st(()=>{"use strict";GL();GW();xF();RF();DF();PF();IF();GF();Qy()});function Zd(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function xv(t){let e=new Map;for(let n of Zd(t).geometries){let r=si(n.properties.name);e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}for(let n of Zd(t).geometries){let r=n.id.toLowerCase();e.has(r)||e.set(r,{id:n.id,name:n.properties.name})}return e}function wv(t){let e=OF.get(t);if(e)return e;let n=Zd(t).geometries,r=TL(n),o=new Map;n.forEach((i,s)=>{if(!i.type||i.type==="null")return;let l=o.get(i.id);l||(l=new Set,o.set(i.id,l));for(let c of r[s]??[]){let d=n[c]?.id;d&&d!==i.id&&l.add(d)}});let a=new Map;for(let[i,s]of o)a.set(i,[...s].sort());return OF.set(t,a),a}function Ev(t){return Zd(t).geometries.map(e=>{let n=jl(t,e);return{type:"Feature",id:e.id,properties:e.properties,geometry:n.geometry}})}function $F(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let i=n[o][0],s=n[o][1],l=n[a][0],c=n[a][1];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function HF(t,e,n){for(let r=0,o=n.length-1;r<n.length;o=r++){let a=n[r][0],i=n[r][1],s=n[o][0],l=n[o][1];if(t<Math.min(a,s)-mp||t>Math.max(a,s)+mp||e<Math.min(i,l)-mp||e>Math.max(i,l)+mp)continue;let c=(s-a)*(e-i)-(l-i)*(t-a);if(Math.abs(c)<=mp)return!0}return!1}function gp(t,e,n){let r=t;if(!r)return!1;let o=r.type==="Polygon"?[r.coordinates]:r.type==="MultiPolygon"?r.coordinates:[];for(let a of o){if(!a.length)continue;if(HF(e,n,a[0]))return!0;if(!$F(e,n,a[0]))continue;let i=!1;for(let s=1;s<a.length;s++)if($F(e,n,a[s])&&!HF(e,n,a[s])){i=!0;break}if(!i)return!0}return!1}function WF(t,e,n){let r=t[0],o=t[1],a=null;for(let s of e)if(gp(s.geometry,r,o)){a={iso:s.id,name:s.properties.name};break}let i=null;if(a?.iso==="US"&&n){for(let s of n)if(gp(s.geometry,r,o)){i={iso:s.id,name:s.properties.name};break}}return{country:a,state:i}}function hp(t,e){let n=Zd(t).geometries.find(a=>a.id===e);if(!n)return null;let r=jl(t,n),o=fs(r);return!o||!Number.isFinite(o[0][0])?null:[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]}function $at(t){let e=t.geometry??t,n=e.type,r=e.coordinates;return n==="Polygon"?[{type:"Feature",geometry:{type:"Polygon",coordinates:r}}]:n==="MultiPolygon"?r.map(o=>({type:"Feature",geometry:{type:"Polygon",coordinates:o}})):[]}function Hat(t,e){let n=Math.max(0,t[0][0]-e[1][0],e[0][0]-t[1][0]),r=Math.max(0,t[0][1]-e[1][1],e[0][1]-t[1][1]);return Math.max(n,r)}function yp(t,e){let n=Zd(t).geometries.find(u=>u.id===e);if(!n)return null;let r=jl(t,n),o=$at(r);if(o.length<=1)return hp(t,e);let a=o.map(u=>{let f=fs(u);if(!f||!Number.isFinite(f[0][0]))return null;let p=f[1][0]<f[0][0];return{bbox:[[f[0][0],f[0][1]],[f[1][0],f[1][1]]],area:DL(u),wraps:p}}).filter(u=>u!==null);if(a.length<=1||a.some(u=>u.wraps))return hp(t,e);let i=Math.max(...a.map(u=>u.area)),s=a.find(u=>u.area===i),l=[[s.bbox[0][0],s.bbox[0][1]],[s.bbox[1][0],s.bbox[1][1]]],c=a.filter(u=>u!==s),d=!0;for(;d;){d=!1;for(let u=c.length-1;u>=0;u--){let f=c[u],p=Hat(f.bbox,l)<=Gat,m=f.area>=Oat*i;(p||m)&&(l[0][0]=Math.min(l[0][0],f.bbox[0][0]),l[0][1]=Math.min(l[0][1],f.bbox[0][1]),l[1][0]=Math.max(l[1][0],f.bbox[1][0]),l[1][1]=Math.max(l[1][1],f.bbox[1][1]),c.splice(u,1),d=!0)}}return l}function ab(t,e){let n=[],r=[];for(let l of t)n.push(l[0][1],l[1][1]),r.push(l[0][0],l[1][0]);for(let[l,c]of e)r.push(l),n.push(c);if(!n.length)return null;let o=Math.min(...n),a=Math.max(...n),{west:i,east:s}=Wat(r);return[[i,o],[s,a]]}function Wat(t){let e=[...new Set(t)].sort((a,i)=>a-i);if(e.length===1)return{west:e[0],east:e[0]};let n=-1,r=-1;for(let a=1;a<e.length;a++){let i=e[a]-e[a-1];i>n&&(n=i,r=a)}return e[0]+360-e[e.length-1]>=n?{west:e[0],east:e[e.length-1]}:{west:e[r],east:e[r-1]+360}}var si,OF,mp,Gat,Oat,Sv=st(()=>{"use strict";_L();ob();si=t=>t.normalize("NFD").replace(/\p{Diacritic}/gu,"").toLowerCase().trim();OF=new WeakMap;mp=1e-9;Gat=10,Oat=.25});var Nv={};ye(Nv,{isSubNationalUsExtent:()=>jF,resolveMap:()=>tit});function jat(t,e){return e?Lv:Math.max(Uat,Math.min(Lv,Lv-Xat*t))}function YF(t){return(t[1][0]-t[0][0])*(t[1][1]-t[0][1])}function jF(t){return t?YF(t)/YF(Kat)<Zat:!1}function vv(t){if(!t)return null;let e=t.toUpperCase();return Qat.has(e)?`US-${e}`:null}function zF(t,e){return t<15||t>72?!1:e>=-180&&e<=-64||e>=172}function UF(t,e){return t>=14&&t<=72&&e>=-141&&e<=-52}function Jat(t){return t[0][0]<=-179&&t[1][0]>=179&&t[0][1]<=-89&&t[1][1]>=89}function tit(t,e){let n=[...t.diagnostics],r=new Set,o={title:t.title,...t.directives.caption!==void 0&&{caption:t.directives.caption},tagGroups:[...t.tagGroups],directives:{...t.directives},basemaps:{world:"detail",subdivisions:[]},regions:[],pois:[],edges:[],routes:[],extent:[[-180,-85],[180,85]],projection:"equirectangular",poiFrameContainers:[],diagnostics:n,error:t.error},a=xv(e.worldCoarse),i=xv(e.usStates),s=[...[...a.values()].map(Z=>Z.name),...[...i.values()].map(Z=>Z.name)],l=t.directives.locale?.toUpperCase(),c=l?l.split("-")[0]:void 0,d=l&&/^[A-Z]{2}-/.test(l)?l:void 0,u=c==="US"||t.regions.some(Z=>{let lt=si(Z.name);return i.has(lt)&&!a.has(lt)})||t.regions.some(Z=>Z.scope==="US"||Z.scope?.startsWith("US-")||vv(Z.scope)!==null)||t.pois.some(Z=>Z.pos.kind==="name"&&(Z.pos.scope?.startsWith("US-")||vv(Z.pos.scope)!==null)),f=[],p=new Map,m=!1,g=!1,h=!1,S=[];for(let Z of t.regions){let lt=si(Z.name),nt=a.get(lt)??(VF[lt]?a.get(VF[lt]):void 0),J=i.get(lt),at=null,it=Z.scope;if(it){let At=it==="US"||it.startsWith("US-");if(At&&J){if(it.startsWith("US-")&&J.id!==it){n.push(Me(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it,iso:J.id}));continue}at={...J,layer:"us-state"}}else if(!At&&nt)at={...nt,layer:"country"};else{n.push(Me(sa.SCOPE_MISS,Z.lineNumber,{name:Z.name,scope:it}));continue}}else nt&&J?u?at={...J,layer:"us-state"}:(at={...nt,layer:"country"},n.push(Me(sa.REGION_AMBIGUOUS,Z.lineNumber,{name:Z.name,layer:at.layer,chosenId:at.id,stateId:J.id,countryId:nt.id}))):J?at={...J,layer:"us-state"}:nt&&(at={...nt,layer:"country"});if(!at){let At=be(Z.name,s);n.push(Me(sa.UNKNOWN_SUBDIVISION,Z.lineNumber,{name:Z.name,hint:At}));continue}at.layer==="us-state"&&(m=!0,at.id==="US-AK"&&(g=!0),at.id==="US-HI"&&(h=!0),S.push({topo:"us",id:at.id}));let Lt={iso:at.id,name:at.name,layer:at.layer,...Z.value!==void 0&&{value:Z.value},...Z.color!==void 0&&{color:Z.color},tags:Z.tags,meta:Z.meta,lineNumber:Z.lineNumber},Tt=p.get(at.id);Tt!==void 0?(n.push(Me(sa.DUPLICATE_REGION,Z.lineNumber,{name:at.name})),f[Tt]=Lt):(p.set(at.id,f.length),f.push(Lt))}let y=new Map,b=[],E=(Z,lt,nt)=>{let J=y.get(Z);if(J){if(lt.implicit&&!J.implicit)return;!lt.implicit&&!J.implicit&&n.push(Me(sa.DUPLICATE_POI,nt,{id:Z}));let at=b.indexOf(J);at>=0&&(b[at]=lt)}else b.push(lt);y.set(Z,lt)},x=(Z,lt,nt,J,at)=>{let it=si(Z),Lt=e.gazetteer.byName[it];if(!Lt?.length){let pt=e.gazetteer.alt[it];pt!==void 0&&(Lt=[pt])}if(!Lt?.length){let pt=e.airports?.airportIata?.[it];if(pt!==void 0){let ut=e.airports.airports[pt];if(ut)return{kind:"ok",lat:ut[0],lon:ut[1],iso:ut[2]}}if(/^[A-Za-z]{3}$/.test(Z)){let ut=Z.toUpperCase();return n.push(Me(sa.UNKNOWN_AIRPORT_CODE,nt,{code:ut})),{kind:"miss"}}let gt=e.gazetteer.cities.map(ut=>ut[4]),dt=be(Z,gt);return n.push(Me(sa.UNKNOWN_PLACE,nt,{name:Z,hint:dt})),{kind:"miss"}}let Tt=Lt.map(pt=>e.gazetteer.cities[pt]),At=lt??J;if(At){let pt=vv(At),gt=/^[A-Za-z]{2}-/.test(At)?At:pt,dt=Tt.filter(ut=>gt?ut[5]===gt:ut[2]===At);if(dt.length)Tt=dt;else if(lt)return n.push(Me(sa.SCOPE_MISS,nt,{name:Z,scope:lt,place:!0})),{kind:"miss"}}if(Tt.length>1){if(!at&&!At)return{kind:"defer"};Tt=[...Tt].sort((pt,gt)=>gt[3]-pt[3]),lt||n.push(Me(sa.AMBIGUOUS_NAME,nt,{name:Z}))}let rt=Tt[0];if(e.airports?.airportIata?.[it]!==void 0&&!r.has(it)){r.add(it);let pt=Z.toUpperCase();n.push(Me(sa.AIRPORT_SHADOWED_BY_CITY,nt,{name:Z,code:pt}))}return{kind:"ok",lat:rt[0],lon:rt[1],iso:rt[2]}},N=(Z,lt)=>lt?si(lt):Z.kind==="coords"?`@${Z.lat},${Z.lon}`:si(Z.name),L=[],A=!1,C=!1,k=Z=>{Z&&(L.push(Z),Z==="US"&&(A=!0),Z!=="US"&&Z!=="CA"&&Z!=="MX"&&(C=!0))},w=[];for(let Z of t.pois){if(Z.pos.kind==="coords"){zF(Z.pos.lat,Z.pos.lon)?A=!0:UF(Z.pos.lat,Z.pos.lon)||(C=!0),_(Z.pos.lat,Z.pos.lon,Z);continue}let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,void 0,!1);lt.kind==="ok"?(k(lt.iso),_(lt.lat,lt.lon,Z)):lt.kind==="defer"&&w.push(Z)}let v=c??eit(f,L)??void 0,M=d??v;for(let Z of w){if(Z.pos.kind!=="name")continue;let lt=x(Z.pos.name,Z.pos.scope,Z.lineNumber,M,!0);lt.kind==="ok"&&(k(lt.iso),_(lt.lat,lt.lon,Z))}function _(Z,lt,nt){let J=N(nt.pos,nt.alias),at=nt.pos.kind==="name"?nt.pos.name:nt.alias,it={id:J,...at!==void 0&&{name:at},lat:Z,lon:lt,...nt.label!==void 0&&{label:nt.label},...nt.color!==void 0&&{color:nt.color},tags:nt.tags,meta:nt.meta,lineNumber:nt.lineNumber};E(J,it,nt.lineNumber)}let T=new Map;for(let Z of b){let lt=Z.name?si(Z.name):void 0;lt&&lt!==Z.id&&!T.has(lt)&&T.set(lt,Z.id)}let R=(Z,lt)=>{let nt=si(Z);if(y.has(nt))return nt;let J=T.get(nt);if(J)return J;let at=x(Z,void 0,lt,v,!0);if(at.kind!=="ok")return null;k(at.iso);let it={id:nt,name:Z,lat:at.lat,lon:at.lon,tags:{},meta:{},lineNumber:lt,implicit:!0};return E(nt,it,lt),nt},O=[];for(let Z of t.edges){let lt=R(Z.from,Z.lineNumber),nt=R(Z.to,Z.lineNumber);!lt||!nt||O.push({fromId:lt,toId:nt,...Z.label!==void 0&&{label:Z.label},directed:Z.directed,style:Z.style,meta:Z.meta,tags:Z.tags,lineNumber:Z.lineNumber})}let I=(Z,lt,nt,J,at,it)=>{let Lt=at!==void 0?{value:at}:{};if(Z.kind==="coords"){let pt=lt?si(lt):`@${Z.lat},${Z.lon}`;return zF(Z.lat,Z.lon)?A=!0:UF(Z.lat,Z.lon)||(C=!0),y.has(pt)||E(pt,{id:pt,...lt!==void 0&&{name:lt},lat:Z.lat,lon:Z.lon,...nt!==void 0&&{label:nt},tags:J,meta:Lt,lineNumber:it},it),pt}let Tt=si(Z.name);if(y.has(Tt))return Tt;let At=T.get(Tt);if(At)return At;let rt=x(Z.name,Z.scope,it,M,!0);return rt.kind!=="ok"?null:(k(rt.iso),E(Tt,{id:Tt,name:Z.name,lat:rt.lat,lon:rt.lon,...nt!==void 0&&{label:nt},tags:J,meta:Lt,lineNumber:it},it),Tt)},H=[];for(let Z of t.routes){let lt=I(Z.origin,Z.originAlias,Z.originLabel,Z.originTags,Z.originValue,Z.lineNumber);if(!lt)continue;let nt=[lt],J=[],at=lt;for(let it of Z.legs){let Lt=I(it.dest,it.destAlias,it.destLabel,{},void 0,it.lineNumber);Lt&&(J.push({fromId:at,toId:Lt,...it.label!==void 0&&{label:it.label},style:it.style,...it.value!==void 0&&{value:it.value},tags:it.tags,lineNumber:it.lineNumber}),nt.includes(Lt)||nt.push(Lt),at=Lt)}H.push({stopIds:nt,legs:J,lineNumber:Z.lineNumber})}let G=m||A||c==="US",D=!C&&!f.some(Z=>Z.layer==="country"&&!["US","CA","MX"].includes(Z.iso))&&G,W=[];(m||D)&&W.push("us-states");let V=[];for(let Z of S){let lt=hp(e.usStates,Z.id);lt&&V.push(lt)}for(let Z of f)if(Z.layer==="country"){let lt=yp(e.worldCoarse,Z.iso);lt&&V.push(lt)}let P=b.map(Z=>[Z.lon,Z.lat]),F=ab(V,P),Y=jF(F),z=c==="US"&&!d,j=[[-180,-85],[180,85]],K=f.length>0?Yat:FF,$=F?XF(F,K):j,U=b.length>0&&f.length===0,X=[];if(U){let Z=Ev(e.worldDetail),lt=Ev(e.usStates),nt=new Set,J=[];for(let it of b){let{country:Lt,state:Tt}=WF([it.lon,it.lat],Z,lt),At=Tt?.iso??Lt?.iso;if(!At||nt.has(At))continue;nt.add(At),X.push(At);let rt=Tt?hp(e.usStates,At):D?null:yp(e.worldCoarse,At);rt&&!Jat(rt)&&J.push(rt)}let at=ab(J,P);at&&($=XF(nit(at,P,D),FF))}if(U||Y&&D){let Z=($[0][0]+$[1][0])/2,lt=($[0][1]+$[1][1])/2,nt=$[1][0]-$[0][0],J=$[1][1]-$[0][1],at=Math.max(nt,J);if(at>0&&at<BF){let it=BF/at,Lt=nt*it/2,Tt=J*it/2;$=[[Z-Lt,lt-Tt],[Z+Lt,lt+Tt]]}}let q=$[1][0]-$[0][0],et=$[1][1]-$[0][1],tt=Math.max(q,et),B=Math.max(Math.abs($[0][1]),Math.abs($[1][1])),Q=D&&Y&&!U&&!g&&!h&&!z,ot;return D&&q<qat&&(U||Q)?ot="mercator":D?ot="albers-usa":tt>Fat||B>Bat?ot="equirectangular":ot="conic-equal-area",q>=180&&($=[[-180,Math.min($[0][1],Vat)],[180,Math.max($[1][1],zat)]]),o.regions=f,o.pois=b,o.edges=O,o.routes=H,o.basemaps={world:"detail",subdivisions:W},o.extent=$,o.projection=ot,o.poiFrameContainers=X,o.error=t.error??rit(n),o}function eit(t,e){let n=new Map;for(let a of t){let i=a.layer==="us-state"?"US":a.iso;n.set(i,(n.get(i)??0)+1)}for(let a of e)n.set(a,(n.get(a)??0)+1);let r,o=0;for(let[a,i]of[...n.entries()].sort((s,l)=>s[0]<l[0]?-1:1))i>o&&(o=i,r=a);return r}function nit(t,e,n){let r=ab([],e);if(!r)return t;let[[o,a],[i,s]]=t,[[l,c],[d,u]]=r,f=jat(Math.max(d-l,u-c),n);a=Math.max(a,c-f),s=Math.min(s,u+f);let p=l-f,m=d+f;return o=o>=-180&&o<=l?Math.max(o,p):p,i=i<=180&&i>=d?Math.min(i,m):m,[[o,a],[i,s]]}function XF(t,e){let n=(t[1][0]-t[0][0])*e||1,r=(t[1][1]-t[0][1])*e||1;return[[Math.max(-180,t[0][0]-n),Math.max(-90,t[0][1]-r)],[Math.min(540,t[1][0]+n),Math.min(90,t[1][1]+r)]]}function rit(t){let e=t.find(n=>n.severity==="error");return e?Ge(e):null}var Fat,Bat,FF,Yat,Vat,zat,BF,Lv,Uat,Xat,qat,Kat,Zat,VF,Qat,Mv=st(()=>{"use strict";un();EL();Sv();Fat=90,Bat=80,FF=.05,Yat=.12,Vat=-58,zat=78,BF=7,Lv=8,Uat=3,Xat=.3;qat=48,Kat=[[-125,25],[-66,49]],Zat=.4;VF={"united states":"united states of america",usa:"united states of america",america:"united states of america",uk:"united kingdom","western sahara":"w. sahara","democratic republic of the congo":"dem. rep. congo","dr congo":"dem. rep. congo",drc:"dem. rep. congo","dominican republic":"dominican rep.","falkland islands":"falkland is.","ivory coast":"cote d'ivoire","central african republic":"central african rep.","equatorial guinea":"eq. guinea","solomon islands":"solomon is.","bosnia and herzegovina":"bosnia and herz.","south sudan":"s. sudan","north macedonia":"macedonia","czech republic":"czechia"},Qat=new Set(["AL","AK","AZ","AR","CA","CO","CT","DE","FL","GA","HI","ID","IL","IN","IA","KS","KY","LA","ME","MD","MA","MI","MN","MS","MO","MT","NE","NV","NH","NJ","NM","NY","NC","ND","OH","OK","OR","PA","RI","SC","SD","TN","TX","UT","VT","VA","WA","WV","WI","WY","DC"])});function ib(t){let e=t.ramp,n=e?{name:e.metric?.trim()||"Value",entries:[],gradient:{min:e.min,max:e.max,low:e.low,high:e.high}}:null,r=t.tagGroups.filter(o=>o.entries.length>0).map(o=>({name:o.name,entries:[...o.entries]}));return[...n?[n]:[],...r]}function sb(t,e){return{groups:t,position:{placement:"top-center",titleRelation:"below-title"},mode:e,showEmptyGroups:!1,showInactivePills:!0}}function qF(t,e){return(t?50:0)+(e?20:0)+oit}function KF(t,e){if(!t)return 0;let n=ib(t);if(n.length===0)return 0;let r=sb(n,e.mode),o={activeGroup:t.activeGroup},{height:a}=kl(r,o,e.width);return a<=0?0:qF(e.hasTitle,e.hasSubtitle)+a+ait}function ZF(t,e){if(!t)return null;let n=ib(t);if(n.length===0)return null;let r=sb(n,e.mode),o={activeGroup:t.activeGroup},{width:a,height:i}=kl(r,o,e.width);return i<=0||a<=0?null:{x:(e.width-a)/2,y:qF(e.hasTitle,e.hasSubtitle),width:a,height:i}}var oit,ait,kv=st(()=>{"use strict";_o();oit=8,ait=10});function QF(t,e){let n=[...t].sort(),r=new Map,o=-1;for(let a of n){let i=new Set;for(let l of e.get(a)??[]){let c=r.get(l);c!==void 0&&i.add(c)}let s=0;for(;i.has(s);)s++;r.set(a,s),s>o&&(o=s)}return{byIso:r,huesNeeded:o+1}}var JF=st(()=>{"use strict"});function Av(t){return t>=90?"world":t>=20?"continental":t>=5?"regional":"local"}function Rv(t,e,n){let r={world:10,continental:9,regional:7,local:6},o=Math.floor(Math.sqrt(Math.max(0,t*e))/105);return Math.max(0,Math.min(o,r[n]))}function fit(t,e,n){switch(n){case"world":return t<=1&&(e==="ocean"||e==="sea");case"continental":return t<=2;case"regional":return t<=3;case"local":return t<=4}}function nB(t,e,n){return!!t&&Number.isFinite(t[0])&&Number.isFinite(t[1])&&t[0]>=0&&t[0]<=e&&t[1]>=0&&t[1]<=n}function Qd(t,e,n=ms){let r=e>0?Math.max(0,t.length-1)*e:0;return Fe(t,n)+r+2*iit}function pit(t,e){let n=t.split(/\s+/).filter(Boolean);if(n.length<=1)return[t];let r=n.length>=4?3:2,o=n.length,a=null;for(let i=0;i<1<<o-1;i++){let s=[],l=[n[0]];for(let u=1;u<o;u++)i&1<<u-1?(s.push(l.join(" ")),l=[n[u]]):l.push(n[u]);if(s.push(l.join(" ")),s.length>r)continue;let c=Math.round(Math.max(...s.map(u=>Qd(u,e)))),d=Qd(s[0],e);(!a||c<a.cost||c===a.cost&&s.length<a.lines.length||c===a.cost&&s.length===a.lines.length&&d>a.head)&&(a={lines:s,cost:c,head:d})}return a?.lines??[t]}function mit(t,e,n,r,o=ms){let a=o+2,i=Math.max(...n.map(l=>Qd(l,r,o))),s=(n.length-1)*a+o+2*_v;return{x:t-i/2,y:e-s/2,w:i,h:s}}function git(t,e,n){return t.x>=0&&t.y>=0&&t.x+t.w<=e&&t.y+t.h<=n}function hit(t,e,n){return t.x-n<e.x+e.w&&t.x+t.w+n>e.x&&t.y-n<e.y+e.h&&t.y+t.h+n>e.y}function iB(t){let{projection:e,dLonSpan:n,dLatSpan:r,width:o,height:a,waterBodies:i,countries:s,palette:l,countryTone:c,waterTone:d,project:u,collides:f,overLand:p}=t,m=Av(Math.max(n,r)),g=Rv(o,a,m);if(g<=0)return[];let h=d??Ot(l.colors.blue,l.textMuted,50),S=c??l.textMuted,y=l.bg,b=[],E=[o/2,a/2];for(let R of i?.entries??[]){let[O,I,H,G,D,W]=R;if(!fit(G,D,m))continue;let V=pit(H,Cv),P=[[I,O]];for(let K of W??[])P.push([K[1],K[0]]);let F=null,Y=1/0,z=null,j=1/0;for(let[K,$]of P){let U=u(K,$);if(!U||!Number.isFinite(U[0])||!Number.isFinite(U[1]))continue;let X=(U[0]-E[0])**2+(U[1]-E[1])**2;X<j&&(j=X,z=U),nB(U,o,a)&&X<Y&&(Y=X,F=U)}if(!F&&G===0&&z){let K=Math.max(0,-z[0],z[0]-o),$=Math.max(0,-z[1],z[1]-a);if(K<=o*tB&&$<=a*tB){let U=Math.max(...V.map(et=>Qd(et,Cv)))/2,X=((V.length-1)*Tv+ms+2*_v)/2,q=lit;F=[Math.min(Math.max(z[0],U+q),o-U-q),Math.min(Math.max(z[1],X+q),a-X-q)]}}F&&b.push({text:H,lines:V,cx:F[0],cy:F[1],italic:!0,letterSpacing:Cv,color:h,fontSize:ms,sort:(G<=1?0:2e3)+G*10+uit[D]})}let x=s.map(R=>{let[O,I,H,G]=R.bbox,D=H-O,W=G-I;return{c:R,w:D,h:W,area:D*W}}).filter(R=>Number.isFinite(R.area)&&R.area>0).sort((R,O)=>O.area-R.area),N=Math.sqrt(Math.max(1,o*a)),L=0;for(let R of x){let{c:O,w:I,h:H,area:G}=R;if(!O.curatedAnchor&&I>o*.66&&H>a*.66||!nB(O.anchor,o,a))continue;let D=Math.sqrt(G)/N,W=Math.min(1,Math.max(0,(D-eB)/(dit-eB))),V=Math.round(ms+W*(cit-ms)),P=S,F=O.name;Qd(F,0,V)>I||V+2*_v>H||b.push({text:F,lines:[F],cx:O.anchor[0],cy:O.anchor[1],italic:!1,letterSpacing:0,color:P,fontSize:V,...O.bordering?{bordering:!0}:{},...O.positions?{positions:O.positions}:{},sort:1e3+L++})}b.sort((R,O)=>R.sort-O.sort);let A=[],C=[],k=b.reduce((R,O)=>R+(!O.italic&&!O.bordering?1:0),0),w=g-Math.min(2,k),v=0,M=0,_=(R,O,I)=>{let H=mit(R,O,I.lines,I.letterSpacing,I.fontSize);if(!git(H,o,a))return null;if(I.italic&&p){let D=O-(I.lines.length-1)/2*Tv;if(I.lines.some((V,P)=>{let F=Qd(V,I.letterSpacing),Y=R-F/2+2,z=R+F/2-2,j=[Y,(Y+R)/2,R,(R+z)/2,z],K=D+P*Tv;return[K,K-ms*.4,K-ms*.8].some($=>j.some(U=>p(U,$)))}))return null}return f(H)||C.some(G=>hit(H,G,sit))?null:H},T=R=>{let O=R.positions??[[R.cx,R.cy]];for(let[I,H]of O){let G=_(I,H,R);if(G)return C.push(G),A.push({x:I,y:H,text:R.text,anchor:"middle",color:R.color,halo:!1,haloColor:y,fontSize:R.fontSize,italic:R.italic,letterSpacing:R.letterSpacing,...R.lines.length>1?{lines:R.lines}:{},lineNumber:0}),!0}return!1};for(let R of b)R.bordering&&T(R);for(let R of b)if(!R.bordering){if(M>=g)break;R.italic&&v>=w||T(R)&&(M++,R.italic&&v++)}return A}var ms,Tv,iit,_v,Cv,sit,lit,tB,cit,eB,dit,rB,oB,aB,uit,sB=st(()=>{"use strict";tn();Tr();ms=11,Tv=ms+2,iit=4,_v=3,Cv=1.5,sit=4,lit=8,tB=.35,cit=22,eB=.06,dit=.32,rB=4,oB=5,aB=3,uit={ocean:0,sea:1,gulf:2,bay:3,strait:4,channel:5,sound:6}});function cB(){let t=lB*lB;return Zy({lineStart(){let e=this;e._has=!1,e._pending=!1,e.stream.lineStart()},point(e,n){let r=this;if(r._lx=e,r._ly=n,r._has){let o=e-r._ex,a=n-r._ey;if(o*o+a*a<t){r._pending=!0;return}}r.stream.point(e,n),r._ex=e,r._ey=n,r._has=!0,r._pending=!1},lineEnd(){let e=this;e._pending&&e.stream.point(e._lx,e._ly),e._pending=!1,e.stream.lineEnd()}})}function Kit(t){let e=Object.keys(t.objects)[0];return t.objects[e]}function Zit(t,e){let n=a=>{let i=a.geometry;return i?i.type==="Polygon"?[i.coordinates]:i.type==="MultiPolygon"?i.coordinates:null:null},r=n(t),o=n(e);return!r||!o?t:{...t,geometry:{type:"MultiPolygon",coordinates:[...r,...o]}}}function Jd(t){let e=xB.get(t);if(e)return e;let n=new Map;for(let r of Kit(t).geometries){let o=jl(t,r);if(!o.geometry)continue;let a={...o,id:r.id},i=n.get(r.id);n.set(r.id,i?Zit(i,a):a)}return xB.set(t,n),n}function Qit(t){let{geometry:e,bounds:n,project:r,width:o,height:a,curated:i}=t,s=n[0][0],l=n[0][1],c=n[1][0],d=n[1][1];if(![s,l,c,d].every(Number.isFinite)||c<=s||d<=l)return Gv(i,r);let u=oB,f=[],p=[];for(let A=0;A<u;A++){f[A]=[];let C=s+(A+.5)/u*(c-s);for(let k=0;k<u;k++){let w=l+(k+.5)/u*(d-l),v=gp(e,C,w);if(f[A][k]=v,!v)continue;let M=r(C,w);!M||!Number.isFinite(M[0])||!Number.isFinite(M[1])||M[0]<0||M[0]>o||M[1]<0||M[1]>a||p.push({i:A,j:k,lon:C,lat:w,sx:M[0],sy:M[1]})}}if(!p.length)return Gv(i,r);let m=p.reduce((A,C)=>A+C.sx,0)/p.length,g=p.reduce((A,C)=>A+C.sy,0)/p.length,h=A=>{let C=0;for(let k=-1;k<=1;k++)for(let w=-1;w<=1;w++){if(k===0&&w===0)continue;let v=A.i+k,M=A.j+w;v>=0&&v<u&&M>=0&&M<u&&f[v][M]&&C++}return C},S=A=>(A.sx-m)**2+(A.sy-g)**2,y=p.reduce((A,C)=>A+C.lon,0)/p.length,b=p.reduce((A,C)=>A+C.lat,0)/p.length,E=r(y,b),x=gp(e,y,b)&&E&&Number.isFinite(E[0])&&Number.isFinite(E[1])&&E[0]>=0&&E[0]<=o&&E[1]>=0&&E[1]<=a?[{lonLat:[y,b],screen:[E[0],E[1]]}]:[],N=[...p].sort((A,C)=>h(C)-h(A)||S(A)-S(C)).map(A=>({lonLat:[A.lon,A.lat],screen:[A.sx,A.sy]}));return[...i?Gv(i,r):[],...x,...N].slice(0,rB)}function Gv(t,e){if(!t)return[];let n=e(t[0],t[1]);return!n||!Number.isFinite(n[0])||!Number.isFinite(n[1])?[]:[{lonLat:[t[0],t[1]],screen:[n[0],n[1]]}]}function nst(t,e){switch(t){case"albers-usa":return Jit();case"conic-equal-area":{let n=e[0][1],r=e[1][1];return cp().parallels([n+(r-n)/6,n+(r-n)*5/6]).center([0,(n+r)/2])}case"mercator":return tb();case"equal-earth":return hv();case"equirectangular":return nb();case"natural-earth":return bv();default:return nb()}}function ast(t,e=!1,n=!1){return Ot(t.colors.blue,t.bg,e?Nit:vit)}function ist(t,e,n=!1){return Ot(t.colors.green,t.bg,e?Lit:Sit)}function bp(t,e){let n=t.basemaps.subdivisions.includes("us-states"),r=(t.projection==="albers-usa"||t.projection==="mercator")&&n&&!!e.naLand,o=r||t.basemaps.world==="detail"?e.worldDetail:e.worldCoarse,a=new Map(Jd(o));if(r&&e.naLand){let[p,m,g,h]=[-140,10,-52,66],S=Jd(e.naLand);for(let[y,b]of S){let E=a.get(y);if(!E)continue;let[[x,N],[L,A]]=fs(E);x>=p&&L<=g&&N>=m&&A<=h&&a.set(y,{...b,properties:E.properties})}}let i=n?Jd(e.usStates):null,s=()=>{let[[p,m],[g,h]]=t.extent,S=16,y=[];for(let b=0;b<=S;b++){let E=b/S,x=p+(g-p)*E,N=m+(h-m)*E;y.push([x,m],[x,h],[p,N],[g,N])}return{type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:y}}},l;if(t.projection==="albers-usa"&&i){l=[...i.entries()].filter(([m])=>!Hv.has(m)).map(([,m])=>m);let p=t.pois.filter(m=>!Ov(m.lon,m.lat)&&!$v(m.lon,m.lat)).map(m=>[m.lon,m.lat]);p.length>0&&l.push({type:"Feature",properties:{},geometry:{type:"MultiPoint",coordinates:p}});for(let m of t.regions)if(m.layer==="country"&&(m.iso==="CA"||m.iso==="MX")){let g=a.get(m.iso);g&&l.push(g)}}else l=[s()];let c={type:"FeatureCollection",features:l},d=nst(t.projection,t.extent);if(t.projection!=="albers-usa"){let p=(t.extent[0][0]+t.extent[1][0])/2;p>180&&(p-=360),d.rotate([-p,0])}let u=fs(c),f=u[1][0]-u[0][0]>=270||u[1][1]-u[0][1]>=130;return{projection:d,fitTarget:c,fitIsGlobal:f,worldLayer:a,usLayer:i,usCrisp:r,wantsUsStates:n,worldTopo:o}}function xp(t){let e=[],n=[],r=/([MLZ])([^MLZ]*)/g,o;for(;o=r.exec(t);){if(o[1]==="Z"){n.length&&e.push(n),n=[];continue}o[1]==="M"&&n.length&&(e.push(n),n=[]);let a=o[2].split(/[ ,]+/).map(Number);for(let i=0;i+1<a.length;i+=2){let s=a[i],l=a[i+1];Number.isFinite(s)&&Number.isFinite(l)&&n.push([s,l])}}return n.length&&e.push(n),e}function sst(t,e,n){let r=xp(t);if(r.length<=1)return t;let o=.75,a=.003*e*n,i=f=>{let p=0;for(let m=0;m<f.length;m++){let g=f[m],h=f[(m+1)%f.length];p+=g[0]*h[1]-h[0]*g[1]}return Math.abs(p)/2},s=r.map(i),l=Math.max(...s),c=(f,p)=>Math.abs(f[0])<=o&&Math.abs(p[0])<=o||Math.abs(f[0]-e)<=o&&Math.abs(p[0]-e)<=o,d=!1,u=r.filter((f,p)=>s[p]>=l||s[p]>=a?!0:f.some((g,h)=>c(g,f[(h+1)%f.length]))?(d=!0,!1):!0);return d?u.map(f=>f.map((p,m)=>(m?"L":"M")+p[0]+","+p[1]).join("")+"Z").join(""):t}function lst(t,e,n,r){if(t.projection!=="albers-usa"||!t.basemaps.subdivisions.includes("us-states")||!(n>0)||!(r>0))return!1;let o=t.regions.some(p=>p.iso==="US-AK")||t.pois.some(p=>Ov(p.lon,p.lat)),a=t.regions.some(p=>p.iso==="US-HI")||t.pois.some(p=>$v(p.lon,p.lat));if(o||a)return!1;let{projection:i,fitTarget:s,usLayer:l}=bp(t,e);if(!l||![...l.keys()].some(p=>!Hv.has(p)))return!1;i.fitSize([1e3,1e3],s);let c=Wa(i).bounds(s),d=(c[1][0]-c[0][0])/(c[1][1]-c[0][1]);if(!(d>0))return!1;let u=n/r;return Math.max(u/d,d/u)>yit}function dst(t,e){let n=wB.get(t);n||(n=new Map,wB.set(t,n));let r=n.get(e);if(!r&&(r=new Map,n.set(e,r),n.size>cst)){let o=n.keys().next().value;o!==void 0&&n.delete(o)}return r}function Wv(t,e,n,r){let{palette:o,isDark:a}=r,{width:i,height:s}=n,l=t;lst(l,e,i,s)&&(l={...l,projection:"conic-equal-area"});let{projection:c,fitTarget:d,fitIsGlobal:u,worldLayer:f,usLayer:p,usCrisp:m,worldTopo:g}=bp(l,e),h=p!==null,S=a?Ot(o.border,o.text,65):Ot(o.text,o.bg,78),y=l.regions.filter(mt=>mt.value!==void 0).map(mt=>mt.value),b=y.length>0?Math.min(...y):0,E=Math.max(...y),x=On(l.directives.regionMetricColor??"",o)??o.colors.red,N=l.directives.regionMetricLowColor?On(l.directives.regionMetricLowColor,o)??void 0:void 0,L=y.length>0,A=L?l.directives.regionMetric?.trim()||"Value":null,C=mt=>{let St=mt.trim().toLowerCase();if(St==="none")return null;if(St===A?.toLowerCase())return A;let Bt=l.tagGroups.find(kt=>kt.name.toLowerCase()===St);return Bt?Bt.name:mt},k=new Set;for(let mt of l.tagGroups){let St=mt.name.toLowerCase();(l.regions.some(Bt=>Bt.tags[St])||l.pois.some(Bt=>Bt.tags[St]))&&k.add(mt.name)}let w=l.tagGroups.find(mt=>k.has(mt.name))?.name??null,v=r.activeGroup,M;v!==void 0?M=v===null?null:C(v):l.directives.activeTag!==void 0?M=C(l.directives.activeTag):M=A??w??l.tagGroups[0]?.name??null;let _=A!==null&&M===A,T=_||M!==null&&k.has(M),R=ist(o,a,T),O=ast(o,a,T),I=Ot(S,O,45),H=Ot(o.colors.gray,o.bg,T?a?Bit:Fit:a?Wit:Hit),G=(mt,...St)=>{let Bt=kt=>St.every(Jt=>gl(kt,Jt)>=pB);if(Bt(mt))return mt;for(let kt=10;kt<=100;kt+=10){let Jt=Ot(o.text,mt,kt);if(Bt(Jt))return Jt}return o.text},D=G(o.textMuted,R,O),W=G(Ot(o.colors.blue,o.textMuted,50),O,R),V=l.regions.some(mt=>mt.color!==void 0),P=l.directives.noColorize!==!0&&!L&&!V&&k.size===0,F=new Map;if(P){let mt=new Map,St=re=>{for(let[pe,ce]of re){let ke=mt.get(pe);ke?ke.push(...ce):mt.set(pe,[...ce])}};if(St(wv(g)),p){St(wv(e.usStates));for(let[re,pe]of Object.entries(ost)){let ce=mt.get(re);if(ce)for(let ke of pe){let $e=mt.get(ke);$e&&(ce.push(ke),$e.push(re))}}}let{byIso:Bt,huesNeeded:kt}=QF([...mt.keys()],mt),Jt=Lk(o,kt,a);for(let[re,pe]of Bt)F.set(re,Jt[pe])}let Y=mt=>Ot(mt,o.text,35),z=a?Ot(o.surface,o.text,28):o.bg,j=Ot(x,z,Pv),K=mt=>{let St=E>b?(mt-b)/(E-b):1;if(N!==void 0)return Kp(N,x,St,{isDark:a});let Bt=Pv+Math.max(0,Math.min(1,St))*(100-Pv);return Ot(x,z,Bt)},$=(mt,St)=>{if(!St)return null;let Bt=l.tagGroups.find(re=>re.name.toLowerCase()===St.toLowerCase());if(!Bt)return null;let kt=mt[qt(Bt.name)]??Bt.defaultValue;if(!kt)return null;let Jt=Bt.entries.find(re=>re.value.toLowerCase()===kt.toLowerCase());return Jt?.color?Ot(Jt.color,o.bg,a?gB:mB):null},U=mt=>{let St=mt?On(mt,o):null;return St?Ot(St,o.bg,a?gB:mB):null},X=mt=>{let St=U(mt.color);return St||(_?mt.value!==void 0?K(mt.value):R:P?(mt.iso&&F.get(mt.iso))??R:$(mt.tags,M)??R)},q=new Map(l.regions.map(mt=>[mt.iso,mt])),et=null;if(!l.directives.noLegend){let mt=l.tagGroups.map(St=>({name:St.name,entries:St.entries.map(Bt=>({value:Bt.value,color:Bt.color}))}));(mt.length>0||L)&&(et={tagGroups:mt,activeGroup:M,...L&&{ramp:{...l.directives.regionMetric!==void 0&&{metric:l.directives.regionMetric},min:b,max:E,low:N??j,high:x}}})}let tt=l.directives.noTitle?null:l.title,B=16,Q=Go;if(tt&&l.pois.length>0){let mt=(l.subtitle?50:30)+20/2;Q=Math.max(Go,mt+B)}let ot=KF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});ot>Q&&(Q=ot);let Z=[];if(tt){let mt=l.subtitle?2:1,St=Math.max(Fe(tt,20),l.subtitle?Fe(l.subtitle,20):0)+40;Z.push({x:i/2-St/2,y:10,w:St,h:20*(mt+.5)})}let lt=ZF(et,{width:i,mode:r.legendMode??"preview",hasTitle:!!tt,hasSubtitle:!!l.subtitle});lt&&Z.push({x:lt.x,y:lt.y,w:lt.width,h:lt.height});let nt=r._calloutReserve,J=Go+(nt?.left??0),at=i-Go-(nt?.right??0),it=Q+(nt?.top??0),Lt=s-Go-(nt?.bottom??0),Tt=[[J,it],[Math.max(J+1,at),Math.max(it+1,Lt)]];if(c.fitExtent(Tt,d),!u&&l.projection!=="albers-usa"&&l.regions.length>0){let mt=1/0,St=-1/0;for(let Bt of l.regions){let kt=Bt.iso?yp(e.worldCoarse,Bt.iso):null;if(kt)for(let Jt of[kt[0][0],kt[1][0]])for(let re of[kt[0][1],kt[1][1]]){let pe=c([Jt,re]);pe&&Number.isFinite(pe[1])&&(pe[1]<mt&&(mt=pe[1]),pe[1]>St&&(St=pe[1]))}}if(mt<St){let Bt=it,kt=Lt,Jt=(Bt+kt)/2-(mt+St)/2,re=Bt-mt,pe=kt-St;re<=pe&&(Jt=Math.max(re,Math.min(pe,Jt)));let[ce,ke]=c.translate();c.translate([ce,ke+Jt])}}if(!u&&l.projection==="albers-usa"){let mt=Wa(c).bounds(d);if(Number.isFinite(mt[0][1])){let St=Lt-it-(mt[1][1]-mt[0][1]);if(St>0){let Bt=mt[0][1]-it,kt=St*.3-Bt,[Jt,re]=c.translate();c.translate([Jt,re+kt])}}}let At,rt,pt=null;if(u&&!r.preferContain){let mt=Wa(c).bounds(d),St=mt[0][0],Bt=mt[0][1],kt=mt[1][0]-St,Jt=mt[1][1]-Bt,re=l.title&&l.pois.length>0||ot>0?Q:0,pe=0,ce=re,ke=kt>0?i/kt:1,$e=Jt>0?(s-re)/Jt:1;pt={sx:ke,sy:$e,ox:pe,oy:ce,bx0:St,by0:Bt};let ct=(Yt,Et)=>[pe+(Yt-St)*ke,ce+(Et-Bt)*$e],ht=c,wt=Zy({point(Yt,Et){let[Ft,Kt]=ct(Yt,Et);this.stream.point(Ft,Kt)}}),Ct=cB();At=Wa({stream:Yt=>ht.stream(wt.stream(Ct.stream(Yt)))}).digits(Iv),rt=(Yt,Et)=>{let Ft=ht([Yt,Et]);return Ft?ct(Ft[0],Ft[1]):null}}else{c.clipExtent([[0,0],[i,s]]);let mt=cB();At=Wa({stream:St=>c.stream(mt.stream(St))}).digits(Iv),rt=(St,Bt)=>c([St,Bt])??null}let gt=dst(t,JSON.stringify([i,s,[[-100,40],[-120,37],[-80,40],[0,0],[60,30],[-60,-30],[150,60],[-150,-60],[100,-40],[-30,50]].map(([mt,St])=>rt(mt,St))])),dt=[],ut=[],yt=[],vt=l.regions.some(mt=>mt.iso==="US-AK")||l.pois.some(mt=>Ov(mt.lon,mt.lat)),Gt=l.regions.some(mt=>mt.iso==="US-HI")||l.pois.some(mt=>$v(mt.lon,mt.lat));if(l.projection==="albers-usa"&&p&&(vt||Gt)){let Bt=s-Go,kt=8,Jt=new Map,re=(ht,wt)=>{let Ct=c([ht,wt]);if(!Ct)return;let Yt=Math.floor(Ct[0]/kt),Et=Jt.get(Yt);(Et===void 0||Ct[1]>Et)&&Jt.set(Yt,Ct[1])},pe=ht=>{if(Array.isArray(ht)&&typeof ht[0]=="number")re(ht[0],ht[1]);else if(Array.isArray(ht))for(let wt of ht)pe(wt)};for(let[ht,wt]of p)Hv.has(ht)||pe(wt.geometry.coordinates);let ce=ht=>{let wt=Math.floor(ht/kt),Ct=-1/0;for(let Yt=wt-1;Yt<=wt+1;Yt++){let Et=Jt.get(Yt);Et!==void 0&&Et>Ct&&(Ct=Et)}return Ct},ke=(ht,wt)=>{let Yt=-1/0;for(let Et=0;Et<=24;Et++){let Ft=ce(ht+(wt-ht)*Et/24);Ft>Yt&&(Yt=Ft)}return Yt},$e=(ht,wt,Ct,Yt)=>{let Et=p.get(ht);if(!Et)return Ct;let Ft=Ct,Kt=Math.min(Yt,i-Go-Ft-16);if(Kt<24)return Ct;let ue=Ft+Kt+16,_e=ke(Ft,ue),ve=_e>-1/0?_e+12:Bt-s*.42;wt.fitWidth(Kt,Et);let Re=Wa(wt).bounds(Et),sn=(Number.isFinite(Re[0][0])?Re[1][1]-Re[0][1]:Kt)+16,Pe=ve,qe=Math.min(Pe+sn,Bt);qe-Pe<sn&&(Pe=qe-sn),wt.fitExtent([[Ft+8,Pe+8],[ue-8,qe-8]],Et);let Ae=Wa(wt).digits(Iv),Ze=Ae(Et)??"";if(!Ze)return ue;let Oe;if(ht==="US-AK"){let Ir=f.get("CA"),zo=Ir?Ae(Ir)??"":"";zo&&(Oe={d:zo,fill:P?F.get("CA")??H:H})}let Ke=q.get(ht),De=P?F.get(ht)??R:R,En=-1;Ke?.layer==="us-state"&&(De=X(Ke),En=Ke.lineNumber),dt.push({x:Ft,y:Pe,w:ue-Ft,h:qe-Pe,points:[[Ft,Pe],[ue,Pe],[ue,qe],[Ft,qe]],projection:wt,...Oe&&{contextLand:Oe}}),ut.push({id:ht,d:Ze,fill:De,stroke:P?Y(De):S,lineNumber:En,layer:"us-state",...Ke?.value!==void 0&&{value:Ke.value},...Ke&&Object.keys(Ke.tags).length>0&&{tags:Ke.tags}});let Tn=Wa(wt).centroid(Et);if(Number.isFinite(Tn[0])){let Ir=Et.properties?.name??ht;yt.push({x:Tn[0],y:Tn[1],iso:ht,name:Ir,lineNumber:En})}return ue},ct=Go;vt&&(ct=$e("US-AK",tst(),Go,i*.18)),Gt&&$e("US-HI",est(),vt?ct+24:Go,i*.12)}let Xt=l.projection==="albers-usa"&&!!p,bt=Xt?fs(d):l.extent,Mt=bt[1][0]-bt[0][0],zt=bt[1][1]-bt[0][1],xt=Mt>=270||zt>=130,Nt=(bt[0][0]+bt[1][0])/2,Dt=mt=>{let St=mt;for(;St<Nt-180;)St+=360;for(;St>Nt+180;)St-=360;return St},Vt=mt=>{let St=1/0,Bt=-1/0,kt=1/0,Jt=-1/0,re=[];for(let[Ct]of mt){let Yt=Dt(Ct);re.push(Yt),Yt<St&&(St=Yt),Yt>Bt&&(Bt=Yt),Ct<kt&&(kt=Ct),Ct>Jt&&(Jt=Ct)}re.sort((Ct,Yt)=>Ct-Yt);let pe=0;for(let Ct=1;Ct<re.length;Ct++)pe=Math.max(pe,re[Ct]-re[Ct-1]);re.length>1&&(pe=Math.max(pe,re[0]+360-re[re.length-1]));let ce=360-pe;if(ce>270||Jt-kt>180&&ce<90)return!1;let ke=1/0,$e=1/0,ct=-1/0,ht=-1/0,wt=!1;for(let[Ct,Yt]of mt){let Et=rt(Ct,Yt);!Et||!Number.isFinite(Et[0])||!Number.isFinite(Et[1])||(wt=!0,Et[0]<ke&&(ke=Et[0]),Et[0]>ct&&(ct=Et[0]),Et[1]<$e&&($e=Et[1]),Et[1]>ht&&(ht=Et[1]))}return wt?!(ct<0||ke>i||ht<0||$e>s):!1},$t=mt=>{if(xt)return mt;let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Bt=St.coordinates[0];return Vt(Bt)?mt:null}if(St.type==="MultiPolygon"){let Bt=St.coordinates,kt=Bt.filter(Jt=>Vt(Jt[0]));return kt.length?kt.length===Bt.length?mt:{...mt,geometry:{...St,coordinates:kt}}:null}return mt},ft=100,Wt=mt=>{let St=mt.map(([ce])=>ce).sort((ce,ke)=>ce-ke);if(St.length<2)return!1;let Bt=-1,kt=0;for(let ce=1;ce<St.length;ce++){let ke=St[ce]-St[ce-1];ke>Bt&&(Bt=ke,kt=ce)}if(St[0]+360-St[St.length-1]>=Bt)return!1;let re=360-Bt;return St[kt-1]+360>180&&re<ft},ge=mt=>{let St=mt.geometry;if(!St)return mt;if(St.type==="Polygon"){let Bt=St.coordinates[0];return Wt(Bt)?null:mt}if(St.type==="MultiPolygon"){let Bt=St.coordinates,kt=Bt.filter(Jt=>!Wt(Jt[0]));return kt.length?kt.length===Bt.length?mt:{...mt,geometry:{...St,coordinates:kt}}:null}return mt},ne=[],se=(mt,St,Bt)=>{for(let[kt,Jt]of mt){if(St==="us-state"&&h&&l.projection==="albers-usa"&&rst.has(kt)||St==="country"&&h&&kt==="US"||St==="country"&&kt==="AQ"&&!q.has("AQ"))continue;let re=q.get(kt),pe=St+":"+kt,ce=gt.get(pe);if(ce===void 0){let Kt=Bt?$t(Jt):ge(Jt);if(!Kt){gt.set(pe,null);continue}let ue=At(Kt)??"",_e=u?sst(ue,i,s):ue;if(!_e){gt.set(pe,null);continue}let ve=Dv[kt],Re=ve?rt(ve[0],ve[1]):At.centroid(Kt),Xe=Re!=null&&Number.isFinite(Re[0])&&Number.isFinite(Re[1]);ce={d:_e,cx:Xe?Re[0]:void 0,cy:Xe?Re[1]:void 0},gt.set(pe,ce)}else if(ce===null)continue;let ke=ce.d,$e=ce.cx!==void 0&&ce.cy!==void 0,ct=re?.layer===St,wt=St==="country"&&h&&kt!=="US"?H:R,Ct=P?F.get(kt)??wt:wt,Yt,Et=-1,Ft="base";ct?(Ct=X(re),Et=re.lineNumber,Ft=St,Yt=re.name):Yt=Jt.properties?.name,ne.push({id:kt,d:ke,fill:Ct,stroke:P?Y(Ct):S,lineNumber:Et,layer:Ft,...Yt!==void 0&&{label:Yt},...$e&&{labelX:ce.cx,labelY:ce.cy},...ct&&re.value!==void 0&&{value:re.value},...ct&&Object.keys(re.tags).length>0&&{tags:re.tags}})}};se(f,"country",!xt),p&&se(p,"us-state",!Xt&&!xt);let Zt=m&&e.naLakes?e.naLakes:e.lakes;if(Zt)for(let[,mt]of Jd(Zt)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At(St)??"";Bt&&ne.push({id:"lake",d:Bt,fill:O,stroke:I,lineNumber:-1,layer:"base"})}let Ie=(mt,St,Bt)=>{let kt=!1;for(let Jt of Bt)for(let re=0,pe=Jt.length-1;re<Jt.length;pe=re++){let[ce,ke]=Jt[re],[$e,ct]=Jt[pe];ke>St!=ct>St&&mt<($e-ce)*(St-ke)/(ct-ke)+ce&&(kt=!kt)}return kt},Ht=[...ne,...ut].map(mt=>{let St=xp(mt.d),Bt=1/0,kt=1/0,Jt=-1/0,re=-1/0;for(let pe of St)for(let ce of pe)ce[0]<Bt&&(Bt=ce[0]),ce[0]>Jt&&(Jt=ce[0]),ce[1]<kt&&(kt=ce[1]),ce[1]>re&&(re=ce[1]);return mt.bbox=[Bt,kt,Jt,re],mt.rings=St,{fill:mt.fill,rings:St,minX:Bt,minY:kt,maxX:Jt,maxY:re}}),Qt=(mt,St)=>{let Bt=O;for(let kt of Ht)mt<kt.minX||mt>kt.maxX||St<kt.minY||St>kt.maxY||Ie(mt,St,kt.rings)&&(Bt=kt.fill);return Bt},Ut=mt=>{let St=gl(mt,o.textOnFillDark)>=gl(mt,o.textOnFillLight)?o.textOnFillDark:o.textOnFillLight,Bt=St===o.textOnFillLight?o.textOnFillDark:o.textOnFillLight;return{color:St,halo:gl(mt,St)<pB,haloColor:Bt}},fe=l.directives.noRelief!==!0,de=[],te=null;if(fe&&e.mountainRanges){for(let[,mt]of Jd(e.mountainRanges)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At.area(St);if(!Number.isFinite(Bt)||Bt<Tit)continue;let kt=At.bounds(St);if(kt[1][0]-kt[0][0]<hB||kt[1][1]-kt[0][1]<hB)continue;let Jt=At(St)??"";Jt&&de.push({d:Jt})}if(de.length){let mt=a?o.bg:o.text,St=a?o.text:o.bg,Bt=P?a?o.surface:o.bg:R,kt=Ss(Bt),Jt=Math.abs(kt-Ss(mt))>.04?mt:St;te={color:Ot(Jt,Bt,Ait),spacing:Cit,width:_it}}}let ae=null;if(l.directives.noCoastline!==!0){let mt=Math.min(i,s);ae={color:Ot(S,O,$it),lines:Array.from({length:yB},(St,Bt)=>({d:(Rit+Bt*Iit)*mt,thickness:Pit*mt,opacity:bB+(Dit-bB)*Bt/(yB-1)})),minExtent:(xt?Oit:Git)*mt}}let Te=Ot(o.colors.blue,O,32),Je=[];if(e.rivers)for(let[,mt]of Jd(e.rivers)){let St=xt?ge(mt):$t(mt);if(!St)continue;let Bt=At(St)??"";Bt&&Je.push({d:Bt,color:Te,width:Mit})}let ln=l.pois.map(mt=>Number(mt.meta.size)).filter(mt=>Number.isFinite(mt)&&mt>0),Ve=ln.length?Math.min(...ln):0,Ce=ln.length?Math.max(...ln):0,ee=mt=>{let St=Number(mt.meta.size);if(!Number.isFinite(St)||St<=0||Ce<=0)return bit;let Bt=Ce>Ve?(Math.sqrt(St)-Math.sqrt(Ve))/(Math.sqrt(Ce)-Math.sqrt(Ve)):1;return lb+Math.max(0,Math.min(1,Bt))*(dB-lb)},oe=mt=>{let St=Math.max(0,Math.min(1,(mt-lb)/(dB-lb)));return uB-St*(uB-xit)},Be=mt=>{let St=mt.color?On(mt.color,o):null;if(St)return{fill:St,stroke:Ot(St,o.text,18)};for(let Bt of l.tagGroups){let kt=mt.tags[qt(Bt.name)];if(!kt)continue;let re=Bt.entries.find(pe=>pe.value.toLowerCase()===kt.toLowerCase())?.color;if(re)return{fill:re,stroke:Ot(re,o.text,18)}}return{fill:o.colors.orange,stroke:Ot(o.colors.orange,o.text,18)}},fn=mt=>{for(let St of l.tagGroups){let Bt=mt[qt(St.name)];if(!Bt)continue;let kt=St.entries.find(Jt=>Jt.value.toLowerCase()===Bt.toLowerCase());if(kt?.color)return kt.color}return null},An=new Map,We=new Set;for(let mt of l.routes)mt.stopIds.forEach((St,Bt)=>{Bt===0&&We.add(St),An.has(St)||An.set(St,Bt+1)});let kn=new Map,Kn=[],xo=[...l.pois].sort((mt,St)=>mt.lineNumber-St.lineNumber||(mt.id<St.id?-1:1)),Lr=[];for(let mt of xo){let St=rt(mt.lon,mt.lat);St&&Lr.push({p:mt,xy:St})}let Rn=(mt,St,Bt,kt)=>{let{fill:Jt,stroke:re}=Be(mt.p),pe=ee(mt.p);kn.set(mt.p.id,{cx:St,cy:Bt,r:pe});let ce=An.get(mt.p.id);Kn.push({id:mt.p.id,cx:St,cy:Bt,r:pe,fill:Jt,fillOpacity:oe(pe),stroke:re,lineNumber:mt.p.lineNumber,implicit:!!mt.p.implicit,isOrigin:We.has(mt.p.id),...ce!==void 0&&{routeNumber:ce},...Object.keys(mt.p.tags).length>0&&{tags:mt.p.tags},...kt!==void 0&&{clusterId:kt}})},Dn=[],Rr=new Set;for(let mt of l.edges)Rr.add(mt.fromId),Rr.add(mt.toId);for(let mt of l.routes)mt.stopIds.forEach(St=>Rr.add(St));let dr=mt=>ee(mt.p);for(let mt of Lr)Rr.has(mt.p.id)&&Rn(mt,mt.xy[0],mt.xy[1]);let Ur=[];for(let mt of Lr){if(Rr.has(mt.p.id))continue;let St=dr(mt),Bt=Ur.find(kt=>kt.some(Jt=>Math.hypot(Jt.xy[0]-mt.xy[0],Jt.xy[1]-mt.xy[1])<(St+dr(Jt))*zit));Bt?Bt.push(mt):Ur.push([mt])}for(let mt of Ur){if(mt.length===1){Rn(mt[0],mt[0].xy[0],mt[0].xy[1]);continue}let St=mt[0].p.id,Bt=mt.reduce((Et,Ft)=>Et+Ft.xy[0],0)/mt.length,kt=mt.reduce((Et,Ft)=>Et+Ft.xy[1],0)/mt.length,Jt=Math.max(...mt.map(dr)),re=2*Jt+Xit,pe=Math.max(Yit,re/(2*Math.sin(Math.PI/Math.max(mt.length,2)))),ce=mt.map((Et,Ft)=>{if(mt.length<=Uit){let _e=-Math.PI/2+Ft*2*Math.PI/mt.length;return{e:Et,mx:Bt+Math.cos(_e)*pe,my:kt+Math.sin(_e)*pe}}let Kt=Ft*Vit,ue=pe*Math.sqrt((Ft+1)/mt.length);return{e:Et,mx:Bt+Math.cos(Kt)*ue,my:kt+Math.sin(Kt)*ue}}),ke=Bt-Jt,$e=Bt+Jt,ct=kt-Jt,ht=kt+Jt;for(let{mx:Et,my:Ft,e:Kt}of ce){let ue=dr(Kt);ke=Math.min(ke,Et-ue),$e=Math.max($e,Et+ue),ct=Math.min(ct,Ft-ue),ht=Math.max(ht,Ft+ue)}let wt=0,Ct=0;ke+wt<2&&(wt=2-ke),$e+wt>i-2&&(wt=i-2-$e),ct+Ct<2&&(Ct=2-ct),ht+Ct>s-2&&(Ct=s-2-ht);let Yt=[];for(let{e:Et,mx:Ft,my:Kt}of ce){let ue=Ft+wt,_e=Kt+Ct;Rn(Et,ue,_e,St),Yt.push({x2:ue,y2:_e,color:Be(Et.p).fill})}Dn.push({id:St,cx:Bt+wt,cy:kt+Ct,count:mt.length,hitR:pe+Jt+6,legs:Yt})}let Jn=[],io=1.5,Oo=(mt,St,Bt,kt,Jt,re,pe)=>{if(Jt!==0)return Jt;let ce=re*qit;return pe&&Bt*(mt-pe.x)+kt*(St-pe.y)<0?-ce:ce},rc=(mt,St,Bt,kt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2,ce=St.cx-mt.cx,ke=St.cy-mt.cy,$e=Math.hypot(ce,ke)||1,ct=Math.min(mt.r+io,$e*.45),ht=Math.min(St.r+io,$e*.45);if(!Bt&&kt===0){let sn=ce/$e,Pe=ke/$e,qe=mt.cx+sn*ct,Ae=mt.cy+Pe*ct,Ze=St.cx-sn*ht,Oe=St.cy-Pe*ht;return`M${qe},${Ae}L${Ze},${Oe}`}let wt=-ke/$e,Ct=ce/$e,Yt=Oo(re,pe,wt,Ct,kt,$e,Jt),Et=re+wt*Yt,Ft=pe+Ct*Yt,Kt=Math.hypot(Et-mt.cx,Ft-mt.cy)||1,ue=Math.hypot(St.cx-Et,St.cy-Ft)||1,_e=mt.cx+(Et-mt.cx)/Kt*ct,ve=mt.cy+(Ft-mt.cy)/Kt*ct,Re=St.cx-(St.cx-Et)/ue*ht,Xe=St.cy-(St.cy-Ft)/ue*ht;return`M${_e},${ve}Q${Et},${Ft} ${Re},${Xe}`},ci=(mt,St,Bt,kt,Jt)=>{let re=(mt.cx+St.cx)/2,pe=(mt.cy+St.cy)/2;if(!Bt&&kt===0)return{x:re,y:pe-4};let ce=St.cx-mt.cx,ke=St.cy-mt.cy,$e=Math.hypot(ce,ke)||1,ct=-ke/$e,ht=ce/$e,wt=Oo(re,pe,ct,ht,kt,$e,Jt),Ct=wt*.5+Math.sign(wt||1)*8;return{x:re+ct*Ct,y:pe+ht*Ct}},Mo=l.routes.flatMap(mt=>mt.legs).map(mt=>Number(mt.value)).filter(mt=>Number.isFinite(mt)&&mt>0),pa=Mo.length?Math.min(...Mo):0,ma=Mo.length?Math.max(...Mo):0,di=mt=>{if(!Number.isFinite(mt)||mt<=0||ma<=0)return tc;let St=ma>pa?(mt-pa)/(ma-pa):1;return tc+St*(fB-tc)};for(let mt of l.routes){let St=mt.stopIds.map(kt=>kn.get(kt)).filter(kt=>!!kt),Bt=St.length>=3?{x:St.reduce((kt,Jt)=>kt+Jt.cx,0)/St.length,y:St.reduce((kt,Jt)=>kt+Jt.cy,0)/St.length}:void 0;for(let kt of mt.legs){let Jt=kn.get(kt.fromId),re=kn.get(kt.toId);if(!Jt||!re)continue;let pe=ci(Jt,re,kt.style==="arc",0,Bt),ce={curved:kt.style==="arc",offset:0,center:Bt,labelX:pe.x,labelY:pe.y},ke=kt.label!==void 0?Ut(Qt(ce.labelX,ce.labelY)):void 0,$e=Number(kt.value);Jn.push({d:rc(Jt,re,ce.curved,ce.offset,ce.center),width:di($e),color:fn(kt.tags)??Ot(o.text,o.bg,72),arrow:!0,fromId:kt.fromId,toId:kt.toId,...Number.isFinite($e)&&$e>0&&{value:$e},...Object.keys(kt.tags).length>0&&{tags:kt.tags},lineNumber:kt.lineNumber,...kt.label!==void 0&&{label:kt.label,labelX:ce.labelX,labelY:ce.labelY,labelColor:ke.color,labelHalo:ke.halo,labelHaloColor:ke.haloColor}})}}let ga=l.edges.map(mt=>Number(mt.meta.width)).filter(mt=>Number.isFinite(mt)&&mt>0),ui=ga.length?Math.min(...ga):0,fi=ga.length?Math.max(...ga):0,cl=mt=>{let St=Number(mt.meta.width);if(!Number.isFinite(St)||St<=0||fi<=0)return tc;let Bt=fi>ui?(St-ui)/(fi-ui):1;return tc+Bt*(fB-tc)},Ya=new Map;for(let mt of l.edges){let St=[mt.fromId,mt.toId].sort().join(" "),Bt=Ya.get(St);Bt?Bt.push(mt):Ya.set(St,[mt])}for(let mt of Ya.values()){let St=[...mt].sort((kt,Jt)=>kt.lineNumber-Jt.lineNumber),Bt=St.length;St.forEach((kt,Jt)=>{let re=kn.get(kt.fromId),pe=kn.get(kt.toId);if(!re||!pe)return;let ce=Bt>1?(Jt-(Bt-1)/2)*jit:0,ke=kt.style==="arc"||Bt>1,$e=ci(re,pe,ke,ce),ct={curved:ke,offset:ce,labelX:$e.x,labelY:$e.y},ht=kt.label!==void 0?Ut(Qt(ct.labelX,ct.labelY)):void 0,wt=Number(kt.meta.width);Jn.push({d:rc(re,pe,ct.curved,ct.offset),width:cl(kt),color:fn(kt.tags)??Ot(o.text,o.bg,66),arrow:kt.directed,fromId:kt.fromId,toId:kt.toId,...Number.isFinite(wt)&&wt>0&&{value:wt},...Object.keys(kt.tags).length>0&&{tags:kt.tags},lineNumber:kt.lineNumber,...kt.label!==void 0&&{label:kt.label,labelX:ct.labelX,labelY:ct.labelY,labelColor:ht.color,labelHalo:ht.halo,labelHaloColor:ht.haloColor}})})}let vr=[],ha=[...Z],hs=[],Fi=Kn.map(mt=>({cx:mt.cx,cy:mt.cy,r:mt.r})),ou=[];for(let mt of Jn){let St=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(mt.d);if(!St)continue;let Bt=+St[1],kt=+St[2];if(St[3]!==void 0)ou.push([Bt,kt,+St[3],+St[4]]);else{let Jt=+St[5],re=+St[6],pe=+St[7],ce=+St[8],ke=8,$e=Bt,ct=kt;for(let ht=1;ht<=ke;ht++){let wt=ht/ke,Ct=1-wt,Yt=Ct*Ct*Bt+2*Ct*wt*Jt+wt*wt*pe,Et=Ct*Ct*kt+2*Ct*wt*re+wt*wt*ce;ou.push([$e,ct,Yt,Et]),$e=Yt,ct=Et}}}let Bi=mt=>Fi.some(St=>Wu(mt,St))||ha.some(St=>Ea(mt,St))||ou.some(St=>w0(St[0],St[1],St[2],St[3],mt)),pi=l.directives.noRegionLabels!==!0,mi=new Set,to=l.directives.noRegionValue!==!0&&_,au=mt=>to&&mt!==void 0?Im(mt):void 0,oc=i<kit,Yi=l.projection==="mercator"&&l.basemaps.subdivisions.includes("us-states")&&_,iu=6,ac=3,yr=1,ya=(mt,St=xr)=>Fe(mt,St)+2*iu,$o=xr+2*ac,ys=(mt,St,Bt=xr)=>Math.max(ya(mt,Bt),St?Fe(St,Math.round(Bt*.82))+2*iu:0),su=(mt,St=xr)=>{let Bt=St+2*ac;return mt?Bt+yr+Math.round(St*.82):Bt},Ap=22,ic=.06,sc=.32,lu=18,Hb=13,cu=15,Wb=Math.sqrt(Math.max(1,i*s)),Fb=(mt,St)=>{let Bt=Math.sqrt(Math.max(0,mt*St))/Wb;return Math.min(1,Math.max(0,(Bt-ic)/(sc-ic)))},du=(mt,St,Bt,kt,Jt,re,pe=xr,ce)=>{let{color:ke,haloColor:$e}=Ut(kt),ct=ce??ke,ht=Math.round(pe*.82),wt=Math.max(Fe(Bt,pe),re?Fe(re,ht):0)/2,Ct=[St-pe*.55,St-pe*.1].some(Yt=>Qt(mt-wt,Yt)!==kt||Qt(mt+wt,Yt)!==kt);vr.push({x:mt,y:St,text:Bt,anchor:"middle",color:ct,halo:ce?!1:Ct,haloColor:$e,...pe!==xr&&{fontSize:pe},...re!==void 0&&{valueLine:re},lineNumber:Jt})},bs=2,ta=(mt,St,Bt,kt,Jt=xr)=>{let re=Math.round(Jt*.82),pe=Math.max(Fe(Bt,Jt),kt?Fe(kt,re):0)+2*bs,ce=kt?Jt+yr+re:Jt;return{x:mt-pe/2,y:St-ce/2,w:pe,h:ce}};if(pi){let mt=new Set(l.poiFrameContainers),St=ne.map(Et=>{let Ft=mt.has(Et.id);if(Et.layer==="base"&&!Ft||Et.label===void 0)return null;let Kt=Et.layer==="us-state"||Et.id.startsWith("US-"),ue=Kt?p?.get(Et.id):f.get(Et.id);if(!ue)return null;let[[_e,ve],[Re,Xe]]=At.bounds(ue),sn=Re-_e,Pe=Xe-ve,qe=Kt&&!Yi?Et.id.replace(/^US-/,""):void 0,Ae=qe!==void 0?oc?[qe,Et.label]:Ft?[Et.label]:[Et.label,qe]:[Et.label],Ze=Kt?void 0:Dv[Et.id],Oe=Ze?rt(Ze[0],Ze[1]):At.centroid(ue);return!Oe||!Number.isFinite(Oe[0])?null:{r:Et,c:Oe,boxW:sn,boxH:Pe,area:sn*Pe,candidates:Ae}}).filter(Et=>Et!==null).sort((Et,Ft)=>Ft.area-Et.area||Et.r.lineNumber-Ft.r.lineNumber),Bt=[...Z],kt=[],Jt=Et=>Et===O||Et===R||Et===H,re=14,pe=Kn.map(Et=>({x:Et.cx-Et.r-re,y:Et.cy-Et.r-re,w:2*(Et.r+re),h:2*(Et.r+re)})),ce=Math.max(46,Math.min(i,s)*.11),ke=4,$e=9,ct=6,ht=ce*3,wt=ct,Ct=(Et,Ft,Kt,ue)=>{let _e=Math.atan2(ue,Kt),ve=ht;for(let Re=-2;Re<=2;Re++){let Xe=_e+Re*Math.PI/4,sn=Math.cos(Xe),Pe=Math.sin(Xe),qe=ct;for(;qe<=ht;qe+=ct){let Ae=Et+sn*qe,Ze=Ft+Pe*qe;if(Ae<Go||Ze<Q||Ae>i-Go||Ze>s-Go||Qt(Ae,Ze)!==O)break}qe<ve&&(ve=qe)}return ve},Yt=(Et,Ft,Kt,ue,_e,ve=xr,Re=$e,Xe=ce)=>{let sn=ys(ue,_e,ve),Pe=su(_e!==void 0,ve),qe=Math.SQRT1_2,Ae=[[0,-1],[0,1],[1,0],[-1,0],[qe,-qe],[qe,qe],[-qe,-qe],[-qe,qe]],Ze=null;for(let[Oe,Ke]of Ae){let De=Et,En=Ft,Tn=0,Ir=Math.ceil(Xe/ke)+1;for(;Tn<Ir&&Qt(De,En)===Kt;)De+=Oe*ke,En+=Ke*ke,Tn++;if(Qt(De,En)===Kt)continue;let zo=(Math.abs(Oe)*sn+Math.abs(Ke)*Pe)/2,so=De+Oe*(Re+zo),ba=En+Ke*(Re+zo),Nr={x:so-sn/2,y:ba-Pe/2,w:sn,h:Pe};if(Nr.x<Go||Nr.y<Q||Nr.x+Nr.w>i-Go||Nr.y+Nr.h>s-Go)continue;let ul=[Nr.x+2,so,Nr.x+Nr.w-2],xN=[Nr.y+2,ba,Nr.y+Nr.h-2],jt=!0;for(let gn of ul)for(let pn of xN)if(!Jt(Qt(gn,pn))){jt=!1;break}if(!jt||Bt.some(gn=>Ea(Nr,gn))||pe.some(gn=>Ea(Nr,gn))||Fi.some(gn=>Wu(Nr,gn)))continue;let he=so-Oe*(sn/2),Ne=ba-Ke*(Pe/2),xe=Math.hypot(he-Et,Ne-Ft);if(xe>Xe||kt.some(gn=>JC(Et,Ft,he,Ne,gn[0],gn[1],gn[2],gn[3]))||Bt.some(gn=>w0(Et,Ft,he,Ne,gn)))continue;let rn=Ct(so,ba,Oe,Ke);(Ze===null||rn>Ze.clear+wt||rn>=Ze.clear-wt&&xe<Ze.len)&&(Ze={x:so,y:ba,rect:Nr,leader:[Et,Ft,he,Ne],len:xe,clear:rn})}return Ze?{x:Ze.x,y:Ze.y,rect:Ze.rect,leader:Ze.leader}:null};for(let{r:Et,c:Ft,boxW:Kt,boxH:ue,candidates:_e}of St){let ve=au(Et.value),Re=De=>!Bt.some(En=>Ea(De,En)),Xe=De=>!pe.some(En=>Ea(De,En)),sn=q.has(Et.id),Pe=(De,En,Tn)=>{let Ir=Fe(Tn,xr)/2;return Qt(De-Ir,En)===Et.fill&&Qt(De+Ir,En)===Et.fill};if(sn&&ve===void 0&&Et.label!==void 0){let De=_e[0],En=-1;for(let Tn=lu;Tn>=xr;Tn--){if(Fe(De,Tn)>Kt||Tn+2*ac>ue)continue;let Ir=ta(Ft[0],Ft[1],De,void 0,Tn);if(!Re(Ir)||!Xe(Ir)||Bi(Ir))continue;let zo=Fe(De,Tn)/2;if(!(Qt(Ft[0]-zo,Ft[1])!==Et.fill||Qt(Ft[0]+zo,Ft[1])!==Et.fill)){En=Tn;break}}if(En>=Hb){let Tn=ta(Ft[0],Ft[1],De,void 0,En);Bt.push(Tn),du(Ft[0],Ft[1],De,Et.fill,Et.lineNumber,void 0,En),mi.add(Et.id),hs.push({label:vr[vr.length-1],rect:Tn})}else{let Tn=Yt(Ft[0],Ft[1],Et.fill,Et.label,void 0,cu,$e+cu,ce*2.2);if(Tn){Bt.push(Tn.rect),kt.push(Tn.leader);let Ir=Ot(Et.fill,o.text,60);vr.push({x:Tn.x,y:Tn.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,fontSize:cu,leader:{x1:Tn.leader[0],y1:Tn.leader[1],x2:Tn.leader[2],y2:Tn.leader[3]},leaderColor:Ir,calloutDot:{x:Ft[0],y:Ft[1],color:Ir},lineNumber:Et.lineNumber}),mi.add(Et.id)}}continue}let qe=[{x:Ft[0],y:Ft[1],guard:!1}];ve&&qe.push({x:Ft[0],y:Ft[1]+ue*.26,guard:!0},{x:Ft[0],y:Ft[1]-ue*.26,guard:!0},{x:Ft[0]+Kt*.26,y:Ft[1],guard:!0},{x:Ft[0]-Kt*.26,y:Ft[1],guard:!0},{x:Ft[0]+Kt*.22,y:Ft[1]+ue*.22,guard:!0},{x:Ft[0]-Kt*.22,y:Ft[1]+ue*.22,guard:!0},{x:Ft[0]+Kt*.22,y:Ft[1]-ue*.22,guard:!0},{x:Ft[0]-Kt*.22,y:Ft[1]-ue*.22,guard:!0});let Ae;for(let De of qe)if(!(De.guard&&Qt(De.x,De.y)!==Et.fill)){for(let En of _e){let Tn=ta(De.x,De.y,En);if(ve&&ys(En,ve)<=Kt&&su(!0)<=ue){let Ir=ta(De.x,De.y,En,ve);if(Re(Ir)&&Xe(Tn)&&Pe(De.x,De.y,En)){Ae={text:En,valueLine:ve,ax:De.x,ay:De.y};break}}if(ya(En)<=Kt&&$o<=ue&&Re(Tn)&&Xe(Tn)&&(ve===void 0||Pe(De.x,De.y,En))){Ae={text:En,ax:De.x,ay:De.y};break}}if(Ae)break}if(Ae===void 0&&Et.label!==void 0&&sn){let De=Yt(Ft[0],Ft[1],Et.fill,Et.label,ve);if(De){Bt.push(De.rect),kt.push(De.leader);let En=Ot(Et.fill,o.text,60);vr.push({x:De.x,y:De.y,text:Et.label,anchor:"middle",color:o.text,halo:!1,haloColor:o.bg,...ve!==void 0&&{valueLine:ve},leader:{x1:De.leader[0],y1:De.leader[1],x2:De.leader[2],y2:De.leader[3]},leaderColor:En,calloutDot:{x:Ft[0],y:Ft[1],color:En},lineNumber:Et.lineNumber}),mi.add(Et.id)}continue}if(Ae===void 0)continue;let Ze=Et.value===void 0&&Et.layer==="base",Oe=xr;if(Ze){let De=Fb(Kt,ue),En=Math.round(xr+De*(Ap-xr)),Tn=Ae.valueLine!==void 0,Ir=so=>{let ba=Fe(Ae.text,so)/2;return[Ae.ax-ba,Ae.ax+ba].every(Nr=>{let ul=Qt(Nr,Ae.ay);return ul===Et.fill||Jt(ul)})},zo=-1;for(let so=En;so>=xr;so--){if(ys(Ae.text,Ae.valueLine,so)>Kt||su(Tn,so)>ue)continue;let ba=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,so),Nr=ta(Ae.ax,Ae.ay,Ae.text,void 0,so);if(!(!Re(ba)||!Xe(Nr)||Bi(Nr))&&Ir(so)){zo=so;break}}if(zo<0){if(!mt.has(Et.id))continue;Oe=xr}else Oe=zo}let Ke=ta(Ae.ax,Ae.ay,Ae.text,Ae.valueLine,Oe);Bt.push(Ke),du(Ae.ax,Ae.ay,Ae.text,Et.fill,Et.lineNumber,Ae.valueLine,Oe,Ze?D:void 0),mi.add(Et.id),hs.push({label:vr[vr.length-1],rect:Ke})}for(let Et of yt){let Ft=oc?Et.iso.replace(/^US-/,""):Et.name,Kt=q.get(Et.iso),ue=au(Kt?.value);du(Et.x,Et.y,Ft,Kt?X(Kt):R,Et.lineNumber,ue),mi.add(Et.iso),hs.push({label:vr[vr.length-1],rect:ta(Et.x,Et.y,Ft,ue)})}}if(l.directives.noPoiLabels!==!0){let mt=[...Kn].filter(jt=>jt.clusterId===void 0).sort((jt,he)=>jt.lineNumber-he.lineNumber||(jt.id<he.id?-1:1)),St=new Map(l.pois.map(jt=>[jt.id,jt])),Bt=jt=>{let he=St.get(jt.id);return he?.label??he?.name??jt.id},kt=xr*1.25,Jt=jt=>{let he=Bt(jt);return{text:he,w:Fe(he,xr)}},re=3,pe=Math.max(20,Math.round(Math.min(i,s)*.03)),ce=new Map;for(let jt of Kn){if(jt.clusterId===void 0)continue;let he=ce.get(jt.clusterId);he?he.push(jt):ce.set(jt.clusterId,[jt])}let ke=(jt,he,Ne)=>{switch(Ne){case"right":return{x:jt.cx+jt.r+re,y:jt.cy-kt/2,w:he,h:kt};case"left":return{x:jt.cx-jt.r-re-he,y:jt.cy-kt/2,w:he,h:kt};case"above":return{x:jt.cx-he/2,y:jt.cy-jt.r-re-kt,w:he,h:kt};case"below":return{x:jt.cx-he/2,y:jt.cy+jt.r+re,w:he,h:kt};case"below-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy+xe,w:he,h:kt}}case"below-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-he,y:jt.cy+xe,w:he,h:kt}}case"above-right":{let xe=(jt.r+re)*.7071;return{x:jt.cx+xe,y:jt.cy-xe-kt,w:he,h:kt}}case"above-left":{let xe=(jt.r+re)*.7071;return{x:jt.cx-xe-he,y:jt.cy-xe-kt,w:he,h:kt}}}},$e=(jt,he,Ne,xe,rn)=>{let on=ke(jt,Ne,xe);ha.push(on);let gn=xe==="right"||xe==="below-right"||xe==="above-right",pn=xe==="left"||xe==="below-left"||xe==="above-left",dn=gn?"start":pn?"end":"middle",Gn=gn?on.x:pn?on.x+Ne:jt.cx;vr.push({x:Gn,y:on.y+kt/2+xr/3,text:he,anchor:dn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,lineNumber:jt.lineNumber,...rn!==void 0&&{clusterMember:rn}})},ct=(jt,he,Ne)=>{let xe=ke(jt,he,Ne);return xe.x>=0&&xe.x+xe.w<=i&&xe.y>=0&&xe.y+xe.h<=s&&!Bi(xe)},ht=30,wt=[];for(let jt of mt){let he=wt.find(Ne=>Ne.some(xe=>Math.hypot(xe.cx-jt.cx,xe.cy-jt.cy)<ht));he?he.push(jt):wt.push([jt])}let Yt=kt+3,Et=16,Ft=jt=>jt.map(he=>({p:he,...Jt(he)})).sort((he,Ne)=>he.p.cy-Ne.p.cy||(he.text<Ne.text?-1:1)),Kt=(jt,he)=>{let Ne=Math.min(...jt.map(Gn=>Gn.p.cx-Gn.p.r)),xe=Math.max(...jt.map(Gn=>Gn.p.cx+Gn.p.r)),rn=Math.max(...jt.map(Gn=>Gn.w)),on=(Math.min(...jt.map(Gn=>Gn.p.cy))+Math.max(...jt.map(Gn=>Gn.p.cy)))/2,gn=he==="right"?Math.min(xe+Et,i-pe-rn):Math.max(Ne-Et,pe+rn),pn=jt.length*Yt,dn=on-pn/2;return dn=Math.max(pe,Math.min(dn,s-pn-pe)),jt.map((Gn,Ho)=>{let Uo=dn+Ho*Yt+Yt/2;return{o:Gn,colX:gn,rowCy:Uo,rect:{x:he==="right"?gn:gn-Gn.w,y:Uo-kt/2,w:Gn.w,h:kt}}})},ue=(jt,he)=>Kt(jt,he).every(({rect:Ne})=>Ne.x>=0&&Ne.x+Ne.w<=i&&Ne.y>=0&&Ne.y+Ne.h<=s&&!Bi(Ne)),_e=1e3,ve=jt=>{let he=[jt.x+jt.w*.15,jt.x+jt.w*.5,jt.x+jt.w*.85],Ne=[jt.y+jt.h*.25,jt.y+jt.h*.75],xe=0;for(let gn of he)for(let pn of Ne)Qt(gn,pn)===O&&xe++;let rn=xe/(he.length*Ne.length),on=Math.max(0,Math.min(jt.x,i-(jt.x+jt.w),jt.y,s-(jt.y+jt.h)));return _e*rn+on*.1},Re=(jt,he)=>{let Ne=Kt(jt,he);return Ne.length===0?-1/0:Ne.reduce((xe,{rect:rn})=>xe+ve(rn),0)/Ne.length},Xe=jt=>Re(jt,"right")>=Re(jt,"left")?"right":"left",sn=(jt,he,Ne)=>{for(let{o:xe,colX:rn,rowCy:on,rect:gn}of Kt(jt,he))ha.push(gn),vr.push({x:rn,y:on+xr/3,text:xe.text,anchor:he==="right"?"start":"end",color:o.text,halo:!1,haloColor:o.bg,leader:{x1:xe.p.cx,y1:xe.p.cy,x2:he==="right"?rn-2:rn+2,y2:on},leaderColor:xe.p.fill,poiId:xe.p.id,lineNumber:xe.p.lineNumber,...Ne!==void 0&&{clusterMember:Ne}})},Pe=jt=>{let{text:he,w:Ne}=Jt(jt),xe=jt.cx+jt.r+re,rn="start";xe+Ne>i&&(xe=jt.cx-jt.r-re-Ne,rn="end");let on=Math.max(0,Math.min(jt.cy-kt/2,s-kt));vr.push({x:rn==="start"?xe:xe+Ne,y:on+kt/2+xr/3,text:he,anchor:rn,color:o.text,halo:!1,haloColor:o.bg,poiId:jt.id,hidden:!0,lineNumber:jt.lineNumber})},qe=4,Ae=(jt,he,Ne)=>{let xe=jt.cx-he,rn=jt.cy-Ne;return Math.abs(rn)>=Math.abs(xe)?rn<=0?"above":"below":xe<0?"left":"right"},Ze=(jt,he)=>{let Ne=Dn.find(on=>on.id===he);if(!Ne||jt.length>qe)return!1;let xe=[],rn=[];for(let{p:on,text:gn,w:pn}of jt){let dn=Ae(on,Ne.cx,Ne.cy),Ho=[dn,...["above","below","right","left"].filter(Uo=>Uo!==dn)].find(Uo=>{let $r=ke(on,pn,Uo);return $r.x>=0&&$r.x+$r.w<=i&&$r.y>=0&&$r.y+$r.h<=s&&!Bi($r)&&!xe.some(lc=>Ea(lc,$r))});if(Ho===void 0)return!1;xe.push(ke(on,pn,Ho)),rn.push({p:on,text:gn,w:pn,side:Ho})}for(let{p:on,text:gn,w:pn,side:dn}of rn)$e(on,gn,pn,dn,he);return!0};for(let[jt,he]of ce){if(he.length===0)continue;let Ne=Ft(he);if(Ze(Ne,jt))continue;let xe=ue(Ne,"right"),rn=ue(Ne,"left"),on=xe&&rn?Xe(Ne):xe?"right":rn?"left":Xe(Ne);sn(Ne,on,jt)}let Oe=48,Ke=8,De=.25,En=(jt,he,Ne,xe,rn,on)=>{let gn=rn-Ne,pn=on-xe,dn=gn*gn+pn*pn,Gn=dn>0?((jt-Ne)*gn+(he-xe)*pn)/dn:0;return Gn=Math.max(0,Math.min(1,Gn)),Math.hypot(jt-(Ne+Gn*gn),he-(xe+Gn*pn))},Tn=(jt,he)=>{let Ne=jt.x+jt.w/2,xe=jt.y+jt.h/2,rn=Oe;for(let on of Kn)on.id!==he&&(rn=Math.min(rn,Math.hypot(on.cx-Ne,on.cy-xe)-on.r));for(let on of ou)rn=Math.min(rn,En(Ne,xe,on[0],on[1],on[2],on[3]));return Math.max(0,rn)},Ir={right:160,left:160,above:100,below:100,"below-right":0,"below-left":0,"above-right":0,"above-left":0},zo=Object.keys(Ir),so=(jt,he,Ne)=>{let xe=ke(jt,he,Ne);return Ke*Tn(xe,jt.id)+De*ve(xe)+Ir[Ne]},ba=wit*Math.min(i,s),Nr=[];for(let jt of wt){let he=Ft(jt);if(jt.length===1){let{p:pn,text:dn,w:Gn}=he[0],Ho=zo.filter($r=>ct(pn,Gn,$r)).map($r=>({s:$r,v:so(pn,Gn,$r)}));if(Ho.length===0){sn(he,Xe(he));continue}let Uo=Ho.reduce(($r,lc)=>lc.v>$r.v?lc:$r).s;$e(pn,dn,Gn,Uo);continue}let Ne=Math.min(...he.map(pn=>pn.p.cx-pn.p.r)),xe=Math.max(...he.map(pn=>pn.p.cx+pn.p.r)),rn=Math.min(...he.map(pn=>pn.p.cy)),on=Math.max(...he.map(pn=>pn.p.cy));Math.hypot(xe-Ne,on-rn)>ba||he.length>Eit?he.forEach(pn=>Pe(pn.p)):Nr.push(he)}for(let jt of Nr){let he=["right","left"].filter(xe=>ue(jt,xe)),Ne=he.length>1?Xe(jt):he[0];Ne?sn(jt,Ne):jt.forEach(xe=>Pe(xe.p))}let ul=r._poiClearancePass??0;if(ul<4&&Kn.length>0){let jt=pe,he=Math.floor(i*.3),Ne=Math.floor(s*.3),xe=new Map(Kn.map(dn=>[dn.id,dn])),rn=0,on=0,gn=0,pn=0;for(let dn of Kn)rn=Math.max(rn,jt-(dn.cx-dn.r)),on=Math.max(on,dn.cx+dn.r+jt-i),gn=Math.max(gn,jt-(dn.cy-dn.r)),pn=Math.max(pn,dn.cy+dn.r+jt-s);for(let dn of vr){if(dn.poiId===void 0)continue;let Gn=xe.get(dn.poiId);if(!Gn)continue;if(dn.hidden||dn.leader){let C4=dn.hidden?Jt(Gn).w:Fe(dn.text,xr),wN=Gn.r+Et+C4+jt;Gn.cx>=i/2?on=Math.max(on,Gn.cx+wN-i):rn=Math.max(rn,wN-Gn.cx);continue}let Ho=Fe(dn.text,xr),Uo=dn.anchor==="start"?dn.x:dn.anchor==="end"?dn.x-Ho:dn.x-Ho/2,$r=dn.y-xr/3-kt/2,lc=Uo+Ho,T4=$r+kt;rn=Math.max(rn,jt-Uo),on=Math.max(on,lc+jt-i),gn=Math.max(gn,jt-$r),pn=Math.max(pn,T4+jt-s)}if(rn=Math.min(Math.max(0,Math.ceil(rn)),he),on=Math.min(Math.max(0,Math.ceil(on)),he),gn=Math.min(Math.max(0,Math.ceil(gn)),Ne),pn=Math.min(Math.max(0,Math.ceil(pn)),Ne),rn>=1||on>=1||gn>=1||pn>=1){let dn=r._calloutReserve,Gn=Math.min((dn?.left??0)+rn,he),Ho=Math.min((dn?.right??0)+on,he),Uo=Math.min((dn?.top??0)+gn,Ne),$r=Math.min((dn?.bottom??0)+pn,Ne);return Wv(l,e,n,{...r,_poiClearancePass:ul+1,_calloutReserve:{...Gn>0&&{left:Gn},...Ho>0&&{right:Ho},...Uo>0&&{top:Uo},...$r>0&&{bottom:$r}}})}}}if(hs.length>0){let St=vr.filter(Bt=>Bt.poiId!==void 0&&Bt.hidden!==!0).map(Bt=>{let kt=Fe(Bt.text,xr);return{x:(Bt.anchor==="start"?Bt.x:Bt.anchor==="end"?Bt.x-kt:Bt.x-kt/2)-2,y:Bt.y-xr,w:kt+4,h:xr*1.4+4}});for(let Bt of hs)if(St.some(kt=>Ea(kt,Bt.rect))){let kt=vr.indexOf(Bt.label);kt>=0&&vr.splice(kt,1)}}if(Jn.some(mt=>mt.label!==void 0)){let mt=vr.filter(kt=>!kt.hidden).map(kt=>{let Jt=ya(kt.text);return{x:kt.anchor==="start"?kt.x:kt.anchor==="end"?kt.x-Jt:kt.x-Jt/2,y:kt.y-$o/2,w:Jt,h:$o}}),St=[],Bt=[.5,.42,.58,.34,.66,.28,.72];for(let kt=0;kt<Jn.length;kt++){let Jt=Jn[kt];if(Jt.label===void 0)continue;let re=kn.get(Jt.fromId),pe=kn.get(Jt.toId);if(!re||!pe)continue;let ce=ya(Jt.label),ke=pe.cx-re.cx,$e=pe.cy-re.cy,ct=Math.hypot(ke,$e)||1,ht=-$e/ct,wt=ke/ct,Ct=$o+2,Yt=Jt.width??tc,Et=Yt/2+$o/2+3,Ft=Yt>=4?[Et,-Et,Et+Ct,-(Et+Ct),0]:[0,Ct,-Ct,2*Ct,-2*Ct],Kt=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(Jt.d),ue=Ae=>{if(Kt?.[5]!==void 0){let Ze=1-Ae;return[Ze*Ze*+Kt[1]+2*Ze*Ae*+Kt[5]+Ae*Ae*+Kt[7],Ze*Ze*+Kt[2]+2*Ze*Ae*+Kt[6]+Ae*Ae*+Kt[8]]}return Kt?.[3]!==void 0?[+Kt[1]+(+Kt[3]-+Kt[1])*Ae,+Kt[2]+(+Kt[4]-+Kt[2])*Ae]:[re.cx+ke*Ae,re.cy+$e*Ae]},_e=[];for(let Ae of Ft)for(let Ze of Bt){let[Oe,Ke]=ue(Ze);_e.push([Oe+ht*Ae,Ke+wt*Ae-4])}let ve=([Ae,Ze])=>{let Oe={x:Ae-ce/2,y:Ze-$o/2,w:ce,h:$o};return!(Oe.x<0||Oe.x+ce>i||Oe.y<0||Oe.y+Oe.h>s||Fi.some(Ke=>Wu(Oe,Ke))||mt.some(Ke=>Ea(Ke,Oe))||St.some(Ke=>Ea(Ke,Oe)))},Re=ue(.5),[Xe,sn]=_e.find(ve)??[Re[0],Re[1]-4],Pe=Ut(Qt(Xe,sn));Jn[kt]={...Jt,labelX:Xe,labelY:sn,labelColor:Pe.color,labelHalo:Pe.halo,labelHaloColor:Pe.haloColor};let qe={x:Xe-ce/2,y:sn-$o/2,w:ce,h:$o};St.push(qe),ha.push(qe)}}if(l.directives.noContextLabels!==!0){for(let ct of vr){if(ct.hidden)continue;let ht=ya(ct.text),wt=ct.anchor==="start"?ct.x:ct.anchor==="end"?ct.x-ht:ct.x-ht/2;ha.push({x:wt,y:ct.y-$o/2,w:ht,h:$o})}for(let ct of dt)ha.push({x:ct.x,y:ct.y,w:ct.w,h:ct.h});let mt=[],St=[];for(let ct of f.values()){let ht=typeof ct.id=="string"?ct.id:String(ct.id??"");if(!ht||q.has(ht)||mi.has(ht)||h&&ht==="US")continue;let wt=!1;for(let ve of q.keys())if(ve.startsWith(ht+"-")){wt=!0;break}if(wt)continue;let Ct=At.bounds(ct),[Yt,Et]=Ct[0],[Ft,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Ft))continue;let ue=Dv[ht],_e=ue?rt(ue[0],ue[1]):At.centroid(ct);St.push({f:ct,iso:ht,name:ct.properties?.name??ht,bbox:[Yt,Et,Ft,Kt],anchor:_e&&Number.isFinite(_e[0])?[_e[0],_e[1]]:null,curatedLngLat:ue??null,area:(Ft-Yt)*(Kt-Et)})}let Bt=Av(Math.max(Mt,zt)),kt=Rv(i,s,Bt),Jt=Bt!=="world",re=kt+aB,pe=St.map((ct,ht)=>({idx:ht,area:ct.area})).filter(ct=>Number.isFinite(ct.area)&&ct.area>0).sort((ct,ht)=>ht.area-ct.area).slice(0,re),ce=new Set(pe.map(ct=>ct.idx));for(let ct=0;ct<St.length;ct++){let ht=St[ct],wt=ht.anchor,Ct;if(ce.has(ct)&&wt){let Yt=fs(ht.f),Et=Qit({geometry:ht.f.geometry,bounds:Yt,project:rt,width:i,height:s,curated:ht.curatedLngLat});Et.length&&(Ct=Et.map(Ft=>Ft.screen),wt=Ct[0])}mt.push({name:ht.name,bbox:ht.bbox,anchor:wt,curatedAnchor:!!ht.curatedLngLat,bordering:Jt,...Ct?{positions:Ct}:{}})}let ke=(l.poiFrameContainers??[]).some(ct=>ct.startsWith("US-"));if(p&&ke)for(let[ct,ht]of p){if(q.has(ct)||mi.has(ct))continue;let wt=$t(ht);if(!wt)continue;let Ct=At.bounds(wt),[Yt,Et]=Ct[0],[Ft,Kt]=Ct[1];if(!Number.isFinite(Yt)||!Number.isFinite(Ft))continue;let ue=At.centroid(wt);mt.push({name:ht.properties?.name??ct,bbox:[Yt,Et,Ft,Kt],anchor:ue&&Number.isFinite(ue[0])?[ue[0],ue[1]]:null})}let $e=iB({projection:l.projection,dLonSpan:Mt,dLatSpan:zt,width:i,height:s,waterBodies:e.waterBodies,countries:mt,palette:o,countryTone:D,waterTone:W,project:rt,collides:Bi,overLand:(ct,ht)=>Qt(ct,ht)!==O});vr.push(...$e)}let dl=[];if(l.directives.noCities!==!0){let ce=Math.log10(5e4),ke=Math.log10(15e6)-ce,$e=wt=>wt>5e4?.7+Math.min(1,(Math.log10(wt)-ce)/ke)*(2.6-.7):.7,ct=Kn.map(wt=>({x:wt.cx,y:wt.cy})),ht=[...e.gazetteer.cities].sort((wt,Ct)=>Ct[3]-wt[3]);for(let wt of ht){if(dl.length>=220)break;let Ct=wt[0],Yt=wt[1],Et=rt(Yt,Ct);if(!Et)continue;let[Ft,Kt]=Et;if(Ft<0||Ft>i||Kt<0||Kt>s)continue;let ue=!1;for(let _e of ct){let ve=_e.x-Ft,Re=_e.y-Kt;if(ve*ve+Re*Re<144){ue=!0;break}}ue||(ct.push({x:Ft,y:Kt}),dl.push({cx:Ft,cy:Kt,r:$e(wt[3])}))}}return{width:i,height:s,background:O,title:tt,...l.subtitle!==void 0&&{subtitle:l.subtitle},...l.caption!==void 0&&{caption:l.caption},regions:ne,rivers:Je,relief:de,reliefHatch:te,coastlineStyle:ae,legs:Jn,pois:Kn,cityDots:dl,clusters:Dn,labels:vr,legend:et,insets:dt,insetRegions:ut,projection:c,stretch:pt,diagnostics:[]}}var Go,Iv,lB,yit,Pv,bit,lb,dB,uB,xit,tc,fB,xr,Dv,wit,Eit,pB,Sit,Lit,mB,gB,vit,Nit,Mit,kit,Tit,hB,Cit,_it,Ait,yB,Rit,Iit,Pit,bB,Dit,Git,Oit,$it,Hit,Wit,Fit,Bit,Yit,Vit,zit,Uit,Xit,jit,qit,xB,Jit,tst,est,rst,Ov,$v,ost,Hv,wB,cst,Fv=st(()=>{"use strict";je();ob();_L();tn();Sv();JF();wr();E0();Tr();f0();kv();sB();Go=24,Iv=1,lB=.6,yit=1.25;Pv=15,bit=6,lb=4,dB=22,uB=.92,xit=.55,tc=1.25,fB=8,xr=11,Dv={US:[-98.5,39.5],RU:[45,58]},wit=.18,Eit=7,pB=4.5,Sit=12,Lit=24,mB=60,gB=68,vit=24,Nit=24,Mit=1.3,kit=480,Tit=12,hB=2,Cit=1.5,_it=.2,Ait=26,yB=5,Rit=.0016,Iit=.0028,Pit=.0014,bB=.5,Dit=.1,Git=6e-4,Oit=6e-4,$it=32,Hit=30,Wit=62,Fit=28,Bit=16,Yit=9,Vit=2.399963229728653,zit=1,Uit=8,Xit=4,jit=16,qit=.18;xB=new WeakMap;Jit=()=>cp().parallels([29.5,45.5]).rotate([96,0]),tst=()=>cp().rotate([154,0]).center([-2,58.5]).parallels([55,65]),est=()=>tb();rst=new Set(["US-AK","US-HI"]),Ov=(t,e)=>e>=51&&(t<=-129||t>=172),$v=(t,e)=>e>=18&&e<=23&&t>=-161&&t<=-154,ost={CA:["US-AK","US-WA","US-ID","US-MT","US-ND","US-MN","US-MI","US-NY","US-VT","US-NH","US-ME"],MX:["US-CA","US-AZ","US-NM","US-TX"]},Hv=new Set(["US-AK","US-HI","US-AS","US-GU","US-MP","US-PR","US-VI"]);wB=new WeakMap,cst=8});var MB={};ye(MB,{renderMap:()=>NB,renderMapForExport:()=>mst});function ust(t,e,n){let r=!1;for(let o=0,a=n.length-1;o<n.length;a=o++){let[i,s]=n[o],[l,c]=n[a];s>e!=c>e&&t<(l-i)*(e-s)/(c-s)+i&&(r=!r)}return r}function EB(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e+"Z"}function SB(t){let e="";for(let n=0;n<t.length;n++)e+=(n?"L":"M")+t[n][0]+","+t[n][1];return e}function fst(t,e){if(!e)return[EB(t)];let n=t.length,r=.75,o=p=>Math.abs(p)<=r,a=p=>Math.abs(p-e.w)<=r,i=p=>Math.abs(p)<=r,s=p=>Math.abs(p-e.h)<=r,l=(p,m)=>o(p[0])&&o(m[0])||a(p[0])&&a(m[0])||i(p[1])&&i(m[1])||s(p[1])&&s(m[1]),c=-1;for(let p=0;p<n;p++)if(l(t[p],t[(p+1)%n])){c=p;break}if(c===-1)return[EB(t)];let d=[],u=[],f=(c+1)%n;for(let p=0;p<n;p++){let m=(f+p)%n,g=t[m],h=t[(m+1)%n];if(l(g,h)){u.length>=2&&d.push(SB(u)),u=[];continue}u.length===0&&u.push(g),u.push(h)}return u.length>=2&&d.push(SB(u)),d}function LB(t,e,n){let r=[];for(let o of t){let a=o.rings??xp(o.d);for(let i=0;i<a.length;i++){let s=a[i];if(s.length<3)continue;let l=1/0,c=1/0,d=-1/0,u=-1/0;for(let[g,h]of s)g<l&&(l=g),g>d&&(d=g),h<c&&(c=h),h>u&&(u=h);if(Math.max(d-l,u-c)<e)continue;let[f,p]=s[0],m=0;for(let g=0;g<a.length;g++)g!==i&&ust(f,p,a[g])&&m++;m%2!==1&&r.push(...fst(s,n))}}return r}function vB(t,e,n,r,o,a){let i=r.join(" ");if(!i)return;e.append("path").attr("id",n).attr("d",i).attr("fill","none");let s=`#${n}`,l=[...o.lines].sort((c,d)=>d.d-c.d);for(let c of l)t.append("use").attr("href",s).attr("stroke",o.color).attr("stroke-width",2*(c.d+c.thickness)).attr("stroke-opacity",c.opacity).attr("stroke-linejoin","round").attr("stroke-linecap","round"),t.append("use").attr("href",s).attr("stroke",a).attr("stroke-width",2*c.d).attr("stroke-linejoin","round").attr("stroke-linecap","round")}function NB(t,e,n,r,o,a,i,s){It(t).selectAll(":not([data-d3-tooltip])").remove();let l=i?.width??t.clientWidth,c=i?.height??t.clientHeight;if(l<=0||c<=0)return;let d=Wv(e,n,{width:l,height:c},{palette:r,isDark:o,preferContain:i?.preferContain??!1,legendMode:i?"export":"preview",...s!==void 0&&{activeGroup:s}}),u=It(t).append("svg").attr("width",l).attr("height",c).attr("viewBox",`0 0 ${l} ${c}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt).style("background",d.background);u.append("rect").attr("width",l).attr("height",c).attr("fill",d.background);let f=u.append("defs"),p=pst++,m=w=>`${w}__m${p}`,g=w=>Math.min(15,7+w*.95),h=r.bg,S=u.append("g").attr("class","dgmo-map-regions"),y=(w,v,M)=>{let _=w.append("path").attr("d",v.d).attr("fill",v.fill).attr("stroke",v.stroke).attr("stroke-width",M);if(v.label&&_.attr("data-region-name",v.label),v.id&&v.id!=="lake"&&_.attr("data-iso",v.id),v.labelX!==void 0&&v.labelY!==void 0&&_.attr("data-label-x",v.labelX).attr("data-label-y",v.labelY),v.layer!=="base"&&(_.classed("dgmo-map-region",!0).attr("data-region",v.id),v.value!==void 0&&_.attr("data-value",v.value),v.tags))for(let[T,R]of Object.entries(v.tags))_.attr(`data-tag-${T.toLowerCase()}`,R.toLowerCase());v.lineNumber>=0&&(_.attr("data-line-number",v.lineNumber),a&&_.style("cursor","pointer").on("click",()=>a(v.lineNumber)))};for(let w of d.regions)y(S,w,.5);if(d.relief.length&&d.reliefHatch){let w=d.reliefHatch,v=m("dgmo-relief-clip"),M=m("dgmo-relief-land"),_=f.append("clipPath").attr("id",v);for(let O of d.relief)_.append("path").attr("d",O.d);let T=f.append("clipPath").attr("id",M);for(let O of d.regions)O.id!=="lake"&&T.append("path").attr("d",O.d);let R=u.append("g").attr("clip-path",`url(#${M})`).style("pointer-events","none").append("g").attr("class","dgmo-map-relief").attr("clip-path",`url(#${v})`).attr("stroke",w.color).attr("stroke-width",w.width).attr("vector-effect","non-scaling-stroke");for(let O=w.spacing;O<c;O+=w.spacing)R.append("line").attr("x1",0).attr("y1",O).attr("x2",l).attr("y2",O)}if(d.coastlineStyle){let w=d.coastlineStyle,v=m("dgmo-map-water-mask"),M=f.append("mask").attr("id",v).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c);M.append("rect").attr("x",0).attr("y",0).attr("width",l).attr("height",c).attr("fill","white");let _=d.regions.filter(I=>I.id!=="lake").map(I=>I.d).join(" "),T=d.regions.filter(I=>I.id==="lake").map(I=>I.d).join(" ");if(_&&M.append("path").attr("d",_).attr("fill","black"),T&&M.append("path").attr("d",T).attr("fill","white"),d.insets.length){let I=Math.max(0,...w.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";M.append("path").attr("d",G).attr("fill","black").attr("stroke","black").attr("stroke-width",2*I).attr("stroke-linejoin","round")}}let R=u.append("g").attr("class","dgmo-map-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${v})`);vB(R,f,m("dgmo-map-coast"),LB(d.regions,w.minExtent,{w:l,h:c}),w,d.background);let O=new Map;for(let I of d.regions){let H=O.get(I.stroke);H?H.push(I.d):O.set(I.stroke,[I.d])}for(let[I,H]of O)R.append("path").attr("d",H.join(" ")).attr("stroke",I).attr("stroke-width",.5).attr("stroke-linejoin","round")}if(d.rivers.length){let w=u.append("g").attr("class","dgmo-map-rivers").attr("fill","none").style("pointer-events","none");for(let v of d.rivers)w.append("path").attr("d",v.d).attr("stroke",v.color).attr("stroke-width",v.width).attr("stroke-linecap","round").attr("stroke-linejoin","round")}if(d.cityDots.length){let w=u.append("g").attr("class","dgmo-map-cities").attr("fill",r.textMuted).attr("fill-opacity",.28).style("pointer-events","none");for(let v of d.cityDots)w.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",v.r)}let b=!i&&!e.directives.noClusterPois,E=d.labels.filter(w=>w.poiId!==void 0&&!w.hidden);if(E.length){let w=m("dgmo-map-label-patch-blur");f.append("filter").attr("id",w).attr("x","-50%").attr("y","-50%").attr("width","200%").attr("height","200%").append("feGaussianBlur").attr("in","SourceGraphic").attr("stdDeviation",2.5);let v=8,M=(_,T,R)=>{if(!_.length)return;let I=f.append("mask").attr("id",T).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c).append("g").attr("filter",`url(#${w})`),H=[];for(let D of _){let W=D.lines&&D.lines.length>1,V=W?Math.max(...D.lines.map(K=>_t(K,Fa))):_t(D.text,Fa),P=W?D.lines.length*(Fa+2):Fa,F=D.anchor==="start"?D.x+V/2:D.anchor==="end"?D.x-V/2:D.x,Y=D.y-Fa*.3,z=V+8,j=P+6;I.append("rect").attr("x",F-z/2).attr("y",Y-j/2).attr("width",z).attr("height",j).attr("rx",j/2).attr("fill","white"),H.push({x0:F-z/2-v,y0:Y-j/2-v,x1:F+z/2+v,y1:Y+j/2+v})}let G=u.append("g").attr("class","dgmo-map-label-patch").attr("mask",`url(#${T})`).style("pointer-events","none");R!==void 0&&G.attr("data-cluster-deco",R);for(let D of d.regions){let W,V,P,F;if(D.bbox)[W,V,P,F]=D.bbox;else{W=1/0,V=1/0,P=-1/0,F=-1/0;for(let z of xp(D.d))for(let[j,K]of z)j<W&&(W=j),j>P&&(P=j),K<V&&(V=K),K>F&&(F=K)}H.some(z=>W<=z.x1&&P>=z.x0&&V<=z.y1&&F>=z.y0)&&G.append("path").attr("d",D.d).attr("fill",D.fill)}};if(b){M(E.filter(R=>R.clusterMember===void 0),m("dgmo-map-label-patch"));let _=new Map;for(let R of E){if(R.clusterMember===void 0)continue;let O=_.get(R.clusterMember);O?O.push(R):_.set(R.clusterMember,[R])}let T=0;for(let[R,O]of _)M(O,m(`dgmo-map-label-patch-c${T++}`),R)}else M(E,m("dgmo-map-label-patch"))}if(d.insets.length){let w=u.append("g").attr("class","dgmo-map-insets");d.insets.forEach((v,M)=>{let _=v.points.map((T,R)=>`${R?"L":"M"}${T[0]},${T[1]}`).join("")+"Z";if(w.append("path").attr("d",_).attr("fill",d.background).attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round"),v.contextLand){let T=m(`dgmo-map-inset-clip-${M}`);f.append("clipPath").attr("id",T).append("path").attr("d",_),w.append("path").attr("d",v.contextLand.d).attr("fill",v.contextLand.fill).attr("clip-path",`url(#${T})`)}});for(let v of d.insetRegions)y(w,v,.5);if(d.coastlineStyle){let v=d.coastlineStyle,M=m("dgmo-map-inset-water-mask"),_=f.append("mask").attr("id",M).attr("maskUnits","userSpaceOnUse").attr("x",0).attr("y",0).attr("width",l).attr("height",c),T=Math.max(0,...v.lines.map(H=>H.d+H.thickness));for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";_.append("path").attr("d",G).attr("fill","white").attr("stroke","black").attr("stroke-width",2*T).attr("stroke-linejoin","round")}d.insets.forEach((H,G)=>{H.contextLand&&_.append("path").attr("d",H.contextLand.d).attr("fill","black").attr("clip-path",`url(#${m(`dgmo-map-inset-clip-${G}`)})`)});for(let H of d.insetRegions)H.id!=="lake"&&_.append("path").attr("d",H.d).attr("fill","black");for(let H of d.insetRegions)H.id==="lake"&&_.append("path").attr("d",H.d).attr("fill","white");let R=m("dgmo-map-inset-water-clip"),O=f.append("clipPath").attr("id",R);for(let H of d.insets){let G=H.points.map((D,W)=>`${W?"L":"M"}${D[0]},${D[1]}`).join("")+"Z";O.append("path").attr("d",G)}let I=w.append("g").attr("clip-path",`url(#${R})`).append("g").attr("class","dgmo-map-inset-water-lines").attr("fill","none").style("pointer-events","none").attr("mask",`url(#${M})`);vB(I,f,m("dgmo-map-inset-coast"),LB(d.insetRegions,v.minExtent),v,d.background);for(let H of d.insetRegions)I.append("path").attr("d",H.d).attr("stroke",H.stroke).attr("stroke-width",.5).attr("stroke-linejoin","round")}for(let v of d.insets){let M=v.points.map((_,T)=>`${T?"L":"M"}${_[0]},${_[1]}`).join("")+"Z";w.append("path").attr("d",M).attr("fill","none").attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",1).attr("stroke-linejoin","round").style("pointer-events","none")}}let x=(w,v)=>{v<1||(w.attr("data-line-number",v),a&&w.style("cursor","pointer").on("click",()=>a(v)))},N=u.append("g").attr("class","dgmo-map-legs").attr("fill","none"),L=w=>{let v=/^M(-?[\d.]+),(-?[\d.]+)(?:L(-?[\d.]+),(-?[\d.]+)|Q(-?[\d.]+),(-?[\d.]+) (-?[\d.]+),(-?[\d.]+))$/.exec(w);if(!v)return null;let M=+v[1],_=+v[2],T,R,O,I;v[3]!==void 0?(T=+v[3],R=+v[4],O=M,I=_):(T=+v[7],R=+v[8],O=+v[5],I=+v[6]);let H=T-O,G=R-I,D=Math.hypot(H,G);return D>0?{ex:T,ey:R,tx:H/D,ty:G/D}:null};d.legs.forEach(w=>{let v=w.arrow?L(w.d):null,M=w.d,_=null;if(v){let R=g(w.width),O=Math.max(R*.5,w.width*.6+1),I=v.ex-v.tx*R,H=v.ey-v.ty*R,G=-v.ty,D=v.tx;_=`M${I+G*O},${H+D*O}L${v.ex},${v.ey}L${I-G*O},${H-D*O}z`,M=w.d.replace(/(-?[\d.]+),(-?[\d.]+)$/,`${I.toFixed(2)},${H.toFixed(2)}`)}let T=N.append("path").attr("d",M).attr("stroke",w.color).attr("stroke-width",w.width).attr("stroke-linecap","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[R,O]of Object.entries(w.tags))T.attr(`data-tag-${R.toLowerCase()}`,O.toLowerCase());if(x(T,w.lineNumber),w.value!==void 0&&(T.attr("data-value",w.value),T.append("title").text(w.label!==void 0?`${w.label}: ${w.value}`:`${w.value}`)),_){let R=N.append("path").attr("d",_).attr("fill",w.color).attr("stroke",w.color).attr("stroke-width",1).attr("stroke-linejoin","round").attr("data-from-id",w.fromId).attr("data-to-id",w.toId);if(w.tags)for(let[O,I]of Object.entries(w.tags))R.attr(`data-tag-${O.toLowerCase()}`,I.toLowerCase())}if(w.label!==void 0&&w.labelX!==void 0){let R=wp(N,w.labelX,w.labelY??0,w.label,"middle",w.labelColor??r.textMuted,w.labelHaloColor??h,w.labelHalo??!0,Fa-1);x(R,w.lineNumber)}});let A=u.append("g").attr("class","dgmo-map-spider");for(let w of d.clusters){b&&A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.hitR).attr("fill","transparent").attr("data-cluster-hit",w.id).style("cursor","pointer");for(let v of w.legs)A.append("line").attr("x1",w.cx).attr("y1",w.cy).attr("x2",v.x2).attr("y2",v.y2).attr("stroke",v.color).attr("stroke-width",1).attr("data-cluster-deco",w.id).style("pointer-events","none");A.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",2).attr("fill",Ot(r.textMuted,r.bg,40)).attr("data-cluster-deco",w.id).style("pointer-events","none")}let C=u.append("g").attr("class","dgmo-map-pois");for(let w of d.pois){w.isOrigin&&C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r+3).attr("fill","none").attr("stroke",w.stroke).attr("stroke-width",1.5);let v=C.append("circle").attr("cx",w.cx).attr("cy",w.cy).attr("r",w.r).attr("fill",w.fill).attr("fill-opacity",w.fillOpacity).attr("stroke",w.stroke).attr("stroke-width",1).attr("data-line-number",w.lineNumber).attr("data-poi",w.id);if(w.clusterId!==void 0&&v.attr("data-cluster-member",w.clusterId),w.tags)for(let[M,_]of Object.entries(w.tags))v.attr(`data-tag-${M.toLowerCase()}`,_.toLowerCase());a&&v.style("cursor","pointer").on("click",()=>a(w.lineNumber)),w.routeNumber!==void 0&&wp(C,w.cx,w.cy+3,String(w.routeNumber),"middle",r.bg,w.fill,!1,Fa-2)}let k=u.append("g").attr("class","dgmo-map-labels");for(let w of d.labels){if(w.hidden){if(i)continue;wp(k,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing).attr("data-poi",w.poiId??null).attr("data-poi-hidden","").style("opacity",0).style("pointer-events","none");continue}if(w.leader){let M=k.append("line").attr("x1",w.leader.x1).attr("y1",w.leader.y1).attr("x2",w.leader.x2).attr("y2",w.leader.y2).attr("stroke",w.leaderColor??Ot(r.textMuted,r.bg,60)).attr("stroke-width",w.leaderColor?1:.75);w.poiId!==void 0&&M.attr("data-poi",w.poiId),w.clusterMember!==void 0&&M.attr("data-cluster-member",w.clusterMember),x(M,w.lineNumber)}w.calloutDot&&k.append("circle").attr("cx",w.calloutDot.x).attr("cy",w.calloutDot.y).attr("r",2.5).attr("fill",w.calloutDot.color).attr("stroke",Ot(r.text,r.bg,55)).attr("stroke-width",.75);let v=wp(k,w.x,w.y,w.text,w.anchor,w.color,w.haloColor,w.halo,w.fontSize??Fa,w.italic,w.letterSpacing,w.lines,w.valueLine);w.poiId!==void 0&&v.attr("data-poi",w.poiId).style("cursor","default"),w.clusterMember!==void 0&&v.attr("data-cluster-member",w.clusterMember),x(v,w.lineNumber)}if(b&&d.clusters.length){let w=u.append("g").attr("class","dgmo-map-cluster-badges");for(let v of d.clusters){let M=w.append("g").attr("data-cluster",v.id).style("opacity",0).style("pointer-events","none"),_=9;M.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",_).attr("fill",Ot(r.textMuted,r.bg,35)).attr("stroke",r.textMuted).attr("stroke-width",1),M.append("circle").attr("cx",v.cx).attr("cy",v.cy).attr("r",_+2.5).attr("fill","none").attr("stroke",r.textMuted).attr("stroke-width",1);let T=_+2.5;for(let R of v.legs){let O=Math.atan2(R.y2-v.cy,R.x2-v.cx);M.append("circle").attr("class","dgmo-map-cluster-bead").attr("cx",v.cx+T*Math.cos(O)).attr("cy",v.cy+T*Math.sin(O)).attr("r",1.8).attr("fill",R.color).attr("stroke",r.bg).attr("stroke-width",.5)}wp(M,v.cx,v.cy+3,String(v.count),"middle",r.text,r.bg,!1,Fa)}}if(d.legend){let w=(d.title?50:0)+(d.subtitle?20:0)+8,v=u.append("g").attr("class","dgmo-map-legend").attr("transform",`translate(0, ${w})`),M=ib(d.legend);if(M.length>0){let _=sb(M,i?"export":"preview");mn(v,{..._,palette:r,isDark:o,width:l,activeGroup:d.legend.activeGroup})}}d.title&&u.append("text").attr("class","dgmo-map-title").attr("x",l/2).attr("y",30).attr("text-anchor","middle").attr("font-size",20).attr("font-weight","700").attr("fill",r.text).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.title),d.subtitle&&u.append("text").attr("class","dgmo-map-subtitle").attr("x",l/2).attr("y",50).attr("text-anchor","middle").attr("font-size",Fa+1).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.subtitle),d.caption&&u.append("text").attr("x",l/2).attr("y",c-8).attr("text-anchor","middle").attr("font-size",Fa).attr("fill",r.textMuted).attr("paint-order","stroke fill").attr("stroke",r.bg).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.7).text(d.caption)}function mst(t,e,n,r,o,a){NB(t,e,n,r,o,void 0,a)}function wp(t,e,n,r,o,a,i,s,l,c,d,u,f){let p=t.append("text").attr("x",e).attr("y",n).attr("text-anchor",o).attr("font-size",l).attr("fill",a);if(u&&u.length>1){let m=l+2,g=-((u.length-1)/2)*m;u.forEach((h,S)=>{p.append("tspan").attr("x",e).attr("dy",S===0?g:m).text(h)})}else if(f!==void 0){let m=Math.round(l*.82);p.append("tspan").attr("x",e).attr("dy",-l*.28).text(r),p.append("tspan").attr("x",e).attr("dy",l*.92).attr("font-size",m).attr("fill-opacity",.72).text(f)}else p.text(r);return c&&p.attr("font-style","italic"),d&&p.attr("letter-spacing",d),s&&p.attr("paint-order","stroke fill").attr("stroke",i).attr("stroke-width",2).attr("stroke-linejoin","round").attr("stroke-linecap","round").attr("stroke-opacity",.55),p}var Fa,pst,kB=st(()=>{"use strict";qn();an();tn();en();Br();kv();Fv();Fa=11;pst=0});var AB={};ye(AB,{mapContentAspect:()=>_B,mapExportDimensions:()=>Est});function _B(t,e,n=wst){let{projection:r,fitTarget:o}=bp(t,e);r.fitSize([n,n],o);let a=Wa(r).bounds(o),i=a[1][0]-a[0][0],s=a[1][1]-a[0][1],l=i/s;return Number.isFinite(l)&&l>0?l:xst}function Est(t,e,n=1200,r){let o=r!==void 0&&Number.isFinite(r)&&r>0,a=o?r:_B(t,e),s=!o&&bp(t,e).fitIsGlobal?a/bst:a,l=o?a:Math.max(yst,Math.min(hst,s)),c=n,d=Math.round(c/l),u=0;if(t.title&&t.pois.length>0){let m=(t.subtitle?50:30)+20/2;u+=Math.max(TB,m+gst)-TB}let f=!1;return d-u<CB&&(d=Math.round(u+CB),f=!0),{width:c,height:d,preferContain:o?f:l!==s||f}}var TB,gst,hst,yst,bst,CB,xst,wst,RB=st(()=>{"use strict";ob();Fv();TB=24,gst=16,hst=3,yst=.9,bst=1.12,CB=200,xst=1.5,wst=1e3});var Vv={};ye(Vv,{loadMapData:()=>Yv});async function Sst(){let[{readFile:t},{fileURLToPath:e},{dirname:n,resolve:r}]=await Promise.all([import("fs/promises"),import("url"),import("path")]);return{readFile:t,fileURLToPath:e,dirname:n,resolve:r}}async function li(t,e,n){return JSON.parse(await t.readFile(t.resolve(e,n),"utf8"))}async function Lst(t,e){for(let n of IB){let r=t.resolve(e,n);try{return await t.readFile(t.resolve(r,Ba.gazetteer),"utf8"),r}catch{}}throw new Error(`map data assets not found near ${e} (looked in ${IB.join(", ")}). Run \`pnpm build:map-data\` and \`pnpm build\`.`)}function vst(t){let e=n=>!!n&&n.type==="Topology"&&!!n.objects;if(!e(t.worldCoarse)||!e(t.worldDetail)||!e(t.usStates)||!t.gazetteer||!Array.isArray(t.gazetteer.cities)||!t.gazetteer.byName)throw new Error("map data assets are malformed (failed shape validation)");return t}function Nst(t){try{let e=Mst.url;if(e)return t.dirname(t.fileURLToPath(e))}catch{}return typeof __dirname<"u"?__dirname:process.cwd()}function Yv(){return Bv??=(async()=>{let t=await Sst(),e=await Lst(t,Nst(t)),[n,r,o,a,i,s,l,c,d,u,f]=await Promise.all([li(t,e,Ba.worldCoarse),li(t,e,Ba.worldDetail),li(t,e,Ba.usStates),li(t,e,Ba.lakes).catch(()=>{}),li(t,e,Ba.rivers).catch(()=>{}),li(t,e,Ba.mountainRanges).catch(()=>{}),li(t,e,Ba.naLand).catch(()=>{}),li(t,e,Ba.naLakes).catch(()=>{}),li(t,e,Ba.waterBodies).catch(()=>{}),li(t,e,Ba.airports).catch(()=>{}),li(t,e,Ba.gazetteer)]);return vst({worldCoarse:n,worldDetail:r,usStates:o,gazetteer:f,...a&&{lakes:a},...i&&{rivers:i},...s&&{mountainRanges:s},...l&&{naLand:l},...c&&{naLakes:c},...d&&{waterBodies:d},...u&&{airports:u}})})().catch(t=>{throw Bv=void 0,t}),Bv}var Mst,Ba,IB,Bv,cb=st(()=>{"use strict";Mst={};Ba={worldCoarse:"world-coarse.json",worldDetail:"world-detail.json",usStates:"us-states.json",lakes:"lakes.json",rivers:"rivers.json",mountainRanges:"mountain-ranges.json",naLand:"na-land.json",naLakes:"na-lakes.json",waterBodies:"water-bodies.json",airports:"airports.json",gazetteer:"gazetteer.json"},IB=["./data","./map-data","../map-data","../src/map/data"]});var FB={};ye(FB,{renderPyramid:()=>WB,renderPyramidForExport:()=>Gst});function WB(t,e,n,r,o,a){if(e.layers.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(kst),p=c.aesthetic(zv),m=e.layers.some(T=>T.description.length>0),g=!!e.title&&e.options["no-title"]!=="on",h=g?f:0,S=h+p,y=s-p,b=Math.max(60,y-S),E=i*Tst,x=i-E*2,N=e.layers.length,L=GB({width:i,usableWidth:x,sideMargin:E,bodyTop:S,bodyHeight:b,layers:e.layers,hasDescription:m,alternate:!1}),C=L.wraps.some(T=>T.overflows)&&m&&N>=2,k=C?GB({width:i,usableWidth:x,sideMargin:E,bodyTop:S,bodyHeight:b,layers:e.layers,hasDescription:!0,alternate:!0}):L,w=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c.isBelowFloor&&w.attr("width","100%"),w.append("style").text(".pyramid-desc-full{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-short{display:none}.dgmo-pyramid-layer-highlight.pyramid-desc-full{display:inline}.dgmo-pyramid-hidden{display:none}"),w.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),g){let T=w.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&T.on("click",()=>o(e.titleLineNumber))}let v=lr(n),M=(T,R)=>{if(T.color){let O=On(T.color,n);if(O)return O}return v[R%v.length]},_=w.append("g").attr("class","pyramid-body");for(let T=0;T<N;T++){let R=e.layers[T],O=k.pyramidTop+T*k.layerH,I=O+k.layerH,H=OB(T,N,k.baseWidth,e.inverted),G=OB(T+1,N,k.baseWidth,e.inverted),D=[[k.pyramidCx-H,O],[k.pyramidCx+H,O],[k.pyramidCx+G,I],[k.pyramidCx-G,I]].map($=>`${$[0]},${$[1]}`).join(" "),W=M(R,T),V=ie(n,W,r,{solid:e.options["solid-fill"]==="on"}),P=_.append("g").attr("class","pyramid-layer").attr("data-line-number",R.lineNumber);if(o){let $=R.lineNumber;P.style("cursor","pointer").on("click",()=>o($))}P.append("polygon").attr("points",D).attr("fill",V).attr("stroke",W).attr("stroke-width",2);let F=(O+I)/2,Y=Le(V,n.textOnFillLight,n.textOnFillDark),z=Math.min(H,G)*2>_t(R.label,k.labelFont),j=Y===n.textOnFillLight?n.textOnFillDark:n.textOnFillLight,K=P.append("text").attr("x",k.pyramidCx).attr("y",F).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",Y).attr("font-family",Pt).attr("font-size",k.labelFont).attr("font-weight",600);if(z||K.attr("paint-order","stroke fill").attr("stroke",j).attr("stroke-width",3).attr("stroke-linejoin","round").attr("stroke-opacity",.6),bn(K,R.label,n),R.description.length>0){let $=C?T%2===0?"right":"left":"right",U=k.wraps[T];Ost(_,R,$,U,k,F,W,n,h+zv,s-zv,o)}}}function Gst(t,e,n,r,o){WB(t,e,n,r,void 0,o)}function GB(t){let{width:e,usableWidth:n,sideMargin:r,bodyTop:o,bodyHeight:a,layers:i,hasDescription:s,alternate:l}=t,c=i.length,u=n*(s?l?Ast:_st:Cst),f=a/PB,p=Math.min(u,f),m=p*PB,g;s?l?g=e/2:g=r+u/2:g=e/2;let h=o+(a-m)/2,S=m/c,y=$B(Math.round(S*.38),Rst,Ist),b=$B(Math.round(S*.22),Pst,Dst),E=Math.round(b*1.35),x=g+p/2,N=g-p/2,L=x+DB,A=L+db+ub,C=Math.max(80,e-r-A),k=N-DB-db,w=Math.max(80,k-ub-r),v=r,M=i.map((_,T)=>{if(_.description.length===0)return{allLines:[],overflows:!1,shortLineCount:0};let O=(l?T%2===0?"right":"left":"right")==="right"?C:w,I=Wst(_.description,O,b),H=Math.max(1,Math.floor(S/E)-0),G=I.length>H,D=G?H:I.length;return{allLines:I,overflows:G,shortLineCount:D}});return{alternate:l,baseWidth:p,pyramidCx:g,pyramidTop:h,pyramidH:m,layerH:S,labelFont:y,descFont:b,descLineHeight:E,rightTextX:A,rightTextWidth:C,leftTextX:v,leftTextWidth:w,rightAccentX:L,leftAccentX:k,wraps:M}}function OB(t,e,n,r){return(!r?t/e:(e-t)/e)*n/2}function Ost(t,e,n,r,o,a,i,s,l,c,d){let{descFont:u,descLineHeight:f}=o,p=n==="right"?o.rightAccentX:o.leftAccentX,m=n==="right"?o.rightTextX:o.leftTextX,g=n==="right"?"start":"end",h=n==="right"?m:o.leftAccentX-ub,S=o.leftAccentX-ub,y=L=>{if(n==="right")return o.rightTextX;let A=0;for(let C of L)(C.kind==="bullet-first"||C.kind==="bullet-cont")&&(A=Math.max(A,_t(C.text,u)));return S-A-HB},b=c-l,E=Math.max(1,Math.floor(b/f)),x=$st(r.allLines,E);if(!r.overflows){Uv({parentG:t,layer:e,lines:r.allLines,className:"pyramid-desc",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(r.allLines),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"});return}let N=Hst(r);Uv({parentG:t,layer:e,lines:N,className:"pyramid-desc pyramid-desc-short",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(N),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"short"}),Uv({parentG:t,layer:e,lines:x,className:"pyramid-desc pyramid-desc-full",accentX:p,accentColor:i,textX:h,textAnchor:g,side:n,bulletColLeftX:y(x),midY:a,descFont:u,descLineHeight:f,palette:s,topBound:l,bottomBound:c,...d!==void 0&&{onClickItem:d},variant:"full"})}function $st(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function Hst(t){if(!t.overflows)return t.allLines.slice();let e=t.allLines.slice(0,t.shortLineCount);if(e.length===0)return[];let n=e[e.length-1];return e[e.length-1]={...n,text:n.text.endsWith("\u2026")?n.text:`${n.text} \u2026`},e}function Uv(t){let{parentG:e,layer:n,lines:r,className:o,accentX:a,accentColor:i,textX:s,textAnchor:l,bulletColLeftX:c,midY:d,descFont:u,descLineHeight:f,palette:p,topBound:m,bottomBound:g,onClickItem:h,variant:S}=t;if(r.length===0)return;let y=r.length*f,b=d-y/2+f/2,E=Math.max(4,Math.round(u*.3)),x=b-f/2-E,N=b+(r.length-1)*f+f/2+E,L=0;x<m?L=m-x:N>g&&(L=g-N),b+=L;let A=b-f/2-E,C=y+E*2,k=e.append("g").attr("class",o).attr("data-line-number",n.lineNumber).attr("data-variant",S);if(h){let w=n.lineNumber;k.style("cursor","pointer").on("click",()=>h(w))}k.append("rect").attr("x",a).attr("y",A).attr("width",db).attr("height",C).attr("rx",db/2).attr("fill",i);for(let w=0;w<r.length;w++){let v=r[w],M=b+w*f,_=v.kind==="bullet-first"||v.kind==="bullet-cont";v.kind==="bullet-first"&&k.append("text").attr("x",c).attr("y",M).attr("dy","0.35em").attr("text-anchor","start").attr("fill",p.text).attr("font-family",Pt).attr("font-size",u).attr("font-weight",w===0?500:400).text("\u2022");let T=k.append("text").attr("x",_?c+HB:s).attr("y",M).attr("dy","0.35em").attr("text-anchor",_?"start":l).attr("fill",p.text).attr("font-family",Pt).attr("font-size",u).attr("font-weight",w===0?500:400);bn(T,v.text,p)}}function Wst(t,e,n){let r=n*Bo,o=Math.max(8,Math.floor(e/r)),a=t.map(s=>s.startsWith("- ")?"\u2022 "+s.slice(2):s),i=[];for(let s of a){if(s===""){i.push({text:"",kind:"plain"});continue}i.push(...Ko([s],o))}return i}function $B(t,e,n){return Math.max(e,Math.min(n,t))}var kst,Tst,zv,Cst,_st,Ast,PB,DB,db,ub,HB,Rst,Ist,Pst,Dst,BB=st(()=>{"use strict";qn();an();tn();wr();Ro();en();Ds();mr();kst=50,Tst=.03,zv=16,Cst=.78,_st=.58,Ast=.42,PB=.85,DB=28,db=3,ub=12,HB=10,Rst=12,Ist=22,Pst=11,Dst=15});var KB={};ye(KB,{renderRing:()=>qB,renderRingForExport:()=>Zst});function qB(t,e,n,r,o,a){if(e.layers.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=a?.width??t.clientWidth,s=a?.height??t.clientHeight;if(i<=0||s<=0)return;let l=i,c=a?Ee.identity():Ee.from(i,l),d=c.text(20),u=c.structural(30),f=c.structural(Fst),p=c.aesthetic(Yst),m=e.layers.length,g=e.layers.some(U=>U.description.length>0),h=!!e.title&&e.options["no-title"]!=="on",y=(h?f:0)+p,b=s-p,E=Math.max(60,b-y),x=i*Bst,N=i-x*2,L=g?zst:Vst,A=N*L,w=Math.min(A,E)/2,v=w/m,M=y+E/2,_=g?x+N*L/2:i/2,T=_+w+Ust,R=T+Xv+Xst,O=Math.max(80,i-x-R),I=Math.round(v*.45),H=I>=UB,G=jB(I,UB,qst),D=g?jB(Math.round(O/30),XB,Kst):XB,W=Math.round(D*1.35),V=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMid meet").attr("xmlns","http://www.w3.org/2000/svg").style("font-family",Pt);if(c.isBelowFloor&&V.attr("width","100%"),V.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),h){let U=V.append("text").attr("class","chart-title").attr("x",i/2).attr("y",u).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",d).attr("font-weight","700").attr("data-line-number",e.titleLineNumber).text(e.title).style("cursor",o?"pointer":"default");o&&U.on("click",()=>o(e.titleLineNumber))}let P=lr(n),F=(U,X)=>{if(U.color){let q=On(U.color,n);if(q)return q}return P[X%P.length]},Y=e.options["solid-fill"]==="on",z=e.layers.map((U,X)=>F(U,X)),j=z.map(U=>ie(n,U,r,{solid:Y})),K=V.append("g").attr("class","ring-body"),$=n.text;for(let U=0;U<m;U++){let X=e.layers[U],q=(U+1)*v,et=U*v,tt=j[U],B=K.append("g").attr("class","ring-layer").attr("data-line-number",X.lineNumber);if(o){let Q=X.lineNumber;B.style("cursor","pointer").on("click",()=>o(Q))}if(U===0)B.append("circle").attr("cx",_).attr("cy",M).attr("r",q).attr("fill",tt).attr("stroke",$).attr("stroke-width",YB).attr("stroke-opacity",VB);else{let Q=`M ${_-q} ${M} A ${q} ${q} 0 1 0 ${_+q} ${M} A ${q} ${q} 0 1 0 ${_-q} ${M} M ${_-et} ${M} A ${et} ${et} 0 1 0 ${_+et} ${M} A ${et} ${et} 0 1 0 ${_-et} ${M} Z`;B.append("path").attr("d",Q).attr("fill-rule","evenodd").attr("fill",tt).attr("stroke",$).attr("stroke-width",YB).attr("stroke-opacity",VB)}}if(H){let U=V.append("g").attr("class","ring-labels");for(let X=0;X<m;X++){let q=e.layers[X],et=j[X],B=X===0?M:M-(X+.5)*v,Q=G,ot=Le(et,n.textOnFillLight,n.textOnFillDark),lt=U.append("g").attr("class","ring-label-group").attr("data-line-number",q.lineNumber).append("text").attr("class","ring-label").attr("x",_).attr("y",B).attr("dy","0.35em").attr("text-anchor","middle").attr("fill",ot).attr("font-family",Pt).attr("font-size",Q).attr("font-weight",600).style("pointer-events","none");bn(lt,q.label,n,Q)}}(g||!H)&&Qst({parentG:V.append("g").attr("class","ring-descriptions"),layers:e.layers,colors:z,accentX:T,textX:R,textWidth:O,topY:y,bottomY:b,descFont:D,descLineHeight:W,palette:n,...o!==void 0&&{onClickItem:o}})}function Zst(t,e,n,r,o){qB(t,e,n,r,void 0,o)}function Qst(t){let{parentG:e,layers:n,colors:r,accentX:o,textX:a,textWidth:i,topY:s,bottomY:l,descFont:c,descLineHeight:d,palette:u,onClickItem:f}=t,p=Math.max(8,Math.floor(i/(c*Bo))),m=Math.round(c*1.3),g=Math.max(8,Math.round(c*.6)),h=l-s,S=L=>{let A=n.map(w=>Jst(Ko(w.description.slice(),p),L)),C=A.map(w=>m+w.length*d),k=C.reduce((w,v)=>w+v,0)+g*Math.max(0,n.length-1);return{wraps:A,blockHeights:C,totalH:k}},y=S(zB);for(let L=zB-1;L>=0&&y.totalH>h;L--)y=S(L);let{wraps:b,blockHeights:E,totalH:x}=y,N=s+Math.max(0,(h-x)/2);for(let L=0;L<n.length;L++){let A=n[L],C=b[L],k=E[L],w=e.append("g").attr("class","ring-desc").attr("data-line-number",A.lineNumber);if(f){let _=A.lineNumber;w.style("cursor","pointer").on("click",()=>f(_))}w.append("rect").attr("x",o).attr("y",N).attr("width",Xv).attr("height",k).attr("rx",Xv/2).attr("fill",r[L]);let v=w.append("text").attr("x",a).attr("y",N+Math.round(m*.7)).attr("text-anchor","start").attr("fill",u.text).attr("font-family",Pt).attr("font-size",c).attr("font-weight",600);bn(v,A.label,u,c);let M=N+m+Math.round(d*.4);for(let _ of C){let T=_.kind==="bullet-first"||_.kind==="bullet-cont";_.kind==="bullet-first"&&w.append("text").attr("x",a).attr("y",M).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",Pt).attr("font-size",c).text("\u2022");let R=w.append("text").attr("x",T?a+jst:a).attr("y",M).attr("text-anchor","start").attr("fill",u.textMuted).attr("font-family",Pt).attr("font-size",c);bn(R,_.text,u,c),M+=d}N+=k+g}}function Jst(t,e){if(t.length<=e)return t.slice();let n=t.slice(0,e);if(n.length===0)return n;let r=n[n.length-1];return n[n.length-1]={...r,text:r.text.endsWith("\u2026")?r.text:`${r.text} \u2026`},n}function jB(t,e,n){return Math.max(e,Math.min(n,t))}var Fst,Bst,Yst,Vst,zst,Ust,Xv,Xst,jst,YB,VB,zB,UB,qst,XB,Kst,ZB=st(()=>{"use strict";qn();an();tn();wr();Ro();en();Ds();mr();Fst=50,Bst=.03,Yst=16,Vst=.78,zst=.58,Ust=28,Xv=3,Xst=12,jst=10,YB=1,VB=.4,zB=4,UB=12,qst=22,XB=11,Kst=15});function JB(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>JB(e))}}function tlt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function QB(t,e){let n=t*.32,r=t/(Math.max(1,e)+1);return Math.min(n,r)}function t3(t,e){let n=e.maxDepth??1/0,r=Math.max(1,e.radius),o={label:"__root",children:t.map(m=>JB(m))},a=Ci(o).sum(m=>m.children?.length?0:m.value??0),i=a.value??0;if(i<=0)return{cells:[],total:0,discRadius:e.discRadius??QB(r,1),maxDepthReached:0,isEmpty:!0};let s=EE().size([2*Math.PI,1])(a),l=s.height,c=Math.min(r-1,e.discRadius??QB(r,l)),u=Math.max(1,r-c)/Math.max(1,l);(s.children??[]).forEach((m,g)=>{m.each(h=>{h._topIndex=g})});let f=[],p=0;for(let m of s.descendants()){if(m.depth===0||m.depth>n)continue;let g=!!m.children&&m.children.length>0;m.depth>p&&(p=m.depth);let h=[],S=m;for(;S&&S.depth>0;)h.unshift(S.data.label),S=S.parent;let y=c+(m.depth-1)*u,b=c+m.depth*u,E=tlt(m);f.push({node:m.data.ref??null,label:m.data.label,startAngle:m.x0,endAngle:m.x1,innerR:y,outerR:b,depth:m.depth,value:m.value??0,isContainer:g,isCollapsed:!1,topIndex:m._topIndex??0,pctOfRoot:i>0?(m.value??0)/i:0,pctOfParent:m.parent&&(m.parent.value??0)>0?(m.value??0)/(m.parent.value??1):1,...E!==void 0&&{heat:E},path:h,...m.data.lineNumber!==void 0&&{lineNumber:m.data.lineNumber}})}return{cells:f,total:i,discRadius:c,maxDepthReached:p,isEmpty:!1}}var e3=st(()=>{"use strict";Ug()});function elt(t,e,n){if(e<=1)return t;let r=Math.max(55,100-(e-1)*18);return Ot(t,n,r)}function pb(t,e){let n=e??t.defaultColorMode;return n==="tag"&&t.tagGroups.length===0&&(n=t.hasHeat?"heat":"branch"),n==="heat"&&!t.hasHeat&&(n="branch"),n}function mb(t,e){if(e.mode==="heat")return t.heat!==void 0&&e.heat?e.heat.scale(t.heat):jv;if(e.mode==="tag")return t.node?sr(t.node.metadata,e.tagGroups,e.activeGroup)??jv:jv;let n=t.path[0]??t.label,r=(e.rootIndexByLabel.get(n)??t.topIndex)+e.colorOffset,o=e.seriesColors[r%e.seriesColors.length];return elt(o,t.depth,e.bg)}function gb(t,e){if(!t.hasHeat)return null;let n=[],r=f=>{for(let p of f)typeof p.heat=="number"&&n.push(p.heat),r(p.children)};if(r(t.roots),n.length===0)return null;let o=Math.min(...n),a=Math.max(...n),i=o<0&&a>0,s=e.surface,l=t.options.heatColors.map(f=>On(f,e)??f).filter(f=>!!f),c,d;if(l.length>=2){c=[l[0],s,l[1]];let f=i?0:(o+a)/2;d=[o,f,a]}else l.length===1?(c=[s,l[0]],d=[o,a]):i?(c=[e.colors.red,s,e.colors.green],d=[o,0,a]):(c=[s,e.primary],d=[o,a]);if(d[0]===d[d.length-1]){let f=c[c.length-1];return{scale:()=>f,min:o,max:a,stops:c,signed:i}}let u=ir().domain(d).range(c).clamp(!0);return{scale:f=>nlt(u(f)),min:o,max:a,stops:c,signed:i}}function nlt(t){if(t.startsWith("#"))return t;let e=t.match(/rgba?\(([^)]+)\)/);if(!e)return t;let n=e[1].split(",").map(o=>Math.round(parseFloat(o))),r=o=>Math.max(0,Math.min(255,o||0)).toString(16).padStart(2,"0");return`#${r(n[0]??0)}${r(n[1]??0)}${r(n[2]??0)}`}function tu(t){let e=Math.abs(t);return e>=1e9?fb(t/1e9)+"B":e>=1e6?fb(t/1e6)+"M":e>=1e3?fb(t/1e3)+"k":fb(Math.round(t*100)/100)}function fb(t){return parseFloat(t.toFixed(t<10&&!Number.isInteger(t)?1:0)).toString()}function Ep(t){let e=t*100;return e>=10?`${Math.round(e)}%`:e>=1?`${e.toFixed(0)}%`:`${e.toFixed(1)}%`}function hb(t,e,n,r,o){let a=[],i=new Map,s=null;if(e.tagGroups.length>0){let l=e.tagGroups[0],c=new Set,d=u=>{for(let f of u){let p=f.metadata[qt(l.name)];p&&c.add(p.toLowerCase()),d(f.children)}};d(e.roots),a.push({name:l.name,entries:l.entries.filter(u=>c.has(u.value.toLowerCase())).map(u=>({value:u.value,color:u.color}))}),i.set(l.name,"tag"),t==="tag"&&(s=l.name)}if(n){let l=e.options.heatLabel??"Value";a.push({name:l,entries:[],gradient:{min:n.min,max:n.max,low:n.stops[0],high:n.stops[n.stops.length-1]}}),i.set(l,"heat"),t==="heat"&&(s=l)}return a.push({name:"Branch",entries:e.roots.map((l,c)=>({value:l.label,color:r[(c+o)%r.length]}))}),i.set("Branch","branch"),(t==="branch"||s===null)&&(s="Branch"),{groups:a,activeGroup:s,modeByName:i}}var jv,qv=st(()=>{"use strict";Xa();wr();tn();je();jv="#cbd5e1"});var o3={};ye(o3,{renderTreemapRadial:()=>r3,renderTreemapRadialForExport:()=>alt});function alt(t,e,n,r,o,a){r3(t,e,n,r,o,{exportMode:!0,...a})}function r3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=a.exportMode??!1,u=lr(n),f=gb(e,n),p=c.noLegend?null:hb(l,e,f,u,a.colorOffset??0),g=(p?Cr({groups:p.groups,position:n3,mode:"preview"},i)+Bn:0)+yb,h=Math.max(1,i-yb*2),S=Math.max(1,s-g-yb),y=Math.max(1,Math.min(h,S)/2-yb),b=i/2,E=g+S/2,x=t3(e.roots,{radius:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),N=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap dgmo-treemap-radial").style("font-family",Pt),L=N.append("defs");N.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg);let A=N.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${E})`),C=e.tagGroups.length>0?e.tagGroups[0].name:null,k=new Map(e.roots.map((_,T)=>[_.label,T])),w={mode:l,heat:f,tagGroups:e.tagGroups,activeGroup:C,rootIndexByLabel:k,seriesColors:u,colorOffset:a.colorOffset??0,bg:n.bg},v=Nl().startAngle(_=>_.startAngle).endAngle(_=>_.endAngle).innerRadius(_=>_.innerR).outerRadius(_=>_.outerR).padAngle(.004).padRadius(y),M=0;if(!x.isEmpty)for(let _ of x.cells){let T=mb(_,w),R=A.append("g").attr("class","dgmo-treemap-cell").attr("data-node-path",_.path.join(" / "));if(_.lineNumber!==void 0&&R.attr("data-line-number",_.lineNumber),_.heat!==void 0&&R.attr("data-heat",_.heat),_.node&&C){let O=qt(C),I=_.node.metadata[O];I&&R.attr(`data-tag-${O}`,I)}R.append("path").attr("class",_.isContainer?"dgmo-treemap-arc branch":"dgmo-treemap-arc").attr("d",v(_)??"").attr("fill",T).attr("stroke",n.bg).attr("stroke-width",1),slt(R,L,`dgmo-arc-lbl-${M++}`,_,c,n,T)}if(ilt(A,e,x.discRadius,x.total,x.isEmpty,n),p){let _=N.append("g").attr("class","dgmo-treemap-legend").attr("transform","translate(0, 0)");mn(_,{groups:p.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:d?"export":"preview",position:n3,activeGroup:p.activeGroup,showInactivePills:!d,showEmptyGroups:!d})}}function ilt(t,e,n,r,o,a){let i=t.append("g").attr("class","dgmo-treemap-disc");i.append("circle").attr("r",n).attr("fill",a.surface).attr("stroke",a.bg).attr("stroke-width",1);let s=Le(a.surface,a.textOnFillLight,a.textOnFillDark),l=n*1.7;if(o){i.append("text").attr("class","dgmo-treemap-empty").attr("text-anchor","middle").attr("y",4).attr("fill",s).attr("font-size",bb(13,n)).text(xb("No values to chart",l,13));return}let c=e.title??"",d=tu(r),u=bb(15,n),f=bb(22,n);if(c){let p=i.append("text").attr("class","dgmo-treemap-disc-title").attr("text-anchor","middle").attr("y",-4).attr("fill",s).attr("font-size",u).attr("font-weight",600).text(xb(c,l,u));e.titleLineNumber!==null&&p.attr("data-line-number",e.titleLineNumber)}i.append("text").attr("class","dgmo-treemap-disc-total").attr("text-anchor","middle").attr("y",c?u:8).attr("fill",s).attr("font-size",f).attr("font-weight",700).text(xb(d,l,f))}function slt(t,e,n,r,o,a,i){let s=r.endAngle-r.startAngle;if(s<rlt)return;let l=r.outerR-r.innerR;if(l<10)return;let c=Le(i,a.textOnFillLight,a.textOnFillDark),d=(r.innerR+r.outerR)/2,u=bb(13,l),p=[o.noValues?"":tu(r.value),o.noPercent?"":Ep(r.pctOfRoot)].filter(Boolean).join(" \xB7 "),m=p?`${r.label} ${p}`:r.label,g=s*d*.94,h=u,S=_t(m,u);S>g&&(h=Math.max(olt,Math.floor(u*g/S)));let y=xb(m,g,h);y&&llt(t,e,n,r,d,h,y,c)}function llt(t,e,n,r,o,a,i,s){let l=(r.startAngle+r.endAngle)/2,c=l>Math.PI/2&&l<3*Math.PI/2,d=c?o+a*.32:o-a*.32,[u,f]=c?[r.endAngle,r.startAngle]:[r.startAngle,r.endAngle],p=Math.sin(u)*d,m=-Math.cos(u)*d,g=Math.sin(f)*d,h=-Math.cos(f)*d,S=c?0:1,y=`M ${p.toFixed(2)} ${m.toFixed(2)} A ${d.toFixed(2)} ${d.toFixed(2)} 0 0 ${S} ${g.toFixed(2)} ${h.toFixed(2)}`;e.append("path").attr("id",n).attr("d",y),t.append("text").attr("class","dgmo-treemap-label").attr("font-size",a).attr("font-weight",600).attr("fill",s).append("textPath").attr("href",`#${n}`).attr("startOffset","50%").attr("text-anchor","middle").text(i)}function bb(t,e){return Math.max(8,Math.min(t,Math.round(e*.9)))}function xb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var yb,n3,rlt,olt,a3=st(()=>{"use strict";qn();So();an();tn();je();en();Br();_o();Tr();e3();qv();yb=12,n3={placement:"top-center",titleRelation:"below-title"},rlt=6*Math.PI/180,olt=8});function i3(t){return t.children.length===0?{ref:t,label:t.label,value:t.value??0,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber}:{ref:t,label:t.label,...t.heat!==void 0&&{heat:t.heat},lineNumber:t.lineNumber,children:t.children.map(e=>i3(e))}}function clt(t){if(t.data.heat!==void 0)return t.data.heat;let e=[];for(let n of t.leaves())n.data.heat!==void 0&&e.push(n.data.heat);if(e.length!==0)return e.reduce((n,r)=>n+r,0)/e.length}function s3(t,e){let n=e.maxDepth??1/0,r={label:"__root",children:t.map(l=>i3(l))},o=Ci(r).sum(l=>l.children?.length?0:l.value??0).sort((l,c)=>(c.value??0)-(l.value??0)),a=ME().tile(gf).size([e.width,e.height]).paddingOuter(e.paddingOuter??3).paddingTop(e.headerH>0?e.headerH:e.paddingInner??2).paddingInner(e.paddingInner??2).round(!0)(o),i=a.value??0;(a.children??[]).forEach((l,c)=>{l.each(d=>{d._topIndex=c})});let s=[];for(let l of a.descendants()){if(l.depth===0||l.depth>n)continue;let c=!!l.children&&l.children.length>0,d=c&&l.depth>=n,u=c&&!d,f=[],p=l;for(;p&&p.depth>0;)f.unshift(p.data.label),p=p.parent;let m=clt(l);s.push({node:l.data.ref??null,label:l.data.label,x0:l.x0,y0:l.y0,x1:l.x1,y1:l.y1,depth:l.depth,value:l.value??0,isContainer:u,isCollapsed:d,topIndex:l._topIndex??0,pctOfRoot:i>0?(l.value??0)/i:0,pctOfParent:l.parent&&(l.parent.value??0)>0?(l.value??0)/(l.parent.value??1):1,...m!==void 0&&{heat:m},path:f,...l.data.lineNumber!==void 0&&{lineNumber:l.data.lineNumber}})}return{cells:s,total:i}}var l3=st(()=>{"use strict";Ug()});var f3={};ye(f3,{renderTreemap:()=>u3,renderTreemapForExport:()=>plt});function plt(t,e,n,r,o,a){u3(t,e,n,r,o,{exportMode:!0,...a})}function u3(t,e,n,r,o,a={}){if(e.error||e.roots.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=o?.width??t.clientWidth,s=o?.height??t.clientHeight;if(i<=0||s<=0)return;let l=pb(e,a.colorMode),c=e.options,d=c.solidFill,u=a.exportMode??!1,f=lr(n),p=!!e.title,m=p?ult:0,g=gb(e,n),h=c.noLegend?null:hb(l,e,g,f,a.colorOffset??0),S=h?Cr({groups:h.groups,position:c3,mode:"preview"},i)+Bn:0,y=c.noHeaders?0:dlt,b=wb,E=m+S+wb,x=Math.max(1,i-wb*2),N=Math.max(1,s-E-wb),L=s3(e.roots,{width:x,height:N,headerH:y,...a.maxDepth!==void 0&&{maxDepth:a.maxDepth}}),A=It(t).append("svg").attr("width",i).attr("height",s).attr("viewBox",`0 0 ${i} ${s}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-treemap").style("font-family",Pt);if(A.append("style").text(".dgmo-treemap-focus{opacity:.3;transition:opacity .12s}.dgmo-treemap-cell:hover .dgmo-treemap-focus{opacity:.7}"),A.append("rect").attr("width",i).attr("height",s).attr("fill",n.bg),p){let T=A.append("text").attr("class","chart-title").attr("x",i/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&T.attr("data-line-number",e.titleLineNumber)}let C=A.append("g").attr("class","dgmo-treemap-cells").attr("transform",`translate(${b},${E})`),k=f,w=a.colorOffset??0,v=e.tagGroups.length>0?e.tagGroups[0].name:null,M=new Map(e.roots.map((T,R)=>[T.label,R])),_={mode:l,heat:g,tagGroups:e.tagGroups,activeGroup:v,rootIndexByLabel:M,seriesColors:k,colorOffset:w,bg:n.bg};for(let T of L.cells){let R=Math.max(0,T.x1-T.x0),O=Math.max(0,T.y1-T.y0);if(R<=0||O<=0)continue;let I=mb(T,_),H=T.isContainer||d?I:Ot(I,n.bg,flt),G=T.isContainer||T.isCollapsed,D=C.append("g").attr("class","dgmo-treemap-cell").attr("transform",`translate(${T.x0},${T.y0})`).attr("data-node-path",T.path.join(" / "));if(T.lineNumber!==void 0&&D.attr("data-line-number",T.lineNumber),T.heat!==void 0&&D.attr("data-heat",T.heat),T.node&&v){let Y=qt(v),z=T.node.metadata[Y];z&&D.attr(`data-tag-${Y}`,z)}let W=D.append("rect").attr("class",T.isContainer?"dgmo-treemap-rect branch":"dgmo-treemap-rect").attr("width",R).attr("height",O).attr("rx",2).attr("fill",H).attr("fill-opacity",1).attr("stroke",n.bg).attr("stroke-width",T.isContainer?1:0);if(G&&a.onClickItem&&T.lineNumber!==void 0){let Y=T.lineNumber;W.style("cursor","pointer").on("click",()=>a.onClickItem(Y))}let V=Le(H,n.textOnFillLight,n.textOnFillDark);if(T.isContainer&&y>0&&R>34&&O>y){let Y=[];c.noValues||Y.push(tu(T.value)),c.noPercent||Y.push(Ep(T.pctOfRoot));let z=Y.join(" \xB7 "),j=G?16:4,K=z.length>0&&R>110,$=K?_t(z,10.5):0,U=R-8-j-(K?$+10:0);D.append("text").attr("class","dgmo-treemap-header").attr("x",6).attr("y",13).attr("font-size",11).attr("font-weight",700).attr("fill",V).text(Sb(T.label,Math.max(0,U),11)),K&&D.append("text").attr("class","dgmo-treemap-header-value").attr("x",R-j-4).attr("y",13).attr("text-anchor","end").attr("font-size",10.5).attr("fill",V).attr("opacity",.75).text(z)}let P=Math.max(4,Math.min(14,Math.floor(Math.min(R,O)/5))),F=7;if(!T.isContainer&&R>=2*P+8&&O>=2*P+8){let Y=R-2*P;if(_t(T.label,F)*1.06>Y&&O>R*1.25&&O-2*P>Y){mlt(D,T.label,R,O,P,V),G&&R>30&&O>22&&d3(D,R,V,9);continue}let j=Lp(Math.round(Math.min(R/3.6,O/3.4)),F,72),K=_t(T.label,j)*1.06;K>Y&&(j=Math.max(F,Math.floor(j*Y/K)));let U=.95-Lp((j-F)/(72-F),0,1)*.5,X=Lp(Math.round(j*.42),11,28),q=Math.max(.45,U-.1),et=P+Math.round(j*.78);D.append("text").attr("class","dgmo-treemap-label").attr("x",P).attr("y",et).attr("font-size",j).attr("font-weight",600).attr("fill",V).attr("opacity",U).text(Sb(T.label,Y,j));let tt=[c.noValues?"":tu(T.value),c.noPercent?"":Ep(T.pctOfRoot)].filter(Boolean),B=tt.join(" \xB7 "),Q=et,ot=(Z,lt,nt,J)=>{D.append("text").attr("class","dgmo-treemap-value").attr("x",P).attr("y",lt).attr("font-size",nt).attr("fill",V).attr("opacity",J).text(Z)};if(B){let Z=_t(B,X)<=Y,lt=et+Eb(j,X),nt=lt+Sp(X)<=O-P;if(Z&&nt)ot(B,lt,X,q);else if(Z){let J=Lp(Math.round(j*.5),11,Math.max(11,X)),at=Sb(T.label,Y,j),it=_t(at,j)*1.12,Lt=Math.max(12,Math.round(j*.25));P+it+Lt+_t(B,J)<=R-P&&D.append("text").attr("class","dgmo-treemap-value").attr("x",P+it+Lt).attr("y",Q).attr("font-size",J).attr("fill",V).attr("opacity",q).text(B)}else if(tt.length===2){let J=Eb(j,X);et+J+Sp(X)<=O-P&&(et+=J,ot(tt[0],et,X,q));let at=Math.max(10,Math.round(X*.9)),it=Eb(X,at);et+it+Sp(at)<=O-P&&(et+=it,ot(tt[1],et,at,q))}else{let J=et+Eb(j,X);J+Sp(X)<=O-P&&ot(B,J,X,q)}}}G&&R>30&&O>22&&d3(D,R,V,9)}if(h){let T=A.append("g").attr("class","dgmo-treemap-legend").attr("transform",`translate(0, ${m})`);mn(T,{groups:h.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:i,mode:u?"export":"preview",position:c3,activeGroup:h.activeGroup,showInactivePills:!u,showEmptyGroups:!u,...a.onSelectMode!==void 0&&{callbacks:{onGroupToggle:R=>{let O=h.modeByName.get(R);O&&a.onSelectMode(O)}}}})}}function d3(t,e,n,r){let a=e-4.5-5,i=t.append("g").attr("class","dgmo-treemap-focus").attr("data-export-ignore","true");i.append("rect").attr("x",a-9).attr("y",r-9).attr("width",18).attr("height",18).attr("fill","transparent"),i.append("circle").attr("cx",a).attr("cy",r).attr("r",4.5).attr("fill","none").attr("stroke",n).attr("stroke-width",1.25),i.append("circle").attr("cx",a).attr("cy",r).attr("r",1.4).attr("fill",n)}function mlt(t,e,n,r,o,a){let s=r-2*o,l=n-2*o,c=Lp(Math.round(Math.min(l/.8,14)),6,22),d=_t(e,c)*1.06;d>s&&(c=Math.max(6,Math.floor(c*s/d)));let u=Sb(e,s,c);u&&t.append("text").attr("class","dgmo-treemap-label").attr("transform",`translate(${n/2},${r/2}) rotate(-90)`).attr("y",Math.round(c*.28)).attr("text-anchor","middle").attr("font-size",c).attr("font-weight",600).attr("fill",a).attr("opacity",.95).text(u)}function Sp(t){return Math.ceil(t*.26)}function Eb(t,e,n=4){return Sp(t)+n+Math.round(e*.72)}function Lp(t,e,n){return Math.max(e,Math.min(n,t))}function Sb(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}var wb,dlt,ult,flt,c3,p3=st(()=>{"use strict";qn();an();tn();je();en();Br();_o();Tr();l3();qv();wb=12,dlt=18,ult=36,flt=50,c3={placement:"top-center",titleRelation:"below-title"}});function g3(t,e={}){let n=e.collapsed??new Set,r=y3(t,0,0,null,n);return{width:r.w,height:r.h,items:r.items}}function Zv(t){return Math.max(1,...t.rows.map(e=>e.reduce((n,r)=>n+(r.span||1),0)))}function ylt(t){return Math.max(Jv,Math.min(glt,_t(t.label,hlt)+2*vp+14))}function h3(t){let e=Jv;for(let n of t.rows)for(let r of n){if(!Ja(r))continue;let o=r.grid?blt(r.grid)+2*vp:ylt(r);e=Math.max(e,o/(r.span||1))}return e}function blt(t){let e=t.cols??Zv(t);return e*h3(t)+(e+1)*vo}function y3(t,e,n,r,o){let a=t.cols??Zv(t),i=r??h3(t),s=a*i+(a+1)*vo,l=n+vo,c=[],d=e+vo;for(let f of t.rows){let p=e+vo,m=Kv,g=[];for(let h of f){let S=h.span||1,y=S*i+(S-1)*vo;if(!Ja(h)){g.push({type:"empty",x:p,y:l,w:y,h:Kv}),p+=y+vo,d=Math.max(d,p-vo);continue}if(h.grid&&o.has(h.id)){let b={type:"collapsed",x:p,y:l,w:y,h:m3,label:h.label,node:h,lineNumber:h.lineNumber};g.push(b),m=Math.max(m,m3),p+=y+vo,d=Math.max(d,p-vo);continue}if(h.grid){let b=h.grid.cols??Zv(h.grid),E=Math.max(Jv*.66,(y-2*vp-(b+1)*vo)/b),x=y3(h.grid,p+vp,l+Lb,E,o),N=Lb+x.h+vp;g.push({type:"container",x:p,y:l,w:y,h:N,label:h.label,node:h,lineNumber:h.lineNumber,inner:x.items}),m=Math.max(m,N),p+=y+vo,d=Math.max(d,p-vo);continue}g.push({type:"leaf",x:p,y:l,w:y,h:Kv,label:h.label,node:h,lineNumber:h.lineNumber}),p+=y+vo,d=Math.max(d,p-vo)}c.push(...g),l+=m+vo}let u=Math.max(s,d-e+vo);return{x:e,y:n,w:u,h:l-n,items:c}}var vo,vp,Kv,Lb,m3,Qv,Jv,glt,hlt,b3=st(()=>{"use strict";en();kg();vo=12,vp=10,Kv=46,Lb=28,m3=46,Qv=6,Jv=104,glt=250,hlt=13});var v3={};ye(v3,{authoredCollapsedIds:()=>L3,renderBlock:()=>E3,renderBlockForExport:()=>Elt});function Elt(t,e,n,r,o,a){E3(t,e,n,r,o,{exportMode:!0,...a})}function E3(t,e,n,r,o,a={}){if(e.error||e.top.rows.length===0)return;It(t).selectAll(":not([data-d3-tooltip])").remove();let i=e.options,s=!!e.title,l=s?xlt:0,c=a.collapsed??L3(e),d=g3(e.top,{collapsed:c}),u=i.noLegend?null:Nlt(e),f,p;a.exportMode?f=Math.max(d.width,wlt)+eu*2:f=o?.width??t.clientWidth;let m=u?Cr({groups:u.groups,position:x3,mode:"preview"},f)+Bn:0,g=l+m+eu;if(a.exportMode?p=g+d.height+eu:p=o?.height??t.clientHeight,f<=0||p<=0)return;let h=eu,S=Math.max(1,f-eu*2),y=Math.max(1,p-g-eu),b=Math.min(1,S/d.width,y/d.height),E=h+(S-d.width*b)/2,x=g,N=It(t).append("svg").attr("width",f).attr("height",p).attr("viewBox",`0 0 ${f} ${p}`).attr("preserveAspectRatio","xMidYMin meet").attr("xmlns","http://www.w3.org/2000/svg").attr("class","dgmo-block").style("font-family",Pt);if(s){let k=N.append("text").attr("class","chart-title").attr("x",f/2).attr("y",30).attr("text-anchor","middle").attr("fill",n.text).attr("font-family",Pt).attr("font-size",20).attr("font-weight","700").text(e.title);e.titleLineNumber!==null&&k.attr("data-line-number",e.titleLineNumber)}let L=e.tagGroups.length>0?e.tagGroups[0].name:null,A=Ot(n.text,n.bg,22),C=N.append("g").attr("class","dgmo-block-cells").attr("transform",`translate(${E},${x}) scale(${b})`);if(S3(C,d.items,{palette:n,tagGroups:e.tagGroups,activeGroup:L,activeKey:L?qt(L):null,neutral:A,solidFill:i.solidFill,onToggle:a.onToggle}),u){let k=N.append("g").attr("class","dgmo-block-legend").attr("transform",`translate(0, ${l})`);mn(k,{groups:u.groups,palette:{bg:n.bg,surface:n.surface,text:n.text,textMuted:n.textMuted,primary:n.primary},isDark:r,width:f,mode:a.exportMode?"export":"preview",position:x3,activeGroup:u.activeGroup})}}function Slt(t,e){return!t||!e.activeGroup?null:sr(t.metadata,e.tagGroups,e.activeGroup)??null}function tN(t,e,n){if(_t(t,n)<=e)return t;let r=0,o=t.length;for(;r<o;){let a=Math.ceil((r+o)/2);_t(t.slice(0,a)+"\u2026",n)<=e?r=a:o=a-1}return r<=0?"":t.slice(0,r)+"\u2026"}function S3(t,e,n,r=[]){let{palette:o,solidFill:a}=n;for(let i of e){if(i.type==="empty"){t.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",7).attr("fill","none").attr("stroke",n.neutral).attr("stroke-width",1).attr("stroke-dasharray","3 4").attr("opacity",.7);continue}let s=i.node,l=[...r,s.id],c=Slt(s,n),d=c??n.neutral,u=t.append("g").attr("class","dgmo-block-cell").attr("data-block-id",s.id).attr("data-block-path",l.join(" / "));if(i.lineNumber!==void 0&&u.attr("data-line-number",i.lineNumber),n.activeKey){let p=s.metadata[n.activeKey];p&&u.attr(`data-tag-${n.activeKey}`,p)}if(i.type==="collapsed"){let p=c?a?c:Ot(c,o.bg,12):o.surface,m=`dgmo-block-clip-${Llt++}`;u.append("clipPath").attr("id",m).append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+4).attr("text-anchor","middle").attr("font-size",12.5).attr("font-weight",700).attr("fill",o.text).text(tN(i.label??"",i.w-24,12.5)),u.append("rect").attr("x",i.x).attr("y",i.y+i.h-Qv).attr("width",i.w).attr("height",Qv).attr("fill",a&&c?o.text:d).attr("clip-path",`url(#${m})`),w3(u,i,n,i.h);continue}if(i.type==="container"){let p=c?a?c:Ot(c,o.bg,7):o.surface;u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",10).attr("fill",p).attr("stroke",d).attr("stroke-width",1.5);let m=Math.min(i.w,i.h*2.5),g=Math.max(13,Math.min(20,Math.round(13+(m-220)/70))),S=.92-(g-13)/7*.3,y=i.y+Math.round(g*.7)+7;u.append("text").attr("x",i.x+i.w/2).attr("y",y).attr("text-anchor","middle").attr("font-size",g).attr("font-weight",700).attr("fill",o.text).attr("opacity",S).text(tN(i.label??"",i.w-24,g)),w3(u,i,n,Lb),i.inner&&S3(t,i.inner,n,l);continue}let f=c?a?c:Ot(c,o.bg,14):o.bg;u.attr("data-leaf","true"),u.append("rect").attr("x",i.x).attr("y",i.y).attr("width",i.w).attr("height",i.h).attr("rx",8).attr("fill",f).attr("stroke",d).attr("stroke-width",1.25),u.append("text").attr("x",i.x+i.w/2).attr("y",i.y+i.h/2+5).attr("text-anchor","middle").attr("font-size",13).attr("font-weight",600).attr("fill",o.text).text(tN(i.label??"",i.w-16,13))}}function w3(t,e,n,r){if(!n.onToggle||!e.node||e.lineNumber===void 0)return;let o=e.node.id,a=e.lineNumber;t.append("rect").attr("x",e.x).attr("y",e.y).attr("width",e.w).attr("height",r).attr("rx",10).attr("fill","transparent").style("cursor","pointer").on("click",()=>n.onToggle(o,a))}function L3(t){let e=new Set;return vlt(t,e),e}function vlt(t,e){let n=r=>{for(let o of r.rows)for(let a of o)Ja(a)&&(a.collapsed&&a.grid&&e.add(a.id),a.grid&&n(a.grid))};n(t.top)}function Nlt(t){if(t.tagGroups.length===0)return null;let e=t.tagGroups[0],n=qt(e.name),r=new Set,o=i=>{for(let s of i.rows)for(let l of s)if(Ja(l)){let c=l.metadata[n];c&&r.add(c.toLowerCase()),l.grid&&o(l.grid)}};o(t.top);let a=e.entries.filter(i=>r.has(i.value.toLowerCase())).map(i=>({value:i.value,color:i.color}));return a.length===0?null:{groups:[{name:e.name,entries:a}],activeGroup:e.name}}var eu,xlt,wlt,x3,Llt,N3=st(()=>{"use strict";qn();an();tn();je();Br();_o();Tr();en();kg();b3();eu=12,xlt=36,wlt=220,x3={placement:"top-center",titleRelation:"below-title"};Llt=0});var $3={};ye($3,{MARKER_LABELS:()=>Nb,renderRaci:()=>G3,renderRaciForExport:()=>Jlt});function Mlt(t){let e=new Map;if(t.diagnostics.length===0)return e;let n=[];for(let r of t.tasksWithoutPhase)n.push(r);for(let r of t.phases)for(let o of r.tasks)n.push(o);for(let r of t.diagnostics){if(r.line<=0)continue;let o=n.find(s=>r.line>=s.lineNumber&&r.line<=s.endLineNumber);if(!o)continue;let a=e.get(o.id);a?r.line<a.firstLine&&(a.firstLine=r.line):(a={errors:[],warnings:[],firstLine:r.line},e.set(o.id,a));let i={line:r.line,message:r.message};r.severity==="error"?a.errors.push(i):a.warnings.push(i)}return e}function klt(t){let e=t.match(/^Task '[^']*'\s+(.+)$/);if(e){let n=e[1];return n.charAt(0).toUpperCase()+n.slice(1)}return t.replace(/\s+on task '[^']*'/,"")}function Tlt(t,e,n,r,o){let a=Math.min(o,n/2,r/2);return`M ${t} ${e+a} A ${a} ${a} 0 0 1 ${t+a} ${e} H ${t+n-a} A ${a} ${a} 0 0 1 ${t+n} ${e+a} V ${e+r} H ${t} Z`}function _3(t,e){let n=new Map(e.map((r,o)=>[r,o]));return[...t].sort((r,o)=>(n.get(r)??99)-(n.get(o)??99))}function eN(t,e){return e.colors[C3[t%C3.length]]}function oN(t,e){switch(t){case"R":return e.colors.green;case"A":return e.colors.red;case"S":return e.colors.teal;case"C":return e.colors.yellow;case"I":return e.colors.gray;case"D":return e.colors.purple}}function G3(t,e,n,r,o,a){let i=typeof o=="function"?{onClickLine:o}:o??{},s=i.onClickLine,l=i.onMarkerDragStart,c=i.hideLegend??!1,d=i.collapsedPhases??new Set,u=(i.hideTitle??!1)||e.options["no-title"]==="on";It(t).selectAll(":not([data-d3-tooltip])").remove();let f=a?.width??t.clientWidth,p=a?.height??t.clientHeight;if(f<=0||p<=0)return;let m=[...es(e)];if(m.length===0&&e.phases.length===0)return;let g=e.options["solid-fill"]==="on",h=or(n,r),S=Math.max(1,e.roles.length),y=S*T3+k3+2*M3,b=a?Ee.identity():Ee.from(f,y),E=b.text(20),x=b.structural(30),N=b.aesthetic(M3),L=b.aesthetic(_lt),A=b.structural(Clt),C=b.structural($lt),k=b.structural(A3),w=b.structural(Hlt),v=b.structural(Wlt),M=b.structural(k3),_=b.structural(Flt),T=b.structural(T3),R=b.structural(Blt),O=b.text(D3),I=b.text(jlt),H=b.text(qlt),G=b.text(Ult),D=b.text(P3),W=b.structural(Ylt),V=b.structural(Vlt),P=b.structural(zlt),F=b.structural(Alt),Y=b.structural(Rlt),z=b.structural(Ilt),j=b.structural(Plt),K=b.aesthetic(Dlt),$=b.text(Glt),U=b.text(Olt),X=b.structural(R3),q=b.structural(I3),et=b.structural(1.5),tt=b.structural(Klt),B=Math.max(0,f-2*N),Q=Math.max(_,Math.min(T,Math.floor((B-v)/S))),ot=B-Q*S;ot>M&&(ot=M,Q=Math.max(_,Math.floor((B-ot)/S))),ot<v&&(ot=v);let Z=Mlt(e),lt=[];for(let te of e.tasksWithoutPhase)lt.push({kind:"task",task:te});for(let te of e.phases){let ae=d.has(te.id);if(lt.push({kind:"phase",phase:te,collapsed:ae}),!ae)for(let Te of te.tasks)lt.push({kind:"task",task:Te})}let J=!u||!c?A:L,at=(A-F)/2,it=J+L,Tt=it+C,At=[],rt=ot-16,pt=new Map;for(let te of lt)if(te.kind==="task"){let ae=Z.get(te.task.id);pt.set(te.task.id,O3(te.task,ae,rt,O,D,k,q,X))}for(let te of lt)if(At.push(Tt),te.kind==="phase")Tt+=w;else{let ae=pt.get(te.task.id);Tt+=ae?.rowHeight??k}let gt=Tt+P,dt=gt+L,ut=a?dt:Math.max(p,dt),yt=It(t).append("svg").attr("xmlns","http://www.w3.org/2000/svg").attr("width",f).attr("height",ut).attr("viewBox",`0 0 ${f} ${ut}`).attr("preserveAspectRatio","xMidYMin meet").attr("font-family",Pt).style("background","transparent");b.isBelowFloor&&yt.attr("width","100%");let vt=Nb[e.variant],Gt=Object.keys(vt).filter(te=>vt[te]!==void 0),Xt=Gt.length,bt=Y*Math.max(0,Xt-1),Mt=Gt.reduce((te,ae)=>Math.max(te,_t(vt[ae]??"",$)),0),zt=Math.max(z,Math.ceil(36+Mt+8)),xt=Xt*zt+bt,Nt=Xt*j+bt,Dt=e.title&&!u?_t(e.title,E):0,Vt="full",$t=xt,ft=zt;c?$t=0:B-Dt-K<xt&&(Vt="letters",$t=Nt,ft=j);let Wt=N+B-$t,ge=c?B:Wt-N-K;e.title&&!u&&yt.append("text").attr("x",N).attr("y",x).attr("text-anchor","start").attr("font-size",E).attr("font-weight","700").attr("fill",n.text).text(nr(e.title,E,ge)),!c&&Xt>0&&Qlt(yt,Gt,e.variant,Wt,at,Vt,ft,n,h,g,l,Y,F,tt,et,U,$);let ne=te=>N+ot+te*Q,se=gt-it;if(e.phases.length===0){let te=yt.append("g").attr("class","raci-row-bands");lt.forEach((ae,Te)=>{if(ae.kind!=="task")return;let Je=e.tasksWithoutPhase.indexOf(ae.task);if(Je<0)return;let ln=At[Te],Ve=pt.get(ae.task.id)?.rowHeight??k;te.append("rect").attr("class","raci-row-band").attr("data-task-id",ae.task.id).attr("x",N).attr("y",ln+2).attr("width",B).attr("height",Ve-4).attr("rx",6).attr("fill",Ot(eN(Je,n),h,12))})}let Zt=yt.append("g").attr("class","raci-columns");e.roles.forEach((te,ae)=>{let Te=ne(ae)+V,Je=Q-2*V,ln=e.roleColors[ae]??eN(ae,n),Ve=Ot(ln,or(n,r),16),Ce=Ot(ln,or(n,r),30),ee=Zt.append("g").attr("class","raci-column").attr("data-role-id",te);ee.append("rect").attr("class","raci-column-body").attr("x",Te).attr("y",it).attr("width",Je).attr("height",se).attr("rx",W).attr("fill",Ve),ee.append("path").attr("class","raci-column-header").attr("d",Tlt(Te,it,Je,C,W)).attr("fill",Ce);let oe=ne(ae)+Q/2;ee.append("text").attr("class","raci-column-label").attr("x",oe).attr("y",it+C/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",I).attr("font-weight",600).attr("fill",n.text).text(nr(e.roleDisplayNames[ae]??"",I,Q-2*R))});let Ie=Z.size>0,Ht=22,Qt=V+4,Ut=Q-2*Qt,fe=!0;for(let te of lt)if(!(te.kind!=="phase"||!te.collapsed)){for(let ae of e.roles){let Te=new Set;for(let Ve of te.phase.tasks){let Ce=Ve.roleAssignments.find(ee=>ee.id===ae);if(Ce)for(let ee of Ce.markers)Te.add(ee)}if(Te.size===0)continue;let Je=Np*Math.max(0,Te.size-1);if((Ut-Je)/Te.size<Ht){fe=!1;break}}if(!fe)break}for(let te=0;te<lt.length;te++){let ae=lt[te],Te=At[te];if(ae.kind==="phase"){let Je=e.phases.indexOf(ae.phase);tct(yt,ae.phase,N,Te,B,n,ae.collapsed,eN(Math.max(0,Je),n),e.roles,ne,Q,e.variant,h,g,fe,w,H,V,tt)}else ect(yt,ae.task,e,N,Te,ot,ne,Q,n,h,g,Z,Ie,pt.get(ae.task.id),s,l,O,D,R,k,V,tt,et,G,$,q,X)}m.some(te=>te.roleAssignments.some(ae=>ae.markers.length>0))||yt.append("text").attr("x",f/2).attr("y",dt-L-2).attr("text-anchor","middle").attr("font-size",12).attr("fill",n.textMuted).text("Drag a marker from the legend onto any cell. Drag a marker out to remove."),Zlt(yt)}function Zlt(t){let e=t.node();if(!e)return;let n=null,r=a=>{let i=a;for(;i&&i!==e;){let s=i.getAttribute&&i.getAttribute("data-role-id");if(s)return s;i=i.parentElement}return null},o=a=>{a!==n&&(n&&t.selectAll(`.raci-cell[data-role-id="${n}"], .raci-column[data-role-id="${n}"]`).classed("raci-col-active",!1),n=a,a?(t.attr("data-hover-col",a),t.selectAll(`.raci-cell[data-role-id="${a}"], .raci-column[data-role-id="${a}"]`).classed("raci-col-active",!0)):t.attr("data-hover-col",null))};t.on("mouseover",a=>o(r(a.target))),t.on("mouseleave",()=>o(null))}function Qlt(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h){if(e.length===0)return;let S=Nb[n],y=t.append("g").attr("class","raci-legend").attr("aria-label",`${n.toUpperCase()} marker legend`);e.forEach((b,E)=>{let x=r+E*(i+u),N=oN(b,s),L=S[b],A=y.append("g").attr("class","raci-legend-chip").attr("data-marker",b).style("cursor","grab");if(a==="letters"){let _=c?N:Ot(N,l,vb),T=c?Ot(N,l,70):N;A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",_).attr("stroke",T).attr("stroke-width",m),A.append("text").attr("x",x+i/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",700).attr("fill",c?Le(_,s.textOnFillLight,s.textOnFillDark):s.text).text(b);return}let C=c?N:Ot(N,l,vb),k=Ot(N,l,70);A.append("rect").attr("x",x).attr("y",o).attr("width",i).attr("height",f).attr("rx",p).attr("fill",C).attr("stroke",k).attr("stroke-width",m);let w=4,v=24,M=c?Ot(N,l,70):Ot(N,l,55);A.append("rect").attr("x",x+w).attr("y",o+w).attr("width",v).attr("height",f-2*w).attr("rx",4).attr("fill",M),A.append("text").attr("x",x+w+v/2).attr("y",o+f/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",g).attr("font-weight",700).attr("fill",c?Le(M,s.textOnFillLight,s.textOnFillDark):s.text).text(b),A.append("text").attr("x",x+w+v+8).attr("y",o+f/2).attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",600).attr("fill",s.text).text(nr(L,h,i-v-w*2-12))})}function Jlt(t,e,n,r,o){G3(t,e,n,r,{},o)}function tct(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h,S,y){let b=t.append("g").attr("class","raci-phase").attr("data-section",`phase-${e.id}`).attr("data-section-toggle","").attr("data-line-number",String(e.lineNumber)).attr("data-phase-id",e.id).attr("data-collapsed",i?"1":"0").style("cursor","pointer"),E=Ot(e.color??s,a.bg,30);b.append("rect").attr("x",n).attr("y",r+4).attr("width",o).attr("height",g-8).attr("fill",E).attr("rx",4);let x=n+12,N=r+g/2;if(b.append("text").attr("x",x).attr("y",N).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-family",Pt).attr("font-size",9).attr("fill",a.text).attr("opacity",.6).text(i?"\u25B6":"\u25BC"),b.append("text").attr("x",n+26).attr("y",r+(g-4)/2+2).attr("dominant-baseline","central").attr("font-size",h).attr("font-weight",600).attr("fill",a.text).text(e.displayName),i){let L=e.tasks.length;if(L>0){let _=_t(e.displayName,h);b.append("text").attr("x",n+26+_+10).attr("y",r+(g-4)/2+2).attr("dominant-baseline","central").attr("font-size",h-1).attr("font-weight",500).attr("fill",a.textMuted).text(`${L} ${L===1?"task":"tasks"}`)}if(!m)return;let A=Qc[u].alphabet,C=S+4,k=d-2*C,w=24,v=13,M=r+(g-w)/2;l.forEach((_,T)=>{let R=new Set;for(let D of e.tasks){let W=D.roleAssignments.find(V=>V.id===_);if(W)for(let V of W.markers)R.add(V)}if(R.size===0)return;let O=_3([...R],A),I=Np*Math.max(0,O.length-1),H=(k-I)/O.length,G=c(T)+C;O.forEach((D,W)=>{let V=G+W*(H+Np),P=oN(D,a),F=p?P:Ot(P,f,vb),Y=p?Ot(P,f,70):P,z=b.append("g").attr("class","raci-phase-summary");z.append("rect").attr("x",V).attr("y",M).attr("width",H).attr("height",w).attr("rx",y).attr("fill",F).attr("stroke",Y).attr("stroke-width",1.25),z.append("text").attr("x",V+H/2).attr("y",M+w/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",v).attr("font-weight",700).attr("fill",p?Le(F,a.textOnFillLight,a.textOnFillDark):a.text).text(D)})})}}function ect(t,e,n,r,o,a,i,s,l,c,d,u,f,p,m,g,h,S,y,b,E,x,N,L,A,C,k){let w=t.append("g").attr("class","raci-task-row").attr("data-task-id",e.id).attr("data-line-number",String(e.lineNumber)),v=r+8,M=a-16,_=p??O3(e,u?.get(e.id),M,h,S,b,C,k),{nameLines:T,descLines:R,violations:O,rowHeight:I}=_,H=w.append("g").attr("class","raci-task-label-area");H.append("rect").attr("class","raci-task-label-zone").attr("x",r).attr("y",o).attr("width",a).attr("height",I).attr("fill","transparent").attr("pointer-events","all");let G=o+h/2+6,D=H.append("text").attr("class","raci-task-label").attr("x",v).attr("y",G).attr("dominant-baseline","central").attr("font-size",h).attr("fill",l.text);T.forEach((F,Y)=>{let z=D.append("tspan").attr("x",v).text(F);Y>0&&z.attr("dy",nN)});let W=G+Math.max(0,T.length-1)*nN+h/2+4+C;if(R.length>0){let F=H.append("text").attr("class","raci-task-description").attr("x",v).attr("y",W).attr("dominant-baseline","central").attr("font-size",S).attr("fill",l.textMuted);R.forEach((Y,z)=>{let j=F.append("tspan").attr("x",v).text(Y);z>0&&j.attr("dy",rN)}),W+=R.length*rN}for(let F of O){let Y=F.severity==="error"?l.colors.red:l.colors.orange,z=H.append("g").attr("class","raci-violation-line").attr("data-severity",F.severity).style("cursor",m?"pointer":"default"),j=h-2,K=z.append("text").attr("x",v).attr("y",W).attr("dominant-baseline","central").attr("font-size",j).attr("fill",Y);if(F.lines.forEach(($,U)=>{nct($).forEach((q,et)=>{let tt=K.append("tspan").text(q.text);U>0&&et===0&&tt.attr("x",v).attr("dy",k),q.bold&&tt.attr("font-weight",700)})}),m){let $=F.sourceLine;z.on("click",U=>{U.stopPropagation(),m($)})}W+=F.lines.length*k}let V=new Map;for(let F of e.roleAssignments)V.set(F.id,F.markers);let P=Qc[n.variant].alphabet;n.roles.forEach((F,Y)=>{let z=E+4,j=i(Y)+z,K=o+y,$=s-2*z,U=b-2*y,X=V.get(F)??[],q=_3(X,P),et=e.roleAssignments.find(Z=>Z.id===F),tt=w.append("g").attr("class","raci-cell").attr("data-task-id",e.id).attr("data-role-id",F);et&&tt.attr("data-line-number",String(et.lineNumber)),tt.append("rect").attr("class","raci-cell-hit").attr("x",i(Y)+E).attr("y",o).attr("width",s-2*E).attr("height",b).attr("fill","transparent").attr("pointer-events","all");let B=Np*(q.length-1),Q=q.length>0?($-B)/q.length:0,ot=Nb[n.variant];q.forEach((Z,lt)=>{let nt=oN(Z,l),J=d?nt:Ot(nt,c,vb),at=nt,it=j+lt*(Q+Np),Lt=tt.append("g").attr("class","raci-marker-slice").attr("data-marker",Z).style("cursor","grab");Lt.append("rect").attr("x",it).attr("y",K).attr("width",Q).attr("height",U).attr("rx",x).attr("fill",J).attr("stroke",at).attr("stroke-width",N);let Tt=ot[Z]??Z,rt=_t(Tt,A)+16<=Q,pt=rt?Tt:Z,gt=rt?A:L;Lt.append("text").attr("x",it+Q/2).attr("y",K+U/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("font-size",gt).attr("font-weight",Xlt).attr("fill",d?Le(J,l.textOnFillLight,l.textOnFillDark):l.text).text(pt)}),tt.append("rect").attr("class","raci-cell-drop-preview").attr("x",j).attr("y",K).attr("width",$).attr("height",U).attr("rx",x).attr("fill","transparent").attr("stroke","transparent").attr("pointer-events","none"),m&&et&&tt.on("click",()=>m(et.lineNumber))})}function O3(t,e,n,r=D3,o=P3,a=A3,i=I3,s=R3){let l=Cn(t.displayName,r,n,{hardBreak:!0}),c=t.description?.trim()??"",d=c.length>0?c.split(`
310
310
  `).flatMap(h=>Cn(h,o,n,{hardBreak:!0})):[],u=[];if(e){let h=(S,y)=>{for(let b of S){let E=klt(b.message);u.push({severity:y,sourceLine:b.line,text:E,lines:Cn(E,r-2,n,{hardBreak:!0})})}};h(e.errors,"error"),h(e.warnings,"warning")}let f=u.reduce((h,S)=>h+S.lines.length,0),p=d.length>0||u.length>0,m=Math.max(0,l.length-1)*nN,g=a+m+(p?i:0)+d.length*rN+f*s;return{nameLines:l,descLines:d,violations:u,rowHeight:g}}function nct(t){let e=[],n=/'([^']+)'/g,r=0,o;for(;(o=n.exec(t))!==null;)o.index>r&&e.push({text:t.slice(r,o.index),bold:!1}),e.push({text:o[1],bold:!0}),r=o.index+o[0].length;return r<t.length&&e.push({text:t.slice(r),bold:!1}),e}var Nb,Clt,M3,_lt,Alt,Rlt,Ilt,Plt,Dlt,Glt,Olt,$lt,A3,Hlt,Wlt,k3,Flt,T3,Blt,R3,I3,P3,Ylt,Vlt,zlt,Ult,Xlt,D3,jlt,qlt,vb,Klt,C3,Np,nN,rN,H3=st(()=>{"use strict";qn();an();tn();_g();Uw();mr();en();Nb={raci:{R:"Responsible",A:"Accountable",C:"Consulted",I:"Informed"},rasci:{R:"Responsible",A:"Accountable",S:"Support",C:"Consulted",I:"Informed"},daci:{D:"Driver",A:"Approver",C:"Contributor",I:"Informed"}},Clt=50,M3=24,_lt=16,Alt=28,Rlt=8,Ilt=96,Plt=28,Dlt=16,Glt=12,Olt=14,$lt=36,A3=36,Hlt=40,Wlt=200,k3=360,Flt=64,T3=120,Blt=4,R3=14,I3=8,P3=11,Ylt=8,Vlt=8,zlt=14,Ult=14,Xlt=600,D3=13,jlt=12,qlt=13,vb=25,Klt=6,C3=["blue","orange","green","purple","yellow","cyan","red","teal"];Np=4;nN=16,rN=16});function W3(t,e){if(e.size===0)return{participants:t.participants,messages:t.messages,elements:t.elements,groups:t.groups,collapsedGroupIds:new Map};let n=new Map,r=new Set;for(let d of t.groups)if(e.has(d.lineNumber)){r.add(d.name);for(let u of d.participantIds)n.set(u,d.name)}let o=[],a=new Set;for(let d of t.participants){let u=n.get(d.id);if(u){if(!a.has(u)){a.add(u);let f=t.groups.find(p=>p.name===u&&e.has(p.lineNumber));o.push({id:u,label:u,type:"default",lineNumber:f.lineNumber})}}else r.has(d.id)||o.push(d)}let i=d=>n.get(d)??d,s=t.messages.map(d=>({...d,from:i(d.from),to:i(d.to)})),l=Mb(t.elements,n),c=t.groups.filter(d=>!e.has(d.lineNumber));return{participants:o,messages:s,elements:l,groups:c,collapsedGroupIds:n}}function Mb(t,e){let n=o=>e.get(o)??o,r=[];for(let o of t)if(Yo(o))r.push(o);else if(Zr(o))r.push({...o,participantId:n(o.participantId)});else if(Pr(o))r.push({...o,children:Mb(o.children,e),elseChildren:Mb(o.elseChildren,e),...o.elseIfBranches?{elseIfBranches:o.elseIfBranches.map(a=>({...a,children:Mb(a.children,e)}))}:{}});else{let a=o,i=n(a.from),s=n(a.to);if(i===s&&i!==a.from&&!a.label)continue;r.push({...a,from:i,to:s})}return r}var F3=st(()=>{"use strict";_c()});function rct(t,e){for(let n of e)if(n.metadata)for(let r of n.participantIds){let o=t.get(r);if(o)for(let[a,i]of Object.entries(n.metadata))a in o||(o[a]=i)}}function oct(t,e,n,r){let o=new Map;for(let a of t){if(r.get(a.id)?.[n])continue;let s=new Set;for(let l of e)l.to===a.id&&l.metadata?.[n]&&s.add(l.metadata[n]);s.size===1&&o.set(a.id,[...s][0])}return o}function B3(t,e){let n={participants:new Map,messages:new Map},r=t.tagGroups.find(s=>s.name.toLowerCase()===e.toLowerCase());if(!r){for(let s of t.participants)n.participants.set(s.id,void 0);for(let s of t.messages)n.messages.set(s.lineNumber,void 0);return n}let o=qt(r.name),a=new Map;for(let s of t.participants)a.set(s.id,{...s.metadata||{}});rct(a,t.groups);let i=oct(t.participants,t.messages,o,a);for(let[s,l]of i){let c=a.get(s);c[o]=l}if(r.defaultValue)for(let s of t.participants){let l=a.get(s.id);o in l||(l[o]=r.defaultValue)}for(let s of t.participants){let l=a.get(s.id);n.participants.set(s.id,l[o]||void 0)}for(let s of t.messages)n.messages.set(s.lineNumber,s.metadata?.[o]||void 0);return n}var Y3=st(()=>{"use strict";je()});var Q3={};ye(Q3,{applyGroupOrdering:()=>Z3,applyPositionOverrides:()=>K3,buildNoteMessageMap:()=>Cct,buildRenderSequence:()=>j3,computeActivations:()=>q3,groupMessagesBySection:()=>X3,parseInlineMarkdown:()=>Tl,renderSequenceDiagram:()=>Tct,truncateBareUrl:()=>C0});function V3(t,e,n){let r=t.split(`
311
311
  `).map(o=>o.startsWith("- ")?"\u2022 "+o.slice(2):o);return Ko(r,e,o=>_t(o,n))}function U3(t,e,n){if(_t(t,n)<=e)return[t];if(t.includes(" "))return aN(t.split(" "),e,n);if(/[-_:/]/.test(t)){let o=t.split(/[-_:/]+/);return aN(o,e,n)}let r=t.replace(/([a-z])([A-Z])/g,"$1\0$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1\0$2").split("\0");return r.length>1?aN(r,e,n):[t]}function aN(t,e,n){let r=[],o="";for(let a of t){let i=o?o+a:a;_t(i,n)>e&&o?(r.push(o),o=a):o=i}return o&&r.push(o),r}function Lct(t,e,n,r,o,a=nu,i=ec){t.append("rect").attr("x",-a/2).attr("y",0).attr("width",a).attr("height",i).attr("rx",2).attr("ry",2).attr("fill",Mp(e,n,r,o)).attr("stroke",kp(e,r)).attr("stroke-width",ua)}function vct(t,e,n,r=ec){let o=r/ec,a=8*o,i=0,s=10*o,l=19*o,c=r*.65,d=r-2*o,u=24*o,f=16*o,p=12*o,m=kp(e,n),g=Math.max(1.2,2.5*o);t.append("circle").attr("cx",i).attr("cy",s).attr("r",a).attr("fill","none").attr("stroke",m).attr("stroke-width",g),t.append("line").attr("x1",i).attr("y1",l).attr("x2",i).attr("y2",c).attr("stroke",m).attr("stroke-width",g),t.append("line").attr("x1",i-f).attr("y1",u).attr("x2",i+f).attr("y2",u).attr("stroke",m).attr("stroke-width",g),t.append("line").attr("x1",i).attr("y1",c).attr("x2",i-p).attr("y2",d).attr("stroke",m).attr("stroke-width",g),t.append("line").attr("x1",i).attr("y1",c).attr("x2",i+p).attr("y2",d).attr("stroke",m).attr("stroke-width",g)}function Nct(t,e,n,r,o,a=nu,i=ec){let c=i-14,d=Mp(e,n,r,o),u=kp(e,r);t.append("ellipse").attr("cx",0).attr("cy",7+c).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua),t.append("rect").attr("class","participant-body").attr("x",-a/2).attr("y",7).attr("width",a).attr("height",c).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",-a/2).attr("y1",7).attr("x2",-a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua),t.append("line").attr("x1",a/2).attr("y1",7).attr("x2",a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua),t.append("ellipse").attr("cx",0).attr("cy",7).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua)}function Mct(t,e,n,r,o,a=nu,i=ec){let l=-a/2+10,c=a-20,d=Mp(e,n,r,o),u=kp(e,r);t.append("ellipse").attr("cx",l+c).attr("cy",i/2).attr("rx",10).attr("ry",i/2).attr("fill",d).attr("stroke",u).attr("stroke-width",ua),t.append("rect").attr("class","participant-body").attr("x",l).attr("y",0).attr("width",c).attr("height",i).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",l).attr("y1",0).attr("x2",l+c).attr("y2",0).attr("stroke",u).attr("stroke-width",ua),t.append("line").attr("x1",l).attr("y1",i).attr("x2",l+c).attr("y2",i).attr("stroke",u).attr("stroke-width",ua),t.append("ellipse").attr("cx",l).attr("cy",i/2).attr("rx",10).attr("ry",i/2).attr("fill",d).attr("stroke",u).attr("stroke-width",ua)}function kct(t,e,n,r,o,a=nu,i=ec){let c=i-14,d=Mp(e,n,r,o),u=kp(e,r),f="4 3";t.append("ellipse").attr("cx",0).attr("cy",7+c).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("rect").attr("class","participant-body").attr("x",-a/2).attr("y",7).attr("width",a).attr("height",c).attr("fill",d).attr("stroke","none"),t.append("line").attr("x1",-a/2).attr("y1",7).attr("x2",-a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("line").attr("x1",a/2).attr("y1",7).attr("x2",a/2).attr("y2",7+c).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f),t.append("ellipse").attr("cx",0).attr("cy",7).attr("rx",a/2).attr("ry",7).attr("fill",d).attr("stroke",u).attr("stroke-width",ua).attr("stroke-dasharray",f)}function X3(t,e){let n=[],r=null,o=new Map;e.forEach((i,s)=>o.set(i.lineNumber,s));let a=i=>{let s=[];for(let l of i)if(Pr(l)){if(s.push(...a(l.children),...a(l.elseChildren)),l.elseIfBranches)for(let c of l.elseIfBranches)s.push(...a(c.children))}else{if(Yo(l)||Zr(l))continue;{let c=o.get(l.lineNumber)??-1;c>=0&&s.push(c)}}return s};for(let i of t)if(Yo(i))r={section:i,messageIndices:[]},n.push(r);else if(r){if(Pr(i))r.messageIndices.push(...a([i]));else if(!Zr(i)){let s=o.get(i.lineNumber)??-1;s>=0&&r.messageIndices.push(s)}}return n}function j3(t){let e=[],n=[];for(let r=0;r<t.length;r++){let o=t[r];for(;n.length>0;){let a=n[n.length-1];if(a.to===o.from)break;n.pop(),e.push({type:"return",from:a.to,to:a.from,label:"",messageIndex:a.messageIndex})}if(n.length>0&&!o.async&&o.from!==o.to){let a=n[n.length-1];if(a.from===o.to&&a.to===o.from){n.pop(),e.push({type:"return",from:o.from,to:o.to,label:o.label,messageIndex:r});continue}}e.push({type:"call",from:o.from,to:o.to,label:o.label,messageIndex:r,...o.async?{async:!0}:{}}),!o.async&&(o.from===o.to?e.push({type:"return",from:o.to,to:o.from,label:"",messageIndex:r}):n.push({from:o.from,to:o.to,messageIndex:r}))}for(;n.length>0;){let r=n.pop();e.push({type:"return",from:r.to,to:r.from,label:"",messageIndex:r.messageIndex})}return e}function q3(t){let e=[],n=new Map,r=o=>(n.has(o)||n.set(o,[]),n.get(o));for(let o=0;o<t.length;o++){let a=t[o];if(a.type==="call")r(a.to).push(o);else{let i=r(a.from);if(i.length>0){let s=i.pop();e.push({participantId:a.from,startStep:s,endStep:o,depth:i.length})}}}return e}function K3(t){if(!t.some(s=>s.position!==void 0))return[...t];let e=t.length,n=[],r=[];for(let s of t)if(s.position!==void 0){let l=s.position<0?e+s.position:s.position;l=Math.max(0,Math.min(e-1,l)),n.push({participant:s,index:l})}else r.push(s);n.sort((s,l)=>s.index-l.index);let o=new Array(e).fill(null),a=new Set;for(let{participant:s,index:l}of n){let c=l;if(a.has(c))for(let d=1;d<e;d++){if(c+d<e&&!a.has(c+d)){c=c+d;break}if(c-d>=0&&!a.has(c-d)){c=c-d;break}}o[c]=s,a.add(c)}let i=0;for(let s=0;s<e;s++)o[s]===null&&(o[s]=r[i++]);return o}function Z3(t,e,n=[]){if(e.length===0)return[...t];let r=new Map;for(let c of e)for(let d of c.participantIds)r.set(d,c);let o=[],a=new Set;for(let c of n)for(let d of[c.from,c.to])a.has(d)||(a.add(d),o.push(d));for(let c of t)a.has(c.id)||(a.add(c.id),o.push(c.id));let i=[],s=new Set,l=new Set;for(let c of o){if(s.has(c))continue;let d=r.get(c);if(d&&!l.has(d)){l.add(d);for(let u of d.participantIds){let f=t.find(p=>p.id===u);f&&!s.has(u)&&(i.push(f),s.add(u))}}else if(!d){let u=t.find(f=>f.id===c);u&&(i.push(u),s.add(c))}}return i}function Tct(t,e,n,r,o,a){It(t).selectAll("*").remove();let{title:i,options:s}=e,l=s["solid-fill"]==="on",c=a?.collapsedGroups?new Set(a.collapsedGroups):new Set(e.groups.filter(ct=>ct.collapsed).map(ct=>ct.lineNumber)),d=c.size>0?W3(e,c):null,u=d?d.messages:e.messages,f=d?d.elements:e.elements,p=d?d.groups:e.groups,m=a?.collapsedSections,g=d?d.participants:e.participants,h=K3(Z3(g,p,u));if(h.length===0)return;let S=new Set;if(p.length>0){let ct=new Map;for(let wt=0;wt<p.length;wt++)for(let Ct of p[wt].participantIds)ct.set(Ct,wt);let ht=-1;for(let wt=1;wt<h.length;wt++){let Ct=ct.get(h[wt-1].id)??ht,Yt=ct.get(h[wt].id)??ht;Yt!==Ct&&!(Yt===ht&&Ct===ht)&&S.add(h[wt].id)}}let y=S.size,b=225,E=iN;for(let ct of h){let ht=U3(ct.label,Tb(iN),kb);if(ht.length===0)continue;let Ct=Math.max(...ht.map(Yt=>_t(Yt,kb)))+10;E=Math.max(E,Ct)}E=Math.min(b,E);let x=Math.max(act,E+30),N=Math.max(h.length*x,E+40),L=a?.exportWidth??t.getBoundingClientRect().width,A=a?.exportWidth?Ee.identity():Ee.from(L,N),C=A.structural(x),k=A.structural(E),w=A.structural(z3),v=A.aesthetic(ict),M=A.aesthetic(sct),_=A.aesthetic(lct),T=A.structural(cct),R=A.structural(dct),O=A.structural(uct),I=A.structural(fct),H=A.structural(pct),G=A.structural(mct),D=A.structural(gct),W=A.text(hct),V=A.structural(yct),P=A.structural(bct),F=A.structural(xct),Y=wct,z=A.structural(Ect),j=I-G*2-H,K=C-F-P,$=A.text(kb),U=Tb(k),X=new Map;h.forEach((ct,ht)=>X.set(ct.id,ht));let q=ct=>{let ht=X.get(ct.participantId);return ht===void 0?ct.position:ct.position==="right"&&ht===h.length-1&&ht>0?"left":ct.position==="left"&&ht===0&&h.length>1?"right":ct.position},et=F/2+z+P-(F+P),tt=(ct,ht,wt=!1)=>{let Ct=X.get(ct);if(Ct===void 0||!(ht==="right"?Ct<h.length-1:Ct>0))return I;let Et=wt&&ht==="right"?K-et:K;return Math.min(I,Et)},B=ct=>ct-G*2-H,Q=s.activations?.toLowerCase()==="off",ot=Wr(e.tagGroups.filter(ct=>ct.entries.length>0),s["active-tag"],a?.activeTagGroup)??void 0,Z,lt=new Map;if(ot){Z=B3(e,ot);let ct=e.tagGroups.find(ht=>ht.name.toLowerCase()===ot.toLowerCase());if(ct)for(let ht of ct.entries)lt.set(ht.value.toLowerCase(),ht.color)}let nt=ct=>ct?lt.get(ct.toLowerCase()):void 0,J=ot?qt(ot):void 0,at=new Set;if(m&&m.size>0){let ct=X3(f,u);for(let ht of ct)if(m.has(ht.section.lineNumber))for(let wt of ht.messageIndices)at.add(wt)}let it=j3(u),Lt=ct=>(at.size===0||!at.has(ct.messageIndex))&&(ct.type==="call"||!!ct.label),Tt=[],At=new Array(it.length);for(let ct=0;ct<it.length;ct++){let ht=it[ct];At[ct]=Tt.length,Lt(ht)&&Tt.push(ht)}let rt=Math.max(Tt.length-1,0),pt=ct=>Math.min(Math.max(ct,0),rt),gt=Q?[]:q3(it).map(ct=>({...ct,startStep:pt(At[ct.startStep]??0),endStep:pt(At[ct.endStep]??0)})),dt=35,ut=30,yt=15,vt=42,Gt=new Map,Xt=new Map;Tt.forEach((ct,ht)=>{Gt.has(ct.messageIndex)||Gt.set(ct.messageIndex,ht),Xt.set(ct.messageIndex,ht)});let bt=ct=>{let ht=-1,wt=-1;for(let Ct=0;Ct<u.length;Ct++){let Yt=u[Ct];Yt.lineNumber<ct.lineNumber&&Yt.lineNumber>wt&&(wt=Yt.lineNumber,ht=Ct)}return ht>=0&&at.has(ht)||ht<0?-1:Xt.get(ht)??-1},Mt=ct=>{let ht=-1,wt=-1;for(let Yt=0;Yt<u.length;Yt++){let Et=u[Yt];Et.lineNumber<ct.lineNumber&&Et.lineNumber>wt&&(wt=Et.lineNumber,ht=Yt)}if(ht<0)return!1;let Ct=u[ht];return Ct.from===Ct.to},zt=A.structural(8),xt=ct=>Mt(ct)?Y+ne+zt:ne,Nt=new Map;u.forEach((ct,ht)=>Nt.set(ct.lineNumber,ht));let Dt=ct=>{for(let ht of ct)if(Pr(ht)){let wt=Dt(ht.children);if(wt>=0)return wt;if(ht.elseIfBranches)for(let Yt of ht.elseIfBranches){let Et=Dt(Yt.children);if(Et>=0)return Et}let Ct=Dt(ht.elseChildren);if(Ct>=0)return Ct}else if(!Yo(ht)&&!Zr(ht)){let wt=Nt.get(ht.lineNumber)??-1;if(wt>=0&&!at.has(wt))return wt}return-1},Vt=35,$t=45,ft=new Map,Wt=(ct,ht)=>{ft.set(ct,(ft.get(ct)||0)+ht)},ge=ct=>{for(let ht=0;ht<ct.length;ht++){let wt=ct[ht];if(Yo(wt)||!Pr(wt))continue;let Ct=Dt(wt.children);if(Ct>=0&&Wt(Ct,ut),wt.elseIfBranches)for(let Et of wt.elseIfBranches){let Ft=Dt(Et.children);Ft>=0&&Wt(Ft,ut),ge(Et.children)}let Yt=Dt(wt.elseChildren);if(Yt>=0&&Wt(Yt,ut),ge(wt.children),ge(wt.elseChildren),ht+1<ct.length){let Et=Dt([ct[ht+1]]);Et>=0&&Wt(Et,yt)}}};f&&f.length>0&&ge(f);let ne=A.structural(14),se=A.aesthetic(35),Zt=(ct,ht=j)=>V3(ct,ht,W).length*V+D*2,Ie=0,Ht=ct=>{for(let ht=0;ht<ct.length;ht++){let wt=ct[ht];if(Zr(wt)){let Yt=xt(wt),Et=ht;for(;Et<ct.length&&Zr(ct[Et]);){let _e=ct[Et],ve=Mt(_e),Re=tt(_e.participantId,_e.position,ve),Xe=Zt(_e.text,B(Re));Yt+=Xe+ne,Et++}let Ft=Math.max(se,Yt*.3);Yt+=Ft-ne;let Kt=Math.max(0,Yt-dt),ue=-1;for(let _e=Et;_e<ct.length&&(ue=Dt([ct[_e]]),!(ue>=0));_e++);Et<ct.length&&Pr(ct[Et])&&(Kt+=vt-ut),ue>=0?Wt(ue,Kt):Ie=Math.max(Ie,Kt),ht=Et-1}else if(Pr(wt)){if(Ht(wt.children),wt.elseIfBranches)for(let Ct of wt.elseIfBranches)Ht(Ct.children);Ht(wt.elseChildren)}}};f&&f.length>0&&Ht(f);let Qt=[],Ut=[];{let ct=new Map;u.forEach((Yt,Et)=>ct.set(Yt.lineNumber,Et));let ht=Yt=>ct.get(Yt.lineNumber)??-1,wt=Yt=>{let Et=[];for(let Ft of Yt.children)if(Pr(Ft))Et.push(...wt(Ft));else if(!Yo(Ft)&&!Zr(Ft)){let Kt=ht(Ft);Kt>=0&&Et.push(Kt)}if(Yt.elseIfBranches){for(let Ft of Yt.elseIfBranches)for(let Kt of Ft.children)if(Pr(Kt))Et.push(...wt(Kt));else if(!Yo(Kt)&&!Zr(Kt)){let ue=ht(Kt);ue>=0&&Et.push(ue)}}for(let Ft of Yt.elseChildren)if(Pr(Ft))Et.push(...wt(Ft));else if(!Yo(Ft)&&!Zr(Ft)){let Kt=ht(Ft);Kt>=0&&Et.push(Kt)}return Et},Ct=Qt;for(let Yt of f)if(Yo(Yt)){let Et={section:Yt,msgIndices:[]};Ut.push(Et),Ct=Et.msgIndices}else if(Pr(Yt))Ct.push(...wt(Yt));else{let Et=ht(Yt);Et>=0&&Ct.push(Et)}}let fe=new Map;it.forEach((ct,ht)=>{fe.has(ct.messageIndex)||fe.set(ct.messageIndex,ht)});let de=new Map;{let ct=0;for(let ht=0;ht<it.length;ht++){let wt=it[ht];!at.has(wt.messageIndex)&&(wt.type==="call"||wt.label)&&(de.set(ht,ct),ct++)}}let te=ct=>{for(let ht=ct;ht<it.length;ht++){let wt=de.get(ht);if(wt!==void 0)return wt}return null},ae=new Map,Te=[];for(let ct of Ut){if(ct.msgIndices.length===0){Te.push(ct.section);continue}let ht=ct.msgIndices[0],wt=fe.get(ht);if(wt===void 0){Te.push(ct.section);continue}let Ct=te(wt);if(Ct===null){Te.push(ct.section);continue}let Yt=ae.get(Ct)||[];Yt.push(ct.section),ae.set(Ct,Yt)}let Je=new Map;for(let ct of Ut)Je.set(ct.section.lineNumber,ct.msgIndices.length);let ln=15,Ve=22,Ce=8,ee=11,oe=!!i&&s["no-title"]!=="on",Be=oe?M:0,fn=8,We={groups:e.tagGroups.filter(ct=>ct.entries.length>0).map(ct=>({name:ct.name,entries:ct.entries.map(ht=>({value:ht.value,color:ht.color}))})),position:{placement:"top-center",titleRelation:"below-title"},mode:"preview"},kn=e.tagGroups.length>0?Cr(We,L)+fn:0,Kn=e.groups.length>0?Ve+ee:0,xo=v+Be+kn+_+Kn,Lr=xo+w,Rn=h.some(ct=>ct.type==="actor"),Dn=T+(Rn?20:0)+(e.groups.length>0?Ce:0),Rr=[],dr=new Map,Ur;{let ct=Lr+Dn;for(let ht=0;ht<Tt.length;ht++){let wt=ae.get(ht);if(wt)for(let Et of wt)ct+=Vt,dr.set(Et.lineNumber,ct),ct+=$t;let Ct=Tt[ht];if(Gt.get(Ct.messageIndex)===ht){let Et=ft.get(Ct.messageIndex)||0;ct+=Et}Rr.push(ct);let Yt=Ct.type==="call"&&Ct.from===Ct.to;ct+=Yt?Y+25:dt}for(let ht of Te)ct+=Vt,dr.set(ht.lineNumber,ct),ct+=$t;ct+=Ie,Ur=ct}let Jn=ct=>Rr[ct],io=new Map;{let ct=ht=>{for(let wt=0;wt<ht.length;wt++){let Ct=ht[wt];if(Zr(Ct)){let Yt=bt(Ct);if(Yt<0)continue;let Et=wt>0&&Zr(ht[wt-1])?ht[wt-1]:null,Ft=Et?io.get(Et):void 0,Kt;if(Ft!==void 0&&Et){let ue=tt(Et.participantId,q(Et),Mt(Et)),_e=Zt(Et.text,B(ue));Kt=Ft+_e+ne}else Kt=Jn(Yt)+xt(Ct);io.set(Ct,Kt)}else if(Pr(Ct)){if(ct(Ct.children),Ct.elseIfBranches)for(let Yt of Ct.elseIfBranches)ct(Yt.children);ct(Ct.elseChildren)}}};f&&f.length>0&&ct(f)}let Oo=Tt[Tt.length-1],ci=Oo?.type==="call"&&Oo.from===Oo.to?Y+25:dt,Mo=Tt.length>0?Math.max(Rr[Rr.length-1]+ci,Ur):Ur;for(let[ct,ht]of io){let wt=tt(ct.participantId,q(ct),Mt(ct)),Ct=Zt(ct.text,B(wt));Mo=Math.max(Mo,ht+Ct+se)}let ma=Mo-Lr+R,di=h.length>1?h.length-1:0,ga=di-y,ui=C,fi=C;y>0&&di>0&&(ui=C*.88,fi=(di*C-ga*ui)/y);let cl=h[h.length-1]?.id,Ya=k/2;if(cl){e.groups.some(wt=>wt.participantIds.includes(cl))&&(Ya=Math.max(Ya,k/2+ln));for(let wt of Tt)if(wt.from===wt.to&&wt.from===cl){let Ct=F+z,Yt=0;wt.label&&(Yt=_t(wt.label,12)+15),Ya=Math.max(Ya,Ct+Yt)}let ct=30,ht=wt=>{for(let Ct of wt)if(Pr(Ct)){let Yt=Et=>Et.some(Ft=>!Pr(Ft)&&!Zr(Ft)&&!Yo(Ft)&&"from"in Ft&&(Ft.from===cl||Ft.to===cl));if(Yt(Ct.children)||Yt(Ct.elseChildren)||Ct.elseIfBranches?.some(Et=>Yt(Et.children))||ht(Ct.children)||ht(Ct.elseChildren)||Ct.elseIfBranches?.some(Et=>ht(Et.children)))return!0}return!1};f&&ht(f)&&(Ya=Math.max(Ya,k/2+ct))}let vr=Math.max(Ya+10,C/2),ha=C/2,hs=h.length*C,Fi=Math.max(ha+hs+vr,k+40),Bi=xo+w+Math.max(ma,40)+40,pi=Math.max(Fi,L),mi=ha+Math.max(0,(pi-Fi)/2),to=new Map,au=()=>{let ct=mi;to.clear(),h.forEach((ht,wt)=>{if(to.set(ht.id,ct),wt<h.length-1){let Ct=h[wt+1].id;ct+=S.has(Ct)?fi:ui}})};au();let oc=0,Yi=pi;for(let ct of Tt){if(!ct.label)continue;let ht=_t(ct.label,12);if(ct.from===ct.to){let wt=to.get(ct.from);if(wt!==void 0){let Ct=wt+F/2+z+5+ht;Yi=Math.max(Yi,Ct)}}else{let wt=to.get(ct.from),Ct=to.get(ct.to);if(wt!==void 0&&Ct!==void 0){let Yt=(wt+Ct)/2;oc=Math.min(oc,Yt-ht/2),Yi=Math.max(Yi,Yt+ht/2)}}}if(f){let ct=ht=>{for(let wt of ht)if(Zr(wt)){let Ct=wt,Yt=q(Ct);if(Yt==="right"){let Et=to.get(Ct.participantId);if(Et!==void 0){let Ft=Mt(Ct),Kt=Ft?F/2+z+P:F+P,ue=tt(Ct.participantId,Yt,Ft);Yi=Math.max(Yi,Et+Kt+ue)}}}else if(Pr(wt)&&(ct(wt.children),ct(wt.elseChildren),wt.elseIfBranches))for(let Ct of wt.elseIfBranches)ct(Ct.children)};ct(f)}let iu=Math.max(0,-oc),ac=Math.max(0,Yi-pi);(iu>0||ac>0)&&(ha+=iu,vr+=ac,Fi=Math.max(ha+hs+vr,k+40),pi=Math.max(Fi,L),mi=ha+Math.max(0,(pi-Fi)/2),au());let yr=It(t).append("svg").attr("width","100%").attr("height",Bi).attr("viewBox",`0 0 ${pi} ${Bi}`).attr("preserveAspectRatio","xMidYMin meet").attr("class","sequence-diagram").style("font-family",Pt),ya=yr.append("defs");ya.append("marker").attr("id","seq-arrowhead").attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polygon").attr("points",`0,0 ${O},${O/2} 0,${O}`).attr("fill",n.text),ya.append("marker").attr("id","seq-arrowhead-open").attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polyline").attr("points",`0,0 ${O},${O/2} 0,${O}`).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1.2),ya.append("marker").attr("id","seq-arrowhead-async").attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polyline").attr("points",`0,0 ${O},${O/2} 0,${O}`).attr("fill","none").attr("stroke",n.text).attr("stroke-width",1.2);let $o=`0,0 ${O},${O/2} 0,${O}`;for(let[,ct]of lt){let ht=ct.replace("#","");ya.append("marker").attr("id",`seq-arrowhead-c${ht}`).attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polygon").attr("points",$o).attr("fill",ct),ya.append("marker").attr("id",`seq-arrowhead-async-c${ht}`).attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polyline").attr("points",$o).attr("fill","none").attr("stroke",ct).attr("stroke-width",1.2),ya.append("marker").attr("id",`seq-arrowhead-open-c${ht}`).attr("viewBox",`0 0 ${O} ${O}`).attr("refX",O).attr("refY",O/2).attr("markerWidth",O).attr("markerHeight",O).attr("orient","auto").append("polyline").attr("points",$o).attr("fill","none").attr("stroke",ct).attr("stroke-width",1.2)}let ys=(ct,ht)=>{if(ht){let wt=ht.replace("#","");switch(ct){case"call":return`url(#seq-arrowhead-c${wt})`;case"async":return`url(#seq-arrowhead-async-c${wt})`;case"return":return`url(#seq-arrowhead-open-c${wt})`}}switch(ct){case"call":return"url(#seq-arrowhead)";case"async":return"url(#seq-arrowhead-async)";case"return":return"url(#seq-arrowhead-open)"}};if(oe){let ct=yr.append("text").attr("class","chart-title").attr("x",pi/2).attr("y",A.structural(30)).attr("text-anchor","middle").attr("fill",n.text).attr("font-size",A.text(20)).attr("font-weight","700").text(i);e.titleLineNumber&&ct.attr("data-line-number",e.titleLineNumber)}let su=e.tagGroups.length>0,Ap=new Set,ic=new Map;for(let ct of e.groups)c.has(ct.lineNumber)&&(Ap.add(ct.name),ic.set(ct.name,{lineNumber:ct.lineNumber,...ct.metadata!==void 0&&{metadata:ct.metadata}}));for(let ct of p){if(ct.participantIds.length===0)continue;let ht=ct.participantIds.map(Re=>to.get(Re)).filter(Re=>Re!==void 0);if(ht.length===0)continue;let wt=Math.min(...ht)-k/2-ln,Ct=Math.max(...ht)+k/2+ln,Yt=xo-Ve,Et=w+Ve+Ce,Ft=J&&ct.metadata?.[J],Kt=nt(Ft||void 0),ue=Kt?Ot(Kt,or(n,r),r?15:20):r?n.surface:n.bg,_e=Kt||n.textMuted,ve=yr.append("g").attr("class","group-box-wrapper").attr("data-group-toggle","").attr("data-group-line",String(ct.lineNumber)).attr("tabindex","0").attr("role","button").attr("aria-expanded","true").attr("cursor","pointer");ve.append("title").text("Click to collapse"),ve.append("rect").attr("x",wt).attr("y",Yt).attr("width",Ct-wt).attr("height",Et).attr("rx",6).attr("fill",ue).attr("stroke",_e).attr("stroke-width",1).attr("stroke-opacity",.5).attr("pointer-events","none").attr("class","group-box"),ve.append("rect").attr("x",wt).attr("y",Yt).attr("width",Ct-wt).attr("height",xo-Yt).attr("fill","transparent").attr("class","group-label-hit"),ve.append("text").attr("x",(wt+Ct)/2).attr("y",Yt+ee+4).attr("text-anchor","middle").attr("fill",_e).attr("font-size",ee).attr("font-weight","bold").attr("opacity",.7).attr("pointer-events","none").attr("class","group-label").text(ct.name)}let sc=Lr;h.forEach(ct=>{let ht=to.get(ct.id),wt=xo,Ct=Z?.participants.get(ct.id),Yt=nt(Ct),Et=J&&Ct?{key:J,value:Ct.toLowerCase()}:void 0,Ft=Ap.has(ct.id),Kt=Yt;if(Ft&&!Kt){let Re=ic.get(ct.id);Re?.metadata&&J&&(Kt=nt(Re.metadata[J]))}if(_ct(yr,ct,ht,wt,n,r,Kt,Et,l,k,w,U,$),Ft){let Re=ic.get(ct.id),Xe=Kt||n.textMuted,sn=6,Pe=k,qe=w+Ve+Ce,Ae=`clip-drill-group-${ct.id.replace(/[^a-zA-Z0-9-]/g,"-")}`,Ze=yr.select(`.participant[data-participant-id="${ct.id}"]`);Ze.attr("data-group-toggle","").attr("data-group-line",String(Re.lineNumber)).attr("tabindex","0").attr("role","button").attr("aria-expanded","false").attr("cursor","pointer"),Ze.append("title").text("Click to expand");let Oe=Kt?Ot(Kt,or(n,r),r?30:40):r?Ot(n.overlay,n.surface,50):Ot(n.bg,n.surface,50),Ke=Kt||n.border;Ze.append("rect").attr("x",-Pe/2).attr("y",-Ve).attr("width",Pe).attr("height",qe).attr("rx",6).attr("fill",Oe).attr("stroke",Ke).attr("stroke-width",1.5),Ze.append("text").attr("x",0).attr("y",-Ve+qe/2).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",n.text).attr("font-size",A.text(13)).attr("font-weight",500).text(ct.label),Ze.append("clipPath").attr("id",Ae).append("rect").attr("x",-Pe/2).attr("y",-Ve).attr("width",Pe).attr("height",qe).attr("rx",6),Ze.append("rect").attr("class","sequence-drill-bar").attr("x",-Pe/2).attr("y",-Ve+qe-sn).attr("width",Pe).attr("height",sn).attr("fill",Xe).attr("clip-path",`url(#${Ae})`)}let ue=Ft?sc+Ce:ct.type==="actor"?sc+Sct:sc,_e=Ft?Kt||n.textMuted:Yt||n.textMuted,ve=yr.append("line").attr("x1",ht).attr("y1",ue).attr("x2",ht).attr("y2",sc+ma).attr("stroke",_e).attr("stroke-width",1).attr("stroke-dasharray","6 4").attr("class","lifeline").attr("data-participant-id",ct.id);J&&Ct&&ve.attr(`data-tag-${J}`,Ct.toLowerCase())});let lu=30,Hb=15,cu=18,Wb=F/2+z,Fb=10,du=Math.max(...Array.from(to.values())),bs=ct=>{let ht=[];for(let wt of ct)if(Pr(wt)){if(ht.push(...bs(wt.children),...bs(wt.elseChildren)),wt.elseIfBranches)for(let Ct of wt.elseIfBranches)ht.push(...bs(Ct.children))}else if(!Yo(wt)&&!Zr(wt)){let Ct=u.indexOf(wt);Ct>=0&&ht.push(Ct)}return ht},ta=[],dl=[],mt=(ct,ht)=>{for(let wt of ct){if(!Pr(wt))continue;let Ct=bs(wt.children),Yt=[];if(wt.elseIfBranches)for(let Oe of wt.elseIfBranches)Yt.push({label:Oe.label,indices:bs(Oe.children),lineNumber:Oe.lineNumber});let Et=bs(wt.elseChildren),Ft=[...Ct,...Yt.flatMap(Oe=>Oe.indices),...Et];if(Ft.length===0)continue;let Kt=1/0,ue=-1/0;for(let Oe of Ft){let Ke=Gt.get(Oe),De=Xt.get(Oe);Ke!==void 0&&(Kt=Math.min(Kt,Ke)),De!==void 0&&(ue=Math.max(ue,De))}if(Kt===1/0)continue;let _e=new Set;for(let Oe of Ft){let Ke=u[Oe];_e.add(Ke.from),_e.add(Ke.to)}let ve=1/0,Re=-1/0;for(let Oe of _e){let Ke=to.get(Oe);Ke!==void 0&&(ve=Math.min(ve,Ke),Re=Math.max(Re,Ke))}let Xe=0,sn=!1;for(let Oe of Ft){let Ke=u[Oe];if(Ke.from===Ke.to){let De=to.get(Ke.from);if(De!==void 0){let Tn=De+Wb-(Re+lu)+Fb;Tn>0&&(Xe=Math.max(Xe,Tn))}Xt.get(Oe)===ue&&(sn=!0)}}let Pe=ve-lu,qe=Jn(Kt)-vt,Ae=Re-ve+lu*2+Xe,Ze=Jn(ue)-Jn(Kt)+vt+Hb+(sn?Y:0);yr.append("rect").attr("x",Pe).attr("y",qe).attr("width",Ae).attr("height",Ze).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",1).attr("stroke-dasharray","2 3").attr("rx",3).attr("ry",3).attr("class","block-frame").attr("data-block-line",String(wt.lineNumber)),ta.push({x:Pe+6,y:qe+cu-4,text:`${wt.type} ${wt.label}`,bold:!1,italic:!1,blockLine:wt.lineNumber});for(let Oe of Yt)if(Oe.indices.length>0){let Ke=1/0;for(let De of Oe.indices){let En=Gt.get(De);En!==void 0&&(Ke=Math.min(Ke,En))}if(Ke<1/0){let De=Jn(Ke)-ut;dl.push({x1:Pe,y1:De,x2:Pe+Ae,y2:De,blockLine:Oe.lineNumber}),ta.push({x:Pe+6,y:De+14,text:`else if ${Oe.label}`,bold:!1,italic:!1,blockLine:Oe.lineNumber})}}if(Et.length>0){let Oe=1/0;for(let Ke of Et){let De=Gt.get(Ke);De!==void 0&&(Oe=Math.min(Oe,De))}if(Oe<1/0){let Ke=Jn(Oe)-ut;dl.push({x1:Pe,y1:Ke,x2:Pe+Ae,y2:Ke,...wt.elseLineNumber!==void 0&&{blockLine:wt.elseLineNumber}}),ta.push({x:Pe+6,y:Ke+14,text:"else",bold:!1,italic:!1,...wt.elseLineNumber!==void 0&&{blockLine:wt.elseLineNumber}})}}if(mt(wt.children,ht+1),wt.elseIfBranches)for(let Oe of wt.elseIfBranches)mt(Oe.children,ht+1);mt(wt.elseChildren,ht+1)}};f&&f.length>0&&mt(f,0);let St=A.structural(6);gt.forEach(ct=>{let ht=to.get(ct.participantId);if(ht===void 0)return;let wt=ht-F/2+ct.depth*St,Ct=Jn(ct.startStep),Yt=Jn(ct.endStep),Et=[];for(let sn=ct.startStep;sn<=ct.endStep;sn++){let Pe=Tt[sn];if(!Pe)continue;let qe=u[Pe.messageIndex];qe&&Et.push(qe.lineNumber)}let Ft=Tt[ct.startStep],Kt=Ft!==void 0?u[Ft.messageIndex]:void 0,ue=Kt?Z?.messages.get(Kt.lineNumber):void 0,ve=nt(ue)||n.primary;yr.append("rect").attr("x",wt).attr("y",Ct).attr("width",F).attr("height",Yt-Ct).attr("fill",or(n,r));let Re=ie(n,ve,r,{solid:l}),Xe=yr.append("rect").attr("x",wt).attr("y",Ct).attr("width",F).attr("height",Yt-Ct).attr("fill",Re).attr("stroke",ve).attr("stroke-width",1).attr("stroke-opacity",.5).attr("data-participant-id",ct.participantId).attr("data-msg-lines",Et.join(",")).attr("data-line-number",Et[0]??"").attr("class","activation");J&&ue&&Xe.attr(`data-tag-${J}`,ue.toLowerCase())});for(let ct of dl){let ht=yr.append("line").attr("x1",ct.x1).attr("y1",ct.y1).attr("x2",ct.x2).attr("y2",ct.y2).attr("stroke",n.textMuted).attr("stroke-width",1).attr("stroke-dasharray","2 3").attr("class","block-divider");ct.blockLine!==void 0&&ht.attr("data-block-line",String(ct.blockLine))}for(let ct of ta){let ht=yr.append("text").attr("x",ct.x).attr("y",ct.y).attr("fill",n.text).attr("font-size",11).attr("class","block-label").text(ct.text);ct.bold&&ht.attr("font-weight","bold"),ct.italic&&ht.attr("font-style","italic"),ct.blockLine!==void 0&&ht.attr("data-block-line",String(ct.blockLine))}let Bt=(ct,ht)=>{let wt=-1;for(let Ct of gt)Ct.participantId===ct&&Ct.startStep<=ht&&ht<=Ct.endStep&&Ct.depth>wt&&(wt=Ct.depth);return wt},kt=(ct,ht,wt)=>{let Ct=to.get(ct),Yt=Bt(ct,ht);if(Yt<0)return Ct;let Et=Yt*St;return wt==="right"?Ct+F/2+Et:Ct-F/2+Et},Jt=Math.min(...Array.from(to.values())),re=du,pe=Jt-k/2-10,ce=re+k/2+10;for(let ct of Ut){let ht=ct.section,wt=dr.get(ht.lineNumber);if(wt===void 0)continue;let Ct=m?.has(ht.lineNumber)??!1,Yt=n.textMuted,Et=yr.append("g").attr("data-section-toggle","").attr("data-line-number",String(ht.lineNumber)).attr("data-section","").attr("tabindex","0").attr("role","button").attr("aria-expanded",String(!Ct)),Ft=22,Kt=pe-10,ue=ce-pe+20,_e=Ct?r?.35:.25:r?.1:.08;Et.append("rect").attr("x",Kt).attr("y",wt-Ft/2).attr("width",ue).attr("height",Ft).attr("fill",Yt).attr("opacity",_e).attr("rx",2).attr("pointer-events","none").attr("class","section-divider");let ve=Je.get(ht.lineNumber)??0,Re=Ct?`${ht.label} (${ve} ${ve===1?"message":"messages"})`:ht.label,Xe=(pe+ce)/2,sn=Math.max(80,_t(Re,11)+24);Et.append("rect").attr("x",Xe-sn/2).attr("y",wt-Ft/2).attr("width",sn).attr("height",Ft).attr("fill","transparent").attr("class","section-label-hit"),Et.append("text").attr("x",Xe).attr("y",wt+4).attr("text-anchor","middle").attr("fill",Yt).attr("font-size",11).attr("font-weight","bold").attr("class","section-label").text(Re)}Tt.forEach((ct,ht)=>{let wt=to.get(ct.from),Ct=to.get(ct.to);if(wt===void 0||Ct===void 0)return;let Yt=Jn(ht),Et=20,Ft=u[ct.messageIndex],Kt=Ft?Z?.messages.get(Ft.lineNumber):void 0,ue=nt(Kt);if(ct.type==="call"){let _e=ue||n.text;if(ct.from===ct.to){let ve=kt(ct.from,ht,"right"),Re=ve+z,Xe=ve;yr.append("rect").attr("x",Xe).attr("y",Yt-5).attr("width",z).attr("height",Y+10).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));let sn=yr.append("path").attr("d",`M ${ve} ${Yt} H ${Re} V ${Yt+Y} H ${ve}`).attr("fill","none").attr("stroke",_e).attr("stroke-width",1.2).attr("marker-end",ys("call",ue)).attr("class","message-arrow self-call").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&sn.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let Pe=yr.append("text").attr("x",Re+5).attr("y",Yt+Y/2+4).attr("text-anchor","start").attr("fill",_e).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",12).attr("class","message-label").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));J&&Kt&&Pe.attr(`data-tag-${J}`,Kt.toLowerCase()),Pe.text(ct.label)}}else{let ve=wt<Ct,Re=kt(ct.from,ht,ve?"right":"left"),Xe=kt(ct.to,ht,ve?"left":"right");yr.append("rect").attr("x",Math.min(Re,Xe)).attr("y",Yt-Et/2).attr("width",Math.abs(Xe-Re)).attr("height",Et).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));let sn=ct.async?ys("async",ue):ys("call",ue),Pe=yr.append("line").attr("x1",Re).attr("y1",Yt).attr("x2",Xe).attr("y2",Yt).attr("stroke",_e).attr("stroke-width",1.2).attr("marker-end",sn).attr("class","message-arrow").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&Pe.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let qe=(Re+Xe)/2,Ae=yr.append("text").attr("x",qe).attr("y",Yt-8).attr("text-anchor","middle").attr("fill",_e).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",12).attr("class","message-label").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));J&&Kt&&Ae.attr(`data-tag-${J}`,Kt.toLowerCase()),Ae.text(ct.label)}}}else{if(ct.from===ct.to)return;let _e=wt<Ct,ve=kt(ct.from,ht,_e?"right":"left"),Re=kt(ct.to,ht,_e?"left":"right"),Xe=ue||n.textMuted;yr.append("rect").attr("x",Math.min(ve,Re)).attr("y",Yt-Et/2).attr("width",Math.abs(Re-ve)).attr("height",Et).attr("fill","transparent").attr("class","message-hit-area").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));let sn=yr.append("line").attr("x1",ve).attr("y1",Yt).attr("x2",Re).attr("y2",Yt).attr("stroke",Xe).attr("stroke-width",1).attr("stroke-dasharray","6 4").attr("marker-end",ys("return",ue)).attr("class","return-arrow").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht)).attr("data-from",ct.from).attr("data-to",ct.to);if(J&&Kt&&sn.attr(`data-tag-${J}`,Kt.toLowerCase()),ct.label){let Pe=(ve+Re)/2,qe=yr.append("text").attr("x",Pe).attr("y",Yt-6).attr("text-anchor","middle").attr("fill",Xe).attr("paint-order","stroke fill").attr("stroke",n.bg).attr("stroke-width",4).attr("stroke-linejoin","round").attr("font-size",11).attr("class","message-label").attr("data-line-number",String(Ft.lineNumber)).attr("data-msg-index",String(ct.messageIndex)).attr("data-step-index",String(ht));J&&Kt&&qe.attr(`data-tag-${J}`,Kt.toLowerCase()),qe.text(ct.label)}}});let ke=r?Ot(n.surface,n.bg,50):Ot(n.bg,n.surface,15),$e=ct=>{for(let ht of ct)if(Zr(ht)){let wt=to.get(ht.participantId);if(wt===void 0)continue;let Ct=io.get(ht);if(Ct===void 0)continue;let Yt=q(ht),Et=Yt==="right",Ft=Mt(ht),Kt=tt(ht.participantId,Yt,Ft),ue=B(Kt),_e=V3(ht.text,ue,W),ve=_e.length*V+D*2,Re=Math.max(..._e.map(Ze=>_t(Ze.text,W))),Xe=Math.min(Kt,Math.max(80,Re+G*2+H)),sn=Ft&&Et?F/2+z+P:F+P,Pe=Et?wt+sn:wt-F-P-Xe,qe=yr.append("g").attr("class","note").attr("data-note-toggle","").attr("data-line-number",String(ht.lineNumber)).attr("data-line-end",String(ht.endLineNumber));qe.append("path").attr("d",[`M ${Pe} ${Ct}`,`L ${Pe+Xe-H} ${Ct}`,`L ${Pe+Xe} ${Ct+H}`,`L ${Pe+Xe} ${Ct+ve}`,`L ${Pe} ${Ct+ve}`,"Z"].join(" ")).attr("fill",ke).attr("stroke",n.textMuted).attr("stroke-width",.75).attr("class","note-box"),qe.append("path").attr("d",[`M ${Pe+Xe-H} ${Ct}`,`L ${Pe+Xe-H} ${Ct+H}`,`L ${Pe+Xe} ${Ct+H}`].join(" ")).attr("fill","none").attr("stroke",n.textMuted).attr("stroke-width",.75).attr("class","note-fold");let Ae=10;_e.forEach((Ze,Oe)=>{let Ke=Ct+D+(Oe+1)*V-3,De=Ze.kind==="plain"?0:Ae;Ze.kind==="bullet-first"&&qe.append("text").attr("x",Pe+G).attr("y",Ke).attr("fill",n.text).attr("font-size",W).text("\u2022");let En=qe.append("text").attr("x",Pe+G+De).attr("y",Ke).attr("fill",n.text).attr("font-size",W).attr("class","note-text");bn(En,Ze.text,n,W)})}else if(Pr(ht)){if($e(ht.children),ht.elseIfBranches)for(let wt of ht.elseIfBranches)$e(wt.children);$e(ht.elseChildren)}};if(f&&f.length>0&&$e(f),su){let ct=v+Be,ht={},wt=yr.append("g").attr("class","sequence-legend").attr("transform",`translate(0,${ct})`);mn(wt,{...We,palette:n,isDark:r,width:pi,activeGroup:ot??null,controlsExpanded:!1,callbacks:ht})}}function Cct(t){let e=new Map,n=-1,r=o=>{for(let a of o)if(Zr(a))n>=0&&e.set(a.lineNumber,n);else if(Pr(a)){if(r(a.children),a.elseIfBranches)for(let i of a.elseIfBranches)r(i.children);r(a.elseChildren)}else Yo(a)||(n=a.lineNumber)};return r(t),e}function _ct(t,e,n,r,o,a,i,s,l,c=nu,d=ec,u=Tb(nu),f=kb){let p=t.append("g").attr("transform",`translate(${n}, ${r})`).attr("class","participant").attr("data-participant-id",e.id);switch(s&&p.attr(`data-tag-${s.key}`,s.value),e.type){case"actor":vct(p,o,i,d);break;case"database":Nct(p,o,a,i,l,c,d);break;case"queue":Mct(p,o,a,i,l,c,d);break;case"cache":kct(p,o,a,i,l,c,d);break;default:Lct(p,o,a,i,l,c,d);break}let m=e.type==="actor",g=U3(e.label,u,f),h=f,S=h+2,y=m?o.text:Le(Mp(o,a,i,l),o.textOnFillLight,o.textOnFillDark),b=p.append("text").attr("x",0).attr("text-anchor","middle").attr("fill",y).attr("font-size",h).attr("font-weight",500),E=Tb(c),x=N=>nr(N,h,E);if(g.length===1)b.attr("y",m?d+14:d/2+5).text(x(e.label));else{let N=g.length*S,L=m?d+14-(g.length-1)*S/2:d/2+5-(N-S)/2;g.forEach((A,C)=>{b.append("tspan").attr("x",0).attr("dy",C===0?`${L}px`:`${S}px`).text(x(A))})}}var act,iN,z3,kb,ict,sct,lct,cct,dct,uct,fct,pct,mct,gct,hct,yct,bct,xct,wct,Ect,Sct,Tb,Mp,kp,ua,nu,ec,J3=st(()=>{"use strict";je();qn();tn();Ro();an();_c();F3();Ds();en();Y3();je();_o();Br();mr();act=160,iN=120,z3=50,kb=13,ict=20,sct=30,lct=10,cct=50,dct=30,uct=8,fct=200,pct=10,mct=8,gct=6,hct=10,yct=14,bct=15,xct=10,wct=25,Ect=30,Sct=22;Tb=t=>t-10;Mp=(t,e,n,r)=>n?ie(t,n,e,{...r!==void 0&&{solid:r}}):e?Ot(t.overlay,t.surface,50):Ot(t.bg,t.surface,50),kp=(t,e)=>e||t.border,ua=1.5,nu=iN,ec=z3});var c4=EN((CDt,Ib)=>{"use strict";var dN=(function(){var t=String.fromCharCode,e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",r={};function o(i,s){if(!r[i]){r[i]={};for(var l=0;l<i.length;l++)r[i][i.charAt(l)]=l}return r[i][s]}var a={compressToBase64:function(i){if(i==null)return"";var s=a._compress(i,6,function(l){return e.charAt(l)});switch(s.length%4){default:case 0:return s;case 1:return s+"===";case 2:return s+"==";case 3:return s+"="}},decompressFromBase64:function(i){return i==null?"":i==""?null:a._decompress(i.length,32,function(s){return o(e,i.charAt(s))})},compressToUTF16:function(i){return i==null?"":a._compress(i,15,function(s){return t(s+32)})+" "},decompressFromUTF16:function(i){return i==null?"":i==""?null:a._decompress(i.length,16384,function(s){return i.charCodeAt(s)-32})},compressToUint8Array:function(i){for(var s=a.compress(i),l=new Uint8Array(s.length*2),c=0,d=s.length;c<d;c++){var u=s.charCodeAt(c);l[c*2]=u>>>8,l[c*2+1]=u%256}return l},decompressFromUint8Array:function(i){if(i==null)return a.decompress(i);for(var s=new Array(i.length/2),l=0,c=s.length;l<c;l++)s[l]=i[l*2]*256+i[l*2+1];var d=[];return s.forEach(function(u){d.push(t(u))}),a.decompress(d.join(""))},compressToEncodedURIComponent:function(i){return i==null?"":a._compress(i,6,function(s){return n.charAt(s)})},decompressFromEncodedURIComponent:function(i){return i==null?"":i==""?null:(i=i.replace(/ /g,"+"),a._decompress(i.length,32,function(s){return o(n,i.charAt(s))}))},compress:function(i){return a._compress(i,16,function(s){return t(s)})},_compress:function(i,s,l){if(i==null)return"";var c,d,u={},f={},p="",m="",g="",h=2,S=3,y=2,b=[],E=0,x=0,N;for(N=0;N<i.length;N+=1)if(p=i.charAt(N),Object.prototype.hasOwnProperty.call(u,p)||(u[p]=S++,f[p]=!0),m=g+p,Object.prototype.hasOwnProperty.call(u,m))g=m;else{if(Object.prototype.hasOwnProperty.call(f,g)){if(g.charCodeAt(0)<256){for(c=0;c<y;c++)E=E<<1,x==s-1?(x=0,b.push(l(E)),E=0):x++;for(d=g.charCodeAt(0),c=0;c<8;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1}else{for(d=1,c=0;c<y;c++)E=E<<1|d,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=0;for(d=g.charCodeAt(0),c=0;c<16;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1}h--,h==0&&(h=Math.pow(2,y),y++),delete f[g]}else for(d=u[g],c=0;c<y;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1;h--,h==0&&(h=Math.pow(2,y),y++),u[m]=S++,g=String(p)}if(g!==""){if(Object.prototype.hasOwnProperty.call(f,g)){if(g.charCodeAt(0)<256){for(c=0;c<y;c++)E=E<<1,x==s-1?(x=0,b.push(l(E)),E=0):x++;for(d=g.charCodeAt(0),c=0;c<8;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1}else{for(d=1,c=0;c<y;c++)E=E<<1|d,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=0;for(d=g.charCodeAt(0),c=0;c<16;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1}h--,h==0&&(h=Math.pow(2,y),y++),delete f[g]}else for(d=u[g],c=0;c<y;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1;h--,h==0&&(h=Math.pow(2,y),y++)}for(d=2,c=0;c<y;c++)E=E<<1|d&1,x==s-1?(x=0,b.push(l(E)),E=0):x++,d=d>>1;for(;;)if(E=E<<1,x==s-1){b.push(l(E));break}else x++;return b.join("")},decompress:function(i){return i==null?"":i==""?null:a._decompress(i.length,32768,function(s){return i.charCodeAt(s)})},_decompress:function(i,s,l){var c=[],d,u=4,f=4,p=3,m="",g=[],h,S,y,b,E,x,N,L={val:l(0),position:s,index:1};for(h=0;h<3;h+=1)c[h]=h;for(y=0,E=Math.pow(2,2),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;switch(d=y){case 0:for(y=0,E=Math.pow(2,8),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;N=t(y);break;case 1:for(y=0,E=Math.pow(2,16),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;N=t(y);break;case 2:return""}for(c[3]=N,S=N,g.push(N);;){if(L.index>i)return"";for(y=0,E=Math.pow(2,p),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;switch(N=y){case 0:for(y=0,E=Math.pow(2,8),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;c[f++]=t(y),N=f-1,u--;break;case 1:for(y=0,E=Math.pow(2,16),x=1;x!=E;)b=L.val&L.position,L.position>>=1,L.position==0&&(L.position=s,L.val=l(L.index++)),y|=(b>0?1:0)*x,x<<=1;c[f++]=t(y),N=f-1,u--;break;case 2:return g.join("")}if(u==0&&(u=Math.pow(2,p),p++),c[N])m=c[N];else if(N===f)m=S+S.charAt(0);else return null;g.push(m),c[f++]=S+m.charAt(0),u--,S=m,u==0&&(u=Math.pow(2,p),p++)}}};return a})();typeof define=="function"&&define.amd?define(function(){return dN}):typeof Ib<"u"&&Ib!=null?Ib.exports=dN:typeof angular<"u"&&angular!=null&&angular.module("LZString",[]).factory("LZString",function(){return dN})});var Pn=require("fs"),ll=require("child_process"),No=require("os"),nn=require("path"),N4=require("@resvg/resvg-js");Ui();je();Xi();Xa();So();To();en();mr();Xi();function SC(t,e,n){if(t.length===0)return[];let r=t.map((i,s)=>({...i,idx:s})).sort((i,s)=>i.naturalY-s.naturalY),o=new Array(t.length),a=-1/0;for(let i of r){let s=i.height/2,l=Math.max(i.naturalY-s,a+e);n!==void 0&&(l=Math.min(l,n-i.height)),o[i.idx]=l+s,a=l+i.height}return o}var km={top:80,bottom:40,left:80},jY=14;function LC(t,e,n,r,o,a){let{periods:i,data:s}=e,l=e.noTitle?null:e.title;if(s.length===0||i.length<2)return;let c=za(t,n,a);if(!c)return;let{svg:d,width:u,height:f,textColor:p,mutedColor:m,bgColor:g,colors:h}=c,S=km.left+i.length*100+150,y=a?Ee.identity():Ee.from(u,S),b=y.aesthetic(km.top),E=y.aesthetic(km.bottom),x=y.aesthetic(km.left),N=y.text(jY),L=y.text(18),A=y.text(16),C=y.structural(15),k=`${y.structural(4)},${y.structural(4)}`,w=y.structural(2.5),v=y.structural(14),M=y.structural(4),_=y.structural(1.5),T=y.structural(10),R=y.structural(10);d.attr("preserveAspectRatio","xMidYMin meet"),y.isBelowFloor&&d.attr("width","100%");let O=s.reduce((Q,ot)=>{let Z=`${ot.values[ot.values.length-1]} \u2014 ${ot.label}`;return Z.length>Q.length?Z:Q},""),I=_t(O,N),H=Math.floor(u*.35),G=Math.min(Math.max(I+y.aesthetic(30),y.aesthetic(120)),H),D=u-x-G,W=f-b-E,V=s.flatMap(Q=>Q.values),[P,F]=gc(V),Y=(F-P)*.1||1,z=ir().domain([P-Y,F+Y]).range([W,0]),j=vs().domain(i).range([0,D]).padding(0),K=d.append("g").attr("transform",`translate(${x},${b})`),$=Zp(t,n,r);co(d,l,e.titleLineNumber,u,p,o);for(let Q of i){let ot=j(Q);K.append("text").attr("x",ot).attr("y",-C).attr("text-anchor","middle").attr("fill",p).attr("font-size",`${L}px`).attr("font-weight","600").text(Q),K.append("line").attr("x1",ot).attr("y1",0).attr("x2",ot).attr("y2",W).attr("stroke",m).attr("stroke-width",1).attr("stroke-dasharray",k)}let U=Qn().x((Q,ot)=>j(i[ot])).y(Q=>z(Q)),X=s.map((Q,ot)=>{let Z=Q.color??h[ot%h.length],lt=Q.values[0],nt=Q.values[Q.values.length-1],J=nt-lt,at=lt!==0?J/lt*100:null,it=J>0?"+":"",Lt=[`${it}${parseFloat(J.toFixed(2))}`];at!==null&&Lt.push(`${it}${at.toFixed(1)}%`);let Tt=Lt.join("<br>"),At=j(i[i.length-1]),rt=`${nt} \u2014 ${Q.label}`,pt=G-y.aesthetic(15),gt=1,dt=null;if(_t(rt,N)>pt){let vt=Cn(rt,N,pt);gt=vt.length,dt=vt}let ut=N*1.2,yt=gt===1?N:gt*ut;return{item:Q,idx:ot,color:Z,firstVal:lt,lastVal:nt,tipHtml:Tt,lastX:At,labelText:rt,wrappedLines:dt,labelHeight:yt}}),q=A*1.25,et=new Map;for(let Q=0;Q<i.length-1;Q++){let ot=s.map(Z=>({naturalY:z(Z.values[Q]),height:q}));et.set(Q,SC(ot,4,W))}let tt=X.map(Q=>({naturalY:z(Q.lastVal),height:Math.max(Q.labelHeight,N*1.4)})),B=SC(tt,4,W);s.forEach((Q,ot)=>{let Z=X[ot],lt=Z.color,nt=K.append("g").attr("class","slope-series").attr("data-line-number",String(Q.lineNumber));nt.append("path").datum(Q.values).attr("fill","none").attr("stroke",lt).attr("stroke-width",w).attr("d",U),nt.append("path").datum(Q.values).attr("fill","none").attr("stroke","transparent").attr("stroke-width",v).attr("d",U).style("cursor",o?"pointer":"default").on("mouseenter",it=>jo($,Z.tipHtml,it)).on("mousemove",it=>jo($,Z.tipHtml,it)).on("mouseleave",()=>Ls($)).on("click",()=>{o&&Q.lineNumber&&o(Q.lineNumber)}),Q.values.forEach((it,Lt)=>{let Tt=j(i[Lt]),At=z(it);nt.append("circle").attr("cx",Tt).attr("cy",At).attr("r",M).attr("fill",lt).attr("stroke",g).attr("stroke-width",_).style("cursor",o?"pointer":"default").on("mouseenter",gt=>jo($,Z.tipHtml,gt)).on("mousemove",gt=>jo($,Z.tipHtml,gt)).on("mouseleave",()=>Ls($)).on("click",()=>{o&&Q.lineNumber&&o(Q.lineNumber)});let rt=Lt===0;if(!(Lt===i.length-1)){let gt=et.get(Lt)[ot];nt.append("text").attr("x",rt?Tt-T:Tt).attr("y",gt).attr("dy","0.35em").attr("text-anchor",rt?"end":"middle").attr("fill",lt).attr("font-size",`${A}px`).text(it.toString())}});let J=B[ot],at=nt.append("text").attr("x",Z.lastX+R).attr("y",J).attr("text-anchor","start").attr("fill",lt).attr("font-size",`${N}px`).attr("font-weight","500");if(!Z.wrappedLines)at.attr("dy","0.35em").text(Z.labelText);else{let it=N*1.2,Tt=-((Z.wrappedLines.length-1)*it)/2;Z.wrappedLines.forEach((At,rt)=>{at.append("tspan").attr("x",Z.lastX+R).attr("dy",rt===0?`${Tt+N*.35}px`:`${it}px`).text(At)})}})}o0();Xa();qn();To();mr();Xi();function qY(t,e,n){let r=new Set;for(let a of t)r.add(a.source),r.add(a.target);let o=Array.from(r);if(e==="name")return o.slice().sort((a,i)=>a.localeCompare(i));if(e==="degree"){let a=new Map;for(let i of o)a.set(i,0);for(let i of t)a.set(i.source,a.get(i.source)+i.value),a.set(i.target,a.get(i.target)+i.value);return o.slice().sort((i,s)=>{let l=a.get(s)-a.get(i);return l!==0?l:i.localeCompare(s)})}if(e==="group"){if(n.length>0){let d=[],u=new Set;for(let f of n)for(let p of f.nodes)u.has(p)||(d.push(p),u.add(p));for(let f of o)u.has(f)||(d.push(f),u.add(f));return d}let a=new Map;for(let d of o)a.set(d,new Set);for(let d of t)a.get(d.source).add(d.target),a.get(d.target).add(d.source);let i=new Map;for(let d of o)i.set(d,0);for(let d of t)i.set(d.source,i.get(d.source)+d.value),i.set(d.target,i.get(d.target)+d.value);let s=new Set,l=[],c=new Set(o);for(;c.size>0;){let d="",u=-1;for(let m of c)i.get(m)>u&&(u=i.get(m),d=m);let f=[],p=[d];for(s.add(d),c.delete(d);p.length>0;){let m=p.shift();f.push(m);for(let g of a.get(m))s.has(g)||(s.add(g),c.delete(g),p.push(g))}l.push(f)}return l.sort((d,u)=>u.length-d.length),l.flat()}return o}var KY=60,a0=40,ZY=60,vC=40,NC=120,QY=5,JY=1.5,t6=11,e6=12,MC=60,n6=40,r6=4,o6=6,a6=14,i6=4,s6=14,l6=20,c6=1.5,d6=6,u6=1;function kC(t,e,n,r,o,a){let{links:i,orientation:s,arcOrder:l,arcNodeGroups:c}=e,d=e.noTitle?null:e.title;if(i.length===0)return;let u=za(t,n,a);if(!u)return;let{svg:f,width:p,height:m,textColor:g,mutedColor:h,bgColor:S,colors:y}=u,b=s==="vertical",E=qY(i,l,c),x=b?NC+a0+MC*2+100:E.length*20+vC+a0,N=a?Ee.identity():Ee.from(p,x),L=N.aesthetic(KY),A=N.aesthetic(a0),C=N.aesthetic(ZY),k=b?N.aesthetic(NC):N.aesthetic(vC),w=N.structural(QY),v=N.structural(JY),M=N.text(t6),_=N.text(e6),T=N.aesthetic(MC),R=N.aesthetic(n6),O=N.structural(r6),I=N.structural(o6),H=N.structural(a6),G=N.structural(i6),D=N.structural(s6),W=N.structural(l6),V=N.structural(c6),P=N.structural(d6),F=`${N.structural(4)},${N.structural(4)}`,Y=N.structural(u6);f.attr("preserveAspectRatio","xMidYMin meet"),N.isBelowFloor&&f.attr("width","100%");let z={top:L,right:A,bottom:C,left:k},j=p-z.left-z.right,K=m-z.top-z.bottom,$=new Map;for(let J of c)if(J.color)for(let at of J.nodes)$.has(at)||$.set(at,J.color);let U=new Map;for(let J of c)U.set(J.name,new Set(J.nodes));let X=i.map(J=>J.value),[q,et]=gc(X),tt=ir().domain([q,et]).range([V,P]),B=f.append("g").attr("transform",`translate(${z.left},${z.top})`);co(f,d,e.titleLineNumber,p,g,o);let Q=new Map;for(let J of E)Q.set(J,new Set);for(let J of i)Q.get(J.source).add(J.target),Q.get(J.target).add(J.source);let ot=.1;function Z(J){let at=Q.get(J);B.selectAll(".arc-link").each(function(){let it=It(this),Lt=it.attr("data-source"),Tt=it.attr("data-target"),At=Lt===J||Tt===J;it.attr("stroke-opacity",At?.85:ot)}),B.selectAll(".arc-node").each(function(){let it=It(this),Lt=it.attr("data-node"),Tt=Lt===J||at.has(Lt);it.attr("opacity",Tt?1:ot)})}function lt(){B.selectAll(".arc-link").attr("stroke-opacity",.7),B.selectAll(".arc-node").attr("opacity",1),B.selectAll(".arc-group-band").attr("fill-opacity",.06),B.selectAll(".arc-group-label").attr("fill-opacity",.5)}function nt(J){let at=U.get(J);at&&(B.selectAll(".arc-link").each(function(){let it=It(this),Lt=at.has(it.attr("data-source"))||at.has(it.attr("data-target"));it.attr("stroke-opacity",Lt?.85:ot)}),B.selectAll(".arc-node").each(function(){let it=It(this);it.attr("opacity",at.has(it.attr("data-node"))?1:ot)}),B.selectAll(".arc-group-band").each(function(){let it=It(this);it.attr("fill-opacity",it.attr("data-group")===J?.18:.03)}),B.selectAll(".arc-group-label").each(function(){let it=It(this);it.attr("fill-opacity",it.attr("data-group")===J?1:.2)}))}if(b){let J=vs().domain(E).range([0,K]).padding(.5),at=j/2;if(c.length>0){let it=(J.step?.()??20)*.4;for(let Lt of c){let Tt=Lt.nodes.filter(gt=>E.includes(gt));if(Tt.length===0)continue;let At=Tt.map(gt=>J(gt)),rt=Math.min(...At)-it,pt=Math.max(...At)+it;B.append("rect").attr("class","arc-group-band").attr("data-group",Lt.name).attr("data-line-number",String(Lt.lineNumber)).attr("x",at-T).attr("y",rt).attr("width",T*2).attr("height",pt-rt).attr("rx",O).attr("fill",g).attr("fill-opacity",.06).style("cursor","pointer").on("mouseenter",()=>nt(Lt.name)).on("mouseleave",lt).on("click",()=>{o&&o(Lt.lineNumber)}),B.append("text").attr("class","arc-group-label").attr("data-group",Lt.name).attr("data-line-number",String(Lt.lineNumber)).attr("x",at-T+I).attr("y",rt+H).attr("fill",g).attr("font-size",`${_}px`).attr("font-weight","600").attr("fill-opacity",.5).style("cursor",o?"pointer":"default").text(Lt.name).on("mouseenter",()=>nt(Lt.name)).on("mouseleave",lt).on("click",()=>{o&&o(Lt.lineNumber)})}}B.append("line").attr("x1",at).attr("y1",0).attr("x2",at).attr("y2",K).attr("stroke",h).attr("stroke-width",Y).attr("stroke-dasharray",F),i.forEach((it,Lt)=>{let Tt=J(it.source),At=J(it.target),rt=(Tt+At)/2,pt=Math.abs(At-Tt),gt=at+pt*.4,dt=it.color??y[Lt%y.length];B.append("path").attr("class","arc-link").attr("data-source",it.source).attr("data-target",it.target).attr("data-line-number",String(it.lineNumber)).attr("d",`M ${at},${Tt} Q ${gt},${rt} ${at},${At}`).attr("fill","none").attr("stroke",dt).attr("stroke-width",tt(it.value)).attr("stroke-opacity",.7).style("cursor",o?"pointer":"default").on("click",()=>{o&&it.lineNumber&&o(it.lineNumber)})});for(let it of E){let Lt=J(it),Tt=$.get(it)??g,At=i.find(pt=>pt.source===it||pt.target===it),rt=B.append("g").attr("class","arc-node").attr("data-node",it).attr("data-line-number",At?.lineNumber?String(At.lineNumber):null).style("cursor","pointer").on("mouseenter",()=>Z(it)).on("mouseleave",lt).on("click",()=>{o&&At?.lineNumber&&o(At.lineNumber)});rt.append("circle").attr("cx",at).attr("cy",Lt).attr("r",w).attr("fill",Tt).attr("stroke",S).attr("stroke-width",v),rt.append("text").attr("x",at-D).attr("y",Lt).attr("dy","0.35em").attr("text-anchor","end").attr("fill",g).attr("font-size",`${M}px`).text(it)}}else{let J=vs().domain(E).range([0,j]).padding(.5),at=K/2;if(a){let it=0;for(let rt of i){let pt=J(rt.source),gt=J(rt.target);pt!=null&&gt!=null&&(it=Math.max(it,Math.abs(gt-pt)))}let Lt=it*.2+w,Tt=Math.max(R,W+M);at=Lt;let At=z.top+Lt+Tt+z.bottom;f.attr("height",At).attr("viewBox",`0 0 ${p} ${At}`)}if(c.length>0){let it=(J.step?.()??20)*.4;for(let Lt of c){let Tt=Lt.nodes.filter(gt=>E.includes(gt));if(Tt.length===0)continue;let At=Tt.map(gt=>J(gt)),rt=Math.min(...At)-it,pt=Math.max(...At)+it;B.append("rect").attr("class","arc-group-band").attr("data-group",Lt.name).attr("data-line-number",String(Lt.lineNumber)).attr("x",rt).attr("y",at-R).attr("width",pt-rt).attr("height",R*2).attr("rx",O).attr("fill",g).attr("fill-opacity",.06).style("cursor","pointer").on("mouseenter",()=>nt(Lt.name)).on("mouseleave",lt).on("click",()=>{o&&o(Lt.lineNumber)}),B.append("text").attr("class","arc-group-label").attr("data-group",Lt.name).attr("data-line-number",String(Lt.lineNumber)).attr("x",(rt+pt)/2).attr("y",at+R-G).attr("text-anchor","middle").attr("fill",g).attr("font-size",`${_}px`).attr("font-weight","600").attr("fill-opacity",.5).style("cursor",o?"pointer":"default").text(Lt.name).on("mouseenter",()=>nt(Lt.name)).on("mouseleave",lt).on("click",()=>{o&&o(Lt.lineNumber)})}}B.append("line").attr("x1",0).attr("y1",at).attr("x2",j).attr("y2",at).attr("stroke",h).attr("stroke-width",Y).attr("stroke-dasharray",F),i.forEach((it,Lt)=>{let Tt=J(it.source),At=J(it.target),rt=(Tt+At)/2,pt=Math.abs(At-Tt),gt=at-pt*.4,dt=it.color??y[Lt%y.length];B.append("path").attr("class","arc-link").attr("data-source",it.source).attr("data-target",it.target).attr("data-line-number",String(it.lineNumber)).attr("d",`M ${Tt},${at} Q ${rt},${gt} ${At},${at}`).attr("fill","none").attr("stroke",dt).attr("stroke-width",tt(it.value)).attr("stroke-opacity",.7).style("cursor",o?"pointer":"default").on("click",()=>{o&&it.lineNumber&&o(it.lineNumber)})});for(let it of E){let Lt=J(it),Tt=$.get(it)??g,At=i.find(pt=>pt.source===it||pt.target===it),rt=B.append("g").attr("class","arc-node").attr("data-node",it).attr("data-line-number",At?.lineNumber?String(At.lineNumber):null).style("cursor","pointer").on("mouseenter",()=>Z(it)).on("mouseleave",lt).on("click",()=>{o&&At?.lineNumber&&o(At.lineNumber)});rt.append("circle").attr("cx",Lt).attr("cy",at).attr("r",w).attr("fill",Tt).attr("stroke",S).attr("stroke-width",v),rt.append("text").attr("x",Lt).attr("y",at+W).attr("text-anchor","middle").attr("fill",g).attr("font-size",`${M}px`).text(it)}}}i0();m0();g0();qn();var KC=uu(qC(),1);an();en();Xi();Va();function Q6(t){return t==="mixed"?()=>Math.random()>.5?0:90:t==="angled"?()=>Math.round(Math.random()*30-15):()=>0}function J6(){try{if(typeof document>"u")return!1;let t=document.createElement("canvas");return typeof t.getContext=="function"&&!!t.getContext("2d")}catch{return!1}}function tV(t,e){return _t(t,e)}function eV(t,e,n,r,o){let a=[...t].sort((c,d)=>d.size-c.size),i=[],s=Math.sqrt(e*e+n*n)/2,l=e>0?n/e:1;for(let c of a){let d=o(),u=tV(c.text,c.size)+r*2,f=c.size+r*2,p=d*Math.PI/180,m=Math.abs(Math.cos(p)),g=Math.abs(Math.sin(p)),h=(u*m+f*g)/2,S=(u*g+f*m)/2,y=null;for(let b=0;b<4e3;b++){let E=b*.25,x=E*1.4;if(x>s)break;let N=Math.cos(E)*x,L=Math.sin(E)*x*l;if(N-h<-e/2||N+h>e/2||L-S<-n/2||L+S>n/2)continue;let A=!1;for(let C of i)if(Math.abs(N-C.x)<h+C.halfW&&Math.abs(L-C.y)<S+C.halfH){A=!0;break}if(!A){y={x:N,y:L};break}}y&&i.push({...c,rotate:d,x:y.x,y:y.y,halfW:h,halfH:S})}return i}function ZC(t,e,n,r,o){return new Promise(a=>{It(t).selectAll(":not([data-d3-tooltip])").remove();let{words:i,cloudOptions:s}=e,l=e.noTitle?null:e.title;if(i.length===0){a();return}let c=o?.width??t.clientWidth,d=o?.height??t.clientHeight;if(c<=0||d<=0){a();return}let u=l?40:0,f=d-u,p=n.text,m=n.bg,g=lr(n),{minSize:h,maxSize:S}=s,y=i.map(v=>v.weight),b=Math.min(...y),x=Math.max(...y)-b||1,N=v=>{let M=(v-b)/x;return h+Math.sqrt(M)*(S-h)},L=Q6(s.rotate),A=It(t).append("svg").attr("width",c).attr("height",d).attr("viewBox",`0 0 ${c} ${d}`).attr("preserveAspectRatio","xMidYMid meet").style("background",m);co(A,l,e.titleLineNumber,c,p);let C=A.append("g").attr("transform",`translate(${c/2},${u+f/2})`),k=i.map(v=>({...v,size:N(v.weight)})),w=v=>{C.selectAll("text").data(v).join("text").style("font-size",M=>`${M.size}px`).style("font-family",Pt).style("font-weight","600").style("fill",(M,_)=>g[_%g.length]).attr("text-anchor","middle").attr("transform",M=>`translate(${M.x},${M.y}) rotate(${M.rotate})`).text(M=>M.text),a()};if(!J6()){w(eV(k,c,f,2,L));return}(0,KC.default)().size([c,f]).words(k).padding(2).rotate(L).fontSize(v=>v.size).font(Pt).on("end",w).start()})}y0();en();mr();Xi();tn();function nV(t,e,n,r,o,a,i){if(t.length===0)return[];let s=1/0,l=-1/0,c=1/0,d=-1/0;for(let E of t)s=Math.min(s,E.x-E.r),l=Math.max(l,E.x+E.r),c=Math.min(c,E.y-E.r),d=Math.max(d,E.y+E.r);let u=l-s,f=d-c,p=e-r-o,m=n-a-i,g=Math.min(p/u,m/f),h=(s+l)/2,S=(c+d)/2,y=r+p/2,b=a+m/2;return t.map(E=>({x:(E.x-h)*g+y,y:(E.y-S)*g+b,r:E.r*g}))}function Hu(t,e){let n=t.x-e.x,r=t.y-e.y;return n*n+r*r<=e.r*e.r+1e-6}function b0(t,e){let r=1/0,o=-1/0,a=1/0,i=-1/0;for(let f of t)r=Math.min(r,f.x-f.r),o=Math.max(o,f.x+f.r),a=Math.min(a,f.y-f.r),i=Math.max(i,f.y+f.r);let s=(o-r)/50,l=(i-a)/50,c=0,d=0,u=0;for(let f=0;f<=50;f++){let p=r+f*s;for(let m=0;m<=50;m++){let g=a+m*l,h=!0;for(let S=0;S<t.length;S++)if(Hu({x:p,y:g},t[S])!==e[S]){h=!1;break}h&&(c+=p,d+=g,u++)}}if(u===0){let f=0,p=0,m=0;for(let g=0;g<t.length;g++)e[g]&&(f+=t[g].x,p+=t[g].y,m++);return{x:f/(m||1),y:p/(m||1)}}return{x:c/u,y:d/u}}function QC(t,e,n,r,o,a){let{vennSets:i,vennOverlaps:s}=e,l=e.solidFill===!0,c=e.noTitle?null:e.title;if(i.length<2||i.length>3)return;let d=za(t,n,a);if(!d)return;let{svg:u,width:f,height:p,textColor:m,colors:g}=d,h=i.length,S=h===2?500:600,y=a?Ee.identity():Ee.from(f,S),b=c?y.aesthetic(40):0;u.attr("preserveAspectRatio","xMidYMid meet"),y.isBelowFloor&&u.attr("width","100%");let E=100,x=E*1.4,N;if(h===2)N=[{x:-x/2,y:0,r:E},{x:x/2,y:0,r:E}];else{let bt=x,Mt=Math.sqrt(3)/2*bt;N=[{x:-bt/2,y:Mt/3,r:E},{x:bt/2,y:Mt/3,r:E},{x:0,y:-(2*Mt)/3,r:E}]}let L=i.map((bt,Mt)=>bt.color??g[Mt%g.length]),A=N.reduce((bt,Mt)=>bt+Mt.x,0)/h,C=N.reduce((bt,Mt)=>bt+Mt.y,0)/h,k=y.aesthetic(30),w=y.aesthetic(30),v=y.aesthetic(30),M=y.aesthetic(30),_=y.structural(20),T=y.aesthetic(8),R=y.aesthetic(4),O=y.text(14);for(let bt=0;bt<h;bt++){let Mt=_t(i[bt].name,O)+_+T+R,zt=N[bt].x-A,xt=N[bt].y-C;if(Math.abs(zt)>=Math.abs(xt))zt>=0?w=Math.max(w,Mt):k=Math.max(k,Mt);else{let Nt=Mt*.5;xt>=0?M=Math.max(M,Nt+y.aesthetic(20)):v=Math.max(v,Nt+y.aesthetic(20))}}let I=y.text(13),H=y.structural(16),G=y.structural(18),D=y.aesthetic(6),W=y.aesthetic(12),V=Math.max(y.structural(80),Math.min(y.structural(170),f*.18));function P(bt){let Mt=N.map((zt,xt)=>xt).filter(zt=>!bt.includes(zt));if(Mt.length>0){let zt=0,xt=0;for(let Wt of Mt)zt+=N[Wt].x,xt+=N[Wt].y;zt/=Mt.length,xt/=Mt.length;let Nt=0,Dt=0;for(let Wt of bt)Nt+=N[Wt].x,Dt+=N[Wt].y;Nt/=bt.length,Dt/=bt.length;let Vt=Nt-zt,$t=Dt-xt,ft=Math.sqrt(Vt*Vt+$t*$t);if(ft>=1e-6)return{x:Vt/ft,y:$t/ft}}return h===3?{x:0,y:-1}:{x:0,y:1}}let F=new Map;for(let bt of s){if(!bt.label)continue;let Mt=bt.sets.map($t=>i.findIndex(ft=>ft.name===$t));if(Mt.some($t=>$t<0))continue;let zt=Cn(bt.label,I,V);F.set(bt,zt);let xt=P(Mt),Nt=zt.reduce(($t,ft)=>Math.max($t,_t(ft,I)),0),Dt=zt.length*H,Vt=G+D+W;if(Math.abs(xt.x)>=Math.abs(xt.y)){let $t=Nt+Vt;xt.x>=0?w=Math.max(w,$t):k=Math.max(k,$t);let ft=Dt/2;xt.y>=0?M=Math.max(M,ft+8):v=Math.max(v,ft+8)}else{let ft=Mt.length===3&&h===3&&xt.y<0?32:0,Wt=Dt+Vt+ft;xt.y>=0?M=Math.max(M,Wt):v=Math.max(v,Wt)}}let Y=p-b,z=f*.32,j=Y*.4;k=Math.min(k,z),w=Math.min(w,z),v=Math.min(v,j),M=Math.min(M,j);let K=nV(N,f,Y,k,w,v,M).map(bt=>({...bt,y:bt.y+b})),$=K[0].r;u.append("style").text("circle:focus, circle:focus-visible { outline-solid: none !important; }"),co(u,c,e.titleLineNumber,f,m,o);let U=[],X=u.append("g");K.forEach((bt,Mt)=>{let zt=X.append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r).attr("fill",L[Mt]).attr("fill-opacity",l?.6:.35).attr("stroke",L[Mt]).attr("stroke-width",y.structural(2)).style("pointer-events","none");U.push(zt)});let q=u.append("defs");K.forEach((bt,Mt)=>{q.append("clipPath").attr("id",`vcp-${Mt}`).append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r)});let et=K.map((bt,Mt)=>[Mt]);h===2?et.push([0,1]):et.push([0,1],[0,2],[1,2],[0,1,2]);let tt=u.append("g").style("pointer-events","none"),B=new Map;for(let bt of et){let Mt=bt.join("-"),zt=Array.from({length:h},(Vt,$t)=>$t).filter(Vt=>!bt.includes(Vt)),xt=`vcp-${bt[0]}`;for(let Vt=1;Vt<bt.length;Vt++){let $t=`vcp-n-${bt.slice(0,Vt+1).join("-")}`,ft=bt[Vt];q.append("clipPath").attr("id",$t).append("circle").attr("cx",K[ft].x).attr("cy",K[ft].y).attr("r",K[ft].r).attr("clip-path",`url(#${xt})`),xt=$t}let Nt=null;if(bt.length===1)Nt=i[bt[0]].lineNumber;else{let Vt=bt.map(ft=>i[ft].name).sort();Nt=s.find(ft=>ft.sets.length===Vt.length&&ft.sets.every((Wt,ge)=>Wt===Vt[ge]))?.lineNumber??null}let Dt=tt.append("rect").attr("x",0).attr("y",0).attr("width",f).attr("height",p).attr("fill","white").attr("fill-opacity",0).attr("class","venn-region-overlay").attr("data-line-number",Nt!=null?String(Nt):"0").attr("clip-path",`url(#${xt})`);if(zt.length>0){let Vt=`vvm-${Mt}`,$t=q.append("mask").attr("id",Vt);$t.append("rect").attr("x",0).attr("y",0).attr("width",f).attr("height",p).attr("fill","white");for(let ft of zt)$t.append("circle").attr("cx",K[ft].x).attr("cy",K[ft].y).attr("r",K[ft].r).attr("fill","black");Dt.attr("mask",`url(#${Vt})`)}B.set(Mt,Dt)}let Q=new Map;function ot(bt,Mt){Q.has(bt)||Q.set(bt,[]),Q.get(bt).push(Mt)}function Z(bt){Q.forEach((Mt,zt)=>{let xt=bt===null||zt===bt?1:.2;Mt.forEach(Nt=>Nt.attr("opacity",xt))})}let lt=bt=>{let Mt=[...bt].sort((zt,xt)=>zt-xt).join("-");B.forEach((zt,xt)=>zt.attr("fill-opacity",xt===Mt?0:.55)),Z(Mt)},nt=()=>{B.forEach(bt=>bt.attr("fill-opacity",0)),Z(null)},J=K.reduce((bt,Mt)=>bt+Mt.x,0)/h,at=K.reduce((bt,Mt)=>bt+Mt.y,0)/h;function it(bt,Mt,zt){let xt=K[zt],Nt=Mt-xt.y,Dt=Math.sqrt(Math.max(0,xt.r*xt.r-Nt*Nt)),Vt=xt.x-Dt,$t=xt.x+Dt;for(let ft=0;ft<h;ft++){if(ft===zt)continue;let Wt=K[ft],ge=Mt-Wt.y;if(Math.abs(ge)>=Wt.r)continue;let ne=Math.sqrt(Wt.r*Wt.r-ge*ge),se=Wt.x-ne,Zt=Wt.x+ne;if(se<=Vt&&Zt>=$t)return 0;se<=Vt&&Zt>Vt&&(Vt=Zt),Zt>=$t&&se<$t&&($t=se)}return Math.max(0,$t-Vt)}let Lt=y.text(10),Tt=y.text(22),At=y.aesthetic(12),rt=u.append("g"),pt=K.map(()=>null);K.forEach((bt,Mt)=>{let zt=i[Mt].name,xt=K.map((se,Zt)=>Zt===Mt),Nt=b0(K,xt),Dt=it(Nt.x,Nt.y,Mt),Vt=_t(zt,1),$t=Math.min(Tt,Math.max(Lt,(Dt-At*2)/Vt)),ft=_t(zt,$t),Wt=ft+At*2<Dt&&Hu({x:Nt.x,y:Nt.y-$t/2},bt)&&Hu({x:Nt.x,y:Nt.y+$t/2},bt),ge=String(Mt),ne=rt.append("g").style("cursor","default").on("mouseenter",()=>lt([Mt])).on("mouseleave",()=>nt());if(ot(ge,ne),Wt)ne.append("text").attr("x",Nt.x).attr("y",Nt.y).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",m).attr("font-size",`${Math.round($t)}px`).attr("font-weight","bold").text(zt),pt[Mt]={x:Nt.x-ft/2,y:Nt.y-$t/2,w:ft,h:$t};else{let se=bt.x-J,Zt=bt.y-at,Ie=Math.sqrt(se*se+Zt*Zt);Ie<1e-6?(se=1,Zt=0):(se/=Ie,Zt/=Ie);let Ht=bt.x+se*bt.r,Qt=bt.y+Zt*bt.r,Ut=Ht+se*T,fe=Qt+Zt*T,de=Ut+se*_,te=fe+Zt*_;ne.append("line").attr("x1",Ut).attr("y1",fe).attr("x2",de).attr("y2",te).attr("stroke",m).attr("stroke-width",y.structural(1));let ae=de>=J,Te=ae?"start":"end",Je=de+(ae?R:-R),ln=te,Ve=_t(zt,O);ae?Je=Math.min(Je,f-Ve-4):Je=Math.max(Je,Ve+4);let Ce=Math.max(O,Math.min(p-4,ln));ne.append("text").attr("x",Je).attr("y",Ce).attr("text-anchor",Te).attr("dominant-baseline","central").attr("fill",m).attr("font-size",`${O}px`).attr("font-weight","bold").text(zt);let ee=_t(zt,O);pt[Mt]={x:ae?Je:Je-ee,y:Ce-O/2,w:ee,h:O}}});function gt(bt,Mt,zt,xt,Nt,Dt=4){let Vt=zt-bt,$t=xt-Mt,ft=[];for(let se of Nt){let Zt=se.x-Dt,Ie=se.y-Dt,Ht=se.w+2*Dt,Qt=se.h+2*Dt,Ut=0,fe=1;if(Math.abs(Vt)<1e-9){if(bt<Zt||bt>Zt+Ht)continue}else{let de=(Zt-bt)/Vt,te=(Zt+Ht-bt)/Vt;Ut=Math.max(Ut,Math.min(de,te)),fe=Math.min(fe,Math.max(de,te))}if(Math.abs($t)<1e-9){if(Mt<Ie||Mt>Ie+Qt)continue}else{let de=(Ie-Mt)/$t,te=(Ie+Qt-Mt)/$t;Ut=Math.max(Ut,Math.min(de,te)),fe=Math.min(fe,Math.max(de,te))}Ut<fe&&ft.push([Math.max(0,Ut),Math.min(1,fe)])}ft.sort((se,Zt)=>se[0]-Zt[0]);let Wt=[];for(let se of ft){let Zt=Wt[Wt.length-1];!Zt||se[0]>Zt[1]?Wt.push([se[0],se[1]]):Zt[1]=Math.max(Zt[1],se[1])}let ge=[],ne=0;for(let[se,Zt]of Wt)se>ne&&ge.push({x1:bt+Vt*ne,y1:Mt+$t*ne,x2:bt+Vt*se,y2:Mt+$t*se}),ne=Math.max(ne,Zt);return ne<1&&ge.push({x1:bt+Vt*ne,y1:Mt+$t*ne,x2:zt,y2:xt}),ge}function dt(bt,Mt){let zt=K.map((xt,Nt)=>Nt).filter(xt=>!Mt.includes(xt));if(zt.length>0){let xt=0,Nt=0;for(let ft of zt)xt+=K[ft].x,Nt+=K[ft].y;xt/=zt.length,Nt/=zt.length;let Dt=bt.x-xt,Vt=bt.y-Nt,$t=Math.sqrt(Dt*Dt+Vt*Vt);if($t>=1e-6){let ft=Math.abs(Dt/$t)<1e-9?0:Dt/$t,Wt=Math.abs(Vt/$t)<1e-9?0:Vt/$t;return{x:ft,y:Wt}}}return h===3?{x:0,y:-1}:{x:0,y:1}}function ut(bt,Mt,zt){let xt=1/0;for(let Nt of zt){let Dt=K[Nt],Vt=bt.x-Dt.x,$t=bt.y-Dt.y,ft=Vt*Mt.x+$t*Mt.y,Wt=Vt*Vt+$t*$t-Dt.r*Dt.r,ge=ft*ft-Wt;if(ge<0)continue;let ne=-ft+Math.sqrt(ge);ne>0&&ne<xt&&(xt=ne)}return isFinite(xt)?{x:bt.x+Mt.x*xt,y:bt.y+Mt.y*xt}:{x:bt.x,y:bt.y}}function yt(bt,Mt,zt){let xt=1/0,Nt=-1/0,Dt=1/0,Vt=-1/0;for(let se of K)xt=Math.min(xt,se.x-se.r),Nt=Math.max(Nt,se.x+se.r),Dt=Math.min(Dt,se.y-se.r),Vt=Math.max(Vt,se.y+se.r);let $t=3,ft=400,Wt=Mt.x===0||Mt.y===0,ge={x:bt.x,y:bt.y},ne=!1;for(let se=0;se<ft;se++){let Zt={x:ge.x+Mt.x*$t,y:ge.y+Mt.y*$t};if(ge=Zt,!(!ne&&(ne=!zt.every(Ht=>Hu(Zt,K[Ht])),!ne)||K.some(Ht=>Hu(Zt,Ht)))){if(Wt){let Ht=Mt.x>0?Zt.x>=Nt:Zt.x<=xt,Qt=Mt.y>0?Zt.y>=Vt:Zt.y<=Dt;if(Mt.x!==0&&!Ht||Mt.y!==0&&!Qt)continue}break}}return ge}for(let bt of s){if(!bt.label)continue;let Mt=bt.sets.map(We=>i.findIndex(kn=>kn.name===We));if(Mt.some(We=>We<0))continue;let zt=F.get(bt)??[bt.label],xt=K.map((We,kn)=>Mt.includes(kn)),Nt=b0(K,xt),Dt=dt(Nt,Mt),Vt=Mt.length===3&&h===3,$t=Vt&&Dt.y<0?32:0,ft=G+$t,Wt=ut(Nt,Dt,Mt),ge=yt(Nt,Dt,Mt),ne=ge.x+Dt.x*ft,se=ge.y+Dt.y*ft,Zt=Math.abs(Dt.x)>=Math.abs(Dt.y),Ie,Ht="central";Zt?Ie=Dt.x>=0?"start":"end":(Ie="middle",Ht=Dt.y>=0?"hanging":"auto");let Qt,Ut;if(Zt){let We=Dt.x>=0?1:-1;Qt=ne+We*D,Ut=se}else{let We=Dt.y>=0?1:-1;Qt=ne,Ut=se+We*D}let fe=zt.reduce((We,kn)=>Math.max(We,_t(kn,I)),0),de=zt.length*H;Ie==="start"?Qt=Math.min(Qt,f-fe-4):Ie==="end"?Qt=Math.max(Qt,fe+4):Qt=Math.max(fe/2+4,Math.min(f-fe/2-4,Qt));let te,ae;Ht==="hanging"?(te=Ut,ae=Ut+de):Ht==="auto"?(ae=Ut,te=Ut-de):(te=Ut-de/2,ae=Ut+de/2),te<b+6?Ut+=b+6-te:ae>p-4&&(Ut-=ae-(p-4));let Te=Ht==="hanging"?Ut:Ht==="auto"?Ut-(zt.length-1)*H:Ut-(zt.length-1)*H/2,Je=Vt?Nt.x:Wt.x,ln=Vt?Nt.y:Wt.y,Ve=L[Mt[0]];for(let We=1;We<Mt.length;We++){let kn=We/(We+1)*100;Ve=Ot(Ve,L[Mt[We]],kn)}let Ce=Ot(Ve,m,90),ee=[...Mt].sort((We,kn)=>We-kn).join("-"),oe=rt.append("g").style("cursor","default").on("mouseenter",()=>lt(Mt)).on("mouseleave",()=>nt());ot(ee,oe);let Be=pt.filter(We=>We!==null),fn=gt(Je,ln,ne,se,Be,4);for(let We of fn)oe.append("line").attr("x1",We.x1).attr("y1",We.y1).attr("x2",We.x2).attr("y2",We.y2).attr("stroke",Ce).attr("stroke-width",y.structural(1.25)).attr("opacity",.85);let An=oe.append("text").attr("text-anchor",Ie).attr("dominant-baseline",Ht).attr("fill",Ce).attr("font-size",`${I}px`).attr("font-weight","600");zt.forEach((We,kn)=>{let Kn=An.append("tspan").attr("x",Qt);kn===0?Kn.attr("y",Te):Kn.attr("dy",H),Kn.text(We)})}let vt=u.append("g");K.forEach((bt,Mt)=>{vt.append("circle").attr("cx",bt.x).attr("cy",bt.y).attr("r",bt.r).attr("fill","transparent").attr("stroke","none").attr("class","venn-hit-target").attr("data-line-number",String(i[Mt].lineNumber)).style("cursor",o?"pointer":"default").style("outline-solid","none").on("mouseenter",()=>{lt([Mt])}).on("mouseleave",()=>{nt()}).on("click",function(){this.blur?.(),o&&i[Mt].lineNumber&&o(i[Mt].lineNumber)})});let Gt=$*.35,Xt=[];if(h===2)Xt.push({idxs:[0,1],sets:[i[0].name,i[1].name].sort()});else{for(let bt=0;bt<h;bt++)for(let Mt=bt+1;Mt<h;Mt++)Xt.push({idxs:[bt,Mt],sets:[i[bt].name,i[Mt].name].sort()});Xt.push({idxs:[0,1,2],sets:[i[0].name,i[1].name,i[2].name].sort()})}for(let bt of Xt){let{idxs:Mt,sets:zt}=bt,xt=K.map((Vt,$t)=>Mt.includes($t)),Nt=b0(K,xt),Dt=s.find(Vt=>Vt.sets.length===zt.length&&Vt.sets.every(($t,ft)=>$t===zt[ft]));vt.append("circle").attr("cx",Nt.x).attr("cy",Nt.y).attr("r",Gt).attr("fill","transparent").attr("stroke","none").attr("class","venn-hit-target").attr("data-line-number",Dt?String(Dt.lineNumber):"").style("cursor",o&&Dt?"pointer":"default").style("outline-solid","none").on("mouseenter",()=>{lt(Mt)}).on("mouseleave",()=>{nt()}).on("click",function(){this.blur?.(),o&&Dt&&o(Dt.lineNumber)})}}x0();Xa();qn();E0();en();mr();Xi();tn();function e_(t,e,n,r,o,a){let{quadrantLabels:i,quadrantPoints:s,quadrantXAxis:l,quadrantYAxis:c,quadrantTitleLineNumber:d,quadrantXAxisLineNumber:u,quadrantYAxisLineNumber:f}=e,p=e.noTitle?null:e.title;if(s.length===0)return;let m=za(t,n,a);if(!m)return;let{svg:g,width:h,height:S,textColor:y}=m,b=n.border,x=a?Ee.identity():Ee.from(h,600);g.attr("preserveAspectRatio","xMidYMid meet"),x.isBelowFloor&&g.attr("width","100%");let N=[n.colors.blue,n.colors.green,n.colors.yellow,n.colors.purple],L=!!l,A=!!c,C={top:p?x.aesthetic(60):x.aesthetic(30),right:x.aesthetic(30),bottom:L?x.aesthetic(70):x.aesthetic(40),left:A?x.aesthetic(80):x.aesthetic(40)},k=h-C.left-C.right,w=S-C.top-C.bottom,v=ir().domain([0,1]).range([0,k]),M=ir().domain([0,1]).range([w,0]);co(g,p,d,h,y,o);let _=g.append("g").attr("transform",`translate(${C.left}, ${C.top})`),T=or(n,r),R=(J,at)=>J?.color??N[at%N.length],O=(J,at)=>Ot(R(J,at),T,30),I=[{position:"top-left",x:0,y:0,w:k/2,h:w/2,labelX:k/4,labelY:w/4,label:i.topLeft,colorIdx:1},{position:"top-right",x:k/2,y:0,w:k/2,h:w/2,labelX:k*3/4,labelY:w/4,label:i.topRight,colorIdx:0},{position:"bottom-left",x:0,y:w/2,w:k/2,h:w/2,labelX:k/4,labelY:w*3/4,label:i.bottomLeft,colorIdx:2},{position:"bottom-right",x:k/2,y:w/2,w:k/2,h:w/2,labelX:k*3/4,labelY:w*3/4,label:i.bottomRight,colorIdx:3}],H=_.selectAll("rect.quadrant").data(I).enter().append("rect").attr("class","quadrant").attr("x",J=>J.x).attr("y",J=>J.y).attr("width",J=>J.w).attr("height",J=>J.h).attr("fill",J=>O(J.label,J.colorIdx)).attr("stroke",J=>R(J.label,J.colorIdx)).attr("stroke-width",x.structural(2)),G="rgba(0,0,0,0.4)",D=Ot(y,T,35),W=x.text(48),V=x.text(14),P=x.aesthetic(40),F=(J,at,it)=>{let Lt=at-P,Tt=it-P;if(_t(J,W)<=Lt){let ut=Math.min(W,Tt);return{lines:[J],fontSize:Math.max(V,Math.round(ut))}}let At=ut=>Cn(J,ut,Lt),rt=V,pt=W,gt=At(rt),dt=rt;for(;rt<=pt;){let ut=Math.round((rt+pt)/2),yt=At(ut),vt=yt.length*ut*1.2;Math.max(...yt.map(Xt=>_t(Xt,ut)))<=Lt&&vt<=Tt?(dt=ut,gt=yt,rt=ut+1):pt=ut-1}return{lines:gt,fontSize:Math.max(V,dt)}},Y=k/2,z=w/2,j=I.filter(J=>J.label!==null),K=new Map(j.map(J=>[J.label.text,F(J.label.text,Y,z)])),$=(J,at)=>{let it=K.get(at.label.text),Lt=It(J);if(Lt.text(null).attr("font-size",`${it.fontSize}px`).attr("font-weight","700"),it.lines.length===1)Lt.text(it.lines[0]);else{let Tt=it.fontSize*1.2,rt=-(it.lines.length*Tt)/2+Tt/2;it.lines.forEach((pt,gt)=>{Lt.append("tspan").attr("x",at.labelX).attr("dy",gt===0?`${rt}px`:`${Tt}px`).text(pt)})}},U=_.selectAll("text.quadrant-label").data(j).enter().append("text").attr("class","quadrant-label").attr("x",J=>J.labelX).attr("y",J=>J.labelY).attr("text-anchor","middle").attr("dominant-baseline","central").attr("fill",D).attr("data-line-number",J=>J.label?.lineNumber?String(J.label.lineNumber):null).style("cursor",J=>o&&J.label?.lineNumber?"pointer":"default").each(function(J){$(this,J)});o&&U.on("click",(J,at)=>{at.label?.lineNumber&&o(at.label.lineNumber)}).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)});let X=x.text(18),q=x.aesthetic(20),et=x.aesthetic(22);if(l){let J=g.append("text").attr("class","quadrant-axis-label").attr("x",C.left+k/4).attr("y",S-q).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("data-line-number",u?String(u):null).style("cursor",o&&u?"pointer":"default").text(l[0]),at=g.append("text").attr("class","quadrant-axis-label").attr("x",C.left+k*3/4).attr("y",S-q).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("data-line-number",u?String(u):null).style("cursor",o&&u?"pointer":"default").text(l[1]);o&&u&&[J,at].forEach(it=>{it.on("click",()=>o(u)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)})})}if(c){let J=C.top+w*3/4,at=C.top+w/4,it=g.append("text").attr("class","quadrant-axis-label").attr("x",et).attr("y",J).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("transform",`rotate(-90, ${et}, ${J})`).attr("data-line-number",f?String(f):null).style("cursor",o&&f?"pointer":"default").text(c[0]),Lt=g.append("text").attr("class","quadrant-axis-label").attr("x",et).attr("y",at).attr("text-anchor","middle").attr("fill",y).attr("font-size",`${X}px`).attr("transform",`rotate(-90, ${et}, ${at})`).attr("data-line-number",f?String(f):null).style("cursor",o&&f?"pointer":"default").text(c[1]);o&&f&&[it,Lt].forEach(Tt=>{Tt.on("click",()=>o(f)).on("mouseenter",function(){It(this).attr("opacity",.7)}).on("mouseleave",function(){It(this).attr("opacity",1)})})}_.append("line").attr("x1",k/2).attr("y1",0).attr("x2",k/2).attr("y2",w).attr("stroke",b).attr("stroke-width",1),_.append("line").attr("x1",0).attr("y1",w/2).attr("x2",k).attr("y2",w/2).attr("stroke",b).attr("stroke-width",1);let tt=(J,at)=>J>=.5&&at>=.5?"top-right":J<.5&&at>=.5?"top-left":J<.5&&at<.5?"bottom-left":"bottom-right",B=x.structural(6),Q=x.text(12),ot=j.map(J=>{let at=K.get(J.label.text),it=Math.max(...at.lines.map(Tt=>_t(Tt,at.fontSize))),Lt=at.lines.length*at.fontSize*1.2;return{x:J.labelX-it/2,y:J.labelY-Lt/2,w:it,h:Lt}}),Z=s.map(J=>({label:J.label,cx:v(J.x),cy:M(J.y)})),lt=t_(Z,{left:0,top:0,right:k,bottom:w},ot,B,Q),nt=_.append("g").attr("class","points");s.forEach((J,at)=>{let it=v(J.x),Lt=M(J.y),Tt=tt(J.x,J.y),At=I.find(Gt=>Gt.position===Tt),rt=At?.label?.color??N[At?.colorIdx??0],pt=lt[at],gt=nt.append("g").attr("class","point-group").attr("data-line-number",String(J.lineNumber)).attr("data-quadrant",Tt);pt.connectorLine&&gt.append("line").attr("x1",pt.connectorLine.x1).attr("y1",pt.connectorLine.y1).attr("x2",pt.connectorLine.x2).attr("y2",pt.connectorLine.y2).attr("stroke",rt).attr("stroke-width",1).attr("opacity",.5),gt.append("circle").attr("cx",it).attr("cy",Lt).attr("r",B).attr("fill","#ffffff").attr("stroke",rt).attr("stroke-width",x.structural(2));let dt=gt.append("text").attr("x",pt.x).attr("y",pt.y).attr("text-anchor",pt.anchor).attr("dominant-baseline","central").attr("fill",y).attr("font-size",`${Q}px`).attr("font-weight","700").style("text-shadow",`0 1px 2px ${G}`).style("transition","y 120ms ease-out");dt.append("tspan").text(J.label);let ut=dt.append("tspan").attr("class","point-coords").attr("x",pt.x).attr("dy",`${Q}px`).attr("font-size",`${x.text(10)}px`).attr("font-weight","500").attr("opacity",0).text(`${J.x.toFixed(2)}, ${J.y.toFixed(2)}`),yt=x.structural(14),vt=pt.y<Lt?-yt:yt;gt.style("cursor",o?"pointer":"default").on("mouseenter",()=>{gt.select("circle").attr("r",x.structural(8)),dt.attr("y",pt.y+vt),ut.attr("opacity",1),H.attr("opacity",Gt=>Gt.position===Tt?1:.3),U.attr("opacity",Gt=>Gt.position===Tt?1:.3),nt.selectAll("g.point-group").filter((Gt,Xt)=>Xt!==at).attr("opacity",.3)}).on("mouseleave",()=>{gt.select("circle").attr("r",B),dt.attr("y",pt.y),ut.attr("opacity",0),H.attr("opacity",1),U.attr("opacity",1),nt.selectAll("g.point-group").attr("opacity",1)}).on("click",()=>{o&&J.lineNumber&&o(J.lineNumber)})}),H.style("cursor",o?"pointer":"default").on("mouseenter",function(J,at){H.attr("opacity",it=>it.position===at.position?1:.3),U.attr("opacity",it=>it.position===at.position?1:.3),nt.selectAll("g.point-group").each(function(it,Lt){let Tt=s[Lt],At=tt(Tt.x,Tt.y);It(this).attr("opacity",At===at.position?1:.2)})}).on("mouseleave",()=>{H.attr("opacity",1),U.attr("opacity",1),nt.selectAll("g.point-group").attr("opacity",1)}).on("click",(J,at)=>{o&&at.label?.lineNumber&&o(at.label.lineNumber)})}S0();var Act={org:Pct,sitemap:Dct,kanban:Gct,class:Oct,er:$ct,"boxes-and-lines":Hct,swimlane:Wct,"version-control":Ict,mindmap:Fct,wireframe:Bct,c4:Yct,flowchart:Vct,infra:zct,pert:Uct,gantt:Xct,state:jct,"tech-radar":qct,"journey-map":Kct,cycle:Zct,map:Qct,pyramid:Jct,ring:tdt,treemap:edt,block:ndt,raci:rdt,slope:odt,arc:adt,timeline:idt,"event-line":Rct,wordcloud:sdt,venn:ldt,quadrant:cdt};function sN(t,e,n){if(e==="arc"){let r=Tc(t,n);if(!r.error&&r.layout==="chord"&&r.links.length)return{content:[`chord ${r.title??""}`.trimEnd(),...r.links.map(a=>`${a.source} -> ${a.target} ${a.value}`)].join(`
312
312
  `),type:"chord"}}return null}async function t4(t,e,n,r,o){let a=o?.exportMode??!1,{parseDgmoChartType:i}=await Promise.resolve().then(()=>(ff(),TA)),s=i(t),l=sN(t,s,n),c=l?.content??t,d=l?.type??s;if(d!==null){let{supportsD3DataChart:p,renderDataChartD3:m}=await Promise.resolve().then(()=>(rE(),cR));if(p(d))return m(c,e,n)}let u={content:c,theme:e,palette:n,viewState:r,options:o,exportMode:a,isDark:e==="dark"};return((d!==null?Act[d]:void 0)??ddt)(u)}function fa(t){return t.viewState?.tag??t.options?.tagGroup}async function Rct(t){let{content:e,theme:n,palette:r}=t,{parseEventLine:o}=await Promise.resolve().then(()=>(sw(),t2)),{renderEventLineForExport:a}=await Promise.resolve().then(()=>(LR(),SR)),i=await zn(n,r),s=o(e,i);if(s.error||s.events.length===0)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br},fa(t)),Un(l,n,i)}async function Ict(t){let{content:e,theme:n,palette:r}=t,{parseVersionControl:o}=await Promise.resolve().then(()=>(cw(),r2)),{renderVersionControlForExport:a}=await Promise.resolve().then(()=>(TR(),kR)),i=await zn(n,r),s=o(e,i);if(s.error||s.nodes.length===0)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br}),Un(l,n,i)}function e4(t,e){let n=t?t.split(",").map(o=>o.trim().toLowerCase()).filter(Boolean):[],r=new Set([...n,...e??[]]);return r.size>0?r:void 0}async function Pct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseOrg:i}=await Promise.resolve().then(()=>(ju(),G_)),{layoutOrg:s}=await Promise.resolve().then(()=>(AE(),bI)),{collapseOrgTree:l}=await Promise.resolve().then(()=>(NI(),vI)),{renderOrg:c}=await Promise.resolve().then(()=>(RI(),AI)),d=t.isDark,u=await zn(n,r),f=i(e,u);if(f.error)return"";let p=o?.cg?new Set(o.cg):void 0,m=Wr(f.tagGroups,f.options["active-tag"],fa(t)),g=e4(f.options.hide,o?.ha),{parsed:h,hiddenCounts:S}=p&&p.size>0?l(f,p):{parsed:f,hiddenCounts:new Map},y=s(h,S.size>0?S:void 0,m,g,!1),b=20,E=h.title?30:0,x=y.width+b*2,N=y.height+b*2+E,L=ar(x,N);return c(L,h,y,u,d,void 0,{width:x,height:N},m,g,void 0,a),Un(L,n,u)}async function Dct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseSitemap:i}=await Promise.resolve().then(()=>(qu(),j0)),{layoutSitemap:s}=await Promise.resolve().then(()=>(KE(),qE)),{collapseSitemapTree:l}=await Promise.resolve().then(()=>(PP(),IP)),{renderSitemap:c}=await Promise.resolve().then(()=>($P(),OP)),d=t.isDark,u=await zn(n,r),f=i(e,u);if(f.error||f.roots.length===0)return"";let p=o?.cg?new Set(o.cg):void 0,m=Wr(f.tagGroups,f.options["active-tag"],fa(t)),g=e4(f.options.hide,o?.ha),{parsed:h,hiddenCounts:S}=p&&p.size>0?l(f,p):{parsed:f,hiddenCounts:new Map},y=s(h,S.size>0?S:void 0,m,g,!0),b=20,E=h.title?30:0,x=y.width+b*2,N=y.height+b*2+E,L=ar(x,N);return c(L,h,y,u,d,void 0,{width:x,height:N},m,g,a),Un(L,n,u)}async function Gct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseKanban:i}=await Promise.resolve().then(()=>(ug(),o2)),{renderKanban:s}=await Promise.resolve().then(()=>(jP(),XP)),l=await zn(n,r),c=i(e,l);if(c.error||c.columns.length===0)return"";let d=document.createElement("div");d.style.position="absolute",d.style.left="-9999px",document.body.appendChild(d);let u=o?.cl?new Set(o.cl):void 0,f=c.columns.filter(m=>m.collapsed).map(m=>m.id),p=o?.cc||f.length>0?new Set([...f,...o?.cc??[]]):void 0;return s(d,c,l,t.isDark,{activeTagGroup:Wr(c.tagGroups,c.options["active-tag"],fa(t)),currentSwimlaneGroup:o?.swim??c.options["lane-by"]??null,...u!==void 0&&{collapsedLanes:u},...p!==void 0&&{collapsedColumns:p},...o?.cm!==void 0&&{compactMeta:o.cm},exportMode:a}),Un(d,n,l)}async function Oct(t){let{content:e,theme:n,palette:r,exportMode:o}=t,{parseClassDiagram:a}=await Promise.resolve().then(()=>(Uu(),__)),{layoutClassDiagram:i}=await Promise.resolve().then(()=>(a1(),KP)),{renderClassDiagram:s}=await Promise.resolve().then(()=>(rD(),nD)),l=await zn(n,r),c=a(e,l);if(c.error||c.classes.length===0)return"";let d=i(c),u=20,f=c.title?40:0,p=d.width+u*2,m=d.height+u*2+f,g=ar(p,m);return s(g,c,d,l,t.isDark,void 0,{width:p,height:m},void 0,o),Un(g,n,l)}async function $ct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseERDiagram:i}=await Promise.resolve().then(()=>(Xu(),P_)),{layoutERDiagram:s}=await Promise.resolve().then(()=>(d1(),aD)),{renderERDiagram:l}=await Promise.resolve().then(()=>(mD(),pD)),c=await zn(n,r),d=i(e,c);if(d.error||d.tables.length===0)return"";let u=s(d),f=20,p=d.title?40:0,m=u.width+f*2,g=u.height+f*2+p,h=ar(m,g);return l(h,d,u,c,t.isDark,void 0,{width:m,height:g},Wr(d.tagGroups,d.options["active-tag"],fa(t)),o?.sem??(d.options["no-semantic-colors"]==="on"?!1:void 0),a),Un(h,n,c)}async function Hct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseBoxesAndLines:i}=await Promise.resolve().then(()=>(Sw(),O2)),s=await zn(n,r),l=i(e,s);if(l.error||l.nodes.length===0)return"";let c;if(o?.htv){c=new Map;for(let[b,E]of Object.entries(o.htv))c.set(b,new Set(E))}let{renderBoxesAndLinesForExport:d}=await Promise.resolve().then(()=>(SD(),ED)),{layoutBoxesAndLines:u}=await Promise.resolve().then(()=>(vf(),zD)),f=await u(l),p=20,m=l.title?40:0,g=f.width+p*2,h=f.height+p*2+m,S=ar(g,h),y=fa(t);return d(S,l,f,s,t.isDark,{exportDims:{width:g,height:h},...y!==void 0&&{activeTagGroup:y},...c!==void 0&&{hiddenTagValues:c},exportMode:a}),Un(S,n,s)}async function Wct(t){let{content:e,theme:n,palette:r}=t,{parseSwimlane:o}=await Promise.resolve().then(()=>(vw(),F2)),{layoutSwimlane:a}=await Promise.resolve().then(()=>(rG(),nG)),{renderSwimlaneForExport:i}=await Promise.resolve().then(()=>(cG(),lG)),s=await zn(n,r),l=o(e,s);if(l.error||l.nodes.length===0)return"";let c=a(l),d=20,u=l.title?40:0,f=c.width+d*2,p=c.height+d*2+u,m=ar(f,p);return i(m,l,c,s,t.isDark,{exportDims:{width:f,height:p},activeTagGroup:Wr(l.tagGroups,l.options["active-tag"],fa(t)),exportMode:t.exportMode}),Un(m,n,s)}async function Fct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseMindmap:i}=await Promise.resolve().then(()=>(Eg(),B2)),{layoutMindmap:s}=await Promise.resolve().then(()=>($1(),hG)),{collapseMindmapTree:l}=await Promise.resolve().then(()=>(xG(),bG)),{renderMindmap:c}=await Promise.resolve().then(()=>(LG(),SG)),d=t.isDark,u=await zn(n,r),f=i(e,u);if(f.error)return"";let p=new Set(o?.cg??[]),m=w=>{for(let v of w)v.collapsed&&p.add(v.id),v.children.length&&m(v.children)};m(f.roots);let g=Wr(f.tagGroups,f.options["active-tag"],fa(t)),h=f.options["no-descriptions"]==="true"||o?.hd===!0,{roots:S,hiddenCounts:y}=p&&p.size>0?l(f.roots,p):{roots:f.roots,hiddenCounts:new Map},b={...f,roots:S},E=s(b,u,{interactive:!1,...y.size>0&&{hiddenCounts:y},activeTagGroup:g,hideDescriptions:h}),x=20,N=b.title?30:0,L=E.width+x*2,A=E.height+x*2+N,C=ar(L,A),k=o?.cbd??f.options["color-by-depth"]==="on";return c(C,b,E,u,d,void 0,{width:L,height:A},void 0,h,k?null:g,k?{colorByDepth:!0,exportMode:a}:{exportMode:a}),Un(C,n,u)}async function Bct(t){let{content:e,theme:n,palette:r}=t,{parseWireframe:o}=await Promise.resolve().then(()=>(kw(),q2)),{layoutWireframe:a}=await Promise.resolve().then(()=>(CG(),TG)),{renderWireframe:i}=await Promise.resolve().then(()=>(GG(),DG)),s=await zn(n,r),l=o(e);if(l.error||l.roots.length===0&&l.modals.length===0)return"";let c=a(l),d=c.width,u=c.height,f=ar(d,u);return i(f,l,c,s,t.isDark,void 0,{width:d,height:u},n),Un(f,n,s)}async function Yct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseC4:i}=await Promise.resolve().then(()=>(fg(),c2)),{layoutC4Context:s,layoutC4Containers:l,layoutC4Components:c,layoutC4Deployment:d}=await Promise.resolve().then(()=>(X1(),VG)),{renderC4Context:u,renderC4Containers:f}=await Promise.resolve().then(()=>(cO(),lO)),p=await zn(n,r),m=i(e,p);if(m.error||m.elements.length===0)return"";let g=t.options?.c4Level??o?.c4l??"context",h=t.options?.c4System??o?.c4s,S=t.options?.c4Container??o?.c4c,y=g==="deployment"?d(m):g==="components"&&h&&S?c(m,h,S):g==="containers"&&h?l(m,h):s(m);if(y.nodes.length===0)return"";let b=20,E=m.title?40:0,x=y.width+b*2,N=y.height+b*2+E,L=ar(x,N);return(g==="deployment"||g==="components"&&h&&S||g==="containers"&&h?f:u)(L,m,y,p,t.isDark,void 0,{width:x,height:N},Wr(m.tagGroups,m.options["active-tag"],fa(t)),a),Un(L,n,p)}async function Vct(t){let{content:e,theme:n,palette:r}=t,{parseFlowchart:o}=await Promise.resolve().then(()=>(Vu(),v_)),{layoutGraph:a}=await Promise.resolve().then(()=>(Rf(),Q1)),{renderFlowchart:i}=await Promise.resolve().then(()=>(pO(),fO)),s=await zn(n,r),l=o(e,s);if(l.error||l.nodes.length===0)return"";let c=a(l),d=ar(pr,br);return i(d,l,c,s,t.isDark,void 0,{width:pr,height:br}),Un(d,n,s)}async function zct(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parseInfra:a}=await Promise.resolve().then(()=>(gg(),L2)),{computeInfra:i}=await Promise.resolve().then(()=>(sS(),gO)),{layoutInfra:s}=await Promise.resolve().then(()=>(uS(),NO)),{renderInfra:l,computeInfraLegendGroups:c}=await Promise.resolve().then(()=>(VO(),YO)),d=await zn(n,r),u=a(e);if(u.error||u.nodes.length===0)return"";let f=i(u),p=s(f),m=Wr(u.tagGroups,u.options["active-tag"],fa(t)),g=!!u.title&&u.options["no-title"]!=="on",h=g?40:0,S=[...u.tagGroups],b=c(p.nodes,S,d).length>0?28:0,E=p.width,x=p.height+h+b,N=ar(E,x);l(N,p,d,t.isDark,g?u.title:null,g?u.titleLineNumber:null,S,m,!1,null,null,!0,o?.cg?new Set(o.cg):null);let L=N.querySelector("svg");return L&&(L.setAttribute("width",String(E)),L.setAttribute("height",String(x))),Un(N,n,d)}async function Uct(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parsePert:a}=await Promise.resolve().then(()=>(ef(),z_)),{analyzePert:i}=await Promise.resolve().then(()=>(wS(),t$)),{layoutPert:s}=await Promise.resolve().then(()=>(LS(),s$)),{renderPert:l,measurePertAnalysisBlock:c}=await Promise.resolve().then(()=>(I$(),R$)),d=await zn(n,r),u=a(e,{palette:d});if(u.error||u.activities.length===0)return"";let f=i(u),p=s(f),m=u.title&&!u.options.noTitle?80:0,g=20,h=o?.an??!u.options.noAnalysis,S=o?.fl===!0,y=p.width+g*2,b=h||S?c(f,y-2*g,{showSummary:!1,showTornado:h,showScurve:h,showFieldLegend:S}):{width:0,height:0},E=p.height+g*2+m+b.height,x=ar(y,E);return l(x,f,p,d,t.isDark,{title:u.title,exportDims:{width:y,height:E},showSummary:!1,showTornado:h,showScurve:h,showFieldLegend:S}),Un(x,n,d)}async function Xct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseGantt:i}=await Promise.resolve().then(()=>(gw(),_2)),{calculateSchedule:s}=await Promise.resolve().then(()=>(F$(),W$)),{renderGantt:l}=await Promise.resolve().then(()=>(uH(),dH)),c=await zn(n,r),d=i(e,c),u=s(d);if(u.tasks.length===0)return"";let f=1200,p=800,m=ar(f,p),g=u.groups.filter(E=>E.collapsed).map(E=>E.name),h=o?.cg||g.length>0?new Set([...g,...o?.cg??[]]):void 0,S=u.options.sort==="tag"?u.options.defaultSwimlaneGroup??void 0:void 0,y=o?.swim??S,b=o?.cl?new Set(o.cl):void 0;return l(m,u,c,t.isDark,{...h!==void 0&&{collapsedGroups:h},...y!==void 0&&{currentSwimlaneGroup:y},...b!==void 0&&{collapsedLanes:b},currentActiveGroup:Wr(u.tagGroups,u.options.activeTag??void 0,fa(t)),exportMode:a},{width:f,height:p}),Un(m,n,c)}async function jct(t){let{content:e,theme:n,palette:r,viewState:o}=t,{parseState:a}=await Promise.resolve().then(()=>(zu(),M_)),{layoutGraph:i}=await Promise.resolve().then(()=>(Rf(),Q1)),{renderState:s}=await Promise.resolve().then(()=>(mH(),pH)),{collapseStateGroups:l}=await Promise.resolve().then(()=>(hH(),gH)),c=await zn(n,r),d=a(e,c);if(d.error||d.nodes.length===0)return"";let u=(d.groups??[]).filter(y=>y.collapsed).map(y=>y.id),f=new Set([...u,...o?.cg??[]]),{parsed:p,collapsedChildCounts:m,originalGroups:g}=f.size>0?l(d,f):{parsed:d,collapsedChildCounts:new Map,originalGroups:d.groups??[]},h=i(p,{collapsedChildCounts:m,originalGroups:g}),S=ar(pr,br);return s(S,p,h,c,t.isDark,void 0,{width:pr,height:br}),Un(S,n,c)}async function qct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseTechRadar:i}=await Promise.resolve().then(()=>(_w(),K2)),{renderTechRadarForExport:s}=await Promise.resolve().then(()=>(IH(),RH)),l=await zn(n,r),c=i(e);if(c.error||c.quadrants.length===0)return"";let d=1300,u=1500,f=ar(d,u);return s(f,c,l,t.isDark,{width:d,height:u},o,a),Un(f,n,l)}async function Kct(t){let{content:e,theme:n,palette:r,exportMode:o}=t,{parseJourneyMap:a}=await Promise.resolve().then(()=>(Mg(),tA)),{renderJourneyMap:i}=await Promise.resolve().then(()=>(jH(),XH)),{layoutJourneyMap:s}=await Promise.resolve().then(()=>(iL(),$H)),l=await zn(n,r),c=a(e,l);if(c.error||c.phases.length===0&&c.steps.length===0)return"";let d=s(c,l,{isDark:t.isDark}),u=ar(d.totalWidth,d.totalHeight);return i(u,c,l,t.isDark,{exportDims:{width:d.totalWidth,height:d.totalHeight},exportMode:o}),Un(u,n,l)}async function Zct(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,{parseCycle:i}=await Promise.resolve().then(()=>(Rw(),Z2)),{renderCycleForExport:s}=await Promise.resolve().then(()=>(cW(),lW)),l=await zn(n,r),c=i(e);if(c.error||c.nodes.length===0)return"";let d=ar(pr,br);return s(d,c,l,t.isDark,{width:pr,height:br},o,a),Un(d,n,l)}async function Qct(t){let{content:e,theme:n,palette:r,options:o}=t,{parseMap:a}=await Promise.resolve().then(()=>(bg(),xw)),{resolveMap:i}=await Promise.resolve().then(()=>(Mv(),Nv)),{renderMapForExport:s}=await Promise.resolve().then(()=>(kB(),MB)),{mapExportDimensions:l}=await Promise.resolve().then(()=>(RB(),AB)),c=await zn(n,r),d=a(e,c),u=o?.mapData;if(!u){let{loadMapData:g}=await Promise.resolve().then(()=>(cb(),Vv));try{u=await g()}catch{return""}}let f=i(d,u),p=l(f,u,pr,o?.mapAspect),m=ar(p.width,p.height);return s(m,f,u,c,t.isDark,p),Un(m,n,c)}async function Jct(t){let{content:e,theme:n,palette:r}=t,{parsePyramid:o}=await Promise.resolve().then(()=>(Pw(),nA)),{renderPyramidForExport:a}=await Promise.resolve().then(()=>(BB(),FB)),i=await zn(n,r),s=o(e);if(s.error||s.layers.length===0)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br}),Un(l,n,i)}async function tdt(t){let{content:e,theme:n,palette:r}=t,{parseRing:o}=await Promise.resolve().then(()=>(Gw(),aA)),{renderRingForExport:a}=await Promise.resolve().then(()=>(ZB(),KB)),i=await zn(n,r),s=o(e);if(s.error||s.layers.length===0)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br}),Un(l,n,i)}async function edt(t){let{content:e,theme:n,palette:r}=t,{parseTreemap:o}=await Promise.resolve().then(()=>(Hw(),lA)),a=await zn(n,r),i=o(e,a);if(i.error||i.roots.length===0)return"";let s=ar(pr,br),l={width:pr,height:br};if(i.options.radial){let{renderTreemapRadialForExport:c}=await Promise.resolve().then(()=>(a3(),o3));c(s,i,a,t.isDark,l)}else{let{renderTreemapForExport:c}=await Promise.resolve().then(()=>(p3(),f3));c(s,i,a,t.isDark,l)}return Un(s,n,a)}async function ndt(t){let{content:e,theme:n,palette:r}=t,{parseBlock:o}=await Promise.resolve().then(()=>(Fw(),cA)),{renderBlockForExport:a}=await Promise.resolve().then(()=>(N3(),v3)),i=await zn(n,r),s=o(e,i);if(s.error||s.top.rows.length===0)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br}),Un(l,n,i)}async function rdt(t){let{content:e,theme:n,palette:r}=t,{parseRaci:o}=await Promise.resolve().then(()=>(_g(),bA)),{renderRaciForExport:a}=await Promise.resolve().then(()=>(H3(),$3)),i=await zn(n,r),s=o(e,i);if(s.error)return"";let l=ar(pr,br);return a(l,s,i,t.isDark,{width:pr,height:br}),Un(l,n,i)}function ru(){return{container:ar(pr,br),dims:{width:pr,height:br}}}async function odt(t){let{content:e,theme:n,palette:r}=t,o=Tm(e,r);if(o.error||o.data.length===0)return"";let a=await zn(n,r),{container:i,dims:s}=ru();return LC(i,o,a,t.isDark,void 0,s),Un(i,n,a)}async function adt(t){let{content:e,theme:n,palette:r}=t,o=Tc(e,r);if(o.error||o.links.length===0)return"";let a=await zn(n,r),{container:i,dims:s}=ru();return kC(i,o,a,t.isDark,void 0,s),Un(i,n,a)}async function idt(t){let{content:e,theme:n,palette:r,viewState:o,exportMode:a}=t,i=Bm(e,r);if(i.error||i.timelineEvents.length===0)return"";let s=await zn(n,r),{container:l,dims:c}=ru();return Fm(l,i,s,t.isDark,void 0,c,Wr(i.timelineTagGroups,i.timelineActiveTag,fa(t)),o?.swim??i.timelineDefaultSwimlaneTG,void 0,void 0,a),Un(l,n,s)}async function sdt(t){let{content:e,theme:n,palette:r}=t,o=zm(e,r);if(o.error||o.words.length===0)return"";let a=await zn(n,r),{container:i,dims:s}=ru();return await ZC(i,o,a,t.isDark,s),Un(i,n,a)}async function ldt(t){let{content:e,theme:n,palette:r}=t,o=Um(e,r);if(o.error||o.vennSets.length<2)return"";let a=await zn(n,r),{container:i,dims:s}=ru();return QC(i,o,a,t.isDark,void 0,s),Un(i,n,a)}async function cdt(t){let{content:e,theme:n,palette:r}=t,o=Xm(e,r);if(o.error||o.quadrantPoints.length===0)return"";let a=await zn(n,r),{container:i,dims:s}=ru();return e_(i,o,a,t.isDark,void 0,s),Un(i,n,a)}async function ddt(t){let{content:e,theme:n,palette:r,viewState:o}=t,a=lo(e,r);if(a.type!=="sequence")if(a.error){if(!/->|~>|<-/.test(e))return""}else return"";let i=await zn(n,r),s=t.isDark,l=ar(pr,br),{parseSequenceDgmo:c}=await Promise.resolve().then(()=>(_c(),i_)),{renderSequenceDiagram:d}=await Promise.resolve().then(()=>(J3(),Q3)),u=c(e,i);if(u.error||u.participants.length===0)return"";let f=o?.cs?new Set(o.cs):void 0,p=o?.cg?new Set(o.cg.map(Number).filter(g=>Number.isFinite(g))):void 0,m=fa(t);return d(l,u,i,s,void 0,{exportWidth:pr,...m!==void 0&&{activeTagGroup:m},...f!==void 0&&{collapsedSections:f},...p!==void 0&&{collapsedGroups:p}}),Un(l,n,i)}rE();var _b="filter:saturate(1.4) brightness(1.06)",udt="transition:filter .12s ease, opacity .12s ease";function Cb(t){let e="";for(let n of t){let r=n.codePointAt(0);n==='"'?e+='\\"':n==="\\"?e+="\\\\":n==="<"?e+="\\3c ":r<32||r===127?e+="\\"+r.toString(16)+" ":e+=n}return e}function fdt(t){return`${t}:hover{${_b}}`}function pdt(t,e,n,r,o){let a=Cb(n),i=`svg:has(${t}[${e}="${a}"]:hover)`;return r==="lift"?`${i} ${t}[${e}="${a}"]{${_b}}`:`${i} ${t}:not([${e}="${a}"]){opacity:${o}}`}function mdt(t,e,n,r,o){let a=Cb(n.toLowerCase()),i=Cb(n),s=`svg:has([data-legend-entry="${a}"]:hover)`;return r==="lift"?`${s} ${t}[${e}="${i}"]{${_b}}`:`${s} ${t}:not([${e}="${i}"]){opacity:${o}}`}function gdt(t,e,n){let r=Cb(e),{hoverSelector:o,hoverAttr:a,edgeSelector:i,fromAttr:s,toAttr:l}=t;return`${`svg:has(${o}[${a}="${r}"]:hover)`} ${i}:not([${s}="${r}"]):not([${l}="${r}"]){opacity:${n}}`}function hdt(t,e={},n){let r=n??t.emphasis??"lift",o=t.dimOpacity??.4,a=t.selfEmphasis!==!1,i=e.values??[],s=e.ids??[],l=[];a&&(l.push(fdt(t.markSelector)),t.animatesOpacity||l.push(`${t.markSelector}{${udt}}`));let c=[];if(t.strategy==="structural"&&t.groupSelector){let u=t.groupSelector;c.push(r==="lift"?`svg:has(${u}:hover) ${u}:hover{${_b}}`:`svg:has(${u}:hover) ${u}:not(:hover){opacity:${o}}`)}else if(t.strategy==="enumerated"&&t.groupAttr){let u=t.legend?i.length:0;if(i.length+u>40)l.push(`/* hover: ${i.length} groups exceeds cap 40; self-emphasis only */`);else{for(let f of i)c.push(pdt(t.markSelector,t.groupAttr,f,r,o));if(t.legend)for(let f of i)c.push(mdt(t.markSelector,t.groupAttr,f,r,o))}}else if(t.strategy==="connection")if(s.length>40)l.push(`/* hover: ${s.length} nodes exceeds cap 40; self-emphasis only */`);else for(let u of s)c.push(gdt(t,u,o));let d=[...l];return c.length&&d.push(`@media (hover:hover){${c.join("")}}`),d.join("")}var ydt={pie:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},bar:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},funnel:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},heatmap:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},"polar-area":{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-emph-key",legend:!0},gantt:{markSelector:".gantt-task",strategy:"enumerated",groupAttr:"data-group"},timeline:{markSelector:".tl-event",strategy:"enumerated",groupAttr:"data-group"},raci:{markSelector:"[data-role-id]",strategy:"enumerated",groupAttr:"data-role-id"},sequence:{markSelector:".participant",strategy:"connection",hoverSelector:".participant",hoverAttr:"data-participant-id",edgeSelector:".message-arrow",fromAttr:"data-from",toAttr:"data-to"},arc:{markSelector:".arc-node",strategy:"connection",hoverSelector:".arc-node",hoverAttr:"data-node",edgeSelector:".arc-link",fromAttr:"data-source",toAttr:"data-target"},pert:{markSelector:".pert-node",strategy:"connection",hoverSelector:".pert-node",hoverAttr:"data-activity-id",edgeSelector:".pert-edge",fromAttr:"data-source",toAttr:"data-target"},treemap:{markSelector:".dgmo-treemap-cell",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},block:{markSelector:".dgmo-block-cell",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},"event-line":{markSelector:".dgmo-event-dot",strategy:"enumerated",groupAttrMode:"tag-active",legend:!0},flowchart:{markSelector:".fc-node",strategy:"connection",hoverSelector:".fc-node",hoverAttr:"data-node-id",edgeSelector:".fc-edge-group",fromAttr:"data-source",toAttr:"data-target"},state:{markSelector:".st-node",strategy:"connection",hoverSelector:".st-node",hoverAttr:"data-node-id",edgeSelector:".st-edge-group",fromAttr:"data-source",toAttr:"data-target"},"boxes-and-lines":{markSelector:".bl-node",strategy:"connection",hoverSelector:".bl-node",hoverAttr:"data-node-id",edgeSelector:".bl-edge-group",fromAttr:"data-from",toAttr:"data-to"},infra:{markSelector:".infra-node",strategy:"connection",hoverSelector:".infra-node",hoverAttr:"data-infra-node",edgeSelector:".infra-edge",fromAttr:"data-from",toAttr:"data-to"},c4:{markSelector:".c4-card",strategy:"connection",hoverSelector:".c4-card",hoverAttr:"data-node-id",edgeSelector:".c4-edge-group",fromAttr:"data-source",toAttr:"data-target"},class:{markSelector:".cd-class",strategy:"connection",hoverSelector:".cd-class",hoverAttr:"data-node-id",edgeSelector:".cd-edge-group",fromAttr:"data-source",toAttr:"data-target"},er:{markSelector:".er-table",strategy:"connection",hoverSelector:".er-table",hoverAttr:"data-node-id",edgeSelector:".er-edge-group",fromAttr:"data-source",toAttr:"data-target"},org:{markSelector:".org-node",strategy:"connection",hoverSelector:".org-node",hoverAttr:"data-node-id",edgeSelector:".org-edge",fromAttr:"data-from",toAttr:"data-to"},sitemap:{markSelector:".sitemap-node",strategy:"connection",hoverSelector:".sitemap-node",hoverAttr:"data-node-id",edgeSelector:".sitemap-edge-group",fromAttr:"data-from",toAttr:"data-to"},cycle:{markSelector:".cycle-node",strategy:"connection",hoverSelector:".cycle-node",hoverAttr:"data-node-index",edgeSelector:".cycle-edge",fromAttr:"data-from",toAttr:"data-to"},scatter:{markSelector:".dgmo-datum",strategy:"enumerated",groupAttr:"data-category",legend:!0},quadrant:{markSelector:".point-group",strategy:"enumerated",groupAttr:"data-quadrant"},"version-control":{markSelector:"[data-branch]",strategy:"enumerated",groupAttr:"data-branch"},kanban:{markSelector:".kanban-column",strategy:"structural",groupSelector:".kanban-column",emphasis:"dim",selfEmphasis:!1},line:{markSelector:"g.dgmo-series",strategy:"structural",groupSelector:"g.dgmo-series",emphasis:"dim",selfEmphasis:!1},swimlane:{markSelector:"[data-lane]",strategy:"enumerated",groupAttr:"data-lane"},"tech-radar":{markSelector:"[data-trend]",strategy:"enumerated",groupAttr:"data-quadrant"},"journey-map":{markSelector:".journey-face",strategy:"enumerated",groupAttr:"data-score"},mindmap:{markSelector:".mindmap-node",strategy:"enumerated",groupAttrMode:"tag-active"},pyramid:{markSelector:".pyramid-layer",strategy:"self"},ring:{markSelector:".ring-layer",strategy:"self"},slope:{markSelector:".slope-series",strategy:"self"},function:{markSelector:".dgmo-datum",strategy:"self"},map:{markSelector:"[data-poi]",strategy:"enumerated",groupAttrMode:"tag-active"}};function bdt(t,e){if(typeof document>"u")return{};let n=document.createElement("div");n.innerHTML=t;let r=n.querySelector("svg");if(!r)return{};if(e.strategy==="enumerated"){let o=e.groupAttr;if(e.groupAttrMode==="tag-active"){let s=r.querySelector("[data-legend-active]")?.getAttribute("data-legend-active");if(s)o=`data-tag-${s}`;else{let l=new Set;if(r.querySelectorAll(e.markSelector).forEach(c=>{for(let d of Array.from(c.attributes))d.name.startsWith("data-tag-")&&l.add(d.name)}),l.size!==1)return{};o=[...l][0]}}if(!o)return{};let a=o,i=new Set;return r.querySelectorAll(`${e.markSelector}[${a}]`).forEach(s=>{let l=s.getAttribute(a);l!=null&&i.add(l)}),{values:[...i],groupAttr:a}}if(e.strategy==="connection"&&e.hoverSelector&&e.hoverAttr){let o=new Set;return r.querySelectorAll(`${e.hoverSelector}[${e.hoverAttr}]`).forEach(a=>{let i=a.getAttribute(e.hoverAttr);i!=null&&o.add(i)}),{ids:[...o]}}return{}}function lN(t,e,n){if(!n?.bakeHover||!t||!e)return t;let r=ydt[e];if(!r)return t;let o=bdt(t,r),a=o.groupAttr?{...r,groupAttr:o.groupAttr}:r,i=hdt(a,o,n.emphasis);if(!i)return t;let s=t.match(/<svg\b[^>]*>/);if(s?.index==null)return t;let l=s.index+s[0].length;return`${t.slice(0,l)}<style>${i}</style>${t.slice(l)}`}ff();hi();var o4=["document","window","navigator","HTMLElement","SVGElement"],cN=0,Ab=null,Rb=!1;async function xdt(){let{JSDOM:t}=await wdt(),n=new t("<!DOCTYPE html><html><body></body></html>",{url:"http://localhost/"}).window,r={document:n.document,window:n,navigator:n.navigator,HTMLElement:n.HTMLElement,SVGElement:n.SVGElement};for(let o of o4)Object.defineProperty(globalThis,o,{value:r[o],configurable:!0});Rb=!0}async function n4(){typeof document<"u"&&!Rb||(cN++,Ab||(Ab=xdt()),await Ab)}function r4(){if(Rb&&!(--cN>0)){for(let t of o4)delete globalThis[t];Rb=!1,Ab=null,cN=0}}async function wdt(){return import(["js","dom"].join(""))}async function a4(t,e){let n=e?.theme??"light",r=e?.palette??"slate",o=e?.bakeHover??!0,a=Es(r)[n==="dark"?"dark":"light"],i=uf(t),s=i.diagnostics,l=sN(t,i.chartType,a),c=l?.content??t,d=l?.type??i.chartType,u=l?"data-chart":d?Kw(d):null,f=e?.viewState??(e?.legendState?{...e.legendState.activeGroup!==void 0&&{tag:e.legendState.activeGroup},...e.legendState.hiddenAttributes!==void 0&&{ha:e.legendState.hiddenAttributes}}:void 0);if(u==="data-chart"){await n4();try{let m=await nE(c,n,a);return{svg:lN(m,d,{bakeHover:o}),diagnostics:s}}finally{r4()}}await n4();let p;try{p=await t4(c,n,a,f,{...e?.c4Level!==void 0&&{c4Level:e.c4Level},...e?.c4System!==void 0&&{c4System:e.c4System},...e?.c4Container!==void 0&&{c4Container:e.c4Container},...e?.tagGroup!==void 0&&{tagGroup:e.tagGroup},...e?.mapData!==void 0&&{mapData:e.mapData}}),p=lN(p,d,{bakeHover:o})}finally{r4()}if(d==="map")try{let[{parseMap:m},{resolveMap:g},{loadMapData:h}]=await Promise.all([Promise.resolve().then(()=>(bg(),xw)),Promise.resolve().then(()=>(Mv(),Nv)),Promise.resolve().then(()=>(cb(),Vv))]),S=e?.mapData??await h();s=[...g(m(t),S).diagnostics]}catch{}return{svg:p,diagnostics:s}}ff();ff();un();un();Lw();Tg();Ow();iw();lw();qa();var i4=[{code:Bu.ARROW_SUBSTRING_IN_LABEL,severity:"error",chartType:null,title:"Arrow symbol inside label",message:'Arrow symbols (-> or ~>) are not allowed inside a label. Move the label after the arrow: "A -> B: uses -> to chain". See "In-Arrow Message Labels" \u2192 Forbidden.',hint:"Put the label after the arrow with a colon: `A -> B: uses -> to chain`.",example:`class