Zi))l.moveTo(0,0);else if(v>V0-Zi)l.moveTo(m*Nh(g),m*wl(g)),l.arc(0,0,m,g,y,!x),p>Zi&&(l.moveTo(p*Nh(y),p*wl(y)),l.arc(0,0,p,y,g,x));else{var b=g,w=y,C=g,T=y,E=v,A=v,S=s.apply(this,arguments)/2,_=S>Zi&&(n?+n.apply(this,arguments):Dd(p*p+m*m)),I=B5(s9(m-p)/2,+r.apply(this,arguments)),L=I,k=I,D,R;if(_>Zi){var O=o9(_/p*wl(S)),M=o9(_/m*wl(S));(E-=O*2)>Zi?(O*=x?1:-1,C+=O,T-=O):(E=0,C=T=(g+y)/2),(A-=M*2)>Zi?(M*=x?1:-1,b+=M,w-=M):(A=0,b=w=(g+y)/2)}var P=m*Nh(b),B=m*wl(b),F=p*Nh(T),z=p*wl(T);if(I>Zi){var $=m*Nh(w),U=m*wl(w),Q=p*Nh(C),te=p*wl(C),Y;if(v b&&(b=h),E=v*v*w,T=Math.max(b/E,E/x),T>C){v-=h;break}C=T}s.push(u={value:v,dice:m{"use strict";cm();em();o(I6e,"copyObject");Bo=I6e});function O6e(t,e){for(var r=-1,n=Array(t);++r
"},r),Ze.lineBreakRegex.test(t)))return t;let n=t.split(" ").filter(Boolean),i=[],a="";return n.forEach((s,l)=>{let u=ra(`${s} `,r),h=ra(a,r);if(u>e){let{hyphenatedStrings:p,remainingWord:m}=TCe(s,e,"-",r);i.push(a,...p),a=m}else h+u>=e?(i.push(a),a=s):a=[a,s].filter(Boolean).join(" ");l+1===n.length&&i.push(a)}),i.filter(s=>s!=="").join(r.joinWith)},(t,e,r)=>`${t}${e}${r.fontSize}${r.fontWeight}${r.fontFamily}${r.joinWith}`),TCe=Q0((t,e,r="-",n)=>{n=Object.assign({fontSize:12,fontWeight:400,fontFamily:"Arial",margin:0},n);let i=[...t],a=[],s="";return i.forEach((l,u)=>{let h=`${s}${l}`;if(ra(h,n)>=e){let d=u+1,p=i.length===d,m=`${h}${r}`;a.push(p?h:m),s=""}else s=h}),{hyphenatedStrings:a,remainingWord:s}},(t,e,r="-",n)=>`${t}${e}${r}${n.fontSize}${n.fontWeight}${n.fontFamily}`);o(bw,"calculateTextHeight");o(ra,"calculateTextWidth");rD=Q0((t,e)=>{let{fontSize:r=12,fontFamily:n="Arial",fontWeight:i=400}=e;if(!t)return{width:0,height:0};let[,a]=Fo(r),s=["sans-serif",n],l=t.split(Ze.lineBreakRegex),u=[],h=Ge("body");if(!h.remove)return{width:0,height:0,lineHeight:0};let f=h.append("svg");for(let p of s){let m=0,g={width:0,height:0,lineHeight:0};for(let y of l){let v=bCe();v.text=y||j9;let x=wCe(f,v).style("font-size",a).style("font-weight",i).style("font-family",p),b=(x._groups||x)[0][0].getBBox();if(b.width===0&&b.height===0)throw new Error("svg element not in render tree");g.width=Math.round(Math.max(g.width,b.width)),m=Math.round(b.height),g.height+=m,g.lineHeight=Math.round(Math.max(g.lineHeight,m))}u.push(g)}f.remove();let d=isNaN(u[1].height)||isNaN(u[1].width)||isNaN(u[1].lineHeight)||u[0].height>u[1].height&&u[0].width>u[1].width&&u[0].lineHeight>u[1].lineHeight?0:1;return u[d]},(t,e)=>`${t}${e.fontSize}${e.fontWeight}${e.fontFamily}`),X9=class{constructor(e=!1,r){this.count=0;this.count=r?r.length:0,this.next=e?()=>this.count++:()=>Date.now()}static{o(this,"InitIDGenerator")}},kCe=o(function(t){return xw=xw||document.createElement("div"),t=escape(t).replace(/%26/g,"&").replace(/%23/g,"#").replace(/%3B/g,";"),xw.innerHTML=t,unescape(xw.textContent)},"entityDecode");o(nD,"isDetailedError");ECe=o((t,e,r,n)=>{if(!n)return;let i=t.node()?.getBBox();i&&t.append("text").text(n).attr("text-anchor","middle").attr("x",i.x+i.width/2).attr("y",-r).attr("class",e)},"insertTitle"),Fo=o(t=>{if(typeof t=="number")return[t,t+"px"];let e=parseInt(t??"",10);return Number.isNaN(e)?[void 0,void 0]:t===String(e)?[e,t+"px"]:[e,t]},"parseFontSize");o(gi,"cleanAndMerge");Gt={assignWithDepth:Gn,wrapLabel:tD,calculateTextHeight:bw,calculateTextWidth:ra,calculateTextDimensions:rD,cleanAndMerge:gi,detectInit:hCe,detectDirective:FX,isSubstringInArray:fCe,interpolateToCurve:K9,calcLabelPosition:gCe,calcCardinalityPosition:yCe,calcTerminalLabelPosition:vCe,formatUrl:dCe,getStylesFromArray:Z9,generateId:J9,random:eD,runFunc:pCe,entityDecode:kCe,insertTitle:ECe,parseFontSize:Fo,InitIDGenerator:X9},GX=o(function(t){let e=t;return e=e.replace(/style.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/classDef.*:\S*#.*;/g,function(r){return r.substring(0,r.length-1)}),e=e.replace(/#\w+;/g,function(r){let n=r.substring(1,r.length-1);return/^\+?\d+$/.test(n)?"\uFB02\xB0\xB0"+n+"\xB6\xDF":"\uFB02\xB0"+n+"\xB6\xDF"}),e},"encodeEntities"),na=o(function(t){return t.replace(/fl°°/g,"").replace(/fl°/g,"&").replace(/¶ß/g,";")},"decodeEntities"),Uh=o((t,e,{counter:r=0,prefix:n,suffix:i},a)=>a||`${n?`${n}_`:""}${t}_${e}_${r}${i?`_${i}`:""}`,"getEdgeId");o($n,"handleUndefinedAttr")});function _l(t,e,r,n,i){if(!e[t].width)if(r)e[t].text=tD(e[t].text,i,n),e[t].textLines=e[t].text.split(Ze.lineBreakRegex).length,e[t].width=i,e[t].height=bw(e[t].text,n);else{let a=e[t].text.split(Ze.lineBreakRegex);e[t].textLines=a.length;let s=0;e[t].height=0,e[t].width=0;for(let l of a)e[t].width=Math.max(ra(l,n),e[t].width),s=bw(l,n),e[t].height=e[t].height+s}}function qX(t,e,r,n,i){let a=new Ew(i);a.data.widthLimit=r.data.widthLimit/Math.min(iD,n.length);for(let[s,l]of n.entries()){let u=0;l.image={width:0,height:0,Y:0},l.sprite&&(l.image.width=48,l.image.height=48,l.image.Y=u,u=l.image.Y+l.image.height);let h=l.wrap&&Vt.wrap,f=ww(Vt);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",_l("label",l,h,f,a.data.widthLimit),l.label.Y=u+8,u=l.label.Y+l.label.height,l.type&&l.type.text!==""){l.type.text="["+l.type.text+"]";let g=ww(Vt);_l("type",l,h,g,a.data.widthLimit),l.type.Y=u+5,u=l.type.Y+l.type.height}if(l.descr&&l.descr.text!==""){let g=ww(Vt);g.fontSize=g.fontSize-2,_l("descr",l,h,g,a.data.widthLimit),l.descr.Y=u+20,u=l.descr.Y+l.descr.height}if(s==0||s%iD===0){let g=r.data.startx+Vt.diagramMarginX,y=r.data.stopy+Vt.diagramMarginY+u;a.setData(g,g,y,y)}else{let g=a.data.stopx!==a.data.startx?a.data.stopx+Vt.diagramMarginX:a.data.startx,y=a.data.starty;a.setData(g,g,y,y)}a.name=l.alias;let d=i.db.getC4ShapeArray(l.alias),p=i.db.getC4ShapeKeys(l.alias);p.length>0&&WX(a,t,d,p),e=l.alias;let m=i.db.getBoundaries(e);m.length>0&&qX(t,e,a,m,i),l.alias!=="global"&&HX(t,l,a),r.data.stopy=Math.max(a.data.stopy+Vt.c4ShapeMargin,r.data.stopy),r.data.stopx=Math.max(a.data.stopx+Vt.c4ShapeMargin,r.data.stopx),Tw=Math.max(Tw,r.data.stopx),kw=Math.max(kw,r.data.stopy)}}var Tw,kw,UX,iD,Vt,Ew,aD,f2,ww,SCe,HX,WX,Ls,VX,CCe,ACe,_Ce,sD,YX=N(()=>{"use strict";pr();Vq();vt();WC();dr();mA();zt();d0();nr();Si();Tw=0,kw=0,UX=4,iD=2;Ly.yy=iv;Vt={},Ew=class{static{o(this,"Bounds")}constructor(e){this.name="",this.data={},this.data.startx=void 0,this.data.stopx=void 0,this.data.starty=void 0,this.data.stopy=void 0,this.data.widthLimit=void 0,this.nextData={},this.nextData.startx=void 0,this.nextData.stopx=void 0,this.nextData.starty=void 0,this.nextData.stopy=void 0,this.nextData.cnt=0,aD(e.db.getConfig())}setData(e,r,n,i){this.nextData.startx=this.data.startx=e,this.nextData.stopx=this.data.stopx=r,this.nextData.starty=this.data.starty=n,this.nextData.stopy=this.data.stopy=i}updateVal(e,r,n,i){e[r]===void 0?e[r]=n:e[r]=i(n,e[r])}insert(e){this.nextData.cnt=this.nextData.cnt+1;let r=this.nextData.startx===this.nextData.stopx?this.nextData.stopx+e.margin:this.nextData.stopx+e.margin*2,n=r+e.width,i=this.nextData.starty+e.margin*2,a=i+e.height;(r>=this.data.widthLimit||n>=this.data.widthLimit||this.nextData.cnt>UX)&&(r=this.nextData.startx+e.margin+Vt.nextLinePaddingX,i=this.nextData.stopy+e.margin*2,this.nextData.stopx=n=r+e.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=a=i+e.height,this.nextData.cnt=1),e.x=r,e.y=i,this.updateVal(this.data,"startx",r,Math.min),this.updateVal(this.data,"starty",i,Math.min),this.updateVal(this.data,"stopx",n,Math.max),this.updateVal(this.data,"stopy",a,Math.max),this.updateVal(this.nextData,"startx",r,Math.min),this.updateVal(this.nextData,"starty",i,Math.min),this.updateVal(this.nextData,"stopx",n,Math.max),this.updateVal(this.nextData,"stopy",a,Math.max)}init(e){this.name="",this.data={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,widthLimit:void 0},this.nextData={startx:void 0,stopx:void 0,starty:void 0,stopy:void 0,cnt:0},aD(e.db.getConfig())}bumpLastMargin(e){this.data.stopx+=e,this.data.stopy+=e}},aD=o(function(t){Gn(Vt,t),t.fontFamily&&(Vt.personFontFamily=Vt.systemFontFamily=Vt.messageFontFamily=t.fontFamily),t.fontSize&&(Vt.personFontSize=Vt.systemFontSize=Vt.messageFontSize=t.fontSize),t.fontWeight&&(Vt.personFontWeight=Vt.systemFontWeight=Vt.messageFontWeight=t.fontWeight)},"setConf"),f2=o((t,e)=>({fontFamily:t[e+"FontFamily"],fontSize:t[e+"FontSize"],fontWeight:t[e+"FontWeight"]}),"c4ShapeFont"),ww=o(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),SCe=o(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");o(_l,"calcC4ShapeTextWH");HX=o(function(t,e,r){e.x=r.data.startx,e.y=r.data.starty,e.width=r.data.stopx-r.data.startx,e.height=r.data.stopy-r.data.starty,e.label.y=Vt.c4ShapeMargin-35;let n=e.wrap&&Vt.wrap,i=ww(Vt);i.fontSize=i.fontSize+2,i.fontWeight="bold";let a=ra(e.label.text,i);_l("label",e,n,i,a),Sl.drawBoundary(t,e,Vt)},"drawBoundary"),WX=o(function(t,e,r,n){let i=0;for(let a of n){i=0;let s=r[a],l=f2(Vt,s.typeC4Shape.text);switch(l.fontSize=l.fontSize-2,s.typeC4Shape.width=ra("\xAB"+s.typeC4Shape.text+"\xBB",l),s.typeC4Shape.height=l.fontSize+2,s.typeC4Shape.Y=Vt.c4ShapePadding,i=s.typeC4Shape.Y+s.typeC4Shape.height-4,s.image={width:0,height:0,Y:0},s.typeC4Shape.text){case"person":case"external_person":s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height;break}s.sprite&&(s.image.width=48,s.image.height=48,s.image.Y=i,i=s.image.Y+s.image.height);let u=s.wrap&&Vt.wrap,h=Vt.width-Vt.c4ShapePadding*2,f=f2(Vt,s.typeC4Shape.text);if(f.fontSize=f.fontSize+2,f.fontWeight="bold",_l("label",s,u,f,h),s.label.Y=i+8,i=s.label.Y+s.label.height,s.type&&s.type.text!==""){s.type.text="["+s.type.text+"]";let m=f2(Vt,s.typeC4Shape.text);_l("type",s,u,m,h),s.type.Y=i+5,i=s.type.Y+s.type.height}else if(s.techn&&s.techn.text!==""){s.techn.text="["+s.techn.text+"]";let m=f2(Vt,s.techn.text);_l("techn",s,u,m,h),s.techn.Y=i+5,i=s.techn.Y+s.techn.height}let d=i,p=s.label.width;if(s.descr&&s.descr.text!==""){let m=f2(Vt,s.typeC4Shape.text);_l("descr",s,u,m,h),s.descr.Y=i+20,i=s.descr.Y+s.descr.height,p=Math.max(s.label.width,s.descr.width),d=i-s.descr.textLines*5}p=p+Vt.c4ShapePadding,s.width=Math.max(s.width||Vt.width,p,Vt.width),s.height=Math.max(s.height||Vt.height,d,Vt.height),s.margin=s.margin||Vt.c4ShapeMargin,t.insert(s),Sl.drawC4Shape(e,s,Vt)}t.bumpLastMargin(Vt.c4ShapeMargin)},"drawC4ShapeArray"),Ls=class{static{o(this,"Point")}constructor(e,r){this.x=e,this.y=r}},VX=o(function(t,e){let r=t.x,n=t.y,i=e.x,a=e.y,s=r+t.width/2,l=n+t.height/2,u=Math.abs(r-i),h=Math.abs(n-a),f=h/u,d=t.height/t.width,p=null;return n==a&&ri?p=new Ls(r,l):r==i&&na&&(p=new Ls(s,n)),r>i&&n=f?p=new Ls(r,l+f*t.width/2):p=new Ls(s-u/h*t.height/2,n+t.height):r=f?p=new Ls(r+t.width,l+f*t.width/2):p=new Ls(s+u/h*t.height/2,n+t.height):ra?d>=f?p=new Ls(r+t.width,l-f*t.width/2):p=new Ls(s+t.height/2*u/h,n):r>i&&n>a&&(d>=f?p=new Ls(r,l-t.width/2*f):p=new Ls(s-t.height/2*u/h,n)),p},"getIntersectPoint"),CCe=o(function(t,e){let r={x:0,y:0};r.x=e.x+e.width/2,r.y=e.y+e.height/2;let n=VX(t,r);r.x=t.x+t.width/2,r.y=t.y+t.height/2;let i=VX(e,r);return{startPoint:n,endPoint:i}},"getIntersectPoints"),ACe=o(function(t,e,r,n){let i=0;for(let a of e){i=i+1;let s=a.wrap&&Vt.wrap,l=SCe(Vt);n.db.getC4Type()==="C4Dynamic"&&(a.label.text=i+": "+a.label.text);let h=ra(a.label.text,l);_l("label",a,s,l,h),a.techn&&a.techn.text!==""&&(h=ra(a.techn.text,l),_l("techn",a,s,l,h)),a.descr&&a.descr.text!==""&&(h=ra(a.descr.text,l),_l("descr",a,s,l,h));let f=r(a.from),d=r(a.to),p=CCe(f,d);a.startPoint=p.startPoint,a.endPoint=p.endPoint}Sl.drawRels(t,e,Vt)},"drawRels");o(qX,"drawInsideBoundary");_Ce=o(function(t,e,r,n){Vt=me().c4;let i=me().securityLevel,a;i==="sandbox"&&(a=Ge("#i"+e));let s=i==="sandbox"?Ge(a.nodes()[0].contentDocument.body):Ge("body"),l=n.db;n.db.setWrap(Vt.wrap),UX=l.getC4ShapeInRow(),iD=l.getC4BoundaryInRow(),X.debug(`C:${JSON.stringify(Vt,null,2)}`);let u=i==="sandbox"?s.select(`[id="${e}"]`):Ge(`[id="${e}"]`);Sl.insertComputerIcon(u),Sl.insertDatabaseIcon(u),Sl.insertClockIcon(u);let h=new Ew(n);h.setData(Vt.diagramMarginX,Vt.diagramMarginX,Vt.diagramMarginY,Vt.diagramMarginY),h.data.widthLimit=screen.availWidth,Tw=Vt.diagramMarginX,kw=Vt.diagramMarginY;let f=n.db.getTitle(),d=n.db.getBoundaries("");qX(u,"",h,d,n),Sl.insertArrowHead(u),Sl.insertArrowEnd(u),Sl.insertArrowCrossHead(u),Sl.insertArrowFilledHead(u),ACe(u,n.db.getRels(),n.db.getC4Shape,n),h.data.stopx=Tw,h.data.stopy=kw;let p=h.data,g=p.stopy-p.starty+2*Vt.diagramMarginY,v=p.stopx-p.startx+2*Vt.diagramMarginX;f&&u.append("text").text(f).attr("x",(p.stopx-p.startx)/2-4*Vt.diagramMarginX).attr("y",p.starty+Vt.diagramMarginY),vn(u,g,v,Vt.useMaxWidth);let x=f?60:0;u.attr("viewBox",p.startx-Vt.diagramMarginX+" -"+(Vt.diagramMarginY+x)+" "+v+" "+(g+x)),X.debug("models:",p)},"draw"),sD={drawPersonOrSystemArray:WX,drawBoundary:HX,setConf:aD,draw:_Ce}});var DCe,XX,jX=N(()=>{"use strict";DCe=o(t=>`.person {
+`},"getStyles"),CV=o((t,e)=>{e!==void 0&&(H3[t]=e)},"addStylesForDiagram"),AV=E5e});var ov={};ur(ov,{clear:()=>kr,getAccDescription:()=>Rr,getAccTitle:()=>Dr,getDiagramTitle:()=>Nr,setAccDescription:()=>Lr,setAccTitle:()=>Ar,setDiagramTitle:()=>Or});var kA,EA,SA,CA,kr,Ar,Dr,Lr,Rr,Or,Nr,ci=N(()=>{"use strict";pr();mi();kA="",EA="",SA="",CA=o(t=>wr(t,tr()),"sanitizeText"),kr=o(()=>{kA="",SA="",EA=""},"clear"),Ar=o(t=>{kA=CA(t).replace(/^\s+/g,"")},"setAccTitle"),Dr=o(()=>kA,"getAccTitle"),Lr=o(t=>{SA=CA(t).replace(/\n\s+/g,`
+`)},"setAccDescription"),Rr=o(()=>SA,"getAccDescription"),Or=o(t=>{EA=CA(t)},"setDiagramTitle"),Nr=o(()=>EA,"getDiagramTitle")});var _V,S5e,me,lv,q3,pd,_A,C5e,W3,md,cv,AA,Gt=N(()=>{"use strict";nd();gt();mi();pr();xi();wA();ci();_V=X,S5e=Oy,me=tr,lv=f3,q3=mh,pd=o(t=>wr(t,me()),"sanitizeText"),_A=Lo,C5e=o(()=>ov,"getCommonDb"),W3={},md=o((t,e,r)=>{W3[t]&&_V.warn(`Diagram with id ${t} already registered. Overwriting.`),W3[t]=e,r&&s7(t,r),CV(t,e.styles),e.injectUtils?.(_V,S5e,me,pd,_A,C5e(),()=>{})},"registerDiagram"),cv=o(t=>{if(t in W3)return W3[t];throw new AA(t)},"getDiagram"),AA=class extends Error{static{o(this,"DiagramNotFoundError")}constructor(e){super(`Diagram ${e} not found.`)}}});var ml,kh,is,pl,lc,uv,DA,LA,Y3,X3,DV,A5e,_5e,D5e,L5e,R5e,N5e,M5e,I5e,O5e,P5e,B5e,F5e,$5e,z5e,G5e,V5e,U5e,LV,H5e,W5e,RV,q5e,Y5e,X5e,j5e,Eh,K5e,Q5e,Z5e,J5e,eTe,hv,RA=N(()=>{"use strict";Gt();pr();ci();ml=[],kh=[""],is="global",pl="",lc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],uv=[],DA="",LA=!1,Y3=4,X3=2,A5e=o(function(){return DV},"getC4Type"),_5e=o(function(t){DV=wr(t,me())},"setC4Type"),D5e=o(function(t,e,r,n,i,a,s,l,u){if(t==null||e===void 0||e===null||r===void 0||r===null||n===void 0||n===null)return;let h={},f=uv.find(d=>d.from===e&&d.to===r);if(f?h=f:uv.push(h),h.type=t,h.from=e,h.to=r,h.label={text:n},i==null)h.techn={text:""};else if(typeof i=="object"){let[d,p]=Object.entries(i)[0];h[d]={text:p}}else h.techn={text:i};if(a==null)h.descr={text:""};else if(typeof a=="object"){let[d,p]=Object.entries(a)[0];h[d]={text:p}}else h.descr={text:a};if(typeof s=="object"){let[d,p]=Object.entries(s)[0];h[d]=p}else h.sprite=s;if(typeof l=="object"){let[d,p]=Object.entries(l)[0];h[d]=p}else h.tags=l;if(typeof u=="object"){let[d,p]=Object.entries(u)[0];h[d]=p}else h.link=u;h.wrap=Eh()},"addRel"),L5e=o(function(t,e,r,n,i,a,s){if(e===null||r===null)return;let l={},u=ml.find(h=>h.alias===e);if(u&&e===u.alias?l=u:(l.alias=e,ml.push(l)),r==null?l.label={text:""}:l.label={text:r},n==null)l.descr={text:""};else if(typeof n=="object"){let[h,f]=Object.entries(n)[0];l[h]={text:f}}else l.descr={text:n};if(typeof i=="object"){let[h,f]=Object.entries(i)[0];l[h]=f}else l.sprite=i;if(typeof a=="object"){let[h,f]=Object.entries(a)[0];l[h]=f}else l.tags=a;if(typeof s=="object"){let[h,f]=Object.entries(s)[0];l[h]=f}else l.link=s;l.typeC4Shape={text:t},l.parentBoundary=is,l.wrap=Eh()},"addPersonOrSystem"),R5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ml.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ml.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=Eh(),u.typeC4Shape={text:t},u.parentBoundary=is},"addContainer"),N5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=ml.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,ml.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.techn={text:""};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.techn={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof a=="object"){let[f,d]=Object.entries(a)[0];u[f]=d}else u.sprite=a;if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.wrap=Eh(),u.typeC4Shape={text:t},u.parentBoundary=is},"addComponent"),M5e=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=lc.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,lc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"system"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=is,a.wrap=Eh(),pl=is,is=t,kh.push(pl)},"addPersonOrSystemBoundary"),I5e=o(function(t,e,r,n,i){if(t===null||e===null)return;let a={},s=lc.find(l=>l.alias===t);if(s&&t===s.alias?a=s:(a.alias=t,lc.push(a)),e==null?a.label={text:""}:a.label={text:e},r==null)a.type={text:"container"};else if(typeof r=="object"){let[l,u]=Object.entries(r)[0];a[l]={text:u}}else a.type={text:r};if(typeof n=="object"){let[l,u]=Object.entries(n)[0];a[l]=u}else a.tags=n;if(typeof i=="object"){let[l,u]=Object.entries(i)[0];a[l]=u}else a.link=i;a.parentBoundary=is,a.wrap=Eh(),pl=is,is=t,kh.push(pl)},"addContainerBoundary"),O5e=o(function(t,e,r,n,i,a,s,l){if(e===null||r===null)return;let u={},h=lc.find(f=>f.alias===e);if(h&&e===h.alias?u=h:(u.alias=e,lc.push(u)),r==null?u.label={text:""}:u.label={text:r},n==null)u.type={text:"node"};else if(typeof n=="object"){let[f,d]=Object.entries(n)[0];u[f]={text:d}}else u.type={text:n};if(i==null)u.descr={text:""};else if(typeof i=="object"){let[f,d]=Object.entries(i)[0];u[f]={text:d}}else u.descr={text:i};if(typeof s=="object"){let[f,d]=Object.entries(s)[0];u[f]=d}else u.tags=s;if(typeof l=="object"){let[f,d]=Object.entries(l)[0];u[f]=d}else u.link=l;u.nodeType=t,u.parentBoundary=is,u.wrap=Eh(),pl=is,is=e,kh.push(pl)},"addDeploymentNode"),P5e=o(function(){is=pl,kh.pop(),pl=kh.pop(),kh.push(pl)},"popBoundaryParseStack"),B5e=o(function(t,e,r,n,i,a,s,l,u,h,f){let d=ml.find(p=>p.alias===e);if(!(d===void 0&&(d=lc.find(p=>p.alias===e),d===void 0))){if(r!=null)if(typeof r=="object"){let[p,m]=Object.entries(r)[0];d[p]=m}else d.bgColor=r;if(n!=null)if(typeof n=="object"){let[p,m]=Object.entries(n)[0];d[p]=m}else d.fontColor=n;if(i!=null)if(typeof i=="object"){let[p,m]=Object.entries(i)[0];d[p]=m}else d.borderColor=i;if(a!=null)if(typeof a=="object"){let[p,m]=Object.entries(a)[0];d[p]=m}else d.shadowing=a;if(s!=null)if(typeof s=="object"){let[p,m]=Object.entries(s)[0];d[p]=m}else d.shape=s;if(l!=null)if(typeof l=="object"){let[p,m]=Object.entries(l)[0];d[p]=m}else d.sprite=l;if(u!=null)if(typeof u=="object"){let[p,m]=Object.entries(u)[0];d[p]=m}else d.techn=u;if(h!=null)if(typeof h=="object"){let[p,m]=Object.entries(h)[0];d[p]=m}else d.legendText=h;if(f!=null)if(typeof f=="object"){let[p,m]=Object.entries(f)[0];d[p]=m}else d.legendSprite=f}},"updateElStyle"),F5e=o(function(t,e,r,n,i,a,s){let l=uv.find(u=>u.from===e&&u.to===r);if(l!==void 0){if(n!=null)if(typeof n=="object"){let[u,h]=Object.entries(n)[0];l[u]=h}else l.textColor=n;if(i!=null)if(typeof i=="object"){let[u,h]=Object.entries(i)[0];l[u]=h}else l.lineColor=i;if(a!=null)if(typeof a=="object"){let[u,h]=Object.entries(a)[0];l[u]=parseInt(h)}else l.offsetX=parseInt(a);if(s!=null)if(typeof s=="object"){let[u,h]=Object.entries(s)[0];l[u]=parseInt(h)}else l.offsetY=parseInt(s)}},"updateRelStyle"),$5e=o(function(t,e,r){let n=Y3,i=X3;if(typeof e=="object"){let a=Object.values(e)[0];n=parseInt(a)}else n=parseInt(e);if(typeof r=="object"){let a=Object.values(r)[0];i=parseInt(a)}else i=parseInt(r);n>=1&&(Y3=n),i>=1&&(X3=i)},"updateLayoutConfig"),z5e=o(function(){return Y3},"getC4ShapeInRow"),G5e=o(function(){return X3},"getC4BoundaryInRow"),V5e=o(function(){return is},"getCurrentBoundaryParse"),U5e=o(function(){return pl},"getParentBoundaryParse"),LV=o(function(t){return t==null?ml:ml.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),H5e=o(function(t){return ml.find(e=>e.alias===t)},"getC4Shape"),W5e=o(function(t){return Object.keys(LV(t))},"getC4ShapeKeys"),RV=o(function(t){return t==null?lc:lc.filter(e=>e.parentBoundary===t)},"getBoundaries"),q5e=RV,Y5e=o(function(){return uv},"getRels"),X5e=o(function(){return DA},"getTitle"),j5e=o(function(t){LA=t},"setWrap"),Eh=o(function(){return LA},"autoWrap"),K5e=o(function(){ml=[],lc=[{alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}],pl="",is="global",kh=[""],uv=[],kh=[""],DA="",LA=!1,Y3=4,X3=2},"clear"),Q5e={SOLID:0,DOTTED:1,NOTE:2,SOLID_CROSS:3,DOTTED_CROSS:4,SOLID_OPEN:5,DOTTED_OPEN:6,LOOP_START:10,LOOP_END:11,ALT_START:12,ALT_ELSE:13,ALT_END:14,OPT_START:15,OPT_END:16,ACTIVE_START:17,ACTIVE_END:18,PAR_START:19,PAR_AND:20,PAR_END:21,RECT_START:22,RECT_END:23,SOLID_POINT:24,DOTTED_POINT:25},Z5e={FILLED:0,OPEN:1},J5e={LEFTOF:0,RIGHTOF:1,OVER:2},eTe=o(function(t){DA=wr(t,me())},"setTitle"),hv={addPersonOrSystem:L5e,addPersonOrSystemBoundary:M5e,addContainer:R5e,addContainerBoundary:I5e,addComponent:N5e,addDeploymentNode:O5e,popBoundaryParseStack:P5e,addRel:D5e,updateElStyle:B5e,updateRelStyle:F5e,updateLayoutConfig:$5e,autoWrap:Eh,setWrap:j5e,getC4ShapeArray:LV,getC4Shape:H5e,getC4ShapeKeys:W5e,getBoundaries:RV,getBoundarys:q5e,getCurrentBoundaryParse:V5e,getParentBoundaryParse:U5e,getRels:Y5e,getTitle:X5e,getC4Type:A5e,getC4ShapeInRow:z5e,getC4BoundaryInRow:G5e,setAccTitle:Ar,getAccTitle:Dr,getAccDescription:Rr,setAccDescription:Lr,getConfig:o(()=>me().c4,"getConfig"),clear:K5e,LINETYPE:Q5e,ARROWTYPE:Z5e,PLACEMENT:J5e,setTitle:eTe,setC4Type:_5e}});function gd(t,e){return t==null||e==null?NaN:t0)for(var r=new Array(i),n=0,i,a;n{"use strict";KV()});var n5,HA,WA=N(()=>{"use strict";n5="http://www.w3.org/1999/xhtml",HA={svg:"http://www.w3.org/2000/svg",xhtml:n5,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"}});function cc(t){var e=t+="",r=e.indexOf(":");return r>=0&&(e=t.slice(0,r))!=="xmlns"&&(t=t.slice(r+1)),HA.hasOwnProperty(e)?{space:HA[e],local:t}:t}var i5=N(()=>{"use strict";WA();o(cc,"default")});function vTe(t){return function(){var e=this.ownerDocument,r=this.namespaceURI;return r===n5&&e.documentElement.namespaceURI===n5?e.createElement(t):e.createElementNS(r,t)}}function xTe(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function dv(t){var e=cc(t);return(e.local?xTe:vTe)(e)}var qA=N(()=>{"use strict";i5();WA();o(vTe,"creatorInherit");o(xTe,"creatorFixed");o(dv,"default")});function bTe(){}function Ch(t){return t==null?bTe:function(){return this.querySelector(t)}}var a5=N(()=>{"use strict";o(bTe,"none");o(Ch,"default")});function YA(t){typeof t!="function"&&(t=Ch(t));for(var e=this._groups,r=e.length,n=new Array(r),i=0;i{"use strict";gl();o(o8,"default")});function l8(){for(var t=this._groups,e=-1,r=t.length;++e0;){if(h=fv(s,l,r),h===u)return n[i]=s,n[a]=l,e(n);if(h>0)s=Math.floor(s/h)*h,l=Math.ceil(l/h)*h;else if(h<0)s=Math.ceil(s*h)/h,l=Math.floor(l*h)/h;else break;u=h}return t},t}function Tl(){var t=Fv();return t.copy=function(){return B5(t,Tl())},Nh.apply(t,arguments),Pke(t)}var pq=N(()=>{"use strict";Sh();g9();Bv();dq();o(Pke,"linearish");o(Tl,"linear")});function v9(t,e){t=t.slice();var r=0,n=t.length-1,i=t[r],a=t[n],s;return a{"use strict";o(v9,"nice")});function xn(t,e,r,n){function i(a){return t(a=arguments.length===0?new Date:new Date(+a)),a}return o(i,"interval"),i.floor=a=>(t(a=new Date(+a)),a),i.ceil=a=>(t(a=new Date(a-1)),e(a,1),t(a),a),i.round=a=>{let s=i(a),l=i.ceil(a);return a-s0))return u;let h;do u.push(h=new Date(+a)),e(a,l),t(a);while(hxn(s=>{if(s>=s)for(;t(s),!a(s);)s.setTime(s-1)},(s,l)=>{if(s>=s)if(l<0)for(;++l<=0;)for(;e(s,-1),!a(s););else for(;--l>=0;)for(;e(s,1),!a(s););}),r&&(i.count=(a,s)=>(x9.setTime(+a),b9.setTime(+s),t(x9),t(b9),Math.floor(r(x9,b9))),i.every=a=>(a=Math.floor(a),!isFinite(a)||!(a>0)?null:a>1?i.filter(n?s=>n(s)%a===0:s=>i.count(0,s)%a===0):i)),i}var x9,b9,Eu=N(()=>{"use strict";x9=new Date,b9=new Date;o(xn,"timeInterval")});var dc,gq,T9=N(()=>{"use strict";Eu();dc=xn(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);dc.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?xn(e=>{e.setTime(Math.floor(e/t)*t)},(e,r)=>{e.setTime(+e+r*t)},(e,r)=>(r-e)/t):dc);gq=dc.range});var to,yq,w9=N(()=>{"use strict";Eu();to=xn(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*1e3)},(t,e)=>(e-t)/1e3,t=>t.getUTCSeconds()),yq=to.range});var Su,Bke,F5,Fke,k9=N(()=>{"use strict";Eu();Su=xn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getMinutes()),Bke=Su.range,F5=xn(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*6e4)},(t,e)=>(e-t)/6e4,t=>t.getUTCMinutes()),Fke=F5.range});var Cu,$ke,$5,zke,E9=N(()=>{"use strict";Eu();Cu=xn(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*1e3-t.getMinutes()*6e4)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getHours()),$ke=Cu.range,$5=xn(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*36e5)},(t,e)=>(e-t)/36e5,t=>t.getUTCHours()),zke=$5.range});var Ro,Gke,zv,Vke,z5,Uke,S9=N(()=>{"use strict";Eu();Ro=xn(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*6e4)/864e5,t=>t.getDate()-1),Gke=Ro.range,zv=xn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>t.getUTCDate()-1),Vke=zv.range,z5=xn(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/864e5,t=>Math.floor(t/864e5)),Uke=z5.range});function Dd(t){return xn(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,r)=>{e.setDate(e.getDate()+r*7)},(e,r)=>(r-e-(r.getTimezoneOffset()-e.getTimezoneOffset())*6e4)/6048e5)}function Ld(t){return xn(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCDate(e.getUTCDate()+r*7)},(e,r)=>(r-e)/6048e5)}var wl,Mh,G5,V5,mc,U5,H5,xq,Hke,Wke,qke,Yke,Xke,jke,Rd,X0,bq,Tq,Ih,wq,kq,Eq,Kke,Qke,Zke,Jke,eEe,tEe,C9=N(()=>{"use strict";Eu();o(Dd,"timeWeekday");wl=Dd(0),Mh=Dd(1),G5=Dd(2),V5=Dd(3),mc=Dd(4),U5=Dd(5),H5=Dd(6),xq=wl.range,Hke=Mh.range,Wke=G5.range,qke=V5.range,Yke=mc.range,Xke=U5.range,jke=H5.range;o(Ld,"utcWeekday");Rd=Ld(0),X0=Ld(1),bq=Ld(2),Tq=Ld(3),Ih=Ld(4),wq=Ld(5),kq=Ld(6),Eq=Rd.range,Kke=X0.range,Qke=bq.range,Zke=Tq.range,Jke=Ih.range,eEe=wq.range,tEe=kq.range});var Au,rEe,W5,nEe,A9=N(()=>{"use strict";Eu();Au=xn(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth()),rEe=Au.range,W5=xn(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth()),nEe=W5.range});var ro,iEe,kl,aEe,_9=N(()=>{"use strict";Eu();ro=xn(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());ro.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:xn(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,r)=>{e.setFullYear(e.getFullYear()+r*t)});iEe=ro.range,kl=xn(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());kl.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:xn(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,r)=>{e.setUTCFullYear(e.getUTCFullYear()+r*t)});aEe=kl.range});function Cq(t,e,r,n,i,a){let s=[[to,1,1e3],[to,5,5*1e3],[to,15,15*1e3],[to,30,30*1e3],[a,1,6e4],[a,5,5*6e4],[a,15,15*6e4],[a,30,30*6e4],[i,1,36e5],[i,3,3*36e5],[i,6,6*36e5],[i,12,12*36e5],[n,1,864e5],[n,2,2*864e5],[r,1,6048e5],[e,1,2592e6],[e,3,3*2592e6],[t,1,31536e6]];function l(h,f,d){let p=f{"use strict";Sh();T9();w9();k9();E9();S9();C9();A9();_9();o(Cq,"ticker");[oEe,lEe]=Cq(kl,W5,Rd,z5,$5,F5),[D9,L9]=Cq(ro,Au,wl,Ro,Cu,Su)});var q5=N(()=>{"use strict";T9();w9();k9();E9();S9();C9();A9();_9();Aq()});function R9(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function N9(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function Gv(t,e,r){return{y:t,m:e,d:r,H:0,M:0,S:0,L:0}}function M9(t){var e=t.dateTime,r=t.date,n=t.time,i=t.periods,a=t.days,s=t.shortDays,l=t.months,u=t.shortMonths,h=Vv(i),f=Uv(i),d=Vv(a),p=Uv(a),m=Vv(s),g=Uv(s),y=Vv(l),v=Uv(l),x=Vv(u),b=Uv(u),T={a:P,A:B,b:F,B:z,c:null,d:Mq,e:Mq,f:REe,g:GEe,G:UEe,H:_Ee,I:DEe,j:LEe,L:Fq,m:NEe,M:MEe,p:$,q:U,Q:Pq,s:Bq,S:IEe,u:OEe,U:PEe,V:BEe,w:FEe,W:$Ee,x:null,X:null,y:zEe,Y:VEe,Z:HEe,"%":Oq},C={a:K,A:ee,b:Y,B:ce,c:null,d:Iq,e:Iq,f:XEe,g:iSe,G:sSe,H:WEe,I:qEe,j:YEe,L:zq,m:jEe,M:KEe,p:Z,q:ue,Q:Pq,s:Bq,S:QEe,u:ZEe,U:JEe,V:eSe,w:tSe,W:rSe,x:null,X:null,y:nSe,Y:aSe,Z:oSe,"%":Oq},w={a:O,A:R,b:k,B:L,c:A,d:Rq,e:Rq,f:EEe,g:Lq,G:Dq,H:Nq,I:Nq,j:bEe,L:kEe,m:xEe,M:TEe,p:D,q:vEe,Q:CEe,s:AEe,S:wEe,u:dEe,U:pEe,V:mEe,w:fEe,W:gEe,x:I,X:M,y:Lq,Y:Dq,Z:yEe,"%":SEe};T.x=E(r,T),T.X=E(n,T),T.c=E(e,T),C.x=E(r,C),C.X=E(n,C),C.c=E(e,C);function E(Q,j){return function(re){var te=[],he=-1,le=0,J=Q.length,Se,se,ae;for(re instanceof Date||(re=new Date(+re));++he