dsh-vt-web-chat 1.2.1 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/README.md +66 -33
  2. package/client.js +355 -798
  3. package/docs/research/01-chat-demo-embedding.md +322 -0
  4. package/index.js +36 -8
  5. package/locale/en.json +1 -1
  6. package/locale/zh.json +1 -1
  7. package/package.json +15 -6
  8. package/scripts/dev-server.mjs +54 -0
  9. package/scripts/sync-upstream.mjs +106 -0
  10. package/src/auth.js +65 -0
  11. package/src/maintenance.js +240 -0
  12. package/src/proxy.js +139 -0
  13. package/src/route.js +307 -0
  14. package/src/settings.js +74 -0
  15. package/webview/UPSTREAM.json +6 -0
  16. package/webview/dist/LICENSE +21 -0
  17. package/webview/dist/index.html +1 -0
  18. package/webview/dist/static/css/async/4959.1382f613.css +1 -0
  19. package/webview/dist/static/css/main.27198ffe.css +1 -0
  20. package/webview/dist/static/js/async/1031.575fa503.js +1 -0
  21. package/webview/dist/static/js/async/1085.769e13d5.js +1 -0
  22. package/webview/dist/static/js/async/1086.4d3be1fa.js +1 -0
  23. package/webview/dist/static/js/async/1097.4f798919.js +117 -0
  24. package/webview/dist/static/js/async/1299.0ef86619.js +1 -0
  25. package/webview/dist/static/js/async/1393.6ef1efab.js +1 -0
  26. package/webview/dist/static/js/async/1401.88487cba.js +1 -0
  27. package/webview/dist/static/js/async/1505.8913966f.js +1 -0
  28. package/webview/dist/static/js/async/160.81018107.js +55 -0
  29. package/webview/dist/static/js/async/1679.153f9f03.js +1 -0
  30. package/webview/dist/static/js/async/1690.fe25bdfe.js +1 -0
  31. package/webview/dist/static/js/async/2110.a1d33f2f.js +215 -0
  32. package/webview/dist/static/js/async/2152.97b0a90c.js +1 -0
  33. package/webview/dist/static/js/async/2168.9925ab2d.js +1 -0
  34. package/webview/dist/static/js/async/2312.4fd0ef8e.js +1 -0
  35. package/webview/dist/static/js/async/2348.41564e59.js +148 -0
  36. package/webview/dist/static/js/async/2356.631a6aca.js +1 -0
  37. package/webview/dist/static/js/async/2415.00900482.js +1 -0
  38. package/webview/dist/static/js/async/2461.15199935.js +1 -0
  39. package/webview/dist/static/js/async/2541.f8eac009.js +1 -0
  40. package/webview/dist/static/js/async/2607.abb8bc11.js +1 -0
  41. package/webview/dist/static/js/async/265.b43cee3f.js +1 -0
  42. package/webview/dist/static/js/async/2696.60d5ecf0.js +1 -0
  43. package/webview/dist/static/js/async/3014.c8e9b88f.js +1 -0
  44. package/webview/dist/static/js/async/3111.e2cca965.js +1 -0
  45. package/webview/dist/static/js/async/3251.0b9c608e.js +1 -0
  46. package/webview/dist/static/js/async/3339.ed293391.js +1 -0
  47. package/webview/dist/static/js/async/3376.3aa54d1a.js +93 -0
  48. package/webview/dist/static/js/async/3465.845187e8.js +1 -0
  49. package/webview/dist/static/js/async/3477.94bd21ab.js +5 -0
  50. package/webview/dist/static/js/async/3594.edfe4411.js +1 -0
  51. package/webview/dist/static/js/async/3806.28abb895.js +1 -0
  52. package/webview/dist/static/js/async/3909.4b4bd806.js +1 -0
  53. package/webview/dist/static/js/async/4138.104dbc81.js +1 -0
  54. package/webview/dist/static/js/async/426.6fedaabe.js +1 -0
  55. package/webview/dist/static/js/async/4387.151c5858.js +1 -0
  56. package/webview/dist/static/js/async/4468.d0c907eb.js +1 -0
  57. package/webview/dist/static/js/async/4471.b0874c8d.js +158 -0
  58. package/webview/dist/static/js/async/4568.cf5e547d.js +1 -0
  59. package/webview/dist/static/js/async/4580.f1bc120a.js +131 -0
  60. package/webview/dist/static/js/async/4695.8f4b8910.js +1 -0
  61. package/webview/dist/static/js/async/4959.deb41780.js +1 -0
  62. package/webview/dist/static/js/async/509.f3e093b4.js +59 -0
  63. package/webview/dist/static/js/async/5172.e1e3bd11.js +43 -0
  64. package/webview/dist/static/js/async/535.e10ba324.js +1 -0
  65. package/webview/dist/static/js/async/5546.89da376c.js +24 -0
  66. package/webview/dist/static/js/async/5597.3018e134.js +36 -0
  67. package/webview/dist/static/js/async/5636.61075f0b.js +174 -0
  68. package/webview/dist/static/js/async/5638.7cfdcd7e.js +1 -0
  69. package/webview/dist/static/js/async/5706.d34ac064.js +1 -0
  70. package/webview/dist/static/js/async/5856.d75c4e3b.js +1 -0
  71. package/webview/dist/static/js/async/6061.7cfcc3e9.js +1 -0
  72. package/webview/dist/static/js/async/6152.d3a64904.js +1 -0
  73. package/webview/dist/static/js/async/6297.6e694780.js +1 -0
  74. package/webview/dist/static/js/async/6325.cafe9e55.js +1 -0
  75. package/webview/dist/static/js/async/6332.682f48c9.js +1 -0
  76. package/webview/dist/static/js/async/6349.e9992b47.js +56 -0
  77. package/webview/dist/static/js/async/6389.1bb952e3.js +1 -0
  78. package/webview/dist/static/js/async/6443.95da1923.js +1 -0
  79. package/webview/dist/static/js/async/6526.56ce7dc4.js +1 -0
  80. package/webview/dist/static/js/async/6600.6e0dfb69.js +1 -0
  81. package/webview/dist/static/js/async/6689.d0bd8935.js +262 -0
  82. package/webview/dist/static/js/async/6751.54c80aba.js +1 -0
  83. package/webview/dist/static/js/async/680.5aa7dcb4.js +1 -0
  84. package/webview/dist/static/js/async/6948.9cd716f4.js +1 -0
  85. package/webview/dist/static/js/async/7262.f680270f.js +88 -0
  86. package/webview/dist/static/js/async/7515.20c14480.js +1 -0
  87. package/webview/dist/static/js/async/7536.34769b35.js +1 -0
  88. package/webview/dist/static/js/async/7630.ed725458.js +1 -0
  89. package/webview/dist/static/js/async/7853.0a4b794a.js +1 -0
  90. package/webview/dist/static/js/async/8180.4d4299ef.js +1 -0
  91. package/webview/dist/static/js/async/828.56686119.js +1 -0
  92. package/webview/dist/static/js/async/8379.1b75211c.js +1 -0
  93. package/webview/dist/static/js/async/8389.4f120664.js +1 -0
  94. package/webview/dist/static/js/async/8538.d5f92d14.js +24 -0
  95. package/webview/dist/static/js/async/8560.1bdf90ec.js +1 -0
  96. package/webview/dist/static/js/async/8794.759831e8.js +60 -0
  97. package/webview/dist/static/js/async/8821.2b444259.js +29 -0
  98. package/webview/dist/static/js/async/925.548cc1b9.js +1 -0
  99. package/webview/dist/static/js/async/9252.3c22a9cd.js +1 -0
  100. package/webview/dist/static/js/async/9261.1e796956.js +1 -0
  101. package/webview/dist/static/js/async/9324.b3518ebf.js +1 -0
  102. package/webview/dist/static/js/async/9354.4425ac3c.js +1 -0
  103. package/webview/dist/static/js/async/9501.a7851380.js +4 -0
  104. package/webview/dist/static/js/async/9560.d604e606.js +166 -0
  105. package/webview/dist/static/js/async/9640.5f6a6734.js +1 -0
  106. package/webview/dist/static/js/async/9765.ecc8b5dc.js +1 -0
  107. package/webview/dist/static/js/async/9821.b1897048.js +63 -0
  108. package/webview/dist/static/js/main.7c5f914e.js +3 -0
  109. package/webview/dist/static/media/KaTeX_AMS-Regular.1608a09b.woff +0 -0
  110. package/webview/dist/static/media/KaTeX_AMS-Regular.4aafdb68.ttf +0 -0
  111. package/webview/dist/static/media/KaTeX_AMS-Regular.a79f1c31.woff2 +0 -0
  112. package/webview/dist/static/media/KaTeX_Caligraphic-Bold.b6770918.woff +0 -0
  113. package/webview/dist/static/media/KaTeX_Caligraphic-Bold.cce5b8ec.ttf +0 -0
  114. package/webview/dist/static/media/KaTeX_Caligraphic-Bold.ec17d132.woff2 +0 -0
  115. package/webview/dist/static/media/KaTeX_Caligraphic-Regular.07ef19e7.ttf +0 -0
  116. package/webview/dist/static/media/KaTeX_Caligraphic-Regular.55fac258.woff2 +0 -0
  117. package/webview/dist/static/media/KaTeX_Caligraphic-Regular.dad44a7f.woff +0 -0
  118. package/webview/dist/static/media/KaTeX_Fraktur-Bold.9f256b85.woff +0 -0
  119. package/webview/dist/static/media/KaTeX_Fraktur-Bold.b18f59e1.ttf +0 -0
  120. package/webview/dist/static/media/KaTeX_Fraktur-Bold.d42a5579.woff2 +0 -0
  121. package/webview/dist/static/media/KaTeX_Fraktur-Regular.7c187121.woff +0 -0
  122. package/webview/dist/static/media/KaTeX_Fraktur-Regular.d3c882a6.woff2 +0 -0
  123. package/webview/dist/static/media/KaTeX_Fraktur-Regular.ed38e79f.ttf +0 -0
  124. package/webview/dist/static/media/KaTeX_Main-Bold.b74a1a8b.ttf +0 -0
  125. package/webview/dist/static/media/KaTeX_Main-Bold.c3fb5ac2.woff2 +0 -0
  126. package/webview/dist/static/media/KaTeX_Main-Bold.d181c465.woff +0 -0
  127. package/webview/dist/static/media/KaTeX_Main-BoldItalic.6f2bb1df.woff2 +0 -0
  128. package/webview/dist/static/media/KaTeX_Main-BoldItalic.70d8b0a5.ttf +0 -0
  129. package/webview/dist/static/media/KaTeX_Main-BoldItalic.e3f82f9d.woff +0 -0
  130. package/webview/dist/static/media/KaTeX_Main-Italic.47373d1e.ttf +0 -0
  131. package/webview/dist/static/media/KaTeX_Main-Italic.8916142b.woff2 +0 -0
  132. package/webview/dist/static/media/KaTeX_Main-Italic.9024d815.woff +0 -0
  133. package/webview/dist/static/media/KaTeX_Main-Regular.0462f03b.woff2 +0 -0
  134. package/webview/dist/static/media/KaTeX_Main-Regular.7f51fe03.woff +0 -0
  135. package/webview/dist/static/media/KaTeX_Main-Regular.b7f8fe9b.ttf +0 -0
  136. package/webview/dist/static/media/KaTeX_Math-BoldItalic.572d331f.woff2 +0 -0
  137. package/webview/dist/static/media/KaTeX_Math-BoldItalic.a879cf83.ttf +0 -0
  138. package/webview/dist/static/media/KaTeX_Math-BoldItalic.f1035d8d.woff +0 -0
  139. package/webview/dist/static/media/KaTeX_Math-Italic.5295ba48.woff +0 -0
  140. package/webview/dist/static/media/KaTeX_Math-Italic.939bc644.ttf +0 -0
  141. package/webview/dist/static/media/KaTeX_Math-Italic.f28c23ac.woff2 +0 -0
  142. package/webview/dist/static/media/KaTeX_SansSerif-Bold.8c5b5494.woff2 +0 -0
  143. package/webview/dist/static/media/KaTeX_SansSerif-Bold.94e1e8dc.ttf +0 -0
  144. package/webview/dist/static/media/KaTeX_SansSerif-Bold.bf59d231.woff +0 -0
  145. package/webview/dist/static/media/KaTeX_SansSerif-Italic.3b1e59b3.woff2 +0 -0
  146. package/webview/dist/static/media/KaTeX_SansSerif-Italic.7c9bc82b.woff +0 -0
  147. package/webview/dist/static/media/KaTeX_SansSerif-Italic.b4c20c84.ttf +0 -0
  148. package/webview/dist/static/media/KaTeX_SansSerif-Regular.74048478.woff +0 -0
  149. package/webview/dist/static/media/KaTeX_SansSerif-Regular.ba21ed5f.woff2 +0 -0
  150. package/webview/dist/static/media/KaTeX_SansSerif-Regular.d4d7ba48.ttf +0 -0
  151. package/webview/dist/static/media/KaTeX_Script-Regular.03e9641d.woff2 +0 -0
  152. package/webview/dist/static/media/KaTeX_Script-Regular.07505710.woff +0 -0
  153. package/webview/dist/static/media/KaTeX_Script-Regular.fe9cbbe1.ttf +0 -0
  154. package/webview/dist/static/media/KaTeX_Size1-Regular.e1e279cb.woff +0 -0
  155. package/webview/dist/static/media/KaTeX_Size1-Regular.eae34984.woff2 +0 -0
  156. package/webview/dist/static/media/KaTeX_Size1-Regular.fabc004a.ttf +0 -0
  157. package/webview/dist/static/media/KaTeX_Size2-Regular.57727022.woff +0 -0
  158. package/webview/dist/static/media/KaTeX_Size2-Regular.5916a24f.woff2 +0 -0
  159. package/webview/dist/static/media/KaTeX_Size2-Regular.d6b476ec.ttf +0 -0
  160. package/webview/dist/static/media/KaTeX_Size3-Regular.9acaf01c.woff +0 -0
  161. package/webview/dist/static/media/KaTeX_Size3-Regular.a144ef58.ttf +0 -0
  162. package/webview/dist/static/media/KaTeX_Size3-Regular.b4230e7e.woff2 +0 -0
  163. package/webview/dist/static/media/KaTeX_Size4-Regular.10d95fd3.woff2 +0 -0
  164. package/webview/dist/static/media/KaTeX_Size4-Regular.7a996c9d.woff +0 -0
  165. package/webview/dist/static/media/KaTeX_Size4-Regular.fbccdabe.ttf +0 -0
  166. package/webview/dist/static/media/KaTeX_Typewriter-Regular.6258592b.woff +0 -0
  167. package/webview/dist/static/media/KaTeX_Typewriter-Regular.a8709e36.woff2 +0 -0
  168. package/webview/dist/static/media/KaTeX_Typewriter-Regular.d97aaf4a.ttf +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.rspackChunkchat_demo=self.rspackChunkchat_demo||[]).push([[4138],{1807(e,t,n){n.d(t,{A:()=>a});var r=n(1208);let a=function(e){return(0,r.A)(e,4)}},1041(e,t,n){n.r(t),n.d(t,{render:()=>D});var r=n(9462);n(5939);var a=n(7618),i=n(5040);n(5695),n(3919),n(3218);var d=n(8755),o=n(815),s=n(8430),l=n(1807),g=n(3336);function c(e){var t,n,r={options:{directed:e.isDirected(),multigraph:e.isMultigraph(),compound:e.isCompound()},nodes:(t=e,g.A(t.nodes(),function(e){var n=t.node(e),r=t.parent(e),a={v:e};return s.A(n)||(a.value=n),s.A(r)||(a.parent=r),a})),edges:(n=e,g.A(n.edges(),function(e){var t=n.edge(e),r={v:e.v,w:e.w};return s.A(e.name)||(r.name=e.name),s.A(t)||(r.value=t),r}))};return s.A(e.graph())||(r.value=l.A(e.graph())),r}n(5521);var f=n(7420),h=new Map,p=new Map,u=new Map,m=(0,d.K2)(()=>{p.clear(),u.clear(),h.clear()},"clear"),w=(0,d.K2)((e,t)=>{let n=p.get(t)||[];return d.Rm.trace("In isDescendant",t," ",e," = ",n.includes(e)),n.includes(e)},"isDescendant"),R=(0,d.K2)((e,t)=>{let n=p.get(t)||[];return d.Rm.info("Descendants of ",t," is ",n),d.Rm.info("Edge is ",e),e.v!==t&&e.w!==t&&(n?n.includes(e.v)||w(e.v,t)||w(e.w,t)||n.includes(e.w):(d.Rm.debug("Tilt, ",t,",not in descendants"),!1))},"edgeInCluster"),v=(0,d.K2)((e,t,n,r)=>{d.Rm.warn("Copying children of ",e,"root",r,"data",t.node(e),r);let a=t.children(e)||[];e!==r&&a.push(e),d.Rm.warn("Copying (nodes) clusterId",e,"nodes",a),a.forEach(a=>{if(t.children(a).length>0)v(a,t,n,r);else{let i=t.node(a);d.Rm.info("cp ",a," to ",r," with parent ",e),n.setNode(a,i),r!==t.parent(a)&&(d.Rm.warn("Setting parent",a,t.parent(a)),n.setParent(a,t.parent(a))),e!==r&&a!==e?(d.Rm.debug("Setting parent",a,e),n.setParent(a,e)):(d.Rm.info("In copy ",e,"root",r,"data",t.node(e),r),d.Rm.debug("Not Setting parent for node=",a,"cluster!==rootId",e!==r,"node!==clusterId",a!==e));let o=t.edges(a);d.Rm.debug("Copying Edges",o),o.forEach(a=>{d.Rm.info("Edge",a);let i=t.edge(a.v,a.w,a.name);d.Rm.info("Edge data",i,r);try{R(a,r)?(d.Rm.info("Copying as ",a.v,a.w,i,a.name),n.setEdge(a.v,a.w,i,a.name),d.Rm.info("newGraph edges ",n.edges(),n.edge(n.edges()[0]))):d.Rm.info("Skipping copy of edge ",a.v,"--\x3e",a.w," rootId: ",r," clusterId:",e)}catch(e){d.Rm.error(e)}})}d.Rm.debug("Removing node",a),t.removeNode(a)})},"copy"),y=(0,d.K2)((e,t)=>{let n=t.children(e),r=[...n];for(let a of n)u.set(a,e),r=[...r,...y(a,t)];return r},"extractDescendants"),X=(0,d.K2)((e,t,n)=>{let r=e.edges().filter(e=>e.v===t||e.w===t),a=e.edges().filter(e=>e.v===n||e.w===n),i=r.map(e=>({v:e.v===t?n:e.v,w:e.w===t?t:e.w})),d=a.map(e=>({v:e.v,w:e.w}));return i.filter(e=>d.some(t=>e.v===t.v&&e.w===t.w))},"findCommonEdges"),E=(0,d.K2)((e,t,n)=>{let r,a=t.children(e);if(d.Rm.trace("Searching children of id ",e,a),a.length<1)return e;for(let e of a){let a=E(e,t,n),i=X(t,n,a);if(a)if(!(i.length>0))return a;else r=a}return r},"findNonClusterChild"),N=(0,d.K2)(e=>h.has(e)&&h.get(e).externalConnections&&h.has(e)?h.get(e).id:e,"getAnchorId"),b=(0,d.K2)((e,t)=>{if(!e||t>10)return void d.Rm.debug("Opting out, no graph ");for(let t of(d.Rm.debug("Opting in, graph "),e.nodes().forEach(function(t){e.children(t).length>0&&(d.Rm.warn("Cluster identified",t," Replacement id in edges: ",E(t,e,t)),p.set(t,y(t,e)),h.set(t,{id:E(t,e,t),clusterData:e.node(t)}))}),e.nodes().forEach(function(t){let n=e.children(t),r=e.edges();n.length>0?(d.Rm.debug("Cluster identified",t,p),r.forEach(e=>{w(e.v,t)^w(e.w,t)&&(d.Rm.warn("Edge: ",e," leaves cluster ",t),d.Rm.warn("Descendants of XXX ",t,": ",p.get(t)),h.get(t).externalConnections=!0)})):d.Rm.debug("Not a cluster ",t,p)}),h.keys())){let n=h.get(t).id,r=e.parent(n);r!==t&&h.has(r)&&!h.get(r).externalConnections&&(h.get(t).id=r)}e.edges().forEach(function(t){let n=e.edge(t);d.Rm.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(t)),d.Rm.warn("Edge "+t.v+" -> "+t.w+": "+JSON.stringify(e.edge(t)));let r=t.v,a=t.w;if(d.Rm.warn("Fix XXX",h,"ids:",t.v,t.w,"Translating: ",h.get(t.v)," --- ",h.get(t.w)),h.get(t.v)||h.get(t.w)){if(d.Rm.warn("Fixing and trying - removing XXX",t.v,t.w,t.name),r=N(t.v),a=N(t.w),e.removeEdge(t.v,t.w,t.name),r!==t.v){let a=e.parent(r);h.get(a).externalConnections=!0,n.fromCluster=t.v}if(a!==t.w){let r=e.parent(a);h.get(r).externalConnections=!0,n.toCluster=t.w}d.Rm.warn("Fix Replacing with XXX",r,a,t.name),e.setEdge(r,a,n,t.name)}}),d.Rm.warn("Adjusted Graph",c(e)),C(e,0),d.Rm.trace(h)},"adjustClustersAndEdges"),C=(0,d.K2)((e,t)=>{if(d.Rm.warn("extractor - ",t,c(e),e.children("D")),t>10)return void d.Rm.error("Bailing out");let n=e.nodes(),r=!1;for(let t of n){let n=e.children(t);r=r||n.length>0}if(!r)return void d.Rm.debug("Done, no node has children",e.nodes());for(let r of(d.Rm.debug("Nodes = ",n,t),n))if(d.Rm.debug("Extracting node",r,h,h.has(r)&&!h.get(r).externalConnections,!e.parent(r),e.node(r),e.children("D")," Depth ",t),h.has(r))if(!h.get(r).externalConnections&&e.children(r)&&e.children(r).length>0){d.Rm.warn("Cluster without external connections, without a parent and with children",r,t);let n="TB"===e.graph().rankdir?"LR":"TB";h.get(r)?.clusterData?.dir&&(n=h.get(r).clusterData.dir,d.Rm.warn("Fixing dir",h.get(r).clusterData.dir,n));let a=new f.T({multigraph:!0,compound:!0}).setGraph({rankdir:n,nodesep:50,ranksep:50,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}});d.Rm.warn("Old graph before copy",c(e)),v(r,e,a,r),e.setNode(r,{clusterNode:!0,id:r,clusterData:h.get(r).clusterData,label:h.get(r).label,graph:a}),d.Rm.warn("New graph after copy node: (",r,")",c(a)),d.Rm.debug("Old graph after copy",c(e))}else d.Rm.warn("Cluster ** ",r," **not meeting the criteria !externalConnections:",!h.get(r).externalConnections," no parent: ",!e.parent(r)," children ",e.children(r)&&e.children(r).length>0,e.children("D"),t),d.Rm.debug(h);else d.Rm.debug("Not a cluster",r,t);for(let r of(n=e.nodes(),d.Rm.warn("New list of nodes",n),n)){let n=e.node(r);d.Rm.warn(" Now next level",r,n),n?.clusterNode&&C(n.graph,t+1)}},"extractor"),S=(0,d.K2)((e,t)=>{if(0===t.length)return[];let n=Object.assign([],t);return t.forEach(t=>{let r=e.children(t),a=S(e,r);n=[...n,...a]}),n},"sorter"),x=(0,d.K2)(e=>S(e,e.children()),"sortNodesByHierarchy"),I=(0,d.K2)(async(e,t,n,s,l,g)=>{d.Rm.warn("Graph in recursive render:XAX",c(t),l);let f=t.graph().rankdir;d.Rm.trace("Dir in recursive render - dir:",f);let p=e.insert("g").attr("class","root");t.nodes()?d.Rm.info("Recursive render XXX",t.nodes()):d.Rm.info("No nodes found for",t),t.edges().length>0&&d.Rm.info("Recursive edges",t.edge(t.edges()[0]));let u=p.insert("g").attr("class","clusters"),m=p.insert("g").attr("class","edgePaths"),w=p.insert("g").attr("class","edgeLabels"),R=p.insert("g").attr("class","nodes");await Promise.all(t.nodes().map(async function(e){let r=t.node(e);if(void 0!==l){let n=JSON.parse(JSON.stringify(l.clusterData));d.Rm.trace("Setting data for parent cluster XXX\n Node.id = ",e,"\n data=",n.height,"\nParent cluster",l.height),t.setNode(l.id,n),t.parent(e)||(d.Rm.trace("Setting parent",e,l.id),t.setParent(e,l.id,n))}if(d.Rm.info("(Insert) Node XXX"+e+": "+JSON.stringify(t.node(e))),r?.clusterNode){d.Rm.info("Cluster identified XBX",e,r.width,t.node(e));let{ranksep:i,nodesep:o}=t.graph();r.graph.setGraph({...r.graph.graph(),ranksep:i+25,nodesep:o});let l=await I(R,r.graph,n,s,t.node(e),g),c=l.elem;(0,a.lC)(r,c),r.diff=l.diff||0,d.Rm.info("New compound node after recursive render XAX",e,"width",r.width,"height",r.height),(0,a.U7)(c,r)}else t.children(e).length>0?(d.Rm.trace("Cluster - the non recursive path XBX",e,r.id,r,r.width,"Graph:",t),d.Rm.trace(E(r.id,t)),h.set(r.id,{id:E(r.id,t),node:r})):(d.Rm.trace("Node - the non recursive path XAX",e,R,t.node(e),f),await (0,a.on)(R,t.node(e),{config:g,dir:f}))}));let v=(0,d.K2)(async()=>{let e=t.edges().map(async function(e){let n=t.edge(e.v,e.w,e.name);d.Rm.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(e)),d.Rm.info("Edge "+e.v+" -> "+e.w+": ",e," ",JSON.stringify(t.edge(e))),d.Rm.info("Fix",h,"ids:",e.v,e.w,"Translating: ",h.get(e.v),h.get(e.w)),await (0,r.jP)(w,n)});await Promise.all(e)},"processEdges");await v(),d.Rm.info("Graph before layout:",JSON.stringify(c(t))),d.Rm.info("############################################# XXX"),d.Rm.info("### Layout ### XXX"),d.Rm.info("############################################# XXX"),(0,o.Zp)(t),d.Rm.info("Graph after layout:",JSON.stringify(c(t)));let y=0,{subGraphTitleTotalMargin:X}=(0,i.O)(g);return await Promise.all(x(t).map(async function(e){let n=t.node(e);if(d.Rm.info("Position XBX => "+e+": ("+n.x,","+n.y,") width: ",n.width," height: ",n.height),n?.clusterNode)n.y+=X,d.Rm.info("A tainted cluster node XBX1",e,n.id,n.width,n.height,n.x,n.y,t.parent(e)),h.get(n.id).node=n,(0,a.U_)(n);else if(t.children(e).length>0){d.Rm.info("A pure cluster node XBX1",e,n.id,n.x,n.y,n.width,n.height,t.parent(e)),n.height+=X,t.node(n.parentId);let r=n?.padding/2||0,i=n?.labelBBox?.height||0;d.Rm.debug("OffsetY",i-r||0,"labelHeight",i,"halfPadding",r),await (0,a.U)(u,n),h.get(n.id).node=n}else{let e=t.node(n.parentId);n.y+=X/2,d.Rm.info("A regular node XBX1 - using the padding",n.id,"parent",n.parentId,n.width,n.height,n.x,n.y,"offsetY",n.offsetY,"parent",e,e?.offsetY,n),(0,a.U_)(n)}})),t.edges().forEach(function(e){let a=t.edge(e);d.Rm.info("Edge "+e.v+" -> "+e.w+": "+JSON.stringify(a),a),a.points.forEach(e=>e.y+=X/2);let i=t.node(e.v);var o=t.node(e.w);let l=(0,r.Jo)(m,a,h,n,i,o,s);(0,r.T_)(a,l)}),t.nodes().forEach(function(e){let n=t.node(e);d.Rm.info(e,n.type,n.diff),n.isGroup&&(y=n.diff)}),d.Rm.warn("Returning from recursive render XAX",p,y),{elem:p,diff:y}},"recursiveRender"),D=(0,d.K2)(async(e,t)=>{let n=new f.T({multigraph:!0,compound:!0}).setGraph({rankdir:e.direction,nodesep:e.config?.nodeSpacing||e.config?.flowchart?.nodeSpacing||e.nodeSpacing,ranksep:e.config?.rankSpacing||e.config?.flowchart?.rankSpacing||e.rankSpacing,marginx:8,marginy:8}).setDefaultEdgeLabel(function(){return{}}),i=t.select("g");(0,r.g0)(i,e.markers,e.type,e.diagramId),(0,a.gh)(),(0,r.IU)(),(0,a.IU)(),m(),e.nodes.forEach(e=>{n.setNode(e.id,{...e}),e.parentId&&n.setParent(e.id,e.parentId)}),d.Rm.debug("Edges:",e.edges),e.edges.forEach(e=>{if(e.start===e.end){let t=e.start,r=t+"---"+t+"---1",a=t+"---"+t+"---2",i=n.node(t);n.setNode(r,{domId:r,id:r,parentId:i.parentId,labelStyle:"",label:"",padding:0,shape:"labelRect",style:"",width:10,height:10}),n.setParent(r,i.parentId),n.setNode(a,{domId:a,id:a,parentId:i.parentId,labelStyle:"",padding:0,shape:"labelRect",label:"",style:"",width:10,height:10}),n.setParent(a,i.parentId);let d=structuredClone(e),o=structuredClone(e),s=structuredClone(e);d.label="",d.arrowTypeEnd="none",d.id=t+"-cyclic-special-1",o.arrowTypeStart="none",o.arrowTypeEnd="none",o.id=t+"-cyclic-special-mid",s.label="",i.isGroup&&(d.fromCluster=t,s.toCluster=t),s.id=t+"-cyclic-special-2",s.arrowTypeStart="none",n.setEdge(t,r,d,t+"-cyclic-special-0"),n.setEdge(r,a,o,t+"-cyclic-special-1"),n.setEdge(a,t,s,t+"-cyc<lic-special-2")}else n.setEdge(e.start,e.end,{...e},e.id)}),d.Rm.warn("Graph at first:",JSON.stringify(c(n))),b(n),d.Rm.warn("Graph after XAX:",JSON.stringify(c(n)));let o=(0,d.D7)();await I(i,n,e.type,e.diagramId,void 0,o)},"render")}}]);
