filecat 6.59.2 → 6.60.0
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/build/dist/{1472.ac066786b1f8f318de62.js → 1472.9d3201dddf293c385633.js} +1 -1
- package/build/dist/1695.8a7beb249e1ad17a47f3.js +1 -0
- package/build/dist/3105.8506dea62edb242a898c.js +1 -0
- package/build/dist/3457.e003dede632769cfe55e.js +1 -0
- package/build/dist/3721.c484f07613f940d94b90.js +1 -0
- package/build/dist/378.a32383dade4a2e55152a.js +1 -0
- package/build/dist/5137.ea60635374bc8146dbe3.js +1 -0
- package/build/dist/5622.01faef0a863f5cad9619.js +1 -0
- package/build/dist/6284.10deb80685728f50aa45.js +1 -0
- package/build/dist/647.42e7ab2f84bd57ba60e4.js +1 -0
- package/build/dist/6636.cc3f66845c61dbf76bd1.js +1 -0
- package/build/dist/6919.f30a30d5d03530a80dde.js +1 -0
- package/build/dist/7277.aa3af95608a9d9d07634.js +1 -0
- package/build/dist/7454.e647fbf309ca068e39e8.js +1 -0
- package/build/dist/7834.7a593dcb80ca09f58586.js +1 -0
- package/build/dist/8840.525f17063dc60979415b.js +1 -0
- package/build/dist/8947.5c2814b7a2c2810f0ce2.js +2 -0
- package/build/dist/{2637.9c1a442f4131e029385d.js → 9214.7750d99fcaff8de186f9.js} +1 -1
- package/build/dist/9421.7eb137bdb14410e9f6f4.js +1 -0
- package/build/dist/9482.a952553a24ad781da8c4.js +1 -0
- package/build/dist/9546.0621e5736f104bc83c15.js +1 -0
- package/build/dist/970.0a2e1e7d00bc1b8a2d6c.js +1 -0
- package/build/dist/9899.2a79d3f40f2bf1ae7829.js +1 -0
- package/build/dist/dark.css +8 -0
- package/build/dist/google-dark.css +8 -0
- package/build/dist/index.html +1 -1
- package/build/dist/main.2dba8f586160288d6981.js +2 -0
- package/build/main.js +1 -1
- package/package.json +1 -1
- package/build/dist/1070.f9959455a7cb92f7cc56.js +0 -1
- package/build/dist/1297.f0c54354f6a56960f66e.js +0 -1
- package/build/dist/1327.4b8e684f28cdee892e00.js +0 -1
- package/build/dist/2824.2990d63b1d3564cf19fb.js +0 -1
- package/build/dist/2857.870fe5dcf2cff743819f.js +0 -1
- package/build/dist/4253.f6c2ea8c7314d4df9c6d.js +0 -1
- package/build/dist/4306.9618c407f36d82608325.js +0 -1
- package/build/dist/4806.1e68bc623f8c369611a3.js +0 -1
- package/build/dist/4830.0042c6dcd47f7dcec003.js +0 -1
- package/build/dist/5315.0a806bc186510d2d0152.js +0 -1
- package/build/dist/5332.00d54e3fd946dafee80e.js +0 -1
- package/build/dist/6459.06eb5a8b0d8c8f7d3bd0.js +0 -1
- package/build/dist/6488.4de7c86754406277783e.js +0 -1
- package/build/dist/6506.ae8f7efceae47503af40.js +0 -1
- package/build/dist/6535.a5c5040e658bc76d0da8.js +0 -1
- package/build/dist/727.45aacafb8172bc2bb662.js +0 -1
- package/build/dist/821.1cd8faa58770da7e977c.js +0 -1
- package/build/dist/8947.7e10e5115cc7edc7fc85.js +0 -2
- package/build/dist/9269.f5e25bc611f9230a1aae.js +0 -1
- package/build/dist/9546.4801bc682362b139f12a.js +0 -1
- package/build/dist/main.73187d8e6ef7f4c10a5b.js +0 -2
- /package/build/dist/{8947.7e10e5115cc7edc7fc85.js.LICENSE.txt → 8947.5c2814b7a2c2810f0ce2.js.LICENSE.txt} +0 -0
- /package/build/dist/{main.73187d8e6ef7f4c10a5b.js.LICENSE.txt → main.2dba8f586160288d6981.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7454],{17454(t,e,n){n.r(e),n.d(e,{render:()=>_n});var o=n(56679),r=(n(24980),n(27838)),s=(n(96865),n(48159),n(44505),n(69793),n(43287),n(12505),n(86535),n(31293)),i=n(86827),a=1e-5,c=1e-6;function f(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}function d(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,f=r*a-s*i;if(0===f)return null;const d=n.x-t.x,l=n.y-t.y,u=(d*a-l*i)/f,h=(d*s-l*r)/f;return u<=c||u>=.999999||h<=c||h>=.999999?null:{point:{x:t.x+u*r,y:t.y+u*s},tA:u,tB:h}}function l(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}function u(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],r=f(o.points);for(let s=n+1;s<t.length;s++){const n=t[s],i=f(n.points);for(const[t,s]of r.entries())for(const[r,a]of i.entries()){const i=d(s.a,s.b,a.a,a.b);if(!i)continue;const c=l(s);!!(c!==l(a))&&c?e.push({jumpEdgeId:o.id,otherEdgeId:n.id,segIndex:t,t:i.tA,point:i.point}):e.push({jumpEdgeId:n.id,otherEdgeId:o.id,segIndex:r,t:i.tB,point:i.point})}}}return e}function h(t){const e=Math.round(1e3*t)/1e3;return Number.isInteger(e),`${e}`}function g(t){return`${h(t.x)},${h(t.y)}`}function p(t){const e=t.b.x-t.a.x,n=t.b.y-t.a.y;return Math.abs(e)>=Math.abs(n)?e>=0?1:0:n>=0?1:0}(0,i.K)(f,"buildSegmentList"),(0,i.K)(d,"segmentIntersection"),(0,i.K)(l,"isHorizontalSeg"),(0,i.K)(u,"findEdgeIntersections"),(0,i.K)(h,"fmt"),(0,i.K)(g,"pointToString"),(0,i.K)(p,"getArcSweepFlag");function x(t,e){if(t.length<2)return t.map(t=>({...t}));const n=t.map(t=>({...t})),o=e.arrowTypeStart&&r.hq[e.arrowTypeStart];if(o){const e=t[0],r=t[1],s=Math.atan2(r.y-e.y,r.x-e.x);n[0].x=e.x+o*Math.cos(s),n[0].y=e.y+o*Math.sin(s)}const s=e.arrowTypeEnd&&r.hq[e.arrowTypeEnd];if(s){const e=t.length,o=t[e-2],r=t[e-1],i=Math.atan2(r.y-o.y,r.x-o.x);n[e-1].x=r.x-s*Math.cos(i),n[e-1].y=r.y-s*Math.sin(i)}return n}function m(t,e,n,o,r){const s=t.point.x,i=t.point.y,a={x:s-e*t.r,y:i-n*t.r},c={x:s+e*t.r,y:i+n*t.r},f=[`L${g(a)}`];return"arc"===r?f.push(`A${h(t.r)},${h(t.r)} 0 0 ${o} ${g(c)}`):f.push(`M${g(c)}`),f}function y(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=n.x-e.x,c=n.y-e.y,f=Math.hypot(r,s),d=Math.hypot(i,c);if(f<a||d<a)return null;const l=r/f,u=s/f,h=i/d,g=c/d,p=l*h+u*g,x=Math.max(-1,Math.min(1,p)),m=Math.acos(x);if(m<a||Math.abs(Math.PI-m)<a)return null;const y=Math.min(o/Math.sin(m/2),f/2,d/2);return{startX:e.x-l*y,startY:e.y-u*y,endX:e.x+h*y,endY:e.y+g*y,ctrlX:e.x,ctrlY:e.y,cutLen:y}}function b(t,e,n){const o=t.points;if(o.length<2)return"";const r=x(o,t),s="rounded"===t.curve,i=f(r),a=new Map;for(const t of e){const e=i[t.segIndex];if(!e)continue;const o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),r=a.get(t.segIndex)??[];r.push({t:t.t,point:t.point,d:t.t*o,r:n.jumpRadius}),a.set(t.segIndex,r)}const c=[`M${g(r[0])}`];for(let t=0;t<i.length;t++){const e=i[t],o=Math.hypot(e.b.x-e.a.x,e.b.y-e.a.y),f=0===o?0:(e.b.x-e.a.x)/o,d=0===o?0:(e.b.y-e.a.y)/o,l=p(e);let u=0;if(s&&t>0){const e=y(r[t-1],r[t],r[t+1]??r[t],5);e&&(u=e.cutLen)}let x=o,b=null;s&&t<i.length-1&&(b=y(r[t],r[t+1],r[t+2]??r[t+1],5),b&&(x=o-b.cutLen));const M=[...a.get(t)??[]].sort((t,e)=>t.t-e.t);for(const t of M)t.r=Math.min(t.r,t.d-u,x-t.d);for(let t=0;t<M.length-1;t++){const e=M[t+1].d-M[t].d;if(M[t].r+M[t+1].r>e){const n=e/2;M[t].r=Math.min(M[t].r,n),M[t+1].r=Math.min(M[t+1].r,n)}}for(const t of M)t.r<.001||c.push(...m(t,f,d,l,n.jumpStyle));s&&b?(c.push(`L${h(b.startX)},${h(b.startY)}`),c.push(`Q${h(b.ctrlX)},${h(b.ctrlY)} ${h(b.endX)},${h(b.endY)}`)):c.push(`L${g(e.b)}`)}return c.join(" ")}function M(t){return/^[\d\s+,.LMelm-]*$/.test(t)}function K(t){return!t||("linear"===t||"rounded"===t||"step"===t||"stepBefore"===t||"stepAfter"===t)}function I(t){if(!t)return null;try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString(),n=JSON.parse(e);if(!Array.isArray(n))return null;const o=[];for(const t of n)t&&"number"==typeof t.x&&"number"==typeof t.y&&o.push({x:t.x,y:t.y});return o.length>=2?o:null}catch{return null}}function S(t,e,n){if(!n.enabled)return;const o=t.node();if(!o)return;const r=new Map;for(const t of e)r.set(t.id,t);const s=[],i=new Map;for(const t of e){const e="undefined"!=typeof CSS&&CSS.escape?CSS.escape(t.id):t.id,n=o.querySelector(`path[data-id="${e}"]`);if(!n)continue;i.set(t.id,n);const r=I(n.getAttribute("data-points"))??t.points;s.push({...t,points:r})}const a=u(s);if(0===a.length)return;const c=new Map;for(const t of a){const e=c.get(t.jumpEdgeId)??[];e.push(t),c.set(t.jumpEdgeId,e)}for(const t of s){const e=c.get(t.id);if(!e||0===e.length)continue;const o=r.get(t.id),s=o?.curve;if(void 0!==s&&!K(s))continue;const a=i.get(t.id);if(!a)continue;if(void 0===s){if(!M(a.getAttribute("d")??""))continue}const f=a.getAttribute("style")??"",d=/stroke-dasharray\s*:\s*0\s+([\d.]+)\s+[\d.]+\s+([\d.]+)/.exec(f),l=d?Number.parseFloat(d[1]):null,u=d?Number.parseFloat(d[2]):null,h=b(t,e,n);if(a.setAttribute("d",h),null!==l&&null!==u&&"function"==typeof a.getTotalLength){const t=a.getTotalLength(),e=`0 ${l} ${Math.max(0,t-l-u)} ${u}`,n=f.replace(/stroke-dasharray\s*:[^;]*;?/g,`stroke-dasharray: ${e};`).replace(/;\s*;+/g,";");a.setAttribute("style",n)}}}function w(t,{measure:e}){const n=t.config?.swimlane?.lineHops;if(!1===n)return;const o="gap"===n?"gap":"arc",r=t.edges.filter(t=>Array.isArray(t.points)&&t.points.length>=2).map(t=>({id:t.id,points:t.points,curve:t.curve,arrowTypeStart:t.arrowTypeStart,arrowTypeEnd:t.arrowTypeEnd}));S(e.groups.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:o})}(0,i.K)(x,"applyMarkerOffsets"),(0,i.K)(m,"emitJump"),(0,i.K)(y,"computeRoundedCorner"),(0,i.K)(b,"rewriteEdgePath"),(0,i.K)(M,"isStraightPath"),(0,i.K)(K,"curveSupportsLineHops"),(0,i.K)(I,"decodeDataPoints"),(0,i.K)(S,"applyLineJumpsToSvg"),(0,i.K)(w,"applySwimlaneLineJumps");var v="__swimlane_default__";function C(t){return Math.max(t.padding??20,20)}function L(t){const{x:e,y:n,width:o,height:r}=t,s=t.swimlaneContentTop;if("number"!=typeof e||"number"!=typeof n||"number"!=typeof o||"number"!=typeof r||"number"!=typeof s||!Number.isFinite(e)||!Number.isFinite(n)||!Number.isFinite(o)||!Number.isFinite(r)||!Number.isFinite(s)||o<=0||r<=0)return void delete t.groupTitleRect;const i=n-r/2,a=Math.min(s,n+r/2),c=i+Math.min(21,Math.max(0,a-i));c<=i?delete t.groupTitleRect:t.groupTitleRect={left:e-o/2,right:e+o/2,top:i,bottom:c}}function k(t){const e=t.direction,n=t.nodes??=[];for(const n of t.nodes??[])n.isGroup&&!n.parentId&&(n.shape="swimlane",e&&(n.direction=e));const o=n.filter(t=>!t.isGroup&&!t.parentId);if(0===o.length)return;let r=n.find(t=>t.id===v);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:v,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(r));for(const t of o)t.parentId=v}function O(t){const e=new Map;for(const n of t.nodes??[])e.set(n.id,n);const n=[];for(const e of t.edges??[]){const t="string"==typeof e.start?e.start:void 0,o="string"==typeof e.end?e.end:void 0;t&&o&&(e.labelNodeId||n.push({id:e.id,src:t,dst:o,ref:e}))}const o=t.nodes??[],r=o.filter(t=>t.isGroup),s=o.filter(t=>!t.isGroup);return{nodes:[...[...r].reverse(),...s].map(t=>t.id),edges:n,layout:t,nodeById:e}}function R(t,e,n,o){const{layout:r}=t,s=t.nodeById,i=o?.layerGap??100,a=o?.nodeGap??40;let c=0;for(const t of e.layers){let e=0;for(const o of t){const t=s.get(o);if(!t){e++;continue}t.layer=c,t.order=e;const r=n.x[o]??e*a,f=n.y[o]??c*i;t.x=r,t.y=f,e++}c++}const f=r.nodes??[],d=new Map,l=[];for(const t of f){if(!t?.isGroup)continue;t.parentId||l.push(t);const e=f.filter(e=>e.parentId===t.id);let o=1/0,r=-1/0,s=1/0,i=-1/0;for(const t of e){const e=t.x??n.x[t.id],a=t.y??n.y[t.id],c=t.width??0,f=t.height??0;null!=e&&null!=a&&(o=Math.min(o,e-c/2),r=Math.max(r,e+c/2),s=Math.min(s,a-f/2),i=Math.max(i,a+f/2))}if(o===1/0||s===1/0)t.x=t.x??0,t.y=t.y??0,t.width=t.width??0,t.height=t.height??0;else{const e=t.padding??20,n=t.parentId?e:2*C(t),a=e,c=Math.max(0,r-o)+n,f=Math.max(0,i-s)+a,l=(o+r)/2,u=(s+i)/2;t.x=l,t.y=u,t.width=c,t.height=f,d.set(t.id,{minX:o,maxX:r,minY:s,maxY:i})}}if(l.length>0&&d.size>0){let t=1/0,e=-1/0,n=0;for(const o of l){const r=o.padding??20;r>n&&(n=r);const s=d.get(o.id);s&&(t=Math.min(t,s.minY),e=Math.max(e,s.maxY))}if(t!==1/0&&e!==-1/0){const o=36,r=Math.max(0,e-t)+2*Math.max(n,o),s=(t+e)/2;for(const e of l)e.y=s,e.height=r,e.swimlaneContentTop=t;const i=[...l].sort((t,e)=>(t.x??0)-(e.x??0)),a=[],c=[],f=[];for(const t of i){const e=d.get(t.id);if(!e)continue;const n=Math.max(0,e.maxX-e.minX)+2*C(t),o=(e.minX+e.maxX)/2;a.push(t.id),c.push(o),f.push(n)}const u=a.length;if(u>0){const t=new Map;if(1===u)t.set(a[0],f[0]);else{const e=[];for(let t=0;t<u-1;t++)e.push(c[t+1]-c[t]);const n=new Array(u);n[0]=0;for(let t=0;t<u-1;t++)n[t+1]=2*e[t]-n[t];let o=0,r=Number.POSITIVE_INFINITY;for(let t=0;t<u;t++){const e=f[t];t%2==0?o=Math.max(o,e-n[t]):r=Math.min(r,n[t]-e)}let s=o;s=o<=r?(o+r)/2:o;for(let e=0;e<u;e++){const o=n[e]+(e%2==0?s:-s),r=Math.max(f[e],o);t.set(a[e],r)}}for(const e of l){const n=t.get(e.id);null!=n&&(e.width=n),L(e)}}}}}(0,i.K)(C,"topLaneHorizontalPadding"),(0,i.K)(L,"assignTopLaneTitleRect"),(0,i.K)(k,"prepareLayoutForSwimlanes"),(0,i.K)(O,"toGraphView"),(0,i.K)(R,"writeBackToLayoutData");function T(t){const e=[],n=[],o=new Map;for(const e of t.nodes)o.set(e.id,e);for(const r of t.edges){if(!r.label||0===r.label.length)continue;if(r.isLayoutOnly)continue;if(r.labelNodeId)continue;const t=r.start?o.get(r.start):void 0,i=r.end?o.get(r.end):void 0;if(!t||!i){s.R.warn("[EdgeLabelNodes]",`Edge ${r.id} has missing source or target node`);continue}const a=`edge-label-${r.start}-${r.end}-${r.id}`,c=t.parentId!==i.parentId?i.parentId:t.parentId,f={id:a,label:r.label,edgeStart:r.start??"",edgeEnd:r.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:c,isGroup:!1,labelStyle:Array.isArray(r.labelStyle)?r.labelStyle[0]:r.labelStyle??"",...t.dir?{dir:t.dir}:{}};e.push(f),r.labelNodeId=a,r.label=void 0,r.text=void 0;const d={id:`${r.id}-to-label`,start:r.start,end:a,type:"normal",isLayoutOnly:!0},l={id:`${r.id}-from-label`,start:a,end:r.end,type:"normal",isLayoutOnly:!0};n.push(d,l)}const r=[...t.nodes,...e],i=[...t.edges,...n];return{...t,nodes:r,edges:i}}(0,i.K)(T,"createEdgeLabelNodes");var $=.001;function N(t){const e=t.x??0,n=t.y??0,o=t.width??0,r=t.height??0;return o>0&&r>0?{cx:e,cy:n,rect:Q(e,n,o,r)}:void 0}function B(t){if(t.isGroup)return;const e=N(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function F(t,e,n=$){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function E(t,e,n=$){return Math.abs(t.x-e.x)<n}function Y(t,e,n=$){return Math.abs(t.y-e.y)<n}function X(t,e,n=$){return Y(t,e,n)&&Math.abs(t.x-e.x)>n}function z(t,e,n=$){return E(t,e,n)&&Math.abs(t.y-e.y)>n}function A(t,e,n,o){return Math.max(0,Math.min(Math.max(t,e),Math.max(n,o))-Math.max(Math.min(t,e),Math.min(n,o)))}function P(t,e,n=$){return t.horizontal&&e.horizontal&&Y(t.a,e.a,n)?A(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&E(t.a,e.a,n)?A(t.a.y,t.b.y,e.a.y,e.b.y):0}function D(t,e=$){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],i=X(r,s,e),a=z(r,s,e);(i||a)&&n.push({index:o,a:r,b:s,horizontal:i,vertical:a})}return n}function G(t,e=$){const n=D(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function H(t,e=$){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&F(t,o,e)||n.push({x:o.x,y:o.y})}return n}function j(t,e=$){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(X(n,o,e)&&z(o,r,e)&&X(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return z(n,o,e)&&X(o,r,e)&&z(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function V(t,e,n,o=0){const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return s>n.left-o&&r<n.right+o&&a>n.top-o&&i<n.bottom+o}function _(t,e,n=0){return t.x>e.left+n&&t.x<e.right-n&&t.y>e.top+n&&t.y<e.bottom-n}function W(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function q(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function J(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function Q(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function U(t){return N(t)?.rect}function Z(t,e){switch(e){case"top":return{x:t.cx,y:t.rect.top};case"bottom":return{x:t.cx,y:t.rect.bottom};case"left":return{x:t.rect.left,y:t.cy};case"right":return{x:t.rect.right,y:t.cy}}}function tt(t,e,n,o,r,s=$){const i="left"===e||"right"===e,a="left"===o||"right"===o;if(i&&a){if("right"===e&&"left"===o&&t.x<n.x||"left"===e&&"right"===o&&t.x>n.x){if(Y(t,n,s))return[t,n];const e=(t.x+n.x)/2;return[t,{x:e,y:t.y},{x:e,y:n.y},n]}if(e===o){if(Y(t,n,s))return;const o="left"===e?Math.min(t.x,n.x)-r:Math.max(t.x,n.x)+r;return[t,{x:o,y:t.y},{x:o,y:n.y},n]}return}if(!i&&!a){if(e===o){if(E(t,n,s))return;const o="top"===e?Math.min(t.y,n.y)-r:Math.max(t.y,n.y)+r;return[t,{x:t.x,y:o},{x:n.x,y:o},n]}if(!("bottom"===e&&"top"===o&&t.y<n.y||"top"===e&&"bottom"===o&&t.y>n.y))return;if(E(t,n,s))return[t,n];const i=(t.y+n.y)/2;return[t,{x:t.x,y:i},{x:n.x,y:i},n]}if(i&&!a){const r="right"===e&&n.x>t.x||"left"===e&&n.x<t.x,s="top"===o&&t.y<n.y||"bottom"===o&&t.y>n.y;return r&&s?[t,{x:n.x,y:t.y},n]:void 0}const c="bottom"===e&&n.y>t.y||"top"===e&&n.y<t.y,f="left"===o&&t.x<n.x||"right"===o&&t.x>n.x;return c&&f?[t,{x:t.x,y:n.y},n]:void 0}function et(t,e,n,o){return"left"===e||"right"===e?[t,{x:o,y:t.y},{x:o,y:n.y},n]:[t,{x:t.x,y:o},{x:n.x,y:o},n]}function nt(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=B(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function ot(t){const e=[],n=[];for(const o of t){const t=B(o);if(!t)continue;const r={id:t.id,rect:t.rect};o.isEdgeLabel?n.push(r):e.push(r)}return{realNodeRects:e,labelNodeRects:n}}function rt(t,{includeEdgeLabels:e=!0}={}){const n=[];for(const o of t){if(o.isGroup||!e&&o.isEdgeLabel)continue;const t=o.x??0,r=o.y??0,s=o.width??0,i=o.height??0;n.push({nodeId:o.id,...Q(t,r,s,i)})}return n}function st(t,e,n=$){const o=t.start,r=t.end;if(!o||!r)return;const s=e.get(o),i=e.get(r);return s&&i?{srcId:o,dstId:r,srcInfo:s,dstInfo:i,collinearX:Math.abs(s.cx-i.cx)<n,collinearY:Math.abs(s.cy-i.cy)<n}:void 0}function it(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&V(t,e,s.rect,-r))return!0;return!1}function at(t,e,n,o,r=$,s=1e-6){const i=Y(t,e,r),a=E(t,e,r),c=Y(n,o,r),f=E(n,o,r);if(i&&c||a&&f)return!1;if(!i&&!a||!c&&!f)return!1;const d=i?{a:t,b:e}:{a:n,b:o},l=a?{a:t,b:e}:{a:n,b:o},u=d.a.y,h=Math.min(d.a.x,d.b.x),g=Math.max(d.a.x,d.b.x),p=l.a.x,x=Math.min(l.a.y,l.b.y),m=Math.max(l.a.y,l.b.y);if(p<h||p>g||u<x||u>m)return!1;const y=Math.abs(p-d.a.x)<s&&Math.abs(u-d.a.y)<s||Math.abs(p-d.b.x)<s&&Math.abs(u-d.b.y)<s,b=Math.abs(p-l.a.x)<s&&Math.abs(u-l.a.y)<s||Math.abs(p-l.b.x)<s&&Math.abs(u-l.b.y)<s;return!(y&&b)}function ct(t,e,n,o,r=$){const s=Y(t,e,r),i=E(t,e,r),a=Y(n,o,r),c=E(n,o,r);return i&&c&&E(t,n,r)?A(t.y,e.y,n.y,o.y)>r:!!(s&&a&&Y(t,n,r))&&A(t.x,e.x,n.x,o.x)>r}function ft(t,e,n,o,{epsilon:r=$,skipDegenerateOther:s=!1}={}){for(const i of n){if(i===o||i.isLayoutOnly)continue;const n=i.points;if(n&&!(n.length<2))for(let o=0;o<n.length-1;o++){const i=n[o],a=n[o+1];if((!s||!F(i,a,r))&&(at(t,e,i,a,r)||ct(t,e,i,a,r)))return!0}}return!1}function dt(t,e,n,o,r=$){const s=Y(t,e,r),i=E(t,e,r),a=Y(n,o,r),c=E(n,o,r);if(!(s&&c||i&&a))return!1;const f=s?{a:t,b:e}:{a:n,b:o},d=s?{a:n,b:o}:{a:t,b:e},l=f.a.y,u=Math.min(f.a.x,f.b.x),h=Math.max(f.a.x,f.b.x),g=d.a.x,p=Math.min(d.a.y,d.b.y),x=Math.max(d.a.y,d.b.y);return g>u+r&&g<h-r&&l>p+r&&l<x-r}function lt(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+$&&t<r-$}function ut(t,e,n){return E(t,e)&&E(e,n)?lt(e.y,t.y,n.y):!(!Y(t,e)||!Y(e,n))&<(e.x,t.x,n.x)}function ht(t){let e=!1;const n=[];for(let o=0;o<t.length;o++){const r=n[n.length-1],s=t[o],i=o+1<t.length?t[o+1]:void 0;if(r&&i){if(F(r,i)){o++,e=!0;continue}if(ut(r,s,i)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function gt(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!E(o,r)&&!Y(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&E(t,o)?{x:o.x,y:r.y}:{x:r.x,y:o.y};e.push(n)}e.push(r)}const n=[];for(const t of e){const e=n[n.length-1];e&&F(e,t)||n.push(t)}return n}function pt(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=ht(e);if(e=t.points,!t.changed)break}return e}(0,i.K)(N,"measuredNodeRect"),(0,i.K)(B,"nodeBoundsInfoFor"),(0,i.K)(F,"samePoint"),(0,i.K)(E,"sameX"),(0,i.K)(Y,"sameY"),(0,i.K)(X,"isHorizontalSegment"),(0,i.K)(z,"isVerticalSegment"),(0,i.K)(A,"overlapLength"),(0,i.K)(P,"sameAxisSegmentOverlapLength"),(0,i.K)(D,"orthogonalSegmentsForPoints"),(0,i.K)(G,"countOrthogonalBends"),(0,i.K)(H,"dedupeConsecutivePoints"),(0,i.K)(j,"classifyThreeSegmentRoute"),(0,i.K)(V,"segmentBoundsOverlapRect"),(0,i.K)(_,"pointInsideRect"),(0,i.K)(W,"rectContainsRect"),(0,i.K)(q,"rectsOverlap"),(0,i.K)(J,"inflateRect"),(0,i.K)(Q,"rectFromCenterSize"),(0,i.K)(U,"rectOfNodeBounds"),(0,i.K)(Z,"portForRectSide"),(0,i.K)(tt,"buildOrthogonalPortPath"),(0,i.K)(et,"buildSameSideTrackPath"),(0,i.K)(nt,"collectRealNodeBounds"),(0,i.K)(ot,"collectNodeRectEntries"),(0,i.K)(rt,"collectLayoutNodeRects"),(0,i.K)(st,"getNodePairGeometry"),(0,i.K)(it,"segmentHitsAnyRect"),(0,i.K)(at,"orthogonalSegmentsCross"),(0,i.K)(ct,"sameAxisSegmentsOverlap"),(0,i.K)(ft,"segmentConflictsWithAnyEdge"),(0,i.K)(dt,"orthogonalSegmentsStrictlyCross"),(0,i.K)(lt,"strictlyBetween"),(0,i.K)(ut,"isCollinearIntermediate"),(0,i.K)(ht,"simplifyPolylineOnce"),(0,i.K)(gt,"orthogonalizePolyline"),(0,i.K)(pt,"simplifyPolyline");var xt=.001;function mt(t,e,n){const o=t;if(o.isLayoutOnly||!o.points||o.points.length<n)return;const r=o.start?e.get(o.start):void 0,s=o.end?e.get(o.end):void 0;return{edge:o,points:o.points,srcRect:r?U(r):void 0,dstRect:s?U(s):void 0}}function yt(t,e,n){if(Y(t,e,xt)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(E(t,e,xt)){const e=t.y<n.top?n.top:n.bottom;return{x:t.x,y:e}}return{x:Math.min(n.right,Math.max(n.left,t.x)),y:Math.min(n.bottom,Math.max(n.top,t.y))}}function bt(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&_(t[r],e,.5);)r+=o;if(r<0||r>=t.length)return t;const s=r-o;if(s<0||s>=t.length)return t;const i=yt(t[r],t[s],e);return n?[i,...t.slice(r)]:[...t.slice(0,r+1),i]}function Mt(t,e){for(const n of t){const t=mt(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=bt(o,t.srcRect,!0)),t.dstRect&&(o=bt(o,t.dstRect,!1)),o=pt(gt(o)),o=Tt(o,t.srcRect,t.dstRect),t.edge.points=pt(gt(o))}}function Kt(t,e,n,o=!1){if(Y(t,e,xt)){if(e.y<n.top-xt||e.y>n.bottom+xt)return e;if(o){if(t.x<n.left-xt)return{x:n.left,y:t.y};if(t.x>n.right+xt)return{x:n.right,y:t.y}}return{x:Math.abs(e.x-n.left)<=Math.abs(e.x-n.right)?n.left:n.right,y:t.y}}if(E(t,e,xt)){if(e.x<n.left-xt||e.x>n.right+xt)return e;if(o){if(t.y<n.top-xt)return{x:t.x,y:n.top};if(t.y>n.bottom+xt)return{x:t.x,y:n.bottom}}const r=Math.abs(e.y-n.top)<=Math.abs(e.y-n.bottom);return{x:t.x,y:r?n.top:n.bottom}}return e}function It(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!F(e,o,xt))return e}return t[e+n]}function St(t,e){const n=t+4,o=e-4;return n<=o?{lo:n,hi:o}:{lo:(t+e)/2,hi:(t+e)/2}}function wt(t,e,n){const{lo:o,hi:r}=St(e,n);return Math.min(r,Math.max(o,t))}function vt(t){const e=Math.max(...t.map(t=>t.lo)),n=Math.min(...t.map(t=>t.hi));if(!(e>n))return{lo:e,hi:n}}function Ct(t,e){return"left"===e||"right"===e?St(t.top,t.bottom):St(t.left,t.right)}function Lt(t,e,n){const o=t.y>=n.top-xt&&t.y<=n.bottom+xt,r=t.x>=n.left-xt&&t.x<=n.right+xt;if(Y(t,e,xt)&&o){if(Math.abs(t.x-n.left)<xt)return"left";if(Math.abs(t.x-n.right)<xt)return"right"}if(E(t,e,xt)&&r){if(Math.abs(t.y-n.top)<xt)return"top";if(Math.abs(t.y-n.bottom)<xt)return"bottom"}}function kt(t){return"left"===t||"right"===t}function Ot(t,e,n,o,r){const s=[],i=n?Lt(t,e,n):void 0,a=o?Lt(e,t,o):void 0;return n&&i&&kt(i)===r&&s.push(Ct(n,i)),o&&a&&kt(a)===r&&s.push(Ct(o,a)),s.length>0?vt(s):void 0}function Rt(t,e,n,o,r){const s=Ot(t,e,n,o,r);if(!s)return;const i=r?t.y:t.x,a=Math.min(s.hi,Math.max(s.lo,i));return Math.abs(a-i)<xt?void 0:r?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}function Tt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return Y(o,r,xt)?Rt(o,r,e,n,!0)??t:E(o,r,xt)?Rt(o,r,e,n,!1)??t:t}function $t(t,e,n){return kt(n)?{x:t.x,y:wt(t.y,e.top,e.bottom)}:{x:wt(t.x,e.left,e.right),y:t.y}}function Nt(t,e,n,o,r,s){const i=t.map(t=>({...t}));for(let a=e;a>=0&&a<t.length;a+=n){const e=t[a];if(s&&!Y(e,o,xt))break;if(!s&&!E(e,o,xt))break;s?i[a].y=r.y:i[a].x=r.x}return i}function Bt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],i=It(t,o,r);if(!i)return t;const a=Lt(s,i,e);if(!a)return t;const c=kt(a),f=$t(s,e,a);return F(s,f,xt)?t:Nt(t,o,r,s,f,c)}function Ft(t,e,n){const o=Math.min(t.x,e.x)>=n.left-xt&&Math.max(t.x,e.x)<=n.right+xt,r=Math.min(t.y,e.y)>=n.top-xt&&Math.max(t.y,e.y)<=n.bottom+xt;return Math.abs(t.y-n.top)<xt&&Math.abs(e.y-n.top)<xt&&o?"top":Math.abs(t.y-n.bottom)<xt&&Math.abs(e.y-n.bottom)<xt&&o?"bottom":Math.abs(t.x-n.left)<xt&&Math.abs(e.x-n.left)<xt&&r?"left":Math.abs(t.x-n.right)<xt&&Math.abs(e.x-n.right)<xt&&r?"right":void 0}function Et(t,e,n,o){switch(t){case"top":return E(e,n,xt)&&n.y<o.top-xt;case"bottom":return E(e,n,xt)&&n.y>o.bottom+xt;case"left":return Y(e,n,xt)&&n.x<o.left-xt;case"right":return Y(e,n,xt)&&n.x>o.right+xt}}function Yt(t,e,n){if(t.length<3)return t;if(n){const n=Ft(t[0],t[1],e);return n&&Et(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=Ft(t[o-1],t[o],e);return r&&Et(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function Xt(t,e,n){let o=t;if(e){const t=It(o,0,1);if(t){const n=Kt(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=Yt(o,e,!0)}if(n){const t=o.length-1,e=It(o,t,-1);if(e){const r=Kt(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=Yt(o,n,!1)}const r=Tt(o,e,n);return r!==o||2===o.length?r:(e&&(o=Bt(o,e,!0)),n&&(o=Bt(o,n,!1)),o)}function zt(t,e){for(const n of t){const t=mt(n,e,2);if(!t)continue;const o=Xt(H(t.points,xt),t.srcRect,t.dstRect);if(o.length<3){t.edge.points=o;continue}const r=[o[0],{...o[0]},...o.slice(1,-1),o[o.length-1],{...o[o.length-1]}];t.edge.points=r}}function At(t){return new Map(t.map(t=>[t.id,t]))}function Pt(t,e){let n=t.parentId,o=null;for(;n;){const t=e.get(n);if(!t?.isGroup)break;o=t.id,n=t.parentId}return o}function Dt(t,e){let n=0,o=t.parentId;for(;o;){const t=e.get(o);if(!t?.isGroup)break;n++,o=t.parentId}return n}function Gt(t){let e=1/0,n=-1/0,o=1/0,r=-1/0;for(const s of t){const t=s.x,i=s.y;if("number"!=typeof t||"number"!=typeof i)continue;const a=s.width??0,c=s.height??0;e=Math.min(e,t-a/2),n=Math.max(n,t+a/2),o=Math.min(o,i-c/2),r=Math.max(r,i+c/2)}return e===1/0||o===1/0?null:{minX:e,maxX:n,minY:o,maxY:r}}function Ht(t,e){const n=t.padding??20;t.x=(e.minX+e.maxX)/2,t.y=(e.minY+e.maxY)/2,t.width=Math.max(0,e.maxX-e.minX)+n,t.height=Math.max(0,e.maxY-e.minY)+n}function jt(t){const e=At(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>Dt(n,e)-Dt(t,e));for(const e of n){const n=Gt(t.filter(t=>t.parentId===e.id));n&&Ht(e,n)}}function Vt(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,a=-1/0;for(const t of r){const n=t[e];"number"==typeof n&&(s=Math.min(s,n),a=Math.max(a,n))}if(!Number.isFinite(s)||!Number.isFinite(a))return!1;const c=(0,i.K)(t=>s+a-t,"mirror");for(const t of n){const n=t[e];"number"==typeof n&&(t[e]=c(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?{...o,left:c(o.right),right:c(o.left)}:{...o,top:c(o.bottom),bottom:c(o.top)})}for(const t of o)for(const n of t.points??[])n[e]=c(n[e]);return!0}function _t(t){return!(t.nodes??[]).some(t=>!t.isGroup)||Vt(t,"y")}function Wt(t,e="LR"){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);let s=1/0,i=1/0;for(const t of r){const e=t.x??0,n=t.y??0;e<s&&(s=e),n<i&&(i=n)}if(!Number.isFinite(s)||!Number.isFinite(i))return!1;const a=36;let c=0,f=0;for(const t of r)c+=t.width??0,f+=t.height??0;const d=c/r.length,l=f/r.length,u=l>0?Math.max(1,d/l):1;for(const t of r){const e=t.x??0,n=((t.y??0)-i)*u+a,o=e-s;t.x=n,t.y=o}for(const t of o)if(t.points)for(const e of t.points){const t=e.x,n=(e.y-i)*u+a,o=t-s;e.x=n,e.y=o}jt(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&Vt(t,"x"),!0;const g=At(n),p=new Map;for(const t of n){if(t.isGroup)continue;const e=Pt(t,g);if(!e)continue;const n=p.get(e)??[];n.push(t),p.set(e,n)}let x=0;for(const t of h){const e=t.padding??0;e>x&&(x=e)}const m=[];let y=1/0,b=-1/0;for(const t of h){const e=Gt(p.get(t.id)??[]);e&&(y=Math.min(y,e.minX),b=Math.max(b,e.maxX),m.push({lane:t,contentTop:e.minY,contentBottom:e.maxY,centerY:(e.minY+e.maxY)/2}))}if(y===1/0||b===-1/0)return!0;const M=Math.max(0,b-y)+2*Math.max(x,10),K=a+M,I=(y+b)/2-M/2-a,S=I+K/2,w=Math.max(x,a);m.sort((t,e)=>t.centerY-e.centerY);for(let t=0;t<m.length;t++){const e=m[t];let n,o;if(0===t)n=e.contentTop-w;else{n=(m[t-1].contentBottom+e.contentTop)/2}if(t===m.length-1)o=e.contentBottom+w;else{const n=m[t+1];o=(e.contentBottom+n.contentTop)/2}const r=Math.max(0,o-n),s=(n+o)/2;e.lane.x=S,e.lane.y=s,e.lane.width=K,e.lane.height=r,e.lane.swimlaneContentTop=e.contentTop,e.lane.groupTitleRect={left:I,right:I+a,top:n,bottom:o}}return"RL"===e&&Vt(t,"x"),!0}(0,i.K)(mt,"endpointContextFor"),(0,i.K)(yt,"segmentEnterPoint"),(0,i.K)(bt,"clipEndpoint"),(0,i.K)(Mt,"clipEdgeEndpointsToNodeBoundaries"),(0,i.K)(Kt,"snapEndpointToBoundary"),(0,i.K)(It,"firstDistinctAdjacent"),(0,i.K)(St,"cornerClearanceRange"),(0,i.K)(wt,"clampToCornerClearance"),(0,i.K)(vt,"intersectRanges"),(0,i.K)(Ct,"clearanceRangeForSide"),(0,i.K)(Lt,"terminalSideForSegment"),(0,i.K)(kt,"isHorizontalSide"),(0,i.K)(Ot,"straightClearanceRange"),(0,i.K)(Rt,"clearStraightEndpointCornerAxis"),(0,i.K)(Tt,"clearStraightEndpointCornerConnections"),(0,i.K)($t,"cornerClearedEndpoint"),(0,i.K)(Nt,"moveCollinearEndpointRun"),(0,i.K)(Bt,"clearEndpointCornerConnection"),(0,i.K)(Ft,"borderSideForSegment"),(0,i.K)(Et,"leavesOutward"),(0,i.K)(Yt,"collapseOwnBorderStub"),(0,i.K)(Xt,"snapAndCollapseEndpoints"),(0,i.K)(zt,"prepareEdgeEndpointsForRenderer"),(0,i.K)(At,"buildNodeMap"),(0,i.K)(Pt,"resolveTopLevelGroupId"),(0,i.K)(Dt,"groupDepth"),(0,i.K)(Gt,"boundsForChildren"),(0,i.K)(Ht,"applyGroupBounds"),(0,i.K)(jt,"recomputeNestedGroupBounds"),(0,i.K)(Vt,"mirrorAxis"),(0,i.K)(_t,"applyBtDirectionTransform"),(0,i.K)(Wt,"applyLrDirectionTransform");var qt=1e-6,Jt=[0,8,-8,16,-16];function Qt(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=j(H(r,qt),qt);if(!s)continue;const{p3:i}=s,a="HVH"===s.kind,c=st(e,n,qt);if(!c)continue;const{srcId:f,dstId:d,srcInfo:l,dstInfo:u,collinearX:h,collinearY:g}=c;if(h||g)continue;let p;const x=l.rect;for(const n of Jt){let r,s,c;if(a){const t=u.cy>l.cy?x.bottom:x.top,e=l.cx+n;if(e<=x.left+qt||e>=x.right-qt)continue;r={x:e,y:t},s={x:e,y:i.y},c={x:i.x,y:i.y}}else{const t=u.cx>l.cx?x.right:x.left,e=l.cy+n;if(e<=x.top+qt||e>=x.bottom-qt)continue;r={x:t,y:e},s={x:i.x,y:e},c={x:i.x,y:i.y}}const h=F(r,s,qt),g=F(s,c,qt);if(h&&g)continue;if(!h&&it(r,s,o,[f],1))continue;if(!g&&it(s,c,o,[d],1))continue;const m=!h&&ft(r,s,t,e,{epsilon:qt,skipDegenerateOther:!0}),y=!g&&ft(s,c,t,e,{epsilon:qt,skipDegenerateOther:!0});if(!m&&!y){p=h?[s,c]:g?[r,s]:[r,s,c];break}}p&&(e.points=p)}}function Ut(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=ot(e.values());for(const s of t){if(s.isLayoutOnly)continue;const a=s.points;if(!a||a.length<4)continue;const c=H(a,n);if(c.length<4)continue;const f=c.length-1,d=c[f],l=c[f-1],u=c[f-2],h=d.x-l.x,g=d.y-l.y,p=Math.hypot(h,g);if(p>=10||p<n)continue;const x=l.x-u.x,m=l.y-u.y;if(Math.hypot(x,m)<n)continue;const y=X(l,d,n),b=z(l,d,n),M=X(u,l,n),K=z(u,l,n);if(!(y&&K||b&&M))continue;const I=s.end,S=s.start,w=I?e.get(I):void 0;if(!w)continue;const v=w.x??0,C=w.y??0,L=U(w);if(!L)continue;let k,O;if(K){const t=m<0;k={x:v,y:u.y},O={x:v,y:t?L.bottom:L.top}}else{const t=x>0;k={x:u.x,y:C},O={x:t?L.right:L.left,y:C}}if(it(k,O,o,I?[I]:[],-2))continue;if(it(k,O,r,[],-2))continue;if(S){const t=e.get(S),n=t?U(t):void 0;if(n&&_(k,n,2))continue}const R=(0,i.K)((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),T=new Set;for(let t=0;t<c.length-1;t++)T.add(R(c[t],c[t+1]));const $=(0,i.K)((e,o)=>{for(const r of t){if(r===s)continue;if(r.isLayoutOnly)continue;const t=r.points;if(t&&!(t.length<2))for(let r=0;r<t.length-1;r++){const s=t[r],i=t[r+1];if(!T.has(R(s,i))&&dt(e,o,s,i,n))return!0}}return!1},"segmentCrossesOtherEdge");if($(k,O))continue;if(f-3>=0){const t=c[f-3];if(it(t,k,o,[S,I].filter(t=>Boolean(t)),-2))continue;if($(t,k))continue}const N=[...c.slice(0,f-2),k,O];s.points=N;const B=s.labelNodeId;if(B){const t=e.get(B);if(t){const e=t.width??0,o=t.height??0;if(e>0&&o>0){let r,s,i=-1;for(let t=0;t<N.length-1;t++){const a=N[t],c=N[t+1],f=Math.hypot(c.x-a.x,c.y-a.y),d=Y(a,c,n),l=E(a,c,n);(d&&f>=e+2||l&&f>=o+2)&&(f>i&&(i=f,r=(a.x+c.x)/2,s=(a.y+c.y)/2))}void 0!==r&&void 0!==s&&(t.x=r,t.y=s)}}}}}(0,i.K)(Qt,"portSwapToLShape"),(0,i.K)(Ut,"collapseShortTerminalStub");var Zt=.001,te=D,ee=(0,i.K)((t,e)=>E(t,e,Zt)||Y(t,e,Zt),"orthogonallyAligned");function ne(t,e){const n=(0,i.K)((t,e)=>{const n=t.x??0,o=t.y??0,r=e.x-n,s=e.y-o;let i=(t.width??0)/2,a=(t.height??0)/2;return Math.abs(s)*i>Math.abs(r)*a?(s<0&&(a=-a),{x:n+(0===s?0:a*r/s),y:o+a}):(r<0&&(i=-i),{x:n+i,y:o+(0===r?0:i*s/r)})},"rectIntersect"),o=(0,i.K)((t,o)=>{const r=H(t.points??[]);if(r.length<2)return;const s=o?t.start:t.end,i=s?e.get(s):void 0,a=i?U(i):void 0;if(!i||!s||!a)return;const c=o?r[0]:r[r.length-1],f=o?r[1]:r[r.length-2],d=n(i,c);let l=c;return ee(f,d)&&(l=f),E(d,l,Zt)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"V",coord:d.x,min:Math.min(d.y,l.y),max:Math.max(d.y,l.y),boundary:d,railEnd:l,rect:a}:Y(d,l,Zt)?{edge:t,edgeId:String(t.id??""),nodeId:s,atStart:o,orientation:"H",coord:d.y,min:Math.min(d.x,l.x),max:Math.max(d.x,l.x),boundary:d,railEnd:l,rect:a}:void 0},"terminalLaneFor"),r=(0,i.K)((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),s=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;if("H"===t.orientation){return(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&E(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&Y(t.boundary,e.boundary,1)},"sameTerminalFace"),a=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation)return!1;return r(t,e)>=8&&Math.abs(t.coord-e.coord)<.5},"exactTerminalLaneConflict"),c=(0,i.K)((t,e)=>{if(t.nodeId!==e.nodeId||t.orientation!==e.orientation||"H"!==t.orientation||t.atStart===e.atStart)return!1;const n=r(t,e);if(n<8)return!1;const o=t.rect.bottom-t.rect.top;return!(n<o||n>2*o)&&(s(t,e)&&Math.abs(t.coord-e.coord)<16)},"nearTerminalLaneConflict"),f=(0,i.K)((t,e)=>{const n=H(t.edge.points??[]);if(n.length<2)return;const o="V"===t.orientation?{x:t.boundary.x+e,y:t.boundary.y}:{x:t.boundary.x,y:t.boundary.y+e},r="V"===t.orientation?{x:t.railEnd.x+e,y:t.railEnd.y}:{x:t.railEnd.x,y:t.railEnd.y+e};if(!(0,i.K)(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?Y(o,t.boundary,Zt)&&o.x>=t.rect.left+1&&o.x<=t.rect.right-1:(Math.abs(t.boundary.x-t.rect.left)<1||Math.abs(t.boundary.x-t.rect.right)<1)&&(E(o,t.boundary,Zt)&&o.y>=t.rect.top+1&&o.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=n.length>1&&F(n[1],t.railEnd,Zt),s=n.slice(e?2:1),i=s[0];if(i&&!ee(i,r))return;return[o,r,...s]}const s=n.length>1&&F(n[n.length-2],t.railEnd,Zt),a=n.slice(0,s?-2:-1),c=a[a.length-1];return!c||ee(c,r)?[...a,r,o]:void 0},"shiftedCandidate"),d=(0,i.K)(t=>{const n=t.edge,o=H(n.points??[]);if(2!==o.length)return!1;const r=n.start,s=n.end,i=r?e.get(r):void 0,a=s?e.get(s):void 0;if(!i||!a)return!1;const c=i.x??0,f=i.y??0,d=a.x??0,l=a.y??0,[u,h]=o;return Y(u,h,Zt)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||E(u,h,Zt)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),l=[-7,7,-14,14,-21,21];for(let e=0;e<8;e++){const e=t.filter(t=>!t.isLayoutOnly).flatMap(t=>[o(t,!0),o(t,!1)]).filter(t=>Boolean(t));let n=!1;for(let t=0;t<e.length&&!n;t++)for(let r=t+1;r<e.length&&!n;r++){const s=e[t],i=e[r];if(s.edge===i.edge||!a(s,i)&&!c(s,i))continue;const u=!a(s,i),h=[s,i].sort((t,e)=>{const n=d(t),o=d(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const r of l){const s=f(t,r);if(!s)continue;const i=o({...t.edge,points:s},t.atStart);if(i&&!e.some(e=>e.edge!==t.edge&&(a(i,e)||u&&c(i,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function oe(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=(0,i.K)((e,r)=>{const s=e.start,i=e.end,a=te(r);if(a.length!==r.length-1)return!1;const c=[s,i].filter(t=>Boolean(t));for(const t of a){if(it(t.a,t.b,n,c,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1}for(const n of t){if(n===e||n.isLayoutOnly)continue;const t=n.points;if(t&&!(t.length<2))for(const e of a)for(const n of te(H(t))){if(P(e,n,.5)>=8)return!1;if(dt(e.a,e.b,n.a,n.b,Zt))return!1}}return!0},"candidateIsSafe"),s=(0,i.K)((t,e)=>{if(e+4>=t.length)return;const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=t[e+4],a=X(n,o)&&z(o,r)&&X(r,s)&&z(s,i)&&E(n,s,Zt)&&E(n,i,Zt)&&E(o,r,Zt)&&(o.x-n.x)*(s.x-r.x)<0,c=z(n,o)&&X(o,r)&&z(r,s)&&X(s,i)&&Y(n,s,Zt)&&Y(n,i,Zt)&&Y(o,r,Zt)&&(o.y-n.y)*(s.y-r.y)<0;if(a||c)return H([...t.slice(0,e+1),i,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=z(n,o)&&X(o,r)&&z(r,s)&&X(s,i)&&z(i,f)&&E(n,i,Zt)&&E(n,f,Zt)&&E(r,s,Zt)&&(r.x-o.x)*(i.x-s.x)<0,l=X(n,o)&&z(o,r)&&X(r,s)&&z(s,i)&&X(i,f)&&Y(n,i,Zt)&&Y(n,f,Zt)&&Y(r,s,Zt)&&(r.y-o.y)*(i.y-s.y)<0;return d||l?H([...t.slice(0,e+1),f,...t.slice(e+6)]):void 0},"withoutDogleg");for(let e=0;e<8;e++){let e=!1;for(const n of t){if(n.isLayoutOnly)continue;const t=H(n.points??[]);for(let o=0;o<=t.length-5;o++){const i=s(t,o);if(i&&r(n,i)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function re(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e,n)=>H(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,i.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=te(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=te(s(r[a],t,e));for(const t of i)for(const e of o)dt(t.a,t.b,e.a,e.b,Zt)&&n++}}return n},"strictCrossingCount"),c=(0,i.K)(t=>{const e=te(t);if(3!==e.length)return;const n=e[1];return e[0].horizontal!==n.horizontal&&e[2].horizontal!==n.horizontal?{index:n.index,horizontal:n.horizontal,vertical:n.vertical,segment:n}:void 0},"middleRail"),f=(0,i.K)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));return n.filter(t=>{if(o.includes(t.id))return!1;const n=t.rect;if(e.horizontal){return A(e.a.x,e.b.x,n.left,n.right)>=8&&e.a.y>=n.top-2&&e.a.y<=n.bottom+2}return A(e.a.y,e.b.y,n.top,n.bottom)>=8&&e.a.x>=n.left-2&&e.a.x<=n.right+2})},"blockingRectsFor"),d=(0,i.K)((t,e,n)=>{const o=t.map(t=>({...t}));if(e.horizontal)o[e.index].y=n,o[e.index+1].y=n;else{if(!e.vertical)return;o[e.index].x=n,o[e.index+1].x=n}const r=pt(H(o));return te(r).length===r.length-1?r:void 0},"candidateByMovingRail"),l=(0,i.K)((t,e,i)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=te(e);if(f.length!==e.length-1)return!1;for(const t of f){if(it(t.a,t.b,n,c,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1}for(const e of r)if(e!==t)for(const t of f)for(const n of te(s(e)))if(P(t,n,.5)>=8)return!1;return a(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e=!1;for(const n of r){const o=s(n),r=c(o);if(!r)continue;const i=f(n,r.segment);if(0===i.length)continue;const a=r.horizontal?[Math.min(...i.map(t=>t.rect.top))-20,Math.max(...i.map(t=>t.rect.bottom))+20]:[Math.min(...i.map(t=>t.rect.left))-20,Math.max(...i.map(t=>t.rect.right))+20];for(const s of a){const i=d(o,r.segment,s);if(i&&l(n,i,t)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function se(t,e){const n=(0,i.K)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,i.K)(t=>{if(!t.isGroup||t.parentId)return;const e=t.direction,o="string"==typeof e?e.toUpperCase():"";if("LR"===o||"RL"===o||"BT"===o)return;const r=n(t),s=t.y,i=t.height;if(!r||"number"!=typeof s||"number"!=typeof i||!Number.isFinite(s)||!Number.isFinite(i)||i<=0)return;const a=r.right-r.left,c=r.bottom-r.top;return c<=0||a<c?void 0:{node:t,rect:r}},"topLaneTitleFor"),r=(0,i.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+Zt||n>=e.bottom-Zt)&&A(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),s=[...e.values()].map(o).filter(t=>Boolean(t));if(0===s.length)return;let a=0;for(const e of t){if(e.isLayoutOnly)continue;const t=H(e.points??[]);for(const e of te(t))for(const t of s)r(e,t.rect)&&(a=Math.max(a,t.rect.bottom-e.a.y+4))}if(!(a<=Zt))for(const t of s){const e=t.node.y,n=t.node.height;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.y=e-a/2,t.node.height=n+a,t.node.groupTitleRect={...t.rect,top:t.rect.top-a,bottom:t.rect.bottom-a})}}function ie(t,e){const n=(0,i.K)(t=>{const e=t.groupTitleRect;if(e&&"number"==typeof e.left&&"number"==typeof e.right&&"number"==typeof e.top&&"number"==typeof e.bottom&&Number.isFinite(e.left)&&Number.isFinite(e.right)&&Number.isFinite(e.top)&&Number.isFinite(e.bottom)&&!(e.right<=e.left)&&!(e.bottom<=e.top))return{left:e.left,right:e.right,top:e.top,bottom:e.bottom}},"validTitleRect"),o=(0,i.K)(t=>{if(!t.isGroup||t.parentId)return;if("LR"!==t.direction)return;const e=n(t),o=t.x,r=t.width;if(!e||"number"!=typeof o||"number"!=typeof r||!Number.isFinite(o)||!Number.isFinite(r)||r<=0)return;const s=e.right-e.left,i=e.bottom-e.top;return s<=0||i<s?void 0:{node:t,rect:e}},"leftLaneTitleFor"),r=(0,i.K)((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<=e.left+Zt||n>=e.right-Zt)&&A(t.a.y,t.b.y,e.top,e.bottom)>=8},"verticalSegmentIntersectsTitle"),s=(0,i.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+Zt||n>=e.bottom-Zt)&&A(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),a=[...e.values()].map(o).filter(t=>Boolean(t));if(0===a.length)return;let c=0;for(const e of t){if(e.isLayoutOnly)continue;const t=H(e.points??[]);for(const e of te(t))for(const t of a)if(r(e,t.rect))c=Math.max(c,t.rect.right-e.a.x+4);else if(s(e,t.rect)){const n=Math.min(e.a.x,e.b.x);c=Math.max(c,t.rect.right-n+4)}}if(!(c<=Zt))for(const t of a){const e=t.node.x,n=t.node.width;"number"!=typeof e||"number"!=typeof n||!Number.isFinite(e)||!Number.isFinite(n)||n<=0||(t.node.x=e-c/2,t.node.width=n+c,t.node.groupTitleRect={...t.rect,left:t.rect.left-c,right:t.rect.right-c})}}function ae(t,e){const{realNodeRects:n}=ot(e.values()),o=t.filter(t=>!t.isLayoutOnly),r=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),s=(0,i.K)((t=new Map)=>{let e=0;for(let n=0;n<o.length;n++){const s=te(r(o[n],t));for(let i=n+1;i<o.length;i++){const n=te(r(o[i],t));for(const t of s)for(const o of n)dt(t.a,t.b,o.a,o.b,Zt)&&e++}}return e},"crossingCount"),a=(0,i.K)((t=new Map)=>o.reduce((e,n)=>e+G(r(n,t)),0),"totalBends"),c=(0,i.K)(t=>{const e=r(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return X(n,o,Zt)||z(n,o,Zt)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),f=(0,i.K)((t,e)=>{const n=r(t);if(n.length<3)return;const o=n[0],s=n[1];let i;if(X(o,s,Zt))i={x:s.x,y:e.tailStart.y};else{if(!z(o,s,Zt))return;i={x:e.tailStart.x,y:s.y}}const a=pt(H([o,s,i,e.tailStart,e.terminal]));return te(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),d=(0,i.K)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));for(const t of te(e))if(it(t.a,t.b,n,o,-2))return!0;return!1},"pathHasNodeHit"),l=(0,i.K)((t,e,n)=>{for(const s of o)if(s!==t)for(const t of te(e))for(const e of te(r(s,n)))if(P(t,e,.5)>=8)return!0;return!1},"pathHasSharedTrack"),u=(0,i.K)((t,e,n)=>!d(t,e)&&!l(t,e,n),"candidateIsSafe"),h=(0,i.K)(()=>{const t=new Map;for(const n of o){const o=n.end;if(!o||!e.has(o))continue;if(r(n).length<4)continue;const s=t.get(o)??[];s.push(n),t.set(o,s)}return t},"edgesByDestination");for(let t=0;t<4;t++){const t=s();if(0===t)return;let e,n=t,o=a();for(const r of h().values())for(let i=0;i<r.length;i++)for(let d=i+1;d<r.length;d++){const l=r[i],h=r[d],g=c(l),p=c(h);if(!g||!p)continue;const x=f(l,p),m=f(h,g);if(!x||!m)continue;const y=new Map([[l,x],[h,m]]);if(!u(l,x,y)||!u(h,m,y))continue;const b=s(y),M=a(y);b>=t||(b>n||b===n&&M>=o||(e=y,n=b,o=M))}if(!e)return;for(const[t,n]of e)t.points=n}}function ce(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),a=(0,i.K)((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=te(s(r[n],t));for(let i=n+1;i<r.length;i++){const n=te(s(r[i],t));for(const t of o)for(const o of n)dt(t.a,t.b,o.a,o.b,Zt)&&e++}}return e},"strictCrossingCount"),c=(0,i.K)((t=new Map)=>r.reduce((e,n)=>e+G(s(n,t)),0),"totalBends"),f=(0,i.K)(t=>{const n=t.start,o=t.end,r=n?e.get(n):void 0,s=o?e.get(o):void 0,i=r?U(r):void 0,a=s?U(s):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),d=(0,i.K)((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=f(t);if(o){if(n.vertical){const r=n.a.x,s=Math.min(o.src.left,o.dst.left),i=Math.max(o.src.right,o.dst.right),a=r<s-Zt?"left":r>i+Zt?"right":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"vertical",side:a,coord:r,min:Math.min(n.a.y,n.b.y),max:Math.max(n.a.y,n.b.y)}}if(n.horizontal){const r=n.a.y,s=Math.min(o.src.top,o.dst.top),i=Math.max(o.src.bottom,o.dst.bottom),a=r<s-Zt?"top":r>i+Zt?"bottom":void 0;if(!a)return;return{edge:t,points:e,segmentIndex:n.index,axis:"horizontal",side:a,coord:r,min:Math.min(n.a.x,n.b.x),max:Math.max(n.a.x,n.b.x)}}}},"externalRailForSegment"),l=(0,i.K)(()=>{const t=[];for(const e of r){const n=s(e);for(const o of te(n)){const r=d(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),u=(0,i.K)((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&A(t.min,t.max,e.min,e.max)>=8,"railsInteract"),h=(0,i.K)(t=>{const e=[],n=new Set;for(const o of t){if(n.has(o))continue;const r=[o],s=[];for(n.add(o);r.length>0;){const e=r.pop();s.push(e);for(const o of t)!n.has(o)&&u(e,o)&&(n.add(o),r.push(o))}s.length>1&&e.push(s)}return e},"connectedComponents"),g=(0,i.K)(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<Zt)||e.push(n.coord);for(;e.length<t.length;){const n=Math.min(...e),o=Math.max(...e),r=t[0].side;e.push("left"===r||"top"===r?n-12*(t.length-e.length):o+12*(t.length-e.length))}return e},"uniqueCoordsFor"),p=(0,i.K)(t=>{const e=t.map(t=>t.coord),n=g(t),o=[];if(t.length<=6){const r=new Array(n.length).fill(!1),s=[],a=(0,i.K)(()=>{if(s.length!==t.length)for(const[t,e]of n.entries())r[t]||(r[t]=!0,s.push(e),a(),s.pop(),r[t]=!1);else s.some((t,n)=>Math.abs(t-e[n])>=Zt)&&o.push([...s])},"visit");return a(),o}for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){const r=[...e];[r[t],r[n]]=[r[n],r[t]],o.push(r)}return o},"coordinateAssignmentsFor"),x=(0,i.K)((t,e)=>{const n=new Map;for(const[o,r]of t.entries()){const t=e[o],s=n.get(r.edge)??r.points.map(t=>({x:t.x,y:t.y}));"vertical"===r.axis?(s[r.segmentIndex].x=t,s[r.segmentIndex+1].x=t):(s[r.segmentIndex].y=t,s[r.segmentIndex+1].y=t),n.set(r.edge,s)}const o=new Map;for(const[t,e]of n){const n=pt(H(e));if(te(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),m=(0,i.K)(t=>{for(const[e,r]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of te(r)){if(it(e.a,e.b,n,t,-2))return!1;if(it(e.a,e.b,o,[],-2))return!1}}for(let e=0;e<r.length;e++){const n=r[e],o=t.has(n),i=te(s(n,t));for(let n=e+1;n<r.length;n++){const e=r[n];if(!o&&!t.has(e))continue;const a=te(s(e,t));for(const t of i)for(const e of a)if(P(t,e,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=a();if(0===t)return;let e,n=t,o=c(),r=Number.POSITIVE_INFINITY;for(const s of h(l()))for(const i of p(s)){const f=x(s,i);if(!f||!m(f))continue;const d=a(f);if(d>=t)continue;const l=c(f),u=s.reduce((t,e,n)=>t+Math.abs(i[n]-e.coord),0);d>n||d===n&&(l>o||l===o&&u>=r)||(e=f,n=d,o=l,r=u)}if(!e)return;for(const[t,n]of e)t.points=n}}function fe(t,e){const{realNodeRects:n,labelNodeRects:o}=ot(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,i.K)((t,e,n)=>H(t===e?n??[]:t.points??[]),"pointsFor"),a=(0,i.K)(t=>te(t).reduce((t,e)=>{const n=e.a.x-e.b.x,o=e.a.y-e.b.y;return t+Math.hypot(n,o)},0),"pathLength"),c=(0,i.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=te(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=te(s(r[a],t,e));for(const t of i)for(const e of o)dt(t.a,t.b,e.a,e.b,Zt)&&n++}}return n},"strictCrossingCount"),f=(0,i.K)((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&A(t.a.x,t.b.x,e.left,e.right)>=8}if(t.vertical){const n=t.a.x;return(Math.abs(n-e.left)<1||Math.abs(n-e.right)<1)&&A(t.a.y,t.b.y,e.top,e.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),d=(0,i.K)(t=>{const n=[t.start,t.end].filter(t=>Boolean(t)),o=[];for(const t of n){const n=e.get(t),r=n?U(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),l=(0,i.K)((t,e)=>{if(e+3>=t.length)return[];const n=t[e],o=t[e+1],r=t[e+2],s=t[e+3],i=X(n,o,Zt)&&z(o,r,Zt)&&X(r,s,Zt),a=z(n,o,Zt)&&X(o,r,Zt)&&z(r,s,Zt);if(!i&&!a)return[];if(!(i?Math.sign(o.x-n.x)!==Math.sign(s.x-r.x):Math.sign(o.y-n.y)!==Math.sign(s.y-r.y)))return[];const c=E(n,s,Zt)||Y(n,s,Zt)?[]:[{x:n.x,y:s.y},{x:s.x,y:n.y}],f=0===c.length?[[...t.slice(0,e+1),...t.slice(e+3)]]:c.map(n=>[...t.slice(0,e+1),n,...t.slice(e+3)]),d=new Set;return f.map(t=>pt(H(t))).filter(t=>{if(te(t).length!==t.length-1)return!1;if(!t.some(t=>F(t,s,Zt)))return!1;const e=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!d.has(e)&&(d.add(e),!0)})},"shortcutCandidatesAt"),u=(0,i.K)((t,e,i)=>{const a=[t.start,t.end].filter(t=>Boolean(t)),l=d(t);for(const t of te(e)){if(it(t.a,t.b,n,a,-2))return!1;if(it(t.a,t.b,o,[],-2))return!1;if(l.some(e=>f(t,e)))return!1}for(const n of r)if(n!==t)for(const t of te(e))for(const e of te(s(n)))if(P(t,e,.5)>=8)return!1;return c(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=c();let e,n,o=t,i=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const d of r){const r=s(d),h=G(r,Zt),g=a(r);for(let s=0;s<=r.length-4;s++)for(const p of l(r,s)){const r=G(p,Zt),s=a(p);if(!(r<h||r===h&&s<g-Zt)||!u(d,p,t))continue;const l=c(d,p);l>o||l===o&&(r>i||r===i&&s>=f)||(e=d,n=p,o=l,i=r,f=s)}}if(!e||!n)return;e.points=n}}function de(t,e){const n=20,o=[];for(const t of e.values()){if(t.isGroup||t.isEdgeLabel)continue;const e=t.x??0,n=t.y??0,r=U(t);r&&o.push({id:String(t.id??""),cx:e,cy:n,rect:r})}if(0===o.length)return;const r=new Map(o.map(t=>[t.id,t])),s=o.map(t=>({id:t.id,rect:t.rect})),a=["top","bottom","left","right"],c={top:Math.min(...o.map(t=>t.rect.top))-n,bottom:Math.max(...o.map(t=>t.rect.bottom))+n,left:Math.min(...o.map(t=>t.rect.left))-n,right:Math.max(...o.map(t=>t.rect.right))+n},f=t.filter(t=>!t.isLayoutOnly),d=new Map(f.map((t,e)=>[t,e])),l=(0,i.K)(t=>{const e="left"===t||"top"===t?-1:1,o=[];for(let r=0;r<=2;r++)o.push(c[t]+e*n*r);return o},"outwardTracksForSide"),u=(0,i.K)((t,e=new Map)=>H(e.get(t)??t.points??[]),"replacementPointsFor"),h=(0,i.K)((t,e)=>{let n=0;for(const o of t)for(const t of e)dt(o.a,o.b,t.a,t.b,Zt)&&n++;return n},"crossingCountBetweenSegments"),g=(0,i.K)((t,e)=>h(te(t),te(e)),"crossingCountBetweenPaths"),p=(0,i.K)((t=new Map)=>{let e=0;const n=[],o=new Set,r=[],s=(0,i.K)(t=>{o.has(t)||(o.add(t),r.push(t))},"addEdge");for(let o=0;o<f.length;o++){const r=f[o],i=u(r,t);for(let a=o+1;a<f.length;a++){const o=f[a],c=g(i,u(o,t));c>0&&(e+=c,n.push({first:r,second:o,count:c}),s(r),s(o))}}return r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),{count:e,pairs:n,edgeSet:o,edges:r}},"crossingSnapshot"),x=(0,i.K)((t,e)=>{const n=new Set(e.keys());if(0===n.size)return t.count;let o=0;for(const e of t.pairs)(n.has(e.first)||n.has(e.second))&&(o+=e.count);let r=0;for(let t=0;t<f.length;t++){const o=f[t],s=n.has(o),i=u(o,e);for(let o=t+1;o<f.length;o++){const t=f[o];(s||n.has(t))&&(r+=g(i,u(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),m=(0,i.K)(t=>{const e=new Map;for(const n of t.pairs){const t=e.get(n.first)??new Set;t.add(n.second),e.set(n.first,t);const o=e.get(n.second)??new Set;o.add(n.first),e.set(n.second,o)}const n=[],o=new Set;for(const r of t.edges){if(o.has(r))continue;const t=[r],s=[];for(o.add(r);t.length>0;){const n=t.pop();s.push(n);for(const r of e.get(n)??[])o.has(r)||(o.add(r),t.push(r))}s.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),y=(0,i.K)(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),b=(0,i.K)(t=>{const e=[];for(const n of m(t)){const t=new Set(n),o=new Set(n.flatMap(t=>y(t))),r=[...n];for(const e of f)t.has(e)||y(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(d.get(t)??0)-(d.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),M=(0,i.K)((t,e,n)=>x(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),K=(0,i.K)(t=>{const e=new Map;for(const n of t.pairs)e.set(n.first,(e.get(n.first)??0)+n.count),e.set(n.second,(e.get(n.second)??0)+n.count);return e},"currentCrossingsByEdge"),I=(0,i.K)(t=>t.slice(1).reduce((e,n,o)=>{const r=t[o];return e+Math.abs(n.x-r.x)+Math.abs(n.y-r.y)},0),"pathLength"),S=(0,i.K)((t=new Map)=>f.reduce((e,n)=>e+G(u(n,t)),0),"totalBends"),w=(0,i.K)((t=new Map)=>f.reduce((e,n)=>e+I(u(n,t)),0),"totalLength"),v=(0,i.K)((t,e,n=new Map)=>{const o=te(e);for(const e of f)if(e!==t)for(const t of o)for(const o of te(u(e,n)))if(P(t,o,.5)>=8)return!0;return!1},"pathHasSegmentConflict"),C=(0,i.K)((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of te(e))if(it(t.a,t.b,s,n,-2))return!0;return!1},"pathHitsNode"),L=(0,i.K)((t,e)=>{const n=pt(H(e));te(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),k=(0,i.K)(t=>"left"===t||"right"===t,"sideIsHorizontal"),O=(0,i.K)((t,e,o)=>{switch(e){case"left":return Math.min(t.x,o.x)-n;case"right":return Math.max(t.x,o.x)+n;case"top":return Math.min(t.y,o.y)-n;case"bottom":return Math.max(t.y,o.y)+n}},"localTrackForSameSide"),R=(0,i.K)((t,e,o,r)=>{const s="left"===o||"top"===o?-1:1,i=[O(e,o,r),c[o]];for(const a of i)for(let i=0;i<=2;i++)L(t,et(e,o,r,a+s*n*i))},"addSameSideCandidates"),T=(0,i.K)((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))L(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),$=(0,i.K)((t,e,n,o,r)=>{for(const s of l(n))for(const n of l(r))L(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),N=(0,i.K)((t,e,n,o,r)=>{const s=[...l("top"),...l("bottom")];for(const i of l(n))for(const n of l(r))for(const r of s)L(t,[e,{x:i,y:e.y},{x:i,y:r},{x:n,y:r},{x:n,y:o.y},o])},"addHorizontalPairCandidates"),B=(0,i.K)((t,e,n,o,r)=>{const s=[...l("left"),...l("right")];for(const i of l(n))for(const n of l(r))for(const r of s)L(t,[e,{x:e.x,y:i},{x:r,y:i},{x:r,y:n},{x:o.x,y:n},o])},"addVerticalPairCandidates"),F=(0,i.K)(t=>{const e=new Set;return t.map(t=>H(t)).filter(t=>{const n=t.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(e.has(n)||t.length<2)&&(e.add(n),!0)})},"dedupeCandidatePaths"),E=(0,i.K)((t,e,o,r)=>{const s=[],i=tt(t,e,o,r,n,Zt);i&&L(s,i),e===r&&R(s,t,e,o);const a=k(e),c=k(r);return a&&!c?T(s,t,e,o,r):!a&&c?$(s,t,e,o,r):a?N(s,t,e,o,r):B(s,t,e,o,r),F(s)},"buildCandidatesForSides"),Y=(0,i.K)((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=Z(o,i),c="top"===i||"bottom"===i?l(i):s;for(const o of r){L(t,[e,n,{x:o,y:n.y},{x:o,y:a.y},a]);for(const r of c)L(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:a.x,y:r},a])}}},"addVerticalDepartureOuterTrackCandidates"),A=(0,i.K)((t,e,n,o)=>{const r=[...l("left"),...l("right")],s=[...l("top"),...l("bottom")];for(const i of a){const a=Z(o,i),c="left"===i||"right"===i?l(i):r;for(const o of s){L(t,[e,n,{x:n.x,y:o},{x:a.x,y:o},a]);for(const r of c)L(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:a.y},a])}}},"addHorizontalDepartureOuterTrackCandidates"),D=(0,i.K)(t=>{const e=t.start,n=t.end,o=n?r.get(n):void 0;if(!e||!o)return[];const s=H(t.points??[]);if(s.length<4)return[];const i=s[0],a=s[1],c=[];return z(i,a,Zt)?Y(c,i,a,o):X(i,a,Zt)&&A(c,i,a,o),c},"terminalPreservingOuterTrackCandidates"),j=(0,i.K)(t=>{const e=t.start,n=t.end,o=e?r.get(e):void 0,s=n?r.get(n):void 0;if(!o||!s)return[];const i=[];for(const t of a){const e=Z(o,t);for(const n of a)i.push(...E(e,t,Z(s,n),n))}return i.push(...D(t)),i},"candidatePathsFor"),V=(0,i.K)(()=>new Map(f.map(t=>[t,te(u(t))])),"currentSegmentsByEdge"),_=(0,i.K)((t,e,n)=>{const o=new Set;for(const r of f){if(r===t)continue;const s=n.get(r)??te(u(r));e.some(t=>s.some(e=>P(t,e,.5)>=8))&&o.add(r)}return o},"sharedTrackConflictsFor"),W=(0,i.K)((t,e,n,o)=>{const r=new Set;return j(t).map(t=>pt(H(t))).filter(e=>{if(C(t,e))return!1;const n=e.map(t=>`${t.x.toFixed(3)},${t.y.toFixed(3)}`).join("|");return!(r.has(n)||e.length<2)&&(r.add(n),!0)}).map(r=>{const s=te(r);let i=0;for(const e of f)e!==t&&(i+=h(s,n.get(e)??te(u(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+i,bends:G(r,Zt),totalBends:G(r),length:I(r)}}).filter(({crossings:t})=>t<=e.count).sort((t,e)=>t.crossings-e.crossings||t.bends-e.bends||t.length-e.length).slice(0,48).map(e=>({path:e.candidate,segments:e.candidateSegments,sharedTrackConflicts:_(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),q=(0,i.K)((t,e,n,o,r,s)=>{let i=0;for(const n of t.pairs)n.first!==e&&n.second!==e&&n.first!==o&&n.second!==o||(i+=n.count);let a=h(n.segments,r.segments);for(const t of f){if(t===e||t===o)continue;const i=s.get(t)??te(u(t));a+=h(n.segments,i)+h(r.segments,i)}return t.count-i+a},"pairCrossingCount"),J=(0,i.K)((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),Q=(0,i.K)((t,e)=>t.segments.some(t=>e.segments.some(e=>P(t,e,.5)>=8)),"candidatesShareTrack"),nt=(0,i.K)((t,e,n,o)=>J(e,n.edge)&&J(o,t.edge)&&!Q(e,o),"pairCandidatesAreCompatible"),ot=(0,i.K)((t,e,n,o,r)=>{const s=q(t.current,e.edge,n,o.edge,r,t.baseSegments);if(!(s>=t.current.count))return{replacements:new Map([[e.edge,n.path],[o.edge,r.path]]),crossings:s,bends:t.currentBends-(t.baseBendsByEdge.get(e.edge)??0)-(t.baseBendsByEdge.get(o.edge)??0)+n.totalBends+r.totalBends,length:t.currentLength-(t.baseLengthByEdge.get(e.edge)??0)-(t.baseLengthByEdge.get(o.edge)??0)+n.length+r.length}},"scorePairReplacement"),rt=(0,i.K)((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),st=(0,i.K)((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!nt(e,o,n,s))continue;const i=ot(t,e,o,n,s);i&&rt(i,r)&&(r=i)}return r},"bestScoreForOptionPair"),at=(0,i.K)(t=>{const e=S(),n=w(),o=V(),r=K(t),s=new Map(f.map(t=>[t,G(u(t))])),i=new Map(f.map(t=>[t,I(u(t))])),a=new Map,c=b(t);for(const e of c)for(const n of e){if(a.has(n))continue;const e=W(n,t,o,r);e.length>0&&a.set(n,{edge:n,candidates:e})}let d={replacements:new Map,crossings:t.count,bends:e,length:n};const l={current:t,currentBends:e,currentLength:n,baseBendsByEdge:s,baseLengthByEdge:i,baseSegments:o};for(const e of c){const n=new Set(e.filter(e=>t.edgeSet.has(e))),o=e.map(t=>a.get(t)).filter(t=>Boolean(t));for(let t=0;t<o.length;t++){const e=o[t];for(let r=t+1;r<o.length;r++){const t=o[r];(n.has(e.edge)||n.has(t.edge))&&(d=st(l,e,t,d))}}}return d.replacements.size>0?d.replacements:void 0},"bestPairedReplacement");for(let t=0;t<4;t++){const t=p(),e=t.count;if(0===e)return;let n,o,r=e,s=Number.POSITIVE_INFINITY;for(const i of t.edges){const a=G(u(i),Zt);for(const c of j(i)){const f=C(i,c),d=!f&&v(i,c),l=M(t,i,c),u=G(c,Zt);if(f||d)continue;(l<e||l===e&&u<a)&&(l>r||l===r&&u>=s||(n=i,o=c,r=l,s=u))}}if(n&&o){n.points=o;continue}const i=at(t);if(!i)return;for(const[t,e]of i)t.points=e}}(0,i.K)(ne,"separateSharedRenderedTerminalLanes"),(0,i.K)(oe,"collapseRedundantRectangularDoglegs"),(0,i.K)(re,"liftObstacleHuggingSameSideRails"),(0,i.K)(se,"liftTopLaneTitleBandsAboveRails"),(0,i.K)(ie,"shiftLeftLaneTitleBandsLeftOfRails"),(0,i.K)(ae,"swapDestinationTerminalTailsToReduceCrossings"),(0,i.K)(ce,"reassignCrossingExternalRailChannels"),(0,i.K)(fe,"shortcutRedundantOrthogonalJogs"),(0,i.K)(de,"resolveRenderedOrthogonalCrossings");var le=.001;function ue(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e),r=["top","bottom","left","right"],s={top:Math.min(...o.map(t=>t.rect.top))-20,bottom:Math.max(...o.map(t=>t.rect.bottom))+20,left:Math.min(...o.map(t=>t.rect.left))-20,right:Math.max(...o.map(t=>t.rect.right))+20},a=(0,i.K)((t,e,n,o)=>{const r=[],i=tt(t,e,n,o,20,le);return i&&r.push(i),e===o&&r.push(et(t,e,n,s[e])),r},"buildOrthogonalPathCandidates"),c=(0,i.K)((t,e)=>{for(let n=0;n<t.length-1;n++){if(it(t[n],t[n+1],o,e,1))return!0}return!1},"pathHitsNode"),f=(0,i.K)((e,n,o=!1)=>{let r=0;const s=D(e,le),i=n.start,a=n.end;for(const e of t){if(e===n||e.isLayoutOnly)continue;const t=e.start,c=e.end;if(!o&&i&&a&&(t===i||t===a||c===i||c===a))continue;const f=e.points;if(f&&!(f.length<2))for(const t of s)for(const e of D(f,le))(at(t.a,t.b,e.a,e.b,le,le)||P(t,e,le)>=8)&&r++}return r},"pathConflictCount"),d=(0,i.K)((t,e)=>{const n=Math.abs(t.y-e.rect.top),o=Math.abs(t.y-e.rect.bottom),r=Math.abs(t.x-e.rect.left),s=Math.abs(t.x-e.rect.right);let i="top",a=n;return o<a&&(i="bottom",a=o),r<a&&(i="left",a=r),s<a&&(i="right",a=s),i},"nearestSideOfRect"),l=new Map,u=(0,i.K)((t,e,n)=>{const o=l.get(t)??[];o.push({side:e,edgeId:n}),l.set(t,o)},"addFaceClaim");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points??[];if(t.length<1)continue;const o=e.id??"",r=e.start,s=e.end;if(r){const e=n.get(r);e&&u(r,d(t[0],e),o)}if(s){const e=n.get(s);e&&u(s,d(t[t.length-1],e),o)}}const h=(0,i.K)((t,e,n)=>l.get(t)?.some(t=>t.edgeId!==n&&t.side===e)??!1,"faceIsClaimed");for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(!t||t.length<2)continue;const o=G(t,le);if(o<4)continue;const s=e.start,i=e.end;if(!s||!i)continue;const g=n.get(s),p=n.get(i);if(!g||!p)continue;const x=e.id??"",m=f(t,e,!0),y=f(t,e);let b,M=m,K=o;for(const t of r){if(h(s,t,x))continue;const n=Z(g,t);for(const o of r){if(h(i,o,x))continue;const r=Z(p,o);for(const d of a(n,t,r,o)){if(c(d,[s,i]))continue;const t=G(d,le);if(m>0){const n=f(d,e,!0);if(n>M||n===M&&t>=K)continue;M=n,K=t,b=d;continue}f(d,e)>y||t<K&&(K=t,b=d)}}}if(b){e.points=b;const t=l.get(s);t&&l.set(s,t.filter(t=>t.edgeId!==x));const n=l.get(i);n&&l.set(i,n.filter(t=>t.edgeId!==x)),u(s,d(b[0],g),x),u(i,d(b[b.length-1],p),x)}}}(0,i.K)(ue,"simplifyDetouredEdges");var he=.001;function ge(t,e){const n=e?0:t.length-1,o=e?1:-1,r=t[n],s=t[n+o];if(!r||!s)return;const i=s.x-r.x,a=s.y-r.y;if(!(Math.abs(i)+Math.abs(a)<he)){if(Math.abs(a)<=he){const t=r.x+10*Math.sign(i);return{left:Math.min(r.x,t),right:Math.max(r.x,t),top:r.y-7,bottom:r.y+7}}if(Math.abs(i)<=he){const t=r.y+10*Math.sign(a);return{left:r.x-7,right:r.x+7,top:Math.min(r.y,t),bottom:Math.max(r.y,t)}}return{left:Math.min(r.x,s.x),right:Math.max(r.x,s.x),top:Math.min(r.y,s.y),bottom:Math.max(r.y,s.y)}}}function pe(t){return{left:Math.min(t.left,t.right),right:Math.max(t.left,t.right),top:Math.min(t.top,t.bottom),bottom:Math.max(t.top,t.bottom)}}function xe(t,e){const n=H(e);return[ge(n,!0),ge(n,!1)].some(e=>e&&q(t,pe(e)))}function me(t,e){const n=[];for(const e of t){if(e.isLayoutOnly)continue;const t=e.points;if(t&&!(t.length<2))for(let o=0;o<t.length-1;o++)n.push({edgeId:e.id,p1:t[o],p2:t[o+1]})}const o=[],r=[];for(const t of e.values()){const e=t.isGroup,n=t.parentId;if(e&&!n){const e=U(t);e&&r.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const s=U(t);s&&o.push({nodeId:t.id,rect:s})}const s=(0,i.K)((t,e)=>{const n=J(e,3);for(const{nodeId:e,rect:r}of o)if(e!==t&&q(n,r))return!0;return!1},"labelOverlapsForeignNode"),a=(0,i.K)((t,e)=>{const o=J(e,3);for(const e of n)if(e.edgeId!==t&&V(e.p1,e.p2,o))return!0;return!1},"labelOverlapsForeignEdge"),c=(0,i.K)((t,e,n)=>s(t,n)||a(e,n),"labelOverlapsAnything"),f=[],d=(0,i.K)(t=>{for(const{id:e,rect:n}of r)if(W(n,t))return e},"findContainingLane"),l=(0,i.K)((t,e)=>f.some(n=>n.labelId!==t&&q(e,n.rect)),"overlapsPlacedLabel");for(const n of t){if(n.isLayoutOnly)continue;const t=n.labelNodeId;if(!t)continue;const o=e.get(t);if(!o)continue;const u=n.points;if(!u||u.length<2)continue;const h=o.width??0,g=o.height??0;if(h<=0||g<=0)continue;const p=[];for(let t=0;t<u.length-1;t++){const e=u[t],n=u[t+1],o=Math.abs(e.x-n.x),r=Math.abs(e.y-n.y);o<he&&r<he||(o>=he&&r>=he||p.push({idx:t,length:o+r,orientation:o>=he?"horizontal":"vertical",midX:(e.x+n.x)/2,midY:(e.y+n.y)/2}))}if(0===p.length)continue;const x=p.length>=3?p.filter(t=>t.idx>0&&t.idx<p.length-1):p,m=x.length>0?x:p,y=h>=g?"horizontal":"vertical",b=(0,i.K)(t=>[...t].sort((t,e)=>{const n=t.orientation===y;if(n!==(e.orientation===y))return n?-1:1;const o=t.length>=("horizontal"===t.orientation?h:g)+2;return o!==e.length>=("horizontal"===e.orientation?h:g)+2?o?-1:1:e.length-t.length}),"rankSegments"),M=p[0],K=p[p.length-1],I=[.5,.25,.75,.05,.95,.15,.85,.1,.9],S=(0,i.K)((t,e)=>{const n=u[t.idx],o=u[t.idx+1];return{midX:n.x+(o.x-n.x)*e,midY:n.y+(o.y-n.y)*e}},"anchorAtT"),w=(0,i.K)((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),v=(0,i.K)((t,e)=>t.midX>=e.left-he&&t.midX<=e.right+he&&t.midY>=e.top-he&&t.midY<=e.bottom+he,"pointInsideRectInclusive"),C=(0,i.K)(t=>{const e=Q(t.midX,t.midY,h,g),n=d(e);if(n)return{laneId:n,anchor:t,rect:e};const o=r.find(({rect:e})=>v(t,e));if(!o)return;const s=o.rect.left+h/2+1,i=o.rect.right-h/2-1,a=o.rect.top+g/2+1,c=o.rect.bottom-g/2-1;if(s>i||a>c)return;const f={midX:w(t.midX,s,i),midY:w(t.midY,a,c)},l=Q(f.midX,f.midY,h,g);return v(t,l)?{laneId:o.id,anchor:f,rect:l}:void 0},"placementForAnchor"),L=(0,i.K)((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),k=(0,i.K)((t,e)=>{const n=("horizontal"===t.orientation?h/2:g/2)+12;if(t===M){const o=u[t.idx];if(L(t,e,o)+he<n)return!1}if(t===K){const o=u[t.idx+1];if(L(t,e,o)+he<n)return!1}return!0},"labelClearsTerminalEndpoints"),O=(0,i.K)(e=>{const o=b(e);for(const e of o)for(const o of I){const r=S(e,o);if(!k(e,r))continue;const s=C(r);if(s&&(!xe(s.rect,u)&&!l(t,s.rect)&&!c(t,n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),R=(0,i.K)((e,o,r=!1)=>{const i=b(e);for(const e of i){const i={midX:e.midX,midY:e.midY};if(o&&!k(e,i))continue;const c=C(i);if(c&&!xe(c.rect,u)&&!l(t,c.rect)&&!s(t,c.rect)&&(r||!a(n.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),T=O(m)??(m.length<p.length?O(p):void 0)??R(p,!0)??R(p,!1)??R(p,!1,!0);if(T){o.x=T.anchor.midX,o.y=T.anchor.midY,o.parentId=T.laneId;const e=Q(T.anchor.midX,T.anchor.midY,h,g),n=f.findIndex(e=>e.labelId===t);n>=0?f[n]={labelId:t,rect:e}:f.push({labelId:t,rect:e})}}}(0,i.K)(ge,"markerClearanceRectFor"),(0,i.K)(pe,"normalizeRect"),(0,i.K)(xe,"labelOverlapsOwnMarker"),(0,i.K)(me,"anchorLabelsToPolyline");var ye=1e-6;function be(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function Me(t,e){const{nodeInfoById:n,realNodeRects:o}=nt(e),r=new Map;for(const t of e){const e=t.id;t.isGroup||t.isEdgeLabel&&r.set(e,{w:t.width??0,h:t.height??0})}const s=(0,i.K)((e,n,o,s)=>{const a=be(n,o);let c=0;const f=(0,i.K)(t=>{if(!t)return;const e=r.get(t);if(!e)return;const n="x"===s?e.w/2:e.h/2;n>c&&(c=n)},"consider");f(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(be(t,o)===a&&f(n.labelNodeId))}return c>0?c+3:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!j(e.points,ye))continue;const r=st(e,n,ye);if(!r)continue;const{srcId:i,dstId:a,srcInfo:c,dstInfo:f,collinearX:d,collinearY:l}=r;if(d===l)continue;let u,h;if(d){const t=f.cy>c.cy;u={x:c.cx,y:t?c.rect.bottom:c.rect.top},h={x:f.cx,y:t?f.rect.top:f.rect.bottom}}else{const t=f.cx>c.cx;u={x:t?c.rect.right:c.rect.left,y:c.cy},h={x:t?f.rect.left:f.rect.right,y:f.cy}}if(it(u,h,o,[i,a],1))continue;const g=s(e,i,a,d?"x":"y"),p=g>4?g:4,x=[0,p,-p];for(const n of x){const r={...u},s={...h};if(d){if(r.x+=n,s.x+=n,r.x<=c.rect.left||r.x>=c.rect.right)continue;if(s.x<=f.rect.left||s.x>=f.rect.right)continue}else{if(r.y+=n,s.y+=n,r.y<=c.rect.top||r.y>=c.rect.bottom)continue;if(s.y<=f.rect.top||s.y>=f.rect.bottom)continue}if(!it(r,s,o,[i,a],1)&&!ft(r,s,t,e,{epsilon:ye})){e.points=[r,s];break}}}}function Ke(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=ot(e.values()),s=(0,i.K)((t,e)=>D(e,n).map(n=>({...n,edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),a=(0,i.K)(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...s(n,H(t)))}return e},"allSegments"),c=(0,i.K)((t,e)=>t.horizontal&&e.horizontal?A(t.a.x,t.b.x,e.a.x,e.b.x)>=8&&Math.abs(t.a.y-e.a.y)<7:!(!t.vertical||!e.vertical)&&(A(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),f=(0,i.K)((e,i)=>{const a=e.start,f=e.end,d=s(e,i);if(d.length!==i.length-1)return!1;const l=[a,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(it(t.a,t.b,o,l,-2))return!1;if(it(t.a,t.b,r,u,-2))return!1}for(const o of t){if(o===e||o.isLayoutOnly)continue;const t=o.points;if(t&&!(t.length<2))for(const e of d)for(const r of s(o,H(t))){if(c(e,r))return!1;if(dt(e.a,e.b,r.a,r.b,n))return!1}}return!0},"candidateIsSafe"),d=(0,i.K)((t,e)=>{const n=H(t.edge.points??[]);if(n.length<4||t.index>=n.length-1)return;const o=n.map(t=>({...t}));if(t.horizontal)o[t.index].y+=e,o[t.index+1].y+=e;else{if(!t.vertical)return;o[t.index].x+=e,o[t.index+1].x+=e}return s(t.edge,o).length===o.length-1?o:void 0},"shiftedCandidate"),l=(0,i.K)((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),u=(0,i.K)(t=>{const n=t.edge,o=H(n.points??[]);if(4!==o.length||1!==t.index)return;const r=n.start?e.get(n.start):void 0,s=n.end?e.get(n.end):void 0,i=r?U(r):void 0,a=s?U(s):void 0,c=o.slice(t.index+2);return r&&s&&i&&a&&0!==c.length?{sourceCenter:l(r,i),targetCenter:l(s,a),sourceRect:i,tail:c}:void 0},"sourceDetourContextFor"),h=(0,i.K)((t,e,o,r,s,i)=>{const a=r.y>=o.y,c=a?s.bottom:s.top,f=c+(a?20:-20);if(a&&t.b.y<=f+n||!a&&t.b.y>=f-n)return;const d=t.a.x+e;return H([{x:o.x,y:c},{x:o.x,y:f},{x:d,y:f},{x:d,y:t.b.y},...i],n)},"verticalSourceDetour"),g=(0,i.K)((t,e,o,r,s,i)=>{const a=r.x>=o.x,c=a?s.right:s.left,f=c+(a?20:-20);if(a&&t.b.x<=f+n||!a&&t.b.x>=f-n)return;const d=t.a.y+e;return H([{x:c,y:o.y},{x:f,y:o.y},{x:f,y:d},{x:t.b.x,y:d},...i],n)},"horizontalSourceDetour"),p=(0,i.K)((t,e)=>{const n=u(t);if(n)return t.vertical?h(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):t.horizontal?g(t,e,n.sourceCenter,n.targetCenter,n.sourceRect,n.tail):void 0},"sourceDetourCandidate"),x=[-7,7,-14,14,-21,21];for(let t=0;t<12;t++){const t=a();let e=!1;for(let n=0;n<t.length&&!e;n++)for(let o=n+1;o<t.length&&!e;o++){const r=t[n],s=t[o];if(r.edge===s.edge||!c(r,s))continue;const i=[r,s].filter(t=>t.interior);for(const t of i){for(const n of x){const o=d(t,n);if(o&&f(t.edge,o)){t.edge.points=o,e=!0;break}const r=p(t,n);if(r&&f(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function Ie(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=o.x-n.x,a=o.y-n.y,c=r*a-s*i;if(Math.abs(c)<1e-10)return!1;const f=n.x-t.x,d=n.y-t.y,l=(f*a-d*i)/c,u=(f*s-d*r)/c,h=.01;return l>h&&l<.99&&u>h&&u<.99}function Se(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const r=rt(e),i=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,s=t.end,a=t.labelNodeId,c=t.id??`${n}->${s}`;for(const t of r)if(t.nodeId!==n&&t.nodeId!==s&&(!a||t.nodeId!==a))for(let n=0;n<e.length-1;n++)if(V(e[n],e[n+1],t,-1)){o.push({type:"edge-node-overlap",edgeId:c,targetId:t.nodeId,detail:`segment ${n} passes through node "${t.nodeId}"`});break}for(let t=0;t<e.length-1;t++)i.push({edgeId:c,start:n,end:s,p1:e[t],p2:e[t+1]})}const a=new Set;for(let t=0;t<i.length;t++)for(let e=t+1;e<i.length;e++){const n=i[t],r=i[e];if(n.edgeId!==r.edgeId&&(n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&Ie(n.p1,n.p2,r.p1,r.p2))){const t=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;a.has(t)||(a.add(t),o.push({type:"edge-edge-crossing",edgeId:n.edgeId,targetId:r.edgeId,detail:`edges "${n.edgeId}" and "${r.edgeId}" cross`}))}}if(o.length>0){const t=o.filter(t=>"edge-node-overlap"===t.type).length,e=o.filter(t=>"edge-edge-crossing"===t.type).length;s.R.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of o)s.R.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return o}function we(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&r.length>0&&!Wt(t,e))return;if("BT"===e&&r.length>0&&!_t(t))return;for(const t of o){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=pt(gt(e)))}ue(o,n),Me(o,n),Qt(o,n);const s=new Map;for(const t of n)s.set(String(t.id),t);me(o,s),Mt(o,s),Ut(o,s),Ke(o,s),ne(o,s),oe(o,s),re(o,s),ae(o,s);const a=(0,i.K)(()=>{de(o,s),ce(o,s),fe(o,s),me(o,s),zt(o,s),re(o,s),me(o,s),zt(o,s)},"finalizeRenderedEdges");a(),Ke(o,s),a(),se(o,s),ie(o,s),se(o,s),ie(o,s)}function ve(t){const e=new Map(t.nodeById),n=new Set,o=[];for(const r of t.edges){if(!e.has(r.src)||!e.has(r.dst))continue;const t=`${r.id}:${r.src}->${r.dst}`;n.has(t)||(n.add(t),o.push(r))}return{nodes:[...e.keys()],edges:o,layout:t.layout,nodeById:e}}function Ce(t,e){return t.edges.filter(t=>t.dst===e)}function Le(t){const e=new Map;for(const n of t.nodes)e.set(n,[]);for(const n of t.edges)e.get(n.src).push(n.dst);return e}function ke(t){const e=Le(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function Oe(t){const e=new Map;for(const n of t.nodes)e.set(n,0);for(const n of t.edges)e.set(n.dst,(e.get(n.dst)??0)+1);return e}function Re(t){return[...t.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e))}function Te(t,e=()=>!0){const n=new Map,o=new Map;for(const e of t.nodes)n.set(e,[]),o.set(e,[]);for(const r of t.edges)e(r)&&(o.get(r.src).push(r.dst),n.get(r.dst).push(r.src));return{preds:n,succs:o}}function $e(t,e,n,o){let r=0;for(const e of t.nodes)o?.skipGroups&&t.nodeById.get(e)?.isGroup||(r=Math.max(r,n[e]??0));const s=Array.from({length:r+1},()=>[]);for(const r of e)o?.skipGroups&&t.nodeById.get(r)?.isGroup||s[Math.max(0,n[r]??0)].push(r);return s}function Ne(t){const e=Oe(t),n=Re(e),o=[],r=ke(t);for(;n.length;){const t=n.shift();o.push(t);for(const o of r.get(t)??[])if(e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)){let t=0;for(;t<n.length&&n[t]<o;)t++;n.splice(t,0,o)}}return o.length===t.nodes.length?o:null}function Be(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function Fe(t){const e=new Array(t.length),n=(0,i.K)((o,r)=>{if(r-o<=1)return 0;const s=o+r>>1;let i=n(o,s)+n(s,r),a=o,c=s,f=o;for(;a<s||c<r;)c>=r||a<s&&t[a]<=t[c]?e[f++]=t[a++]:(e[f++]=t[c++],i+=s-a);for(let n=o;n<r;n++)t[n]=e[n];return i},"count");return n(0,t.length)}function Ee(t){const e=ve(t),n=new Map;for(const t of e.nodes)n.set(t,[]);for(const t of e.edges)n.get(t.src).push(t);for(const t of n.values())t.sort((t,e)=>t.dst===e.dst?t.id.localeCompare(e.id):t.dst.localeCompare(e.dst));const o=Object.create(null);for(const t of e.nodes)o[t]=0;const r=[],s=(0,i.K)(t=>{o[t]=1;for(const e of n.get(t)??[]){const t=e.dst;0===o[t]?s(t):1===o[t]&&r.push(e)}o[t]=2},"dfs"),a=[...e.nodes].sort((t,e)=>t.localeCompare(e));for(const t of a)0===o[t]&&s(t);const c=new Set(r.map(t=>`${t.id}:${t.src}->${t.dst}`)),f=e.edges.map(t=>c.has(`${t.id}:${t.src}->${t.dst}`)?{id:t.id,src:t.dst,dst:t.src,weight:t.weight,ref:t.ref}:t);return{acyclic:{nodes:[...e.nodes],edges:f,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:r}}function Ye(t){const e=new Map,n=(0,i.K)(o=>{if(e.has(o))return e.get(o);const r=t.nodeById.get(o);if(!r)return e.set(o,null),null;const s=r.parentId;if(!s)return e.set(o,null),null;const i=n(s)??s;return e.set(o,i),i},"resolve");for(const e of t.nodes)n(e);return e}function Xe(t){const e=Ye(t);return t=>e.get(t)??null}function ze(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function Ae(t,e){const n=ze(t);if(!e||0===e.length)return n;const o=new Set(n),r=new Set,s=[];for(const t of e)o.has(t)&&!r.has(t)&&(r.add(t),s.push(t));for(const t of n)r.has(t)||s.push(t);return s}(0,i.K)(be,"pairKey"),(0,i.K)(Me,"straightenCollinearSiblingDetours"),(0,i.K)(Ke,"nudgeSharedInteriorSubpaths"),(0,i.K)(Ie,"segmentsIntersect"),(0,i.K)(Se,"validateSwimlanesLayout"),(0,i.K)(we,"postProcessSwimlaneLayout"),(0,i.K)(ve,"normalizeGraph"),(0,i.K)(Ce,"incoming"),(0,i.K)(Le,"buildSuccessorMap"),(0,i.K)(ke,"buildSortedSuccessorMap"),(0,i.K)(Oe,"buildInDegreeMap"),(0,i.K)(Re,"sortedZeroInDegreeNodes"),(0,i.K)(Te,"buildPredecessorSuccessorMaps"),(0,i.K)($e,"buildLayersFromRanks"),(0,i.K)(Ne,"topoSortIfAcyclic"),(0,i.K)(Be,"buildLayerIndex"),(0,i.K)(Fe,"countInversions"),(0,i.K)(Ee,"removeCycles_DFS"),(0,i.K)(Ye,"buildTopLaneMap"),(0,i.K)(Xe,"createTopLaneResolver"),(0,i.K)(ze,"buildTopLaneOrder"),(0,i.K)(Ae,"resolveTopLaneOrder");var Pe=8,De=4,Ge=!0,He=100,je=40;function Ve(t,e){const n=ve(t),o=e?.laneOf??(()=>null),r=e?.rankHint,{preds:s}=Te(n);for(const t of s.values())t.sort((t,e)=>t.localeCompare(e));const a=Ne(n)??[...n.nodes].sort((t,e)=>t.localeCompare(e)),c=new Map;for(const[t,e]of a.entries())c.set(e,t);const f=new Map,d=new Map;for(const t of n.nodes)d.set(t,[]);for(const t of a){const e=(s.get(t)??[]).filter(t=>f.has(t));if(e.length>0){const n=_e(t,e,{laneOf:o,rankHint:r,topoIndex:c});f.set(t,n),d.get(n).push(t)}else f.has(t)||f.set(t,null)}for(const t of n.nodes)f.has(t)||f.set(t,null);const l=new Set;for(const t of n.nodes)null===(f.get(t)??null)&&l.add(t);const u=[...l].sort((t,e)=>{const n=c.get(t)??0,o=c.get(e)??0;return n===o?t.localeCompare(e):n-o}),h=We(n),g=new Map;for(const[t,e]of h.entries())g.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const p=qe(g),x=Je(g),m=new Map;for(const t of n.nodes)m.set(t,[]);for(const t of x)for(const e of t.nodes){const n=m.get(e);n?n.push(t.id):m.set(e,[t.id])}const y=[],b=[],M=new Set,K=(0,i.K)(t=>{if(!M.has(t)){M.add(t),y.push(t);for(const e of d.get(t)??[])K(e);b.push(t)}},"walk");for(const t of u)K(t);for(const t of a)K(t);return{parent:f,children:d,roots:u,componentOf:p,blocks:x,nodeBlocks:m,adjacency:g,preorder:y,postorder:b,topologicalOrder:a}}function _e(t,e,n){const o=n.laneOf(t);return[...e].sort((t,e)=>{const r=n.laneOf(t),s=n.laneOf(e),i=null!=r&&r===o;if(i!==(null!=s&&s===o))return i?-1:1;const a=n.rankHint?.[t],c=n.rankHint?.[e];if(null!=a&&null!=c&&a!==c)return c-a;const f=n.topoIndex.get(t)??0,d=n.topoIndex.get(e)??0;return f!==d?f-d:t.localeCompare(e)})[0]}function We(t){const e=new Map;for(const n of t.nodes)e.set(n,new Set);for(const n of t.edges)e.get(n.src).add(n.dst),e.get(n.dst).add(n.src);return e}function qe(t){const e=new Map;let n=0;for(const o of t.keys()){if(e.has(o))continue;const r=[o];for(;r.length>0;){const o=r.pop();if(!e.has(o)){e.set(o,n);for(const n of t.get(o)??[])e.has(n)||r.push(n)}}n++}return e}function Je(t){const e=new Map,n=new Map,o=[],r=[];let s=0;const a=(0,i.K)((i,c)=>{e.set(i,++s),n.set(i,s);for(const f of t.get(i)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(i)??0)&&(o.push([i,f]),n.set(i,Math.min(n.get(i)??s,e.get(f)??s))):(o.push([i,f]),a(f,i),n.set(i,Math.min(n.get(i)??s,n.get(f)??s)),(n.get(f)??0)>=(e.get(i)??0)&&r.push(Qe(i,f,o,r.length))))},"visit");for(const n of t.keys())e.has(n)||a(n,null);return r}function Qe(t,e,n,o){const r=[],s=new Set;for(;n.length>0;){const o=n.pop();if(r.push(o),s.add(o[0]),s.add(o[1]),o[0]===t&&o[1]===e||o[0]===e&&o[1]===t)break}return{id:o,edges:r,nodes:[...s]}}function Ue(t,e,n){const o=[...t.nodes],r=new Map;for(const[t,e]of o.entries())r.set(e,t);const s=o.length,a=new Array(s).fill(-1),c=new Array(s).fill(0),f=[],d=new Set;for(const t of o){const e=n.parent.get(t)??null,o=r.get(t);null!=o&&(null==e&&(a[o]=-1,c[o]=0,d.has(t)||(d.add(t),f.push(t))))}for(;f.length>0;){const t=f.shift(),e=r.get(t);if(null==e)continue;const o=n.children.get(t)??[];for(const t of o){if(d.has(t))continue;const n=r.get(t);null!=n&&(a[n]=e,c[n]=c[e]+1,d.add(t),f.push(t))}}for(const t of o){if(d.has(t))continue;const e=r.get(t);null!=e&&(a[e]=-1,c[e]=0,d.add(t))}const l=Math.max(1,Math.ceil(Math.log2(Math.max(1,s)))+1),u=Array.from({length:l},()=>new Array(s).fill(-1));for(let t=0;t<s;t++)u[0][t]=a[t];for(let t=1;t<l;t++)for(let e=0;e<s;e++){const n=u[t-1][e];u[t][e]=-1===n?-1:u[t-1][n]}const h=(0,i.K)((t,e)=>{if(-1===t||-1===e)return-1;c[t]<c[e]&&([t,e]=[e,t]);const n=c[t]-c[e];for(let e=0;e<l;e++)if(n>>e&1&&-1===(t=u[e][t]))return-1;if(t===e)return t;for(let n=l-1;n>=0;n--){const o=u[n][t],r=u[n][e];-1!==o&&-1!==r&&(o!==r&&(t=o,e=r))}return u[0][t]},"lcaIndex"),g=Array.from({length:s},()=>new Map);for(const n of t.edges){let t=n.src,o=n.dst,s=e[t],i=e[o];if(null==s||null==i)continue;if(s>i&&([t,o]=[o,t],[s,i]=[i,s]),null==s||null==i||s===i)continue;const a=r.get(t),c=r.get(o);if(null==a||null==c)continue;const f=h(a,c);if(-1===f)continue;const d=g[f];for(let t=s;t<i;t++)d.set(t,(d.get(t)??0)+1)}const p=new Map,x=(0,i.K)((t,e)=>{if(0!==e.size)for(const[n,o]of e)t.set(n,(t.get(n)??0)+o)},"mergeInto"),m=new Set,y=(0,i.K)(t=>{const o=r.get(t);m.add(t);const s=null==o?void 0:g[o],i=s?new Map(s):new Map,a=n.children.get(t)??[];for(const n of a){const o=y(n),r=e[t];if(null!=r){let s=p.get(t);s||(s=new Map,p.set(t,s));let i=o.get(r)??0;const a=e[n];null!=a&&a>r&&(i+=1),s.set(n,i)}x(i,o)}return i},"dfs");for(const t of n.roots)m.has(t)||y(t);for(const t of o)m.has(t)||y(t);return p}function Ze(t,e,n){const o=new Map,r=(0,i.K)(t=>{let s=n[t]??0;const i=[...e.get(t)??[]];i.sort(tn(n));for(const t of i){r(t);const e=o.get(t);null!=e&&(s=Math.min(s,e))}o.set(t,s)},"annotate");for(const e of t)r(e);return o}function tn(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function en(t,e,n,o){let r=0;for(const t of e){const e=n[t]??0;e>r&&(r=e)}const s=Array.from({length:r+1},()=>[]),a=new Set,c=(0,i.K)(t=>{if(a.has(t))return;a.add(t);const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t);for(const e of o(t))c(e)},"emit");for(const e of t)c(e);for(const t of e)if(!a.has(t)){const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t),a.add(t)}return s}function nn(t){const e=[];for(const n of t){const t=new Set,o=[];for(const e of n)t.has(e)||(t.add(e),o.push(e));e.push(o)}return e}function on(t,e,n,o){return r=>{const s=t.get(r)??[];if(0===s.length)return[];const i=e[r]??0,a=[],c=[],f=n.get(r);for(const t of s){const e=o.get(t)??i;e>i?a.push({child:t,min:e}):c.push(t)}return a.sort((t,e)=>t.min===e.min?t.child.localeCompare(e.child):t.min-e.min),c.sort((t,e)=>{const n=f?.get(t)??0,r=f?.get(e)??0;if(n!==r)return n-r;const s=o.get(t)??i,a=o.get(e)??i;return s!==a?s-a:t.localeCompare(e)}),[...a.map(t=>t.child),...c]}}function rn(t,e,n){const o=Ve(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const i=Ue(t,e,o),a=[...s].sort(tn(e)),c=on(r,e,i,Ze(a,r,e));let f=en(a,t.nodes,e,c);return f=nn(f),f}function sn(t,e,n){const o=new Set(t),r=new Set(e),s=Be(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push(s.get(t.dst));return Fe(i)}function an(t,e,n){const o=[];for(const t of e){const e=n[t.src],r=n[t.dst];if(null==e||null==r||e===r)continue;let s=t.src,i=t.dst,a=e,c=r;e>r&&(s=t.dst,i=t.src,a=r,c=e);for(let e=a;e<c;e++)o.push({id:`${t.id}@${e}`,src:s,dst:i,ref:t.ref})}let r=0;for(let e=0;e+1<t.length;e++)r+=sn(t[e],t[e+1],o);return r}function cn(t,e){const n={...e},{preds:o}=Te(t),r=Xe(t);let s=an(rn(t,n,r),t.edges,n);const i=De;for(let e=0;e<i;e++){let e=!1;const i=[...t.nodes].sort((t,e)=>(n[e]??0)-(n[t]??0));for(const a of i){const i=n[a]??0;if(0===i)continue;let c=0;for(const t of o.get(a)??[])c=Math.max(c,(n[t]??0)+1);if(c>=i)continue;const f=i;n[a]=c;const d=an(rn(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[a]=f}if(!e)break}return n}function fn(t,e){const n=Xe(t),o=[...t.nodes].sort((t,n)=>(e[t]??0)-(e[n]??0)||t.localeCompare(n));for(const r of o){const o=n(r);if(!o)continue;const s=t.edges.filter(t=>t.src===r);if(0===s.length)continue;let i=!1,a=0;for(const t of s){const e=n(t.dst);null==e||e===o?i=!0:a++}if(0===a||i)continue;let c=0,f=!1;for(const e of t.edges){if(e.dst!==r)continue;const t=n(e.src);t&&(t===o?f=!0:c++)}if(c>0||!f)continue;const d=e[r]??0,l=d+a;let u=0;for(const n of t.edges)n.dst===r&&(u=Math.max(u,(e[n.src]??0)+1));const h=Math.max(d,u,l);h!==d&&(e[r]=h)}}function dn(t,e){const n=ve(t),o=Ne(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=Xe(n);let i=Object.create(null);for(const t of o){const o=Ce(n,t),a=e?.ignoreCrossLaneEdges?o.filter(e=>{const n=s(e.src),o=s(t);return!n||!o||n===o}):o;if(0===a.length)i[t]=0;else if(r&&1===a.length){const e=a[0].src,n=s(e),o=s(t);i[t]=n!==o?i[e]??0:(i[e]??0)+1}else{let e=-1/0;for(const t of a)e=Math.max(e,(i[t.src]??0)+1);i[t]=e===-1/0?0:e}}e?.optimizeRanksByCrossings&&(i=cn(n,i)),e?.ignoreCrossLaneEdges&&fn(n,i);return{layers:rn(n,i,s),rankOf:i,dummy:new Set}}function ln(t,e){const n=ve(t),o={...dn(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=Xe(n),{preds:s,succs:a}=Te(n,t=>{if(e?.ignoreCrossLaneEdges){const e=r(t.src),n=r(t.dst);if(e&&n&&e!==n)return!1}return!0}),c=Ne(n)??[...n.nodes],f=[...c].reverse(),d=(0,i.K)((t,e)=>{let n=0;for(const e of s.get(t)??[])n=Math.max(n,(o[e]??0)+1);let r=Number.POSITIVE_INFINITY;const i=a.get(t)??[];return i.length>0&&(r=Math.min(...i.map(t=>(o[t]??0)-1))),Number.isFinite(r)||(r=Math.max(n,e)),Math.min(Math.max(e,n),r)},"clampFeasible"),l=Pe,u=(0,i.K)(t=>{let e=!1;for(const n of t){const t=s.get(n)??[],r=a.get(n)??[];if(0===t.length&&0===r.length)continue;const i=t.length>0?t.reduce((t,e)=>t+(o[e]??0)+1,0)/t.length:o[n]??0,c=r.length>0?r.reduce((t,e)=>t+(o[e]??0)-1,0)/r.length:o[n]??0,f=Math.round((i+c)/2),l=d(n,f);l!==o[n]&&(o[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<l;t++){const t=u(c),e=u(f);if(!t&&!e)break}for(const t of c){let e=0;for(const n of s.get(t)??[])e=Math.max(e,(o[n]??0)+1);(o[t]??0)<e&&(o[t]=e)}for(const t of f){const e=a.get(t)??[];if(e.length>0){const n=Math.min(...e.map(t=>(o[t]??0)-1));(o[t]??0)>n&&(o[t]=n)}}return{layers:$e(n,c,o),rankOf:o,dummy:new Set}}function un(t){const e=Oe(t),n=ke(t);let o=Re(e);const r=[];for(;o.length>0;){const t=[];for(const s of o){r.push(s);for(const o of n.get(s)??[])e.set(o,(e.get(o)??0)-1),0===(e.get(o)??0)&&t.push(o)}o=t.sort((t,e)=>t.localeCompare(e))}return r.length===t.nodes.length?r:null}function hn(t,e){const n=ve(t),o="LR"===e?.direction?un(n)??[...n.nodes].sort():Ne(n)??[...n.nodes].sort(),r=Xe(n),s=(0,i.K)(t=>r(t)??t,"laneOf"),a=Object.create(null),c=new Map,f=(0,i.K)((t,n)=>e?.ignoreCrossLaneEdges??!0?s(t)===s(n)?1:0:1,"edgeWeight");for(const t of o){const e=n.nodeById.get(t);if(e?.isGroup)continue;const o=Ce(n,t);let r=0;if(o.length>0)for(const e of o){const n=e.src,o=a[n]??0;r=Math.max(r,o+f(n,t))}const i=s(t),d=c.get(i)??0,l=Math.max(r,d);a[t]=l,c.set(i,l+1)}return{layers:$e(n,o,a,{skipGroups:!0}),rankOf:a,dummy:new Set}}function gn(t,e){const n=ve(e),{rankOf:o}=t,r=t.layers.map(t=>[...t]),s=new Set(t.dummy?[...t.dummy]:[]);let a=0;const c=new Map(n.nodeById),f=(0,i.K)(t=>{const e="placeholder-"+a++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(c.set(e,n),s.add(e);r.length<=t;)r.push([]);return r[t].push(e),o[e]=t,e},"addDummyAt"),d=[...n.edges].sort((t,e)=>t.id===e.id?t.src===e.src?t.dst.localeCompare(e.dst):t.src.localeCompare(e.src):t.id.localeCompare(e.id)),l=[];for(const t of d){const e=o[t.src]??0,n=o[t.dst]??0;if(n-e<=1){l.push(t);continue}let r=t.src;for(let o=e+1,s=0;o<n;o++,s++){const e=f(o);l.push({id:`${t.id}#${s}`,src:r,dst:e,weight:t.weight,ref:t.ref}),r=e}const s=n-e-2;l.push({id:`${t.id}#${Math.max(s+1,0)}`,src:r,dst:t.dst,weight:t.weight,ref:t.ref})}const u={nodes:[...n.nodes,...[...s].filter(t=>!n.nodes.includes(t))],edges:l,layout:n.layout,nodeById:c};return{layering:{layers:r,rankOf:o,dummy:s},graphWithDummies:u}}function pn(t){const e=t.length;if(0===e)return Number.POSITIVE_INFINITY;const n=[...t].sort((t,e)=>t-e);return e%2==1?n[(e-1)/2]:.5*(n[e/2-1]+n[e/2])}function xn(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function mn(t,e,n,o){const r=new Map;for(const e of t)r.set(e,[]);for(const t of n)"down"===o?e.has(t.src)&&r.has(t.dst)&&r.get(t.dst).push(e.get(t.src)):e.has(t.dst)&&r.has(t.src)&&r.get(t.src).push(e.get(t.dst));return r}function yn(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function bn(t,e,n){const o=new Set(t),r=new Set(e),s=Be(t),i=Be(e),a=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&a.push({u:s.get(t.src),v:i.get(t.dst)});a.sort((t,e)=>t.u===e.u?t.v-e.v:t.u-e.u);return Fe(a.map(t=>t.v))}function Mn(t,e,n){return[...t].sort((t,o)=>{const r=pn(e.get(t)??[]),s=pn(e.get(o)??[]);return r===s?yn(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function Kn(t,e,n,o,r,s){const i=Be(t),a=Be(e),c=mn(e,i,n,o);if(!r||!s||0===s.length)return Mn(e,c,a);const f=new Map;for(const t of e){const e=r(t),n=f.get(e)??[];n.push(t),f.set(e,n)}const d=[];for(const t of s){const e=f.get(t);if(!e||0===e.length)continue;const n=Mn(e,c,a);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=Mn(l,c,a);for(const e of t){const t=xn(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<xn(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function In(t,e,n,o,r){const s=[...e],a=new Set(t),c=new Set(e),f=o?new Set(o):null,d=n.filter(t=>a.has(t.src)&&c.has(t.dst)),l=f?n.filter(t=>c.has(t.src)&&f.has(t.dst)):void 0,u=(0,i.K)(e=>{let n=bn(t,e,d);return l&&o&&(n+=bn(e,o,l)),n},"crossingScore"),h=r?new Map:null;if(r&&h)for(const t of e)h.set(t,r(t));let g=!0,p=u(s);for(;g;){g=!1;for(let t=0;t+1<s.length;t++){if(h){if(h.get(s[t])!==h.get(s[t+1]))continue}const e=p;[s[t],s[t+1]]=[s[t+1],s[t]];const n=u(s);n<e?(p=n,g=!0):[s[t],s[t+1]]=[s[t+1],s[t]]}}return s}function Sn(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=Xe(e),i=Ae(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=Kn(o[t-1],o[t],r,"down",s,i),o[t]=In(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=Kn(o[t+1],o[t],r,"up",s,i),o[t]=In(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function wn(t,e,n){const o=n?.layerGap??He,r=n?.nodeGap??je,s=n?.laneGap??2*r,a=n?.direction??"TB",c="LR"===a||"RL"===a,f=t.layers,d=Object.create(null),l=Object.create(null),u=(0,i.K)(t=>e.nodeById.get(t),"getNode"),h=(0,i.K)(t=>u(t)?.width??0,"getWidth"),g=(0,i.K)(t=>u(t)?.height??0,"getHeight"),p=Xe(e),x=Ae(e,n?.laneOrder),m=f.map(t=>t.reduce((t,e)=>Math.max(t,g(e)),0)),y=[];if(c)for(let t=0;t+1<f.length;t++){const e=f[t].reduce((t,e)=>Math.max(t,h(e)),0),n=f[t+1].reduce((t,e)=>Math.max(t,h(e)),0),r=m[t]/2+m[t+1]/2,s=(e+n)/2,i=Math.max(0,s-r-o);y.push(i)}const b=new Set;for(const t of f)for(const e of t)b.add(p(e));const M=b.has(null),K=x.filter(t=>b.has(t)),I=[...M?[null]:[],...K],S=Object.create(null);for(const t of K)S[t]=0;M&&(S.null=0);for(const t of f){const e=Object.create(null),n=[];for(const o of t){const t=p(o);null===t?n.push(o):(e[t]||=[]).push(o)}for(const[t,n]of Object.entries(e)){const e=n.reduce((t,e)=>t+h(e),0)+r*Math.max(0,n.length-1);S[t]=Math.max(S[t]??0,e)}if(M&&n.length){const t=n.reduce((t,e)=>t+h(e),0)+r*Math.max(0,n.length-1);S.null=Math.max(S.null??0,t)}}const w=new Map;{const t=I.map(t=>(null===t?S.null:S[t])??0);let e=-(t.reduce((t,e)=>t+e,0)+s*Math.max(0,I.length-1))/2;for(let n=0;n<I.length;n++){const o=I[n],r=t[n]??0,i=e+r/2;w.set(o,i),e+=r,n<I.length-1&&(e+=s)}}let v=0;for(const[t,e]of f.entries()){const n=m[t]??0,s=new Map;for(const t of e){const e=p(t),n=s.get(e)??[];n.push(t),s.set(e,n)}for(const t of I){const e=s.get(t)??[];if(0===e.length)continue;const o=w.get(t);if(1===e.length){const t=e[0];d[t]=o,l[t]=v+n/2}else{const t=e.map(t=>h(t));let s=o-(t.reduce((t,e)=>t+e,0)+r*(e.length-1))/2;for(const[o,i]of e.entries()){const e=t[o];d[i]=s+e/2,l[i]=v+n/2,s+=e+r}}}v+=n+o+(y[t]??0)}const C=new Map;for(const t of e.edges){const e=t.ref.id;C.has(e)||C.set(e,[]),C.get(e).push(t)}for(const[,t]of C){if(0===t.length)continue;const n=t[0].ref,o=n.start,r=n.end;if(null==o||null==r)continue;const s=Math.round(((d[o]??0)+(d[r]??0))/2),i=new Set;for(const e of t)i.add(e.src),i.add(e.dst);for(const t of i){if(t===o||t===r)continue;const n=e.nodeById.get(t);n?.isDummy&&(d[t]=s)}}return{x:d,y:l}}(0,i.K)(Ve,"buildDrivingTree"),(0,i.K)(_e,"chooseParent"),(0,i.K)(We,"buildAdjacency"),(0,i.K)(qe,"assignComponents"),(0,i.K)(Je,"computeBlocks"),(0,i.K)(Qe,"popBlock"),(0,i.K)(Ue,"computeSubtreeCrossCounts"),(0,i.K)(Ze,"annotateMinimumLayers"),(0,i.K)(tn,"compareByRankThenId"),(0,i.K)(en,"emitNodesInTreeOrder"),(0,i.K)(nn,"deduplicateLayers"),(0,i.K)(on,"createChildOrderer"),(0,i.K)(rn,"buildMultitreeLayerOrder"),(0,i.K)(sn,"countCrossingsBetweenAdjacent"),(0,i.K)(an,"totalCrossings"),(0,i.K)(cn,"optimizeRanksByCrossings"),(0,i.K)(fn,"adjustCrossLaneSources"),(0,i.K)(dn,"assignLayers_LongestPath"),(0,i.K)(ln,"assignLayers_Gravity"),(0,i.K)(un,"topoSortByGenerationIfAcyclic"),(0,i.K)(hn,"assignLayers_LaneAwareCompact"),(0,i.K)(gn,"makeProperLayering"),(0,i.K)(pn,"median"),(0,i.K)(xn,"barycenter"),(0,i.K)(mn,"neighborPositionsFor"),(0,i.K)(yn,"currentOrderTieBreak"),(0,i.K)(bn,"countCrossingsBetweenAdjacent"),(0,i.K)(Mn,"sortByHeuristic"),(0,i.K)(Kn,"reorderLayer"),(0,i.K)(In,"transposeImprove"),(0,i.K)(Sn,"orderLayers"),(0,i.K)(wn,"assignCoordinates");function vn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function Cn(t){let e=t>>>0;return()=>{e+=1831565813;let t=e;return t=Math.imul(t^t>>>15,1|t),t^=t+Math.imul(t^t>>>7,61|t),((t^t>>>14)>>>0)/4294967296}}function Ln(t,e){const n=[...t],o=Cn(e);for(let t=n.length-1;t>0;t--){const e=Math.floor(o()*(t+1));[n[t],n[e]]=[n[e],n[t]]}return n}function kn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function On(t,e){const n=new Map;for(const[e,o]of t.entries())n.set(o,e);let o=0;for(const{a:t,b:r,weight:s}of e){const e=n.get(t),i=n.get(r);null!=e&&null!=i&&(o+=s*Math.abs(e-i))}return o}function Rn(t){const e=ze(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=Xe(t),r=new Map;for(const e of t.layout.edges??[]){if(e.isLayoutOnly)continue;const s="string"==typeof e.start?e.start:void 0,i="string"==typeof e.end?e.end:void 0;if(!(s&&i&&t.nodeById.has(s)&&t.nodeById.has(i)))continue;const a=o(s),c=o(i);if(!a||!c||a===c)continue;const f=n.get(a),d=n.get(c);if(null==f||null==d)continue;const[l,u]=f<=d?[a,c]:[c,a],h=`${l}\0${u}`,g=r.get(h);g?g.weight++:r.set(h,{a:l,b:u,weight:1})}return[...r.values()]}function Tn(t,e,n){const o=[...t];let r=On(o,e),s=!0,i=0;const a=Math.max(1,o.length);for(;s&&i<a;){s=!1,i++;for(let t=0;t+1<o.length;t++){[o[t],o[t+1]]=[o[t+1],o[t]];const n=On(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:kn(o,n)}}function $n(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function Nn(t,e,n){const o=[...e].sort((t,e)=>t.a===e.a?t.b.localeCompare(e.b):t.a.localeCompare(e.a)).map(({a:t,b:e,weight:n})=>`${t}:${e}:${n}`).join("|");return vn(`${t.join("|")}#${o}#${n}`)}function Bn(t,e={}){const n=ze(t);if(n.length<2)return n;const o=Rn(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=Tn(n,o,r);const i=Math.max(0,e.restarts??8);for(let t=0;t<i;t++){const e=Tn(Ln(n,Nn(n,o,t)),o,r);$n(e,s)&&(s=e)}return s.order}function Fn(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=ve(t),s=e?.automaticLaneOrdering?Bn(r,{restarts:8}):void 0,i=Ee(r),a=i.acyclic,c=n?hn(a,{compactSingleInput:e?.compactSingleInput??Ge,ignoreCrossLaneEdges:!0,direction:e?.direction}):ln(a,{compactSingleInput:e?.compactSingleInput??Ge,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=gn(c,a),l=Sn(f,d,{laneOrder:s}),u=wn(l,d,{layerGap:e?.layerGap,nodeGap:e?.nodeGap,direction:e?.direction,laneOrder:s});return{acyclic:a,reversed:i.reversed,layering:f,ordered:l,coordinates:u}}(0,i.K)(vn,"hashString"),(0,i.K)(Cn,"mulberry32"),(0,i.K)(Ln,"deterministicShuffle"),(0,i.K)(kn,"sourceDistance"),(0,i.K)(On,"laneArrangementCost"),(0,i.K)(Rn,"buildWeightedLaneEdges"),(0,i.K)(Tn,"greedySwitch"),(0,i.K)($n,"isBetterCandidate"),(0,i.K)(Nn,"seedForRestart"),(0,i.K)(Bn,"optimizeTopLaneOrder"),(0,i.K)(Fn,"sugiyamaLayout");var En=1e-6,Yn=15,Xn=15,zn=20;function An(t,e,n){const o=t.x??0,r=t.y??0,s=e.x-o,i=e.y-r,a=Math.abs(s),c=Math.abs(i);if(a<En&&c<En)return n;return c>En&&3*c>=a?i>0?"bottom":"top":a>En?s>0?"right":"left":n}function Pn(t,e){return Math.abs(t.to-e.from)<En||Math.abs(t.to-e.to)<En?t.to:t.from}function Dn(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function Gn(t,e){const n=t.nodes??[],o=t.edges??[],r=[];for(const t of o)t.isLayoutOnly||r.push({...t,__originalEdge:t});const s=new Map,a=new Map,c=[],f="LR"===e;for(const t of n)s.set(t.id,t);const d=n.filter(t=>t.isGroup&&!t.parentId);for(const t of d){const e={id:t.id},o=(0,i.K)(t=>{a.set(t.id,e),n.filter(e=>e.parentId===t.id).forEach(o)},"assignLane");o(t)}const l=n.filter(t=>!t.isGroup&&!t.isEdgeLabel).map(t=>{const e=t.width??10,n=t.height??10,o=t.x??0,r=t.y??0;return{nodeId:t.id,minX:o-e/2-8,maxX:o+e/2+8,minY:r-n/2-8,maxY:r+n/2+8,visualXHalfExtent:f?n/2+8:e/2+8}}),u=(0,i.K)((t,e,n,o)=>{let r=c.find(n=>n.orientation===t&&Math.abs(n.coord-e)<1);return r||(r={id:`pipe-${t}-${e.toFixed(0)}`,orientation:t,coord:e,spanMin:n,spanMax:o,tracks:[]},c.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),h=(0,i.K)((t,e)=>{const n=t.width??10,o=t.height??10,r=t.x??0,s=t.y??0;switch(e){case"top":return{x:r,y:s-o/2};case"bottom":return{x:r,y:s+o/2};case"left":return{x:r-n/2,y:s};case"right":return{x:r+n/2,y:s}}},"portForSide"),g=(0,i.K)((t,e,n)=>h(t,An(t,e,n?"bottom":"top")),"getOrthogonalPort"),p=[],x=[],m=new Set,y=(0,i.K)((t,e,n)=>{if(0===p.length)return 0;const o=Math.abs(e.y-n.y)<En,r=Math.abs(e.x-n.x)<En;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-En,i=Math.max(e.x,n.x)+En;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"vertical"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-En<=o&&e.to+En>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-En,i=Math.max(e.y,n.y)+En;if(i<=r)return 0;for(const e of p)e.edgeIndex!==t&&"horizontal"===e.orientation&&(e.pipe.coord<r||e.pipe.coord>i||e.from-En<=o&&e.to+En>=o&&(s+=1e3))}return s},"crossingPenalty"),b=r.map((t,e)=>{if(!t.start||!t.end)return{idx:e,crossLane:0,dx:0,dy:0};const n=s.get(t.start),o=s.get(t.end),r=a.get(t.start),i=a.get(t.end);return{idx:e,crossLane:r&&i&&r.id!==i.id?1:0,dx:n&&o?Math.abs((o.x??0)-(n.x??0)):0,dy:n&&o?Math.abs((o.y??0)-(n.y??0)):0}}).sort((t,e)=>{if(t.crossLane!==e.crossLane)return e.crossLane-t.crossLane;const n=t.dx+t.dy,o=e.dx+e.dy;return Math.abs(n-o)>1?n-o:t.idx-e.idx}).map(t=>t.idx),M=(0,i.K)((t,e,n,o)=>{const r=Math.min(t.x,e.x),s=Math.max(t.x,e.x),i=Math.min(t.y,e.y),a=Math.max(t.y,e.y);return!!l.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>En?c.minY<t.y&&c.maxY>t.y&&c.maxX>r&&c.minX<s:c.minX<t.x&&c.maxX>t.x&&c.maxY>i&&c.minY<a)))},"isSegmentBlocked"),K=new Map,I=new Map;for(const t of r)t.start&&t.end&&t.start!==t.end&&(I.set(t.start,(I.get(t.start)??0)+1),I.set(t.end,(I.get(t.end)??0)+1));const S=(0,i.K)((t,e)=>An(t,e,"bottom"),"determineSide"),w=new Map;for(const[t,e]of r.entries()){if(!e.start||!e.end||e.start===e.end)continue;if(e.points&&e.points.length>0)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const r=(o.x??0)-(n.x??0),i=(o.y??0)-(n.y??0);w.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:S(n,{x:o.x??0,y:o.y??0}),dstSide:S(o,{x:n.x??0,y:n.y??0}),absDx:Math.abs(r),absDy:Math.abs(i),dxSign:Math.sign(r),dySign:Math.sign(i)})}const v=(0,i.K)(t=>"top"===t.srcSide||"bottom"===t.srcSide?0===t.absDx?1/0:t.absDy/t.absDx:0===t.absDy?1/0:t.absDx/t.absDy,"preferenceStrength"),C=(0,i.K)(t=>"top"===t.srcSide||"bottom"===t.srcSide?t.dxSign>=0?"right":"left":t.dySign>=0?"bottom":"top","secondarySide"),L=new Map;for(const t of w.values()){const e=`${t.srcId}:${t.srcSide}`;L.has(e)||L.set(e,[]),L.get(e).push(t)}const k=new Map,O=(0,i.K)((t,e)=>`${t}:${e}`,"loadKey");for(const t of w.values())k.set(O(t.srcId,t.srcSide),(k.get(O(t.srcId,t.srcSide))??0)+1),k.set(O(t.dstId,t.dstSide),(k.get(O(t.dstId,t.dstSide))??0)+1);for(const t of L.values())if(!(t.length<2)){t.sort((t,e)=>{const n=v(t),o=v(e);return Math.abs(n-o)>1e-9?o-n:t.edgeIdx-e.edgeIdx});for(let e=1;e<t.length;e++){const n=t[e],o=C(n),r=k.get(O(n.srcId,n.srcSide))??0,s=k.get(O(n.srcId,o))??0;s>=r||(k.set(O(n.srcId,n.srcSide),r-1),k.set(O(n.srcId,o),s+1),n.srcSide=o)}}const R=(0,i.K)(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),T=new Map;for(const t of w.values())T.has(t.dstId)||T.set(t.dstId,new Set),T.get(t.dstId).add(t.dstSide);for(const t of w.values()){if(!R(s.get(t.srcId)))continue;const e=T.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=C(t);if(e.has(n)||(k.get(O(t.srcId,n))??0)>0)continue;const o=k.get(O(t.srcId,t.srcSide))??0;k.set(O(t.srcId,t.srcSide),Math.max(0,o-1)),k.set(O(t.srcId,n),1),t.srcSide=n}for(const t of w.values()){const{edgeIdx:e,srcId:n,dstId:o,srcSide:r,dstSide:i}=t,a=s.get(n),c=s.get(o),f=`${n}:${r}:src`,d="top"===r||"bottom"===r?c.x??0:c.y??0;K.has(f)||K.set(f,[]),K.get(f).push({edgeIdx:e,oppositeCoord:d});const l=`${o}:${i}:dst`,u="top"===i||"bottom"===i?a.x??0:a.y??0;K.has(l)||K.set(l,[]),K.get(l).push({edgeIdx:e,oppositeCoord:u})}const $=new Map;for(const[t,e]of K){if(e.length<2)continue;e.sort((t,e)=>t.oppositeCoord-e.oppositeCoord);const n=t.split(":"),o=n.slice(0,-2).join(":"),r=n[n.length-2],i=n[n.length-1],a=s.get(o);if(!a)continue;const c="left"===r||"right"===r?a.height??10:a.width??10,f=a.shape,d="question"===f||"diamond"===f?.3*c:c,l=20,u=Math.min(l,Math.max(8,d/(e.length+1))),h=-(u*(e.length-1))/2;for(const[t,n]of e.entries()){const e=h+t*u,o=`${n.edgeIdx}:${i}`;$.set(o,e)}}const N=(0,i.K)(t=>Boolean(r[t]?.labelNodeId),"edgeHasLabelNode"),B=(0,i.K)((t,e)=>!!t&&((K.get(`${t}:${e}:src`)??[]).some(({edgeIdx:t})=>N(t))||(K.get(`${t}:${e}:dst`)??[]).some(({edgeIdx:t})=>N(t))),"faceHasLabelNode"),F=(0,i.K)((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),E=(0,i.K)((t,e,n)=>{const o=w.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},i=o?.srcSide??S(e,r),a=o?.dstSide??S(n,s);let c=o?h(e,o.srcSide):g(e,r,!0),f=o?h(n,o.dstSide):g(n,s,!1);const d=$.get(`${t}:src`),l=$.get(`${t}:dst`);return void 0!==d&&(c=F(c,i,d)),void 0!==l&&(f=F(f,a,l)),{pSrcPort:c,pDstPort:f,srcSide:i,dstSide:a}},"portsForEdge");for(const t of b){const e=r[t];if(x[t]=[],!e.start||!e.end)continue;if(e.points&&e.points.length>0)continue;if(e.start===e.end)continue;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)continue;const{pSrcPort:a,pDstPort:d,srcSide:h,dstSide:g}=E(t,n,o),b={...a},S={...d},w="top"===h||"bottom"===h,v="top"===g||"bottom"===g;if(w){const t=a.y>(n.y??0);b.y=t?a.y+zn:a.y-zn}else{const t=a.x>(n.x??0);b.x=t?a.x+zn:a.x-zn}if(v){const t=d.y>(o.y??0);S.y=t?d.y+zn:d.y-zn}else{const t=d.x>(o.x??0);S.x=t?d.x+zn:d.x-zn}const C=(0,i.K)((t,e)=>{for(const n of l)if(!e.includes(n.nodeId)&&t.x>n.minX&&t.x<n.maxX&&t.y>n.minY&&t.y<n.maxY)return{inside:!0,obstacle:n};return{inside:!1}},"isPointInObstacle"),L=(0,i.K)((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+Yn:o.minX-Yn,y:r?o.maxY+Xn:o.minY-Xn,leavesPositiveSide:r}}const s=t.x>(e.x??0),i=(n.y??0)>=t.y;return{x:s?o.maxX+Yn:o.minX-Yn,y:i?o.maxY+Xn:o.minY-Xn,leavesPositiveSide:s}},"obstacleDetour");let k=[];const O=[e.start,e.end],R=C(b,O);if(R.inside&&R.obstacle){const t=R.obstacle;if(w){const e=L(a,n,o,t,!0);b.x=e.x,b.y=e.y;const r=e.leavesPositiveSide?Math.min(t.minY-2,a.y+zn):Math.max(t.maxY+2,a.y-zn);k=[{x:a.x,y:r},{x:e.x,y:r},{x:e.x,y:e.y}]}else{const e=L(a,n,o,t,!1),r=e.leavesPositiveSide?Math.min(t.minX-2,a.x+zn):Math.max(t.maxX+2,a.x-zn);b.x=e.x,b.y=e.y,k=[{x:r,y:a.y},{x:r,y:e.y},{x:e.x,y:e.y}]}}let T=[];const N=C(S,O);if(N.inside&&N.obstacle){const t=N.obstacle;if(v){const e=L(d,o,n,t,!0);S.x=e.x,S.y=e.y,T=[{x:e.x,y:e.y},{x:d.x,y:e.y}]}else{const e=L(d,o,n,t,!1);S.x=e.x,S.y=e.y,T=[{x:e.x,y:e.y},{x:e.x,y:d.y}]}}if(0===k.length&&0===T.length){const n=Yn,o=Math.abs(b.x-S.x)<n,r=Math.abs(b.y-S.y)<n,s=void 0!==$.get(`${t}:src`)||void 0!==$.get(`${t}:dst`),i=(K.get(`${e.start??""}:${h}:src`)?.length??0)+(K.get(`${e.start??""}:${h}:dst`)?.length??0),c=(K.get(`${e.end??""}:${g}:src`)?.length??0)+(K.get(`${e.end??""}:${g}:dst`)?.length??0),f=i>1||c>1,l=I.get(e.start??"")??0,u=I.get(e.end??"")??0,x=i>1&&B(e.start,h)||c>1&&B(e.end,g);if((o||r)&&!s&&(!f||f&&!x&&(i<=1||l<=2)&&(c<=1||u<=2))){if(!M(a,d,e.start,e.end)){e.points=[{...a},{...b},{...S},{...d}],m.add(t);const n=r?"horizontal":"vertical",o=r?a.y:a.x,s=r?Math.min(a.x,d.x):Math.min(a.y,d.y),i=r?Math.max(a.x,d.x):Math.max(a.y,d.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:i,tracks:[]};p.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:i});continue}}}const F=u("vertical",b.x,b.y,b.y);b.x=F.coord;const Y=u("vertical",S.x,S.y,S.y);S.x=Y.coord;let X=Math.min(b.x,S.x)-50,z=Math.max(b.x,S.x)+50,A=Math.min(b.y,S.y)-50,P=Math.max(b.y,S.y)+50;for(const t of l){const e=Math.min(b.x,S.x),n=Math.max(b.x,S.x),o=Math.min(b.y,S.y),r=Math.max(b.y,S.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(X=Math.min(X,t.minX-25),z=Math.max(z,t.maxX+25),A=Math.min(A,t.minY-25),P=Math.max(P,t.maxY+25))}for(const t of l){if(t.maxX<X||t.minX>z||t.maxY<A||t.minY>P)continue;const e=Yn;u("horizontal",t.minY-e,X,z),u("horizontal",t.maxY+e,X,z);const n=Xn;u("vertical",t.minX-n,A,P),u("vertical",t.maxX+n,A,P)}u("horizontal",b.y,X,z),u("horizontal",S.y,X,z);const D=c.filter(t=>"horizontal"===t.orientation&&t.coord>=A&&t.coord<=P),G=c.filter(t=>"vertical"===t.orientation&&t.coord>=X&&t.coord<=z),H=(0,i.K)((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),j=H(b.x,b.y),V=H(S.x,S.y),_=new Map,W=new Map,q=new Map,J=new Set,Q=[];_.set(j,0),q.set(j,"n"),Q.push({key:j,f:Math.hypot(S.x-b.x,S.y-b.y),pt:b}),J.add(j);let U=[];const Z=(0,i.K)((t,n)=>M(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:S.x,y:b.y},et=Z(b,tt),nt=Z(tt,S),ot=et||nt,rt={x:b.x,y:S.y},st=Z(b,rt),it=Z(rt,S);if(ot?st||it||(U=Math.abs(b.x-S.x)<En?[b,S]:[b,rt,S]):U=Math.abs(b.y-S.y)<En||Math.abs(b.x-S.x)<En?[b,S]:[b,tt,S],0===U.length)for(;Q.length>0;){Q.sort((t,e)=>t.f-e.f);const n=Q.shift();if(J.delete(n.key),n.key===V){let t=V,e=S;for(U=[e];W.has(t);){const n=W.get(t);U.unshift(n),e=n,t=H(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=G.sort((t,e)=>t.coord-e.coord),i=s.findIndex(t=>Math.abs(t.coord-o)<1),a=D.sort((t,e)=>t.coord-e.coord),c=a.findIndex(t=>Math.abs(t.coord-r)<1),f=[];i>0&&f.push({x:s[i-1].coord,y:r}),i>=0&&i<s.length-1&&f.push({x:s[i+1].coord,y:r}),c>0&&f.push({x:o,y:a[c-1].coord}),c>=0&&c<a.length-1&&f.push({x:o,y:a[c+1].coord});for(const s of f){const i=Math.min(o,s.x),a=Math.max(o,s.x),c=Math.min(r,s.y),f=Math.max(r,s.y);if(l.some(t=>t.nodeId!==e.start&&t.nodeId!==e.end&&(i!==a?t.minY<r&&t.maxY>r&&t.maxX>i&&t.minX<a:t.minX<o&&t.maxX>o&&t.maxY>c&&t.minY<f)))continue;const d=H(s.x,s.y),u=Math.abs(s.x-o)+Math.abs(s.y-r),h=y(t,n.pt,s);let g=0;const p=S.x-b.x,x=S.y-b.y,m=s.x-o,M=s.y-r;(x>10&&M<-5||x<-10&&M>5)&&(g=100*Math.abs(M)),(p>10&&m<-5||p<-10&&m>5)&&(g+=50*Math.abs(m));let K=0;const I=q.get(n.key)??"n",w=Math.abs(m)>En?"h":"v";"n"!==I&&I!==w&&(K=50);const v=u+h+g+K,C=(_.get(n.key)??1/0)+v,L=Math.abs(S.x-s.x)+Math.abs(S.y-s.y);if(C<(_.get(d)??1/0))if(W.set(d,n.pt),_.set(d,C),q.set(d,w),J.has(d)){const t=Q.findIndex(t=>t.key===d);-1!==t&&(Q[t].f=C+L)}else Q.push({key:d,f:C+L,pt:s}),J.add(d)}}if(0===U.length&&(U=[b,{x:b.x,y:S.y},S]),U.length>4){const t=U[0],e=U[U.length-1];let n=Math.min(t.x,e.x),o=Math.max(t.x,e.x),r=Math.min(t.y,e.y),s=Math.max(t.y,e.y);for(const t of U)n=Math.min(n,t.x),o=Math.max(o,t.x),r=Math.min(r,t.y),s=Math.max(s,t.y);const a=o>Math.max(t.x,e.x),c=n<Math.min(t.x,e.x);if(f){const r=Xn;if(a){const n=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y),a=l.filter(t=>t.minX<n&&t.maxX>n&&t.minY<i&&t.maxY>s);if(a.length>0){let n=Math.max(t.x,e.x);for(const t of a){const e=(t.minX+t.maxX)/2;if(void 0===t.visualXHalfExtent||isNaN(t.visualXHalfExtent))continue;const o=e+t.visualXHalfExtent+r;n=Math.max(n,o)}isNaN(n)||(o=n)}}if(c){const o=l.filter(n=>n.minX<Math.min(t.x,e.x)+r&&n.minY<Math.max(t.y,e.y)&&n.maxY>Math.min(t.y,e.y));if(o.length>0){let s=Math.min(t.x,e.x);for(const t of o){const e=(t.minX+t.maxX)/2-t.visualXHalfExtent-r;s=Math.min(s,e)}n=s}}}const d=(0,i.K)(n=>{const o=e.y>t.y,r=l.filter(n=>{const o=Math.min(t.x,e.x)<n.maxX&&Math.max(t.x,e.x)>n.minX,r=Math.min(t.y,e.y)<n.maxY&&Math.max(t.y,e.y)>n.minY;return o&&r});let s=r;if(f&&r.length>0){const t=r.filter(t=>t.minX<n&&t.maxX>n);t.length>0&&(s=t)}if(0===s.length)return e.y;if(o){const t=Math.max(...s.map(t=>t.maxY))+15;if(t<e.y-En)return t}else{const t=Math.min(...s.map(t=>t.minY))-15;if(t>e.y+En)return t}return e.y},"findBestReturnY"),u=(0,i.K)(n=>{const o=d(n),r={x:n,y:t.y},s={x:n,y:o},i={x:e.x,y:o},a=Z(t,r),c=Z(r,s),f=Z(s,i),l=o!==e.y&&Z(i,e);return a||c||f||l?null:Math.abs(o-e.y)<En?[t,r,s,e]:[t,r,s,i,e]},"trySimplifyWithDetourX"),h=a&&!c?u(o):c&&!a?u(n):null;h&&(U=h)}const at=[a,...k,...U,...T.reverse(),d];if(at.length>=3){const t=at[at.length-1],e=at[at.length-2],n=at[at.length-3],o=Math.abs(n.y-e.y)<En&&Math.abs(e.y-t.y)<En,r=Math.abs(n.x-e.x)<En&&Math.abs(e.x-t.x)<En;if(o){const o=Math.sign(e.x-n.x),r=Math.sign(t.x-n.x);0!==o&&o===r&&Math.abs(e.x-n.x)>Math.abs(t.x-n.x)&&at.splice(-2,1)}else if(r){const o=Math.sign(e.y-n.y),r=Math.sign(t.y-n.y);0!==o&&o===r&&Math.abs(e.y-n.y)>Math.abs(t.y-n.y)&&at.splice(-2,1)}}const ct=[at[0]];for(let t=1;t<at.length-1;t++){if(1===t){ct.push(at[t]);continue}const e=ct[ct.length-1],n=at[t],o=at[t+1];if(Math.abs(e.y-n.y)<En&&Math.abs(n.y-o.y)<En){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<En&&Math.abs(n.x-o.x)<En){if(n.y>e.y!==o.y>n.y){ct.push(n);continue}continue}ct.push(n)}ct.push(at[at.length-1]);for(let e=0;e<ct.length-1;e++){const n=ct[e],o=ct[e+1],r=Math.abs(n.x-o.x)<En?"vertical":"horizontal",s="vertical"===r?n.x:n.y,i="vertical"===r?Math.min(n.y,o.y):Math.min(n.x,o.x),a="vertical"===r?Math.max(n.y,o.y):Math.max(n.x,o.x),c=u(r,s,i,a),f={edgeIndex:t,segmentIndex:e,orientation:r,pipe:c,trackIndex:0,from:i,to:a};p.push(f),x[t].push(p.length-1),c.tracks[0]||(c.tracks[0]={index:0,coord:c.coord,segments:[]}),c.tracks[0].segments.push({edgeIndex:t,segmentIndex:e,from:i,to:a})}}const Y=(0,i.K)((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),X=(0,i.K)((t,e,n,o)=>{const r=!o.segments.some(n=>(n.edgeIndex!==e.edgeIndex||n.segmentIndex!==e.segmentIndex)&&Y(n,t)),s=!n.segments.some(n=>(n.edgeIndex!==t.edgeIndex||n.segmentIndex!==t.segmentIndex)&&Y(n,e));return!(!r||!s)&&(t.trackIndex=o.index,e.trackIndex=n.index,n.segments=[...n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),{edgeIndex:e.edgeIndex,segmentIndex:e.segmentIndex,from:e.from,to:e.to}],o.segments=[...o.segments.filter(t=>t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex),{edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to}],!0)},"trySwapSegmentsAcrossTracks"),z=(0,i.K)(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),A=(0,i.K)((t,e)=>{const n=t.pipe.tracks[t.trackIndex];n.segments=n.segments.filter(e=>e.edgeIndex!==t.edgeIndex||e.segmentIndex!==t.segmentIndex),t.trackIndex=e;t.pipe.tracks[e].segments.push({edgeIndex:t.edgeIndex,segmentIndex:t.segmentIndex,from:t.from,to:t.to})},"moveSegmentToTrack"),P=(0,i.K)((t,e)=>{const n=x[t.edgeIndex];for(const o of n){const n=p[o];n.pipe===t.pipe&&A(n,e)}},"moveSegmentChainToTrack"),D=(0,i.K)(t=>{const e=x[t.edgeIndex],n=e.indexOf(p.indexOf(t)),o=[];return n>0&&o.push(p[e[n-1]]),n<e.length-1&&o.push(p[e[n+1]]),o},"getAdjacentSegmentsAlongEdge"),G=(0,i.K)((t,e)=>{if(t.orientation===e.orientation)return!1;const n="horizontal"===t.orientation?t:e,o="horizontal"===t.orientation?e:t;return o.pipe.coord>n.from&&o.pipe.coord<n.to&&n.pipe.coord>o.from&&n.pipe.coord<o.to},"haveAnyCrossing"),H=(0,i.K)((t,e)=>{for(const n of t.tracks){if(!n.segments.some(t=>(t.edgeIndex!==e.edgeIndex||t.segmentIndex!==e.segmentIndex)&&Y(t,e)))return n.index}return-1},"findAvailableTrack"),j=(0,i.K)((t,e)=>{if(t.trackIndex===e.trackIndex)return Y(t,e);const n=D(t),o=D(e);return n.some(t=>o.some(e=>G(t,e)))},"segmentsConflict"),V=(0,i.K)((t,e,n)=>{if(X(t,e,t.pipe.tracks[t.trackIndex],e.pipe.tracks[e.trackIndex]))return;const o=H(t.pipe,e);n(e,-1!==o?o:z(t.pipe))},"resolveTrackConflict"),_=(0,i.K)(t=>{let e=0;for(let n=0;n<t.length;n++)for(let o=n+1;o<t.length;o++){const r=t[n],s=t[o];r.pipe===s.pipe&&(j(r,s)&&(e++,V(r,s,P)))}return e},"resolveHandleConflicts"),W=new Map,q=(0,i.K)(t=>{if(W.has(t))return W.get(t);const e=x[t];if(0===e.length){const e={dest:0,deviation:0,base:0,delta:0};return W.set(t,e),e}const n=p[e[0]].pipe.coord;let o=n;for(let t=1;t<e.length;t++){const r=p[e[t]];if("horizontal"===r.orientation){const t=r.from,e=r.to;o=Math.abs(t-n)>Math.abs(e-n)?t:e;break}}const r={dest:o,deviation:Math.abs(o-n),base:n,delta:o-n};return W.set(t,r),r},"getDestInfo"),J=(0,i.K)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries())0!==x[t].length&&n.start&&(e.has(n.start)||e.set(n.start,[]),e.get(n.start).push(t));const n=(0,i.K)(t=>{const e=r[t];if(!e.start||!e.end)return 0;const n=s.get(e.start),o=s.get(e.end);if(!n||!o)return 0;const i=(o.x??0)-(n.x??0),a=(o.y??0)-(n.y??0);return Math.abs(i)+Math.abs(a)},"getEdgeDistance");for(const o of e.values()){o.sort((t,e)=>{const o=q(t),r=q(e);if(Math.abs(o.deviation-r.deviation)>1)return o.deviation-r.deviation;if(Math.abs(o.dest-r.dest)>1)return o.dest-r.dest;const s=n(t),i=n(e);if(Math.abs(s-i)>1)return i-s;const a=x[t].length,c=x[e].length;if(a!==c)return a-c;if(1===a){const n=x[t][0],o=x[e][0];if(p[n]&&p[o]){const t=p[n],e=p[o],r=Math.abs(t.to-t.from),s=Math.abs(e.to-e.from);if(Math.abs(r-s)>1)return r-s}}return 0});const e=o.map(t=>p[x[t][0]]);t+=_(e)}return t},"fixSourceHandleCrossings"),Q=(0,i.K)(()=>{let t=0;const e=new Map;for(const[t,n]of r.entries()){0!==x[t].length&&(n.end&&(e.has(n.end)||e.set(n.end,[]),e.get(n.end).push(t)))}for(const n of e.values()){n.sort((t,e)=>{const n=(0,i.K)(t=>{const e=x[t];if(e.length<2)return 0;const n=p[e[e.length-2]];return Math.abs(n.to-n.from)},"getDist"),o=n(t),r=n(e);return Math.abs(o-r)>.1?o-r:t-e});const e=n.map(t=>p[x[t][x[t].length-1]]);t+=_(e)}return t},"fixTargetHandleCrossings"),U=(0,i.K)(()=>{let t=0;for(const e of c){const n=[];for(const t of e.tracks)for(const e of t.segments){const t=x[e.edgeIndex].find(t=>p[t].segmentIndex===e.segmentIndex);void 0!==t&&n.push(p[t])}n.sort((t,e)=>t.edgeIndex-e.edgeIndex||t.segmentIndex-e.segmentIndex);for(let e=0;e<n.length;e++)for(let o=e+1;o<n.length;o++){const r=n[e],s=n[o];j(r,s)&&(t++,V(r,s,A))}}return t},"fixPipeCrossings");let Z=0;for(;Z<10;){let t=0;if(t+=J(),t+=Q(),t+=U(),0===t)break;Z++}const tt=new Map;for(const t of c){const e=[];t.tracks.forEach(t=>{t.segments.forEach(n=>{e.push({edgeIndex:n.edgeIndex,segmentIndex:n.segmentIndex,trackIndex:t.index,from:n.from,to:n.to})})}),e.sort((t,e)=>t.from-e.from);const n=[];if(e.length>0){let t=[e[0]],o=e[0].to;for(let r=1;r<e.length;r++){const s=e[r];s.from<o?(t.push(s),o=Math.max(o,s.to)):(n.push(t),t=[s],o=s.to)}n.push(t)}for(const e of n){const n=new Set;e.forEach(t=>n.add(t.trackIndex));const o=new Map;e.forEach(t=>{const e=q(t.edgeIndex);o.set(t.trackIndex,(o.get(t.trackIndex)??0)+e.delta)});const r=[...n].filter(t=>(o.get(t)??0)<-1),s=[...n].filter(t=>(o.get(t)??0)>1),a=[...n].filter(t=>Math.abs(o.get(t)??0)<=1);r.sort((t,e)=>(o.get(e)??0)-(o.get(t)??0)),s.sort((t,e)=>(o.get(t)??0)-(o.get(e)??0));const c=(0,i.K)((n,o)=>{e.filter(t=>t.trackIndex===n).forEach(e=>{const n=m.has(e.edgeIndex)?t.coord:o;tt.set(`${e.edgeIndex}-${e.segmentIndex}`,n)})},"assignCoord");let f=0;for(const e of r)f++,c(e,t.coord-10*f);if(0===a.length&&n.size>0){const t=[...n].sort((t,e)=>Math.abs(o.get(t)??0)-Math.abs(o.get(e)??0))[0],e=r.indexOf(t);-1!==e&&r.splice(e,1);const i=s.indexOf(t);-1!==i&&s.splice(i,1),a.push(t)}let d=0;for(const e of a){if(0===d)c(e,t.coord);else{const n=d%2==1?1:-1,o=Math.ceil(d/2);c(e,t.coord+n*o*10*.5)}d++}let l=0;for(const e of s)l++,c(e,t.coord+10*l)}}for(const[t,e]of r.entries()){const n=x[t]??[];if(0===n.length)continue;const o=[],r=s.get(e.start),i=s.get(e.end),{pSrcPort:a,pDstPort:c}=E(t,r,i),f=n.map(t=>{const e=p[t],n=tt.get(`${e.edgeIndex}-${e.segmentIndex}`)??e.pipe.coord;return{orient:e.orientation,coord:n,from:e.from,to:e.to}});o.push(a);for(let t=0;t<f.length;t++){const e=f[t],n=o[o.length-1],r="vertical"===e.orient?n.y:n.x,s="vertical"===e.orient?n.x:n.y,i=f[t+1],a=t<f.length-1;if(Math.abs(s-e.coord)>En&&o.push(Dn(e,r)),a&&i.orient===e.orient)if(Math.abs(e.coord-i.coord)>En){const t="vertical"===e.orient?(r+i.from)/2:Pn(e,i);o.push(Dn(e,t),Dn(i,t))}else 0!==t&&t!==f.length-2||o.push(Dn(e,Pn(e,i)));else if(a)o.push(Dn(e,i.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(Dn(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>En||Math.abs(d.y-c.y)>En)&&o.push(c);const l=[];o.length>0&&l.push(o[0]);for(let t=1;t<o.length;t++){const e=o[t],n=l[l.length-1];(Math.abs(e.x-n.x)>En||Math.abs(e.y-n.y)>En)&&l.push(e)}e.points=l}for(const t of r){const e=t.__originalEdge;e&&t.points&&(e.points=t.points)}t.edges=(t.edges??[]).filter(t=>!t.isLayoutOnly);const et=(0,i.K)((t,e)=>{const n=e.x??0,o=e.y??0,r=e.width??0,s=e.height??0;if(r<=0||s<=0)return t;const i=n-r/2,a=n+r/2,c=o-s/2,f=o+s/2;if(t.x<i||t.x>a||t.y<c||t.y>f)return t;const d=t.x-i,l=a-t.x,u=t.y-c,h=f-t.y,g=Math.min(d,l,u,h);return g===d?{x:i,y:t.y}:g===l?{x:a,y:t.y}:g===u?{x:t.x,y:c}:{x:t.x,y:f}},"nodeBoundaryClamp");for(const e of t.edges){const t=e.points;if(!t||t.length<2)continue;const n=e.start,o=e.end,r=n?s.get(n):void 0,i=o?s.get(o):void 0;r&&(t[0]=et(t[0],r)),i&&(t[t.length-1]=et(t[t.length-1],i))}return t}function Hn(t){return t.direction??"TB"}function jn(t){const e=O(t),n=t.config.flowchart?.nodeSpacing??40,o=t.config.flowchart?.rankSpacing??100,r=t.config.swimlane?.ignoreCrossLaneEdges??!0,s=t.config.swimlane?.optimizeRanksByCrossings??!0,i=t.config.swimlane?.automaticLaneOrdering??!1,a=Hn(t),{ordered:c,coordinates:f}=Fn(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:i,direction:a});R(e,c,f,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;Gn(t,a);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return we(t,a),Se(t),a}function Vn(t){k(t);const e=T(t);t.nodes=e.nodes,t.edges=e.edges}(0,i.K)(An,"chooseOrthogonalSide"),(0,i.K)(Pn,"sharedLineEndpointCoord"),(0,i.K)(Dn,"pointOnLine"),(0,i.K)(Gn,"routeEdgesOrthogonal"),(0,i.K)(Hn,"getSwimlaneDirection"),(0,i.K)(jn,"runSwimlaneLayoutCore"),(0,i.K)(Vn,"prepareSwimlaneLayout");var _n=(0,o.xY)({prepareLayout:Vn,runLayoutCore:jn,afterPaint:w})}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7834],{87834(t,e,n){n.d(e,{diagram:()=>Ht});var s=n(338),r=n(48159),a=(n(44505),n(69793),n(43287),n(12505)),i=n(86535),o=n(31293),l=n(86827),h=n(51444),d=function(){var t=(0,l.K)(function(t,e,n,s){for(n=n||{},s=t.length;s--;n[t[s]]=e);return n},"o"),e=[1,24],n=[1,25],s=[1,26],r=[1,27],a=[1,28],i=[1,63],o=[1,64],h=[1,65],d=[1,66],u=[1,67],p=[1,68],y=[1,69],b=[1,29],f=[1,30],_=[1,31],g=[1,32],m=[1,33],x=[1,34],E=[1,35],S=[1,36],C=[1,37],k=[1,38],T=[1,39],w=[1,40],R=[1,41],v=[1,42],O=[1,43],P=[1,44],D=[1,45],N=[1,46],A=[1,47],K=[1,48],L=[1,50],I=[1,51],M=[1,52],$=[1,53],B=[1,54],j=[1,55],Y=[1,56],U=[1,57],F=[1,58],z=[1,59],X=[1,60],q=[14,42],W=[14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],H=[12,14,34,36,37,38,39,40,41,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],Q=[1,82],V=[1,83],G=[1,84],Z=[1,85],J=[12,14,42],tt=[12,14,33,42],et=[12,14,33,42,76,77,79,80],nt=[12,33],st=[34,36,37,38,39,40,41,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74],rt={trace:(0,l.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,mermaidDoc:4,direction:5,direction_tb:6,direction_bt:7,direction_rl:8,direction_lr:9,graphConfig:10,C4_CONTEXT:11,NEWLINE:12,statements:13,EOF:14,C4_CONTAINER:15,C4_COMPONENT:16,C4_DYNAMIC:17,C4_DEPLOYMENT:18,otherStatements:19,diagramStatements:20,otherStatement:21,title:22,accDescription:23,acc_title:24,acc_title_value:25,acc_descr:26,acc_descr_value:27,acc_descr_multiline_value:28,boundaryStatement:29,boundaryStartStatement:30,boundaryStopStatement:31,boundaryStart:32,LBRACE:33,ENTERPRISE_BOUNDARY:34,attributes:35,SYSTEM_BOUNDARY:36,BOUNDARY:37,CONTAINER_BOUNDARY:38,NODE:39,NODE_L:40,NODE_R:41,RBRACE:42,diagramStatement:43,PERSON:44,PERSON_EXT:45,SYSTEM:46,SYSTEM_DB:47,SYSTEM_QUEUE:48,SYSTEM_EXT:49,SYSTEM_EXT_DB:50,SYSTEM_EXT_QUEUE:51,CONTAINER:52,CONTAINER_DB:53,CONTAINER_QUEUE:54,CONTAINER_EXT:55,CONTAINER_EXT_DB:56,CONTAINER_EXT_QUEUE:57,COMPONENT:58,COMPONENT_DB:59,COMPONENT_QUEUE:60,COMPONENT_EXT:61,COMPONENT_EXT_DB:62,COMPONENT_EXT_QUEUE:63,REL:64,BIREL:65,REL_U:66,REL_D:67,REL_L:68,REL_R:69,REL_B:70,REL_INDEX:71,UPDATE_EL_STYLE:72,UPDATE_REL_STYLE:73,UPDATE_LAYOUT_CONFIG:74,attribute:75,STR:76,STR_KEY:77,STR_VALUE:78,ATTRIBUTE:79,ATTRIBUTE_EMPTY:80,$accept:0,$end:1},terminals_:{2:"error",6:"direction_tb",7:"direction_bt",8:"direction_rl",9:"direction_lr",11:"C4_CONTEXT",12:"NEWLINE",14:"EOF",15:"C4_CONTAINER",16:"C4_COMPONENT",17:"C4_DYNAMIC",18:"C4_DEPLOYMENT",22:"title",23:"accDescription",24:"acc_title",25:"acc_title_value",26:"acc_descr",27:"acc_descr_value",28:"acc_descr_multiline_value",33:"LBRACE",34:"ENTERPRISE_BOUNDARY",36:"SYSTEM_BOUNDARY",37:"BOUNDARY",38:"CONTAINER_BOUNDARY",39:"NODE",40:"NODE_L",41:"NODE_R",42:"RBRACE",44:"PERSON",45:"PERSON_EXT",46:"SYSTEM",47:"SYSTEM_DB",48:"SYSTEM_QUEUE",49:"SYSTEM_EXT",50:"SYSTEM_EXT_DB",51:"SYSTEM_EXT_QUEUE",52:"CONTAINER",53:"CONTAINER_DB",54:"CONTAINER_QUEUE",55:"CONTAINER_EXT",56:"CONTAINER_EXT_DB",57:"CONTAINER_EXT_QUEUE",58:"COMPONENT",59:"COMPONENT_DB",60:"COMPONENT_QUEUE",61:"COMPONENT_EXT",62:"COMPONENT_EXT_DB",63:"COMPONENT_EXT_QUEUE",64:"REL",65:"BIREL",66:"REL_U",67:"REL_D",68:"REL_L",69:"REL_R",70:"REL_B",71:"REL_INDEX",72:"UPDATE_EL_STYLE",73:"UPDATE_REL_STYLE",74:"UPDATE_LAYOUT_CONFIG",76:"STR",77:"STR_KEY",78:"STR_VALUE",79:"ATTRIBUTE",80:"ATTRIBUTE_EMPTY"},productions_:[0,[3,1],[3,1],[5,1],[5,1],[5,1],[5,1],[4,1],[10,4],[10,4],[10,4],[10,4],[10,4],[13,1],[13,1],[13,2],[19,1],[19,2],[19,3],[21,1],[21,1],[21,2],[21,2],[21,1],[29,3],[30,3],[30,3],[30,4],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[32,2],[31,1],[20,1],[20,2],[20,3],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,1],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[43,2],[35,1],[35,2],[75,1],[75,2],[75,1],[75,1]],performAction:(0,l.K)(function(t,e,n,s,r,a,i){var o=a.length-1;switch(r){case 3:s.setDirection("TB");break;case 4:s.setDirection("BT");break;case 5:s.setDirection("RL");break;case 6:s.setDirection("LR");break;case 8:case 9:case 10:case 11:case 12:s.setC4Type(a[o-3]);break;case 19:s.setTitle(a[o].substring(6)),this.$=a[o].substring(6);break;case 20:s.setAccDescription(a[o].substring(15)),this.$=a[o].substring(15);break;case 21:this.$=a[o].trim(),s.setTitle(this.$);break;case 22:case 23:this.$=a[o].trim(),s.setAccDescription(this.$);break;case 28:a[o].splice(2,0,"ENTERPRISE"),s.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 29:a[o].splice(2,0,"SYSTEM"),s.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 30:s.addPersonOrSystemBoundary(...a[o]),this.$=a[o];break;case 31:a[o].splice(2,0,"CONTAINER"),s.addContainerBoundary(...a[o]),this.$=a[o];break;case 32:s.addDeploymentNode("node",...a[o]),this.$=a[o];break;case 33:s.addDeploymentNode("nodeL",...a[o]),this.$=a[o];break;case 34:s.addDeploymentNode("nodeR",...a[o]),this.$=a[o];break;case 35:s.popBoundaryParseStack();break;case 39:s.addPersonOrSystem("person",...a[o]),this.$=a[o];break;case 40:s.addPersonOrSystem("external_person",...a[o]),this.$=a[o];break;case 41:s.addPersonOrSystem("system",...a[o]),this.$=a[o];break;case 42:s.addPersonOrSystem("system_db",...a[o]),this.$=a[o];break;case 43:s.addPersonOrSystem("system_queue",...a[o]),this.$=a[o];break;case 44:s.addPersonOrSystem("external_system",...a[o]),this.$=a[o];break;case 45:s.addPersonOrSystem("external_system_db",...a[o]),this.$=a[o];break;case 46:s.addPersonOrSystem("external_system_queue",...a[o]),this.$=a[o];break;case 47:s.addContainer("container",...a[o]),this.$=a[o];break;case 48:s.addContainer("container_db",...a[o]),this.$=a[o];break;case 49:s.addContainer("container_queue",...a[o]),this.$=a[o];break;case 50:s.addContainer("external_container",...a[o]),this.$=a[o];break;case 51:s.addContainer("external_container_db",...a[o]),this.$=a[o];break;case 52:s.addContainer("external_container_queue",...a[o]),this.$=a[o];break;case 53:s.addComponent("component",...a[o]),this.$=a[o];break;case 54:s.addComponent("component_db",...a[o]),this.$=a[o];break;case 55:s.addComponent("component_queue",...a[o]),this.$=a[o];break;case 56:s.addComponent("external_component",...a[o]),this.$=a[o];break;case 57:s.addComponent("external_component_db",...a[o]),this.$=a[o];break;case 58:s.addComponent("external_component_queue",...a[o]),this.$=a[o];break;case 60:s.addRel("rel",...a[o]),this.$=a[o];break;case 61:s.addRel("birel",...a[o]),this.$=a[o];break;case 62:s.addRel("rel_u",...a[o]),this.$=a[o];break;case 63:s.addRel("rel_d",...a[o]),this.$=a[o];break;case 64:s.addRel("rel_l",...a[o]),this.$=a[o];break;case 65:s.addRel("rel_r",...a[o]),this.$=a[o];break;case 66:s.addRel("rel_b",...a[o]),this.$=a[o];break;case 67:a[o].splice(0,1),s.addRel("rel",...a[o]),this.$=a[o];break;case 68:s.updateElStyle("update_el_style",...a[o]),this.$=a[o];break;case 69:s.updateRelStyle("update_rel_style",...a[o]),this.$=a[o];break;case 70:s.updateLayoutConfig("update_layout_config",...a[o]),this.$=a[o];break;case 71:this.$=[a[o]];break;case 72:a[o].unshift(a[o-1]),this.$=a[o];break;case 73:case 75:this.$=a[o].trim();break;case 74:let t={};t[a[o-1].trim()]=a[o].trim(),this.$=t;break;case 76:this.$=""}},"anonymous"),table:[{3:1,4:2,5:3,6:[1,5],7:[1,6],8:[1,7],9:[1,8],10:4,11:[1,9],15:[1,10],16:[1,11],17:[1,12],18:[1,13]},{1:[3]},{1:[2,1]},{1:[2,2]},{1:[2,7]},{1:[2,3]},{1:[2,4]},{1:[2,5]},{1:[2,6]},{12:[1,14]},{12:[1,15]},{12:[1,16]},{12:[1,17]},{12:[1,18]},{13:19,19:20,20:21,21:22,22:e,23:n,24:s,26:r,28:a,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{13:70,19:20,20:21,21:22,22:e,23:n,24:s,26:r,28:a,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{13:71,19:20,20:21,21:22,22:e,23:n,24:s,26:r,28:a,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{13:72,19:20,20:21,21:22,22:e,23:n,24:s,26:r,28:a,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{13:73,19:20,20:21,21:22,22:e,23:n,24:s,26:r,28:a,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{14:[1,74]},t(q,[2,13],{43:23,29:49,30:61,32:62,20:75,34:i,36:o,37:h,38:d,39:u,40:p,41:y,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X}),t(q,[2,14]),t(W,[2,16],{12:[1,76]}),t(q,[2,36],{12:[1,77]}),t(H,[2,19]),t(H,[2,20]),{25:[1,78]},{27:[1,79]},t(H,[2,23]),{35:80,75:81,76:Q,77:V,79:G,80:Z},{35:86,75:81,76:Q,77:V,79:G,80:Z},{35:87,75:81,76:Q,77:V,79:G,80:Z},{35:88,75:81,76:Q,77:V,79:G,80:Z},{35:89,75:81,76:Q,77:V,79:G,80:Z},{35:90,75:81,76:Q,77:V,79:G,80:Z},{35:91,75:81,76:Q,77:V,79:G,80:Z},{35:92,75:81,76:Q,77:V,79:G,80:Z},{35:93,75:81,76:Q,77:V,79:G,80:Z},{35:94,75:81,76:Q,77:V,79:G,80:Z},{35:95,75:81,76:Q,77:V,79:G,80:Z},{35:96,75:81,76:Q,77:V,79:G,80:Z},{35:97,75:81,76:Q,77:V,79:G,80:Z},{35:98,75:81,76:Q,77:V,79:G,80:Z},{35:99,75:81,76:Q,77:V,79:G,80:Z},{35:100,75:81,76:Q,77:V,79:G,80:Z},{35:101,75:81,76:Q,77:V,79:G,80:Z},{35:102,75:81,76:Q,77:V,79:G,80:Z},{35:103,75:81,76:Q,77:V,79:G,80:Z},{35:104,75:81,76:Q,77:V,79:G,80:Z},t(J,[2,59]),{35:105,75:81,76:Q,77:V,79:G,80:Z},{35:106,75:81,76:Q,77:V,79:G,80:Z},{35:107,75:81,76:Q,77:V,79:G,80:Z},{35:108,75:81,76:Q,77:V,79:G,80:Z},{35:109,75:81,76:Q,77:V,79:G,80:Z},{35:110,75:81,76:Q,77:V,79:G,80:Z},{35:111,75:81,76:Q,77:V,79:G,80:Z},{35:112,75:81,76:Q,77:V,79:G,80:Z},{35:113,75:81,76:Q,77:V,79:G,80:Z},{35:114,75:81,76:Q,77:V,79:G,80:Z},{35:115,75:81,76:Q,77:V,79:G,80:Z},{20:116,29:49,30:61,32:62,34:i,36:o,37:h,38:d,39:u,40:p,41:y,43:23,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X},{12:[1,118],33:[1,117]},{35:119,75:81,76:Q,77:V,79:G,80:Z},{35:120,75:81,76:Q,77:V,79:G,80:Z},{35:121,75:81,76:Q,77:V,79:G,80:Z},{35:122,75:81,76:Q,77:V,79:G,80:Z},{35:123,75:81,76:Q,77:V,79:G,80:Z},{35:124,75:81,76:Q,77:V,79:G,80:Z},{35:125,75:81,76:Q,77:V,79:G,80:Z},{14:[1,126]},{14:[1,127]},{14:[1,128]},{14:[1,129]},{1:[2,8]},t(q,[2,15]),t(W,[2,17],{21:22,19:130,22:e,23:n,24:s,26:r,28:a}),t(q,[2,37],{19:20,20:21,21:22,43:23,29:49,30:61,32:62,13:131,22:e,23:n,24:s,26:r,28:a,34:i,36:o,37:h,38:d,39:u,40:p,41:y,44:b,45:f,46:_,47:g,48:m,49:x,50:E,51:S,52:C,53:k,54:T,55:w,56:R,57:v,58:O,59:P,60:D,61:N,62:A,63:K,64:L,65:I,66:M,67:$,68:B,69:j,70:Y,71:U,72:F,73:z,74:X}),t(H,[2,21]),t(H,[2,22]),t(J,[2,39]),t(tt,[2,71],{75:81,35:132,76:Q,77:V,79:G,80:Z}),t(et,[2,73]),{78:[1,133]},t(et,[2,75]),t(et,[2,76]),t(J,[2,40]),t(J,[2,41]),t(J,[2,42]),t(J,[2,43]),t(J,[2,44]),t(J,[2,45]),t(J,[2,46]),t(J,[2,47]),t(J,[2,48]),t(J,[2,49]),t(J,[2,50]),t(J,[2,51]),t(J,[2,52]),t(J,[2,53]),t(J,[2,54]),t(J,[2,55]),t(J,[2,56]),t(J,[2,57]),t(J,[2,58]),t(J,[2,60]),t(J,[2,61]),t(J,[2,62]),t(J,[2,63]),t(J,[2,64]),t(J,[2,65]),t(J,[2,66]),t(J,[2,67]),t(J,[2,68]),t(J,[2,69]),t(J,[2,70]),{31:134,42:[1,135]},{12:[1,136]},{33:[1,137]},t(nt,[2,28]),t(nt,[2,29]),t(nt,[2,30]),t(nt,[2,31]),t(nt,[2,32]),t(nt,[2,33]),t(nt,[2,34]),{1:[2,9]},{1:[2,10]},{1:[2,11]},{1:[2,12]},t(W,[2,18]),t(q,[2,38]),t(tt,[2,72]),t(et,[2,74]),t(J,[2,24]),t(J,[2,35]),t(st,[2,25]),t(st,[2,26],{12:[1,138]}),t(st,[2,27])],defaultActions:{2:[2,1],3:[2,2],4:[2,7],5:[2,3],6:[2,4],7:[2,5],8:[2,6],74:[2,8],126:[2,9],127:[2,10],128:[2,11],129:[2,12]},parseError:(0,l.K)(function(t,e){if(!e.recoverable){var n=new Error(t);throw n.hash=e,n}this.trace(t)},"parseError"),parse:(0,l.K)(function(t){var e=this,n=[0],s=[],r=[null],a=[],i=this.table,o="",c=0,h=0,d=0,u=a.slice.call(arguments,1),p=Object.create(this.lexer),y={yy:{}};for(var b in this.yy)Object.prototype.hasOwnProperty.call(this.yy,b)&&(y.yy[b]=this.yy[b]);p.setInput(t,y.yy),y.yy.lexer=p,y.yy.parser=this,void 0===p.yylloc&&(p.yylloc={});var f=p.yylloc;a.push(f);var _=p.options&&p.options.ranges;function g(){var t;return"number"!=typeof(t=s.pop()||p.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=e.symbols_[t]||t),t}"function"==typeof y.yy.parseError?this.parseError=y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,l.K)(function(t){n.length=n.length-2*t,r.length=r.length-t,a.length=a.length-t},"popStack"),(0,l.K)(g,"lex");for(var m,x,E,S,C,k,T,w,R,v={};;){if(E=n[n.length-1],this.defaultActions[E]?S=this.defaultActions[E]:(null==m&&(m=g()),S=i[E]&&i[E][m]),void 0===S||!S.length||!S[0]){var O="";for(k in R=[],i[E])this.terminals_[k]&&k>2&&R.push("'"+this.terminals_[k]+"'");O=p.showPosition?"Parse error on line "+(c+1)+":\n"+p.showPosition()+"\nExpecting "+R.join(", ")+", got '"+(this.terminals_[m]||m)+"'":"Parse error on line "+(c+1)+": Unexpected "+(1==m?"end of input":"'"+(this.terminals_[m]||m)+"'"),this.parseError(O,{text:p.match,token:this.terminals_[m]||m,line:p.yylineno,loc:f,expected:R})}if(S[0]instanceof Array&&S.length>1)throw new Error("Parse Error: multiple actions possible at state: "+E+", token: "+m);switch(S[0]){case 1:n.push(m),r.push(p.yytext),a.push(p.yylloc),n.push(S[1]),m=null,x?(m=x,x=null):(h=p.yyleng,o=p.yytext,c=p.yylineno,f=p.yylloc,d>0&&d--);break;case 2:if(T=this.productions_[S[1]][1],v.$=r[r.length-T],v._$={first_line:a[a.length-(T||1)].first_line,last_line:a[a.length-1].last_line,first_column:a[a.length-(T||1)].first_column,last_column:a[a.length-1].last_column},_&&(v._$.range=[a[a.length-(T||1)].range[0],a[a.length-1].range[1]]),void 0!==(C=this.performAction.apply(v,[o,h,c,y.yy,S[1],r,a].concat(u))))return C;T&&(n=n.slice(0,-1*T*2),r=r.slice(0,-1*T),a=a.slice(0,-1*T)),n.push(this.productions_[S[1]][0]),r.push(v.$),a.push(v._$),w=i[n[n.length-2]][n[n.length-1]],n.push(w);break;case 3:return!0}}return!0},"parse")},at=function(){return{EOF:1,parseError:(0,l.K)(function(t,e){if(!this.yy.parser)throw new Error(t);this.yy.parser.parseError(t,e)},"parseError"),setInput:(0,l.K)(function(t,e){return this.yy=e||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,l.K)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,l.K)(function(t){var e=t.length,n=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-e),this.offset-=e;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var r=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===s.length?this.yylloc.first_column:0)+s[s.length-n.length].length-n[0].length:this.yylloc.first_column-e},this.options.ranges&&(this.yylloc.range=[r[0],r[0]+this.yyleng-e]),this.yyleng=this.yytext.length,this},"unput"),more:(0,l.K)(function(){return this._more=!0,this},"more"),reject:(0,l.K)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,l.K)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,l.K)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,l.K)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,l.K)(function(){var t=this.pastInput(),e=new Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+e+"^"},"showPosition"),test_match:(0,l.K)(function(t,e){var n,s,r;if(this.options.backtrack_lexer&&(r={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(r.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],n=this.performAction.call(this,this.yy,this,e,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),n)return n;if(this._backtrack){for(var a in r)this[a]=r[a];return!1}return!1},"test_match"),next:(0,l.K)(function(){if(this.done)return this.EOF;var t,e,n,s;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var r=this._currentRules(),a=0;a<r.length;a++)if((n=this._input.match(this.rules[r[a]]))&&(!e||n[0].length>e[0].length)){if(e=n,s=a,this.options.backtrack_lexer){if(!1!==(t=this.test_match(n,r[a])))return t;if(this._backtrack){e=!1;continue}return!1}if(!this.options.flex)break}return e?!1!==(t=this.test_match(e,r[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,l.K)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,l.K)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,l.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,l.K)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,l.K)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,l.K)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,l.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{},performAction:(0,l.K)(function(t,e,n,s){switch(n){case 0:return 6;case 1:return 7;case 2:return 8;case 3:return 9;case 4:return 22;case 5:return 23;case 6:return this.begin("acc_title"),24;case 7:return this.popState(),"acc_title_value";case 8:return this.begin("acc_descr"),26;case 9:return this.popState(),"acc_descr_value";case 10:this.begin("acc_descr_multiline");break;case 11:case 73:this.popState();break;case 12:return"acc_descr_multiline_value";case 13:case 16:case 70:break;case 14:c;break;case 15:return 12;case 17:return 11;case 18:return 15;case 19:return 16;case 20:return 17;case 21:return 18;case 22:return this.begin("person_ext"),45;case 23:return this.begin("person"),44;case 24:return this.begin("system_ext_queue"),51;case 25:return this.begin("system_ext_db"),50;case 26:return this.begin("system_ext"),49;case 27:return this.begin("system_queue"),48;case 28:return this.begin("system_db"),47;case 29:return this.begin("system"),46;case 30:return this.begin("boundary"),37;case 31:return this.begin("enterprise_boundary"),34;case 32:return this.begin("system_boundary"),36;case 33:return this.begin("container_ext_queue"),57;case 34:return this.begin("container_ext_db"),56;case 35:return this.begin("container_ext"),55;case 36:return this.begin("container_queue"),54;case 37:return this.begin("container_db"),53;case 38:return this.begin("container"),52;case 39:return this.begin("container_boundary"),38;case 40:return this.begin("component_ext_queue"),63;case 41:return this.begin("component_ext_db"),62;case 42:return this.begin("component_ext"),61;case 43:return this.begin("component_queue"),60;case 44:return this.begin("component_db"),59;case 45:return this.begin("component"),58;case 46:case 47:return this.begin("node"),39;case 48:return this.begin("node_l"),40;case 49:return this.begin("node_r"),41;case 50:return this.begin("rel"),64;case 51:return this.begin("birel"),65;case 52:case 53:return this.begin("rel_u"),66;case 54:case 55:return this.begin("rel_d"),67;case 56:case 57:return this.begin("rel_l"),68;case 58:case 59:return this.begin("rel_r"),69;case 60:return this.begin("rel_b"),70;case 61:return this.begin("rel_index"),71;case 62:return this.begin("update_el_style"),72;case 63:return this.begin("update_rel_style"),73;case 64:return this.begin("update_layout_config"),74;case 65:return"EOF_IN_STRUCT";case 66:return this.begin("attribute"),"ATTRIBUTE_EMPTY";case 67:this.begin("attribute");break;case 68:case 79:this.popState(),this.popState();break;case 69:case 71:return 80;case 72:this.begin("string");break;case 74:case 80:return"STR";case 75:this.begin("string_kv");break;case 76:return this.begin("string_kv_key"),"STR_KEY";case 77:this.popState(),this.begin("string_kv_value");break;case 78:return"STR_VALUE";case 81:return"LBRACE";case 82:return"RBRACE";case 83:return"SPACE";case 84:return"EOL";case 85:return 14}},"anonymous"),rules:[/^(?:.*direction\s+TB[^\n]*)/,/^(?:.*direction\s+BT[^\n]*)/,/^(?:.*direction\s+RL[^\n]*)/,/^(?:.*direction\s+LR[^\n]*)/,/^(?:title\s[^#\n;]+)/,/^(?:accDescription\s[^#\n;]+)/,/^(?:accTitle\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*:\s*)/,/^(?:(?!\n||)*[^\n]*)/,/^(?:accDescr\s*\{\s*)/,/^(?:[\}])/,/^(?:[^\}]*)/,/^(?:%%(?!\{)*[^\n]*(\r?\n?)+)/,/^(?:%%[^\n]*(\r?\n)*)/,/^(?:\s*(\r?\n)+)/,/^(?:\s+)/,/^(?:C4Context\b)/,/^(?:C4Container\b)/,/^(?:C4Component\b)/,/^(?:C4Dynamic\b)/,/^(?:C4Deployment\b)/,/^(?:Person_Ext\b)/,/^(?:Person\b)/,/^(?:SystemQueue_Ext\b)/,/^(?:SystemDb_Ext\b)/,/^(?:System_Ext\b)/,/^(?:SystemQueue\b)/,/^(?:SystemDb\b)/,/^(?:System\b)/,/^(?:Boundary\b)/,/^(?:Enterprise_Boundary\b)/,/^(?:System_Boundary\b)/,/^(?:ContainerQueue_Ext\b)/,/^(?:ContainerDb_Ext\b)/,/^(?:Container_Ext\b)/,/^(?:ContainerQueue\b)/,/^(?:ContainerDb\b)/,/^(?:Container\b)/,/^(?:Container_Boundary\b)/,/^(?:ComponentQueue_Ext\b)/,/^(?:ComponentDb_Ext\b)/,/^(?:Component_Ext\b)/,/^(?:ComponentQueue\b)/,/^(?:ComponentDb\b)/,/^(?:Component\b)/,/^(?:Deployment_Node\b)/,/^(?:Node\b)/,/^(?:Node_L\b)/,/^(?:Node_R\b)/,/^(?:Rel\b)/,/^(?:BiRel\b)/,/^(?:Rel_Up\b)/,/^(?:Rel_U\b)/,/^(?:Rel_Down\b)/,/^(?:Rel_D\b)/,/^(?:Rel_Left\b)/,/^(?:Rel_L\b)/,/^(?:Rel_Right\b)/,/^(?:Rel_R\b)/,/^(?:Rel_Back\b)/,/^(?:RelIndex\b)/,/^(?:UpdateElementStyle\b)/,/^(?:UpdateRelStyle\b)/,/^(?:UpdateLayoutConfig\b)/,/^(?:$)/,/^(?:[(][ ]*[,])/,/^(?:[(])/,/^(?:[)])/,/^(?:,,)/,/^(?:,)/,/^(?:[ ]*["]["])/,/^(?:[ ]*["])/,/^(?:["])/,/^(?:[^"]*)/,/^(?:[ ]*[\$])/,/^(?:[^=]*)/,/^(?:[=][ ]*["])/,/^(?:[^"]+)/,/^(?:["])/,/^(?:[^,]+)/,/^(?:\{)/,/^(?:\})/,/^(?:[\s]+)/,/^(?:[\n\r]+)/,/^(?:$)/],conditions:{acc_descr_multiline:{rules:[11,12],inclusive:!1},acc_descr:{rules:[9],inclusive:!1},acc_title:{rules:[7],inclusive:!1},string_kv_value:{rules:[78,79],inclusive:!1},string_kv_key:{rules:[77],inclusive:!1},string_kv:{rules:[76],inclusive:!1},string:{rules:[73,74],inclusive:!1},attribute:{rules:[68,69,70,71,72,75,80],inclusive:!1},update_layout_config:{rules:[65,66,67,68],inclusive:!1},update_rel_style:{rules:[65,66,67,68],inclusive:!1},update_el_style:{rules:[65,66,67,68],inclusive:!1},rel_b:{rules:[65,66,67,68],inclusive:!1},rel_r:{rules:[65,66,67,68],inclusive:!1},rel_l:{rules:[65,66,67,68],inclusive:!1},rel_d:{rules:[65,66,67,68],inclusive:!1},rel_u:{rules:[65,66,67,68],inclusive:!1},rel_bi:{rules:[],inclusive:!1},rel:{rules:[65,66,67,68],inclusive:!1},node_r:{rules:[65,66,67,68],inclusive:!1},node_l:{rules:[65,66,67,68],inclusive:!1},node:{rules:[65,66,67,68],inclusive:!1},index:{rules:[],inclusive:!1},rel_index:{rules:[65,66,67,68],inclusive:!1},component_ext_queue:{rules:[65,66,67,68],inclusive:!1},component_ext_db:{rules:[65,66,67,68],inclusive:!1},component_ext:{rules:[65,66,67,68],inclusive:!1},component_queue:{rules:[65,66,67,68],inclusive:!1},component_db:{rules:[65,66,67,68],inclusive:!1},component:{rules:[65,66,67,68],inclusive:!1},container_boundary:{rules:[65,66,67,68],inclusive:!1},container_ext_queue:{rules:[65,66,67,68],inclusive:!1},container_ext_db:{rules:[65,66,67,68],inclusive:!1},container_ext:{rules:[65,66,67,68],inclusive:!1},container_queue:{rules:[65,66,67,68],inclusive:!1},container_db:{rules:[65,66,67,68],inclusive:!1},container:{rules:[65,66,67,68],inclusive:!1},birel:{rules:[65,66,67,68],inclusive:!1},system_boundary:{rules:[65,66,67,68],inclusive:!1},enterprise_boundary:{rules:[65,66,67,68],inclusive:!1},boundary:{rules:[65,66,67,68],inclusive:!1},system_ext_queue:{rules:[65,66,67,68],inclusive:!1},system_ext_db:{rules:[65,66,67,68],inclusive:!1},system_ext:{rules:[65,66,67,68],inclusive:!1},system_queue:{rules:[65,66,67,68],inclusive:!1},system_db:{rules:[65,66,67,68],inclusive:!1},system:{rules:[65,66,67,68],inclusive:!1},person_ext:{rules:[65,66,67,68],inclusive:!1},person:{rules:[65,66,67,68],inclusive:!1},INITIAL:{rules:[0,1,2,3,4,5,6,8,10,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,81,82,83,84,85],inclusive:!0}}}}();function it(){this.yy={}}return rt.lexer=at,(0,l.K)(it,"Parser"),it.prototype=rt,rt.Parser=it,new it}();d.parser=d;var u,p=d,y=(0,l.K)(t=>(0,i.D7)()[t],"getRequiredConfig"),b=(0,l.K)((t,e)=>{for(const[n,s]of Object.entries(e))if(void 0!==s)if("object"==typeof s){const[e,n]=Object.entries(s)[0];t[e]=n}else t[n]=s},"assignAttributes"),f=(0,l.K)(()=>({alias:"global",label:{text:"global"},type:{text:"global"},tags:null,link:null,parentBoundary:""}),"createGlobalBoundary"),_=[],g=[""],m="global",x="",E=[f()],S=[],C="",k=!1,T=4,w=2,R=(0,l.K)(function(){return u},"getC4Type"),v=(0,l.K)(function(t){const e=(0,i.jZ)(t,(0,i.D7)());u=e},"setC4Type"),O=(0,l.K)(function(t,e,n,s,r,a,i,o,l){if(null==t||null==e||null==n||null==s)return;let c={};const h=S.find(t=>t.from===e&&t.to===n);if(h?c=h:S.push(c),c.type=t,c.from=e,c.to=n,c.label={text:s},null==r)c.techn={text:""};else if("object"==typeof r){const[t,e]=Object.entries(r)[0];c[t]={text:e}}else c.techn={text:r};if(null==a)c.descr={text:""};else if("object"==typeof a){const[t,e]=Object.entries(a)[0];c[t]={text:e}}else c.descr={text:a};b(c,{sprite:i,tags:o,link:l}),c.wrap=Z()},"addRel"),P=(0,l.K)(function(t,e,n,s,r,a,i){if(null===e||null===n)return;let o={};const l=_.find(t=>t.alias===e);if(l&&e===l.alias?o=l:(o.alias=e,_.push(o)),o.label=null==n?{text:""}:{text:n},null==s)o.descr={text:""};else if("object"==typeof s){const[t,e]=Object.entries(s)[0];o[t]={text:e}}else o.descr={text:s};b(o,{sprite:r,tags:a,link:i}),o.typeC4Shape={text:t},o.parentBoundary=m,o.wrap=Z()},"addPersonOrSystem"),D=(0,l.K)(function(t,e,n,s,r,a,i,o){if(null===e||null===n)return;let l={};const c=_.find(t=>t.alias===e);if(c&&e===c.alias?l=c:(l.alias=e,_.push(l)),l.label=null==n?{text:""}:{text:n},null==s)l.techn={text:""};else if("object"==typeof s){const[t,e]=Object.entries(s)[0];l[t]={text:e}}else l.techn={text:s};if(null==r)l.descr={text:""};else if("object"==typeof r){const[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.descr={text:r};b(l,{sprite:a,tags:i,link:o}),l.wrap=Z(),l.typeC4Shape={text:t},l.parentBoundary=m},"addContainer"),N=(0,l.K)(function(t,e,n,s,r,a,i,o){if(null===e||null===n)return;let l={};const c=_.find(t=>t.alias===e);if(c&&e===c.alias?l=c:(l.alias=e,_.push(l)),l.label=null==n?{text:""}:{text:n},null==s)l.techn={text:""};else if("object"==typeof s){const[t,e]=Object.entries(s)[0];l[t]={text:e}}else l.techn={text:s};if(null==r)l.descr={text:""};else if("object"==typeof r){const[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.descr={text:r};b(l,{sprite:a,tags:i,link:o}),l.wrap=Z(),l.typeC4Shape={text:t},l.parentBoundary=m},"addComponent"),A=(0,l.K)(function(t,e,n,s,r){if(null===t||null===e)return;let a={};const i=E.find(e=>e.alias===t);if(i&&t===i.alias?a=i:(a.alias=t,E.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"system"};else if("object"==typeof n){const[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};b(a,{tags:s,link:r}),a.parentBoundary=m,a.wrap=Z(),x=m,m=t,g.push(x)},"addPersonOrSystemBoundary"),K=(0,l.K)(function(t,e,n,s,r){if(null===t||null===e)return;let a={};const i=E.find(e=>e.alias===t);if(i&&t===i.alias?a=i:(a.alias=t,E.push(a)),a.label=null==e?{text:""}:{text:e},null==n)a.type={text:"container"};else if("object"==typeof n){const[t,e]=Object.entries(n)[0];a[t]={text:e}}else a.type={text:n};b(a,{tags:s,link:r}),a.parentBoundary=m,a.wrap=Z(),x=m,m=t,g.push(x)},"addContainerBoundary"),L=(0,l.K)(function(t,e,n,s,r,a,i,o){if(null===e||null===n)return;let l={};const c=E.find(t=>t.alias===e);if(c&&e===c.alias?l=c:(l.alias=e,E.push(l)),l.label=null==n?{text:""}:{text:n},null==s)l.type={text:"node"};else if("object"==typeof s){const[t,e]=Object.entries(s)[0];l[t]={text:e}}else l.type={text:s};if(null==r)l.descr={text:""};else if("object"==typeof r){const[t,e]=Object.entries(r)[0];l[t]={text:e}}else l.descr={text:r};b(l,{tags:i,link:o}),l.nodeType=t,l.parentBoundary=m,l.wrap=Z(),x=m,m=e,g.push(x)},"addDeploymentNode"),I=(0,l.K)(function(){m=x,g.pop(),x=g.pop(),g.push(x)},"popBoundaryParseStack"),M=(0,l.K)(function(t,e,n,s,r,a,i,o,l,c,h){let d=_.find(t=>t.alias===e);if(void 0!==d||(d=E.find(t=>t.alias===e),void 0!==d)){if(null!=n)if("object"==typeof n){const[t,e]=Object.entries(n)[0];d[t]=e}else d.bgColor=n;if(null!=s)if("object"==typeof s){const[t,e]=Object.entries(s)[0];d[t]=e}else d.fontColor=s;if(null!=r)if("object"==typeof r){const[t,e]=Object.entries(r)[0];d[t]=e}else d.borderColor=r;if(null!=a)if("object"==typeof a){const[t,e]=Object.entries(a)[0];d[t]=e}else d.shadowing=a;if(null!=i)if("object"==typeof i){const[t,e]=Object.entries(i)[0];d[t]=e}else d.shape=i;if(null!=o)if("object"==typeof o){const[t,e]=Object.entries(o)[0];d[t]=e}else d.sprite=o;if(null!=l)if("object"==typeof l){const[t,e]=Object.entries(l)[0];d[t]=e}else d.techn=l;if(null!=c)if("object"==typeof c){const[t,e]=Object.entries(c)[0];d[t]=e}else d.legendText=c;if(null!=h)if("object"==typeof h){const[t,e]=Object.entries(h)[0];d[t]=e}else d.legendSprite=h}},"updateElStyle"),$=(0,l.K)(function(t,e,n,s,r,a,i){const o=S.find(t=>t.from===e&&t.to===n);if(void 0!==o){if(null!=s)if("object"==typeof s){const[t,e]=Object.entries(s)[0];o[t]=e}else o.textColor=s;if(null!=r)if("object"==typeof r){const[t,e]=Object.entries(r)[0];o[t]=e}else o.lineColor=r;if(null!=a)if("object"==typeof a){const[t,e]=Object.entries(a)[0];o[t]=parseInt(e)}else o.offsetX=parseInt(a);if(null!=i)if("object"==typeof i){const[t,e]=Object.entries(i)[0];o[t]=parseInt(e)}else o.offsetY=parseInt(i)}},"updateRelStyle"),B=(0,l.K)(function(t,e,n){let s=T,r=w;if("object"==typeof e){const t=Object.values(e)[0];s=parseInt(t)}else s=parseInt(e);if("object"==typeof n){const t=Object.values(n)[0];r=parseInt(t)}else r=parseInt(n);s>=1&&(T=s),r>=1&&(w=r)},"updateLayoutConfig"),j=(0,l.K)(function(){return T},"getC4ShapeInRow"),Y=(0,l.K)(function(){return w},"getC4BoundaryInRow"),U=(0,l.K)(function(){return m},"getCurrentBoundaryParse"),F=(0,l.K)(function(){return x},"getParentBoundaryParse"),z=(0,l.K)(function(t){return null==t?_:_.filter(e=>e.parentBoundary===t)},"getC4ShapeArray"),X=(0,l.K)(function(t){return _.find(e=>e.alias===t)},"getC4Shape"),q=(0,l.K)(function(t){return Object.keys(z(t))},"getC4ShapeKeys"),W=(0,l.K)(function(t){return null==t?E:E.filter(e=>e.parentBoundary===t)},"getBoundaries"),H=W,Q=(0,l.K)(function(){return S},"getRels"),V=(0,l.K)(function(){return C},"getTitle"),G=(0,l.K)(function(t){k=t},"setWrap"),Z=(0,l.K)(function(){return k},"autoWrap"),J=(0,l.K)(function(){_=[],E=[f()],x="",m="global",g=[""],S=[],g=[""],C="",k=!1,T=4,w=2},"clear"),tt=(0,l.K)(function(t){const e=(0,i.jZ)(t,(0,i.D7)());C=e},"setTitle"),et={addPersonOrSystem:P,addPersonOrSystemBoundary:A,addContainer:D,addContainerBoundary:K,addComponent:N,addDeploymentNode:L,popBoundaryParseStack:I,addRel:O,updateElStyle:M,updateRelStyle:$,updateLayoutConfig:B,autoWrap:Z,setWrap:G,getC4ShapeArray:z,getC4Shape:X,getC4ShapeKeys:q,getBoundaries:W,getBoundarys:H,getCurrentBoundaryParse:U,getParentBoundaryParse:F,getRels:Q,getTitle:V,getC4Type:R,getC4ShapeInRow:j,getC4BoundaryInRow:Y,setAccTitle:i.SV,getAccTitle:i.iN,getAccDescription:i.m7,setAccDescription:i.EI,getConfig:(0,l.K)(()=>y("c4"),"getConfig"),clear:J,LINETYPE:{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},ARROWTYPE:{FILLED:0,OPEN:1},PLACEMENT:{LEFTOF:0,RIGHTOF:1,OVER:2},setTitle:tt,setC4Type:v},nt=(0,l.K)(function(t,e){return(0,s.tk)(t,e)},"drawRect"),st=(0,l.K)((t,e,n,s)=>{const r=t.append("g");let a=0;for(const t of e){const e=t.textColor?t.textColor:"#444444",i=t.lineColor?t.lineColor:"#444444",o=t.offsetX?parseInt(String(t.offsetX)):0,l=t.offsetY?parseInt(String(t.offsetY)):0,c="";if(0===a){const e=r.append("line");e.attr("x1",t.startPoint.x),e.attr("y1",t.startPoint.y),e.attr("x2",t.endPoint.x),e.attr("y2",t.endPoint.y),e.attr("stroke-width","1"),e.attr("stroke",i),e.style("fill","none"),"rel_b"!==t.type&&e.attr("marker-end","url("+c+"#"+s+"-arrowhead)"),"birel"!==t.type&&"rel_b"!==t.type||e.attr("marker-start","url("+c+"#"+s+"-arrowend)"),a=-1}else{const e=r.append("path");e.attr("fill","none").attr("stroke-width","1").attr("stroke",i).attr("d","Mstartx,starty Qcontrolx,controly stopx,stopy ".replaceAll("startx",t.startPoint.x).replaceAll("starty",t.startPoint.y).replaceAll("controlx",t.startPoint.x+(t.endPoint.x-t.startPoint.x)/2-(t.endPoint.x-t.startPoint.x)/4).replaceAll("controly",t.startPoint.y+(t.endPoint.y-t.startPoint.y)/2).replaceAll("stopx",t.endPoint.x).replaceAll("stopy",t.endPoint.y)),"rel_b"!==t.type&&e.attr("marker-end","url("+c+"#"+s+"-arrowhead)"),"birel"!==t.type&&"rel_b"!==t.type||e.attr("marker-start","url("+c+"#"+s+"-arrowend)")}const h=t.label.width;let d=n.messageFont();ut(n)(t.label.text,r,Math.min(t.startPoint.x,t.endPoint.x)+Math.abs(t.endPoint.x-t.startPoint.x)/2+o,Math.min(t.startPoint.y,t.endPoint.y)+Math.abs(t.endPoint.y-t.startPoint.y)/2+l,h,t.label.height,{fill:e},d),t.techn&&""!==t.techn.text&&(d=n.messageFont(),ut(n)("["+t.techn.text+"]",r,Math.min(t.startPoint.x,t.endPoint.x)+Math.abs(t.endPoint.x-t.startPoint.x)/2+o,Math.min(t.startPoint.y,t.endPoint.y)+Math.abs(t.endPoint.y-t.startPoint.y)/2+n.messageFontSize+5+l,Math.max(h,t.techn.width),t.techn.height,{fill:e,"font-style":"italic"},d))}},"drawRels"),rt=(0,l.K)(function(t,e,n){const s=t.append("g"),r=e.bgColor?e.bgColor:"none",a=e.borderColor?e.borderColor:"#444444",i=e.fontColor?e.fontColor:"black";let o={"stroke-width":1,"stroke-dasharray":"7.0,7.0"};e.nodeType&&(o={"stroke-width":1});const l={x:e.x,y:e.y,fill:r,stroke:a,width:e.width,height:e.height,rx:2.5,ry:2.5,attrs:o};nt(s,l);let c=n.boundaryFont();c.fontWeight="bold",c.fontSize=c.fontSize+2,c.fontColor=i,ut(n)(e.label.text,s,e.x,e.y+e.label.Y,e.width,e.height,{fill:"#444444"},c),e.type&&""!==e.type.text&&(c=n.boundaryFont(),c.fontColor=i,ut(n)(e.type.text,s,e.x,e.y+e.type.Y,e.width,e.height,{fill:"#444444"},c)),e.descr&&""!==e.descr.text&&(c=n.boundaryFont(),c.fontSize=c.fontSize-2,c.fontColor=i,ut(n)(e.descr.text,s,e.x,e.y+e.descr.Y,e.width,e.height,{fill:"#444444"},c))},"drawBoundary"),at=(0,l.K)(function(t,e){t.append("defs").append("symbol").attr("id",e+"-database").attr("fill-rule","evenodd").attr("clip-rule","evenodd").append("path").attr("transform","scale(.5)").attr("d","M12.258.001l.256.004.255.005.253.008.251.01.249.012.247.015.246.016.242.019.241.02.239.023.236.024.233.027.231.028.229.031.225.032.223.034.22.036.217.038.214.04.211.041.208.043.205.045.201.046.198.048.194.05.191.051.187.053.183.054.18.056.175.057.172.059.168.06.163.061.16.063.155.064.15.066.074.033.073.033.071.034.07.034.069.035.068.035.067.035.066.035.064.036.064.036.062.036.06.036.06.037.058.037.058.037.055.038.055.038.053.038.052.038.051.039.05.039.048.039.047.039.045.04.044.04.043.04.041.04.04.041.039.041.037.041.036.041.034.041.033.042.032.042.03.042.029.042.027.042.026.043.024.043.023.043.021.043.02.043.018.044.017.043.015.044.013.044.012.044.011.045.009.044.007.045.006.045.004.045.002.045.001.045v17l-.001.045-.002.045-.004.045-.006.045-.007.045-.009.044-.011.045-.012.044-.013.044-.015.044-.017.043-.018.044-.02.043-.021.043-.023.043-.024.043-.026.043-.027.042-.029.042-.03.042-.032.042-.033.042-.034.041-.036.041-.037.041-.039.041-.04.041-.041.04-.043.04-.044.04-.045.04-.047.039-.048.039-.05.039-.051.039-.052.038-.053.038-.055.038-.055.038-.058.037-.058.037-.06.037-.06.036-.062.036-.064.036-.064.036-.066.035-.067.035-.068.035-.069.035-.07.034-.071.034-.073.033-.074.033-.15.066-.155.064-.16.063-.163.061-.168.06-.172.059-.175.057-.18.056-.183.054-.187.053-.191.051-.194.05-.198.048-.201.046-.205.045-.208.043-.211.041-.214.04-.217.038-.22.036-.223.034-.225.032-.229.031-.231.028-.233.027-.236.024-.239.023-.241.02-.242.019-.246.016-.247.015-.249.012-.251.01-.253.008-.255.005-.256.004-.258.001-.258-.001-.256-.004-.255-.005-.253-.008-.251-.01-.249-.012-.247-.015-.245-.016-.243-.019-.241-.02-.238-.023-.236-.024-.234-.027-.231-.028-.228-.031-.226-.032-.223-.034-.22-.036-.217-.038-.214-.04-.211-.041-.208-.043-.204-.045-.201-.046-.198-.048-.195-.05-.19-.051-.187-.053-.184-.054-.179-.056-.176-.057-.172-.059-.167-.06-.164-.061-.159-.063-.155-.064-.151-.066-.074-.033-.072-.033-.072-.034-.07-.034-.069-.035-.068-.035-.067-.035-.066-.035-.064-.036-.063-.036-.062-.036-.061-.036-.06-.037-.058-.037-.057-.037-.056-.038-.055-.038-.053-.038-.052-.038-.051-.039-.049-.039-.049-.039-.046-.039-.046-.04-.044-.04-.043-.04-.041-.04-.04-.041-.039-.041-.037-.041-.036-.041-.034-.041-.033-.042-.032-.042-.03-.042-.029-.042-.027-.042-.026-.043-.024-.043-.023-.043-.021-.043-.02-.043-.018-.044-.017-.043-.015-.044-.013-.044-.012-.044-.011-.045-.009-.044-.007-.045-.006-.045-.004-.045-.002-.045-.001-.045v-17l.001-.045.002-.045.004-.045.006-.045.007-.045.009-.044.011-.045.012-.044.013-.044.015-.044.017-.043.018-.044.02-.043.021-.043.023-.043.024-.043.026-.043.027-.042.029-.042.03-.042.032-.042.033-.042.034-.041.036-.041.037-.041.039-.041.04-.041.041-.04.043-.04.044-.04.046-.04.046-.039.049-.039.049-.039.051-.039.052-.038.053-.038.055-.038.056-.038.057-.037.058-.037.06-.037.061-.036.062-.036.063-.036.064-.036.066-.035.067-.035.068-.035.069-.035.07-.034.072-.034.072-.033.074-.033.151-.066.155-.064.159-.063.164-.061.167-.06.172-.059.176-.057.179-.056.184-.054.187-.053.19-.051.195-.05.198-.048.201-.046.204-.045.208-.043.211-.041.214-.04.217-.038.22-.036.223-.034.226-.032.228-.031.231-.028.234-.027.236-.024.238-.023.241-.02.243-.019.245-.016.247-.015.249-.012.251-.01.253-.008.255-.005.256-.004.258-.001.258.001zm-9.258 20.499v.01l.001.021.003.021.004.022.005.021.006.022.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.023.018.024.019.024.021.024.022.025.023.024.024.025.052.049.056.05.061.051.066.051.07.051.075.051.079.052.084.052.088.052.092.052.097.052.102.051.105.052.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.048.144.049.147.047.152.047.155.047.16.045.163.045.167.043.171.043.176.041.178.041.183.039.187.039.19.037.194.035.197.035.202.033.204.031.209.03.212.029.216.027.219.025.222.024.226.021.23.02.233.018.236.016.24.015.243.012.246.01.249.008.253.005.256.004.259.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.021.224-.024.22-.026.216-.027.212-.028.21-.031.205-.031.202-.034.198-.034.194-.036.191-.037.187-.039.183-.04.179-.04.175-.042.172-.043.168-.044.163-.045.16-.046.155-.046.152-.047.148-.048.143-.049.139-.049.136-.05.131-.05.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.053.083-.051.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.05.023-.024.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.023.01-.022.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.127l-.077.055-.08.053-.083.054-.085.053-.087.052-.09.052-.093.051-.095.05-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.045-.118.044-.12.043-.122.042-.124.042-.126.041-.128.04-.13.04-.132.038-.134.038-.135.037-.138.037-.139.035-.142.035-.143.034-.144.033-.147.032-.148.031-.15.03-.151.03-.153.029-.154.027-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.01-.179.008-.179.008-.181.006-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.006-.179-.008-.179-.008-.178-.01-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.027-.153-.029-.151-.03-.15-.03-.148-.031-.146-.032-.145-.033-.143-.034-.141-.035-.14-.035-.137-.037-.136-.037-.134-.038-.132-.038-.13-.04-.128-.04-.126-.041-.124-.042-.122-.042-.12-.044-.117-.043-.116-.045-.113-.045-.112-.046-.109-.047-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.05-.093-.052-.09-.051-.087-.052-.085-.053-.083-.054-.08-.054-.077-.054v4.127zm0-5.654v.011l.001.021.003.021.004.021.005.022.006.022.007.022.009.022.01.022.011.023.012.023.013.023.015.024.016.023.017.024.018.024.019.024.021.024.022.024.023.025.024.024.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.052.11.051.114.051.119.052.123.05.127.051.131.05.135.049.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.044.171.042.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.022.23.02.233.018.236.016.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.012.241-.015.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.048.139-.05.136-.049.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.051.051-.049.023-.025.023-.024.021-.025.02-.024.019-.024.018-.024.017-.024.015-.023.014-.023.013-.024.012-.022.01-.023.01-.023.008-.022.006-.022.006-.022.004-.021.004-.022.001-.021.001-.021v-4.139l-.077.054-.08.054-.083.054-.085.052-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.049-.105.048-.106.047-.109.047-.111.046-.114.045-.115.044-.118.044-.12.044-.122.042-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.035-.143.033-.144.033-.147.033-.148.031-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.025-.161.024-.162.023-.163.022-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.011-.178.009-.179.009-.179.007-.181.007-.182.005-.182.004-.184.003-.184.002h-.37l-.184-.002-.184-.003-.182-.004-.182-.005-.181-.007-.179-.007-.179-.009-.178-.009-.176-.011-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.022-.162-.023-.161-.024-.159-.025-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.031-.146-.033-.145-.033-.143-.033-.141-.035-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.04-.126-.041-.124-.042-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.047-.105-.048-.102-.049-.1-.049-.097-.05-.095-.051-.093-.051-.09-.051-.087-.053-.085-.052-.083-.054-.08-.054-.077-.054v4.139zm0-5.666v.011l.001.02.003.022.004.021.005.022.006.021.007.022.009.023.01.022.011.023.012.023.013.023.015.023.016.024.017.024.018.023.019.024.021.025.022.024.023.024.024.025.052.05.056.05.061.05.066.051.07.051.075.052.079.051.084.052.088.052.092.052.097.052.102.052.105.051.11.052.114.051.119.051.123.051.127.05.131.05.135.05.139.049.144.048.147.048.152.047.155.046.16.045.163.045.167.043.171.043.176.042.178.04.183.04.187.038.19.037.194.036.197.034.202.033.204.032.209.03.212.028.216.027.219.025.222.024.226.021.23.02.233.018.236.017.24.014.243.012.246.01.249.008.253.006.256.003.259.001.26-.001.257-.003.254-.006.25-.008.247-.01.244-.013.241-.014.237-.016.233-.018.231-.02.226-.022.224-.024.22-.025.216-.027.212-.029.21-.03.205-.032.202-.033.198-.035.194-.036.191-.037.187-.039.183-.039.179-.041.175-.042.172-.043.168-.044.163-.045.16-.045.155-.047.152-.047.148-.048.143-.049.139-.049.136-.049.131-.051.126-.05.123-.051.118-.052.114-.051.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.052.07-.051.065-.051.06-.051.056-.05.051-.049.023-.025.023-.025.021-.024.02-.024.019-.024.018-.024.017-.024.015-.023.014-.024.013-.023.012-.023.01-.022.01-.023.008-.022.006-.022.006-.022.004-.022.004-.021.001-.021.001-.021v-4.153l-.077.054-.08.054-.083.053-.085.053-.087.053-.09.051-.093.051-.095.051-.097.05-.1.049-.102.048-.105.048-.106.048-.109.046-.111.046-.114.046-.115.044-.118.044-.12.043-.122.043-.124.042-.126.041-.128.04-.13.039-.132.039-.134.038-.135.037-.138.036-.139.036-.142.034-.143.034-.144.033-.147.032-.148.032-.15.03-.151.03-.153.028-.154.028-.156.027-.158.026-.159.024-.161.024-.162.023-.163.023-.165.021-.166.02-.167.019-.169.018-.169.017-.171.016-.173.015-.173.014-.175.013-.175.012-.177.01-.178.01-.179.009-.179.007-.181.006-.182.006-.182.004-.184.003-.184.001-.185.001-.185-.001-.184-.001-.184-.003-.182-.004-.182-.006-.181-.006-.179-.007-.179-.009-.178-.01-.176-.01-.176-.012-.175-.013-.173-.014-.172-.015-.171-.016-.17-.017-.169-.018-.167-.019-.166-.02-.165-.021-.163-.023-.162-.023-.161-.024-.159-.024-.157-.026-.156-.027-.155-.028-.153-.028-.151-.03-.15-.03-.148-.032-.146-.032-.145-.033-.143-.034-.141-.034-.14-.036-.137-.036-.136-.037-.134-.038-.132-.039-.13-.039-.128-.041-.126-.041-.124-.041-.122-.043-.12-.043-.117-.044-.116-.044-.113-.046-.112-.046-.109-.046-.106-.048-.105-.048-.102-.048-.1-.05-.097-.049-.095-.051-.093-.051-.09-.052-.087-.052-.085-.053-.083-.053-.08-.054-.077-.054v4.153zm8.74-8.179l-.257.004-.254.005-.25.008-.247.011-.244.012-.241.014-.237.016-.233.018-.231.021-.226.022-.224.023-.22.026-.216.027-.212.028-.21.031-.205.032-.202.033-.198.034-.194.036-.191.038-.187.038-.183.04-.179.041-.175.042-.172.043-.168.043-.163.045-.16.046-.155.046-.152.048-.148.048-.143.048-.139.049-.136.05-.131.05-.126.051-.123.051-.118.051-.114.052-.11.052-.106.052-.101.052-.096.052-.092.052-.088.052-.083.052-.079.052-.074.051-.07.052-.065.051-.06.05-.056.05-.051.05-.023.025-.023.024-.021.024-.02.025-.019.024-.018.024-.017.023-.015.024-.014.023-.013.023-.012.023-.01.023-.01.022-.008.022-.006.023-.006.021-.004.022-.004.021-.001.021-.001.021.001.021.001.021.004.021.004.022.006.021.006.023.008.022.01.022.01.023.012.023.013.023.014.023.015.024.017.023.018.024.019.024.02.025.021.024.023.024.023.025.051.05.056.05.06.05.065.051.07.052.074.051.079.052.083.052.088.052.092.052.096.052.101.052.106.052.11.052.114.052.118.051.123.051.126.051.131.05.136.05.139.049.143.048.148.048.152.048.155.046.16.046.163.045.168.043.172.043.175.042.179.041.183.04.187.038.191.038.194.036.198.034.202.033.205.032.21.031.212.028.216.027.22.026.224.023.226.022.231.021.233.018.237.016.241.014.244.012.247.011.25.008.254.005.257.004.26.001.26-.001.257-.004.254-.005.25-.008.247-.011.244-.012.241-.014.237-.016.233-.018.231-.021.226-.022.224-.023.22-.026.216-.027.212-.028.21-.031.205-.032.202-.033.198-.034.194-.036.191-.038.187-.038.183-.04.179-.041.175-.042.172-.043.168-.043.163-.045.16-.046.155-.046.152-.048.148-.048.143-.048.139-.049.136-.05.131-.05.126-.051.123-.051.118-.051.114-.052.11-.052.106-.052.101-.052.096-.052.092-.052.088-.052.083-.052.079-.052.074-.051.07-.052.065-.051.06-.05.056-.05.051-.05.023-.025.023-.024.021-.024.02-.025.019-.024.018-.024.017-.023.015-.024.014-.023.013-.023.012-.023.01-.023.01-.022.008-.022.006-.023.006-.021.004-.022.004-.021.001-.021.001-.021-.001-.021-.001-.021-.004-.021-.004-.022-.006-.021-.006-.023-.008-.022-.01-.022-.01-.023-.012-.023-.013-.023-.014-.023-.015-.024-.017-.023-.018-.024-.019-.024-.02-.025-.021-.024-.023-.024-.023-.025-.051-.05-.056-.05-.06-.05-.065-.051-.07-.052-.074-.051-.079-.052-.083-.052-.088-.052-.092-.052-.096-.052-.101-.052-.106-.052-.11-.052-.114-.052-.118-.051-.123-.051-.126-.051-.131-.05-.136-.05-.139-.049-.143-.048-.148-.048-.152-.048-.155-.046-.16-.046-.163-.045-.168-.043-.172-.043-.175-.042-.179-.041-.183-.04-.187-.038-.191-.038-.194-.036-.198-.034-.202-.033-.205-.032-.21-.031-.212-.028-.216-.027-.22-.026-.224-.023-.226-.022-.231-.021-.233-.018-.237-.016-.241-.014-.244-.012-.247-.011-.25-.008-.254-.005-.257-.004-.26-.001-.26.001z")},"insertDatabaseIcon"),it=(0,l.K)(function(t,e){t.append("defs").append("symbol").attr("id",e+"-computer").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M2 2v13h20v-13h-20zm18 11h-16v-9h16v9zm-10.228 6l.466-1h3.524l.467 1h-4.457zm14.228 3h-24l2-6h2.104l-1.33 4h18.45l-1.297-4h2.073l2 6zm-5-10h-14v-7h14v7z")},"insertComputerIcon"),ot=(0,l.K)(function(t,e){t.append("defs").append("symbol").attr("id",e+"-clock").attr("width","24").attr("height","24").append("path").attr("transform","scale(.5)").attr("d","M12 2c5.514 0 10 4.486 10 10s-4.486 10-10 10-10-4.486-10-10 4.486-10 10-10zm0-2c-6.627 0-12 5.373-12 12s5.373 12 12 12 12-5.373 12-12-5.373-12-12-12zm5.848 12.459c.202.038.202.333.001.372-1.907.361-6.045 1.111-6.547 1.111-.719 0-1.301-.582-1.301-1.301 0-.512.77-5.447 1.125-7.445.034-.192.312-.181.343.014l.985 6.238 5.394 1.011z")},"insertClockIcon"),lt=(0,l.K)(function(t,e){t.append("defs").append("marker").attr("id",e+"-arrowhead").attr("refX",9).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 0 0 L 10 5 L 0 10 z")},"insertArrowHead"),ct=(0,l.K)(function(t,e){t.append("defs").append("marker").attr("id",e+"-arrowend").attr("refX",1).attr("refY",5).attr("markerUnits","userSpaceOnUse").attr("markerWidth",12).attr("markerHeight",12).attr("orient","auto").append("path").attr("d","M 10 0 L 0 5 L 10 10 z")},"insertArrowEnd"),ht=(0,l.K)(function(t,e){t.append("defs").append("marker").attr("id",e+"-filled-head").attr("refX",18).attr("refY",7).attr("markerWidth",20).attr("markerHeight",28).attr("orient","auto").append("path").attr("d","M 18,7 L9,13 L14,7 L9,1 Z")},"insertArrowFilledHead"),dt=(0,l.K)(function(t,e){const n=t.append("defs").append("marker").attr("id",e+"-crosshead").attr("markerWidth",15).attr("markerHeight",8).attr("orient","auto").attr("refX",16).attr("refY",4);n.append("path").attr("fill","black").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 9,2 V 6 L16,4 Z"),n.append("path").attr("fill","none").attr("stroke","#000000").style("stroke-dasharray","0, 0").attr("stroke-width","1px").attr("d","M 0,1 L 6,7 M 6,1 L 0,7")},"insertArrowCrossHead"),ut=function(){function t(t,e,n,r,a,i,o){s(e.append("text").attr("x",n+a/2).attr("y",r+i/2+5).style("text-anchor","middle").text(t),o)}function e(t,e,n,r,a,o,l,c){const{fontSize:h,fontFamily:d,fontWeight:u}=c,p=t.split(i.Y2.lineBreakRegex);for(let t=0;t<p.length;t++){const i=t*h-h*(p.length-1)/2,o=e.append("text").attr("x",n+a/2).attr("y",r).style("text-anchor","middle").attr("dominant-baseline","middle").style("font-size",h).style("font-weight",u).style("font-family",d);o.append("tspan").attr("dy",i).text(p[t]).attr("alignment-baseline","mathematical"),s(o,l)}}function n(t,n,r,a,i,o,l,c){const h=n.append("switch"),d=h.append("foreignObject").attr("x",r).attr("y",a).attr("width",i).attr("height",o).append("xhtml:div").style("display","table").style("height","100%").style("width","100%");d.append("div").style("display","table-cell").style("text-align","center").style("vertical-align","middle").text(t),e(t,h,r,a,i,0,l,c),s(d,l)}function s(t,e){for(const n in e)e.hasOwnProperty(n)&&t.attr(n,e[n])}return(0,l.K)(t,"byText"),(0,l.K)(e,"byTspan"),(0,l.K)(n,"byFo"),(0,l.K)(s,"_setTextAttrs"),function(s){return"fo"===s.textPlacement?n:"old"===s.textPlacement?t:e}}(),pt={drawRect:nt,drawBoundary:rt,drawRels:st,insertArrowHead:lt,insertArrowEnd:ct,insertArrowFilledHead:ht,insertArrowCrossHead:dt,insertDatabaseIcon:at,insertComputerIcon:it,insertClockIcon:ot},yt=(0,l.K)((t,e)=>{if("sandbox"===e){const e=(0,h.Ltv)("#i"+t),n=e.node()?.contentDocument;if(!n)throw new Error(`Sandbox iframe #i${t} is missing its content document`);return{root:(0,h.Ltv)(n.body),doc:n}}return{root:(0,h.Ltv)("body"),doc:document}},"getDiagramRoot"),bt=new Set(["system_queue","external_system_queue","container_queue","external_container_queue","component_queue","external_component_queue"]),ft=new Set(["system_db","external_system_db","container_db","external_container_db","component_db","external_component_db"]),_t={person:"person",box:"rounded",rounded:"rounded",cylinder:"cylinder",database:"cylinder",db:"cylinder",queue:"h-cyl",pipe:"h-cyl",component:"fr-rect"},gt=(0,l.K)(t=>t?_t[t.toLowerCase()]:void 0,"keywordShape"),mt=(0,l.K)(t=>{const e=gt(t.shape)??gt(t.sprite);if(e)return e;if(t.tags)for(const e of t.tags.split(",")){const t=gt(e.trim());if(t)return t}const n=t.typeC4Shape.text;return"person"===n||"external_person"===n?"person":ft.has(n)?"cylinder":bt.has(n)?"h-cyl":"rounded"},"resolveNodeShape"),xt={person:"Person",system:"Software System",container:"Container",component:"Component"},Et=(0,l.K)(t=>{const e=t.replace(/^external_/,"").replace(/_(db|queue)$/,"");return xt[e]??e.replace(/_/g," ")},"stereotypeLabel"),St=(0,l.K)(t=>t.startsWith("external_"),"isExternal"),Ct=(0,l.K)(t=>{const e=Et(t.typeC4Shape.text);return t.techn?.text?`[${e}: ${t.techn.text}]`:`[${e}]`},"stereotypeText"),kt=["person","system","system_db","system_queue","container","container_db","container_queue","component","component_db","component_queue"].flatMap(t=>[t,`external_${t}`]),Tt=new Set(kt),wt=(0,l.K)(t=>Tt.has(t),"isC4ElementType"),Rt=(0,l.K)((t,e)=>{const n=t.typeC4Shape.text,s=t.bgColor??(wt(n)&&e[`${n}_bg_color`]),r=t.borderColor??(wt(n)&&e[`${n}_border_color`]),a=[];return s&&a.push(`fill:${s}`),r&&a.push(`stroke:${r}`),a.push(`color:${t.fontColor??"#FFFFFF"}`),a},"elementCssStyles"),vt=(0,l.K)((t,e,n,s,r)=>{const a=t.typeC4Shape.text,i=["c4-shape",`c4-${a}`];St(a)&&i.push("c4-external");const o=mt(t),l=Rt(t,e);return"rounded"!==o&&"fr-rect"!==o||l.push("rx:12px","ry:12px"),{id:t.alias,label:t.label.text,stereotype:Ct(t),description:t.descr?.text?[t.descr.text]:void 0,labelType:"string",isGroup:!1,shape:o,cssClasses:i.join(" "),cssStyles:l,padding:n,look:s,useHtmlLabels:!1,width:r}},"buildC4Node"),Ot=0,Pt=0,Dt=4,Nt=2;d.yy=et;var At={},Kt=class{static{(0,l.K)(this,"Bounds")}constructor(t){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,Lt(t.db.getConfig())}setData(t,e,n,s){this.nextData.startx=this.data.startx=t,this.nextData.stopx=this.data.stopx=e,this.nextData.starty=this.data.starty=n,this.nextData.stopy=this.data.stopy=s}updateVal(t,e,n,s){void 0===t[e]?t[e]=n:t[e]=s(n,t[e])}insert(t){this.nextData.cnt=this.nextData.cnt+1;const e=this.nextData.stopx,n=this.data.widthLimit;let s=this.nextData.startx===this.nextData.stopx?e+t.margin:e+2*t.margin,r=s+t.width,a=this.nextData.starty+2*t.margin,i=a+t.height;(s>=n||r>=n||this.nextData.cnt>Dt)&&(s=this.nextData.startx+t.margin+At.nextLinePaddingX,a=this.nextData.stopy+2*t.margin,this.nextData.stopx=r=s+t.width,this.nextData.starty=this.nextData.stopy,this.nextData.stopy=i=a+t.height,this.nextData.cnt=1),t.x=s,t.y=a,this.updateVal(this.data,"startx",s,Math.min),this.updateVal(this.data,"starty",a,Math.min),this.updateVal(this.data,"stopx",r,Math.max),this.updateVal(this.data,"stopy",i,Math.max),this.updateVal(this.nextData,"startx",s,Math.min),this.updateVal(this.nextData,"starty",a,Math.min),this.updateVal(this.nextData,"stopx",r,Math.max),this.updateVal(this.nextData,"stopy",i,Math.max)}init(t){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},Lt(t.db.getConfig())}bumpLastMargin(t){this.data.stopx+=t,this.data.stopy+=t}},Lt=(0,l.K)(function(t){(0,i.hH)(At,t),t?.fontFamily&&(At.personFontFamily=At.systemFontFamily=At.messageFontFamily=t.fontFamily),t?.fontSize&&(At.personFontSize=At.systemFontSize=At.messageFontSize=t.fontSize),t?.fontWeight&&(At.personFontWeight=At.systemFontWeight=At.messageFontWeight=t.fontWeight)},"setConf"),It=(0,l.K)(t=>({fontFamily:t.boundaryFontFamily,fontSize:t.boundaryFontSize,fontWeight:t.boundaryFontWeight}),"boundaryFont"),Mt=(0,l.K)(t=>({fontFamily:t.messageFontFamily,fontSize:t.messageFontSize,fontWeight:t.messageFontWeight}),"messageFont");function $t(t,e,n,s,r){const o=e[t];if(!o.width)if(n)o.text=(0,a.bH)(o.text,r,s),o.textLines=o.text.split(i.Y2.lineBreakRegex).length,o.width=r,o.height=(0,a.ru)(o.text,s);else{const t=o.text.split(i.Y2.lineBreakRegex);o.textLines=t.length;let e=0;o.height=0,o.width=0;for(const n of t)o.width=Math.max((0,a.Un)(n,s),o.width),e=(0,a.ru)(n,s),o.height=o.height+e}return o}(0,l.K)($t,"calcC4ShapeTextWH");var Bt=(0,l.K)(function(t,e,n){const s=n.data.startx,r=n.data.starty;e.x=s,e.y=r,e.width=n.data.stopx-s,e.height=n.data.stopy-r,e.label.y=At.c4ShapeMargin-35;const i=e.wrap&&At.wrap,o=It(At);o.fontSize=o.fontSize+2,o.fontWeight="bold";$t("label",e,i,o,(0,a.Un)(e.label.text,o)),pt.drawBoundary(t,e,At)},"drawBoundary"),jt=(0,l.K)(async function(t,e,n,s){const a=(0,i.D7)(),o=a.look??"classic",c={config:a},h=e.attr("id")??"",d=s.map(t=>n[Number(t)]),u=(0,l.K)(t=>{const e=t.shape?r.nq[t.shape]:void 0;if(!e)throw new Error(`C4: no shape handler for "${t.shape}"`);return e},"shapeHandlerFor");await Promise.all(d.map(async t=>{const n=vt(t,At,At.c4ShapePadding,o,At.width);n.domId=`${h}-${n.id}`;const s=await u(n)(e,n,c);t.width=n.width??At.width,t.height=n.height??At.height,t.margin=At.c4ShapeMargin,s.remove()}));for(const e of d)t.insert(e);await Promise.all(d.map(async t=>{const n=vt(t,At,At.c4ShapePadding,o,At.width);n.domId=`${h}-${n.id}`,n.x=t.x+t.width/2,n.y=t.y+t.height/2;const s=e.append("g").attr("transform",`translate(${t.x+t.width/2}, ${t.y+t.height/2})`);await u(n)(s,n,c),t.intersect=n.intersect})),t.bumpLastMargin(At.c4ShapeMargin)},"drawC4ShapeArray"),Yt=class{static{(0,l.K)(this,"Point")}constructor(t,e){this.x=t,this.y=e}},Ut=(0,l.K)(function(t,e){if(!t.intersect)throw new Error(`C4 shape "${t.alias}" has no intersect function. Please report this to https://github.com/mermaid-js/mermaid/issues`);const{x:n,y:s}=t.intersect(e);return new Yt(n,s)},"getIntersectPoint"),Ft=(0,l.K)(function(t,e){const n={x:0,y:0};n.x=e.x+e.width/2,n.y=e.y+e.height/2;const s=Ut(t,n);n.x=t.x+t.width/2,n.y=t.y+t.height/2;return{startPoint:s,endPoint:Ut(e,n)}},"getIntersectPoints"),zt=(0,l.K)(function(t,e,n,s,r){const i=s.db.getC4Type();let o=0;for(const t of e){o+=1;const e=t.wrap&&At.wrap,s=Mt(At);"C4Dynamic"===i&&(t.label.text=o+": "+t.label.text);let r=(0,a.Un)(t.label.text,s);$t("label",t,e,s,r),t.techn&&""!==t.techn.text&&(r=(0,a.Un)(t.techn.text,s),$t("techn",t,e,s,r)),t.descr&&""!==t.descr.text&&(r=(0,a.Un)(t.descr.text,s),$t("descr",t,e,s,r));const l=n(t.from),c=n(t.to);if(!l||!c)throw new Error(`C4 rel "${t.from}" -> "${t.to}" references an unknown shape`);const h=Ft(l,c);if(!h.startPoint||!h.endPoint)throw new Error(`Could not calculate intersection points for rel "${t.from}" -> "${t.to}"`);t.startPoint=h.startPoint,t.endPoint=h.endPoint}pt.drawRels(t,e,At,r)},"drawRels");async function Xt(t,e,n,s,r){const a=r.db,i=new Kt(r);i.data.widthLimit=n.data.widthLimit/Math.min(Nt,s.length);for(const[o,l]of s.entries()){let s=0;l.image={width:0,height:0,Y:0},l.sprite&&(l.image.width=48,l.image.height=48,l.image.Y=s,s=l.image.Y+l.image.height);const c=l.wrap&&At.wrap,h=It(At);h.fontSize=h.fontSize+2,h.fontWeight="bold";const d=$t("label",l,c,h,i.data.widthLimit);if(d.Y=s+8,s=d.Y+d.height,l.type&&""!==l.type.text){l.type.text="["+l.type.text+"]";const t=$t("type",l,c,It(At),i.data.widthLimit);t.Y=s+5,s=t.Y+t.height}if(l.descr&&""!==l.descr.text){const t=It(At);t.fontSize=t.fontSize-2;const e=$t("descr",l,c,t,i.data.widthLimit);e.Y=s+20,s=e.Y+e.height}if(0==o||o%Nt===0){const t=n.data.startx+At.diagramMarginX,e=n.data.stopy+At.diagramMarginY+s;i.setData(t,t,e,e)}else{const t=i.data.stopx!==i.data.startx?i.data.stopx+At.diagramMarginX:i.data.startx,e=i.data.starty;i.setData(t,t,e,e)}i.name=l.alias;const u=a.getC4ShapeArray(l.alias),p=a.getC4ShapeKeys(l.alias);p.length>0&&await jt(i,t,u,p),e=l.alias;const y=a.getBoundaries(e);y.length>0&&await Xt(t,e,i,y,r),"global"!==l.alias&&Bt(t,l,i),n.data.stopy=Math.max(i.data.stopy+At.c4ShapeMargin,n.data.stopy),n.data.stopx=Math.max(i.data.stopx+At.c4ShapeMargin,n.data.stopx),Ot=Math.max(Ot,n.data.stopx),Pt=Math.max(Pt,n.data.stopy)}}(0,l.K)(Xt,"drawInsideBoundary");var qt={drawPersonOrSystemArray:jt,drawBoundary:Bt,setConf:Lt,draw:(0,l.K)(async function(t,e,n,s){At=y("c4");const r=(0,i.D7)().securityLevel,{root:a}=yt(e,r),l=s.db;l.setWrap(At.wrap),Dt=l.getC4ShapeInRow(),Nt=l.getC4BoundaryInRow(),o.R.debug(`C:${JSON.stringify(At,null,2)}`);const c=a.select(`[id="${e}"]`);pt.insertComputerIcon(c,e),pt.insertDatabaseIcon(c,e),pt.insertClockIcon(c,e);const h=new Kt(s);h.setData(At.diagramMarginX,At.diagramMarginX,At.diagramMarginY,At.diagramMarginY),h.data.widthLimit=screen.availWidth,Ot=At.diagramMarginX,Pt=At.diagramMarginY;const d=l.getTitle(),u=l.getBoundaries("");await Xt(c,"",h,u,s),pt.insertArrowHead(c,e),pt.insertArrowEnd(c,e),pt.insertArrowCrossHead(c,e),pt.insertArrowFilledHead(c,e),zt(c,l.getRels(),l.getC4Shape,s,e),h.data.stopx=Ot,h.data.stopy=Pt;const p=h.data,b=p.startx,f=p.starty,_=Pt-f+2*At.diagramMarginY,g=Ot-b,m=g+2*At.diagramMarginX;d&&c.append("text").text(d).attr("x",g/2-4*At.diagramMarginX).attr("y",f+At.diagramMarginY),(0,i.a$)(c,_,m,At.useMaxWidth);const x=d?60:0;c.attr("viewBox",b-At.diagramMarginX+" -"+(At.diagramMarginY+x)+" "+m+" "+(_+x)),o.R.debug("models:",p)},"draw")},Wt=(0,l.K)(()=>{const t=(0,i.D7)().c4??{},e=new CSSStyleSheet;for(const n of kt){const s=e.cssRules[e.insertRule(`.c4-shape.c4-${n} .label {}`,e.cssRules.length)],r=t[`${n}FontFamily`],a=t[`${n}FontSize`],i=t[`${n}FontWeight`];r&&s.style.setProperty("font-family",r),a&&s.style.setProperty("font-size","number"==typeof a?`${a}px`:a),i&&s.style.setProperty("font-weight",String(i))}return[...e.cssRules].filter(t=>t.style.length>0).map(t=>` ${t.cssText}`).join("\n")},"elementFontStyles"),Ht={parser:p,db:et,renderer:qt,styles:(0,l.K)(t=>`.person {\n stroke: ${t.personBorder};\n fill: ${t.personBkg};\n }\n${Wt()}\n\n /* The element font colour is set inline per element (default white); the\n label text takes it via currentColor. */\n .c4-shape .label,\n .c4-shape .label text {\n color: inherit;\n fill: currentColor;\n }\n /* Structurizr typography: bold name, smaller stereotype/type and description lines. */\n .c4-shape .label .c4-name {\n font-weight: bold;\n }\n .c4-shape .label .c4-type {\n font-size: 0.75em;\n }\n .c4-shape .label .c4-descr {\n font-size: 0.82em;\n }\n .c4-shape .basic,\n .c4-shape rect,\n .c4-shape path,\n .c4-shape circle,\n .c4-shape ellipse,\n .c4-shape line {\n stroke-width: 2px;\n }\n`,"getStyles"),init:(0,l.K)(({c4:t,wrap:e})=>{qt.setConf(t),et.setWrap(e)},"init")}},338(t,e,n){n.d(e,{CP:()=>d,Ck:()=>y,HT:()=>p,PB:()=>u,aC:()=>h,lC:()=>l,m:()=>c,tk:()=>o});var s=n(86535),r=n(86827),a=n(62559),i=n(51444),o=(0,r.K)((t,e)=>{const n=t.append("rect");if(n.attr("x",e.x),n.attr("y",e.y),n.attr("fill",e.fill),n.attr("stroke",e.stroke),n.attr("width",e.width),n.attr("height",e.height),e.name&&n.attr("name",e.name),e.rx&&n.attr("rx",e.rx),e.ry&&n.attr("ry",e.ry),void 0!==e.attrs)for(const t in e.attrs)n.attr(t,e.attrs[t]);return e.class&&n.attr("class",e.class),n},"drawRect"),l=(0,r.K)((t,e)=>{const n={x:e.startx,y:e.starty,width:e.stopx-e.startx,height:e.stopy-e.starty,fill:e.fill,stroke:e.stroke,class:"rect"};o(t,n).lower()},"drawBackgroundRect"),c=(0,r.K)((t,e)=>{const n=e.text.replace(s.H1," "),r=t.append("text");r.attr("x",e.x),r.attr("y",e.y),r.attr("class","legend"),r.style("text-anchor",e.anchor),e.class&&r.attr("class",e.class);const a=r.append("tspan");return a.attr("x",e.x+2*e.textMargin),a.text(n),r},"drawText"),h=(0,r.K)((t,e,n,s)=>{const r=t.append("image");r.attr("x",e),r.attr("y",n);const i=(0,a.J)(s);r.attr("xlink:href",i)},"drawImage"),d=(0,r.K)((t,e,n,s)=>{const r=t.append("use");r.attr("x",e),r.attr("y",n);const i=(0,a.J)(s);r.attr("xlink:href",`#${i}`)},"drawEmbeddedImage"),u=(0,r.K)(()=>({x:0,y:0,width:100,height:100,fill:"#EDF2AE",stroke:"#666",anchor:"start",rx:0,ry:0}),"getNoteRect"),p=(0,r.K)(()=>({x:0,y:0,width:100,height:100,"text-anchor":"start",style:"#666",textMargin:0,rx:0,ry:0,tspan:!0}),"getTextObj"),y=(0,r.K)(()=>{let t=(0,i.Ltv)(".mermaidTooltip");return t.empty()&&(t=(0,i.Ltv)("body").append("div").attr("class","mermaidTooltip").style("opacity",0).style("position","absolute").style("text-align","center").style("max-width","200px").style("padding","2px").style("font-size","12px").style("background","#ffffde").style("border","1px solid #333").style("border-radius","2px").style("pointer-events","none").style("z-index","100")),t},"createTooltip")}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[8840],{18840(e,r,t){t.d(r,{diagram:()=>i});var a=t(29899),s=(t(96755),t(1672),t(67830),t(338),t(24980),t(27838),t(96865),t(48159),t(44505),t(69793),t(43287),t(12505),t(86535),t(31293),t(86827)),i={parser:a.Zk,get db(){return new a.u4(2)},renderer:a.q7,styles:a.tM,init:(0,s.K)(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")}}}]);
|