@copilotkit/react-textarea 1.51.4-next.7 → 1.51.4

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 (250) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +18 -12
  3. package/dist/{chunk-D47EKHIF.mjs → chunk-2X3CZVEP.mjs} +9 -3
  4. package/dist/chunk-2X3CZVEP.mjs.map +1 -0
  5. package/dist/{chunk-GU5LTWGL.mjs → chunk-3WLGLZTY.mjs} +19 -13
  6. package/dist/chunk-3WLGLZTY.mjs.map +1 -0
  7. package/dist/{chunk-DRV2FOHZ.mjs → chunk-7GZWOXE4.mjs} +2 -2
  8. package/dist/chunk-7GZWOXE4.mjs.map +1 -0
  9. package/dist/{chunk-NAFNY4FL.mjs → chunk-7V4ORVQX.mjs} +1 -1
  10. package/dist/chunk-7V4ORVQX.mjs.map +1 -0
  11. package/dist/{chunk-ECR45NSD.mjs → chunk-A6YGJFQI.mjs} +9 -2
  12. package/dist/chunk-A6YGJFQI.mjs.map +1 -0
  13. package/dist/{chunk-WGWQRALG.mjs → chunk-AHNPJMBR.mjs} +10 -3
  14. package/dist/chunk-AHNPJMBR.mjs.map +1 -0
  15. package/dist/{chunk-VSVQZUPW.mjs → chunk-ARLBRSB7.mjs} +23 -7
  16. package/dist/chunk-ARLBRSB7.mjs.map +1 -0
  17. package/dist/{chunk-72GJNLCO.mjs → chunk-AZ7RF6ED.mjs} +5 -5
  18. package/dist/chunk-AZ7RF6ED.mjs.map +1 -0
  19. package/dist/{chunk-I72DKFHD.mjs → chunk-CFCMZVQ2.mjs} +29 -7
  20. package/dist/chunk-CFCMZVQ2.mjs.map +1 -0
  21. package/dist/{chunk-T6MTDQZ7.mjs → chunk-CMKGYQFX.mjs} +1 -1
  22. package/dist/chunk-CMKGYQFX.mjs.map +1 -0
  23. package/dist/{chunk-DFTV4TST.mjs → chunk-DZMQBOPG.mjs} +1 -1
  24. package/dist/chunk-DZMQBOPG.mjs.map +1 -0
  25. package/dist/{chunk-CLGAJCZ5.mjs → chunk-E7C63KQP.mjs} +10 -6
  26. package/dist/chunk-E7C63KQP.mjs.map +1 -0
  27. package/dist/{chunk-GQN2HYFJ.mjs → chunk-EGBZSVLK.mjs} +5 -2
  28. package/dist/{chunk-GQN2HYFJ.mjs.map → chunk-EGBZSVLK.mjs.map} +1 -1
  29. package/dist/{chunk-3QJOFG3V.mjs → chunk-FTG7P3NP.mjs} +1 -1
  30. package/dist/chunk-FTG7P3NP.mjs.map +1 -0
  31. package/dist/{chunk-KMVGEY7Q.mjs → chunk-IBZTDP72.mjs} +9 -4
  32. package/dist/chunk-IBZTDP72.mjs.map +1 -0
  33. package/dist/{chunk-4PDYALMP.mjs → chunk-LYNGBKJR.mjs} +9 -3
  34. package/dist/chunk-LYNGBKJR.mjs.map +1 -0
  35. package/dist/{chunk-DL3JWL2E.mjs → chunk-M7GTVHFB.mjs} +26 -8
  36. package/dist/chunk-M7GTVHFB.mjs.map +1 -0
  37. package/dist/chunk-MQBPYOOZ.mjs +97 -0
  38. package/dist/chunk-MQBPYOOZ.mjs.map +1 -0
  39. package/dist/{chunk-6SGWO63I.mjs → chunk-MQXYWOE2.mjs} +3 -3
  40. package/dist/chunk-MQXYWOE2.mjs.map +1 -0
  41. package/dist/{chunk-F2ULK22F.mjs → chunk-NFMCLTJU.mjs} +1 -1
  42. package/dist/chunk-NFMCLTJU.mjs.map +1 -0
  43. package/dist/{chunk-F6RLSVG3.mjs → chunk-O4WCM57A.mjs} +1 -1
  44. package/dist/chunk-O4WCM57A.mjs.map +1 -0
  45. package/dist/{chunk-4NHVQZ67.mjs → chunk-PDFIUPCS.mjs} +1 -1
  46. package/dist/chunk-PDFIUPCS.mjs.map +1 -0
  47. package/dist/{chunk-7NOLZ5T3.mjs → chunk-SWX3MRZ4.mjs} +31 -22
  48. package/dist/chunk-SWX3MRZ4.mjs.map +1 -0
  49. package/dist/{chunk-QJNFNPWH.mjs → chunk-TGN3YVSO.mjs} +2 -2
  50. package/dist/chunk-TGN3YVSO.mjs.map +1 -0
  51. package/dist/{chunk-LYB4B6MK.mjs → chunk-UB4Y22EF.mjs} +4 -2
  52. package/dist/chunk-UB4Y22EF.mjs.map +1 -0
  53. package/dist/{chunk-ZQSEYPNN.mjs → chunk-UIBUYQPG.mjs} +7 -2
  54. package/dist/chunk-UIBUYQPG.mjs.map +1 -0
  55. package/dist/{chunk-AJ5OMEXM.mjs → chunk-VBPZTMXB.mjs} +2 -2
  56. package/dist/{chunk-EJGGLWWR.mjs → chunk-VH7INUR5.mjs} +1 -1
  57. package/dist/{chunk-EJGGLWWR.mjs.map → chunk-VH7INUR5.mjs.map} +1 -1
  58. package/dist/{chunk-7LSRNPNI.mjs → chunk-VVRGAA43.mjs} +1 -1
  59. package/dist/chunk-VVRGAA43.mjs.map +1 -0
  60. package/dist/{chunk-YLFAIYRY.mjs → chunk-VYLLLBUP.mjs} +1 -1
  61. package/dist/chunk-VYLLLBUP.mjs.map +1 -0
  62. package/dist/{chunk-2QDCE7PD.mjs → chunk-WXKPRNNO.mjs} +1 -1
  63. package/dist/chunk-WXKPRNNO.mjs.map +1 -0
  64. package/dist/{chunk-JLOABKLH.mjs → chunk-YINY56BI.mjs} +2 -2
  65. package/dist/{chunk-23Q6A46J.mjs → chunk-ZBP4SABT.mjs} +22 -8
  66. package/dist/chunk-ZBP4SABT.mjs.map +1 -0
  67. package/dist/{chunk-H5ZNEKUR.mjs → chunk-ZWI5KPQ5.mjs} +2 -2
  68. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +154 -86
  69. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
  70. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +29 -29
  71. package/dist/components/base-copilot-textarea/render-element.js.map +1 -1
  72. package/dist/components/base-copilot-textarea/render-element.mjs +1 -1
  73. package/dist/components/base-copilot-textarea/render-placeholder.js.map +1 -1
  74. package/dist/components/base-copilot-textarea/render-placeholder.mjs +1 -1
  75. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
  76. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +2 -2
  77. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
  78. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +1 -1
  79. package/dist/components/copilot-textarea/copilot-textarea.js +190 -95
  80. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
  81. package/dist/components/copilot-textarea/copilot-textarea.mjs +34 -34
  82. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
  83. package/dist/components/hovering-toolbar/hovering-editor-provider.js +3 -1
  84. package/dist/components/hovering-toolbar/hovering-editor-provider.js.map +1 -1
  85. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +1 -1
  86. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +57 -63
  87. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
  88. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +1 -1
  89. package/dist/components/hovering-toolbar/hovering-toolbar.js +117 -77
  90. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
  91. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +15 -15
  92. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +60 -14
  93. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
  94. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +11 -11
  95. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +60 -14
  96. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
  97. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +12 -12
  98. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +1 -1
  99. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +14 -3
  100. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -1
  101. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +3 -3
  102. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +60 -14
  103. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
  104. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +12 -12
  105. package/dist/components/index.js +190 -95
  106. package/dist/components/index.js.map +1 -1
  107. package/dist/components/index.mjs +34 -34
  108. package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
  109. package/dist/components/manual-ui/chip-with-icon.js +13 -2
  110. package/dist/components/manual-ui/chip-with-icon.js.map +1 -1
  111. package/dist/components/manual-ui/chip-with-icon.mjs +13 -2
  112. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  113. package/dist/components/source-search-box/source-search-box.js +28 -5
  114. package/dist/components/source-search-box/source-search-box.js.map +1 -1
  115. package/dist/components/source-search-box/source-search-box.mjs +4 -4
  116. package/dist/components/ui/button.js +7 -1
  117. package/dist/components/ui/button.js.map +1 -1
  118. package/dist/components/ui/button.mjs +2 -2
  119. package/dist/components/ui/command.js +47 -9
  120. package/dist/components/ui/command.js.map +1 -1
  121. package/dist/components/ui/command.mjs +3 -3
  122. package/dist/components/ui/dialog.js +27 -5
  123. package/dist/components/ui/dialog.js.map +1 -1
  124. package/dist/components/ui/dialog.mjs +2 -2
  125. package/dist/components/ui/label.js +7 -1
  126. package/dist/components/ui/label.js.map +1 -1
  127. package/dist/components/ui/label.mjs +2 -2
  128. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js +18 -4
  129. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
  130. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +4 -4
  131. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.js.map +1 -1
  132. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +2 -2
  133. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
  134. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +2 -2
  135. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js +6 -1
  136. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
  137. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +1 -1
  138. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js +25 -7
  139. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
  140. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +1 -1
  141. package/dist/hooks/misc/use-autosize-textarea.js.map +1 -1
  142. package/dist/hooks/misc/use-autosize-textarea.mjs +1 -1
  143. package/dist/index.js +190 -95
  144. package/dist/index.js.map +1 -1
  145. package/dist/index.mjs +35 -35
  146. package/dist/index.umd.js +16 -16
  147. package/dist/index.umd.js.map +1 -1
  148. package/dist/lib/debouncer.js.map +1 -1
  149. package/dist/lib/debouncer.mjs +1 -1
  150. package/dist/lib/editor-to-text.js.map +1 -1
  151. package/dist/lib/editor-to-text.mjs +1 -1
  152. package/dist/lib/get-text-around-cursor.js.map +1 -1
  153. package/dist/lib/get-text-around-cursor.mjs +1 -1
  154. package/dist/lib/slatejs-edits/clear-autocompletions.js +4 -1
  155. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
  156. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +1 -1
  157. package/dist/lib/slatejs-edits/with-partial-history.js.map +1 -1
  158. package/dist/lib/slatejs-edits/with-partial-history.mjs +1 -1
  159. package/dist/lib/stream-promise-flatten.js.map +1 -1
  160. package/dist/lib/stream-promise-flatten.mjs +1 -1
  161. package/dist/lib/utils.js.map +1 -1
  162. package/dist/lib/utils.mjs +1 -1
  163. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.js.map +1 -1
  164. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
  165. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +3 -3
  166. package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
  167. package/dist/types/autosuggestions-config/editing-api-config.mjs +1 -1
  168. package/dist/types/autosuggestions-config/index.js.map +1 -1
  169. package/dist/types/autosuggestions-config/index.mjs +3 -3
  170. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.js.map +1 -1
  171. package/dist/types/base/base-autosuggestions-config.js.map +1 -1
  172. package/dist/types/base/base-autosuggestions-config.mjs +1 -1
  173. package/dist/types/base/base-copilot-textarea-props.js.map +1 -1
  174. package/dist/types/base/editor-autocomplete-state.js.map +1 -1
  175. package/dist/types/base/editor-autocomplete-state.mjs +2 -2
  176. package/dist/types/base/index.js.map +1 -1
  177. package/dist/types/base/index.mjs +1 -1
  178. package/dist/types/index.js.map +1 -1
  179. package/dist/types/index.mjs +3 -3
  180. package/package.json +8 -8
  181. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +30 -10
  182. package/src/components/base-copilot-textarea/render-element.tsx +6 -2
  183. package/src/components/base-copilot-textarea/render-placeholder.tsx +3 -1
  184. package/src/components/base-copilot-textarea/use-add-branding-css.tsx +3 -1
  185. package/src/components/copilot-textarea/copilot-textarea.tsx +15 -9
  186. package/src/components/hovering-toolbar/hovering-editor-provider.tsx +3 -1
  187. package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +63 -52
  188. package/src/components/hovering-toolbar/hovering-toolbar.tsx +21 -5
  189. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +13 -7
  190. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +7 -2
  191. package/src/components/manual-ui/chip-with-icon.tsx +12 -3
  192. package/src/components/source-search-box/source-search-box.tsx +12 -2
  193. package/src/components/ui/button.tsx +13 -5
  194. package/src/components/ui/command.tsx +17 -4
  195. package/src/components/ui/dialog.tsx +23 -5
  196. package/src/components/ui/label.tsx +7 -2
  197. package/src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts +35 -9
  198. package/src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx +5 -1
  199. package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +5 -1
  200. package/src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx +9 -2
  201. package/src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx +24 -6
  202. package/src/hooks/misc/use-autosize-textarea.tsx +4 -1
  203. package/src/lib/debouncer.ts +3 -1
  204. package/src/lib/editor-to-text.ts +5 -2
  205. package/src/lib/get-text-around-cursor.ts +14 -2
  206. package/src/lib/slatejs-edits/clear-autocompletions.ts +4 -1
  207. package/src/lib/slatejs-edits/with-partial-history.ts +10 -3
  208. package/src/lib/stream-promise-flatten.ts +3 -1
  209. package/src/lib/utils.ts +6 -2
  210. package/src/types/autosuggestions-config/autosuggestions-config-user-specified.tsx +3 -2
  211. package/src/types/autosuggestions-config/autosuggestions-config.tsx +20 -5
  212. package/src/types/autosuggestions-config/editing-api-config.tsx +2 -1
  213. package/src/types/autosuggestions-config/subtypes/make-system-prompt.ts +4 -1
  214. package/src/types/base/base-autosuggestions-config.tsx +10 -4
  215. package/src/types/base/base-copilot-textarea-props.tsx +4 -2
  216. package/tsconfig.json +1 -1
  217. package/tsup.config.ts +5 -1
  218. package/dist/chunk-23Q6A46J.mjs.map +0 -1
  219. package/dist/chunk-2IWVZ4PP.mjs +0 -103
  220. package/dist/chunk-2IWVZ4PP.mjs.map +0 -1
  221. package/dist/chunk-2QDCE7PD.mjs.map +0 -1
  222. package/dist/chunk-3QJOFG3V.mjs.map +0 -1
  223. package/dist/chunk-4NHVQZ67.mjs.map +0 -1
  224. package/dist/chunk-4PDYALMP.mjs.map +0 -1
  225. package/dist/chunk-6SGWO63I.mjs.map +0 -1
  226. package/dist/chunk-72GJNLCO.mjs.map +0 -1
  227. package/dist/chunk-7LSRNPNI.mjs.map +0 -1
  228. package/dist/chunk-7NOLZ5T3.mjs.map +0 -1
  229. package/dist/chunk-CLGAJCZ5.mjs.map +0 -1
  230. package/dist/chunk-D47EKHIF.mjs.map +0 -1
  231. package/dist/chunk-DFTV4TST.mjs.map +0 -1
  232. package/dist/chunk-DL3JWL2E.mjs.map +0 -1
  233. package/dist/chunk-DRV2FOHZ.mjs.map +0 -1
  234. package/dist/chunk-ECR45NSD.mjs.map +0 -1
  235. package/dist/chunk-F2ULK22F.mjs.map +0 -1
  236. package/dist/chunk-F6RLSVG3.mjs.map +0 -1
  237. package/dist/chunk-GU5LTWGL.mjs.map +0 -1
  238. package/dist/chunk-I72DKFHD.mjs.map +0 -1
  239. package/dist/chunk-KMVGEY7Q.mjs.map +0 -1
  240. package/dist/chunk-LYB4B6MK.mjs.map +0 -1
  241. package/dist/chunk-NAFNY4FL.mjs.map +0 -1
  242. package/dist/chunk-QJNFNPWH.mjs.map +0 -1
  243. package/dist/chunk-T6MTDQZ7.mjs.map +0 -1
  244. package/dist/chunk-VSVQZUPW.mjs.map +0 -1
  245. package/dist/chunk-WGWQRALG.mjs.map +0 -1
  246. package/dist/chunk-YLFAIYRY.mjs.map +0 -1
  247. package/dist/chunk-ZQSEYPNN.mjs.map +0 -1
  248. /package/dist/{chunk-AJ5OMEXM.mjs.map → chunk-VBPZTMXB.mjs.map} +0 -0
  249. /package/dist/{chunk-JLOABKLH.mjs.map → chunk-YINY56BI.mjs.map} +0 -0
  250. /package/dist/{chunk-H5ZNEKUR.mjs.map → chunk-ZWI5KPQ5.mjs.map} +0 -0
