@copilotkit/react-ui 0.20.0 → 0.21.0-mme-fix-esm-error.1

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 (78) hide show
  1. package/.turbo/turbo-build.log +60 -60
  2. package/CHANGELOG.md +36 -0
  3. package/dist/{chunk-EIB4TGCW.mjs → chunk-3SXQEFGW.mjs} +3 -3
  4. package/dist/{chunk-NFMERKCE.mjs → chunk-7JYUCW7H.mjs} +2 -2
  5. package/dist/{chunk-N37JEHLI.mjs → chunk-7LMXXGJT.mjs} +8 -4
  6. package/dist/chunk-7LMXXGJT.mjs.map +1 -0
  7. package/dist/{chunk-BPT5B4JN.mjs → chunk-7UK4MYTF.mjs} +4 -7
  8. package/dist/{chunk-BPT5B4JN.mjs.map → chunk-7UK4MYTF.mjs.map} +1 -1
  9. package/dist/{chunk-EAKWARPJ.mjs → chunk-BJ75DW3Z.mjs} +30 -26
  10. package/dist/{chunk-EAKWARPJ.mjs.map → chunk-BJ75DW3Z.mjs.map} +1 -1
  11. package/dist/{chunk-WBXU5YXF.mjs → chunk-KE3N45ZY.mjs} +2 -2
  12. package/dist/{chunk-2JGAK63B.mjs → chunk-OTE2PMAQ.mjs} +3 -3
  13. package/dist/chunk-OTE2PMAQ.mjs.map +1 -0
  14. package/dist/{chunk-Q3WQ546F.mjs → chunk-PGPR52GM.mjs} +16 -3
  15. package/dist/chunk-PGPR52GM.mjs.map +1 -0
  16. package/dist/chunk-UGQQ4WEQ.mjs +1 -0
  17. package/dist/{chunk-OAIXDKPE.mjs → chunk-YEHO5VMA.mjs} +2 -2
  18. package/dist/{chunk-EZ3QSEI2.mjs → chunk-YTIGBBTC.mjs} +2 -2
  19. package/dist/components/chat/Button.js.map +1 -1
  20. package/dist/components/chat/Button.mjs +2 -2
  21. package/dist/components/chat/Chat.d.ts +5 -1
  22. package/dist/components/chat/Chat.js +45 -24
  23. package/dist/components/chat/Chat.js.map +1 -1
  24. package/dist/components/chat/Chat.mjs +8 -8
  25. package/dist/components/chat/ChatContext.d.ts +5 -1
  26. package/dist/components/chat/ChatContext.js +7 -3
  27. package/dist/components/chat/ChatContext.js.map +1 -1
  28. package/dist/components/chat/ChatContext.mjs +1 -1
  29. package/dist/components/chat/Header.js.map +1 -1
  30. package/dist/components/chat/Header.mjs +2 -2
  31. package/dist/components/chat/Input.js.map +1 -1
  32. package/dist/components/chat/Input.mjs +2 -2
  33. package/dist/components/chat/Markdown.js +15 -2
  34. package/dist/components/chat/Markdown.js.map +1 -1
  35. package/dist/components/chat/Markdown.mjs +1 -1
  36. package/dist/components/chat/Messages.js +15 -2
  37. package/dist/components/chat/Messages.js.map +1 -1
  38. package/dist/components/chat/Messages.mjs +3 -3
  39. package/dist/components/chat/Popup.js +46 -25
  40. package/dist/components/chat/Popup.js.map +1 -1
  41. package/dist/components/chat/Popup.mjs +9 -9
  42. package/dist/components/chat/Response.js.map +1 -1
  43. package/dist/components/chat/Response.mjs +2 -2
  44. package/dist/components/chat/Sidebar.js +46 -28
  45. package/dist/components/chat/Sidebar.js.map +1 -1
  46. package/dist/components/chat/Sidebar.mjs +9 -9
  47. package/dist/components/chat/index.d.ts +1 -1
  48. package/dist/components/chat/index.js +51 -31
  49. package/dist/components/chat/index.js.map +1 -1
  50. package/dist/components/chat/index.mjs +15 -12
  51. package/dist/components/index.d.ts +1 -1
  52. package/dist/components/index.js +51 -31
  53. package/dist/components/index.js.map +1 -1
  54. package/dist/components/index.mjs +15 -12
  55. package/dist/index.css +4 -0
  56. package/dist/index.css.map +1 -1
  57. package/dist/index.d.ts +1 -1
  58. package/dist/index.js +51 -31
  59. package/dist/index.js.map +1 -1
  60. package/dist/index.mjs +15 -12
  61. package/package.json +7 -7
  62. package/src/components/chat/Chat.tsx +8 -1
  63. package/src/components/chat/ChatContext.tsx +9 -1
  64. package/src/components/chat/Markdown.tsx +12 -0
  65. package/src/components/chat/Popup.tsx +5 -1
  66. package/src/components/chat/Sidebar.tsx +3 -2
  67. package/src/components/chat/index.tsx +1 -0
  68. package/src/css/messages.css +1 -0
  69. package/dist/chunk-2JGAK63B.mjs.map +0 -1
  70. package/dist/chunk-N37JEHLI.mjs.map +0 -1
  71. package/dist/chunk-P4GBO6MW.mjs +0 -1
  72. package/dist/chunk-Q3WQ546F.mjs.map +0 -1
  73. /package/dist/{chunk-EIB4TGCW.mjs.map → chunk-3SXQEFGW.mjs.map} +0 -0
  74. /package/dist/{chunk-NFMERKCE.mjs.map → chunk-7JYUCW7H.mjs.map} +0 -0
  75. /package/dist/{chunk-WBXU5YXF.mjs.map → chunk-KE3N45ZY.mjs.map} +0 -0
  76. /package/dist/{chunk-P4GBO6MW.mjs.map → chunk-UGQQ4WEQ.mjs.map} +0 -0
  77. /package/dist/{chunk-OAIXDKPE.mjs.map → chunk-YEHO5VMA.mjs.map} +0 -0
  78. /package/dist/{chunk-EZ3QSEI2.mjs.map → chunk-YTIGBBTC.mjs.map} +0 -0
@@ -1,5 +1,5 @@
1
1
 
2
- > @copilotkit/react-ui@0.20.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-ui
2
+ > @copilotkit/react-ui@0.21.0-mme-fix-esm-error.1 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/react-ui
3
3
  > tsup --clean
4
4
 
5
5
  CLI Building entry: src/index.tsx, src/components/index.ts, src/context/index.ts, src/hooks/index.ts, src/hooks/use-copy-to-clipboard.tsx, src/lib/utils.test.ts, src/lib/utils.ts, src/types/index.ts, src/types/types.ts, src/components/chat/Button.tsx, src/components/chat/Chat.tsx, src/components/chat/ChatContext.tsx, src/components/chat/CodeBlock.tsx, src/components/chat/Header.tsx, src/components/chat/Icons.tsx, src/components/chat/Input.tsx, src/components/chat/Markdown.tsx, src/components/chat/Messages.tsx, src/components/chat/Popup.tsx, src/components/chat/Response.tsx, src/components/chat/Sidebar.tsx, src/components/chat/Textarea.tsx, src/components/chat/Window.tsx, src/components/chat/index.tsx, src/components/chat/props.ts
@@ -14,28 +14,28 @@ Browserslist: caniuse-lite is outdated. Please run:
14
14
  npx update-browserslist-db@latest
15
15
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
16
16
  DTS Build start
17
- ESM dist/index.mjs 825.00 B
18
- ESM dist/components/index.mjs 737.00 B
17
+ ESM dist/index.mjs 869.00 B
18
+ ESM dist/components/index.mjs 781.00 B
19
19
  ESM dist/context/index.mjs 66.00 B
