isorite 0.8.1 → 0.10.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 (112) hide show
  1. package/dist/core.js +84 -10
  2. package/dist/main.js +692 -99
  3. package/docs/setup-for-agents.md +8 -5
  4. package/docs/setup.md +31 -4
  5. package/docs/terminal.md +9 -3
  6. package/notes/algorithms/the-quadtree/subdivision.svg +15 -0
  7. package/notes/algorithms/the-quadtree.md +2 -0
  8. package/package.json +1 -1
  9. package/plugin/server.ts +1 -1
  10. package/plugin/tui.tsx +6 -0
  11. package/web/_app/immutable/assets/{0.CTbO0owi.css → 0.CPW9fjPu.css} +1 -1
  12. package/web/_app/immutable/assets/NoteEditor.Wt5vU9Tb.css +1 -0
  13. package/web/_app/immutable/chunks/{8wVGBFSs.js → -2Meesge.js} +3 -3
  14. package/web/_app/immutable/chunks/{C_ER1Any.js → 6RXH8WsD.js} +1 -1
  15. package/web/_app/immutable/chunks/{BL3mLym4.js → 9z49435t.js} +1 -1
  16. package/web/_app/immutable/chunks/B0A4Snxv.js +6 -0
  17. package/web/_app/immutable/chunks/B8Qvvm53.js +1 -0
  18. package/web/_app/immutable/chunks/{DMAYXnpq.js → BA8Hpxhg.js} +1 -1
  19. package/web/_app/immutable/chunks/{CKSRTWxH.js → BAclEN0O.js} +1 -1
  20. package/web/_app/immutable/chunks/BJo70SOc.js +1 -0
  21. package/web/_app/immutable/chunks/{DECNRCf2.js → BLmF1B2i.js} +1 -1
  22. package/web/_app/immutable/chunks/{CiVjR8gq.js → BTclWEfx.js} +1 -1
  23. package/web/_app/immutable/chunks/{Cp_JbuGh.js → BWVMfAMh.js} +1 -1
  24. package/web/_app/immutable/chunks/{D4fLEcOQ.js → BXAOBcPb.js} +1 -1
  25. package/web/_app/immutable/chunks/BYSDTLqw.js +1 -0
  26. package/web/_app/immutable/chunks/{Cgml88Pl.js → BcgO-fBX.js} +1 -1
  27. package/web/_app/immutable/chunks/BimZp6R0.js +523 -0
  28. package/web/_app/immutable/chunks/{CO2Y5y64.js → Bq2GBAJ0.js} +1 -1
  29. package/web/_app/immutable/chunks/BqrMZ9MX.js +1 -0
  30. package/web/_app/immutable/chunks/{BN6xhG8e.js → Bt7VOT5H.js} +1 -1
  31. package/web/_app/immutable/chunks/{BGbXxNFa.js → BuUzVkG2.js} +1 -1
  32. package/web/_app/immutable/chunks/{Brxvm_b1.js → By4S_gy5.js} +1 -1
  33. package/web/_app/immutable/chunks/{CRIvE37b.js → BymwHy7o.js} +1 -1
  34. package/web/_app/immutable/chunks/{B4sg4e8i.js → C5MPRibb.js} +1 -1
  35. package/web/_app/immutable/chunks/CBkjDkEN.js +151 -0
  36. package/web/_app/immutable/chunks/{BrqJKzQU.js → CD6xPodA.js} +1 -1
  37. package/web/_app/immutable/chunks/{CEufJyoj.js → CQd9D8Nc.js} +1 -1
  38. package/web/_app/immutable/chunks/{BrGmYbJT.js → CT_Ry4q8.js} +1 -1
  39. package/web/_app/immutable/chunks/{CQadubS9.js → C_amgxV1.js} +1 -1
  40. package/web/_app/immutable/chunks/CiU6tYJv.js +1 -0
  41. package/web/_app/immutable/chunks/{spNKdrPy.js → CjtKPNlv.js} +1 -1
  42. package/web/_app/immutable/chunks/{DxLkKbK2.js → Cl5zRP_n.js} +1 -1
  43. package/web/_app/immutable/chunks/{yXUzBjUq.js → CsRPJjQS.js} +1 -1
  44. package/web/_app/immutable/chunks/{CETSRtnV.js → CyFLqlvP.js} +1 -1
  45. package/web/_app/immutable/chunks/{Bq5hCPe1.js → Czz9qOh8.js} +1 -1
  46. package/web/_app/immutable/chunks/{BguXRgvc.js → D3-rqfsM.js} +1 -1
  47. package/web/_app/immutable/chunks/{bcQIrid8.js → D5XlJBy8.js} +1 -1
  48. package/web/_app/immutable/chunks/{TuFg0KqZ.js → D5vocsTl.js} +1 -1
  49. package/web/_app/immutable/chunks/{CTscJvp6.js → D95RKsvN.js} +1 -1
  50. package/web/_app/immutable/chunks/{BzI3yqBQ.js → DBC2xjOo.js} +1 -1
  51. package/web/_app/immutable/chunks/{C1hqerMA.js → DCD8_jrW.js} +1 -1
  52. package/web/_app/immutable/chunks/{BsLNwr5A.js → DF89zyH-.js} +1 -1
  53. package/web/_app/immutable/chunks/{DsIcKd8x.js → DQjIi5Jv.js} +1 -1
  54. package/web/_app/immutable/chunks/{C-dfcq9W.js → DRX-TQzj.js} +1 -1
  55. package/web/_app/immutable/chunks/{BunrC_8P.js → DX4bJJO0.js} +1 -1
  56. package/web/_app/immutable/chunks/{EQVRMnZU.js → DXK7PB4g.js} +1 -1
  57. package/web/_app/immutable/chunks/{mbLqADPr.js → DXTK-eyo.js} +1 -1
  58. package/web/_app/immutable/chunks/{wCTXGvXm.js → DbNETcPs.js} +1 -1
  59. package/web/_app/immutable/chunks/{CX-xckzu.js → DfCZPwp1.js} +1 -1
  60. package/web/_app/immutable/chunks/{DKNOMI4Y.js → Dh1lBxfx.js} +1 -1
  61. package/web/_app/immutable/chunks/{BgczuZKA.js → DkxkvOjx.js} +1 -1
  62. package/web/_app/immutable/chunks/DlKQFacy.js +1 -0
  63. package/web/_app/immutable/chunks/{0M1khDs2.js → DlXrOzlh.js} +1 -1
  64. package/web/_app/immutable/chunks/{B85D_PlV.js → Dpa4Syyy.js} +1 -1
  65. package/web/_app/immutable/chunks/DshHzxgH.js +1 -0
  66. package/web/_app/immutable/chunks/{CdY1YAit.js → EMo1IeTW.js} +1 -1
  67. package/web/_app/immutable/chunks/Iqr2CudW.js +3 -0
  68. package/web/_app/immutable/chunks/{CoyQYage.js → RFxekmX-.js} +1 -1
  69. package/web/_app/immutable/chunks/{vk5Wkr31.js → RlApGeew.js} +1 -1
  70. package/web/_app/immutable/chunks/{CLVUDRRk.js → Xm0YTnxV.js} +1 -1
  71. package/web/_app/immutable/chunks/c7PFFMl4.js +1 -0
  72. package/web/_app/immutable/chunks/{CZ8wTb_M.js → gPtCGHiy.js} +1 -1
  73. package/web/_app/immutable/chunks/{D4SKbj9K.js → oWM_kgYq.js} +1 -1
  74. package/web/_app/immutable/chunks/{wj7G6pU5.js → rghE0CVz.js} +1 -1
  75. package/web/_app/immutable/chunks/{B9YLdnR_.js → tUSDgbpy.js} +1 -1
  76. package/web/_app/immutable/chunks/{DTdlqvEb.js → vfDvz3qP.js} +1 -1
  77. package/web/_app/immutable/chunks/{BRKS-CCX.js → whhiiiga.js} +1 -1
  78. package/web/_app/immutable/entry/app.iw6ZIOh2.js +2 -0
  79. package/web/_app/immutable/entry/start.CFnKMSWs.js +1 -0
  80. package/web/_app/immutable/nodes/0.BzEgwgsa.js +26 -0
  81. package/web/_app/immutable/nodes/1.rzuq9VRh.js +1 -0
  82. package/web/_app/immutable/nodes/2.D_jWsQLW.js +1 -0
  83. package/web/_app/immutable/nodes/3.BzRx3SiD.js +1 -0
  84. package/web/_app/immutable/nodes/4.DP2MGav1.js +2 -0
  85. package/web/_app/immutable/nodes/5.BPS-CCQT.js +5 -0
  86. package/web/_app/immutable/nodes/6.DQMCyNJ3.js +1 -0
  87. package/web/_app/immutable/nodes/7.MWEn-qPC.js +1 -0
  88. package/web/_app/version.json +1 -1
  89. package/web/index.html +17 -17
  90. package/web/_app/immutable/assets/NoteEditor.8wWtZK_A.css +0 -1
  91. package/web/_app/immutable/chunks/B2TCcw-P.js +0 -6
  92. package/web/_app/immutable/chunks/BAkGB2fM.js +0 -1
  93. package/web/_app/immutable/chunks/CHbKgHy3.js +0 -1
  94. package/web/_app/immutable/chunks/CMTjeXEe.js +0 -1
  95. package/web/_app/immutable/chunks/CurmVJyp.js +0 -1
  96. package/web/_app/immutable/chunks/D29fKEzc.js +0 -1
  97. package/web/_app/immutable/chunks/D3BEa5-_.js +0 -673
  98. package/web/_app/immutable/chunks/DPnfDiTn.js +0 -1
  99. package/web/_app/immutable/chunks/DZYaqCwi.js +0 -1
  100. package/web/_app/immutable/chunks/D_19S_Iu.js +0 -1
  101. package/web/_app/immutable/chunks/DtPULAe0.js +0 -1
  102. package/web/_app/immutable/chunks/nMarIA7J.js +0 -3
  103. package/web/_app/immutable/entry/app.idRgnoYp.js +0 -2
  104. package/web/_app/immutable/entry/start.CEx_UQO6.js +0 -1
  105. package/web/_app/immutable/nodes/0.BUd_gY_8.js +0 -26
  106. package/web/_app/immutable/nodes/1.DHK7VmG0.js +0 -1
  107. package/web/_app/immutable/nodes/2.CDAt-6SJ.js +0 -1
  108. package/web/_app/immutable/nodes/3.4Wv5nmaw.js +0 -1
  109. package/web/_app/immutable/nodes/4.Ceb5g4Ps.js +0 -2
  110. package/web/_app/immutable/nodes/5.DioYOANs.js +0 -5
  111. package/web/_app/immutable/nodes/6.CzYfNb6g.js +0 -1
  112. package/web/_app/immutable/nodes/7.BxQaF3lD.js +0 -1