@@ -152,7 +152,10 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
152
152
  if (disableWhenEmpty && editorAutocompleteState.textBeforeCursor === "" && editorAutocompleteState.textAfterCursor === "") {
153
153
  return;
154
154
  }
155
- const suggestion = yield autosuggestionFunction(editorAutocompleteState, abortSignal);
155
+ const suggestion = yield autosuggestionFunction(
156
+ editorAutocompleteState,
157
+ abortSignal
158
+ );
156
159
  if (!suggestion || abortSignal.aborted) {
157
160
  throw new DOMException("Aborted", "AbortError");
158
161
  }
@@ -161,10 +164,17 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
161
164
  point: editorAutocompleteState.cursorPoint
162
165
  });
163
166
  }),
164
- [autosuggestionFunction, setCurrentAutocompleteSuggestion, disableWhenEmpty, disabled]
167
+ [
168
+ autosuggestionFunction,
169
+ setCurrentAutocompleteSuggestion,
170
+ disableWhenEmpty,
171
+ disabled
172
+ ]
165
173
  );
166
174
  const debouncedFunction = (0, import_react.useMemo)(
167
- () => new Debouncer(debounceTime),
175
+ () => new Debouncer(
176
+ debounceTime
177
+ ),
168
178
  [debounceTime]
169
179
  );
