@copilotkit/react-textarea 1.3.0 → 1.3.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 (335) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunk-224UKA7C.mjs +38 -0
  3. package/dist/chunk-224UKA7C.mjs.map +1 -0
  4. package/dist/chunk-23Q6A46J.mjs +103 -0
  5. package/dist/chunk-23Q6A46J.mjs.map +1 -0
  6. package/dist/chunk-2C7O2EVM.mjs +27 -0
  7. package/dist/chunk-2C7O2EVM.mjs.map +1 -0
  8. package/dist/chunk-2QDCE7PD.mjs +32 -0
  9. package/dist/chunk-2QDCE7PD.mjs.map +1 -0
  10. package/dist/chunk-2XDYLKPH.mjs +181 -0
  11. package/dist/chunk-2XDYLKPH.mjs.map +1 -0
  12. package/dist/chunk-3PQ7GSFE.mjs +17 -0
  13. package/dist/chunk-3PQ7GSFE.mjs.map +1 -0
  14. package/dist/chunk-4AMCUMC7.mjs +124 -0
  15. package/dist/chunk-4AMCUMC7.mjs.map +1 -0
  16. package/dist/chunk-4CVSOOJY.mjs +30 -0
  17. package/dist/chunk-4CVSOOJY.mjs.map +1 -0
  18. package/dist/chunk-4NHVQZ67.mjs +108 -0
  19. package/dist/chunk-4NHVQZ67.mjs.map +1 -0
  20. package/dist/chunk-4PDYALMP.mjs +52 -0
  21. package/dist/chunk-4PDYALMP.mjs.map +1 -0
  22. package/dist/chunk-5UNJXFUO.mjs +29 -0
  23. package/dist/chunk-5UNJXFUO.mjs.map +1 -0
  24. package/dist/chunk-7LSRNPNI.mjs +59 -0
  25. package/dist/chunk-7LSRNPNI.mjs.map +1 -0
  26. package/dist/chunk-AJ5OMEXM.mjs +13 -0
  27. package/dist/chunk-AJ5OMEXM.mjs.map +1 -0
  28. package/dist/chunk-CF5GISTC.mjs +113 -0
  29. package/dist/chunk-CF5GISTC.mjs.map +1 -0
  30. package/dist/chunk-D2SUDM2O.mjs +99 -0
  31. package/dist/chunk-D2SUDM2O.mjs.map +1 -0
  32. package/dist/chunk-D47EKHIF.mjs +26 -0
  33. package/dist/chunk-D47EKHIF.mjs.map +1 -0
  34. package/dist/chunk-DE5K76I2.mjs +1 -0
  35. package/dist/chunk-DE5K76I2.mjs.map +1 -0
  36. package/dist/chunk-DFTV4TST.mjs +36 -0
  37. package/dist/chunk-DFTV4TST.mjs.map +1 -0
  38. package/dist/chunk-DRV2FOHZ.mjs +70 -0
  39. package/dist/chunk-DRV2FOHZ.mjs.map +1 -0
  40. package/dist/chunk-ECR45NSD.mjs +104 -0
  41. package/dist/chunk-ECR45NSD.mjs.map +1 -0
  42. package/dist/chunk-EJGGLWWR.mjs +82 -0
  43. package/dist/chunk-EJGGLWWR.mjs.map +1 -0
  44. package/dist/chunk-FYCQE57K.mjs +60 -0
  45. package/dist/chunk-FYCQE57K.mjs.map +1 -0
  46. package/dist/chunk-GQN2HYFJ.mjs +22 -0
  47. package/dist/chunk-GQN2HYFJ.mjs.map +1 -0
  48. package/dist/chunk-H4VKQGVU.mjs +1 -0
  49. package/dist/chunk-H4VKQGVU.mjs.map +1 -0
  50. package/dist/chunk-HL7EF7KA.mjs +32 -0
  51. package/dist/chunk-HL7EF7KA.mjs.map +1 -0
  52. package/dist/chunk-I3SPIGAI.mjs +31 -0
  53. package/dist/chunk-I3SPIGAI.mjs.map +1 -0
  54. package/dist/chunk-I72DKFHD.mjs +114 -0
  55. package/dist/chunk-I72DKFHD.mjs.map +1 -0
  56. package/dist/chunk-IU3WTXLQ.mjs +1 -0
  57. package/dist/chunk-IU3WTXLQ.mjs.map +1 -0
  58. package/dist/chunk-J62KUPFZ.mjs +264 -0
  59. package/dist/chunk-J62KUPFZ.mjs.map +1 -0
  60. package/dist/chunk-KMVGEY7Q.mjs +51 -0
  61. package/dist/chunk-KMVGEY7Q.mjs.map +1 -0
  62. package/dist/chunk-KNQIEOFP.mjs +19 -0
  63. package/dist/chunk-KNQIEOFP.mjs.map +1 -0
  64. package/dist/chunk-L7VVZH4Q.mjs +1 -0
  65. package/dist/chunk-L7VVZH4Q.mjs.map +1 -0
  66. package/dist/chunk-LQ2OWQU7.mjs +49 -0
  67. package/dist/chunk-LQ2OWQU7.mjs.map +1 -0
  68. package/dist/chunk-LYB4B6MK.mjs +19 -0
  69. package/dist/chunk-LYB4B6MK.mjs.map +1 -0
  70. package/dist/chunk-MCNXIA4Q.mjs +75 -0
  71. package/dist/chunk-MCNXIA4Q.mjs.map +1 -0
  72. package/dist/chunk-MMVDU6DF.mjs +1 -0
  73. package/dist/chunk-MMVDU6DF.mjs.map +1 -0
  74. package/dist/chunk-MRXNTQOX.mjs +59 -0
  75. package/dist/chunk-MRXNTQOX.mjs.map +1 -0
  76. package/dist/chunk-QJNFNPWH.mjs +85 -0
  77. package/dist/chunk-QJNFNPWH.mjs.map +1 -0
  78. package/dist/chunk-RUV6NBIF.mjs +1 -0
  79. package/dist/chunk-RUV6NBIF.mjs.map +1 -0
  80. package/dist/chunk-SDHH6DI6.mjs +63 -0
  81. package/dist/chunk-SDHH6DI6.mjs.map +1 -0
  82. package/dist/chunk-T6MTDQZ7.mjs +45 -0
  83. package/dist/chunk-T6MTDQZ7.mjs.map +1 -0
  84. package/dist/chunk-UGEKMSRR.mjs +225 -0
  85. package/dist/chunk-UGEKMSRR.mjs.map +1 -0
  86. package/dist/chunk-VSVQZUPW.mjs +124 -0
  87. package/dist/chunk-VSVQZUPW.mjs.map +1 -0
  88. package/dist/chunk-WADHCMPK.mjs +1 -0
  89. package/dist/chunk-WADHCMPK.mjs.map +1 -0
  90. package/dist/chunk-WGWQRALG.mjs +83 -0
  91. package/dist/chunk-WGWQRALG.mjs.map +1 -0
  92. package/dist/chunk-WJHSY5T6.mjs +1 -0
  93. package/dist/chunk-WJHSY5T6.mjs.map +1 -0
  94. package/dist/chunk-XW3ICO4S.mjs +25 -0
  95. package/dist/chunk-XW3ICO4S.mjs.map +1 -0
  96. package/dist/chunk-YLFAIYRY.mjs +50 -0
  97. package/dist/chunk-YLFAIYRY.mjs.map +1 -0
  98. package/dist/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
  99. package/dist/components/base-copilot-textarea/base-copilot-textarea.css.map +1 -0
  100. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +1 -1
  101. package/dist/components/base-copilot-textarea/base-copilot-textarea.js +114 -49
  102. package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
  103. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +36 -1687
  104. package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
  105. package/dist/components/base-copilot-textarea/render-element.d.ts +1 -1
  106. package/dist/components/base-copilot-textarea/render-element.mjs +4 -48
  107. package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
  108. package/dist/components/base-copilot-textarea/render-placeholder.d.ts +1 -1
  109. package/dist/components/base-copilot-textarea/render-placeholder.mjs +4 -46
  110. package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
  111. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js +4 -2
  112. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.js.map +1 -1
  113. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +5 -81
  114. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
  115. package/dist/components/base-copilot-textarea/use-add-branding-css.js.map +1 -1
  116. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +4 -54
  117. package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
  118. package/dist/components/copilot-textarea/copilot-textarea.css +9 -0
  119. package/dist/components/copilot-textarea/copilot-textarea.css.map +1 -0
  120. package/dist/components/copilot-textarea/copilot-textarea.d.ts +9 -3
  121. package/dist/components/copilot-textarea/copilot-textarea.js +116 -51
  122. package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
  123. package/dist/components/copilot-textarea/copilot-textarea.mjs +44 -2212
  124. package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
  125. package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +1 -1
  126. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +5 -13
  127. package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
  128. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +2 -1
  129. package/dist/components/hovering-toolbar/hovering-toolbar-components.js +21 -0
  130. package/dist/components/hovering-toolbar/hovering-toolbar-components.js.map +1 -1
  131. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +9 -111
  132. package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
  133. package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +1 -1
  134. package/dist/components/hovering-toolbar/hovering-toolbar.js +94 -31
  135. package/dist/components/hovering-toolbar/hovering-toolbar.js.map +1 -1
  136. package/dist/components/hovering-toolbar/hovering-toolbar.mjs +19 -808
  137. package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
  138. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +1 -1
  139. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js +65 -21
  140. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.js.map +1 -1
  141. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +14 -520
  142. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
  143. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +1 -1
  144. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js +68 -24
  145. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.js.map +1 -1
  146. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +15 -543
  147. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
  148. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.d.ts +16 -0
  149. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js +133 -0
  150. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.js.map +1 -0
  151. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs +12 -0
  152. package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -0
  153. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js +68 -24
  154. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.js.map +1 -1
  155. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +16 -543
  156. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
  157. package/dist/components/index.css +9 -0
  158. package/dist/components/index.css.map +1 -0
  159. package/dist/components/index.js +116 -51
  160. package/dist/components/index.js.map +1 -1
  161. package/dist/components/index.mjs +46 -2211
  162. package/dist/components/index.mjs.map +1 -1
  163. package/dist/components/manual-ui/chip-with-icon.d.ts +1 -1
  164. package/dist/components/manual-ui/chip-with-icon.mjs +2 -0
  165. package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
  166. package/dist/components/source-search-box/source-search-box.d.ts +1 -1
  167. package/dist/components/source-search-box/source-search-box.js +4 -2
  168. package/dist/components/source-search-box/source-search-box.js.map +1 -1
  169. package/dist/components/source-search-box/source-search-box.mjs +8 -200
  170. package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
  171. package/dist/components/ui/button.d.ts +1 -1
  172. package/dist/components/ui/button.mjs +6 -76
  173. package/dist/components/ui/button.mjs.map +1 -1
  174. package/dist/components/ui/command.mjs +14 -233
  175. package/dist/components/ui/command.mjs.map +1 -1
  176. package/dist/components/ui/dialog.mjs +11 -135
  177. package/dist/components/ui/dialog.mjs.map +1 -1
  178. package/dist/components/ui/label.mjs +5 -51
  179. package/dist/components/ui/label.mjs.map +1 -1
  180. package/dist/context/index.d.ts +1 -1
  181. package/dist/context/index.mjs +1 -0
  182. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +1 -1
  183. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.js.map +1 -1
  184. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +7 -152
  185. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
  186. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +5 -165
  187. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
  188. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
  189. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +6 -141
  190. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
  191. package/dist/hooks/index.d.ts +1 -1
  192. package/dist/hooks/index.mjs +1 -0
  193. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.js.map +1 -1
  194. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +4 -139
  195. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
  196. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.js.map +1 -1
  197. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +4 -221
  198. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
  199. package/dist/hooks/misc/use-autosize-textarea.mjs +4 -12
  200. package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
  201. package/dist/index.css +644 -1
  202. package/dist/index.css.map +1 -0
  203. package/dist/index.js +116 -58
  204. package/dist/index.js.map +1 -1
  205. package/dist/index.mjs +54 -2218
  206. package/dist/index.mjs.map +1 -1
  207. package/dist/lib/debouncer.d.ts +1 -1
  208. package/dist/lib/debouncer.js.map +1 -1
  209. package/dist/lib/debouncer.mjs +4 -48
  210. package/dist/lib/debouncer.mjs.map +1 -1
  211. package/dist/lib/editor-to-text.mjs +4 -40
  212. package/dist/lib/editor-to-text.mjs.map +1 -1
  213. package/dist/lib/get-text-around-cursor.d.ts +1 -1
  214. package/dist/lib/get-text-around-cursor.mjs +7 -96
  215. package/dist/lib/get-text-around-cursor.mjs.map +1 -1
  216. package/dist/lib/retry.mjs +4 -14
  217. package/dist/lib/retry.mjs.map +1 -1
  218. package/dist/lib/slatejs-edits/add-autocompletions.mjs +4 -22
  219. package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
  220. package/dist/lib/slatejs-edits/clear-autocompletions.js.map +1 -1
  221. package/dist/lib/slatejs-edits/clear-autocompletions.mjs +4 -17
  222. package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
  223. package/dist/lib/slatejs-edits/replace-text.mjs +4 -24
  224. package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
  225. package/dist/lib/slatejs-edits/with-partial-history.d.ts +1 -1
  226. package/dist/lib/slatejs-edits/with-partial-history.mjs +5 -102
  227. package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
  228. package/dist/lib/stream-promise-flatten.js.map +1 -1
  229. package/dist/lib/stream-promise-flatten.mjs +4 -44
  230. package/dist/lib/stream-promise-flatten.mjs.map +1 -1
  231. package/dist/lib/utils.mjs +8 -58
  232. package/dist/lib/utils.mjs.map +1 -1
  233. package/dist/lib/utils.test.d.ts +1 -1
  234. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +1 -1
  235. package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +1 -1
  236. package/dist/types/autosuggestions-config/autosuggestions-config.js.map +1 -1
  237. package/dist/types/autosuggestions-config/autosuggestions-config.mjs +9 -258
  238. package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
  239. package/dist/types/autosuggestions-config/editing-api-config.d.ts +1 -1
  240. package/dist/types/autosuggestions-config/editing-api-config.js.map +1 -1
  241. package/dist/types/autosuggestions-config/editing-api-config.mjs +6 -75
  242. package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
  243. package/dist/types/autosuggestions-config/index.js.map +1 -1
  244. package/dist/types/autosuggestions-config/index.mjs +10 -258
  245. package/dist/types/autosuggestions-config/index.mjs.map +1 -1
  246. package/dist/types/autosuggestions-config/insertions-api-config.d.ts +1 -1
  247. package/dist/types/autosuggestions-config/insertions-api-config.js.map +1 -1
  248. package/dist/types/autosuggestions-config/insertions-api-config.mjs +6 -68
  249. package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
  250. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +1 -1
  251. package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +1 -1
  252. package/dist/types/autosuggestions-config/suggestions-api-config.js.map +1 -1
  253. package/dist/types/autosuggestions-config/suggestions-api-config.mjs +6 -56
  254. package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
  255. package/dist/types/base/autosuggestion-state.d.ts +1 -1
  256. package/dist/types/base/autosuggestions-bare-function.d.ts +1 -1
  257. package/dist/types/base/base-autosuggestions-config.d.ts +1 -1
  258. package/dist/types/base/base-autosuggestions-config.mjs +4 -25
  259. package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
  260. package/dist/types/base/custom-editor.d.ts +1 -1
  261. package/dist/types/base/editor-autocomplete-state.d.ts +1 -1
  262. package/dist/types/base/editor-autocomplete-state.mjs +5 -9
  263. package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
  264. package/dist/types/base/index.d.ts +1 -1
  265. package/dist/types/base/index.mjs +5 -25
  266. package/dist/types/base/index.mjs.map +1 -1
  267. package/dist/types/html-copilot-textarea-element.d.ts +1 -1
  268. package/dist/types/html-copilot-textarea-element.mjs +1 -0
  269. package/dist/types/index.js.map +1 -1
  270. package/dist/types/index.mjs +14 -258
  271. package/dist/types/index.mjs.map +1 -1
  272. package/package.json +11 -17
  273. package/src/components/base-copilot-textarea/base-copilot-textarea.css +9 -0
  274. package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +1 -0
  275. package/src/components/copilot-textarea/copilot-textarea.tsx +8 -2
  276. package/src/components/hovering-toolbar/hovering-toolbar-components.tsx +17 -0
  277. package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +7 -4
  278. package/src/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.tsx +55 -0
  279. package/src/styles.css +2 -9
  280. package/tsup.config.ts +15 -63
  281. package/dist/components/base-copilot-textarea/base-copilot-textarea.d.mts +0 -43
  282. package/dist/components/base-copilot-textarea/render-element.d.mts +0 -6
  283. package/dist/components/base-copilot-textarea/render-placeholder.d.mts +0 -6
  284. package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.mts +0 -8
  285. package/dist/components/base-copilot-textarea/use-add-branding-css.d.mts +0 -3
  286. package/dist/components/copilot-textarea/copilot-textarea.d.mts +0 -165
  287. package/dist/components/hovering-toolbar/hovering-editor-provider.d.mts +0 -18
  288. package/dist/components/hovering-toolbar/hovering-toolbar-components.d.mts +0 -17
  289. package/dist/components/hovering-toolbar/hovering-toolbar.d.mts +0 -12
  290. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.mts +0 -16
  291. package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.mts +0 -14
  292. package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.mts +0 -4
  293. package/dist/components/index.d.mts +0 -15
  294. package/dist/components/manual-ui/chip-with-icon.d.mts +0 -10
  295. package/dist/components/source-search-box/source-search-box.d.mts +0 -16
  296. package/dist/components/ui/button.d.mts +0 -14
  297. package/dist/components/ui/command.d.mts +0 -53
  298. package/dist/components/ui/dialog.d.mts +0 -19
  299. package/dist/components/ui/label.d.mts +0 -8
  300. package/dist/context/index.d.mts +0 -2
  301. package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.mts +0 -15
  302. package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.mts +0 -8
  303. package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.mts +0 -7
  304. package/dist/hooks/index.d.mts +0 -2
  305. package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.mts +0 -22
  306. package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.mts +0 -23
  307. package/dist/hooks/misc/use-autosize-textarea.d.mts +0 -5
  308. package/dist/index.d.mts +0 -15
  309. package/dist/lib/debouncer.d.mts +0 -11
  310. package/dist/lib/editor-to-text.d.mts +0 -7
  311. package/dist/lib/get-text-around-cursor.d.mts +0 -15
  312. package/dist/lib/retry.d.mts +0 -3
  313. package/dist/lib/slatejs-edits/add-autocompletions.d.mts +0 -8
  314. package/dist/lib/slatejs-edits/clear-autocompletions.d.mts +0 -8
  315. package/dist/lib/slatejs-edits/replace-text.d.mts +0 -5
  316. package/dist/lib/slatejs-edits/with-partial-history.d.mts +0 -8
  317. package/dist/lib/stream-promise-flatten.d.mts +0 -12
  318. package/dist/lib/utils.d.mts +0 -9
  319. package/dist/lib/utils.test.d.mts +0 -2
  320. package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.mts +0 -23
  321. package/dist/types/autosuggestions-config/autosuggestions-config.d.mts +0 -20
  322. package/dist/types/autosuggestions-config/editing-api-config.d.mts +0 -15
  323. package/dist/types/autosuggestions-config/index.d.mts +0 -10
  324. package/dist/types/autosuggestions-config/insertions-api-config.d.mts +0 -15
  325. package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.mts +0 -3
  326. package/dist/types/autosuggestions-config/suggestions-api-config.d.mts +0 -14
  327. package/dist/types/base/autosuggestion-state.d.mts +0 -8
  328. package/dist/types/base/autosuggestions-bare-function.d.mts +0 -19
  329. package/dist/types/base/base-autosuggestions-config.d.mts +0 -83
  330. package/dist/types/base/base-copilot-textarea-props.d.mts +0 -5
  331. package/dist/types/base/custom-editor.d.mts +0 -29
  332. package/dist/types/base/editor-autocomplete-state.d.mts +0 -10
  333. package/dist/types/base/index.d.mts +0 -54
  334. package/dist/types/html-copilot-textarea-element.d.mts +0 -7
  335. package/dist/types/index.d.mts +0 -13