@@ -1,2 +1,2 @@
1
- import{_ as e,f as t,i as n,o as r,s as i,u as a,x as o}from"./CX-xckzu.js";import{PeleError as s,g as c,h as l,s as u,u as d,x as f,y as p}from"./8wVGBFSs.js";function m(e){let t=e.trim();return t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t}function h(e){return e.map(m).sort()}var g=class{type=`venn`;title;subsets=[];textNodes=[];styles=[];known=new Set;current;indent=!1;setDiagramTitle(e){this.title=e}addSubsetData(e,t,n){let r=h(e);this.current=r,r.length===1&&this.known.add(r[0]),this.subsets.push({sets:r,size:n??10/e.length**2,label:t?m(t):void 0})}addTextData(e,t,n){this.textNodes.push({sets:h(e),id:m(t),label:n?m(n):void 0})}addStyleData(e,t){let n=new Map;for(let[e,r]of t)n.set(e,r&&m(r));this.styles.push({targets:h(e),styles:n})}validateUnionIdentifiers(e){let t=e.map(m).filter(e=>!this.known.has(e));if(t.length>0)throw new s(`unknown set identifier: ${t.join(`, `)}`,`semantic`,{type:`venn`})}getCurrentSets(){return this.current}getIndentMode(){return this.indent}setIndentMode(e){this.indent=e}},_=[`$end`,`INVALID`,`EOF`,`NEWLINE`,`VENN`,`TITLE`,`SET`,`UNION`,`TEXT`,`INDENT_TEXT`,`STYLE`,`BRACKET_LABEL`,`NUMERIC`,`HEXCOLOR`,`RGBCOLOR`,`RGBACOLOR`,`IDENTIFIER`,`STRING`,`COMMA`,`COLON`],v=[[`venn-beta`,4],[`set`,6],[`union`,7],[`text`,8],[`style`,10]],y=class{constructor(e,t){this.src=e,this.host=t}src;host;text=``;start=0;at=0;lineStart=!1;ended=!1;word(e,t){let n=this.src;for(let r=0;r<t.length;r++){let i=n.charCodeAt(e+r),a=t.charCodeAt(r);if(i!==a&&(i+32!==a||i<65||i>90))return!1}return!0}keyword(e,t){return this.word(e,t)&&!c(this.src.charCodeAt(e+t.length))}color(e,t){let n=this.src,r=e+1;for(let e=0;e<t;e++){for(;l(n.charCodeAt(r));)r++;let i=r;for(;p(n.charCodeAt(r))||n.charCodeAt(r)===46;)r++;if(r===i)return-1;for(;l(n.charCodeAt(r));)r++;if(n.charCodeAt(r)!==(e===t-1?41:44))return-1;r++}return r}afterLineFeed(e){let t=e-1;for(;this.src.charCodeAt(t)===32||this.src.charCodeAt(t)===9;)t--;return this.src.charCodeAt(t)===10}lineEnd(e){let t=this.src.indexOf(`
1
+ import{_ as e,f as t,i as n,o as r,s as i,u as a,x as o}from"./DfCZPwp1.js";import{PeleError as s,g as c,h as l,s as u,u as d,x as f,y as p}from"./-2Meesge.js";function m(e){let t=e.trim();return t.length>=2&&t.startsWith(`"`)&&t.endsWith(`"`)?t.slice(1,-1):t}function h(e){return e.map(m).sort()}var g=class{type=`venn`;title;subsets=[];textNodes=[];styles=[];known=new Set;current;indent=!1;setDiagramTitle(e){this.title=e}addSubsetData(e,t,n){let r=h(e);this.current=r,r.length===1&&this.known.add(r[0]),this.subsets.push({sets:r,size:n??10/e.length**2,label:t?m(t):void 0})}addTextData(e,t,n){this.textNodes.push({sets:h(e),id:m(t),label:n?m(n):void 0})}addStyleData(e,t){let n=new Map;for(let[e,r]of t)n.set(e,r&&m(r));this.styles.push({targets:h(e),styles:n})}validateUnionIdentifiers(e){let t=e.map(m).filter(e=>!this.known.has(e));if(t.length>0)throw new s(`unknown set identifier: ${t.join(`, `)}`,`semantic`,{type:`venn`})}getCurrentSets(){return this.current}getIndentMode(){return this.indent}setIndentMode(e){this.indent=e}},_=[`$end`,`INVALID`,`EOF`,`NEWLINE`,`VENN`,`TITLE`,`SET`,`UNION`,`TEXT`,`INDENT_TEXT`,`STYLE`,`BRACKET_LABEL`,`NUMERIC`,`HEXCOLOR`,`RGBCOLOR`,`RGBACOLOR`,`IDENTIFIER`,`STRING`,`COMMA`,`COLON`],v=[[`venn-beta`,4],[`set`,6],[`union`,7],[`text`,8],[`style`,10]],y=class{constructor(e,t){this.src=e,this.host=t}src;host;text=``;start=0;at=0;lineStart=!1;ended=!1;word(e,t){let n=this.src;for(let r=0;r<t.length;r++){let i=n.charCodeAt(e+r),a=t.charCodeAt(r);if(i!==a&&(i+32!==a||i<65||i>90))return!1}return!0}keyword(e,t){return this.word(e,t)&&!c(this.src.charCodeAt(e+t.length))}color(e,t){let n=this.src,r=e+1;for(let e=0;e<t;e++){for(;l(n.charCodeAt(r));)r++;let i=r;for(;p(n.charCodeAt(r))||n.charCodeAt(r)===46;)r++;if(r===i)return-1;for(;l(n.charCodeAt(r));)r++;if(n.charCodeAt(r)!==(e===t-1?41:44))return-1;r++}return r}afterLineFeed(e){let t=e-1;for(;this.src.charCodeAt(t)===32||this.src.charCodeAt(t)===9;)t--;return this.src.charCodeAt(t)===10}lineEnd(e){let t=this.src.indexOf(`
2
2
  `,e);return t===-1?this.src.length:t}next(){let e=this.src,t=e.length;for(;;){let n=this.at;if(this.start=n,this.text=``,n>=t)return this.ended?0:(this.ended=!0,2);let r=e.charCodeAt(n);if(r===37&&e.charCodeAt(n+1)===37&&e.charCodeAt(n+2)!==123)this.at=this.lineEnd(n+2);else if(this.lineStart&&this.word(n,`title`)&&this.afterLineFeed(n)&&e.slice(n+5,this.lineEnd(n+5)).trim()===``){let t=this.lineEnd(n+5);for(;e.charCodeAt(t)===10||e.charCodeAt(t)===13;)t++;this.at=t}else{if(this.lineStart){if(r===32||r===9){let t=n+1;for(;e.charCodeAt(t)===32||e.charCodeAt(t)===9;)t++;if(this.at=t,this.keyword(t,`text`)&&this.host.getIndentMode())return this.at=t+4,this.lineStart=!1,this.text=e.slice(n,t),9;continue}r!==10&&r!==13&&(this.host.setIndentMode(!1),this.lineStart=!1)}if(r===10||r===13){for(n++;e.charCodeAt(n)===10||e.charCodeAt(n)===13;)n++;return this.lineStart=!0,this.token(3,n)}if(r===37&&e.charCodeAt(n+1)===37)this.at=this.lineEnd(n);else if(r===32||r===9){for(n++;e.charCodeAt(n)===32||e.charCodeAt(n)===9;)n++;this.at=n}else{if((r|32)>=97&&(r|32)<=122||r===95){let r=e.charCodeAt(n+5);if(this.word(n,`title`)&&l(r)&&r!==10&&r!==13){let r=n+6;for(;r<t;){let t=e.charCodeAt(r);if(t===35||t===10||t===59)break;r++}if(r>n+6)return this.token(5,r)}for(let[e,t]of v)if(this.keyword(n,e))return this.token(t,n+e.length);if(this.word(n,`rgb`)){let t=(e.charCodeAt(n+3)|32)==97,r=n+(t?4:3),i=e.charCodeAt(r)===40?this.color(r,t?4:3):-1;if(i!==-1)return this.token(t?15:14,i)}for(n++;c(e.charCodeAt(n))||e.charCodeAt(n)===45;)n++;return this.token(16,n)}if(r===91){if(e.charCodeAt(n+1)===34){let t=e.indexOf(`"`,n+2);return t===-1||e.charCodeAt(t+1)!==93?1:(this.at=t+2,this.text=e.slice(n+2,t),11)}let r=n+1;for(;r<t&&e.charCodeAt(r)!==93&&e.charCodeAt(r)!==34;)r++;return r===n+1||e.charCodeAt(r)!==93?1:(this.at=r+1,this.text=e.slice(n+1,r).trim(),11)}if(p(r)||r===46||r===43||r===45){(r===43||r===45)&&n++;let t=n;for(;p(e.charCodeAt(n));)n++;if(n>t){if(e.charCodeAt(n)===46&&p(e.charCodeAt(n+1)))for(n+=2;p(e.charCodeAt(n));)n++}else if(e.charCodeAt(n)===46&&p(e.charCodeAt(n+1)))for(n+=2;p(e.charCodeAt(n));)n++;else return 1;return this.token(12,n)}if(r===35){let t=n+1;for(;t<n+9&&f(e.charCodeAt(t));)t++;return t>=n+4?this.token(13,t):1}if(r===34){let t=e.indexOf(`"`,n+1);return t===-1?1:this.token(17,t+1)}return r===44?this.token(18,n+1):r===58?this.token(19,n+1):1}}}}token(e,t){return this.text=this.src.slice(this.at,t),this.at=t,e}},b=`'EOF', 'NEWLINE', 'TITLE', 'SET', 'UNION', 'TEXT', 'INDENT_TEXT', 'STYLE'`,x=`'NUMERIC', 'IDENTIFIER', 'STRING', 'HEXCOLOR', 'RGBCOLOR', 'RGBACOLOR'`;function S(e,t){let n=new y(e,t),r=-1,i=()=>r===-1?r=n.next():r,a=t=>{throw i()===1?u(`venn`,e,n.start,``,!0):u(`venn`,e,n.start,`Expecting ${t}, got '${_[r]}'`)},o=()=>(r=-1,n.text),c=e=>(i()!==e&&a(`'${_[e]}'`),o()),l=()=>(i()!==16&&r!==17&&a(`'IDENTIFIER', 'STRING'`),o()),d=()=>{let e=[l()];for(;i()===18;)o(),e.push(l());return e},f=(e,n)=>{let r=i()===11?o():void 0,a;if(i()===19&&(o(),a=parseFloat(c(12))),n){if(e.length<2)throw new s(`union requires multiple identifiers`,`semantic`,{type:`venn`});t.validateUnionIdentifiers(e)}t.addSubsetData(e,r,a),t.setIndentMode(!0)},p=e=>{let n=i();n!==16&&n!==17&&n!==12&&a(`'NUMERIC', 'IDENTIFIER', 'STRING'`);let r=o(),s=n!==12&&i()===11?o():void 0;t.addTextData(e(),r,s)},m=()=>{let e=d(),n=[];for(;;){let e=c(16);c(19);let t;if(i()===17)t=o();else{let e=[];for(;i()===16||r>=12&&r<=15;)e.push(o());e.length===0&&a(x),t=e.join(` `)}if(n.push([e,t]),i()!==18)break;o()}t.addStyleData(e,n)};for(;i()===3;)o();for(c(4);;){let e=i();if(e===2)return;if((e<3||e>10||e===4)&&a(b),o(),e===5)t.setDiagramTitle(n.text.slice(6));else if(e===6)f([l()],!1);else if(e===7)f(d(),!0);else if(e===8){let e=d();p(()=>e)}else e===9?p(()=>{let e=t.getCurrentSets();if(!e)throw new s(`text requires set`,`semantic`,{type:`venn`});return e}):e===10&&m()}}var C=Math.PI*2;function w(e){let t=new Set,n=new Map;for(let r of e)t.add(JSON.stringify([...r.sets].sort())),r.sets.length===1&&n.set(r.sets[0],r.size);let r=[];for(let i of e){if(i.sets.length<3)continue;let e=[...i.sets].sort();for(let i=0;i<e.length-1;i++)for(let a=i+1;a<e.length;a++){let o=[e[i],e[a]],s=JSON.stringify(o);if(t.has(s))continue;t.add(s);let c=n.get(o[0]),l=n.get(o[1]);r.push({sets:o,size:c!==void 0&&l!==void 0?Math.min(c,l)/4:2.5,label:``})}}return r.length>0?[...e,...r]:e}function T(e,t,n){if(n>=e+t)return 0;let r=Math.min(e,t);if(n<=Math.abs(e-t))return Math.PI*r*r;let i=e*e*Math.acos((n*n+e*e-t*t)/(2*n*e)),a=t*t*Math.acos((n*n+t*t-e*e)/(2*n*t)),o=.5*Math.sqrt(Math.max((-n+e+t)*(n+e-t)*(n-e+t)*(n+e+t),0));return i+a-o}function E(e,t,n){let r=Math.abs(e-t),i=e+t;if(!(n>0))return i;if(n>=Math.PI*Math.min(e,t)**2)return r;for(let a=0;a<48;a++){let a=(r+i)/2;T(e,t,a)>n?r=a:i=a}return(r+i)/2}function D(e,t,n,r,i,a){let o=1/0;for(let n of t){let t=e[n],s=r-t.x,c=i-t.y,l=t.r-Math.sqrt(s*s+c*c);if(l<o){if(l<a)return l;o=l}}for(let t of n){let n=e[t],s=r-n.x,c=i-n.y,l=Math.sqrt(s*s+c*c)-n.r;if(l<o){if(l<a)return l;o=l}}return o}function O(e,t,n){let r=0,i=0,a=e[t[0]];for(let n of t){let o=e[n];r+=o.x/t.length,i+=o.y/t.length,o.r<a.r&&(a=o)}let o=a.r,s=r,c=i,l=D(e,t,n,s,c,-1/0),u=0,d=(a,d)=>{let f=D(e,t,n,a,d,l-o*1e-9);if(!(f>l-o*1e-9))return!1;let p=Math.hypot(a-r,d-i);return f>l+o*1e-9||p<u-o*1e-9?(l=f,u=p,s=a,c=d,!0):!1};for(let e=-10;e<=10;e++)for(let t=-10;t<=10;t++)t*t+e*e<=100&&d(a.x+t*o/10,a.y+e*o/10);let f=o/10;for(let e=0;e<40&&f>o*1e-6;e++){let e=!1;for(let t=0;t<8;t++){let n=t*C/8;d(s+Math.cos(n)*f,c+Math.sin(n)*f)&&(e=!0)}e||(f/=2)}return{x:s,y:c,margin:l}}function k(e){let t=new Map;for(let n of e)for(let e of n.sets)t.has(e)||t.set(e,10);for(let n of e)n.sets.length===1&&t.set(n.sets[0],n.size);let n=new Map,r=[],i=0;for(let e of t.values())Number.isFinite(e)&&e>i&&(i=e);i===0&&(i=10);let a=Math.sqrt(i/Math.PI);for(let[e,i]of t){n.set(e,r.length);let t=Number.isFinite(i)&&i>0?Math.sqrt(i/Math.PI):0;r.push({id:e,x:0,y:0,r:Math.max(t,a*.3)})}let o=r.length;if(o<2)return r;let s=new Map;for(let t of w(e)){if(t.sets.length!==2)continue;let e=n.get(t.sets[0]),r=n.get(t.sets[1]);e!==r&&s.set(Math.min(e,r)*o+Math.max(e,r),t.size)}let c=new Map;for(let[e,t]of s)c.set(e,E(r[Math.floor(e/o)].r,r[e%o].r,t));let l=a*.15,u=(e,t)=>c.get(e*o+t)??r[e].r+r[t].r+l;if(o===2)return r[1].x=u(0,1),r;if(o===3){let t=u(0,1),n=u(0,2),i=u(1,2),o=e.some(e=>new Set(e.sets).size===3);for(let e=0;e<40;e++){let e=t>0?(t*t+n*n-i*i)/(2*t):0;if(r[1].x=t,r[2].x=Math.max(-n,Math.min(n,e)),r[2].y=Math.sqrt(Math.max(n*n-e*e,0)),!o||O(r,[0,1,2],[]).margin>a*.12)break;t*=.94,n*=.94,i*=.94}return r}let d=0;for(let e of r)d+=2*e.r+l;let f=Math.min(300,Math.floor(3e6/(o*o)));if(o<=64){let e=d/C;r.forEach((t,n)=>{let r=n*C/o-Math.PI/2;t.x=Math.cos(r)*e,t.y=Math.sin(r)*e})}else{let e=Math.ceil(Math.sqrt(o)),t=2*a+l;r.forEach((n,r)=>{n.x=r%e*t,n.y=Math.floor(r/e)*t})}let p=new Float64Array(o),m=new Float64Array(o),h=new Int32Array(o);for(let e=0;e<f;e++){p.fill(0),m.fill(0),h.fill(0);for(let e=0;e<o;e++)for(let t=e+1;t<o;t++){let n=c.get(e*o+t),i=r[e].r+r[t].r+l,a=r[t].x-r[e].x,s=r[t].y-r[e].y,u=Math.hypot(a,s);if(n===void 0&&u>=i)continue;u<1e-9&&(a=Math.cos(e+t),s=Math.sin(e+t),u=1);let d=(u-(n??i))/2/u;p[e]+=a*d,m[e]+=s*d,p[t]-=a*d,m[t]-=s*d,h[e]++,h[t]++}for(let e=0;e<o;e++)h[e]!==0&&(r[e].x+=p[e]/h[e],r[e].y+=m[e]/h[e])}return r}function A(e,t){let n=e=>`M${t(e.x-e.r)},${t(e.y)}A${t(e.r)},${t(e.r)} 0 1 1 ${t(e.x+e.r)},${t(e.y)}A${t(e.r)},${t(e.r)} 0 1 1 ${t(e.x-e.r)},${t(e.y)}Z`;if(e.length===1)return n(e[0]);let r=(t,n,r,i)=>{for(let a of e)if(a!==r&&a!==i&&Math.hypot(t-a.x,n-a.y)>a.r*(1+1e-9))return!1;return!0},i=[];for(let t=0;t<e.length;t++)for(let n=t+1;n<e.length;n++){let a=e[t],o=e[n],s=Math.hypot(o.x-a.x,o.y-a.y);if(s>=a.r+o.r||s<=Math.abs(a.r-o.r)||s===0)continue;let c=(a.r*a.r-o.r*o.r+s*s)/(2*s),l=Math.sqrt(Math.max(a.r*a.r-c*c,0)),u=a.x+(o.x-a.x)*c/s,d=a.y+(o.y-a.y)*c/s;for(let e of[1,-1]){let t=u+e*l*(o.y-a.y)/s,n=d-e*l*(o.x-a.x)/s;r(t,n,a,o)&&i.push({x:t,y:n,a,b:o})}}if(i.length<2){let t=e[0];for(let n of e)n.r<t.r&&(t=n);for(let n of e)if(n!==t&&Math.hypot(n.x-t.x,n.y-t.y)+t.r>n.r*(1+1e-9))return``;return n(t)}let a=0,o=0;for(let e of i)a+=e.x/i.length,o+=e.y/i.length;i.sort((e,t)=>Math.atan2(e.y-o,e.x-a)-Math.atan2(t.y-o,t.x-a));let s=``;for(let e=0;e<i.length;e++){let n=i[e],r=i[(e+1)%i.length];e===0&&(s=`M${t(n.x)},${t(n.y)}`);let a,o=0,c=1/0;for(let e of[n.a,n.b]){if(e!==r.a&&e!==r.b)continue;let t=Math.atan2(n.y-e.y,n.x-e.x),i=Math.atan2(r.y-e.y,r.x-e.x)-t;i<=0&&(i+=C);let s=e.x+e.r*Math.cos(t+i/2),l=e.y+e.r*Math.sin(t+i/2),u=Math.hypot(s-(n.x+r.x)/2,l-(n.y+r.y)/2);u<c&&(c=u,a=e,o=+(i>Math.PI))}s+=a===void 0?`L${t(r.x)},${t(r.y)}`:`A${t(a.r)},${t(a.r)} 0 ${o} 1 ${t(r.x)},${t(r.y)}`}return s+`Z`}var j=100,M=1.6,N=i([]);function P(e){return e.length===1?e[0]:JSON.stringify(e)}function F(s,c,l){let u=l.fontSize??16,f=Math.round(u*.875),p=Math.round(u*.8125),h=l.measurer??d(l.fontFamily,l.fontFamilyMono),g=l.padding??8,_=k(s.subsets),v=new Map;_.forEach((e,t)=>v.set(e.id,t));let y=new Map;for(let{targets:e,styles:t}of s.styles){let n=P(e),r=y.get(n);r||y.set(n,r=new Map);for(let[e,n]of t)r.set(e,n)}let b=e=>{let t=y.get(e);if(!t)return N;let n=[];for(let[e,r]of t)n.push(`${e}:${r}`);return i(n)},x=_.map(()=>[]);for(let e=0;e<_.length;e++)for(let t=e+1;t<_.length;t++)Math.hypot(_[e].x-_[t].x,_[e].y-_[t].y)<_[e].r+_[t].r&&(x[e].push(t),x[t].push(e));let S=new Map;for(let e of s.subsets)S.set(P(e.sets),e);let C=new Map;for(let[e,t]of S){let n=[...new Set(t.sets)],r=n.map(e=>v.get(e)),i=new Set(r),o=r[0];for(let e of r)_[e].r<_[o].r&&(o=e);let s=b(e),c=t.label??(t.sets.length===1?t.sets[0]:void 0),l=+!!s.bold|(s.italic?2:0),d=O(_,r,x[o].filter(e=>!i.has(e)));d.margin<_[o].r*.2&&(d=O(_,r,[]));let p={sets:n,inside:r,spot:d,lines:[],style:s};if(c){let e=n.length===1?u:f;p.lines.push({id:void 0,raw:c,size:e,base:l,label:a(c,!1,h,e,4e3,l)})}C.set(e,p)}for(let e of s.textNodes){let t=e.label??e.id;C.get(P(e.sets))?.lines.push({id:e.id,raw:t,size:p,base:0,label:a(t,!1,h,p,4e3)})}let w=0;for(let e of _)e.r>w&&(w=e.r);let T=w>0?j/w:1,E=1;for(let e of C.values()){if(e.spot.margin<=0)continue;let t=0,n=0;for(let r of e.lines)t=Math.max(t,r.label.width),n+=r.label.height;let r=Math.hypot(t,n)/2+4;E=Math.max(E,Math.min(r/(e.spot.margin*T),M))}T*=E;for(let e of C.values()){let t=Math.max(e.spot.margin*T*1.8,72);for(let n of e.lines)n.label.width>t&&(n.label=a(n.raw,!1,h,n.size,t,n.base))}let D=1/0,F=1/0,I=-1/0,L=-1/0;for(let e of _)D=Math.min(D,(e.x-e.r)*T),F=Math.min(F,(e.y-e.r)*T),I=Math.max(I,(e.x+e.r)*T),L=Math.max(L,(e.y+e.r)*T);for(let e of C.values()){let t=0,n=0;for(let r of e.lines)t=Math.max(t,r.label.width),n+=r.label.height;D=Math.min(D,e.spot.x*T-t/2),I=Math.max(I,e.spot.x*T+t/2),F=Math.min(F,e.spot.y*T-n/2),L=Math.max(L,e.spot.y*T+n/2)}_.length===0&&(D=F=I=L=0);let R=a(s.title&&m(s.title),!1,h,u,4e3,1),z=R.height>0?R.height+12:0,B=Math.max(I-D,R.width),V=g+(B-(I-D))/2-D,H=g+z-F,U=Math.ceil(B+2*g),W=Math.ceil(L-F+z+2*g),G=_.map(e=>({id:e.id,x:e.x*T+V,y:e.y*T+H,r:e.r*T})),K=``;G.forEach((e,r)=>{let i=t(r),a=C.get(e.id)?.style??N;K+=`<circle class="pele-venn-set" data-id="${n(e.id)}" cx="${o(e.x)}" cy="${o(e.y)}" r="${o(e.r)}" fill="${i}" fill-opacity="0.2" stroke="${i}"${a.shape}/>`});let q=``,J=``;for(let e of C.values()){let t=n(e.sets.join(`|`));if(e.sets.length>1&&e.style.shape!==``){let n=A(e.inside.map(e=>G[e]),o);n!==``&&(q+=`<path class="pele-venn-overlap" data-id="${t}" d="${n}" fill="none"${e.style.shape}/>`)}let i=0;for(let t of e.lines)i+=t.label.height;if(i===0)continue;let a=e.spot.x*T+V,s=e.spot.y*T+H-i/2,c=``;for(let t of e.lines){let i=t.id===void 0?` class="pele-label"${t.size===u?``:` font-size="${t.size}"`}${e.style.text}`:` class="pele-venn-text" data-id="${n(t.id)}" font-size="${p}" fill="var(--_m)"${b(t.id).text}`;c+=r(t.label,a,s+t.label.height/2,i),s+=t.label.height}J+=`<g class="pele-venn-region" data-id="${t}">${c}</g>`}return{svg:e(`venn`,U,W,u,l,{},r(R,U/2,g+R.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g class="pele-venn-sets">${K}</g>`+(q?`<g class="pele-venn-overlaps">${q}</g>`:``)+(J?`<g class="pele-venn-labels">${J}</g>`:``)),width:U,height:W,links:[]}}var I={type:`venn`,parse(e,t,n){let r=new g;return n&&(r.title=n),S(e,r),r},render:F};export{I as venn};