20
20
  ESM dist/hooks/index.mjs 66.00 B
21
21
  ESM dist/lib/utils.test.mjs 168.00 B
22
22
  ESM dist/types/index.mjs 66.00 B
23
23
  ESM dist/chunk-JD7BAH7U.mjs 43.00 B
24
- ESM dist/chunk-P4GBO6MW.mjs 43.00 B
24
+ ESM dist/chunk-UGQQ4WEQ.mjs 43.00 B
25
25
  ESM dist/chunk-WB3YULQ4.mjs 43.00 B
26
- ESM dist/chunk-2JGAK63B.mjs 528.00 B
27
- ESM dist/chunk-BPT5B4JN.mjs 1.01 KB
28
- ESM dist/chunk-EAKWARPJ.mjs 2.64 KB
29
- ESM dist/chunk-EIB4TGCW.mjs 4.94 KB
30
- ESM dist/chunk-Q3WQ546F.mjs 1.84 KB
31
- ESM dist/chunk-OAIXDKPE.mjs 613.00 B
26
+ ESM dist/chunk-OTE2PMAQ.mjs 573.00 B
27
+ ESM dist/chunk-7UK4MYTF.mjs 1.02 KB
28
+ ESM dist/chunk-BJ75DW3Z.mjs 2.75 KB
29
+ ESM dist/chunk-3SXQEFGW.mjs 4.94 KB
30
+ ESM dist/chunk-PGPR52GM.mjs 2.17 KB
31
+ ESM dist/chunk-YEHO5VMA.mjs 613.00 B
32
32
  ESM dist/chunk-B7DNOYVQ.mjs 3.80 KB
33
- ESM dist/chunk-EZ3QSEI2.mjs 825.00 B
33
+ ESM dist/chunk-YTIGBBTC.mjs 825.00 B
34
34
  ESM dist/chunk-ZRJSYYXC.mjs 3.55 KB
35
- ESM dist/chunk-NFMERKCE.mjs 566.00 B
36
- ESM dist/chunk-WBXU5YXF.mjs 1.79 KB
35
+ ESM dist/chunk-7JYUCW7H.mjs 566.00 B
36
+ ESM dist/chunk-KE3N45ZY.mjs 1.79 KB
37
37
  ESM dist/chunk-WM6BS77F.mjs 1.54 KB
38
- ESM dist/chunk-N37JEHLI.mjs 1.70 KB
38
+ ESM dist/chunk-7LMXXGJT.mjs 1.76 KB
39
39
  ESM dist/chunk-7YXG7D47.mjs 6.52 KB
40
40
  ESM dist/chunk-IU3WTXLQ.mjs 43.00 B
41
41
  ESM dist/chunk-H4VKQGVU.mjs 43.00 B
@@ -44,7 +44,7 @@ Browserslist: caniuse-lite is outdated. Please run:
44
44
  ESM dist/lib/utils.mjs 885.00 B
45
45
  ESM dist/chunk-MRXNTQOX.mjs 1.89 KB
46
46
  ESM dist/chunk-7NSRDJ5C.mjs 43.00 B
47
- ESM dist/index.css 19.82 KB
47
+ ESM dist/index.css 19.90 KB
48
48
  ESM dist/components/chat/props.mjs 69.00 B
49
49
  ESM dist/components/chat/Markdown.mjs 255.00 B
50
50
  ESM dist/components/chat/Messages.mjs 325.00 B
@@ -53,7 +53,7 @@ Browserslist: caniuse-lite is outdated. Please run:
53
53
  ESM dist/components/chat/Sidebar.mjs 616.00 B
54
54
  ESM dist/components/chat/Textarea.mjs 177.00 B
55
55
  ESM dist/components/chat/Window.mjs 144.00 B
56
- ESM dist/components/chat/index.mjs 759.00 B
56
+ ESM dist/components/chat/index.mjs 803.00 B
57
57
  ESM dist/types/types.mjs 34.00 B
58
58
  ESM dist/components/chat/Button.mjs 214.00 B
59
59
  ESM dist/components/chat/Chat.mjs 572.00 B
@@ -69,21 +69,21 @@ Browserslist: caniuse-lite is outdated. Please run:
69
69
  ESM dist/lib/utils.test.mjs.map 350.00 B
70
70
  ESM dist/types/index.mjs.map 71.00 B
71
71
  ESM dist/chunk-JD7BAH7U.mjs.map 71.00 B
72
- ESM dist/chunk-P4GBO6MW.mjs.map 71.00 B
72
+ ESM dist/chunk-UGQQ4WEQ.mjs.map 71.00 B
73
73
  ESM dist/chunk-WB3YULQ4.mjs.map 71.00 B
74
- ESM dist/chunk-2JGAK63B.mjs.map 549.00 B
75
- ESM dist/chunk-BPT5B4JN.mjs.map 1.36 KB
76
- ESM dist/chunk-EAKWARPJ.mjs.map 7.07 KB
77
- ESM dist/chunk-EIB4TGCW.mjs.map 8.79 KB
78
- ESM dist/chunk-Q3WQ546F.mjs.map 2.76 KB
79
- ESM dist/chunk-OAIXDKPE.mjs.map 854.00 B
74
+ ESM dist/chunk-OTE2PMAQ.mjs.map 687.00 B
75
+ ESM dist/chunk-7UK4MYTF.mjs.map 1.36 KB
76
+ ESM dist/chunk-BJ75DW3Z.mjs.map 7.26 KB
77
+ ESM dist/chunk-3SXQEFGW.mjs.map 8.79 KB
78
+ ESM dist/chunk-PGPR52GM.mjs.map 3.22 KB
79
+ ESM dist/chunk-YEHO5VMA.mjs.map 854.00 B
80
80
  ESM dist/chunk-B7DNOYVQ.mjs.map 6.70 KB
81
- ESM dist/chunk-EZ3QSEI2.mjs.map 1.26 KB
81
+ ESM dist/chunk-YTIGBBTC.mjs.map 1.26 KB
82
82
  ESM dist/chunk-ZRJSYYXC.mjs.map 5.65 KB
83
- ESM dist/chunk-NFMERKCE.mjs.map 773.00 B
84
- ESM dist/chunk-WBXU5YXF.mjs.map 2.78 KB
83
+ ESM dist/chunk-7JYUCW7H.mjs.map 773.00 B
84
+ ESM dist/chunk-KE3N45ZY.mjs.map 2.78 KB
85
85
  ESM dist/chunk-WM6BS77F.mjs.map 2.80 KB
86
- ESM dist/chunk-N37JEHLI.mjs.map 4.80 KB
86
+ ESM dist/chunk-7LMXXGJT.mjs.map 5.02 KB
87
87
  ESM dist/chunk-7YXG7D47.mjs.map 8.44 KB
88
88
  ESM dist/chunk-IU3WTXLQ.mjs.map 71.00 B
89
89
  ESM dist/chunk-H4VKQGVU.mjs.map 71.00 B
@@ -92,7 +92,7 @@ Browserslist: caniuse-lite is outdated. Please run:
92
92
  ESM dist/lib/utils.mjs.map 1.49 KB
93
93
  ESM dist/chunk-MRXNTQOX.mjs.map 71.00 B
94
94
  ESM dist/chunk-7NSRDJ5C.mjs.map 71.00 B
95
- ESM dist/index.css.map 30.93 KB
95
+ ESM dist/index.css.map 31.02 KB
96
96
  ESM dist/components/chat/props.mjs.map 71.00 B
97
97
  ESM dist/components/chat/Markdown.mjs.map 71.00 B
98
98
  ESM dist/components/chat/Messages.mjs.map 71.00 B
