@n8n-zengchao/chat 0.62.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 (151) hide show
  1. package/README.md +289 -0
  2. package/dist/App.vue.d.ts +2 -0
  3. package/dist/__stories__/App.stories.d.ts +18 -0
  4. package/dist/__tests__/Input.spec.d.ts +1 -0
  5. package/dist/__tests__/api/generic.spec.d.ts +1 -0
  6. package/dist/__tests__/api/message.spec.d.ts +1 -0
  7. package/dist/__tests__/index.spec.d.ts +1 -0
  8. package/dist/__tests__/plugins/chat.spec.d.ts +1 -0
  9. package/dist/__tests__/plugins/chat.test.d.ts +1 -0
  10. package/dist/__tests__/setup.d.ts +0 -0
  11. package/dist/__tests__/utils/create.d.ts +5 -0
  12. package/dist/__tests__/utils/fetch.d.ts +13 -0
  13. package/dist/__tests__/utils/index.d.ts +3 -0
  14. package/dist/__tests__/utils/selectors.d.ts +12 -0
  15. package/dist/__tests__/utils/streaming.spec.d.ts +1 -0
  16. package/dist/__tests__/utils/streamingHandlers.spec.d.ts +1 -0
  17. package/dist/_basePickBy-aQilsjEs.mjs +106 -0
  18. package/dist/_baseUniq-Agc10qFQ.mjs +232 -0
  19. package/dist/api/generic.d.ts +7 -0
  20. package/dist/api/index.d.ts +2 -0
  21. package/dist/api/message.d.ts +11 -0
  22. package/dist/arc-EhYU_DB1.mjs +79 -0
  23. package/dist/architecture-U656AL7Q-B1STlXpR.mjs +10 -0
  24. package/dist/architectureDiagram-VXUJARFQ-DOVAbXSw.mjs +4054 -0
  25. package/dist/array-B5w981Vk.mjs +5 -0
  26. package/dist/blockDiagram-VD42YOAC-BsX3Fkg3.mjs +3013 -0
  27. package/dist/c4Diagram-YG6GDRKO-B5JaLuX6.mjs +2957 -0
  28. package/dist/channel-CqrIo07y.mjs +4 -0
  29. package/dist/chat.bundle.es.js +37656 -0
  30. package/dist/chat.bundle.umd.js +2784 -0
  31. package/dist/chat.es.js +35738 -0
  32. package/dist/chat.umd.js +2776 -0
  33. package/dist/chunk-4BX2VUAB-dn0RXIrC.mjs +7 -0
  34. package/dist/chunk-55IACEB6-DrIttNoL.mjs +7 -0
  35. package/dist/chunk-76Q3JFCE-D7DMbWeQ.mjs +20 -0
  36. package/dist/chunk-ABZYJK2D-_NXv778f.mjs +2516 -0
  37. package/dist/chunk-ATLVNIR6-CBnG7Ev9.mjs +66 -0
  38. package/dist/chunk-B4BG7PRW-DElmmAse.mjs +3109 -0
  39. package/dist/chunk-CVBHYZKI-kPsSw5G9.mjs +11 -0
  40. package/dist/chunk-DI55MBZ5-Bw6uFFfD.mjs +1995 -0
  41. package/dist/chunk-DZXZ2BO8.mjs +19 -0
  42. package/dist/chunk-EXTU4WIE-DWzncOZf.mjs +8 -0
  43. package/dist/chunk-FMBD7UC4-CQf-nVrj.mjs +4 -0
  44. package/dist/chunk-FPAJGGOC-HRc6DGju.mjs +12254 -0
  45. package/dist/chunk-FWNWRKHM-CGiJVNMo.mjs +57 -0
  46. package/dist/chunk-HN2XXSSU-DMfVdeUE.mjs +75 -0
  47. package/dist/chunk-JA3XYJ7Z-b0Li4NN8.mjs +1834 -0
  48. package/dist/chunk-JZLCHNYA-C_4MLySW.mjs +4862 -0
  49. package/dist/chunk-KS23V3DP-BRKOfbU6.mjs +136 -0
  50. package/dist/chunk-LBM3YZW2-JIQK8wiH.mjs +20 -0
  51. package/dist/chunk-LHMN2FUI-PNCyIUgu.mjs +20 -0
  52. package/dist/chunk-MI3HLSF2-B9GTCmLp.mjs +1146 -0
  53. package/dist/chunk-N4CR4FBY-CjlmnCPD.mjs +40 -0
  54. package/dist/chunk-O7ZBX7Z2-DmJUfqJj.mjs +27 -0
  55. package/dist/chunk-QN33PNHL-nN1zLFSf.mjs +24 -0
  56. package/dist/chunk-QXUST7PY-CY78Btj9.mjs +487 -0
  57. package/dist/chunk-QZHKN3VN-BF5N1pfB.mjs +12 -0
  58. package/dist/chunk-S3R3BYOJ-BhFsv0Go.mjs +1076 -0
  59. package/dist/chunk-S6J4BHB3-BvrWTdbl.mjs +20 -0
  60. package/dist/chunk-T53DSG4Q-XzY06amw.mjs +25 -0
  61. package/dist/chunk-TZMSLE5B-DVmJQ8eg.mjs +57 -0
  62. package/dist/classDiagram-2ON5EDUG-CKxiEVX9.mjs +33 -0
  63. package/dist/classDiagram-v2-WZHVMYZB-sAa_2keq.mjs +33 -0
  64. package/dist/clone-nkGlb0Gn.mjs +8 -0
  65. package/dist/components/Button.vue.d.ts +17 -0
  66. package/dist/components/Chat.vue.d.ts +2 -0
  67. package/dist/components/ChatFile.vue.d.ts +11 -0
  68. package/dist/components/ChatWindow.vue.d.ts +2 -0
  69. package/dist/components/GetStarted.vue.d.ts +2 -0
  70. package/dist/components/GetStartedFooter.vue.d.ts +2 -0
  71. package/dist/components/Input.vue.d.ts +39 -0
  72. package/dist/components/Layout.vue.d.ts +23 -0
  73. package/dist/components/Message.vue.d.ts +39 -0
  74. package/dist/components/MessageTyping.vue.d.ts +76 -0
  75. package/dist/components/MessagesList.vue.d.ts +164 -0
  76. package/dist/components/PoweredBy.vue.d.ts +2 -0
  77. package/dist/components/index.d.ts +10 -0
  78. package/dist/composables/index.d.ts +3 -0
  79. package/dist/composables/useChat.d.ts +2 -0
  80. package/dist/composables/useI18n.d.ts +4 -0
  81. package/dist/composables/useOptions.d.ts +4 -0
  82. package/dist/constants/defaults.d.ts +3 -0
  83. package/dist/constants/index.d.ts +3 -0
  84. package/dist/constants/localStorage.d.ts +2 -0
  85. package/dist/constants/symbols.d.ts +4 -0
  86. package/dist/cose-bilkent-S5V4N54A-1lKG2PUg.mjs +2251 -0
  87. package/dist/cytoscape.esm-Dls1_mGy.mjs +18108 -0
  88. package/dist/dagre-6UL2VRFP-CbWFu9xQ.mjs +300 -0
  89. package/dist/dagre-DEdOheHq.mjs +1385 -0
  90. package/dist/defaultLocale-CyoQm63E.mjs +178 -0
  91. package/dist/diagram-PSM6KHXK-CJcHbrJH.mjs +499 -0
  92. package/dist/diagram-QEK2KX5R-XQ9XOVL4.mjs +228 -0
  93. package/dist/diagram-S2PKOQOG-CmRfaeSf.mjs +146 -0
  94. package/dist/dist-BT0fjU7K.mjs +50 -0
  95. package/dist/erDiagram-Q2GNP2WA-iuoUWHwm.mjs +1603 -0
  96. package/dist/event-buses/chatEventBus.d.ts +1 -0
  97. package/dist/event-buses/index.d.ts +1 -0
  98. package/dist/favicon.ico +0 -0
  99. package/dist/flowDiagram-NV44I4VS-D3GMS8-G.mjs +4132 -0
  100. package/dist/ganttDiagram-LVOFAZNH-DMTZVZDR.mjs +2832 -0
  101. package/dist/gitGraph-F6HP7TQM-CrdUzURw.mjs +10 -0
  102. package/dist/gitGraphDiagram-NY62KEGX-DipP5Fgt.mjs +636 -0
  103. package/dist/graphlib-D9eH5icd.mjs +224 -0
  104. package/dist/index.d.ts +2 -0
  105. package/dist/info-NVLQJR56-C-93Yf3U.mjs +10 -0
  106. package/dist/infoDiagram-F6ZHWCRC-jM50s26K.mjs +33 -0
  107. package/dist/init-CYeu4QfE.mjs +14 -0
  108. package/dist/isArrayLikeObject-BPcFdnyK.mjs +459 -0
  109. package/dist/isUndefined-BvarJ1wS.mjs +374 -0
  110. package/dist/journeyDiagram-XKPGCS4Q-BEEO_0Bh.mjs +885 -0
  111. package/dist/kanban-definition-3W4ZIXB7-B8u_HDmL.mjs +971 -0
  112. package/dist/katex-Dc1vXbUC.mjs +22094 -0
  113. package/dist/line-BJxACIPZ.mjs +31 -0
  114. package/dist/linear-DHHVI-cj.mjs +251 -0
  115. package/dist/math-Byg0NvhS.mjs +9 -0
  116. package/dist/mermaid-parser.core-YT4qvimq.mjs +49 -0
  117. package/dist/mindmap-definition-VGOIOE7T-ah41V88S.mjs +960 -0
  118. package/dist/now-DsJMgI1z.mjs +6 -0
  119. package/dist/ordinal-L0-EVPg8.mjs +62 -0
  120. package/dist/packet-BFZMPI3H-Cs4kRHct.mjs +10 -0
  121. package/dist/path-BcDHwjEr.mjs +80 -0
  122. package/dist/pie-7BOR55EZ-YZ5Xu4o6.mjs +10 -0
  123. package/dist/pieDiagram-ADFJNKIX-CqI33m1a.mjs +174 -0
  124. package/dist/plugins/chat.d.ts +3 -0
  125. package/dist/plugins/index.d.ts +1 -0
  126. package/dist/quadrantDiagram-AYHSOK5B-DDv2X9c1.mjs +1971 -0
  127. package/dist/radar-NHE76QYJ-TpirOFtv.mjs +10 -0
  128. package/dist/requirementDiagram-UZGBJVZJ-DXa77VzO.mjs +2194 -0
  129. package/dist/sankeyDiagram-TZEHDZUN--B9DInJC.mjs +885 -0
  130. package/dist/sequenceDiagram-WL72ISMW-Dqn9jJ3g.mjs +3562 -0
  131. package/dist/src-DdwtiGjk.mjs +1976 -0
  132. package/dist/stateDiagram-FKZM4ZOC-D3eEcVjS.mjs +226 -0
  133. package/dist/stateDiagram-v2-4FDKWEC3-dzwJ4caL.mjs +32 -0
  134. package/dist/style.css +3 -0
  135. package/dist/timeline-definition-IT6M3QCI-z93ry7RN.mjs +831 -0
  136. package/dist/toInteger-1S_4Byef.mjs +36 -0
  137. package/dist/treemap-KMMF4GRG-BlF0Ev1z.mjs +10 -0
  138. package/dist/types/chat.d.ts +13 -0
  139. package/dist/types/index.d.ts +5 -0
  140. package/dist/types/messages.d.ts +17 -0
  141. package/dist/types/options.d.ts +33 -0
  142. package/dist/types/streaming.d.ts +18 -0
  143. package/dist/types/webhook.d.ts +19 -0
  144. package/dist/utils/event-bus.d.ts +8 -0
  145. package/dist/utils/index.d.ts +3 -0
  146. package/dist/utils/mount.d.ts +1 -0
  147. package/dist/utils/streaming.d.ts +26 -0
  148. package/dist/utils/streamingHandlers.d.ts +6 -0
  149. package/dist/utils/utils.d.ts +1 -0
  150. package/dist/xychartDiagram-PRI3JC2R-C3aDcgBz.mjs +2022 -0
  151. package/package.json +78 -0
