@alisio/server 0.1.0-alpha.5 → 0.1.0-alpha.7

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 (149) hide show
  1. package/dist/auth/view-token.d.ts +16 -0
  2. package/dist/auth/view-token.js +36 -0
  3. package/dist/bridges/approval-bridge.js +4 -0
  4. package/dist/host/presets.js +4 -0
  5. package/dist/host/run-scheduler.d.ts +12 -2
  6. package/dist/host/run-scheduler.js +16 -7
  7. package/dist/host/sessions.js +1 -0
  8. package/dist/host/workspace-host.js +3 -3
  9. package/dist/http/errors.js +6 -0
  10. package/dist/http/router.d.ts +4 -1
  11. package/dist/http/router.js +30 -9
  12. package/dist/index.js +67 -5
  13. package/dist/routes/artifact-view.d.ts +17 -0
  14. package/dist/routes/artifact-view.js +78 -0
  15. package/dist/routes/artifacts.d.ts +26 -0
  16. package/dist/routes/artifacts.js +261 -0
  17. package/dist/routes/capabilities.d.ts +13 -0
  18. package/dist/routes/capabilities.js +20 -0
  19. package/dist/routes/commands.js +24 -0
  20. package/dist/routes/datasets.d.ts +14 -0
  21. package/dist/routes/datasets.js +239 -0
  22. package/dist/routes/files.js +24 -16
  23. package/dist/routes/management.js +25 -3
  24. package/dist/routes/prompts.js +26 -3
  25. package/dist/sse/inflight.js +4 -0
  26. package/dist/web/assets/AgentPicker-DB8mxbbL.js +1 -0
  27. package/dist/web/assets/AgentsModal-RvCfWb-2.js +2 -0
  28. package/dist/web/assets/ArtifactPanel-BO4wIe9q.js +2 -0
  29. package/dist/web/assets/ArtifactPanel-Cfi5Lgi8.css +1 -0
  30. package/dist/web/assets/BtwPanel-BQN5XxKF.js +1 -0
  31. package/dist/web/assets/SettingsModal--RT4zb3v.js +1 -0
  32. package/dist/web/assets/SpreadsheetPanel-C2XdUSSC.js +1 -0
  33. package/dist/web/assets/SpreadsheetPanel-CYyWl0en.css +1 -0
  34. package/dist/web/assets/{abnfDiagram-VCTEODGH-Cz5hn5ec.js → abnfDiagram-VCTEODGH-BNuKZo1p.js} +1 -1
  35. package/dist/web/assets/{agents.module-lYyQTI6Z.js → agents.module-D1wKvaD-.js} +1 -1
  36. package/dist/web/assets/app-DP2KtZ7m.js +2 -0
  37. package/dist/web/assets/architecture-7GRP2DOG-Bxp-PFvl.js +1 -0
  38. package/dist/web/assets/{architectureDiagram-5GKGNRK7-CSWMHXJ1.js → architectureDiagram-5GKGNRK7-Dt_V8yqa.js} +1 -1
  39. package/dist/web/assets/{blockDiagram-I7D4REHJ-CV034Tti.js → blockDiagram-I7D4REHJ-NxVOhPmn.js} +1 -1
  40. package/dist/web/assets/{c4Diagram-7LVT6UL2-DxMgBNf1.js → c4Diagram-7LVT6UL2-DRi00rDC.js} +1 -1
  41. package/dist/web/assets/channel-CNDX-cbg.js +1 -0
  42. package/dist/web/assets/{chunk-4HAMMTFA-CT8liele.js → chunk-4HAMMTFA-DmLMKdyN.js} +1 -1
  43. package/dist/web/assets/{chunk-75Z2AOVW-DFYQUeQA.js → chunk-75Z2AOVW-BR8-_T1K.js} +1 -1
  44. package/dist/web/assets/{chunk-DU6HZSFF-BJuBFcwd.js → chunk-DU6HZSFF-CgtANb4X.js} +1 -1
  45. package/dist/web/assets/{chunk-F27PBJKO-DQKhFLQx.js → chunk-F27PBJKO-CEslv91G.js} +1 -1
  46. package/dist/web/assets/{chunk-GMAD6QVW-DOqNcbFg.js → chunk-GMAD6QVW-ajMpCrE1.js} +1 -1
  47. package/dist/web/assets/{chunk-GVQU2GXP-uaJ9Q1Go.js → chunk-GVQU2GXP-Cxv3ClOW.js} +1 -1
  48. package/dist/web/assets/{chunk-IMKFNOWR-C85sNyla.js → chunk-IMKFNOWR-BrT27IpP.js} +1 -1
  49. package/dist/web/assets/{chunk-L3NEJ4N5-VqLWue5E.js → chunk-L3NEJ4N5-IF_NnfIM.js} +1 -1
  50. package/dist/web/assets/{chunk-OSK3NFVY-CpDZTLO2.js → chunk-OSK3NFVY-CTNQzsaZ.js} +1 -1
  51. package/dist/web/assets/{chunk-P2QGCYS3-8aJ3lrqy.js → chunk-P2QGCYS3-C8Mv-VXk.js} +1 -1
  52. package/dist/web/assets/{chunk-POPQ4Y6H-CCGI6bTT.js → chunk-POPQ4Y6H-DEyZliGx.js} +1 -1
  53. package/dist/web/assets/{chunk-PWAF6VOD-BzM7cl8Q.js → chunk-PWAF6VOD-DYoILyGR.js} +1 -1
  54. package/dist/web/assets/{chunk-SHT3W25Y-DB0C0Tk9.js → chunk-SHT3W25Y-BPA5CAVG.js} +1 -1
  55. package/dist/web/assets/{chunk-SVP7TREG-CaN0-mdN.js → chunk-SVP7TREG-DuiGU0RH.js} +1 -1
  56. package/dist/web/assets/{chunk-TICWLB2K-C0M4j05X.js → chunk-TICWLB2K-CPsLIDl-.js} +1 -1
  57. package/dist/web/assets/classDiagram-ZZMXUADV-BfcenY86.js +1 -0
  58. package/dist/web/assets/classDiagram-v2-VYDZK3BY-BfcenY86.js +1 -0
  59. package/dist/web/assets/clipboard-hOiC7lD8.js +1 -0
  60. package/dist/web/assets/{cynefin-OW5HDTMX-r5xVJ9v1.js → cynefin-OW5HDTMX-CfgsLEx3.js} +1 -1
  61. package/dist/web/assets/{cynefinDiagram-5FMLGOSQ-CkEacFFF.js → cynefinDiagram-5FMLGOSQ-CF2Eh0TH.js} +1 -1
  62. package/dist/web/assets/{dagre-GXQ25YYZ-Cpg1w4D6.js → dagre-GXQ25YYZ-DYyidWnQ.js} +1 -1
  63. package/dist/web/assets/{diagram-S7CK7UJ4-CxzdVKBq.js → diagram-S7CK7UJ4-DSBPkUpu.js} +1 -1
  64. package/dist/web/assets/{diagram-UQ7AKVKN-BtZLF6HT.js → diagram-UQ7AKVKN-V5xEYTHc.js} +1 -1
  65. package/dist/web/assets/{diagram-VSXAHHWV-fSwq53_o.js → diagram-VSXAHHWV-BECaFuc3.js} +1 -1
  66. package/dist/web/assets/{diagram-VX7I27RA-p_z4ar7w.js → diagram-VX7I27RA-21c8snpi.js} +1 -1
  67. package/dist/web/assets/{diagram-Z3DM3KII-DvIxMDwh.js → diagram-Z3DM3KII-C35HmHNH.js} +1 -1
  68. package/dist/web/assets/{ebnfDiagram-PWID7BFC-kUnSJleQ.js → ebnfDiagram-PWID7BFC-CITGP-Q9.js} +1 -1
  69. package/dist/web/assets/{engine-CuFplYJ5.js → engine-DUxyrccI.js} +4 -4
  70. package/dist/web/assets/{erDiagram-RLTQ6QDP-BRDWsV60.js → erDiagram-RLTQ6QDP-BP6F-Cwl.js} +1 -1
  71. package/dist/web/assets/eventmodeling-NTZA5JFV-50pr2V7m.js +1 -0
  72. package/dist/web/assets/flowDiagram-HODETNUW-ftQQEWxR.js +1 -0
  73. package/dist/web/assets/{ganttDiagram-EL5Y4UJY-DUOezeyk.js → ganttDiagram-EL5Y4UJY-Cakc1RCe.js} +1 -1
  74. package/dist/web/assets/{gitGraph-4MIJSDKK-DdGj4H6p.js → gitGraph-4MIJSDKK-CHB16fZf.js} +1 -1
  75. package/dist/web/assets/{gitGraphDiagram-WWUBYQGX-DQ_wu8-N.js → gitGraphDiagram-WWUBYQGX-CTd8KVPV.js} +1 -1
  76. package/dist/web/assets/{highlight-Coezwnqq.js → highlight-DJEaplpK.js} +1 -1
  77. package/dist/web/assets/icons-dCLC5DFa.js +1 -0
  78. package/dist/web/assets/index-CRb-14T4.css +1 -0
  79. package/dist/web/assets/index-lCAk_Rn7.js +74 -0
  80. package/dist/web/assets/{info-A6RAGUB7-bzlyOEbS.js → info-A6RAGUB7-BCmSXR4J.js} +1 -1
  81. package/dist/web/assets/{infoDiagram-27XIBGKW-DMPIkM67.js → infoDiagram-27XIBGKW-kmLXHL0B.js} +1 -1
  82. package/dist/web/assets/{ishikawaDiagram-5VMMS53U-Dn1_RFxe.js → ishikawaDiagram-5VMMS53U-T3d1OORv.js} +1 -1
  83. package/dist/web/assets/{journeyDiagram-3NMN7TZE-BZNgHBt7.js → journeyDiagram-3NMN7TZE-IRnndJxa.js} +1 -1
  84. package/dist/web/assets/jsxRuntime-DJRCfs_u.js +5 -0
  85. package/dist/web/assets/{kanban-definition-UXKFOSKX-5UeB0sIz.js → kanban-definition-UXKFOSKX-D81-nCTe.js} +1 -1
  86. package/dist/web/assets/{line-CESetX3B.js → line-BBeV3vfV.js} +1 -1
  87. package/dist/web/assets/{mermaid-parser.core-9beuOH8q.js → mermaid-parser.core-xZ2WHlRI.js} +3 -3
  88. package/dist/web/assets/{mindmap-definition-YA3MSWOX-BgWvbpzs.js → mindmap-definition-YA3MSWOX-Ho6e6jVr.js} +1 -1
  89. package/dist/web/assets/{packet-AYTQ26CC-Clm_VEbL.js → packet-AYTQ26CC-B9pSVRWc.js} +1 -1
  90. package/dist/web/assets/{pegDiagram-XKGWAZYB-D78fyGXR.js → pegDiagram-XKGWAZYB-CTXTBWF0.js} +1 -1
  91. package/dist/web/assets/{pie-WAS4IAKB-BjnIB8bI.js → pie-WAS4IAKB-Bga9YnnI.js} +1 -1
  92. package/dist/web/assets/{pieDiagram-E7YTZNPT-k3CAPrzW.js → pieDiagram-E7YTZNPT-DVVSLq99.js} +1 -1
  93. package/dist/web/assets/{quadrantDiagram-AXDQQJYC-Cj3pONTC.js → quadrantDiagram-AXDQQJYC-B83E3PUh.js} +1 -1
  94. package/dist/web/assets/{radar-RG4KPBEZ-BHTSDlOu.js → radar-RG4KPBEZ-u8zRwuLC.js} +1 -1
  95. package/dist/web/assets/{railroad-74A4TZTK-D2sY5w8h.js → railroad-74A4TZTK-D9v6vBft.js} +1 -1
  96. package/dist/web/assets/railroad-abnf-HS5TGJTU-DkFG-50O.js +1 -0
  97. package/dist/web/assets/railroad-ebnf-LZEXJU2U-CBTuWFTA.js +1 -0
  98. package/dist/web/assets/railroad-peg-WCYAUIDC-CdSnH_fA.js +1 -0
  99. package/dist/web/assets/{railroadDiagram-O6MQD6OU-De99_Cdp.js → railroadDiagram-O6MQD6OU-qU8L_T9G.js} +1 -1
  100. package/dist/web/assets/{requirementDiagram-BXWQKSXE-plwNdlUu.js → requirementDiagram-BXWQKSXE-DbGVadzP.js} +1 -1
  101. package/dist/web/assets/{sankeyDiagram-P5KCCOFB-BLX5pbzb.js → sankeyDiagram-P5KCCOFB-DjF_6wxm.js} +1 -1
  102. package/dist/web/assets/{sequenceDiagram-WJ2MYXX4-D5L3ResV.js → sequenceDiagram-WJ2MYXX4-ACVlOZ_E.js} +1 -1
  103. package/dist/web/assets/shared-BaCxhGEp.js +1 -0
  104. package/dist/web/assets/{stateDiagram-D77RDMKH-B_PLcigs.js → stateDiagram-D77RDMKH-gO6dN_6c.js} +1 -1
  105. package/dist/web/assets/stateDiagram-v2-MP3YSRHH-Bmk6g5Wx.js +1 -0
  106. package/dist/web/assets/{swimlanes-42K2YHIH-BCoy3JfH.js → swimlanes-42K2YHIH-DChgukPo.js} +1 -1
  107. package/dist/web/assets/swimlanesDiagram-VR7AAH4N-CPdgOMx5.js +8 -0
  108. package/dist/web/assets/{timeline-definition-24CTP7MA-Dz0_qjiL.js → timeline-definition-24CTP7MA-BOJKAXQm.js} +1 -1
  109. package/dist/web/assets/{treeView-Q6P3EWNA-rMSggC0A.js → treeView-Q6P3EWNA-DDk_V5T-.js} +1 -1
  110. package/dist/web/assets/{treemap-WGGIJYW6-DSgqT8Si.js → treemap-WGGIJYW6-gSJ9NeJF.js} +1 -1
  111. package/dist/web/assets/{vennDiagram-4TSXK5OY-OZgwexj9.js → vennDiagram-4TSXK5OY-pztSs7q3.js} +1 -1
  112. package/dist/web/assets/view-BByXcA5W.js +1 -0
  113. package/dist/web/assets/view-BOCBCjVE.js +2 -0
  114. package/dist/web/assets/view-CuotKs3K.js +1 -0
  115. package/dist/web/assets/{view-DCdLCLXZ.js → view-D1FOOnH2.js} +2 -2
  116. package/dist/web/assets/{view-DCcRnXKN.js → view-DL9H44DY.js} +1 -1
  117. package/dist/web/assets/{view-PaHzu9kV.js → view-DzGOmq2Y.js} +2 -2
  118. package/dist/web/assets/view-Lqn7oIjv.js +1 -0
  119. package/dist/web/assets/{view-BYuuM7qn.js → view-wUX2CVZB.js} +1 -1
  120. package/dist/web/assets/view-xJC-nbhd.js +1 -0
  121. package/dist/web/assets/{wardley-WFR3VGLG-BXO-hnJx.js → wardley-WFR3VGLG-CZ8Fuv6x.js} +1 -1
  122. package/dist/web/assets/{wardleyDiagram-VM6X3IG4-CJ_kVeKc.js → wardleyDiagram-VM6X3IG4-BPDY9aCw.js} +1 -1
  123. package/dist/web/assets/{xychartDiagram-S5SC5T6Z-DULIcOoX.js → xychartDiagram-S5SC5T6Z-DTGZgbYf.js} +1 -1
  124. package/dist/web/index.html +6 -4
  125. package/package.json +3 -3
  126. package/dist/web/assets/AgentPicker-vmCkZAEg.js +0 -1
  127. package/dist/web/assets/AgentsModal-SDE7h8Ov.js +0 -2
  128. package/dist/web/assets/BtwPanel-C3is5T--.js +0 -1
  129. package/dist/web/assets/SettingsModal-CcH378D6.js +0 -1
  130. package/dist/web/assets/architecture-7GRP2DOG-Bsf7Btg2.js +0 -1
  131. package/dist/web/assets/channel-DagxYswy.js +0 -1
  132. package/dist/web/assets/classDiagram-ZZMXUADV-DKXTlMcs.js +0 -1
  133. package/dist/web/assets/classDiagram-v2-VYDZK3BY-DKXTlMcs.js +0 -1
  134. package/dist/web/assets/eventmodeling-NTZA5JFV-B9LemJL3.js +0 -1
  135. package/dist/web/assets/flowDiagram-HODETNUW-Dr1bc3bC.js +0 -1
  136. package/dist/web/assets/icons-BuSI35ng.js +0 -1
  137. package/dist/web/assets/index-DFURIQeX.js +0 -75
  138. package/dist/web/assets/index-Duk7lhBO.css +0 -1
  139. package/dist/web/assets/jsxRuntime-B237YiZZ.js +0 -5
  140. package/dist/web/assets/railroad-abnf-HS5TGJTU-By7JhmIc.js +0 -1
  141. package/dist/web/assets/railroad-ebnf-LZEXJU2U-XSOf4PPv.js +0 -1
  142. package/dist/web/assets/railroad-peg-WCYAUIDC-Bj0KcXv3.js +0 -1
  143. package/dist/web/assets/shared-sr65xU-a.js +0 -1
  144. package/dist/web/assets/stateDiagram-v2-MP3YSRHH-Cgy-1bb9.js +0 -1
  145. package/dist/web/assets/swimlanesDiagram-VR7AAH4N-DECB5qyv.js +0 -8
  146. package/dist/web/assets/view-0w3H4M8J.js +0 -2
  147. package/dist/web/assets/view-CFknHmXR.js +0 -1
  148. package/dist/web/assets/view-CtWHa3Z4.js +0 -1
  149. package/dist/web/assets/view-DMJ8HX8Y.js +0 -1