@@ -0,0 +1 @@
1
+ (self.rspackChunkchat_demo=self.rspackChunkchat_demo||[]).push([[426],{65(){Prism.languages.c=Prism.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),Prism.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),Prism.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},Prism.languages.c.string],char:Prism.languages.c.char,comment:Prism.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:Prism.languages.c}}}}),Prism.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete Prism.languages.c.boolean}}]);
@@ -0,0 +1 @@
1
+ (self.rspackChunkchat_demo=self.rspackChunkchat_demo||[]).push([[4387],{4894(){Prism.languages.scala=Prism.languages.extend("java",{"triple-quoted-string":{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string"},string:{pattern:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,greedy:!0},keyword:/<-|=>|\b(?:abstract|case|catch|class|def|derives|do|else|enum|extends|extension|final|finally|for|forSome|given|if|implicit|import|infix|inline|lazy|match|new|null|object|opaque|open|override|package|private|protected|return|sealed|self|super|this|throw|trait|transparent|try|type|using|val|var|while|with|yield)\b/,number:/\b0x(?:[\da-f]*\.)?[\da-f]+|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e\d+)?[dfl]?/i,builtin:/\b(?:Any|AnyRef|AnyVal|Boolean|Byte|Char|Double|Float|Int|Long|Nothing|Short|String|Unit)\b/,symbol:/'[^\d\s\\]\w*/}),Prism.languages.insertBefore("scala","triple-quoted-string",{"string-interpolation":{pattern:/\b[a-z]\w*(?:"""(?:[^$]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*?"""|"(?:[^$"\r\n]|\$(?:[^{]|\{(?:[^{}]|\{[^{}]*\})*\}))*")/i,greedy:!0,inside:{id:{pattern:/^\w+/,greedy:!0,alias:"function"},escape:{pattern:/\\\$"|\$[$"]/,greedy:!0,alias:"symbol"},interpolation:{pattern:/\$(?:\w+|\{(?:[^{}]|\{[^{}]*\})*\})/,greedy:!0,inside:{punctuation:/^\$\{?|\}$/,expression:{pattern:/[\s\S]+/,inside:Prism.languages.scala}}},string:/[\s\S]+/}}}),delete Prism.languages.scala["class-name"],delete Prism.languages.scala.function,delete Prism.languages.scala.constant}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.rspackChunkchat_demo=self.rspackChunkchat_demo||[]).push([[4468],{287(t,i,e){e.d(i,{diagram:()=>ti});var s,a=e(3919),n=e(3218),h=e(5876),o=e(8755),r=e(1733),l=e(2631),c=function(){var t=(0,o.K2)(function(t,i,e,s){for(e=e||{},s=t.length;s--;e[t[s]]=i);return e},"o"),i=[1,10,12,14,16,18,19,21,23],e=[2,6],s=[1,3],a=[1,5],n=[1,6],h=[1,7],r=[1,5,10,12,14,16,18,19,21,23,34,35,36],l=[1,25],c=[1,26],g=[1,28],u=[1,29],x=[1,30],d=[1,31],p=[1,32],f=[1,33],m=[1,34],y=[1,35],b=[1,36],A=[1,37],S=[1,43],w=[1,42],C=[1,47],k=[1,50],_=[1,10,12,14,16,18,19,21,23,34,35,36],T=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],R=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],D=[1,64],L={trace:(0,o.K2)(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,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$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",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"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],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:(0,o.K2)(function(t,i,e,s,a,n,h){var o=n.length-1;switch(a){case 5:s.setOrientation(n[o]);break;case 9:s.setDiagramTitle(n[o].text.trim());break;case 12:s.setLineData({text:"",type:"text"},n[o]);break;case 13:s.setLineData(n[o-1],n[o]);break;case 14:s.setBarData({text:"",type:"text"},n[o]);break;case 15:s.setBarData(n[o-1],n[o]);break;case 16:this.$=n[o].trim(),s.setAccTitle(this.$);break;case 17:case 18:this.$=n[o].trim(),s.setAccDescription(this.$);break;case 19:case 27:this.$=n[o-1];break;case 20:this.$=[Number(n[o-2]),...n[o]];break;case 21:this.$=[Number(n[o])];break;case 22:s.setXAxisTitle(n[o]);break;case 23:s.setXAxisTitle(n[o-1]);break;case 24:s.setXAxisTitle({type:"text",text:""});break;case 25:s.setXAxisBand(n[o]);break;case 26:s.setXAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 28:this.$=[n[o-2],...n[o]];break;case 29:this.$=[n[o]];break;case 30:s.setYAxisTitle(n[o]);break;case 31:s.setYAxisTitle(n[o-1]);break;case 32:s.setYAxisTitle({type:"text",text:""});break;case 33:s.setYAxisRangeData(Number(n[o-2]),Number(n[o]));break;case 37:case 38:this.$={text:n[o],type:"text"};break;case 39:this.$={text:n[o],type:"markdown"};break;case 40:this.$=n[o];break;case 41:this.$=n[o-1]+""+n[o]}},"anonymous"),table:[t(i,e,{3:1,4:2,7:4,5:s,34:a,35:n,36:h}),{1:[3]},t(i,e,{4:2,7:4,3:8,5:s,34:a,35:n,36:h}),t(i,e,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:a,35:n,36:h}),{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(r,[2,34]),t(r,[2,35]),t(r,[2,36]),{1:[2,1]},t(i,e,{4:2,7:4,3:21,5:s,34:a,35:n,36:h}),{1:[2,3]},t(r,[2,5]),t(i,[2,7],{4:22,34:a,35:n,36:h}),{11:23,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:39,13:38,24:S,27:w,29:40,30:41,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:45,15:44,27:C,33:46,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:49,17:48,24:k,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{11:52,17:51,24:k,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},{20:[1,53]},{22:[1,54]},t(_,[2,18]),{1:[2,2]},t(_,[2,8]),t(_,[2,9]),t(T,[2,37],{40:55,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A}),t(T,[2,38]),t(T,[2,39]),t(R,[2,40]),t(R,[2,42]),t(R,[2,43]),t(R,[2,44]),t(R,[2,45]),t(R,[2,46]),t(R,[2,47]),t(R,[2,48]),t(R,[2,49]),t(R,[2,50]),t(R,[2,51]),t(_,[2,10]),t(_,[2,22],{30:41,29:56,24:S,27:w}),t(_,[2,24]),t(_,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,11]),t(_,[2,30],{33:60,27:C}),t(_,[2,32]),{31:[1,61]},t(_,[2,12]),{17:62,24:k},{25:63,27:D},t(_,[2,14]),{17:65,24:k},t(_,[2,16]),t(_,[2,17]),t(R,[2,41]),t(_,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},t(_,[2,31]),{27:[1,69]},t(_,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},t(_,[2,15]),t(_,[2,26]),t(_,[2,27]),{11:59,32:72,37:24,38:l,39:c,40:27,41:g,42:u,43:x,44:d,45:p,46:f,47:m,48:y,49:b,50:A},t(_,[2,33]),t(_,[2,19]),{25:73,27:D},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:(0,o.K2)(function(t,i){if(i.recoverable)this.trace(t);else{var e=Error(t);throw e.hash=i,e}},"parseError"),parse:(0,o.K2)(function(t){var i=this,e=[0],s=[],a=[null],n=[],h=this.table,r="",l=0,c=0,g=0,u=n.slice.call(arguments,1),x=Object.create(this.lexer),d={};for(var p in this.yy)Object.prototype.hasOwnProperty.call(this.yy,p)&&(d[p]=this.yy[p]);x.setInput(t,d),d.lexer=x,d.parser=this,void 0===x.yylloc&&(x.yylloc={});var f=x.yylloc;n.push(f);var m=x.options&&x.options.ranges;function y(){var t;return"number"!=typeof(t=s.pop()||x.lex()||1)&&(t instanceof Array&&(t=(s=t).pop()),t=i.symbols_[t]||t),t}"function"==typeof d.parseError?this.parseError=d.parseError:this.parseError=Object.getPrototypeOf(this).parseError,(0,o.K2)(function(t){e.length=e.length-2*t,a.length=a.length-t,n.length=n.length-t},"popStack"),(0,o.K2)(y,"lex");for(var b,A,S,w,C,k,_,T,R,D={};;){if(S=e[e.length-1],this.defaultActions[S]?w=this.defaultActions[S]:(null==b&&(b=y()),w=h[S]&&h[S][b]),void 0===w||!w.length||!w[0]){var L="";for(k in R=[],h[S])this.terminals_[k]&&k>2&&R.push("'"+this.terminals_[k]+"'");L=x.showPosition?"Parse error on line "+(l+1)+":\n"+x.showPosition()+"\nExpecting "+R.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(l+1)+": Unexpected "+(1==b?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(L,{text:x.match,token:this.terminals_[b]||b,line:x.yylineno,loc:f,expected:R})}if(w[0]instanceof Array&&w.length>1)throw Error("Parse Error: multiple actions possible at state: "+S+", token: "+b);switch(w[0]){case 1:e.push(b),a.push(x.yytext),n.push(x.yylloc),e.push(w[1]),b=null,A?(b=A,A=null):(c=x.yyleng,r=x.yytext,l=x.yylineno,f=x.yylloc,g>0&&g--);break;case 2:if(_=this.productions_[w[1]][1],D.$=a[a.length-_],D._$={first_line:n[n.length-(_||1)].first_line,last_line:n[n.length-1].last_line,first_column:n[n.length-(_||1)].first_column,last_column:n[n.length-1].last_column},m&&(D._$.range=[n[n.length-(_||1)].range[0],n[n.length-1].range[1]]),void 0!==(C=this.performAction.apply(D,[r,c,l,d,w[1],a,n].concat(u))))return C;_&&(e=e.slice(0,-1*_*2),a=a.slice(0,-1*_),n=n.slice(0,-1*_)),e.push(this.productions_[w[1]][0]),a.push(D.$),n.push(D._$),T=h[e[e.length-2]][e[e.length-1]],e.push(T);break;case 3:return!0}}return!0},"parse")};function P(){this.yy={}}return L.lexer={EOF:1,parseError:(0,o.K2)(function(t,i){if(this.yy.parser)this.yy.parser.parseError(t,i);else throw Error(t)},"parseError"),setInput:(0,o.K2)(function(t,i){return this.yy=i||this.yy||{},this._input=t,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:(0,o.K2)(function(){var t=this._input[0];return this.yytext+=t,this.yyleng++,this.offset++,this.match+=t,this.matched+=t,t.match(/(?:\r\n?|\n).*/g)?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),t},"input"),unput:(0,o.K2)(function(t){var i=t.length,e=t.split(/(?:\r\n?|\n)/g);this._input=t+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-i),this.offset-=i;var s=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),e.length-1&&(this.yylineno-=e.length-1);var a=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:e?(e.length===s.length?this.yylloc.first_column:0)+s[s.length-e.length].length-e[0].length:this.yylloc.first_column-i},this.options.ranges&&(this.yylloc.range=[a[0],a[0]+this.yyleng-i]),this.yyleng=this.yytext.length,this},"unput"),more:(0,o.K2)(function(){return this._more=!0,this},"more"),reject:(0,o.K2)(function(){return this.options.backtrack_lexer?(this._backtrack=!0,this):this.parseError("Lexical error on line "+(this.yylineno+1)+". You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"reject"),less:(0,o.K2)(function(t){this.unput(this.match.slice(t))},"less"),pastInput:(0,o.K2)(function(){var t=this.matched.substr(0,this.matched.length-this.match.length);return(t.length>20?"...":"")+t.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:(0,o.K2)(function(){var t=this.match;return t.length<20&&(t+=this._input.substr(0,20-t.length)),(t.substr(0,20)+(t.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:(0,o.K2)(function(){var t=this.pastInput(),i=Array(t.length+1).join("-");return t+this.upcomingInput()+"\n"+i+"^"},"showPosition"),test_match:(0,o.K2)(function(t,i){var e,s,a;if(this.options.backtrack_lexer&&(a={yylineno:this.yylineno,yylloc:{first_line:this.yylloc.first_line,last_line:this.last_line,first_column:this.yylloc.first_column,last_column:this.yylloc.last_column},yytext:this.yytext,match:this.match,matches:this.matches,matched:this.matched,yyleng:this.yyleng,offset:this.offset,_more:this._more,_input:this._input,yy:this.yy,conditionStack:this.conditionStack.slice(0),done:this.done},this.options.ranges&&(a.yylloc.range=this.yylloc.range.slice(0))),(s=t[0].match(/(?:\r\n?|\n).*/g))&&(this.yylineno+=s.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:s?s[s.length-1].length-s[s.length-1].match(/\r?\n?/)[0].length:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.matches=t,this.yyleng=this.yytext.length,this.options.ranges&&(this.yylloc.range=[this.offset,this.offset+=this.yyleng]),this._more=!1,this._backtrack=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,i,this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e)return e;if(this._backtrack)for(var n in a)this[n]=a[n];return!1},"test_match"),next:(0,o.K2)(function(){if(this.done)return this.EOF;this._input||(this.done=!0),this._more||(this.yytext="",this.match="");for(var t,i,e,s,a=this._currentRules(),n=0;n<a.length;n++)if((e=this._input.match(this.rules[a[n]]))&&(!i||e[0].length>i[0].length)){if(i=e,s=n,this.options.backtrack_lexer){if(!1!==(t=this.test_match(e,a[n])))return t;if(!this._backtrack)return!1;i=!1;continue}if(!this.options.flex)break}return i?!1!==(t=this.test_match(i,a[s]))&&t:""===this._input?this.EOF:this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},"next"),lex:(0,o.K2)(function(){var t=this.next();return t||this.lex()},"lex"),begin:(0,o.K2)(function(t){this.conditionStack.push(t)},"begin"),popState:(0,o.K2)(function(){return this.conditionStack.length-1>0?this.conditionStack.pop():this.conditionStack[0]},"popState"),_currentRules:(0,o.K2)(function(){return this.conditionStack.length&&this.conditionStack[this.conditionStack.length-1]?this.conditions[this.conditionStack[this.conditionStack.length-1]].rules:this.conditions.INITIAL.rules},"_currentRules"),topState:(0,o.K2)(function(t){return(t=this.conditionStack.length-1-Math.abs(t||0))>=0?this.conditionStack[t]:"INITIAL"},"topState"),pushState:(0,o.K2)(function(t){this.begin(t)},"pushState"),stateStackSize:(0,o.K2)(function(){return this.conditionStack.length},"stateStackSize"),options:{"case-insensitive":!0},performAction:(0,o.K2)(function(t,i,e,s){switch(e){case 0:case 1:case 5:case 44:break;case 2:case 3:return this.popState(),34;case 4:return 34;case 6:return 10;case 7:return this.pushState("acc_title"),19;case 8:return this.popState(),"acc_title_value";case 9:return this.pushState("acc_descr"),21;case 10:return this.popState(),"acc_descr_value";case 11:this.pushState("acc_descr_multiline");break;case 12:case 26:case 28:this.popState();break;case 13:return"acc_descr_multiline_value";case 14:case 15:return 5;case 16:return 8;case 17:return this.pushState("axis_data"),"X_AXIS";case 18:return this.pushState("axis_data"),"Y_AXIS";case 19:return this.pushState("axis_band_data"),24;case 20:return 31;case 21:return this.pushState("data"),16;case 22:return this.pushState("data"),18;case 23:return this.pushState("data_inner"),24;case 24:return 27;case 25:return this.popState(),26;case 27:this.pushState("string");break;case 29:return"STR";case 30:return 24;case 31:return 26;case 32:return 43;case 33:return"COLON";case 34:return 44;case 35:return 28;case 36:return 45;case 37:return 46;case 38:return 48;case 39:return 50;case 40:return 47;case 41:return 41;case 42:return 49;case 43:return 42;case 45:return 35;case 46:return 36}},"anonymous"),rules:[/^(?:%%(?!\{)[^\n]*)/i,/^(?:[^\}]%%[^\n]*)/i,/^(?:(\r?\n))/i,/^(?:(\r?\n))/i,/^(?:[\n\r]+)/i,/^(?:%%[^\n]*)/i,/^(?:title\b)/i,/^(?:accTitle\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*:\s*)/i,/^(?:(?!\n||)*[^\n]*)/i,/^(?:accDescr\s*\{\s*)/i,/^(?:\{)/i,/^(?:[^\}]*)/i,/^(?:xychart-beta\b)/i,/^(?:xychart\b)/i,/^(?:(?:vertical|horizontal))/i,/^(?:x-axis\b)/i,/^(?:y-axis\b)/i,/^(?:\[)/i,/^(?:-->)/i,/^(?:line\b)/i,/^(?:bar\b)/i,/^(?:\[)/i,/^(?:[+-]?(?:\d+(?:\.\d+)?|\.\d+))/i,/^(?:\])/i,/^(?:(?:`\) \{ this\.pushState\(md_string\); \}\n<md_string>\(\?:\(\?!`"\)\.\)\+ \{ return MD_STR; \}\n<md_string>\(\?:`))/i,/^(?:["])/i,/^(?:["])/i,/^(?:[^"]*)/i,/^(?:\[)/i,/^(?:\])/i,/^(?:[A-Za-z]+)/i,/^(?::)/i,/^(?:\+)/i,/^(?:,)/i,/^(?:=)/i,/^(?:\*)/i,/^(?:#)/i,/^(?:[\_])/i,/^(?:\.)/i,/^(?:&)/i,/^(?:-)/i,/^(?:[0-9]+)/i,/^(?:\s+)/i,/^(?:;)/i,/^(?:$)/i],conditions:{data_inner:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,24,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},data:{rules:[0,1,3,4,5,6,7,9,11,14,15,16,17,18,21,22,23,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_band_data:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,25,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},axis_data:{rules:[0,1,2,4,5,6,7,9,11,14,15,16,17,18,19,20,21,22,24,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0},acc_descr_multiline:{rules:[12,13],inclusive:!1},acc_descr:{rules:[10],inclusive:!1},acc_title:{rules:[8],inclusive:!1},title:{rules:[],inclusive:!1},md_string:{rules:[],inclusive:!1},string:{rules:[28,29],inclusive:!1},INITIAL:{rules:[0,1,4,5,6,7,9,11,14,15,16,17,18,21,22,26,27,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46],inclusive:!0}}},(0,o.K2)(P,"Parser"),P.prototype=L,L.Parser=P,new P}();function g(t){return"bar"===t.type}function u(t){return"band"===t.type}function x(t){return"linear"===t.type}c.parser=c,(0,o.K2)(g,"isBarPlot"),(0,o.K2)(u,"isBandAxisData"),(0,o.K2)(x,"isLinearAxisData");var d=class{constructor(t){this.parentGroup=t}static{(0,o.K2)(this,"TextDimensionCalculatorWithFont")}getMaxDimension(t,i){if(!this.parentGroup)return{width:t.reduce((t,i)=>Math.max(i.length,t),0)*i,height:i};let e={width:0,height:0},s=this.parentGroup.append("g").attr("visibility","hidden").attr("font-size",i);for(let n of t){let t=(0,a.W6)(s,1,n),h=t?t.width:n.length*i,o=t?t.height:i;e.width=Math.max(e.width,h),e.height=Math.max(e.height,o)}return s.remove(),e}},p=class{constructor(t,i,e,s){this.axisConfig=t,this.title=i,this.textDimensionCalculator=e,this.axisThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left",this.showTitle=!1,this.showLabel=!1,this.showTick=!1,this.showAxisLine=!1,this.outerPadding=0,this.titleTextHeight=0,this.labelTextHeight=0,this.range=[0,10],this.boundingRect={x:0,y:0,width:0,height:0},this.axisPosition="left"}static{(0,o.K2)(this,"BaseAxis")}setRange(t){this.range=t,"left"===this.axisPosition||"right"===this.axisPosition?this.boundingRect.height=t[1]-t[0]:this.boundingRect.width=t[1]-t[0],this.recalculateScale()}getRange(){return[this.range[0]+this.outerPadding,this.range[1]-this.outerPadding]}setAxisPosition(t){this.axisPosition=t,this.setRange(this.range)}getTickDistance(){let t=this.getRange();return Math.abs(t[0]-t[1])/this.getTickValues().length}getAxisOuterPadding(){return this.outerPadding}getLabelDimension(){return this.textDimensionCalculator.getMaxDimension(this.getTickValues().map(t=>t.toString()),this.axisConfig.labelFontSize)}recalculateOuterPaddingToDrawBar(){.7*this.getTickDistance()>2*this.outerPadding&&(this.outerPadding=Math.floor(.7*this.getTickDistance()/2)),this.recalculateScale()}calculateSpaceIfDrawnHorizontally(t){let i=t.height;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),s=.2*t.width;this.outerPadding=Math.min(e.width/2,s);let a=e.height+2*this.axisConfig.labelPadding;this.labelTextHeight=e.height,a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width,this.boundingRect.height=t.height-i}calculateSpaceIfDrawnVertical(t){let i=t.width;if(this.axisConfig.showAxisLine&&i>this.axisConfig.axisLineWidth&&(i-=this.axisConfig.axisLineWidth,this.showAxisLine=!0),this.axisConfig.showLabel){let e=this.getLabelDimension(),s=.2*t.height;this.outerPadding=Math.min(e.height/2,s);let a=e.width+2*this.axisConfig.labelPadding;a<=i&&(i-=a,this.showLabel=!0)}if(this.axisConfig.showTick&&i>=this.axisConfig.tickLength&&(this.showTick=!0,i-=this.axisConfig.tickLength),this.axisConfig.showTitle&&this.title){let t=this.textDimensionCalculator.getMaxDimension([this.title],this.axisConfig.titleFontSize),e=t.height+2*this.axisConfig.titlePadding;this.titleTextHeight=t.height,e<=i&&(i-=e,this.showTitle=!0)}this.boundingRect.width=t.width-i,this.boundingRect.height=t.height}calculateSpace(t){return"left"===this.axisPosition||"right"===this.axisPosition?this.calculateSpaceIfDrawnVertical(t):this.calculateSpaceIfDrawnHorizontally(t),this.recalculateScale(),{width:this.boundingRect.width,height:this.boundingRect.height}}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}getDrawableElementsForLeftAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.x+this.boundingRect.width-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["left-axis","axisl-line"],data:[{path:`M ${i},${this.boundingRect.y} L ${i},${this.boundingRect.y+this.boundingRect.height} `,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["left-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.boundingRect.x+this.boundingRect.width-(this.showLabel?this.axisConfig.labelPadding:0)-(this.showTick?this.axisConfig.tickLength:0)-(this.showAxisLine?this.axisConfig.axisLineWidth:0),y:this.getScaleValue(t),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"middle",horizontalPos:"right"}))}),this.showTick){let i=this.boundingRect.x+this.boundingRect.width-(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["left-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${i},${this.getScaleValue(t)} L ${i-this.axisConfig.tickLength},${this.getScaleValue(t)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["left-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.axisConfig.titlePadding,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:270,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForBottomAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["bottom-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["bottom-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+this.axisConfig.labelPadding+(this.showTick?this.axisConfig.tickLength:0)+(this.showAxisLine?this.axisConfig.axisLineWidth:0),fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y+(this.showAxisLine?this.axisConfig.axisLineWidth:0);t.push({type:"path",groupTexts:["bottom-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i} L ${this.getScaleValue(t)},${i+this.axisConfig.tickLength}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["bottom-axis","title"],data:[{text:this.title,x:this.range[0]+(this.range[1]-this.range[0])/2,y:this.boundingRect.y+this.boundingRect.height-this.axisConfig.titlePadding-this.titleTextHeight,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElementsForTopAxis(){let t=[];if(this.showAxisLine){let i=this.boundingRect.y+this.boundingRect.height-this.axisConfig.axisLineWidth/2;t.push({type:"path",groupTexts:["top-axis","axis-line"],data:[{path:`M ${this.boundingRect.x},${i} L ${this.boundingRect.x+this.boundingRect.width},${i}`,strokeFill:this.axisThemeConfig.axisLineColor,strokeWidth:this.axisConfig.axisLineWidth}]})}if(this.showLabel&&t.push({type:"text",groupTexts:["top-axis","label"],data:this.getTickValues().map(t=>({text:t.toString(),x:this.getScaleValue(t),y:this.boundingRect.y+(this.showTitle?this.titleTextHeight+2*this.axisConfig.titlePadding:0)+this.axisConfig.labelPadding,fill:this.axisThemeConfig.labelColor,fontSize:this.axisConfig.labelFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}))}),this.showTick){let i=this.boundingRect.y;t.push({type:"path",groupTexts:["top-axis","ticks"],data:this.getTickValues().map(t=>({path:`M ${this.getScaleValue(t)},${i+this.boundingRect.height-(this.showAxisLine?this.axisConfig.axisLineWidth:0)} L ${this.getScaleValue(t)},${i+this.boundingRect.height-this.axisConfig.tickLength-(this.showAxisLine?this.axisConfig.axisLineWidth:0)}`,strokeFill:this.axisThemeConfig.tickColor,strokeWidth:this.axisConfig.tickWidth}))})}return this.showTitle&&t.push({type:"text",groupTexts:["top-axis","title"],data:[{text:this.title,x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.axisConfig.titlePadding,fill:this.axisThemeConfig.titleColor,fontSize:this.axisConfig.titleFontSize,rotation:0,verticalPos:"top",horizontalPos:"center"}]}),t}getDrawableElements(){if("left"===this.axisPosition)return this.getDrawableElementsForLeftAxis();if("right"===this.axisPosition)throw Error("Drawing of right axis is not implemented");return"bottom"===this.axisPosition?this.getDrawableElementsForBottomAxis():"top"===this.axisPosition?this.getDrawableElementsForTopAxis():[]}},f=class extends p{static{(0,o.K2)(this,"BandAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.categories=e,this.scale=(0,r.WH)().domain(this.categories).range(this.getRange())}setRange(t){super.setRange(t)}recalculateScale(){this.scale=(0,r.WH)().domain(this.categories).range(this.getRange()).paddingInner(1).paddingOuter(0).align(.5),o.Rm.trace("BandAxis axis final categories, range: ",this.categories,this.getRange())}getTickValues(){return this.categories}getScaleValue(t){return this.scale(t)??this.getRange()[0]}},m=class extends p{static{(0,o.K2)(this,"LinearAxis")}constructor(t,i,e,s,a){super(t,s,a,i),this.domain=e,this.scale=(0,r.m4)().domain(this.domain).range(this.getRange())}getTickValues(){return this.scale.ticks()}recalculateScale(){let t=[...this.domain];"left"===this.axisPosition&&t.reverse(),this.scale=(0,r.m4)().domain(t).range(this.getRange())}getScaleValue(t){return this.scale(t)}};function y(t,i,e,s){let a=new d(s);return u(t)?new f(i,e,t.categories,t.title,a):new m(i,e,[t.min,t.max],t.title,a)}(0,o.K2)(y,"getAxis");var b=class{constructor(t,i,e,s){this.textDimensionCalculator=t,this.chartConfig=i,this.chartData=e,this.chartThemeConfig=s,this.boundingRect={x:0,y:0,width:0,height:0},this.showChartTitle=!1}static{(0,o.K2)(this,"ChartTitle")}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){let i=this.textDimensionCalculator.getMaxDimension([this.chartData.title],this.chartConfig.titleFontSize),e=Math.max(i.width,t.width),s=i.height+2*this.chartConfig.titlePadding;return i.width<=e&&i.height<=s&&this.chartConfig.showTitle&&this.chartData.title&&(this.boundingRect.width=e,this.boundingRect.height=s,this.showChartTitle=!0),{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){let t=[];return this.showChartTitle&&t.push({groupTexts:["chart-title"],type:"text",data:[{fontSize:this.chartConfig.titleFontSize,text:this.chartData.title,verticalPos:"middle",horizontalPos:"center",x:this.boundingRect.x+this.boundingRect.width/2,y:this.boundingRect.y+this.boundingRect.height/2,fill:this.chartThemeConfig.titleColor,rotation:0}]}),t}};function A(t,i,e,s){return new b(new d(s),t,i,e)}(0,o.K2)(A,"getChartTitleComponent");var S=class{constructor(t,i,e,s,a){this.plotData=t,this.xAxis=i,this.yAxis=e,this.orientation=s,this.plotIndex=a}static{(0,o.K2)(this,"LinePlot")}getDrawableElement(){let t,i=this.plotData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]);return(t="horizontal"===this.orientation?(0,l.n8)().y(t=>t[0]).x(t=>t[1])(i):(0,l.n8)().x(t=>t[0]).y(t=>t[1])(i))?[{groupTexts:["plot",`line-plot-${this.plotIndex}`],type:"path",data:[{path:t,strokeFill:this.plotData.strokeFill,strokeWidth:this.plotData.strokeWidth}]}]:[]}},w=class{constructor(t,i,e,s,a,n){this.barData=t,this.boundingRect=i,this.xAxis=e,this.yAxis=s,this.orientation=a,this.plotIndex=n}static{(0,o.K2)(this,"BarPlot")}getDrawableElement(){let t=this.barData.data.map(t=>[this.xAxis.getScaleValue(t[0]),this.yAxis.getScaleValue(t[1])]),i=.95*Math.min(2*this.xAxis.getAxisOuterPadding(),this.xAxis.getTickDistance()),e=i/2;return"horizontal"===this.orientation?[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(t=>({x:this.boundingRect.x,y:t[0]-e,height:i,width:t[1]-this.boundingRect.x,fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]:[{groupTexts:["plot",`bar-plot-${this.plotIndex}`],type:"rect",data:t.map(t=>({x:t[0]-e,y:t[1],width:i,height:this.boundingRect.y+this.boundingRect.height-t[1],fill:this.barData.fill,strokeWidth:0,strokeFill:this.barData.fill}))}]}},C=class{constructor(t,i,e){this.chartConfig=t,this.chartData=i,this.chartThemeConfig=e,this.boundingRect={x:0,y:0,width:0,height:0}}static{(0,o.K2)(this,"BasePlot")}setAxes(t,i){this.xAxis=t,this.yAxis=i}setBoundingBoxXY(t){this.boundingRect.x=t.x,this.boundingRect.y=t.y}calculateSpace(t){return this.boundingRect.width=t.width,this.boundingRect.height=t.height,{width:this.boundingRect.width,height:this.boundingRect.height}}getDrawableElements(){if(!(this.xAxis&&this.yAxis))throw Error("Axes must be passed to render Plots");let t=[];for(let[i,e]of this.chartData.plots.entries())switch(e.type){case"line":{let s=new S(e,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}break;case"bar":{let s=new w(e,this.boundingRect,this.xAxis,this.yAxis,this.chartConfig.chartOrientation,i);t.push(...s.getDrawableElement())}}return t}};function k(t,i,e){return new C(t,i,e)}(0,o.K2)(k,"getPlotComponent");var _=class{constructor(t,i,e,s){this.chartConfig=t,this.chartData=i,this.componentStore={title:A(t,i,e,s),plot:k(t,i,e),xAxis:y(i.xAxis,t.xAxis,{titleColor:e.xAxisTitleColor,labelColor:e.xAxisLabelColor,tickColor:e.xAxisTickColor,axisLineColor:e.xAxisLineColor},s),yAxis:y(i.yAxis,t.yAxis,{titleColor:e.yAxisTitleColor,labelColor:e.yAxisLabelColor,tickColor:e.yAxisTickColor,axisLineColor:e.yAxisLineColor},s)}}static{(0,o.K2)(this,"Orchestrator")}calculateVerticalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),n=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),h=this.componentStore.plot.calculateSpace({width:a,height:n});t-=h.width,i-=h.height,s=(h=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i})).height,i-=h.height,this.componentStore.xAxis.setAxisPosition("bottom"),h=this.componentStore.xAxis.calculateSpace({width:t,height:i}),i-=h.height,this.componentStore.yAxis.setAxisPosition("left"),e=(h=this.componentStore.yAxis.calculateSpace({width:t,height:i})).width,(t-=h.width)>0&&(a+=t,t=0),i>0&&(n+=i,i=0),this.componentStore.plot.calculateSpace({width:a,height:n}),this.componentStore.plot.setBoundingBoxXY({x:e,y:s}),this.componentStore.xAxis.setRange([e,e+a]),this.componentStore.xAxis.setBoundingBoxXY({x:e,y:s+n}),this.componentStore.yAxis.setRange([s,s+n]),this.componentStore.yAxis.setBoundingBoxXY({x:0,y:s}),this.chartData.plots.some(t=>g(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateHorizontalSpace(){let t=this.chartConfig.width,i=this.chartConfig.height,e=0,s=0,a=0,n=Math.floor(t*this.chartConfig.plotReservedSpacePercent/100),h=Math.floor(i*this.chartConfig.plotReservedSpacePercent/100),o=this.componentStore.plot.calculateSpace({width:n,height:h});t-=o.width,i-=o.height,e=(o=this.componentStore.title.calculateSpace({width:this.chartConfig.width,height:i})).height,i-=o.height,this.componentStore.xAxis.setAxisPosition("left"),o=this.componentStore.xAxis.calculateSpace({width:t,height:i}),t-=o.width,s=o.width,this.componentStore.yAxis.setAxisPosition("top"),o=this.componentStore.yAxis.calculateSpace({width:t,height:i}),i-=o.height,a=e+o.height,t>0&&(n+=t,t=0),i>0&&(h+=i,i=0),this.componentStore.plot.calculateSpace({width:n,height:h}),this.componentStore.plot.setBoundingBoxXY({x:s,y:a}),this.componentStore.yAxis.setRange([s,s+n]),this.componentStore.yAxis.setBoundingBoxXY({x:s,y:e}),this.componentStore.xAxis.setRange([a,a+h]),this.componentStore.xAxis.setBoundingBoxXY({x:0,y:a}),this.chartData.plots.some(t=>g(t))&&this.componentStore.xAxis.recalculateOuterPaddingToDrawBar()}calculateSpace(){"horizontal"===this.chartConfig.chartOrientation?this.calculateHorizontalSpace():this.calculateVerticalSpace()}getDrawableElement(){this.calculateSpace();let t=[];for(let i of(this.componentStore.plot.setAxes(this.componentStore.xAxis,this.componentStore.yAxis),Object.values(this.componentStore)))t.push(...i.getDrawableElements());return t}},T=class{static{(0,o.K2)(this,"XYChartBuilder")}static build(t,i,e,s){return new _(t,i,e,s).getDrawableElement()}},R=0,D=$(),L=I(),P=M(),E=L.plotColorPalette.split(",").map(t=>t.trim()),K=!1,v=!1;function I(){let t=(0,o.P$)(),i=(0,o.zj)();return(0,n.$t)(t.xyChart,i.themeVariables.xyChart)}function $(){let t=(0,o.zj)();return(0,n.$t)(o.UI.xyChart,t.xyChart)}function M(){return{yAxis:{type:"linear",title:"",min:1/0,max:-1/0},xAxis:{type:"band",title:"",categories:[]},title:"",plots:[]}}function z(t){let i=(0,o.zj)();return(0,o.jZ)(t.trim(),i)}function B(t){s=t}function W(t){"horizontal"===t?D.chartOrientation="horizontal":D.chartOrientation="vertical"}function O(t){P.xAxis.title=z(t.text)}function F(t,i){P.xAxis={type:"linear",title:P.xAxis.title,min:t,max:i},K=!0}function N(t){P.xAxis={type:"band",title:P.xAxis.title,categories:t.map(t=>z(t.text))},K=!0}function V(t){P.yAxis.title=z(t.text)}function X(t,i){P.yAxis={type:"linear",title:P.yAxis.title,min:t,max:i},v=!0}function Y(t){let i=Math.min(...t),e=Math.max(...t),s=x(P.yAxis)?P.yAxis.min:1/0,a=x(P.yAxis)?P.yAxis.max:-1/0;P.yAxis={type:"linear",title:P.yAxis.title,min:Math.min(s,i),max:Math.max(a,e)}}function H(t){let i=[];if(0===t.length)return i;if(K||F(Math.min(x(P.xAxis)?P.xAxis.min:1/0,1),Math.max(x(P.xAxis)?P.xAxis.max:-1/0,t.length)),v||Y(t),u(P.xAxis)&&(i=P.xAxis.categories.map((i,e)=>[i,t[e]])),x(P.xAxis)){let e=P.xAxis.min,s=P.xAxis.max,a=(s-e)/(t.length-1),n=[];for(let t=e;t<=s;t+=a)n.push(`${t}`);i=n.map((i,e)=>[i,t[e]])}return i}function U(t){return E[0===t?0:t%E.length]}function j(t,i){let e=H(i);P.plots.push({type:"line",strokeFill:U(R),strokeWidth:2,data:e}),R++}function G(t,i){let e=H(i);P.plots.push({type:"bar",fill:U(R),data:e}),R++}function Q(){if(0===P.plots.length)throw Error("No Plot to render, please provide a plot with some data");return P.title=(0,o.ab)(),T.build(D,P,L,s)}function Z(){return L}function q(){return D}function J(){return P}(0,o.K2)(I,"getChartDefaultThemeConfig"),(0,o.K2)($,"getChartDefaultConfig"),(0,o.K2)(M,"getChartDefaultData"),(0,o.K2)(z,"textSanitizer"),(0,o.K2)(B,"setTmpSVGG"),(0,o.K2)(W,"setOrientation"),(0,o.K2)(O,"setXAxisTitle"),(0,o.K2)(F,"setXAxisRangeData"),(0,o.K2)(N,"setXAxisBand"),(0,o.K2)(V,"setYAxisTitle"),(0,o.K2)(X,"setYAxisRangeData"),(0,o.K2)(Y,"setYAxisRangeFromPlotData"),(0,o.K2)(H,"transformDataWithoutCategory"),(0,o.K2)(U,"getPlotColorFromPalette"),(0,o.K2)(j,"setLineData"),(0,o.K2)(G,"setBarData"),(0,o.K2)(Q,"getDrawableElem"),(0,o.K2)(Z,"getChartThemeConfig"),(0,o.K2)(q,"getChartConfig"),(0,o.K2)(J,"getXYChartData");var tt={getDrawableElem:Q,clear:(0,o.K2)(function(){(0,o.IU)(),R=0,D=$(),P=M(),E=(L=I()).plotColorPalette.split(",").map(t=>t.trim()),K=!1,v=!1},"clear"),setAccTitle:o.SV,getAccTitle:o.iN,setDiagramTitle:o.ke,getDiagramTitle:o.ab,getAccDescription:o.m7,setAccDescription:o.EI,setOrientation:W,setXAxisTitle:O,setXAxisRangeData:F,setXAxisBand:N,setYAxisTitle:V,setYAxisRangeData:X,setLineData:j,setBarData:G,setTmpSVGG:B,getChartThemeConfig:Z,getChartConfig:q,getXYChartData:J},ti={parser:c,db:tt,renderer:{draw:(0,o.K2)((t,i,e,s)=>{let a=s.db,n=a.getChartThemeConfig(),r=a.getChartConfig(),l=a.getXYChartData().plots[0].data.map(t=>t[1]);function c(t){return"top"===t?"text-before-edge":"middle"}function g(t){return"left"===t?"start":"right"===t?"end":"middle"}function u(t){return`translate(${t.x}, ${t.y}) rotate(${t.rotation||0})`}(0,o.K2)(c,"getDominantBaseLine"),(0,o.K2)(g,"getTextAnchor"),(0,o.K2)(u,"getTextTransformation"),o.Rm.debug("Rendering xychart chart\n"+t);let x=(0,h.D)(i),d=x.append("g").attr("class","main"),p=d.append("rect").attr("width",r.width).attr("height",r.height).attr("class","background");(0,o.a$)(x,r.height,r.width,!0),x.attr("viewBox",`0 0 ${r.width} ${r.height}`),p.attr("fill",n.backgroundColor),a.setTmpSVGG(x.append("g").attr("class","mermaid-tmp-group"));let f=a.getDrawableElem(),m={};function y(t){let i=d,e="";for(let[s]of t.entries()){let a=d;s>0&&m[e]&&(a=m[e]),e+=t[s],(i=m[e])||(i=m[e]=a.append("g").attr("class",t[s]))}return i}for(let t of((0,o.K2)(y,"getGroup"),f)){if(0===t.data.length)continue;let i=y(t.groupTexts);switch(t.type){case"rect":if(i.selectAll("rect").data(t.data).enter().append("rect").attr("x",t=>t.x).attr("y",t=>t.y).attr("width",t=>t.width).attr("height",t=>t.height).attr("fill",t=>t.fill).attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth),r.showDataLabel)if("horizontal"===r.chartOrientation){let e=function(t,i){let{data:e,label:a}=t;return i*a.length*s<=e.width-10};(0,o.K2)(e,"fitsHorizontally");let s=.7,a=t.data.map((t,i)=>({data:t,label:l[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),n=Math.floor(Math.min(...a.map(t=>{let{data:i}=t,s=.7*i.height;for(;!e(t,s)&&s>0;)s-=1;return s})));i.selectAll("text").data(a).enter().append("text").attr("x",t=>t.data.x+t.data.width-10).attr("y",t=>t.data.y+t.data.height/2).attr("text-anchor","end").attr("dominant-baseline","middle").attr("fill","black").attr("font-size",`${n}px`).text(t=>t.label)}else{let e=function(t,i,e){let{data:s,label:a}=t,n=i*a.length*.7,h=s.x+s.width/2,o=h-n/2,r=h+n/2,l=o>=s.x&&r<=s.x+s.width,c=s.y+e+i<=s.y+s.height;return l&&c};(0,o.K2)(e,"fitsInBar");let s=t.data.map((t,i)=>({data:t,label:l[i].toString()})).filter(t=>t.data.width>0&&t.data.height>0),a=Math.floor(Math.min(...s.map(t=>{let{data:i,label:s}=t,a=i.width/(.7*s.length);for(;!e(t,a,10)&&a>0;)a-=1;return a})));i.selectAll("text").data(s).enter().append("text").attr("x",t=>t.data.x+t.data.width/2).attr("y",t=>t.data.y+10).attr("text-anchor","middle").attr("dominant-baseline","hanging").attr("fill","black").attr("font-size",`${a}px`).text(t=>t.label)}break;case"text":i.selectAll("text").data(t.data).enter().append("text").attr("x",0).attr("y",0).attr("fill",t=>t.fill).attr("font-size",t=>t.fontSize).attr("dominant-baseline",t=>c(t.verticalPos)).attr("text-anchor",t=>g(t.horizontalPos)).attr("transform",t=>u(t)).text(t=>t.text);break;case"path":i.selectAll("path").data(t.data).enter().append("path").attr("d",t=>t.path).attr("fill",t=>t.fill?t.fill:"none").attr("stroke",t=>t.strokeFill).attr("stroke-width",t=>t.strokeWidth)}}},"draw")}}}}]);