170
180
  (0, import_react.useEffect)(() => {
@@ -202,7 +212,11 @@ function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress,
202
212
  const keyDownOrTouchHandler = (0, import_react.useCallback)(
203
213
  (event) => {
204
214
  if (currentAutocompleteSuggestion) {
205
- const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(event) : shouldAcceptAutosuggestionOnKeyPress(event);
215
+ const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(
216
+ event
217
+ ) : shouldAcceptAutosuggestionOnKeyPress(
218
+ event
219
+ );
206
220
  if (shouldAcceptSuggestion) {
207
221
  event.preventDefault();
208
222
  insertAutocompleteSuggestion(currentAutocompleteSuggestion);
@@ -625,7 +639,10 @@ function clearAutocompletionsFromEditor(editor) {
625
639
  try {
626
640
  import_slate6.Transforms.removeNodes(editor, { at: path });
627
641
  } catch (e) {
628
- console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
642
+ console.log(
643
+ "CopilotTextarea.clearAutocompletionsFromEditor: error removing node",
644
+ e
645
+ );
629
646
  }
630
647
  }
631
648
  }
@@ -669,7 +686,9 @@ var HoveringEditorContext = (0, import_react4.createContext)({
669
686
  setIsDisplayed: () => {
670
687
  }
671
688
  });
672
- var HoveringEditorProvider = ({ children }) => {
689
+ var HoveringEditorProvider = ({
690
+ children
691
+ }) => {
673
692
  const [isDisplayed, setIsDisplayed] = (0, import_react4.useState)(false);
674
693
  return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
675
694
  };
@@ -696,73 +715,67 @@ var Button = import_react5.default.forwardRef((_a, ref) => {
696
715
  })
697
716
  );
698
717
  });
699
- var Icon = import_react5.default.forwardRef(
700
- (_a, ref) => {
701
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
702
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
703
- "span",
704
- __spreadProps(__spreadValues({}, props), {
705
- ref,
706
- className: (0, import_css.cx)(
707
- "material-icons",
708
- className,
709
- import_css.css`
710
- font-size: 18px;
711
- vertical-align: text-bottom;
712
- `
713
- )
714
- })
715
- );
716
- }
717
- );
718
- var Menu = import_react5.default.forwardRef(
719
- (_a, ref) => {
720
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
721
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
722
- "div",
723
- __spreadProps(__spreadValues({}, props), {
724
- "data-testid": "menu",
725
- ref,
726
- className: (0, import_css.cx)(
727
- className,
728
- import_css.css`
729
- & > * {
730
- display: inline-block;
731
- }
718
+ var Icon = import_react5.default.forwardRef((_a, ref) => {
719
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
720
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
721
+ "span",
722
+ __spreadProps(__spreadValues({}, props), {
723
+ ref,
724
+ className: (0, import_css.cx)(
725
+ "material-icons",
726
+ className,
727
+ import_css.css`
728
+ font-size: 18px;
729
+ vertical-align: text-bottom;
730
+ `
731
+ )
732
+ })
733
+ );
734
+ });
735
+ var Menu = import_react5.default.forwardRef((_a, ref) => {
736
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
737
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
738
+ "div",
739
+ __spreadProps(__spreadValues({}, props), {
740
+ "data-testid": "menu",
741
+ ref,
742
+ className: (0, import_css.cx)(
743
+ className,
744
+ import_css.css`
745
+ & > * {
746
+ display: inline-block;
747
+ }
732
748
 
733
- & > * + * {
734
- margin-left: 15px;
735
- }
736
- `
737
- )
738
- })
739
- );
740
- }
741
- );
749
+ & > * + * {
750
+ margin-left: 15px;
751
+ }
752
+ `
753
+ )
754
+ })
755
+ );
756
+ });
742
757
  var Portal = ({ children }) => {
743
758
  return typeof document === "object" ? import_react_dom.default.createPortal(children, document.body) : null;
744
759
  };
745
- var Toolbar = import_react5.default.forwardRef(
746
- (_a, ref) => {
747
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
748
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
749
- Menu,
750
- __spreadProps(__spreadValues({}, props), {
751
- ref,
752
- className: (0, import_css.cx)(
753
- className,
754
- import_css.css`
755
- position: relative;
756
- padding: 1px 18px 17px;
757
- margin: 0 -20px;
758
- border-bottom: 2px solid #eee;
759
- margin-bottom: 20px;
760
- `
761
- )
762
- })
763
- );
764
- }
765
- );
760
+ var Toolbar = import_react5.default.forwardRef((_a, ref) => {
761
+ var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
762
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
763
+ Menu,
764
+ __spreadProps(__spreadValues({}, props), {
765
+ ref,
766
+ className: (0, import_css.cx)(
767
+ className,
768
+ import_css.css`
769
+ position: relative;
770
+ padding: 1px 18px 17px;
771
+ margin: 0 -20px;
772
+ border-bottom: 2px solid #eee;
773
+ margin-bottom: 20px;
774
+ `
775
+ )
776
+ })
777
+ );
778
+ });
766
779
 