@@ -1,2216 +1,51 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
- var __async = (__this, __arguments, generator) => {
33
- return new Promise((resolve, reject) => {
34
- var fulfilled = (value) => {
35
- try {
36
- step(generator.next(value));
37
- } catch (e) {
38
- reject(e);
39
- }
40
- };
41
- var rejected = (value) => {
42
- try {
43
- step(generator.throw(value));
44
- } catch (e) {
45
- reject(e);
46
- }
47
- };
48
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
49
- step((generator = generator.apply(__this, __arguments)).next());
50
- });
51
- };
52
-
53
- // src/components/base-copilot-textarea/base-copilot-textarea.tsx
54
- import React6, { useCallback as useCallback3, useEffect as useEffect7, useMemo as useMemo3, useState as useState6 } from "react";
55
- import { Editor as Editor5 } from "slate";
56
- import { Editable, Slate } from "slate-react";
57
- import { twMerge as twMerge2 } from "tailwind-merge";
58
-
59
- // src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts
60
- import { useCallback, useEffect, useMemo, useState } from "react";
61
-
62
- // src/lib/debouncer.ts
63
- var Debouncer = class {
64
- constructor(wait) {
65
- this.wait = wait;
66
- this.debounce = (func, ...args) => __async(this, null, function* () {
67
- this.cancel();
68
- this.timeoutId = setTimeout(() => __async(this, null, function* () {
69
- try {
70
- this.activeAbortController = new AbortController();
71
- yield func(...args, this.activeAbortController.signal);
72
- this.activeAbortController = void 0;
73
- } catch (error) {
74
- }
75
- }), this.wait);
76
- });
77
- this.cancel = () => {
78
- if (this.activeAbortController) {
79
- this.activeAbortController.abort();
80
- this.activeAbortController = void 0;
81
- }
82
- if (this.timeoutId !== void 0) {
83
- clearTimeout(this.timeoutId);
84
- this.timeoutId = void 0;
85
- }
86
- };
87
- }
88
- };
89
-
90
- // src/lib/utils.ts
91
- import { clsx } from "clsx";
92
- import { twMerge } from "tailwind-merge";
93
- function cn(...inputs) {
94
- return twMerge(clsx(inputs));
95
- }
96
- var arraysAreEqual = (arr1, arr2) => arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
97
- function nullableCompatibleEqualityCheck(naiveEqualityCheck, a, b) {
98
- if (a === null || a === void 0 || b === null || b === void 0) {
99
- return a === b;
100
- }
101
- return naiveEqualityCheck(a, b);
102
- }
103
-
104
- // src/types/base/editor-autocomplete-state.ts
105
- function areEqual_autocompleteState(prev, next) {
106
- return prev.cursorPoint.offset === next.cursorPoint.offset && arraysAreEqual(prev.cursorPoint.path, next.cursorPoint.path) && prev.textBeforeCursor === next.textBeforeCursor && prev.textAfterCursor === next.textAfterCursor;
107
- }
108
-
109
- // src/hooks/base-copilot-textarea-implementation/use-autosuggestions.ts
110
- function useAutosuggestions(debounceTime, shouldAcceptAutosuggestionOnKeyPress, shouldAcceptAutosuggestionOnTouch, autosuggestionFunction, insertAutocompleteSuggestion, disableWhenEmpty, disabled) {
111
- const [previousAutocompleteState, setPreviousAutocompleteState] = useState(null);
112
- const [currentAutocompleteSuggestion, setCurrentAutocompleteSuggestion] = useState(null);
113
- const awaitForAndAppendSuggestion = useCallback(
114
- (editorAutocompleteState, abortSignal) => __async(this, null, function* () {
115
- if (disabled) {
116
- return;
117
- }
118
- if (disableWhenEmpty && editorAutocompleteState.textBeforeCursor === "" && editorAutocompleteState.textAfterCursor === "") {
119
- return;
120
- }
121
- const suggestion = yield autosuggestionFunction(editorAutocompleteState, abortSignal);
122
- if (!suggestion || abortSignal.aborted) {
123
- throw new DOMException("Aborted", "AbortError");
124
- }
125
- setCurrentAutocompleteSuggestion({
126
- text: suggestion,
127
- point: editorAutocompleteState.cursorPoint
128
- });
129
- }),
130
- [autosuggestionFunction, setCurrentAutocompleteSuggestion, disableWhenEmpty, disabled]
131
- );
132
- const debouncedFunction = useMemo(
133
- () => new Debouncer(debounceTime),
134
- [debounceTime]
135
- );
136
- useEffect(() => {
137
- return () => {
138
- debouncedFunction.cancel();
139
- setCurrentAutocompleteSuggestion(null);
140
- };
141
- }, [debouncedFunction, disabled]);
142
- const onChange = useCallback(
143
- (newEditorState) => {
144
- const editorStateHasChanged = !nullableCompatibleEqualityCheck(
145
- areEqual_autocompleteState,
146
- previousAutocompleteState,
147
- newEditorState
148
- );
149
- setPreviousAutocompleteState(newEditorState);
150
- if (!editorStateHasChanged) {
151
- return;
152
- }
153
- setCurrentAutocompleteSuggestion(null);
154
- if (newEditorState) {
155
- debouncedFunction.debounce(awaitForAndAppendSuggestion, newEditorState);
156
- } else {
157
- debouncedFunction.cancel();
158
- }
159
- },
160
- [
161
- previousAutocompleteState,
162
- setPreviousAutocompleteState,
163
- debouncedFunction,
164
- awaitForAndAppendSuggestion,
165
- setCurrentAutocompleteSuggestion
166
- ]
167
- );
168
- const keyDownOrTouchHandler = useCallback(
169
- (event) => {
170
- if (currentAutocompleteSuggestion) {
171
- const shouldAcceptSuggestion = event.type === "touchstart" ? shouldAcceptAutosuggestionOnTouch(event) : shouldAcceptAutosuggestionOnKeyPress(event);
172
- if (shouldAcceptSuggestion) {
173
- event.preventDefault();
174
- insertAutocompleteSuggestion(currentAutocompleteSuggestion);
175
- setCurrentAutocompleteSuggestion(null);
176
- }
177
- }
178
- },
179
- [
180
- currentAutocompleteSuggestion,
181
- setCurrentAutocompleteSuggestion,
182
- insertAutocompleteSuggestion,
183
- shouldAcceptAutosuggestionOnKeyPress
184
- ]
185
- );
186
- return {
187
- currentAutocompleteSuggestion,
188
- onChangeHandler: onChange,
189
- onKeyDownHandler: keyDownOrTouchHandler,
190
- onTouchStartHandler: keyDownOrTouchHandler
191
- };
192
- }
193
-
194
- // src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx
195
- import { useMemo as useMemo2 } from "react";
196
- import { createEditor, Element } from "slate";
197
- import { withReact } from "slate-react";
198
-
199
- // src/lib/slatejs-edits/with-partial-history.ts
200
- import { Editor, Operation, Path, Transforms } from "slate";
201
- import { HistoryEditor } from "slate-history";
202
- var withPartialHistory = (editor, shouldSave2) => {
203
- const e = editor;
204
- const { apply } = e;
205
- e.history = { undos: [], redos: [] };
206
- e.redo = () => {
207
- const { history } = e;
208
- const { redos } = history;
209
- if (redos.length > 0) {
210
- const batch = redos[redos.length - 1];
211
- if (batch.selectionBefore) {
212
- Transforms.setSelection(e, batch.selectionBefore);
213
- }
214
- HistoryEditor.withoutSaving(e, () => {
215
- Editor.withoutNormalizing(e, () => {
216
- for (const op of batch.operations) {
217
- e.apply(op);
218
- }
219
- });
220
- });
221
- history.redos.pop();
222
- e.writeHistory("undos", batch);
223
- }
224
- };
225
- e.undo = () => {
226
- const { history } = e;
227
- const { undos } = history;
228
- if (undos.length > 0) {
229
- const batch = undos[undos.length - 1];
230
- HistoryEditor.withoutSaving(e, () => {
231
- Editor.withoutNormalizing(e, () => {
232
- const inverseOps = batch.operations.map(Operation.inverse).reverse();
233
- for (const op of inverseOps) {
234
- e.apply(op);
235
- }
236
- if (batch.selectionBefore) {
237
- Transforms.setSelection(e, batch.selectionBefore);
238
- }
239
- });
240
- });
241
- e.writeHistory("redos", batch);
242
- history.undos.pop();
243
- }
244
- };
245
- e.apply = (op) => {
246
- const { operations, history } = e;
247
- const { undos } = history;
248
- const lastBatch = undos[undos.length - 1];
249
- const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
250
- let save = HistoryEditor.isSaving(e);
251
- let merge2 = HistoryEditor.isMerging(e);
252
- if (save == null) {
253
- save = shouldSave2(op, lastOp);
254
- }
255
- if (save) {
256
- if (merge2 == null) {
257
- if (lastBatch == null) {
258
- merge2 = false;
259
- } else if (operations.length !== 0) {
260
- merge2 = true;
261
- } else {
262
- merge2 = shouldMerge(op, lastOp);
263
- }
264
- }
265
- if (lastBatch && merge2) {
266
- lastBatch.operations.push(op);
267
- } else {
268
- const batch = {
269
- operations: [op],
270
- selectionBefore: e.selection
271
- };
272
- e.writeHistory("undos", batch);
273
- }
274
- while (undos.length > 100) {
275
- undos.shift();
276
- }
277
- history.redos = [];
278
- }
279
- apply(op);
280
- };
281
- e.writeHistory = (stack, batch) => {
282
- e.history[stack].push(batch);
283
- };
284
- return e;
285
- };
286
- var shouldMerge = (op, prev) => {
287
- if (prev && op.type === "insert_text" && prev.type === "insert_text" && op.offset === prev.offset + prev.text.length && Path.equals(op.path, prev.path)) {
288
- return true;
289
- }
290
- if (prev && op.type === "remove_text" && prev.type === "remove_text" && op.offset + op.text.length === prev.offset && Path.equals(op.path, prev.path)) {
291
- return true;
292
- }
293
- return false;
294
- };
295
- var defaultShouldSave = (op, prev) => {
296
- if (op.type === "set_selection") {
297
- return false;
298
- }
299
- return true;
300
- };
301
-
302
- // src/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.tsx
303
- var shouldSave = (op, prev) => {
304
- const excludedNodeType = "suggestion";
305
- if (op.type === "insert_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
306
- return false;
307
- }
308
- if (op.type === "remove_node" && Element.isElement(op.node) && op.node.type === excludedNodeType) {
309
- return false;
310
- }
311
- if (op.type === "set_node" && "type" in op.newProperties && op.newProperties.type === excludedNodeType) {
312
- return false;
313
- }
314
- if (op.type == "set_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
315
- return false;
316
- }
317
- if (op.type === "merge_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
318
- return false;
319
- }
320
- if (op.type === "split_node" && "type" in op.properties && op.properties.type === excludedNodeType) {
321
- return false;
322
- }
323
- return defaultShouldSave(op, prev);
324
- };
325
- function useCopilotTextareaEditor() {
326
- const editor = useMemo2(() => {
327
- const editor2 = withPartialHistory(withReact(createEditor()), shouldSave);
328
- const { isVoid } = editor2;
329
- editor2.isVoid = (element) => {
330
- switch (element.type) {
331
- case "suggestion":
332
- return true;
333
- default:
334
- return isVoid(element);
335
- }
336
- };
337
- const { markableVoid } = editor2;
338
- editor2.markableVoid = (element) => {
339
- switch (element.type) {
340
- case "suggestion":
341
- return true;
342
- default:
343
- return markableVoid(element);
344
- }
345
- };
346
- const { isInline } = editor2;
347
- editor2.isInline = (element) => {
348
- switch (element.type) {
349
- case "suggestion":
350
- return element.inline;
351
- default:
352
- return isInline(element);
353
- }
354
- };
355
- return editor2;
356
- }, []);
357
- return editor;
358
- }
359
-
360
- // src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts
361
- import React from "react";
362
- import { ReactEditor } from "slate-react";
363
-
364
- // src/lib/get-text-around-cursor.ts
365
- import { Editor as Editor2, Path as Path2, Range as Range2, Text, Element as Element2, Point } from "slate";
366
- function getTextAroundCollapsedCursor(editor) {
367
- const { selection } = editor;
368
- if (!selection || !Range2.isCollapsed(selection)) {
369
- return null;
370
- }
371
- const cursorPoint = selection.anchor;
372
- const beforeRange = {
373
- anchor: Editor2.start(editor, []),
374
- focus: cursorPoint
375
- };
376
- const afterRange = {
377
- anchor: cursorPoint,
378
- focus: Editor2.end(editor, [])
379
- };
380
- const before = extractTextWithNewlines(editor, beforeRange);
381
- const after = extractTextWithNewlines(editor, afterRange);
382
- return {
383
- cursorPoint,
384
- textBeforeCursor: before,
385
- textAfterCursor: after
386
- };
387
- }
388
- function getTextAroundSelection(editor) {
389
- const { selection } = editor;
390
- if (!selection) {
391
- return null;
392
- }
393
- const wellOrderedSelection = wellOrderedRange(selection);
394
- const beforeRange = {
395
- anchor: Editor2.start(editor, []),
396
- focus: wellOrderedSelection.anchor
397
- };
398
- const afterRange = {
399
- anchor: wellOrderedSelection.focus,
400
- focus: Editor2.end(editor, [])
401
- };
402
- const before = extractTextWithNewlines(editor, beforeRange);
403
- const after = extractTextWithNewlines(editor, afterRange);
404
- const selectedText = extractTextWithNewlines(editor, wellOrderedSelection);
405
- return {
406
- selection: wellOrderedSelection,
407
- textBeforeCursor: before,
408
- selectedText,
409
- textAfterCursor: after
410
- };
411
- }
412
- function getFullEditorTextWithNewlines(editor) {
413
- const fullDocumentRange = {
414
- anchor: Editor2.start(editor, []),
415
- focus: Editor2.end(editor, [])
416
- };
417
- return extractTextWithNewlines(editor, fullDocumentRange);
418
- }
419
- function extractTextWithNewlines(editor, range) {
420
- const voids = false;
421
- const [start, end] = Range2.edges(range);
422
- let text = "";
423
- let lastBlock = null;
424
- for (const [node, path] of Editor2.nodes(editor, {
425
- at: range,
426
- match: Text.isText,
427
- voids
428
- })) {
429
- let t = node.text;
430
- const [block] = Editor2.above(editor, {
431
- at: path,
432
- match: (n) => Element2.isElement(n) && n.type === "paragraph"
433
- }) || [null];
434
- if (lastBlock !== block && block) {
435
- if (lastBlock) {
436
- text += "\n";
437
- }
438
- lastBlock = block;
439
- }
440
- if (Path2.equals(path, end.path)) {
441
- t = t.slice(0, end.offset);
442
- }
443
- if (Path2.equals(path, start.path)) {
444
- t = t.slice(start.offset);
445
- }
446
- text += t;
447
- }
448
- return text;
449
- }
450
- function wellOrderedRange(range) {
451
- const { anchor, focus } = range;
452
- if (Point.isBefore(anchor, focus)) {
453
- return range;
454
- }
455
- return {
456
- anchor: focus,
457
- focus: anchor
458
- };
459
- }
460
-
461
- // src/lib/slatejs-edits/replace-text.ts
462
- import { Editor as Editor3, Transforms as Transforms2 } from "slate";
463
- function replaceEditorText(editor, newText) {
464
- Transforms2.delete(editor, {
465
- at: {
466
- anchor: Editor3.start(editor, []),
467
- focus: Editor3.end(editor, [])
468
- }
469
- });
470
- if (newText && newText !== "") {
471
- Transforms2.insertNodes(
472
- editor,
473
- [
474
- {
475
- type: "paragraph",
476
- children: [{ text: newText }]
477
- }
478
- ],
479
- {
480
- at: [0]
481
- }
482
- );
483
- }
484
- }
485
-
486
- // src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts
487
- function usePopulateCopilotTextareaRef(editor, ref) {
488
- React.useImperativeHandle(ref, () => {
489
- class Combined {
490
- constructor(customMethods2, editorHtmlElement2) {
491
- this.customMethods = customMethods2;
492
- this.editorHtmlElement = editorHtmlElement2;
493
- }
494
- get(target, propKey) {
495
- if (this.isKeyOfCustomMethods(propKey)) {
496
- const value = this.customMethods[propKey];
497
- if (typeof value === "function") {
498
- return value.bind(this.customMethods);
499
- }
500
- return value;
501
- } else if (this.isKeyOfHTMLElement(propKey)) {
502
- const value = this.editorHtmlElement[propKey];
503
- if (typeof value === "function") {
504
- return value.bind(this.editorHtmlElement);
505
- }
506
- return value;
507
- }
508
- }
509
- set(target, propKey, value) {
510
- if (this.isKeyOfCustomMethods(propKey)) {
511
- this.customMethods[propKey] = value;
512
- } else if (this.isKeyOfHTMLElement(propKey)) {
513
- this.editorHtmlElement[propKey] = value;
514
- } else {
515
- target[propKey] = value;
516
- }
517
- return true;
518
- }
519
- isKeyOfCustomMethods(key) {
520
- return key in this.customMethods;
521
- }
522
- isKeyOfHTMLElement(key) {
523
- return key in this.editorHtmlElement;
524
- }
525
- }
526
- const handler = {
527
- get(target, propKey) {
528
- return target.get(target, propKey);
529
- },
530
- set(target, propKey, value) {
531
- return target.set(target, propKey, value);
532
- }
533
- };
534
- class CustomMethods {
535
- constructor(editor2) {
536
- this.editor = editor2;
537
- }
538
- focus() {
539
- ReactEditor.focus(this.editor);
540
- }
541
- blur() {
542
- ReactEditor.blur(this.editor);
543
- }
544
- get value() {
545
- return getFullEditorTextWithNewlines(this.editor);
546
- }
547
- set value(value) {
548
- replaceEditorText(this.editor, value);
549
- }
550
- }
551
- const editorHtmlElement = ReactEditor.toDOMNode(editor, editor);
552
- const customMethods = new CustomMethods(editor);
553
- const combined = new Combined(customMethods, editorHtmlElement);
554
- return new Proxy(combined, handler);
555
- }, [editor]);
556
- }
557
-
558
- // src/lib/slatejs-edits/add-autocompletions.ts
559
- import { Transforms as Transforms3 } from "slate";
560
- function addAutocompletionsToEditor(editor, newSuggestion, point) {
561
- const editorPosition = editor.selection;
562
- Transforms3.insertNodes(
563
- editor,
564
- [
565
- {
566
- type: "suggestion",
567
- inline: true,
568
- content: newSuggestion,
569
- children: [{ text: "" }]
570
- }
571
- ],
572
- {
573
- at: point
574
- }
575
- );
576
- if (editorPosition) {
577
- editor.selection = editorPosition;
578
- }
579
- }
580
-
581
- // src/lib/slatejs-edits/clear-autocompletions.ts
582
- import { Element as Element3, Node as Node2, Transforms as Transforms4 } from "slate";
583
- function clearAutocompletionsFromEditor(editor) {
584
- const paths = [];
585
- for (const [node, path] of Node2.nodes(editor)) {
586
- if (Element3.isElement(node) && node.type === "suggestion") {
587
- paths.push(path);
588
- }
589
- }
590
- for (const path of paths) {
591
- try {
592
- Transforms4.removeNodes(editor, { at: path });
593
- } catch (e) {
594
- console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
595
- }
596
- }
597
- }
598
-
599
- // src/types/base/base-autosuggestions-config.tsx
600
- import { defaultCopilotContextCategories } from "@copilotkit/react-core";
601
- var defaultShouldToggleHoveringEditorOnKeyPress = (event, shortcut) => {
602
- if (event.key === shortcut && event.metaKey) {
603
- return true;
604
- }
605
- return false;
606
- };
607
- var defaultShouldAcceptAutosuggestionOnKeyPress = (event) => {
608
- if (event.key === "Tab") {
609
- return true;
610
- }
611
- return false;
612
- };
613
- var defaultShouldAcceptAutosuggestionOnTouch = () => false;
614
- var defaultBaseAutosuggestionsConfig = {
615
- debounceTime: 250,
616
- contextCategories: defaultCopilotContextCategories,
617
- disableWhenEmpty: true,
618
- disabled: false,
619
- temporarilyDisableWhenMovingCursorWithoutChangingText: true,
620
- shouldToggleHoveringEditorOnKeyPress: defaultShouldToggleHoveringEditorOnKeyPress,
621
- shouldAcceptAutosuggestionOnKeyPress: defaultShouldAcceptAutosuggestionOnKeyPress,
622
- shouldAcceptAutosuggestionOnTouch: defaultShouldAcceptAutosuggestionOnTouch
623
- };
624
-
625
- // src/components/hovering-toolbar/hovering-toolbar.tsx
626
- import { useEffect as useEffect4, useRef as useRef2, useState as useState5 } from "react";
627
- import { Transforms as Transforms5 } from "slate";
628
- import { useSlate, useSlateSelection } from "slate-react";
629
-
630
- // src/hooks/misc/use-autosize-textarea.tsx
631
- import { useEffect as useEffect2 } from "react";
632
- var useAutosizeTextArea = (textAreaRef, value) => {
633
- useEffect2(() => {
634
- if (textAreaRef.current !== null) {
635
- textAreaRef.current.style.height = "0px";
636
- const scrollHeight = textAreaRef.current.scrollHeight;
637
- textAreaRef.current.style.height = scrollHeight + "px";
638
- }
639
- }, [textAreaRef, value]);
640
- };
641
- var use_autosize_textarea_default = useAutosizeTextArea;
642
-
643
- // src/components/source-search-box/source-search-box.tsx
644
- import { useState as useState2 } from "react";
645
-
646
- // src/components/ui/command.tsx
647
- import * as React2 from "react";
648
- import { Command as CommandPrimitive } from "cmdk";
649
- import { jsx } from "react/jsx-runtime";
650
- var Command = React2.forwardRef((_a, ref) => {
651
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
652
- return /* @__PURE__ */ jsx(
653
- CommandPrimitive,
654
- __spreadValues({
655
- ref,
656
- className: cn(
657
- "flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
658
- className
659
- )
660
- }, props)
661
- );
662
- });
663
- Command.displayName = CommandPrimitive.displayName;
664
- var CommandInput = React2.forwardRef((_a, ref) => {
665
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
666
- return /* @__PURE__ */ jsx("div", { className: "flex items-center border-b px-3", "cmdk-input-wrapper": "", children: /* @__PURE__ */ jsx(
667
- CommandPrimitive.Input,
668
- __spreadValues({
669
- ref,
670
- className: cn(
671
- "flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",
672
- className
673
- )
674
- }, props)
675
- ) });
676
- });
677
- CommandInput.displayName = CommandPrimitive.Input.displayName;
678
- var CommandList = React2.forwardRef((_a, ref) => {
679
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
680
- return /* @__PURE__ */ jsx(
681
- CommandPrimitive.List,
682
- __spreadValues({
683
- ref,
684
- className: cn("max-h-[300px] overflow-y-auto overflow-x-hidden pb-2", className)
685
- }, props)
686
- );
687
- });
688
- CommandList.displayName = CommandPrimitive.List.displayName;
689
- var CommandEmpty = React2.forwardRef((props, ref) => /* @__PURE__ */ jsx(CommandPrimitive.Empty, __spreadValues({ ref, className: "py-6 text-center text-sm" }, props)));
690
- CommandEmpty.displayName = CommandPrimitive.Empty.displayName;
691
- var CommandGroup = React2.forwardRef((_a, ref) => {
692
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
693
- return /* @__PURE__ */ jsx(
694
- CommandPrimitive.Group,
695
- __spreadValues({
696
- ref,
697
- className: cn(
698
- "overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",
699
- className
700
- )
701
- }, props)
702
- );
703
- });
704
- CommandGroup.displayName = CommandPrimitive.Group.displayName;
705
- var CommandSeparator = React2.forwardRef((_a, ref) => {
706
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
707
- return /* @__PURE__ */ jsx(
708
- CommandPrimitive.Separator,
709
- __spreadValues({
710
- ref,
711
- className: cn("-mx-1 h-px bg-border", className)
712
- }, props)
713
- );
714
- });
715
- CommandSeparator.displayName = CommandPrimitive.Separator.displayName;
716
- var CommandItem = React2.forwardRef((_a, ref) => {
717
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
718
- return /* @__PURE__ */ jsx(
719
- CommandPrimitive.Item,
720
- __spreadValues({
721
- ref,
722
- className: cn(
723
- "relative flex cursor-default select-none items-center rounded-sm text-sm outline-none aria-selected:bg-accent aria-selected:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
724
- className
725
- )
726
- }, props)
727
- );
728
- });
729
- CommandItem.displayName = CommandPrimitive.Item.displayName;
730
- var CommandShortcut = (_a) => {
731
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
732
- return /* @__PURE__ */ jsx(
733
- "span",
734
- __spreadValues({
735
- className: cn("ml-auto text-xs tracking-widest text-muted-foreground", className)
736
- }, props)
737
- );
738
- };
739
- CommandShortcut.displayName = "CommandShortcut";
740
-
741
- // src/components/source-search-box/source-search-box.tsx
742
- import { jsx as jsx2, jsxs } from "react/jsx-runtime";
743
- function SourceSearchBox(props) {
744
- const [selectedValue, setSelectedValue] = useState2("");
745
- return /* @__PURE__ */ jsxs(
746
- Command,
747
- {
748
- className: "rounded-lg border shadow-md",
749
- value: selectedValue,
750
- onValueChange: (value) => {
751
- setSelectedValue(value);
752
- },
753
- filter: (value, search) => {
754
- if (props.searchTerm === "") return 1;
755
- if (value.startsWith(props.searchTerm)) return 1;
756
- return 0;
757
- },
758
- children: [
759
- /* @__PURE__ */ jsx2(
760
- CommandInput,
761
- {
762
- value: props.searchTerm,
763
- className: "rounded-t-lg hidden",
764
- placeholder: "Search for a command..."
765
- }
766
- ),
767
- /* @__PURE__ */ jsxs(CommandList, { children: [
768
- /* @__PURE__ */ jsx2(CommandEmpty, { children: "No results found." }),
769
- /* @__PURE__ */ jsx2(CommandGroup, { heading: "Available resources", children: props.suggestedFiles.map((filePointer) => {
770
- return /* @__PURE__ */ jsx2(
771
- CommandItem,
772
- {
773
- value: filePointer.name,
774
- onSelect: (value) => {
775
- props.onSelectedFile(filePointer);
776
- },
777
- children: /* @__PURE__ */ jsxs("div", { className: " px-3 flex flex-row gap-1 items-center", children: [
778
- /* @__PURE__ */ jsx2(Logo, { width: "20px", height: "20px", children: /* @__PURE__ */ jsx2(
779
- "img",
780
- {
781
- src: filePointer.iconImageUri,
782
- alt: filePointer.sourceApplication,
783
- className: "w-full h-full"
784
- }
785
- ) }),
786
- filePointer.name
787
- ] })
788
- },
789
- `word-${filePointer.sourceApplication}.${filePointer.name}`
790
- );
791
- }) }),
792
- /* @__PURE__ */ jsx2(CommandSeparator, {})
793
- ] })
794
- ]
795
- }
796
- );
797
- }
798
- function Logo({
799
- children,
800
- width,
801
- height
802
- }) {
803
- return /* @__PURE__ */ jsx2("div", { className: "flex items-center justify-center", style: { width, height }, children });
804
- }
805
-
806
- // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
807
- import { useCopilotContext } from "@copilotkit/react-core";
808
-
809
- // src/components/ui/button.tsx
810
- import * as React3 from "react";
811
- import { Slot } from "@radix-ui/react-slot";
812
- import { cva } from "class-variance-authority";
813
- import { jsx as jsx3 } from "react/jsx-runtime";
814
- var buttonVariants = cva(
815
- "inline-flex items-center justify-center rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
816
- {
817
- variants: {
818
- variant: {
819
- default: "bg-primary text-primary-foreground hover:bg-primary/90",
820
- destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
821
- outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
822
- secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
823
- ghost: "hover:bg-accent hover:text-accent-foreground",
824
- link: "text-primary underline-offset-4 hover:underline"
825
- },
826
- size: {
827
- default: "h-10 px-4 py-2",
828
- sm: "h-9 rounded-md px-3",
829
- lg: "h-11 rounded-md px-8",
830
- icon: "h-10 w-10"
831
- }
832
- },
833
- defaultVariants: {
834
- variant: "default",
835
- size: "default"
836
- }
837
- }
838
- );
839
- var Button = React3.forwardRef(
840
- (_a, ref) => {
841
- var _b = _a, { className, variant, size, asChild = false } = _b, props = __objRest(_b, ["className", "variant", "size", "asChild"]);
842
- const Comp = asChild ? Slot : "button";
843
- return /* @__PURE__ */ jsx3(Comp, __spreadValues({ className: cn(buttonVariants({ variant, size, className })), ref }, props));
844
- }
845
- );
846
- Button.displayName = "Button";
847
-
848
- // src/components/ui/label.tsx
849
- import * as React4 from "react";
850
- import * as LabelPrimitive from "@radix-ui/react-label";
851
- import { cva as cva2 } from "class-variance-authority";
852
- import { jsx as jsx4 } from "react/jsx-runtime";
853
- var labelVariants = cva2(
854
- "text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"
855
- );
856
- var Label = React4.forwardRef((_a, ref) => {
857
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
858
- return /* @__PURE__ */ jsx4(LabelPrimitive.Root, __spreadValues({ ref, className: cn(labelVariants(), className) }, props));
859
- });
860
- Label.displayName = LabelPrimitive.Root.displayName;
861
-
862
- // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
863
- import { useCallback as useCallback2, useEffect as useEffect3, useRef, useState as useState4 } from "react";
864
-
865
- // src/lib/stream-promise-flatten.ts
866
- function streamPromiseFlatten(promise) {
867
- return new ReadableStream({
868
- start(controller) {
869
- return __async(this, null, function* () {
870
- try {
871
- const stream = yield promise;
872
- const reader = stream.getReader();
873
- while (true) {
874
- const { done, value } = yield reader.read();
875
- if (done) {
876
- controller.close();
877
- return;
878
- }
879
- controller.enqueue(value);
880
- }
881
- } catch (error) {
882
- controller.error(error);
883
- }
884
- });
885
- }
886
- });
887
- }
888
-
889
- // src/components/hovering-toolbar/hovering-editor-provider.tsx
890
- import { createContext, useState as useState3, useContext } from "react";
891
- import { jsx as jsx5 } from "react/jsx-runtime";
892
- var HoveringEditorContext = createContext({
893
- isDisplayed: false,
894
- setIsDisplayed: () => {
895
- }
896
- });
897
- var HoveringEditorProvider = ({ children }) => {
898
- const [isDisplayed, setIsDisplayed] = useState3(false);
899
- return /* @__PURE__ */ jsx5(HoveringEditorContext.Provider, { value: { isDisplayed, setIsDisplayed }, children });
900
- };
901
- var useHoveringEditorContext = () => useContext(HoveringEditorContext);
902
-
903
- // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
904
- import { MdArrowForward, MdCheck } from "react-icons/md";
905
- import { Fragment, jsx as jsx6, jsxs as jsxs2 } from "react/jsx-runtime";
906
- var HoveringInsertionPromptBoxCore = ({
907
- performInsertion,
908
- state,
909
- insertionOrEditingFunction,
910
- contextCategories
911
- }) => {
912
- const { getDocumentsContext } = useCopilotContext();
913
- const [editSuggestion, setEditSuggestion] = useState4("");
914
- const [suggestionIsLoading, setSuggestionIsLoading] = useState4(false);
915
- const [adjustmentPrompt, setAdjustmentPrompt] = useState4("");
916
- const [generatingSuggestion, setGeneratingSuggestion] = useState4(
917
- null
918
- );
919
- const adjustmentTextAreaRef = useRef(null);
920
- const suggestionTextAreaRef = useRef(null);
921
- const [filePointers, setFilePointers] = useState4([]);
922
- const [suggestedFiles, setSuggestedFiles] = useState4([]);
923
- useEffect3(() => {
924
- setSuggestedFiles(getDocumentsContext(contextCategories));
925
- }, [contextCategories, getDocumentsContext]);
926
- use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
927
- use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
928
- useEffect3(() => {
929
- var _a;
930
- (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
931
- }, []);
932
- useEffect3(() => {
933
- if (!generatingSuggestion) {
934
- return;
935
- }
936
- if (generatingSuggestion.locked) {
937
- return;
938
- }
939
- setEditSuggestion("");
940
- const reader = generatingSuggestion.getReader();
941
- const read = () => __async(void 0, null, function* () {
942
- setSuggestionIsLoading(true);
943
- while (true) {
944
- const { done, value } = yield reader.read();
945
- if (done) {
946
- break;
947
- }
948
- setEditSuggestion((prev) => {
949
- const newSuggestion = prev + value;
950
- if (suggestionTextAreaRef.current) {
951
- suggestionTextAreaRef.current.scrollTop = suggestionTextAreaRef.current.scrollHeight;
952
- }
953
- return newSuggestion;
954
- });
955
- }
956
- setSuggestionIsLoading(false);
957
- });
958
- read();
959
- return () => {
960
- const releaseLockIfNotClosed = () => __async(void 0, null, function* () {
961
- try {
962
- yield reader.closed;
963
- } catch (e) {
964
- reader.releaseLock();
965
- }
966
- });
967
- releaseLockIfNotClosed();
968
- };
969
- }, [generatingSuggestion]);
970
- const beginGeneratingAdjustment = useCallback2(() => __async(void 0, null, function* () {
971
- if (!adjustmentPrompt.trim()) {
972
- return;
973
- }
974
- let modificationState = state.editorState;
975
- if (editSuggestion !== "") {
976
- modificationState.selectedText = editSuggestion;
977
- }
978
- const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(
979
- modificationState,
980
- adjustmentPrompt,
981
- filePointers,
982
- new AbortController().signal
983
- );
984
- const adjustmentSuggestionTextStream = streamPromiseFlatten(
985
- adjustmentSuggestionTextStreamPromise
986
- );
987
- setGeneratingSuggestion(adjustmentSuggestionTextStream);
988
- }), [
989
- adjustmentPrompt,
990
- editSuggestion,
991
- state.editorState,
992
- insertionOrEditingFunction,
993
- filePointers
994
- ]);
995
- const isLoading = suggestionIsLoading;
996
- const textToEdit = editSuggestion || state.editorState.selectedText;
997
- const adjustmentLabel = textToEdit === "" ? "Describe the text you want to insert" : "Describe adjustments to the suggested text";
998
- const placeholder = textToEdit === "" ? "e.g. 'summarize the client's top 3 pain-points from @CallTranscript'" : "e.g. 'make it more formal', 'be more specific', ...";
999
- const { setIsDisplayed } = useHoveringEditorContext();
1000
- const AdjustmentPromptComponent = /* @__PURE__ */ jsxs2(Fragment, { children: [
1001
- /* @__PURE__ */ jsx6(Label, { className: "", children: adjustmentLabel }),
1002
- /* @__PURE__ */ jsxs2("div", { className: "relative w-full flex items-center", children: [
1003
- /* @__PURE__ */ jsx6(
1004
- "textarea",
1005
- {
1006
- disabled: suggestionIsLoading,
1007
- ref: adjustmentTextAreaRef,
1008
- value: adjustmentPrompt,
1009
- onChange: (e) => setAdjustmentPrompt(e.target.value),
1010
- onKeyDown: (e) => {
1011
- if (e.key === "Enter" && e.shiftKey) {
1012
- e.preventDefault();
1013
- setAdjustmentPrompt(adjustmentPrompt + "\n");
1014
- } else if (e.key === "Enter") {
1015
- e.preventDefault();
1016
- beginGeneratingAdjustment();
1017
- } else if (e.key == "Escape") {
1018
- e.preventDefault();
1019
- setIsDisplayed(false);
1020
- }
1021
- },
1022
- placeholder,
1023
- style: { minHeight: "3rem" },
1024
- className: "w-full bg-slate-100 h-auto h-min-14 text-sm p-2 rounded-md resize-none overflow-visible focus:outline-none focus:ring-0 focus:border-non pr-[3rem]",
1025
- rows: 1
1026
- }
1027
- ),
1028
- /* @__PURE__ */ jsx6(
1029
- "button",
1030
- {
1031
- onClick: beginGeneratingAdjustment,
1032
- className: "absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center",
1033
- children: /* @__PURE__ */ jsx6(MdArrowForward, { className: "text-2xl" })
1034
- }
1035
- )
1036
- ] })
1037
- ] });
1038
- const SuggestionComponent = /* @__PURE__ */ jsxs2(Fragment, { children: [
1039
- /* @__PURE__ */ jsxs2("div", { className: "flex justify-between items-end w-full", children: [
1040
- /* @__PURE__ */ jsx6(Label, { className: "mt-4", children: "Suggested:" }),
1041
- /* @__PURE__ */ jsx6("div", { className: "ml-auto", children: isLoading && /* @__PURE__ */ jsx6("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsx6(
1042
- "div",
1043
- {
1044
- className: "inline-block h-4 w-4 animate-spin rounded-full border-4 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",
1045
- role: "status",
1046
- children: /* @__PURE__ */ jsx6("span", { className: "absolute -m-px h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]", children: "Loading..." })
1047
- }
1048
- ) }) })
1049
- ] }),
1050
- /* @__PURE__ */ jsx6(
1051
- "textarea",
1052
- {
1053
- ref: suggestionTextAreaRef,
1054
- value: editSuggestion,
1055
- disabled: suggestionIsLoading,
1056
- onChange: (e) => setEditSuggestion(e.target.value),
1057
- className: "w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50",
1058
- style: { overflow: "auto", maxHeight: "10em" }
1059
- }
1060
- )
1061
- ] });
1062
- const SubmitComponent = /* @__PURE__ */ jsx6("div", { className: "flex w-full gap-4 justify-start", children: /* @__PURE__ */ jsxs2(
1063
- Button,
1064
- {
1065
- className: " bg-green-700 text-white",
1066
- onClick: () => {
1067
- performInsertion(editSuggestion);
1068
- },
1069
- children: [
1070
- "Insert ",
1071
- /* @__PURE__ */ jsx6(MdCheck, { className: "text-2xl" })
1072
- ]
1073
- }
1074
- ) });
1075
- const sourceSearchCandidate = adjustmentPrompt.split(" ").pop();
1076
- const sourceSearchWord = (sourceSearchCandidate == null ? void 0 : sourceSearchCandidate.startsWith("@")) ? sourceSearchCandidate.slice(1) : void 0;
1077
- return /* @__PURE__ */ jsxs2("div", { className: "w-full flex flex-col items-start relative gap-2", children: [
1078
- AdjustmentPromptComponent,
1079
- sourceSearchWord !== void 0 && /* @__PURE__ */ jsx6(
1080
- SourceSearchBox,
1081
- {
1082
- searchTerm: sourceSearchWord,
1083
- suggestedFiles,
1084
- onSelectedFile: (filePointer) => {
1085
- var _a;
1086
- setAdjustmentPrompt(adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), ""));
1087
- setFilePointers((prev) => [...prev, filePointer]);
1088
- (_a = adjustmentTextAreaRef.current) == null ? void 0 : _a.focus();
1089
- }
1090
- }
1091
- ),
1092
- generatingSuggestion ? SuggestionComponent : null,
1093
- generatingSuggestion ? SubmitComponent : null
1094
- ] });
1095
- };
1096
-
1097
- // src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
1098
- import { jsx as jsx7 } from "react/jsx-runtime";
1099
- var HoveringInsertionPromptBox = (props) => {
1100
- return /* @__PURE__ */ jsx7(
1101
- "div",
1102
- {
1103
- className: "flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white",
1104
- style: { width: "35rem" },
1105
- children: /* @__PURE__ */ jsx7(
1106
- HoveringInsertionPromptBoxCore,
1107
- {
1108
- state: {
1109
- editorState: props.editorState
1110
- },
1111
- insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
1112
- performInsertion: props.performInsertion,
1113
- contextCategories: props.contextCategories
1114
- }
1115
- )
1116
- }
1117
- );
1118
- };
1119
-
1120
- // src/components/hovering-toolbar/hovering-toolbar-components.tsx
1121
- import { css, cx } from "@emotion/css";
1122
- import React5 from "react";
1123
- import ReactDOM from "react-dom";
1124
- import { jsx as jsx8 } from "react/jsx-runtime";
1125
- var Button2 = React5.forwardRef(
1126
- (_a, ref) => {
1127
- var _b = _a, {
1128
- className,
1129
- active,
1130
- reversed
1131
- } = _b, props = __objRest(_b, [
1132
- "className",
1133
- "active",
1134
- "reversed"
1135
- ]);
1136
- return /* @__PURE__ */ jsx8(
1137
- "span",
1138
- __spreadProps(__spreadValues({}, props), {
1139
- ref,
1140
- className: cx(
1141
- className,
1142
- css`
1143
- cursor: pointer;
1144
- color: ${reversed ? active ? "white" : "#aaa" : active ? "black" : "#ccc"};
1145
- `
1146
- )
1147
- })
1148
- );
1149
- }
1150
- );
1151
- var Menu = React5.forwardRef(
1152
- (_a, ref) => {
1153
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1154
- return /* @__PURE__ */ jsx8(
1155
- "div",
1156
- __spreadProps(__spreadValues({}, props), {
1157
- "data-test-id": "menu",
1158
- ref,
1159
- className: cx(
1160
- className,
1161
- css`
1162
- & > * {
1163
- display: inline-block;
1164
- }
1165
-
1166
- & > * + * {
1167
- margin-left: 15px;
1168
- }
1169
- `
1170
- )
1171
- })
1172
- );
1173
- }
1174
- );
1175
- var Portal = ({ children }) => {
1176
- return typeof document === "object" ? ReactDOM.createPortal(children, document.body) : null;
1177
- };
1178
- var Toolbar = React5.forwardRef(
1179
- (_a, ref) => {
1180
- var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
1181
- return /* @__PURE__ */ jsx8(
1182
- Menu,
1183
- __spreadProps(__spreadValues({}, props), {
1184
- ref,
1185
- className: cx(
1186
- className,
1187
- css`
1188
- position: relative;
1189
- padding: 1px 18px 17px;
1190
- margin: 0 -20px;
1191
- border-bottom: 2px solid #eee;
1192
- margin-bottom: 20px;
1193
- `
1194
- )
1195
- })
1196
- );
1197
- }
1198
- );
1199
-
1200
- // src/components/hovering-toolbar/hovering-toolbar.tsx
1201
- import { jsx as jsx9 } from "react/jsx-runtime";
1202
- var HoveringToolbar = (props) => {
1203
- const ref = useRef2(null);
1204
- const editor = useSlate();
1205
- const selection = useSlateSelection();
1206
- const { isDisplayed, setIsDisplayed } = useHoveringEditorContext();
1207
- const [isClient, setIsClient] = useState5(false);
1208
- useEffect4(() => {
1209
- setIsClient(true);
1210
- }, []);
1211
- useEffect4(() => {
1212
- const el = ref.current;
1213
- const { selection: selection2 } = editor;
1214
- if (!el) {
1215
- return;
1216
- }
1217
- if (!selection2) {
1218
- el.removeAttribute("style");
1219
- return;
1220
- }
1221
- const domSelection = window.getSelection();
1222
- if (!domSelection || domSelection.rangeCount === 0) {
1223
- return;
1224
- }
1225
- const domRange = domSelection.getRangeAt(0);
1226
- const rect = domRange.getBoundingClientRect();
1227
- if (rect.top === 0 && rect.left === 0 && rect.width === 0 && rect.height === 0) {
1228
- return;
1229
- }
1230
- const minGapFromEdge = 60;
1231
- const verticalOffsetFromCorner = 35;
1232
- const horizontalOffsetFromCorner = 15;
1233
- let top = rect.top + window.scrollY - el.offsetHeight + verticalOffsetFromCorner;
1234
- if (top < minGapFromEdge) {
1235
- top = rect.bottom + window.scrollY + minGapFromEdge;
1236
- } else if (top + el.offsetHeight > window.innerHeight - minGapFromEdge) {
1237
- top = rect.top + window.scrollY - el.offsetHeight - minGapFromEdge;
1238
- }
1239
- let left = rect.left + window.scrollX - el.offsetWidth / 2 + rect.width / 2 + horizontalOffsetFromCorner;
1240
- if (left < minGapFromEdge) {
1241
- left = minGapFromEdge;
1242
- } else if (left + el.offsetWidth > window.innerWidth - minGapFromEdge) {
1243
- left = window.innerWidth - el.offsetWidth - minGapFromEdge;
1244
- }
1245
- el.style.opacity = "1";
1246
- el.style.position = "absolute";
1247
- el.style.top = `${top}px`;
1248
- el.style.left = `${left}px`;
1249
- });
1250
- useEffect4(() => {
1251
- const handleClickOutside = (event) => {
1252
- if (ref.current && !ref.current.contains(event.target)) {
1253
- setIsDisplayed(false);
1254
- }
1255
- };
1256
- document.addEventListener("mousedown", handleClickOutside);
1257
- return () => {
1258
- document.removeEventListener("mousedown", handleClickOutside);
1259
- };
1260
- }, [ref, setIsDisplayed]);
1261
- if (!isClient) {
1262
- return null;
1263
- }
1264
- return /* @__PURE__ */ jsx9(Portal, { children: /* @__PURE__ */ jsx9(
1265
- Menu,
1266
- {
1267
- ref,
1268
- className: "copilot-kit-textarea-css-scope " + (props.hoverMenuClassname || "p-2 absolute z-10 top-[-10000px] left-[-10000px] mt-[-6px] opacity-0 transition-opacity duration-700"),
1269
- children: isDisplayed && selection && /* @__PURE__ */ jsx9(
1270
- HoveringInsertionPromptBox,
1271
- {
1272
- editorState: editorState(editor, selection),
1273
- apiConfig: props.apiConfig,
1274
- closeWindow: () => {
1275
- setIsDisplayed(false);
1276
- },
1277
- performInsertion: (insertedText) => {
1278
- Transforms5.delete(editor, { at: selection });
1279
- Transforms5.insertText(editor, insertedText, {
1280
- at: selection
1281
- });
1282
- setIsDisplayed(false);
1283
- },
1284
- contextCategories: props.contextCategories
1285
- }
1286
- )
1287
- }
1288
- ) });
1289
- };
1290
- function editorState(editor, selection) {
1291
- const textAroundCursor = getTextAroundSelection(editor);
1292
- if (textAroundCursor) {
1293
- return textAroundCursor;
1294
- }
1295
- return {
1296
- textBeforeCursor: getFullEditorTextWithNewlines(editor),
1297
- textAfterCursor: "",
1298
- selectedText: ""
1299
- };
1300
- }
1301
-
1302
- // src/components/base-copilot-textarea/render-element.tsx
1303
- import { jsx as jsx10, jsxs as jsxs3 } from "react/jsx-runtime";
1304
- function makeRenderElementFunction(suggestionsStyle) {
1305
- return (props) => {
1306
- switch (props.element.type) {
1307
- case "paragraph":
1308
- return /* @__PURE__ */ jsx10(DefaultElement, __spreadValues({}, props));
1309
- case "suggestion":
1310
- return /* @__PURE__ */ jsx10(SuggestionElement, __spreadProps(__spreadValues({}, props), { suggestionsStyle }));
1311
- }
1312
- };
1313
- }
1314
- var DefaultElement = (props) => {
1315
- return /* @__PURE__ */ jsx10("div", __spreadProps(__spreadValues({}, props.attributes), { children: props.children }));
1316
- };
1317
- var SuggestionElement = (props) => {
1318
- return /* @__PURE__ */ jsxs3(
1319
- "span",
1320
- __spreadProps(__spreadValues({}, props.attributes), {
1321
- style: __spreadValues({}, props.suggestionsStyle),
1322
- contentEditable: false,
1323
- children: [
1324
- props.children,
1325
- props.element.type === "suggestion" && props.element.content
1326
- ]
1327
- })
1328
- );
1329
- };
1330
-
1331
- // src/components/base-copilot-textarea/render-placeholder.tsx
1332
- import { jsx as jsx11 } from "react/jsx-runtime";
1333
- function makeRenderPlaceholderFunction(placeholderStyle) {
1334
- return (props) => {
1335
- const _a = props.attributes, { style } = _a, restAttributes = __objRest(_a, ["style"]);
1336
- return /* @__PURE__ */ jsx11(
1337
- "div",
1338
- __spreadProps(__spreadValues({}, restAttributes), {
1339
- style: __spreadValues(__spreadValues({}, style), placeholderStyle),
1340
- children: props.children
1341
- })
1342
- );
1343
- };
1344
- }
1345
-
1346
- // src/components/base-copilot-textarea/use-add-branding-css.tsx
1347
- import { useEffect as useEffect5 } from "react";
1348
- function useAddBrandingCss(suggestionStyleAugmented, disableBranding) {
1349
- const cssSelector = ".copilot-textarea.with-branding";
1350
- useEffect5(() => {
1351
- if (disableBranding) {
1352
- return;
1353
- }
1354
- const styleEl = document.createElement("style");
1355
- styleEl.id = "dynamic-styles";
1356
- let dynamicStyles = Object.entries(suggestionStyleAugmented).map(([key, value]) => {
1357
- const kebabCaseKey = key.replace(/([a-z0-9]|(?=[A-Z]))([A-Z])/g, "$1-$2").toLowerCase();
1358
- return `${kebabCaseKey}: ${value};`;
1359
- }).join(" ");
1360
- dynamicStyles += `font-style: normal; font-size: x-small;`;
1361
- dynamicStyles += `content: "CopilotKit";`;
1362
- dynamicStyles += `bottom: 6px;`;
1363
- dynamicStyles += `right: 6px;`;
1364
- dynamicStyles += `pointer-events: none;`;
1365
- dynamicStyles += `font-weight: 200;`;
1366
- dynamicStyles += `padding: 0;`;
1367
- dynamicStyles += `margin: 0;`;
1368
- dynamicStyles += `border: 0;`;
1369
- dynamicStyles += `line-height: 1;`;
1370
- dynamicStyles += `position: absolute;`;
1371
- styleEl.innerHTML = `
1372
- ${cssSelector}::after {
1373
- ${dynamicStyles}
1374
- }
1375
- `;
1376
- document.head.appendChild(styleEl);
1377
- const textarea = document.querySelector(cssSelector);
1378
- const handleScroll = () => {
1379
- const styleEl2 = document.getElementById("dynamic-styles");
1380
- if (styleEl2 && textarea) {
1381
- const offsetFromBottom = -textarea.scrollTop + 6;
1382
- const offsetFromRight = -textarea.scrollLeft + 6;
1383
- styleEl2.innerHTML = `
1384
- ${cssSelector}::after {
1385
- ${dynamicStyles}
1386
- bottom: ${offsetFromBottom}px;
1387
- right: ${offsetFromRight}px;
1388
- }
1389
- `;
1390
- }
1391
- };
1392
- textarea == null ? void 0 : textarea.addEventListener("scroll", handleScroll);
1393
- return () => {
1394
- var _a;
1395
- (_a = document.getElementById("dynamic-styles")) == null ? void 0 : _a.remove();
1396
- textarea == null ? void 0 : textarea.removeEventListener("scroll", handleScroll);
1397
- };
1398
- }, [disableBranding, suggestionStyleAugmented]);
1399
- }
1400
-
1401
- // src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
1402
- import { useEffect as useEffect6, useRef as useRef3 } from "react";
1403
- import { useSlateSelector } from "slate-react";
1404
- import { Range as Range3 } from "slate";
1405
-
1406
- // src/lib/editor-to-text.ts
1407
- import { Element as Element4 } from "slate";
1408
- function nodeChildrenToTextComponents(editor, nodes) {
1409
- const indeciesOfInlineElements = new Set(
1410
- nodes.map((node, index) => {
1411
- if (Element4.isElement(node) && editor.isInline(node)) {
1412
- return index;
1413
- }
1414
- return -1;
1415
- }).filter((index) => index !== -1)
1416
- );
1417
- const nonIgnorableItems = nodes.filter((node, index) => {
1418
- const isInline = indeciesOfInlineElements.has(index);
1419
- if (isInline) {
1420
- return false;
1421
- }
1422
- const isNeighbourOfInline = indeciesOfInlineElements.has(index - 1) || indeciesOfInlineElements.has(index + 1);
1423
- if (isNeighbourOfInline) {
1424
- return node.text !== "";
1425
- }
1426
- return true;
1427
- });
1428
- return nonIgnorableItems.map((node) => {
1429
- if (Element4.isElement(node)) {
1430
- switch (node.type) {
1431
- case "paragraph":
1432
- return nodeChildrenToTextComponents(editor, node.children);
1433
- case "suggestion":
1434
- return [];
1435
- }
1436
- } else {
1437
- return [node];
1438
- }
1439
- }).reduce((acc, val) => acc.concat(val), []);
1440
- }
1441
- var editorToText = (editor) => {
1442
- const flattened = nodeChildrenToTextComponents(editor, editor.children);
1443
- const text = flattened.map((textComponent) => textComponent.text).join("\n");
1444
- return text;
1445
- };
1446
-
1447
- // src/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.tsx
1448
- import { Fragment as Fragment2, jsx as jsx12 } from "react/jsx-runtime";
1449
- function TrackerTextEditedSinceLastCursorMovement(props) {
1450
- const cursorState = useSlateSelector((state) => ({
1451
- selection: state.selection,
1452
- text: editorToText(state)
1453
- }));
1454
- const previousState = usePrevious(cursorState);
1455
- useEffect6(() => {
1456
- if (!previousState) {
1457
- return;
1458
- }
1459
- if (cursorChangedWithoutTextChanged(previousState, cursorState)) {
1460
- props.setCursorMovedSinceLastTextChange(true);
1461
- }
1462
- }, [props.setCursorMovedSinceLastTextChange, cursorState]);
1463
- return /* @__PURE__ */ jsx12(Fragment2, {});
1464
- }
1465
- var cursorChangedWithoutTextChanged = (prev, next) => {
1466
- const isSelectionChanged = !isSelectionEqual(prev.selection, next.selection);
1467
- const isTextSame = prev.text === next.text;
1468
- return isSelectionChanged && isTextSame;
1469
- };
1470
- var isSelectionEqual = (a, b) => {
1471
- if (!a && !b) return true;
1472
- if (!a || !b) return false;
1473
- return Range3.equals(a, b);
1474
- };
1475
- function usePrevious(value) {
1476
- const ref = useRef3();
1477
- useEffect6(() => {
1478
- ref.current = value;
1479
- });
1480
- return ref.current;
1481
- }
1482
-
1483
- // src/components/base-copilot-textarea/base-copilot-textarea.tsx
1484
- import { jsx as jsx13, jsxs as jsxs4 } from "react/jsx-runtime";
1485
- var BaseCopilotTextarea = React6.forwardRef(
1486
- (props, ref) => {
1487
- return /* @__PURE__ */ jsx13(HoveringEditorProvider, { children: /* @__PURE__ */ jsx13(BaseCopilotTextareaWithHoveringContext, __spreadProps(__spreadValues({}, props), { ref })) });
1488
- }
1489
- );
1490
- var BaseCopilotTextareaWithHoveringContext = React6.forwardRef(
1491
- (props, ref) => {
1492
- const autosuggestionsConfig = __spreadValues(__spreadValues({}, defaultBaseAutosuggestionsConfig), props.baseAutosuggestionsConfig);
1493
- const valueOnInitialRender = useMemo3(() => {
1494
- var _a2;
1495
- return (_a2 = props.value) != null ? _a2 : "";
1496
- }, []);
1497
- const [lastKnownFullEditorText, setLastKnownFullEditorText] = useState6(valueOnInitialRender);
1498
- const [cursorMovedSinceLastTextChange, setCursorMovedSinceLastTextChange] = useState6(false);
1499
- const initialValue = useMemo3(() => {
1500
- return [
1501
- {
1502
- type: "paragraph",
1503
- children: [{ text: valueOnInitialRender }]
1504
- }
1505
- ];
1506
- }, [valueOnInitialRender]);
1507
- const editor = useCopilotTextareaEditor();
1508
- const { isDisplayed: hoveringEditorIsDisplayed, setIsDisplayed: setHoveringEditorIsDisplayed } = useHoveringEditorContext();
1509
- const insertText = useCallback3(
1510
- (autosuggestion) => {
1511
- Editor5.insertText(editor, autosuggestion.text, {
1512
- at: autosuggestion.point
1513
- });
1514
- },
1515
- [editor]
1516
- );
1517
- const shouldDisableAutosuggestions = (
1518
- // textarea is manually disabled:
1519
- autosuggestionsConfig.disabled || // hovering editor is displayed:
1520
- hoveringEditorIsDisplayed || // the cursor has moved since the last text change AND we are configured to disable autosuggestions in this case:
1521
- cursorMovedSinceLastTextChange && autosuggestionsConfig.temporarilyDisableWhenMovingCursorWithoutChangingText
1522
- );
1523
- const {
1524
- currentAutocompleteSuggestion,
1525
- onChangeHandler: onChangeHandlerForAutocomplete,
1526
- onKeyDownHandler: onKeyDownHandlerForAutocomplete,
1527
- onTouchStartHandler: onTouchStartHandlerForAutocomplete
1528
- } = useAutosuggestions(
1529
- autosuggestionsConfig.debounceTime,
1530
- autosuggestionsConfig.shouldAcceptAutosuggestionOnKeyPress,
1531
- autosuggestionsConfig.shouldAcceptAutosuggestionOnTouch,
1532
- autosuggestionsConfig.apiConfig.autosuggestionsFunction,
1533
- insertText,
1534
- autosuggestionsConfig.disableWhenEmpty,
1535
- shouldDisableAutosuggestions
1536
- );
1537
- const onKeyDownHandlerForHoveringEditor = useCallback3(
1538
- (event) => {
1539
- var _a2;
1540
- if (autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress(event, (_a2 = props.shortcut) != null ? _a2 : "k")) {
1541
- event.preventDefault();
1542
- setHoveringEditorIsDisplayed(!hoveringEditorIsDisplayed);
1543
- }
1544
- },
1545
- [
1546
- hoveringEditorIsDisplayed,
1547
- setHoveringEditorIsDisplayed,
1548
- autosuggestionsConfig.shouldToggleHoveringEditorOnKeyPress
1549
- ]
1550
- );
1551
- useEffect7(() => {
1552
- clearAutocompletionsFromEditor(editor);
1553
- if (currentAutocompleteSuggestion) {
1554
- addAutocompletionsToEditor(
1555
- editor,
1556
- currentAutocompleteSuggestion.text,
1557
- currentAutocompleteSuggestion.point
1558
- );
1559
- }
1560
- }, [currentAutocompleteSuggestion]);
1561
- const suggestionStyleAugmented = useMemo3(() => {
1562
- return __spreadValues({
1563
- fontStyle: "italic",
1564
- color: "gray"
1565
- }, props.suggestionsStyle);
1566
- }, [props.suggestionsStyle]);
1567
- const renderElementMemoized = useMemo3(() => {
1568
- return makeRenderElementFunction(suggestionStyleAugmented);
1569
- }, [suggestionStyleAugmented]);
1570
- const renderPlaceholderMemoized = useMemo3(() => {
1571
- const placeholderStyleSlatejsOverrides = {
1572
- top: void 0
1573
- };
1574
- const placeholderStyleAugmented = __spreadValues(__spreadValues({}, placeholderStyleSlatejsOverrides), props.placeholderStyle);
1575
- return makeRenderPlaceholderFunction(placeholderStyleAugmented);
1576
- }, [props.placeholderStyle]);
1577
- useEffect7(() => {
1578
- var _a2, _b;
1579
- if (props.value === lastKnownFullEditorText) {
1580
- return;
1581
- }
1582
- setLastKnownFullEditorText((_a2 = props.value) != null ? _a2 : "");
1583
- replaceEditorText(editor, (_b = props.value) != null ? _b : "");
1584
- }, [props.value]);
1585
- const _a = props, {
1586
- placeholderStyle,
1587
- value,
1588
- hoverMenuClassname,
1589
- onValueChange,
1590
- baseAutosuggestionsConfig: autosuggestionsConfigFromProps,
1591
- className,
1592
- onChange,
1593
- onKeyDown,
1594
- disableBranding
1595
- } = _a, propsToForward = __objRest(_a, [
1596
- "placeholderStyle",
1597
- "value",
1598
- "hoverMenuClassname",
1599
- "onValueChange",
1600
- "baseAutosuggestionsConfig",
1601
- "className",
1602
- "onChange",
1603
- "onKeyDown",
1604
- "disableBranding"
1605
- ]);
1606
- useAddBrandingCss(suggestionStyleAugmented, disableBranding);
1607
- usePopulateCopilotTextareaRef(editor, ref);
1608
- const moddedClassName = (() => {
1609
- const baseClassName = "copilot-textarea";
1610
- const brandingClass = disableBranding ? "no-branding" : "with-branding";
1611
- const defaultTailwindClassName = "bg-white overflow-y-auto resize-y";
1612
- const mergedClassName = twMerge2(defaultTailwindClassName, className != null ? className : "");
1613
- return `${baseClassName} ${brandingClass} ${mergedClassName}`;
1614
- })();
1615
- return /* @__PURE__ */ jsxs4(
1616
- Slate,
1617
- {
1618
- editor,
1619
- initialValue,
1620
- onChange: (value2) => {
1621
- var _a2, _b;
1622
- const newEditorState = getTextAroundCollapsedCursor(editor);
1623
- const fullEditorText = newEditorState ? newEditorState.textBeforeCursor + newEditorState.textAfterCursor : getFullEditorTextWithNewlines(editor);
1624
- setLastKnownFullEditorText((prev) => {
1625
- if (prev !== fullEditorText) {
1626
- setCursorMovedSinceLastTextChange(false);
1627
- }
1628
- return fullEditorText;
1629
- });
1630
- onChangeHandlerForAutocomplete(newEditorState);
1631
- (_a2 = props.onValueChange) == null ? void 0 : _a2.call(props, fullEditorText);
1632
- (_b = props.onChange) == null ? void 0 : _b.call(props, makeSemiFakeReactTextAreaEvent(fullEditorText));
1633
- },
1634
- children: [
1635
- /* @__PURE__ */ jsx13(
1636
- TrackerTextEditedSinceLastCursorMovement,
1637
- {
1638
- setCursorMovedSinceLastTextChange
1639
- }
1640
- ),
1641
- /* @__PURE__ */ jsx13(
1642
- HoveringToolbar,
1643
- {
1644
- apiConfig: autosuggestionsConfig.apiConfig,
1645
- contextCategories: autosuggestionsConfig.contextCategories,
1646
- hoverMenuClassname
1647
- }
1648
- ),
1649
- /* @__PURE__ */ jsx13(
1650
- Editable,
1651
- __spreadValues({
1652
- renderElement: renderElementMemoized,
1653
- renderPlaceholder: renderPlaceholderMemoized,
1654
- onKeyDown: (event) => {
1655
- var _a2;
1656
- onKeyDownHandlerForHoveringEditor(event);
1657
- onKeyDownHandlerForAutocomplete(event);
1658
- (_a2 = props.onKeyDown) == null ? void 0 : _a2.call(props, event);
1659
- },
1660
- onTouchStart: (event) => {
1661
- onTouchStartHandlerForAutocomplete(event);
1662
- },
1663
- className: moddedClassName,
1664
- onBlur: (ev) => {
1665
- var _a2;
1666
- (_a2 = props.onBlur) == null ? void 0 : _a2.call(props, ev);
1667
- clearAutocompletionsFromEditor(editor);
1668
- }
1669
- }, propsToForward)
1670
- )
1671
- ]
1672
- }
1673
- );
1674
- }
1675
- );
1676
- function makeSemiFakeReactTextAreaEvent(currentText) {
1677
- return {
1678
- target: {
1679
- value: currentText,
1680
- type: "copilot-textarea"
1681
- },
1682
- currentTarget: {
1683
- value: currentText,
1684
- type: "copilot-textarea"
1685
- }
1686
- };
1687
- }
1688
-
1689
- // src/components/copilot-textarea/copilot-textarea.tsx
1690
- import React7 from "react";
1691
-
1692
- // src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
1693
- import { COPILOT_CLOUD_PUBLIC_API_KEY_HEADER } from "@copilotkit/shared";
1694
- import { useCopilotContext as useCopilotContext2 } from "@copilotkit/react-core";
1695
- import { useCallback as useCallback4 } from "react";
1696
-
1697
- // src/lib/retry.tsx
1698
- function retry(fn, retriesLeft = 2, interval = 200, backoff = 1.5) {
1699
- return new Promise((resolve, reject) => {
1700
- fn().then(resolve).catch((error) => {
1701
- if (retriesLeft === 1) {
1702
- reject(error);
1703
- return;
1704
- }
1705
- setTimeout(() => {
1706
- retry(fn, retriesLeft - 1, interval * backoff, backoff).then(resolve).catch(reject);
1707
- }, interval);
1708
- });
1709
- });
1710
- }
1711
-
1712
- // src/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.tsx
1
+ import "../chunk-MMVDU6DF.mjs";
1713
2
  import {
1714
- CopilotRuntimeClient,
1715
- Role,
1716
- TextMessage,
1717
- convertGqlOutputToMessages,
1718
- convertMessagesToGqlInput,
1719
- filterAgentStateMessages,
1720
- CopilotRequestType
1721
- } from "@copilotkit/runtime-client-gql";
1722
- function useMakeStandardAutosuggestionFunction(textareaPurpose, contextCategories, apiConfig) {
1723
- const { getContextString, copilotApiConfig } = useCopilotContext2();
1724
- const { chatApiEndpoint: url, publicApiKey, credentials, properties } = copilotApiConfig;
1725
- const headers = __spreadValues(__spreadValues({}, copilotApiConfig.headers), publicApiKey ? { [COPILOT_CLOUD_PUBLIC_API_KEY_HEADER]: publicApiKey } : {});
1726
- const { maxTokens, stop } = apiConfig;
1727
- return useCallback4(
1728
- (editorState2, abortSignal) => __async(this, null, function* () {
1729
- const res = yield retry(() => __async(this, null, function* () {
1730
- var _a, _b, _c;
1731
- const messages = [
1732
- new TextMessage({
1733
- role: Role.System,
1734
- content: apiConfig.makeSystemPrompt(
1735
- textareaPurpose,
1736
- getContextString([], contextCategories)
1737
- )
1738
- }),
1739
- ...apiConfig.fewShotMessages,
1740
- new TextMessage({
1741
- role: Role.User,
1742
- content: editorState2.textAfterCursor
1743
- }),
1744
- new TextMessage({
1745
- role: Role.User,
1746
- content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
1747
- }),
1748
- new TextMessage({
1749
- role: Role.User,
1750
- content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
1751
- })
1752
- ];
1753
- const runtimeClient = new CopilotRuntimeClient({
1754
- url,
1755
- publicApiKey,
1756
- headers,
1757
- credentials
1758
- });
1759
- const response = yield runtimeClient.generateCopilotResponse({
1760
- data: {
1761
- frontend: {
1762
- actions: [],
1763
- url: window.location.href
1764
- },
1765
- messages: convertMessagesToGqlInput(filterAgentStateMessages(messages)),
1766
- metadata: {
1767
- requestType: CopilotRequestType.TextareaCompletion
1768
- },
1769
- forwardedParameters: {
1770
- maxTokens,
1771
- stop
1772
- }
1773
- },
1774
- properties,
1775
- signal: abortSignal
1776
- }).toPromise();
1777
- let result = "";
1778
- for (const message of convertGqlOutputToMessages(
1779
- (_c = (_b = (_a = response.data) == null ? void 0 : _a.generateCopilotResponse) == null ? void 0 : _b.messages) != null ? _c : []
1780
- )) {
1781
- if (abortSignal.aborted) {
1782
- break;
1783
- }
1784
- if (message instanceof TextMessage) {
1785
- result += message.content;
1786
- }
1787
- }
1788
- return result;
1789
- }));
1790
- return res;
1791
- }),
1792
- [apiConfig, getContextString, contextCategories, textareaPurpose]
1793
- );
1794
- }
1795
-
1796
- // src/types/autosuggestions-config/suggestions-api-config.tsx
1797
- import { Role as Role2, TextMessage as TextMessage2 } from "@copilotkit/runtime-client-gql";
1798
- var defaultSuggestionsMakeSystemPrompt = (textareaPurpose, contextString) => {
1799
- return `You are a versatile writing assistant.
1800
-
1801
- The user is writing some text.
1802
- The purpose is: "${textareaPurpose}"
1803
-
1804
- Your job is to guess what the user will write next AS BEST YOU CAN.
1805
- Only guess a SHORT distance ahead. Usually 1 sentence, or at most 1 paragraph.
1806
-
1807
- Adjust yourself to the user's style and implied intent.
1808
-
1809
- The user will provide both the text before and after the cursor. You should use this to infer what the user is likely to write next.
1810
- <TextAfterCursor>
1811
- <TextBeforeCursor>
1812
- <YourSuggestion>
1813
-
1814
- If we need to add a whitespace character to the suggested text, make sure to explicitly add it in.
1815
-
1816
- The following external context is also provided. Use it to help you make better suggestions!!!
1817
- \`\`\`
1818
- ${contextString}
1819
- \`\`\`
1820
- `;
1821
- };
1822
- var defaultSuggestionsFewShotMessages = [
1823
- new TextMessage2({
1824
- role: Role2.User,
1825
- content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
1826
- }),
1827
- new TextMessage2({
1828
- role: Role2.User,
1829
- content: "This morning I woke up and went straight to the grocery store."
1830
- }),
1831
- new TextMessage2({
1832
- role: Role2.Assistant,
1833
- content: " When I arrived I went straight to the produce section and picked out a big watermelon. "
1834
- }),
1835
- new TextMessage2({
1836
- role: Role2.User,
1837
- content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
1838
- }),
1839
- new TextMessage2({
1840
- role: Role2.User,
1841
- content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
1842
- }),
1843
- new TextMessage2({
1844
- role: Role2.Assistant,
1845
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
1846
- })
1847
- ];
1848
- var defaultSuggestionsApiConfig = {
1849
- makeSystemPrompt: defaultSuggestionsMakeSystemPrompt,
1850
- fewShotMessages: defaultSuggestionsFewShotMessages
1851
- };
1852
-
1853
- // src/types/autosuggestions-config/insertions-api-config.tsx
1854
- import { Role as Role3, TextMessage as TextMessage3 } from "@copilotkit/runtime-client-gql";
1855
- var defaultInsertionsMakeSystemPrompt = (textareaPurpose, contextString) => {
1856
- return `You are a versatile writing assistant helping the user insert new text into their existing work.
1857
-
1858
- The user is writing some text.
1859
- The purpose is: "${textareaPurpose}"
1860
-
1861
- The following external context is also provided. Use it to inform your suggestions when relevant!!!
1862
- \`\`\`
1863
- ${contextString}
1864
- \`\`\`
1865
-
1866
- The user will provide you with a prompt for an INSERTION into the text they are writing.
1867
- Your job is to come up with an INSERTION into the text that the user would like to use, AS BEST YOU CAN.
1868
- Only insert a SHORT segment. Usually 1 sentence, or at most 1 paragraph.
1869
-
1870
- Adjust yourself to the user's style and implied intent.
1871
-
1872
-
1873
- The user will provide the text before and after the cursor, as well as the INSERTION prompt. You should use this to infer the best relevant insertion.
1874
- The conversation will be structured as follows:
1875
- <TextAfterCursor>
1876
- <TextBeforeCursor>
1877
- <InsertionPrompt>
1878
-
1879
- <YourInsertionSuggestion>
1880
- `;
1881
- };
1882
- var defaultInsertionsFewShotMessages = [
1883
- new TextMessage3({
1884
- role: Role3.User,
1885
- content: "<TextAfterCursor>While I was there I also picked up some apples, oranges, and bananas.</TextAfterCursor>"
1886
- }),
1887
- new TextMessage3({
1888
- role: Role3.User,
1889
- content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store.</TextBeforeCursor>"
1890
- }),
1891
- new TextMessage3({
1892
- role: Role3.User,
1893
- content: "<InsertionPrompt>I bought a big watermelon</InsertionPrompt>"
1894
- }),
1895
- new TextMessage3({
1896
- role: Role3.Assistant,
1897
- content: "When I arrived I went straight to the produce section and picked out a big watermelon."
1898
- }),
1899
- new TextMessage3({
1900
- role: Role3.User,
1901
- content: "<TextAfterCursor>and (iii) to the appointment of the Equityholders' Representative pursuant to Section 10.7 of the Merger Agreement and to the provisions thereof.</TextAfterCursor>"
1902
- }),
1903
- new TextMessage3({
1904
- role: Role3.User,
1905
- content: `<TextBeforeCursor>The Optionholder, in the Optionholder's capacity as a holder of vested Options, hereby irrevocably and unconditionally agrees: (i) that the Optionholder shall be deemed an "Equityholder" under the Merger Agreement and shall be entitled to the rights and benefits, and subject to the obligations, of an "Equityholder" thereunder;</TextBeforeCursor>`
1906
- }),
1907
- new TextMessage3({
1908
- role: Role3.User,
1909
- content: "<InsertionPrompt>add section about the optionholder's pro rata share</InsertionPrompt>"
1910
- }),
1911
- new TextMessage3({
1912
- role: Role3.Assistant,
1913
- content: ` (ii) that, for purposes of this Agreement and the Merger Agreement, the applicable percentage set forth opposite the name of the Optionholder in the Distribution Waterfall shall be such the Optionholder's "Pro Rata Share"; `
1914
- })
1915
- ];
1916
- var defaultInsertionsApiConfig = {
1917
- makeSystemPrompt: defaultInsertionsMakeSystemPrompt,
1918
- fewShotMessages: defaultInsertionsFewShotMessages,
1919
- forwardedParams: void 0
1920
- };
1921
-
1922
- // src/types/autosuggestions-config/editing-api-config.tsx
1923
- import { Role as Role4, TextMessage as TextMessage4 } from "@copilotkit/runtime-client-gql";
1924
- var defaultEditingMakeSystemPrompt = (textareaPurpose, contextString) => {
1925
- return `You are a versatile writing assistant helping the user edit a portion of their text.
1926
-
1927
- The user is writing some text.
1928
- The purpose is: "${textareaPurpose}"
1929
-
1930
- The following external context is also provided. Use it when relevant.
1931
- \`\`\`
1932
- ${contextString}
1933
- \`\`\`
1934
-
1935
- The user has provided you with a PROMPT for EDITING a PORTION of the text.
1936
- Your job is to come up with a new EDITED version OF THE SEGMENT IN QUESTION - AS BEST YOU CAN.
1937
- Only rewrite the portion of the text that the user has marked as "TextToEdit"!!!
1938
-
1939
- Adjust yourself to the user's style and implied intent.
1940
-
1941
- The conversation will be structured as follows:
1942
- <TextBeforeCursor>
1943
- <TextToEdit>
1944
- <TextAfterCursor>
1945
- <EditingPrompt>
1946
-
1947
- <YourEditSuggestion>
1948
- `;
1949
- };
1950
- var defaultEditingFewShotMessages = [
1951
- new TextMessage4({
1952
- role: Role4.User,
1953
- content: "<TextBeforeCursor>This morning I woke up and went straight to the grocery store. </TextBeforeCursor>"
1954
- }),
1955
- new TextMessage4({
1956
- role: Role4.User,
1957
- content: "<TextToEdit>While I was there I picked up some apples, oranges, and bananas. </TextToEdit>"
1958
- }),
1959
- new TextMessage4({
1960
- role: Role4.User,
1961
- content: "<TextAfterCursor>The grocery store was having a sale on fruit, so I decided to stock up.</TextAfterCursor>"
1962
- }),
1963
- new TextMessage4({
1964
- role: Role4.User,
1965
- content: "<EditingPrompt>I also bought a big watermelon</EditingPrompt>"
1966
- }),
1967
- new TextMessage4({
1968
- role: Role4.Assistant,
1969
- content: "While I was there I picked up some apples, oranges, and bananas, and a big watermelon."
1970
- }),
1971
- new TextMessage4({
1972
- role: Role4.User,
1973
- content: "<TextBeforeCursor>Yesterday, I spent the afternoon working on my new project.</TextBeforeCursor>"
1974
- }),
1975
- new TextMessage4({
1976
- role: Role4.User,
1977
- content: "<TextToEdit>It's quite challenging and requires a lot of focus.</TextToEdit>"
1978
- }),
1979
- new TextMessage4({
1980
- role: Role4.User,
1981
- content: "<TextAfterCursor>I'm really excited about the potential outcomes of this project.</TextAfterCursor>"
1982
- }),
1983
- new TextMessage4({
1984
- role: Role4.User,
1985
- content: "<EditingPrompt>emphasize the complexity and my enthusiasm for the project</EditingPrompt>"
1986
- }),
1987
- new TextMessage4({
1988
- role: Role4.Assistant,
1989
- content: "It's a highly complex task that demands intense concentration, but I'm incredibly enthusiastic about the promising prospects of this project."
1990
- })
1991
- ];
1992
- var defaultEditingApiConfig = {
1993
- makeSystemPrompt: defaultEditingMakeSystemPrompt,
1994
- fewShotMessages: defaultEditingFewShotMessages,
1995
- forwardedParams: void 0
1996
- };
1997
-
1998
- // src/types/autosuggestions-config/autosuggestions-config.tsx
1999
- import { defaultCopilotContextCategories as defaultCopilotContextCategories2 } from "@copilotkit/react-core";
2000
- var defaultAutosuggestionsConfig = __spreadProps(__spreadValues({}, defaultBaseAutosuggestionsConfig), {
2001
- contextCategories: defaultCopilotContextCategories2,
2002
- chatApiConfigs: {
2003
- suggestionsApiConfig: defaultSuggestionsApiConfig,
2004
- insertionApiConfig: defaultInsertionsApiConfig,
2005
- editingApiConfig: defaultEditingApiConfig
2006
- }
2007
- });
2008
-
2009
- // src/hooks/make-autosuggestions-function/use-make-standard-insertion-function.tsx
2010
- import { COPILOT_CLOUD_PUBLIC_API_KEY_HEADER as COPILOT_CLOUD_PUBLIC_API_KEY_HEADER2 } from "@copilotkit/shared";
2011
- import { useCopilotContext as useCopilotContext3 } from "@copilotkit/react-core";
2012
- import { useCallback as useCallback5 } from "react";
3
+ CopilotTextarea
4
+ } from "../chunk-FYCQE57K.mjs";
5
+ import "../chunk-2XDYLKPH.mjs";
6
+ import "../chunk-D2SUDM2O.mjs";
7
+ import "../chunk-RUV6NBIF.mjs";
8
+ import "../chunk-HL7EF7KA.mjs";
9
+ import "../chunk-EJGGLWWR.mjs";
10
+ import "../chunk-MCNXIA4Q.mjs";
11
+ import "../chunk-SDHH6DI6.mjs";
2013
12
  import {
2014
- CopilotRuntimeClient as CopilotRuntimeClient2,
2015
- Role as Role5,
2016
- TextMessage as TextMessage5,
2017
- convertGqlOutputToMessages as convertGqlOutputToMessages2,
2018
- convertMessagesToGqlInput as convertMessagesToGqlInput2,
2019
- filterAgentStateMessages as filterAgentStateMessages2,
2020
- CopilotRequestType as CopilotRequestType2
2021
- } from "@copilotkit/runtime-client-gql";
2022
- function useMakeStandardInsertionOrEditingFunction(textareaPurpose, contextCategories, insertionApiConfig, editingApiConfig) {
2023
- const { getContextString, copilotApiConfig } = useCopilotContext3();
2024
- const headers = __spreadValues({}, copilotApiConfig.publicApiKey ? { [COPILOT_CLOUD_PUBLIC_API_KEY_HEADER2]: copilotApiConfig.publicApiKey } : {});
2025
- const runtimeClient = new CopilotRuntimeClient2({
2026
- url: copilotApiConfig.chatApiEndpoint,
2027
- publicApiKey: copilotApiConfig.publicApiKey,
2028
- headers,
2029
- credentials: copilotApiConfig.credentials
2030
- });
2031
- function runtimeClientResponseToStringStream(responsePromise) {
2032
- return __async(this, null, function* () {
2033
- const messagesStream = yield CopilotRuntimeClient2.asStream(responsePromise);
2034
- return new ReadableStream({
2035
- start(controller) {
2036
- return __async(this, null, function* () {
2037
- const reader = messagesStream.getReader();
2038
- let sentContent = "";
2039
- while (true) {
2040
- const { done, value } = yield reader.read();
2041
- if (done) {
2042
- break;
2043
- }
2044
- const messages = convertGqlOutputToMessages2(value.generateCopilotResponse.messages);
2045
- let newContent = "";
2046
- for (const message of messages) {
2047
- if (message instanceof TextMessage5) {
2048
- newContent += message.content;
2049
- }
2050
- }
2051
- if (newContent) {
2052
- const contentToSend = newContent.slice(sentContent.length);
2053
- controller.enqueue(contentToSend);
2054
- sentContent += contentToSend;
2055
- }
2056
- }
2057
- controller.close();
2058
- });
2059
- }
2060
- });
2061
- });
2062
- }
2063
- const insertionFunction = useCallback5(
2064
- (editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
2065
- const res = yield retry(() => __async(this, null, function* () {
2066
- const messages = [
2067
- new TextMessage5({
2068
- role: Role5.System,
2069
- content: insertionApiConfig.makeSystemPrompt(
2070
- textareaPurpose,
2071
- getContextString(documents, contextCategories)
2072
- )
2073
- }),
2074
- ...insertionApiConfig.fewShotMessages,
2075
- new TextMessage5({
2076
- role: Role5.User,
2077
- content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
2078
- }),
2079
- new TextMessage5({
2080
- role: Role5.User,
2081
- content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
2082
- }),
2083
- new TextMessage5({
2084
- role: Role5.User,
2085
- content: `<InsertionPrompt>${insertionPrompt}</InsertionPrompt>`
2086
- })
2087
- ];
2088
- return runtimeClientResponseToStringStream(
2089
- runtimeClient.generateCopilotResponse({
2090
- data: {
2091
- frontend: {
2092
- actions: [],
2093
- url: window.location.href
2094
- },
2095
- messages: convertMessagesToGqlInput2(filterAgentStateMessages2(messages)),
2096
- metadata: {
2097
- requestType: CopilotRequestType2.TextareaCompletion
2098
- }
2099
- },
2100
- properties: copilotApiConfig.properties,
2101
- signal: abortSignal
2102
- })
2103
- );
2104
- }));
2105
- return res;
2106
- }),
2107
- [insertionApiConfig, getContextString, contextCategories, textareaPurpose]
2108
- );
2109
- const editingFunction = useCallback5(
2110
- (editorState2, editingPrompt, documents, abortSignal) => __async(this, null, function* () {
2111
- const res = yield retry(() => __async(this, null, function* () {
2112
- const messages = [
2113
- new TextMessage5({
2114
- role: Role5.System,
2115
- content: editingApiConfig.makeSystemPrompt(
2116
- textareaPurpose,
2117
- getContextString(documents, contextCategories)
2118
- )
2119
- }),
2120
- ...editingApiConfig.fewShotMessages,
2121
- new TextMessage5({
2122
- role: Role5.User,
2123
- content: `<TextBeforeCursor>${editorState2.textBeforeCursor}</TextBeforeCursor>`
2124
- }),
2125
- new TextMessage5({
2126
- role: Role5.User,
2127
- content: `<TextToEdit>${editorState2.selectedText}</TextToEdit>`
2128
- }),
2129
- new TextMessage5({
2130
- role: Role5.User,
2131
- content: `<TextAfterCursor>${editorState2.textAfterCursor}</TextAfterCursor>`
2132
- }),
2133
- new TextMessage5({
2134
- role: Role5.User,
2135
- content: `<EditingPrompt>${editingPrompt}</EditingPrompt>`
2136
- })
2137
- ];
2138
- const runtimeClient2 = new CopilotRuntimeClient2({
2139
- url: copilotApiConfig.chatApiEndpoint,
2140
- publicApiKey: copilotApiConfig.publicApiKey,
2141
- headers,
2142
- credentials: copilotApiConfig.credentials
2143
- });
2144
- return runtimeClientResponseToStringStream(
2145
- runtimeClient2.generateCopilotResponse({
2146
- data: {
2147
- frontend: {
2148
- actions: [],
2149
- url: window.location.href
2150
- },
2151
- messages: convertMessagesToGqlInput2(filterAgentStateMessages2(messages)),
2152
- metadata: {
2153
- requestType: CopilotRequestType2.TextareaCompletion
2154
- }
2155
- },
2156
- properties: copilotApiConfig.properties,
2157
- signal: abortSignal
2158
- })
2159
- );
2160
- }));
2161
- return res;
2162
- }),
2163
- [editingApiConfig, getContextString, contextCategories, textareaPurpose]
2164
- );
2165
- const insertionOrEditingFunction = useCallback5(
2166
- (editorState2, insertionPrompt, documents, abortSignal) => __async(this, null, function* () {
2167
- if (editorState2.selectedText === "") {
2168
- return yield insertionFunction(editorState2, insertionPrompt, documents, abortSignal);
2169
- } else {
2170
- return yield editingFunction(editorState2, insertionPrompt, documents, abortSignal);
2171
- }
2172
- }),
2173
- [insertionFunction, editingFunction]
2174
- );
2175
- return insertionOrEditingFunction;
2176
- }
2177
-
2178
- // src/components/copilot-textarea/copilot-textarea.tsx
2179
- import merge from "lodash.merge";
2180
- import { Fragment as Fragment3, jsx as jsx14 } from "react/jsx-runtime";
2181
- var CopilotTextarea = React7.forwardRef(
2182
- (props, ref) => {
2183
- const _a = props, { autosuggestionsConfig: autosuggestionsConfigUserSpecified } = _a, forwardedProps = __objRest(_a, ["autosuggestionsConfig"]);
2184
- const autosuggestionsConfig = merge(
2185
- defaultAutosuggestionsConfig,
2186
- autosuggestionsConfigUserSpecified
2187
- );
2188
- const autosuggestionsFunction = useMakeStandardAutosuggestionFunction(
2189
- autosuggestionsConfig.textareaPurpose,
2190
- autosuggestionsConfig.contextCategories,
2191
- autosuggestionsConfig.chatApiConfigs.suggestionsApiConfig
2192
- );
2193
- const insertionOrEditingFunction = useMakeStandardInsertionOrEditingFunction(
2194
- autosuggestionsConfig.textareaPurpose,
2195
- autosuggestionsConfig.contextCategories,
2196
- autosuggestionsConfig.chatApiConfigs.insertionApiConfig,
2197
- autosuggestionsConfig.chatApiConfigs.editingApiConfig
2198
- );
2199
- return /* @__PURE__ */ jsx14(Fragment3, { children: /* @__PURE__ */ jsx14(
2200
- BaseCopilotTextarea,
2201
- __spreadProps(__spreadValues({
2202
- ref
2203
- }, forwardedProps), {
2204
- baseAutosuggestionsConfig: __spreadProps(__spreadValues({}, autosuggestionsConfig), {
2205
- apiConfig: {
2206
- insertionOrEditingFunction,
2207
- autosuggestionsFunction
2208
- }
2209
- })
2210
- })
2211
- ) });
2212
- }
2213
- );
13
+ BaseCopilotTextarea
14
+ } from "../chunk-J62KUPFZ.mjs";
15
+ import "../chunk-2C7O2EVM.mjs";
16
+ import "../chunk-GQN2HYFJ.mjs";
17
+ import "../chunk-23Q6A46J.mjs";
18
+ import "../chunk-AJ5OMEXM.mjs";
19
+ import "../chunk-DRV2FOHZ.mjs";
20
+ import "../chunk-4NHVQZ67.mjs";
21
+ import "../chunk-QJNFNPWH.mjs";
22
+ import "../chunk-5UNJXFUO.mjs";
23
+ import "../chunk-LQ2OWQU7.mjs";
24
+ import "../chunk-7LSRNPNI.mjs";
25
+ import "../chunk-4AMCUMC7.mjs";
26
+ import "../chunk-L7VVZH4Q.mjs";
27
+ import "../chunk-I3SPIGAI.mjs";
28
+ import "../chunk-UGEKMSRR.mjs";
29
+ import "../chunk-KMVGEY7Q.mjs";
30
+ import "../chunk-3PQ7GSFE.mjs";
31
+ import "../chunk-4PDYALMP.mjs";
32
+ import "../chunk-D47EKHIF.mjs";
33
+ import "../chunk-LYB4B6MK.mjs";
34
+ import "../chunk-CF5GISTC.mjs";
35
+ import "../chunk-WGWQRALG.mjs";
36
+ import "../chunk-VSVQZUPW.mjs";
37
+ import "../chunk-I72DKFHD.mjs";
38
+ import "../chunk-2QDCE7PD.mjs";
39
+ import "../chunk-YLFAIYRY.mjs";
40
+ import "../chunk-WJHSY5T6.mjs";
41
+ import "../chunk-4CVSOOJY.mjs";
42
+ import "../chunk-224UKA7C.mjs";
43
+ import "../chunk-XW3ICO4S.mjs";
44
+ import "../chunk-DFTV4TST.mjs";
45
+ import "../chunk-T6MTDQZ7.mjs";
46
+ import "../chunk-ECR45NSD.mjs";
47
+ import "../chunk-KNQIEOFP.mjs";
48
+ import "../chunk-MRXNTQOX.mjs";
2214
49
  export {
2215
50
  BaseCopilotTextarea,
2216
51
  CopilotTextarea