@copilotkit/react-textarea 0.35.0-function-calling-fixes.2 → 0.35.0-mme-cloud.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +428 -432
- package/CHANGELOG.md +4 -28
- package/dist/{chunk-VPEH6V7T.mjs → chunk-FMQG2ZM3.mjs} +1 -1
- package/dist/chunk-FMQG2ZM3.mjs.map +1 -0
- package/dist/{chunk-SP5HFO3H.mjs → chunk-HWM2CVKO.mjs} +2 -2
- package/dist/{chunk-22TYLEZZ.mjs → chunk-XU5Z5BWV.mjs} +2 -2
- package/dist/components/base-copilot-textarea/base-copilot-textarea.js.map +1 -1
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs +36 -1752
- package/dist/components/base-copilot-textarea/base-copilot-textarea.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-element.mjs +4 -48
- package/dist/components/base-copilot-textarea/render-element.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/render-placeholder.mjs +4 -46
- package/dist/components/base-copilot-textarea/render-placeholder.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs +5 -83
- package/dist/components/base-copilot-textarea/track-cursor-moved-since-last-text-change.mjs.map +1 -1
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs +4 -54
- package/dist/components/base-copilot-textarea/use-add-branding-css.mjs.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.js.map +1 -1
- package/dist/components/copilot-textarea/copilot-textarea.mjs +45 -2196
- package/dist/components/copilot-textarea/copilot-textarea.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs +5 -13
- package/dist/components/hovering-toolbar/hovering-editor-provider.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs +8 -130
- package/dist/components/hovering-toolbar/hovering-toolbar-components.mjs.map +1 -1
- package/dist/components/hovering-toolbar/hovering-toolbar.mjs +19 -876
- 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.mjs +14 -569
- 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.mjs +15 -592
- 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/included-files-preview.mjs +7 -98
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/included-files-preview.mjs.map +1 -1
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs +16 -592
- package/dist/components/hovering-toolbar/text-insertion-prompt-box/index.mjs.map +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +48 -2196
- package/dist/components/index.mjs.map +1 -1
- package/dist/components/manual-ui/chip-with-icon.mjs +2 -0
- package/dist/components/manual-ui/chip-with-icon.mjs.map +1 -1
- package/dist/components/source-search-box/source-search-box.mjs +8 -207
- package/dist/components/source-search-box/source-search-box.mjs.map +1 -1
- package/dist/components/ui/button.mjs +6 -81
- package/dist/components/ui/button.mjs.map +1 -1
- package/dist/components/ui/card.mjs +7 -42
- package/dist/components/ui/card.mjs.map +1 -1
- package/dist/components/ui/command.mjs +14 -232
- package/dist/components/ui/command.mjs.map +1 -1
- package/dist/components/ui/dialog.mjs +11 -134
- package/dist/components/ui/dialog.mjs.map +1 -1
- package/dist/components/ui/label.mjs +5 -56
- package/dist/components/ui/label.mjs.map +1 -1
- package/dist/components/ui/separator.mjs +7 -42
- package/dist/components/ui/separator.mjs.map +1 -1
- package/dist/components/ui/textarea.mjs +7 -42
- package/dist/components/ui/textarea.mjs.map +1 -1
- package/dist/context/index.mjs +1 -0
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs +7 -155
- package/dist/hooks/base-copilot-textarea-implementation/use-autosuggestions.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs +5 -165
- package/dist/hooks/base-copilot-textarea-implementation/use-copilot-textarea-editor.mjs.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.js.map +1 -1
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs +6 -145
- package/dist/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.mjs.map +1 -1
- package/dist/hooks/index.mjs +1 -0
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs +5 -111
- package/dist/hooks/make-autosuggestions-function/use-make-standard-autosuggestions-function.mjs.map +1 -1
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs +5 -160
- package/dist/hooks/make-autosuggestions-function/use-make-standard-insertion-function.mjs.map +1 -1
- package/dist/hooks/misc/use-autosize-textarea.mjs +4 -12
- package/dist/hooks/misc/use-autosize-textarea.mjs.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -2196
- package/dist/index.mjs.map +1 -1
- package/dist/lib/debouncer.mjs +4 -48
- package/dist/lib/debouncer.mjs.map +1 -1
- package/dist/lib/editor-to-text.mjs +4 -40
- package/dist/lib/editor-to-text.mjs.map +1 -1
- package/dist/lib/get-text-around-cursor.mjs +7 -96
- package/dist/lib/get-text-around-cursor.mjs.map +1 -1
- package/dist/lib/retry.mjs +4 -14
- package/dist/lib/retry.mjs.map +1 -1
- package/dist/lib/slatejs-edits/add-autocompletions.mjs +4 -22
- package/dist/lib/slatejs-edits/add-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs +4 -17
- package/dist/lib/slatejs-edits/clear-autocompletions.mjs.map +1 -1
- package/dist/lib/slatejs-edits/replace-text.mjs +4 -24
- package/dist/lib/slatejs-edits/replace-text.mjs.map +1 -1
- package/dist/lib/slatejs-edits/with-partial-history.mjs +5 -102
- package/dist/lib/slatejs-edits/with-partial-history.mjs.map +1 -1
- package/dist/lib/stream-promise-flatten.mjs +4 -44
- package/dist/lib/stream-promise-flatten.mjs.map +1 -1
- package/dist/lib/utils.mjs +9 -63
- package/dist/lib/utils.mjs.map +1 -1
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs +9 -271
- package/dist/types/autosuggestions-config/autosuggestions-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/editing-api-config.mjs +6 -82
- package/dist/types/autosuggestions-config/editing-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/index.mjs +10 -271
- package/dist/types/autosuggestions-config/index.mjs.map +1 -1
- package/dist/types/autosuggestions-config/insertions-api-config.mjs +6 -73
- package/dist/types/autosuggestions-config/insertions-api-config.mjs.map +1 -1
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs +6 -59
- package/dist/types/autosuggestions-config/suggestions-api-config.mjs.map +1 -1
- package/dist/types/base/base-autosuggestions-config.mjs +4 -23
- package/dist/types/base/base-autosuggestions-config.mjs.map +1 -1
- package/dist/types/base/editor-autocomplete-state.mjs +5 -14
- package/dist/types/base/editor-autocomplete-state.mjs.map +1 -1
- package/dist/types/base/index.mjs +5 -23
- package/dist/types/base/index.mjs.map +1 -1
- package/dist/types/html-copilot-textarea-element.mjs +1 -0
- package/dist/types/index.mjs +14 -271
- package/dist/types/index.mjs.map +1 -1
- package/package.json +6 -6
- package/src/hooks/base-copilot-textarea-implementation/use-populate-copilot-textarea-ref.ts +4 -1
- package/dist/chunk-VPEH6V7T.mjs.map +0 -1
- /package/dist/{chunk-SP5HFO3H.mjs.map → chunk-HWM2CVKO.mjs.map} +0 -0
- /package/dist/{chunk-22TYLEZZ.mjs.map → chunk-XU5Z5BWV.mjs.map} +0 -0
package/dist/lib/retry.mjs
CHANGED
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (retriesLeft === 1) {
|
|
6
|
-
reject(error);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
setTimeout(() => {
|
|
10
|
-
retry(fn, retriesLeft - 1, interval * backoff, backoff).then(resolve).catch(reject);
|
|
11
|
-
}, interval);
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
retry
|
|
3
|
+
} from "../chunk-KNQIEOFP.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
15
5
|
export {
|
|
16
6
|
retry
|
|
17
7
|
};
|
package/dist/lib/retry.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,25 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
Transforms.insertNodes(
|
|
6
|
-
editor,
|
|
7
|
-
[
|
|
8
|
-
{
|
|
9
|
-
type: "suggestion",
|
|
10
|
-
inline: true,
|
|
11
|
-
content: newSuggestion,
|
|
12
|
-
children: [{ text: "" }]
|
|
13
|
-
}
|
|
14
|
-
],
|
|
15
|
-
{
|
|
16
|
-
at: point
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
if (editorPosition) {
|
|
20
|
-
editor.selection = editorPosition;
|
|
21
|
-
}
|
|
22
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
addAutocompletionsToEditor
|
|
3
|
+
} from "../../chunk-2C7O2EVM.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
23
5
|
export {
|
|
24
6
|
addAutocompletionsToEditor
|
|
25
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,20 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
for (const [node, path] of Node.nodes(editor)) {
|
|
6
|
-
if (Element.isElement(node) && node.type === "suggestion") {
|
|
7
|
-
paths.push(path);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
for (const path of paths) {
|
|
11
|
-
try {
|
|
12
|
-
Transforms.removeNodes(editor, { at: path });
|
|
13
|
-
} catch (e) {
|
|
14
|
-
console.log("CopilotTextarea.clearAutocompletionsFromEditor: error removing node", e);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
clearAutocompletionsFromEditor
|
|
3
|
+
} from "../../chunk-GQN2HYFJ.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
18
5
|
export {
|
|
19
6
|
clearAutocompletionsFromEditor
|
|
20
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,27 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
at: {
|
|
6
|
-
anchor: Editor.start(editor, []),
|
|
7
|
-
focus: Editor.end(editor, [])
|
|
8
|
-
}
|
|
9
|
-
});
|
|
10
|
-
if (newText && newText !== "") {
|
|
11
|
-
Transforms.insertNodes(
|
|
12
|
-
editor,
|
|
13
|
-
[
|
|
14
|
-
{
|
|
15
|
-
type: "paragraph",
|
|
16
|
-
children: [{ text: newText }]
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
{
|
|
20
|
-
at: [0]
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
replaceEditorText
|
|
3
|
+
} from "../../chunk-5UNJXFUO.mjs";
|
|
4
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
25
5
|
export {
|
|
26
6
|
replaceEditorText
|
|
27
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,105 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { apply } = e;
|
|
7
|
-
e.history = { undos: [], redos: [] };
|
|
8
|
-
e.redo = () => {
|
|
9
|
-
const { history } = e;
|
|
10
|
-
const { redos } = history;
|
|
11
|
-
if (redos.length > 0) {
|
|
12
|
-
const batch = redos[redos.length - 1];
|
|
13
|
-
if (batch.selectionBefore) {
|
|
14
|
-
Transforms.setSelection(e, batch.selectionBefore);
|
|
15
|
-
}
|
|
16
|
-
HistoryEditor.withoutSaving(e, () => {
|
|
17
|
-
Editor.withoutNormalizing(e, () => {
|
|
18
|
-
for (const op of batch.operations) {
|
|
19
|
-
e.apply(op);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
history.redos.pop();
|
|
24
|
-
e.writeHistory("undos", batch);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
e.undo = () => {
|
|
28
|
-
const { history } = e;
|
|
29
|
-
const { undos } = history;
|
|
30
|
-
if (undos.length > 0) {
|
|
31
|
-
const batch = undos[undos.length - 1];
|
|
32
|
-
HistoryEditor.withoutSaving(e, () => {
|
|
33
|
-
Editor.withoutNormalizing(e, () => {
|
|
34
|
-
const inverseOps = batch.operations.map(Operation.inverse).reverse();
|
|
35
|
-
for (const op of inverseOps) {
|
|
36
|
-
e.apply(op);
|
|
37
|
-
}
|
|
38
|
-
if (batch.selectionBefore) {
|
|
39
|
-
Transforms.setSelection(e, batch.selectionBefore);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
e.writeHistory("redos", batch);
|
|
44
|
-
history.undos.pop();
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
e.apply = (op) => {
|
|
48
|
-
const { operations, history } = e;
|
|
49
|
-
const { undos } = history;
|
|
50
|
-
const lastBatch = undos[undos.length - 1];
|
|
51
|
-
const lastOp = lastBatch && lastBatch.operations[lastBatch.operations.length - 1];
|
|
52
|
-
let save = HistoryEditor.isSaving(e);
|
|
53
|
-
let merge = HistoryEditor.isMerging(e);
|
|
54
|
-
if (save == null) {
|
|
55
|
-
save = shouldSave(op, lastOp);
|
|
56
|
-
}
|
|
57
|
-
if (save) {
|
|
58
|
-
if (merge == null) {
|
|
59
|
-
if (lastBatch == null) {
|
|
60
|
-
merge = false;
|
|
61
|
-
} else if (operations.length !== 0) {
|
|
62
|
-
merge = true;
|
|
63
|
-
} else {
|
|
64
|
-
merge = shouldMerge(op, lastOp);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
if (lastBatch && merge) {
|
|
68
|
-
lastBatch.operations.push(op);
|
|
69
|
-
} else {
|
|
70
|
-
const batch = {
|
|
71
|
-
operations: [op],
|
|
72
|
-
selectionBefore: e.selection
|
|
73
|
-
};
|
|
74
|
-
e.writeHistory("undos", batch);
|
|
75
|
-
}
|
|
76
|
-
while (undos.length > 100) {
|
|
77
|
-
undos.shift();
|
|
78
|
-
}
|
|
79
|
-
history.redos = [];
|
|
80
|
-
}
|
|
81
|
-
apply(op);
|
|
82
|
-
};
|
|
83
|
-
e.writeHistory = (stack, batch) => {
|
|
84
|
-
e.history[stack].push(batch);
|
|
85
|
-
};
|
|
86
|
-
return e;
|
|
87
|
-
};
|
|
88
|
-
var shouldMerge = (op, prev) => {
|
|
89
|
-
if (prev && op.type === "insert_text" && prev.type === "insert_text" && op.offset === prev.offset + prev.text.length && Path.equals(op.path, prev.path)) {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
if (prev && op.type === "remove_text" && prev.type === "remove_text" && op.offset + op.text.length === prev.offset && Path.equals(op.path, prev.path)) {
|
|
93
|
-
return true;
|
|
94
|
-
}
|
|
95
|
-
return false;
|
|
96
|
-
};
|
|
97
|
-
var defaultShouldSave = (op, prev) => {
|
|
98
|
-
if (op.type === "set_selection") {
|
|
99
|
-
return false;
|
|
100
|
-
}
|
|
101
|
-
return true;
|
|
102
|
-
};
|
|
1
|
+
import {
|
|
2
|
+
defaultShouldSave,
|
|
3
|
+
withPartialHistory
|
|
4
|
+
} from "../../chunk-4NHVQZ67.mjs";
|
|
5
|
+
import "../../chunk-MRXNTQOX.mjs";
|
|
103
6
|
export {
|
|
104
7
|
defaultShouldSave,
|
|
105
8
|
withPartialHistory
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1,47 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
step(generator.next(value));
|
|
6
|
-
} catch (e) {
|
|
7
|
-
reject(e);
|
|
8
|
-
}
|
|
9
|
-
};
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/lib/stream-promise-flatten.ts
|
|
23
|
-
function streamPromiseFlatten(promise) {
|
|
24
|
-
return new ReadableStream({
|
|
25
|
-
start(controller) {
|
|
26
|
-
return __async(this, null, function* () {
|
|
27
|
-
try {
|
|
28
|
-
const stream = yield promise;
|
|
29
|
-
const reader = stream.getReader();
|
|
30
|
-
while (true) {
|
|
31
|
-
const { done, value } = yield reader.read();
|
|
32
|
-
if (done) {
|
|
33
|
-
controller.close();
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
controller.enqueue(value);
|
|
37
|
-
}
|
|
38
|
-
} catch (error) {
|
|
39
|
-
controller.error(error);
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
streamPromiseFlatten
|
|
3
|
+
} from "../chunk-2QDCE7PD.mjs";
|
|
4
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
45
5
|
export {
|
|
46
6
|
streamPromiseFlatten
|
|
47
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/lib/utils.mjs
CHANGED
|
@@ -1,66 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var rejected = (value) => {
|
|
11
|
-
try {
|
|
12
|
-
step(generator.throw(value));
|
|
13
|
-
} catch (e) {
|
|
14
|
-
reject(e);
|
|
15
|
-
}
|
|
16
|
-
};
|
|
17
|
-
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
18
|
-
step((generator = generator.apply(__this, __arguments)).next());
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// src/lib/utils.ts
|
|
23
|
-
import { clsx } from "clsx";
|
|
24
|
-
import { customAlphabet } from "nanoid";
|
|
25
|
-
import { twMerge } from "tailwind-merge";
|
|
26
|
-
function cn(...inputs) {
|
|
27
|
-
return twMerge(clsx(inputs));
|
|
28
|
-
}
|
|
29
|
-
var nanoid = customAlphabet(
|
|
30
|
-
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
|
|
31
|
-
7
|
|
32
|
-
);
|
|
33
|
-
function fetcher(input, init) {
|
|
34
|
-
return __async(this, null, function* () {
|
|
35
|
-
const res = yield fetch(input, init);
|
|
36
|
-
if (!res.ok) {
|
|
37
|
-
const json = yield res.json();
|
|
38
|
-
if (json.error) {
|
|
39
|
-
const error = new Error(json.error);
|
|
40
|
-
error.status = res.status;
|
|
41
|
-
throw error;
|
|
42
|
-
} else {
|
|
43
|
-
throw new Error("An unexpected error occurred");
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return res.json();
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
function formatDate(input) {
|
|
50
|
-
const date = new Date(input);
|
|
51
|
-
return date.toLocaleDateString("en-US", {
|
|
52
|
-
month: "long",
|
|
53
|
-
day: "numeric",
|
|
54
|
-
year: "numeric"
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
var arraysAreEqual = (arr1, arr2) => arr1.length === arr2.length && arr1.every((value, index) => value === arr2[index]);
|
|
58
|
-
function nullableCompatibleEqualityCheck(naiveEqualityCheck, a, b) {
|
|
59
|
-
if (a === null || a === void 0 || b === null || b === void 0) {
|
|
60
|
-
return a === b;
|
|
61
|
-
}
|
|
62
|
-
return naiveEqualityCheck(a, b);
|
|
63
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
arraysAreEqual,
|
|
3
|
+
cn,
|
|
4
|
+
fetcher,
|
|
5
|
+
formatDate,
|
|
6
|
+
nanoid,
|
|
7
|
+
nullableCompatibleEqualityCheck
|
|
8
|
+
} from "../chunk-7SUZ6CXM.mjs";
|
|
9
|
+
import "../chunk-MRXNTQOX.mjs";
|
|
64
10
|
export {
|
|
65
11
|
arraysAreEqual,
|
|
66
12
|
cn,
|
package/dist/lib/utils.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|