767
780
  // src/hooks/misc/use-autosize-textarea.tsx
768
781
  var import_react6 = require("react");
@@ -818,12 +831,21 @@ var CommandList = React3.forwardRef((_a, ref) => {
818
831
  import_cmdk.Command.List,
819
832
  __spreadValues({
820
833
  ref,
821
- className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
834
+ className: cn(
835
+ "max-h-[300px] overflow-y-auto overflow-x-hidden pb-2",
836
+ className
837
+ )
822
838
  }, props)
823
839
  );
824
840
  });
825
841
  CommandList.displayName = import_cmdk.Command.List.displayName;
826
- var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_cmdk.Command.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
842
+ var CommandEmpty = React3.forwardRef((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
843
+ import_cmdk.Command.Empty,
844
+ __spreadValues({
845
+ ref,
846
+ className: "py-6 text-center text-sm"
847
+ }, props)
848
+ ));
827
849
  CommandEmpty.displayName = import_cmdk.Command.Empty.displayName;
828
850
  var CommandGroup = React3.forwardRef((_a, ref) => {
829
851
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
@@ -865,11 +887,18 @@ var CommandItem = React3.forwardRef((_a, ref) => {
865
887
  });
866
888
  CommandItem.displayName = import_cmdk.Command.Item.displayName;
867
889
  var CommandShortcut = (_a) => {
868
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
890
+ var _b = _a, {
891
+ className
892
+ } = _b, props = __objRest(_b, [
893
+ "className"
894
+ ]);
869
895
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
870
896
  "span",
871
897
  __spreadValues({
872
- className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
898
+ className: cn(
899
+ "ml-auto text-xs tracking-widest text-muted-foreground",
900
+ className
901
+ )
873
902
  }, props)
874
903
  );
875
904
  };
@@ -939,7 +968,14 @@ function Logo({
939
968
  width,
940
969
  height
941
970
  }) {
942
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center justify-center", style: { width, height }, children });
971
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
972
+ "div",
973
+ {
974
+ className: "flex items-center justify-center",
975
+ style: { width, height },
976
+ children
977
+ }
978
+ );
943
979
  }
