@copilotkit/react-textarea 0.19.0-alpha.8 → 0.19.0-alpha.9
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.
- package/.turbo/turbo-build.log +150 -151
- package/CHANGELOG.md +11 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.d.ts +13 -0
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +32 -208
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.d.ts +6 -0
- package/dist/components/base-copilot-textarea/render-placeholder.d.ts +6 -0
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.d.ts +6 -0
- package/dist/components/base-copilot-textarea/use-add-branding-css.d.ts +3 -0
- package/dist/components/copilot-textarea/copilot-textarea.d.ts +19 -0
- package/dist/components/copilot-textarea/copilot-textarea.mjs +35 -211
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.d.ts +13 -0
- package/dist/components/hovering-toolbar/hovering-toolbar-components.d.ts +18 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.d.ts +9 -0
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +29 -207
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.d.ts +26 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs +23 -207
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.d.ts +13 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs +25 -207
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.d.ts +3 -0
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +25 -207
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.mjs +38 -214
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.d.ts +10 -0
- package/dist/components/source-search-box/source-search-box.d.ts +14 -0
- package/dist/components/source-search-box/source-search-box.mjs +21 -168
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.d.ts +14 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/command.d.ts +48 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/label.d.ts +8 -0
- package/dist/components/ui/separator.d.ts +6 -0
- package/dist/components/ui/textarea.d.ts +7 -0
- package/dist/context/index.d.ts +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.d.ts +13 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.d.ts +8 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.d.ts +7 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.d.ts +21 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.d.ts +22 -0
- package/dist/hooks/misc/use-autosize-textarea.d.ts +5 -0
- package/dist/index.css +4 -18
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +16 -0
- package/dist/index.mjs +38 -214
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.d.ts +11 -0
- package/dist/lib/editor-to-text.d.ts +7 -0
- package/dist/lib/get-text-around-cursor.d.ts +15 -0
- package/dist/lib/retry.d.ts +3 -0
- package/dist/lib/slatejs-edits/add-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/clear-autocompletions.d.ts +8 -0
- package/dist/lib/slatejs-edits/replace-text.d.ts +5 -0
- package/dist/lib/slatejs-edits/with-partial-history.d.ts +10 -0
- package/dist/lib/stream-promise-flatten.d.ts +3 -0
- package/dist/lib/utils.d.ts +10 -0
- package/dist/lib/utils.test.d.ts +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config-user-specified.d.ts +22 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.d.ts +19 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +1 -0
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/index.d.ts +11 -0
- package/dist/types/autosuggestions-config/index.mjs +1 -0
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.d.ts +15 -0
- package/dist/types/autosuggestions-config/subtypes/chatlike-api-endpoint.d.ts +27 -0
- package/dist/types/autosuggestions-config/subtypes/make-system-prompt.d.ts +3 -0
- package/dist/types/autosuggestions-config/subtypes/minimal-chat-gpt-message.d.ts +7 -0
- package/dist/types/autosuggestions-config/suggestions-api-config.d.ts +15 -0
- package/dist/types/base/autosuggestion-state.d.ts +8 -0
- package/dist/types/base/autosuggestions-bare-function.d.ts +17 -0
- package/dist/types/base/base-autosuggestions-config.d.ts +15 -0
- package/dist/types/base/base-autosuggestions-config.mjs +1 -0
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/base-copilot-textarea-props.d.ts +40 -0
- package/dist/types/base/custom-editor.d.ts +29 -0
- package/dist/types/base/editor-autocomplete-state.d.ts +10 -0
- package/dist/types/base/index.d.ts +4 -0
- package/dist/types/base/index.mjs +1 -0
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.d.ts +7 -0
- package/dist/types/index.d.ts +14 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -1
- package/package.json +4 -4
- package/src/components/base-copilot-textarea/base-copilot-textarea.tsx +4 -1
- package/src/components/hovering-toolbar/hovering-toolbar.tsx +2 -0
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx +26 -152
- package/src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx +2 -0
- package/src/components/source-search-box/source-search-box.tsx +13 -17
- package/src/types/base/base-autosuggestions-config.tsx +2 -0
package/dist/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.mjs
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
|
-
var __defProps = Object.defineProperties;
|
|
3
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
2
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
3
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
4
|
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
@@ -16,7 +14,6 @@ var __spreadValues = (a, b) => {
|
|
|
16
14
|
}
|
|
17
15
|
return a;
|
|
18
16
|
};
|
|
19
|
-
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
17
|
var __objRest = (source, exclude) => {
|
|
21
18
|
var target = {};
|
|
22
19
|
for (var prop in source)
|
|
@@ -170,11 +167,6 @@ var CommandShortcut = (_a) => {
|
|
|
170
167
|
CommandShortcut.displayName = "CommandShortcut";
|
|
171
168
|
|
|
172
169
|
// src/components/source-search-box/source-search-box.tsx
|
|
173
|
-
import {
|
|
174
|
-
Calculator,
|
|
175
|
-
Calendar,
|
|
176
|
-
Smile
|
|
177
|
-
} from "lucide-react";
|
|
178
170
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
179
171
|
function SourceSearchBox(props) {
|
|
180
172
|
const [selectedValue, setSelectedValue] = useState("");
|
|
@@ -203,12 +195,11 @@ function SourceSearchBox(props) {
|
|
|
203
195
|
children: "No results found."
|
|
204
196
|
}),
|
|
205
197
|
/* @__PURE__ */ jsx2(CommandGroup, {
|
|
206
|
-
heading: "
|
|
207
|
-
children: props.
|
|
198
|
+
heading: "Available resources",
|
|
199
|
+
children: props.suggestedFiles.map((filePointer) => {
|
|
208
200
|
return /* @__PURE__ */ jsx2(CommandItem, {
|
|
209
201
|
value: filePointer.name,
|
|
210
202
|
onSelect: (value) => {
|
|
211
|
-
console.log(filePointer.name);
|
|
212
203
|
props.onSelectedFile(filePointer);
|
|
213
204
|
},
|
|
214
205
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -216,9 +207,11 @@ function SourceSearchBox(props) {
|
|
|
216
207
|
children: [
|
|
217
208
|
/* @__PURE__ */ jsx2(Logo, {
|
|
218
209
|
size: "30px",
|
|
219
|
-
children: /* @__PURE__ */ jsx2(
|
|
220
|
-
filePointer,
|
|
221
|
-
|
|
210
|
+
children: /* @__PURE__ */ jsx2("img", {
|
|
211
|
+
src: filePointer.iconImageUri,
|
|
212
|
+
alt: filePointer.sourceApplication,
|
|
213
|
+
width: 30,
|
|
214
|
+
height: 30
|
|
222
215
|
})
|
|
223
216
|
}),
|
|
224
217
|
filePointer.name
|
|
@@ -227,45 +220,6 @@ function SourceSearchBox(props) {
|
|
|
227
220
|
}, `word-${filePointer.sourceApplication}.${filePointer.name}`);
|
|
228
221
|
})
|
|
229
222
|
}),
|
|
230
|
-
/* @__PURE__ */ jsxs(CommandGroup, {
|
|
231
|
-
heading: "Suggestions",
|
|
232
|
-
children: [
|
|
233
|
-
/* @__PURE__ */ jsxs(CommandItem, {
|
|
234
|
-
onSelect: (value) => {
|
|
235
|
-
console.log(value);
|
|
236
|
-
console.log(value);
|
|
237
|
-
},
|
|
238
|
-
children: [
|
|
239
|
-
/* @__PURE__ */ jsx2(Calendar, {
|
|
240
|
-
className: "mr-2 h-4 w-4"
|
|
241
|
-
}),
|
|
242
|
-
/* @__PURE__ */ jsx2("span", {
|
|
243
|
-
children: "Calendar"
|
|
244
|
-
})
|
|
245
|
-
]
|
|
246
|
-
}),
|
|
247
|
-
/* @__PURE__ */ jsxs(CommandItem, {
|
|
248
|
-
children: [
|
|
249
|
-
/* @__PURE__ */ jsx2(Smile, {
|
|
250
|
-
className: "mr-2 h-4 w-4"
|
|
251
|
-
}),
|
|
252
|
-
/* @__PURE__ */ jsx2("span", {
|
|
253
|
-
children: "Search Emoji"
|
|
254
|
-
})
|
|
255
|
-
]
|
|
256
|
-
}),
|
|
257
|
-
/* @__PURE__ */ jsxs(CommandItem, {
|
|
258
|
-
children: [
|
|
259
|
-
/* @__PURE__ */ jsx2(Calculator, {
|
|
260
|
-
className: "mr-2 h-4 w-4"
|
|
261
|
-
}),
|
|
262
|
-
/* @__PURE__ */ jsx2("span", {
|
|
263
|
-
children: "Calculator"
|
|
264
|
-
})
|
|
265
|
-
]
|
|
266
|
-
})
|
|
267
|
-
]
|
|
268
|
-
}),
|
|
269
223
|
/* @__PURE__ */ jsx2(CommandSeparator, {})
|
|
270
224
|
]
|
|
271
225
|
})
|
|
@@ -277,7 +231,7 @@ function Logo({
|
|
|
277
231
|
size = "30px"
|
|
278
232
|
}) {
|
|
279
233
|
return /* @__PURE__ */ jsx2("div", {
|
|
280
|
-
className: "flex items-center justify-center",
|
|
234
|
+
className: "flex items-center justify-center bg-black",
|
|
281
235
|
style: { width: size, height: size },
|
|
282
236
|
children
|
|
283
237
|
});
|
|
@@ -344,7 +298,7 @@ var Label = React3.forwardRef((_a, ref) => {
|
|
|
344
298
|
Label.displayName = LabelPrimitive.Root.displayName;
|
|
345
299
|
|
|
346
300
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
347
|
-
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
301
|
+
import { useContext, useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
348
302
|
import Chip from "@mui/material/Chip";
|
|
349
303
|
import Avatar from "@mui/material/Avatar";
|
|
350
304
|
|
|
@@ -373,8 +327,15 @@ function streamPromiseFlatten(promise) {
|
|
|
373
327
|
}
|
|
374
328
|
|
|
375
329
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx
|
|
330
|
+
import { CopilotContext } from "@copilotkit/react-core";
|
|
376
331
|
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
377
|
-
var HoveringInsertionPromptBoxCore = ({
|
|
332
|
+
var HoveringInsertionPromptBoxCore = ({
|
|
333
|
+
performInsertion,
|
|
334
|
+
state,
|
|
335
|
+
insertionOrEditingFunction,
|
|
336
|
+
contextCategories
|
|
337
|
+
}) => {
|
|
338
|
+
const { getDocumentsContext } = useContext(CopilotContext);
|
|
378
339
|
const [editSuggestion, setEditSuggestion] = useState2("");
|
|
379
340
|
const [suggestionIsLoading, setSuggestionIsLoading] = useState2(false);
|
|
380
341
|
const [adjustmentPrompt, setAdjustmentPrompt] = useState2("");
|
|
@@ -382,6 +343,10 @@ var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEdit
|
|
|
382
343
|
const adjustmentTextAreaRef = useRef(null);
|
|
383
344
|
const suggestionTextAreaRef = useRef(null);
|
|
384
345
|
const [filePointers, setFilePointers] = useState2([]);
|
|
346
|
+
const [suggestedFiles, setSuggestedFiles] = useState2([]);
|
|
347
|
+
useEffect2(() => {
|
|
348
|
+
setSuggestedFiles(getDocumentsContext(contextCategories));
|
|
349
|
+
}, [contextCategories, getDocumentsContext]);
|
|
385
350
|
use_autosize_textarea_default(suggestionTextAreaRef, editSuggestion || "");
|
|
386
351
|
use_autosize_textarea_default(adjustmentTextAreaRef, adjustmentPrompt || "");
|
|
387
352
|
useEffect2(() => {
|
|
@@ -551,7 +516,7 @@ var HoveringInsertionPromptBoxCore = ({ performInsertion, state, insertionOrEdit
|
|
|
551
516
|
}),
|
|
552
517
|
sourceSearchWord !== void 0 && /* @__PURE__ */ jsx5(SourceSearchBox, {
|
|
553
518
|
searchTerm: sourceSearchWord,
|
|
554
|
-
|
|
519
|
+
suggestedFiles,
|
|
555
520
|
onSelectedFile: (filePointer) => {
|
|
556
521
|
var _a;
|
|
557
522
|
setAdjustmentPrompt(
|
|
@@ -601,158 +566,10 @@ var FileChipPreview = ({
|
|
|
601
566
|
label: filePointer.name,
|
|
602
567
|
onDelete,
|
|
603
568
|
avatar: /* @__PURE__ */ jsx5(Avatar, {
|
|
604
|
-
sx: { backgroundColor: "transparent" }
|
|
605
|
-
children: /* @__PURE__ */ jsx5(IconForFilePointer, {
|
|
606
|
-
filePointer,
|
|
607
|
-
className: "w-4 h-1 object-contain"
|
|
608
|
-
})
|
|
569
|
+
sx: { backgroundColor: "transparent" }
|
|
609
570
|
})
|
|
610
571
|
});
|
|
611
572
|
};
|
|
612
|
-
function IconForFilePointer({
|
|
613
|
-
filePointer,
|
|
614
|
-
className
|
|
615
|
-
}) {
|
|
616
|
-
if (filePointer.sourceApplication === "Salesforce") {
|
|
617
|
-
return /* @__PURE__ */ jsx5(IconSalesforce, {
|
|
618
|
-
className
|
|
619
|
-
});
|
|
620
|
-
} else if (filePointer.sourceApplication === "GoogleDocs") {
|
|
621
|
-
return /* @__PURE__ */ jsx5(IconGoogleDocs, {
|
|
622
|
-
className
|
|
623
|
-
});
|
|
624
|
-
} else {
|
|
625
|
-
return /* @__PURE__ */ jsx5(IconSalesforce, {
|
|
626
|
-
className
|
|
627
|
-
});
|
|
628
|
-
}
|
|
629
|
-
}
|
|
630
|
-
function IconSalesforce(_a) {
|
|
631
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
632
|
-
return /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({
|
|
633
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
634
|
-
xmlnsXlink: "http://www.w3.org/1999/xlink",
|
|
635
|
-
preserveAspectRatio: "xMidYMid meet",
|
|
636
|
-
viewBox: "0 0 273 191"
|
|
637
|
-
}, props), {
|
|
638
|
-
children: [
|
|
639
|
-
/* @__PURE__ */ jsx5("title", {
|
|
640
|
-
children: "Salesforce.com logo"
|
|
641
|
-
}),
|
|
642
|
-
/* @__PURE__ */ jsx5("defs", {
|
|
643
|
-
children: /* @__PURE__ */ jsx5("path", {
|
|
644
|
-
id: "a",
|
|
645
|
-
d: "M.06.5h272v190H.06z"
|
|
646
|
-
})
|
|
647
|
-
}),
|
|
648
|
-
/* @__PURE__ */ jsxs2("g", {
|
|
649
|
-
fillRule: "evenodd",
|
|
650
|
-
children: [
|
|
651
|
-
/* @__PURE__ */ jsx5("mask", {
|
|
652
|
-
id: "b",
|
|
653
|
-
fill: "#fff",
|
|
654
|
-
children: /* @__PURE__ */ jsx5("use", {
|
|
655
|
-
xlinkHref: "#a"
|
|
656
|
-
})
|
|
657
|
-
}),
|
|
658
|
-
/* @__PURE__ */ jsx5("path", {
|
|
659
|
-
fill: "#00A1E0",
|
|
660
|
-
d: "M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8",
|
|
661
|
-
mask: "url(#b)"
|
|
662
|
-
}),
|
|
663
|
-
/* @__PURE__ */ jsx5("path", {
|
|
664
|
-
fill: "#FFFFFE",
|
|
665
|
-
d: "M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31"
|
|
666
|
-
}),
|
|
667
|
-
/* @__PURE__ */ jsx5("path", {
|
|
668
|
-
fill: "#FFFFFE",
|
|
669
|
-
d: "M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668"
|
|
670
|
-
})
|
|
671
|
-
]
|
|
672
|
-
})
|
|
673
|
-
]
|
|
674
|
-
}));
|
|
675
|
-
}
|
|
676
|
-
function IconGoogleDocs(_a) {
|
|
677
|
-
var _b = _a, { className } = _b, props = __objRest(_b, ["className"]);
|
|
678
|
-
return /* @__PURE__ */ jsxs2("svg", __spreadProps(__spreadValues({
|
|
679
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
680
|
-
xmlSpace: "preserve",
|
|
681
|
-
viewBox: "0 0 64 88"
|
|
682
|
-
}, props), {
|
|
683
|
-
children: [
|
|
684
|
-
/* @__PURE__ */ jsx5("path", {
|
|
685
|
-
d: "M58 88H6c-3.3 0-6-2.7-6-6V6c0-3.3 2.7-6 6-6h36l22 22v60c0 3.3-2.7 6-6 6z",
|
|
686
|
-
style: {
|
|
687
|
-
fill: "#3086f6"
|
|
688
|
-
}
|
|
689
|
-
}),
|
|
690
|
-
/* @__PURE__ */ jsx5("path", {
|
|
691
|
-
d: "m42 0 22 22H42V0z",
|
|
692
|
-
style: {
|
|
693
|
-
fill: "#0c67d6"
|
|
694
|
-
}
|
|
695
|
-
}),
|
|
696
|
-
/* @__PURE__ */ jsx5("path", {
|
|
697
|
-
d: "M50 39H14v-5h36v5zm0 7H14v5h36v-5zM40 58H14v5h26v-5z",
|
|
698
|
-
style: {
|
|
699
|
-
fill: "#fdffff"
|
|
700
|
-
}
|
|
701
|
-
})
|
|
702
|
-
]
|
|
703
|
-
}));
|
|
704
|
-
}
|
|
705
|
-
var mockFiles = [
|
|
706
|
-
{
|
|
707
|
-
name: "CopilotTextarea README",
|
|
708
|
-
sourceApplication: "GoogleDocs",
|
|
709
|
-
getContents: () => __async(void 0, null, function* () {
|
|
710
|
-
return "some contents";
|
|
711
|
-
})
|
|
712
|
-
},
|
|
713
|
-
{
|
|
714
|
-
name: "prospecting call transcript",
|
|
715
|
-
sourceApplication: "Salesforce",
|
|
716
|
-
getContents: () => __async(void 0, null, function* () {
|
|
717
|
-
return "some contents";
|
|
718
|
-
})
|
|
719
|
-
},
|
|
720
|
-
{
|
|
721
|
-
name: "customer feedback",
|
|
722
|
-
sourceApplication: "Zendesk",
|
|
723
|
-
getContents: () => __async(void 0, null, function* () {
|
|
724
|
-
return "some contents";
|
|
725
|
-
})
|
|
726
|
-
},
|
|
727
|
-
{
|
|
728
|
-
name: "product specifications",
|
|
729
|
-
sourceApplication: "Google Docs",
|
|
730
|
-
getContents: () => __async(void 0, null, function* () {
|
|
731
|
-
return "some contents";
|
|
732
|
-
})
|
|
733
|
-
},
|
|
734
|
-
{
|
|
735
|
-
name: "meeting minutes",
|
|
736
|
-
sourceApplication: "Microsoft Teams",
|
|
737
|
-
getContents: () => __async(void 0, null, function* () {
|
|
738
|
-
return "some contents";
|
|
739
|
-
})
|
|
740
|
-
},
|
|
741
|
-
{
|
|
742
|
-
name: "project plan",
|
|
743
|
-
sourceApplication: "Trello",
|
|
744
|
-
getContents: () => __async(void 0, null, function* () {
|
|
745
|
-
return "some contents";
|
|
746
|
-
})
|
|
747
|
-
},
|
|
748
|
-
{
|
|
749
|
-
name: "code review comments",
|
|
750
|
-
sourceApplication: "Github",
|
|
751
|
-
getContents: () => __async(void 0, null, function* () {
|
|
752
|
-
return "some contents";
|
|
753
|
-
})
|
|
754
|
-
}
|
|
755
|
-
];
|
|
756
573
|
|
|
757
574
|
// src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx
|
|
758
575
|
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
@@ -765,7 +582,8 @@ var HoveringInsertionPromptBox = (props) => {
|
|
|
765
582
|
editorState: props.editorState
|
|
766
583
|
},
|
|
767
584
|
performInsertion: props.performInsertion,
|
|
768
|
-
insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction
|
|
585
|
+
insertionOrEditingFunction: props.apiConfig.insertionOrEditingFunction,
|
|
586
|
+
contextCategories: props.contextCategories
|
|
769
587
|
})
|
|
770
588
|
});
|
|
771
589
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/hooks/misc/use-autosize-textarea.tsx","../../../../src/components/source-search-box/source-search-box.tsx","../../../../src/components/ui/command.tsx","../../../../src/lib/utils.ts","../../../../src/components/ui/button.tsx","../../../../src/components/ui/label.tsx","../../../../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx","../../../../src/lib/stream-promise-flatten.ts","../../../../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx"],"sourcesContent":["import { Ref, RefObject, useEffect } from \"react\";\n\n// Updates the height of a <textarea> when the value changes.\nconst useAutosizeTextArea = (\n textAreaRef: RefObject<HTMLTextAreaElement>,\n value: string\n) => {\n useEffect(() => {\n if (textAreaRef.current !== null) {\n // We need to reset the height momentarily to get the correct scrollHeight for the textarea\n textAreaRef.current.style.height = \"0px\";\n const scrollHeight = textAreaRef.current.scrollHeight;\n\n // We then set the height directly, outside of the render loop\n // Trying to set this with state or a ref will product an incorrect value.\n textAreaRef.current.style.height = scrollHeight + \"px\";\n }\n }, [textAreaRef, value]);\n};\n\nexport default useAutosizeTextArea;\n","import { useState } from \"react\";\nimport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from \"../ui/command\";\n\nimport {\n Calculator,\n Calendar,\n CreditCard,\n Settings,\n Smile,\n User,\n} from \"lucide-react\";\nimport { IconForFilePointer } from \"../hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core\";\n\nexport interface FilePointer {\n name: string;\n sourceApplication: string;\n getContents: () => Promise<string>;\n}\n\nexport interface SourceSearchBoxProps {\n searchTerm: string;\n recentFiles: FilePointer[];\n onSelectedFile: (filePointer: FilePointer) => void;\n}\n\nexport function SourceSearchBox(props: SourceSearchBoxProps) {\n const [selectedValue, setSelectedValue] = useState<string>(\"\");\n\n return (\n <Command\n className=\"rounded-lg border shadow-md\"\n value={selectedValue}\n onValueChange={(value) => {\n setSelectedValue(value);\n }}\n filter={(value, search) => {\n // if the search term is empty, show all commands\n if (props.searchTerm === \"\") return 1;\n\n // if the search term is a prefix of the command, show it\n if (value.startsWith(props.searchTerm)) return 1;\n\n // otherwise, don't show it\n return 0;\n }}\n >\n <CommandInput\n value={props.searchTerm}\n className=\"rounded-t-lg hidden\"\n placeholder=\"Search for a command...\"\n />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n\n <CommandGroup heading=\"Recents\">\n {props.recentFiles.map((filePointer) => {\n return (\n <CommandItem\n key={`word-${filePointer.sourceApplication}.${filePointer.name}`}\n value={filePointer.name}\n onSelect={(value) => {\n console.log(filePointer.name);\n props.onSelectedFile(filePointer);\n }}\n >\n <div className=\"flex flex-row gap-3 items-center\">\n <Logo size=\"30px\">\n <IconForFilePointer\n filePointer={filePointer}\n className=\"mx-auto my-auto\"\n />\n </Logo>\n {filePointer.name}\n </div>\n </CommandItem>\n );\n })}\n </CommandGroup>\n\n <CommandGroup heading=\"Suggestions\">\n <CommandItem\n onSelect={(value) => {\n console.log(value);\n console.log(value);\n }}\n >\n <Calendar className=\"mr-2 h-4 w-4\" />\n <span>Calendar</span>\n </CommandItem>\n <CommandItem>\n <Smile className=\"mr-2 h-4 w-4\" />\n <span>Search Emoji</span>\n </CommandItem>\n <CommandItem>\n <Calculator className=\"mr-2 h-4 w-4\" />\n <span>Calculator</span>\n </CommandItem>\n </CommandGroup>\n <CommandSeparator />\n </CommandList>\n </Command>\n );\n}\n\nexport function Logo({\n children,\n size = \"30px\",\n}: {\n children: React.ReactNode;\n size?: string;\n}) {\n return (\n <div\n className=\"flex items-center justify-center\"\n style={{ width: size, height: size }}\n >\n {children}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { Dialog, DialogContent } from \"./dialog\";\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0 shadow-lg\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n {/* <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" /> */}\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n </div>\n));\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nconst CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n\nexport const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>\n arr1.length === arr2.length &&\n arr1.every((value, index) => value === arr2[index]);\n\nexport function nullableCompatibleEqualityCheck<T>(\n naiveEqualityCheck: (a: T, b: T) => boolean,\n a: T | null | undefined,\n b: T | null | undefined\n): boolean {\n if (a === null || a === undefined || b === null || b === undefined) {\n return a === b;\n }\n\n return naiveEqualityCheck(a, b);\n}\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","import useAutosizeTextArea from \"../../../hooks/misc/use-autosize-textarea\";\nimport { MinimalChatGPTMessage } from \"../../../types\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n} from \"../../../types/base/autosuggestions-bare-function\";\nimport {\n FilePointer,\n SourceSearchBox,\n} from \"../../source-search-box/source-search-box\";\nimport { Button } from \"../../ui/button\";\nimport { Label } from \"../../ui/label\";\nimport React, { useEffect, useRef, useState } from \"react\";\n\nimport Chip from \"@mui/material/Chip\";\nimport Avatar from \"@mui/material/Avatar\";\nimport { streamPromiseFlatten } from \"../../../lib/stream-promise-flatten\";\n\nexport type SuggestionState = {\n editorState: EditingEditorState;\n};\n\nexport interface HoveringInsertionPromptBoxCoreProps {\n state: SuggestionState;\n performInsertion: (insertedText: string) => void;\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n}\n\nexport const HoveringInsertionPromptBoxCore: React.FC<\n HoveringInsertionPromptBoxCoreProps\n> = ({ performInsertion, state, insertionOrEditingFunction }) => {\n const [editSuggestion, setEditSuggestion] = useState<string>(\"\");\n const [suggestionIsLoading, setSuggestionIsLoading] =\n useState<boolean>(false);\n\n const [adjustmentPrompt, setAdjustmentPrompt] = useState<string>(\"\");\n\n const [generatingSuggestion, setGeneratingSuggestion] =\n useState<ReadableStream<string> | null>(null);\n\n const adjustmentTextAreaRef = useRef<HTMLTextAreaElement>(null);\n const suggestionTextAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [filePointers, setFilePointers] = useState<FilePointer[]>([]);\n\n useAutosizeTextArea(suggestionTextAreaRef, editSuggestion || \"\");\n useAutosizeTextArea(adjustmentTextAreaRef, adjustmentPrompt || \"\");\n\n // initially focus on the adjustment prompt text area\n useEffect(() => {\n adjustmentTextAreaRef.current?.focus();\n }, []);\n\n useEffect(() => {\n // if no generating suggestion, do nothing\n if (!generatingSuggestion) {\n return;\n }\n\n // Check if the stream is already locked (i.e. already reading from it)\n if (generatingSuggestion.locked) {\n return;\n }\n\n // reset the edit suggestion\n setEditSuggestion(\"\");\n\n // read the generating suggestion stream and continuously update the edit suggestion\n const reader = generatingSuggestion.getReader();\n\n const read = async () => {\n setSuggestionIsLoading(true);\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n setEditSuggestion((prev) => {\n const newSuggestion = prev + value;\n\n // Scroll to the bottom of the textarea. We call this here to make sure scroll-to-bottom is synchronous with the state update.\n if (suggestionTextAreaRef.current) {\n suggestionTextAreaRef.current.scrollTop =\n suggestionTextAreaRef.current.scrollHeight;\n }\n return newSuggestion;\n });\n }\n\n setSuggestionIsLoading(false);\n };\n read();\n\n return () => {\n const releaseLockIfNotClosed = async () => {\n try {\n await reader.closed;\n } catch {\n reader.releaseLock();\n }\n };\n\n releaseLockIfNotClosed();\n };\n }, [generatingSuggestion]);\n\n const begingGeneratingAdjustment = async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n // if the current edit suggestion is not empty, then use it as the selected text instead of the editor state's selected text\n let editorState = state.editorState;\n if (editSuggestion !== \"\") {\n editorState.selectedText = editSuggestion;\n }\n\n const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(\n editorState,\n adjustmentPrompt,\n new AbortController().signal\n );\n const adjustmentSuggestionTextStream = streamPromiseFlatten(\n adjustmentSuggestionTextStreamPromise\n );\n\n setGeneratingSuggestion(adjustmentSuggestionTextStream);\n };\n\n const isLoading = suggestionIsLoading;\n\n const textToEdit = editSuggestion || state.editorState.selectedText;\n const adjustmentLabel =\n textToEdit === \"\"\n ? \"Describe the text you want to insert\"\n : \"Describe adjustments to the suggested text\";\n const placeholder =\n textToEdit === \"\"\n ? \"e.g. 'summarize the client's top 3 pain-points from @CallTranscript'\"\n : \"e.g. 'make it more formal', 'be more specific', ...\";\n\n const AdjustmentPromptComponent = (\n <>\n <Label className=\"\">{adjustmentLabel}</Label>\n <div className=\"relative w-full flex items-center\">\n <textarea\n disabled={suggestionIsLoading}\n ref={adjustmentTextAreaRef}\n value={adjustmentPrompt}\n onChange={(e) => setAdjustmentPrompt(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && e.shiftKey) {\n e.preventDefault();\n setAdjustmentPrompt(adjustmentPrompt + \"\\n\");\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n begingGeneratingAdjustment();\n }\n }}\n placeholder={placeholder}\n style={{ minHeight: \"3rem\" }}\n 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]\"\n rows={1}\n />\n <button\n onClick={begingGeneratingAdjustment}\n className=\"absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center\"\n >\n <i className=\"material-icons\">arrow_forward</i>\n </button>\n </div>\n </>\n );\n\n const SuggestionComponent = (\n <>\n <div className=\"flex justify-between items-end w-full\">\n <Label className=\"mt-4\">Suggested:</Label>\n <div className=\"ml-auto\">\n {isLoading && (\n <div className=\"flex justify-center items-center\">\n <div\n 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]\"\n role=\"status\"\n >\n <span className=\"!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]\">\n Loading...\n </span>\n </div>\n </div>\n )}\n </div>\n </div>\n <textarea\n ref={suggestionTextAreaRef}\n value={editSuggestion}\n disabled={suggestionIsLoading}\n onChange={(e) => setEditSuggestion(e.target.value)}\n className=\"w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50\"\n style={{ overflow: \"auto\", maxHeight: \"10em\" }}\n />\n </>\n );\n\n const SubmitComponent = (\n <div className=\"flex w-full gap-4 justify-start\">\n <Button\n className=\" bg-green-700 text-white\"\n onClick={() => {\n performInsertion(editSuggestion);\n }}\n >\n Insert <i className=\"material-icons\">check</i>\n </Button>\n </div>\n );\n\n // show source search if the last word in the adjustment prompt BEGINS with an @\n const sourceSearchCandidate = adjustmentPrompt.split(\" \").pop();\n // if the candidate is @someCandidate, then 'someCandidate', otherwise undefined\n const sourceSearchWord = sourceSearchCandidate?.startsWith(\"@\")\n ? sourceSearchCandidate.slice(1)\n : undefined;\n\n return (\n <div className=\"w-full flex flex-col items-start relative gap-2\">\n {AdjustmentPromptComponent}\n {filePointers.length > 0 && (\n <IncludedFilesPreview\n includedFiles={filePointers}\n setIncludedFiles={setFilePointers}\n />\n )}\n {sourceSearchWord !== undefined && (\n <SourceSearchBox\n searchTerm={sourceSearchWord}\n recentFiles={mockFiles}\n onSelectedFile={(filePointer) => {\n setAdjustmentPrompt(\n adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), \"\")\n );\n setFilePointers((prev) => [...prev, filePointer]);\n\n // focus back on the adjustment prompt, and move the cursor to the end\n adjustmentTextAreaRef.current?.focus();\n }}\n />\n )}\n {generatingSuggestion ? SuggestionComponent : null}\n {generatingSuggestion ? SubmitComponent : null}\n </div>\n );\n};\n\ninterface IncludedFilesPreviewProps {\n includedFiles: FilePointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<FilePointer[]>>;\n}\n\nexport const IncludedFilesPreview: React.FC<IncludedFilesPreviewProps> = ({\n includedFiles,\n setIncludedFiles,\n}) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) =>\n prev.filter((fp) => fp !== filePointer)\n );\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: FilePointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({\n filePointer,\n onDelete,\n}) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={\n <Avatar sx={{ backgroundColor: \"transparent\" }}>\n <IconForFilePointer\n filePointer={filePointer}\n className=\"w-4 h-1 object-contain\"\n />\n </Avatar>\n }\n />\n );\n};\n\nexport function IconForFilePointer({\n filePointer,\n className,\n}: {\n filePointer: FilePointer;\n className: string;\n}): JSX.Element {\n if (filePointer.sourceApplication === \"Salesforce\") {\n return <IconSalesforce className={className} />;\n } else if (filePointer.sourceApplication === \"GoogleDocs\") {\n return <IconGoogleDocs className={className} />;\n } else {\n return <IconSalesforce className={className} />;\n }\n}\n\nfunction IconSalesforce({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlnsXlink=\"http://www.w3.org/1999/xlink\"\n preserveAspectRatio=\"xMidYMid meet\"\n viewBox=\"0 0 273 191\"\n {...props}\n >\n <title>{\"Salesforce.com logo\"}</title>\n <defs>\n <path id=\"a\" d=\"M.06.5h272v190H.06z\" />\n </defs>\n <g fillRule=\"evenodd\">\n <mask id=\"b\" fill=\"#fff\">\n <use xlinkHref=\"#a\" />\n </mask>\n <path\n fill=\"#00A1E0\"\n d=\"M113 21.3c8.78-9.14 21-14.8 34.5-14.8 18 0 33.6 10 42 24.9a58 58 0 0 1 23.7-5.05c32.4 0 58.7 26.5 58.7 59.2s-26.3 59.2-58.7 59.2c-3.96 0-7.82-.398-11.6-1.15-7.35 13.1-21.4 22-37.4 22a42.7 42.7 0 0 1-18.8-4.32c-7.45 17.5-24.8 29.8-45 29.8-21.1 0-39-13.3-45.9-32a45.1 45.1 0 0 1-9.34.972c-25.1 0-45.4-20.6-45.4-45.9 0-17 9.14-31.8 22.7-39.8a52.6 52.6 0 0 1-4.35-21c0-29.2 23.7-52.8 52.9-52.8 17.1 0 32.4 8.15 42 20.8\"\n mask=\"url(#b)\"\n />\n <path\n fill=\"#FFFFFE\"\n d=\"M39.4 99.3c-.171.446.061.539.116.618.511.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.92-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.26.799 7.09 1.81 0 0 .542.35.739-.173.107-.283 1.04-2.78 1.14-3.06.106-.293-.08-.514-.271-.628-2.1-1.28-5-2.15-8-2.15l-.557.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.592.184c2.68.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.941 0-3.94-.016-7.19-2.07-.393-.229-.617-.394-.92-.579-.16-.097-.56-.272-.734.252l-1.1 3.06m81.7 0c-.171.446.061.539.118.618.509.37 1.03.638 1.55.939 2.78 1.47 5.4 1.9 8.14 1.9 5.58 0 9.05-2.97 9.05-7.75v-.094c0-4.42-3.91-6.03-7.58-7.18l-.479-.155c-2.77-.898-5.16-1.68-5.16-3.5v-.093c0-1.56 1.4-2.71 3.56-2.71 2.4 0 5.25.799 7.09 1.81 0 0 .542.35.74-.173.106-.283 1.04-2.78 1.13-3.06.107-.293-.08-.514-.27-.628-2.1-1.28-5-2.15-8-2.15l-.558.002c-5.11 0-8.68 3.09-8.68 7.51v.095c0 4.66 3.94 6.18 7.62 7.23l.591.184c2.69.824 5 1.54 5 3.42v.094c0 1.73-1.51 3.02-3.93 3.02-.943 0-3.95-.016-7.19-2.07-.393-.229-.623-.387-.921-.579-.101-.064-.572-.248-.733.252l-1.1 3.06m55.8-9.36c0 2.7-.504 4.83-1.49 6.34-.984 1.49-2.47 2.22-4.54 2.22s-3.55-.724-4.52-2.21c-.977-1.5-1.47-3.64-1.47-6.34 0-2.7.496-4.82 1.47-6.31.968-1.48 2.44-2.19 4.52-2.19s3.56.717 4.54 2.19c.992 1.49 1.49 3.61 1.49 6.31m4.66-5.01c-.459-1.55-1.17-2.91-2.12-4.05a10.151 10.151 0 0 0-3.58-2.72c-1.42-.665-3.1-1-5-1s-3.57.337-5 1c-1.42.664-2.63 1.58-3.58 2.72-.948 1.14-1.66 2.5-2.12 4.05-.455 1.54-.686 3.22-.686 5.01 0 1.79.231 3.47.686 5.01.457 1.55 1.17 2.91 2.12 4.05.951 1.14 2.16 2.05 3.58 2.7 1.43.648 3.11.978 5 .978 1.89 0 3.57-.33 4.99-.978 1.42-.648 2.63-1.56 3.58-2.7.949-1.14 1.66-2.5 2.12-4.05.454-1.54.685-3.22.685-5.01 0-1.78-.231-3.47-.685-5.01m38.3 12.8c-.153-.453-.595-.282-.595-.282-.677.259-1.4.499-2.17.619-.776.122-1.64.183-2.55.183-2.25 0-4.05-.671-5.33-2-1.29-1.33-2.01-3.47-2-6.37.007-2.64.645-4.62 1.79-6.14 1.13-1.5 2.87-2.28 5.17-2.28 1.92 0 3.39.223 4.93.705 0 0 .365.159.54-.322.409-1.13.711-1.94 1.15-3.18.124-.355-.18-.505-.291-.548-.604-.236-2.03-.623-3.11-.786-1.01-.154-2.18-.234-3.5-.234-1.96 0-3.7.335-5.19.999-1.49.663-2.75 1.58-3.75 2.72-1 1.14-1.76 2.5-2.27 4.05-.505 1.54-.76 3.23-.76 5.02 0 3.86 1.04 6.99 3.1 9.28 2.06 2.3 5.16 3.46 9.2 3.46 2.39 0 4.84-.483 6.6-1.18 0 0 .336-.162.19-.554l-1.15-3.16m8.15-10.4c.223-1.5.634-2.75 1.28-3.72.967-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.65.975.934 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.397-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.959 1.16-1.68 2.53-2.14 4.1-.46 1.55-.692 3.25-.692 5.03 0 1.82.241 3.51.715 5.04.479 1.54 1.25 2.89 2.29 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.52.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.175-.098.34-.267.134-.754l-1.03-2.89c-.158-.431-.594-.275-.594-.275-1.13.422-2.73 1.18-6.48 1.17-2.45-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.471-6.79zm-142 3.3c.223-1.5.635-2.75 1.28-3.72.968-1.48 2.44-2.29 4.51-2.29s3.44.814 4.42 2.29c.649.975.933 2.27 1.04 3.72l-11.3-.002zm15.7-3.3c-.396-1.49-1.38-3-2.02-3.69-1.02-1.09-2.01-1.86-3-2.28a11.5 11.5 0 0 0-4.52-.917c-1.97 0-3.76.333-5.21 1.01-1.45.682-2.67 1.61-3.63 2.77-.957 1.16-1.68 2.53-2.14 4.1-.459 1.55-.69 3.25-.69 5.03 0 1.82.239 3.51.716 5.04.478 1.54 1.25 2.89 2.28 4.01 1.04 1.13 2.37 2.01 3.97 2.63 1.59.615 3.51.934 5.73.927 4.56-.015 6.96-1.03 7.94-1.58.174-.098.34-.267.133-.754l-1.03-2.89c-.159-.431-.595-.275-.595-.275-1.13.422-2.73 1.18-6.48 1.17-2.44-.004-4.26-.727-5.4-1.86-1.16-1.16-1.74-2.85-1.83-5.25l15.8.012s.416-.004.459-.41c.017-.168.541-3.24-.472-6.79zm-49.8 13.6c-.619-.494-.705-.615-.91-.936-.313-.483-.473-1.17-.473-2.05 0-1.38.46-2.38 1.41-3.05-.01.002 1.36-1.18 4.58-1.14a32 32 0 0 1 4.28.365v7.17h.002s-2 .431-4.26.567c-3.21.193-4.63-.924-4.62-.921zm6.28-11.1c-.64-.047-1.47-.07-2.46-.07-1.35 0-2.66.168-3.88.498-1.23.332-2.34.846-3.29 1.53a7.63 7.63 0 0 0-2.29 2.6c-.559 1.04-.844 2.26-.844 3.64 0 1.4.243 2.61.723 3.6a6.54 6.54 0 0 0 2.06 2.47c.877.638 1.96 1.11 3.21 1.39 1.24.283 2.64.426 4.18.426 1.62 0 3.23-.136 4.79-.399a95.1 95.1 0 0 0 3.97-.772c.526-.121 1.11-.28 1.11-.28.39-.099.36-.516.36-.516l-.009-14.4c0-3.16-.844-5.51-2.51-6.96-1.66-1.45-4.09-2.18-7.24-2.18-1.18 0-3.09.16-4.23.389 0 0-3.44.668-4.86 1.78 0 0-.312.192-.142.627l1.12 3c.139.389.518.256.518.256s.119-.047.259-.13c3.03-1.65 6.87-1.6 6.87-1.6 1.7 0 3.02.345 3.9 1.02.861.661 1.3 1.66 1.3 3.76v.667c-1.35-.196-2.6-.309-2.6-.309zm127-8.13a.428.428 0 0 0-.237-.568c-.269-.102-1.61-.385-2.64-.449-1.98-.124-3.08.21-4.07.654-.978.441-2.06 1.15-2.66 1.97l-.002-1.92c0-.264-.187-.477-.453-.477h-4.04c-.262 0-.452.213-.452.477v23.5a.48.48 0 0 0 .479.479h4.14a.479.479 0 0 0 .478-.479v-11.8c0-1.58.174-3.15.521-4.14.342-.979.807-1.76 1.38-2.32a4.79 4.79 0 0 1 1.95-1.17 7.68 7.68 0 0 1 2.12-.298c.825 0 1.73.212 1.73.212.304.034.473-.152.576-.426.271-.721 1.04-2.88 1.19-3.31\"\n />\n <path\n fill=\"#FFFFFE\"\n d=\"M162.201 67.548a13.258 13.258 0 0 0-1.559-.37 12.217 12.217 0 0 0-2.144-.166c-2.853 0-5.102.806-6.681 2.398-1.568 1.58-2.635 3.987-3.17 7.154l-.193 1.069h-3.581s-.437-.018-.529.459l-.588 3.28c-.041.314.094.51.514.508h3.486l-3.537 19.743c-.277 1.59-.594 2.898-.945 3.889-.346.978-.684 1.711-1.1 2.243-.403.515-.785.894-1.444 1.115-.544.183-1.17.267-1.856.267-.382 0-.89-.064-1.265-.139-.375-.074-.57-.158-.851-.276 0 0-.409-.156-.57.254-.131.335-1.06 2.89-1.17 3.206-.112.312.045.558.243.629.464.166.809.272 1.441.421.878.207 1.618.22 2.311.22 1.452 0 2.775-.204 3.872-.6 1.104-.399 2.065-1.094 2.915-2.035.919-1.015 1.497-2.078 2.05-3.528.547-1.437 1.013-3.221 1.386-5.3l3.554-20.109h5.196s.438.016.529-.459l.588-3.28c.041-.314-.093-.51-.515-.508h-5.043c.025-.114.254-1.888.833-3.558.247-.713.712-1.288 1.106-1.683a3.273 3.273 0 0 1 1.321-.822 5.48 5.48 0 0 1 1.693-.244c.475 0 .941.057 1.296.131.489.104.679.159.807.197.514.157.583.005.684-.244l1.206-3.312c.124-.356-.178-.506-.29-.55m-70.474 34.117c0 .264-.188.479-.452.479h-4.183c-.265 0-.453-.215-.453-.479V67.997c0-.263.188-.476.453-.476h4.183c.264 0 .452.213.452.476v33.668\"\n />\n </g>\n </svg>\n );\n}\n\nfunction IconGoogleDocs({ className, ...props }: React.ComponentProps<\"svg\">) {\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n xmlSpace=\"preserve\"\n viewBox=\"0 0 64 88\"\n {...props}\n >\n <path\n d=\"M58 88H6c-3.3 0-6-2.7-6-6V6c0-3.3 2.7-6 6-6h36l22 22v60c0 3.3-2.7 6-6 6z\"\n style={{\n fill: \"#3086f6\",\n }}\n />\n <path\n d=\"m42 0 22 22H42V0z\"\n style={{\n fill: \"#0c67d6\",\n }}\n />\n <path\n d=\"M50 39H14v-5h36v5zm0 7H14v5h36v-5zM40 58H14v5h26v-5z\"\n style={{\n fill: \"#fdffff\",\n }}\n />\n </svg>\n );\n}\n\nconst mockFiles: FilePointer[] = [\n {\n name: \"CopilotTextarea README\",\n sourceApplication: \"GoogleDocs\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"prospecting call transcript\",\n sourceApplication: \"Salesforce\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"customer feedback\",\n sourceApplication: \"Zendesk\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"product specifications\",\n sourceApplication: \"Google Docs\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"meeting minutes\",\n sourceApplication: \"Microsoft Teams\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"project plan\",\n sourceApplication: \"Trello\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n {\n name: \"code review comments\",\n sourceApplication: \"Github\",\n getContents: async () => {\n return \"some contents\";\n },\n },\n];\n","export function streamPromiseFlatten<A>(\n promise: Promise<ReadableStream<A>>\n): ReadableStream<A> {\n return new ReadableStream<A>({\n async start(controller) {\n try {\n const stream = await promise;\n const reader = stream.getReader();\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n controller.close();\n return;\n }\n\n controller.enqueue(value);\n }\n } catch (error) {\n controller.error(error);\n }\n },\n });\n}\n","import React, { useCallback, useState } from \"react\";\nimport { HoveringInsertionPromptBoxCore } from \"./hovering-insertion-prompt-box-core\";\nimport {\n EditingEditorState,\n InsertionEditorApiConfig,\n} from \"../../../types/base/autosuggestions-bare-function\";\n\nexport interface Props {\n editorState: EditingEditorState;\n apiConfig: InsertionEditorApiConfig;\n performInsertion: (insertedText: string) => void;\n closeWindow: () => void;\n}\n\nexport const HoveringInsertionPromptBox: React.FC<Props> = (props) => {\n return (\n <div\n className=\"flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white\"\n style={{ width: \"35rem\" }}\n >\n <HoveringInsertionPromptBoxCore\n state={{\n editorState: props.editorState,\n }}\n performInsertion={props.performInsertion}\n insertionOrEditingFunction={props.apiConfig.insertionOrEditingFunction}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAyB,iBAAiB;AAG1C,IAAM,sBAAsB,CAC1B,aACA,UACG;AACH,YAAU,MAAM;AACd,QAAI,YAAY,YAAY,MAAM;AAEhC,kBAAY,QAAQ,MAAM,SAAS;AACnC,YAAM,eAAe,YAAY,QAAQ;AAIzC,kBAAY,QAAQ,MAAM,SAAS,eAAe;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,aAAa,KAAK,CAAC;AACzB;AAEA,IAAO,gCAAQ;;;ACpBf,SAAS,gBAAgB;;;ACEzB,YAAY,WAAW;AAEvB,SAAS,WAAW,wBAAwB;;;ACJ5C,SAAS,YAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,EACA;AACF;;;ADGE;AAdF;AAUA,IAAM,UAAgB,iBAGpB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YAbL,IAaG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC;AAAA,IACC;AAAA,IACA,WAAW;AAAA,MACT;AAAA,MACA;AAAA,IACF;AAAA,KACI,MACN;AAAA,CACD;AACD,QAAQ,cAAc,iBAAiB;AAgBvC,IAAM,eAAqB,iBAGzB,CAAC,IAAyB,QAAK;AAA9B,eAAE,YA1CL,IA0CG,IAAgB,kBAAhB,IAAgB,CAAd;AACH,6BAAC;AAAA,IAAI,WAAU;AAAA,IAAkC,sBAAmB;AAAA,IA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,IACE,MAAM;AAAA,IACN,mBAAmB;AAAA,IACnB,aAAa,MAAY;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,mBAAmB;AAAA,IACnB,aAAa,MAAY;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,mBAAmB;AAAA,IACnB,aAAa,MAAY;AACvB,aAAO;AAAA,IACT;AAAA,EACF;AACF;;;AEtaM,gBAAAI,YAAA;AANC,IAAM,6BAA8C,CAAC,UAAU;AACpE,SACE,gBAAAA,KAAC;AAAA,IACC,WAAU;AAAA,IACV,OAAO,EAAE,OAAO,QAAQ;AAAA,IAExB,0BAAAA,KAAC;AAAA,MACC,OAAO;AAAA,QACL,aAAa,MAAM;AAAA,MACrB;AAAA,MACA,kBAAkB,MAAM;AAAA,MACxB,4BAA4B,MAAM,UAAU;AAAA,KAC9C;AAAA,GACF;AAEJ;","names":["jsx","React","jsx","React","cva","jsx","cva","useEffect","useState","jsx","jsxs","useState","useEffect","jsx"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/hooks/misc/use-autosize-textarea.tsx","../../../../src/components/source-search-box/source-search-box.tsx","../../../../src/components/ui/command.tsx","../../../../src/lib/utils.ts","../../../../src/components/ui/button.tsx","../../../../src/components/ui/label.tsx","../../../../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box-core.tsx","../../../../src/lib/stream-promise-flatten.ts","../../../../src/components/hovering-toolbar/text-insertion-prompt-box/hovering-insertion-prompt-box.tsx"],"sourcesContent":["import { Ref, RefObject, useEffect } from \"react\";\n\n// Updates the height of a <textarea> when the value changes.\nconst useAutosizeTextArea = (\n textAreaRef: RefObject<HTMLTextAreaElement>,\n value: string\n) => {\n useEffect(() => {\n if (textAreaRef.current !== null) {\n // We need to reset the height momentarily to get the correct scrollHeight for the textarea\n textAreaRef.current.style.height = \"0px\";\n const scrollHeight = textAreaRef.current.scrollHeight;\n\n // We then set the height directly, outside of the render loop\n // Trying to set this with state or a ref will product an incorrect value.\n textAreaRef.current.style.height = scrollHeight + \"px\";\n }\n }, [textAreaRef, value]);\n};\n\nexport default useAutosizeTextArea;\n","import { useState } from \"react\";\nimport {\n Command,\n CommandDialog,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n CommandShortcut,\n} from \"../ui/command\";\n\nimport {\n Calculator,\n Calendar,\n CreditCard,\n Settings,\n Smile,\n User,\n} from \"lucide-react\";\n\nimport { DocumentPointer } from \"@copilotkit/react-core\";\n\nexport interface SourceSearchBoxProps {\n searchTerm: string;\n suggestedFiles: DocumentPointer[];\n onSelectedFile: (filePointer: DocumentPointer) => void;\n}\n\nexport function SourceSearchBox(props: SourceSearchBoxProps) {\n const [selectedValue, setSelectedValue] = useState<string>(\"\");\n\n return (\n <Command\n className=\"rounded-lg border shadow-md\"\n value={selectedValue}\n onValueChange={(value) => {\n setSelectedValue(value);\n }}\n filter={(value, search) => {\n // if the search term is empty, show all commands\n if (props.searchTerm === \"\") return 1;\n\n // if the search term is a prefix of the command, show it\n if (value.startsWith(props.searchTerm)) return 1;\n\n // otherwise, don't show it\n return 0;\n }}\n >\n <CommandInput\n value={props.searchTerm}\n className=\"rounded-t-lg hidden\"\n placeholder=\"Search for a command...\"\n />\n <CommandList>\n <CommandEmpty>No results found.</CommandEmpty>\n\n <CommandGroup heading=\"Available resources\">\n {props.suggestedFiles.map((filePointer) => {\n return (\n <CommandItem\n key={`word-${filePointer.sourceApplication}.${filePointer.name}`}\n value={filePointer.name}\n onSelect={(value) => {\n props.onSelectedFile(filePointer);\n }}\n >\n <div className=\"flex flex-row gap-3 items-center\">\n <Logo size=\"30px\">\n <img\n src={filePointer.iconImageUri}\n alt={filePointer.sourceApplication}\n width={30}\n height={30}\n />\n </Logo>\n {filePointer.name}\n </div>\n </CommandItem>\n );\n })}\n </CommandGroup>\n\n {/* <CommandGroup heading=\"Suggestions\">\n <CommandItem\n onSelect={(value) => {\n console.log(value);\n console.log(value);\n }}\n >\n <Calendar className=\"mr-2 h-4 w-4\" />\n <span>Calendar</span>\n </CommandItem>\n <CommandItem>\n <Smile className=\"mr-2 h-4 w-4\" />\n <span>Search Emoji</span>\n </CommandItem>\n <CommandItem>\n <Calculator className=\"mr-2 h-4 w-4\" />\n <span>Calculator</span>\n </CommandItem>\n </CommandGroup> */}\n <CommandSeparator />\n </CommandList>\n </Command>\n );\n}\n\nexport function Logo({\n children,\n size = \"30px\",\n}: {\n children: React.ReactNode;\n size?: string;\n}) {\n return (\n <div\n className=\"flex items-center justify-center bg-black\"\n style={{ width: size, height: size }}\n >\n {children}\n </div>\n );\n}\n","\"use client\";\n\nimport * as React from \"react\";\nimport { DialogProps } from \"@radix-ui/react-dialog\";\nimport { Command as CommandPrimitive } from \"cmdk\";\nimport { Search } from \"lucide-react\";\n\nimport { cn } from \"../../lib/utils\";\nimport { Dialog, DialogContent } from \"./dialog\";\n\nconst Command = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive\n ref={ref}\n className={cn(\n \"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground\",\n className\n )}\n {...props}\n />\n));\nCommand.displayName = CommandPrimitive.displayName;\n\ninterface CommandDialogProps extends DialogProps {}\n\nconst CommandDialog = ({ children, ...props }: CommandDialogProps) => {\n return (\n <Dialog {...props}>\n <DialogContent className=\"overflow-hidden p-0 shadow-lg\">\n <Command className=\"[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5\">\n {children}\n </Command>\n </DialogContent>\n </Dialog>\n );\n};\n\nconst CommandInput = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Input>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>\n>(({ className, ...props }, ref) => (\n <div className=\"flex items-center border-b px-3\" cmdk-input-wrapper=\"\">\n {/* <Search className=\"mr-2 h-4 w-4 shrink-0 opacity-50\" /> */}\n <CommandPrimitive.Input\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n </div>\n));\n\nCommandInput.displayName = CommandPrimitive.Input.displayName;\n\nconst CommandList = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.List>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.List\n ref={ref}\n className={cn(\"max-h-[300px] overflow-y-auto overflow-x-hidden\", className)}\n {...props}\n />\n));\n\nCommandList.displayName = CommandPrimitive.List.displayName;\n\nconst CommandEmpty = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Empty>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Empty>\n>((props, ref) => (\n <CommandPrimitive.Empty\n ref={ref}\n className=\"py-6 text-center text-sm\"\n {...props}\n />\n));\n\nCommandEmpty.displayName = CommandPrimitive.Empty.displayName;\n\nconst CommandGroup = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Group>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Group>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Group\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n));\n\nCommandGroup.displayName = CommandPrimitive.Group.displayName;\n\nconst CommandSeparator = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Separator>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Separator>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Separator\n ref={ref}\n className={cn(\"-mx-1 h-px bg-border\", className)}\n {...props}\n />\n));\nCommandSeparator.displayName = CommandPrimitive.Separator.displayName;\n\nconst CommandItem = React.forwardRef<\n React.ElementRef<typeof CommandPrimitive.Item>,\n React.ComponentPropsWithoutRef<typeof CommandPrimitive.Item>\n>(({ className, ...props }, ref) => (\n <CommandPrimitive.Item\n ref={ref}\n className={cn(\n \"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\",\n className\n )}\n {...props}\n />\n));\n\nCommandItem.displayName = CommandPrimitive.Item.displayName;\n\nconst CommandShortcut = ({\n className,\n ...props\n}: React.HTMLAttributes<HTMLSpanElement>) => {\n return (\n <span\n className={cn(\n \"ml-auto text-xs tracking-widest text-muted-foreground\",\n className\n )}\n {...props}\n />\n );\n};\nCommandShortcut.displayName = \"CommandShortcut\";\n\nexport {\n Command,\n CommandDialog,\n CommandInput,\n CommandList,\n CommandEmpty,\n CommandGroup,\n CommandItem,\n CommandShortcut,\n CommandSeparator,\n};\n","import { clsx, type ClassValue } from \"clsx\";\nimport { customAlphabet } from \"nanoid\";\nimport { twMerge } from \"tailwind-merge\";\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport const nanoid = customAlphabet(\n \"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz\",\n 7\n); // 7-character random string\n\nexport async function fetcher<JSON = any>(\n input: RequestInfo,\n init?: RequestInit\n): Promise<JSON> {\n const res = await fetch(input, init);\n\n if (!res.ok) {\n const json = await res.json();\n if (json.error) {\n const error = new Error(json.error) as Error & {\n status: number;\n };\n error.status = res.status;\n throw error;\n } else {\n throw new Error(\"An unexpected error occurred\");\n }\n }\n\n return res.json();\n}\n\nexport function formatDate(input: string | number | Date): string {\n const date = new Date(input);\n return date.toLocaleDateString(\"en-US\", {\n month: \"long\",\n day: \"numeric\",\n year: \"numeric\",\n });\n}\n\nexport const arraysAreEqual = (arr1: number[], arr2: number[]): boolean =>\n arr1.length === arr2.length &&\n arr1.every((value, index) => value === arr2[index]);\n\nexport function nullableCompatibleEqualityCheck<T>(\n naiveEqualityCheck: (a: T, b: T) => boolean,\n a: T | null | undefined,\n b: T | null | undefined\n): boolean {\n if (a === null || a === undefined || b === null || b === undefined) {\n return a === b;\n }\n\n return naiveEqualityCheck(a, b);\n}\n","import * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst buttonVariants = cva(\n \"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\",\n {\n variants: {\n variant: {\n default: \"bg-primary text-primary-foreground hover:bg-primary/90\",\n destructive:\n \"bg-destructive text-destructive-foreground hover:bg-destructive/90\",\n outline:\n \"border border-input bg-background hover:bg-accent hover:text-accent-foreground\",\n secondary:\n \"bg-secondary text-secondary-foreground hover:bg-secondary/80\",\n ghost: \"hover:bg-accent hover:text-accent-foreground\",\n link: \"text-primary underline-offset-4 hover:underline\",\n },\n size: {\n default: \"h-10 px-4 py-2\",\n sm: \"h-9 rounded-md px-3\",\n lg: \"h-11 rounded-md px-8\",\n icon: \"h-10 w-10\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n size: \"default\",\n },\n }\n);\n\nexport interface ButtonProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean;\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n ({ className, variant, size, asChild = false, ...props }, ref) => {\n const Comp = asChild ? Slot : \"button\";\n return (\n <Comp\n className={cn(buttonVariants({ variant, size, className }))}\n ref={ref}\n {...props}\n />\n );\n }\n);\nButton.displayName = \"Button\";\n\nexport { Button, buttonVariants };\n","\"use client\";\n\nimport * as React from \"react\";\nimport * as LabelPrimitive from \"@radix-ui/react-label\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"../../lib/utils\";\n\nconst labelVariants = cva(\n \"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70\"\n);\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> &\n VariantProps<typeof labelVariants>\n>(({ className, ...props }, ref) => (\n <LabelPrimitive.Root\n ref={ref}\n className={cn(labelVariants(), className)}\n {...props}\n />\n));\nLabel.displayName = LabelPrimitive.Root.displayName;\n\nexport { Label };\n","import useAutosizeTextArea from \"../../../hooks/misc/use-autosize-textarea\";\nimport { MinimalChatGPTMessage } from \"../../../types\";\nimport {\n EditingEditorState,\n Generator_InsertionOrEditingSuggestion,\n} from \"../../../types/base/autosuggestions-bare-function\";\nimport { SourceSearchBox } from \"../../source-search-box/source-search-box\";\nimport { DocumentPointer } from \"@copilotkit/react-core\";\nimport { Button } from \"../../ui/button\";\nimport { Label } from \"../../ui/label\";\nimport React, { useContext, useEffect, useRef, useState } from \"react\";\n\nimport Chip from \"@mui/material/Chip\";\nimport Avatar from \"@mui/material/Avatar\";\nimport { streamPromiseFlatten } from \"../../../lib/stream-promise-flatten\";\nimport { CopilotContext } from \"@copilotkit/react-core\";\n\nexport type SuggestionState = {\n editorState: EditingEditorState;\n};\n\nexport interface HoveringInsertionPromptBoxCoreProps {\n state: SuggestionState;\n performInsertion: (insertedText: string) => void;\n insertionOrEditingFunction: Generator_InsertionOrEditingSuggestion;\n contextCategories: string[];\n}\n\nexport const HoveringInsertionPromptBoxCore: React.FC<\n HoveringInsertionPromptBoxCoreProps\n> = ({\n performInsertion,\n state,\n insertionOrEditingFunction,\n contextCategories,\n}) => {\n const { getDocumentsContext } = useContext(CopilotContext);\n\n const [editSuggestion, setEditSuggestion] = useState<string>(\"\");\n const [suggestionIsLoading, setSuggestionIsLoading] =\n useState<boolean>(false);\n\n const [adjustmentPrompt, setAdjustmentPrompt] = useState<string>(\"\");\n\n const [generatingSuggestion, setGeneratingSuggestion] =\n useState<ReadableStream<string> | null>(null);\n\n const adjustmentTextAreaRef = useRef<HTMLTextAreaElement>(null);\n const suggestionTextAreaRef = useRef<HTMLTextAreaElement>(null);\n\n const [filePointers, setFilePointers] = useState<DocumentPointer[]>([]);\n\n const [suggestedFiles, setSuggestedFiles] = useState<DocumentPointer[]>([]);\n useEffect(() => {\n setSuggestedFiles(getDocumentsContext(contextCategories));\n }, [contextCategories, getDocumentsContext]);\n\n useAutosizeTextArea(suggestionTextAreaRef, editSuggestion || \"\");\n useAutosizeTextArea(adjustmentTextAreaRef, adjustmentPrompt || \"\");\n\n // initially focus on the adjustment prompt text area\n useEffect(() => {\n adjustmentTextAreaRef.current?.focus();\n }, []);\n\n // continuously read the generating suggestion stream and update the edit suggestion\n useEffect(() => {\n // if no generating suggestion, do nothing\n if (!generatingSuggestion) {\n return;\n }\n\n // Check if the stream is already locked (i.e. already reading from it)\n if (generatingSuggestion.locked) {\n return;\n }\n\n // reset the edit suggestion\n setEditSuggestion(\"\");\n\n // read the generating suggestion stream and continuously update the edit suggestion\n const reader = generatingSuggestion.getReader();\n\n const read = async () => {\n setSuggestionIsLoading(true);\n while (true) {\n const { done, value } = await reader.read();\n if (done) {\n break;\n }\n setEditSuggestion((prev) => {\n const newSuggestion = prev + value;\n\n // Scroll to the bottom of the textarea. We call this here to make sure scroll-to-bottom is synchronous with the state update.\n if (suggestionTextAreaRef.current) {\n suggestionTextAreaRef.current.scrollTop =\n suggestionTextAreaRef.current.scrollHeight;\n }\n return newSuggestion;\n });\n }\n\n setSuggestionIsLoading(false);\n };\n read();\n\n return () => {\n const releaseLockIfNotClosed = async () => {\n try {\n await reader.closed;\n } catch {\n reader.releaseLock();\n }\n };\n\n releaseLockIfNotClosed();\n };\n }, [generatingSuggestion]);\n\n // when the adjustment prompt changes, reset the edit suggestion\n const begingGeneratingAdjustment = async () => {\n // don't generate text if the prompt is empty\n if (!adjustmentPrompt.trim()) {\n return;\n }\n\n // if the current edit suggestion is not empty, then use it as the selected text instead of the editor state's selected text\n let editorState = state.editorState;\n if (editSuggestion !== \"\") {\n editorState.selectedText = editSuggestion;\n }\n\n const adjustmentSuggestionTextStreamPromise = insertionOrEditingFunction(\n editorState,\n adjustmentPrompt,\n new AbortController().signal\n );\n const adjustmentSuggestionTextStream = streamPromiseFlatten(\n adjustmentSuggestionTextStreamPromise\n );\n\n setGeneratingSuggestion(adjustmentSuggestionTextStream);\n };\n\n const isLoading = suggestionIsLoading;\n\n const textToEdit = editSuggestion || state.editorState.selectedText;\n const adjustmentLabel =\n textToEdit === \"\"\n ? \"Describe the text you want to insert\"\n : \"Describe adjustments to the suggested text\";\n const placeholder =\n textToEdit === \"\"\n ? \"e.g. 'summarize the client's top 3 pain-points from @CallTranscript'\"\n : \"e.g. 'make it more formal', 'be more specific', ...\";\n\n const AdjustmentPromptComponent = (\n <>\n <Label className=\"\">{adjustmentLabel}</Label>\n <div className=\"relative w-full flex items-center\">\n <textarea\n disabled={suggestionIsLoading}\n ref={adjustmentTextAreaRef}\n value={adjustmentPrompt}\n onChange={(e) => setAdjustmentPrompt(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && e.shiftKey) {\n e.preventDefault();\n setAdjustmentPrompt(adjustmentPrompt + \"\\n\");\n } else if (e.key === \"Enter\") {\n e.preventDefault();\n begingGeneratingAdjustment();\n }\n }}\n placeholder={placeholder}\n style={{ minHeight: \"3rem\" }}\n 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]\"\n rows={1}\n />\n <button\n onClick={begingGeneratingAdjustment}\n className=\"absolute right-2 bg-blue-500 text-white w-8 h-8 rounded-full flex items-center justify-center\"\n >\n <i className=\"material-icons\">arrow_forward</i>\n </button>\n </div>\n </>\n );\n\n const SuggestionComponent = (\n <>\n <div className=\"flex justify-between items-end w-full\">\n <Label className=\"mt-4\">Suggested:</Label>\n <div className=\"ml-auto\">\n {isLoading && (\n <div className=\"flex justify-center items-center\">\n <div\n 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]\"\n role=\"status\"\n >\n <span className=\"!absolute !-m-px !h-px !w-px !overflow-hidden !whitespace-nowrap !border-0 !p-0 ![clip:rect(0,0,0,0)]\">\n Loading...\n </span>\n </div>\n </div>\n )}\n </div>\n </div>\n <textarea\n ref={suggestionTextAreaRef}\n value={editSuggestion}\n disabled={suggestionIsLoading}\n onChange={(e) => setEditSuggestion(e.target.value)}\n className=\"w-full text-base p-2 border border-gray-300 rounded-md resize-none bg-green-50\"\n style={{ overflow: \"auto\", maxHeight: \"10em\" }}\n />\n </>\n );\n\n const SubmitComponent = (\n <div className=\"flex w-full gap-4 justify-start\">\n <Button\n className=\" bg-green-700 text-white\"\n onClick={() => {\n performInsertion(editSuggestion);\n }}\n >\n Insert <i className=\"material-icons\">check</i>\n </Button>\n </div>\n );\n\n // show source search if the last word in the adjustment prompt BEGINS with an @\n const sourceSearchCandidate = adjustmentPrompt.split(\" \").pop();\n // if the candidate is @someCandidate, then 'someCandidate', otherwise undefined\n const sourceSearchWord = sourceSearchCandidate?.startsWith(\"@\")\n ? sourceSearchCandidate.slice(1)\n : undefined;\n\n return (\n <div className=\"w-full flex flex-col items-start relative gap-2\">\n {AdjustmentPromptComponent}\n {filePointers.length > 0 && (\n <IncludedFilesPreview\n includedFiles={filePointers}\n setIncludedFiles={setFilePointers}\n />\n )}\n {sourceSearchWord !== undefined && (\n <SourceSearchBox\n searchTerm={sourceSearchWord}\n suggestedFiles={suggestedFiles}\n onSelectedFile={(filePointer) => {\n setAdjustmentPrompt(\n adjustmentPrompt.replace(new RegExp(`@${sourceSearchWord}$`), \"\")\n );\n setFilePointers((prev) => [...prev, filePointer]);\n\n // focus back on the adjustment prompt, and move the cursor to the end\n adjustmentTextAreaRef.current?.focus();\n }}\n />\n )}\n {generatingSuggestion ? SuggestionComponent : null}\n {generatingSuggestion ? SubmitComponent : null}\n </div>\n );\n};\n\ninterface IncludedFilesPreviewProps {\n includedFiles: DocumentPointer[];\n setIncludedFiles: React.Dispatch<React.SetStateAction<DocumentPointer[]>>;\n}\n\nexport const IncludedFilesPreview: React.FC<IncludedFilesPreviewProps> = ({\n includedFiles,\n setIncludedFiles,\n}) => {\n return (\n <div className=\"flex flex-col gap-2 mt-2\">\n <Label className=\"\">Included context:</Label>\n <div className=\"flex flex-wrap gap-2\">\n {includedFiles.map((filePointer, index) => {\n return (\n <FileChipPreview\n key={`file-${filePointer.sourceApplication}.${filePointer.name}`}\n filePointer={filePointer}\n onDelete={() => {\n setIncludedFiles((prev) =>\n prev.filter((fp) => fp !== filePointer)\n );\n }}\n />\n );\n })}\n </div>\n </div>\n );\n};\n\nexport interface FileChipPreviewProp {\n filePointer: DocumentPointer;\n onDelete: () => void;\n}\n\nexport const FileChipPreview: React.FC<FileChipPreviewProp> = ({\n filePointer,\n onDelete,\n}) => {\n return (\n <Chip\n label={filePointer.name}\n onDelete={onDelete}\n avatar={<Avatar sx={{ backgroundColor: \"transparent\" }}></Avatar>}\n />\n );\n};\n","export function streamPromiseFlatten<A>(\n promise: Promise<ReadableStream<A>>\n): ReadableStream<A> {\n return new ReadableStream<A>({\n async start(controller) {\n try {\n const stream = await promise;\n const reader = stream.getReader();\n\n while (true) {\n const { done, value } = await reader.read();\n\n if (done) {\n controller.close();\n return;\n }\n\n controller.enqueue(value);\n }\n } catch (error) {\n controller.error(error);\n }\n },\n });\n}\n","import React, { useCallback, useState } from \"react\";\nimport { HoveringInsertionPromptBoxCore } from \"./hovering-insertion-prompt-box-core\";\nimport {\n EditingEditorState,\n InsertionEditorApiConfig,\n} from \"../../../types/base/autosuggestions-bare-function\";\n\nexport interface Props {\n editorState: EditingEditorState;\n apiConfig: InsertionEditorApiConfig;\n performInsertion: (insertedText: string) => void;\n closeWindow: () => void;\n contextCategories: string[];\n}\n\nexport const HoveringInsertionPromptBox: React.FC<Props> = (props) => {\n return (\n <div\n className=\"flex flex-col justify-center items-center space-y-4 rounded-md border shadow-lg p-4 border-gray- bg-white\"\n style={{ width: \"35rem\" }}\n >\n <HoveringInsertionPromptBoxCore\n state={{\n editorState: props.editorState,\n }}\n performInsertion={props.performInsertion}\n insertionOrEditingFunction={props.apiConfig.insertionOrEditingFunction}\n contextCategories={props.contextCategories}\n />\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAyB,iBAAiB;AAG1C,IAAM,sBAAsB,CAC1B,aACA,UACG;AACH,YAAU,MAAM;AACd,QAAI,YAAY,YAAY,MAAM;AAEhC,kBAAY,QAAQ,MAAM,SAAS;AACnC,YAAM,eAAe,YAAY,QAAQ;AAIzC,kBAAY,QAAQ,MAAM,SAAS,eAAe;AAAA,IACpD;AAAA,EACF,GAAG,CAAC,aAAa,KAAK,CAAC;AACzB;AAEA,IAAO,gCAAQ;;;ACpBf,SAAS,gBAAgB;;;ACEzB,YAAY,WAAW;AAEvB,SAAS,WAAW,wBAAwB;;;ACJ5C,SAAS,YAA6B;AACtC,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AAEjB,SAAS,MAAM,QAAsB;AAC1C,SAAO,QAAQ,KAAK,MAAM,CAAC;AAC7B;AAEO,IAAM,SAAS;AAAA,EACpB;AAAA,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