@@ -1 +1 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{c as e}from"./mermaid-parser.core-9beuOH8q.js";export{e as createTreeViewServices};
1
+ import"./chunk-FOHPRMQF-DzxwRta7.js";import{c as e}from"./mermaid-parser.core-xZ2WHlRI.js";export{e as createTreeViewServices};
@@ -1 +1 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{o as e}from"./mermaid-parser.core-9beuOH8q.js";export{e as createTreemapServices};
1
+ import"./chunk-FOHPRMQF-DzxwRta7.js";import{o as e}from"./mermaid-parser.core-xZ2WHlRI.js";export{e as createTreemapServices};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{p as t}from"./src-B6xuSHsQ.js";import{$ as n,H as r,K as i,U as a,a as o,b as s,c,et as l,f as u,nt as d,tt as f,v as p,w as m,y as h}from"./chunk-DU6HZSFF-BJuBFcwd.js";import{i as g}from"./chunk-75Z2AOVW-DFYQUeQA.js";import{t as _}from"./rough.esm-Dy-Kn_BL.js";import{f as v}from"./engine-CuFplYJ5.js";var y=(e,t)=>f(e,`a`,-t),b=1e-10;function x(e,t){let n=C(e),r=n.filter(t=>S(t,e)),i=0,a=0,o=[];if(r.length>1){let t=O(r);for(let e=0;e<r.length;++e){let n=r[e];n.angle=Math.atan2(n.x-t.x,n.y-t.y)}r.sort((e,t)=>t.angle-e.angle);let n=r[r.length-1];for(let t=0;t<r.length;++t){let s=r[t];a+=(n.x+s.x)*(s.y-n.y);let c={x:(s.x+n.x)/2,y:(s.y+n.y)/2},l=null;for(let t=0;t<s.parentIndex.length;++t)if(n.parentIndex.includes(s.parentIndex[t])){let r=e[s.parentIndex[t]],i=Math.atan2(s.x-r.x,s.y-r.y),a=Math.atan2(n.x-r.x,n.y-r.y),o=a-i;o<0&&(o+=2*Math.PI);let u=a-o/2,d=T(c,{x:r.x+r.radius*Math.sin(u),y:r.y+r.radius*Math.cos(u)});d>r.radius*2&&(d=r.radius*2),(l==null||l.width>d)&&(l={circle:r,width:d,p1:s,p2:n,large:d>r.radius,sweep:!0})}l!=null&&(o.push(l),i+=w(l.circle.radius,l.width),n=s)}}else{let t=e[0];for(let n=1;n<e.length;++n)e[n].radius<t.radius&&(t=e[n]);let n=!1;for(let r=0;r<e.length;++r)if(T(e[r],t)>Math.abs(t.radius-e[r].radius)){n=!0;break}n?i=a=0:(i=t.radius*t.radius*Math.PI,o.push({circle:t,p1:{x:t.x,y:t.y+t.radius},p2:{x:t.x-b,y:t.y+t.radius},width:t.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=i+a,t.arcArea=i,t.polygonArea=a,t.arcs=o,t.innerPoints=r,t.intersectionPoints=n),i+a}function S(e,t){return t.every(t=>T(e,t)<t.radius+b)}function C(e){let t=[];for(let n=0;n<e.length;++n)for(let r=n+1;r<e.length;++r){let i=D(e[n],e[r]);for(let e of i)e.parentIndex=[n,r],t.push(e)}return t}function w(e,t){return e*e*Math.acos(1-t/e)-(e-t)*Math.sqrt(t*(2*e-t))}function T(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}function E(e,t,n){if(n>=e+t)return 0;if(n<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let r=e-(n*n-t*t+e*e)/(2*n),i=t-(n*n-e*e+t*t)/(2*n);return w(e,r)+w(t,i)}function D(e,t){let n=T(e,t),r=e.radius,i=t.radius;if(n>=r+i||n<=Math.abs(r-i))return[];let a=(r*r-i*i+n*n)/(2*n),o=Math.sqrt(r*r-a*a),s=e.x+a*(t.x-e.x)/n,c=e.y+a*(t.y-e.y)/n,l=-(t.y-e.y)*(o/n),u=-(t.x-e.x)*(o/n);return[{x:s+l,y:c-u},{x:s-l,y:c+u}]}function O(e){let t={x:0,y:0};for(let n of e)t.x+=n.x,t.y+=n.y;return t.x/=e.length,t.y/=e.length,t}function k(e,t,n,r){r||={};let i=r.maxIterations||100,a=r.tolerance||1e-10,o=e(t),s=e(n),c=n-t;if(o*s>0)throw`Initial bisect points must have opposite signs`;if(o===0)return t;if(s===0)return n;for(let n=0;n<i;++n){c/=2;let n=t+c,r=e(n);if(r*o>=0&&(t=n),Math.abs(c)<a||r===0)return n}return t+c}function A(e){let t=Array(e);for(let n=0;n<e;++n)t[n]=0;return t}function j(e,t){return A(e).map(()=>A(t))}function M(e,t){let n=0;for(let r=0;r<e.length;++r)n+=e[r]*t[r];return n}function N(e){return Math.sqrt(M(e,e))}function P(e,t,n){for(let r=0;r<t.length;++r)e[r]=t[r]*n}function F(e,t,n,r,i){for(let a=0;a<e.length;++a)e[a]=t*n[a]+r*i[a]}function I(e,t,n){n||={};let r=n.maxIterations||t.length*200,i=n.nonZeroDelta||1.05,a=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,s=n.minErrorDelta||1e-5,c=n.rho===void 0?1:n.rho,l=n.chi===void 0?2:n.chi,u=n.psi===void 0?-.5:n.psi,d=n.sigma===void 0?.5:n.sigma,f,p=t.length,m=Array(p+1);m[0]=t,m[0].fx=e(t),m[0].id=0;for(let n=0;n<p;++n){let r=t.slice();r[n]=r[n]?r[n]*i:a,m[n+1]=r,m[n+1].fx=e(r),m[n+1].id=n+1}function h(e){for(let t=0;t<e.length;t++)m[p][t]=e[t];m[p].fx=e.fx}let g=(e,t)=>e.fx-t.fx,_=t.slice(),v=t.slice(),y=t.slice(),b=t.slice();for(let t=0;t<r;++t){if(m.sort(g),n.history){let e=m.map(e=>{let t=e.slice();return t.fx=e.fx,t.id=e.id,t});e.sort((e,t)=>e.id-t.id),n.history.push({x:m[0].slice(),fx:m[0].fx,simplex:e})}f=0;for(let e=0;e<p;++e)f=Math.max(f,Math.abs(m[0][e]-m[1][e]));if(Math.abs(m[0].fx-m[p].fx)<o&&f<s)break;for(let e=0;e<p;++e){_[e]=0;for(let t=0;t<p;++t)_[e]+=m[t][e];_[e]/=p}let t=m[p];if(F(v,1+c,_,-c,t),v.fx=e(v),v.fx<m[0].fx)F(b,1+l,_,-l,t),b.fx=e(b),b.fx<v.fx?h(b):h(v);else if(v.fx>=m[p-1].fx){let n=!1;if(v.fx>t.fx?(F(y,1+u,_,-u,t),y.fx=e(y),y.fx<t.fx?h(y):n=!0):(F(y,1-u*c,_,u*c,t),y.fx=e(y),y.fx<v.fx?h(y):n=!0),n){if(d>=1)break;for(let t=1;t<m.length;++t)F(m[t],1-d,m[0],d,m[t]),m[t].fx=e(m[t])}}else h(v)}return m.sort(g),{fx:m[0].fx,x:m[0]}}function L(e,t,n,r,i,a,o){let s=n.fx,c=M(n.fxprime,t),l=s,u=s,d=c,f=0;i||=1,a||=1e-6,o||=.1;function p(u,f,p){for(let m=0;m<16;++m)if(i=(u+f)/2,F(r.x,1,n.x,i,t),l=r.fx=e(r.x,r.fxprime),d=M(r.fxprime,t),l>s+a*i*c||l>=p)f=i;else{if(Math.abs(d)<=-o*c)return i;d*(f-u)>=0&&(f=u),u=i,p=l}return 0}for(let m=0;m<10;++m){if(F(r.x,1,n.x,i,t),l=r.fx=e(r.x,r.fxprime),d=M(r.fxprime,t),l>s+a*i*c||m&&l>=u)return p(f,i,u);if(Math.abs(d)<=-o*c)return i;if(d>=0)return p(i,f,l);u=l,f=i,i*=2}return i}function R(e,t,n){let r={x:t.slice(),fx:0,fxprime:t.slice()},i={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),o,s,c=1,l;n||={},l=n.maxIterations||t.length*20,r.fx=e(r.x,r.fxprime),o=r.fxprime.slice(),P(o,r.fxprime,-1);for(let t=0;t<l;++t){if(c=L(e,o,r,i,c),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),!c)P(o,r.fxprime,-1);else{F(a,1,i.fxprime,-1,r.fxprime);let e=M(r.fxprime,r.fxprime),t=Math.max(0,M(a,i.fxprime)/e);F(o,t,o,-1,i.fxprime),s=r,r=i,i=s}if(N(r.fxprime)<=1e-5)break}return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),r}function ee(e,t={}){t.maxIterations=t.maxIterations||500;let n=t.initialLayout||ae,r=t.lossFunction||B,i=ne(e,t),a=n(i,t),o=Object.keys(a),s=[];for(let e of o)s.push(a[e].x),s.push(a[e].y);let c=I(e=>{let t={};for(let n=0;n<o.length;++n){let r=o[n];t[r]={x:e[2*n],y:e[2*n+1],radius:a[r].radius}}return r(t,i)},s,t).x;for(let e=0;e<o.length;++e){let t=o[e];a[t].x=c[2*e],a[t].y=c[2*e+1]}return a}var te=1e-10;function z(e,t,n){return Math.min(e,t)*Math.min(e,t)*Math.PI<=n+te?Math.abs(e-t):k(r=>E(e,t,r)-n,0,e+t)}function ne(e,t={}){let n=t.distinct,r=e.map(e=>Object.assign({},e));function i(e){return e.join(`;`)}if(n){let e=new Map;for(let t of r)for(let n=0;n<t.sets.length;n++){let r=String(t.sets[n]);e.set(r,t.size+(e.get(r)||0));for(let i=n+1;i<t.sets.length;i++){let n=String(t.sets[i]),a=`${r};${n}`,o=`${n};${r}`;e.set(a,t.size+(e.get(a)||0)),e.set(o,t.size+(e.get(o)||0))}}for(let t of r)t.sets.length<3&&(t.size=e.get(i(t.sets)))}let a=[],o=new Set;for(let e of r)if(e.sets.length===1)a.push(e.sets[0]);else if(e.sets.length===2){let t=e.sets[0],n=e.sets[1];o.add(i(e.sets)),o.add(i([n,t]))}a.sort((e,t)=>e===t?0:e<t?-1:1);for(let e=0;e<a.length;++e){let t=a[e];for(let n=e+1;n<a.length;++n){let e=a[n];o.has(i([t,e]))||r.push({sets:[t,e],size:0})}}return r}function re(e,t,n){let r=j(t.length,t.length),i=j(t.length,t.length);return e.filter(e=>e.sets.length===2).forEach(e=>{let a=n[e.sets[0]],o=n[e.sets[1]],s=z(Math.sqrt(t[a].size/Math.PI),Math.sqrt(t[o].size/Math.PI),e.size);r[a][o]=r[o][a]=s;let c=0;e.size+1e-10>=Math.min(t[a].size,t[o].size)?c=1:e.size<=1e-10&&(c=-1),i[a][o]=i[o][a]=c}),{distances:r,constraints:i}}function ie(e,t,n,r){for(let e=0;e<t.length;++e)t[e]=0;let i=0;for(let a=0;a<n.length;++a){let o=e[2*a],s=e[2*a+1];for(let c=a+1;c<n.length;++c){let l=e[2*c],u=e[2*c+1],d=n[a][c],f=r[a][c],p=(l-o)*(l-o)+(u-s)*(u-s),m=Math.sqrt(p),h=p-d*d;f>0&&m<=d||f<0&&m>=d||(i+=2*h*h,t[2*a]+=4*h*(o-l),t[2*a+1]+=4*h*(s-u),t[2*c]+=4*h*(l-o),t[2*c+1]+=4*h*(u-s))}}return i}function ae(e,t={}){let n=se(e,t),r=t.lossFunction||B;if(e.length>=8){let i=oe(e,t),a=r(i,e),o=r(n,e);a+1e-8<o&&(n=i)}return n}function oe(e,t={}){let n=t.restarts||10,r=[],i={};for(let t of e)t.sets.length===1&&(i[t.sets[0]]=r.length,r.push(t));let{distances:a,constraints:o}=re(e,r,i),s=N(a.map(N))/a.length;a=a.map(e=>e.map(e=>e/s));let c=(e,t)=>ie(e,t,a,o),l=null;for(let e=0;e<n;++e){let e=R(c,A(a.length*2).map(Math.random),t);(!l||e.fx<l.fx)&&(l=e)}let u=l.x,d={};for(let e=0;e<r.length;++e){let t=r[e];d[t.sets[0]]={x:u[2*e]*s,y:u[2*e+1]*s,radius:Math.sqrt(t.size/Math.PI)}}if(t.history)for(let e of t.history)P(e.x,s);return d}function se(e,t){let n=t&&t.lossFunction?t.lossFunction:B,r={},i={};for(let t of e)if(t.sets.length===1){let e=t.sets[0];r[e]={x:1e10,y:1e10,rowid:r.length,size:t.size,radius:Math.sqrt(t.size/Math.PI)},i[e]=[]}e=e.filter(e=>e.sets.length===2);for(let t of e){let e=t.weight==null?1:t.weight,n=t.sets[0],a=t.sets[1];t.size+te>=Math.min(r[n].size,r[a].size)&&(e=0),i[n].push({set:a,size:t.size,weight:e}),i[a].push({set:n,size:t.size,weight:e})}let a=[];Object.keys(i).forEach(e=>{let t=0;for(let n=0;n<i[e].length;++n)t+=i[e][n].size*i[e][n].weight;a.push({set:e,size:t})});function o(e,t){return t.size-e.size}a.sort(o);let s={};function c(e){return e.set in s}function l(e,t){r[t].x=e.x,r[t].y=e.y,s[t]=!0}l({x:0,y:0},a[0].set);for(let t=1;t<a.length;++t){let s=a[t].set,d=i[s].filter(c),f=r[s];if(d.sort(o),d.length===0)throw`ERROR: missing pairwise overlap information`;let p=[];for(var u=0;u<d.length;++u){let e=r[d[u].set],t=z(f.radius,e.radius,d[u].size);p.push({x:e.x+t,y:e.y}),p.push({x:e.x-t,y:e.y}),p.push({y:e.y+t,x:e.x}),p.push({y:e.y-t,x:e.x});for(let n=u+1;n<d.length;++n){let i=r[d[n].set],a=z(f.radius,i.radius,d[n].size),o=D({x:e.x,y:e.y,radius:t},{x:i.x,y:i.y,radius:a});p.push(...o)}}let m=1e50,h=p[0];for(let t of p){r[s].x=t.x,r[s].y=t.y;let i=n(r,e);i<m&&(m=i,h=t)}l(h,s)}return r}function B(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=E(n.radius,i.radius,T(n,i))}else t=x(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight;n+=i*(t-r.size)*(t-r.size)}return n}function ce(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=E(n.radius,i.radius,T(n,i))}else t=x(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight,a=Math.log((t+1)/(r.size+1));n+=i*a*a}return n}function le(e,t,n){if(n==null?e.sort((e,t)=>t.radius-e.radius):e.sort(n),e.length>0){let t=e[0].x,n=e[0].y;for(let r of e)r.x-=t,r.y-=n}if(e.length===2&&T(e[0],e[1])<Math.abs(e[1].radius-e[0].radius)&&(e[1].x=e[0].x+e[0].radius-e[1].radius-1e-10,e[1].y=e[0].y),e.length>1){let n=Math.atan2(e[1].x,e[1].y)-t,r=Math.cos(n),i=Math.sin(n);for(let t of e){let e=t.x,n=t.y;t.x=r*e-i*n,t.y=i*e+r*n}}if(e.length>2){let n=Math.atan2(e[2].x,e[2].y)-t;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){let t=e[1].y/(1e-10+e[1].x);for(let n of e){var r=(n.x+t*n.y)/(1+t*t);n.x=2*r-n.x,n.y=2*r*t-n.y}}}}function ue(e){e.forEach(e=>{e.parent=e});function t(e){return e.parent!==e&&(e.parent=t(e.parent)),e.parent}function n(e,n){let r=t(e);r.parent=t(n)}for(let t=0;t<e.length;++t)for(let r=t+1;r<e.length;++r){let i=e[t].radius+e[r].radius;T(e[t],e[r])+1e-10<i&&n(e[r],e[t])}let r=new Map;for(let n=0;n<e.length;++n){let i=t(e[n]).parent.setid;r.has(i)||r.set(i,[]),r.get(i).push(e[n])}return e.forEach(e=>{delete e.parent}),Array.from(r.values())}function V(e){let t=t=>({max:e.reduce((e,n)=>Math.max(e,n[t]+n.radius),-1/0),min:e.reduce((e,n)=>Math.min(e,n[t]-n.radius),1/0)});return{xRange:t(`x`),yRange:t(`y`)}}function de(e,t,n){t??=Math.PI/2;let r=me(e).map(e=>Object.assign({},e)),i=ue(r);for(let e of i){le(e,t,n);let r=V(e);e.size=(r.xRange.max-r.xRange.min)*(r.yRange.max-r.yRange.min),e.bounds=r}i.sort((e,t)=>t.size-e.size),r=i[0];let a=r.bounds,o=(a.xRange.max-a.xRange.min)/50;function s(e,t,n){if(!e)return;let i=e.bounds,s,c;if(t)s=a.xRange.max-i.xRange.min+o;else{s=a.xRange.max-i.xRange.max;let e=(i.xRange.max-i.xRange.min)/2-(a.xRange.max-a.xRange.min)/2;e<0&&(s+=e)}if(n)c=a.yRange.max-i.yRange.min+o;else{c=a.yRange.max-i.yRange.max;let e=(i.yRange.max-i.yRange.min)/2-(a.yRange.max-a.yRange.min)/2;e<0&&(c+=e)}for(let t of e)t.x+=s,t.y+=c,r.push(t)}let c=1;for(;c<i.length;)s(i[c],!0,!1),s(i[c+1],!1,!0),s(i[c+2],!0,!0),c+=3,a=V(r);return pe(r)}function fe(e,t,n,r,i){let a=me(e);t-=2*r,n-=2*r;let{xRange:o,yRange:s}=V(a);if(o.max===o.min||s.max===s.min)return console.log(`not scaling solution: zero size detected`),e;let c,l;if(i){let e=Math.sqrt(i/Math.PI)*2;c=t/e,l=n/e}else c=t/(o.max-o.min),l=n/(s.max-s.min);let u=Math.min(l,c),d=(t-(o.max-o.min)*u)/2,f=(n-(s.max-s.min)*u)/2;return pe(a.map(e=>({radius:u*e.radius,x:r+d+(e.x-o.min)*u,y:r+f+(e.y-s.min)*u,setid:e.setid})))}function pe(e){let t={};for(let n of e)t[n.setid]=n;return t}function me(e){return Object.keys(e).map(t=>Object.assign(e[t],{setid:t}))}function he(e={}){let t=!1,n=600,r=350,i=15,a=1e3,o=Math.PI/2,s=!0,c=null,l=!0,u=!0,d=null,f=null,p=!1,m=null,h=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,g={},_=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:[`#1f77b4`,`#ff7f0e`,`#2ca02c`,`#d62728`,`#9467bd`,`#8c564b`,`#e377c2`,`#7f7f7f`,`#bcbd22`,`#17becf`],v=0,y=function(e){if(e in g)return g[e];var t=g[e]=_[v];return v+=1,v>=_.length&&(v=0),t},b=ee,x=B;function S(g){let _=g.datum(),v=new Set;_.forEach(e=>{e.size==0&&e.sets.length==1&&v.add(e.sets[0])}),_=_.filter(e=>!e.sets.some(e=>v.has(e)));let S={},C={};if(_.length>0){let e=b(_,{lossFunction:x,distinct:p});s&&(e=de(e,o,f)),S=fe(e,n,r,i,c),C=ve(S,_,h)}let w={};_.forEach(e=>{e.label&&(w[e.sets]=e.label)});function T(e){if(e.sets in w)return w[e.sets];if(e.sets.length==1)return``+e.sets[0]}g.selectAll(`svg`).data([S]).enter().append(`svg`);let E=g.select(`svg`);t?E.attr(`viewBox`,`0 0 ${n} ${r}`):E.attr(`width`,n).attr(`height`,r);let D={},O=!1;E.selectAll(`.venn-area path`).each(function(e){let t=this.getAttribute(`d`);e.sets.length==1&&t&&!p&&(O=!0,D[e.sets[0]]=be(t))});function k(e){return t=>Ce(e.sets.map(e=>{let i=D[e],a=S[e];return i||={x:n/2,y:r/2,radius:1},a||={x:n/2,y:r/2,radius:1},{x:i.x*(1-t)+a.x*t,y:i.y*(1-t)+a.y*t,radius:i.radius*(1-t)+a.radius*t}}),m)}let A=E.selectAll(`.venn-area`).data(_,e=>e.sets),j=A.enter().append(`g`).attr(`class`,e=>`venn-area venn-${e.sets.length==1?`circle`:`intersection`}${e.colour||e.color?` venn-coloured`:``}`).attr(`data-venn-sets`,e=>e.sets.join(`_`)),M=j.append(`path`),N=j.append(`text`).attr(`class`,`label`).text(e=>T(e)).attr(`text-anchor`,`middle`).attr(`dy`,`.35em`).attr(`x`,n/2).attr(`y`,r/2);u&&(M.style(`fill-opacity`,`0`).filter(e=>e.sets.length==1).style(`fill`,e=>e.colour?e.colour:e.color?e.color:y(e.sets)).style(`fill-opacity`,`.25`),N.style(`fill`,t=>t.colour||t.color?`#FFF`:e.textFill?e.textFill:t.sets.length==1?y(t.sets):`#444`));function P(e){return typeof e.transition==`function`?e.transition(`venn`).duration(a):e}let F=g;O&&typeof F.transition==`function`?(F=P(g),F.selectAll(`path`).attrTween(`d`,k)):F.selectAll(`path`).attr(`d`,e=>Ce(e.sets.map(e=>S[e])),m);let I=F.selectAll(`text`).filter(e=>e.sets in C).text(e=>T(e)).attr(`x`,e=>Math.floor(C[e.sets].x)).attr(`y`,e=>Math.floor(C[e.sets].y));l&&(O?`on`in I?I.on(`end`,H(S,T)):I.each(`end`,H(S,T)):I.each(H(S,T)));let L=P(A.exit()).remove();typeof A.transition==`function`&&L.selectAll(`path`).attrTween(`d`,k);let R=L.selectAll(`text`).attr(`x`,n/2).attr(`y`,r/2);return d!==null&&(N.style(`font-size`,`0px`),I.style(`font-size`,d),R.style(`font-size`,`0px`)),{circles:S,textCentres:C,nodes:A,enter:j,update:F,exit:L}}return S.wrap=function(e){return arguments.length?(l=e,S):l},S.useViewBox=function(){return t=!0,S},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.padding=function(e){return arguments.length?(i=e,S):i},S.distinct=function(e){return arguments.length?(p=e,S):p},S.colours=function(e){return arguments.length?(y=e,S):y},S.colors=function(e){return arguments.length?(y=e,S):y},S.fontSize=function(e){return arguments.length?(d=e,S):d},S.round=function(e){return arguments.length?(m=e,S):m},S.duration=function(e){return arguments.length?(a=e,S):a},S.layoutFunction=function(e){return arguments.length?(b=e,S):b},S.normalize=function(e){return arguments.length?(s=e,S):s},S.scaleToFit=function(e){return arguments.length?(c=e,S):c},S.styled=function(e){return arguments.length?(u=e,S):u},S.orientation=function(e){return arguments.length?(o=e,S):o},S.orientationOrder=function(e){return arguments.length?(f=e,S):f},S.lossFunction=function(e){return arguments.length?(x=e==="default"?B:e===`logRatio`?ce:e,S):x},S}function H(e,t){return function(n){let r=this,i=e[n.sets[0]].radius||50,a=t(n)||``,o=a.split(/\s+/).reverse(),s=(a.length+o.length)/3,c=o.pop(),l=[c],u=0,d=1.1;r.textContent=null;let f=[];function p(e){let t=r.ownerDocument.createElementNS(r.namespaceURI,`tspan`);return t.textContent=e,f.push(t),r.append(t),t}let m=p(c);for(;c=o.pop(),c;){l.push(c);let e=l.join(` `);m.textContent=e,e.length>s&&m.getComputedTextLength()>i&&(l.pop(),m.textContent=l.join(` `),l=[c],m=p(c),u++)}let h=.35-u*d/2,g=r.getAttribute(`x`),_=r.getAttribute(`y`);f.forEach((e,t)=>{e.setAttribute(`x`,g),e.setAttribute(`y`,_),e.setAttribute(`dy`,`${h+t*d}em`)})}}function U(e,t,n){let r=t[0].radius-T(t[0],e);for(let n=1;n<t.length;++n){let i=t[n].radius-T(t[n],e);i<=r&&(r=i)}for(let t=0;t<n.length;++t){let i=T(n[t],e)-n[t].radius;i<=r&&(r=i)}return r}function ge(e,t,n){let r=[];for(let t of e)r.push({x:t.x,y:t.y}),r.push({x:t.x+t.radius/2,y:t.y}),r.push({x:t.x-t.radius/2,y:t.y}),r.push({x:t.x,y:t.y+t.radius/2}),r.push({x:t.x,y:t.y-t.radius/2});let i=r[0],a=U(r[0],e,t);for(let n=1;n<r.length;++n){let o=U(r[n],e,t);o>=a&&(i=r[n],a=o)}let o=I(n=>-1*U({x:n[0],y:n[1]},e,t),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,s={x:n?0:o[0],y:o[1]},c=!0;for(let t of e)if(T(s,t)>t.radius){c=!1;break}for(let e of t)if(T(s,e)<e.radius){c=!1;break}if(c)return s;if(e.length==1)return{x:e[0].x,y:e[0].y};let l={};return x(e,l),l.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:l.arcs.length==1?{x:l.arcs[0].circle.x,y:l.arcs[0].circle.y}:t.length?ge(e,[]):O(l.arcs.map(e=>e.p1))}function _e(e){let t={},n=Object.keys(e);for(let e of n)t[e]=[];for(let r=0;r<n.length;r++){let i=n[r],a=e[i];for(let o=r+1;o<n.length;++o){let r=n[o],s=e[r],c=T(a,s);c+s.radius<=a.radius+1e-10?t[r].push(i):c+a.radius<=s.radius+1e-10&&t[i].push(r)}}return t}function ve(e,t,n){let r={},i=_e(e);for(let a=0;a<t.length;++a){let o=t[a].sets,s={},c={};for(let e=0;e<o.length;++e){s[o[e]]=!0;let t=i[o[e]];for(let e=0;e<t.length;++e)c[t[e]]=!0}let l=[],u=[];for(let t in e)t in s?l.push(e[t]):t in c||u.push(e[t]);let d=ge(l,u,n);r[o]=d,d.disjoint&&t[a].size>0&&console.log(`WARNING: area `+o+` not represented on screen`)}return r}function ye(e,t,n){let r=[];return r.push(`
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{p as t}from"./src-B6xuSHsQ.js";import{$ as n,H as r,K as i,U as a,a as o,b as s,c,et as l,f as u,nt as d,tt as f,v as p,w as m,y as h}from"./chunk-DU6HZSFF-CgtANb4X.js";import{i as g}from"./chunk-75Z2AOVW-BR8-_T1K.js";import{t as _}from"./rough.esm-Dy-Kn_BL.js";import{f as v}from"./engine-DUxyrccI.js";var y=(e,t)=>f(e,`a`,-t),b=1e-10;function x(e,t){let n=C(e),r=n.filter(t=>S(t,e)),i=0,a=0,o=[];if(r.length>1){let t=O(r);for(let e=0;e<r.length;++e){let n=r[e];n.angle=Math.atan2(n.x-t.x,n.y-t.y)}r.sort((e,t)=>t.angle-e.angle);let n=r[r.length-1];for(let t=0;t<r.length;++t){let s=r[t];a+=(n.x+s.x)*(s.y-n.y);let c={x:(s.x+n.x)/2,y:(s.y+n.y)/2},l=null;for(let t=0;t<s.parentIndex.length;++t)if(n.parentIndex.includes(s.parentIndex[t])){let r=e[s.parentIndex[t]],i=Math.atan2(s.x-r.x,s.y-r.y),a=Math.atan2(n.x-r.x,n.y-r.y),o=a-i;o<0&&(o+=2*Math.PI);let u=a-o/2,d=T(c,{x:r.x+r.radius*Math.sin(u),y:r.y+r.radius*Math.cos(u)});d>r.radius*2&&(d=r.radius*2),(l==null||l.width>d)&&(l={circle:r,width:d,p1:s,p2:n,large:d>r.radius,sweep:!0})}l!=null&&(o.push(l),i+=w(l.circle.radius,l.width),n=s)}}else{let t=e[0];for(let n=1;n<e.length;++n)e[n].radius<t.radius&&(t=e[n]);let n=!1;for(let r=0;r<e.length;++r)if(T(e[r],t)>Math.abs(t.radius-e[r].radius)){n=!0;break}n?i=a=0:(i=t.radius*t.radius*Math.PI,o.push({circle:t,p1:{x:t.x,y:t.y+t.radius},p2:{x:t.x-b,y:t.y+t.radius},width:t.radius*2,large:!0,sweep:!0}))}return a/=2,t&&(t.area=i+a,t.arcArea=i,t.polygonArea=a,t.arcs=o,t.innerPoints=r,t.intersectionPoints=n),i+a}function S(e,t){return t.every(t=>T(e,t)<t.radius+b)}function C(e){let t=[];for(let n=0;n<e.length;++n)for(let r=n+1;r<e.length;++r){let i=D(e[n],e[r]);for(let e of i)e.parentIndex=[n,r],t.push(e)}return t}function w(e,t){return e*e*Math.acos(1-t/e)-(e-t)*Math.sqrt(t*(2*e-t))}function T(e,t){return Math.sqrt((e.x-t.x)*(e.x-t.x)+(e.y-t.y)*(e.y-t.y))}function E(e,t,n){if(n>=e+t)return 0;if(n<=Math.abs(e-t))return Math.PI*Math.min(e,t)*Math.min(e,t);let r=e-(n*n-t*t+e*e)/(2*n),i=t-(n*n-e*e+t*t)/(2*n);return w(e,r)+w(t,i)}function D(e,t){let n=T(e,t),r=e.radius,i=t.radius;if(n>=r+i||n<=Math.abs(r-i))return[];let a=(r*r-i*i+n*n)/(2*n),o=Math.sqrt(r*r-a*a),s=e.x+a*(t.x-e.x)/n,c=e.y+a*(t.y-e.y)/n,l=-(t.y-e.y)*(o/n),u=-(t.x-e.x)*(o/n);return[{x:s+l,y:c-u},{x:s-l,y:c+u}]}function O(e){let t={x:0,y:0};for(let n of e)t.x+=n.x,t.y+=n.y;return t.x/=e.length,t.y/=e.length,t}function k(e,t,n,r){r||={};let i=r.maxIterations||100,a=r.tolerance||1e-10,o=e(t),s=e(n),c=n-t;if(o*s>0)throw`Initial bisect points must have opposite signs`;if(o===0)return t;if(s===0)return n;for(let n=0;n<i;++n){c/=2;let n=t+c,r=e(n);if(r*o>=0&&(t=n),Math.abs(c)<a||r===0)return n}return t+c}function A(e){let t=Array(e);for(let n=0;n<e;++n)t[n]=0;return t}function j(e,t){return A(e).map(()=>A(t))}function M(e,t){let n=0;for(let r=0;r<e.length;++r)n+=e[r]*t[r];return n}function N(e){return Math.sqrt(M(e,e))}function P(e,t,n){for(let r=0;r<t.length;++r)e[r]=t[r]*n}function F(e,t,n,r,i){for(let a=0;a<e.length;++a)e[a]=t*n[a]+r*i[a]}function I(e,t,n){n||={};let r=n.maxIterations||t.length*200,i=n.nonZeroDelta||1.05,a=n.zeroDelta||.001,o=n.minErrorDelta||1e-6,s=n.minErrorDelta||1e-5,c=n.rho===void 0?1:n.rho,l=n.chi===void 0?2:n.chi,u=n.psi===void 0?-.5:n.psi,d=n.sigma===void 0?.5:n.sigma,f,p=t.length,m=Array(p+1);m[0]=t,m[0].fx=e(t),m[0].id=0;for(let n=0;n<p;++n){let r=t.slice();r[n]=r[n]?r[n]*i:a,m[n+1]=r,m[n+1].fx=e(r),m[n+1].id=n+1}function h(e){for(let t=0;t<e.length;t++)m[p][t]=e[t];m[p].fx=e.fx}let g=(e,t)=>e.fx-t.fx,_=t.slice(),v=t.slice(),y=t.slice(),b=t.slice();for(let t=0;t<r;++t){if(m.sort(g),n.history){let e=m.map(e=>{let t=e.slice();return t.fx=e.fx,t.id=e.id,t});e.sort((e,t)=>e.id-t.id),n.history.push({x:m[0].slice(),fx:m[0].fx,simplex:e})}f=0;for(let e=0;e<p;++e)f=Math.max(f,Math.abs(m[0][e]-m[1][e]));if(Math.abs(m[0].fx-m[p].fx)<o&&f<s)break;for(let e=0;e<p;++e){_[e]=0;for(let t=0;t<p;++t)_[e]+=m[t][e];_[e]/=p}let t=m[p];if(F(v,1+c,_,-c,t),v.fx=e(v),v.fx<m[0].fx)F(b,1+l,_,-l,t),b.fx=e(b),b.fx<v.fx?h(b):h(v);else if(v.fx>=m[p-1].fx){let n=!1;if(v.fx>t.fx?(F(y,1+u,_,-u,t),y.fx=e(y),y.fx<t.fx?h(y):n=!0):(F(y,1-u*c,_,u*c,t),y.fx=e(y),y.fx<v.fx?h(y):n=!0),n){if(d>=1)break;for(let t=1;t<m.length;++t)F(m[t],1-d,m[0],d,m[t]),m[t].fx=e(m[t])}}else h(v)}return m.sort(g),{fx:m[0].fx,x:m[0]}}function L(e,t,n,r,i,a,o){let s=n.fx,c=M(n.fxprime,t),l=s,u=s,d=c,f=0;i||=1,a||=1e-6,o||=.1;function p(u,f,p){for(let m=0;m<16;++m)if(i=(u+f)/2,F(r.x,1,n.x,i,t),l=r.fx=e(r.x,r.fxprime),d=M(r.fxprime,t),l>s+a*i*c||l>=p)f=i;else{if(Math.abs(d)<=-o*c)return i;d*(f-u)>=0&&(f=u),u=i,p=l}return 0}for(let m=0;m<10;++m){if(F(r.x,1,n.x,i,t),l=r.fx=e(r.x,r.fxprime),d=M(r.fxprime,t),l>s+a*i*c||m&&l>=u)return p(f,i,u);if(Math.abs(d)<=-o*c)return i;if(d>=0)return p(i,f,l);u=l,f=i,i*=2}return i}function R(e,t,n){let r={x:t.slice(),fx:0,fxprime:t.slice()},i={x:t.slice(),fx:0,fxprime:t.slice()},a=t.slice(),o,s,c=1,l;n||={},l=n.maxIterations||t.length*20,r.fx=e(r.x,r.fxprime),o=r.fxprime.slice(),P(o,r.fxprime,-1);for(let t=0;t<l;++t){if(c=L(e,o,r,i,c),n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),!c)P(o,r.fxprime,-1);else{F(a,1,i.fxprime,-1,r.fxprime);let e=M(r.fxprime,r.fxprime),t=Math.max(0,M(a,i.fxprime)/e);F(o,t,o,-1,i.fxprime),s=r,r=i,i=s}if(N(r.fxprime)<=1e-5)break}return n.history&&n.history.push({x:r.x.slice(),fx:r.fx,fxprime:r.fxprime.slice(),alpha:c}),r}function ee(e,t={}){t.maxIterations=t.maxIterations||500;let n=t.initialLayout||ae,r=t.lossFunction||B,i=ne(e,t),a=n(i,t),o=Object.keys(a),s=[];for(let e of o)s.push(a[e].x),s.push(a[e].y);let c=I(e=>{let t={};for(let n=0;n<o.length;++n){let r=o[n];t[r]={x:e[2*n],y:e[2*n+1],radius:a[r].radius}}return r(t,i)},s,t).x;for(let e=0;e<o.length;++e){let t=o[e];a[t].x=c[2*e],a[t].y=c[2*e+1]}return a}var te=1e-10;function z(e,t,n){return Math.min(e,t)*Math.min(e,t)*Math.PI<=n+te?Math.abs(e-t):k(r=>E(e,t,r)-n,0,e+t)}function ne(e,t={}){let n=t.distinct,r=e.map(e=>Object.assign({},e));function i(e){return e.join(`;`)}if(n){let e=new Map;for(let t of r)for(let n=0;n<t.sets.length;n++){let r=String(t.sets[n]);e.set(r,t.size+(e.get(r)||0));for(let i=n+1;i<t.sets.length;i++){let n=String(t.sets[i]),a=`${r};${n}`,o=`${n};${r}`;e.set(a,t.size+(e.get(a)||0)),e.set(o,t.size+(e.get(o)||0))}}for(let t of r)t.sets.length<3&&(t.size=e.get(i(t.sets)))}let a=[],o=new Set;for(let e of r)if(e.sets.length===1)a.push(e.sets[0]);else if(e.sets.length===2){let t=e.sets[0],n=e.sets[1];o.add(i(e.sets)),o.add(i([n,t]))}a.sort((e,t)=>e===t?0:e<t?-1:1);for(let e=0;e<a.length;++e){let t=a[e];for(let n=e+1;n<a.length;++n){let e=a[n];o.has(i([t,e]))||r.push({sets:[t,e],size:0})}}return r}function re(e,t,n){let r=j(t.length,t.length),i=j(t.length,t.length);return e.filter(e=>e.sets.length===2).forEach(e=>{let a=n[e.sets[0]],o=n[e.sets[1]],s=z(Math.sqrt(t[a].size/Math.PI),Math.sqrt(t[o].size/Math.PI),e.size);r[a][o]=r[o][a]=s;let c=0;e.size+1e-10>=Math.min(t[a].size,t[o].size)?c=1:e.size<=1e-10&&(c=-1),i[a][o]=i[o][a]=c}),{distances:r,constraints:i}}function ie(e,t,n,r){for(let e=0;e<t.length;++e)t[e]=0;let i=0;for(let a=0;a<n.length;++a){let o=e[2*a],s=e[2*a+1];for(let c=a+1;c<n.length;++c){let l=e[2*c],u=e[2*c+1],d=n[a][c],f=r[a][c],p=(l-o)*(l-o)+(u-s)*(u-s),m=Math.sqrt(p),h=p-d*d;f>0&&m<=d||f<0&&m>=d||(i+=2*h*h,t[2*a]+=4*h*(o-l),t[2*a+1]+=4*h*(s-u),t[2*c]+=4*h*(l-o),t[2*c+1]+=4*h*(u-s))}}return i}function ae(e,t={}){let n=se(e,t),r=t.lossFunction||B;if(e.length>=8){let i=oe(e,t),a=r(i,e),o=r(n,e);a+1e-8<o&&(n=i)}return n}function oe(e,t={}){let n=t.restarts||10,r=[],i={};for(let t of e)t.sets.length===1&&(i[t.sets[0]]=r.length,r.push(t));let{distances:a,constraints:o}=re(e,r,i),s=N(a.map(N))/a.length;a=a.map(e=>e.map(e=>e/s));let c=(e,t)=>ie(e,t,a,o),l=null;for(let e=0;e<n;++e){let e=R(c,A(a.length*2).map(Math.random),t);(!l||e.fx<l.fx)&&(l=e)}let u=l.x,d={};for(let e=0;e<r.length;++e){let t=r[e];d[t.sets[0]]={x:u[2*e]*s,y:u[2*e+1]*s,radius:Math.sqrt(t.size/Math.PI)}}if(t.history)for(let e of t.history)P(e.x,s);return d}function se(e,t){let n=t&&t.lossFunction?t.lossFunction:B,r={},i={};for(let t of e)if(t.sets.length===1){let e=t.sets[0];r[e]={x:1e10,y:1e10,rowid:r.length,size:t.size,radius:Math.sqrt(t.size/Math.PI)},i[e]=[]}e=e.filter(e=>e.sets.length===2);for(let t of e){let e=t.weight==null?1:t.weight,n=t.sets[0],a=t.sets[1];t.size+te>=Math.min(r[n].size,r[a].size)&&(e=0),i[n].push({set:a,size:t.size,weight:e}),i[a].push({set:n,size:t.size,weight:e})}let a=[];Object.keys(i).forEach(e=>{let t=0;for(let n=0;n<i[e].length;++n)t+=i[e][n].size*i[e][n].weight;a.push({set:e,size:t})});function o(e,t){return t.size-e.size}a.sort(o);let s={};function c(e){return e.set in s}function l(e,t){r[t].x=e.x,r[t].y=e.y,s[t]=!0}l({x:0,y:0},a[0].set);for(let t=1;t<a.length;++t){let s=a[t].set,d=i[s].filter(c),f=r[s];if(d.sort(o),d.length===0)throw`ERROR: missing pairwise overlap information`;let p=[];for(var u=0;u<d.length;++u){let e=r[d[u].set],t=z(f.radius,e.radius,d[u].size);p.push({x:e.x+t,y:e.y}),p.push({x:e.x-t,y:e.y}),p.push({y:e.y+t,x:e.x}),p.push({y:e.y-t,x:e.x});for(let n=u+1;n<d.length;++n){let i=r[d[n].set],a=z(f.radius,i.radius,d[n].size),o=D({x:e.x,y:e.y,radius:t},{x:i.x,y:i.y,radius:a});p.push(...o)}}let m=1e50,h=p[0];for(let t of p){r[s].x=t.x,r[s].y=t.y;let i=n(r,e);i<m&&(m=i,h=t)}l(h,s)}return r}function B(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=E(n.radius,i.radius,T(n,i))}else t=x(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight;n+=i*(t-r.size)*(t-r.size)}return n}function ce(e,t){let n=0;for(let r of t){if(r.sets.length===1)continue;let t;if(r.sets.length===2){let n=e[r.sets[0]],i=e[r.sets[1]];t=E(n.radius,i.radius,T(n,i))}else t=x(r.sets.map(t=>e[t]));let i=r.weight==null?1:r.weight,a=Math.log((t+1)/(r.size+1));n+=i*a*a}return n}function le(e,t,n){if(n==null?e.sort((e,t)=>t.radius-e.radius):e.sort(n),e.length>0){let t=e[0].x,n=e[0].y;for(let r of e)r.x-=t,r.y-=n}if(e.length===2&&T(e[0],e[1])<Math.abs(e[1].radius-e[0].radius)&&(e[1].x=e[0].x+e[0].radius-e[1].radius-1e-10,e[1].y=e[0].y),e.length>1){let n=Math.atan2(e[1].x,e[1].y)-t,r=Math.cos(n),i=Math.sin(n);for(let t of e){let e=t.x,n=t.y;t.x=r*e-i*n,t.y=i*e+r*n}}if(e.length>2){let n=Math.atan2(e[2].x,e[2].y)-t;for(;n<0;)n+=2*Math.PI;for(;n>2*Math.PI;)n-=2*Math.PI;if(n>Math.PI){let t=e[1].y/(1e-10+e[1].x);for(let n of e){var r=(n.x+t*n.y)/(1+t*t);n.x=2*r-n.x,n.y=2*r*t-n.y}}}}function ue(e){e.forEach(e=>{e.parent=e});function t(e){return e.parent!==e&&(e.parent=t(e.parent)),e.parent}function n(e,n){let r=t(e);r.parent=t(n)}for(let t=0;t<e.length;++t)for(let r=t+1;r<e.length;++r){let i=e[t].radius+e[r].radius;T(e[t],e[r])+1e-10<i&&n(e[r],e[t])}let r=new Map;for(let n=0;n<e.length;++n){let i=t(e[n]).parent.setid;r.has(i)||r.set(i,[]),r.get(i).push(e[n])}return e.forEach(e=>{delete e.parent}),Array.from(r.values())}function V(e){let t=t=>({max:e.reduce((e,n)=>Math.max(e,n[t]+n.radius),-1/0),min:e.reduce((e,n)=>Math.min(e,n[t]-n.radius),1/0)});return{xRange:t(`x`),yRange:t(`y`)}}function de(e,t,n){t??=Math.PI/2;let r=me(e).map(e=>Object.assign({},e)),i=ue(r);for(let e of i){le(e,t,n);let r=V(e);e.size=(r.xRange.max-r.xRange.min)*(r.yRange.max-r.yRange.min),e.bounds=r}i.sort((e,t)=>t.size-e.size),r=i[0];let a=r.bounds,o=(a.xRange.max-a.xRange.min)/50;function s(e,t,n){if(!e)return;let i=e.bounds,s,c;if(t)s=a.xRange.max-i.xRange.min+o;else{s=a.xRange.max-i.xRange.max;let e=(i.xRange.max-i.xRange.min)/2-(a.xRange.max-a.xRange.min)/2;e<0&&(s+=e)}if(n)c=a.yRange.max-i.yRange.min+o;else{c=a.yRange.max-i.yRange.max;let e=(i.yRange.max-i.yRange.min)/2-(a.yRange.max-a.yRange.min)/2;e<0&&(c+=e)}for(let t of e)t.x+=s,t.y+=c,r.push(t)}let c=1;for(;c<i.length;)s(i[c],!0,!1),s(i[c+1],!1,!0),s(i[c+2],!0,!0),c+=3,a=V(r);return pe(r)}function fe(e,t,n,r,i){let a=me(e);t-=2*r,n-=2*r;let{xRange:o,yRange:s}=V(a);if(o.max===o.min||s.max===s.min)return console.log(`not scaling solution: zero size detected`),e;let c,l;if(i){let e=Math.sqrt(i/Math.PI)*2;c=t/e,l=n/e}else c=t/(o.max-o.min),l=n/(s.max-s.min);let u=Math.min(l,c),d=(t-(o.max-o.min)*u)/2,f=(n-(s.max-s.min)*u)/2;return pe(a.map(e=>({radius:u*e.radius,x:r+d+(e.x-o.min)*u,y:r+f+(e.y-s.min)*u,setid:e.setid})))}function pe(e){let t={};for(let n of e)t[n.setid]=n;return t}function me(e){return Object.keys(e).map(t=>Object.assign(e[t],{setid:t}))}function he(e={}){let t=!1,n=600,r=350,i=15,a=1e3,o=Math.PI/2,s=!0,c=null,l=!0,u=!0,d=null,f=null,p=!1,m=null,h=e&&e.symmetricalTextCentre?e.symmetricalTextCentre:!1,g={},_=e&&e.colourScheme?e.colourScheme:e&&e.colorScheme?e.colorScheme:[`#1f77b4`,`#ff7f0e`,`#2ca02c`,`#d62728`,`#9467bd`,`#8c564b`,`#e377c2`,`#7f7f7f`,`#bcbd22`,`#17becf`],v=0,y=function(e){if(e in g)return g[e];var t=g[e]=_[v];return v+=1,v>=_.length&&(v=0),t},b=ee,x=B;function S(g){let _=g.datum(),v=new Set;_.forEach(e=>{e.size==0&&e.sets.length==1&&v.add(e.sets[0])}),_=_.filter(e=>!e.sets.some(e=>v.has(e)));let S={},C={};if(_.length>0){let e=b(_,{lossFunction:x,distinct:p});s&&(e=de(e,o,f)),S=fe(e,n,r,i,c),C=ve(S,_,h)}let w={};_.forEach(e=>{e.label&&(w[e.sets]=e.label)});function T(e){if(e.sets in w)return w[e.sets];if(e.sets.length==1)return``+e.sets[0]}g.selectAll(`svg`).data([S]).enter().append(`svg`);let E=g.select(`svg`);t?E.attr(`viewBox`,`0 0 ${n} ${r}`):E.attr(`width`,n).attr(`height`,r);let D={},O=!1;E.selectAll(`.venn-area path`).each(function(e){let t=this.getAttribute(`d`);e.sets.length==1&&t&&!p&&(O=!0,D[e.sets[0]]=be(t))});function k(e){return t=>Ce(e.sets.map(e=>{let i=D[e],a=S[e];return i||={x:n/2,y:r/2,radius:1},a||={x:n/2,y:r/2,radius:1},{x:i.x*(1-t)+a.x*t,y:i.y*(1-t)+a.y*t,radius:i.radius*(1-t)+a.radius*t}}),m)}let A=E.selectAll(`.venn-area`).data(_,e=>e.sets),j=A.enter().append(`g`).attr(`class`,e=>`venn-area venn-${e.sets.length==1?`circle`:`intersection`}${e.colour||e.color?` venn-coloured`:``}`).attr(`data-venn-sets`,e=>e.sets.join(`_`)),M=j.append(`path`),N=j.append(`text`).attr(`class`,`label`).text(e=>T(e)).attr(`text-anchor`,`middle`).attr(`dy`,`.35em`).attr(`x`,n/2).attr(`y`,r/2);u&&(M.style(`fill-opacity`,`0`).filter(e=>e.sets.length==1).style(`fill`,e=>e.colour?e.colour:e.color?e.color:y(e.sets)).style(`fill-opacity`,`.25`),N.style(`fill`,t=>t.colour||t.color?`#FFF`:e.textFill?e.textFill:t.sets.length==1?y(t.sets):`#444`));function P(e){return typeof e.transition==`function`?e.transition(`venn`).duration(a):e}let F=g;O&&typeof F.transition==`function`?(F=P(g),F.selectAll(`path`).attrTween(`d`,k)):F.selectAll(`path`).attr(`d`,e=>Ce(e.sets.map(e=>S[e])),m);let I=F.selectAll(`text`).filter(e=>e.sets in C).text(e=>T(e)).attr(`x`,e=>Math.floor(C[e.sets].x)).attr(`y`,e=>Math.floor(C[e.sets].y));l&&(O?`on`in I?I.on(`end`,H(S,T)):I.each(`end`,H(S,T)):I.each(H(S,T)));let L=P(A.exit()).remove();typeof A.transition==`function`&&L.selectAll(`path`).attrTween(`d`,k);let R=L.selectAll(`text`).attr(`x`,n/2).attr(`y`,r/2);return d!==null&&(N.style(`font-size`,`0px`),I.style(`font-size`,d),R.style(`font-size`,`0px`)),{circles:S,textCentres:C,nodes:A,enter:j,update:F,exit:L}}return S.wrap=function(e){return arguments.length?(l=e,S):l},S.useViewBox=function(){return t=!0,S},S.width=function(e){return arguments.length?(n=e,S):n},S.height=function(e){return arguments.length?(r=e,S):r},S.padding=function(e){return arguments.length?(i=e,S):i},S.distinct=function(e){return arguments.length?(p=e,S):p},S.colours=function(e){return arguments.length?(y=e,S):y},S.colors=function(e){return arguments.length?(y=e,S):y},S.fontSize=function(e){return arguments.length?(d=e,S):d},S.round=function(e){return arguments.length?(m=e,S):m},S.duration=function(e){return arguments.length?(a=e,S):a},S.layoutFunction=function(e){return arguments.length?(b=e,S):b},S.normalize=function(e){return arguments.length?(s=e,S):s},S.scaleToFit=function(e){return arguments.length?(c=e,S):c},S.styled=function(e){return arguments.length?(u=e,S):u},S.orientation=function(e){return arguments.length?(o=e,S):o},S.orientationOrder=function(e){return arguments.length?(f=e,S):f},S.lossFunction=function(e){return arguments.length?(x=e==="default"?B:e===`logRatio`?ce:e,S):x},S}function H(e,t){return function(n){let r=this,i=e[n.sets[0]].radius||50,a=t(n)||``,o=a.split(/\s+/).reverse(),s=(a.length+o.length)/3,c=o.pop(),l=[c],u=0,d=1.1;r.textContent=null;let f=[];function p(e){let t=r.ownerDocument.createElementNS(r.namespaceURI,`tspan`);return t.textContent=e,f.push(t),r.append(t),t}let m=p(c);for(;c=o.pop(),c;){l.push(c);let e=l.join(` `);m.textContent=e,e.length>s&&m.getComputedTextLength()>i&&(l.pop(),m.textContent=l.join(` `),l=[c],m=p(c),u++)}let h=.35-u*d/2,g=r.getAttribute(`x`),_=r.getAttribute(`y`);f.forEach((e,t)=>{e.setAttribute(`x`,g),e.setAttribute(`y`,_),e.setAttribute(`dy`,`${h+t*d}em`)})}}function U(e,t,n){let r=t[0].radius-T(t[0],e);for(let n=1;n<t.length;++n){let i=t[n].radius-T(t[n],e);i<=r&&(r=i)}for(let t=0;t<n.length;++t){let i=T(n[t],e)-n[t].radius;i<=r&&(r=i)}return r}function ge(e,t,n){let r=[];for(let t of e)r.push({x:t.x,y:t.y}),r.push({x:t.x+t.radius/2,y:t.y}),r.push({x:t.x-t.radius/2,y:t.y}),r.push({x:t.x,y:t.y+t.radius/2}),r.push({x:t.x,y:t.y-t.radius/2});let i=r[0],a=U(r[0],e,t);for(let n=1;n<r.length;++n){let o=U(r[n],e,t);o>=a&&(i=r[n],a=o)}let o=I(n=>-1*U({x:n[0],y:n[1]},e,t),[i.x,i.y],{maxIterations:500,minErrorDelta:1e-10}).x,s={x:n?0:o[0],y:o[1]},c=!0;for(let t of e)if(T(s,t)>t.radius){c=!1;break}for(let e of t)if(T(s,e)<e.radius){c=!1;break}if(c)return s;if(e.length==1)return{x:e[0].x,y:e[0].y};let l={};return x(e,l),l.arcs.length===0?{x:0,y:-1e3,disjoint:!0}:l.arcs.length==1?{x:l.arcs[0].circle.x,y:l.arcs[0].circle.y}:t.length?ge(e,[]):O(l.arcs.map(e=>e.p1))}function _e(e){let t={},n=Object.keys(e);for(let e of n)t[e]=[];for(let r=0;r<n.length;r++){let i=n[r],a=e[i];for(let o=r+1;o<n.length;++o){let r=n[o],s=e[r],c=T(a,s);c+s.radius<=a.radius+1e-10?t[r].push(i):c+a.radius<=s.radius+1e-10&&t[i].push(r)}}return t}function ve(e,t,n){let r={},i=_e(e);for(let a=0;a<t.length;++a){let o=t[a].sets,s={},c={};for(let e=0;e<o.length;++e){s[o[e]]=!0;let t=i[o[e]];for(let e=0;e<t.length;++e)c[t[e]]=!0}let l=[],u=[];for(let t in e)t in s?l.push(e[t]):t in c||u.push(e[t]);let d=ge(l,u,n);r[o]=d,d.disjoint&&t[a].size>0&&console.log(`WARNING: area `+o+` not represented on screen`)}return r}function ye(e,t,n){let r=[];return r.push(`
2
2
  M`,e,t),r.push(`
3
3
  m`,-n,0),r.push(`
4
4
  a`,n,n,0,1,0,n*2,0),r.push(`
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-hePW80VL.js";import{a as t,t as n,v as r}from"./jsxRuntime-DJRCfs_u.js";import{p as i,u as a}from"./index-lCAk_Rn7.js";var o={block:`_block_gdsq8_1`,header:`_header_gdsq8_9`,tree:`_tree_gdsq8_18`,children:`_children_gdsq8_19`,row:`_row_gdsq8_37`,toggle:`_toggle_gdsq8_41`,key:`_key_gdsq8_53`,string:`_string_gdsq8_57`,number:`_number_gdsq8_61`,boolean:`_boolean_gdsq8_62`,null:`_null_gdsq8_66`,preview:`_preview_gdsq8_67`,more:`_more_gdsq8_68`,tools:`_tools_gdsq8_72`,tool:`_tool_gdsq8_72`},s=/^[A-Za-z_$][\w$]*$/;function c(e){return e.reduce((e,t)=>typeof t==`number`?`${e}[${t}]`:s.test(t)?`${e}.${t}`:`${e}[${JSON.stringify(t)}]`,`$`)}var l=e=>typeof e==`object`&&!!e;function u(e,t=1e3){if(!l(e))return{entries:[],more:0};let n=Array.isArray(e)?e.map((e,t)=>[t,e]):Object.entries(e);return{entries:n.slice(0,t),more:Math.max(0,n.length-t)}}var d=(e,t,n)=>`${e} ${e===1?t:n}`;function f(e,t=80){if(Array.isArray(e))return`[…] ${d(e.length,`item`,`items`)}`;if(l(e))return`{…} ${d(Object.keys(e).length,`key`,`keys`)}`;let n=e===void 0?`undefined`:JSON.stringify(e);return n.length>t?`${n.slice(0,t-1)}…`:n}var p=e({default:()=>g}),m=e=>typeof e==`string`?o.string:typeof e==`number`?o.number:typeof e==`boolean`?o.boolean:o.null;function h(e){let{value:a,path:s}=e,d=l(a),[p,g]=r(e.open>0),_=e.name===void 0?null:n(`span`,{class:o.key,children:[typeof e.name==`number`?e.name:JSON.stringify(e.name),`:`]}),v=n(`span`,{class:o.tools,children:[n(i,{text:()=>JSON.stringify(a,null,2)??`undefined`,class:o.tool,label:t(`json.copyValue`),showText:!0}),n(i,{text:()=>c(s),class:o.tool,label:t(`json.copyPath`),showText:!0})]});if(!d)return n(`li`,{class:o.row,children:[_,` `,n(`span`,{class:m(a),children:JSON.stringify(a)??`undefined`}),v]});let{entries:y,more:b}=p?u(a):{entries:[],more:0};return n(`li`,{class:o.row,children:[n(`button`,{type:`button`,class:o.toggle,"aria-expanded":p,onClick:()=>g(!p),children:p?`▾`:`▸`}),_,` `,n(`span`,{class:o.preview,children:f(a)}),v,p?n(`ul`,{class:o.children,children:[y.map(([t,r])=>n(h,{name:t,value:r,path:[...s,t],open:e.open-1},String(t))),b?n(`li`,{class:o.more,children:t(`json.more`,{count:b})}):null]}):null]})}function g({block:e}){let[i,s]=r(!1);return n(`figure`,{class:o.block,children:[n(`figcaption`,{class:o.header,children:[n(`span`,{children:e.caption??`JSON`}),n(`button`,{type:`button`,class:o.tool,"aria-pressed":i,onClick:()=>s(!i),children:t(i?`json.tree`:`json.source`)})]}),i?n(a,{block:{kind:`code`,lang:`json`,code:JSON.stringify(e.value,null,2)??``}}):n(`ul`,{class:o.tree,children:n(h,{value:e.value,path:[],open:e.collapsedDepth??2})})]})}export{p as n,g as t};
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/engine-DUxyrccI.js","assets/index-lCAk_Rn7.js","assets/jsxRuntime-DJRCfs_u.js","assets/app-DP2KtZ7m.js","assets/icons-dCLC5DFa.js","assets/clipboard-hOiC7lD8.js","assets/index-CRb-14T4.css","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-B6xuSHsQ.js","assets/rolldown-runtime-hePW80VL.js","assets/chunk-DU6HZSFF-CgtANb4X.js","assets/purify.es--06brOip.js","assets/chunk-75Z2AOVW-BR8-_T1K.js","assets/dist-v5Q1xZ2K.js","assets/chunk-PWAF6VOD-DYoILyGR.js","assets/chunk-GMAD6QVW-ajMpCrE1.js","assets/chunk-P2QGCYS3-C8Mv-VXk.js","assets/chunk-4HAMMTFA-DmLMKdyN.js","assets/rough.esm-Dy-Kn_BL.js","assets/chunk-GVQU2GXP-Cxv3ClOW.js","assets/chunk-OSK3NFVY-CTNQzsaZ.js","assets/line-BBeV3vfV.js","assets/path-fybaL0A-.js","assets/array-BifhSqXX.js","assets/graphlib-DS17s2tU.js","assets/chunk-L3NEJ4N5-IF_NnfIM.js"])))=>i.map(i=>d[i]);
2
+ import{a as e,h as t,t as n,v as r,w as i,y as a}from"./jsxRuntime-DJRCfs_u.js";import{t as o}from"./icons-dCLC5DFa.js";import{d as s,f as c,i as l,p as u}from"./index-lCAk_Rn7.js";var d={block:`_block_1smqo_1`,header:`_header_1smqo_9`,label:`_label_1smqo_21`,actions:`_actions_1smqo_28`,action:`_action_1smqo_28`,viewport:`_viewport_1smqo_58`,canvas:`_canvas_1smqo_64`,source:`_source_1smqo_75`,error:`_error_1smqo_87`,overlay:`_overlay_1smqo_96`,overlayBody:`_overlayBody_1smqo_106`,overlayClose:`_overlayClose_1smqo_115`},f=[.5,.75,1,1.25,1.5,2,3];function p(e,t){let n=URL.createObjectURL(new Blob([e],{type:`image/svg+xml`})),r=document.createElement(`a`);r.href=n,r.download=`${t}.svg`,r.click(),setTimeout(()=>URL.revokeObjectURL(n),1e3)}function m(e){return n(`div`,{class:d.canvas,style:{width:`${e.zoom*100}%`},dangerouslySetInnerHTML:{__html:e.svg}})}function h(h){let g=h.block.kind===`mermaid`?h.block.source:``,_=h.block.kind===`mermaid`?h.block.title:void 0,v=t(null),[y,b]=r(),[x,S]=r(!1),[C,w]=r(2),[T,E]=r(!1),D=t(null),O=l.value;a(()=>{if(b(void 0),h.live||!v.current||!g.trim())return;let e=!1,t=c(v.current,()=>{s(()=>import(`./engine-DUxyrccI.js`).then(e=>e.render(g,O)),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25])).catch(e=>({error:e instanceof Error?e.message:String(e)})).then(t=>{e||b(t)})});return()=>{e=!0,t()}},[g,O,h.live]),a(()=>{if(!T)return;D.current?.focus();let e=e=>{e.key===`Escape`&&E(!1)};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[T]);let k=y&&`svg`in y?y.svg:void 0,A=y&&`error`in y?y.error:void 0,j=f[C]??1,M=n(`pre`,{class:d.source,children:g});return n(`figure`,{class:d.block,ref:v,children:[n(`figcaption`,{class:d.header,children:[n(`span`,{class:d.label,children:_??`mermaid`}),n(`span`,{class:d.actions,children:[k?n(i,{children:[n(`button`,{type:`button`,class:d.action,"aria-pressed":x,onClick:()=>S(!x),children:e(x?`mermaid.diagram`:`mermaid.source`)}),n(`button`,{type:`button`,class:d.action,"aria-label":e(`mermaid.zoomOut`),title:e(`mermaid.zoomOut`),disabled:C===0,onClick:()=>w(Math.max(0,C-1)),children:`−`}),n(`button`,{type:`button`,class:d.action,title:e(`mermaid.zoomReset`),onClick:()=>w(2),children:[Math.round(j*100),`%`]}),n(`button`,{type:`button`,class:d.action,"aria-label":e(`mermaid.zoomIn`),title:e(`mermaid.zoomIn`),disabled:C===f.length-1,onClick:()=>w(Math.min(f.length-1,C+1)),children:`+`}),n(`button`,{type:`button`,class:d.action,onClick:()=>p(k,_?.replace(/[^\w-]+/g,`-`)||`diagram`),children:e(`mermaid.export`)}),n(`button`,{type:`button`,class:d.action,"aria-label":e(`mermaid.fullscreen`),title:e(`mermaid.fullscreen`),onClick:()=>E(!0),children:n(o,{name:`expand`,size:14})})]}):null,n(u,{text:()=>g,class:d.action,showText:!0})]})]}),A?n(`div`,{role:`note`,children:[n(`p`,{class:d.error,children:e(`mermaid.error`,{message:A})}),M]}):k&&!x?n(`div`,{class:d.viewport,tabIndex:0,children:n(m,{svg:k,zoom:j})}):M,T&&k?n(`div`,{class:d.overlay,role:`dialog`,"aria-modal":`true`,"aria-label":_??e(`mermaid.diagram`),onMouseDown:e=>{e.target===e.currentTarget&&E(!1)},children:[n(`button`,{type:`button`,ref:D,class:`icon-btn ${d.overlayClose}`,"aria-label":e(`common.close`),onClick:()=>E(!1),children:n(o,{name:`x`,size:18})}),n(`div`,{class:d.overlayBody,children:n(m,{svg:k,zoom:1})})]}):null]})}export{h as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsxRuntime-DJRCfs_u.js";import{n as t}from"./index-lCAk_Rn7.js";function n({block:n}){return n.kind===`artifact`?e(t,{artifact:n.artifact,compact:!0}):null}export{n as default};
@@ -1,5 +1,5 @@
1
- import{a as e,b as t,g as n,m as r,t as i}from"./jsxRuntime-B237YiZZ.js";import{d as a,s as o}from"./index-DFURIQeX.js";var s={block:`_block_jmwvo_1`,bar:`_bar_jmwvo_10`,fileHead:`_fileHead_jmwvo_11`,title:`_title_jmwvo_20`,actions:`_actions_jmwvo_24`,action:`_action_jmwvo_24`,nav:`_nav_jmwvo_45`,file:`_file_jmwvo_11`,path:`_path_jmwvo_63`,status:`_status_jmwvo_77`,stat:`_stat_jmwvo_77`,plus:`_plus_jmwvo_101`,minus:`_minus_jmwvo_105`,scroll:`_scroll_jmwvo_109`,table:`_table_jmwvo_114`,no:`_no_jmwvo_126`,sign:`_sign_jmwvo_134`,code:`_code_jmwvo_140`,add:`_add_jmwvo_145`,del:`_del_jmwvo_149`,note:`_note_jmwvo_153`,empty:`_empty_jmwvo_160`,hunkRow:`_hunkRow_jmwvo_164`,hunkToggle:`_hunkToggle_jmwvo_169`,plainText:`_plainText_jmwvo_180`},c=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/,l=e=>e.replace(/^[ab]\//,``).replace(/\t.*$/,``);function u(e,t=``){let n=[],r,i,a=0,o=0,s=0,u=0,d,f=()=>{let e={path:t,status:`modified`,hunks:[],added:0,removed:0};return n.push(e),i=void 0,e};for(let t of e.replace(/\r\n/g,`
1
+ import{a as e,g as t,t as n,v as r,w as i}from"./jsxRuntime-DJRCfs_u.js";import{D as a,p as o}from"./index-lCAk_Rn7.js";var s={block:`_block_jmwvo_1`,bar:`_bar_jmwvo_10`,fileHead:`_fileHead_jmwvo_11`,title:`_title_jmwvo_20`,actions:`_actions_jmwvo_24`,action:`_action_jmwvo_24`,nav:`_nav_jmwvo_45`,file:`_file_jmwvo_11`,path:`_path_jmwvo_63`,status:`_status_jmwvo_77`,stat:`_stat_jmwvo_77`,plus:`_plus_jmwvo_101`,minus:`_minus_jmwvo_105`,scroll:`_scroll_jmwvo_109`,table:`_table_jmwvo_114`,no:`_no_jmwvo_126`,sign:`_sign_jmwvo_134`,code:`_code_jmwvo_140`,add:`_add_jmwvo_145`,del:`_del_jmwvo_149`,note:`_note_jmwvo_153`,empty:`_empty_jmwvo_160`,hunkRow:`_hunkRow_jmwvo_164`,hunkToggle:`_hunkToggle_jmwvo_169`,plainText:`_plainText_jmwvo_180`},c=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(.*)$/,l=e=>e.replace(/^[ab]\//,``).replace(/\t.*$/,``);function u(e,t=``){let n=[],r,i,a=0,o=0,s=0,u=0,d,f=()=>{let e={path:t,status:`modified`,hunks:[],added:0,removed:0};return n.push(e),i=void 0,e};for(let t of e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `)){if(i&&r&&(s>0||u>0)){let e=t[0],n=t.slice(1);if(e===`+`){i.lines.push({type:`add`,text:n,newNo:o++}),r.added++,u--;continue}if(e===`-`){i.lines.push({type:`del`,text:n,oldNo:a++}),r.removed++,s--;continue}if(e===` `||t===``){i.lines.push({type:`ctx`,text:n,oldNo:a++,newNo:o++}),s--,u--;continue}if(e===`\\`){i.lines.push({type:`note`,text:t.slice(2)});continue}s=u=0}if(i&&t.startsWith(`\\`)){i.lines.push({type:`note`,text:t.slice(2)});continue}if(t.startsWith(`diff --git `)){r=f();let e=/ b\/(.+)$/.exec(t);e?.[1]&&(r.path=e[1]),d=void 0;continue}if(t.startsWith(`--- `)){(!r||r.hunks.length)&&(r=f()),d=t.slice(4).trim();continue}if(t.startsWith(`+++ `)&&r&&d!==void 0){let e=t.slice(4).trim();d===`/dev/null`&&(r.status=`added`),e===`/dev/null`?(r.status=`deleted`,r.path=l(d)):(r.path=l(e),d!==`/dev/null`&&l(d)!==r.path&&(r.status=`renamed`)),d=void 0;continue}let e=c.exec(t);if(e){r??=f(),a=Number(e[1]),s=e[2]===void 0?1:Number(e[2]),o=Number(e[3]),u=e[4]===void 0?1:Number(e[4]),i={header:t,lines:[]},r.hunks.push(i);continue}i=void 0,r&&/^(new|deleted) file mode/.test(t)?r.status=t.startsWith(`new`)?`added`:`deleted`:r&&/^Binary files .* differ$/.test(t)&&(r.binary=!0)}return n}function d(e,t,n){let r=e.length,i=t.length;if(!r)return t.map(()=>2);if(!i)return e.map(()=>1);let a=r+i,o=a+1,s=new Int32Array(2*a+3),c=[];for(let l=0;l<=Math.min(a,n);l++){c.push(s.slice(o-l-1,o+l+2));for(let n=-l;n<=l;n+=2){let a=n===-l||n!==l&&s[o+n-1]<s[o+n+1]?s[o+n+1]:s[o+n-1]+1,u=a-n;for(;a<r&&u<i&&e[a]===t[u];)a++,u++;if(s[o+n]=a,a>=r&&u>=i)return f(c,r,i)}}}function f(e,t,n){let r=[],i=t,a=n;for(let t=e.length-1;t>0;t--){let n=e[t],o=e=>n[e+t+1],s=i-a,c=s===-t||s!==t&&o(s-1)<o(s+1)?s+1:s-1,l=o(c),u=l-c;for(;i>l&&a>u;)r.push(0),i--,a--;r.push(i===l?2:1),i=l,a=u}for(;i>0&&a>0;)r.push(0),i--,a--;return r.reverse()}function p(e,t,n=2e3){let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;let o=e.slice(r,i),s=t.slice(r,a),c=d(o,s,n)??[...o.map(()=>1),...s.map(()=>2)];return[...Array(r).fill(0),...c,...Array(e.length-i).fill(0)]}var m=e=>{if(!e)return[];let t=e.replace(/\r\n/g,`
4
4
  `).split(`
5
- `);return t.at(-1)===``&&t.pop(),t};function h(e,t,n=3){let r=m(e),i=m(t),a=[],o=0,s=0;for(let e of p(r,i))e===0?a.push({type:`ctx`,text:r[o],oldNo:++o,newNo:++s}):e===1?a.push({type:`del`,text:r[o],oldNo:++o}):a.push({type:`add`,text:i[s],newNo:++s});let c=[],l,u=-1/0;for(let e=0;e<a.length;e++){let t=a[e];t.type!==`ctx`&&(!l||e-u>2*n?(l&&l.push(...a.slice(u+1,u+1+n)),l=a.slice(Math.max(0,e-n),e),c.push({header:``,lines:l})):l.push(...a.slice(u+1,e)),l.push(t),u=e)}l&&l.push(...a.slice(u+1,u+1+n));for(let e of c)e.header=g(e.lines);return c}function g(e){let t=e.filter(e=>e.oldNo!==void 0),n=e.filter(e=>e.newNo!==void 0),r=(e,t)=>e.length?`${e[0]?.[t]},${e.length}`:`0,0`;return`@@ -${r(t,`oldNo`)} +${r(n,`newNo`)} @@`}function _(e){let t=e.path??``;if(e.patch!==void 0){let n=u(e.patch,t);return n.length?n:[{path:t,status:`modified`,hunks:[],added:0,removed:0}]}let n=h(e.before??``,e.after??``),r=e=>n.reduce((t,n)=>t+n.lines.filter(t=>t.type===e).length,0);return[{path:t,status:e.before===void 0?`added`:e.after===void 0?`deleted`:`modified`,hunks:n,added:r(`add`),removed:r(`del`)}]}function v(e){let t=[],n=[],r=[],i=()=>{for(let e=0;e<Math.max(n.length,r.length);e++){let i=n[e],a=r[e];t.push({...i?{left:i}:{},...a?{right:a}:{}})}n=[],r=[]};for(let a of e.lines)a.type===`del`?(r.length&&i(),n.push(a)):a.type===`add`?r.push(a):(i(),a.type===`ctx`&&t.push({left:a,right:a}));return i(),t}var y={add:`+`,del:`−`,ctx:` `,note:``};function b({hunk:e}){return i(t,{children:e.lines.map((e,t)=>i(`tr`,{class:s[e.type],children:[i(`td`,{class:s.no,children:e.oldNo??``}),i(`td`,{class:s.no,children:e.newNo??``}),i(`td`,{class:s.sign,children:y[e.type]}),i(`td`,{class:s.code,children:e.text})]},t))})}var x=({line:e,side:n})=>i(t,{children:[i(`td`,{class:`${s.no} ${e?s[e.type]:s.empty}`,children:(n===`left`?e?.oldNo:e?.newNo)??``}),i(`td`,{class:`${s.code} ${e?s[e.type]:s.empty}`,children:e?.text??``})]});function S({hunk:e}){return i(t,{children:v(e).map((e,t)=>i(`tr`,{children:[i(x,{line:e.left,side:`left`}),i(x,{line:e.right,side:`right`})]},t))})}function C(t){let{file:r}=t,[a,c]=n(()=>new Set),l=e=>{let t=new Set(a);t.has(e)?t.delete(e):t.add(e),c(t)};return i(`section`,{class:s.file,id:`diff-file-${t.index}`,children:[i(`header`,{class:s.fileHead,children:[i(`span`,{class:s.status,"data-status":r.status,children:e(`diff.status.${r.status}`)}),r.path?i(`button`,{type:`button`,class:s.path,title:e(`diff.open`),onClick:()=>void o(r.path),children:r.path}):i(`span`,{class:s.path,children:e(`diff.untitled`)}),i(`span`,{class:s.stat,children:[i(`span`,{class:s.plus,children:[`+`,r.added]}),i(`span`,{class:s.minus,children:[`−`,r.removed]})]})]}),r.binary?i(`p`,{class:s.note,children:e(`diff.binary`)}):null,!r.hunks.length&&!r.binary?i(`p`,{class:s.note,children:e(`diff.noChanges`)}):null,r.hunks.length?i(`div`,{class:s.scroll,children:i(`table`,{class:s.table,children:r.hunks.map((e,n)=>i(`tbody`,{children:[i(`tr`,{class:s.hunkRow,children:i(`td`,{colSpan:4,children:i(`button`,{type:`button`,class:s.hunkToggle,"aria-expanded":!a.has(n),onClick:()=>l(n),children:[a.has(n)?`▸`:`▾`,` `,e.header]})})}),a.has(n)?null:t.split?i(S,{hunk:e}):i(b,{hunk:e})]},n))})}):null]})}function w({block:t}){let o=r(()=>_(t),[t]),[c,l]=n(!1),u=o.every(e=>!e.hunks.length&&!e.binary)&&t.patch;return i(`figure`,{class:s.block,children:[i(`figcaption`,{class:s.bar,children:[i(`span`,{class:s.title,children:t.caption??(o.length>1?e(`diff.files`,{count:o.length}):e(`diff.title`))}),i(`span`,{class:s.actions,children:[i(`button`,{type:`button`,class:s.action,"aria-pressed":c,onClick:()=>l(!c),children:e(c?`diff.unified`:`diff.split`)}),t.patch?i(a,{text:()=>t.patch??``,class:s.action,showText:!0}):null]})]}),o.length>1?i(`nav`,{class:s.nav,"aria-label":e(`diff.files`,{count:o.length}),children:o.map((e,t)=>i(`a`,{href:`#diff-file-${t}`,onClick:e=>{e.preventDefault(),document.getElementById(`diff-file-${t}`)?.scrollIntoView({block:`nearest`})},children:[e.path,i(`span`,{class:s.plus,children:[` +`,e.added]}),i(`span`,{class:s.minus,children:[` −`,e.removed]})]},t))}):null,u?i(`pre`,{class:s.plainText,children:t.patch}):o.map((e,t)=>i(C,{file:e,split:c,index:t},t))]})}export{w as default};
5
+ `);return t.at(-1)===``&&t.pop(),t};function h(e,t,n=3){let r=m(e),i=m(t),a=[],o=0,s=0;for(let e of p(r,i))e===0?a.push({type:`ctx`,text:r[o],oldNo:++o,newNo:++s}):e===1?a.push({type:`del`,text:r[o],oldNo:++o}):a.push({type:`add`,text:i[s],newNo:++s});let c=[],l,u=-1/0;for(let e=0;e<a.length;e++){let t=a[e];t.type!==`ctx`&&(!l||e-u>2*n?(l&&l.push(...a.slice(u+1,u+1+n)),l=a.slice(Math.max(0,e-n),e),c.push({header:``,lines:l})):l.push(...a.slice(u+1,e)),l.push(t),u=e)}l&&l.push(...a.slice(u+1,u+1+n));for(let e of c)e.header=g(e.lines);return c}function g(e){let t=e.filter(e=>e.oldNo!==void 0),n=e.filter(e=>e.newNo!==void 0),r=(e,t)=>e.length?`${e[0]?.[t]},${e.length}`:`0,0`;return`@@ -${r(t,`oldNo`)} +${r(n,`newNo`)} @@`}function _(e){let t=e.path??``;if(e.patch!==void 0){let n=u(e.patch,t);return n.length?n:[{path:t,status:`modified`,hunks:[],added:0,removed:0}]}let n=h(e.before??``,e.after??``),r=e=>n.reduce((t,n)=>t+n.lines.filter(t=>t.type===e).length,0);return[{path:t,status:e.before===void 0?`added`:e.after===void 0?`deleted`:`modified`,hunks:n,added:r(`add`),removed:r(`del`)}]}function v(e){let t=[],n=[],r=[],i=()=>{for(let e=0;e<Math.max(n.length,r.length);e++){let i=n[e],a=r[e];t.push({...i?{left:i}:{},...a?{right:a}:{}})}n=[],r=[]};for(let a of e.lines)a.type===`del`?(r.length&&i(),n.push(a)):a.type===`add`?r.push(a):(i(),a.type===`ctx`&&t.push({left:a,right:a}));return i(),t}var y={add:`+`,del:`−`,ctx:` `,note:``};function b({hunk:e}){return n(i,{children:e.lines.map((e,t)=>n(`tr`,{class:s[e.type],children:[n(`td`,{class:s.no,children:e.oldNo??``}),n(`td`,{class:s.no,children:e.newNo??``}),n(`td`,{class:s.sign,children:y[e.type]}),n(`td`,{class:s.code,children:e.text})]},t))})}var x=({line:e,side:t})=>n(i,{children:[n(`td`,{class:`${s.no} ${e?s[e.type]:s.empty}`,children:(t===`left`?e?.oldNo:e?.newNo)??``}),n(`td`,{class:`${s.code} ${e?s[e.type]:s.empty}`,children:e?.text??``})]});function S({hunk:e}){return n(i,{children:v(e).map((e,t)=>n(`tr`,{children:[n(x,{line:e.left,side:`left`}),n(x,{line:e.right,side:`right`})]},t))})}function C(t){let{file:i}=t,[o,c]=r(()=>new Set),l=e=>{let t=new Set(o);t.has(e)?t.delete(e):t.add(e),c(t)};return n(`section`,{class:s.file,id:`diff-file-${t.index}`,children:[n(`header`,{class:s.fileHead,children:[n(`span`,{class:s.status,"data-status":i.status,children:e(`diff.status.${i.status}`)}),i.path?n(`button`,{type:`button`,class:s.path,title:e(`diff.open`),onClick:()=>void a(i.path),children:i.path}):n(`span`,{class:s.path,children:e(`diff.untitled`)}),n(`span`,{class:s.stat,children:[n(`span`,{class:s.plus,children:[`+`,i.added]}),n(`span`,{class:s.minus,children:[`−`,i.removed]})]})]}),i.binary?n(`p`,{class:s.note,children:e(`diff.binary`)}):null,!i.hunks.length&&!i.binary?n(`p`,{class:s.note,children:e(`diff.noChanges`)}):null,i.hunks.length?n(`div`,{class:s.scroll,children:n(`table`,{class:s.table,children:i.hunks.map((e,r)=>n(`tbody`,{children:[n(`tr`,{class:s.hunkRow,children:n(`td`,{colSpan:4,children:n(`button`,{type:`button`,class:s.hunkToggle,"aria-expanded":!o.has(r),onClick:()=>l(r),children:[o.has(r)?`▸`:`▾`,` `,e.header]})})}),o.has(r)?null:t.split?n(S,{hunk:e}):n(b,{hunk:e})]},r))})}):null]})}function w({block:i}){let a=t(()=>_(i),[i]),[c,l]=r(!1),u=a.every(e=>!e.hunks.length&&!e.binary)&&i.patch;return n(`figure`,{class:s.block,children:[n(`figcaption`,{class:s.bar,children:[n(`span`,{class:s.title,children:i.caption??(a.length>1?e(`diff.files`,{count:a.length}):e(`diff.title`))}),n(`span`,{class:s.actions,children:[n(`button`,{type:`button`,class:s.action,"aria-pressed":c,onClick:()=>l(!c),children:e(c?`diff.unified`:`diff.split`)}),i.patch?n(o,{text:()=>i.patch??``,class:s.action,showText:!0}):null]})]}),a.length>1?n(`nav`,{class:s.nav,"aria-label":e(`diff.files`,{count:a.length}),children:a.map((e,t)=>n(`a`,{href:`#diff-file-${t}`,onClick:e=>{e.preventDefault(),document.getElementById(`diff-file-${t}`)?.scrollIntoView({block:`nearest`})},children:[e.path,n(`span`,{class:s.plus,children:[` +`,e.added]}),n(`span`,{class:s.minus,children:[` −`,e.removed]})]},t))}):null,u?n(`pre`,{class:s.plainText,children:i.patch}):a.map((e,t)=>n(C,{file:e,split:c,index:t},t))]})}export{w as default};
@@ -1 +1 @@
1
- import{a as e,t}from"./jsxRuntime-B237YiZZ.js";var n={block:`_block_do9qp_1`,header:`_header_do9qp_8`,count:`_count_do9qp_16`,steps:`_steps_do9qp_20`,mark:`_mark_do9qp_34`,label:`_label_do9qp_52`,detail:`_detail_do9qp_57`},r={pending:`○`,running:`●`,completed:`✓`,failed:`✗`,cancelled:`–`};function i({block:i}){let a=i.steps.filter(e=>e.status===`completed`).length;return t(`figure`,{class:n.block,children:[t(`figcaption`,{class:n.header,children:[t(`span`,{children:i.title??e(`progress.title`)}),t(`span`,{class:n.count,children:[a,`/`,i.steps.length]})]}),t(`ol`,{class:n.steps,children:i.steps.map((i,a)=>t(`li`,{"data-status":i.status,children:[t(`span`,{class:n.mark,"aria-label":e(`progress.status.${i.status}`),children:r[i.status]}),t(`span`,{class:n.label,children:i.label}),i.detail?t(`span`,{class:n.detail,children:i.detail}):null]},a))})]})}export{i as default};
1
+ import{a as e,t}from"./jsxRuntime-DJRCfs_u.js";var n={block:`_block_do9qp_1`,header:`_header_do9qp_8`,count:`_count_do9qp_16`,steps:`_steps_do9qp_20`,mark:`_mark_do9qp_34`,label:`_label_do9qp_52`,detail:`_detail_do9qp_57`},r={pending:`○`,running:`●`,completed:`✓`,failed:`✗`,cancelled:`–`};function i({block:i}){let a=i.steps.filter(e=>e.status===`completed`).length;return t(`figure`,{class:n.block,children:[t(`figcaption`,{class:n.header,children:[t(`span`,{children:i.title??e(`progress.title`)}),t(`span`,{class:n.count,children:[a,`/`,i.steps.length]})]}),t(`ol`,{class:n.steps,children:i.steps.map((i,a)=>t(`li`,{"data-status":i.status,children:[t(`span`,{class:n.mark,"aria-label":e(`progress.status.${i.status}`),children:r[i.status]}),t(`span`,{class:n.label,children:i.label}),i.detail?t(`span`,{class:n.detail,children:i.detail}):null]},a))})]})}export{i as default};
@@ -1,6 +1,6 @@
1
- import{a as e,b as t,g as n,m as r,t as i}from"./jsxRuntime-B237YiZZ.js";import{d as a}from"./index-DFURIQeX.js";var o=/\x1b\[([0-9;:?<=>]*)([ -/]*)([@-~])|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]?/g,s=[0,95,135,175,215,255];function c(e){if(!Number.isInteger(e)||e<0||e>255)return;if(e<16)return e;if(e>=232){let t=8+(e-232)*10;return`rgb(${t},${t},${t})`}let t=e-16;return`rgb(${s[Math.floor(t/36)]},${s[Math.floor(t/6)%6]},${s[t%6]})`}function l(e,t){let n=t===``?[0]:t.split(/[;:]/).map(e=>e===``?0:Number(e)),r={...e};for(let e=0;e<n.length;e++){let t=n[e];if(t===0)r={};else if(t===1)r.bold=!0;else if(t===2)r.dim=!0;else if(t===3)r.italic=!0;else if(t===4)r.underline=!0;else if(t===7)r.inverse=!0;else if(t===22)delete r.bold,delete r.dim;else if(t===23)delete r.italic;else if(t===24)delete r.underline;else if(t===27)delete r.inverse;else if(t>=30&&t<=37)r.fg=t-30;else if(t>=90&&t<=97)r.fg=t-90+8;else if(t===39)delete r.fg;else if(t>=40&&t<=47)r.bg=t-40;else if(t>=100&&t<=107)r.bg=t-100+8;else if(t===49)delete r.bg;else if(t===38||t===48){let i=t===38?`fg`:`bg`,a;if(n[e+1]===5)a=c(n[e+2]),e+=2;else if(n[e+1]===2){let[t,r,i]=[n[e+2],n[e+3],n[e+4]].map(e=>Math.max(0,Math.min(255,Number(e??0))));a=`rgb(${t},${r},${i})`,e+=4}a!==void 0&&(r[i]=a)}}return r}function u(e){let t=[],n={},r=0,i=e=>{if(!e)return;let r=t.at(-1);r&&f(r,n)?r.text+=e:t.push({text:e,...n})};for(let t of e.matchAll(o))i(e.slice(r,t.index)),r=(t.index??0)+t[0].length,t[3]===`m`&&!t[2]&&!t[1]?.startsWith(`?`)&&(n=l(n,t[1]??``));return i(e.slice(r)),t}var d=[`fg`,`bg`,`bold`,`dim`,`italic`,`underline`,`inverse`],f=(e,t)=>d.every(n=>e[n]===t[n]);function p(e){return e.includes(`\r`)?e.replace(/\r\n/g,`
1
+ import{a as e,g as t,t as n,v as r,w as i}from"./jsxRuntime-DJRCfs_u.js";import{p as a}from"./index-lCAk_Rn7.js";var o=/\x1b\[([0-9;:?<=>]*)([ -/]*)([@-~])|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]?/g,s=[0,95,135,175,215,255];function c(e){if(!Number.isInteger(e)||e<0||e>255)return;if(e<16)return e;if(e>=232){let t=8+(e-232)*10;return`rgb(${t},${t},${t})`}let t=e-16;return`rgb(${s[Math.floor(t/36)]},${s[Math.floor(t/6)%6]},${s[t%6]})`}function l(e,t){let n=t===``?[0]:t.split(/[;:]/).map(e=>e===``?0:Number(e)),r={...e};for(let e=0;e<n.length;e++){let t=n[e];if(t===0)r={};else if(t===1)r.bold=!0;else if(t===2)r.dim=!0;else if(t===3)r.italic=!0;else if(t===4)r.underline=!0;else if(t===7)r.inverse=!0;else if(t===22)delete r.bold,delete r.dim;else if(t===23)delete r.italic;else if(t===24)delete r.underline;else if(t===27)delete r.inverse;else if(t>=30&&t<=37)r.fg=t-30;else if(t>=90&&t<=97)r.fg=t-90+8;else if(t===39)delete r.fg;else if(t>=40&&t<=47)r.bg=t-40;else if(t>=100&&t<=107)r.bg=t-100+8;else if(t===49)delete r.bg;else if(t===38||t===48){let i=t===38?`fg`:`bg`,a;if(n[e+1]===5)a=c(n[e+2]),e+=2;else if(n[e+1]===2){let[t,r,i]=[n[e+2],n[e+3],n[e+4]].map(e=>Math.max(0,Math.min(255,Number(e??0))));a=`rgb(${t},${r},${i})`,e+=4}a!==void 0&&(r[i]=a)}}return r}function u(e){let t=[],n={},r=0,i=e=>{if(!e)return;let r=t.at(-1);r&&f(r,n)?r.text+=e:t.push({text:e,...n})};for(let t of e.matchAll(o))i(e.slice(r,t.index)),r=(t.index??0)+t[0].length,t[3]===`m`&&!t[2]&&!t[1]?.startsWith(`?`)&&(n=l(n,t[1]??``));return i(e.slice(r)),t}var d=[`fg`,`bg`,`bold`,`dim`,`italic`,`underline`,`inverse`],f=(e,t)=>d.every(n=>e[n]===t[n]);function p(e){return e.includes(`\r`)?e.replace(/\r\n/g,`
2
2
  `).split(`
3
3
  `).map(e=>e.split(`\r`).findLast(e=>e!==``)??``).join(`
4
4
  `):e}function m(e,t){let n=e.split(`
5
5
  `);return n.length<=t?{text:e,hidden:0}:{text:n.slice(-t).join(`
6
- `),hidden:n.length-t}}var h={block:`_block_19eq0_1`,header:`_header_19eq0_46`,prompt:`_prompt_19eq0_54`,command:`_command_19eq0_59`,actions:`_actions_19eq0_67`,action:`_action_19eq0_67`,output:`_output_19eq0_88`,empty:`_empty_19eq0_99`,more:`_more_19eq0_103`,footer:`_footer_19eq0_115`,ok:`_ok_19eq0_125`,fail:`_fail_19eq0_129`,running:`_running_19eq0_133`},g=2e3,_=e=>e===void 0?void 0:typeof e==`number`?`var(--ansi-${e})`:e;function v({span:e}){if(e.fg===void 0&&e.bg===void 0&&!e.bold&&!e.dim&&!e.italic&&!e.underline&&!e.inverse)return i(t,{children:e.text});let n=_(e.inverse?e.bg:e.fg),r=_(e.inverse?e.fg??7:e.bg);return i(`span`,{style:{...n?{color:n}:e.inverse?{color:`var(--code-bg)`}:{},...r?{background:r}:{},...e.bold?{fontWeight:700}:{},...e.dim?{opacity:.7}:{},...e.italic?{fontStyle:`italic`}:{},...e.underline?{textDecoration:`underline`}:{}},children:e.text})}function y(t){let{block:o}=t,[s,c]=n(!1),l=r(()=>p(o.output),[o.output]),d=s?{text:l,hidden:0}:m(l,g),f=r(()=>u(d.text),[d.text]),_=()=>u(l).map(e=>e.text).join(``),y=o.exitCode;return i(`figure`,{class:h.block,children:[i(`figcaption`,{class:h.header,children:[i(`span`,{class:h.prompt,"aria-hidden":`true`,children:`$`}),i(`code`,{class:h.command,children:o.command??e(`terminal.output`)}),i(`span`,{class:h.actions,children:[o.command?i(a,{text:()=>o.command??``,class:h.action,label:e(`terminal.copyCommand`),showText:!0}):null,i(a,{text:_,class:h.action,label:e(`terminal.copyOutput`),showText:!0})]})]}),d.hidden?i(`button`,{type:`button`,class:h.more,onClick:()=>c(!0),children:e(`terminal.showAll`,{count:d.hidden})}):null,i(`pre`,{class:h.output,tabIndex:0,"aria-live":t.live?`off`:void 0,children:f.length?f.map((e,t)=>i(v,{span:e},t)):i(`span`,{class:h.empty,children:t.live?e(`terminal.waiting`):e(`terminal.empty`)})}),y!==void 0||o.durationMs!==void 0||o.truncated||t.live?i(`p`,{class:h.footer,children:[t.live?i(`span`,{class:h.running,children:e(`terminal.running`)}):null,y===void 0?null:i(`span`,{class:y===0?h.ok:h.fail,children:e(`terminal.exit`,{code:y})}),o.durationMs===void 0?null:i(`span`,{children:e(`tool.duration`,{ms:o.durationMs})}),o.truncated?i(`span`,{children:e(`terminal.truncated`)}):null]}):null]})}export{y as default};
6
+ `),hidden:n.length-t}}var h={block:`_block_19eq0_1`,header:`_header_19eq0_46`,prompt:`_prompt_19eq0_54`,command:`_command_19eq0_59`,actions:`_actions_19eq0_67`,action:`_action_19eq0_67`,output:`_output_19eq0_88`,empty:`_empty_19eq0_99`,more:`_more_19eq0_103`,footer:`_footer_19eq0_115`,ok:`_ok_19eq0_125`,fail:`_fail_19eq0_129`,running:`_running_19eq0_133`},g=2e3,_=e=>e===void 0?void 0:typeof e==`number`?`var(--ansi-${e})`:e;function v({span:e}){if(e.fg===void 0&&e.bg===void 0&&!e.bold&&!e.dim&&!e.italic&&!e.underline&&!e.inverse)return n(i,{children:e.text});let t=_(e.inverse?e.bg:e.fg),r=_(e.inverse?e.fg??7:e.bg);return n(`span`,{style:{...t?{color:t}:e.inverse?{color:`var(--code-bg)`}:{},...r?{background:r}:{},...e.bold?{fontWeight:700}:{},...e.dim?{opacity:.7}:{},...e.italic?{fontStyle:`italic`}:{},...e.underline?{textDecoration:`underline`}:{}},children:e.text})}function y(i){let{block:o}=i,[s,c]=r(!1),l=t(()=>p(o.output),[o.output]),d=s?{text:l,hidden:0}:m(l,g),f=t(()=>u(d.text),[d.text]),_=()=>u(l).map(e=>e.text).join(``),y=o.exitCode;return n(`figure`,{class:h.block,children:[n(`figcaption`,{class:h.header,children:[n(`span`,{class:h.prompt,"aria-hidden":`true`,children:`$`}),n(`code`,{class:h.command,children:o.command??e(`terminal.output`)}),n(`span`,{class:h.actions,children:[o.command?n(a,{text:()=>o.command??``,class:h.action,label:e(`terminal.copyCommand`),showText:!0}):null,n(a,{text:_,class:h.action,label:e(`terminal.copyOutput`),showText:!0})]})]}),d.hidden?n(`button`,{type:`button`,class:h.more,onClick:()=>c(!0),children:e(`terminal.showAll`,{count:d.hidden})}):null,n(`pre`,{class:h.output,tabIndex:0,"aria-live":i.live?`off`:void 0,children:f.length?f.map((e,t)=>n(v,{span:e},t)):n(`span`,{class:h.empty,children:i.live?e(`terminal.waiting`):e(`terminal.empty`)})}),y!==void 0||o.durationMs!==void 0||o.truncated||i.live?n(`p`,{class:h.footer,children:[i.live?n(`span`,{class:h.running,children:e(`terminal.running`)}):null,y===void 0?null:n(`span`,{class:y===0?h.ok:h.fail,children:e(`terminal.exit`,{code:y})}),o.durationMs===void 0?null:n(`span`,{children:e(`tool.duration`,{ms:o.durationMs})}),o.truncated?n(`span`,{children:e(`terminal.truncated`)}):null]}):null]})}export{y as default};
@@ -0,0 +1 @@
1
+ import{t as e}from"./jsxRuntime-DJRCfs_u.js";import{c as t,m as n}from"./index-lCAk_Rn7.js";function r({block:t}){return e(`div`,{class:n.scroll,children:[t.caption?e(`p`,{class:n.caption,children:t.caption}):null,e(`table`,{class:n.table,children:[e(`thead`,{children:e(`tr`,{children:t.columns.map(t=>e(`th`,{scope:`col`,children:t},t))})}),e(`tbody`,{children:t.rows.map((t,n)=>e(`tr`,{children:t.map((t,n)=>e(`td`,{children:t},n))},n))})]})]})}function i({block:t}){return e(`div`,{class:n.scroll,children:[t.caption?e(`p`,{class:n.caption,children:t.caption}):null,e(`table`,{class:n.table,children:e(`tbody`,{children:t.entries.map(([t,n],r)=>e(`tr`,{children:[e(`th`,{scope:`row`,children:t}),e(`td`,{children:n})]},r))})})]})}function a({nodes:t}){return e(`ul`,{class:n.tree,children:t.map((t,r)=>e(`li`,{children:[t.label,t.meta?e(`span`,{class:n.meta,children:t.meta}):null,t.children?.length?e(a,{nodes:t.children}):null]},r))})}var o={table:r,"key-value":i,tree:({block:t})=>e(a,{nodes:t.nodes}),markdown:({block:n})=>e(t,{text:n.text})};export{o as views};
@@ -1,4 +1,4 @@
1
- import{a as e,m as t,t as n}from"./jsxRuntime-B237YiZZ.js";import{d as r}from"./index-DFURIQeX.js";import{t as i}from"./purify.es--06brOip.js";var a=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},o=/([A-Z])/g,s=e=>e.replace(o,`-$1`).toLowerCase(),c={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},l=/[&><"']/g,u=e=>String(e).replace(l,e=>c[e]),d=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?d(e.body[0]):e:e.type===`font`?d(e.body):e,f=new Set([`mathord`,`textord`,`atom`]),p=e=>f.has(d(e).type),m=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},h={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function g(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function _(e){return Object.prototype.hasOwnProperty.call(e,`default`)&&e.default!==void 0?e.default:g(Array.isArray(e.type)?e.type[0]:e.type)}function v(e,t,n,r){var i=Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0,a=Object.prototype.hasOwnProperty.call(r,`processor`)?r.processor:void 0;e[t]=i===void 0?_(r):a?a(i):i}var y=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(h)){var n=h[t];n&&v(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),r&&r!==`ignore`){if(r===!0||r===`error`)throw new a(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=m(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},b=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return ne[re[this.id]]}sub(){return ne[ie[this.id]]}fracNum(){return ne[ae[this.id]]}fracDen(){return ne[oe[this.id]]}cramp(){return ne[se[this.id]]}text(){return ne[ce[this.id]]}isTight(){return this.size>=2}},x=0,S=1,C=2,w=3,ee=4,T=5,te=6,E=7,ne=[new b(x,0,!1),new b(S,0,!0),new b(C,1,!1),new b(w,1,!0),new b(ee,2,!1),new b(T,2,!0),new b(te,3,!1),new b(E,3,!0)],re=[ee,T,ee,T,te,E,te,E],ie=[T,T,T,T,E,E,E,E],ae=[C,w,ee,T,te,E,te,E],oe=[w,w,T,T,E,E,E,E],se=[S,S,w,w,T,T,E,E],ce=[x,S,C,w,C,w,C,w],D={DISPLAY:ne[x],TEXT:ne[C],SCRIPT:ne[ee],SCRIPTSCRIPT:ne[te]},le=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function ue(e){for(var t=0;t<le.length;t++)for(var n=le[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var de=[];le.forEach(e=>e.blocks.forEach(e=>de.push(...e)));function fe(e){for(var t=0;t<de.length;t+=2)if(e>=de[t]&&e<=de[t+1])return!0;return!1}var pe=e=>e+` `+e,me=80,he=function(e,t){return`M95,`+(622+e+t)+`
1
+ import{a as e,g as t,t as n}from"./jsxRuntime-DJRCfs_u.js";import{p as r}from"./index-lCAk_Rn7.js";import{t as i}from"./purify.es--06brOip.js";var a=class e extends Error{constructor(t,n){var r=`KaTeX parse error: `+t,i,a,o=n&&n.loc;if(o&&o.start<=o.end){var s=o.lexer.input;i=o.start,a=o.end,i===s.length?r+=` at end of input: `:r+=` at position `+(i+1)+`: `;var c=s.slice(i,a).replace(/[^]/g,`$&̲`),l=i>15?`…`+s.slice(i-15,i):s.slice(0,i),u=a+15<s.length?s.slice(a,a+15)+`…`:s.slice(a);r+=l+c+u}super(r),this.name=`ParseError`,this.position=void 0,this.length=void 0,this.rawMessage=void 0,Object.setPrototypeOf(this,e.prototype),this.position=i,i!=null&&a!=null&&(this.length=a-i),this.rawMessage=t}},o=/([A-Z])/g,s=e=>e.replace(o,`-$1`).toLowerCase(),c={"&":`&amp;`,">":`&gt;`,"<":`&lt;`,'"':`&quot;`,"'":`&#x27;`},l=/[&><"']/g,u=e=>String(e).replace(l,e=>c[e]),d=e=>e.type===`ordgroup`||e.type===`color`?e.body.length===1?d(e.body[0]):e:e.type===`font`?d(e.body):e,f=new Set([`mathord`,`textord`,`atom`]),p=e=>f.has(d(e).type),m=e=>{var t=/^[\x00-\x20]*([^\\/#?]*?)(:|&#0*58|&#x0*3a|&colon)/i.exec(e);return t?t[2]!==`:`||!/^[a-zA-Z][a-zA-Z0-9+\-.]*$/.test(t[1])?null:t[1].toLowerCase():`_relative`},h={displayMode:{type:`boolean`,description:`Render math in display mode, which puts the math in display style (so \\int and \\sum are large, for example), and centers the math on the page on its own line.`,cli:`-d, --display-mode`},output:{type:{enum:[`htmlAndMathml`,`html`,`mathml`]},description:`Determines the markup language of the output.`,cli:`-F, --format <type>`},leqno:{type:`boolean`,description:`Render display math in leqno style (left-justified tags).`},fleqn:{type:`boolean`,description:`Render display math flush left.`},throwOnError:{type:`boolean`,default:!0,cli:`-t, --no-throw-on-error`,cliDescription:`Render errors (in the color given by --error-color) instead of throwing a ParseError exception when encountering an error.`},errorColor:{type:`string`,default:`#cc0000`,cli:`-c, --error-color <color>`,cliDescription:`A color string given in the format 'rgb' or 'rrggbb' (no #). This option determines the color of errors rendered by the -t option.`,cliProcessor:e=>`#`+e},macros:{type:`object`,cli:`-m, --macro <def>`,cliDescription:`Define custom macro of the form '\\foo:expansion' (use multiple -m arguments for multiple macros).`,cliDefault:[],cliProcessor:(e,t)=>(t.push(e),t)},minRuleThickness:{type:`number`,description:"Specifies a minimum thickness, in ems, for fraction lines, `\\sqrt` top lines, `{array}` vertical lines, `\\hline`, `\\hdashline`, `\\underline`, `\\overline`, and the borders of `\\fbox`, `\\boxed`, and `\\fcolorbox`.",processor:e=>Math.max(0,e),cli:`--min-rule-thickness <size>`,cliProcessor:parseFloat},colorIsTextColor:{type:`boolean`,description:`Makes \\color behave like LaTeX's 2-argument \\textcolor, instead of LaTeX's one-argument \\color mode change.`,cli:`-b, --color-is-text-color`},strict:{type:[{enum:[`warn`,`ignore`,`error`]},`boolean`,`function`],description:`Turn on strict / LaTeX faithfulness mode, which throws an error if the input uses features that are not supported by LaTeX.`,cli:`-S, --strict`,cliDefault:!1},trust:{type:[`boolean`,`function`],description:`Trust the input, enabling all HTML features such as \\url.`,cli:`-T, --trust`},maxSize:{type:`number`,default:1/0,description:`If non-zero, all user-specified sizes, e.g. in \\rule{500em}{500em}, will be capped to maxSize ems. Otherwise, elements and spaces can be arbitrarily large`,processor:e=>Math.max(0,e),cli:`-s, --max-size <n>`,cliProcessor:parseInt},maxExpand:{type:`number`,default:1e3,description:`Limit the number of macro expansions to the specified number, to prevent e.g. infinite macro loops. If set to Infinity, the macro expander will try to fully expand as in LaTeX.`,processor:e=>Math.max(0,e),cli:`-e, --max-expand <n>`,cliProcessor:e=>e===`Infinity`?1/0:parseInt(e)},globalGroup:{type:`boolean`,cli:!1}};function g(e){if(typeof e!=`string`)return e.enum[0];switch(e){case`boolean`:return!1;case`string`:return``;case`number`:return 0;case`object`:return{};default:throw Error(`Unexpected schema type; settings must declare an explicit default.`)}}function _(e){return Object.prototype.hasOwnProperty.call(e,`default`)&&e.default!==void 0?e.default:g(Array.isArray(e.type)?e.type[0]:e.type)}function v(e,t,n,r){var i=Object.prototype.hasOwnProperty.call(n,t)?n[t]:void 0,a=Object.prototype.hasOwnProperty.call(r,`processor`)?r.processor:void 0;e[t]=i===void 0?_(r):a?a(i):i}var y=class{constructor(e){e===void 0&&(e={}),this.displayMode=void 0,this.output=void 0,this.leqno=void 0,this.fleqn=void 0,this.throwOnError=void 0,this.errorColor=void 0,this.macros=void 0,this.minRuleThickness=void 0,this.colorIsTextColor=void 0,this.strict=void 0,this.trust=void 0,this.maxSize=void 0,this.maxExpand=void 0,this.globalGroup=void 0,e||={};for(var t of Object.keys(h)){var n=h[t];n&&v(this,t,e,n)}}reportNonstrict(e,t,n){var r=this.strict;if(typeof r==`function`&&(r=r(e,t,n)),r&&r!==`ignore`){if(r===!0||r===`error`)throw new a(`LaTeX-incompatible input and strict mode is set to 'error': `+(t+` [`+e+`]`),n);r===`warn`?typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)):typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`))}}useStrictBehavior(e,t,n){var r=this.strict;if(typeof r==`function`)try{r=r(e,t,n)}catch{r=`error`}return!r||r===`ignore`?!1:r===!0||r===`error`?!0:r===`warn`?(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to 'warn': `+(t+` [`+e+`]`)),!1):(typeof console<`u`&&console.warn(`LaTeX-incompatible input and strict mode is set to `+(`unrecognized '`+r+`': `+t+` [`+e+`]`)),!1)}isTrusted(e){if(`url`in e&&e.url&&!e.protocol){var t=m(e.url);if(t==null)return!1;e.protocol=t}return!!(typeof this.trust==`function`?this.trust(e):this.trust)}},b=class{constructor(e,t,n){this.id=void 0,this.size=void 0,this.cramped=void 0,this.id=e,this.size=t,this.cramped=n}sup(){return ne[re[this.id]]}sub(){return ne[ie[this.id]]}fracNum(){return ne[ae[this.id]]}fracDen(){return ne[oe[this.id]]}cramp(){return ne[se[this.id]]}text(){return ne[ce[this.id]]}isTight(){return this.size>=2}},x=0,S=1,C=2,w=3,ee=4,T=5,te=6,E=7,ne=[new b(x,0,!1),new b(S,0,!0),new b(C,1,!1),new b(w,1,!0),new b(ee,2,!1),new b(T,2,!0),new b(te,3,!1),new b(E,3,!0)],re=[ee,T,ee,T,te,E,te,E],ie=[T,T,T,T,E,E,E,E],ae=[C,w,ee,T,te,E,te,E],oe=[w,w,T,T,E,E,E,E],se=[S,S,w,w,T,T,E,E],ce=[x,S,C,w,C,w,C,w],D={DISPLAY:ne[x],TEXT:ne[C],SCRIPT:ne[ee],SCRIPTSCRIPT:ne[te]},le=[{name:`latin`,blocks:[[256,591],[768,879]]},{name:`cyrillic`,blocks:[[1024,1279]]},{name:`armenian`,blocks:[[1328,1423]]},{name:`brahmic`,blocks:[[2304,4255]]},{name:`georgian`,blocks:[[4256,4351]]},{name:`cjk`,blocks:[[12288,12543],[19968,40879],[65280,65376]]},{name:`hangul`,blocks:[[44032,55215]]}];function ue(e){for(var t=0;t<le.length;t++)for(var n=le[t],r=0;r<n.blocks.length;r++){var i=n.blocks[r];if(e>=i[0]&&e<=i[1])return n.name}return null}var de=[];le.forEach(e=>e.blocks.forEach(e=>de.push(...e)));function fe(e){for(var t=0;t<de.length;t+=2)if(e>=de[t]&&e<=de[t+1])return!0;return!1}var pe=e=>e+` `+e,me=80,he=function(e,t){return`M95,`+(622+e+t)+`
2
2
  c-2.7,0,-7.17,-2.7,-13.5,-8c-5.8,-5.3,-9.5,-10,-9.5,-14
3
3
  c0,-2,0.3,-3.3,1,-4c1.3,-2.7,23.83,-20.7,67.5,-54
4
4
  c44.2,-33.3,65.8,-50.3,66.5,-51c1.3,-1.3,3,-2,5,-2c4.7,0,8.7,3.3,12,10
@@ -0,0 +1 @@
1
+ import{a as e,t,v as n}from"./jsxRuntime-DJRCfs_u.js";function r(e){let t={passed:0,failed:0,skipped:0,todo:0,total:0};for(let n of e.suites)for(let e of n.cases)t[e.status]++,t.total++;return t}function i(e){return e.map(e=>({...e,cases:e.cases.filter(e=>e.status===`failed`)})).filter(e=>e.cases.length>0)}var a={block:`_block_17dx6_1`,header:`_header_17dx6_9`,framework:`_framework_17dx6_19`,passed:`_passed_17dx6_23`,mark:`_mark_17dx6_24`,failed:`_failed_17dx6_28`,name:`_name_17dx6_30`,filter:`_filter_17dx6_34`,body:`_body_17dx6_49`,suiteName:`_suiteName_17dx6_55`,cases:`_cases_17dx6_60`,file:`_file_17dx6_79`,time:`_time_17dx6_80`,error:`_error_17dx6_90`},o={passed:`✓`,failed:`✗`,skipped:`○`,todo:`○`};function s({block:s}){let c=r(s),[l,u]=n(!1),d=l?i(s.suites):s.suites;return t(`figure`,{class:a.block,children:[t(`figcaption`,{class:a.header,children:[s.framework?t(`span`,{class:a.framework,children:s.framework}):null,t(`span`,{class:a.passed,children:e(`tests.passed`,{count:c.passed})}),t(`span`,{class:a.failed,children:e(`tests.failed`,{count:c.failed})}),t(`span`,{children:e(`tests.skipped`,{count:c.skipped+c.todo})}),s.durationMs===void 0?null:t(`span`,{children:e(`tool.duration`,{ms:s.durationMs})}),c.failed?t(`button`,{type:`button`,class:a.filter,"aria-pressed":l,onClick:()=>u(!l),children:e(`tests.onlyFailed`)}):null]}),t(`div`,{class:a.body,children:d.map((n,r)=>t(`section`,{class:a.suite,children:[t(`p`,{class:a.suiteName,children:[n.name,n.file?t(`span`,{class:a.file,children:n.file}):null]}),t(`ul`,{class:a.cases,children:n.cases.map((r,i)=>t(`li`,{"data-status":r.status,children:[t(`span`,{class:a.mark,"aria-label":e(`tests.status.${r.status}`),children:o[r.status]}),t(`span`,{class:a.name,children:r.name}),n.file&&r.line!==void 0?t(`span`,{class:a.file,children:[n.file,`:`,r.line]}):null,r.durationMs===void 0?null:t(`span`,{class:a.time,children:[r.durationMs,` ms`]}),r.error?t(`details`,{class:a.error,open:r.status===`failed`&&n.cases.length<=20,children:[t(`summary`,{children:e(`tests.error`)}),t(`pre`,{children:r.error})]}):null]},i))})]},r))})]})}export{s as default};
@@ -1 +1 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{i as e}from"./mermaid-parser.core-9beuOH8q.js";export{e as createWardleyServices};
1
+ import"./chunk-FOHPRMQF-DzxwRta7.js";import{i as e}from"./mermaid-parser.core-xZ2WHlRI.js";export{e as createWardleyServices};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./mermaid-parser.core-9beuOH8q.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-B6xuSHsQ.js";import{D as r,H as i,K as a,U as o,a as s,b as c,c as l,v as u,w as d,x as f,y as p}from"./chunk-DU6HZSFF-BJuBFcwd.js";import{i as m}from"./chunk-75Z2AOVW-DFYQUeQA.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{f as g}from"./engine-CuFplYJ5.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(h(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let r=await e(`wardley`,t);n.debug(r);let i=S.parser?.yy;if(!i||typeof i.addNode!=`function`)throw Error(`parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);x(r,i)},`parse`)},C=new class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}};function w(){return f()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),s()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:o,getAccTitle:p,setDiagramTitle:a,getDiagramTitle:d,getAccDescription:u,setAccDescription:i},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=f();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=f()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((e,r,i,a)=>{n.debug(`Rendering Wardley map
1
+ import{n as e}from"./mermaid-parser.core-xZ2WHlRI.js";import{n as t}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as n}from"./src-B6xuSHsQ.js";import{D as r,H as i,K as a,U as o,a as s,b as c,c as l,v as u,w as d,x as f,y as p}from"./chunk-DU6HZSFF-CgtANb4X.js";import{i as m}from"./chunk-75Z2AOVW-BR8-_T1K.js";import{t as h}from"./chunk-JWPE2WC7-DVXcaiue.js";import{f as g}from"./engine-DUxyrccI.js";var _=t((e,t)=>{let n=e<=1?e*100:e;if(n<0||n>100)throw Error(`${t} must be between 0-1 (decimal) or 0-100 (percentage). Received: ${e}`);return n},`toPercent`),v=t((e,t,n)=>({x:_(t,`${n} evolution`),y:_(e,`${n} visibility`)}),`toCoordinates`),y=t(e=>{if(e){if(e===`+<>`)return`bidirectional`;if(e===`+<`)return`backward`;if(e===`+>`)return`forward`}},`getFlowFromPort`),b=t(e=>{if(!e?.startsWith(`+`))return{};let t=/^\+'([^']*)'/.exec(e)?.[1];return e.includes(`<>`)?{flow:`bidirectional`,label:t}:e.includes(`<`)?{flow:`backward`,label:t}:e.includes(`>`)?{flow:`forward`,label:t}:{label:t}},`extractFlowFromArrow`),x=t((e,t)=>{if(h(e,t),e.size&&t.setSize(e.size.width,e.size.height),e.evolution){let n=e.evolution.stages.map(e=>e.secondName?`${e.name.trim()} / ${e.secondName.trim()}`:e.name.trim()),r=e.evolution.stages.filter(e=>e.boundary!==void 0).map(e=>e.boundary);t.updateAxes({stages:n,stageBoundaries:r})}if(e.anchors.forEach(e=>{let n=v(e.visibility,e.evolution,`Anchor "${e.name}"`);t.addNode(e.name,e.name,n.x,n.y,`anchor`)}),e.components.forEach(e=>{let n=v(e.visibility,e.evolution,`Component "${e.name}"`),r=e.label?(e.label.negX?-1:1)*e.label.offsetX:void 0,i=e.label?(e.label.negY?-1:1)*e.label.offsetY:void 0,a=e.decorator?.strategy;t.addNode(e.name,e.name,n.x,n.y,`component`,r,i,e.inertia,a)}),e.notes.forEach(e=>{let n=v(e.visibility,e.evolution,`Note "${e.text}"`);t.addNote(e.text,n.x,n.y)}),e.pipelines.forEach(e=>{let n=t.getNode(e.parent);if(!n||typeof n.y!=`number`)throw Error(`Pipeline "${e.parent}" must reference an existing component with coordinates.`);let r=n.y;t.startPipeline(e.parent),e.components.forEach(n=>{let i=`${e.parent}_${n.name}`,a=n.label?(n.label.negX?-1:1)*n.label.offsetX:void 0,o=n.label?(n.label.negY?-1:1)*n.label.offsetY:void 0,s=_(n.evolution,`Pipeline component "${n.name}" evolution`);t.addNode(i,n.name,s,r,`pipeline-component`,a,o),t.addPipelineComponent(e.parent,i)})}),e.links.forEach(e=>{let n=!!e.arrow&&(e.arrow.includes(`-.->`)||e.arrow.includes(`.-.`)),r=y(e.fromPort)??y(e.toPort),{flow:i,label:a}=b(e.arrow);!r&&i&&(r=i);let o=e.linkLabel,s=a??o;t.addLink(t.resolveNodeId(e.from),t.resolveNodeId(e.to),n,s,r)}),e.evolves.forEach(e=>{let n=t.getNode(e.component);if(n?.y!==void 0){let r=_(e.target,`Evolve target for "${e.component}"`);t.addTrend(e.component,r,n.y)}}),e.annotations.length>0){let n=e.annotations[0],r=v(n.x,n.y,`Annotations box`);t.setAnnotationsBox(r.x,r.y)}e.annotation.forEach(e=>{let n=v(e.x,e.y,`Annotation ${e.number}`);t.addAnnotation(e.number,[{x:n.x,y:n.y}],e.text)}),e.accelerators.forEach(e=>{let n=v(e.x,e.y,`Accelerator "${e.name}"`);t.addAccelerator(e.name,n.x,n.y)}),e.deaccelerators.forEach(e=>{let n=v(e.x,e.y,`Deaccelerator "${e.name}"`);t.addDeaccelerator(e.name,n.x,n.y)})},`populateDb`),S={parser:{yy:void 0},parse:t(async t=>{let r=await e(`wardley`,t);n.debug(r);let i=S.parser?.yy;if(!i||typeof i.addNode!=`function`)throw Error(`parser.parser?.yy was not a WardleyDB. This is due to a bug within Mermaid, please report this issue at https://github.com/mermaid-js/mermaid/issues.`);x(r,i)},`parse`)},C=new class{constructor(){this.nodes=new Map,this.links=[],this.trends=new Map,this.pipelines=new Map,this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.axes={}}static{t(this,`WardleyBuilder`)}addNode(e){let t=this.nodes.get(e.id)??{id:e.id,label:e.label},n={...t,...e,className:e.className??t.className,labelOffsetX:e.labelOffsetX??t.labelOffsetX,labelOffsetY:e.labelOffsetY??t.labelOffsetY};this.nodes.set(e.id,n)}addLink(e){this.links.push(e)}addTrend(e){this.trends.set(e.nodeId,e)}startPipeline(e){this.pipelines.set(e,{nodeId:e,componentIds:[]});let t=this.nodes.get(e);t&&(t.isPipelineParent=!0)}addPipelineComponent(e,t){let n=this.pipelines.get(e);n&&n.componentIds.push(t);let r=this.nodes.get(t);r&&(r.inPipeline=!0)}addAnnotation(e){this.annotations.push(e)}addNote(e){this.notes.push(e)}addAccelerator(e){this.accelerators.push(e)}addDeaccelerator(e){this.deaccelerators.push(e)}setAnnotationsBox(e,t){this.annotationsBox={x:e,y:t}}setAxes(e){this.axes={...this.axes,...e}}setSize(e,t){this.size={width:e,height:t}}getNode(e){return this.nodes.get(e)}resolveNodeId(e){if(this.nodes.has(e))return e;for(let[t,n]of this.nodes)if(n.label===e)return t;return e}build(){let e=[];for(let t of this.nodes.values()){if(typeof t.x!=`number`||typeof t.y!=`number`)throw Error(`Node "${t.label}" is missing coordinates`);e.push(t)}return{nodes:e,links:[...this.links],trends:[...this.trends.values()],pipelines:[...this.pipelines.values()],annotations:[...this.annotations],notes:[...this.notes],accelerators:[...this.accelerators],deaccelerators:[...this.deaccelerators],annotationsBox:this.annotationsBox,axes:{...this.axes},size:this.size}}clear(){this.nodes.clear(),this.links=[],this.trends.clear(),this.pipelines.clear(),this.annotations=[],this.notes=[],this.accelerators=[],this.deaccelerators=[],this.annotationsBox=void 0,this.axes={},this.size=void 0}};function w(){return f()[`wardley-beta`]}t(w,`getConfig`);function T(e,t,n,r,i,a,o,s,c){C.addNode({id:e,label:t,x:n,y:r,className:i,labelOffsetX:a,labelOffsetY:o,inertia:s,sourceStrategy:c})}t(T,`addNode`);function E(e,t,n=!1,r,i){C.addLink({source:e,target:t,dashed:n,label:r,flow:i})}t(E,`addLink`);function D(e,t,n){C.addTrend({nodeId:e,targetX:t,targetY:n})}t(D,`addTrend`);function O(e,t,n){C.addAnnotation({number:e,coordinates:t,text:n})}t(O,`addAnnotation`);function k(e,t,n){C.addNote({text:e,x:t,y:n})}t(k,`addNote`);function A(e,t,n){C.addAccelerator({name:e,x:t,y:n})}t(A,`addAccelerator`);function j(e,t,n){C.addDeaccelerator({name:e,x:t,y:n})}t(j,`addDeaccelerator`);function M(e,t){C.setAnnotationsBox(e,t)}t(M,`setAnnotationsBox`);function N(e,t){C.setSize(e,t)}t(N,`setSize`);function P(e){C.startPipeline(e)}t(P,`startPipeline`);function F(e,t){C.addPipelineComponent(e,t)}t(F,`addPipelineComponent`);function I(e){C.setAxes(e)}t(I,`updateAxes`);function L(e){return C.getNode(e)}t(L,`getNode`);function R(e){return C.resolveNodeId(e)}t(R,`resolveNodeId`);function z(){return C.build()}t(z,`getWardleyData`);function B(){C.clear(),s()}t(B,`clear`);var V={getConfig:w,addNode:T,addLink:E,addTrend:D,addAnnotation:O,addNote:k,addAccelerator:A,addDeaccelerator:j,setAnnotationsBox:M,setSize:N,startPipeline:P,addPipelineComponent:F,updateAxes:I,getNode:L,resolveNodeId:R,getWardleyData:z,clear:B,setAccTitle:o,getAccTitle:p,setDiagramTitle:a,getDiagramTitle:d,getAccDescription:u,setAccDescription:i},H=[`Genesis`,`Custom Built`,`Product`,`Commodity`],U=t(()=>{let{themeVariables:e}=f();return{backgroundColor:e.wardley?.backgroundColor??e.background??`#fff`,axisColor:e.wardley?.axisColor??`#000`,axisTextColor:e.wardley?.axisTextColor??e.primaryTextColor??`#222`,gridColor:e.wardley?.gridColor??`rgba(100, 100, 100, 0.2)`,componentFill:e.wardley?.componentFill??`#fff`,componentStroke:e.wardley?.componentStroke??`#000`,componentLabelColor:e.wardley?.componentLabelColor??e.primaryTextColor??`#222`,linkStroke:e.wardley?.linkStroke??`#000`,evolutionStroke:e.wardley?.evolutionStroke??`#dc3545`,annotationStroke:e.wardley?.annotationStroke??`#000`,annotationTextColor:e.wardley?.annotationTextColor??e.primaryTextColor??`#222`,annotationFill:e.wardley?.annotationFill??e.background??`#fff`}},`getTheme`),W=t(()=>{let e=f()[`wardley-beta`];return{width:e?.width??900,height:e?.height??600,padding:e?.padding??48,nodeRadius:e?.nodeRadius??6,nodeLabelOffset:e?.nodeLabelOffset??8,axisFontSize:e?.axisFontSize??12,labelFontSize:e?.labelFontSize??10,showGrid:e?.showGrid??!1,useMaxWidth:e?.useMaxWidth??!0}},`getConfigValues`),G={parser:S,db:V,renderer:{draw:t((e,r,i,a)=>{n.debug(`Rendering Wardley map
2
2
  `+e);let o=W(),s=U(),c=o.nodeRadius*1.6,u=a.db,d=u.getWardleyData(),f=u.getDiagramTitle(),p=d.size?.width??o.width,m=d.size?.height??o.height,h=g(r);h.selectAll(`*`).remove(),l(h,m,p,o.useMaxWidth),h.attr(`viewBox`,`0 0 ${p} ${m}`);let _=h.append(`g`).attr(`class`,`wardley-map`),v=h.append(`defs`);v.append(`marker`).attr(`id`,`arrow-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,9).attr(`refY`,5).attr(`markerWidth`,6).attr(`markerHeight`,6).attr(`orient`,`auto-start-reverse`).append(`path`).attr(`d`,`M 0 0 L 10 5 L 0 10 z`).attr(`fill`,s.evolutionStroke).attr(`stroke`,`none`),v.append(`marker`).attr(`id`,`link-arrow-end-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,9).attr(`refY`,5).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 0 0 L 10 5 L 0 10 z`).attr(`fill`,s.linkStroke).attr(`stroke`,`none`),v.append(`marker`).attr(`id`,`link-arrow-start-${r}`).attr(`viewBox`,`0 0 10 10`).attr(`refX`,1).attr(`refY`,5).attr(`markerWidth`,5).attr(`markerHeight`,5).attr(`orient`,`auto`).append(`path`).attr(`d`,`M 10 0 L 0 5 L 10 10 z`).attr(`fill`,s.linkStroke).attr(`stroke`,`none`),_.append(`rect`).attr(`class`,`wardley-background`).attr(`width`,p).attr(`height`,m).attr(`fill`,s.backgroundColor);let y=p-o.padding*2,b=m-o.padding*2;f&&_.append(`text`).attr(`class`,`wardley-title`).attr(`x`,p/2).attr(`y`,o.padding/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize*1.05).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).text(f);let x=t(e=>o.padding+e/100*y,`projectX`),S=t(e=>m-o.padding-e/100*b,`projectY`),C=_.append(`g`).attr(`class`,`wardley-axes`);C.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,m-o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1),C.append(`line`).attr(`x1`,o.padding).attr(`x2`,o.padding).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.axisColor).attr(`stroke-width`,1);let w=d.axes.xLabel??`Evolution`,T=d.axes.yLabel??`Visibility`;C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-x`).attr(`x`,o.padding+y/2).attr(`y`,m-o.padding/4).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).text(w),C.append(`text`).attr(`class`,`wardley-axis-label wardley-axis-label-y`).attr(`x`,o.padding/3).attr(`y`,o.padding+b/2).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize).attr(`font-weight`,`bold`).attr(`text-anchor`,`middle`).attr(`transform`,`rotate(-90 ${o.padding/3} ${o.padding+b/2})`).text(T);let E=d.axes.stages&&d.axes.stages.length>0?d.axes.stages:H;if(E.length>0){let e=_.append(`g`).attr(`class`,`wardley-stages`),t=d.axes.stageBoundaries,n=[];if(t&&t.length===E.length){let e=0;t.forEach(t=>{n.push({start:e,end:t}),e=t})}else{let e=1/E.length;E.forEach((t,r)=>{n.push({start:r*e,end:(r+1)*e})})}E.forEach((t,r)=>{let i=n[r],a=o.padding+i.start*y,c=(a+(o.padding+i.end*y))/2;r>0&&e.append(`line`).attr(`x1`,a).attr(`x2`,a).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,`#000`).attr(`stroke-width`,1).attr(`stroke-dasharray`,`5 5`).attr(`opacity`,.8),e.append(`text`).attr(`class`,`wardley-stage-label`).attr(`x`,c).attr(`y`,m-o.padding/1.5).attr(`fill`,s.axisTextColor).attr(`font-size`,o.axisFontSize-2).attr(`text-anchor`,`middle`).text(t)})}if(o.showGrid){let e=_.append(`g`).attr(`class`,`wardley-grid`);for(let t=1;t<4;t++){let n=t/4,r=o.padding+y*n;e.append(`line`).attr(`x1`,r).attr(`x2`,r).attr(`y1`,o.padding).attr(`y2`,m-o.padding).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`),e.append(`line`).attr(`x1`,o.padding).attr(`x2`,p-o.padding).attr(`y1`,m-o.padding-b*n).attr(`y2`,m-o.padding-b*n).attr(`stroke`,s.gridColor).attr(`stroke-dasharray`,`2 6`)}}let D=new Map;if(d.nodes.forEach(e=>{D.set(e.id,{x:x(e.x),y:S(e.y),node:e})}),d.pipelines.length>0){let e=_.append(`g`).attr(`class`,`wardley-pipelines`),t=_.append(`g`).attr(`class`,`wardley-pipeline-links`);d.pipelines.forEach(n=>{if(n.componentIds.length===0)return;let r=n.componentIds.map(e=>({id:e,pos:D.get(e),node:d.nodes.find(t=>t.id===e)})).filter(e=>e.pos&&e.node).sort((e,t)=>e.node.x-t.node.x);for(let e=0;e<r.length-1;e++){let n=r[e],i=r[e+1];t.append(`line`).attr(`class`,`wardley-pipeline-evolution-link`).attr(`x1`,n.pos.x).attr(`y1`,n.pos.y).attr(`x2`,i.pos.x).attr(`y2`,i.pos.y).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`)}let i=1/0,a=-1/0,l=0;if(n.componentIds.forEach(e=>{let t=D.get(e);t&&(i=Math.min(i,t.x),a=Math.max(a,t.x),l=t.y)}),i!==1/0&&a!==-1/0){let t=o.nodeRadius*4,r=l-t/2,u=D.get(n.nodeId);u&&(u.x=(i+a)/2,u.y=r-c/6),e.append(`rect`).attr(`class`,`wardley-pipeline-box`).attr(`x`,i-15).attr(`y`,r).attr(`width`,a-i+30).attr(`height`,t).attr(`fill`,`none`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}})}let O=_.append(`g`).attr(`class`,`wardley-links`),k=new Map;d.pipelines.forEach(e=>{k.set(e.nodeId,new Set(e.componentIds))});let A=d.links.filter(e=>!(!D.has(e.source)||!D.has(e.target)||k.get(e.target)?.has(e.source)));O.selectAll(`line`).data(A).enter().append(`line`).attr(`class`,e=>`wardley-link${e.dashed?` wardley-link--dashed`:``}`).attr(`x1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.x+i/s*r}).attr(`y1`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.source).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=n.x-t.x,a=n.y-t.y,s=Math.sqrt(i*i+a*a);return t.y+a/s*r}).attr(`x2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.x+i/s*r}).attr(`y2`,e=>{let t=D.get(e.source),n=D.get(e.target),r=d.nodes.find(t=>t.id===e.target).isPipelineParent?c/Math.sqrt(2):o.nodeRadius,i=t.x-n.x,a=t.y-n.y,s=Math.sqrt(i*i+a*a);return n.y+a/s*r}).attr(`stroke`,s.linkStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,e=>e.dashed?`6 6`:null).attr(`marker-end`,e=>e.flow===`forward`||e.flow===`bidirectional`?`url(#link-arrow-end-${r})`:null).attr(`marker-start`,e=>e.flow===`backward`||e.flow===`bidirectional`?`url(#link-arrow-start-${r})`:null),O.selectAll(`text`).data(A.filter(e=>e.label)).enter().append(`text`).attr(`class`,`wardley-link-label`).attr(`x`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=n.y-t.y,a=n.x-t.x;return r+i/Math.sqrt(a*a+i*i)*8}).attr(`y`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.y+n.y)/2,i=n.x-t.x,a=n.y-t.y,o=Math.sqrt(i*i+a*a);return r+-i/o*8}).attr(`fill`,s.axisTextColor).attr(`font-size`,o.labelFontSize).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`middle`).attr(`transform`,e=>{let t=D.get(e.source),n=D.get(e.target),r=(t.x+n.x)/2,i=(t.y+n.y)/2,a=n.x-t.x,o=n.y-t.y,s=Math.sqrt(a*a+o*o),c=o/s,l=-a/s,u=r+c*8,d=i+l*8,f=Math.atan2(o,a)*180/Math.PI;return(f>90||f<-90)&&(f+=180),`rotate(${f} ${u} ${d})`}).text(e=>e.label);let j=_.append(`g`).attr(`class`,`wardley-trends`),M=d.trends.map(e=>{let t=D.get(e.nodeId);if(!t)return null;let n=x(e.targetX),r=S(e.targetY),i=n-t.x,a=r-t.y,s=Math.sqrt(i*i+a*a),c=o.nodeRadius+2;return{origin:t,targetX:n,targetY:r,adjustedX2:s>c?n-i/s*c:n,adjustedY2:s>c?r-a/s*c:r}}).filter(e=>e!==null);j.selectAll(`line`).data(M).enter().append(`line`).attr(`class`,`wardley-trend`).attr(`x1`,e=>e.origin.x).attr(`y1`,e=>e.origin.y).attr(`x2`,e=>e.adjustedX2).attr(`y2`,e=>e.adjustedY2).attr(`stroke`,s.evolutionStroke).attr(`stroke-width`,1).attr(`stroke-dasharray`,`4 4`).attr(`marker-end`,`url(#arrow-${r})`);let N=_.append(`g`).attr(`class`,`wardley-nodes`).selectAll(`g`).data(d.nodes).enter().append(`g`).attr(`class`,e=>[`wardley-node`,e.className?`wardley-node--${e.className}`:``].filter(Boolean).join(` `));N.filter(e=>e.sourceStrategy===`outsource`).append(`circle`).attr(`class`,`wardley-outsource-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#666`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`buy`).append(`circle`).attr(`class`,`wardley-buy-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#ccc`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.sourceStrategy===`build`).append(`circle`).attr(`class`,`wardley-build-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`#eee`).attr(`stroke`,`#000`).attr(`stroke-width`,1);let P=N.filter(e=>e.sourceStrategy===`market`);P.append(`circle`).attr(`class`,`wardley-market-overlay`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius*2).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>!e.isPipelineParent&&e.sourceStrategy!==`market`&&e.className!==`anchor`).append(`circle`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y).attr(`r`,o.nodeRadius).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1);let F=o.nodeRadius*.7,I=o.nodeRadius*1.2;if(P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x).attr(`y1`,e=>D.get(e.id).y-I).attr(`x2`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y2`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`line`).attr(`class`,`wardley-market-line`).attr(`x1`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`y1`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`x2`,e=>D.get(e.id).x).attr(`y2`,e=>D.get(e.id).y-I).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x).attr(`cy`,e=>D.get(e.id).y-I).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x-I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),P.append(`circle`).attr(`class`,`wardley-market-dot`).attr(`cx`,e=>D.get(e.id).x+I*Math.cos(Math.PI/6)).attr(`cy`,e=>D.get(e.id).y+I*Math.sin(Math.PI/6)).attr(`r`,F).attr(`fill`,`white`).attr(`stroke`,s.componentStroke).attr(`stroke-width`,2),N.filter(e=>e.isPipelineParent===!0).append(`rect`).attr(`x`,e=>D.get(e.id).x-c/2).attr(`y`,e=>D.get(e.id).y-c/2).attr(`width`,c).attr(`height`,c).attr(`fill`,s.componentFill).attr(`stroke`,s.componentStroke).attr(`stroke-width`,1),N.filter(e=>e.inertia===!0).append(`line`).attr(`class`,`wardley-inertia`).attr(`x1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y1`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c:o.nodeRadius*2;return t.y-n/2}).attr(`x2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c/2+15:o.nodeRadius+15;return e.sourceStrategy&&(n+=o.nodeRadius+10),t.x+n}).attr(`y2`,e=>{let t=D.get(e.id),n=e.isPipelineParent?c:o.nodeRadius*2;return t.y+n/2}).attr(`stroke`,s.componentStroke).attr(`stroke-width`,6),N.append(`text`).attr(`x`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetX===void 0?t.x:t.x+e.labelOffsetX;let n=o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetX===void 0&&(n+=10);let r=e.labelOffsetX??n;return t.x+r}).attr(`y`,e=>{let t=D.get(e.id);if(e.className===`anchor`)return e.labelOffsetY===void 0?t.y-3:t.y+e.labelOffsetY;let n=-o.nodeLabelOffset;e.sourceStrategy&&e.labelOffsetY===void 0&&(n-=10);let r=e.labelOffsetY??n;return t.y+r}).attr(`class`,`wardley-node-label`).attr(`fill`,e=>e.className===`evolved`?s.evolutionStroke:e.className===`anchor`?`#000`:s.componentLabelColor).attr(`font-size`,o.labelFontSize).attr(`font-weight`,e=>e.className===`anchor`?`bold`:`normal`).attr(`text-anchor`,e=>e.className===`anchor`?`middle`:`start`).attr(`dominant-baseline`,e=>e.className===`anchor`?`middle`:`auto`).text(e=>e.label),d.annotations.length>0){let e=_.append(`g`).attr(`class`,`wardley-annotations`);if(d.annotations.forEach(t=>{let n=t.coordinates.map(e=>({x:x(e.x),y:S(e.y)}));if(n.length>1)for(let t=0;t<n.length-1;t++)e.append(`line`).attr(`class`,`wardley-annotation-line`).attr(`x1`,n[t].x).attr(`y1`,n[t].y).attr(`x2`,n[t+1].x).attr(`y2`,n[t+1].y).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`stroke-dasharray`,`4 4`);n.forEach(n=>{let r=e.append(`g`).attr(`class`,`wardley-annotation`);r.append(`circle`).attr(`cx`,n.x).attr(`cy`,n.y).attr(`r`,10).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5),r.append(`text`).attr(`x`,n.x).attr(`y`,n.y).attr(`text-anchor`,`middle`).attr(`dominant-baseline`,`central`).attr(`font-size`,10).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.number)})}),d.annotationsBox){let t=x(d.annotationsBox.x),n=S(d.annotationsBox.y),r=e.append(`g`).attr(`class`,`wardley-annotations-box`),i=[...d.annotations].filter(e=>e.text).sort((e,t)=>e.number-t.number),a=[];if(i.forEach((e,i)=>{let o=r.append(`text`).attr(`x`,t+10).attr(`y`,n+10+(i+1)*16).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`text-anchor`,`start`).attr(`dominant-baseline`,`middle`).text(`${e.number}. ${e.text}`);a.push(o)}),a.length>0){let e=0,c=0;a.forEach(t=>{let n=t.node(),r=n.getComputedTextLength();e=Math.max(e,r);let i=n.getBBox();c=Math.max(c,i.height)});let l=e+20+105,u=i.length*16+20+c/2,d=o.padding,f=p-o.padding-l,h=o.padding,g=m-o.padding-u;t=Math.max(d,Math.min(t,f)),n=Math.max(h,Math.min(n,g)),a.forEach((e,r)=>{e.attr(`x`,t+10).attr(`y`,n+10+(r+1)*16)}),r.insert(`rect`,`text`).attr(`x`,t).attr(`y`,n).attr(`width`,l).attr(`height`,u).attr(`fill`,`white`).attr(`stroke`,s.axisColor).attr(`stroke-width`,1.5).attr(`rx`,4).attr(`ry`,4)}}}if(d.notes.length>0){let e=_.append(`g`).attr(`class`,`wardley-notes`);d.notes.forEach(t=>{let n=x(t.x),r=S(t.y);e.append(`text`).attr(`x`,n).attr(`y`,r).attr(`text-anchor`,`start`).attr(`font-size`,11).attr(`fill`,s.axisTextColor).attr(`font-weight`,`bold`).text(t.text)})}if(d.accelerators.length>0){let e=_.append(`g`).attr(`class`,`wardley-accelerators`);d.accelerators.forEach(t=>{let n=x(t.x),r=S(t.y),i=`