944
980
 
945
981
  // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
@@ -979,7 +1015,13 @@ var Button2 = React4.forwardRef(
979
1015
  (_a, ref) => {
980
1016
  var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
981
1017
  const Comp = asChild ? import_react_slot.Slot : "button";
982
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
1018
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
1019
+ Comp,
1020
+ __spreadValues({
1021
+ className: cn(buttonVariants({ variant, size, className })),
1022
+ ref
1023
+ }, props)
1024
+ );
983
1025
  }
984
1026
  );
985
1027
  Button2.displayName = "Button";
@@ -994,7 +1036,13 @@ var labelVariants = (0, import_class_variance_authority2.cva)(
994
1036
  );
995
1037
  var Label = React5.forwardRef((_a, ref) => {
996
1038
  var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
997
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
1039
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1040
+ LabelPrimitive.Root,
1041
+ __spreadValues({
1042
+ ref,
1043
+ className: cn(labelVariants(), className)
1044
+ }, props)
1045
+ );
998
1046
  });
999
1047
  Label.displayName = LabelPrimitive.Root.displayName;
1000
1048
 
@@ -1041,7 +1089,9 @@ var IncludedFilesPreview = ({
1041
1089
  {
1042
1090
  filePointer,
1043
1091
  onDelete: () => {
1044
- setIncludedFiles((prev) => prev.filter((fp) => fp !== filePointer));
1092
+ setIncludedFiles(
1093
+ (prev) => prev.filter((fp) => fp !== filePointer)
1094
+ );
1045
1095
  }
1046
1096
  },
1047
1097
  `file-${filePointer.sourceApplication}.${filePointer.name}`
@@ -1049,7 +1099,10 @@ var IncludedFilesPreview = ({
1049
1099
  }) })