@@ -0,0 +1 @@
1
+ import{dt as e}from"./Iqr2CudW.js";e();
@@ -1 +1 @@
1
- import{a as e,n as t}from"./CX-xckzu.js";import{d as n}from"./8wVGBFSs.js";var r=`about:blank`,i=/^([^\w]*)(javascript|data|vbscript)/im,a=/&#(\w+)(^\w|;)?/g,o=/&(newline|tab);/gi,s=/[\u0000-\u001F\u007F-\u009F -‍\uD800-\uDFFF\uFFFE\uFFFF]/gimu,c=/^.+(:|&colon;)/gim,l=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function u(e){try{return decodeURIComponent(e)}catch{return e}}function d(e){if(!e)return r;let t=u(e.trim()),n,d=0;do{if(++d>32)return r;t=t.replace(s,``).replace(a,(e,t)=>String.fromCharCode(t)).replace(o,``).replace(s,``).replace(l,``).trim(),t=u(t),n=t.match(s)||t.match(a)||t.match(o)||t.match(l)}while(n&&n.length>0);if(!t)return r;if(t[0]===`.`||t[0]===`/`)return t;let f=t.trimStart(),p=f.match(c);if(!p)return t;let m=p[0].toLowerCase().trim();if(i.test(m))return r;let h=f.replace(/\\/g,`/`);if(m===`mailto:`||m.includes(`://`))return h;if(m===`http:`||m===`https:`){let e;try{e=new URL(h)}catch{return r}return e.protocol=e.protocol.toLowerCase(),e.hostname=e.hostname.toLowerCase(),e.toString()}return h}function f(e){return d(n(e))}var p=[`http`,`https`,`mailto`,`tel`],m=[`http`,`https`],h=/^([a-z][a-z0-9+.-]*):/i,g=/^[\\/]{2}/;function _(e,t){if(g.test(e))return;let n=h.exec(e);return!n||t.includes(n[1].toLowerCase())?e:void 0}function v(e,t){return t.links===!1?void 0:_(e,t.linkSchemes??p)}function y(e,t){return t.images===!1?void 0:_(e,t.imageSchemes??m)}var b=new RegExp(t.source,`gu`);function x(e,t){let n=d(e);return n===r||v(n,t)===void 0?!1:v(e.replace(b,``).replace(/[\t\n\r]/g,``).replace(/^[\x00-\x20]+/,``),t)!==void 0}function S(t,n,r,i,a,o=``){let s=v(n,a);return s===void 0?t:(i.push({id:r,href:s,internal:!1}),`<a href="${e(s)}"${o}${C(a)}>${t}</a>`)}function C(t){let n=t.linkRel??`noopener`;return n?` rel="${e(n)}"`:``}export{x as a,f as i,y as n,d as o,C as r,v as s,S as t};
1
+ import{a as e,n as t}from"./DfCZPwp1.js";import{d as n}from"./-2Meesge.js";var r=`about:blank`,i=/^([^\w]*)(javascript|data|vbscript)/im,a=/&#(\w+)(^\w|;)?/g,o=/&(newline|tab);/gi,s=/[\u0000-\u001F\u007F-\u009F -‍\uD800-\uDFFF\uFFFE\uFFFF]/gimu,c=/^.+(:|&colon;)/gim,l=/(\\|%5[cC])((%(6[eE]|72|74))|[nrt])/g;function u(e){try{return decodeURIComponent(e)}catch{return e}}function d(e){if(!e)return r;let t=u(e.trim()),n,d=0;do{if(++d>32)return r;t=t.replace(s,``).replace(a,(e,t)=>String.fromCharCode(t)).replace(o,``).replace(s,``).replace(l,``).trim(),t=u(t),n=t.match(s)||t.match(a)||t.match(o)||t.match(l)}while(n&&n.length>0);if(!t)return r;if(t[0]===`.`||t[0]===`/`)return t;let f=t.trimStart(),p=f.match(c);if(!p)return t;let m=p[0].toLowerCase().trim();if(i.test(m))return r;let h=f.replace(/\\/g,`/`);if(m===`mailto:`||m.includes(`://`))return h;if(m===`http:`||m===`https:`){let e;try{e=new URL(h)}catch{return r}return e.protocol=e.protocol.toLowerCase(),e.hostname=e.hostname.toLowerCase(),e.toString()}return h}function f(e){return d(n(e))}var p=[`http`,`https`,`mailto`,`tel`],m=[`http`,`https`],h=/^([a-z][a-z0-9+.-]*):/i,g=/^[\\/]{2}/;function _(e,t){if(g.test(e))return;let n=h.exec(e);return!n||t.includes(n[1].toLowerCase())?e:void 0}function v(e,t){return t.links===!1?void 0:_(e,t.linkSchemes??p)}function y(e,t){return t.images===!1?void 0:_(e,t.imageSchemes??m)}var b=new RegExp(t.source,`gu`);function x(e,t){let n=d(e);return n===r||v(n,t)===void 0?!1:v(e.replace(b,``).replace(/[\t\n\r]/g,``).replace(/^[\x00-\x20]+/,``),t)!==void 0}function S(t,n,r,i,a,o=``){let s=v(n,a);return s===void 0?t:(i.push({id:r,href:s,internal:!1}),`<a href="${e(s)}"${o}${C(a)}>${t}</a>`)}function C(t){let n=t.linkRel??`noopener`;return n?` rel="${e(n)}"`:``}export{x as a,f as i,y as n,d as o,C as r,v as s,S as t};
@@ -1,2 +1,2 @@
1
- import{_ as e,a as t,f as n,i as r,o as i,s as a,u as o,x as s}from"./CX-xckzu.js";import{n as c,r as l}from"./DciMwFJ1.js";import{PeleError as u,c as d,d as f,g as p,i as m,s as h,u as g}from"./8wVGBFSs.js";var _=class{type=`sankey`;nodes=[];links=[];title;accTitle;accDescr;lookup=new Map;findOrCreateNode(e){let t=this.lookup.get(e);return t===void 0&&(t={id:e,index:this.nodes.length},this.lookup.set(e,t),this.nodes.push(t)),t}addLink(e,t,n){this.links.push({source:e,target:t,value:n})}},v=[`$end`,`STUCK`,`SANKEY`,`NEWLINE`,`COMMA`,`DQUOTE`,`NON_ESCAPED_TEXT`,`ESCAPED_TEXT`,`EOF`];function y(e){return e>=32&&e<=126&&e!==34&&e!==44||e>=160&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function b(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},l=t=>e.slice(s,s+t.length).toLowerCase()===t&&!p(e.charCodeAt(s+t.length));for(;s<t;){let u=e.charCodeAt(s),d=s,f=s;if(o===2){if(u===34&&e.charCodeAt(s+1)!==34){a.length>0&&(o=a.pop()),c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(y(t)||t===44||t===13||t===10)f+=t>65535?2:1;else if(t===34&&e.charCodeAt(f+1)===34)f+=2;else break}c(7,s,f)}else{if(o===0&&(u|32)==115){let e=l(`sankey-beta`)?11:l(`sankey`)?6:0;if(e>0){a.push(o),o=1,c(2,s,s+e);continue}}if(u===10||u===13&&e.charCodeAt(s+1)===10){c(3,s,u===10?s+1:s+2);continue}if(u===44){c(4,s,s+1);continue}if(u===34){a.push(o),o=2,c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(!y(t))break;f+=t>65535?2:1}c(6,s,f)}if(f===d)return c(1,s,s),{types:n,texts:r,starts:i}}return c(o===2?7:8,t,t),c(0,t,t),{types:n,texts:r,starts:i}}var x=/[\n\r]+/g,S=/[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]/u;function C(e){return e===10||e===13?!1:e<128?e===32||e===9||e===11||e===12:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function w(e,t){let n=0,r=e.length;for(;n<r&&C(e.charCodeAt(n));)n++;for(;r>n&&C(e.charCodeAt(r-1));)r--;let i=e.slice(n,r),a=i.replace(x,`
1
+ import{_ as e,a as t,f as n,i as r,o as i,s as a,u as o,x as s}from"./DfCZPwp1.js";import{n as c,r as l}from"./DciMwFJ1.js";import{PeleError as u,c as d,d as f,g as p,i as m,s as h,u as g}from"./-2Meesge.js";var _=class{type=`sankey`;nodes=[];links=[];title;accTitle;accDescr;lookup=new Map;findOrCreateNode(e){let t=this.lookup.get(e);return t===void 0&&(t={id:e,index:this.nodes.length},this.lookup.set(e,t),this.nodes.push(t)),t}addLink(e,t,n){this.links.push({source:e,target:t,value:n})}},v=[`$end`,`STUCK`,`SANKEY`,`NEWLINE`,`COMMA`,`DQUOTE`,`NON_ESCAPED_TEXT`,`ESCAPED_TEXT`,`EOF`];function y(e){return e>=32&&e<=126&&e!==34&&e!==44||e>=160&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}function b(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=(t,a,o)=>{n.push(t),r.push(e.slice(a,o)),i.push(a),s=o},l=t=>e.slice(s,s+t.length).toLowerCase()===t&&!p(e.charCodeAt(s+t.length));for(;s<t;){let u=e.charCodeAt(s),d=s,f=s;if(o===2){if(u===34&&e.charCodeAt(s+1)!==34){a.length>0&&(o=a.pop()),c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(y(t)||t===44||t===13||t===10)f+=t>65535?2:1;else if(t===34&&e.charCodeAt(f+1)===34)f+=2;else break}c(7,s,f)}else{if(o===0&&(u|32)==115){let e=l(`sankey-beta`)?11:l(`sankey`)?6:0;if(e>0){a.push(o),o=1,c(2,s,s+e);continue}}if(u===10||u===13&&e.charCodeAt(s+1)===10){c(3,s,u===10?s+1:s+2);continue}if(u===44){c(4,s,s+1);continue}if(u===34){a.push(o),o=2,c(5,s,s+1);continue}for(;f<t;){let t=e.codePointAt(f);if(!y(t))break;f+=t>65535?2:1}c(6,s,f)}if(f===d)return c(1,s,s),{types:n,texts:r,starts:i}}return c(o===2?7:8,t,t),c(0,t,t),{types:n,texts:r,starts:i}}var x=/[\n\r]+/g,S=/[\x00-\x08\x0b\x0c\x0e-\x1f\ud800-\udfff\ufffe\uffff]/u;function C(e){return e===10||e===13?!1:e<128?e===32||e===9||e===11||e===12:e===160||e===5760||e>=8192&&e<=8202||e===8232||e===8233||e===8239||e===8287||e===12288||e===65279}function w(e,t){let n=0,r=e.length;for(;n<r&&C(e.charCodeAt(n));)n++;for(;r>n&&C(e.charCodeAt(r-1));)r--;let i=e.slice(n,r),a=i.replace(x,`
2
2
  `),o=a.trim();if(t!==void 0){let s=a.length-a.trimStart().length;t.push([[0,n,0],[r,e.length,0]],d(i,x,1),[[0,s,0],[s+o.length,a.length,0]])}return o}function T(e,t,n=e){let{types:r,texts:i,starts:a}=b(e),o=0,s=(t,r)=>{let i=[];n!==e&&w(n,i);let a=t>0&&t>=e.length?m(i,e.length-1)+1:m(i,t);return h(`sankey`,n,a,r)},c=e=>{let t=r[o],n=t===1?v[r[o-1]]:v[t];throw s(a[o],`Expecting ${e}, got '${n}'`)},l=(e,t=``)=>{r[o]!==e&&c(`'${v[e]}'${t}`),o++},u=()=>{if(r[o]===6)return i[o++];r[o]!==5&&c(`'DQUOTE', 'NON_ESCAPED_TEXT'`),o++,r[o]!==7&&c(`'ESCAPED_TEXT'`);let e=i[o++];return l(5),e},d=()=>{let e=a[o],t=u().trim().replaceAll(`""`,`"`);if(S.test(f(t)))throw s(e,`Invalid XML character in node name`);return t};for(l(2),l(3);;){let e=d();l(4,`, 'NEWLINE', 'EOF'`);let n=d();l(4,`, 'NEWLINE', 'EOF'`);let i=a[o],c=parseFloat(u());if(!Number.isFinite(c))throw s(i,`Expecting a number`);let f=t.findOrCreateNode(e),p=t.findOrCreateNode(n);if(t.addLink(f,p,c),r[o]!==3)break;o++}r[o]===8&&o++,r[o]!==0&&c(`'NEWLINE', 'EOF'`)}var ee=6;function E(e,t){if(e.length>8)e.sort(t);else for(let n=1;n<e.length;n++){let r=e[n],i=n-1;for(;i>=0&&t(e[i],r)>0;)e[i+1]=e[i],i--;e[i+1]=r}}function D(e,t){let n=e.nodes.length,r=e.links.map(e=>({source:e.source.index,target:e.target.index,value:Number.isFinite(e.value)&&e.value>0?e.value:0,thickness:0,sourceY:0,targetY:0})),i=[],a=[];for(let e=0;e<n;e++)i.push([]),a.push([]);r.forEach((e,t)=>{i[e.source].push(t),a[e.target].push(t)});let o=new Int32Array(n),s=new Int32Array(n),c=[];for(let e=0;e<n;e++)s[e]=a[e].length,s[e]===0&&c.push(e);for(let e=0;e<c.length;e++){let t=c[e];for(let e of i[t]){let n=r[e].target;o[n]<o[t]+1&&(o[n]=o[t]+1),--s[n]===0&&c.push(n)}}if(c.length<n){let t=0;for(;s[t]===0;)t++;let i=new Uint8Array(n);for(;i[t]===0;){i[t]=1;for(let e of a[t])if(s[r[e].source]>0){t=r[e].source;break}}throw new u(`Sankey diagrams cannot have circular links, and "${e.nodes[t].id}" is part of one.`,`semantic`,{type:`sankey`})}let l=1;for(let e=0;e<n;e++)o[e]+1>l&&(l=o[e]+1);let d=new Int32Array(n);for(let e=n-1;e>=0;e--){let t=c[e];for(let e of i[t])d[t]<d[r[e].target]+1&&(d[t]=d[r[e].target]+1)}let f=0;for(let e of r)e.value>f&&(f=e.value);let p=f>0?1/f:0,m=[],h=new Float64Array(n),g=[];for(let e=0;e<l;e++)g.push([]);let _=l>1?(t.width-t.nodeWidth)/(l-1):0;for(let e=0;e<n;e++){let n;if(t.alignment===`left`)n=o[e];else if(t.alignment===`right`)n=l-1-d[e];else if(t.alignment===`center`){if(n=o[e],a[e].length===0&&i[e].length>0){n=l;for(let t of i[e])o[r[t].target]-1<n&&(n=o[r[t].target]-1)}}else n=i[e].length>0?o[e]:l-1;let s=0,c=0,u=0,f=0;for(let t of a[e])s+=r[t].value*p,u+=r[t].value;for(let t of i[e])c+=r[t].value*p,f+=r[t].value;h[e]=Math.max(s,c),m.push({layer:n,value:Math.max(u,f),x:n*_,y:0,height:0}),g[n].push(e)}let v=1;for(let e of g)e.length>v&&(v=e.length);let y=v>1?Math.min(t.nodePadding,t.height/(v-1)):t.nodePadding,b=1/0;for(let e of g){let n=0;for(let t of e)n+=h[t];n>0&&(b=Math.min(b,(t.height-(e.length-1)*y)/n))}(!Number.isFinite(b)||b<0)&&(b=0);let x=Math.max(0,t.labelHeight-y),S=e=>{for(let n of g){let r=(n.length-1)*y;for(let t of n)r+=Math.max(h[t]*e,x);if(r>t.height+1e-6)return!1}return!0};if(x>0&&!S(b)){if(S(0)){let e=0;for(let t=0;t<40;t++){let t=(e+b)/2;S(t)?e=t:b=t}b=e}else x=0}let C=new Float64Array(n);for(let e of r)e.thickness=e.value*p*b;for(let e of g){let n=0;for(let t of e)m[t].height=h[t]*b,C[t]=Math.max(0,x-m[t].height)/2,m[t].y=n+C[t],n+=m[t].height+2*C[t]+y;let r=(t.height-n+y)/(e.length+1);e.forEach((e,t)=>m[e].y+=r*(t+1))}let w=e=>m[e].y+m[e].height/2,T=new Float64Array(r.length),D=new Float64Array(r.length),O=(e,t)=>w(r[e].target)-w(r[t].target)||e-t,k=(e,t)=>w(r[e].source)-w(r[t].source)||e-t,te=(e,t)=>w(e)-w(t)||e-t,A=e=>{let t=0;E(i[e],O);for(let n of i[e])T[n]=t+r[n].thickness/2,t+=r[n].thickness},j=e=>{let t=0;E(a[e],k);for(let n of a[e])D[n]=t+r[n].thickness/2,t+=r[n].thickness},M=()=>{for(let e=0;e<n;e++)A(e),j(e)},N=(e,n,o)=>{for(let t of e){let e=o?a[t]:i[t];if(e.length===0)continue;o?j(t):A(t);let s=0,c=0,l=0;for(let n of e){let e=o?m[r[n].source].y+T[n]-D[n]:m[r[n].target].y+D[n]-T[n];s+=e*r[n].thickness,c+=r[n].thickness,l+=w(o?r[n].source:r[n].target)-m[t].height/2}let u=c>0?s/c:l/e.length;m[t].y+=(u-m[t].y)*n}E(e,te);let s=0;for(let t of e)m[t].y-C[t]<s&&(m[t].y=s+C[t]),s=m[t].y+m[t].height+C[t]+y;s=t.height;for(let t=e.length-1;t>=0;t--){let n=e[t];m[n].y+m[n].height+C[n]>s&&(m[n].y=s-m[n].height-C[n]),s=m[n].y-C[n]-y}};M();for(let e=0;e<ee;e++){let t=.99**e;for(let e=l-2;e>=0;e--)N(g[e],t,!1);M();for(let e=1;e<l;e++)N(g[e],t,!0);M()}for(let e=0;e<r.length;e++)r[e].sourceY=m[r[e].source].y+T[e],r[e].targetY=m[r[e].target].y+D[e];return{nodes:m,links:r}}var O=6,k=15,te=1.8,A=300;function j(e){let t=2166136261,n=5381;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);t=Math.imul(t^i,16777619),n=Math.imul(n,33)+i|0}return(t>>>0).toString(36)+(n>>>0).toString(36)}function M(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function N(e,t,n,r,i){let a=e[t];return typeof a==`number`&&a>=r?Math.min(a,i):n}function ne(e,t){let n=e[t];return typeof n==`string`||typeof n==`number`&&Number.isFinite(n)?String(n):``}function re(e){return Math.abs(e)<0x38d7ea4c68000?Math.round(e*100)/100:e}function ie(e){return typeof e==`string`?a([`fill:${e}`]).shape:``}function P(e,t,n){let r=M(t.sankey)?t.sankey:{},i=N(r,`width`,600,1,1e4);return c(n,i,160,t=>F(e,r,n,t,i))}function F(a,c,u,d,p){let m=u.fontSize??16,h=Math.round(m*.625),_=Math.max(h,Math.round(m*.875*Math.min(1,d/p))),v=u.measurer??g(u.fontFamily,u.fontFamilyMono),y=u.padding??8,b=N(c,`height`,400,1,1e4),x=Math.min(N(c,`nodeWidth`,10,1,200),d),S=c.showValues!==!1,C=f(ne(c,`prefix`)),w=f(ne(c,`suffix`)),T=c.labelStyle===`outlined`,ee=c.nodeAlignment===`left`||c.nodeAlignment===`right`||c.nodeAlignment===`center`?c.nodeAlignment:`justify`,E=typeof c.linkColor==`string`?c.linkColor:`gradient`,P=e=>D(a,{width:d,height:b,nodeWidth:x,nodePadding:N(c,`nodePadding`,12,0,200)+(S?k:0),labelHeight:e*1.15,alignment:ee}),F=P(_),I=new Map,L=1;for(let e of F.nodes){let t=(I.get(e.layer)??0)+1;I.set(e.layer,t),t>L&&(L=t)}let R=Math.max(h,Math.round(b/L/te));R<_&&(_=R,F=P(_));let{nodes:z,links:ae}=F,B=_*1.5,V=new Map;if(M(c.nodeColors))for(let[e,t]of Object.entries(c.nodeColors)){let n=ie(t);n&&V.set(e,n)}let H=e=>V.get(a.nodes[e].id)??``,U=e=>/^ style="fill:(.*);"$/.exec(H(e))?.[1]??n(e),W=0,G=0;z.forEach(e=>{e.value>G&&(G=e.value,W=e.layer)});let K=0,q=d,J=0,Y=b,oe=z.map((e,t)=>{let n=f(a.nodes[t].id),r=S?`${C}${re(e.value)}${w}`:``,i=v.width(r?`${n} ${r}`:n,_,0),o=T?e.layer>=W:e.x<d/2,s=o?e.x+x+O:e.x-O,c=e.y+e.height/2;return K=Math.min(K,o?s:s-i),q=Math.max(q,o?s+i:s),J=Math.min(J,c-_*.75),Y=Math.max(Y,c+_*.75),{value:r,width:i,after:o,left:o?s:s-i,y:c}}),X=new Map;if(z.length<=A)for(let e of oe){let t=Math.floor(e.y/B);for(let n of[t-2,t-1,t,t+1,t+2]){let t=X.get(n);t?t.push(e):X.set(n,[e])}}let se=``,ce=``;z.forEach((e,i)=>{let o=a.nodes[i].id,c=f(o),l=Math.max(e.height,1);ce+=`<rect class="pele-sankey-node" data-id="${r(o)}" x="${s(e.x)}" y="${s(e.y)}" width="${s(x)}" height="${s(l)}" rx="${s(Math.min(2,l/2))}" fill="${n(i)}"${H(i)}/>`;let u=oe[i],d=(e,t)=>(X.get(Math.floor(t/B))??[]).some(n=>n!==u&&Math.abs(n.y-t)<B&&e<n.left+n.width+O&&e+u.width>n.left-O);if(z.length<=A&&d(u.left,u.y))e:for(let t of[0,-B,B])for(let n of[u.after,!u.after]){let r=n?e.x+x+O:e.x-O-u.width,a=u.y+t;if(d(r,a)||r<K||r+u.width>q||a-_*.75<J||a+_*.75>Y||z.some((e,t)=>t!==i&&r<e.x+x+O&&r+u.width>e.x-O&&a-_*.75<e.y+e.height&&a+_*.75>e.y))continue;let o=Math.max(0,e.y-a,a-e.y-e.height);if(!z.some((t,n)=>n!==i&&t.x===e.x&&Math.max(0,t.y-a,a-t.y-t.height)<=o)){u.left=r,u.y=a,u.after=n;break e}}let{value:p,after:m,y:h}=u,g=m?e.x+x+O:e.x-O,v=` x="${s(g)}" y="${s(h+_*.35)}" text-anchor="${m?`start`:`end`}"`,y=t(c)+(p?` <tspan class="pele-sankey-value" fill="var(--_m)">${t(p)}</tspan>`:``);se+=`<g class="pele-label" data-id="${r(o)}">`+(T?`<text${v} fill="none" stroke="var(--_bg)" stroke-width="3" stroke-linejoin="round">${t(c)}${p?` `+t(p):``}</text>`:``)+`<text${v}>${y}</text></g>`});let le=E===`gradient`||E===`source`||E===`target`?``:ie(E),ue=u.idPrefix??``,de=E===`gradient`&&/^[\w-]+$/.test(ue),Z=new Map,fe=``;for(let e of ae){let i=E===`target`?e.target:e.source,o=Math.max(e.thickness,1)/2,c=z[e.source].x+x,l=z[e.target].x,u=`fill="${n(i)}"${le||H(i)}`;if(de){let t=`x1="${s(c)}" x2="${s(l)}"><stop offset="0" stop-color="${U(e.source)}"/><stop offset="1" stop-color="${U(e.target)}"/>`,n=`${ue}-sankey-${j(t)}`;Z.set(n,`<linearGradient id="${n}" gradientUnits="userSpaceOnUse" ${t}</linearGradient>`),u=`fill="url(#${n}) ${U(e.source)}"`}let d=s((c+l)/2),f=r(a.nodes[e.source].id),p=r(a.nodes[e.target].id);fe+=`<path class="pele-sankey-link" data-id="${f}-&gt;${p}" d="M${s(c)},${s(e.sourceY-o)}C${d},${s(e.sourceY-o)} ${d},${s(e.targetY-o)} ${s(l)},${s(e.targetY-o)}L${s(l)},${s(e.targetY+o)}C${d},${s(e.targetY+o)} ${d},${s(e.sourceY+o)} ${s(c)},${s(e.sourceY+o)}Z" ${u}><title>${f} → ${p}: ${t(C)}${re(e.value)}${t(w)}</title></path>`}let Q=o(a.title,!1,v,m,l(u),1),pe=Q.height>0?Q.height+12:0,me=Math.max(q-K,Q.width),he=y-K+(me-(q-K))/2,ge=y+pe-J,$=Math.ceil(me+2*y),_e=Math.ceil(Y-J+pe+2*y);return{svg:e(`sankey`,$,_e,m,u,a,i(Q,$/2,y+Q.height/2,` class="pele-title" font-weight="var(--_tw)"`)+`<g transform="translate(${s(he)},${s(ge)})">`+(Z.size>0?`<defs>${[...Z.values()].join(``)}</defs>`:``)+`<g class="pele-sankey-links" fill-opacity="0.4">${fe}</g><g class="pele-sankey-nodes">${ce}</g><g class="pele-labels" font-size="${_}">${se}</g></g>`),width:$,height:_e,links:[]}}var I={type:`sankey`,parse(e,t,n){let r=new _;return n&&(r.title=n),T(w(e),r,e),r},render:P};export{I as sankey};
@@ -1,4 +1,4 @@
1
- import{_ as e,a as t,b as n,d as r,i,o as a,r as o,s,u as c,v as l,x as u}from"./CX-xckzu.js";import{a as d,o as f,t as p}from"./DciMwFJ1.js";import{a as m,i as h,l as g,s as _}from"./DECNRCf2.js";import{n as v}from"./CoyQYage.js";import{n as y}from"./DKNOMI4Y.js";import{o as b,t as ee}from"./BN6xhG8e.js";import{t as x}from"./BZmnMkFw.js";import{t as S}from"./D6QVYUu9.js";import{i as te,n as ne,r as re,t as ie}from"./B9YLdnR_.js";import{i as ae,n as oe,r as se,t as C}from"./vk5Wkr31.js";import{_ as w,d as T,g as E,h as D,s as O,u as ce}from"./8wVGBFSs.js";function k(e){return e===`#`||e===`+`||e===`~`||e===`-`}var A=class{id=``;memberType;visibility=``;classifier=``;parameters=``;returnType=``;constructor(e,t){this.memberType=t,(t!==`method`||!this.parseMethod(e))&&this.parseAttribute(e),this.id=this.id.startsWith(` `)?` `+this.id.trim():this.id.trim()}parseMethod(e){let t=e.length;for(let n=0;n<t;){let r=n;for(;r<t&&!w(e.charCodeAt(r));)r++;let i=r-1;for(;i>n&&e.charCodeAt(i)!==41;)i--;let a=i-1;for(;a>n&&e.charCodeAt(a)!==40;)a--;if(a>n){let r=e[n],o=k(r)&&a>n+1;o&&(this.visibility=r),this.id=e.slice(o?n+1:n,a),this.parameters=e.slice(a+1,i).trim();let s=i+1,c=``;if(s<t){let t=e[s];(t===`$`||t===`*`||t.trim()===``)&&(c=t.trim(),s++)}let l=s;for(;l<t&&!w(e.charCodeAt(l));)l++;if(this.returnType=e.slice(s,l).trim(),c===``){let e=this.returnType.slice(-1);(e===`$`||e===`*`)&&(c=e,this.returnType=this.returnType.slice(0,-1))}return this.classifier=c,!0}n=r+1}return this.memberType=`attribute`,!1}parseAttribute(e){let t=e.slice(0,1),n=e.slice(-1);k(t)&&(this.visibility=t),(n===`$`||n===`*`)&&(this.classifier=n),this.id=e.substring(this.visibility===``?0:1,this.classifier===``?e.length:e.length-1)}getDisplayDetails(){let e=this.visibility+x(this.id);return this.memberType===`method`&&(e+=`(${x(this.parameters.trim())})`,this.returnType&&(e+=` : `+x(this.returnType))),{displayText:e.trim(),cssStyle:this.parseClassifier()}}parseClassifier(){return this.classifier===`*`?`font-style:italic;`:this.classifier===`$`?`text-decoration:underline;`:``}},j={LINE:0,DOTTED_LINE:1},M={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},N=`classId-`;function P(e){let t=e.indexOf(`~`);if(t<=0)return{className:e,type:``};let n=e.indexOf(`~`,t+1);return{className:e.slice(0,t),type:e.slice(t+1,n===-1?e.length:n)}}function le(e){let t=e.charCodeAt(0);return P(t>=48&&t<=57?N+e:e).className}var F=class{type=`class`;lineType=j;relationType=M;direction=`TB`;classes=new Map;relations=[];notes=new Map;namespaces=new Map;interfaces=[];styleClasses=new Map;title;accTitle;accDescr;namespaceStack=[];withCssClass=new Map;addClass(e){let{className:t,type:n}=P(e);if(this.classes.has(t))return;let r={id:t,type:n,label:t,cssClasses:`default`,methods:[],members:[],annotations:[],styles:[]};this.classes.set(t,r),this.tag(r,`default`)}tag(e,t){let n=this.withCssClass.get(t);n?n.add(e):this.withCssClass.set(t,new Set([e]))}ensure(e){return this.addClass(e),this.classes.get(P(e).className)}setClassLabel(e,t){this.ensure(e).label=t}addRelation(e){let{type1:t,type2:n}=e.relation;t===M.LOLLIPOP&&n===`none`?(this.addClass(e.id2),e.id1=this.addInterface(e.id1,e.id2)):n===M.LOLLIPOP&&t===`none`?(this.addClass(e.id1),e.id2=this.addInterface(e.id2,e.id1)):(this.addClass(e.id1),this.addClass(e.id2)),e.id1=P(e.id1).className,e.id2=P(e.id2).className,e.relationTitle1=e.relationTitle1.trim(),e.relationTitle2=e.relationTitle2.trim(),this.relations.push(e)}addInterface(e,t){let n=`interface${this.interfaces.length}`;return this.interfaces.push({id:n,label:e,classId:t}),n}addAnnotation(e,t){this.ensure(e).annotations.push(t)}addMember(e,t){let n=this.ensure(e);if(typeof t!=`string`)return;let r=t.trim();if(r.startsWith(`<<`)&&r.endsWith(`>>`))n.annotations.push(r.substring(2,r.length-2));else if(r.indexOf(`)`)>0){let e=new A(r,`method`);(e.memberType===`method`?n.methods:n.members).push(e)}else r&&n.members.push(new A(r,`attribute`))}addMembers(e,t){if(Array.isArray(t)){t.reverse();for(let n of t)this.addMember(e,n)}}addNote(e,t){let n=this.notes.size,r=`note${n}`;return this.notes.set(r,{id:r,class:t,text:e,index:n}),r}cleanupLabel(e){return(e.startsWith(`:`)?e.substring(1):e).trim()}setCssClass(e,t){for(let n of e.split(`,`)){let e=this.classes.get(le(n));if(e!==void 0){e.cssClasses+=` `+t;for(let n of t.split(` `))this.tag(e,n)}}}defineClass(e,t){for(let n of e){let e=this.styleClasses.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,e)),!t)continue;for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=this.withCssClass.get(n);if(r===void 0)continue;let i=t.flatMap(e=>e.split(`,`));for(let e of r)for(let t of i)e.styles.push(t)}}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`)){let e=this.classes.get(P(n).className);e&&(e.tooltip=t)}}setLink(e,t,n){let r=T(t).trim();for(let t of e.split(`,`)){let e=this.classes.get(le(t));e&&(e.link=r?b(r):void 0,e.linkTarget=typeof n==`string`?n:`_blank`)}this.setCssClass(e,`clickable`)}setClickEvent(e,t,n){for(let t of e.split(`,`)){let e=this.classes.get(P(t).className);e&&(e.haveCallback=!0)}this.setCssClass(e,`clickable`)}setDirection(e){this.direction=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
1
+ import{_ as e,a as t,b as n,d as r,i,o as a,r as o,s,u as c,v as l,x as u}from"./DfCZPwp1.js";import{a as d,o as f,t as p}from"./DciMwFJ1.js";import{a as m,i as h,l as g,s as _}from"./BLmF1B2i.js";import{n as v}from"./RFxekmX-.js";import{n as y}from"./Dh1lBxfx.js";import{o as b,t as ee}from"./Bt7VOT5H.js";import{t as x}from"./BZmnMkFw.js";import{t as S}from"./D6QVYUu9.js";import{i as te,n as ne,r as re,t as ie}from"./tUSDgbpy.js";import{i as ae,n as oe,r as se,t as C}from"./RlApGeew.js";import{_ as w,d as T,g as E,h as D,s as O,u as ce}from"./-2Meesge.js";function k(e){return e===`#`||e===`+`||e===`~`||e===`-`}var A=class{id=``;memberType;visibility=``;classifier=``;parameters=``;returnType=``;constructor(e,t){this.memberType=t,(t!==`method`||!this.parseMethod(e))&&this.parseAttribute(e),this.id=this.id.startsWith(` `)?` `+this.id.trim():this.id.trim()}parseMethod(e){let t=e.length;for(let n=0;n<t;){let r=n;for(;r<t&&!w(e.charCodeAt(r));)r++;let i=r-1;for(;i>n&&e.charCodeAt(i)!==41;)i--;let a=i-1;for(;a>n&&e.charCodeAt(a)!==40;)a--;if(a>n){let r=e[n],o=k(r)&&a>n+1;o&&(this.visibility=r),this.id=e.slice(o?n+1:n,a),this.parameters=e.slice(a+1,i).trim();let s=i+1,c=``;if(s<t){let t=e[s];(t===`$`||t===`*`||t.trim()===``)&&(c=t.trim(),s++)}let l=s;for(;l<t&&!w(e.charCodeAt(l));)l++;if(this.returnType=e.slice(s,l).trim(),c===``){let e=this.returnType.slice(-1);(e===`$`||e===`*`)&&(c=e,this.returnType=this.returnType.slice(0,-1))}return this.classifier=c,!0}n=r+1}return this.memberType=`attribute`,!1}parseAttribute(e){let t=e.slice(0,1),n=e.slice(-1);k(t)&&(this.visibility=t),(n===`$`||n===`*`)&&(this.classifier=n),this.id=e.substring(this.visibility===``?0:1,this.classifier===``?e.length:e.length-1)}getDisplayDetails(){let e=this.visibility+x(this.id);return this.memberType===`method`&&(e+=`(${x(this.parameters.trim())})`,this.returnType&&(e+=` : `+x(this.returnType))),{displayText:e.trim(),cssStyle:this.parseClassifier()}}parseClassifier(){return this.classifier===`*`?`font-style:italic;`:this.classifier===`$`?`text-decoration:underline;`:``}},j={LINE:0,DOTTED_LINE:1},M={AGGREGATION:0,EXTENSION:1,COMPOSITION:2,DEPENDENCY:3,LOLLIPOP:4},N=`classId-`;function P(e){let t=e.indexOf(`~`);if(t<=0)return{className:e,type:``};let n=e.indexOf(`~`,t+1);return{className:e.slice(0,t),type:e.slice(t+1,n===-1?e.length:n)}}function le(e){let t=e.charCodeAt(0);return P(t>=48&&t<=57?N+e:e).className}var F=class{type=`class`;lineType=j;relationType=M;direction=`TB`;classes=new Map;relations=[];notes=new Map;namespaces=new Map;interfaces=[];styleClasses=new Map;title;accTitle;accDescr;namespaceStack=[];withCssClass=new Map;addClass(e){let{className:t,type:n}=P(e);if(this.classes.has(t))return;let r={id:t,type:n,label:t,cssClasses:`default`,methods:[],members:[],annotations:[],styles:[]};this.classes.set(t,r),this.tag(r,`default`)}tag(e,t){let n=this.withCssClass.get(t);n?n.add(e):this.withCssClass.set(t,new Set([e]))}ensure(e){return this.addClass(e),this.classes.get(P(e).className)}setClassLabel(e,t){this.ensure(e).label=t}addRelation(e){let{type1:t,type2:n}=e.relation;t===M.LOLLIPOP&&n===`none`?(this.addClass(e.id2),e.id1=this.addInterface(e.id1,e.id2)):n===M.LOLLIPOP&&t===`none`?(this.addClass(e.id1),e.id2=this.addInterface(e.id2,e.id1)):(this.addClass(e.id1),this.addClass(e.id2)),e.id1=P(e.id1).className,e.id2=P(e.id2).className,e.relationTitle1=e.relationTitle1.trim(),e.relationTitle2=e.relationTitle2.trim(),this.relations.push(e)}addInterface(e,t){let n=`interface${this.interfaces.length}`;return this.interfaces.push({id:n,label:e,classId:t}),n}addAnnotation(e,t){this.ensure(e).annotations.push(t)}addMember(e,t){let n=this.ensure(e);if(typeof t!=`string`)return;let r=t.trim();if(r.startsWith(`<<`)&&r.endsWith(`>>`))n.annotations.push(r.substring(2,r.length-2));else if(r.indexOf(`)`)>0){let e=new A(r,`method`);(e.memberType===`method`?n.methods:n.members).push(e)}else r&&n.members.push(new A(r,`attribute`))}addMembers(e,t){if(Array.isArray(t)){t.reverse();for(let n of t)this.addMember(e,n)}}addNote(e,t){let n=this.notes.size,r=`note${n}`;return this.notes.set(r,{id:r,class:t,text:e,index:n}),r}cleanupLabel(e){return(e.startsWith(`:`)?e.substring(1):e).trim()}setCssClass(e,t){for(let n of e.split(`,`)){let e=this.classes.get(le(n));if(e!==void 0){e.cssClasses+=` `+t;for(let n of t.split(` `))this.tag(e,n)}}}defineClass(e,t){for(let n of e){let e=this.styleClasses.get(n);if(e===void 0&&(e={id:n,styles:[],textStyles:[]},this.styleClasses.set(n,e)),!t)continue;for(let n of t)n.includes(`color`)&&e.textStyles.push(n.replace(`fill`,`bgFill`)),e.styles.push(n);let r=this.withCssClass.get(n);if(r===void 0)continue;let i=t.flatMap(e=>e.split(`,`));for(let e of r)for(let t of i)e.styles.push(t)}}setTooltip(e,t){if(t!==void 0)for(let n of e.split(`,`)){let e=this.classes.get(P(n).className);e&&(e.tooltip=t)}}setLink(e,t,n){let r=T(t).trim();for(let t of e.split(`,`)){let e=this.classes.get(le(t));e&&(e.link=r?b(r):void 0,e.linkTarget=typeof n==`string`?n:`_blank`)}this.setCssClass(e,`clickable`)}setClickEvent(e,t,n){for(let t of e.split(`,`)){let e=this.classes.get(P(t).className);e&&(e.haveCallback=!0)}this.setCssClass(e,`clickable`)}setDirection(e){this.direction=e}setAccTitle(e){this.accTitle=e.replace(/^\s+/g,``)}setAccDescription(e){this.accDescr=e.replace(/\n\s+/g,`
2
2
  `)}addNamespace(e,t){let n=this.namespaceStack[this.namespaceStack.length-1],r=n?`${n}.${e}`:e;this.namespaceStack.push(r);let i=this.namespaces.get(r);if(i)return i.explicit=!0,t&&(i.label=t),r;let a=n||void 0,o=n?n.length+1:0;for(;;){let e=r.indexOf(`.`,o),n=e===-1,i=n?r:r.slice(0,e),s=this.namespaces.get(i);if(s===void 0){let c=r.slice(o,n?r.length:e);s={id:i,label:n&&t?t:c,classes:new Map,notes:new Map,children:new Map,parent:a,explicit:n},this.namespaces.set(i,s)}else n&&(s.explicit=!0);let c=a?this.namespaces.get(a):void 0;if(c&&(c.children.has(i)||c.children.set(i,s),s.parent??=a),n)return r;a=i,o=e+1}}popNamespace(){this.namespaceStack.pop()}addClassesToNamespace(e,t,n){let r=this.namespaces.get(e);if(r!==void 0){for(let n of t){let{className:t}=P(n),i=this.classes.get(t);i!==void 0&&(i.parent=e,r.classes.set(t,i))}for(let t of n){let n=this.notes.get(t);n!==void 0&&(n.parent=e,r.notes.set(t,n))}}}setCssStyle(e,t){let n=this.classes.get(e);if(t&&n)for(let e of t)for(let t of e.split(`,`))n.styles.push(t)}},ue=`$end.INVALID.CLASS_DIAGRAM.NEWLINE.EOF.SQS.STR.SQE.DOT.GENERICTYPE.LABEL.acc_title.acc_title_value.acc_descr.acc_descr_value.acc_descr_multiline_value.STRUCT_START.STRUCT_STOP.NAMESPACE.STYLE_SEPARATOR.ANNOTATION_START.ANNOTATION_END.CLASS.MEMBER.NOTE_FOR.NOTE.CLASSDEF.ALPHA.COMMA.direction_tb.direction_bt.direction_rl.direction_lr.AGGREGATION.EXTENSION.COMPOSITION.DEPENDENCY.LOLLIPOP.LINE.DOTTED_LINE.CALLBACK.LINK.LINK_TARGET.CLICK.CALLBACK_NAME.CALLBACK_ARGS.HREF.STYLE.CSSCLASS.COLON.BRKT.PCT.MINUS.UNICODE_TEXT.BQUOTE_STR.EDGE_STATE.EOF_IN_STRUCT.OPEN_IN_STRUCT.PLUS.EQUALS.PUNCTUATION`.split(`.`),de=[4,6,4,9,44,45,12,14,15,4,56,4,56],fe=[/.*direction\s+TB[^\n]*/y,/.*direction\s+BT[^\n]*/y,/.*direction\s+RL[^\n]*/y,/.*direction\s+LR[^\n]*/y],I=/[\n\r\u2028\u2029]/g;function L(e){let t=e.length,n=[],r=[],i=[],a=[],o=0,s=0,c=e.indexOf(`direction`),l=-1,u=0,d=(t,a,o)=>(n.push(t),r.push(e.slice(a,o)),i.push(a),s=o,!0),f=e=>{a.push(o),o=e},p=()=>{a.length>0&&(o=a.pop())},m=t=>e.startsWith(t,s)&&!E(e.charCodeAt(s+t.length)),h=n=>{for(;n<t&&D(e.charCodeAt(n));)n++;return n},g=n=>{let r=e.indexOf(n,s);return r===-1?t:r},_=n=>{let r=s,i=-1;for(let n=e.charCodeAt(r);r<t&&D(n);n=e.charCodeAt(++r))n===10&&(i=r);i<0?s=r:(n&&p(),d(3,s,i+1))},v=t=>{switch(t){case 99:if(m(`cssClass`))return d(48,s,s+8);if(m(`callback`))return d(40,s,s+8);if(m(`click`))return d(43,s,s+5);break;case 108:if(m(`link`))return d(41,s,s+4);break;case 110:if(m(`note for`))return d(24,s,s+8);if(m(`note`))return d(25,s,s+4);break;case 60:if(e.charCodeAt(s+1)===60)return d(20,s,s+2);break;case 62:if(e.charCodeAt(s+1)===62)return d(21,s,s+2);break;case 104:if(m(`href`))return d(46,s,s+4)}return!1},y=n=>{if(v(n))return!0;let r=e.charCodeAt(s+1);switch(n){case 34:return f(1),s++,!0;case 126:return f(3),s++,!0;case 96:return f(2),s++,!0;case 95:if(m(`_self`))return d(42,s,s+5);if(m(`_blank`))return d(42,s,s+6);if(m(`_parent`))return d(42,s,s+7);if(m(`_top`))return d(42,s,s+4);break;case 60:return r===124?d(34,s,s+2):d(36,s,s+1);case 124:return r===62&&d(34,s,s+2);case 62:return d(36,s,s+1);case 42:return d(35,s,s+1);case 111:if(!E(r))return d(33,s,s+1);break;case 40:return r===41&&d(37,s,s+2);case 45:return r===45?d(38,s,s+2):d(52,s,s+1);case 46:return r===46?d(39,s,s+2):d(8,s,s+1);case 58:{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===58||t===10||t===59)break;n++}return n>s+1?d(10,s,n):r===58&&e.charCodeAt(s+2)===58&&d(19,s,s+3)}case 43:return d(58,s,s+1);case 37:return d(51,s,s+1);case 61:return d(59,s,s+1);case 91:return d(5,s,s+1);case 93:return d(7,s,s+1);case 33:case 35:case 36:case 38:case 39:case 44:case 63:case 92:case 47:return d(60,s,s+1)}if(E(n)){let t=s+1;for(;E(e.charCodeAt(t));)t++;return d(27,s,t)}return S(n)&&d(53,s,s+1)},b=()=>{if(c===-1||s<u||(c<s&&(c=e.indexOf(`direction`,s)),c===-1)||(l<s&&(I.lastIndex=s,l=I.test(e)?I.lastIndex-1:t),c>=l))return!1;for(let t=0;t<4;t++){let n=fe[t];if(n.lastIndex=s,n.test(e))return d(29+t,s,n.lastIndex)}return u=l,!1},ee=n=>{if(b())return!0;if(D(n))return _(!1),!0;switch(n){case 37:if(e.charCodeAt(s+1)===37){let n=g(`
3
3
  `);for(;n<t&&(e.charCodeAt(n)===10||e.charCodeAt(n)===13);)n++;return s=n,!0}break;case 97:{let t=e.startsWith(`accTitle`,s);if(!t&&!e.startsWith(`accDescr`,s))break;let n=h(s+8),r=e.charCodeAt(n);if(r===58)return d(t?11:13,s,h(n+1)),f(t?6:7),!0;if(r===123&&!t)return s=h(n+1),f(8),!0;break}case 99:if(m(`classDiagram-v2`))return d(2,s,s+15);if(m(`classDiagram`))return d(2,s,s+12);if(e.startsWith(`call`,s)&&D(e.charCodeAt(s+4)))return s=h(s+4),f(4),!0;if(m(`classDef`))return d(26,s,s+8);if(m(`class`))return f(9),d(22,s,s+5);break;case 91:if(e.startsWith(`*]`,s+1))return d(55,s,s+3);break;case 115:if(m(`style`))return d(47,s,s+5);break;case 110:if(m(`namespace`))return f(11),d(18,s,s+9);break;case 44:return d(28,s,s+1);case 35:return d(50,s,s+1)}return y(n)||n===58&&d(49,s,s+1)};for(;;){if(s>=t){n.push(de[o]),r.push(``),i.push(t);break}let a=e.charCodeAt(s),c=!0;switch(o){case 0:c=ee(a);break;case 9:D(a)?_(!0):a===125?(p(),p(),d(17,s,s+1)):a===123?(f(10),d(16,s,s+1)):c=y(a);break;case 10:if(a===34)f(1),s++;else if(a===125)p(),d(17,s,s+1);else if(a===91&&e.startsWith(`*]`,s+1))d(55,s,s+3);else if(a===123)d(57,s,s+1);else if(a===10)s++;else{let n=s+1;for(;n<t;){let t=e.charCodeAt(n);if(t===123||t===125||t===10)break;n++}d(23,s,n)}break;case 11:D(a)?_(!0):a===123?(f(12),d(16,s,s+1)):a===125?p():a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):c=y(a);break;case 12:D(a)?_(!1):a===125?(p(),d(17,s,s+1)):a===110&&m(`namespace`)?(f(11),d(18,s,s+9)):a===91&&e.startsWith(`*]`,s+1)?d(55,s,s+3):a===99&&m(`class`)?(f(9),d(22,s,s+5)):c=y(a);break;case 1:a===34?(p(),s++):d(6,s,g(`"`));break;case 3:if(a===34)f(1),s++;else{if(v(a))break;a===126?(p(),s++):d(9,s,g(`~`))}break;case 2:if(a===34)f(1),s++;else{if(v(a))break;a===126?(f(3),s++):a===96?(p(),s++):d(54,s,g("`"))}break;case 4:if(a===40){let t=h(s+1);p(),e.charCodeAt(t)===41?s=t+1:(f(5),s++)}else d(44,s,g(`(`));break;case 5:a===41?(p(),s++):d(45,s,g(`)`));break;case 6:case 7:d(o===6?12:14,s,g(`