@@ -110,10 +110,10 @@ Browserslist: caniuse-lite is outdated. Please run:
110
110
  ESM dist/components/chat/Header.mjs.map 71.00 B
111
111
  ESM dist/components/chat/Icons.mjs.map 71.00 B
112
112
  ESM dist/components/chat/Input.mjs.map 71.00 B
113
- ESM ⚡️ Build success in 1666ms
114
- CJS dist/index.js 36.10 KB
115
- CJS dist/index.css 19.82 KB
116
- CJS dist/components/index.js 36.12 KB
113
+ ESM ⚡️ Build success in 1546ms
114
+ CJS dist/index.js 36.74 KB
115
+ CJS dist/index.css 19.90 KB
116
+ CJS dist/components/index.js 36.76 KB
117
117
  CJS dist/context/index.js 803.00 B
118
118
  CJS dist/hooks/index.js 797.00 B
119
119
  CJS dist/hooks/use-copy-to-clipboard.js 2.30 KB
@@ -122,24 +122,24 @@ Browserslist: caniuse-lite is outdated. Please run:
122
122
  CJS dist/types/index.js 797.00 B
123
123
  CJS dist/types/types.js 797.00 B
124
124
  CJS dist/components/chat/Button.js 2.91 KB
125
- CJS dist/components/chat/Chat.js 34.75 KB
126
- CJS dist/components/chat/ChatContext.js 8.98 KB
125
+ CJS dist/components/chat/Chat.js 35.28 KB
126
+ CJS dist/components/chat/ChatContext.js 9.04 KB
127
127
  CJS dist/components/chat/CodeBlock.js 9.19 KB
128
128
  CJS dist/components/chat/Header.js 2.63 KB
129
129
  CJS dist/components/chat/Icons.js 9.51 KB
130
130
  CJS dist/components/chat/Input.js 5.44 KB
131
- CJS dist/components/chat/Markdown.js 11.00 KB
132
- CJS dist/components/chat/Messages.js 16.74 KB
133
- CJS dist/components/chat/Popup.js 35.15 KB
131
+ CJS dist/components/chat/Markdown.js 11.36 KB
132
+ CJS dist/components/chat/Messages.js 17.10 KB
133
+ CJS dist/components/chat/Popup.js 35.72 KB
134
134
  CJS dist/components/chat/Response.js 2.67 KB
135
- CJS dist/components/chat/Sidebar.js 35.70 KB
135
+ CJS dist/components/chat/Sidebar.js 36.25 KB
136
136
  CJS dist/components/chat/Textarea.js 2.51 KB
137
137
  CJS dist/components/chat/Window.js 5.46 KB
138
- CJS dist/components/chat/index.js 36.10 KB
138
+ CJS dist/components/chat/index.js 36.75 KB
139
139
  CJS dist/components/chat/props.js 807.00 B
140
- CJS dist/index.js.map 55.56 KB
141
- CJS dist/index.css.map 30.93 KB
142
- CJS dist/components/index.js.map 55.49 KB
140
+ CJS dist/index.js.map 56.59 KB
141
+ CJS dist/index.css.map 31.02 KB
142
+ CJS dist/components/index.js.map 56.51 KB
143
143
  CJS dist/context/index.js.map 139.00 B
144
144
  CJS dist/hooks/index.js.map 137.00 B
145
145
  CJS dist/hooks/use-copy-to-clipboard.js.map 1.21 KB
@@ -147,31 +147,31 @@ Browserslist: caniuse-lite is outdated. Please run:
147
147
  CJS dist/lib/utils.js.map 1.55 KB
148
148
  CJS dist/types/index.js.map 137.00 B
149
149
  CJS dist/types/types.js.map 478.00 B
150
- CJS dist/components/chat/Button.js.map 5.54 KB
151
- CJS dist/components/chat/Chat.js.map 53.64 KB
152
- CJS dist/components/chat/ChatContext.js.map 12.51 KB
150
+ CJS dist/components/chat/Button.js.map 5.71 KB
151
+ CJS dist/components/chat/Chat.js.map 54.51 KB
152
+ CJS dist/components/chat/ChatContext.js.map 12.73 KB
153
153
  CJS dist/components/chat/CodeBlock.js.map 13.31 KB
154
- CJS dist/components/chat/Header.js.map 5.03 KB
154
+ CJS dist/components/chat/Header.js.map 5.20 KB
155
155
  CJS dist/components/chat/Icons.js.map 8.55 KB
156
- CJS dist/components/chat/Input.js.map 9.84 KB
157
- CJS dist/components/chat/Markdown.js.map 16.09 KB
158
- CJS dist/components/chat/Messages.js.map 29.11 KB
159
- CJS dist/components/chat/Popup.js.map 54.14 KB
160
- CJS dist/components/chat/Response.js.map 5.11 KB
161
- CJS dist/components/chat/Sidebar.js.map 54.96 KB
156
+ CJS dist/components/chat/Input.js.map 10.01 KB
157
+ CJS dist/components/chat/Markdown.js.map 16.55 KB
158
+ CJS dist/components/chat/Messages.js.map 29.75 KB
159
+ CJS dist/components/chat/Popup.js.map 55.15 KB
160
+ CJS dist/components/chat/Response.js.map 5.28 KB
161
+ CJS dist/components/chat/Sidebar.js.map 55.85 KB
162
162
  CJS dist/components/chat/Textarea.js.map 2.83 KB
163
163
  CJS dist/components/chat/Window.js.map 6.76 KB
164
- CJS dist/components/chat/index.js.map 55.63 KB
164
+ CJS dist/components/chat/index.js.map 56.71 KB
165
165
  CJS dist/components/chat/props.js.map 908.00 B
166
- CJS ⚡️ Build success in 1697ms
167
- DTS ⚡️ Build success in 6127ms
168
- DTS dist/index.d.ts 411.00 B
166
+ CJS ⚡️ Build success in 1613ms
167
+ DTS ⚡️ Build success in 5721ms
168
+ DTS dist/index.d.ts 435.00 B
169
169
  DTS dist/components/chat/props.d.ts 819.00 B
170
170
  DTS dist/components/chat/Popup.d.ts 269.00 B
171
171
  DTS dist/components/chat/Sidebar.d.ts 378.00 B
172
- DTS dist/components/chat/Chat.d.ts 3.66 KB
173
- DTS dist/components/chat/ChatContext.d.ts 2.60 KB
174
- DTS dist/components/index.d.ts 356.00 B
172
+ DTS dist/components/chat/ChatContext.d.ts 2.73 KB
173
+ DTS dist/components/chat/Chat.d.ts 3.74 KB
174
+ DTS dist/components/index.d.ts 380.00 B
175
175
  DTS dist/context/index.d.ts 12.00 B
176
176
  DTS dist/hooks/index.d.ts 12.00 B
177
177
  DTS dist/hooks/use-copy-to-clipboard.d.ts 266.00 B
@@ -189,4 +189,4 @@ Browserslist: caniuse-lite is outdated. Please run:
189
189
  DTS dist/components/chat/Response.d.ts 201.00 B
190
190
  DTS dist/components/chat/Textarea.d.ts 490.00 B
191
191
  DTS dist/components/chat/Window.d.ts 223.00 B
192
- DTS dist/components/chat/index.d.ts 331.00 B
192
+ DTS dist/components/chat/index.d.ts 355.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,41 @@
1
1
  # ui
2
2
 