1050
1100
  ] });
1051
1101
  };
1052
- var FileChipPreview = ({ filePointer, onDelete }) => {
1102
+ var FileChipPreview = ({
1103
+ filePointer,
1104
+ onDelete
1105
+ }) => {
1053
1106
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1054
1107
  import_Chip.default,
1055
1108
  {
@@ -1079,9 +1132,7 @@ var HoveringInsertionPromptBoxCore = ({
1079
1132
  const [editSuggestion, setEditSuggestion] = (0, import_react8.useState)("");
1080
1133
  const [suggestionIsLoading, setSuggestionIsLoading] = (0, import_react8.useState)(false);
1081
1134
  const [adjustmentPrompt, setAdjustmentPrompt] = (0, import_react8.useState)("");
1082
- const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(
1083
- null
1084
- );
1135
+ const [generatingSuggestion, setGeneratingSuggestion] = (0, import_react8.useState)(null);
1085
1136
  const adjustmentTextAreaRef = (0, import_react8.useRef)(null);
1086
1137
  const suggestionTextAreaRef = (0, import_react8.useRef)(null);
1087
1138
  const [filePointers, setFilePointers] = (0, import_react8.useState)([]);
@@ -1243,7 +1294,13 @@ var HoveringInsertionPromptBoxCore = ({
1243
1294
  const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
1244
1295
  return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
1245
1296
  AdjustmentPromptComponent,
1246
- filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(IncludedFilesPreview, { includedFiles: filePointers, setIncludedFiles: setFilePointers }),
1297
+ filePointers.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1298
+ IncludedFilesPreview,
1299
+ {
1300
+ includedFiles: filePointers,
1301
+ setIncludedFiles: setFilePointers
1302
+ }
1303
+ ),
1247
1304
  sourceSearchWord !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
1248
1305
  SourceSearchBox,
1249
1306
  {
@@ -1251,7 +1308,9 @@ var HoveringInsertionPromptBoxCore = ({
1251
1308
  suggestedFiles,
1252
1309
  onSelectedFile: (filePointer) => {
1253
1310
  var _a;
1254
- setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), ""));
1311
+ setAdjustmentPrompt(
1312
+ adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), "")
1313
+ );
1255
1314
  setFilePointers((prev) => [...prev, filePointer]);
1256
1315
  (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
1257
1316
  }
@@ -1593,7 +1652,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
1593
1652
  ];
1594
1653
  }, [valueOnInitialRender]);
1595
1654
  const editor = useCopilotTextareaEditor();
1596
- const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
1655
+ const {
1656
+ isDisplayed: hoveringEditorIsDisplayed,
1657
+ setIsDisplayed: setHoveringEditorIsDisplayed
1658
+ } = useHoveringEditorContext();
1597
1659
  const insertText = (0, import_react12.useCallback)(
1598
1660
  (autosuggestion) => {
1599
1661
  import_slate10.Editor.insertText(editor, autosuggestion.text, {
@@ -1626,7 +1688,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
1626
1688
  const onKeyDownHandlerForHoveringEditor = (0, import_react12.useCallback)(
1627
1689
  (event) => {
1628
1690
  var _a2;
1629
- if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
1691
+ if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(
1692
+ event,
1693
+ (_a2 = props.shortcut) != null ? _a2 : "k"
1694
+ )) {
1630
1695
  event.preventDefault();
1631
1696
  setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
1632
1697
  }
@@ -1698,7 +1763,10 @@ var BaseCopilotTextareaWithHoveringContext = import_react12.default.forwardRef(
1698
1763
  const baseClassName = "copilot-textarea";
1699
1764
  const brandingClass = disableBranding ? "no-branding" : "with-branding";
1700
1765
  const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
1701
- const mergedClassName = (0, import_tailwind_merge2.twMerge)(defaultTailwindClassName, className != null ? className : "");
1766
+ const mergedClassName = (0, import_tailwind_merge2.twMerge)(
1767
+ defaultTailwindClassName,
1768
+ className != null ? className : ""
1769
+ );
1702
1770
  return `${baseClassName} ${brandingClass} ${mergedClassName}`;
1703
1771
  })();
1704
1772
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
@@ -1807,7 +1875,12 @@ function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategorie
1807
1875
  const runtimeClient = { generateCopilotResponse: (...args) => {
1808
1876
  } };
1809
1877
  const { getContextString, copilotApiConfig } = (0, import_react_core3.useCopilotContext)();
1810
- const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
1878
+ const {
1879
+ chatApiEndpoint: url,
1880
+ publicApiKey,
1881
+ credentials,
1882
+ properties
1883
+ } = copilotApiConfig;
1811
1884
  const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [import_shared2.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
1812
1885
  const { maxTokens, stop, temperature = 0 } = apiConfig;
1813
1886
  return (0, import_react13.useCallback)(
@@ -2076,8 +2149,10 @@ var import_react_core5 = require("@copilotkit/react-core");
2076
2149
  var import_react14 = require("react");
2077
2150
  var import_runtime_client_gql5 = require("@copilotkit/runtime-client-gql");
2078
2151
  function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
2079
- const runtimeClient = { generateCopilotResponse: (...args) => {
2080
- } };
2152
+ const runtimeClient = {
2153
+ generateCopilotResponse: (...args) => {
2154
+ }
2155
+ };
2081
2156
  const { getContextString, copilotApiConfig } = (0, import_react_core5.useCopilotContext)();
2082
2157
  const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [import_shared3.COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: copilotApiConfig.publicApiKey } : {});
2083
2158
  function runtimeClientResponseToStringStream(responsePromise) {
@@ -2093,7 +2168,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2093
2168
  if (done) {
2094
2169
  break;
2095
2170
  }
2096
- const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(value.generateCopilotResponse.messages);
2171
+ const messages = (0, import_runtime_client_gql5.convertGqlOutputToMessages)(
2172
+ value.generateCopilotResponse.messages
2173
+ );
2097
2174
  let newContent = "";
2098
2175
  for (const message of messages) {
2099
2176
  if (message.isTextMessage()) {
@@ -2144,7 +2221,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2144
2221
  actions: [],
2145
2222
  url: window.location.href
2146
2223
  },
2147
- messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
2224
+ messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
2225
+ (0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
2226
+ ),
2148
2227
  metadata: {
2149
2228
  requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
2150
2229
  }
@@ -2194,7 +2273,9 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2194
2273
  actions: [],
2195
2274
  url: window.location.href
2196
2275
  },
2197
- messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)((0, import_runtime_client_gql5.filterAgentStateMessages)(messages)),
2276
+ messages: (0, import_runtime_client_gql5.convertMessagesToGqlInput)(
2277
+ (0, import_runtime_client_gql5.filterAgentStateMessages)(messages)
2278
+ ),
2198
2279
  metadata: {
2199
2280
  requestType: import_runtime_client_gql5.CopilotRequestType.TextareaCompletion
2200
2281
  }
@@ -2211,9 +2292,19 @@ function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCateg
2211
2292
  const insertionOrEditingFunction = (0, import_react14.useCallback)(
2212
2293
  (editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
2213
2294
  if (editorState2.selectedText === "") {
2214
- return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
2295
+ return yield insertionFunction(
2296
+ editorState2,
2297
+ insertionPrompt,
2298
+ documents,
2299
+ abortSignal
2300
+ );
2215
2301
  } else {
2216
- return yield editingFunction(editorState2, insertionPrompt, documents, abortSignal);
2302
+ return yield editingFunction(
2303
+ editorState2,
2304
+ insertionPrompt,
2305
+ documents,
2306
+ abortSignal
2307
+ );
2217
2308
  }
2218
2309
  }),
2219
2310
  [insertionFunction, editingFunction]
@@ -2226,7 +2317,11 @@ var import_lodash = __toESM(require("lodash.merge"));
2226
2317
  var import_jsx_runtime15 = require("react/jsx-runtime");
2227
2318
  var CopilotTextarea = import_react15.default.forwardRef(
2228
2319
  (props, ref) => {
2229
- const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
2320
+ const _a = props, {
2321
+ autosuggestionsConfig: autosuggestionsConfigUserSpecified
2322
+ } = _a, forwardedProps = __objRest(_a, [
2323
+ "autosuggestionsConfig"
2324
+ ]);
2230
2325
  const autosuggestionsConfig = (0, import_lodash.default)(
2231
2326
  defaultAutosuggestionsConfig,
2232
2327
  autosuggestionsConfigUserSpecified