4
4
  `)),p();break;case 8:a===125?(p(),s++):d(15,s,g(`}`))}if(!c)return n.push(1),r.push(``),i.push(s),{types:n,texts:r,starts:i}}return n.push(0),r.push(``),i.push(t),{types:n,texts:r,starts:i}}var R=61,z=new Uint8Array(R);for(let e of[53,27,52])z[e]=1;var pe=new Uint8Array(R);for(let e of[27,49,50,47,51,10])pe[e]=1;var B=new Uint8Array(R);B[33]=1,B[34]=2,B[35]=3,B[36]=4,B[37]=5;var V=`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS', 'BQUOTE_STR'`;function me(e,t){let{types:n,texts:r,starts:i}=L(e),a=0,o=t=>{let r=n[a];throw r===1?O(`class`,e,i[a],``,!0):O(`class`,e,i[a],`Expecting ${t}, got '${ue[r]}'`)},s=e=>(n[a]!==e&&o(`'${ue[e]}'`),r[a++]),c=()=>(z[n[a]]===0&&o(`'UNICODE_TEXT', 'NUM', 'ALPHA', 'MINUS'`),r[a++]),l=e=>{let t=``;for(;;){if(n[a]===54){t+=r[a++];break}z[n[a]]===0&&o(V),t+=r[a++];let e=n[a];if(e===8)t+=`.`,a++;else if(z[e]===0&&e!==54)break}return e&&n[a]===9&&(t+=`~`+r[a++]+`~`),t},u=()=>{a++;let e=s(6);return s(7),e},d=()=>{n[a]!==23&&o(`'STRUCT_STOP', 'MEMBER'`);let e=[];for(;n[a]===23;)e.push(r[a++]);return s(17),e.reverse()},f=()=>{a++;let e=l(!0);switch(t.addClass(e),n[a]===5&&t.setClassLabel(e,u()),n[a]){case 19:{a++;let r=c();t.setCssClass(e,r),n[a]===16&&(a++,t.addMembers(e,d()));break}case 16:a++,n[a]===17?a++:t.addMembers(e,d());break;case 20:{a++;let r=c();s(21),t.addAnnotation(e,r),n[a]===16&&(a++,n[a]===17?a++:t.addMembers(e,d()));break}}return e},p=()=>{if(n[a++]===25)return t.addNote(s(6));let e=l(!0);return t.addNote(s(6),e)},m=()=>{let e=[];for(;;){a++;let r=l(!1),i=n[a]===5?t.addNamespace(r,u()):t.addNamespace(r);s(16),n[a]===3&&a++,e.push({id:i,classes:[],notes:[]});let c=!0;for(;c;){let r=e[e.length-1],i=n[a];if(i===18)break;for(i===22?r.classes.push(f()):i===25||i===24?r.notes.push(p()):o(`'NAMESPACE', 'CLASS', 'NOTE_FOR', 'NOTE'`);;){if(n[a]===3){let e=n[a+1];if(e===18||e===22||e===25||e===24){a++;break}a++}s(17);let r=e.pop();if(t.addClassesToNamespace(r.id,r.classes,r.notes),t.popNamespace(),e.length===0){c=!1;break}}}if(e.length===0)return}},h=()=>{let e=B[n[a]];return e===0?`none`:(a++,e-1)},g=()=>{let e=l(!0),i=n[a];if(i===10){t.addMember(e,t.cleanupLabel(r[a++]));return}let s=`none`;if(i===6)s=r[a++],i=n[a];else if(B[i]===0&&i!==38&&i!==39)return;let c=h();i=n[a],i!==38&&i!==39&&o(`'AGGREGATION', 'EXTENSION', 'COMPOSITION', 'DEPENDENCY', 'LOLLIPOP', 'LINE', 'DOTTED_LINE'`),a++;let u=h(),d=n[a]===6?r[a++]:`none`,f={id1:e,id2:l(!0),relation:{type1:c,type2:u,lineType:i===38?0:1},relationTitle1:s,relationTitle2:d};n[a]===10&&(f.title=t.cleanupLabel(r[a++])),t.addRelation(f)},_=()=>{let e=[];for(;;){pe[n[a]]===0&&o(`'ALPHA', 'NUM', 'COLON', 'UNIT', 'SPACE', 'BRKT', 'STYLE', 'PCT', 'LABEL'`);let t=r[a++];for(;pe[n[a]]===1;)t+=r[a++];if(e.push(t),n[a]!==28)return e;a++}},v=e=>{n[a]===6&&t.setTooltip(e,r[a++])},y=e=>{let i=s(6),o=n[a]===6?r[a++]:void 0;n[a]===42?t.setLink(e,i,r[a++]):t.setLink(e,i),o!==void 0&&t.setTooltip(e,o)},b=()=>{let e=n[a];switch(e){case 53:case 27:case 52:case 54:g();return;case 18:m();return;case 22:f();return;case 23:a++;return;case 20:{a++;let e=c();s(21),t.addAnnotation(l(!0),e);return}case 40:{a++;let e=l(!0);t.setClickEvent(e,s(6)),v(e);return}case 41:a++,y(l(!0));return;case 43:{a++;let e=l(!0);if(n[a]===46){a++,y(e);return}let i=s(44);n[a]===45?t.setClickEvent(e,i,r[a++]):t.setClickEvent(e,i),v(e);return}case 47:{a++;let e=s(27);t.setCssStyle(e,_());return}case 48:{a++;let e=s(6);t.setCssClass(e,s(27));return}case 25:case 24:p();return;case 26:{a++;let e=[s(27)];for(;n[a]===28;)a++,e.push(s(27));t.defineClass(e,_());return}case 29:case 30:case 31:case 32:a++,t.setDirection(e===29?`TB`:e===30?`BT`:e===31?`RL`:`LR`);return;case 11:a++,t.setAccTitle(s(12).trim());return;case 13:a++,t.setAccDescription(s(14).trim());return;case 15:t.setAccDescription(r[a++].trim());return}o(`'acc_title', 'acc_descr', 'acc_descr_multiline_value', 'NAMESPACE', 'ANNOTATION_START', 'CLASS', 'MEMBER', 'NOTE_FOR', 'NOTE', 'CLASSDEF', 'direction_tb', 'CALLBACK', 'LINK', 'CLICK', 'STYLE', 'CSSCLASS', 'ALPHA', 'MINUS', 'BQUOTE_STR'`)},ee=n[a]===2;for(ee&&(a++,s(3));b(),!(n[a]!==3||(a++,n[a]===4||n[a]===0)););ee&&s(4),s(0)}function he(e,t,n,r){let i=Int32Array.from(e,(e,t)=>t),a=e=>{for(;i[e]!==e;)i[e]=i[i[e]],e=i[e];return e},o=(e,t)=>{i[a(e)]=a(t)};for(let t=0;t<e.length;t++)e[t].parent>=0&&o(t,e[t].parent);for(let e of t)o(e.src,e.dst);let s=new Map,c=(e,t,n,r=0,i=0)=>{e.left=Math.min(e.left,t-r/2),e.top=Math.min(e.top,n-i/2),e.right=Math.max(e.right,t+r/2),e.bottom=Math.max(e.bottom,n+i/2)};for(let t=0;t<e.length;t++){let n=a(t),r=s.get(n);r||(r={nodes:[],edges:[],left:1/0,top:1/0,right:-1/0,bottom:-1/0},s.set(n,r));let i=e[t];r.nodes.push(i),c(r,i.x,i.y,i.w,i.h)}if(s.size<2)return;for(let e of t){let t=s.get(a(e.src));t.edges.push(e);for(let n=0;n<e.route.length;n+=3)c(t,e.route[n],e.route[n+1]);e.labelW>0&&c(t,e.labelX,e.labelY,e.labelW,e.labelH)}let l=0,u=0,d=0,f=0,p=1/0,m=-1/0,h=[];for(let e of s.values()){let t=e.right-e.left,i=e.bottom-e.top;l>0&&l+t>n&&(u+=d+r,l=0,d=0),h.push(l-e.left,u-e.top),p=Math.min(p,e.left),m=Math.max(m,e.right),f=Math.max(f,l+t),d=Math.max(d,i),l+=t+r}if(f>=m-p)return;let g=0;for(let e of s.values())oe(e.nodes,e.edges,h[g++],h[g++]);return{width:f,height:u+d}}var H=[`aggregation`,`extension`,`composition`,`dependency`,`lollipop`];function U(e){return typeof e==`number`&&H[e]||`none`}function ge(e,t=!0){let n=[],r=[],i=new Map,a=new Map,o=new Map,s=new Map,c=n=>{if(t||n===void 0)return n;let r=[],i=n,a;for(;i;){if(s.has(i)){a=s.get(i);break}let t=e.namespaces.get(i);if(t===void 0)break;if(t.explicit){a=i;break}r.push(i),i=t.parent}for(let e of r)s.set(e,a);return a},l=e=>e===void 0?-1:i.get(e)??-1;for(let r of e.namespaces.values())!t&&!r.explicit||(i.set(r.id,n.length),n.push({id:r.id,label:t?r.label:r.id,isGroup:!0,shape:`rect`,parentId:t?r.parent:void 0,parent:-1}));for(let e of n)e.parent=l(e.parentId);let u=0;for(let t of e.classes.values()){let e=c(t.parent);a.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`classBox`,parentId:e,parent:l(e),classNode:t,colorIndex:u++})}for(let t of e.notes.values()){let e=c(t.parent),i=t.class===void 0?void 0:a.get(t.class);i!==void 0&&r.push({id:`edgeNote${t.index}`,start:t.id,end:n[i].id,source:n.length,target:i,label:void 0,arrowTypeStart:`none`,arrowTypeEnd:`none`,startLabelRight:``,endLabelLeft:``,pattern:`dotted`,classes:`relation`}),n.push({id:t.id,label:t.text,isGroup:!1,shape:`note`,parentId:e,parent:l(e)})}for(let t of e.interfaces){let e=a.get(t.classId);o.set(t.id,n.length),n.push({id:t.id,label:t.label,isGroup:!1,shape:`interface`,parentId:void 0,parent:e===void 0?-1:n[e].parent})}let d=0;for(let t of e.relations){d++;let{type1:e,type2:n}=t.relation,i=e===M.LOLLIPOP&&n===`none`?o:a,s=i===a&&n===M.LOLLIPOP&&e===`none`?o:a;r.push({id:`id_${t.id1}_${t.id2}_${d}`,start:t.id1,end:t.id2,source:i.get(t.id1)??-1,target:s.get(t.id2)??-1,label:t.title,arrowTypeStart:U(e),arrowTypeEnd:U(n),startLabelRight:t.relationTitle1===`none`?``:t.relationTitle1,endLabelLeft:t.relationTitle2===`none`?``:t.relationTitle2,pattern:t.relation.lineType===1?`dashed`:`solid`,classes:`relation`})}return{nodes:n,edges:r}}var W=12,G=16,K=6,q=5;function _e(e){switch(e){case`extension`:return W;case`composition`:case`aggregation`:return G;case`lollipop`:return 2*q;case`dependency`:return m(`arrow_point`)}return 0}function ve(e,t,n,r,i,a){let o=-i,s=r;switch(e){case`extension`:{let e=t-r*W,a=n-i*W;return`<path class="pele-marker" d="M${u(t)},${u(n)}L${u(e+o*K)},${u(a+s*K)}L${u(e-o*K)},${u(a-s*K)}Z" stroke-linejoin="round"/>`}case`composition`:case`aggregation`:{let c=t-r*G/2,l=n-i*G/2,d=K-1;return`<path class="pele-marker" d="M${u(t)},${u(n)}L${u(c+o*d)},${u(l+s*d)}L${u(t-r*G)},${u(n-i*G)}L${u(c-o*d)},${u(l-s*d)}Z" stroke-linejoin="round"${e===`composition`?` fill="${a}"`:``}/>`}case`lollipop`:return`<circle class="pele-marker" cx="${u(t-r*q)}" cy="${u(n-i*q)}" r="${q}"/>`;case`dependency`:return _(`arrow_point`,t,n,r,i,a)}return``}var ye=40,be=16,xe=56,J=20,Se=26,Ce=12,we=8,Te=6,Ee=10,De=64,Oe=8,ke=`var(--_l)`,Ae=new Set([`_self`,`_blank`,`_parent`,`_top`]);function je(e,t,n){let r=e[t];return typeof r==`number`&&r>0?Math.min(r,2e3):n}var Me=[],Ne=[];function Pe(e,t,n){let r=T(e.getDisplayDetails().displayText).trim();return{text:r,width:t.width(r,n,e.classifier===`*`?2:0),classifier:e.classifier}}function Fe(e,t,n){let r=r=>f(n,i=>Ie(e,t,n,r,i));return d(e.direction)?p(n,r):r(!1)}function Ie(d,f,p,m,_){let b=f.class??{},S=ge(d,b.hierarchicalNamespaces!==!1),oe=b.hideEmptyMembersBox===!0,w=p.fontSize??16,E=Math.round(w*.875),D=Math.round(w*.8),O=Math.round(D*1.4),k=p.measurer??ce(p.fontFamily,p.fontFamilyMono),A=p.padding??8,j=(e,t)=>{if(!e.includes(`$$`))return;let n=c(e,!1,k,t,4e3);return n.lines.some(l)?n:void 0},M=e=>e?j(e,D)?.width??k.width(T(e),D,0):0,N=m?`TB`:se(d.direction),P=new Map,le=new Map,F=new Map,ue=e=>{let t=P.get(e);if(t===void 0){let n=s([e]);t=n.shape===``&&n.text===``?``:e.slice(0,e.indexOf(`:`)).trim().toLowerCase(),P.set(e,t)}t!==``&&F.set(t,e)},de=e=>{F.clear();let t=le.get(e.cssClasses);if(t===void 0){for(let t of e.cssClasses.split(` `)){let e=d.styleClasses.get(t);if(e)for(let t of e.styles)for(let e of t.split(`,`))ue(e)}t=[...F],le.set(e.cssClasses,t)}else for(let[e,n]of t)F.set(e,n);for(let t of e.styles)ue(t);return s(F.size===0?Ne:[...F.values()])},fe=new Int32Array(S.nodes.length);for(let e of S.nodes)e.parent>=0&&fe[e.parent]++;let I=new Uint8Array(S.nodes.length);for(let e of S.edges){if(e.source<0||e.target<0)continue;let t=S.nodes[e.source].parent,n=S.nodes[e.target].parent;if(t!==n){for(let e=t;e>=0&&I[e]===0;e=S.nodes[e].parent)I[e]=1;for(let e=n;e>=0&&I[e]===0;e=S.nodes[e].parent)I[e]=1}}let L=[],R=[];S.nodes.forEach((e,t)=>{let n,r;if(e.isGroup){let i=c(e.label,!1,k,w,4e3);n=z(e,i,0,0,w),fe[t]>0?(r=C(0,0),r.isGroup=!0,r.padX=J,r.padTop=i.height>0?i.height+16:J,r.padBottom=J,r.minW=i.width+2*J-12+(I[t]===1&&!_?Math.min(i.width+24,240):0)):(n.w=Math.max(i.width+2*J,80),n.h=i.height+2*J,r=C(n.w,n.h))}else if(e.classNode)n=pe(e,e.classNode),r=C(n.w,n.h);else if(e.shape===`note`){let t=c(e.label,!0,k,E,260);n=z(e,t,Math.max(t.width+2*Ce,40),t.height+2*we,E),r=C(n.w,n.h)}else{let t=c(e.label,!1,k,E,200);n=z(e,t,Math.max(t.width,12)+4,Math.max(t.height,12),E),r=C(n.w,n.h)}r.parent=e.parent,r.seq=t,L.push(n),R.push(r)});function z(e,t,n,r,i){return{node:e,style:s(Ne),label:t,w:n,h:r,loops:0,annotations:Ne,attributes:Me,methods:Me,titleH:0,attributesH:0,fontSize:i}}function pe(e,t){let n=de(t),r=n.fontSize??w,i=Math.round(r*.875),a=Math.round(i*1.5),o=t.type?`&lt;`+x(t.type).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)+`&gt;`:``,s=c(t.label+o,!1,k,r,4e3,1|(n.italic?2:0)),l=t.annotations.length>0?t.annotations.map(e=>j(`«${e.trim()}»`,D)??`«${T(e).trim()}»`):Ne,u=t.members.length>0?t.members.map(e=>Pe(e,k,i)):Me,d=t.methods.length>0?t.methods.map(e=>Pe(e,k,i)):Me,f=s.width,p=0;for(let e of l)f=Math.max(f,typeof e==`string`?k.width(e,D,0):e.width),p+=typeof e==`string`?O:Math.max(O,e.height);for(let e of u)f=Math.max(f,e.width);for(let e of d)f=Math.max(f,e.width);let m=!(oe&&u.length===0&&d.length===0),h=e=>m?e>0?2*Te+e*a:Ee:0,g=2*we+p+Math.max(s.height,Math.round(r*1.5)),_=h(u.length);return{node:e,style:n,label:s,w:Math.max(f+2*Ce,De),h:g+_+h(d.length),loops:0,annotations:l,attributes:u,methods:d,titleH:g,attributesH:_,fontSize:r}}let B=[],V=[],me=[],H=[],U=[],W=new Float64Array(L.length*4),G=(e,t,n)=>{W[e*4+t]++,n>W[e*4+t+1]&&(W[e*4+t+1]=n)};for(let e of S.edges){if(e.source<0||e.target<0)continue;let t=c(e.label,!0,k,E,200),n=M(e.startLabelRight),r=M(e.endLabelLeft);e.source===e.target?(L[e.source].loops++,R[e.source].w+=2*(Se+(t.width>0?t.width+12:0))):(G(e.source,0,n),G(e.target,2,r)),H.push(n),U.push(r),V.push(e),me.push(t),B.push({src:e.source,dst:e.target,minlen:1,labelW:t.width>0?t.width+12:0,labelH:t.height>0?t.height+4:0,route:[],labelX:0,labelY:0})}if(N===`TB`||N===`BT`)for(let e=0;e<L.length;e++){if(!L[e].node.classNode)continue;let t=0;for(let n=0;n<4;n+=2){let r=W[e*4+n],i=W[e*4+n+1];r>1&&(t=Math.max(t,(r-1)*(i>0?i+24:14)+24))}t=Math.min(t,480),t>L[e].w&&(R[e].w+=t-L[e].w,L[e].w=t)}let K=!1;for(let e=0;e<V.length&&!K;e++)K=H[e]>0||U[e]>0;let q=0;if(N===`TB`||N===`BT`){let e=e=>e?Math.max(O,j(e,D)?.height??0):0;for(let t of V)q=Math.max(q,e(t.startLabelRight)+e(t.endLabelLeft)-2*O)}let Fe=ae(R,B,N,{nodeSep:je(b,`nodeSpacing`,ye),edgeSep:be,rankSep:je(b,`rankSpacing`,K?xe+16:xe)+q,portSep:20,apart:!0}),Ie=new Map,Y=[],Le=(e,t,n,r,i)=>{let a=e.route,o=R[n],s=y(a,t,o);if(s<0)return;let c=(o.w-L[n].w)/2;s===1?a[t]-=c:s===3&&(a[t]+=c);let l=s&1,u=a[(t===0?3:t-3)+l],d=u-a[t+l],f={route:a,at:t,toward:u,order:i,room:r,side:s,after:l?d>0:d>=0},p=n*4+s,m=Ie.get(p);return m?m.push(f):Ie.set(p,[f]),f},Re=[],ze=[];for(let e=0;e<B.length;e++){let t=B[e],n=t.src!==t.dst&&t.route.length>=6;Re.push(n?Le(t,0,t.src,H[e],e):void 0),ze.push(n?Le(t,t.route.length-3,t.dst,U[e],e):void 0)}let Be=(e,t,n)=>{for(let r=R[e].parent,i=0;r>=0&&i<1e4;r=R[r].parent,i++){let e=R[r],i=Math.abs(t-e.x),a=Math.abs(n-e.y);if(Math.abs(a-e.h/2)<.5&&i<=e.w/2+.5||Math.abs(i-e.w/2)<.5&&a<=e.h/2+.5)return!0}return!1},Ve=[];for(let[e,t]of Ie){if(t.length<2)continue;let n=e>>2,r=e&1,i=r?L[n].h:L[n].w;t.sort((e,t)=>e.toward-t.toward||e.order-t.order);let a=0;for(let e=0;e+1<t.length;e++){let n=t[e],i=t[e+1],o=r?20:24;n.room>0&&n.after&&(o+=r?O+6:n.room),i.room>0&&!i.after&&(o+=r?O+6:i.room),Ve[e]=o,a+=o}let o=Math.min(1,(i-24)/a);if(o<=0)continue;let s=(r?R[n].y:R[n].x)-a*o/2;for(let e=0;e<t.length;e++){let{route:i,at:a}=t[e],c=a===0?3:-3,l=a+c,u=-1;for(let e=l;e>=0&&e<i.length&&Math.abs(i[e+r]-i[l+r])<.5;e+=c)if(Be(n,i[e],i[e+1])){u=e;break}if(u>=0&&Math.abs(i[l+r]-s)<=24)for(let e=l;e!==u+c;e+=c)i[e+r]=s;i[a+r]=s,s+=Ve[e]*o}}let He=(e,t,n,r)=>{if(t===void 0||n<=0)return;let i=t.side&1,a=r?0:e.length-3,o=a+1-i,s=Math.abs(e[(r?3:a-3)+1-i]-e[o]),c=Math.min(i?n+10:O+6,s*.35);if(c<4)return;let l=[e[a],e[a+1],e[a+2]];l[1-i]+=(t.side===0||t.side===3?-1:1)*c,e.splice(r?3:a,0,l[0],l[1],l[2])};for(let e=0;e<B.length;e++)He(B[e].route,Re[e],H[e],!0),He(B[e].route,ze[e],U[e],!1);let X=0,Z=0,Ue=Fe.width,We=Fe.height,Ge=(e,t,n,r,i,a,o)=>{if(!t)return;let s=j(t,D),c=s?Math.max(O,s.height):O,l=r,u=i;a&1?(l+=(a===3?-1:1)*(5+n/2),u+=(o?1:-1)*(7+c/2)):(l+=(o?1:-1)*(9+n/2),u+=(a===0?-1:1)*(3+c/2)),Y.push({text:T(t),math:s,x:l,y:u,w:n,h:c,parent:e}),X=Math.min(X,l-n/2),Ue=Math.max(Ue,l+n/2),Z=Math.min(Z,u-c/2),We=Math.max(We,u+c/2)},Ke=new Map,qe=new Int32Array(B.length);for(let e=0;e<B.length;e++){let t=B[e],n=V[e],r=t.route;if(t.src===t.dst){let r=Ke.get(t.src)??0;Ke.set(t.src,r+1),qe[e]=r;let i=R[t.src],a=L[t.src],o=i.x+a.w/2,s=Math.min(a.h/2-4,8+r*6);Ge(t.src,n.startLabelRight,H[e],o,i.y-s,1,!1),Ge(t.dst,n.endLabelLeft,U[e],o,i.y+s,1,!0),t.labelX=i.x+a.w/2+Se+r*8+4+t.labelW/2,t.labelY=i.y}else if(r.length>=6){let i=r.length-3,a=Re[e],o=ze[e];Ge(t.src,n.startLabelRight,H[e],r[0],r[1],a?a.side:2,!a||a.after),Ge(t.dst,n.endLabelLeft,U[e],r[i],r[i+1],o?o.side:0,!o||o.after)}}let Je=p.maxWidth;if(Je!==void 0&&Je>0&&Ue-X+2*A>Je){let e=Y.map(e=>({...C(e.w,e.h,e.parent),x:e.x,y:e.y})),t=he(R.concat(e),B,Math.max(1,Je-2*A),je(b,`nodeSpacing`,ye));t&&(Y.forEach((t,n)=>{t.x=e[n].x,t.y=e[n].y}),X=Z=0,Ue=t.width,We=t.height)}let Q=A-X,$=A-Z,Ye=Math.ceil(Ue-X+2*A),Xe=Math.ceil(We-Z+2*A),Ze=[],Qe=new Map;if(S.nodes.length>0&&S.nodes[0].isGroup)for(let e of B)re(Qe,e.route);let $e=``,et=``,tt=``;for(let e=0;e<L.length;e++){let t=L[e],n=R[e],r=t.node,s=n.x+Q,c=n.y+$,l=i(r.id),d=n.isGroup?n.w:t.w,f=n.isGroup?n.h:t.h;if(r.isGroup){let r=n.isGroup?ne(n,t.label.width,Qe,J):n.x,i=c-f/2+8+t.label.height/2,p=` class="pele-cluster-label" fill="var(--_m)"`,m=n.isGroup&&te(n,t.label.width,r,Qe);m&&(et+=ie(t.label,r+Q,i,p,l,S.nodes,e)),$e+=`<g class="pele-cluster pele-namespace" data-id="${l}"><rect x="${u(s-d/2)}" y="${u(c-f/2)}" width="${u(d)}" height="${u(f)}" fill="var(--_a)" fill-opacity="0.5" stroke="var(--_b)"${o}/>`+(m?``:a(t.label,r+Q,i,p))+`</g>`;continue}let m=` transform="translate(${u(s)},${u(c)})"`;if(r.classNode)tt+=nt(t,r.classNode,l,m);else if(r.shape===`note`){let e=d/2,n=-f/2;tt+=`<g class="pele-node pele-note" data-id="${l}"${m}><path d="M${u(-e)},${u(n)}H${u(e-Oe)}L${u(e)},${u(n+Oe)}V${u(-n)}H${u(-e)}Z" fill="var(--_a)" stroke="var(--_b)" stroke-linejoin="round"/><path d="M${u(e-Oe)},${u(n)}V${u(n+Oe)}H${u(e)}" fill="none" stroke="var(--_b)" stroke-linejoin="round"/>`+a(t.label,0,0,` class="pele-label" font-size="${E}"`,p.icons)+`</g>`}else tt+=`<g class="pele-node pele-interface" data-id="${l}"${m}>`+a(t.label,0,0,` class="pele-label" font-size="${E}"`,p.icons)+`</g>`}function nt(e,o,s,c){let{w:l,h:d,style:f}=e,m=-l/2,h=-d/2,g=Math.round(e.fontSize*.875),_=Math.round(g*1.5),v=`<rect x="${u(m)}" y="${u(h)}" width="${u(l)}" height="${u(d)}" fill="var(--_s)" stroke="var(--_b)"${r(f.shape)}/>`,y=h+e.titleH,b=y+e.attributesH;if(d>e.titleH){let e=f.stroke?` style="stroke:${t(f.stroke)}"`:``;v+=`<path class="pele-divider" d="M${u(m)},${u(y)}H${u(-m)}M${u(m)},${u(b)}H${u(-m)}" fill="none" stroke="var(--_b)"${e}/>`}let x=h+we;for(let n of e.annotations)if(typeof n==`string`)v+=`<text class="pele-annotation" x="0" y="${u(x+O/2+D*.35)}" text-anchor="middle" font-size="${D}" fill="var(--_m)">${t(n)}</text>`,x+=O;else{let e=Math.max(O,n.height);v+=a(n,0,x+e/2,` class="pele-annotation" font-size="${D}" fill="var(--_m)"`,p.icons),x+=e}let S=e.fontSize===w?``:` font-size="${u(e.fontSize)}"`;v+=a(e.label,0,(x+y-we)/2,` class="pele-label"${S} font-weight="var(--_hw)"${f.text}`,p.icons);let te=(e,n,r)=>{let i=``,a=r+Te+_/2+g*.35;for(let r of e){let e=r.classifier===`$`?` pele-static"${f.text?f.text.slice(0,-1)+`text-decoration:underline"`:` style="text-decoration:underline"`}`:r.classifier===`*`?` pele-abstract" font-style="italic"${f.text}`:`"${f.text}`;i+=`<text class="pele-member pele-${n}${e} x="${u(m+Ce)}" y="${u(a)}">${t(r.text)}</text>`,a+=_}return i};return(e.attributes.length>0||e.methods.length>0)&&(v+=`<g class="pele-members" font-size="${g}">${te(e.attributes,`attribute`,y)}${te(e.methods,`method`,b)}</g>`),o.tooltip&&(v=`<title>${i(o.tooltip)}</title>`+v),o.link&&(v=ee(v,o.link,o.id,Ze,p,o.linkTarget&&Ae.has(o.linkTarget)?` target="${o.linkTarget}"`:``)),`<g class="pele-node pele-class${n(o.cssClasses.replace(/^default\s?/,``))}" data-id="${s}"${c}>${v}</g>`}let rt=``,it=``;for(let e=0;e<B.length;e++){let t=B[e],n=V[e],r=me[e],a=n.arrowTypeStart,o=n.arrowTypeEnd,s=_e(a),c=_e(o),l;if(t.src===t.dst){let n=R[t.src],r=L[t.src],i=qe[e],a=n.x+Q+r.w/2,o=n.y+$,d=Math.min(r.h/2-4,8+i*6),f=Se+i*8;l={d:`M${u(a+s)},${u(o-d)}C${u(a+f+s)},${u(o-d)} ${u(a+f+c)},${u(o+d)} ${u(a+c)},${u(o+d)}`,sx:a,sy:o-d,sdx:-1,sdy:0,ex:a,ey:o+d,edx:-1,edy:0}}else{let e=t.route;for(let t=0;t<e.length;t+=3)e[t]+=Q,e[t+1]+=$;l=g(e,void 0,s,c)}let d=n.pattern===`dashed`?` stroke-dasharray="6 4"`:n.pattern===`dotted`?` stroke-dasharray="2 4"`:``;if(rt+=`<g class="pele-edge${n.pattern===`dotted`?` pele-note-edge`:` pele-relation`}" data-id="${i(n.id)}"><path d="${l.d}"${d}/>`+ve(a,l.sx,l.sy,l.sdx,l.sdy,ke)+ve(o,l.ex,l.ey,l.edx,l.edy,ke)+`</g>`,r.width>0){let e=t.labelX+Q,i=t.labelY+$;it+=h(n.id,r,e,i,``,p.icons)}}let at=``;for(let e of Y)at+=e.math?a(e.math,e.x+Q,e.y+$,` class="pele-cardinality"`,p.icons):`<text class="pele-cardinality" x="${u(e.x+Q)}" y="${u(e.y+$+D*.35)}" text-anchor="middle">${t(e.text)}</text>`;let ot=v(d.title,k,w,A,Ye,Xe,($e?`<g class="pele-clusters">${$e}</g>`:``)+(rt?`<g class="pele-edges" fill="none" stroke="${ke}" stroke-linecap="round">${rt}</g>`:``)+(et?`<g class="pele-cluster-titles">${et}</g>`:``)+(it?`<g class="pele-edge-labels" font-size="${E}">${it}</g>`:``)+(at?`<g class="pele-cardinalities" font-size="${D}" fill="var(--_m)">${at}</g>`:``)+`<g class="pele-nodes">${tt}</g>`);return{svg:e(`class`,ot.width,ot.height,w,p,d,ot.content),width:ot.width,height:ot.height,links:Ze}}var Y={type:`class`,math:!0,parse(e,t,n){let r=new F;return n&&(r.title=n),me(e,r),r},render:Fe};export{Y as classDiagram};