3
+ ## 0.21.0-mme-fix-esm-error.1
4
+
5
+ ### Minor Changes
6
+
7
+ - ESM by default
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @copilotkit/react-core@0.24.0-mme-fix-esm-error.1
13
+ - @copilotkit/shared@0.8.0-mme-fix-esm-error.1
14
+
15
+ ## 0.21.0-mme-fix-esm-error.0
16
+
17
+ ### Minor Changes
18
+
19
+ - Use esm by default
20
+
21
+ ### Patch Changes
22
+
23
+ - Updated dependencies
24
+ - @copilotkit/react-core@0.24.0-mme-fix-esm-error.0
25
+ - @copilotkit/shared@0.8.0-mme-fix-esm-error.0
26
+
27
+ ## 0.21.0-mme-fix-esm-error.0
28
+
29
+ ### Minor Changes
30
+
31
+ - Add distinct exports for cjs and esm
32
+
33
+ ### Patch Changes
34
+
35
+ - Updated dependencies
36
+ - @copilotkit/react-core@0.24.0-mme-fix-esm-error.0
37
+ - @copilotkit/shared@0.8.0-mme-fix-esm-error.0
38
+
3
39
  ## 0.20.0
4
40
 
5
41
  ### Minor Changes
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  Markdown
3
- } from "./chunk-Q3WQ546F.mjs";
3
+ } from "./chunk-PGPR52GM.mjs";
4
4
  import {
5
5
  useChatContext
6
- } from "./chunk-N37JEHLI.mjs";
6
+ } from "./chunk-7LMXXGJT.mjs";
7
7
 
8
8
  // src/components/chat/Messages.tsx
9
9
  import React, { useEffect, useMemo } from "react";
@@ -119,4 +119,4 @@ function makeInitialMessages(initial) {
119
119
  export {
120
120
  Messages
121
121
  };
122
- //# sourceMappingURL=chunk-EIB4TGCW.mjs.map
122
+ //# sourceMappingURL=chunk-3SXQEFGW.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useChatContext
3
- } from "./chunk-N37JEHLI.mjs";
3
+ } from "./chunk-7LMXXGJT.mjs";
4
4
 
5
5
  // src/components/chat/Header.tsx
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -15,4 +15,4 @@ var Header = ({ setOpen }) => {
15
15
  export {
16
16
  Header
17
17
  };
18
- //# sourceMappingURL=chunk-NFMERKCE.mjs.map
18
+ //# sourceMappingURL=chunk-7JYUCW7H.mjs.map
@@ -32,7 +32,9 @@ var ChatContextProvider = ({
32
32
  // maxFeedback,
33
33
  labels,
34
34
  icons,
35
- children
35
+ children,
36
+ open,
37
+ setOpen
36
38
  }) => {
37
39
  const context = useMemo(
38
40
  () => ({
@@ -56,9 +58,11 @@ var ChatContextProvider = ({
56
58
  regenerateIcon: RegenerateIcon
57
59
  }), {
58
60
  icons
59
- })
61
+ }),
62
+ open,
63
+ setOpen
60
64
  }),
61
- [labels, icons]
65
+ [labels, icons, open, setOpen]
62
66
  );
63
67
  return /* @__PURE__ */ jsx(ChatContext.Provider, { value: context, children });
64
68
  };
@@ -68,4 +72,4 @@ export {
68
72
  useChatContext,
69
73
  ChatContextProvider
70
74
  };
71
- //# sourceMappingURL=chunk-N37JEHLI.mjs.map
75
+ //# sourceMappingURL=chunk-7LMXXGJT.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/ChatContext.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport * as DefaultIcons from \"./Icons\";\n\n/**\n * Icons for CopilotChat component.\n */\nexport interface CopilotChatIcons {\n /**\n * The icon to use for the open chat button.\n * @default <OpenIcon />\n */\n openIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button.\n * @default <CloseIcon />\n */\n closeIcon?: React.ReactNode;\n\n /**\n * The icon to use for the close chat button in the header.\n * @default <HeaderCloseIcon />\n */\n headerCloseIcon?: React.ReactNode;\n\n /**\n * The icon to use for the send button.\n * @default <SendIcon />\n */\n sendIcon?: React.ReactNode;\n\n /**\n * The icon to use for the activity indicator.\n * @default <ActivityIcon />\n */\n activityIcon?: React.ReactNode;\n\n /**\n * The icon to use for the spinner.\n * @default <SpinnerIcon />\n */\n spinnerIcon?: React.ReactNode;\n\n /**\n * The icon to use for the stop button.\n * @default <StopIcon />\n */\n stopIcon?: React.ReactNode;\n\n /**\n * The icon to use for the regenerate button.\n * @default <RegenerateIcon />\n */\n regenerateIcon?: React.ReactNode;\n}\n\n/**\n * Labels for CopilotChat component.\n */\nexport interface CopilotChatLabels {\n /**\n * The initial message(s) to display in the chat window.\n */\n initial?: string | string[];\n\n /**\n * The title to display in the header.\n * @default \"CopilotKit\"\n */\n title?: string;\n\n /**\n * The placeholder to display in the input.\n * @default \"Type a message...\"\n */\n placeholder?: string;\n\n /**\n * The message to display while the chat GPT is \"thinking\".\n * @default \"Thinking...\"\n */\n thinking?: string;\n\n /**\n * The message to display when an error occurs.\n * @default \"❌ An error occurred. Please try again.\"\n */\n error?: string;\n\n /**\n * The label to display on the stop button.\n * @default \"Stop generating\"\n */\n stopGenerating?: string;\n\n /**\n * The label to display on the regenerate button.\n * @default \"Regenerate response\"\n */\n regenerateResponse?: string;\n}\n\ninterface ChatContext {\n labels: Required<CopilotChatLabels>;\n icons: Required<CopilotChatIcons>;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContext = React.createContext<ChatContext | undefined>(undefined);\n\nexport function useChatContext(): ChatContext {\n const context = React.useContext(ChatContext);\n if (context === undefined) {\n throw new Error(\n \"Context not found. Did you forget to wrap your app in a <ChatContextProvider> component?\",\n );\n }\n return context;\n}\n\ninterface ChatContextProps {\n // temperature?: number;\n // instructions?: string;\n // maxFeedback?: number;\n labels?: CopilotChatLabels;\n icons?: CopilotChatIcons;\n children?: React.ReactNode;\n open: boolean;\n setOpen: (open: boolean) => void;\n}\n\nexport const ChatContextProvider = ({\n // temperature,\n // instructions,\n // maxFeedback,\n labels,\n icons,\n children,\n open,\n setOpen,\n}: ChatContextProps) => {\n const context = useMemo(\n () => ({\n labels: {\n ...{\n initial: \"\",\n title: \"CopilotKit\",\n placeholder: \"Type a message...\",\n thinking: \"Thinking...\",\n error: \"❌ An error occurred. Please try again.\",\n stopGenerating: \"Stop generating\",\n regenerateResponse: \"Regenerate response\",\n },\n ...labels,\n },\n\n icons: {\n ...{\n openIcon: DefaultIcons.OpenIcon,\n closeIcon: DefaultIcons.CloseIcon,\n headerCloseIcon: DefaultIcons.HeaderCloseIcon,\n sendIcon: DefaultIcons.SendIcon,\n activityIcon: DefaultIcons.ActivityIcon,\n spinnerIcon: DefaultIcons.SpinnerIcon,\n stopIcon: DefaultIcons.StopIcon,\n regenerateIcon: DefaultIcons.RegenerateIcon,\n },\n icons,\n },\n open,\n setOpen,\n }),\n [labels, icons, open, setOpen],\n );\n return <ChatContext.Provider value={context}>{children}</ChatContext.Provider>;\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,eAAe;AA+KtB;AAlEF,IAAM,cAAc,MAAM,cAAuC,MAAS;AAE1E,SAAS,iBAA8B;AAC5C,QAAM,UAAU,MAAM,WAAW,WAAW;AAC5C,MAAI,YAAY,QAAW;AACzB,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAaO,IAAM,sBAAsB,CAAC;AAAA;AAAA;AAAA;AAAA,EAIlC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,UAAU;AAAA,IACd,OAAO;AAAA,MACL,QAAQ,kCACH;AAAA,QACD,SAAS;AAAA,QACT,OAAO;AAAA,QACP,aAAa;AAAA,QACb,UAAU;AAAA,QACV,OAAO;AAAA,QACP,gBAAgB;AAAA,QAChB,oBAAoB;AAAA,MACtB,IACG;AAAA,MAGL,OAAO,iCACF;AAAA,QACD,UAAuB;AAAA,QACvB,WAAwB;AAAA,QACxB,iBAA8B;AAAA,QAC9B,UAAuB;AAAA,QACvB,cAA2B;AAAA,QAC3B,aAA0B;AAAA,QAC1B,UAAuB;AAAA,QACvB,gBAA6B;AAAA,MAC/B,IAVK;AAAA,QAWL;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,IACA,CAAC,QAAQ,OAAO,MAAM,OAAO;AAAA,EAC/B;AACA,SAAO,oBAAC,YAAY,UAAZ,EAAqB,OAAO,SAAU,UAAS;AACzD;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotChat
3
- } from "./chunk-EAKWARPJ.mjs";
3
+ } from "./chunk-BJ75DW3Z.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -8,7 +8,7 @@ import {
8
8
 
