filecat 6.45.3 → 6.47.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.
Files changed (74) hide show
  1. package/build/dist/124.23fa0d2699d9618dda9b.js +1 -0
  2. package/build/dist/{9725.c0f5fe759b3f29ad5989.js → 1240.8141c3584667c9b102c5.js} +1 -1
  3. package/build/dist/125.46b0b0838cec5442fdf6.js +1 -0
  4. package/build/dist/{1472.f10cd19f1ebc66d06ca5.js → 1472.822ac655d838f1a02b9a.js} +1 -1
  5. package/build/dist/{6202.f1c6599d8628dfe0f47d.js → 1715.b6871d580981169bbdc4.js} +1 -1
  6. package/build/dist/{8888.c714553db9ff11c9da25.js → 1730.f999109734b2ec283532.js} +1 -1
  7. package/build/dist/{4892.2bcb6c2d911a8d6049e6.js → 1750.36c146cd44049aaf79bc.js} +1 -1
  8. package/build/dist/{1218.bb8814412156c1a05a8c.js → 1772.7868dde9477de83bca1b.js} +1 -1
  9. package/build/dist/2449.0a762cd0483921adb91b.js +1 -0
  10. package/build/dist/2535.15ea6ba73588f47dc278.js +1 -0
  11. package/build/dist/{3813.6430f39e6bcabeb141ba.js → 2549.d0b9ca007ebae4995c22.js} +1 -1
  12. package/build/dist/2862.b1506f9eda52fa4f64cd.js +1 -0
  13. package/build/dist/2979.a1aa1f822cfc6c15f4a7.js +1 -0
  14. package/build/dist/{9499.bd13c877be5faa569e76.js → 3386.cc4b0d13967d3d1ac1ac.js} +1 -1
  15. package/build/dist/{6317.0929fcd5463e5e8e67d1.js → 3743.847ccbdcf5b607eec417.js} +1 -1
  16. package/build/dist/{8814.5157a8490dc97bab58c8.js → 3822.7e8ba22abbc6a60e6e20.js} +1 -1
  17. package/build/dist/{9786.cd9c2e2e7602e4310054.js → 3975.fde79b562d1f76f82274.js} +1 -1
  18. package/build/dist/{2018.8ee7ad4c73b038c713c5.js → 4619.1f7d8bf06c69e2ce9de7.js} +1 -1
  19. package/build/dist/{2640.6877d2665aa4ee6a1a85.js → 4625.a6a593542f4f2ebdae0f.js} +1 -1
  20. package/build/dist/{1082.e5badad25358d9fb3079.js → 4877.c31b8c8ee069225abc0d.js} +1 -1
  21. package/build/dist/5014.ff2b55369c42ab3cdda2.js +1 -0
  22. package/build/dist/{2726.52ceb81411f86822798f.js → 5135.9c0adbfd935bc46dd00d.js} +1 -1
  23. package/build/dist/5222.540853902e9c52d28220.js +1 -0
  24. package/build/dist/{7551.fd0ef76160cc344a6cfc.js → 5708.d62ffec88d557ee68f7b.js} +1 -1
  25. package/build/dist/5877.4e8f34819a3ae8da88b7.js +1 -0
  26. package/build/dist/5919.8a2c39a0e1623d795ee5.js +1 -0
  27. package/build/dist/5976.67aa23f2625209b8003b.js +1 -0
  28. package/build/dist/6002.1c2ff6a9c94ee343dded.js +1 -0
  29. package/build/dist/6110.a21be9c843a97bad11d5.js +1 -0
  30. package/build/dist/6402.dc70cc4e1530b8f1519d.js +1 -0
  31. package/build/dist/648.ca43171884d81b27c3a3.js +1 -0
  32. package/build/dist/{5061.5a9a6052bb6d3c895bc0.js → 6794.2fe35b73c565a07ec864.js} +1 -1
  33. package/build/dist/7017.274f83a8995232a6a9a0.js +1 -0
  34. package/build/dist/736.086cd9a8f1598c9f0ac7.js +1 -0
  35. package/build/dist/764.7c29eaf9d7edbee8467e.js +1 -0
  36. package/build/dist/{5181.1493235f192ed0e34fa8.js → 7887.2edcfdeb215d33478936.js} +1 -1
  37. package/build/dist/{4775.2e9cd58436b05580eb1c.js → 8018.02ea29dc6f59bbfaaee0.js} +1 -1
  38. package/build/dist/{5460.d692ffc021e7b872705d.js → 8136.dc1403b91767ca089293.js} +1 -1
  39. package/build/dist/{8256.0e3d9a5222004414b053.js → 8220.3ddda498d174349e189c.js} +1 -1
  40. package/build/dist/8233.6f5cd229953db8462d7d.js +1 -0
  41. package/build/dist/8535.9d68b1a6589a813c5bf1.js +1 -0
  42. package/build/dist/8947.55d1c2f1238de7f51549.js +2 -0
  43. package/build/dist/{4371.773ef273063e38ac1fd1.js → 9256.5d9a03011b69d1504ae4.js} +1 -1
  44. package/build/dist/9307.2c9d7f6089fef297b1c1.js +1 -0
  45. package/build/dist/{2703.e711df3217f7b4dfc978.js → 9352.6ebe66d0487686642ec9.js} +1 -1
  46. package/build/dist/index.html +1 -1
  47. package/build/dist/main.5bc1e6b78e3174e3fe27.js +2 -0
  48. package/build/main.js +1 -1
  49. package/package.json +2 -2
  50. package/build/dist/1012.1ffc2b5f439b4dbd31ab.js +0 -1
  51. package/build/dist/135.f248a925d34a798480d7.js +0 -1
  52. package/build/dist/1727.69b721002e5c4cee43f5.js +0 -1
  53. package/build/dist/2227.630510781f59cc4c4fb2.js +0 -1
  54. package/build/dist/2579.7a313dc04e7bd13abef5.js +0 -1
  55. package/build/dist/3084.52a9fb540f9a2f20e2a4.js +0 -1
  56. package/build/dist/3106.7d69822609a6d0ddd7af.js +0 -1
  57. package/build/dist/4204.e82ad99dea01b22eb25d.js +0 -1
  58. package/build/dist/4754.cd598f047ff6236c61c9.js +0 -1
  59. package/build/dist/5088.0caefbc5a430ba64afa1.js +0 -1
  60. package/build/dist/5945.244b607c26ac99161fe1.js +0 -1
  61. package/build/dist/6084.2417b84c3833e9b05951.js +0 -1
  62. package/build/dist/6085.1dc5c0e79932b5f9e52c.js +0 -1
  63. package/build/dist/636.d61ff5465a8d2326514b.js +0 -1
  64. package/build/dist/6383.b333496d85f9b04daf1f.js +0 -1
  65. package/build/dist/7111.b2007509a9bf0683c90a.js +0 -1
  66. package/build/dist/7209.3b487c37072aadaed4ca.js +0 -1
  67. package/build/dist/7632.43249289310a589f1b1e.js +0 -1
  68. package/build/dist/7911.89b6408e7daaccc1d8af.js +0 -1
  69. package/build/dist/893.0160359067e299f9a4f2.js +0 -1
  70. package/build/dist/8947.f1f29db3485b2287da46.js +0 -2
  71. package/build/dist/9756.eb8e5cd0c35395fdf573.js +0 -1
  72. package/build/dist/main.360cfb58341f1f91aefe.js +0 -2
  73. /package/build/dist/{8947.f1f29db3485b2287da46.js.LICENSE.txt → 8947.55d1c2f1238de7f51549.js.LICENSE.txt} +0 -0
  74. /package/build/dist/{main.360cfb58341f1f91aefe.js.LICENSE.txt → main.5bc1e6b78e3174e3fe27.js.LICENSE.txt} +0 -0
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[6383],{16383(t,e,n){n.r(e),n.d(e,{render:()=>to});var o=n(62204),r=n(1778),s=n(75999),i=(n(23665),n(91865)),a=n(3868),c=(n(8969),n(24731),n(28342)),f=n(68861),d=n(31293),l=n(86827),u=n(697);async function h(t,e){const o=new u.T({multigraph:!0,compound:!0}),r=[...e.edges],i=(0,f.D7)(),a=t.insert("g").attr("class","root"),c=a.insert("g").attr("class","clusters"),d=a.insert("g").attr("class","edges edgePath"),l=a.insert("g").attr("class","edgeLabels"),h=a.insert("g").attr("class","nodes"),g=new Map,p=null!=t.node();await Promise.all(e.nodes.map(async t=>{if(t.isGroup)o.setNode(t.id,{...t});else{if(p){const e=await(0,s.on)(h,t,{config:i,dir:t.dir}),n=e.node()?.getBBox()??{width:0,height:0};g.set(t.id,e),t.width=n.width,t.height=n.height}o.setNode(t.id,{...t})}}));for(const t of r){o.setEdge(t.start,t.end,{...t},t.id);e.edges.some(e=>e.id===t.id)||e.edges.push(t)}if(globalThis.mermaidCaptureSizes){const{captureNodeSizes:o}=await n.e(2857).then(n.bind(n,62857));o(t,e)}return{graph:o,groups:{clusters:c,edgePaths:d,edgeLabels:l,nodes:h,rootGroups:a},nodeElements:g}}(0,l.K)(h,"createGraphWithElements");var g=1e-5,p=1e-6;function x(t){const e=[];for(let n=0;n<t.length-1;n++)e.push({a:t[n],b:t[n+1]});return e}function m(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(0===c)return null;const f=n.x-t.x,d=n.y-t.y,l=(f*a-d*i)/c,u=(f*s-d*r)/c;return l<=p||l>=.999999||u<=p||u>=.999999?null:{point:{x:t.x+l*r,y:t.y+l*s},tA:l,tB:u}}function y(t){return Math.abs(t.b.x-t.a.x)>=Math.abs(t.b.y-t.a.y)}function b(t){const e=[];for(let n=0;n<t.length;n++){const o=t[n],r=x(o.points);for(let s=n+1;s<t.length;s++){const n=t[s],i=x(n.points);for(const[t,s]of r.entries())for(const[r,a]of i.entries()){const i=m(s.a,s.b,a.a,a.b);if(!i)continue;const c=y(s);!!(c!==y(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 M(t){const e=Math.round(1e3*t)/1e3;return Number.isInteger(e),`${e}`}function K(t){return`${M(t.x)},${M(t.y)}`}function I(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,l.K)(x,"buildSegmentList"),(0,l.K)(m,"segmentIntersection"),(0,l.K)(y,"isHorizontalSeg"),(0,l.K)(b,"findEdgeIntersections"),(0,l.K)(M,"fmt"),(0,l.K)(K,"pointToString"),(0,l.K)(I,"getArcSweepFlag");function w(t,e){if(t.length<2)return t.map(t=>({...t}));const n=t.map(t=>({...t})),o=e.arrowTypeStart&&i.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 r=e.arrowTypeEnd&&i.hq[e.arrowTypeEnd];if(r){const e=t.length,o=t[e-2],s=t[e-1],i=Math.atan2(s.y-o.y,s.x-o.x);n[e-1].x=s.x-r*Math.cos(i),n[e-1].y=s.y-r*Math.sin(i)}return n}function S(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${K(a)}`];return"arc"===r?f.push(`A${M(t.r)},${M(t.r)} 0 0 ${o} ${K(c)}`):f.push(`M${K(c)}`),f}function v(t,e,n,o){const r=e.x-t.x,s=e.y-t.y,i=n.x-e.x,a=n.y-e.y,c=Math.hypot(r,s),f=Math.hypot(i,a);if(c<g||f<g)return null;const d=r/c,l=s/c,u=i/f,h=a/f,p=d*u+l*h,x=Math.max(-1,Math.min(1,p)),m=Math.acos(x);if(m<g||Math.abs(Math.PI-m)<g)return null;const y=Math.min(o/Math.sin(m/2),c/2,f/2);return{startX:e.x-d*y,startY:e.y-l*y,endX:e.x+u*y,endY:e.y+h*y,ctrlX:e.x,ctrlY:e.y,cutLen:y}}function C(t,e,n){const o=t.points;if(o.length<2)return"";const r=w(o,t),s="rounded"===t.curve,i=x(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${K(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=I(e);let u=0;if(s&&t>0){const e=v(r[t-1],r[t],r[t+1]??r[t],5);e&&(u=e.cutLen)}let h=o,g=null;s&&t<i.length-1&&(g=v(r[t],r[t+1],r[t+2]??r[t+1],5),g&&(h=o-g.cutLen));const p=[...a.get(t)??[]].sort((t,e)=>t.t-e.t);for(const t of p)t.r=Math.min(t.r,t.d-u,h-t.d);for(let t=0;t<p.length-1;t++){const e=p[t+1].d-p[t].d;if(p[t].r+p[t+1].r>e){const n=e/2;p[t].r=Math.min(p[t].r,n),p[t+1].r=Math.min(p[t+1].r,n)}}for(const t of p)t.r<.001||c.push(...S(t,f,d,l,n.jumpStyle));s&&g?(c.push(`L${M(g.startX)},${M(g.startY)}`),c.push(`Q${M(g.ctrlX)},${M(g.ctrlY)} ${M(g.endX)},${M(g.endY)}`)):c.push(`L${K(e.b)}`)}return c.join(" ")}function L(t){return/^[\d\s+,.LMelm-]*$/.test(t)}function k(t){return!t||("linear"===t||"rounded"===t||"step"===t||"stepBefore"===t||"stepAfter"===t)}function T(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 $(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=T(n.getAttribute("data-points"))??t.points;s.push({...t,points:r})}const a=b(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(!L(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=C(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)}}}async function R(t,e){for(const n of t.nodes)n.isGroup?await(0,s.U)(e.clusters,n):(0,s.U_)(n);const n=new Map;for(const e of t.nodes)e?.id&&n.set(e.id,e);for(const o of t.edges){const s=o.start?n.get(o.start)??{}:{},i=o.end?n.get(o.end)??{}:{},a=(0,r.Jo)(e.edgePaths,{...o},{},t.type,s,i,t.diagramId);o.label&&await(0,r.jP)(e.rootGroups,o),o.label&&O(o,a)}const o=t.config?.swimlane?.lineHops;if(!1!==o){const n="gap"===o?"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}));$(e.edgePaths,r,{enabled:!0,jumpRadius:6,jumpStyle:n})}}function O(t,e){const n=e?.updatedPath??e?.originalPath,o=(0,f.zj)(),{subGraphTitleTotalMargin:s}=(0,a.O)({flowchart:o.flowchart??{}});if(t.label){const o=r.lP.get(t.id);let i=t.x,a=t.y;if(n){const o=c._K.calcLabelPosition(n);d.R.debug("Moving label "+t.label+" from (",i,",",a,") to (",o.x,",",o.y,") abc88"),e&&(i=o.x,a=o.y)}o.attr("transform",`translate(${i}, ${a+s/2})`)}if(t?.startLabelLeft){const e=r.UQ.get(t.id).startLeft;let o=t?.x,s=t?.y;if(n){const e=c._K.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_left",n);o=e.x,s=e.y}e.attr("transform",`translate(${o}, ${s})`)}if(t.startLabelRight){const e=r.UQ.get(t.id).startRight;let o=t.x,s=t.y;if(n){const e=c._K.calcTerminalLabelPosition(t.arrowTypeStart?10:0,"start_right",n);o=e.x,s=e.y}e.attr("transform",`translate(${o}, ${s})`)}if(t.endLabelLeft){const e=r.UQ.get(t.id).endLeft;let o=t.x,s=t.y;if(n){const e=c._K.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_left",n);o=e.x,s=e.y}e.attr("transform",`translate(${o}, ${s})`)}if(t.endLabelRight){const e=r.UQ.get(t.id).endRight;let o=t.x,s=t.y;if(n){const e=c._K.calcTerminalLabelPosition(t.arrowTypeEnd?10:0,"end_right",n);o=e.x,s=e.y}e.attr("transform",`translate(${o}, ${s})`)}}(0,l.K)(w,"applyMarkerOffsets"),(0,l.K)(S,"emitJump"),(0,l.K)(v,"computeRoundedCorner"),(0,l.K)(C,"rewriteEdgePath"),(0,l.K)(L,"isStraightPath"),(0,l.K)(k,"curveSupportsLineHops"),(0,l.K)(T,"decodeDataPoints"),(0,l.K)($,"applyLineJumpsToSvg"),(0,l.K)(R,"adjustLayout"),(0,l.K)(O,"positionEdgeLabel");var N="__swimlane_default__";function B(t){return Math.max(t.padding??20,20)}function E(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 F(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===N);r?r.isGroup&&(r.shape="swimlane",e&&(r.direction=e)):(r={id:N,label:"",isGroup:!0,shape:"swimlane",padding:20,...e?{direction:e}:{}},n.push(r));for(const t of o)t.parentId=N}function Y(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 X(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*B(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*B(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),E(e)}}}}}(0,l.K)(B,"topLaneHorizontalPadding"),(0,l.K)(E,"assignTopLaneTitleRect"),(0,l.K)(F,"prepareLayoutForSwimlanes"),(0,l.K)(Y,"toGraphView"),(0,l.K)(X,"writeBackToLayoutData");function P(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,s=r.end?o.get(r.end):void 0;if(!t||!s){d.R.warn("[EdgeLabelNodes]",`Edge ${r.id} has missing source or target node`);continue}const i=`edge-label-${r.start}-${r.end}-${r.id}`,a=t.parentId!==s.parentId?s.parentId:t.parentId,c={id:i,label:r.label,edgeStart:r.start??"",edgeEnd:r.end??"",shape:"labelRect",width:0,height:0,isEdgeLabel:!0,isDummy:!0,parentId:a,isGroup:!1,labelStyle:Array.isArray(r.labelStyle)?r.labelStyle[0]:r.labelStyle??"",...t.dir?{dir:t.dir}:{}};e.push(c),r.labelNodeId=i,r.label=void 0,r.text=void 0;const f={id:`${r.id}-to-label`,start:r.start,end:i,type:"normal",isLayoutOnly:!0},l={id:`${r.id}-from-label`,start:i,end:r.end,type:"normal",isLayoutOnly:!0};n.push(f,l)}const r=[...t.nodes,...e],s=[...t.edges,...n];return{...t,nodes:r,edges:s}}(0,l.K)(P,"createEdgeLabelNodes");var z=.001;function A(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:st(e,n,o,r)}:void 0}function G(t){if(t.isGroup)return;const e=A(t);if(!e)return;return{id:String(t.id??""),cx:e.cx,cy:e.cy,rect:e.rect}}function D(t,e,n=z){return Math.abs(t.x-e.x)<n&&Math.abs(t.y-e.y)<n}function H(t,e,n=z){return Math.abs(t.x-e.x)<n}function j(t,e,n=z){return Math.abs(t.y-e.y)<n}function _(t,e,n=z){return j(t,e,n)&&Math.abs(t.x-e.x)>n}function V(t,e,n=z){return H(t,e,n)&&Math.abs(t.y-e.y)>n}function W(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 U(t,e,n=z){return t.horizontal&&e.horizontal&&j(t.a,e.a,n)?W(t.a.x,t.b.x,e.a.x,e.b.x):t.vertical&&e.vertical&&H(t.a,e.a,n)?W(t.a.y,t.b.y,e.a.y,e.b.y):0}function q(t,e=z){const n=[];for(let o=0;o<t.length-1;o++){const r=t[o],s=t[o+1],i=_(r,s,e),a=V(r,s,e);(i||a)&&n.push({index:o,a:r,b:s,horizontal:i,vertical:a})}return n}function J(t,e=z){const n=q(t,e);let o=0;for(let t=1;t<n.length;t++)n[t-1].horizontal!==n[t].horizontal&&o++;return o}function Q(t,e=z){const n=[];for(const o of t){const t=n.length>0?n[n.length-1]:void 0;t&&D(t,o,e)||n.push({x:o.x,y:o.y})}return n}function Z(t,e=z){if(!t||4!==t.length)return;const[n,o,r,s]=t;if(_(n,o,e)&&V(o,r,e)&&_(r,s,e))return{kind:"HVH",p0:n,p1:o,p2:r,p3:s};return V(n,o,e)&&_(o,r,e)&&V(r,s,e)?{kind:"VHV",p0:n,p1:o,p2:r,p3:s}:void 0}function tt(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 et(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 nt(t,e){return t.left<=e.left&&t.right>=e.right&&t.top<=e.top&&t.bottom>=e.bottom}function ot(t,e){return t.left<e.right&&t.right>e.left&&t.top<e.bottom&&t.bottom>e.top}function rt(t,e){return{left:t.left-e,right:t.right+e,top:t.top-e,bottom:t.bottom+e}}function st(t,e,n,o){return{left:t-n/2,right:t+n/2,top:e-o/2,bottom:e+o/2}}function it(t){return A(t)?.rect}function at(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 ct(t,e,n,o,r,s=z){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(j(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(j(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(H(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(H(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 ft(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 dt(t){const e=new Map,n=[];for(const o of t){if(o.isEdgeLabel)continue;const t=G(o);t&&(e.set(t.id,t),n.push({id:t.id,rect:t.rect}))}return{nodeInfoById:e,realNodeRects:n}}function lt(t){const e=[],n=[];for(const o of t){const t=G(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 ut(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,...st(t,r,s,i)})}return n}function ht(t,e,n=z){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 gt(t,e,n,o=[],r=0){for(const s of n)if(!o.includes(s.id)&&tt(t,e,s.rect,-r))return!0;return!1}function pt(t,e,n,o,r=z,s=1e-6){const i=j(t,e,r),a=H(t,e,r),c=j(n,o,r),f=H(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 xt(t,e,n,o,r=z){const s=j(t,e,r),i=H(t,e,r),a=j(n,o,r),c=H(n,o,r);return i&&c&&H(t,n,r)?W(t.y,e.y,n.y,o.y)>r:!!(s&&a&&j(t,n,r))&&W(t.x,e.x,n.x,o.x)>r}function mt(t,e,n,o,{epsilon:r=z,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||!D(i,a,r))&&(pt(t,e,i,a,r)||xt(t,e,i,a,r)))return!0}}return!1}function yt(t,e,n,o,r=z){const s=j(t,e,r),i=H(t,e,r),a=j(n,o,r),c=H(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 bt(t,e,n){const o=Math.min(e,n),r=Math.max(e,n);return t>o+z&&t<r-z}function Mt(t,e,n){return H(t,e)&&H(e,n)?bt(e.y,t.y,n.y):!(!j(t,e)||!j(e,n))&&bt(e.x,t.x,n.x)}function Kt(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(D(r,i)){o++,e=!0;continue}if(Mt(r,s,i)){e=!0;continue}}n.push(s)}return{points:n,changed:e}}function It(t){const e=[t[0]];for(let n=1;n<t.length;n++){const o=e[e.length-1],r=t[n];if(!H(o,r)&&!j(o,r)){const t=e.length>=2?e[e.length-2]:void 0,n=!!t&&H(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&&D(e,t)||n.push(t)}return n}function wt(t){if(t.length<3)return t;let e=[...t];for(let t=0;t<32;t++){const t=Kt(e);if(e=t.points,!t.changed)break}return e}(0,l.K)(A,"measuredNodeRect"),(0,l.K)(G,"nodeBoundsInfoFor"),(0,l.K)(D,"samePoint"),(0,l.K)(H,"sameX"),(0,l.K)(j,"sameY"),(0,l.K)(_,"isHorizontalSegment"),(0,l.K)(V,"isVerticalSegment"),(0,l.K)(W,"overlapLength"),(0,l.K)(U,"sameAxisSegmentOverlapLength"),(0,l.K)(q,"orthogonalSegmentsForPoints"),(0,l.K)(J,"countOrthogonalBends"),(0,l.K)(Q,"dedupeConsecutivePoints"),(0,l.K)(Z,"classifyThreeSegmentRoute"),(0,l.K)(tt,"segmentBoundsOverlapRect"),(0,l.K)(et,"pointInsideRect"),(0,l.K)(nt,"rectContainsRect"),(0,l.K)(ot,"rectsOverlap"),(0,l.K)(rt,"inflateRect"),(0,l.K)(st,"rectFromCenterSize"),(0,l.K)(it,"rectOfNodeBounds"),(0,l.K)(at,"portForRectSide"),(0,l.K)(ct,"buildOrthogonalPortPath"),(0,l.K)(ft,"buildSameSideTrackPath"),(0,l.K)(dt,"collectRealNodeBounds"),(0,l.K)(lt,"collectNodeRectEntries"),(0,l.K)(ut,"collectLayoutNodeRects"),(0,l.K)(ht,"getNodePairGeometry"),(0,l.K)(gt,"segmentHitsAnyRect"),(0,l.K)(pt,"orthogonalSegmentsCross"),(0,l.K)(xt,"sameAxisSegmentsOverlap"),(0,l.K)(mt,"segmentConflictsWithAnyEdge"),(0,l.K)(yt,"orthogonalSegmentsStrictlyCross"),(0,l.K)(bt,"strictlyBetween"),(0,l.K)(Mt,"isCollinearIntermediate"),(0,l.K)(Kt,"simplifyPolylineOnce"),(0,l.K)(It,"orthogonalizePolyline"),(0,l.K)(wt,"simplifyPolyline");var St=.001;function vt(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?it(r):void 0,dstRect:s?it(s):void 0}}function Ct(t,e,n){if(j(t,e,St)){return{x:t.x<n.left?n.left:n.right,y:t.y}}if(H(t,e,St)){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 Lt(t,e,n){const o=n?1:-1;let r=n?0:t.length-1;for(;r>=0&&r<t.length&&et(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=Ct(t[r],t[s],e);return n?[i,...t.slice(r)]:[...t.slice(0,r+1),i]}function kt(t,e){for(const n of t){const t=vt(n,e,2);if(!t)continue;let o=[...t.points];t.srcRect&&(o=Lt(o,t.srcRect,!0)),t.dstRect&&(o=Lt(o,t.dstRect,!1)),o=wt(It(o)),o=Pt(o,t.srcRect,t.dstRect),t.edge.points=wt(It(o))}}function Tt(t,e,n,o=!1){if(j(t,e,St)){if(e.y<n.top-St||e.y>n.bottom+St)return e;if(o){if(t.x<n.left-St)return{x:n.left,y:t.y};if(t.x>n.right+St)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(H(t,e,St)){if(e.x<n.left-St||e.x>n.right+St)return e;if(o){if(t.y<n.top-St)return{x:t.x,y:n.top};if(t.y>n.bottom+St)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 $t(t,e,n){const o=t[e];for(let r=e+n;r>=0&&r<t.length;r+=n){const e=t[r];if(!D(e,o,St))return e}return t[e+n]}function Rt(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 Ot(t,e,n){const{lo:o,hi:r}=Rt(e,n);return Math.min(r,Math.max(o,t))}function Nt(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 Bt(t,e){return"left"===e||"right"===e?Rt(t.top,t.bottom):Rt(t.left,t.right)}function Et(t,e,n){const o=t.y>=n.top-St&&t.y<=n.bottom+St,r=t.x>=n.left-St&&t.x<=n.right+St;if(j(t,e,St)&&o){if(Math.abs(t.x-n.left)<St)return"left";if(Math.abs(t.x-n.right)<St)return"right"}if(H(t,e,St)&&r){if(Math.abs(t.y-n.top)<St)return"top";if(Math.abs(t.y-n.bottom)<St)return"bottom"}}function Ft(t){return"left"===t||"right"===t}function Yt(t,e,n,o,r){const s=[],i=n?Et(t,e,n):void 0,a=o?Et(e,t,o):void 0;return n&&i&&Ft(i)===r&&s.push(Bt(n,i)),o&&a&&Ft(a)===r&&s.push(Bt(o,a)),s.length>0?Nt(s):void 0}function Xt(t,e,n,o,r){const s=Yt(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)<St?void 0:r?[{x:t.x,y:a},{x:e.x,y:a}]:[{x:a,y:t.y},{x:a,y:e.y}]}function Pt(t,e,n){if(2!==t.length)return t;const[o,r]=t;return j(o,r,St)?Xt(o,r,e,n,!0)??t:H(o,r,St)?Xt(o,r,e,n,!1)??t:t}function zt(t,e,n){return Ft(n)?{x:t.x,y:Ot(t.y,e.top,e.bottom)}:{x:Ot(t.x,e.left,e.right),y:t.y}}function At(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&&!j(e,o,St))break;if(!s&&!H(e,o,St))break;s?i[a].y=r.y:i[a].x=r.x}return i}function Gt(t,e,n){if(t.length<2)return t;const o=n?0:t.length-1,r=n?1:-1,s=t[o],i=$t(t,o,r);if(!i)return t;const a=Et(s,i,e);if(!a)return t;const c=Ft(a),f=zt(s,e,a);return D(s,f,St)?t:At(t,o,r,s,f,c)}function Dt(t,e,n){const o=Math.min(t.x,e.x)>=n.left-St&&Math.max(t.x,e.x)<=n.right+St,r=Math.min(t.y,e.y)>=n.top-St&&Math.max(t.y,e.y)<=n.bottom+St;return Math.abs(t.y-n.top)<St&&Math.abs(e.y-n.top)<St&&o?"top":Math.abs(t.y-n.bottom)<St&&Math.abs(e.y-n.bottom)<St&&o?"bottom":Math.abs(t.x-n.left)<St&&Math.abs(e.x-n.left)<St&&r?"left":Math.abs(t.x-n.right)<St&&Math.abs(e.x-n.right)<St&&r?"right":void 0}function Ht(t,e,n,o){switch(t){case"top":return H(e,n,St)&&n.y<o.top-St;case"bottom":return H(e,n,St)&&n.y>o.bottom+St;case"left":return j(e,n,St)&&n.x<o.left-St;case"right":return j(e,n,St)&&n.x>o.right+St}}function jt(t,e,n){if(t.length<3)return t;if(n){const n=Dt(t[0],t[1],e);return n&&Ht(n,t[1],t[2],e)?t.slice(1):t}const o=t.length-1,r=Dt(t[o-1],t[o],e);return r&&Ht(r,t[o-1],t[o-2],e)?t.slice(0,o):t}function _t(t,e,n){let o=t;if(e){const t=$t(o,0,1);if(t){const n=Tt(t,o[0],e);n!==o[0]&&(o=[n,...o.slice(1)])}o=jt(o,e,!0)}if(n){const t=o.length-1,e=$t(o,t,-1);if(e){const r=Tt(e,o[t],n,!0);r!==o[t]&&(o=[...o.slice(0,t),r])}o=jt(o,n,!1)}const r=Pt(o,e,n);return r!==o||2===o.length?r:(e&&(o=Gt(o,e,!0)),n&&(o=Gt(o,n,!1)),o)}function Vt(t,e){for(const n of t){const t=vt(n,e,2);if(!t)continue;const o=_t(Q(t.points,St),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 Wt(t){return new Map(t.map(t=>[t.id,t]))}function Ut(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 qt(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 Jt(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 Qt(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 Zt(t){const e=Wt(t),n=t.filter(t=>t.isGroup&&t.parentId).sort((t,n)=>qt(n,e)-qt(t,e));for(const e of n){const n=Jt(t.filter(t=>t.parentId===e.id));n&&Qt(e,n)}}function te(t,e){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 n=t[e];"number"==typeof n&&(s=Math.min(s,n),i=Math.max(i,n))}if(!Number.isFinite(s)||!Number.isFinite(i))return!1;const a=(0,l.K)(t=>s+i-t,"mirror");for(const t of n){const n=t[e];"number"==typeof n&&(t[e]=a(n));const o=t.groupTitleRect;o&&(t.groupTitleRect="x"===e?{...o,left:a(o.right),right:a(o.left)}:{...o,top:a(o.bottom),bottom:a(o.top)})}for(const t of o)for(const n of t.points??[])n[e]=a(n[e]);return!0}function ee(t){return!(t.nodes??[]).some(t=>!t.isGroup)||te(t,"y")}function ne(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}Zt(n);const h=n.filter(t=>t.isGroup&&!t.parentId);if(0===h.length)return"RL"===e&&te(t,"x"),!0;const g=Wt(n),p=new Map;for(const t of n){if(t.isGroup)continue;const e=Ut(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=Jt(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,w=I+K/2,S=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-S;else{n=(m[t-1].contentBottom+e.contentTop)/2}if(t===m.length-1)o=e.contentBottom+S;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=w,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&&te(t,"x"),!0}(0,l.K)(vt,"endpointContextFor"),(0,l.K)(Ct,"segmentEnterPoint"),(0,l.K)(Lt,"clipEndpoint"),(0,l.K)(kt,"clipEdgeEndpointsToNodeBoundaries"),(0,l.K)(Tt,"snapEndpointToBoundary"),(0,l.K)($t,"firstDistinctAdjacent"),(0,l.K)(Rt,"cornerClearanceRange"),(0,l.K)(Ot,"clampToCornerClearance"),(0,l.K)(Nt,"intersectRanges"),(0,l.K)(Bt,"clearanceRangeForSide"),(0,l.K)(Et,"terminalSideForSegment"),(0,l.K)(Ft,"isHorizontalSide"),(0,l.K)(Yt,"straightClearanceRange"),(0,l.K)(Xt,"clearStraightEndpointCornerAxis"),(0,l.K)(Pt,"clearStraightEndpointCornerConnections"),(0,l.K)(zt,"cornerClearedEndpoint"),(0,l.K)(At,"moveCollinearEndpointRun"),(0,l.K)(Gt,"clearEndpointCornerConnection"),(0,l.K)(Dt,"borderSideForSegment"),(0,l.K)(Ht,"leavesOutward"),(0,l.K)(jt,"collapseOwnBorderStub"),(0,l.K)(_t,"snapAndCollapseEndpoints"),(0,l.K)(Vt,"prepareEdgeEndpointsForRenderer"),(0,l.K)(Wt,"buildNodeMap"),(0,l.K)(Ut,"resolveTopLevelGroupId"),(0,l.K)(qt,"groupDepth"),(0,l.K)(Jt,"boundsForChildren"),(0,l.K)(Qt,"applyGroupBounds"),(0,l.K)(Zt,"recomputeNestedGroupBounds"),(0,l.K)(te,"mirrorAxis"),(0,l.K)(ee,"applyBtDirectionTransform"),(0,l.K)(ne,"applyLrDirectionTransform");var oe=1e-6,re=[0,8,-8,16,-16];function se(t,e){const{nodeInfoById:n,realNodeRects:o}=dt(e);for(const e of t){if(e.isLayoutOnly)continue;const r=e.points;if(!r||r.length<4)continue;const s=Z(Q(r,oe),oe);if(!s)continue;const{p3:i}=s,a="HVH"===s.kind,c=ht(e,n,oe);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 re){let r,s,c;if(a){const t=u.cy>l.cy?x.bottom:x.top,e=l.cx+n;if(e<=x.left+oe||e>=x.right-oe)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+oe||e>=x.bottom-oe)continue;r={x:t,y:e},s={x:i.x,y:e},c={x:i.x,y:i.y}}const h=D(r,s,oe),g=D(s,c,oe);if(h&&g)continue;if(!h&&gt(r,s,o,[f],1))continue;if(!g&&gt(s,c,o,[d],1))continue;const m=!h&&mt(r,s,t,e,{epsilon:oe,skipDegenerateOther:!0}),y=!g&&mt(s,c,t,e,{epsilon:oe,skipDegenerateOther:!0});if(!m&&!y){p=h?[s,c]:g?[r,s]:[r,s,c];break}}p&&(e.points=p)}}function ie(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=lt(e.values());for(const s of t){if(s.isLayoutOnly)continue;const i=s.points;if(!i||i.length<4)continue;const a=Q(i,n);if(a.length<4)continue;const c=a.length-1,f=a[c],d=a[c-1],u=a[c-2],h=f.x-d.x,g=f.y-d.y,p=Math.hypot(h,g);if(p>=10||p<n)continue;const x=d.x-u.x,m=d.y-u.y;if(Math.hypot(x,m)<n)continue;const y=_(d,f,n),b=V(d,f,n),M=_(u,d,n),K=V(u,d,n);if(!(y&&K||b&&M))continue;const I=s.end,w=s.start,S=I?e.get(I):void 0;if(!S)continue;const v=S.x??0,C=S.y??0,L=it(S);if(!L)continue;let k,T;if(K){const t=m<0;k={x:v,y:u.y},T={x:v,y:t?L.bottom:L.top}}else{const t=x>0;k={x:u.x,y:C},T={x:t?L.right:L.left,y:C}}if(gt(k,T,o,I?[I]:[],-2))continue;if(gt(k,T,r,[],-2))continue;if(w){const t=e.get(w),n=t?it(t):void 0;if(n&&et(k,n,2))continue}const $=(0,l.K)((t,e)=>`${t.x.toFixed(3)},${t.y.toFixed(3)}|${e.x.toFixed(3)},${e.y.toFixed(3)}`,"ownSegmentKey"),R=new Set;for(let t=0;t<a.length-1;t++)R.add($(a[t],a[t+1]));const O=(0,l.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(!R.has($(s,i))&&yt(e,o,s,i,n))return!0}}return!1},"segmentCrossesOtherEdge");if(O(k,T))continue;if(c-3>=0){const t=a[c-3];if(gt(t,k,o,[w,I].filter(t=>Boolean(t)),-2))continue;if(O(t,k))continue}const N=[...a.slice(0,c-2),k,T];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=j(a,c,n),l=H(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,l.K)(se,"portSwapToLShape"),(0,l.K)(ie,"collapseShortTerminalStub");var ae=.001,ce=q,fe=(0,l.K)((t,e)=>H(t,e,ae)||j(t,e,ae),"orthogonallyAligned");function de(t,e){const n=(0,l.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,l.K)((t,o)=>{const r=Q(t.points??[]);if(r.length<2)return;const s=o?t.start:t.end,i=s?e.get(s):void 0,a=i?it(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 fe(f,d)&&(l=f),H(d,l,ae)?{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}:j(d,l,ae)?{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,l.K)((t,e)=>Math.max(0,Math.min(t.max,e.max)-Math.max(t.min,e.min)),"projectedOverlapLength"),s=(0,l.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)&&H(t.boundary,e.boundary,1)}return(Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1)&&j(t.boundary,e.boundary,1)},"sameTerminalFace"),i=(0,l.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"),a=(0,l.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"),c=(0,l.K)((t,e)=>{const n=Q(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,l.K)(()=>Math.abs(t.boundary.y-t.rect.top)<1||Math.abs(t.boundary.y-t.rect.bottom)<1?j(o,t.boundary,ae)&&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)&&(H(o,t.boundary,ae)&&o.y>=t.rect.top+1&&o.y<=t.rect.bottom-1),"boundaryStaysOnSameFace")())return;if(t.atStart){const e=n.length>1&&D(n[1],t.railEnd,ae),s=n.slice(e?2:1),i=s[0];if(i&&!fe(i,r))return;return[o,r,...s]}const s=n.length>1&&D(n[n.length-2],t.railEnd,ae),i=n.slice(0,s?-2:-1),a=i[i.length-1];return!a||fe(a,r)?[...i,r,o]:void 0},"shiftedCandidate"),f=(0,l.K)(t=>{const n=t.edge,o=Q(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 j(u,h,ae)&&Math.abs(f-l)<1&&Math.abs(c-d)>1||H(u,h,ae)&&Math.abs(c-d)<1&&Math.abs(f-l)>1},"laneIsStraightCollinearConnector"),d=[-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],l=e[r];if(s.edge===l.edge||!i(s,l)&&!a(s,l))continue;const u=!i(s,l),h=[s,l].sort((t,e)=>{const n=f(t),o=f(e);return n!==o?Number(n)-Number(o):Number(!e.atStart)-Number(!t.atStart)});for(const t of h){for(const r of d){const s=c(t,r);if(!s)continue;const f=o({...t.edge,points:s},t.atStart);if(f&&!e.some(e=>e.edge!==t.edge&&(i(f,e)||u&&a(f,e)))){t.edge.points=s,n=!0;break}}if(n)break}}if(!n)return}}function le(t,e){const{realNodeRects:n,labelNodeRects:o}=lt(e.values()),r=(0,l.K)((e,r)=>{const s=e.start,i=e.end,a=ce(r);if(a.length!==r.length-1)return!1;const c=[s,i].filter(t=>Boolean(t));for(const t of a){if(gt(t.a,t.b,n,c,-2))return!1;if(gt(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 ce(Q(t))){if(U(e,n,.5)>=8)return!1;if(yt(e.a,e.b,n.a,n.b,ae))return!1}}return!0},"candidateIsSafe"),s=(0,l.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=_(n,o)&&V(o,r)&&_(r,s)&&V(s,i)&&H(n,s,ae)&&H(n,i,ae)&&H(o,r,ae)&&(o.x-n.x)*(s.x-r.x)<0,c=V(n,o)&&_(o,r)&&V(r,s)&&_(s,i)&&j(n,s,ae)&&j(n,i,ae)&&j(o,r,ae)&&(o.y-n.y)*(s.y-r.y)<0;if(a||c)return Q([...t.slice(0,e+1),i,...t.slice(e+5)]);if(e+5>=t.length)return;const f=t[e+5],d=V(n,o)&&_(o,r)&&V(r,s)&&_(s,i)&&V(i,f)&&H(n,i,ae)&&H(n,f,ae)&&H(r,s,ae)&&(r.x-o.x)*(i.x-s.x)<0,l=_(n,o)&&V(o,r)&&_(r,s)&&V(s,i)&&_(i,f)&&j(n,i,ae)&&j(n,f,ae)&&j(r,s,ae)&&(r.y-o.y)*(i.y-s.y)<0;return d||l?Q([...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=Q(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 ue(t,e){const{realNodeRects:n,labelNodeRects:o}=lt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,l.K)((t,e,n)=>Q(t===e?n??[]:t.points??[]),"pointsFor"),i=(0,l.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=ce(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=ce(s(r[a],t,e));for(const t of i)for(const e of o)yt(t.a,t.b,e.a,e.b,ae)&&n++}}return n},"strictCrossingCount"),a=(0,l.K)(t=>{const e=ce(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"),c=(0,l.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 W(e.a.x,e.b.x,n.left,n.right)>=8&&e.a.y>=n.top-2&&e.a.y<=n.bottom+2}return W(e.a.y,e.b.y,n.top,n.bottom)>=8&&e.a.x>=n.left-2&&e.a.x<=n.right+2})},"blockingRectsFor"),f=(0,l.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=wt(Q(o));return ce(r).length===r.length-1?r:void 0},"candidateByMovingRail"),d=(0,l.K)((t,e,a)=>{const c=[t.start,t.end].filter(t=>Boolean(t)),f=ce(e);if(f.length!==e.length-1)return!1;for(const t of f){if(gt(t.a,t.b,n,c,-2))return!1;if(gt(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 ce(s(e)))if(U(t,n,.5)>=8)return!1;return i(t,e)<=a},"candidateIsSafe");for(let t=0;t<8;t++){const t=i();let e=!1;for(const n of r){const o=s(n),r=a(o);if(!r)continue;const i=c(n,r.segment);if(0===i.length)continue;const l=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 l){const i=f(o,r.segment,s);if(i&&d(n,i,t)){n.points=i,e=!0;break}}if(e)break}if(!e)return}}function he(t,e){const n=(0,l.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,l.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,l.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ae||n>=e.bottom-ae)&&W(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 i=0;for(const e of t){if(e.isLayoutOnly)continue;const t=Q(e.points??[]);for(const e of ce(t))for(const t of s)r(e,t.rect)&&(i=Math.max(i,t.rect.bottom-e.a.y+4))}if(!(i<=ae))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-i/2,t.node.height=n+i,t.node.groupTitleRect={...t.rect,top:t.rect.top-i,bottom:t.rect.bottom-i})}}function ge(t,e){const n=(0,l.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,l.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,l.K)((t,e)=>{if(!t.vertical)return!1;const n=t.a.x;return!(n<=e.left+ae||n>=e.right-ae)&&W(t.a.y,t.b.y,e.top,e.bottom)>=8},"verticalSegmentIntersectsTitle"),s=(0,l.K)((t,e)=>{if(!t.horizontal)return!1;const n=t.a.y;return!(n<=e.top+ae||n>=e.bottom-ae)&&W(t.a.x,t.b.x,e.left,e.right)>=8},"horizontalSegmentIntersectsTitle"),i=[...e.values()].map(o).filter(t=>Boolean(t));if(0===i.length)return;let a=0;for(const e of t){if(e.isLayoutOnly)continue;const t=Q(e.points??[]);for(const e of ce(t))for(const t of i)if(r(e,t.rect))a=Math.max(a,t.rect.right-e.a.x+4);else if(s(e,t.rect)){const n=Math.min(e.a.x,e.b.x);a=Math.max(a,t.rect.right-n+4)}}if(!(a<=ae))for(const t of i){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-a/2,t.node.width=n+a,t.node.groupTitleRect={...t.rect,left:t.rect.left-a,right:t.rect.right-a})}}function pe(t,e){const{realNodeRects:n}=lt(e.values()),o=t.filter(t=>!t.isLayoutOnly),r=(0,l.K)((t,e=new Map)=>Q(e.get(t)??t.points??[]),"replacementPointsFor"),s=(0,l.K)((t=new Map)=>{let e=0;for(let n=0;n<o.length;n++){const s=ce(r(o[n],t));for(let i=n+1;i<o.length;i++){const n=ce(r(o[i],t));for(const t of s)for(const o of n)yt(t.a,t.b,o.a,o.b,ae)&&e++}}return e},"crossingCount"),i=(0,l.K)((t=new Map)=>o.reduce((e,n)=>e+J(r(n,t)),0),"totalBends"),a=(0,l.K)(t=>{const e=r(t);if(e.length<4)return;const n=e[e.length-2],o=e[e.length-1];return _(n,o,ae)||V(n,o,ae)?{tailStart:n,terminal:o}:void 0},"terminalTailFor"),c=(0,l.K)((t,e)=>{const n=r(t);if(n.length<3)return;const o=n[0],s=n[1];let i;if(_(o,s,ae))i={x:s.x,y:e.tailStart.y};else{if(!V(o,s,ae))return;i={x:e.tailStart.x,y:s.y}}const a=wt(Q([o,s,i,e.tailStart,e.terminal]));return ce(a).length===a.length-1?a:void 0},"candidateWithDestinationTail"),f=(0,l.K)((t,e)=>{const o=[t.start,t.end].filter(t=>Boolean(t));for(const t of ce(e))if(gt(t.a,t.b,n,o,-2))return!0;return!1},"pathHasNodeHit"),d=(0,l.K)((t,e,n)=>{for(const s of o)if(s!==t)for(const t of ce(e))for(const e of ce(r(s,n)))if(U(t,e,.5)>=8)return!0;return!1},"pathHasSharedTrack"),u=(0,l.K)((t,e,n)=>!f(t,e)&&!d(t,e,n),"candidateIsSafe"),h=(0,l.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=i();for(const r of h().values())for(let f=0;f<r.length;f++)for(let d=f+1;d<r.length;d++){const l=r[f],h=r[d],g=a(l),p=a(h);if(!g||!p)continue;const x=c(l,p),m=c(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=i(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 xe(t,e){const{realNodeRects:n,labelNodeRects:o}=lt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,l.K)((t,e=new Map)=>Q(e.get(t)??t.points??[]),"replacementPointsFor"),i=(0,l.K)((t=new Map)=>{let e=0;for(let n=0;n<r.length;n++){const o=ce(s(r[n],t));for(let i=n+1;i<r.length;i++){const n=ce(s(r[i],t));for(const t of o)for(const o of n)yt(t.a,t.b,o.a,o.b,ae)&&e++}}return e},"strictCrossingCount"),a=(0,l.K)((t=new Map)=>r.reduce((e,n)=>e+J(s(n,t)),0),"totalBends"),c=(0,l.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?it(r):void 0,a=s?it(s):void 0;return i&&a?{src:i,dst:a}:void 0},"endpointRectsFor"),f=(0,l.K)((t,e,n)=>{if(n.index<=0||n.index+1>=e.length-1)return;const o=c(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-ae?"left":r>i+ae?"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-ae?"top":r>i+ae?"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"),d=(0,l.K)(()=>{const t=[];for(const e of r){const n=s(e);for(const o of ce(n)){const r=f(e,n,o);r&&t.push(r)}}return t},"collectExternalRails"),u=(0,l.K)((t,e)=>t.edge!==e.edge&&t.axis===e.axis&&t.side===e.side&&W(t.min,t.max,e.min,e.max)>=8,"railsInteract"),h=(0,l.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,l.K)(t=>{const e=[];for(const n of t)e.some(t=>Math.abs(t-n.coord)<ae)||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,l.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=[],i=(0,l.K)(()=>{if(s.length!==t.length)for(const[t,e]of n.entries())r[t]||(r[t]=!0,s.push(e),i(),s.pop(),r[t]=!1);else s.some((t,n)=>Math.abs(t-e[n])>=ae)&&o.push([...s])},"visit");return i(),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,l.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=wt(Q(e));if(ce(n).length!==n.length-1)return;o.set(t,n)}return o},"replacementsForAssignment"),m=(0,l.K)(t=>{for(const[e,r]of t){const t=[e.start,e.end].filter(t=>Boolean(t));for(const e of ce(r)){if(gt(e.a,e.b,n,t,-2))return!1;if(gt(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=ce(s(n,t));for(let n=e+1;n<r.length;n++){const e=r[n];if(!o&&!t.has(e))continue;const a=ce(s(e,t));for(const t of i)for(const e of a)if(U(t,e,.5)>=8)return!1}}return!0},"candidateIsSafe");for(let t=0;t<4;t++){const t=i();if(0===t)return;let e,n=t,o=a(),r=Number.POSITIVE_INFINITY;for(const s of h(d()))for(const c of p(s)){const f=x(s,c);if(!f||!m(f))continue;const d=i(f);if(d>=t)continue;const l=a(f),u=s.reduce((t,e,n)=>t+Math.abs(c[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 me(t,e){const{realNodeRects:n,labelNodeRects:o}=lt(e.values()),r=t.filter(t=>!t.isLayoutOnly),s=(0,l.K)((t,e,n)=>Q(t===e?n??[]:t.points??[]),"pointsFor"),i=(0,l.K)(t=>ce(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"),a=(0,l.K)((t,e)=>{let n=0;for(let o=0;o<r.length;o++){const i=ce(s(r[o],t,e));for(let a=o+1;a<r.length;a++){const o=ce(s(r[a],t,e));for(const t of i)for(const e of o)yt(t.a,t.b,e.a,e.b,ae)&&n++}}return n},"strictCrossingCount"),c=(0,l.K)((t,e)=>{if(t.horizontal){const n=t.a.y;return(Math.abs(n-e.top)<1||Math.abs(n-e.bottom)<1)&&W(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)&&W(t.a.y,t.b.y,e.top,e.bottom)>=8}return!1},"segmentRunsAlongRectBorder"),f=(0,l.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?it(n):void 0;r&&o.push(r)}return o},"endpointRectsFor"),d=(0,l.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=_(n,o,ae)&&V(o,r,ae)&&_(r,s,ae),a=V(n,o,ae)&&_(o,r,ae)&&V(r,s,ae);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=H(n,s,ae)||j(n,s,ae)?[]:[{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=>wt(Q(t))).filter(t=>{if(ce(t).length!==t.length-1)return!1;if(!t.some(t=>D(t,s,ae)))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,l.K)((t,e,i)=>{const d=[t.start,t.end].filter(t=>Boolean(t)),l=f(t);for(const t of ce(e)){if(gt(t.a,t.b,n,d,-2))return!1;if(gt(t.a,t.b,o,[],-2))return!1;if(l.some(e=>c(t,e)))return!1}for(const n of r)if(n!==t)for(const t of ce(e))for(const e of ce(s(n)))if(U(t,e,.5)>=8)return!1;return a(t,e)<=i},"candidateIsSafe");for(let t=0;t<8;t++){const t=a();let e,n,o=t,c=Number.POSITIVE_INFINITY,f=Number.POSITIVE_INFINITY;for(const l of r){const r=s(l),h=J(r,ae),g=i(r);for(let s=0;s<=r.length-4;s++)for(const p of d(r,s)){const r=J(p,ae),s=i(p);if(!(r<h||r===h&&s<g-ae)||!u(l,p,t))continue;const d=a(l,p);d>o||d===o&&(r>c||r===c&&s>=f)||(e=l,n=p,o=d,c=r,f=s)}}if(!e||!n)return;e.points=n}}function ye(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=it(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})),i=["top","bottom","left","right"],a={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},c=t.filter(t=>!t.isLayoutOnly),f=new Map(c.map((t,e)=>[t,e])),d=(0,l.K)(t=>{const e="left"===t||"top"===t?-1:1,o=[];for(let r=0;r<=2;r++)o.push(a[t]+e*n*r);return o},"outwardTracksForSide"),u=(0,l.K)((t,e=new Map)=>Q(e.get(t)??t.points??[]),"replacementPointsFor"),h=(0,l.K)((t,e)=>{let n=0;for(const o of t)for(const t of e)yt(o.a,o.b,t.a,t.b,ae)&&n++;return n},"crossingCountBetweenSegments"),g=(0,l.K)((t,e)=>h(ce(t),ce(e)),"crossingCountBetweenPaths"),p=(0,l.K)((t=new Map)=>{let e=0;const n=[],o=new Set,r=[],s=(0,l.K)(t=>{o.has(t)||(o.add(t),r.push(t))},"addEdge");for(let o=0;o<c.length;o++){const r=c[o],i=u(r,t);for(let a=o+1;a<c.length;a++){const o=c[a],f=g(i,u(o,t));f>0&&(e+=f,n.push({first:r,second:o,count:f}),s(r),s(o))}}return r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),{count:e,pairs:n,edgeSet:o,edges:r}},"crossingSnapshot"),x=(0,l.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<c.length;t++){const o=c[t],s=n.has(o),i=u(o,e);for(let o=t+1;o<c.length;o++){const t=c[o];(s||n.has(t))&&(r+=g(i,u(t,e)))}}return t.count-o+r},"crossingCountWithReplacements"),m=(0,l.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)=>(f.get(t)??0)-(f.get(e)??0)),s.length>1&&n.push(s)}return n},"crossingComponents"),y=(0,l.K)(t=>[t.start,t.end].filter(t=>Boolean(t)),"endpointIdsFor"),b=(0,l.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 c)t.has(e)||y(e).some(t=>o.has(t))&&r.push(e);r.sort((t,e)=>(f.get(t)??0)-(f.get(e)??0)),e.push(r)}return e},"pairSearchGroups"),M=(0,l.K)((t,e,n)=>x(t,new Map([[e,n]])),"crossingCountWithSingleReplacement"),K=(0,l.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,l.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"),w=(0,l.K)((t=new Map)=>c.reduce((e,n)=>e+J(u(n,t)),0),"totalBends"),S=(0,l.K)((t=new Map)=>c.reduce((e,n)=>e+I(u(n,t)),0),"totalLength"),v=(0,l.K)((t,e,n=new Map)=>{const o=ce(e);for(const e of c)if(e!==t)for(const t of o)for(const o of ce(u(e,n)))if(U(t,o,.5)>=8)return!0;return!1},"pathHasSegmentConflict"),C=(0,l.K)((t,e)=>{const n=[t.start,t.end].filter(t=>Boolean(t));for(const t of ce(e))if(gt(t.a,t.b,s,n,-2))return!0;return!1},"pathHitsNode"),L=(0,l.K)((t,e)=>{const n=wt(Q(e));ce(n).length===n.length-1&&t.push(n)},"pushOrthogonalCandidate"),k=(0,l.K)(t=>"left"===t||"right"===t,"sideIsHorizontal"),T=(0,l.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"),$=(0,l.K)((t,e,o,r)=>{const s="left"===o||"top"===o?-1:1,i=[T(e,o,r),a[o]];for(const a of i)for(let i=0;i<=2;i++)L(t,ft(e,o,r,a+s*n*i))},"addSameSideCandidates"),R=(0,l.K)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))L(t,[e,{x:s,y:e.y},{x:s,y:n},{x:o.x,y:n},o])},"addHorizontalToVerticalCandidates"),O=(0,l.K)((t,e,n,o,r)=>{for(const s of d(n))for(const n of d(r))L(t,[e,{x:e.x,y:s},{x:n,y:s},{x:n,y:o.y},o])},"addVerticalToHorizontalCandidates"),N=(0,l.K)((t,e,n,o,r)=>{const s=[...d("top"),...d("bottom")];for(const i of d(n))for(const n of d(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,l.K)((t,e,n,o,r)=>{const s=[...d("left"),...d("right")];for(const i of d(n))for(const n of d(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"),E=(0,l.K)(t=>{const e=new Set;return t.map(t=>Q(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"),F=(0,l.K)((t,e,o,r)=>{const s=[],i=ct(t,e,o,r,n,ae);i&&L(s,i),e===r&&$(s,t,e,o);const a=k(e),c=k(r);return a&&!c?R(s,t,e,o,r):!a&&c?O(s,t,e,o,r):a?N(s,t,e,o,r):B(s,t,e,o,r),E(s)},"buildCandidatesForSides"),Y=(0,l.K)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const a of i){const i=at(o,a),c="top"===a||"bottom"===a?d(a):s;for(const o of r){L(t,[e,n,{x:o,y:n.y},{x:o,y:i.y},i]);for(const r of c)L(t,[e,n,{x:o,y:n.y},{x:o,y:r},{x:i.x,y:r},i])}}},"addVerticalDepartureOuterTrackCandidates"),X=(0,l.K)((t,e,n,o)=>{const r=[...d("left"),...d("right")],s=[...d("top"),...d("bottom")];for(const a of i){const i=at(o,a),c="left"===a||"right"===a?d(a):r;for(const o of s){L(t,[e,n,{x:n.x,y:o},{x:i.x,y:o},i]);for(const r of c)L(t,[e,n,{x:n.x,y:o},{x:r,y:o},{x:r,y:i.y},i])}}},"addHorizontalDepartureOuterTrackCandidates"),P=(0,l.K)(t=>{const e=t.start,n=t.end,o=n?r.get(n):void 0;if(!e||!o)return[];const s=Q(t.points??[]);if(s.length<4)return[];const i=s[0],a=s[1],c=[];return V(i,a,ae)?Y(c,i,a,o):_(i,a,ae)&&X(c,i,a,o),c},"terminalPreservingOuterTrackCandidates"),z=(0,l.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 a=[];for(const t of i){const e=at(o,t);for(const n of i)a.push(...F(e,t,at(s,n),n))}return a.push(...P(t)),a},"candidatePathsFor"),A=(0,l.K)(()=>new Map(c.map(t=>[t,ce(u(t))])),"currentSegmentsByEdge"),G=(0,l.K)((t,e,n)=>{const o=new Set;for(const r of c){if(r===t)continue;const s=n.get(r)??ce(u(r));e.some(t=>s.some(e=>U(t,e,.5)>=8))&&o.add(r)}return o},"sharedTrackConflictsFor"),D=(0,l.K)((t,e,n,o)=>{const r=new Set;return z(t).map(t=>wt(Q(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=ce(r);let i=0;for(const e of c)e!==t&&(i+=h(s,n.get(e)??ce(u(e))));return{candidate:r,candidateSegments:s,crossings:e.count-(o.get(t)??0)+i,bends:J(r,ae),totalBends:J(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:G(t,e.candidateSegments,n),totalBends:e.totalBends,length:e.length}))},"pairCandidatesFor"),H=(0,l.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 c){if(t===e||t===o)continue;const i=s.get(t)??ce(u(t));a+=h(n.segments,i)+h(r.segments,i)}return t.count-i+a},"pairCrossingCount"),j=(0,l.K)((t,e)=>{for(const n of t.sharedTrackConflicts)if(n!==e)return!1;return!0},"conflictsOnlyWith"),W=(0,l.K)((t,e)=>t.segments.some(t=>e.segments.some(e=>U(t,e,.5)>=8)),"candidatesShareTrack"),q=(0,l.K)((t,e,n,o)=>j(e,n.edge)&&j(o,t.edge)&&!W(e,o),"pairCandidatesAreCompatible"),Z=(0,l.K)((t,e,n,o,r)=>{const s=H(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"),tt=(0,l.K)((t,e)=>t.crossings<e.crossings||t.crossings===e.crossings&&(t.bends<e.bends||t.bends===e.bends&&t.length<e.length),"pairScoreIsBetter"),et=(0,l.K)((t,e,n,o)=>{let r=o;for(const o of e.candidates)for(const s of n.candidates){if(!q(e,o,n,s))continue;const i=Z(t,e,o,n,s);i&&tt(i,r)&&(r=i)}return r},"bestScoreForOptionPair"),nt=(0,l.K)(t=>{const e=w(),n=S(),o=A(),r=K(t),s=new Map(c.map(t=>[t,J(u(t))])),i=new Map(c.map(t=>[t,I(u(t))])),a=new Map,f=b(t);for(const e of f)for(const n of e){if(a.has(n))continue;const e=D(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 f){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=et(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=J(u(i),ae);for(const c of z(i)){const f=C(i,c),d=!f&&v(i,c),l=M(t,i,c),u=J(c,ae);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=nt(t);if(!i)return;for(const[t,e]of i)t.points=e}}(0,l.K)(de,"separateSharedRenderedTerminalLanes"),(0,l.K)(le,"collapseRedundantRectangularDoglegs"),(0,l.K)(ue,"liftObstacleHuggingSameSideRails"),(0,l.K)(he,"liftTopLaneTitleBandsAboveRails"),(0,l.K)(ge,"shiftLeftLaneTitleBandsLeftOfRails"),(0,l.K)(pe,"swapDestinationTerminalTailsToReduceCrossings"),(0,l.K)(xe,"reassignCrossingExternalRailChannels"),(0,l.K)(me,"shortcutRedundantOrthogonalJogs"),(0,l.K)(ye,"resolveRenderedOrthogonalCrossings");var be=.001;function Me(t,e){const{nodeInfoById:n,realNodeRects:o}=dt(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},i=(0,l.K)((t,e,n,o)=>{const r=[],i=ct(t,e,n,o,20,be);return i&&r.push(i),e===o&&r.push(ft(t,e,n,s[e])),r},"buildOrthogonalPathCandidates"),a=(0,l.K)((t,e)=>{for(let n=0;n<t.length-1;n++){if(gt(t[n],t[n+1],o,e,1))return!0}return!1},"pathHitsNode"),c=(0,l.K)((e,n,o=!1)=>{let r=0;const s=q(e,be),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 q(f,be))(pt(t.a,t.b,e.a,e.b,be,be)||U(t,e,be)>=8)&&r++}return r},"pathConflictCount"),f=(0,l.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"),d=new Map,u=(0,l.K)((t,e,n)=>{const o=d.get(t)??[];o.push({side:e,edgeId:n}),d.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,f(t[0],e),o)}if(s){const e=n.get(s);e&&u(s,f(t[t.length-1],e),o)}}const h=(0,l.K)((t,e,n)=>d.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=J(t,be);if(o<4)continue;const s=e.start,l=e.end;if(!s||!l)continue;const g=n.get(s),p=n.get(l);if(!g||!p)continue;const x=e.id??"",m=c(t,e,!0),y=c(t,e);let b,M=m,K=o;for(const t of r){if(h(s,t,x))continue;const n=at(g,t);for(const o of r){if(h(l,o,x))continue;const r=at(p,o);for(const f of i(n,t,r,o)){if(a(f,[s,l]))continue;const t=J(f,be);if(m>0){const n=c(f,e,!0);if(n>M||n===M&&t>=K)continue;M=n,K=t,b=f;continue}c(f,e)>y||t<K&&(K=t,b=f)}}}if(b){e.points=b;const t=d.get(s);t&&d.set(s,t.filter(t=>t.edgeId!==x));const n=d.get(l);n&&d.set(l,n.filter(t=>t.edgeId!==x)),u(s,f(b[0],g),x),u(l,f(b[b.length-1],p),x)}}}(0,l.K)(Me,"simplifyDetouredEdges");var Ke=.001;function Ie(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)<Ke)){if(Math.abs(a)<=Ke){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)<=Ke){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 we(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 Se(t,e){const n=Q(e);return[Ie(n,!0),Ie(n,!1)].some(e=>e&&ot(t,we(e)))}function ve(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=it(t);e&&r.push({id:t.id,rect:e});continue}if(e)continue;if(t.isEdgeLabel)continue;const s=it(t);s&&o.push({nodeId:t.id,rect:s})}const s=(0,l.K)((t,e)=>{const n=rt(e,3);for(const{nodeId:e,rect:r}of o)if(e!==t&&ot(n,r))return!0;return!1},"labelOverlapsForeignNode"),i=(0,l.K)((t,e)=>{const o=rt(e,3);for(const e of n)if(e.edgeId!==t&&tt(e.p1,e.p2,o))return!0;return!1},"labelOverlapsForeignEdge"),a=(0,l.K)((t,e,n)=>s(t,n)||i(e,n),"labelOverlapsAnything"),c=[],f=(0,l.K)(t=>{for(const{id:e,rect:n}of r)if(nt(n,t))return e},"findContainingLane"),d=(0,l.K)((t,e)=>c.some(n=>n.labelId!==t&&ot(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<Ke&&r<Ke||(o>=Ke&&r>=Ke||p.push({idx:t,length:o+r,orientation:o>=Ke?"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,l.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],w=(0,l.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"),S=(0,l.K)((t,e,n)=>Math.min(n,Math.max(e,t)),"clamp"),v=(0,l.K)((t,e)=>t.midX>=e.left-Ke&&t.midX<=e.right+Ke&&t.midY>=e.top-Ke&&t.midY<=e.bottom+Ke,"pointInsideRectInclusive"),C=(0,l.K)(t=>{const e=st(t.midX,t.midY,h,g),n=f(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 d={midX:S(t.midX,s,i),midY:S(t.midY,a,c)},l=st(d.midX,d.midY,h,g);return v(t,l)?{laneId:o.id,anchor:d,rect:l}:void 0},"placementForAnchor"),L=(0,l.K)((t,e,n)=>"horizontal"===t.orientation?Math.abs(e.midX-n.x):Math.abs(e.midY-n.y),"distanceAlongSegment"),k=(0,l.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)+Ke<n)return!1}if(t===K){const o=u[t.idx+1];if(L(t,e,o)+Ke<n)return!1}return!0},"labelClearsTerminalEndpoints"),T=(0,l.K)(e=>{const o=b(e);for(const e of o)for(const o of I){const r=w(e,o);if(!k(e,r))continue;const s=C(r);if(s&&(!Se(s.rect,u)&&!d(t,s.rect)&&!a(t,n.id,s.rect)))return{laneId:s.laneId,anchor:s.anchor}}},"tryPool"),$=(0,l.K)((e,o,r=!1)=>{const a=b(e);for(const e of a){const a={midX:e.midX,midY:e.midY};if(o&&!k(e,a))continue;const c=C(a);if(c&&!Se(c.rect,u)&&!d(t,c.rect)&&!s(t,c.rect)&&(r||!i(n.id,c.rect)))return{laneId:c.laneId,anchor:c.anchor}}},"findLaneContainingFallback"),R=T(m)??(m.length<p.length?T(p):void 0)??$(p,!0)??$(p,!1)??$(p,!1,!0);if(R){o.x=R.anchor.midX,o.y=R.anchor.midY,o.parentId=R.laneId;const e=st(R.anchor.midX,R.anchor.midY,h,g),n=c.findIndex(e=>e.labelId===t);n>=0?c[n]={labelId:t,rect:e}:c.push({labelId:t,rect:e})}}}(0,l.K)(Ie,"markerClearanceRectFor"),(0,l.K)(we,"normalizeRect"),(0,l.K)(Se,"labelOverlapsOwnMarker"),(0,l.K)(ve,"anchorLabelsToPolyline");var Ce=1e-6;function Le(t,e){return t<e?`${t}::${e}`:`${e}::${t}`}function ke(t,e){const{nodeInfoById:n,realNodeRects:o}=dt(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,l.K)((e,n,o,s)=>{const i=Le(n,o);let a=0;const c=(0,l.K)(t=>{if(!t)return;const e=r.get(t);if(!e)return;const n="x"===s?e.w/2:e.h/2;n>a&&(a=n)},"consider");c(e.labelNodeId);for(const n of t){if(n===e)continue;if(n.isLayoutOnly)continue;const t=n.start,o=n.end;t&&o&&(Le(t,o)===i&&c(n.labelNodeId))}return a>0?a+3:0},"labelClearanceFor");for(const e of t){if(e.isLayoutOnly)continue;if(!Z(e.points,Ce))continue;const r=ht(e,n,Ce);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(gt(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(!gt(r,s,o,[i,a],1)&&!mt(r,s,t,e,{epsilon:Ce})){e.points=[r,s];break}}}}function Te(t,e){const n=.001,{realNodeRects:o,labelNodeRects:r}=lt(e.values()),s=(0,l.K)((t,e)=>q(e,n).map(n=>({...n,edge:t,interior:n.index>=1&&n.index<=e.length-3})),"segmentsFor"),i=(0,l.K)(()=>{const e=[];for(const n of t){if(n.isLayoutOnly)continue;const t=n.points;!t||t.length<2||e.push(...s(n,Q(t)))}return e},"allSegments"),a=(0,l.K)((t,e)=>t.horizontal&&e.horizontal?W(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)&&(W(t.a.y,t.b.y,e.a.y,e.b.y)>=8&&Math.abs(t.a.x-e.a.x)<7),"hasCrowdedParallelTrack"),c=(0,l.K)((e,i)=>{const c=e.start,f=e.end,d=s(e,i);if(d.length!==i.length-1)return!1;const l=[c,f].filter(t=>Boolean(t)),u=e.labelNodeId?[e.labelNodeId]:[];for(const t of d){if(gt(t.a,t.b,o,l,-2))return!1;if(gt(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,Q(t))){if(a(e,r))return!1;if(yt(e.a,e.b,r.a,r.b,n))return!1}}return!0},"candidateIsSafe"),f=(0,l.K)((t,e)=>{const n=Q(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"),d=(0,l.K)((t,e)=>({x:t.x??(e.left+e.right)/2,y:t.y??(e.top+e.bottom)/2}),"nodeCenter"),u=(0,l.K)(t=>{const n=t.edge,o=Q(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?it(r):void 0,a=s?it(s):void 0,c=o.slice(t.index+2);return r&&s&&i&&a&&0!==c.length?{sourceCenter:d(r,i),targetCenter:d(s,a),sourceRect:i,tail:c}:void 0},"sourceDetourContextFor"),h=(0,l.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 Q([{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,l.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 Q([{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,l.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=i();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||!a(r,s))continue;const i=[r,s].filter(t=>t.interior);for(const t of i){for(const n of x){const o=f(t,n);if(o&&c(t.edge,o)){t.edge.points=o,e=!0;break}const r=p(t,n);if(r&&c(t.edge,r)){t.edge.points=r,e=!0;break}}if(e)break}}if(!e)return}}function $e(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 Re(t){const e=t.nodes??[],n=t.edges??[],o=[];if(!n.length||!e.length)return o;const r=ut(e),s=[];for(const t of n){if(t.isLayoutOnly)continue;const e=t.points;if(!e||e.length<2)continue;const n=t.start,i=t.end,a=t.labelNodeId,c=t.id??`${n}->${i}`;for(const t of r)if(t.nodeId!==n&&t.nodeId!==i&&(!a||t.nodeId!==a))for(let n=0;n<e.length-1;n++)if(tt(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++)s.push({edgeId:c,start:n,end:i,p1:e[t],p2:e[t+1]})}const i=new Set;for(let t=0;t<s.length;t++)for(let e=t+1;e<s.length;e++){const n=s[t],r=s[e];if(n.edgeId!==r.edgeId&&(n.start!==r.start&&n.start!==r.end&&n.end!==r.start&&n.end!==r.end&&$e(n.p1,n.p2,r.p1,r.p2))){const t=n.edgeId<r.edgeId?`${n.edgeId}|${r.edgeId}`:`${r.edgeId}|${n.edgeId}`;i.has(t)||(i.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;d.R.warn(`[SWIMLANE_VALIDATE] ${o.length} issue(s) detected: ${t} edge-node overlap(s), ${e} edge crossing(s)`);for(const t of o)d.R.warn(`[SWIMLANE_VALIDATE] ${t.type}: ${t.detail}`)}return o}function Oe(t,e){const n=t.nodes??[],o=t.edges??[],r=n.filter(t=>!t.isGroup);if(("LR"===e||"RL"===e)&&r.length>0&&!ne(t,e))return;if("BT"===e&&r.length>0&&!ee(t))return;for(const t of o){if(t.isLayoutOnly)continue;const e=t.points;!e||e.length<2||(t.points=wt(It(e)))}Me(o,n),ke(o,n),se(o,n);const s=new Map;for(const t of n)s.set(String(t.id),t);ve(o,s),kt(o,s),ie(o,s),Te(o,s),de(o,s),le(o,s),ue(o,s),pe(o,s);const i=(0,l.K)(()=>{ye(o,s),xe(o,s),me(o,s),ve(o,s),Vt(o,s),ue(o,s),ve(o,s),Vt(o,s)},"finalizeRenderedEdges");i(),Te(o,s),i(),he(o,s),ge(o,s),he(o,s),ge(o,s)}function Ne(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 Be(t,e){return t.edges.filter(t=>t.dst===e)}function Ee(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 Fe(t){const e=Ee(t);for(const t of e.values())t.sort((t,e)=>t.localeCompare(e));return e}function Ye(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 Xe(t){return[...t.entries()].filter(([,t])=>0===t).map(([t])=>t).sort((t,e)=>t.localeCompare(e))}function Pe(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 ze(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 Ae(t){const e=Ye(t),n=Xe(e),o=[],r=Fe(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 Ge(t){const e=new Map;let n=0;for(const o of t)e.set(o,n),n++;return e}function De(t){const e=new Array(t.length),n=(0,l.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 He(t){const e=Ne(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,l.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"),i=[...e.nodes].sort((t,e)=>t.localeCompare(e));for(const t of i)0===o[t]&&s(t);const a=new Set(r.map(t=>`${t.id}:${t.src}->${t.dst}`)),c=e.edges.map(t=>a.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:c,layout:e.layout,nodeById:new Map(e.nodeById)},reversed:r}}function je(t){const e=new Map,n=(0,l.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 _e(t){const e=je(t);return t=>e.get(t)??null}function Ve(t){const e=[];for(const n of t.layout.nodes??[])n.isGroup&&!n.parentId&&e.push(n.id);return[...new Set(e)].reverse()}function We(t,e){const n=Ve(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,l.K)(Le,"pairKey"),(0,l.K)(ke,"straightenCollinearSiblingDetours"),(0,l.K)(Te,"nudgeSharedInteriorSubpaths"),(0,l.K)($e,"segmentsIntersect"),(0,l.K)(Re,"validateSwimlanesLayout"),(0,l.K)(Oe,"postProcessSwimlaneLayout"),(0,l.K)(Ne,"normalizeGraph"),(0,l.K)(Be,"incoming"),(0,l.K)(Ee,"buildSuccessorMap"),(0,l.K)(Fe,"buildSortedSuccessorMap"),(0,l.K)(Ye,"buildInDegreeMap"),(0,l.K)(Xe,"sortedZeroInDegreeNodes"),(0,l.K)(Pe,"buildPredecessorSuccessorMaps"),(0,l.K)(ze,"buildLayersFromRanks"),(0,l.K)(Ae,"topoSortIfAcyclic"),(0,l.K)(Ge,"buildLayerIndex"),(0,l.K)(De,"countInversions"),(0,l.K)(He,"removeCycles_DFS"),(0,l.K)(je,"buildTopLaneMap"),(0,l.K)(_e,"createTopLaneResolver"),(0,l.K)(Ve,"buildTopLaneOrder"),(0,l.K)(We,"resolveTopLaneOrder");var Ue=8,qe=4,Je=!0,Qe=100,Ze=40;function tn(t,e){const n=Ne(t),o=e?.laneOf??(()=>null),r=e?.rankHint,{preds:s}=Pe(n);for(const t of s.values())t.sort((t,e)=>t.localeCompare(e));const i=Ae(n)??[...n.nodes].sort((t,e)=>t.localeCompare(e)),a=new Map;for(const[t,e]of i.entries())a.set(e,t);const c=new Map,f=new Map;for(const t of n.nodes)f.set(t,[]);for(const t of i){const e=(s.get(t)??[]).filter(t=>c.has(t));if(e.length>0){const n=en(t,e,{laneOf:o,rankHint:r,topoIndex:a});c.set(t,n),f.get(n).push(t)}else c.has(t)||c.set(t,null)}for(const t of n.nodes)c.has(t)||c.set(t,null);const d=new Set;for(const t of n.nodes)null===(c.get(t)??null)&&d.add(t);const u=[...d].sort((t,e)=>{const n=a.get(t)??0,o=a.get(e)??0;return n===o?t.localeCompare(e):n-o}),h=nn(n),g=new Map;for(const[t,e]of h.entries())g.set(t,[...e].sort((t,e)=>t.localeCompare(e)));const p=on(g),x=rn(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,l.K)(t=>{if(!M.has(t)){M.add(t),y.push(t);for(const e of f.get(t)??[])K(e);b.push(t)}},"walk");for(const t of u)K(t);for(const t of i)K(t);return{parent:c,children:f,roots:u,componentOf:p,blocks:x,nodeBlocks:m,adjacency:g,preorder:y,postorder:b,topologicalOrder:i}}function en(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 nn(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 on(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 rn(t){const e=new Map,n=new Map,o=[],r=[];let s=0;const i=(0,l.K)((a,c)=>{e.set(a,++s),n.set(a,s);for(const f of t.get(a)??[])f!==c&&(e.has(f)?(e.get(f)??0)<(e.get(a)??0)&&(o.push([a,f]),n.set(a,Math.min(n.get(a)??s,e.get(f)??s))):(o.push([a,f]),i(f,a),n.set(a,Math.min(n.get(a)??s,n.get(f)??s)),(n.get(f)??0)>=(e.get(a)??0)&&r.push(sn(a,f,o,r.length))))},"visit");for(const n of t.keys())e.has(n)||i(n,null);return r}function sn(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 an(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,i=new Array(s).fill(-1),a=new Array(s).fill(0),c=[],f=new Set;for(const t of o){const e=n.parent.get(t)??null,o=r.get(t);null!=o&&(null==e&&(i[o]=-1,a[o]=0,f.has(t)||(f.add(t),c.push(t))))}for(;c.length>0;){const t=c.shift(),e=r.get(t);if(null==e)continue;const o=n.children.get(t)??[];for(const t of o){if(f.has(t))continue;const n=r.get(t);null!=n&&(i[n]=e,a[n]=a[e]+1,f.add(t),c.push(t))}}for(const t of o){if(f.has(t))continue;const e=r.get(t);null!=e&&(i[e]=-1,a[e]=0,f.add(t))}const d=Math.max(1,Math.ceil(Math.log2(Math.max(1,s)))+1),u=Array.from({length:d},()=>new Array(s).fill(-1));for(let t=0;t<s;t++)u[0][t]=i[t];for(let t=1;t<d;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,l.K)((t,e)=>{if(-1===t||-1===e)return-1;a[t]<a[e]&&([t,e]=[e,t]);const n=a[t]-a[e];for(let e=0;e<d;e++)if(n>>e&1&&-1===(t=u[e][t]))return-1;if(t===e)return t;for(let n=d-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,l.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,l.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 cn(t,e,n){const o=new Map,r=(0,l.K)(t=>{let s=n[t]??0;const i=[...e.get(t)??[]];i.sort(fn(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 fn(t){return(e,n)=>{const o=t[e]??0,r=t[n]??0;return o===r?e.localeCompare(n):o-r}}function dn(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},()=>[]),i=new Set,a=(0,l.K)(t=>{if(i.has(t))return;i.add(t);const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t);for(const e of o(t))a(e)},"emit");for(const e of t)a(e);for(const t of e)if(!i.has(t)){const e=n[t]??0;s[e]||(s[e]=[]),s[e].push(t),i.add(t)}return s}function ln(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 un(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 hn(t,e,n){const o=tn(t,{rankHint:e,laneOf:n}),{children:r,roots:s}=o;for(const e of t.nodes)r.has(e)||r.set(e,[]);const i=an(t,e,o),a=[...s].sort(fn(e)),c=un(r,e,i,cn(a,r,e));let f=dn(a,t.nodes,e,c);return f=ln(f),f}function gn(t,e,n){const o=new Set(t),r=new Set(e),s=Ge(e),i=[];for(const t of n)o.has(t.src)&&r.has(t.dst)&&i.push(s.get(t.dst));return De(i)}function pn(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+=gn(t[e],t[e+1],o);return r}function xn(t,e){const n={...e},{preds:o}=Pe(t),r=_e(t);let s=pn(hn(t,n,r),t.edges,n);const i=qe;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=pn(hn(t,n,r),t.edges,n);d<s?(s=d,e=!0):n[a]=f}if(!e)break}return n}function mn(t,e){const n=_e(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 yn(t,e){const n=Ne(t),o=Ae(n)??[...n.nodes].sort(),r=e?.compactSingleInput??!1,s=_e(n);let i=Object.create(null);for(const t of o){const o=Be(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=xn(n,i)),e?.ignoreCrossLaneEdges&&mn(n,i);return{layers:hn(n,i,s),rankOf:i,dummy:new Set}}function bn(t,e){const n=Ne(t),o={...yn(n,{compactSingleInput:e?.compactSingleInput,ignoreCrossLaneEdges:e?.ignoreCrossLaneEdges,optimizeRanksByCrossings:e?.optimizeRanksByCrossings}).rankOf},r=_e(n),{preds:s,succs:i}=Pe(n,t=>{if(e?.ignoreCrossLaneEdges){const e=r(t.src),n=r(t.dst);if(e&&n&&e!==n)return!1}return!0}),a=Ae(n)??[...n.nodes],c=[...a].reverse(),f=(0,l.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 a=i.get(t)??[];return a.length>0&&(r=Math.min(...a.map(t=>(o[t]??0)-1))),Number.isFinite(r)||(r=Math.max(n,e)),Math.min(Math.max(e,n),r)},"clampFeasible"),d=Ue,u=(0,l.K)(t=>{let e=!1;for(const n of t){const t=s.get(n)??[],r=i.get(n)??[];if(0===t.length&&0===r.length)continue;const a=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,d=Math.round((a+c)/2),l=f(n,d);l!==o[n]&&(o[n]=l,e=!0)}return e},"relaxOrder");for(let t=0;t<d;t++){const t=u(a),e=u(c);if(!t&&!e)break}for(const t of a){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 c){const e=i.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:ze(n,a,o),rankOf:o,dummy:new Set}}function Mn(t){const e=Ye(t),n=Fe(t);let o=Xe(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 Kn(t,e){const n=Ne(t),o="LR"===e?.direction?Mn(n)??[...n.nodes].sort():Ae(n)??[...n.nodes].sort(),r=_e(n),s=(0,l.K)(t=>r(t)??t,"laneOf"),i=Object.create(null),a=new Map,c=(0,l.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=Be(n,t);let r=0;if(o.length>0)for(const e of o){const n=e.src,o=i[n]??0;r=Math.max(r,o+c(n,t))}const f=s(t),d=a.get(f)??0,l=Math.max(r,d);i[t]=l,a.set(f,l+1)}return{layers:ze(n,o,i,{skipGroups:!0}),rankOf:i,dummy:new Set}}function In(t,e){const n=Ne(e),{rankOf:o}=t,r=t.layers.map(t=>[...t]),s=new Set(t.dummy?[...t.dummy]:[]);let i=0;const a=new Map(n.nodeById),c=(0,l.K)(t=>{const e="placeholder-"+i++,n={id:e,isGroup:!1,isDummy:!0,width:0,height:0};for(a.set(e,n),s.add(e);r.length<=t;)r.push([]);return r[t].push(e),o[e]=t,e},"addDummyAt"),f=[...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)),d=[];for(const t of f){const e=o[t.src]??0,n=o[t.dst]??0;if(n-e<=1){d.push(t);continue}let r=t.src;for(let o=e+1,s=0;o<n;o++,s++){const e=c(o);d.push({id:`${t.id}#${s}`,src:r,dst:e,weight:t.weight,ref:t.ref}),r=e}const s=n-e-2;d.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:d,layout:n.layout,nodeById:a};return{layering:{layers:r,rankOf:o,dummy:s},graphWithDummies:u}}function wn(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 Sn(t){if(0===t.length)return Number.POSITIVE_INFINITY;return t.reduce((t,e)=>t+e,0)/t.length}function vn(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 Cn(t,e,n){const o=n.get(t)??0,r=n.get(e)??0;return o!==r?o-r:t.localeCompare(e)}function Ln(t,e,n){const o=new Set(t),r=new Set(e),s=Ge(t),i=Ge(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 De(a.map(t=>t.v))}function kn(t,e,n){return[...t].sort((t,o)=>{const r=wn(e.get(t)??[]),s=wn(e.get(o)??[]);return r===s?Cn(t,o,n):isFinite(r)?isFinite(s)?r-s:-1:1})}function Tn(t,e,n,o,r,s){const i=Ge(t),a=Ge(e),c=vn(e,i,n,o);if(!r||!s||0===s.length)return kn(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=kn(e,c,a);d.push(...n)}const l=f.get(null);if(l&&l.length>0){const t=kn(l,c,a);for(const e of t){const t=Sn(c.get(e)??[]);let n=d.length;if(isFinite(t))for(const[e,o]of d.entries()){if(t<Sn(c.get(o)??[])){n=e;break}}d.splice(n,0,e)}}return d}function $n(t,e,n,o,r){const s=[...e],i=new Set(t),a=new Set(e),c=o?new Set(o):null,f=n.filter(t=>i.has(t.src)&&a.has(t.dst)),d=c?n.filter(t=>a.has(t.src)&&c.has(t.dst)):void 0,u=(0,l.K)(e=>{let n=Ln(t,e,f);return d&&o&&(n+=Ln(e,o,d)),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 Rn(t,e,n){const o=t.layers.map(t=>[...t]),r=e.edges,s=_e(e),i=We(e,n?.laneOrder);for(let t=0;t<3;t++){for(let t=1;t<o.length;t++)o[t]=Tn(o[t-1],o[t],r,"down",s,i),o[t]=$n(o[t-1],o[t],r,o[t+1],s);for(let t=o.length-2;t>=0;t--)o[t]=Tn(o[t+1],o[t],r,"up",s,i),o[t]=$n(o[t+1],o[t],r,o[t-1],s)}return{layers:o}}function On(t,e,n){const o=n?.layerGap??Qe,r=n?.nodeGap??Ze,s=n?.laneGap??2*r,i=n?.direction??"TB",a="LR"===i||"RL"===i,c=t.layers,f=Object.create(null),d=Object.create(null),u=(0,l.K)(t=>e.nodeById.get(t),"getNode"),h=(0,l.K)(t=>u(t)?.width??0,"getWidth"),g=(0,l.K)(t=>u(t)?.height??0,"getHeight"),p=_e(e),x=We(e,n?.laneOrder),m=c.map(t=>t.reduce((t,e)=>Math.max(t,g(e)),0)),y=[];if(a)for(let t=0;t+1<c.length;t++){const e=c[t].reduce((t,e)=>Math.max(t,h(e)),0),n=c[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 c)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],w=Object.create(null);for(const t of K)w[t]=0;M&&(w.null=0);for(const t of c){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);w[t]=Math.max(w[t]??0,e)}if(M&&n.length){const t=n.reduce((t,e)=>t+h(e),0)+r*Math.max(0,n.length-1);w.null=Math.max(w.null??0,t)}}const S=new Map;{const t=I.map(t=>(null===t?w.null:w[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;S.set(o,i),e+=r,n<I.length-1&&(e+=s)}}let v=0;for(const[t,e]of c.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=S.get(t);if(1===e.length){const t=e[0];f[t]=o,d[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];f[i]=s+e/2,d[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(((f[o]??0)+(f[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&&(f[t]=s)}}return{x:f,y:d}}(0,l.K)(tn,"buildDrivingTree"),(0,l.K)(en,"chooseParent"),(0,l.K)(nn,"buildAdjacency"),(0,l.K)(on,"assignComponents"),(0,l.K)(rn,"computeBlocks"),(0,l.K)(sn,"popBlock"),(0,l.K)(an,"computeSubtreeCrossCounts"),(0,l.K)(cn,"annotateMinimumLayers"),(0,l.K)(fn,"compareByRankThenId"),(0,l.K)(dn,"emitNodesInTreeOrder"),(0,l.K)(ln,"deduplicateLayers"),(0,l.K)(un,"createChildOrderer"),(0,l.K)(hn,"buildMultitreeLayerOrder"),(0,l.K)(gn,"countCrossingsBetweenAdjacent"),(0,l.K)(pn,"totalCrossings"),(0,l.K)(xn,"optimizeRanksByCrossings"),(0,l.K)(mn,"adjustCrossLaneSources"),(0,l.K)(yn,"assignLayers_LongestPath"),(0,l.K)(bn,"assignLayers_Gravity"),(0,l.K)(Mn,"topoSortByGenerationIfAcyclic"),(0,l.K)(Kn,"assignLayers_LaneAwareCompact"),(0,l.K)(In,"makeProperLayering"),(0,l.K)(wn,"median"),(0,l.K)(Sn,"barycenter"),(0,l.K)(vn,"neighborPositionsFor"),(0,l.K)(Cn,"currentOrderTieBreak"),(0,l.K)(Ln,"countCrossingsBetweenAdjacent"),(0,l.K)(kn,"sortByHeuristic"),(0,l.K)(Tn,"reorderLayer"),(0,l.K)($n,"transposeImprove"),(0,l.K)(Rn,"orderLayers"),(0,l.K)(On,"assignCoordinates");function Nn(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 Bn(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 En(t,e){const n=[...t],o=Bn(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 Fn(t,e){let n=0;for(const[o,r]of t.entries())n+=Math.abs(o-(e.get(r)??o));return n}function Yn(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 Xn(t){const e=Ve(t);if(e.length<2)return[];const n=new Map(e.map((t,e)=>[t,e])),o=_e(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 Pn(t,e,n){const o=[...t];let r=Yn(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=Yn(o,e);n<r?(r=n,s=!0):[o[t],o[t+1]]=[o[t+1],o[t]]}}return{order:o,cost:r,sourceDistance:Fn(o,n)}}function zn(t,e){return t.cost!==e.cost?t.cost<e.cost:t.sourceDistance<e.sourceDistance}function An(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 Nn(`${t.join("|")}#${o}#${n}`)}function Gn(t,e={}){const n=Ve(t);if(n.length<2)return n;const o=Xn(t);if(0===o.length)return n;const r=new Map(n.map((t,e)=>[t,e]));let s=Pn(n,o,r);const i=Math.max(0,e.restarts??8);for(let t=0;t<i;t++){const e=Pn(En(n,An(n,o,t)),o,r);zn(e,s)&&(s=e)}return s.order}function Dn(t,e){const n=e?.ignoreCrossLaneEdges??!0,o=e?.optimizeRanksByCrossings??!0,r=Ne(t),s=e?.automaticLaneOrdering?Gn(r,{restarts:8}):void 0,i=He(r),a=i.acyclic,c=n?Kn(a,{compactSingleInput:e?.compactSingleInput??Je,ignoreCrossLaneEdges:!0,direction:e?.direction}):bn(a,{compactSingleInput:e?.compactSingleInput??Je,ignoreCrossLaneEdges:!1,optimizeRanksByCrossings:o}),{layering:f,graphWithDummies:d}=In(c,a),l=Rn(f,d,{laneOrder:s}),u=On(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,l.K)(Nn,"hashString"),(0,l.K)(Bn,"mulberry32"),(0,l.K)(En,"deterministicShuffle"),(0,l.K)(Fn,"sourceDistance"),(0,l.K)(Yn,"laneArrangementCost"),(0,l.K)(Xn,"buildWeightedLaneEdges"),(0,l.K)(Pn,"greedySwitch"),(0,l.K)(zn,"isBetterCandidate"),(0,l.K)(An,"seedForRestart"),(0,l.K)(Gn,"optimizeTopLaneOrder"),(0,l.K)(Dn,"sugiyamaLayout");var Hn=1e-6,jn=15,_n=15,Vn=20;function Wn(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<Hn&&c<Hn)return n;return c>Hn&&3*c>=a?i>0?"bottom":"top":a>Hn?s>0?"right":"left":n}function Un(t,e){return Math.abs(t.to-e.from)<Hn||Math.abs(t.to-e.to)<Hn?t.to:t.from}function qn(t,e){return"vertical"===t.orient?{x:t.coord,y:e}:{x:e,y:t.coord}}function Jn(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,i=new Map,a=[],c="LR"===e;for(const t of n)s.set(t.id,t);const f=n.filter(t=>t.isGroup&&!t.parentId);for(const t of f){const e={id:t.id},o=(0,l.K)(t=>{i.set(t.id,e),n.filter(e=>e.parentId===t.id).forEach(o)},"assignLane");o(t)}const d=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:c?n/2+8:e/2+8}}),u=(0,l.K)((t,e,n,o)=>{let r=a.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:[]},a.push(r)),r.spanMin=Math.min(r.spanMin,n),r.spanMax=Math.max(r.spanMax,o),r},"getOrAddPipe"),h=(0,l.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,l.K)((t,e,n)=>h(t,Wn(t,e,n?"bottom":"top")),"getOrthogonalPort"),p=[],x=[],m=new Set,y=(0,l.K)((t,e,n)=>{if(0===p.length)return 0;const o=Math.abs(e.y-n.y)<Hn,r=Math.abs(e.x-n.x)<Hn;if(!o&&!r)return 0;let s=0;if(o){const o=e.y,r=Math.min(e.x,n.x)-Hn,i=Math.max(e.x,n.x)+Hn;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-Hn<=o&&e.to+Hn>=o&&(s+=1e3))}else if(r){const o=e.x,r=Math.min(e.y,n.y)-Hn,i=Math.max(e.y,n.y)+Hn;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-Hn<=o&&e.to+Hn>=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=i.get(t.start),a=i.get(t.end);return{idx:e,crossLane:r&&a&&r.id!==a.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,l.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!!d.find(c=>(!n||c.nodeId!==n)&&((!o||c.nodeId!==o)&&(Math.abs(t.x-e.x)>Hn?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 w=(0,l.K)((t,e)=>Wn(t,e,"bottom"),"determineSide"),S=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);S.set(t,{edgeIdx:t,srcId:e.start,dstId:e.end,srcSide:w(n,{x:o.x??0,y:o.y??0}),dstSide:w(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,l.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,l.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 S.values()){const e=`${t.srcId}:${t.srcSide}`;L.has(e)||L.set(e,[]),L.get(e).push(t)}const k=new Map,T=(0,l.K)((t,e)=>`${t}:${e}`,"loadKey");for(const t of S.values())k.set(T(t.srcId,t.srcSide),(k.get(T(t.srcId,t.srcSide))??0)+1),k.set(T(t.dstId,t.dstSide),(k.get(T(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(T(n.srcId,n.srcSide))??0,s=k.get(T(n.srcId,o))??0;s>=r||(k.set(T(n.srcId,n.srcSide),r-1),k.set(T(n.srcId,o),s+1),n.srcSide=o)}}const $=(0,l.K)(t=>{const e=t?.shape;return"question"===e||"diamond"===e},"isDiamondNode"),R=new Map;for(const t of S.values())R.has(t.dstId)||R.set(t.dstId,new Set),R.get(t.dstId).add(t.dstSide);for(const t of S.values()){if(!$(s.get(t.srcId)))continue;const e=R.get(t.srcId);if(!e?.has(t.srcSide))continue;const n=C(t);if(e.has(n)||(k.get(T(t.srcId,n))??0)>0)continue;const o=k.get(T(t.srcId,t.srcSide))??0;k.set(T(t.srcId,t.srcSide),Math.max(0,o-1)),k.set(T(t.srcId,n),1),t.srcSide=n}for(const t of S.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 O=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}`;O.set(o,e)}}const N=(0,l.K)(t=>Boolean(r[t]?.labelNodeId),"edgeHasLabelNode"),B=(0,l.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"),E=(0,l.K)((t,e,n)=>"top"===e||"bottom"===e?{x:t.x+n,y:t.y}:{x:t.x,y:t.y+n},"applyPortOffset"),F=(0,l.K)((t,e,n)=>{const o=S.get(t),r={x:n.x??0,y:n.y??0},s={x:e.x??0,y:e.y??0},i=o?.srcSide??w(e,r),a=o?.dstSide??w(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=O.get(`${t}:src`),l=O.get(`${t}:dst`);return void 0!==d&&(c=E(c,i,d)),void 0!==l&&(f=E(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:i,pDstPort:f,srcSide:h,dstSide:g}=F(t,n,o),b={...i},w={...f},S="top"===h||"bottom"===h,v="top"===g||"bottom"===g;if(S){const t=i.y>(n.y??0);b.y=t?i.y+Vn:i.y-Vn}else{const t=i.x>(n.x??0);b.x=t?i.x+Vn:i.x-Vn}if(v){const t=f.y>(o.y??0);w.y=t?f.y+Vn:f.y-Vn}else{const t=f.x>(o.x??0);w.x=t?f.x+Vn:f.x-Vn}const C=(0,l.K)((t,e)=>{for(const n of d)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,l.K)((t,e,n,o,r)=>{if(r){const r=t.y>(e.y??0);return{x:(n.x??0)>=t.x?o.maxX+jn:o.minX-jn,y:r?o.maxY+_n:o.minY-_n,leavesPositiveSide:r}}const s=t.x>(e.x??0),i=(n.y??0)>=t.y;return{x:s?o.maxX+jn:o.minX-jn,y:i?o.maxY+_n:o.minY-_n,leavesPositiveSide:s}},"obstacleDetour");let k=[];const T=[e.start,e.end],$=C(b,T);if($.inside&&$.obstacle){const t=$.obstacle;if(S){const e=L(i,n,o,t,!0);b.x=e.x,b.y=e.y;const r=e.leavesPositiveSide?Math.min(t.minY-2,i.y+Vn):Math.max(t.maxY+2,i.y-Vn);k=[{x:i.x,y:r},{x:e.x,y:r},{x:e.x,y:e.y}]}else{const e=L(i,n,o,t,!1),r=e.leavesPositiveSide?Math.min(t.minX-2,i.x+Vn):Math.max(t.maxX+2,i.x-Vn);b.x=e.x,b.y=e.y,k=[{x:r,y:i.y},{x:r,y:e.y},{x:e.x,y:e.y}]}}let R=[];const N=C(w,T);if(N.inside&&N.obstacle){const t=N.obstacle;if(v){const e=L(f,o,n,t,!0);w.x=e.x,w.y=e.y,R=[{x:e.x,y:e.y},{x:f.x,y:e.y}]}else{const e=L(f,o,n,t,!1);w.x=e.x,w.y=e.y,R=[{x:e.x,y:e.y},{x:e.x,y:f.y}]}}if(0===k.length&&0===R.length){const n=jn,o=Math.abs(b.x-w.x)<n,r=Math.abs(b.y-w.y)<n,s=void 0!==O.get(`${t}:src`)||void 0!==O.get(`${t}:dst`),a=(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),d=a>1||c>1,l=I.get(e.start??"")??0,u=I.get(e.end??"")??0,x=a>1&&B(e.start,h)||c>1&&B(e.end,g);if((o||r)&&!s&&(!d||d&&!x&&(a<=1||l<=2)&&(c<=1||u<=2))){if(!M(i,f,e.start,e.end)){e.points=[{...i},{...b},{...w},{...f}],m.add(t);const n=r?"horizontal":"vertical",o=r?i.y:i.x,s=r?Math.min(i.x,f.x):Math.min(i.y,f.y),a=r?Math.max(i.x,f.x):Math.max(i.y,f.y),c={id:`fast-path-${n}-${o.toFixed(0)}-${t}`,orientation:n,coord:o,spanMin:s,spanMax:a,tracks:[]};p.push({edgeIndex:t,segmentIndex:0,orientation:n,pipe:c,trackIndex:0,from:s,to:a});continue}}}const E=u("vertical",b.x,b.y,b.y);b.x=E.coord;const Y=u("vertical",w.x,w.y,w.y);w.x=Y.coord;let X=Math.min(b.x,w.x)-50,P=Math.max(b.x,w.x)+50,z=Math.min(b.y,w.y)-50,A=Math.max(b.y,w.y)+50;for(const t of d){const e=Math.min(b.x,w.x),n=Math.max(b.x,w.x),o=Math.min(b.y,w.y),r=Math.max(b.y,w.y);t.minX<n&&t.maxX>e&&t.minY<r&&t.maxY>o&&(X=Math.min(X,t.minX-25),P=Math.max(P,t.maxX+25),z=Math.min(z,t.minY-25),A=Math.max(A,t.maxY+25))}for(const t of d){if(t.maxX<X||t.minX>P||t.maxY<z||t.minY>A)continue;const e=jn;u("horizontal",t.minY-e,X,P),u("horizontal",t.maxY+e,X,P);const n=_n;u("vertical",t.minX-n,z,A),u("vertical",t.maxX+n,z,A)}u("horizontal",b.y,X,P),u("horizontal",w.y,X,P);const G=a.filter(t=>"horizontal"===t.orientation&&t.coord>=z&&t.coord<=A),D=a.filter(t=>"vertical"===t.orientation&&t.coord>=X&&t.coord<=P),H=(0,l.K)((t,e)=>`${t.toFixed(1)},${e.toFixed(1)}`,"getKey"),j=H(b.x,b.y),_=H(w.x,w.y),V=new Map,W=new Map,U=new Map,q=new Set,J=[];V.set(j,0),U.set(j,"n"),J.push({key:j,f:Math.hypot(w.x-b.x,w.y-b.y),pt:b}),q.add(j);let Q=[];const Z=(0,l.K)((t,n)=>M(t,n,e.start,e.end),"checkSegmentBlocked"),tt={x:w.x,y:b.y},et=Z(b,tt),nt=Z(tt,w),ot=et||nt,rt={x:b.x,y:w.y},st=Z(b,rt),it=Z(rt,w);if(ot?st||it||(Q=Math.abs(b.x-w.x)<Hn?[b,w]:[b,rt,w]):Q=Math.abs(b.y-w.y)<Hn||Math.abs(b.x-w.x)<Hn?[b,w]:[b,tt,w],0===Q.length)for(;J.length>0;){J.sort((t,e)=>t.f-e.f);const n=J.shift();if(q.delete(n.key),n.key===_){let t=_,e=w;for(Q=[e];W.has(t);){const n=W.get(t);Q.unshift(n),e=n,t=H(n.x,n.y)}break}const o=n.pt.x,r=n.pt.y,s=D.sort((t,e)=>t.coord-e.coord),i=s.findIndex(t=>Math.abs(t.coord-o)<1),a=G.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(d.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 l=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=w.x-b.x,x=w.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=U.get(n.key)??"n",S=Math.abs(m)>Hn?"h":"v";"n"!==I&&I!==S&&(K=50);const v=u+h+g+K,C=(V.get(n.key)??1/0)+v,L=Math.abs(w.x-s.x)+Math.abs(w.y-s.y);if(C<(V.get(l)??1/0))if(W.set(l,n.pt),V.set(l,C),U.set(l,S),q.has(l)){const t=J.findIndex(t=>t.key===l);-1!==t&&(J[t].f=C+L)}else J.push({key:l,f:C+L,pt:s}),q.add(l)}}if(0===Q.length&&(Q=[b,{x:b.x,y:w.y},w]),Q.length>4){const t=Q[0],e=Q[Q.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 Q)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 i=o>Math.max(t.x,e.x),a=n<Math.min(t.x,e.x);if(c){const r=_n;if(i){const n=Math.max(t.x,e.x),s=Math.min(t.y,e.y),i=Math.max(t.y,e.y),a=d.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(a){const o=d.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 f=(0,l.K)(n=>{const o=e.y>t.y,r=d.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(c&&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-Hn)return t}else{const t=Math.min(...s.map(t=>t.minY))-15;if(t>e.y+Hn)return t}return e.y},"findBestReturnY"),u=(0,l.K)(n=>{const o=f(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),d=Z(s,i),l=o!==e.y&&Z(i,e);return a||c||d||l?null:Math.abs(o-e.y)<Hn?[t,r,s,e]:[t,r,s,i,e]},"trySimplifyWithDetourX"),h=i&&!a?u(o):a&&!i?u(n):null;h&&(Q=h)}const at=[i,...k,...Q,...R.reverse(),f];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)<Hn&&Math.abs(e.y-t.y)<Hn,r=Math.abs(n.x-e.x)<Hn&&Math.abs(e.x-t.x)<Hn;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)<Hn&&Math.abs(n.y-o.y)<Hn){if(n.x>e.x!==o.x>n.x){ct.push(n);continue}continue}if(Math.abs(e.x-n.x)<Hn&&Math.abs(n.x-o.x)<Hn){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)<Hn?"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,l.K)((t,e)=>t.from<e.to&&e.from<t.to,"segmentsOverlap"),X=(0,l.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"),P=(0,l.K)(t=>{const e=t.tracks.length;return t.tracks[e]={index:e,coord:t.coord,segments:[]},e},"createNewTrack"),z=(0,l.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"),A=(0,l.K)((t,e)=>{const n=x[t.edgeIndex];for(const o of n){const n=p[o];n.pipe===t.pipe&&z(n,e)}},"moveSegmentChainToTrack"),G=(0,l.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"),D=(0,l.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,l.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,l.K)((t,e)=>{if(t.trackIndex===e.trackIndex)return Y(t,e);const n=G(t),o=G(e);return n.some(t=>o.some(e=>D(t,e)))},"segmentsConflict"),_=(0,l.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:P(t.pipe))},"resolveTrackConflict"),V=(0,l.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++,_(r,s,A)))}return e},"resolveHandleConflicts"),W=new Map,U=(0,l.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"),q=(0,l.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,l.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=U(t),r=U(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+=V(e)}return t},"fixSourceHandleCrossings"),J=(0,l.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,l.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+=V(e)}return t},"fixTargetHandleCrossings"),Q=(0,l.K)(()=>{let t=0;for(const e of a){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++,_(r,s,z))}}return t},"fixPipeCrossings");let Z=0;for(;Z<10;){let t=0;if(t+=q(),t+=J(),t+=Q(),0===t)break;Z++}const tt=new Map;for(const t of a){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=U(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),i=[...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 a=(0,l.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 c=0;for(const e of r)c++,a(e,t.coord-10*c);if(0===i.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 a=s.indexOf(t);-1!==a&&s.splice(a,1),i.push(t)}let f=0;for(const e of i){if(0===f)a(e,t.coord);else{const n=f%2==1?1:-1,o=Math.ceil(f/2);a(e,t.coord+n*o*10*.5)}f++}let d=0;for(const e of s)d++,a(e,t.coord+10*d)}}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}=F(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)>Hn&&o.push(qn(e,r)),a&&i.orient===e.orient)if(Math.abs(e.coord-i.coord)>Hn){const t="vertical"===e.orient?(r+i.from)/2:Un(e,i);o.push(qn(e,t),qn(i,t))}else 0!==t&&t!==f.length-2||o.push(qn(e,Un(e,i)));else if(a)o.push(qn(e,i.coord));else{const t=Math.abs(e.from-r)<Math.abs(e.to-r)?e.to:e.from;o.push(qn(e,t))}}const d=o[o.length-1];(Math.abs(d.x-c.x)>Hn||Math.abs(d.y-c.y)>Hn)&&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)>Hn||Math.abs(e.y-n.y)>Hn)&&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,l.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 Qn(t){return t.direction??"TB"}function Zn(t){const e=Y(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=Qn(t),{ordered:c,coordinates:f}=Dn(e,{nodeGap:n,layerGap:o,ignoreCrossLaneEdges:r,optimizeRanksByCrossings:s,automaticLaneOrdering:i,direction:a});X(e,c,f,{nodeGap:n,layerGap:o});for(const e of t.edges??[])delete e.points;Jn(t,a);for(const e of t.edges??[])e.curve&&"basis"!==e.curve||(e.curve="rounded");return Oe(t,a),Re(t),a}async function to(t,e){const n=e.select("g");(0,r.g0)(n,t.markers,t.type,t.diagramId),(0,s.gh)(),(0,r.IU)(),(0,s.IU)(),(0,o.IU)(),F(t);const i=P(t);t.nodes=i.nodes,t.edges=i.edges;const{groups:a}=await h(n,t);Zn(t),await R(t,a)}(0,l.K)(Wn,"chooseOrthogonalSide"),(0,l.K)(Un,"sharedLineEndpointCoord"),(0,l.K)(qn,"pointOnLine"),(0,l.K)(Jn,"routeEdgesOrthogonal"),(0,l.K)(Qn,"getSwimlaneDirection"),(0,l.K)(Zn,"runSwimlaneLayoutCore"),(0,l.K)(to,"render")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7111],{37111(e,r,t){t.d(r,{diagram:()=>y});var n=t(7827),a=t(77454),s=(t(37851),t(68861),t(31293)),l=t(86827),i=t(34376),p=(0,i.sB)().RailroadAbnf.parser.LangiumParser,m=(0,l.K)(e=>{const r=e.alternatives.map(o);return 1===r.length?r[0]:{type:"choice",alternatives:r}},"transformAlternation"),o=(0,l.K)(e=>{const r=e.elements.map(c);return 1===r.length?r[0]:{type:"sequence",elements:r}},"transformConcatenation"),u=(0,l.K)(e=>{if(e.includes("*")){const[r,t]=e.split("*");return{min:r?parseInt(r,10):0,max:t?parseInt(t,10):1/0}}const r=parseInt(e,10);return{min:r,max:r}},"parseRepeat"),c=(0,l.K)(e=>{const r=d(e.primary);if(!e.repeat)return r;const{min:t,max:n}=u(e.repeat);return 0===t&&1===n?{type:"optional",element:r}:{type:"repetition",element:r,min:t,max:n}},"transformElement"),d=(0,l.K)(e=>{switch(e.$type){case"AbnfStringLiteral":case"AbnfNumVal":return{type:"terminal",value:e.value};case"AbnfRuleName":return{type:"nonterminal",name:e.name};case"AbnfGroup":return m(e.element);case"AbnfOptionalGroup":return{type:"optional",element:m(e.element)};default:throw new Error(`Unsupported ABNF primary node: ${e.$type}`)}},"transformPrimary"),f=(0,l.K)(e=>({name:e.name,definition:m(e.definition)}),"transformRule"),b=(0,l.K)(e=>{(0,a.S)(e,n.db),e.title&&n.db.setTitle(e.title),e.rules.map(e=>n.db.addRule(f(e)))},"populateDb"),y={parser:{parse:(0,l.K)(e=>{n.db.clear(),s.R.debug("[ABNF Parser] Starting Langium parse");const r=p.parse(e);if(r.lexerErrors.length>0||r.parserErrors.length>0)throw new i.zg(r);const t=r.value;s.R.debug("[ABNF Parser] Parsed rules:",t.rules.length),b(t),s.R.debug("[ABNF Parser] Parse complete")},"parse"),parser:{yy:n.db}},db:n.db,renderer:n.U,styles:n.$}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7209],{77481(e,t,n){n.d(t,{S:()=>l,X:()=>i});var a=n(96540),s=n(74848);function i(e){const[t,n]=a.useState([]);return(0,a.useEffect)(()=>{e.children?n(Array.isArray(e.children)?e.children:[e.children]):n(e.rows)},[e.rows,e.children]),(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:e.headers?.map((e,t)=>(0,s.jsx)("th",{children:e},t))})}),(0,s.jsx)("tbody",{children:t.map((t,n)=>(0,s.jsx)("tr",{onContextMenu:()=>{e.handleContextMenu&&e.handleContextMenu(t)},children:t.map((n,a)=>(0,s.jsx)("td",{style:{width:e.width??"auto"},className:a===t.length-1?"small":"",children:n},a))},n))})]})}function l(e){return(0,s.jsx)("div",{style:{display:e.isFlex?"flex":"block"},children:e.columns.map((e,t)=>(0,s.jsx)("div",{children:e},t))})}},83029(e,t,n){n.d(t,{N:()=>f});var a=n(96540),s=n(34843),i=n(82893),l=n(74848);function c(e){const[t,n]=(0,s.fp)(i.AG.user_base_info);return(0,l.jsx)("div",{children:e.div?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},children:e.name}):e.clickItem||"dir"===e._type?(0,l.jsx)("div",{className:"nav_list_a",style:{background:e.color},onClick:()=>{"dir"!==e._type?e.clickItem&&e.clickItem(e):e.click_dir(e.item)},children:e.name}):(0,l.jsx)("a",{href:e.url,target:e.target,className:"nav_list_a",style:{background:e.color},children:e.name})})}var o=n(64694),r=n(61443),d=n(85997),u=n(76213),h=n(34899);const m=["#ffffff","#fefff8","#fcfdf1","#d3d2dc","#f8f9fd","#ebf4fe","#ebebeb","#e8f7eb","#eaf2f9"];let p,x,_=[];const v=[];function f(e){const[t,n]=(0,a.useState)([]),[f,j]=(0,a.useState)(-1),g=(0,u.zy)(),[y,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),{t:b}=(0,h.Bd)(),[w,I]=(0,a.useState)([]),[N,A]=(0,s.fp)(i.AG.nav_index_add_item_by_now_list),D=e=>{-1!==f?v[f]._children=e:_=e};(0,a.useEffect)(()=>{(async()=>{if(!e.getItems)return;const t=await e.getItems();_=t,n(_)})()},[g]);(0,a.useEffect)(()=>{if(N){const e=[...t,{name:"",color:(0,o.Lr)(m),...N}];D(e),n(e),k(!0),A(void 0)}},[N]);const F=e=>{j(f+1),n(e._children),v.push(e)};return(0,l.jsxs)("div",{className:"nav_list_div scroll-div-y",children:[-1!==f&&(0,l.jsx)(d.rA,{title:"返回",icon:"arrow_back",onClick:()=>{n(0===f?_:v[f-1]._children),j(f-1),v.pop()}}),t.map((s,i)=>(0,l.jsxs)("div",{draggable:!0,onDragOver:e=>{e.preventDefault()},onDragStart:e=>((e,t)=>{p=t})(0,i),onDrop:e=>((e,a)=>{e.preventDefault();const s=t[p],i=t[a];if(i&&"dir"===i._type){const e=[...t];return e.splice(p,1),i._children||(i._children=[]),i._children.push(s),D(e),void n(e)}const l=[...t],c=l[p];l.splice(p,1),l.splice(a,0,c),D(l),n(l)})(e,i),style:{cursor:y?"move":"pointer"},children:[(0,l.jsx)(c,{name:s.name,item:s,...s,div:y,target:"_blank",click_dir:F,clickItem:e.clickItem}),y&&(void 0!==w.find(e=>e===i)||C)&&(0,l.jsxs)("div",{className:C?"":" site_edit ",children:["dir"===s._type?(0,l.jsxs)(a.Fragment,{children:[(0,l.jsx)(r.Sm,{value:s.name,handleInputChange:e=>{s.name=e},placeholder:b("输入类目名"),no_border:!0}),(0,l.jsx)(r.Sm,{value:s.color,handleInputChange:e=>{s.color=e},placeholder:"color",no_border:!0})]}):e.items.map((e,t)=>(0,l.jsx)("div",{children:(0,l.jsx)(r.Sm,{value:s[e.key],handleInputChange:t=>{s[e.key]=t},placeholder:e.preName,no_border:!0})},t)),!C&&(0,l.jsx)(d.C3,{text:b("折叠"),clickFun:()=>{I((0,o.P1)(w,i))}})]}),y&&(0,l.jsx)("div",{style:{display:"block"},children:(0,l.jsxs)("span",{className:"div-row ",children:[(0,l.jsx)(d.C3,{text:b("删除"),clickFun:()=>{(e=>{const a=[...t];a.splice(e,1),D(a),n(a)})(i)}}),(0,l.jsx)(d.C3,{text:b("编辑"),clickFun:()=>{void 0===w.find(e=>e===i)&&I([...w,i])}})]})})]},i)),y&&(0,l.jsxs)("div",{style:{display:"block"},children:[(0,l.jsx)(d.rA,{title:b("取消"),icon:"cancel",onClick:()=>{I([]),k(!1),x&&(n(x),D(x)),S(!1)}}),(0,l.jsx)(d.rA,{title:b("添加"),icon:"add",onClick:async()=>{const a=[...t,{name:"",color:(0,o.Lr)(m),...e.get_pre_add_item&&await e.get_pre_add_item()}];D(a),n(a)}}),(0,l.jsx)(d.rA,{title:b("添加类目"),icon:"add_box",onClick:()=>{const e=[...t,{name:"",_type:"dir",_children:[],color:"#c1edfb"}];D(e),n(e)}}),(0,l.jsx)(d.rA,{title:b("全部编辑"),icon:C?"unfold_less":"unfold_more",onClick:()=>{S(!C)}})]}),(void 0===e.have_auth_edit||!0===e.have_auth_edit)&&(0,l.jsx)(d.rA,{icon:y?"save":"edit",title:b(y?"保存":"编辑"),onClick:async()=>{y?e.save&&await e.save(_):x=t,k(!y)}})]})}},87209(e,t,n){n.r(t),n.d(t,{default:()=>I});var a=n(96540),s=n(75725),i=n(61443),l=n(70447),c=n(85997),o=n(34289),r=n(34899),d=n(62042),u=n(14284),h=n(53459),m=n(74848);function p(e){const{t}=(0,r.Bd)(),[n,p]=(0,a.useState)(t("毫秒")),[x,_]=(0,a.useState)(""),[v,f]=(0,a.useState)(""),[j,g]=(0,a.useState)(null),[y,k]=(0,a.useState)(null),[C,S]=(0,a.useState)(Date.now());return(0,a.useEffect)(()=>{(async()=>{const e=await u.Yu.get("sys_time/get");if(e.code===h.m.Success){const t=await e.data;g(t.timestamp),k(t.timezone),S(t.timestamp)}})();const e=setInterval(()=>{S(e=>e+1e3)},1e3);return()=>clearInterval(e)},[]),(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsxs)(l.Zp,{title:t("时间转换器"),rightBottomCom:(0,m.jsx)(c.C3,{text:t("确定"),clickFun:function(){if(!x&&!v)return void(0,d.zN)("不能都为空");let e=0;const t=""!==x&&0!==x;if(t){if(!(0,o.kf)(x))return void(0,d.zN)("must be number !");e=parseInt(x),"分秒"===n&&(e*=1e3)}const a=new Date(t?e:v),s=new Intl.DateTimeFormat("zh-CN",{year:"numeric",month:"short",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1}).format(a);if(f(s),!x){const e=a.getTime();_("毫秒"===n?e:e/1e3)}}}),children:[(0,m.jsx)(i.l6,{value:n,options:[{title:t("毫秒"),value:"毫秒"},{title:t("分秒"),value:"分秒"}],onChange:function(e){p(e)}}),(0,m.jsx)(i.Sm,{placeholder:n,value:x,handleInputChange:e=>{_(e)}}),(0,m.jsx)(i.Sm,{placeholder:t("格式化时间"),value:v,handleInputChange:e=>{f(e)}})]})}),(0,m.jsx)(s.VP,{children:null!==j&&null!==y&&(0,m.jsxs)(l.Zp,{title:t("服务器时间"),children:[(0,m.jsxs)("h1",{children:[t("时区"),": ",y]}),(0,m.jsxs)("h1",{children:[t("时间"),": ",new Date(C).toLocaleString(navigator.language,{timeZone:y})]})]})})]})}var x=n(57952),_=n(83029),v=n(78247),f=n(23430);function j(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),[s,l]=(0,a.useState)(""),o=async e=>{const t=e||s;if(!t)return void(0,d.zN)("mac地址不能为空");(await u._U.post("wol/exec",{mac:t})).code===h.m.Success&&(0,d.SK)("发送唤醒命令成功")};return(0,m.jsxs)("div",{children:[(0,m.jsxs)(x.A,{children:[(0,m.jsx)(c.rA,{icon:"play_arrow",title:t("发送"),onClick:()=>{o()}}),(0,m.jsx)(i.$Z,{placeholder:t("目标设备mac地址"),icon:"laptop_mac",value:s,handleInputChange:e=>l(e)})]}),(0,m.jsx)(_.N,{have_auth_edit:n(f.oV.wol_proxy_tag_update),getItems:async()=>{const e=await u._U.get("wol/tag");return e.code===h.m.Success?e.data:[]},save:async e=>{(await u._U.post("wol/tag/save",e)).code!==h.m.Success&&(0,d.zN)("网络错误")},clickItem:async e=>{l(e.mac),o(e.mac)},items:[{key:"name",preName:t("名字")},{key:"mac",preName:"mac"+t("地址")},{key:"color",preName:"color"}]})]})}var g=n(77481),y=n(34843),k=n(82893),C=n(40505);let S;function b(){const[e,t]=(0,a.useState)("rsa"),[n,o]=(0,a.useState)("pem"),{t:p,i18n:_}=(0,r.Bd)(),[v,f]=(0,y.fp)(k.AG.confirm),[j,b]=(0,a.useState)(""),[w,I]=(0,a.useState)(""),N=async t=>{if(!w||!j)return void(0,d.zN)("密钥不能为空");let n="id_"+e;"pub"===t&&(n+=".pub"),f({open:!0,title:p("将覆盖密钥文件"),sub_title:`之前的密钥将作废。 将会作为 ${n} 文件保存到系统上的"${S}"目录下,此目录会作为openssh(git)所使用的默认目录。`,handle:async()=>{(await u.cD.post("save_openssh",{name:n,context:"pub"===t?j:w})).code===h.m.Success&&((0,d.SK)("完成"),f({open:!1,handle:null}))}})};return(0,m.jsxs)(a.Fragment,{children:[(0,m.jsx)(x.A,{children:(0,m.jsx)(g.S,{isFlex:!0,columns:[(0,m.jsx)(i.l6,{tip:p("加密算法"),value:e,width:"auto",onChange:e=>{t(e)},options:[{title:p("RSA"),value:"rsa"},{title:p("DSA"),value:"dsa"},{title:p("ECDSA"),value:"ecdsa"}]}),(0,m.jsx)(i.l6,{tip:p("输出格式"),value:n,width:"auto",onChange:e=>{o(e)},options:[{title:p("普通PEM"),value:"pem"},{title:p("opensshPEM"),value:"openssh_pem"}]}),(0,m.jsx)(c.rA,{icon:"play_arrow",title:p("生成"),onClick:()=>{(async()=>{const t=await u.cD.post("generate",{type:e,form:n});t.code===h.m.Success&&(b(t.data.public_key),I(t.data.private_key),S=t.data.home_path)})()}})]})}),(0,m.jsx)(s.xh,{children:(0,m.jsxs)(s.fI,{children:[(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("公钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{j&&((0,C.lW)(j),(0,d.SK)("完成"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pub")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},onChange:e=>{b(e.target.value)},value:j})})}),(0,m.jsx)(s.VP,{children:(0,m.jsx)(l.Zp,{title:p("私钥"),titleCom:(0,m.jsx)(c.rA,{title:p("复制"),icon:"copy_all",onClick:()=>{w&&((0,C.lW)(w),(0,d.SK)("成功"))}}),rightBottomCom:"openssh_pem"===n&&(0,m.jsx)(c.C3,{text:p("保存到.ssh目录"),clickFun:()=>{N("pri")}}),children:(0,m.jsx)("textarea",{className:"input--textarea input--no_border",style:{width:"100%",height:"270px"},value:w,onChange:e=>{I(e.target.value)}})})})]})})]})}var w=n(87361);function I(e){const{t}=(0,r.Bd)(),{check_user_auth:n}=(0,v.MH)(),a=[];return a.push({index:1,name:t("时间工具"),rto:"timeutil/",component:(0,m.jsx)(p,{})},{index:1,name:t("非对称密钥"),rto:"crypto/",component:(0,m.jsx)(b,{})}),n(f.oV.wol_proxy)&&a.push({index:1,name:t("网络唤醒"),rto:"netwol/",component:(0,m.jsx)(j,{})}),(0,m.jsx)(s.W1,{optionList:a,father_route:w.o.toolbox})}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7632],{59337(e,t,s){s.d(t,{P:()=>a});var i=s(68861),n=s(31293),r=s(86827),a=(0,r.K)((e,t,s,r)=>{e.attr("class",s);const{width:a,height:c,x:h,y:u}=l(e,t);(0,i.a$)(e,c,a,r);const y=o(h,u,a,c,t);e.attr("viewBox",y),n.R.debug(`viewBox configured: ${y} with padding: ${t}`)},"setupViewPortForSVG"),l=(0,r.K)((e,t)=>{const s=e.node()?.getBBox()||{width:0,height:0,x:0,y:0};return{width:s.width+2*t,height:s.height+2*t,x:s.x,y:s.y}},"calculateDimensionsWithPadding"),o=(0,r.K)((e,t,s,i,n)=>`${e-n} ${t-n} ${s} ${i}`,"createViewBox")},96755(e,t,s){s.d(t,{A:()=>r});var i=s(86827),n=s(51444),r=(0,i.K)((e,t)=>{let s;"sandbox"===t&&(s=(0,n.Ltv)("#i"+e));return("sandbox"===t?(0,n.Ltv)(s.nodes()[0].contentDocument.body):(0,n.Ltv)("body")).select(`[id="${e}"]`)},"getDiagramElement")},57632(e,t,s){s.d(t,{diagram:()=>R});var i=s(96755),n=s(59337),r=s(6923),a=(s(1778),s(75999),s(23665),s(91865),s(3868),s(8969),s(24731),s(28342)),l=s(68861),o=s(31293),c=s(86827),h=function(){var e=(0,c.K)(function(e,t,s,i){for(s=s||{},i=e.length;i--;s[e[i]]=t);return s},"o"),t=[1,3],s=[1,4],i=[1,5],n=[1,6],r=[5,6,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],a=[1,22],l=[2,7],o=[1,26],h=[1,27],u=[1,28],y=[1,29],d=[1,33],m=[1,34],E=[1,35],p=[1,36],R=[1,37],g=[1,38],f=[1,24],_=[1,31],S=[1,32],I=[1,30],b=[1,39],T=[1,40],k=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,77,89,90],N=[1,61],q=[89,90],C=[5,8,9,11,13,21,22,23,24,27,29,41,42,43,44,45,46,54,61,63,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],A=[27,29],L=[1,70],$=[1,71],v=[1,72],x=[1,73],w=[1,74],O=[1,75],D=[1,76],M=[1,83],F=[1,80],K=[1,84],P=[1,85],V=[1,86],U=[1,87],B=[1,88],Y=[1,89],Q=[1,90],H=[1,91],W=[1,92],j=[5,8,9,11,13,21,22,23,24,27,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],z=[63,64],G=[1,101],X=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,76,77,89,90],J=[5,8,9,11,13,21,22,23,24,41,42,43,44,45,46,54,72,74,75,76,77,80,81,82,83,84,85,86,87,88,89,90],Z=[1,110],ee=[1,106],te=[1,107],se=[1,108],ie=[1,109],ne=[1,111],re=[1,116],ae=[1,117],le=[1,114],oe=[1,115],ce={trace:(0,c.K)(function(){},"trace"),yy:{},symbols_:{error:2,start:3,directive:4,NEWLINE:5,RD:6,diagram:7,EOF:8,acc_title:9,acc_title_value:10,acc_descr:11,acc_descr_value:12,acc_descr_multiline_value:13,requirementDef:14,elementDef:15,relationshipDef:16,direction:17,styleStatement:18,classDefStatement:19,classStatement:20,direction_tb:21,direction_bt:22,direction_rl:23,direction_lr:24,requirementType:25,requirementName:26,STRUCT_START:27,requirementBody:28,STYLE_SEPARATOR:29,idList:30,ID:31,COLONSEP:32,id:33,TEXT:34,text:35,RISK:36,riskLevel:37,VERIFYMTHD:38,verifyType:39,STRUCT_STOP:40,REQUIREMENT:41,FUNCTIONAL_REQUIREMENT:42,INTERFACE_REQUIREMENT:43,PERFORMANCE_REQUIREMENT:44,PHYSICAL_REQUIREMENT:45,DESIGN_CONSTRAINT:46,LOW_RISK:47,MED_RISK:48,HIGH_RISK:49,VERIFY_ANALYSIS:50,VERIFY_DEMONSTRATION:51,VERIFY_INSPECTION:52,VERIFY_TEST:53,ELEMENT:54,elementName:55,elementBody:56,TYPE:57,type:58,DOCREF:59,ref:60,END_ARROW_L:61,relationship:62,LINE:63,END_ARROW_R:64,CONTAINS:65,COPIES:66,DERIVES:67,SATISFIES:68,VERIFIES:69,REFINES:70,TRACES:71,CLASSDEF:72,stylesOpt:73,CLASS:74,ALPHA:75,COMMA:76,STYLE:77,style:78,styleComponent:79,NUM:80,COLON:81,UNIT:82,SPACE:83,BRKT:84,PCT:85,MINUS:86,LABEL:87,SEMICOLON:88,unqString:89,qString:90,$accept:0,$end:1},terminals_:{2:"error",5:"NEWLINE",6:"RD",8:"EOF",9:"acc_title",10:"acc_title_value",11:"acc_descr",12:"acc_descr_value",13:"acc_descr_multiline_value",21:"direction_tb",22:"direction_bt",23:"direction_rl",24:"direction_lr",27:"STRUCT_START",29:"STYLE_SEPARATOR",31:"ID",32:"COLONSEP",34:"TEXT",36:"RISK",38:"VERIFYMTHD",40:"STRUCT_STOP",41:"REQUIREMENT",42:"FUNCTIONAL_REQUIREMENT",43:"INTERFACE_REQUIREMENT",44:"PERFORMANCE_REQUIREMENT",45:"PHYSICAL_REQUIREMENT",46:"DESIGN_CONSTRAINT",47:"LOW_RISK",48:"MED_RISK",49:"HIGH_RISK",50:"VERIFY_ANALYSIS",51:"VERIFY_DEMONSTRATION",52:"VERIFY_INSPECTION",53:"VERIFY_TEST",54:"ELEMENT",57:"TYPE",59:"DOCREF",61:"END_ARROW_L",63:"LINE",64:"END_ARROW_R",65:"CONTAINS",66:"COPIES",67:"DERIVES",68:"SATISFIES",69:"VERIFIES",70:"REFINES",71:"TRACES",72:"CLASSDEF",74:"CLASS",75:"ALPHA",76:"COMMA",77:"STYLE",80:"NUM",81:"COLON",82:"UNIT",83:"SPACE",84:"BRKT",85:"PCT",86:"MINUS",87:"LABEL",88:"SEMICOLON",89:"unqString",90:"qString"},productions_:[0,[3,3],[3,2],[3,4],[4,2],[4,2],[4,1],[7,0],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[7,2],[17,1],[17,1],[17,1],[17,1],[14,5],[14,7],[28,5],[28,5],[28,5],[28,5],[28,2],[28,1],[25,1],[25,1],[25,1],[25,1],[25,1],[25,1],[37,1],[37,1],[37,1],[39,1],[39,1],[39,1],[39,1],[15,5],[15,7],[56,5],[56,5],[56,2],[56,1],[16,5],[16,5],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[62,1],[19,3],[20,3],[20,3],[30,1],[30,3],[30,1],[30,3],[18,3],[73,1],[73,3],[78,1],[78,2],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[79,1],[26,1],[26,1],[33,1],[33,1],[35,1],[35,1],[55,1],[55,1],[58,1],[58,1],[60,1],[60,1]],performAction:(0,c.K)(function(e,t,s,i,n,r,a){var l=r.length-1;switch(n){case 4:this.$=r[l].trim(),i.setAccTitle(this.$);break;case 5:case 6:this.$=r[l].trim(),i.setAccDescription(this.$);break;case 7:this.$=[];break;case 17:i.setDirection("TB");break;case 18:i.setDirection("BT");break;case 19:i.setDirection("RL");break;case 20:i.setDirection("LR");break;case 21:i.addRequirement(r[l-3],r[l-4]);break;case 22:i.addRequirement(r[l-5],r[l-6]),i.setClass([r[l-5]],r[l-3]);break;case 23:i.setNewReqId(r[l-2]);break;case 24:i.setNewReqText(r[l-2]);break;case 25:i.setNewReqRisk(r[l-2]);break;case 26:i.setNewReqVerifyMethod(r[l-2]);break;case 29:this.$=i.RequirementType.REQUIREMENT;break;case 30:this.$=i.RequirementType.FUNCTIONAL_REQUIREMENT;break;case 31:this.$=i.RequirementType.INTERFACE_REQUIREMENT;break;case 32:this.$=i.RequirementType.PERFORMANCE_REQUIREMENT;break;case 33:this.$=i.RequirementType.PHYSICAL_REQUIREMENT;break;case 34:this.$=i.RequirementType.DESIGN_CONSTRAINT;break;case 35:this.$=i.RiskLevel.LOW_RISK;break;case 36:this.$=i.RiskLevel.MED_RISK;break;case 37:this.$=i.RiskLevel.HIGH_RISK;break;case 38:this.$=i.VerifyType.VERIFY_ANALYSIS;break;case 39:this.$=i.VerifyType.VERIFY_DEMONSTRATION;break;case 40:this.$=i.VerifyType.VERIFY_INSPECTION;break;case 41:this.$=i.VerifyType.VERIFY_TEST;break;case 42:i.addElement(r[l-3]);break;case 43:i.addElement(r[l-5]),i.setClass([r[l-5]],r[l-3]);break;case 44:i.setNewElementType(r[l-2]);break;case 45:i.setNewElementDocRef(r[l-2]);break;case 48:i.addRelationship(r[l-2],r[l],r[l-4]);break;case 49:i.addRelationship(r[l-2],r[l-4],r[l]);break;case 50:this.$=i.Relationships.CONTAINS;break;case 51:this.$=i.Relationships.COPIES;break;case 52:this.$=i.Relationships.DERIVES;break;case 53:this.$=i.Relationships.SATISFIES;break;case 54:this.$=i.Relationships.VERIFIES;break;case 55:this.$=i.Relationships.REFINES;break;case 56:this.$=i.Relationships.TRACES;break;case 57:this.$=r[l-2],i.defineClass(r[l-1],r[l]);break;case 58:i.setClass(r[l-1],r[l]);break;case 59:i.setClass([r[l-2]],r[l]);break;case 60:case 62:case 65:this.$=[r[l]];break;case 61:case 63:this.$=r[l-2].concat([r[l]]);break;case 64:this.$=r[l-2],i.setCssStyle(r[l-1],r[l]);break;case 66:r[l-2].push(r[l]),this.$=r[l-2];break;case 68:this.$=r[l-1]+r[l]}},"anonymous"),table:[{3:1,4:2,6:t,9:s,11:i,13:n},{1:[3]},{3:8,4:2,5:[1,7],6:t,9:s,11:i,13:n},{5:[1,9]},{10:[1,10]},{12:[1,11]},e(r,[2,6]),{3:12,4:2,6:t,9:s,11:i,13:n},{1:[2,2]},{4:17,5:a,7:13,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},e(r,[2,4]),e(r,[2,5]),{1:[2,1]},{8:[1,41]},{4:17,5:a,7:42,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:43,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:44,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:45,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:46,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:47,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:48,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:49,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{4:17,5:a,7:50,8:l,9:s,11:i,13:n,14:14,15:15,16:16,17:18,18:19,19:20,20:21,21:o,22:h,23:u,24:y,25:23,33:25,41:d,42:m,43:E,44:p,45:R,46:g,54:f,72:_,74:S,77:I,89:b,90:T},{26:51,89:[1,52],90:[1,53]},{55:54,89:[1,55],90:[1,56]},{29:[1,59],61:[1,57],63:[1,58]},e(k,[2,17]),e(k,[2,18]),e(k,[2,19]),e(k,[2,20]),{30:60,33:62,75:N,89:b,90:T},{30:63,33:62,75:N,89:b,90:T},{30:64,33:62,75:N,89:b,90:T},e(q,[2,29]),e(q,[2,30]),e(q,[2,31]),e(q,[2,32]),e(q,[2,33]),e(q,[2,34]),e(C,[2,81]),e(C,[2,82]),{1:[2,3]},{8:[2,8]},{8:[2,9]},{8:[2,10]},{8:[2,11]},{8:[2,12]},{8:[2,13]},{8:[2,14]},{8:[2,15]},{8:[2,16]},{27:[1,65],29:[1,66]},e(A,[2,79]),e(A,[2,80]),{27:[1,67],29:[1,68]},e(A,[2,85]),e(A,[2,86]),{62:69,65:L,66:$,67:v,68:x,69:w,70:O,71:D},{62:77,65:L,66:$,67:v,68:x,69:w,70:O,71:D},{30:78,33:62,75:N,89:b,90:T},{73:79,75:M,76:F,78:81,79:82,80:K,81:P,82:V,83:U,84:B,85:Y,86:Q,87:H,88:W},e(j,[2,60]),e(j,[2,62]),{73:93,75:M,76:F,78:81,79:82,80:K,81:P,82:V,83:U,84:B,85:Y,86:Q,87:H,88:W},{30:94,33:62,75:N,76:F,89:b,90:T},{5:[1,95]},{30:96,33:62,75:N,89:b,90:T},{5:[1,97]},{30:98,33:62,75:N,89:b,90:T},{63:[1,99]},e(z,[2,50]),e(z,[2,51]),e(z,[2,52]),e(z,[2,53]),e(z,[2,54]),e(z,[2,55]),e(z,[2,56]),{64:[1,100]},e(k,[2,59],{76:F}),e(k,[2,64],{76:G}),{33:103,75:[1,102],89:b,90:T},e(X,[2,65],{79:104,75:M,80:K,81:P,82:V,83:U,84:B,85:Y,86:Q,87:H,88:W}),e(J,[2,67]),e(J,[2,69]),e(J,[2,70]),e(J,[2,71]),e(J,[2,72]),e(J,[2,73]),e(J,[2,74]),e(J,[2,75]),e(J,[2,76]),e(J,[2,77]),e(J,[2,78]),e(k,[2,57],{76:G}),e(k,[2,58],{76:F}),{5:Z,28:105,31:ee,34:te,36:se,38:ie,40:ne},{27:[1,112],76:F},{5:re,40:ae,56:113,57:le,59:oe},{27:[1,118],76:F},{33:119,89:b,90:T},{33:120,89:b,90:T},{75:M,78:121,79:82,80:K,81:P,82:V,83:U,84:B,85:Y,86:Q,87:H,88:W},e(j,[2,61]),e(j,[2,63]),e(J,[2,68]),e(k,[2,21]),{32:[1,122]},{32:[1,123]},{32:[1,124]},{32:[1,125]},{5:Z,28:126,31:ee,34:te,36:se,38:ie,40:ne},e(k,[2,28]),{5:[1,127]},e(k,[2,42]),{32:[1,128]},{32:[1,129]},{5:re,40:ae,56:130,57:le,59:oe},e(k,[2,47]),{5:[1,131]},e(k,[2,48]),e(k,[2,49]),e(X,[2,66],{79:104,75:M,80:K,81:P,82:V,83:U,84:B,85:Y,86:Q,87:H,88:W}),{33:132,89:b,90:T},{35:133,89:[1,134],90:[1,135]},{37:136,47:[1,137],48:[1,138],49:[1,139]},{39:140,50:[1,141],51:[1,142],52:[1,143],53:[1,144]},e(k,[2,27]),{5:Z,28:145,31:ee,34:te,36:se,38:ie,40:ne},{58:146,89:[1,147],90:[1,148]},{60:149,89:[1,150],90:[1,151]},e(k,[2,46]),{5:re,40:ae,56:152,57:le,59:oe},{5:[1,153]},{5:[1,154]},{5:[2,83]},{5:[2,84]},{5:[1,155]},{5:[2,35]},{5:[2,36]},{5:[2,37]},{5:[1,156]},{5:[2,38]},{5:[2,39]},{5:[2,40]},{5:[2,41]},e(k,[2,22]),{5:[1,157]},{5:[2,87]},{5:[2,88]},{5:[1,158]},{5:[2,89]},{5:[2,90]},e(k,[2,43]),{5:Z,28:159,31:ee,34:te,36:se,38:ie,40:ne},{5:Z,28:160,31:ee,34:te,36:se,38:ie,40:ne},{5:Z,28:161,31:ee,34:te,36:se,38:ie,40:ne},{5:Z,28:162,31:ee,34:te,36:se,38:ie,40:ne},{5:re,40:ae,56:163,57:le,59:oe},{5:re,40:ae,56:164,57:le,59:oe},e(k,[2,23]),e(k,[2,24]),e(k,[2,25]),e(k,[2,26]),e(k,[2,44]),e(k,[2,45])],defaultActions:{8:[2,2],12:[2,1],41:[2,3],42:[2,8],43:[2,9],44:[2,10],45:[2,11],46:[2,12],47:[2,13],48:[2,14],49:[2,15],50:[2,16],134:[2,83],135:[2,84],137:[2,35],138:[2,36],139:[2,37],141:[2,38],142:[2,39],143:[2,40],144:[2,41],147:[2,87],148:[2,88],150:[2,89],151:[2,90]},parseError:(0,c.K)(function(e,t){if(!t.recoverable){var s=new Error(e);throw s.hash=t,s}this.trace(e)},"parseError"),parse:(0,c.K)(function(e){var t=this,s=[0],i=[],n=[null],r=[],a=this.table,l="",o=0,h=0,u=0,y=r.slice.call(arguments,1),d=Object.create(this.lexer),m={yy:{}};for(var E in this.yy)Object.prototype.hasOwnProperty.call(this.yy,E)&&(m.yy[E]=this.yy[E]);d.setInput(e,m.yy),m.yy.lexer=d,m.yy.parser=this,void 0===d.yylloc&&(d.yylloc={});var p=d.yylloc;r.push(p);var R=d.options&&d.options.ranges;function g(){var e;return"number"!=typeof(e=i.pop()||d.lex()||1)&&(e instanceof Array&&(e=(i=e).pop()),e=t.symbols_[e]||e),e}"function"==typeof m.yy.parseError?this.parseError=m.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,c.K)(function(e){s.length=s.length-2*e,n.length=n.length-e,r.length=r.length-e},"popStack"),(0,c.K)(g,"lex");for(var f,_,S,I,b,T,k,N,q,C={};;){if(S=s[s.length-1],this.defaultActions[S]?I=this.defaultActions[S]:(null==f&&(f=g()),I=a[S]&&a[S][f]),void 0===I||!I.length||!I[0]){var A="";for(T in q=[],a[S])this.terminals_[T]&&T>2&&q.push("'"+this.terminals_[T]+"'");A=d.showPosition?"Parse error on line "+(o+1)+":\n"+d.showPosition()+"\nExpecting "+q.join(", ")+", got '"+(this.terminals_[f]||f)+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==f?"end of input":"'"+(this.terminals_[f]||f)+"'"),this.parseError(A,{text:d.match,token:this.terminals_[f]||f,line:d.yylineno,loc:p,expected:q})}if(I[0]instanceof Array&&I.length>1)throw new Error("Parse Error: multiple actions possible at state: "+S+", token: "+f);switch(I[0]){case 1:s.push(f),n.push(d.yytext),r.push(d.yylloc),s.push(I[1]),f=null,_?(f=_,_=null):(h=d.yyleng,l=d.yytext,o=d.yylineno,p=d.yylloc,u>0&&u--);break;case 2:if(k=this.productions_[I[1]][1],C.$=n[n.length-k],C._$={first_line:r[r.length-(k||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(k||1)].first_column,last_column:r[r.length-1].last_column},R&&(C._$.range=[r[r.length-(k||1)].range[0],r[r.length-1].range[1]]),void 0!==(b=this.performAction.apply(C,[l,h,o,m.yy,I[1],n,r].concat(y))))return b;k&&(s=s.slice(0,-1*k*2),n=n.slice(0,-1*k),r=r.slice(0,-1*k)),s.push(this.productions_[I[1]][0]),n.push(C.$),r.push(C._$),N=a[s[s.length-2]][s[s.length-1]],s.push(N);break;case 3:return!0}}return!0},"parse")},he=function(){return{EOF:1,parseError:(0,c.K)(function(e,t){if(!this.yy.parser)throw new Error(e);this.yy.parser.parseError(e,t)},"parseError"),setInput:(0,c.K)(function(e,t){return this.yy=t||this.yy||{},this._input=e,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,c.K)(function(){var e=this._input[0];return this.yytext+=e,this.yyleng++,this.offset++,this.match+=e,this.matched+=e,e.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),e},"input"),unput:(0,c.K)(function(e){var t=e.length,s=e.split(/(?:\r\n?|\n)/g);this._input=e+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-t),this.offset-=t;var i=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),s.length-1&&(this.yylineno-=s.length-1);var n=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:s?(s.length===i.length?this.yylloc.first_column:0)+i[i.length-s.length].length-s[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[n[0],n[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},"unput"),more:(0,c.K)(function(){return this._more=!0,this},"more"),reject:(0,c.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,c.K)(function(e){this.unput(this.match.slice(e))},"less"),pastInput:(0,c.K)(function(){var e=this.matched.substr(0,this.matched.length-this.match.length);return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,c.K)(function(){var e=this.match;return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,c.K)(function(){var e=this.pastInput(),t=new Array(e.length+1).join("-");return e+this.upcomingInput()+"\n"+t+"^"},"showPosition"),test_match:(0,c.K)(function(e,t){var s,i,n;if(this.options.backtrack_lexer&&(n={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&&(n.yylloc.range=this.yylloc.range.slice(0))),(i=e[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-i[i.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+e[0].length},this.yytext+=e[0],this.match+=e[0],this.matches=e,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(e[0].length),this.matched+=e[0],s=this.performAction.call(this,this.yy,this,t,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),s)return s;if(this._backtrack){for(var r in n)this[r]=n[r];return!1}return!1},"test_match"),next:(0,c.K)(function(){if(this.done)return this.EOF;var e,t,s,i;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var n=this._currentRules(),r=0;r<n.length;r++)if((s=this._input.match(this.rules[n[r]]))&&(!t||s[0].length>t[0].length)){if(t=s,i=r,this.options.backtrack_lexer){if(!1!==(e=this.test_match(s,n[r])))return e;if(this._backtrack){t=!1;continue}return!1}if(!this.options.flex)break}return t?!1!==(e=this.test_match(t,n[i]))&&e:""===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,c.K)(function(){var e=this.next();return e||this.lex()},"lex"),begin:(0,c.K)(function(e){this.conditionStack.push(e)},"begin"),popState:(0,c.K)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,c.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,c.K)(function(e){return(e=this.conditionStack.length-1-Math.abs(e||0))>=0?this.conditionStack[e]:"INITIAL"},"topState"),pushState:(0,c.K)(function(e){this.begin(e)},"pushState"),stateStackSize:(0,c.K)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,c.K)(function(e,t,s,i){switch(s){case 0:return"title";case 1:return this.begin("acc_title"),9;case 2:return this.popState(),"acc_title_value";case 3:return this.begin("acc_descr"),11;case 4:return this.popState(),"acc_descr_value";case 5:this.begin("acc_descr_multiline");break;case 6:case 58:case 65:this.popState();break;case 7:return"acc_descr_multiline_value";case 8:return 21;case 9:return 22;case 10:return 23;case 11:return 24;case 12:return 5;case 13:case 14:case 15:case 56:break;case 16:return 8;case 17:return 6;case 18:return 27;case 19:return 40;case 20:return 29;case 21:return 32;case 22:return 31;case 23:return 34;case 24:return 36;case 25:return 38;case 26:return 41;case 27:return 42;case 28:return 43;case 29:return 44;case 30:return 45;case 31:return 46;case 32:return 47;case 33:return 48;case 34:return 49;case 35:return 50;case 36:return 51;case 37:return 52;case 38:return 53;case 39:return 54;case 40:return 65;case 41:return 66;case 42:return 67;case 43:return 68;case 44:return 69;case 45:return 70;case 46:return 71;case 47:return 57;case 48:return 59;case 49:return this.begin("style"),77;case 50:case 68:return 75;case 51:return 81;case 52:return 88;case 53:return"PERCENT";case 54:return 86;case 55:return 84;case 57:case 64:this.begin("string");break;case 59:return this.begin("style"),72;case 60:return this.begin("style"),74;case 61:return 61;case 62:return 64;case 63:return 63;case 66:return"qString";case 67:return t.yytext=t.yytext.trim(),89;case 69:return 80;case 70:return 76}},"anonymous"),rules:[/^(?:title\s[^#\n;]+)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:[\}])/i,/^(?:[^\}]*)/i,/^(?:.*direction\s+TB[^\n]*)/i,/^(?:.*direction\s+BT[^\n]*)/i,/^(?:.*direction\s+RL[^\n]*)/i,/^(?:.*direction\s+LR[^\n]*)/i,/^(?:(\r?\n)+)/i,/^(?:\s+)/i,/^(?:#[^\n]*)/i,/^(?:%[^\n]*)/i,/^(?:$)/i,/^(?:requirementDiagram\b)/i,/^(?:\{)/i,/^(?:\})/i,/^(?::{3})/i,/^(?::)/i,/^(?:id\b)/i,/^(?:text\b)/i,/^(?:risk\b)/i,/^(?:verifyMethod\b)/i,/^(?:requirement\b)/i,/^(?:functionalRequirement\b)/i,/^(?:interfaceRequirement\b)/i,/^(?:performanceRequirement\b)/i,/^(?:physicalRequirement\b)/i,/^(?:designConstraint\b)/i,/^(?:low\b)/i,/^(?:medium\b)/i,/^(?:high\b)/i,/^(?:analysis\b)/i,/^(?:demonstration\b)/i,/^(?:inspection\b)/i,/^(?:test\b)/i,/^(?:element\b)/i,/^(?:contains\b)/i,/^(?:copies\b)/i,/^(?:derives\b)/i,/^(?:satisfies\b)/i,/^(?:verifies\b)/i,/^(?:refines\b)/i,/^(?:traces\b)/i,/^(?:type\b)/i,/^(?:docref\b)/i,/^(?:style\b)/i,/^(?:\w+)/i,/^(?::)/i,/^(?:;)/i,/^(?:%)/i,/^(?:-)/i,/^(?:#)/i,/^(?: )/i,/^(?:["])/i,/^(?:\n)/i,/^(?:classDef\b)/i,/^(?:class\b)/i,/^(?:<-)/i,/^(?:->)/i,/^(?:-)/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:[\w][^:,\r\n\{\<\>\-\=]*)/i,/^(?:\w+)/i,/^(?:[0-9]+)/i,/^(?:,)/i],conditions:{acc_descr_multiline:{rules:[6,7,68,69,70],inclusive:!1},acc_descr:{rules:[4,68,69,70],inclusive:!1},acc_title:{rules:[2,68,69,70],inclusive:!1},style:{rules:[50,51,52,53,54,55,56,57,58,68,69,70],inclusive:!1},unqString:{rules:[68,69,70],inclusive:!1},token:{rules:[68,69,70],inclusive:!1},string:{rules:[65,66,68,69,70],inclusive:!1},INITIAL:{rules:[0,1,3,5,8,9,10,11,12,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,59,60,61,62,63,64,67,68,69,70],inclusive:!0}}}}();function ue(){this.yy={}}return ce.lexer=he,(0,c.K)(ue,"Parser"),ue.prototype=ce,ce.Parser=ue,new ue}();h.parser=h;var u=h,y=class{constructor(){this.relations=[],this.latestRequirement=this.getInitialRequirement(),this.requirements=new Map,this.latestElement=this.getInitialElement(),this.elements=new Map,this.classes=new Map,this.direction="TB",this.RequirementType={REQUIREMENT:"Requirement",FUNCTIONAL_REQUIREMENT:"Functional Requirement",INTERFACE_REQUIREMENT:"Interface Requirement",PERFORMANCE_REQUIREMENT:"Performance Requirement",PHYSICAL_REQUIREMENT:"Physical Requirement",DESIGN_CONSTRAINT:"Design Constraint"},this.RiskLevel={LOW_RISK:"Low",MED_RISK:"Medium",HIGH_RISK:"High"},this.VerifyType={VERIFY_ANALYSIS:"Analysis",VERIFY_DEMONSTRATION:"Demonstration",VERIFY_INSPECTION:"Inspection",VERIFY_TEST:"Test"},this.Relationships={CONTAINS:"contains",COPIES:"copies",DERIVES:"derives",SATISFIES:"satisfies",VERIFIES:"verifies",REFINES:"refines",TRACES:"traces"},this.setAccTitle=l.SV,this.getAccTitle=l.iN,this.setAccDescription=l.EI,this.getAccDescription=l.m7,this.setDiagramTitle=l.ke,this.getDiagramTitle=l.ab,this.getConfig=(0,c.K)(()=>(0,l.D7)().requirement,"getConfig"),this.clear(),this.setDirection=this.setDirection.bind(this),this.addRequirement=this.addRequirement.bind(this),this.setNewReqId=this.setNewReqId.bind(this),this.setNewReqRisk=this.setNewReqRisk.bind(this),this.setNewReqText=this.setNewReqText.bind(this),this.setNewReqVerifyMethod=this.setNewReqVerifyMethod.bind(this),this.addElement=this.addElement.bind(this),this.setNewElementType=this.setNewElementType.bind(this),this.setNewElementDocRef=this.setNewElementDocRef.bind(this),this.addRelationship=this.addRelationship.bind(this),this.setCssStyle=this.setCssStyle.bind(this),this.setClass=this.setClass.bind(this),this.defineClass=this.defineClass.bind(this),this.setAccTitle=this.setAccTitle.bind(this),this.setAccDescription=this.setAccDescription.bind(this)}static{(0,c.K)(this,"RequirementDB")}getDirection(){return this.direction}setDirection(e){this.direction=e}resetLatestRequirement(){this.latestRequirement=this.getInitialRequirement()}resetLatestElement(){this.latestElement=this.getInitialElement()}getInitialRequirement(){return{requirementId:"",text:"",risk:"",verifyMethod:"",name:"",type:"",cssStyles:[],classes:["default"]}}getInitialElement(){return{name:"",type:"",docRef:"",cssStyles:[],classes:["default"]}}addRequirement(e,t){return this.requirements.has(e)||this.requirements.set(e,{name:e,type:t,requirementId:this.latestRequirement.requirementId,text:this.latestRequirement.text,risk:this.latestRequirement.risk,verifyMethod:this.latestRequirement.verifyMethod,cssStyles:[],classes:["default"]}),this.resetLatestRequirement(),this.requirements.get(e)}getRequirements(){return this.requirements}setNewReqId(e){void 0!==this.latestRequirement&&(this.latestRequirement.requirementId=e)}setNewReqText(e){void 0!==this.latestRequirement&&(this.latestRequirement.text=e)}setNewReqRisk(e){void 0!==this.latestRequirement&&(this.latestRequirement.risk=e)}setNewReqVerifyMethod(e){void 0!==this.latestRequirement&&(this.latestRequirement.verifyMethod=e)}addElement(e){return this.elements.has(e)||(this.elements.set(e,{name:e,type:this.latestElement.type,docRef:this.latestElement.docRef,cssStyles:[],classes:["default"]}),o.R.info("Added new element: ",e)),this.resetLatestElement(),this.elements.get(e)}getElements(){return this.elements}setNewElementType(e){void 0!==this.latestElement&&(this.latestElement.type=e)}setNewElementDocRef(e){void 0!==this.latestElement&&(this.latestElement.docRef=e)}addRelationship(e,t,s){this.relations.push({type:e,src:t,dst:s})}getRelationships(){return this.relations}clear(){this.relations=[],this.resetLatestRequirement(),this.requirements=new Map,this.resetLatestElement(),this.elements=new Map,this.classes=new Map,(0,l.IU)()}setCssStyle(e,t){for(const s of e){const e=this.requirements.get(s)??this.elements.get(s);if(!t||!e)return;for(const s of t)s.includes(",")?e.cssStyles.push(...s.split(",")):e.cssStyles.push(s)}}setClass(e,t){for(const s of e){const e=this.requirements.get(s)??this.elements.get(s);if(e)for(const s of t){e.classes.push(s);const t=this.classes.get(s)?.styles;t&&e.cssStyles.push(...t)}}}defineClass(e,t){for(const s of e){let e=this.classes.get(s);void 0===e&&(e={id:s,styles:[],textStyles:[]},this.classes.set(s,e)),t&&t.forEach(function(t){if(/color/.exec(t)){const s=t.replace("fill","bgFill");e.textStyles.push(s)}e.styles.push(t)}),this.requirements.forEach(e=>{e.classes.includes(s)&&e.cssStyles.push(...t.flatMap(e=>e.split(",")))}),this.elements.forEach(e=>{e.classes.includes(s)&&e.cssStyles.push(...t.flatMap(e=>e.split(",")))})}}getClasses(){return this.classes}getData(){const e=(0,l.D7)(),t=[],s=[];for(const s of this.requirements.values()){const i=s;i.id=s.name,i.cssStyles=s.cssStyles,i.cssClasses=s.classes.join(" "),i.shape="requirementBox",i.look=e.look,i.colorIndex=t.length,t.push(i)}for(const s of this.elements.values()){const i=s;i.shape="requirementBox",i.look=e.look,i.id=s.name,i.cssStyles=s.cssStyles,i.cssClasses=s.classes.join(" "),i.colorIndex=t.length,t.push(i)}for(const t of this.relations){let i=0;const n=t.type===this.Relationships.CONTAINS,r={id:`${t.src}-${t.dst}-${i}`,start:this.requirements.get(t.src)?.name??this.elements.get(t.src)?.name,end:this.requirements.get(t.dst)?.name??this.elements.get(t.dst)?.name,label:`&lt;&lt;${t.type}&gt;&gt;`,classes:"relationshipLine",style:["fill:none",n?"":"stroke-dasharray: 10,7"],labelpos:"c",thickness:"normal",type:"normal",pattern:n?"normal":"dashed",arrowTypeStart:n?"requirement_contains":"",arrowTypeEnd:n?"":"requirement_arrow",look:e.look,labelType:"markdown"};s.push(r),i++}return{nodes:t,edges:s,other:{},config:e,direction:this.getDirection()}}},d=(0,c.K)(e=>{const t=(0,l.zj)(),{themeVariables:s,look:i}=t,{bkgColorArray:n,borderColorArray:r}=s;if(!r?.length)return"";let a="";for(let t=0;t<e.THEME_COLOR_LIMIT;t++)a+=`\n\n [data-look="${i}"][data-color-id="color-${t}"].node path {\n stroke: ${r[t]};\n fill: ${n?.length?n[t]:""};\n }\n\n [data-look="${i}"][data-color-id="color-${t}"].node rect {\n stroke: ${r[t]};\n fill: ${n?.length?n[t]:""};\n }\n `;return a},"genColor"),m=(0,c.K)(e=>{const t=(0,l.zj)(),{look:s,themeVariables:i}=t,{requirementEdgeLabelBackground:n}=i;return`\n ${d(e)}\n marker {\n fill: ${e.relationColor};\n stroke: ${e.relationColor};\n }\n\n marker.cross {\n stroke: ${e.lineColor};\n }\n\n svg {\n font-family: ${e.fontFamily};\n font-size: ${e.fontSize};\n }\n\n .reqBox {\n fill: ${e.requirementBackground};\n fill-opacity: 1.0;\n stroke: ${e.requirementBorderColor};\n stroke-width: ${e.requirementBorderSize};\n }\n \n .reqTitle, .reqLabel{\n fill: ${e.requirementTextColor};\n }\n .reqLabelBox {\n fill: ${e.relationLabelBackground};\n fill-opacity: 1.0;\n }\n\n .req-title-line {\n stroke: ${e.requirementBorderColor};\n stroke-width: ${e.requirementBorderSize};\n }\n .relationshipLine {\n stroke: ${e.relationColor};\n stroke-width: ${"neo"===s?e.strokeWidth:"1px"};\n }\n .relationshipLabel {\n fill: ${e.relationLabelColor};\n }\n .edgeLabel {\n background-color: ${e.edgeLabelBackground};\n }\n .edgeLabel .label rect {\n fill: ${e.edgeLabelBackground};\n }\n .edgeLabel .label text {\n fill: ${e.relationLabelColor};\n }\n .divider {\n stroke: ${e.nodeBorder};\n stroke-width: 1;\n }\n .label {\n font-family: ${e.fontFamily};\n color: ${e.nodeTextColor||e.textColor};\n }\n .label text,span {\n fill: ${e.nodeTextColor||e.textColor};\n color: ${e.nodeTextColor||e.textColor};\n }\n .labelBkg {\n background-color: ${n??e.edgeLabelBackground};\n }\n\n`},"getStyles"),E={};(0,c.V)(E,{draw:()=>p});var p=(0,c.K)(async function(e,t,s,c){o.R.info("REF0:"),o.R.info("Drawing requirement diagram (unified)",t);const{securityLevel:h,state:u,layout:y,look:d}=(0,l.D7)(),m=c.db.getData(),E=(0,i.A)(t,h);m.type=c.type,m.layoutAlgorithm=(0,r.q7)(y),m.nodeSpacing=u?.nodeSpacing??50,m.rankSpacing=u?.rankSpacing??50,m.markers="neo"===d?["requirement_contains_neo","requirement_arrow_neo"]:["requirement_contains","requirement_arrow"],m.diagramId=t,await(0,r.XX)(m,E);a._K.insertTitle(E,"requirementDiagramTitleText",u?.titleTopMargin??25,c.db.getDiagramTitle()),(0,n.P)(E,8,"requirementDiagram",u?.useMaxWidth??!0)},"draw"),R={parser:u,get db(){return new y},renderer:E,styles:m}}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[7911],{17911(e,t,r){r.r(t),r.d(t,{getEdgesToRender:()=>x,render:()=>b});var n=r(62204),a=r(1778),i=r(75999),o=(r(23665),r(91865),r(3868)),d=(r(8969),r(24731),r(28342),r(68861)),s=r(31293),g=r(86827),l=r(75422),c=r(10010),h=r(697),f=(0,g.K)((e,t,r)=>Math.max(t,Math.min(r,e)),"clamp"),p=(0,g.K)((e="TB")=>{switch(e){case"BT":return"bottom";case"LR":return"right";case"RL":return"left";default:return"top"}},"getDefaultSelfLoopSide"),u=(0,g.K)(e=>"flowchart"===e||"flowchart-v2"===e||"stateDiagram"===e,"shouldMergeSelfLoopSegments"),y=(0,g.K)((e,t,r,n,a)=>{const i=[],o=new Set;if(r.forEach(({start:e,end:t})=>{e!==n&&o.add(e),t!==n&&o.add(t)}),o.forEach(t=>{const r=e.node(t);"number"==typeof r?.x&&"number"==typeof r?.y&&i.push(r)}),0===i.length&&r.forEach(({edge:e})=>{(e.points??[]).forEach(e=>{"number"==typeof e?.x&&"number"==typeof e?.y&&i.push(e)})}),0===i.length)return p(a);const d=i.reduce((e,t)=>({x:e.x+t.x/i.length,y:e.y+t.y/i.length}),{x:0,y:0}),s=d.x-t.x,g=d.y-t.y;return Math.abs(s)>Math.abs(g)?s>0?"right":"left":Math.abs(g)>0?g>0?"bottom":"top":p(a)},"getSelfLoopSide"),w=(0,g.K)((e,t="top",r=0,n=0)=>{const a=e.x,i=e.y-r,o=e.width/2,d=e.height/2,s=Math.max(36,Math.min(100,.8*e.width)),g=f(Math.max(n,.35*e.width),36,s),l=f(.45*Math.min(e.width,e.height),24,48);switch(t){case"bottom":{const e=i+d;return[{x:a-g/2,y:e},{x:a-g/2,y:e+l},{x:a+g/2,y:e+l},{x:a+g/2,y:e}]}case"right":{const e=a+o;return[{x:e,y:i-g/2},{x:e+l,y:i-g/2},{x:e+l,y:i+g/2},{x:e,y:i+g/2}]}case"left":{const e=a-o;return[{x:e,y:i-g/2},{x:e-l,y:i-g/2},{x:e-l,y:i+g/2},{x:e,y:i+g/2}]}default:{const e=i-d;return[{x:a-g/2,y:e},{x:a-g/2,y:e-l},{x:a+g/2,y:e-l},{x:a+g/2,y:e}]}}},"getSelfLoopPoints"),m=(0,g.K)((e,t,r="top",n=0,a={})=>{const i=e.x,o=e.y-n,d=a.width??0,s=a.height??0;switch(r){case"bottom":return{x:i,y:Math.max(...t.map(e=>e.y))+s/2+4};case"right":return{x:Math.max(...t.map(e=>e.x))+d/2+4,y:o};case"left":return{x:Math.min(...t.map(e=>e.x))-d/2-4,y:o};default:return{x:i,y:Math.min(...t.map(e=>e.y))-s/2-4}}},"getSelfLoopLabelPosition"),x=(0,g.K)((e,t=0,{mergeSelfLoops:r=!0}={})=>{const n=new Map,a=[],i=e.graph()?.rankdir;return e.edges().forEach(t=>{const i=e.edge(t);if(r&&i.selfLoop){const e=i.selfLoop.id;n.has(e)||n.set(e,[]),n.get(e).push({edge:i,start:t.v,end:t.w})}else a.push({edge:i,start:t.v,end:t.w})}),n.forEach(r=>{if(3!==r.length)return void r.forEach(e=>a.push(e));r.sort((e,t)=>e.edge.selfLoop.order-t.edge.selfLoop.order);const[n,o,d]=r,s=n.edge.originalEdge??o.edge.originalEdge??d.edge.originalEdge??o.edge,g=e.node(s.start);if(!g)return void r.forEach(e=>a.push(e));const l={width:o.edge.width,height:o.edge.height},c=y(e,g,r,s.start,i),h=w(g,c,t,l.width??0),f=m(g,h,c,t,l),p={...o.edge,...s,id:s.id,points:h,start:s.start,end:s.end,x:f.x,y:f.y,width:l.width,height:l.height,labelStyle:o.edge.labelStyle,fromCluster:n.edge.fromCluster??o.edge.fromCluster??d.edge.fromCluster,toCluster:n.edge.toCluster??o.edge.toCluster??d.edge.toCluster};delete p.selfLoop,delete p.originalEdge,a.push({edge:p,start:p.start,end:p.end})}),a},"getEdgesToRender"),R=(0,g.K)(async(e,t,r,d,h,f)=>{s.R.warn("Graph in recursive render:XAX",c.M(t),h);const p=t.graph().rankdir;s.R.trace("Dir in recursive render - dir:",p);const y=e.insert("g").attr("class","root");t.nodes()?s.R.info("Recursive render XXX",t.nodes()):s.R.info("No nodes found for",t),t.edges().length>0&&s.R.info("Recursive edges",t.edge(t.edges()[0]));const w=y.insert("g").attr("class","clusters"),m=y.insert("g").attr("class","edgePaths"),b=y.insert("g").attr("class","edgeLabels"),X=y.insert("g").attr("class","nodes"),L=u(r);await Promise.all(t.nodes().map(async function(e){const a=t.node(e);if(void 0!==h){const r=JSON.parse(JSON.stringify(h.clusterData));s.R.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",r.height,"\nParent cluster",h.height),t.setNode(h.id,r),t.parent(e)||(s.R.trace("Setting parent",e,h.id),t.setParent(e,h.id,r))}if(s.R.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),a?.clusterNode){s.R.info("Cluster identified XBX",e,a.width,t.node(e));const{ranksep:n,nodesep:o}=t.graph();a.graph.setGraph({...a.graph.graph(),ranksep:n+25,nodesep:o});const g=await R(X,a.graph,r,d,t.node(e),f),l=g.elem;(0,i.lC)(a,l),a.diff=g.diff||0,s.R.info("New compound node after recursive render XAX",e,"width",a.width,"height",a.height),(0,i.U7)(l,a)}else t.children(e).length>0?(s.R.trace("Cluster - the non recursive path XBX",e,a.id,a,a.width,"Graph:",t),s.R.trace((0,n.dc)(a.id,t)),n.ju.set(a.id,{id:(0,n.dc)(a.id,t),node:a})):(s.R.trace("Node - the non recursive path XAX",e,X,t.node(e),p),await(0,i.on)(X,t.node(e),{config:f,dir:p}))}));const S=(0,g.K)(async()=>{const e=t.edges().map(async function(e){const r=t.edge(e.v,e.w,e.name);if(s.R.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),s.R.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),s.R.info("Fix",n.ju,"ids:",e.v,e.w,"Translating: ",n.ju.get(e.v),n.ju.get(e.w)),L&&r.selfLoop){if(1!==r.selfLoop.order)return;const e=r.id;return r.id=r.selfLoop.id,await(0,a.jP)(b,r),void(r.id=e)}await(0,a.jP)(b,r)});await Promise.all(e)},"processEdges");await S(),s.R.info("Graph before layout:",JSON.stringify(c.M(t))),s.R.info("############################################# XXX"),s.R.info("### Layout ### XXX"),s.R.info("############################################# XXX"),(0,l.Zp)(t),s.R.info("Graph after layout:",JSON.stringify(c.M(t)));let E=0,{subGraphTitleTotalMargin:v}=(0,o.O)(f);await Promise.all((0,n.sc)(t).map(async function(e){const r=t.node(e);if(s.R.info("Position XBX => "+e+": ("+r.x,","+r.y,") width: ",r.width," height: ",r.height),r?.clusterNode)r.y+=v,s.R.info("A tainted cluster node XBX1",e,r.id,r.width,r.height,r.x,r.y,t.parent(e)),n.ju.get(r.id).node=r,(0,i.U_)(r);else if(t.children(e).length>0){s.R.info("A pure cluster node XBX1",e,r.id,r.x,r.y,r.width,r.height,t.parent(e)),r.height+=v,t.node(r.parentId);const a=r?.padding/2||0,o=r?.labelBBox?.height||0,d=o-a||0;s.R.debug("OffsetY",d,"labelHeight",o,"halfPadding",a),await(0,i.U)(w,r),n.ju.get(r.id).node=r}else{const e=t.node(r.parentId);r.y+=v/2,s.R.info("A regular node XBX1 - using the padding",r.id,"parent",r.parentId,r.width,r.height,r.x,r.y,"offsetY",r.offsetY,"parent",e,e?.offsetY,r),(0,i.U_)(r)}}));const M=v/2;return x(t,M,{mergeSelfLoops:L}).forEach(function({edge:e,start:i,end:o}){s.R.info("Edge "+i+" -> "+o+": "+JSON.stringify(e),e),e.points.forEach(e=>e.y+=M);const g=t.node(i),l=t.node(o),c=(0,a.Jo)(m,e,n.ju,r,g,l,d);(0,a.T_)(e,c)}),t.nodes().forEach(function(e){const r=t.node(e);s.R.info(e,r.type,r.diff),r.isGroup&&(E=r.diff)}),s.R.warn("Returning from recursive render XAX",y,E),{elem:y,diff:E}},"recursiveRender"),b=(0,g.K)(async(e,t)=>{const r=new h.T({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),o=t.select("g");(0,a.g0)(o,e.markers,e.type,e.diagramId),(0,i.gh)(),(0,a.IU)(),(0,i.IU)(),(0,n.IU)(),e.nodes.forEach(e=>{r.setNode(e.id,{...e}),e.parentId&&r.setParent(e.id,e.parentId)}),s.R.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){const t=e.start,n=t+"---"+t+"---1",a=t+"---"+t+"---2",i=r.node(t);r.setNode(n,{domId:n,id:n,parentId:i.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),r.setParent(n,i.parentId),r.setNode(a,{domId:a,id:a,parentId:i.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),r.setParent(a,i.parentId);const o=structuredClone(e),d=structuredClone(e),s=structuredClone(e),g=structuredClone(e);d.originalEdge=o,d.selfLoop={id:o.id,order:0},s.originalEdge=o,s.selfLoop={id:o.id,order:1},g.originalEdge=o,g.selfLoop={id:o.id,order:2},d.label="",d.arrowTypeEnd="none",d.endLabelLeft="",d.endLabelRight="",d.startLabelLeft="",d.id=t+"-cyclic-special-1",s.startLabelRight="",s.startLabelLeft="",s.endLabelLeft="",s.endLabelRight="",s.arrowTypeStart="none",s.arrowTypeEnd="none",s.id=t+"-cyclic-special-mid",g.label="",g.startLabelRight="",g.startLabelLeft="",g.arrowTypeStart="none",i.isGroup&&(d.fromCluster=t,g.toCluster=t),g.id=t+"-cyclic-special-2",g.arrowTypeStart="none",r.setEdge(t,n,d,t+"-cyclic-special-0"),r.setEdge(n,a,s,t+"-cyclic-special-1"),r.setEdge(a,t,g,t+"-cyclic-special-2")}else r.setEdge(e.start,e.end,{...e},e.id)}),s.R.warn("Graph at first:",JSON.stringify(c.M(r))),(0,n.OS)(r),s.R.warn("Graph after XAX:",JSON.stringify(c.M(r)));const g=(0,d.D7)();await R(o,r,e.type,e.diagramId,void 0,g)},"render")}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[893],{80893(e,t,n){n.d(t,{diagram:()=>r});var a=n(52703),l=(n(64918),n(96755),n(59337),n(81818),n(6923),n(72389),n(1778),n(75999),n(23665),n(91865),n(3868),n(8969),n(24731),n(28342),n(68861),n(31293),(0,n(86827).K)(e=>`${(0,a.tM)(e)}\n .swimlane.cluster rect {\n stroke: ${e.clusterBorder} !important;\n }\n [data-look="neo"].cluster rect {\n filter: none;\n }\n`,"getStyles")),r=(0,a.ur)({defaultLayout:"swimlane",styles:l})}}]);