3
3
  M ${n} ${r-15}
4
4
  L ${n+60-20} ${r-15}
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-B6xuSHsQ.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-DU6HZSFF-BJuBFcwd.js";import{t as m}from"./linear-SzVmGSw4.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./init-C-OQMol4.js";import{i as _}from"./chunk-75Z2AOVW-DFYQUeQA.js";import{t as v}from"./line-CESetX3B.js";import"./chunk-PWAF6VOD-BzM7cl8Q.js";import{t as y}from"./chunk-GMAD6QVW-DOqNcbFg.js";import{f as b}from"./engine-CuFplYJ5.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,36,37,38],E=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],D=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],O=[1,65],k=[26,28],A={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,28:`COMMA`,29:`NUMBER_WITH_DECIMAL`,30:`STR`,33:`ARROW_DELIMITER`,36:`NEWLINE`,37:`SEMI`,38:`EOF`,40:`MD_STR`,42:`AMP`,43:`NUM`,44:`ALPHA`,45:`PLUS`,46:`EQUALS`,47:`MULT`,48:`DOT`,49:`BRKT`,50:`MINUS`,51:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:case 30:this.$=[a[s-2],...a[s]];break;case 21:case 31:this.$=[a[s]];break;case 22:this.$={value:Number(a[s-1]),label:a[s]};break;case 23:this.$={value:Number(a[s]),label:``};break;case 24:r.setXAxisTitle(a[s]);break;case 25:r.setXAxisTitle(a[s-1]);break;case 26:r.setXAxisTitle({type:`text`,text:``});break;case 27:r.setXAxisBand(a[s]);break;case 28:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 29:this.$=a[s-1];break;case 32:r.setYAxisTitle(a[s]);break;case 33:r.setYAxisTitle(a[s-1]);break;case 34:r.setYAxisTitle({type:`text`,text:``});break;case 35:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 39:this.$={text:a[s],type:`text`};break;case 40:this.$={text:a[s],type:`text`};break;case 41:this.$={text:a[s],type:`markdown`};break;case 42:this.$=a[s];break;case 43:this.$=a[s-1]+``+a[s]}},`anonymous`),table:[t(n,r,{3:1,4:2,7:4,5:i,36:a,37:o,38:s}),{1:[3]},t(n,r,{4:2,7:4,3:8,5:i,36:a,37:o,38:s}),t(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],36:a,37:o,38:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(c,[2,36]),t(c,[2,37]),t(c,[2,38]),{1:[2,1]},t(n,r,{4:2,7:4,3:21,5:i,36:a,37:o,38:s}),{1:[2,3]},t(c,[2,5]),t(n,[2,7],{4:22,36:a,37:o,38:s}),{11:23,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:39,13:38,24:x,29:S,30:l,31:40,32:41,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:45,15:44,29:C,30:l,35:46,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:49,17:48,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:52,17:51,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{20:[1,53]},{22:[1,54]},t(T,[2,18]),{1:[2,2]},t(T,[2,8]),t(T,[2,9]),t(E,[2,39],{41:55,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b}),t(E,[2,40]),t(E,[2,41]),t(D,[2,42]),t(D,[2,44]),t(D,[2,45]),t(D,[2,46]),t(D,[2,47]),t(D,[2,48]),t(D,[2,49]),t(D,[2,50]),t(D,[2,51]),t(D,[2,52]),t(D,[2,53]),t(T,[2,10]),t(T,[2,24],{32:41,31:56,24:x,29:S}),t(T,[2,26]),t(T,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},t(T,[2,11]),t(T,[2,32],{35:60,29:C}),t(T,[2,34]),{33:[1,61]},t(T,[2,12]),{17:62,24:w},{25:63,27:64,29:O},t(T,[2,14]),{17:66,24:w},t(T,[2,16]),t(T,[2,17]),t(D,[2,43]),t(T,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(T,[2,33]),{29:[1,70]},t(T,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(k,[2,23],{30:[1,73]}),t(T,[2,15]),t(T,[2,28]),t(T,[2,29]),{11:59,30:l,34:74,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},t(T,[2,35]),t(T,[2,19]),{25:75,27:64,29:O},t(k,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
1
+ import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import{m as t}from"./src-B6xuSHsQ.js";import{D as n,H as r,K as i,U as a,a as o,b as s,c,f as l,v as u,w as d,y as f,z as p}from"./chunk-DU6HZSFF-CgtANb4X.js";import{t as m}from"./linear-SzVmGSw4.js";import{t as h}from"./ordinal-BDEzSJ7C.js";import{t as g}from"./init-C-OQMol4.js";import{i as _}from"./chunk-75Z2AOVW-BR8-_T1K.js";import{t as v}from"./line-BBeV3vfV.js";import"./chunk-PWAF6VOD-DYoILyGR.js";import{t as y}from"./chunk-GMAD6QVW-ajMpCrE1.js";import{f as b}from"./engine-DUxyrccI.js";function x(e,t,n){e=+e,t=+t,n=(i=arguments.length)<2?(t=e,e=0,1):i<3?1:+n;for(var r=-1,i=Math.max(0,Math.ceil((t-e)/n))|0,a=Array(i);++r<i;)a[r]=e+r*n;return a}function S(){var e=h().unknown(void 0),t=e.domain,n=e.range,r=0,i=1,a,o,s=!1,c=0,l=0,u=.5;delete e.unknown;function d(){var e=t().length,d=i<r,f=d?i:r,p=d?r:i;a=(p-f)/Math.max(1,e-c+l*2),s&&(a=Math.floor(a)),f+=(p-f-a*(e-c))*u,o=a*(1-c),s&&(f=Math.round(f),o=Math.round(o));var m=x(e).map(function(e){return f+a*e});return n(d?m.reverse():m)}return e.domain=function(e){return arguments.length?(t(e),d()):t()},e.range=function(e){return arguments.length?([r,i]=e,r=+r,i=+i,d()):[r,i]},e.rangeRound=function(e){return[r,i]=e,r=+r,i=+i,s=!0,d()},e.bandwidth=function(){return o},e.step=function(){return a},e.round=function(e){return arguments.length?(s=!!e,d()):s},e.padding=function(e){return arguments.length?(c=Math.min(1,l=+e),d()):c},e.paddingInner=function(e){return arguments.length?(c=Math.min(1,e),d()):c},e.paddingOuter=function(e){return arguments.length?(l=+e,d()):l},e.align=function(e){return arguments.length?(u=Math.max(0,Math.min(1,e)),d()):u},e.copy=function(){return S(t(),[r,i]).round(s).paddingInner(c).paddingOuter(l).align(u)},g.apply(d(),arguments)}var C=(function(){var t=e(function(e,t,n,r){for(n||={},r=e.length;r--;n[e[r]]=t);return n},`o`),n=[1,10,12,14,16,18,19,21,23],r=[2,6],i=[1,3],a=[1,5],o=[1,6],s=[1,7],c=[1,5,10,12,14,16,18,19,21,23,36,37,38],l=[1,25],u=[1,26],d=[1,28],f=[1,29],p=[1,30],m=[1,31],h=[1,32],g=[1,33],_=[1,34],v=[1,35],y=[1,36],b=[1,37],x=[1,43],S=[1,42],C=[1,47],w=[1,50],T=[1,10,12,14,16,18,19,21,23,36,37,38],E=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38],D=[1,10,12,14,16,18,19,21,23,24,26,28,29,36,37,38,42,43,44,45,46,47,48,49,50,51],O=[1,65],k=[26,28],A={trace:e(function(){},`trace`),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,dataPoints:25,SQUARE_BRACES_END:26,dataPoint:27,COMMA:28,NUMBER_WITH_DECIMAL:29,STR:30,xAxisData:31,bandData:32,ARROW_DELIMITER:33,commaSeparatedTexts:34,yAxisData:35,NEWLINE:36,SEMI:37,EOF:38,alphaNum:39,MD_STR:40,alphaNumToken:41,AMP:42,NUM:43,ALPHA:44,PLUS:45,EQUALS:46,MULT:47,DOT:48,BRKT:49,MINUS:50,UNDERSCORE:51,$accept:0,$end:1},terminals_:{2:`error`,5:`XYCHART`,8:`CHART_ORIENTATION`,10:`title`,12:`X_AXIS`,14:`Y_AXIS`,16:`LINE`,18:`BAR`,19:`acc_title`,20:`acc_title_value`,21:`acc_descr`,22:`acc_descr_value`,23:`acc_descr_multiline_value`,24:`SQUARE_BRACES_START`,26:`SQUARE_BRACES_END`,28:`COMMA`,29:`NUMBER_WITH_DECIMAL`,30:`STR`,33:`ARROW_DELIMITER`,36:`NEWLINE`,37:`SEMI`,38:`EOF`,40:`MD_STR`,42:`AMP`,43:`NUM`,44:`ALPHA`,45:`PLUS`,46:`EQUALS`,47:`MULT`,48:`DOT`,49:`BRKT`,50:`MINUS`,51:`UNDERSCORE`},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[27,2],[27,1],[13,1],[13,2],[13,1],[31,1],[31,3],[32,3],[34,3],[34,1],[15,1],[15,2],[15,1],[35,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[39,1],[39,2],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1],[41,1]],performAction:e(function(e,t,n,r,i,a,o){var s=a.length-1;switch(i){case 5:r.setOrientation(a[s]);break;case 9:r.setDiagramTitle(a[s].text.trim());break;case 12:r.setLineData({text:``,type:`text`},a[s]);break;case 13:r.setLineData(a[s-1],a[s]);break;case 14:r.setBarData({text:``,type:`text`},a[s]);break;case 15:r.setBarData(a[s-1],a[s]);break;case 16:this.$=a[s].trim(),r.setAccTitle(this.$);break;case 17:case 18:this.$=a[s].trim(),r.setAccDescription(this.$);break;case 19:this.$=a[s-1];break;case 20:case 30:this.$=[a[s-2],...a[s]];break;case 21:case 31:this.$=[a[s]];break;case 22:this.$={value:Number(a[s-1]),label:a[s]};break;case 23:this.$={value:Number(a[s]),label:``};break;case 24:r.setXAxisTitle(a[s]);break;case 25:r.setXAxisTitle(a[s-1]);break;case 26:r.setXAxisTitle({type:`text`,text:``});break;case 27:r.setXAxisBand(a[s]);break;case 28:r.setXAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 29:this.$=a[s-1];break;case 32:r.setYAxisTitle(a[s]);break;case 33:r.setYAxisTitle(a[s-1]);break;case 34:r.setYAxisTitle({type:`text`,text:``});break;case 35:r.setYAxisRangeData(Number(a[s-2]),Number(a[s]));break;case 39:this.$={text:a[s],type:`text`};break;case 40:this.$={text:a[s],type:`text`};break;case 41:this.$={text:a[s],type:`markdown`};break;case 42:this.$=a[s];break;case 43:this.$=a[s-1]+``+a[s]}},`anonymous`),table:[t(n,r,{3:1,4:2,7:4,5:i,36:a,37:o,38:s}),{1:[3]},t(n,r,{4:2,7:4,3:8,5:i,36:a,37:o,38:s}),t(n,r,{4:2,7:4,6:9,3:10,5:i,8:[1,11],36:a,37:o,38:s}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},t(c,[2,36]),t(c,[2,37]),t(c,[2,38]),{1:[2,1]},t(n,r,{4:2,7:4,3:21,5:i,36:a,37:o,38:s}),{1:[2,3]},t(c,[2,5]),t(n,[2,7],{4:22,36:a,37:o,38:s}),{11:23,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:39,13:38,24:x,29:S,30:l,31:40,32:41,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:45,15:44,29:C,30:l,35:46,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:49,17:48,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{11:52,17:51,24:w,30:l,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},{20:[1,53]},{22:[1,54]},t(T,[2,18]),{1:[2,2]},t(T,[2,8]),t(T,[2,9]),t(E,[2,39],{41:55,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b}),t(E,[2,40]),t(E,[2,41]),t(D,[2,42]),t(D,[2,44]),t(D,[2,45]),t(D,[2,46]),t(D,[2,47]),t(D,[2,48]),t(D,[2,49]),t(D,[2,50]),t(D,[2,51]),t(D,[2,52]),t(D,[2,53]),t(T,[2,10]),t(T,[2,24],{32:41,31:56,24:x,29:S}),t(T,[2,26]),t(T,[2,27]),{33:[1,57]},{11:59,30:l,34:58,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},t(T,[2,11]),t(T,[2,32],{35:60,29:C}),t(T,[2,34]),{33:[1,61]},t(T,[2,12]),{17:62,24:w},{25:63,27:64,29:O},t(T,[2,14]),{17:66,24:w},t(T,[2,16]),t(T,[2,17]),t(D,[2,43]),t(T,[2,25]),{29:[1,67]},{26:[1,68]},{26:[2,31],28:[1,69]},t(T,[2,33]),{29:[1,70]},t(T,[2,13]),{26:[1,71]},{26:[2,21],28:[1,72]},t(k,[2,23],{30:[1,73]}),t(T,[2,15]),t(T,[2,28]),t(T,[2,29]),{11:59,30:l,34:74,39:24,40:u,41:27,42:d,43:f,44:p,45:m,46:h,47:g,48:_,49:v,50:y,51:b},t(T,[2,35]),t(T,[2,19]),{25:75,27:64,29:O},t(k,[2,22]),{26:[2,30]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],74:[2,30],75:[2,20]},parseError:e(function(e,t){if(t.recoverable)this.trace(e);else{var n=Error(e);throw n.hash=t,n}},`parseError`),parse:e(function(t){var n=this,r=[0],i=[],a=[null],o=[],s=this.table,c=``,l=0,u=0,d=0,f=2,p=1,m=o.slice.call(arguments,1),h=Object.create(this.lexer),g={yy:{}};for(var _ in this.yy)Object.prototype.hasOwnProperty.call(this.yy,_)&&(g.yy[_]=this.yy[_]);h.setInput(t,g.yy),g.yy.lexer=h,g.yy.parser=this,h.yylloc===void 0&&(h.yylloc={});var v=h.yylloc;o.push(v);var y=h.options&&h.options.ranges;this.parseError=typeof g.yy.parseError==`function`?g.yy.parseError:Object.getPrototypeOf(this).parseError;function b(e){r.length-=2*e,a.length-=e,o.length-=e}e(b,`popStack`);function x(){var e=i.pop()||h.lex()||p;return typeof e!=`number`&&(e instanceof Array&&(i=e,e=i.pop()),e=n.symbols_[e]||e),e}e(x,`lex`);for(var S,C,w,T,E,D={},O,k,A,j;;){if(w=r[r.length-1],this.defaultActions[w]?T=this.defaultActions[w]:(S??=x(),T=s[w]&&s[w][S]),T===void 0||!T.length||!T[0]){var M=``;for(O in j=[],s[w])this.terminals_[O]&&O>f&&j.push(`'`+this.terminals_[O]+`'`);M=h.showPosition?`Parse error on line `+(l+1)+`:
2
2
  `+h.showPosition()+`
3
3
  Expecting `+j.join(`, `)+`, got '`+(this.terminals_[S]||S)+`'`:`Parse error on line `+(l+1)+`: Unexpected `+(S==p?`end of input`:`'`+(this.terminals_[S]||S)+`'`),this.parseError(M,{text:h.match,token:this.terminals_[S]||S,line:h.yylineno,loc:v,expected:j})}if(T[0]instanceof Array&&T.length>1)throw Error(`Parse Error: multiple actions possible at state: `+w+`, token: `+S);switch(T[0]){case 1:r.push(S),a.push(h.yytext),o.push(h.yylloc),r.push(T[1]),S=null,C?(S=C,C=null):(u=h.yyleng,c=h.yytext,l=h.yylineno,v=h.yylloc,d>0&&d--);break;case 2:if(k=this.productions_[T[1]][1],D.$=a[a.length-k],D._$={first_line:o[o.length-(k||1)].first_line,last_line:o[o.length-1].last_line,first_column:o[o.length-(k||1)].first_column,last_column:o[o.length-1].last_column},y&&(D._$.range=[o[o.length-(k||1)].range[0],o[o.length-1].range[1]]),E=this.performAction.apply(D,[c,u,l,g.yy,T[1],a,o].concat(m)),E!==void 0)return E;k&&(r=r.slice(0,-1*k*2),a=a.slice(0,-1*k),o=o.slice(0,-1*k)),r.push(this.productions_[T[1]][0]),a.push(D.$),o.push(D._$),A=s[r[r.length-2]][r[r.length-1]],r.push(A);break;case 3:return!0}}return!0},`parse`)};A.lexer=(function(){return{EOF:1,parseError:e(function(e,t){if(this.yy.parser)this.yy.parser.parseError(e,t);else throw Error(e)},`parseError`),setInput:e(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:e(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:e(function(e){var t=e.length,n=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 r=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),n.length-1&&(this.yylineno-=n.length-1);var i=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:n?(n.length===r.length?this.yylloc.first_column:0)+r[r.length-n.length].length-n[0].length:this.yylloc.first_column-t},this.options.ranges&&(this.yylloc.range=[i[0],i[0]+this.yyleng-t]),this.yyleng=this.yytext.length,this},`unput`),more:e(function(){return this._more=!0,this},`more`),reject:e(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return 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).
4
4
  `+this.showPosition(),{text:``,token:null,line:this.yylineno});return this},`reject`),less:e(function(e){this.unput(this.match.slice(e))},`less`),pastInput:e(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:e(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:e(function(){var e=this.pastInput(),t=Array(e.length+1).join(`-`);return e+this.upcomingInput()+`
@@ -8,10 +8,12 @@
8
8
  <link rel="icon" type="image/png" href="/favicon.png" />
9
9
  <link rel="apple-touch-icon" href="/favicon.png" />
10
10
  <script>(function(){var p="dark";try{p=localStorage.getItem("alisio.theme")||"dark"}catch(e){}var d=p==="system"?(matchMedia("(prefers-color-scheme: light)").matches?"light":"dark"):p==="light"?"light":"dark";document.documentElement.setAttribute("data-theme",d)})()</script>
11
- <script type="module" crossorigin src="/assets/index-DFURIQeX.js"></script>
12
- <link rel="modulepreload" crossorigin href="/assets/jsxRuntime-B237YiZZ.js">
13
- <link rel="modulepreload" crossorigin href="/assets/icons-BuSI35ng.js">
14
- <link rel="stylesheet" crossorigin href="/assets/index-Duk7lhBO.css">
11
+ <script type="module" crossorigin src="/assets/index-lCAk_Rn7.js"></script>
12
+ <link rel="modulepreload" crossorigin href="/assets/jsxRuntime-DJRCfs_u.js">
13
+ <link rel="modulepreload" crossorigin href="/assets/app-DP2KtZ7m.js">
14
+ <link rel="modulepreload" crossorigin href="/assets/icons-dCLC5DFa.js">
15
+ <link rel="modulepreload" crossorigin href="/assets/clipboard-hOiC7lD8.js">
16
+ <link rel="stylesheet" crossorigin href="/assets/index-CRb-14T4.css">
15
17
  </head>
16
18
  <body>
17
19
  <div id="app"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alisio/server",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.7",
4
4
  "description": "Local HTTP + SSE server behind `alisio serve`: multi-workspace, multi-session web access to the Alisio agent core with a launch-token cookie, strict Host/Origin checks and fail-closed approvals. node:http only; runs on Node >=22.16 and Bun.",
5
5
  "author": "Gustavo Gutiérrez",
6
6
  "license": "MIT",
@@ -39,8 +39,8 @@
39
39
  "node": ">=22.16"
40
40
  },
41
41
  "dependencies": {
42
- "@alisio/core": "0.1.0-alpha.21",
43
- "@alisio/sdk": "0.1.0-alpha.17"
42
+ "@alisio/core": "0.1.0-alpha.23",
43
+ "@alisio/sdk": "0.1.0-alpha.19"
44
44
  },
45
45
  "devDependencies": {
46
46
  "@alisio/web": "0.1.0-alpha.1"
@@ -1 +0,0 @@
1
- import{_ as e,a as t,g as n,p as r,t as i}from"./jsxRuntime-B237YiZZ.js";import{t as a}from"./icons-BuSI35ng.js";import{b as o,g as s,h as c,m as l,p as u}from"./index-DFURIQeX.js";import{b as d,t as f,u as p}from"./agents.module-lYyQTI6Z.js";import{a as m,c as h,i as g,l as _,r as v,u as y}from"./shared-sr65xU-a.js";function b(){let b=h(),x=_(b?()=>s.agents(b.id):void 0,[b?.id],[`agents`]),S=_(()=>s.agentDefinitions(b?.id),[b?.id],[`agents`]),[C,w]=n(``),[T,E]=n(0),D=r(null);e(()=>{let e=document.activeElement;return D.current?.querySelector(`input`)?.focus(),()=>e?.focus()},[]);let O=()=>{l.value=!1},k=o.value?.agent??x.data?.find(e=>e.default)?.id,A=p(x.data??[],C),j=e=>{O(),u(e.id)},M=e=>{let n=d(e,S.data?.agents??[]);return n?i(v,{tone:n===`project`?`ok`:`off`,children:t(`agentsWin.scope.${n}`)}):i(v,{tone:`off`,children:e.source===`builtin`?t(`agentsWin.builtin`):t(`agentsWin.plugin`)})};return i(`div`,{class:y.backdrop,onMouseDown:e=>{e.target===e.currentTarget&&O()},children:i(`div`,{ref:D,class:`${y.dialog} ${f.picker}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agent-picker-title`,onKeyDown:e=>{if(e.key===`Escape`)e.preventDefault(),O();else if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault();let t=e.key===`ArrowDown`?1:-1;E(e=>A.length?(e+t+A.length)%A.length:0)}else if(e.key===`Enter`&&e.target.tagName===`INPUT`){e.preventDefault();let t=A[Math.min(T,A.length-1)];t&&j(t)}},children:[i(`div`,{class:f.pickerHead,children:[i(`div`,{class:f.listHead,children:[i(`div`,{children:[i(`h3`,{class:y.pageTitle,id:`agent-picker-title`,children:t(`agentsWin.picker`)}),i(`p`,{class:y.note,children:t(`agentsWin.pickerLead`)})]}),i(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`common.close`),onClick:O,children:i(a,{name:`x`,size:18})})]}),i(g,{value:C,label:t(`agentsWin.pickerSearch`),onInput:e=>{w(e),E(0)}})]}),i(`div`,{style:{padding:`0 18px`},children:i(m,{loading:x.loading&&!x.data,error:x.error,empty:b?void 0:`settings.noWorkspace`})}),i(`ul`,{class:f.pickerList,"aria-label":t(`agentsWin.picker`),children:[x.data&&!A.length?i(`li`,{class:y.note,children:t(`agentsWin.pickerEmpty`,{query:C})}):null,A.map((e,n)=>i(`li`,{children:i(`button`,{type:`button`,class:f.pickerItem,"data-selected":n===T,"aria-current":e.id===k?`true`:void 0,onMouseEnter:()=>E(n),onClick:()=>j(e),children:[i(`span`,{class:f.pickerTitle,children:[e.name,M(e),e.id===k?i(v,{tone:`ok`,children:t(`agentsWin.current`)}):null,e.id===`build`?i(v,{tone:`off`,children:t(`agentsWin.defaultAgent`)}):null,e.readOnly?i(v,{tone:`warn`,children:t(`agents.readOnly`)}):null]}),i(`span`,{class:y.cardText,children:e.description})]})},e.id)),i(`li`,{children:i(`button`,{type:`button`,class:f.pickerItem,onClick:()=>{O(),c.value=!0},children:i(`span`,{class:f.pickerTitle,children:[i(a,{name:`users`,size:15}),t(`agentsWin.manage`)]})})})]})]})})}export{b as AgentPicker};
@@ -1,2 +0,0 @@
1
- import{_ as e,a as t,b as n,c as r,g as i,m as a,p as o,s,t as c}from"./jsxRuntime-B237YiZZ.js";import{t as l}from"./icons-BuSI35ng.js";import{C as u,E as d,O as f,d as p,g as m,h,k as g,w as _,x as v}from"./index-DFURIQeX.js";import{S as y,_ as b,a as x,c as S,d as C,f as ee,g as w,h as T,i as E,l as D,m as O,n as k,o as A,p as te,r as j,s as ne,t as M,v as re,x as ie,y as ae}from"./agents.module-lYyQTI6Z.js";import{a as N,c as P,l as F,r as I,u as L}from"./shared-sr65xU-a.js";var R=new Set([`minimal`,`low`,`medium`,`high`,`xhigh`]),z=e=>R.has(e)?t(`agentsWin.level.${e}`):e;function B(e){let[t,n]=i(!0);return c(`section`,{class:M.section,children:[c(`button`,{type:`button`,class:M.sectionHead,"aria-expanded":t,onClick:()=>n(!t),children:[c(l,{name:t?`chevronDown`:`chevronRight`,size:15}),e.title]}),t?c(`div`,{class:M.sectionBody,children:e.children}):null]})}function V(e){return c(`label`,{class:M.field,children:[c(`span`,{class:M.fieldLabel,children:[e.label,e.hint?c(`span`,{class:M.fieldHint,children:e.hint}):null]}),e.children,e.error?c(`span`,{class:M.fieldError,children:e.error}):null]})}function oe(e){let n=e.text.split(`
2
- `);return c(`section`,{class:M.code,"aria-label":t(`agentsWin.config`),children:[c(`div`,{class:M.codeHead,children:[c(`span`,{children:t(`agentsWin.config`)}),c(p,{text:()=>e.text,label:t(`agentsWin.configCopy`)})]}),c(`p`,{class:L.note,style:{margin:`8px 16px 0`},children:t(`agentsWin.configLead`)}),c(`pre`,{class:M.codeBody,children:c(`code`,{children:n.map((e,t)=>c(`span`,{class:M.codeLine,children:[c(`span`,{class:M.lineNo,"aria-hidden":`true`,children:t+1}),c(`span`,{children:y(e).map((e,t)=>c(`span`,{class:M[`tok-${e.kind}`],children:e.text},t))})]},t))})})]})}function se(n){let[r,a]=i(Date.now()),s=o(null);return e(()=>{s.current?.focus();let e=setInterval(()=>a(Date.now()),1e3);return()=>clearInterval(e)},[]),c(`div`,{class:M.overlay,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`building-title`,"aria-describedby":`building-body`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),n.onCancel())},children:c(`div`,{class:M.overlayCard,children:[c(`div`,{class:M.spinner,"aria-hidden":`true`}),c(`h3`,{class:M.overlayTitle,id:`building-title`,children:t(`agentsWin.building`)}),c(`p`,{class:L.note,id:`building-body`,role:`status`,children:t(`agentsWin.buildingBody`,{model:n.model})}),c(`div`,{class:M.progress,"aria-hidden":`true`,children:c(`div`,{class:M.progressBar})}),c(`p`,{class:L.meta,children:t(`agentsWin.buildingElapsed`,{seconds:Math.max(0,Math.round((r-n.started)/1e3))})}),c(`div`,{class:M.overlayActions,children:c(`button`,{ref:s,type:`button`,class:L.secondary,onClick:n.onCancel,children:t(`common.cancel`)})})]})})}function ce(n){let r=o(null);return e(()=>r.current?.focus(),[]),c(`div`,{class:M.overlay,role:`alertdialog`,"aria-modal":`true`,"aria-labelledby":`created-title`,onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),n.onStay())},children:c(`div`,{class:M.overlayCard,children:[c(`h3`,{class:M.overlayTitle,id:`created-title`,children:t(`agentsWin.createdTitle`,{name:n.name})}),c(`p`,{class:L.note,children:n.live?t(`agentsWin.createdBody`):t(`agentsWin.createdRestart`)}),c(`div`,{class:M.overlayActions,children:[n.live?c(`button`,{ref:r,type:`button`,class:L.primary,onClick:n.onTry,children:t(`agentsWin.tryIt`)}):null,c(`button`,{ref:n.live?void 0:r,type:`button`,class:L.secondary,onClick:n.onStay,children:t(`agentsWin.stay`)})]})]})})}function H(r){let{workspace:o,models:s}=r,[p,y]=i(r.initial),[D,O]=i(r.saved),[P,I]=i(`setup`),[R,H]=i(``),[U,W]=i(),[G,K]=i(),[le,ue]=i(!1),[q,J]=i(),[de,fe]=i(!b());e(()=>{if(!p.model&&s?.length){let e=s.find(e=>e.active)??s[0];e&&y(t=>C({...t,model:e.reference},e.capabilities))}},[s]);let pe=!D||T(p)!==T(D);e(()=>r.onDirty(pe&&!!D),[pe,D]);let Y=ne(s,p.model),X=F(D?.id?()=>m.agentSessions(D.id):void 0,[D?.id],[`agents`]),me=r.overview?.scopes??(o?[`project`,`global`]:[`global`]),Z=e=>y(t=>({...t,...e})),he=a(()=>x(p,{origin:typeof location<`u`?location.origin:`http://127.0.0.1:4096`,...o?{workspace:o.id}:{}}),[p,o?.id]),ge=s?.find(e=>e.active)?.id??`Alisio`,Q=!!p.instructions.trim(),_e=async e=>{ue(!0);try{let n={...w(e),scope:e.scope,...o?{workspace:o.id}:{}},i=e.id?await m.updateAgent(e.id,n):await m.createAgent(n),a=ee(i.agent);y(a),O(a),r.onSaved(a),e.scope===`project`&&u(),d(t(i.live?`agentsWin.saved`:`agentsWin.savedRestart`)),e.id||J({form:a,live:i.live})}catch(e){d(t(`agentsWin.saveFailed`,{message:g(e)}))}finally{ue(!1)}},ve=async()=>{if(!o)return;let e=new AbortController;K(void 0),W({controller:e,started:Date.now()});let n;try{let r=await m.draftAgent({workspace:o.id,description:R.trim(),...Q?{base:{name:p.name,description:p.description,instructions:p.instructions}}:{}},e.signal);n=C(te(p,r),Y),y(n),H(``),d(t(`agentsWin.buildDone`,{model:r.generatedBy,guidance:r.guidance}))}catch(t){e.signal.aborted||K(g(t))}finally{W(void 0)}n&&!n.id&&A(n,void 0)&&await _e(n)},$=ae(p.name),ye=re({saved:!!D?.id,workspace:!!o,sessions:X.data?.items??[]}),be={define:[`agentsWin.step.define`,`agentsWin.step.defineBody`],runtime:[`agentsWin.step.runtime`,`agentsWin.step.runtimeBody`],session:[`agentsWin.step.session`,`agentsWin.step.sessionBody`],events:[`agentsWin.step.events`,`agentsWin.step.eventsBody`]},xe=async e=>{o&&e.id&&await f(o.id,e.id,e.model||void 0)&&(h.value=!1)};return c(`div`,{style:{position:`relative`},children:[c(`div`,{class:L.tabs,role:`tablist`,"aria-label":t(`agentsWin.title`),children:[`setup`,`sessions`].map(e=>c(`button`,{type:`button`,role:`tab`,class:L.tab,"aria-selected":P===e,onClick:()=>I(e),children:t(`agentsWin.${e}`)},e))}),P===`sessions`?c(`div`,{role:`tabpanel`,children:D?.id?c(n,{children:[c(N,{loading:X.loading&&!X.data,error:X.error}),X.data&&!X.data.items.length?c(`p`,{class:L.note,children:t(`agentsWin.sessionsEmpty`)}):null,c(`ul`,{class:L.rows,children:(X.data?.items??[]).map(e=>c(`li`,{class:L.row,children:c(`button`,{type:`button`,class:M.rowButton,onClick:()=>{h.value=!1,v(e.id)},children:[c(`span`,{class:L.cardName,children:e.title??t(`agentsWin.untitled`)}),c(`p`,{class:L.meta,children:[e.model,` · `,e.workspace]})]})},e.id))}),o?c(`button`,{type:`button`,class:`${L.primary} ${L.addButton}`,onClick:()=>void xe(D),children:t(`agentsWin.startSession`)}):c(`p`,{class:L.note,children:t(`agentsWin.noWorkspace`)})]}):c(`p`,{class:L.note,children:t(`agentsWin.sessionsUnsaved`)})}):c(`div`,{class:M.columns,role:`tabpanel`,children:[c(`div`,{class:M.column,children:[o?c(`section`,{class:M.assist,"aria-labelledby":`assist-title`,children:[c(`h4`,{class:M.assistTitle,id:`assist-title`,children:[c(l,{name:`sparkle`,size:16}),t(Q?`agentsWin.assistRefine`:`agentsWin.assistTitle`)]}),c(`p`,{class:L.note,children:t(Q?`agentsWin.assistRefineLead`:`agentsWin.assistLead`)}),c(`textarea`,{class:M.control,style:{minHeight:`64px`},value:R,placeholder:t(`agentsWin.assistPlaceholder`),"aria-label":t(`agentsWin.assistTitle`),maxLength:2e3,onInput:e=>H(e.target.value)}),G?c(`p`,{class:L.errorText,role:`alert`,children:t(`agentsWin.buildFailed`,{message:G})}):null,c(`div`,{class:M.assistActions,children:c(`button`,{type:`button`,class:L.primary,disabled:!!U||!Q&&!R.trim(),onClick:()=>void ve(),children:t(Q?`agentsWin.assistRefine`:`agentsWin.assistCreate`)})})]}):null,c(B,{title:t(`agentsWin.definition`),children:[c(V,{label:t(`agentsWin.name`),error:$?t(`agentsWin.nameError.${$}`):void 0,children:c(`input`,{class:M.control,value:p.name,maxLength:80,"aria-invalid":$?`true`:void 0,onInput:e=>Z({name:e.target.value})})}),c(V,{label:t(`agentsWin.description`),children:c(`input`,{class:M.control,value:p.description,maxLength:300,placeholder:t(`agentsWin.descriptionPlaceholder`),onInput:e=>Z({description:e.target.value})})}),c(V,{label:t(`agentsWin.instructions`),hint:`${p.instructions.length} / 24000`,children:c(`textarea`,{class:M.control,value:p.instructions,maxLength:24e3,placeholder:t(`agentsWin.instructionsPlaceholder`),onInput:e=>Z({instructions:e.target.value})})}),!p.id&&me.length>1?c(V,{label:t(`agentsWin.scope`),hint:t(`agentsWin.scopeHint`),children:c(`select`,{class:M.control,value:p.scope,title:r.overview?.dirs[p.scope]??``,onChange:e=>Z({scope:e.target.value}),children:me.map(e=>c(`option`,{value:e,title:r.overview?.dirs[e]??``,children:[t(`agentsWin.scope.${e}`),r.overview?.dirs[e]?` — ${ie(e,r.overview.dirs[e])}`:``]},e))})}):c(`p`,{class:L.meta,children:[t(`agentsWin.scope`),`: `,t(`agentsWin.scope.${p.scope}`)]}),p.scope===`project`&&r.overview&&!r.overview.trusted?c(`div`,{class:L.callout,role:`note`,children:[c(l,{name:`shield`,size:16}),c(`div`,{class:L.stack,children:[c(`span`,{children:t(`agentsWin.scopeUntrusted`)}),o?c(`button`,{type:`button`,class:L.secondary,style:{justifySelf:`start`},onClick:async()=>{await _(o,!0)&&r.onTrusted()},children:t(`trust.grant`)}):null]})]}):null]}),c(B,{title:t(`agentsWin.modelSection`),children:[c(V,{label:t(`agentsWin.model`),children:c(`select`,{class:M.control,value:p.model,onChange:e=>{let t=e.target.value;y(e=>C({...e,model:t},ne(s,t)))},children:[c(`option`,{value:``,disabled:!0,children:t(`agentsWin.chooseModel`)}),p.model&&!s?.some(e=>e.reference===p.model)?c(`option`,{value:p.model,children:p.model}):null,(s??[]).map(e=>c(`option`,{value:e.reference,children:[e.active?t(`agentsWin.modelActive`,{name:e.name??e.id}):e.name??e.id,` `,`· `,e.providerName,e.labels.length?` — ${e.labels.join(` · `)}`:``]},e.reference))]})}),r.modelsError?c(`p`,{class:L.errorText,children:r.modelsError}):Y.known?null:c(`p`,{class:M.fieldHint,children:t(`agentsWin.capsUnknown`)}),c(`div`,{class:M.settingsGrid,children:[c(V,{label:t(`agentsWin.textFormat`),children:c(`select`,{class:M.control,value:p.format,onChange:e=>Z({format:e.target.value}),children:j.filter(e=>Y.textFormats.includes(e)).map(e=>c(`option`,{value:e,children:t(`agentsWin.format.${e}`)},e))})}),c(V,{label:t(`agentsWin.effort`),hint:Y.reasoning?void 0:t(`agentsWin.unsupported`),children:c(`select`,{class:M.control,value:p.effort,disabled:!Y.reasoning,onChange:e=>Z({effort:e.target.value}),children:[c(`option`,{value:``,children:[t(`agentsWin.modelDefault`),Y.defaultEffort?` (${z(Y.defaultEffort)})`:``]}),Y.effortLevels.map(e=>c(`option`,{value:e,children:z(e)},e))]})}),c(V,{label:t(`agentsWin.verbosity`),hint:Y.verbosity?void 0:t(`agentsWin.unsupported`),children:c(`select`,{class:M.control,value:p.verbosity,disabled:!Y.verbosity,onChange:e=>Z({verbosity:e.target.value}),children:[c(`option`,{value:``,children:t(`agentsWin.modelDefault`)}),E.map(e=>c(`option`,{value:e,children:z(e)},e))]})}),c(V,{label:t(`agentsWin.summary`),hint:Y.summary?void 0:t(`agentsWin.unsupported`),children:c(`select`,{class:M.control,value:p.summary,disabled:!Y.summary,onChange:e=>Z({summary:e.target.value}),children:[c(`option`,{value:``,children:t(`agentsWin.modelDefault`)}),k.map(e=>c(`option`,{value:e,children:t(`agentsWin.summary.${e}`)},e))]})})]})]}),c(`button`,{type:`button`,class:`${L.primary} ${M.saveButton}`,disabled:le||!!U||!A(p,D),onClick:()=>void _e(p),children:t(`agentsWin.save`)})]}),c(`div`,{class:M.column,children:[c(oe,{text:he}),de?c(`section`,{class:M.stepper,"aria-labelledby":`getting-started`,children:[c(`h4`,{class:M.stepperHead,id:`getting-started`,children:[t(`agentsWin.gettingStarted`),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`agentsWin.dismiss`),title:t(`agentsWin.dismiss`),onClick:()=>{S(),fe(!1)},children:c(l,{name:`x`,size:15})})]}),c(`ol`,{class:M.steps,children:ye.map((e,n)=>{let[r,i]=be[e.id];return c(`li`,{class:M.step,"data-done":e.done,children:[c(`span`,{class:M.stepNode,"aria-hidden":`true`,children:e.done?`✓`:n+1}),c(`div`,{children:[c(`p`,{class:M.stepTitle,children:[t(r),c(`span`,{class:`sr-only`,children:e.done?` ✓`:``})]}),c(`p`,{class:M.stepText,children:t(i)})]})]},e.id)})})]}):null]})]}),U?c(se,{model:ge,started:U.started,onCancel:()=>U.controller.abort()}):null,q?c(ce,{name:q.form.name,live:q.live&&!!o,onTry:()=>{let e=q.form;J(void 0),xe(e)},onStay:()=>J(void 0)}):null]})}var U=`alisio.agents.maximized`,W=`button:not(:disabled), input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex='0']`;function G(e){let{agent:r}=e;return c(n,{children:[c(I,{tone:r.scope===`project`?`ok`:`off`,children:t(`agentsWin.scope.${r.scope}`)}),r.overridesGlobal?c(I,{tone:`warn`,children:t(`agentsWin.overrides`)}):null,r.overriddenByProject?c(I,{tone:`off`,children:t(`agentsWin.overridden`)}):null]})}function K(){let a=P(),[u,f]=i({kind:`list`}),[p,_]=i(!1),[v,y]=i(()=>s(U)===`1`),b=o(null),x=F(()=>m.agentDefinitions(a?.id),[a?.id],[`agents`]),S=F(()=>m.agentTemplates(),[]),C=F(a?()=>m.agentModels(a.id):void 0,[a?.id]);e(()=>{let e=document.activeElement;return b.current?.querySelector(`button`)?.focus(),()=>e?.focus()},[]);let w=x.data?.defaultScope??(a?`project`:`global`),T=()=>C.data?.find(e=>e.active)?.reference??``,E=()=>u.kind===`editor`&&p&&!window.confirm(t(`agentsWin.unsavedLeave`))?!1:(_(!1),f({kind:`list`}),!0),k=()=>{(u.kind!==`editor`||!p||window.confirm(t(`agentsWin.unsavedLeave`)))&&(h.value=!1)},A=e=>f({kind:`editor`,key:`template:${e.id}:${Date.now()}`,form:O(e,w,T()),assist:!0}),te=async e=>{if(window.confirm(t(`agentsWin.deleteConfirm`,{path:e.path})))try{let n=await m.deleteAgent(e.id,e.scope,a?.id);d(t(n.live?`agentsWin.deleted`:`agentsWin.deletedRestart`)),x.reload()}catch(e){d(g(e))}},j=x.data?.agents??[];return c(`div`,{class:L.backdrop,onMouseDown:e=>{e.target===e.currentTarget&&k()},children:c(`div`,{ref:b,class:`${L.dialog} ${M.shell}${v?` ${M.maximized}`:``}`,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`agents-title`,onKeyDown:e=>{if(e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),u.kind===`editor`?E():k()),e.key===`Tab`){let t=[...b.current?.querySelectorAll(W)??[]],n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}},children:c(`div`,{class:`${L.content} ${M.scroll}`,children:[c(`div`,{class:L.topBar,children:[c(`nav`,{class:M.breadcrumb,"aria-label":t(`agentsWin.title`),children:u.kind===`editor`?c(n,{children:[c(`button`,{type:`button`,class:M.crumbLink,onClick:E,children:t(`agentsWin.back`)}),c(l,{name:`chevronRight`,size:14}),c(`span`,{class:M.crumbCurrent,id:`agents-title`,"aria-current":`page`,children:u.form.id?u.form.name:t(`agentsWin.newAgent`)})]}):c(`span`,{class:M.crumbCurrent,id:`agents-title`,children:t(`agentsWin.title`)})}),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(v?`agentsWin.restore`:`agentsWin.maximize`),title:t(v?`agentsWin.restore`:`agentsWin.maximize`),"aria-pressed":v,onClick:()=>{let e=!v;y(e),r(U,e?`1`:void 0)},children:c(l,{name:v?`shrink`:`expand`,size:16})}),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`common.close`),onClick:k,children:c(l,{name:`x`,size:18})})]}),u.kind===`editor`?c(H,{initial:u.form,...u.saved?{saved:u.saved}:{},assist:u.assist,workspace:a,overview:x.data,models:C.data,modelsError:C.error,onDirty:_,onTrusted:()=>{x.reload(),C.reload()},onSaved:e=>{x.reload(),f(t=>t.kind===`editor`?{...t,form:e,saved:e}:t)}},u.key):c(n,{children:[c(`header`,{class:`${L.intro} ${M.listHead}`,children:[c(`div`,{children:[c(`h3`,{class:L.pageTitle,children:t(`agentsWin.title`)}),c(`p`,{class:L.lead,children:t(`agentsWin.lead`)}),a?null:c(`p`,{class:L.note,children:t(`agentsWin.noWorkspace`)})]}),c(`button`,{type:`button`,class:L.primary,onClick:()=>f({kind:`editor`,key:`new:${Date.now()}`,form:D(w,T()),assist:!0}),children:t(`agentsWin.create`)})]}),c(`h4`,{class:L.listTitle,children:[t(`agentsWin.yours`),c(`span`,{class:L.count,children:j.length})]}),c(N,{loading:x.loading&&!x.data,error:x.error}),x.data&&!j.length?c(`p`,{class:L.note,children:t(`agentsWin.none`)}):null,c(`ul`,{class:L.rows,children:j.map(e=>c(`li`,{class:L.row,"data-muted":e.overriddenByProject?`true`:void 0,children:[c(`button`,{type:`button`,class:M.rowButton,onClick:()=>{let t=ee(e);f({kind:`editor`,key:`${e.scope}:${e.id}`,form:t,saved:t,assist:!1})},children:[c(`span`,{class:L.rowTitle,children:[c(`span`,{class:L.cardName,children:e.name}),c(G,{agent:e})]}),c(`p`,{class:L.cardText,children:e.description}),c(`p`,{class:L.meta,children:[e.model||`—`,` · `,c(`code`,{children:e.id})]})]}),c(`div`,{class:L.rowActions,children:c(`button`,{type:`button`,class:`icon-btn`,"aria-label":`${t(`agentsWin.delete`)} ${e.name}`,title:t(`agentsWin.delete`),onClick:()=>void te(e),children:c(l,{name:`archive`,size:16})})})]},`${e.scope}:${e.id}`))}),c(`h4`,{class:L.listTitle,children:t(`agentsWin.templates`)}),c(N,{loading:S.loading&&!S.data,error:S.error}),c(`ul`,{class:L.grid,children:(S.data??[]).map(e=>c(`li`,{children:c(`button`,{type:`button`,class:M.templateCard,onClick:()=>A(e),children:[c(`span`,{class:M.templateName,children:e.name}),c(`span`,{class:M.templateText,children:e.description})]})},e.id))})]})]})})})}export{K as AgentsModal};
@@ -1 +0,0 @@
1
- import{_ as e,a as t,b as n,p as r,t as i}from"./jsxRuntime-B237YiZZ.js";import{t as a}from"./icons-BuSI35ng.js";import{A as o,M as s,N as c,_ as l,d as u,j as d,o as f,y as p}from"./index-DFURIQeX.js";var m={panel:`_panel_ses4f_2`,rise:`_rise_ses4f_1`,head:`_head_ses4f_46`,badge:`_badge_ses4f_54`,titles:`_titles_ses4f_63`,title:`_title_ses4f_63`,eyebrow:`_eyebrow_ses4f_75`,nav:`_nav_ses4f_84`,position:`_position_ses4f_90`,flip:`_flip_ses4f_97`,body:`_body_ses4f_101`,question:`_question_ses4f_106`,answer:`_answer_ses4f_115`,pending:`_pending_ses4f_119`,spinner:`_spinner_ses4f_126`,cancel:`_cancel_ses4f_134`,error:`_error_ses4f_148`,usage:`_usage_ses4f_156`,foot:`_foot_ses4f_166`},h=e=>e instanceof HTMLElement&&(e.isContentEditable||[`INPUT`,`TEXTAREA`,`SELECT`].includes(e.tagName));function g(){let g=l.value,_=r(null);if(e(()=>{_.current?.focus()},[g?.sessionId,g?.pending?.question]),e(()=>{let e=e=>{let t=l.value;t&&!e.defaultPrevented&&(e.key===`Escape`?(e.preventDefault(),p()):(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&!h(e.target)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&(e.preventDefault(),l.value=c(t,e.key===`ArrowLeft`?-1:1)))};return document.addEventListener(`keydown`,e),()=>document.removeEventListener(`keydown`,e)},[]),!g)return null;let v=d(g),y=s(g),b=g.pending?.question??g.error?.question??v?.question,x=e=>{l.value&&(l.value=c(l.value,e))};return i(`aside`,{ref:_,class:m.panel,role:`dialog`,"aria-modal":`false`,"aria-labelledby":`btw-title`,tabIndex:-1,children:[i(`header`,{class:m.head,children:[i(`span`,{class:m.badge,"aria-hidden":`true`,children:`btw`}),i(`div`,{class:m.titles,children:[i(`h2`,{id:`btw-title`,class:m.title,children:t(`btw.title`)}),i(`p`,{class:m.eyebrow,children:t(`btw.subtitle`)})]}),g.entries.length&&!g.usage?i(`nav`,{class:m.nav,"aria-label":t(`btw.history`),children:[i(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`btw.earlier`),title:t(`btw.earlier`),disabled:!y.earlier,onClick:()=>x(-1),children:i(a,{name:`chevronRight`,size:16,class:m.flip})}),i(`span`,{class:m.position,"aria-live":`polite`,children:v?t(`btw.position`,{n:g.index+1,total:g.entries.length}):``}),i(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`btw.later`),title:t(`btw.later`),disabled:!y.later,onClick:()=>x(1),children:i(a,{name:`chevronRight`,size:16})})]}):null,v?i(u,{text:()=>v.answer,label:t(`btw.copy`)}):null,i(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`common.close`),title:t(`common.close`),onClick:()=>p(),children:i(a,{name:`x`,size:16})})]}),i(`div`,{class:m.body,children:g.usage?i(`div`,{class:m.usage,children:[i(`code`,{children:o}),i(`p`,{children:t(`btw.usage`)})]}):i(n,{children:[b?i(`p`,{class:m.question,children:b}):null,g.pending?i(`div`,{class:m.pending,role:`status`,children:[i(`span`,{class:`${m.spinner} spin`,"aria-hidden":`true`}),i(`span`,{children:t(`btw.thinking`)}),i(`button`,{type:`button`,class:m.cancel,onClick:()=>p(),children:t(`common.cancel`)})]}):g.error?i(`p`,{class:m.error,role:`alert`,children:g.error.message}):v?i(`div`,{class:m.answer,children:i(f,{text:v.answer})}):null]})}),v?i(`footer`,{class:m.foot,children:[t(`btw.tokens`,{model:v.model,input:v.usage.input.toLocaleString(),output:v.usage.output.toLocaleString()}),v.truncated?` · ${t(`btw.truncated`)}`:``]}):null]})}export{g as BtwPanel};
@@ -1 +0,0 @@
1
- import{_ as e,a as t,b as n,g as r,i,n as a,p as o,r as s,t as c}from"./jsxRuntime-B237YiZZ.js";import{t as l}from"./icons-BuSI35ng.js";import{E as u,S as d,T as f,a as p,b as m,d as h,g,i as _,r as v,t as y}from"./index-DFURIQeX.js";import{a as b,c as x,i as S,l as C,n as w,o as T,r as E,s as D,t as O,u as k}from"./shared-sr65xU-a.js";var A=`https://github.com/GustavoGutierrez/alisio`;function j(){return c(`section`,{class:k.about,children:[c(w,{title:t(`settings.about`)}),c(`img`,{class:k.aboutLogo,src:`/alisio-wordmark.png`,alt:`Alisio`,width:320,height:150}),c(`p`,{class:k.aboutDescription,children:t(`about.description`)}),c(`p`,{class:k.aboutAttribution,children:`Gustavo Gutiérrez · Bogotá, Colombia`}),c(`a`,{class:k.aboutLink,href:A,target:`_blank`,rel:`noopener noreferrer`,"aria-label":t(`about.repositoryLabel`),children:[c(l,{name:`github`,size:19}),t(`about.repository`)]})]})}function M(){let e=x(),[i,a]=r(),o=C(e?()=>g.agents(e.id):void 0,[e?.id],[`agents`,`plugins`]),s=m.value,u=s?.agent??o.data?.find(e=>e.default)?.id;return c(n,{children:[c(w,{title:t(`settings.agents`),body:t(`agents.lead`),workspace:e?.path}),c(b,{loading:o.loading&&!o.data,error:o.error,empty:e?void 0:`settings.noWorkspace`}),c(`ul`,{class:k.rows,children:(o.data??[]).map(e=>c(`li`,{class:k.row,"data-current":e.id===u,children:[c(`div`,{class:k.rowMain,children:[c(`div`,{class:k.rowTitle,children:[c(`span`,{class:k.cardName,children:e.name}),c(E,{tone:`off`,children:t(`agents.source.${e.source}`)}),e.readOnly?c(E,{tone:`warn`,children:t(`agents.readOnly`)}):null,e.default?c(E,{tone:`ok`,children:t(`agents.default`)}):null]}),c(`p`,{class:k.cardText,children:e.description}),e.model?c(`p`,{class:k.meta,children:t(`agents.model`,{model:e.model})}):null,e.instructions?c(n,{children:[c(`button`,{type:`button`,class:k.linkButton,"aria-expanded":i===e.id,onClick:()=>a(i===e.id?void 0:e.id),children:[c(l,{name:i===e.id?`chevronDown`:`chevronRight`,size:14}),t(`agents.instructions`)]}),i===e.id?c(`pre`,{class:k.instructions,children:e.instructions}):null]}):null]}),c(`div`,{class:k.rowActions,children:s&&!s.parentId?e.id===u?c(`span`,{class:k.meta,children:t(`agents.inUse`)}):c(`button`,{type:`button`,class:k.secondary,onClick:()=>void d({agent:e.id}),children:t(`agents.use`)}):null})]},e.id))})]})}function N(){return c(n,{children:[c(w,{title:t(`settings.appearance`),body:t(`appearance.lead`)}),c(O,{legend:t(`settings.theme`),value:p.value,options:[`dark`,`light`,`system`].map(e=>({id:e,label:t(`theme.${e}`)})),onChange:_}),c(O,{legend:t(`settings.density`),value:y.value,options:[`compact`,`detailed`].map(e=>({id:e,label:t(`density.${e}`)})),onChange:v})]})}var P=/^(tui|agents)\./;function F(e){let{setting:n}=e,[i,a]=r(),[o,s]=r(!1),l=async t=>{s(!0);try{await e.onSave(t),a(void 0)}finally{s(!1)}},u=t(`setting.${n.key}`),d=`setting-${n.key}`,f=()=>{if(i!==void 0){if(n.kind===`number`){let e=Number(i);if(i.trim()===``||!Number.isFinite(e))return a(void 0);l(e)}else l(i.trim()===``?null:i)}};return c(`li`,{class:k.settingRow,children:[c(`label`,{class:k.settingLabel,for:d,children:[c(`span`,{children:u}),c(`code`,{class:k.settingKey,children:n.key})]}),n.kind===`boolean`?c(T,{checked:n.value===!0,label:u,disabled:e.disabled,busy:o,onChange:e=>void l(e)}):n.kind===`enum`?c(`select`,{id:d,class:k.input,disabled:e.disabled||o,value:typeof n.value==`string`?n.value:``,onChange:e=>{let t=e.target.value;l(t===``?null:t)},children:[c(`option`,{value:``,children:t(`settings.default`)}),(n.options??[]).map(e=>c(`option`,{value:e,children:e},e))]}):c(`input`,{id:d,class:k.input,type:n.kind===`number`?`number`:`text`,disabled:e.disabled||o,value:i??(n.value===void 0?``:String(n.value)),onInput:e=>a(e.target.value),onBlur:f,onKeyDown:e=>{e.key===`Enter`&&f(),e.key===`Escape`&&i!==void 0&&(e.stopPropagation(),a(void 0))}})]})}function I(){let e=x(),r=C(e?()=>g.settings(e.id):void 0,[e?.id]),o=async(t,n)=>{if(e&&r.data)try{await g.setSetting(e.id,t,n),r.set({...r.data,settings:r.data.settings.map(e=>e.key===t?{...e,...n===null?{value:void 0}:{value:n}}:e)})}catch(e){throw u(D(e)),e}},l=(r.data?.settings??[]).filter(e=>!P.test(e.key));return c(n,{children:[c(w,{title:t(`settings.general`)}),c(O,{legend:t(`settings.language`),value:s.value,options:a.map(e=>({id:e,label:t(`language.${e}`)})),onChange:i}),c(`h4`,{class:k.sectionTitle,children:t(`settings.agentSettings`)}),c(`p`,{class:k.note,children:[t(`settings.agentSettingsLead`),r.data?c(n,{children:[` `,c(`code`,{children:r.data.settingsPath})]}):null]}),c(b,{loading:r.loading&&!r.data,error:r.error,empty:e?void 0:`settings.noWorkspace`}),r.data?.readOnly?c(`p`,{class:k.note,children:t(`settings.readOnly`)}):null,c(`ul`,{class:k.settingList,children:l.map(e=>c(F,{setting:e,disabled:!!r.data?.readOnly,onSave:t=>o(e.key,t)},e.key))})]})}var L={connected:`ok`,connecting:`warn`,failed:`danger`,"needs-authentication":`warn`,"restart-required":`warn`};function R(e){let[n,i]=r(!1);return c(`div`,{class:k.confirm,role:`alertdialog`,"aria-labelledby":`mcp-consent-title`,children:[c(`h4`,{id:`mcp-consent-title`,class:k.confirmTitle,children:[c(l,{name:`alert`,size:17}),t(`mcp.consentTitle`)]}),c(`p`,{class:k.cardText,children:t(`mcp.consentBody`)}),c(`label`,{class:k.checkRow,children:[c(`input`,{type:`checkbox`,checked:n,onChange:e=>i(e.target.checked)}),c(`span`,{children:t(`mcp.remember`)})]}),c(`div`,{class:k.actions,children:[c(`button`,{type:`button`,class:k.secondary,onClick:e.onCancel,children:t(`common.cancel`)}),c(`button`,{type:`button`,class:k.primary,onClick:()=>e.onGrant(n),children:t(`mcp.grant`)})]})]})}function z(){let e=x(),[i,a]=r(!1),[o,s]=r(),l=C(e?()=>g.mcp(e.id):void 0,[e?.id],[`mcp`]),d=l.data,f=e=>{d&&l.set({...d,servers:d.servers.map(t=>t.name===e.name?e:t)})},p=async(t,n,r)=>{if(e){s(t.name);try{let i=await g.setMcp(e.id,t.name,n,r);f(i),r&&i.status!==`connected`&&i.diagnostic&&u(i.diagnostic)}catch(e){u(D(e))}finally{s(void 0)}}},m=async t=>{if(e){a(!1);try{l.set(await g.mcpConsent(e.id,t))}catch(e){u(D(e))}}},h=d?.permission===`granted`;return c(n,{children:[c(w,{title:t(`settings.mcp`),body:t(`mcp.lead`),workspace:e?.path}),d?c(`div`,{class:k.banner,"data-tone":h?`ok`:`warn`,children:[c(`span`,{children:d.permission===`read-only`?t(`mcp.readOnly`):h?d.persisted?t(`mcp.grantedPersisted`):t(`mcp.granted`):t(`mcp.notGranted`)}),d.permission===`not-granted`&&!i?c(`button`,{type:`button`,class:k.primary,onClick:()=>a(!0),children:t(`mcp.grant`)}):null]}):null,i?c(R,{onCancel:()=>a(!1),onGrant:e=>void m(e)}):null,c(b,{loading:l.loading&&!d,error:l.error,empty:e?d&&!d.servers.length?`mcp.none`:void 0:`settings.noWorkspace`}),c(`ul`,{class:k.rows,children:(d?.servers??[]).map(e=>c(`li`,{class:k.row,children:[c(`div`,{class:k.rowMain,children:[c(`div`,{class:k.rowTitle,children:[c(`span`,{class:k.cardName,children:e.displayName}),c(E,{tone:L[e.status]??`off`,children:t(`mcp.status`,{status:e.status})})]}),c(`p`,{class:k.meta,children:t(`mcp.meta`,{transport:e.transport,source:e.source,tools:e.counts.tools,resources:e.counts.resources,prompts:e.counts.prompts})}),e.diagnostic?c(`p`,{class:k.diagnostic,children:e.diagnostic}):null]}),c(`div`,{class:k.rowActions,children:[e.enabled&&e.status!==`connected`?c(`button`,{type:`button`,class:k.secondary,disabled:!h||o===e.name,title:h?void 0:t(`mcp.needsGrant`),onClick:()=>void p(e,!0,!0),children:t(`mcp.connect`)}):null,c(T,{checked:e.enabled,label:t(`plugins.enableNamed`,{name:e.displayName}),disabled:d?.permission===`read-only`,busy:o===e.name,onChange:t=>void p(e,t,!1)})]})]},e.name))})]})}var B={apiKey:`API key`,bearerToken:`Bearer token`};function V(e){return e.configured?e.source===`env`?t(`models.credential.env`):e.tail?t(`models.credential.storedTail`,{tail:e.tail}):t(`models.credential.stored`):t(`models.credential.missing`)}function H(e){let[n,i]=r(``),[a,o]=r(!1),s=B[e.field]??e.field,l=`cred-${e.profile}-${e.field}`,d=async()=>{let r=n.trim();if(r){o(!0);try{let n=await g.setCredentials(e.profile,{[e.field]:r});e.onChange({...n,source:`file`}),i(``),u(t(`models.credential.saved`))}catch(e){u(D(e))}finally{o(!1)}}},f=async()=>{o(!0);try{await g.deleteCredentials(e.profile),e.onChange({configured:!1})}catch(e){u(D(e))}finally{o(!1)}};return c(`div`,{class:k.credential,children:[c(`label`,{for:l,class:k.settingLabel,children:[c(`span`,{children:s}),c(`span`,{class:k.meta,"data-configured":e.status.configured,children:V(e.status)})]}),c(`form`,{class:k.credentialForm,onSubmit:e=>{e.preventDefault(),d()},children:[c(`input`,{id:l,class:k.input,type:`password`,autocomplete:`off`,spellcheck:!1,placeholder:e.status.configured?t(`models.credential.replace`):t(`models.credential.enter`),value:n,disabled:a,onInput:e=>i(e.target.value)}),c(`button`,{type:`submit`,class:k.primary,disabled:a||!n.trim(),children:t(`models.credential.save`)}),e.status.configured&&e.status.source===`file`?c(`button`,{type:`button`,class:k.secondary,disabled:a,onClick:()=>void f(),children:t(`models.credential.remove`)}):null]})]})}function U(e){let[n,i]=r(e.initial?.name??``),[a,o]=r(e.initial?.provider??e.types[0]?.id??``),[s,l]=r(e.initial?.model??``),[d,f]=r(e.initial?.values??{}),[p,m]=r(!1),h=(e.types.find(e=>e.id===a)?.fields??[]).filter(e=>e.kind!==`secret`),_=(e,t)=>d[e]??t,v=async()=>{m(!0);try{let t={};for(let e of h){let n=_(e.key,e.defaultValue);n!==void 0&&n!==``&&(t[e.key]=n)}e.onSaved(await g.saveProfile(e.workspace,n.trim(),{provider:a,values:t,model:s}))}catch(e){u(D(e))}finally{m(!1)}};return c(`form`,{class:k.profileForm,onSubmit:e=>{e.preventDefault(),v()},children:[c(`label`,{class:k.formRow,children:[c(`span`,{children:t(`models.form.name`)}),c(`input`,{class:k.input,required:!0,pattern:`[A-Za-z0-9][A-Za-z0-9._\\-]{0,63}`,disabled:!!e.initial,value:n,onInput:e=>i(e.target.value)})]}),c(`label`,{class:k.formRow,children:[c(`span`,{children:t(`models.form.type`)}),c(`select`,{class:k.input,value:a,onChange:e=>o(e.target.value),children:e.types.map(e=>c(`option`,{value:e.id,children:e.name},e.id))})]}),h.map(e=>c(`label`,{class:k.formRow,title:e.description,children:[c(`span`,{children:e.label}),e.kind===`select`?c(`select`,{class:k.input,value:String(_(e.key,e.defaultValue)??``),onChange:t=>f({...d,[e.key]:t.target.value}),children:(e.options??[]).map(e=>c(`option`,{value:e.value,children:e.label},e.value))}):e.kind===`boolean`?c(`input`,{type:`checkbox`,checked:_(e.key,e.defaultValue)===!0,onChange:t=>f({...d,[e.key]:t.target.checked})}):c(`input`,{class:k.input,type:e.kind===`url`?`url`:`text`,required:e.required,value:String(_(e.key,e.defaultValue)??``),onInput:t=>f({...d,[e.key]:t.target.value})})]},e.key)),c(`label`,{class:k.formRow,children:[c(`span`,{children:t(`models.form.model`)}),c(`input`,{class:k.input,required:!0,value:s,onInput:e=>l(e.target.value)})]}),c(`p`,{class:k.note,children:t(`models.form.secretsNote`)}),c(`div`,{class:k.actions,children:[c(`button`,{type:`button`,class:k.secondary,onClick:e.onCancel,children:t(`common.cancel`)}),c(`button`,{type:`submit`,class:k.primary,disabled:p,children:t(`models.form.save`)})]})]})}function W(e){let{profile:i,overview:a}=e,[o,s]=r(!1),[d,f]=r(i.model),[p,m]=r(!1),h=a.types.find(e=>e.id===i.provider),_=a.current?.profile===i.name,v=async()=>{m(!0);try{let{changed:n}=await g.activateProvider(e.workspace,i.name,d);u(n?t(`models.activated`,{name:i.name}):t(`models.unchanged`)),e.onActivated()}catch(e){u(D(e))}finally{m(!1)}},y=e.catalog?.models??[];return c(`li`,{class:k.row,"data-current":_,children:c(`div`,{class:k.rowMain,children:[c(`div`,{class:k.rowTitle,children:[c(`span`,{class:k.cardName,children:i.name}),c(E,{tone:`off`,children:h?.name??i.provider}),i.active?c(E,{tone:`ok`,children:t(`models.activeGlobal`)}):null,_?c(E,{tone:`ok`,children:t(`models.current`)}):null,c(`button`,{type:`button`,class:k.linkButton,"aria-expanded":o,onClick:()=>s(!o),children:[c(l,{name:`edit`,size:14}),t(`models.edit`)]})]}),o?c(U,{types:a.types,initial:i,workspace:e.workspace,onCancel:()=>s(!1),onSaved:t=>{s(!1),e.onChange(t)}}):c(`dl`,{class:k.facts,children:[c(`dt`,{children:t(`models.form.model`)}),c(`dd`,{children:i.model}),Object.entries(i.values).map(([e,t])=>c(n,{children:[c(`dt`,{children:h?.fields.find(t=>t.key===e)?.label??e}),c(`dd`,{children:String(t)})]},e))]}),Object.entries(i.credentials).map(([t,n])=>c(H,{profile:i.name,field:t,status:n,onChange:n=>e.onChange({...i,credentials:{...i.credentials,[t]:n}})},t)),c(`form`,{class:k.credentialForm,onSubmit:e=>{e.preventDefault(),v()},children:[y.length?c(`select`,{class:k.input,"aria-label":t(`models.form.model`),value:d,onChange:e=>f(e.target.value),children:[y.some(e=>e.id===d)?null:c(`option`,{value:d,children:d}),y.map(e=>c(`option`,{value:e.id,children:e.name??e.id},e.id))]}):c(`input`,{class:k.input,"aria-label":t(`models.form.model`),value:d,onInput:e=>f(e.target.value)}),c(`button`,{type:`submit`,class:k.secondary,disabled:p||!d.trim(),children:t(`models.activate`)}),e.catalog?.unavailable?c(`span`,{class:k.meta,children:t(`composer.modelsUnavailable`)}):null]})]})})}function G(){let e=x(),[i,a]=r(!1),o=C(e?()=>g.providers(e.id):void 0,[e?.id],[`models`]),s=C(e?()=>g.providerModels(e.id).catch(()=>[]):void 0,[e?.id],[`models`]),l=o.data,u=e=>{if(!l)return;let t=l.profiles.some(t=>t.name===e.name);o.set({...l,profiles:t?l.profiles.map(t=>t.name===e.name?e:t):[...l.profiles,e]})};return c(n,{children:[c(w,{title:t(`settings.models`),body:t(`models.lead`),workspace:e?.path}),l?.current?c(`p`,{class:k.banner,"data-tone":`ok`,children:t(`models.running`,{provider:l.current.provider,model:l.current.model,profile:l.current.profile??`—`})}):null,c(b,{loading:o.loading&&!l,error:o.error,empty:e?l&&!l.profiles.length?`models.none`:void 0:`settings.noWorkspace`}),c(`ul`,{class:k.rows,children:(l?.profiles??[]).map(t=>c(W,{profile:t,overview:l,catalog:s.data?.find(e=>e.profile===t.name),workspace:e?.id??``,onChange:u,onActivated:()=>o.reload()},t.name))}),e&&l?.types.length?i?c(U,{types:l.types,workspace:e.id,onCancel:()=>a(!1),onSaved:e=>{a(!1),u(e)}}):c(`button`,{type:`button`,class:`${k.secondary} ${k.addButton}`,onClick:()=>a(!0),children:t(`models.add`)}):null]})}var K={active:`ok`,inactive:`off`,failed:`danger`,"restart-required":`warn`};function q(e){return e.status===`failed`?t(`plugins.status.failed`):e.status===`restart-required`?t(`plugins.status.restart`):e.enabled?t(`plugins.status.enabled`):t(`plugins.status.disabled`)}function J(e){let{plugin:i}=e,[a,o]=r(!1),s=`plugin-${i.id}`;return c(`li`,{class:k.card,"data-open":a,children:[c(`button`,{type:`button`,class:k.cardHead,"aria-expanded":a,"aria-controls":s,onClick:()=>o(!a),children:[c(`span`,{class:k.cardName,title:i.name,children:i.name}),c(E,{tone:K[i.status],children:q(i)}),c(l,{name:a?`chevronDown`:`chevronRight`,size:16,class:k.chevron})]}),a?c(`div`,{id:s,class:k.cardBody,children:[i.description?c(`p`,{class:k.cardText,children:i.description}):null,c(`dl`,{class:k.facts,children:[c(`dt`,{children:t(`plugins.id`)}),c(`dd`,{children:c(`code`,{children:i.id})}),i.version?c(n,{children:[c(`dt`,{children:t(`plugins.version`)}),c(`dd`,{children:i.version})]}):null,c(`dt`,{children:t(`plugins.source`)}),c(`dd`,{children:i.builtin?t(`plugins.builtin`):i.source}),i.categories.length?c(n,{children:[c(`dt`,{children:t(`plugins.categories`)}),c(`dd`,{children:i.categories.join(`, `)})]}):null,c(`dt`,{children:t(`plugins.tools`)}),c(`dd`,{children:i.tools.length?i.tools.join(`, `):`—`}),c(`dt`,{children:t(`plugins.commands`)}),c(`dd`,{children:i.commands.length?i.commands.map(e=>`/${e}`).join(`, `):`—`})]}),i.diagnostic?c(`p`,{class:k.diagnostic,children:i.diagnostic}):null,c(`div`,{class:k.toggleRow,children:[c(`span`,{children:t(`plugins.enable`)}),c(T,{checked:i.enabled,label:t(`plugins.enableNamed`,{name:i.name}),disabled:!i.manageable,busy:e.busy,onChange:e.onToggle})]})]}):null]})}function Y(){let e=x(),[i,a]=r(`list`),[o,s]=r(``),[d,f]=r(),p=C(e?()=>g.plugins(e.id):void 0,[e?.id],[`plugins`]),m=C(e&&i===`configuration`?()=>g.settings(e.id):void 0,[e?.id,i]),h=async(n,r)=>{if(e){f(n.id);try{let i=await g.setPlugin(e.id,n.id,r);p.set((p.data??[]).map(e=>e.id===i.id?i:e)),i.status===`restart-required`&&u(t(`plugins.deferred`))}catch(e){u(D(e))}finally{f(void 0)}}},_=o.trim().toLowerCase(),v=(p.data??[]).filter(e=>!_||e.name.toLowerCase().includes(_)||e.id.toLowerCase().includes(_)||e.description.toLowerCase().includes(_));return c(n,{children:[c(w,{title:t(`settings.plugins`),body:t(`plugins.lead`),workspace:e?.path}),c(`div`,{class:k.tabs,role:`tablist`,children:[`configuration`,`list`].map(e=>c(`button`,{type:`button`,role:`tab`,class:k.tab,"aria-selected":i===e,onClick:()=>a(e),children:t(e===`list`?`plugins.tab.list`:`plugins.tab.configuration`)},e))}),i===`configuration`?c(`div`,{class:k.stack,children:[c(`p`,{class:k.callout,children:[c(l,{name:`shield`,size:16}),c(`span`,{children:t(`plugins.notSandboxed`)})]}),c(`p`,{class:k.note,children:t(`plugins.howToInstall`)}),c(`p`,{class:k.note,children:t(`plugins.applyNote`)}),m.data?c(`p`,{class:k.note,children:[t(`plugins.projectFile`),` `,c(`code`,{children:m.data.configPath})]}):null]}):c(n,{children:[c(S,{value:o,label:t(`plugins.search`),onInput:s}),c(`h4`,{class:k.listTitle,children:[t(`plugins.tab.list`),` `,c(`span`,{class:k.count,children:v.length})]}),c(b,{loading:p.loading&&!p.data,error:p.error,empty:e?p.data&&!v.length?`plugins.none`:void 0:`settings.noWorkspace`}),c(`ul`,{class:k.grid,children:v.map(e=>c(J,{plugin:e,busy:d===e.id,onToggle:t=>void h(e,t)},e.id))})]})]})}function X(){let e=x(),[i,a]=r(``),[o,s]=r(),l=C(e?()=>g.skills(e.id):void 0,[e?.id],[`skills`]),d=async(t,n)=>{if(e){s(t.id);try{let r=await g.setSkill(e.id,t.id,n);l.set((l.data??[]).map(e=>e.id===r.id&&e.effective?r:e))}catch(e){u(D(e))}finally{s(void 0)}}},f=i.trim().toLowerCase(),p=(l.data??[]).filter(e=>!f||e.displayId.toLowerCase().includes(f)||e.description.toLowerCase().includes(f));return c(n,{children:[c(w,{title:t(`settings.skills`),body:t(`skills.lead`),workspace:e?.path}),c(S,{value:i,label:t(`skills.search`),onInput:a}),c(b,{loading:l.loading&&!l.data,error:l.error,empty:e?l.data&&!p.length?`skills.none`:void 0:`settings.noWorkspace`}),c(`ul`,{class:k.rows,children:p.map(e=>c(`li`,{class:k.row,"data-muted":!e.effective,children:[c(`div`,{class:k.rowMain,children:[c(`div`,{class:k.rowTitle,children:[c(`span`,{class:k.cardName,children:e.displayId}),c(E,{tone:e.enabled&&e.effective?`ok`:`off`,children:e.effective?e.enabled?t(`plugins.status.enabled`):t(`plugins.status.disabled`):t(`skills.shadowed`)})]}),c(`p`,{class:k.cardText,children:e.description}),c(`p`,{class:k.meta,children:[t(`skills.meta`,{scope:e.owner?`${e.scope} · ${e.owner.name}`:e.scope,tokens:e.approximateTokens}),e.shadowedBy?` · ${t(`skills.shadowedBy`,{id:e.shadowedBy})}`:``,e.locked?` · ${t(`skills.locked`)}`:``]})]}),c(T,{checked:e.enabled,label:t(`plugins.enableNamed`,{name:e.displayId}),disabled:!e.effective||!e.manageable||e.locked,busy:o===e.id,onChange:t=>void d(e,t)})]},`${e.id}:${e.source}`))})]})}var Z=[{id:`general`,icon:`settings`},{id:`models`,icon:`database`},{id:`plugins`,icon:`sliders`},{id:`skills`,icon:`book`},{id:`mcp`,icon:`plug`},{id:`agents`,icon:`users`},{id:`appearance`,icon:`palette`},{id:`about`,icon:`info`}],Q=`button:not(:disabled), input:not(:disabled), select:not(:disabled), [tabindex='0']`;function $(e){let n=x(),r=C(n?()=>g.settings(n.id):void 0,[n?.id]),i=r.data?[{label:t(`config.effective`),path:r.data.configPath},{label:t(`config.settings`),path:r.data.settingsPath},{label:t(`config.providers`),path:r.data.providersPath}]:[];return c(`div`,{class:k.popover,role:`dialog`,"aria-label":t(`config.open`),children:[c(`div`,{class:k.popoverHead,children:[c(`strong`,{children:t(`config.open`)}),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`common.close`),onClick:e.onClose,children:c(l,{name:`x`,size:16})})]}),c(`p`,{class:k.note,children:t(`config.lead`)}),n?null:c(`p`,{class:k.note,children:t(`settings.noWorkspace`)}),r.error?c(`p`,{class:k.errorText,children:r.error}):null,c(`ul`,{class:k.paths,children:i.map(e=>c(`li`,{children:[c(`span`,{class:k.meta,children:e.label}),c(`span`,{class:k.pathRow,children:[c(`code`,{class:k.path,children:e.path}),c(h,{text:()=>e.path,label:t(`config.copy`)})]})]},e.label))}),r.data&&!r.data.trusted?c(`p`,{class:k.note,children:t(`config.untrusted`)}):null]})}function ee(){let[n,i]=r(`general`),[a,s]=r(!1),u=o(null);e(()=>{let e=document.activeElement;return u.current?.querySelector(`nav button`)?.focus(),()=>e?.focus()},[]);let d=()=>{f.value=!1};return c(`div`,{class:k.backdrop,onMouseDown:e=>{e.target===e.currentTarget&&d()},children:c(`div`,{ref:u,class:k.dialog,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`settings-title`,onKeyDown:e=>{if(e.key===`Escape`&&(a?s(!1):d()),e.key===`Tab`){let t=[...u.current?.querySelectorAll(Q)??[]],n=t[0],r=t.at(-1);e.shiftKey&&document.activeElement===n?(e.preventDefault(),r?.focus()):!e.shiftKey&&document.activeElement===r&&(e.preventDefault(),n?.focus())}},children:[c(`nav`,{class:k.nav,"aria-label":t(`settings.title`),children:[c(`h2`,{id:`settings-title`,class:k.heading,children:t(`settings.title`)}),Z.map(({id:e,icon:r})=>c(`button`,{type:`button`,class:k.navItem,"aria-current":n===e?`page`:void 0,onClick:()=>i(e),children:[c(l,{name:r,size:17}),t(`settings.${e}`)]},e))]}),c(`div`,{class:k.content,children:[c(`div`,{class:k.topBar,children:[c(`button`,{type:`button`,class:k.outline,"aria-expanded":a,onClick:()=>s(!a),children:t(`config.open`)}),c(`button`,{type:`button`,class:`icon-btn`,"aria-label":t(`common.close`),onClick:d,children:c(l,{name:`x`,size:18})})]}),a?c($,{onClose:()=>s(!1)}):null,c(n===`general`?I:n===`models`?G:n===`plugins`?Y:n===`skills`?X:n===`mcp`?z:n===`agents`?M:n===`appearance`?N:j,{})]})]})})}export{ee as SettingsModal};
@@ -1 +0,0 @@
1
- import"./chunk-FOHPRMQF-DzxwRta7.js";import{M as e}from"./mermaid-parser.core-9beuOH8q.js";export{e as createArchitectureServices};
@@ -1 +0,0 @@
1
- import{at as e,it as t}from"./chunk-DU6HZSFF-BJuBFcwd.js";var n=(n,r)=>e.lang.round(t.parse(n)[r]);export{n as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-B6xuSHsQ.js";import"./chunk-DU6HZSFF-BJuBFcwd.js";import"./chunk-75Z2AOVW-DFYQUeQA.js";import"./chunk-PWAF6VOD-BzM7cl8Q.js";import"./chunk-GMAD6QVW-DOqNcbFg.js";import"./chunk-P2QGCYS3-8aJ3lrqy.js";import"./chunk-4HAMMTFA-CT8liele.js";import"./chunk-GVQU2GXP-uaJ9Q1Go.js";import"./chunk-OSK3NFVY-CpDZTLO2.js";import"./chunk-F27PBJKO-DQKhFLQx.js";import"./chunk-XXDRQBXY-DqAYeljN.js";import"./chunk-POPQ4Y6H-CCGI6bTT.js";import"./chunk-L3NEJ4N5-VqLWue5E.js";import{i as t,n,r,t as i}from"./chunk-TICWLB2K-C0M4j05X.js";import"./engine-CuFplYJ5.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-Y2CYZVJY-DsF7k-Jl.js";import"./src-B6xuSHsQ.js";import"./chunk-DU6HZSFF-BJuBFcwd.js";import"./chunk-75Z2AOVW-DFYQUeQA.js";import"./chunk-PWAF6VOD-BzM7cl8Q.js";import"./chunk-GMAD6QVW-DOqNcbFg.js";import"./chunk-P2QGCYS3-8aJ3lrqy.js";import"./chunk-4HAMMTFA-CT8liele.js";import"./chunk-GVQU2GXP-uaJ9Q1Go.js";import"./chunk-OSK3NFVY-CpDZTLO2.js";import"./chunk-F27PBJKO-DQKhFLQx.js";import"./chunk-XXDRQBXY-DqAYeljN.js";import"./chunk-POPQ4Y6H-CCGI6bTT.js";import"./chunk-L3NEJ4N5-VqLWue5E.js";import{i as t,n,r,t as i}from"./chunk-TICWLB2K-C0M4j05X.js";import"./engine-CuFplYJ5.js";var a={parser:n,get db(){return new i},renderer:r,styles:t,init:e(e=>{e.class||={},e.class.arrowMarkerAbsolute=e.arrowMarkerAbsolute},`init`)};export{a as diagram};