9
9
  // src/components/chat/Sidebar.tsx
10
10
  import { useState } from "react";
11
- import { jsx, jsxs } from "react/jsx-runtime";
11
+ import { jsx } from "react/jsx-runtime";
12
12
  var CopilotSidebar = (props) => {
13
13
  props = __spreadProps(__spreadValues({}, props), {
14
14
  className: props.className ? props.className + " copilotKitSidebar" : "copilotKitSidebar"
@@ -21,13 +21,10 @@ var CopilotSidebar = (props) => {
21
21
  (_a = props.onSetOpen) == null ? void 0 : _a.call(props, open);
22
22
  setExpandedClassName(open ? "sidebarExpanded" : "");
23
23
  };
24
- return /* @__PURE__ */ jsxs("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: [
25
- props.children,
26
- /* @__PURE__ */ jsx(CopilotChat, __spreadValues(__spreadValues({}, props), { onSetOpen }))
27
- ] });
24
+ return /* @__PURE__ */ jsx("div", { className: `copilotKitSidebarContentWrapper ${expandedClassName}`, children: /* @__PURE__ */ jsx(CopilotChat, __spreadProps(__spreadValues(__spreadValues({}, props), { onSetOpen }), { children: props.children })) });
28
25
  };
29
26
 
30
27
  export {
31
28
  CopilotSidebar
32
29
  };
33
- //# sourceMappingURL=chunk-BPT5B4JN.mjs.map
30
+ //# sourceMappingURL=chunk-7UK4MYTF.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\ninterface CopilotSidebarProps extends CopilotChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotSidebar = (props: CopilotSidebarProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n {props.children}\n <CopilotChat {...props} {...{ onSetOpen }} />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAAA,SAAgB,gBAAgB;AAsB5B,SAEE,KAFF;AAfG,IAAM,iBAAiB,CAAC,UAA+B;AAC5D,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AAhBvC;AAiBI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,qBAAC,SAAI,WAAW,mCAAmC,qBAChD;AAAA,UAAM;AAAA,IACP,oBAAC,+CAAgB,QAAW,EAAE,UAAU,EAAG;AAAA,KAC7C;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/components/chat/Sidebar.tsx"],"sourcesContent":["import React, { useState } from \"react\";\nimport { CopilotChat, CopilotChatProps } from \"./Chat\";\n\ninterface CopilotSidebarProps extends CopilotChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotSidebar = (props: CopilotSidebarProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitSidebar\" : \"copilotKitSidebar\",\n };\n const [expandedClassName, setExpandedClassName] = useState(\n props.defaultOpen ? \"sidebarExpanded\" : \"\",\n );\n\n const onSetOpen = (open: boolean) => {\n props.onSetOpen?.(open);\n setExpandedClassName(open ? \"sidebarExpanded\" : \"\");\n };\n\n return (\n <div className={`copilotKitSidebarContentWrapper ${expandedClassName}`}>\n <CopilotChat {...props} {...{ onSetOpen }}>\n {props.children}\n </CopilotChat>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;AAAA,SAAgB,gBAAgB;AAuB1B;AAhBC,IAAM,iBAAiB,CAAC,UAA+B;AAC5D,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,uBAAuB;AAAA,EACxE;AACA,QAAM,CAAC,mBAAmB,oBAAoB,IAAI;AAAA,IAChD,MAAM,cAAc,oBAAoB;AAAA,EAC1C;AAEA,QAAM,YAAY,CAAC,SAAkB;AAhBvC;AAiBI,gBAAM,cAAN,+BAAkB;AAClB,yBAAqB,OAAO,oBAAoB,EAAE;AAAA,EACpD;AAEA,SACE,oBAAC,SAAI,WAAW,mCAAmC,qBACjD,8BAAC,6DAAgB,QAAW,EAAE,UAAU,IAAvC,EACE,gBAAM,WACT,GACF;AAEJ;","names":[]}
@@ -1,24 +1,24 @@
1
1
  import {
2
2
  Messages
3
- } from "./chunk-EIB4TGCW.mjs";
3
+ } from "./chunk-3SXQEFGW.mjs";
4
4
  import {
5
5
  ResponseButton
6
- } from "./chunk-OAIXDKPE.mjs";
6
+ } from "./chunk-YEHO5VMA.mjs";
7
7
  import {
8
8
  Window
9
9
  } from "./chunk-B7DNOYVQ.mjs";
10
10
  import {
11
11
  Button
12
- } from "./chunk-EZ3QSEI2.mjs";
12
+ } from "./chunk-YTIGBBTC.mjs";
13
13
  import {
14
14
  Header
15
- } from "./chunk-NFMERKCE.mjs";
15
+ } from "./chunk-7JYUCW7H.mjs";
16
16
  import {
17
17
  Input
18
- } from "./chunk-WBXU5YXF.mjs";
18
+ } from "./chunk-KE3N45ZY.mjs";
19
19
  import {
20
20
  ChatContextProvider
21
- } from "./chunk-N37JEHLI.mjs";
21
+ } from "./chunk-7LMXXGJT.mjs";
22
22
  import {
23
23
  __async
24
24
  } from "./chunk-MRXNTQOX.mjs";