@@ -0,0 +1,6 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import { G as _root_default } from "./isArrayLikeObject-BPcFdnyK.mjs";
3
+ var now_default = function() {
4
+ return _root_default.Date.now();
5
+ };
6
+ export { now_default as t };
@@ -0,0 +1,62 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import { t as initRange } from "./init-CYeu4QfE.mjs";
3
+ var InternMap = class extends Map {
4
+ constructor(e, r = keyof) {
5
+ if (super(), Object.defineProperties(this, {
6
+ _intern: { value: /* @__PURE__ */ new Map() },
7
+ _key: { value: r }
8
+ }), e != null) for (let [r, i] of e) this.set(r, i);
9
+ }
10
+ get(e) {
11
+ return super.get(intern_get(this, e));
12
+ }
13
+ has(e) {
14
+ return super.has(intern_get(this, e));
15
+ }
16
+ set(e, r) {
17
+ return super.set(intern_set(this, e), r);
18
+ }
19
+ delete(e) {
20
+ return super.delete(intern_delete(this, e));
21
+ }
22
+ };
23
+ function intern_get({ _intern: e, _key: r }, i) {
24
+ let a = r(i);
25
+ return e.has(a) ? e.get(a) : i;
26
+ }
27
+ function intern_set({ _intern: e, _key: r }, i) {
28
+ let a = r(i);
29
+ return e.has(a) ? e.get(a) : (e.set(a, i), i);
30
+ }
31
+ function intern_delete({ _intern: e, _key: r }, i) {
32
+ let a = r(i);
33
+ return e.has(a) && (i = e.get(a), e.delete(a)), i;
34
+ }
35
+ function keyof(e) {
36
+ return typeof e == "object" && e ? e.valueOf() : e;
37
+ }
38
+ const implicit = Symbol("implicit");
39
+ function ordinal() {
40
+ var i = new InternMap(), a = [], o = [], s = implicit;
41
+ function c(e) {
42
+ let r = i.get(e);
43
+ if (r === void 0) {
44
+ if (s !== implicit) return s;
45
+ i.set(e, r = a.push(e) - 1);
46
+ }
47
+ return o[r % o.length];
48
+ }
49
+ return c.domain = function(e) {
50
+ if (!arguments.length) return a.slice();
51
+ a = [], i = new InternMap();
52
+ for (let r of e) i.has(r) || i.set(r, a.push(r) - 1);
53
+ return c;
54
+ }, c.range = function(e) {
55
+ return arguments.length ? (o = Array.from(e), c) : o.slice();
56
+ }, c.unknown = function(e) {
57
+ return arguments.length ? (s = e, c) : s;
58
+ }, c.copy = function() {
59
+ return ordinal(a, o).unknown(s);
60
+ }, initRange.apply(c, arguments), c;
61
+ }
62
+ export { ordinal as t };
@@ -0,0 +1,10 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import "./isArrayLikeObject-BPcFdnyK.mjs";
3
+ import "./isUndefined-BvarJ1wS.mjs";
4
+ import "./toInteger-1S_4Byef.mjs";
5
+ import "./_baseUniq-Agc10qFQ.mjs";
6
+ import "./chunk-FPAJGGOC-HRc6DGju.mjs";
7
+ import "./_basePickBy-aQilsjEs.mjs";
8
+ import "./clone-nkGlb0Gn.mjs";
9
+ import { n as createPacketServices, t as PacketModule } from "./chunk-76Q3JFCE-D7DMbWeQ.mjs";
10
+ export { PacketModule, createPacketServices };
@@ -0,0 +1,80 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ var pi = Math.PI, tau = 2 * pi, epsilon = 1e-6, tauEpsilon = tau - epsilon;
3
+ function append(e) {
4
+ this._ += e[0];
5
+ for (let t = 1, n = e.length; t < n; ++t) this._ += arguments[t] + e[t];
6
+ }
7
+ function appendRound(e) {
8
+ let t = Math.floor(e);
9
+ if (!(t >= 0)) throw Error(`invalid digits: ${e}`);
10
+ if (t > 15) return append;
11
+ let n = 10 ** t;
12
+ return function(e) {
13
+ this._ += e[0];
14
+ for (let t = 1, r = e.length; t < r; ++t) this._ += Math.round(arguments[t] * n) / n + e[t];
15
+ };
16
+ }
17
+ var Path = class {
18
+ constructor(e) {
19
+ this._x0 = this._y0 = this._x1 = this._y1 = null, this._ = "", this._append = e == null ? append : appendRound(e);
20
+ }
21
+ moveTo(e, t) {
22
+ this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}`;
23
+ }
24
+ closePath() {
25
+ this._x1 !== null && (this._x1 = this._x0, this._y1 = this._y0, this._append`Z`);
26
+ }
27
+ lineTo(e, t) {
28
+ this._append`L${this._x1 = +e},${this._y1 = +t}`;
29
+ }
30
+ quadraticCurveTo(e, t, n, r) {
31
+ this._append`Q${+e},${+t},${this._x1 = +n},${this._y1 = +r}`;
32
+ }
33
+ bezierCurveTo(e, t, n, r, i, a) {
34
+ this._append`C${+e},${+t},${+n},${+r},${this._x1 = +i},${this._y1 = +a}`;
35
+ }
36
+ arcTo(t, r, i, a, o) {
37
+ if (t = +t, r = +r, i = +i, a = +a, o = +o, o < 0) throw Error(`negative radius: ${o}`);
38
+ let s = this._x1, c = this._y1, l = i - t, u = a - r, d = s - t, f = c - r, p = d * d + f * f;
39
+ if (this._x1 === null) this._append`M${this._x1 = t},${this._y1 = r}`;
40
+ else if (p > epsilon) if (!(Math.abs(f * l - u * d) > epsilon) || !o) this._append`L${this._x1 = t},${this._y1 = r}`;
41
+ else {
42
+ let m = i - s, h = a - c, g = l * l + u * u, _ = m * m + h * h, v = Math.sqrt(g), y = Math.sqrt(p), b = o * Math.tan((pi - Math.acos((g + p - _) / (2 * v * y))) / 2), x = b / y, S = b / v;
43
+ Math.abs(x - 1) > epsilon && this._append`L${t + x * d},${r + x * f}`, this._append`A${o},${o},0,0,${+(f * m > d * h)},${this._x1 = t + S * l},${this._y1 = r + S * u}`;
44
+ }
45
+ }
46
+ arc(i, a, o, s, c, l) {
47
+ if (i = +i, a = +a, o = +o, l = !!l, o < 0) throw Error(`negative radius: ${o}`);
48
+ let u = o * Math.cos(s), d = o * Math.sin(s), f = i + u, p = a + d, m = 1 ^ l, h = l ? s - c : c - s;
49
+ this._x1 === null ? this._append`M${f},${p}` : (Math.abs(this._x1 - f) > epsilon || Math.abs(this._y1 - p) > epsilon) && this._append`L${f},${p}`, o && (h < 0 && (h = h % tau + tau), h > tauEpsilon ? this._append`A${o},${o},0,1,${m},${i - u},${a - d}A${o},${o},0,1,${m},${this._x1 = f},${this._y1 = p}` : h > epsilon && this._append`A${o},${o},0,${+(h >= pi)},${m},${this._x1 = i + o * Math.cos(c)},${this._y1 = a + o * Math.sin(c)}`);
50
+ }
51
+ rect(e, t, n, r) {
52
+ this._append`M${this._x0 = this._x1 = +e},${this._y0 = this._y1 = +t}h${n = +n}v${+r}h${-n}Z`;
53
+ }
54
+ toString() {
55
+ return this._;
56
+ }
57
+ };
58
+ function path() {
59
+ return new Path();
60
+ }
61
+ path.prototype = Path.prototype;
62
+ function constant_default(e) {
63
+ return function() {
64
+ return e;
65
+ };
66
+ }
67
+ function withPath(e) {
68
+ let t = 3;
69
+ return e.digits = function(n) {
70
+ if (!arguments.length) return t;
71
+ if (n == null) t = null;
72
+ else {
73
+ let e = Math.floor(n);
74
+ if (!(e >= 0)) throw RangeError(`invalid digits: ${n}`);
75
+ t = e;
76
+ }
77
+ return e;
78
+ }, () => new Path(t);
79
+ }
80
+ export { constant_default as n, withPath as t };
@@ -0,0 +1,10 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import "./isArrayLikeObject-BPcFdnyK.mjs";
3
+ import "./isUndefined-BvarJ1wS.mjs";
4
+ import "./toInteger-1S_4Byef.mjs";
5
+ import "./_baseUniq-Agc10qFQ.mjs";
6
+ import "./chunk-FPAJGGOC-HRc6DGju.mjs";
7
+ import "./_basePickBy-aQilsjEs.mjs";
8
+ import "./clone-nkGlb0Gn.mjs";
9
+ import { n as createPieServices, t as PieModule } from "./chunk-T53DSG4Q-XzY06amw.mjs";
10
+ export { PieModule, createPieServices };
@@ -0,0 +1,174 @@
1
+ /*! Package version @n8n/chat@0.62.0 */
2
+ import "./isArrayLikeObject-BPcFdnyK.mjs";
3
+ import "./isUndefined-BvarJ1wS.mjs";
4
+ import "./toInteger-1S_4Byef.mjs";
5
+ import "./_baseUniq-Agc10qFQ.mjs";
6
+ import "./chunk-FPAJGGOC-HRc6DGju.mjs";
7
+ import "./_basePickBy-aQilsjEs.mjs";
8
+ import { i as cleanAndMerge, p as parseFontSize } from "./chunk-S3R3BYOJ-BhFsv0Go.mjs";
9
+ import "./clone-nkGlb0Gn.mjs";
10
+ import { g as log, h as __name } from "./src-DdwtiGjk.mjs";
11
+ import { B as setAccTitle, C as getDiagramTitle, U as setDiagramTitle, _ as getAccDescription, a as clear, b as getConfig2, c as configureSvgSize, d as defaultConfig_default, v as getAccTitle, z as setAccDescription } from "./chunk-ABZYJK2D-_NXv778f.mjs";
12
+ import { t as ordinal } from "./ordinal-L0-EVPg8.mjs";
13
+ import { n as constant_default } from "./path-BcDHwjEr.mjs";
14
+ import "./init-CYeu4QfE.mjs";
15
+ import { p as tau } from "./math-Byg0NvhS.mjs";
16
+ import { t as arc_default } from "./arc-EhYU_DB1.mjs";
17
+ import { t as array_default } from "./array-B5w981Vk.mjs";
18
+ import { t as selectSvgElement } from "./chunk-EXTU4WIE-DWzncOZf.mjs";
19
+ import "./dist-BT0fjU7K.mjs";
20
+ import "./chunk-O7ZBX7Z2-DmJUfqJj.mjs";
21
+ import "./chunk-S6J4BHB3-BvrWTdbl.mjs";
22
+ import "./chunk-LBM3YZW2-JIQK8wiH.mjs";
23
+ import "./chunk-76Q3JFCE-D7DMbWeQ.mjs";
24
+ import "./chunk-T53DSG4Q-XzY06amw.mjs";
25
+ import "./chunk-LHMN2FUI-PNCyIUgu.mjs";
26
+ import "./chunk-FWNWRKHM-CGiJVNMo.mjs";
27
+ import { t as populateCommonDb } from "./chunk-4BX2VUAB-dn0RXIrC.mjs";
28
+ import { t as parse } from "./mermaid-parser.core-YT4qvimq.mjs";
29
+ function descending_default(e, o) {
30
+ return o < e ? -1 : o > e ? 1 : o >= e ? 0 : NaN;
31
+ }
32
+ function identity_default(e) {
33
+ return e;
34
+ }
35
+ function pie_default() {
36
+ var e = identity_default, o = descending_default, s = null, c = constant_default(0), l = constant_default(tau), u = constant_default(0);
37
+ function d(d) {
38
+ var f, p = (d = array_default(d)).length, m, h, g = 0, _ = Array(p), v = Array(p), y = +c.apply(this, arguments), b = Math.min(tau, Math.max(-tau, l.apply(this, arguments) - y)), S, w = Math.min(Math.abs(b) / p, u.apply(this, arguments)), T = w * (b < 0 ? -1 : 1), E;
39
+ for (f = 0; f < p; ++f) (E = v[_[f] = f] = +e(d[f], f, d)) > 0 && (g += E);
40
+ for (o == null ? s != null && _.sort(function(e, o) {
41
+ return s(d[e], d[o]);
42
+ }) : _.sort(function(e, s) {
43
+ return o(v[e], v[s]);
44
+ }), f = 0, h = g ? (b - p * T) / g : 0; f < p; ++f, y = S) m = _[f], E = v[m], S = y + (E > 0 ? E * h : 0) + T, v[m] = {
45
+ data: d[m],
46
+ index: f,
47
+ value: E,
48
+ startAngle: y,
49
+ endAngle: S,
50
+ padAngle: w
51
+ };
52
+ return v;
53
+ }
54
+ return d.value = function(o) {
55
+ return arguments.length ? (e = typeof o == "function" ? o : constant_default(+o), d) : e;
56
+ }, d.sortValues = function(e) {
57
+ return arguments.length ? (o = e, s = null, d) : o;
58
+ }, d.sort = function(e) {
59
+ return arguments.length ? (s = e, o = null, d) : s;
60
+ }, d.startAngle = function(e) {
61
+ return arguments.length ? (c = typeof e == "function" ? e : constant_default(+e), d) : c;
62
+ }, d.endAngle = function(e) {
63
+ return arguments.length ? (l = typeof e == "function" ? e : constant_default(+e), d) : l;
64
+ }, d.padAngle = function(e) {
65
+ return arguments.length ? (u = typeof e == "function" ? e : constant_default(+e), d) : u;
66
+ }, d;
67
+ }
68
+ var DEFAULT_PIE_CONFIG = defaultConfig_default.pie, DEFAULT_PIE_DB = {
69
+ sections: /* @__PURE__ */ new Map(),
70
+ showData: !1,
71
+ config: DEFAULT_PIE_CONFIG
72
+ }, sections = DEFAULT_PIE_DB.sections, showData = DEFAULT_PIE_DB.showData, config = structuredClone(DEFAULT_PIE_CONFIG), db = {
73
+ getConfig: /* @__PURE__ */ __name(() => structuredClone(config), "getConfig"),
74
+ clear: /* @__PURE__ */ __name(() => {
75
+ sections = /* @__PURE__ */ new Map(), showData = DEFAULT_PIE_DB.showData, clear();
76
+ }, "clear"),
77
+ setDiagramTitle,
78
+ getDiagramTitle,
79
+ setAccTitle,
80
+ getAccTitle,
81
+ setAccDescription,
82
+ getAccDescription,
83
+ addSection: /* @__PURE__ */ __name(({ label: e, value: o }) => {
84
+ if (o < 0) throw Error(`"${e}" has invalid value: ${o}. Negative values are not allowed in pie charts. All slice values must be >= 0.`);
85
+ sections.has(e) || (sections.set(e, o), log.debug(`added new section: ${e}, with value: ${o}`));
86
+ }, "addSection"),
87
+ getSections: /* @__PURE__ */ __name(() => sections, "getSections"),
88
+ setShowData: /* @__PURE__ */ __name((e) => {
89
+ showData = e;
90
+ }, "setShowData"),
91
+ getShowData: /* @__PURE__ */ __name(() => showData, "getShowData")
92
+ }, populateDb = /* @__PURE__ */ __name((e, o) => {
93
+ populateCommonDb(e, o), o.setShowData(e.showData), e.sections.map(o.addSection);
94
+ }, "populateDb"), parser = { parse: /* @__PURE__ */ __name(async (e) => {
95
+ let o = await parse("pie", e);
96
+ log.debug(o), populateDb(o, db);
97
+ }, "parse") }, pieStyles_default = /* @__PURE__ */ __name((e) => `
98
+ .pieCircle{
99
+ stroke: ${e.pieStrokeColor};
100
+ stroke-width : ${e.pieStrokeWidth};
101
+ opacity : ${e.pieOpacity};
102
+ }
103
+ .pieOuterCircle{
104
+ stroke: ${e.pieOuterStrokeColor};
105
+ stroke-width: ${e.pieOuterStrokeWidth};
106
+ fill: none;
107
+ }
108
+ .pieTitleText {
109
+ text-anchor: middle;
110
+ font-size: ${e.pieTitleTextSize};
111
+ fill: ${e.pieTitleTextColor};
112
+ font-family: ${e.fontFamily};
113
+ }
114
+ .slice {
115
+ font-family: ${e.fontFamily};
116
+ fill: ${e.pieSectionTextColor};
117
+ font-size:${e.pieSectionTextSize};
118
+ // fill: white;
119
+ }
120
+ .legend text {
121
+ fill: ${e.pieLegendTextColor};
122
+ font-family: ${e.fontFamily};
123
+ font-size: ${e.pieLegendTextSize};
124
+ }
125
+ `, "getStyles"), createPieArcs = /* @__PURE__ */ __name((e) => {
126
+ let o = [...e.values()].reduce((e, o) => e + o, 0), s = [...e.entries()].map(([e, o]) => ({
127
+ label: e,
128
+ value: o
129
+ })).filter((e) => e.value / o * 100 >= 1).sort((e, o) => o.value - e.value);
130
+ return pie_default().value((e) => e.value)(s);
131
+ }, "createPieArcs"), diagram = {
132
+ parser,
133
+ db,
134
+ renderer: { draw: /* @__PURE__ */ __name((c, l, u, d) => {
135
+ log.debug("rendering pie chart\n" + c);
136
+ let f = d.db, p = getConfig2(), g = cleanAndMerge(f.getConfig(), p.pie), _ = selectSvgElement(l), v = _.append("g");
137
+ v.attr("transform", "translate(225,225)");
138
+ let { themeVariables: b } = p, [x] = parseFontSize(b.pieOuterStrokeWidth);
139
+ x ??= 2;
140
+ let C = g.textPosition, T = arc_default().innerRadius(0).outerRadius(185), E = arc_default().innerRadius(185 * C).outerRadius(185 * C);
141
+ v.append("circle").attr("cx", 0).attr("cy", 0).attr("r", 185 + x / 2).attr("class", "pieOuterCircle");
142
+ let D = f.getSections(), O = createPieArcs(D), k = [
143
+ b.pie1,
144
+ b.pie2,
145
+ b.pie3,
146
+ b.pie4,
147
+ b.pie5,
148
+ b.pie6,
149
+ b.pie7,
150
+ b.pie8,
151
+ b.pie9,
152
+ b.pie10,
153
+ b.pie11,
154
+ b.pie12
155
+ ], A = 0;
156
+ D.forEach((e) => {
157
+ A += e;
158
+ });
159
+ let j = O.filter((e) => (e.data.value / A * 100).toFixed(0) !== "0"), M = ordinal(k);
160
+ v.selectAll("mySlices").data(j).enter().append("path").attr("d", T).attr("fill", (e) => M(e.data.label)).attr("class", "pieCircle"), v.selectAll("mySlices").data(j).enter().append("text").text((e) => (e.data.value / A * 100).toFixed(0) + "%").attr("transform", (e) => "translate(" + E.centroid(e) + ")").style("text-anchor", "middle").attr("class", "slice"), v.append("text").text(f.getDiagramTitle()).attr("x", 0).attr("y", -400 / 2).attr("class", "pieTitleText");
161
+ let N = [...D.entries()].map(([e, o]) => ({
162
+ label: e,
163
+ value: o
164
+ })), P = v.selectAll(".legend").data(N).enter().append("g").attr("class", "legend").attr("transform", (e, o) => {
165
+ let s = 22 * N.length / 2;
166
+ return "translate(216," + (o * 22 - s) + ")";
167
+ });
168
+ P.append("rect").attr("width", 18).attr("height", 18).style("fill", (e) => M(e.label)).style("stroke", (e) => M(e.label)), P.append("text").attr("x", 22).attr("y", 14).text((e) => f.getShowData() ? `${e.label} [${e.value}]` : e.label);
169
+ let F = 512 + Math.max(...P.selectAll("text").nodes().map((e) => e?.getBoundingClientRect().width ?? 0));
170
+ _.attr("viewBox", `0 0 ${F} 450`), configureSvgSize(_, 450, F, g.useMaxWidth);
171
+ }, "draw") },
172
+ styles: pieStyles_default
173
+ };
174
+ export { diagram };
@@ -0,0 +1,3 @@
1
+ import { Plugin } from 'vue';
2
+ import { ChatOptions } from '../types';
3
+ export declare const ChatPlugin: Plugin<ChatOptions>;
@@ -0,0 +1 @@
1
+ export * from './chat';