@@ -1,2 +1,2 @@
1
- import{u as e}from"./CX-xckzu.js";var t=/<(?!br\s*\/?>)/gi,n=/:fa-/g,r=/<br\s*\/?>|fl°°?\w+¶ß|&#?\w+;|[\ud800-\udbff][\udc00-\udfff]|[\s\S]/gi;function i(r,i,a,o,s=0){let c=r;return c!==void 0&&(c.includes(`<`)&&(c=c.replace(t,`&lt;`)),c.includes(`:fa-`)&&(c=c.replace(n,`&colon;fa-`))),e(c,!1,i,a,o,s)}function a(e,t,n,a,o=0){let s=i(e,t,n,a,o);if(e===void 0||s.width<=a)return s;let c=``,l=0;for(let i of e.match(r)??[]){if(i.trim()===``||i.length>2&&i[0]===`<`)l=0;else{let e=t.width(i.length>2?`x`:i,n,o);l>0&&l+e>a&&(c+=`
1
+ import{u as e}from"./DfCZPwp1.js";var t=/<(?!br\s*\/?>)/gi,n=/:fa-/g,r=/<br\s*\/?>|fl°°?\w+¶ß|&#?\w+;|[\ud800-\udbff][\udc00-\udfff]|[\s\S]/gi;function i(r,i,a,o,s=0){let c=r;return c!==void 0&&(c.includes(`<`)&&(c=c.replace(t,`&lt;`)),c.includes(`:fa-`)&&(c=c.replace(n,`&colon;fa-`))),e(c,!1,i,a,o,s)}function a(e,t,n,a,o=0){let s=i(e,t,n,a,o);if(e===void 0||s.width<=a)return s;let c=``,l=0;for(let i of e.match(r)??[]){if(i.trim()===``||i.length>2&&i[0]===`<`)l=0;else{let e=t.width(i.length>2?`x`:i,n,o);l>0&&l+e>a&&(c+=`
2
2
  `,l=0),l+=e}c+=i}return i(c,t,n,a,o)}export{i as n,a as t};