@@ -47,7 +47,8 @@ var CopilotChat = ({
47
47
  Messages: Messages2 = Messages,
48
48
  Input: Input2 = Input,
49
49
  ResponseButton: ResponseButton2 = ResponseButton,
50
- className
50
+ className,
51
+ children
51
52
  }) => {
52
53
  const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({
53
54
  id: nanoid(),
@@ -70,27 +71,30 @@ var CopilotChat = ({
70
71
  role: "user"
71
72
  });
72
73
  });
73
- return /* @__PURE__ */ jsx(ChatContextProvider, { icons, labels, children: /* @__PURE__ */ jsxs("div", { className, children: [
74
- /* @__PURE__ */ jsx(Button2, { open: openState, setOpen }),
75
- /* @__PURE__ */ jsxs(
76
- Window2,
77
- {
78
- open: openState,
79
- setOpen,
80
- clickOutsideToClose,
81
- shortcut,
82
- hitEscapeToClose,
83
- children: [
84
- /* @__PURE__ */ jsx(Header2, { open: openState, setOpen }),
85
- /* @__PURE__ */ jsx(Messages2, { messages: visibleMessages, inProgress: isLoading }),
86
- /* @__PURE__ */ jsx(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible: openState, children: showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ jsx(ResponseButton2, { onClick: isLoading ? stop : reload, inProgress: isLoading }) })
87
- ]
88
- }
89
- )
90
- ] }) });
74
+ return /* @__PURE__ */ jsxs(ChatContextProvider, { icons, labels, open: openState, setOpen: setOpenState, children: [
75
+ children,
76
+ /* @__PURE__ */ jsxs("div", { className, children: [
77
+ /* @__PURE__ */ jsx(Button2, { open: openState, setOpen }),
78
+ /* @__PURE__ */ jsxs(
79
+ Window2,
80
+ {
81
+ open: openState,
82
+ setOpen,
83
+ clickOutsideToClose,
84
+ shortcut,
85
+ hitEscapeToClose,
86
+ children: [
87
+ /* @__PURE__ */ jsx(Header2, { open: openState, setOpen }),
88
+ /* @__PURE__ */ jsx(Messages2, { messages: visibleMessages, inProgress: isLoading }),
89
+ /* @__PURE__ */ jsx(Input2, { inProgress: isLoading, onSend: sendMessage, isVisible: openState, children: showResponseButton && visibleMessages.length > 0 && /* @__PURE__ */ jsx(ResponseButton2, { onClick: isLoading ? stop : reload, inProgress: isLoading }) })
90
+ ]
91
+ }
92
+ )
93
+ ] })
94
+ ] });
91
95
  };
92
96
 
93
97
  export {
94
98
  CopilotChat
95
99
  };
96
- //# sourceMappingURL=chunk-EAKWARPJ.mjs.map
100
+ //# sourceMappingURL=chunk-BJ75DW3Z.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/components/chat/Chat.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { CopilotChatIcons, ChatContextProvider, CopilotChatLabels } from \"./ChatContext\";\nimport { SystemMessageFunction, useCopilotChat } from \"@copilotkit/react-core\";\nimport {\n ButtonProps,\n HeaderProps,\n WindowProps,\n MessagesProps,\n InputProps,\n ResponseButtonProps,\n} from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { nanoid } from \"nanoid\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A callback that gets called when the in progress state changes.\n */\n onInProgress?: (inProgress: boolean) => void;\n\n /**\n * A callback that gets called when a new message it submitted.\n */\n onSubmitMessage?: (message: string) => void;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-<shortcut> on a Mac and Ctrl-<shortcut> on Windows.\n * @default \"e\"\n */\n shortcut?: string;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n}\n\nexport const CopilotChat = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n}: CopilotChatProps) => {\n const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({\n id: nanoid(),\n makeSystemMessage,\n additionalInstructions: instructions,\n });\n\n useEffect(() => {\n onInProgress?.(isLoading);\n }, [isLoading]);\n\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n const sendMessage = async (message: string) => {\n onSubmitMessage?.(message);\n append({\n id: nanoid(),\n content: message,\n role: \"user\",\n });\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels}>\n <div className={className}>\n <Button open={openState} setOpen={setOpen}></Button>\n <Window\n open={openState}\n setOpen={setOpen}\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header open={openState} setOpen={setOpen} />\n <Messages messages={visibleMessages} inProgress={isLoading} />\n <Input inProgress={isLoading} onSend={sendMessage} isVisible={openState}>\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton onClick={isLoading ? stop : reload} inProgress={isLoading} />\n )}\n </Input>\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,iBAAiB;AAEjC,SAAgC,sBAAsB;AActD,SAAS,cAAc;AAuKf,cACA,YADA;AAlDD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AACF,MAAwB;AACtB,QAAM,EAAE,iBAAiB,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,eAAe;AAAA,IAC3F,IAAI,OAAO;AAAA,IACX;AAAA,IACA,wBAAwB;AAAA,EAC1B,CAAC;AAED,YAAU,MAAM;AACd,iDAAe;AAAA,EACjB,GAAG,CAAC,SAAS,CAAC;AAEd,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,cAAc,CAAO,YAAoB;AAC7C,uDAAkB;AAClB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,SACE,oBAAC,uBAAoB,OAAc,QACjC,+BAAC,SAAI,WACH;AAAA,wBAACJ,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,IAC3C;AAAA,MAACD;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QAEA;AAAA,8BAACE,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,UAC3C,oBAACC,WAAA,EAAS,UAAU,iBAAiB,YAAY,WAAW;AAAA,UAC5D,oBAACC,QAAA,EAAM,YAAY,WAAW,QAAQ,aAAa,WAAW,WAC3D,gCAAsB,gBAAgB,SAAS,KAC9C,oBAACC,iBAAA,EAAe,SAAS,YAAY,OAAO,QAAQ,YAAY,WAAW,GAE/E;AAAA;AAAA;AAAA,IACF;AAAA,KACF,GACF;AAEJ;","names":["Window","Button","Header","Messages","Input","ResponseButton"]}
1
+ {"version":3,"sources":["../src/components/chat/Chat.tsx"],"sourcesContent":["import React, { useEffect } from \"react\";\nimport { CopilotChatIcons, ChatContextProvider, CopilotChatLabels } from \"./ChatContext\";\nimport { SystemMessageFunction, useCopilotChat } from \"@copilotkit/react-core\";\nimport {\n ButtonProps,\n HeaderProps,\n WindowProps,\n MessagesProps,\n InputProps,\n ResponseButtonProps,\n} from \"./props\";\nimport { Window as DefaultWindow } from \"./Window\";\nimport { Button as DefaultButton } from \"./Button\";\nimport { Header as DefaultHeader } from \"./Header\";\nimport { Messages as DefaultMessages } from \"./Messages\";\nimport { Input as DefaultInput } from \"./Input\";\nimport { nanoid } from \"nanoid\";\nimport { ResponseButton as DefaultResponseButton } from \"./Response\";\n\n/**\n * Props for CopilotChat component.\n */\nexport interface CopilotChatProps {\n /**\n * Custom instructions to be added to the system message. Use this property to\n * provide additional context or guidance to the language model, influencing\n * its responses. These instructions can include specific directions,\n * preferences, or criteria that the model should consider when generating\n * its output, thereby tailoring the conversation more precisely to the\n * user's needs or the application's requirements.\n */\n instructions?: string;\n\n /**\n * Whether the chat window should be open by default.\n * @default false\n */\n defaultOpen?: boolean;\n\n /**\n * If the chat window should close when the user clicks outside of it.\n * @default true\n */\n clickOutsideToClose?: boolean;\n\n /**\n * If the chat window should close when the user hits the Escape key.\n * @default true\n */\n hitEscapeToClose?: boolean;\n\n /**\n * A callback that gets called when the chat window opens or closes.\n */\n onSetOpen?: (open: boolean) => void;\n\n /**\n * A callback that gets called when the in progress state changes.\n */\n onInProgress?: (inProgress: boolean) => void;\n\n /**\n * A callback that gets called when a new message it submitted.\n */\n onSubmitMessage?: (message: string) => void;\n\n /**\n * The shortcut key to open the chat window.\n * Uses Command-<shortcut> on a Mac and Ctrl-<shortcut> on Windows.\n * @default \"e\"\n */\n shortcut?: string;\n\n /**\n * Icons can be used to set custom icons for the chat window.\n */\n icons?: CopilotChatIcons;\n\n /**\n * Labels can be used to set custom labels for the chat window.\n */\n labels?: CopilotChatLabels;\n\n /**\n * A function that takes in context string and instructions and returns\n * the system message to include in the chat request.\n * Use this to completely override the system message, when providing\n * instructions is not enough.\n */\n makeSystemMessage?: SystemMessageFunction;\n\n /**\n * Whether to show the response button.\n * @default true\n */\n showResponseButton?: boolean;\n\n /**\n * A custom Window component to use instead of the default.\n */\n Window?: React.ComponentType<WindowProps>;\n\n /**\n * A custom Button component to use instead of the default.\n */\n Button?: React.ComponentType<ButtonProps>;\n\n /**\n * A custom Header component to use instead of the default.\n */\n Header?: React.ComponentType<HeaderProps>;\n\n /**\n * A custom Messages component to use instead of the default.\n */\n Messages?: React.ComponentType<MessagesProps>;\n\n /**\n * A custom Input component to use instead of the default.\n */\n Input?: React.ComponentType<InputProps>;\n\n /**\n * A custom ResponseButton component to use instead of the default.\n */\n ResponseButton?: React.ComponentType<ResponseButtonProps>;\n\n /**\n * A class name to apply to the root element.\n */\n className?: string;\n\n /**\n * Children to render.\n */\n children?: React.ReactNode;\n}\n\nexport const CopilotChat = ({\n instructions,\n defaultOpen = false,\n clickOutsideToClose = true,\n hitEscapeToClose = true,\n onSetOpen,\n onSubmitMessage,\n shortcut = \"/\",\n icons,\n labels,\n makeSystemMessage,\n showResponseButton = true,\n onInProgress,\n Window = DefaultWindow,\n Button = DefaultButton,\n Header = DefaultHeader,\n Messages = DefaultMessages,\n Input = DefaultInput,\n ResponseButton = DefaultResponseButton,\n className,\n children,\n}: CopilotChatProps) => {\n const { visibleMessages, append, reload, stop, isLoading, input, setInput } = useCopilotChat({\n id: nanoid(),\n makeSystemMessage,\n additionalInstructions: instructions,\n });\n\n useEffect(() => {\n onInProgress?.(isLoading);\n }, [isLoading]);\n\n const [openState, setOpenState] = React.useState(defaultOpen);\n\n const setOpen = (open: boolean) => {\n onSetOpen?.(open);\n setOpenState(open);\n };\n\n const sendMessage = async (message: string) => {\n onSubmitMessage?.(message);\n append({\n id: nanoid(),\n content: message,\n role: \"user\",\n });\n };\n\n return (\n <ChatContextProvider icons={icons} labels={labels} open={openState} setOpen={setOpenState}>\n {children}\n <div className={className}>\n <Button open={openState} setOpen={setOpen}></Button>\n <Window\n open={openState}\n setOpen={setOpen}\n clickOutsideToClose={clickOutsideToClose}\n shortcut={shortcut}\n hitEscapeToClose={hitEscapeToClose}\n >\n <Header open={openState} setOpen={setOpen} />\n <Messages messages={visibleMessages} inProgress={isLoading} />\n <Input inProgress={isLoading} onSend={sendMessage} isVisible={openState}>\n {showResponseButton && visibleMessages.length > 0 && (\n <ResponseButton onClick={isLoading ? stop : reload} inProgress={isLoading} />\n )}\n </Input>\n </Window>\n </div>\n </ChatContextProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,SAAS,iBAAiB;AAEjC,SAAgC,sBAAsB;AActD,SAAS,cAAc;AA8Kf,cACA,YADA;AApDD,IAAM,cAAc,CAAC;AAAA,EAC1B;AAAA,EACA,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,mBAAmB;AAAA,EACnB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA,qBAAqB;AAAA,EACrB;AAAA,EACA,QAAAA,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,QAAAC,UAAS;AAAA,EACT,UAAAC,YAAW;AAAA,EACX,OAAAC,SAAQ;AAAA,EACR,gBAAAC,kBAAiB;AAAA,EACjB;AAAA,EACA;AACF,MAAwB;AACtB,QAAM,EAAE,iBAAiB,QAAQ,QAAQ,MAAM,WAAW,OAAO,SAAS,IAAI,eAAe;AAAA,IAC3F,IAAI,OAAO;AAAA,IACX;AAAA,IACA,wBAAwB;AAAA,EAC1B,CAAC;AAED,YAAU,MAAM;AACd,iDAAe;AAAA,EACjB,GAAG,CAAC,SAAS,CAAC;AAEd,QAAM,CAAC,WAAW,YAAY,IAAI,MAAM,SAAS,WAAW;AAE5D,QAAM,UAAU,CAAC,SAAkB;AACjC,2CAAY;AACZ,iBAAa,IAAI;AAAA,EACnB;AAEA,QAAM,cAAc,CAAO,YAAoB;AAC7C,uDAAkB;AAClB,WAAO;AAAA,MACL,IAAI,OAAO;AAAA,MACX,SAAS;AAAA,MACT,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAEA,SACE,qBAAC,uBAAoB,OAAc,QAAgB,MAAM,WAAW,SAAS,cAC1E;AAAA;AAAA,IACD,qBAAC,SAAI,WACH;AAAA,0BAACJ,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,MAC3C;AAAA,QAACD;AAAA,QAAA;AAAA,UACC,MAAM;AAAA,UACN;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UAEA;AAAA,gCAACE,SAAA,EAAO,MAAM,WAAW,SAAkB;AAAA,YAC3C,oBAACC,WAAA,EAAS,UAAU,iBAAiB,YAAY,WAAW;AAAA,YAC5D,oBAACC,QAAA,EAAM,YAAY,WAAW,QAAQ,aAAa,WAAW,WAC3D,gCAAsB,gBAAgB,SAAS,KAC9C,oBAACC,iBAAA,EAAe,SAAS,YAAY,OAAO,QAAQ,YAAY,WAAW,GAE/E;AAAA;AAAA;AAAA,MACF;AAAA,OACF;AAAA,KACF;AAEJ;","names":["Window","Button","Header","Messages","Input","ResponseButton"]}
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-WM6BS77F.mjs";
4
4
  import {
5
5
  useChatContext
6
- } from "./chunk-N37JEHLI.mjs";
6
+ } from "./chunk-7LMXXGJT.mjs";
7
7
 
8
8
  // src/components/chat/Input.tsx
9
9
  import { useEffect, useRef, useState } from "react";
@@ -60,4 +60,4 @@ var Input = ({ inProgress, onSend, children, isVisible = false }) => {
60
60
  export {
61
61
  Input
62
62
  };
63
- //# sourceMappingURL=chunk-WBXU5YXF.mjs.map
63
+ //# sourceMappingURL=chunk-KE3N45ZY.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  CopilotChat
3
- } from "./chunk-EAKWARPJ.mjs";
3
+ } from "./chunk-BJ75DW3Z.mjs";
4
4
  import {
5
5
  __spreadProps,
6
6
  __spreadValues
@@ -12,10 +12,10 @@ var CopilotPopup = (props) => {
12
12
  props = __spreadProps(__spreadValues({}, props), {
13
13
  className: props.className ? props.className + " copilotKitPopup" : "copilotKitPopup"
14
14
  });
15
- return /* @__PURE__ */ jsx(CopilotChat, __spreadValues({}, props));
15
+ return /* @__PURE__ */ jsx(CopilotChat, __spreadProps(__spreadValues({}, props), { children: props.children }));
16
16
  };
17
17
 
18
18
  export {
19
19
  CopilotPopup
20
20
  };
21
- //# sourceMappingURL=chunk-2JGAK63B.mjs.map
21
+ //# sourceMappingURL=chunk-OTE2PMAQ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Popup.tsx"],"sourcesContent":["import { CopilotChat, CopilotChatProps } from \"./Chat\";\n\ninterface CopilotPopupProps extends CopilotChatProps {\n children?: React.ReactNode;\n}\n\nexport const CopilotPopup = (props: CopilotChatProps) => {\n props = {\n ...props,\n className: props.className ? props.className + \" copilotKitPopup\" : \"copilotKitPopup\",\n };\n return <CopilotChat {...props}>{props.children}</CopilotChat>;\n};\n"],"mappings":";;;;;;;;;AAWS;AALF,IAAM,eAAe,CAAC,UAA4B;AACvD,UAAQ,iCACH,QADG;AAAA,IAEN,WAAW,MAAM,YAAY,MAAM,YAAY,qBAAqB;AAAA,EACtE;AACA,SAAO,oBAAC,8CAAgB,QAAhB,EAAwB,gBAAM,WAAS;AACjD;","names":[]}
@@ -24,8 +24,21 @@ var components = {
24
24
  p({ children }) {
25
25
  return /* @__PURE__ */ jsx("p", { children });
26
26
  },
27
- code(_a) {
28
- var _b = _a, { children, className, inline } = _b, props = __objRest(_b, ["children", "className", "inline"]);
27
+ a(_a) {
28
+ var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
29
+ return /* @__PURE__ */ jsx(
30
+ "a",
31
+ __spreadProps(__spreadValues({
32
+ style: { color: "blue", textDecoration: "underline" }
33
+ }, props), {
34
+ target: "_blank",
35
+ rel: "noopener noreferrer",
36
+ children
37
+ })
38
+ );
39
+ },
40
+ code(_c) {
41
+ var _d = _c, { children, className, inline } = _d, props = __objRest(_d, ["children", "className", "inline"]);
29
42
  if (children.length) {
30
43
  if (children[0] == "\u258D") {
31
44
  return /* @__PURE__ */ jsx(
@@ -59,4 +72,4 @@ var components = {
59
72
  export {
60
73
  Markdown
61
74
  };
62
- //# sourceMappingURL=chunk-Q3WQ546F.mjs.map
75
+ //# sourceMappingURL=chunk-PGPR52GM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/chat/Markdown.tsx"],"sourcesContent":["import { FC, memo } from \"react\";\nimport ReactMarkdown, { Options, Components } from \"react-markdown\";\nimport { CodeBlock } from \"./CodeBlock\";\nimport remarkGfm from \"remark-gfm\";\nimport remarkMath from \"remark-math\";\n\nconst MemoizedReactMarkdown: FC<Options> = memo(\n ReactMarkdown,\n (prevProps, nextProps) =>\n prevProps.children === nextProps.children && prevProps.className === nextProps.className,\n);\n\ntype MarkdownProps = {\n content: string;\n};\n\nexport const Markdown = ({ content }: MarkdownProps) => {\n return (\n <div className=\"copilotKitMarkdown\">\n <MemoizedReactMarkdown components={components} remarkPlugins={[remarkGfm, remarkMath]}>\n {content}\n </MemoizedReactMarkdown>\n </div>\n );\n};\n\nconst components: Components = {\n p({ children }) {\n return <p>{children}</p>;\n },\n a({ children, ...props }) {\n return (\n <a\n style={{ color: \"blue\", textDecoration: \"underline\" }}\n {...props}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {children}\n </a>\n );\n },\n code({ children, className, inline, ...props }) {\n if (children.length) {\n if (children[0] == \"▍\") {\n return (\n <span\n style={{\n animation: \"pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite\",\n marginTop: \"0.25rem\",\n }}\n >\n ▍\n </span>\n );\n }\n\n children[0] = (children[0] as string).replace(\"`▍`\", \"▍\");\n }\n\n const match = /language-(\\w+)/.exec(className || \"\");\n\n if (inline) {\n return (\n <code className={className} {...props}>\n {children}\n </code>\n );\n }\n\n return (\n <CodeBlock\n key={Math.random()}\n language={(match && match[1]) || \"\"}\n value={String(children).replace(/\\n$/, \"\")}\n {...props}\n />\n );\n },\n};\n"],"mappings":";;;;;;;;;;AAAA,SAAa,YAAY;AACzB,OAAO,mBAA4C;AAEnD,OAAO,eAAe;AACtB,OAAO,gBAAgB;AAejB;AAbN,IAAM,wBAAqC;AAAA,EACzC;AAAA,EACA,CAAC,WAAW,cACV,UAAU,aAAa,UAAU,YAAY,UAAU,cAAc,UAAU;AACnF;AAMO,IAAM,WAAW,CAAC,EAAE,QAAQ,MAAqB;AACtD,SACE,oBAAC,SAAI,WAAU,sBACb,8BAAC,yBAAsB,YAAwB,eAAe,CAAC,WAAW,UAAU,GACjF,mBACH,GACF;AAEJ;AAEA,IAAM,aAAyB;AAAA,EAC7B,EAAE,EAAE,SAAS,GAAG;AACd,WAAO,oBAAC,OAAG,UAAS;AAAA,EACtB;AAAA,EACA,EAAE,IAAwB;AAAxB,iBAAE,WA9BN,IA8BI,IAAe,kBAAf,IAAe,CAAb;AACF,WACE;AAAA,MAAC;AAAA;AAAA,QACC,OAAO,EAAE,OAAO,QAAQ,gBAAgB,YAAY;AAAA,SAChD,QAFL;AAAA,QAGC,QAAO;AAAA,QACP,KAAI;AAAA,QAEH;AAAA;AAAA,IACH;AAAA,EAEJ;AAAA,EACA,KAAK,IAA2C;AAA3C,iBAAE,YAAU,WAAW,OA1C9B,IA0CO,IAAkC,kBAAlC,IAAkC,CAAhC,YAAU,aAAW;AAC1B,QAAI,SAAS,QAAQ;AACnB,UAAI,SAAS,CAAC,KAAK,UAAK;AACtB,eACE;AAAA,UAAC;AAAA;AAAA,YACC,OAAO;AAAA,cACL,WAAW;AAAA,cACX,WAAW;AAAA,YACb;AAAA,YACD;AAAA;AAAA,QAED;AAAA,MAEJ;AAEA,eAAS,CAAC,IAAK,SAAS,CAAC,EAAa,QAAQ,YAAO,QAAG;AAAA,IAC1D;AAEA,UAAM,QAAQ,iBAAiB,KAAK,aAAa,EAAE;AAEnD,QAAI,QAAQ;AACV,aACE,oBAAC,uCAAK,aAA0B,QAA/B,EACE,WACH;AAAA,IAEJ;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,UAAW,SAAS,MAAM,CAAC,KAAM;AAAA,QACjC,OAAO,OAAO,QAAQ,EAAE,QAAQ,OAAO,EAAE;AAAA,SACrC;AAAA,MAHC,KAAK,OAAO;AAAA,IAInB;AAAA,EAEJ;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-UGQQ4WEQ.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useChatContext
3
- } from "./chunk-N37JEHLI.mjs";
3
+ } from "./chunk-7LMXXGJT.mjs";
4
4
 
5
5
  // src/components/chat/Response.tsx
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -15,4 +15,4 @@ var ResponseButton = ({ onClick, inProgress }) => {
15
15
  export {
16
16
  ResponseButton
17
17
  };
18
- //# sourceMappingURL=chunk-OAIXDKPE.mjs.map
18
+ //# sourceMappingURL=chunk-YEHO5VMA.mjs.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  useChatContext
3
- } from "./chunk-N37JEHLI.mjs";
3
+ } from "./chunk-7LMXXGJT.mjs";
4
4
 
5
5
  // src/components/chat/Button.tsx
6
6
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -22,4 +22,4 @@ var Button = ({ open, setOpen }) => {
22
22
  export {
23
23
  Button
24
24
  };
25
- //# sourceMappingURL=chunk-EZ3QSEI2.mjs.map
25
+ //# sourceMappingURL=chunk-YTIGBBTC.mjs.map