@sanity/assist 6.1.19 → 6.1.21
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/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +287 -207
- package/dist/index.js.map +1 -1
- package/package.json +9 -9
package/dist/index.js
CHANGED
|
@@ -2,8 +2,8 @@ import "@sanity/ui/styles.css";
|
|
|
2
2
|
import { FormBuilder, FormCallbacksProvider, FormFieldHeaderText, FormInput, MemberFieldError, ObjectInputMember, PatchEvent, PerspectiveProvider, PresenceOverlay, StatusButton, VirtualizerScrollInstanceProvider, createPatchChannel, defineArrayMember, defineField, definePlugin, defineType, fromMutationPatches, getDraftId, getPublishedId, getVersionFromId, getVersionId, insert, isArrayOfObjectsSchemaType, isArraySchemaType, isDocumentSchemaType, isKeySegment, isObjectSchemaType, isRecord, isVersionId, pathToString, set, setIfMissing, stringToPath, typed, unset, useClient, useColorSchemeValue, useCurrentUser, useDocumentPresence, useDocumentStore, useEditState, useFormCallbacks, usePerspective, useSchema, useSyncState, useWorkspaceSchemaId } from "sanity";
|
|
3
3
|
import { c } from "react/compiler-runtime";
|
|
4
4
|
import { Box, Button, Card, Checkbox, Container, Dialog, ErrorBoundary, Flex, Label, Radio, Spinner, Stack, Switch, Text, TextArea, ThemeProvider, focusFirstDescendant, rgba, useClickOutsideEvent, useGlobalKeyDown, useLayer, useTheme } from "@sanity/ui";
|
|
5
|
-
import { createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
|
|
6
5
|
import { DocumentInspectorHeader, DocumentPaneProvider, PaneRouterContext, useDocumentPane, usePaneRouter } from "sanity/structure";
|
|
6
|
+
import { createContext, isValidElement, useCallback, useContext, useEffect, useEffectEvent, useId, useMemo, useReducer, useRef, useState } from "react";
|
|
7
7
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { useToast } from "@sanity/ui/toast";
|
|
9
9
|
import { addSeconds } from "date-fns/addSeconds";
|
|
@@ -350,7 +350,7 @@ const FirstAssistedPathContext = createContext(void 0);
|
|
|
350
350
|
function FirstAssistedPathProvider(props) {
|
|
351
351
|
let $ = c(5), { members } = props, t0;
|
|
352
352
|
if ($[0] !== members) {
|
|
353
|
-
let firstAssisted = members.find(_temp$
|
|
353
|
+
let firstAssisted = members.find(_temp$16);
|
|
354
354
|
t0 = firstAssisted?.field.path ? pathToString(firstAssisted?.field.path) : void 0, $[0] = members, $[1] = t0;
|
|
355
355
|
} else t0 = $[1];
|
|
356
356
|
let firstAssistedPath = t0, t1;
|
|
@@ -359,7 +359,7 @@ function FirstAssistedPathProvider(props) {
|
|
|
359
359
|
children: props.children
|
|
360
360
|
}), $[2] = firstAssistedPath, $[3] = props.children, $[4] = t1) : t1 = $[4], t1;
|
|
361
361
|
}
|
|
362
|
-
function _temp$
|
|
362
|
+
function _temp$16(member) {
|
|
363
363
|
return member.kind === "field" && isAssistSupported(member.field.schemaType);
|
|
364
364
|
}
|
|
365
365
|
const releaseAnnouncementUrl = "https://www.sanity.io/blog/sanity-ai-assist-announcement?utm_source=sanity-assist-plugin&utm_medium=organic_social&utm_campaign=ai-assist&utm_content=", packageName = "@sanity/assist", pluginTitle = "Sanity AI Assist", pluginTitleShort = "AI Assist", maxHistoryVisibilityMs = minutesToMilliseconds(30), illegalIdChars = /[^a-zA-Z0-9._-]/g;
|
|
@@ -374,7 +374,7 @@ function useDocumentState(id, docType) {
|
|
|
374
374
|
return state.draft || state.published;
|
|
375
375
|
}
|
|
376
376
|
function useStudioAssistDocument(t0) {
|
|
377
|
-
let $ = c(
|
|
377
|
+
let $ = c(17), { documentId, schemaType, initDoc } = t0, documentTypeName = schemaType.name, currentUser = useCurrentUser(), t1;
|
|
378
378
|
$[0] === documentTypeName ? t1 = $[1] : (t1 = assistDocumentId(documentTypeName), $[0] = documentTypeName, $[1] = t1);
|
|
379
379
|
let assistDocument = useDocumentState(t1, assistDocumentTypeName), t2 = documentId ?? "", t3;
|
|
380
380
|
$[2] === t2 ? t3 = $[3] : (t3 = assistTasksStatusId(t2), $[2] = t2, $[3] = t3);
|
|
@@ -385,7 +385,7 @@ function useStudioAssistDocument(t0) {
|
|
|
385
385
|
!assistDocument && initDoc && client.createIfNotExists({
|
|
386
386
|
_id: assistDocumentId(documentTypeName),
|
|
387
387
|
_type: assistDocumentTypeName
|
|
388
|
-
}).catch(_temp$
|
|
388
|
+
}).catch(_temp$15);
|
|
389
389
|
}, t6 = [
|
|
390
390
|
client,
|
|
391
391
|
assistDocument,
|
|
@@ -400,7 +400,9 @@ function useStudioAssistDocument(t0) {
|
|
|
400
400
|
}
|
|
401
401
|
let t8;
|
|
402
402
|
if ($[11] !== assistDocument || $[12] !== assistTasksStatus?.tasks || $[13] !== currentUser?.id) {
|
|
403
|
-
let tasks = assistTasksStatus?.tasks ?? [],
|
|
403
|
+
let tasks = assistTasksStatus?.tasks ?? [], t9;
|
|
404
|
+
$[15] === assistDocument?.fields ? t9 = $[16] : (t9 = assistDocument?.fields ?? [], $[15] = assistDocument?.fields, $[16] = t9);
|
|
405
|
+
let fields = t9.map((assistField) => ({
|
|
404
406
|
...assistField,
|
|
405
407
|
tasks: tasks.filter((task) => task.path === assistField.path),
|
|
406
408
|
instructions: assistField.instructions?.filter((p) => !p.userId || p.userId === currentUser?.id).map((instruction) => asStudioInstruction(instruction, tasks))
|
|
@@ -421,7 +423,7 @@ function useStudioAssistDocument(t0) {
|
|
|
421
423
|
}
|
|
422
424
|
return t7;
|
|
423
425
|
}
|
|
424
|
-
function _temp$
|
|
426
|
+
function _temp$15() {}
|
|
425
427
|
function asStudioInstruction(instruction, run) {
|
|
426
428
|
return {
|
|
427
429
|
...instruction,
|
|
@@ -439,11 +441,11 @@ function useInstructionToaster(documentId, documentSchemaType) {
|
|
|
439
441
|
$[3] !== assistDocLoaded || $[4] !== currentUser?.id || $[5] !== tasks || $[6] !== toast ? (t1 = () => {
|
|
440
442
|
if (assistDocLoaded) {
|
|
441
443
|
if (previousTasks.current !== "initial") {
|
|
442
|
-
let prevTaskByKey = Object.fromEntries((previousTasks.current ?? NO_TASKS).map(_temp$
|
|
444
|
+
let prevTaskByKey = Object.fromEntries((previousTasks.current ?? NO_TASKS).map(_temp$14));
|
|
443
445
|
(tasks?.filter((task) => task.startedByUserId === currentUser?.id).filter((task_0) => {
|
|
444
446
|
let prevTask = prevTaskByKey[task_0._key];
|
|
445
447
|
return !prevTask && task_0.ended || !prevTask?.ended && task_0.ended;
|
|
446
|
-
}).filter(_temp2$
|
|
448
|
+
}).filter(_temp2$9))?.forEach((task_2) => {
|
|
447
449
|
let title = task_2.title ?? getInstructionTitle(task_2.instruction);
|
|
448
450
|
task_2.reason === "error" ? toast.push({
|
|
449
451
|
title: `Failed: ${title}`,
|
|
@@ -481,10 +483,10 @@ function useInstructionToaster(documentId, documentSchemaType) {
|
|
|
481
483
|
assistDocLoaded
|
|
482
484
|
], $[8] = assistDocLoaded, $[9] = currentUser, $[10] = tasks, $[11] = toast, $[12] = t2) : t2 = $[12], useEffect(t1, t2);
|
|
483
485
|
}
|
|
484
|
-
function _temp2$
|
|
486
|
+
function _temp2$9(task_1) {
|
|
485
487
|
return task_1.ended && isAfter(addSeconds(new Date(task_1.ended), 30), /* @__PURE__ */ new Date());
|
|
486
488
|
}
|
|
487
|
-
function _temp$
|
|
489
|
+
function _temp$14(run) {
|
|
488
490
|
return [run._key, run];
|
|
489
491
|
}
|
|
490
492
|
function AssistDocumentInputWrapper(props) {
|
|
@@ -856,7 +858,7 @@ function isUserInputBlock(block) {
|
|
|
856
858
|
function RunInstructionProvider(props) {
|
|
857
859
|
let $ = c(33), { config } = useAiAssistanceConfig(), { runInstruction: runInstructionRequest, loading } = useRunInstructionApi(useApiClient(config?.__customApiClient)), id = useId(), [inputs, setInputs] = useState(NO_INPUT), [runRequest, setRunRequest] = useState(), [resolveUserInput, setResolveUserInput] = useState(), t0;
|
|
858
860
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = async (t1) => {
|
|
859
|
-
let { title, inputs: inputs_0 } = t1, userInputBlocks = inputs_0.map(_temp$
|
|
861
|
+
let { title, inputs: inputs_0 } = t1, userInputBlocks = inputs_0.map(_temp$13);
|
|
860
862
|
if (userInputBlocks.length) return setRunRequest({
|
|
861
863
|
dialogTitle: title,
|
|
862
864
|
userInputBlocks
|
|
@@ -867,7 +869,7 @@ function RunInstructionProvider(props) {
|
|
|
867
869
|
let getUserInput = t0, t1;
|
|
868
870
|
$[1] !== loading || $[2] !== runInstructionRequest ? (t1 = (req) => {
|
|
869
871
|
if (loading) return;
|
|
870
|
-
let { instruction, ...request } = req, instructionKey = instruction._key, userInputBlocks_0 = instruction?.prompt?.flatMap(_temp2$
|
|
872
|
+
let { instruction, ...request } = req, instructionKey = instruction._key, userInputBlocks_0 = instruction?.prompt?.flatMap(_temp2$8).filter(isUserInputBlock);
|
|
871
873
|
if (!userInputBlocks_0?.length) {
|
|
872
874
|
runInstructionRequest({
|
|
873
875
|
...request,
|
|
@@ -887,33 +889,35 @@ function RunInstructionProvider(props) {
|
|
|
887
889
|
}, $[4] = resolveUserInput, $[5] = t2);
|
|
888
890
|
let close = t2, t3;
|
|
889
891
|
$[6] !== close || $[7] !== inputs || $[8] !== resolveUserInput || $[9] !== runInstructionRequest || $[10] !== runRequest ? (t3 = () => {
|
|
890
|
-
if (runRequest)
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
let
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
892
|
+
if (runRequest) {
|
|
893
|
+
if ("instruction" in runRequest) {
|
|
894
|
+
let { instruction: instruction_0, userInputBlocks: _, ...request_0 } = runRequest;
|
|
895
|
+
runInstructionRequest({
|
|
896
|
+
...request_0,
|
|
897
|
+
instructionKey: instruction_0._key,
|
|
898
|
+
userTexts: Object.entries(inputs).map(_temp3$6)
|
|
899
|
+
});
|
|
900
|
+
} else {
|
|
901
|
+
let userInputs = Object.values(inputs).map((input_0, i_0) => {
|
|
902
|
+
let userInputBlock = runRequest.userInputBlocks[i_0];
|
|
903
|
+
return {
|
|
904
|
+
input: {
|
|
905
|
+
id: userInputBlock._key,
|
|
906
|
+
title: userInputBlock.message ?? "",
|
|
907
|
+
description: userInputBlock.description
|
|
908
|
+
},
|
|
909
|
+
result: input_0
|
|
910
|
+
};
|
|
911
|
+
});
|
|
912
|
+
resolveUserInput?.(userInputs), setResolveUserInput(void 0);
|
|
913
|
+
}
|
|
910
914
|
}
|
|
911
915
|
close();
|
|
912
916
|
}, $[6] = close, $[7] = inputs, $[8] = resolveUserInput, $[9] = runInstructionRequest, $[10] = runRequest, $[11] = t3) : t3 = $[11];
|
|
913
917
|
let runWithInput = t3, open = !!runRequest;
|
|
914
918
|
runRequest?.userInputBlocks;
|
|
915
919
|
let t4;
|
|
916
|
-
$[12] === inputs ? t4 = $[13] : (t4 = Object.entries(inputs).filter(_temp4$
|
|
920
|
+
$[12] === inputs ? t4 = $[13] : (t4 = Object.entries(inputs).filter(_temp4$4), $[12] = inputs, $[13] = t4);
|
|
917
921
|
let runDisabled = (runRequest?.userInputBlocks?.length ?? 0) > t4.length, t5;
|
|
918
922
|
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = { width: "100%" }, $[14] = t5) : t5 = $[14];
|
|
919
923
|
let t6;
|
|
@@ -971,21 +975,21 @@ function RunInstructionProvider(props) {
|
|
|
971
975
|
children: [t8, props.children]
|
|
972
976
|
}), $[29] = contextValue, $[30] = props.children, $[31] = t8, $[32] = t9) : t9 = $[32], t9;
|
|
973
977
|
}
|
|
974
|
-
function _temp4$
|
|
978
|
+
function _temp4$4(t0) {
|
|
975
979
|
let [, value_0] = t0;
|
|
976
980
|
return !!value_0;
|
|
977
981
|
}
|
|
978
|
-
function _temp3$
|
|
982
|
+
function _temp3$6(t0) {
|
|
979
983
|
let [key, value] = t0;
|
|
980
984
|
return {
|
|
981
985
|
blockKey: key,
|
|
982
986
|
userInput: value
|
|
983
987
|
};
|
|
984
988
|
}
|
|
985
|
-
function _temp2$
|
|
989
|
+
function _temp2$8(block) {
|
|
986
990
|
return block._type === "block" ? block.children.filter(isUserInputBlock) : [block];
|
|
987
991
|
}
|
|
988
|
-
function _temp$
|
|
992
|
+
function _temp$13(input, i) {
|
|
989
993
|
return {
|
|
990
994
|
_type: userInputTypeName,
|
|
991
995
|
_key: input.id ?? `${i}`,
|
|
@@ -1124,7 +1128,7 @@ function useAssistDocumentContextValue(documentId, documentType) {
|
|
|
1124
1128
|
return t9;
|
|
1125
1129
|
}
|
|
1126
1130
|
function useSyntheticTasks(assistableDocumentId) {
|
|
1127
|
-
let $ = c(7), [syntheticTasks, setSyntheticTasks] = useState(_temp$
|
|
1131
|
+
let $ = c(7), [syntheticTasks, setSyntheticTasks] = useState(_temp$12), t0;
|
|
1128
1132
|
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = (task) => {
|
|
1129
1133
|
setSyntheticTasks((current) => [...current, task]);
|
|
1130
1134
|
}, $[0] = t0) : t0 = $[0];
|
|
@@ -1145,7 +1149,7 @@ function useSyntheticTasks(assistableDocumentId) {
|
|
|
1145
1149
|
removeSyntheticTask
|
|
1146
1150
|
}, $[5] = syntheticTasks, $[6] = t4), t4;
|
|
1147
1151
|
}
|
|
1148
|
-
function _temp$
|
|
1152
|
+
function _temp$12() {
|
|
1149
1153
|
return [];
|
|
1150
1154
|
}
|
|
1151
1155
|
function AssistDocumentContextProvider(props) {
|
|
@@ -1167,7 +1171,7 @@ function AssistDocumentLayout(props) {
|
|
|
1167
1171
|
}
|
|
1168
1172
|
const fadeIn = keyframes`0%{opacity:0;transform:scale(0.75);}40%{opacity:0;transform:scale(0.75);}100%{opacity:1;transform:scale(1);}`, FadeInDiv = styled.div.withConfig({
|
|
1169
1173
|
displayName: "FadeInDiv",
|
|
1170
|
-
componentId: "sc-
|
|
1174
|
+
componentId: "sc-gocic8-0"
|
|
1171
1175
|
})`animation-name:${fadeIn};animation-timing-function:ease-in-out;`;
|
|
1172
1176
|
function FadeInContent(t0) {
|
|
1173
1177
|
let $ = c(6), { children, durationMs: t1, ref } = t0, t2 = `${t1 === void 0 ? 250 : t1}ms`, t3;
|
|
@@ -1181,43 +1185,59 @@ function FadeInContent(t0) {
|
|
|
1181
1185
|
}
|
|
1182
1186
|
const Root = styled.span.withConfig({
|
|
1183
1187
|
displayName: "Root",
|
|
1184
|
-
componentId: "sc-
|
|
1188
|
+
componentId: "sc-kyfo1k-0"
|
|
1185
1189
|
})`display:block;width:25px;height:25px;position:relative;`, dash = keyframes`0%{transform:rotate(0);}100%{transform:rotate(43deg);}`, Outline = styled.svg.withConfig({
|
|
1186
1190
|
displayName: "Outline",
|
|
1187
|
-
componentId: "sc-
|
|
1191
|
+
componentId: "sc-kyfo1k-1"
|
|
1188
1192
|
})`display:block;position:absolute;top:0;left:0;& > circle{stroke:var(--ai-avatar-stroke-color);stroke-width:1.5px;stroke-linecap:round;transform-origin:center;animation:${dash} 500ms ease-in-out infinite;transition:stroke-dasharray 200ms ease-in-out;stroke-dasharray:2.34px 0;[data-state='active'] > &{stroke-dasharray:2px 2.34px;}}`, IconDisc = styled.span.withConfig({
|
|
1189
1193
|
displayName: "IconDisc",
|
|
1190
|
-
componentId: "sc-
|
|
1194
|
+
componentId: "sc-kyfo1k-2"
|
|
1191
1195
|
})`background:var(--ai-avatar-disc-color);color:white;width:21px;height:21px;display:flex;align-items:center;justify-content:center;border-radius:10.5px;position:absolute;top:2px;left:2px;`;
|
|
1192
1196
|
function AssistAvatar(props) {
|
|
1193
|
-
let { state
|
|
1194
|
-
|
|
1195
|
-
"
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1197
|
+
let $ = c(8), { state: t0 } = props, state = t0 === void 0 ? "present" : t0, scheme = useColorSchemeValue(), t1;
|
|
1198
|
+
bb0: {
|
|
1199
|
+
if (scheme === "dark") {
|
|
1200
|
+
let t2;
|
|
1201
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
|
|
1202
|
+
"--ai-avatar-stroke-color": purple[400].hex,
|
|
1203
|
+
"--ai-avatar-disc-color": purple[600].hex
|
|
1204
|
+
}, $[0] = t2) : t2 = $[0], t1 = t2;
|
|
1205
|
+
break bb0;
|
|
1206
|
+
}
|
|
1207
|
+
let t2;
|
|
1208
|
+
$[1] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
|
|
1209
|
+
"--ai-avatar-stroke-color": purple[500].hex,
|
|
1210
|
+
"--ai-avatar-disc-color": purple[600].hex
|
|
1211
|
+
}, $[1] = t2) : t2 = $[1], t1 = t2;
|
|
1212
|
+
}
|
|
1213
|
+
let style = t1, t2;
|
|
1214
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = /* @__PURE__ */ jsx(Outline, {
|
|
1215
|
+
width: "25",
|
|
1216
|
+
height: "25",
|
|
1217
|
+
viewBox: "0 0 25 25",
|
|
1218
|
+
fill: "none",
|
|
1219
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1220
|
+
children: /* @__PURE__ */ jsx("circle", {
|
|
1221
|
+
cx: "12.5",
|
|
1222
|
+
cy: "12.5",
|
|
1223
|
+
r: "11.75"
|
|
1224
|
+
})
|
|
1225
|
+
}), $[2] = t2) : t2 = $[2];
|
|
1226
|
+
let t3;
|
|
1227
|
+
$[3] === Symbol.for("react.memo_cache_sentinel") ? (t3 = { color: "inherit" }, $[3] = t3) : t3 = $[3];
|
|
1228
|
+
let t4;
|
|
1229
|
+
$[4] === Symbol.for("react.memo_cache_sentinel") ? (t4 = /* @__PURE__ */ jsx(IconDisc, { children: /* @__PURE__ */ jsx(Text, {
|
|
1230
|
+
as: "span",
|
|
1231
|
+
size: 0,
|
|
1232
|
+
style: t3,
|
|
1233
|
+
children: /* @__PURE__ */ jsx(SparklesIcon, { style: { color: "inherit" } })
|
|
1234
|
+
}) }), $[4] = t4) : t4 = $[4];
|
|
1235
|
+
let t5;
|
|
1236
|
+
return $[5] !== state || $[6] !== style ? (t5 = /* @__PURE__ */ jsxs(Root, {
|
|
1201
1237
|
"data-state": state,
|
|
1202
1238
|
style,
|
|
1203
|
-
children: [
|
|
1204
|
-
|
|
1205
|
-
height: "25",
|
|
1206
|
-
viewBox: "0 0 25 25",
|
|
1207
|
-
fill: "none",
|
|
1208
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1209
|
-
children: /* @__PURE__ */ jsx("circle", {
|
|
1210
|
-
cx: "12.5",
|
|
1211
|
-
cy: "12.5",
|
|
1212
|
-
r: "11.75"
|
|
1213
|
-
})
|
|
1214
|
-
}), /* @__PURE__ */ jsx(IconDisc, { children: /* @__PURE__ */ jsx(Text, {
|
|
1215
|
-
as: "span",
|
|
1216
|
-
size: 0,
|
|
1217
|
-
style: { color: "inherit" },
|
|
1218
|
-
children: /* @__PURE__ */ jsx(SparklesIcon, { style: { color: "inherit" } })
|
|
1219
|
-
}) })]
|
|
1220
|
-
});
|
|
1239
|
+
children: [t2, t4]
|
|
1240
|
+
}), $[5] = state, $[6] = style, $[7] = t5) : t5 = $[7], t5;
|
|
1221
1241
|
}
|
|
1222
1242
|
function AiFieldPresence(_props) {
|
|
1223
1243
|
let $ = c(3), t0;
|
|
@@ -1256,7 +1276,7 @@ function useAssistPresence(path, showFocusWithin) {
|
|
|
1256
1276
|
let $ = c(6), context = useAssistDocumentContext(), tasks = (context && "assistDocument" in context ? context.assistDocument : void 0)?.tasks, t0;
|
|
1257
1277
|
if ($[0] !== path || $[1] !== showFocusWithin || $[2] !== tasks) {
|
|
1258
1278
|
bb0: {
|
|
1259
|
-
let activePresence = tasks?.filter(_temp$
|
|
1279
|
+
let activePresence = tasks?.filter(_temp$11)?.flatMap(_temp2$7)?.filter(_temp3$5).filter((presence) => {
|
|
1260
1280
|
if (!presence.path || !path.length) return !1;
|
|
1261
1281
|
let statusPath = stringToPath(presence.path);
|
|
1262
1282
|
return !showFocusWithin && statusPath.length !== path.length ? !1 : path.every((pathSegment, i) => {
|
|
@@ -1275,13 +1295,13 @@ function useAssistPresence(path, showFocusWithin) {
|
|
|
1275
1295
|
} else t0 = $[3];
|
|
1276
1296
|
return t0;
|
|
1277
1297
|
}
|
|
1278
|
-
function _temp3$
|
|
1298
|
+
function _temp3$5(p) {
|
|
1279
1299
|
return p.started && (/* @__PURE__ */ new Date()).getTime() - new Date(p.started).getTime() < maxHistoryVisibilityMs;
|
|
1280
1300
|
}
|
|
1281
|
-
function _temp2$
|
|
1301
|
+
function _temp2$7(task_0) {
|
|
1282
1302
|
return task_0.presence ?? [];
|
|
1283
1303
|
}
|
|
1284
|
-
function _temp$
|
|
1304
|
+
function _temp$11(task) {
|
|
1285
1305
|
return !task.ended;
|
|
1286
1306
|
}
|
|
1287
1307
|
function aiPresence(presence, path, _title) {
|
|
@@ -1332,7 +1352,7 @@ function AssistField(props) {
|
|
|
1332
1352
|
}
|
|
1333
1353
|
const WrapPreCard = styled(Card).withConfig({
|
|
1334
1354
|
displayName: "WrapPreCard",
|
|
1335
|
-
componentId: "sc-
|
|
1355
|
+
componentId: "sc-flgt1j-0"
|
|
1336
1356
|
})`& pre{white-space:pre-wrap !important;}`;
|
|
1337
1357
|
function SafeValueInput(props) {
|
|
1338
1358
|
let $ = c(5), t0;
|
|
@@ -1461,7 +1481,7 @@ function AssistItem(props) {
|
|
|
1461
1481
|
children: t1
|
|
1462
1482
|
}), $[3] = t1, $[4] = t2);
|
|
1463
1483
|
let t3;
|
|
1464
|
-
$[5] === presence ? t3 = $[6] : (t3 = presence.map(_temp$
|
|
1484
|
+
$[5] === presence ? t3 = $[6] : (t3 = presence.map(_temp$10), $[5] = presence, $[6] = t3);
|
|
1465
1485
|
let t4;
|
|
1466
1486
|
return $[7] !== t2 || $[8] !== t3 ? (t4 = /* @__PURE__ */ jsxs(Flex, {
|
|
1467
1487
|
align: "center",
|
|
@@ -1469,7 +1489,7 @@ function AssistItem(props) {
|
|
|
1469
1489
|
children: [t2, t3]
|
|
1470
1490
|
}), $[7] = t2, $[8] = t3, $[9] = t4) : t4 = $[9], t4;
|
|
1471
1491
|
}
|
|
1472
|
-
function _temp$
|
|
1492
|
+
function _temp$10(pre) {
|
|
1473
1493
|
return /* @__PURE__ */ jsx(Box, {
|
|
1474
1494
|
style: {
|
|
1475
1495
|
position: "absolute",
|
|
@@ -1691,7 +1711,7 @@ function extractConditionalPaths(node, maxDepth) {
|
|
|
1691
1711
|
}
|
|
1692
1712
|
const SparklesIllustration = /* @__PURE__ */ styled(SparklesIcon).withConfig({
|
|
1693
1713
|
displayName: "SparklesIllustration",
|
|
1694
|
-
componentId: "sc-
|
|
1714
|
+
componentId: "sc-xzej1l-0"
|
|
1695
1715
|
})({
|
|
1696
1716
|
fontSize: "3.125em",
|
|
1697
1717
|
"& path": { strokeWidth: "0.6px !important" }
|
|
@@ -1785,9 +1805,9 @@ function FieldAutocomplete(props) {
|
|
|
1785
1805
|
let currentField = t1, t2;
|
|
1786
1806
|
if ($[11] !== fieldRefs || $[12] !== filter) {
|
|
1787
1807
|
let t3;
|
|
1788
|
-
$[14] === filter ? t3 = $[15] : (t3 = (field) => !filter || filter(field), $[14] = filter, $[15] = t3), t2 = fieldRefs.filter(t3).filter(_temp$
|
|
1808
|
+
$[14] === filter ? t3 = $[15] : (t3 = (field) => !filter || filter(field), $[14] = filter, $[15] = t3), t2 = fieldRefs.filter(t3).filter(_temp$9).map(_temp2$6), $[11] = fieldRefs, $[12] = filter, $[13] = t2;
|
|
1789
1809
|
} else t2 = $[13];
|
|
1790
|
-
let autocompleteOptions = t2, renderOption = _temp3$
|
|
1810
|
+
let autocompleteOptions = t2, renderOption = _temp3$4, renderValue = _temp4$3, filterOption = _temp5$2, t3 = currentField ? currentField.icon : SearchIcon, t4 = currentField?.key, t5;
|
|
1791
1811
|
return $[16] !== autocompleteOptions || $[17] !== id || $[18] !== onSelect || $[19] !== t3 || $[20] !== t4 ? (t5 = /* @__PURE__ */ jsx(Autocomplete, {
|
|
1792
1812
|
fontSize: 1,
|
|
1793
1813
|
icon: t3,
|
|
@@ -1803,14 +1823,14 @@ function FieldAutocomplete(props) {
|
|
|
1803
1823
|
filterOption
|
|
1804
1824
|
}), $[16] = autocompleteOptions, $[17] = id, $[18] = onSelect, $[19] = t3, $[20] = t4, $[21] = t5) : t5 = $[21], t5;
|
|
1805
1825
|
}
|
|
1806
|
-
function _temp5(query, option_1) {
|
|
1826
|
+
function _temp5$2(query, option_1) {
|
|
1807
1827
|
let lQuery = query.toLowerCase();
|
|
1808
1828
|
return option_1?.value?.toLowerCase().includes(lQuery) || option_1?.field?.title?.toLowerCase().includes(lQuery);
|
|
1809
1829
|
}
|
|
1810
|
-
function _temp4$
|
|
1830
|
+
function _temp4$3(value_0, option_0) {
|
|
1811
1831
|
return option_0?.field.title ?? value_0;
|
|
1812
1832
|
}
|
|
1813
|
-
function _temp3$
|
|
1833
|
+
function _temp3$4(option) {
|
|
1814
1834
|
let { value, field: field_1 } = option;
|
|
1815
1835
|
return value ? isType(field_1.schemaType, "document") ? /* @__PURE__ */ jsx(Card, {
|
|
1816
1836
|
as: "button",
|
|
@@ -1843,13 +1863,13 @@ function _temp3$2(option) {
|
|
|
1843
1863
|
})
|
|
1844
1864
|
});
|
|
1845
1865
|
}
|
|
1846
|
-
function _temp2$
|
|
1866
|
+
function _temp2$6(field_0) {
|
|
1847
1867
|
return {
|
|
1848
1868
|
value: field_0.key,
|
|
1849
1869
|
field: field_0
|
|
1850
1870
|
};
|
|
1851
1871
|
}
|
|
1852
|
-
function _temp$
|
|
1872
|
+
function _temp$9(f_0) {
|
|
1853
1873
|
return !isType(f_0.schemaType, "reference");
|
|
1854
1874
|
}
|
|
1855
1875
|
function FieldTitle(props) {
|
|
@@ -1866,7 +1886,7 @@ function FieldTitle(props) {
|
|
|
1866
1886
|
size: 1,
|
|
1867
1887
|
children: "/"
|
|
1868
1888
|
})
|
|
1869
|
-
}), $[10] = t1) : t1 = $[10], t2 = 1, t3 = splitTitle.slice(0, splitTitle.length - 1).map(_temp6), $[0] = props.field.title, $[1] = T0, $[2] = T1, $[3] = splitTitle, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4);
|
|
1889
|
+
}), $[10] = t1) : t1 = $[10], t2 = 1, t3 = splitTitle.slice(0, splitTitle.length - 1).map(_temp6$1), $[0] = props.field.title, $[1] = T0, $[2] = T1, $[3] = splitTitle, $[4] = t0, $[5] = t1, $[6] = t2, $[7] = t3, $[8] = t4);
|
|
1870
1890
|
let t5 = splitTitle[splitTitle.length - 1], t6;
|
|
1871
1891
|
$[11] === t5 ? t6 = $[12] : (t6 = /* @__PURE__ */ jsx(Box, {
|
|
1872
1892
|
marginTop: 1,
|
|
@@ -1889,7 +1909,7 @@ function FieldTitle(props) {
|
|
|
1889
1909
|
children: t7
|
|
1890
1910
|
}), $[20] = T1, $[21] = t4, $[22] = t7, $[23] = t8) : t8 = $[23], t8;
|
|
1891
1911
|
}
|
|
1892
|
-
function _temp6(pt, i) {
|
|
1912
|
+
function _temp6$1(pt, i) {
|
|
1893
1913
|
return /* @__PURE__ */ jsx(Box, {
|
|
1894
1914
|
marginTop: 1,
|
|
1895
1915
|
children: /* @__PURE__ */ jsx(Text, {
|
|
@@ -1900,13 +1920,13 @@ function _temp6(pt, i) {
|
|
|
1900
1920
|
}, i);
|
|
1901
1921
|
}
|
|
1902
1922
|
function useInterval(ms) {
|
|
1903
|
-
let $ = c(3), [tick, update] = useReducer(_temp$
|
|
1923
|
+
let $ = c(3), [tick, update] = useReducer(_temp$8, 0), t0, t1;
|
|
1904
1924
|
return $[0] === ms ? (t0 = $[1], t1 = $[2]) : (t0 = () => {
|
|
1905
1925
|
let i = setInterval(update, ms);
|
|
1906
1926
|
return () => clearInterval(i);
|
|
1907
1927
|
}, t1 = [ms], $[0] = ms, $[1] = t0, $[2] = t1), useEffect(t0, t1), tick;
|
|
1908
1928
|
}
|
|
1909
|
-
function _temp$
|
|
1929
|
+
function _temp$8(n) {
|
|
1910
1930
|
return n + 1;
|
|
1911
1931
|
}
|
|
1912
1932
|
function TimeAgo(t0) {
|
|
@@ -1922,7 +1942,7 @@ function TimeAgo(t0) {
|
|
|
1922
1942
|
}
|
|
1923
1943
|
const rotate = keyframes`0%{transform:rotate(0);}100%{transform:rotate(360deg);}`, SyncSpinningIcon = styled(SyncIcon).withConfig({
|
|
1924
1944
|
displayName: "SyncSpinningIcon",
|
|
1925
|
-
componentId: "sc-
|
|
1945
|
+
componentId: "sc-chle4-0"
|
|
1926
1946
|
})`animation:${rotate} 1s linear infinite;`, TASK_CONFIG = {
|
|
1927
1947
|
aborted: {
|
|
1928
1948
|
title: "Canceled",
|
|
@@ -1946,55 +1966,82 @@ const rotate = keyframes`0%{transform:rotate(0);}100%{transform:rotate(360deg);}
|
|
|
1946
1966
|
}
|
|
1947
1967
|
};
|
|
1948
1968
|
function InstructionTaskHistoryButton(props) {
|
|
1949
|
-
let { tasks, instructions, documentId, showTitles } = props,
|
|
1969
|
+
let $ = c(32), { tasks, instructions, documentId, showTitles } = props, t0;
|
|
1970
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = { apiVersion: "2023-01-01" }, $[0] = t0) : t0 = $[0];
|
|
1971
|
+
let client = useClient(t0), t1;
|
|
1972
|
+
$[1] !== client || $[2] !== documentId ? (t1 = (taskKey) => {
|
|
1950
1973
|
if (!documentId) return;
|
|
1951
1974
|
let statusDocId = assistTasksStatusId(documentId), basePath = `${typed("tasks")}[_key=="${taskKey}"]`;
|
|
1952
1975
|
client.patch(statusDocId).set({
|
|
1953
1976
|
[`${basePath}.${typed("ended")}`]: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1954
1977
|
[`${basePath}.${typed("reason")}`]: typed("aborted")
|
|
1955
1978
|
}).commit().catch(console.error);
|
|
1956
|
-
}, [client, documentId
|
|
1957
|
-
|
|
1958
|
-
|
|
1959
|
-
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
|
-
|
|
1967
|
-
|
|
1968
|
-
|
|
1969
|
-
|
|
1970
|
-
|
|
1971
|
-
|
|
1979
|
+
}, $[1] = client, $[2] = documentId, $[3] = t1) : t1 = $[3];
|
|
1980
|
+
let cancelRun = t1, t;
|
|
1981
|
+
$[4] !== cancelRun || $[5] !== instructions || $[6] !== showTitles || $[7] !== tasks ? (t = tasks?.filter(_temp$7).map((task_0) => {
|
|
1982
|
+
let instruction = instructions?.find((i) => i._key === task_0.instructionKey);
|
|
1983
|
+
return {
|
|
1984
|
+
...task_0,
|
|
1985
|
+
title: showTitles ? task_0.title ?? getInstructionTitle(instruction) : void 0,
|
|
1986
|
+
cancel: () => cancelRun(task_0._key)
|
|
1987
|
+
};
|
|
1988
|
+
}) ?? [], t.sort(_temp2$5), $[4] = cancelRun, $[5] = instructions, $[6] = showTitles, $[7] = tasks, $[8] = t) : t = $[8];
|
|
1989
|
+
let titledTasks = t, t2;
|
|
1990
|
+
$[9] === titledTasks ? t2 = $[10] : (t2 = titledTasks.some(_temp3$3), $[9] = titledTasks, $[10] = t2);
|
|
1991
|
+
let isRunning = t2, t3;
|
|
1992
|
+
$[11] === titledTasks ? t3 = $[12] : (t3 = titledTasks.some(_temp4$2), $[11] = titledTasks, $[12] = t3);
|
|
1993
|
+
let hasErrors = t3, [open, setOpen] = useState(!1), t4;
|
|
1994
|
+
$[13] === Symbol.for("react.memo_cache_sentinel") ? (t4 = () => setOpen(_temp5$1), $[13] = t4) : t4 = $[13];
|
|
1995
|
+
let toggleOpen = t4, [button, setButton] = useState(null), [popover, setPopover] = useState(null), t5;
|
|
1996
|
+
$[14] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => {
|
|
1972
1997
|
setOpen(!1);
|
|
1973
|
-
}, []);
|
|
1974
|
-
|
|
1975
|
-
|
|
1998
|
+
}, $[14] = t5) : t5 = $[14];
|
|
1999
|
+
let handleClickOutside = t5, t6;
|
|
2000
|
+
$[15] !== button || $[16] !== popover ? (t6 = () => [button, popover], $[15] = button, $[16] = popover, $[17] = t6) : t6 = $[17], useClickOutsideEvent(handleClickOutside, t6);
|
|
2001
|
+
let t7;
|
|
2002
|
+
$[18] === button ? t7 = $[19] : (t7 = () => {
|
|
1976
2003
|
setOpen(!1), button?.focus();
|
|
1977
|
-
}, [button]);
|
|
1978
|
-
|
|
2004
|
+
}, $[18] = button, $[19] = t7);
|
|
2005
|
+
let handleEscape = t7, t8;
|
|
2006
|
+
$[20] !== handleEscape || $[21] !== titledTasks ? (t8 = /* @__PURE__ */ jsx(TaskList, {
|
|
2007
|
+
onEscape: handleEscape,
|
|
2008
|
+
tasks: titledTasks
|
|
2009
|
+
}), $[20] = handleEscape, $[21] = titledTasks, $[22] = t8) : t8 = $[22];
|
|
2010
|
+
let t9 = open && !!titledTasks?.length, t10 = !titledTasks?.length, t11;
|
|
2011
|
+
$[23] !== hasErrors || $[24] !== isRunning || $[25] !== open || $[26] !== t10 ? (t11 = /* @__PURE__ */ jsx(TaskStatusButton, {
|
|
2012
|
+
disabled: t10,
|
|
2013
|
+
hasErrors,
|
|
2014
|
+
isRunning,
|
|
2015
|
+
onClick: toggleOpen,
|
|
2016
|
+
ref: setButton,
|
|
2017
|
+
selected: open
|
|
2018
|
+
}), $[23] = hasErrors, $[24] = isRunning, $[25] = open, $[26] = t10, $[27] = t11) : t11 = $[27];
|
|
2019
|
+
let t12;
|
|
2020
|
+
return $[28] !== t11 || $[29] !== t8 || $[30] !== t9 ? (t12 = /* @__PURE__ */ jsx(Popover, {
|
|
1979
2021
|
constrainSize: !0,
|
|
1980
|
-
content:
|
|
1981
|
-
|
|
1982
|
-
tasks: titledTasks
|
|
1983
|
-
}),
|
|
1984
|
-
open: open && !!titledTasks?.length,
|
|
2022
|
+
content: t8,
|
|
2023
|
+
open: t9,
|
|
1985
2024
|
placement: "top",
|
|
1986
2025
|
portal: !0,
|
|
1987
2026
|
ref: setPopover,
|
|
1988
2027
|
width: 0,
|
|
1989
|
-
children:
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
2028
|
+
children: t11
|
|
2029
|
+
}), $[28] = t11, $[29] = t8, $[30] = t9, $[31] = t12) : t12 = $[31], t12;
|
|
2030
|
+
}
|
|
2031
|
+
function _temp5$1(v) {
|
|
2032
|
+
return !v;
|
|
2033
|
+
}
|
|
2034
|
+
function _temp4$2(r_0) {
|
|
2035
|
+
return r_0.reason === "error" || r_0.reason === "timeout";
|
|
2036
|
+
}
|
|
2037
|
+
function _temp3$3(r) {
|
|
2038
|
+
return !r.ended;
|
|
2039
|
+
}
|
|
2040
|
+
function _temp2$5(a, b) {
|
|
2041
|
+
return new Date(b.started ?? "").getTime() - new Date(a.started ?? "").getTime();
|
|
2042
|
+
}
|
|
2043
|
+
function _temp$7(task) {
|
|
2044
|
+
return task.started && (/* @__PURE__ */ new Date()).getTime() - new Date(task.started).getTime() < maxHistoryVisibilityMs;
|
|
1998
2045
|
}
|
|
1999
2046
|
const TASK_STATUS_BUTTON_TOOLTIP_PROPS = { placement: "top" };
|
|
2000
2047
|
function TaskStatusButton(props) {
|
|
@@ -2018,7 +2065,7 @@ function TaskList(props) {
|
|
|
2018
2065
|
isTopLayer && event.key === "Escape" && onEscape();
|
|
2019
2066
|
}, $[0] = isTopLayer, $[1] = onEscape, $[2] = t0) : t0 = $[2], useGlobalKeyDown(t0);
|
|
2020
2067
|
let t1;
|
|
2021
|
-
$[3] === tasks ? t1 = $[4] : (t1 = tasks.map(
|
|
2068
|
+
$[3] === tasks ? t1 = $[4] : (t1 = tasks.map(_temp6), $[3] = tasks, $[4] = t1);
|
|
2022
2069
|
let t2;
|
|
2023
2070
|
return $[5] === t1 ? t2 = $[6] : (t2 = /* @__PURE__ */ jsx(Stack, {
|
|
2024
2071
|
padding: 1,
|
|
@@ -2026,7 +2073,7 @@ function TaskList(props) {
|
|
|
2026
2073
|
children: t1
|
|
2027
2074
|
}), $[5] = t1, $[6] = t2), t2;
|
|
2028
2075
|
}
|
|
2029
|
-
function
|
|
2076
|
+
function _temp6(task) {
|
|
2030
2077
|
return /* @__PURE__ */ jsx(TaskItem, { task }, task._key);
|
|
2031
2078
|
}
|
|
2032
2079
|
function TaskItem(props) {
|
|
@@ -2129,10 +2176,10 @@ function isolatePathParams(nextParams, hostParams) {
|
|
|
2129
2176
|
}
|
|
2130
2177
|
const EMPTY_PANE_PARAMS = {}, CardWithShadowBelow = styled(Card).withConfig({
|
|
2131
2178
|
displayName: "CardWithShadowBelow",
|
|
2132
|
-
componentId: "sc-
|
|
2179
|
+
componentId: "sc-pz26f7-0"
|
|
2133
2180
|
})`position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;bottom:-1px;border-bottom:1px solid var(--card-border-color);opacity:0.5;z-index:100;}`, CardWithShadowAbove = styled(Card).withConfig({
|
|
2134
2181
|
displayName: "CardWithShadowAbove",
|
|
2135
|
-
componentId: "sc-
|
|
2182
|
+
componentId: "sc-pz26f7-1"
|
|
2136
2183
|
})`position:relative;&:after{content:'';display:block;position:absolute;left:0;right:0;top:-1px;border-top:1px solid var(--card-border-color);opacity:0.5;z-index:100;}`;
|
|
2137
2184
|
function AssistInspectorWrapper(props) {
|
|
2138
2185
|
let $ = c(43), context = useAiAssistanceConfig();
|
|
@@ -2308,7 +2355,7 @@ function AssistInspector(props) {
|
|
|
2308
2355
|
documentId,
|
|
2309
2356
|
schemaType,
|
|
2310
2357
|
initDoc: !0
|
|
2311
|
-
}), instruction = (assistDocument?.fields?.find((f) => f.path === typePath))?.instructions?.find((i) => i._key === instructionKey), tasks = useMemo(() => assistDocument?.tasks?.filter((
|
|
2358
|
+
}), instruction = (assistDocument?.fields?.find((f) => f.path === typePath))?.instructions?.find((i) => i._key === instructionKey), tasks = useMemo(() => assistDocument?.tasks?.filter((i) => !instructionKey || i.instructionKey === instructionKey), [assistDocument?.tasks, instructionKey]), instructions = useMemo(() => assistDocument?.fields?.flatMap((f) => f.instructions ?? []), [assistDocument?.fields]), promptValue = instruction?.prompt, isEmptyPrompt = useMemo(() => {
|
|
2312
2359
|
if (!promptValue?.length) return !0;
|
|
2313
2360
|
let children = promptValue[0]?.children;
|
|
2314
2361
|
return promptValue.length == 1 && children?.length === 1 && !children?.[0]?.text?.length;
|
|
@@ -2637,14 +2684,12 @@ const options = {
|
|
|
2637
2684
|
}
|
|
2638
2685
|
};
|
|
2639
2686
|
function AssistConnectorsOverlay(props) {
|
|
2640
|
-
let $ = c(
|
|
2641
|
-
$[0] ===
|
|
2687
|
+
let $ = c(12), { connectors } = props, [, setRedraw] = useState(!1), t0, t1;
|
|
2688
|
+
$[0] === Symbol.for("react.memo_cache_sentinel") ? (t0 = () => {
|
|
2642
2689
|
setRedraw(!0);
|
|
2643
|
-
}, $[0] =
|
|
2644
|
-
let t1;
|
|
2645
|
-
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t1 = [], $[2] = t1) : t1 = $[2], useEffect(t0, t1);
|
|
2690
|
+
}, t1 = [], $[0] = t0, $[1] = t1) : (t0 = $[0], t1 = $[1]), useEffect(t0, t1);
|
|
2646
2691
|
let t2;
|
|
2647
|
-
$[
|
|
2692
|
+
$[2] === Symbol.for("react.memo_cache_sentinel") ? (t2 = {
|
|
2648
2693
|
position: "absolute",
|
|
2649
2694
|
top: 0,
|
|
2650
2695
|
left: 0,
|
|
@@ -2652,23 +2697,23 @@ function AssistConnectorsOverlay(props) {
|
|
|
2652
2697
|
height: "100%",
|
|
2653
2698
|
pointerEvents: "none",
|
|
2654
2699
|
zIndex: 150
|
|
2655
|
-
}, $[
|
|
2700
|
+
}, $[2] = t2) : t2 = $[2];
|
|
2656
2701
|
let t3;
|
|
2657
|
-
$[
|
|
2702
|
+
$[3] === connectors ? t3 = $[4] : (t3 = connectors.map(_temp$6), $[3] = connectors, $[4] = t3);
|
|
2658
2703
|
let t4;
|
|
2659
|
-
$[
|
|
2704
|
+
$[5] === t3 ? t4 = $[6] : (t4 = /* @__PURE__ */ jsx("svg", {
|
|
2660
2705
|
fill: "none",
|
|
2661
2706
|
width: window.innerWidth,
|
|
2662
2707
|
height: window.innerHeight,
|
|
2663
2708
|
style: t2,
|
|
2664
2709
|
children: t3
|
|
2665
|
-
}), $[
|
|
2710
|
+
}), $[5] = t3, $[6] = t4);
|
|
2666
2711
|
let t5;
|
|
2667
|
-
$[
|
|
2712
|
+
$[7] === connectors ? t5 = $[8] : (t5 = !1, $[7] = connectors, $[8] = t5);
|
|
2668
2713
|
let t6;
|
|
2669
|
-
return $[
|
|
2714
|
+
return $[9] !== t4 || $[10] !== t5 ? (t6 = /* @__PURE__ */ jsxs(Fragment, { children: [t4, t5] }), $[9] = t4, $[10] = t5, $[11] = t6) : t6 = $[11], t6;
|
|
2670
2715
|
}
|
|
2671
|
-
function _temp$
|
|
2716
|
+
function _temp$6(connector) {
|
|
2672
2717
|
return /* @__PURE__ */ jsx(ConnectorPath, {
|
|
2673
2718
|
from: connector.from,
|
|
2674
2719
|
options,
|
|
@@ -2834,7 +2879,7 @@ function FieldTranslationProvider(props) {
|
|
|
2834
2879
|
}
|
|
2835
2880
|
let preferred = getPreferredToFieldLanguages(from.id), allToLanguages = languages_0.filter((l) => l.id !== from?.id), filteredToLanguages = allToLanguages.filter((l_0) => !preferred.length || preferred.includes(l_0.id));
|
|
2836
2881
|
setToLanguages(filteredToLanguages);
|
|
2837
|
-
let fromId = from?.id, allToIds = allToLanguages?.map(_temp$
|
|
2882
|
+
let fromId = from?.id, allToIds = allToLanguages?.map(_temp$5) ?? [], docMembers = getDocumentMembersFlat(document, documentSchema, config?.maxPathDepth);
|
|
2838
2883
|
if (fromId && allToIds?.length) {
|
|
2839
2884
|
let transMap = getFieldLanguageMap(documentSchema, docMembers, fromId, allToIds.filter((toId) => fromId !== toId), config?.translationOutputs ?? defaultLanguageOutputs);
|
|
2840
2885
|
setFieldLanguageMaps(transMap);
|
|
@@ -2844,7 +2889,7 @@ function FieldTranslationProvider(props) {
|
|
|
2844
2889
|
$[6] === fromLanguage ? t4 = $[7] : (t4 = (toggledLang, toLanguages_0, languages_1) => {
|
|
2845
2890
|
if (!languages_1 || !fromLanguage) return;
|
|
2846
2891
|
let wasSelected = !!toLanguages_0?.find((l_2) => l_2.id === toggledLang.id), newToLangs = languages_1.filter((anyLang) => !!toLanguages_0?.find((selectedLang) => toggledLang.id !== selectedLang.id && selectedLang.id === anyLang.id) || toggledLang.id === anyLang.id && !wasSelected);
|
|
2847
|
-
setToLanguages(newToLangs), setPreferredToFieldLanguages(fromLanguage.id, newToLangs.map(_temp2$
|
|
2892
|
+
setToLanguages(newToLangs), setPreferredToFieldLanguages(fromLanguage.id, newToLangs.map(_temp2$4));
|
|
2848
2893
|
}, $[6] = fromLanguage, $[7] = t4);
|
|
2849
2894
|
let toggleToLanguage = t4, t5;
|
|
2850
2895
|
$[8] !== config || $[9] !== languageClient || $[10] !== selectFromLanguage ? (t5 = async (params_0) => {
|
|
@@ -2964,10 +3009,10 @@ function FieldTranslationProvider(props) {
|
|
|
2964
3009
|
children: [t11, props.children]
|
|
2965
3010
|
}), $[45] = contextValue, $[46] = props.children, $[47] = t11, $[48] = t12) : t12 = $[48], t12;
|
|
2966
3011
|
}
|
|
2967
|
-
function _temp2$
|
|
3012
|
+
function _temp2$4(l_3) {
|
|
2968
3013
|
return l_3.id;
|
|
2969
3014
|
}
|
|
2970
|
-
function _temp$
|
|
3015
|
+
function _temp$5(l_1) {
|
|
2971
3016
|
return l_1.id;
|
|
2972
3017
|
}
|
|
2973
3018
|
function ToLanguageCheckbox(props) {
|
|
@@ -3450,7 +3495,7 @@ function useCustomFieldActions(props) {
|
|
|
3450
3495
|
pushToast,
|
|
3451
3496
|
addSyntheticTask,
|
|
3452
3497
|
removeSyntheticTask
|
|
3453
|
-
})).filter(isDefined), onlyGroups = customActions?.length && customActions?.every((
|
|
3498
|
+
})).filter(isDefined), onlyGroups = customActions?.length && customActions?.every((node) => node.type === "group");
|
|
3454
3499
|
return (customActions?.length ? onlyGroups ? customActions : [{
|
|
3455
3500
|
type: "group",
|
|
3456
3501
|
title: title || "Custom actions",
|
|
@@ -3779,26 +3824,57 @@ function createAssistDocumentPresence(documentId) {
|
|
|
3779
3824
|
};
|
|
3780
3825
|
}
|
|
3781
3826
|
function AssistDocumentPresence() {
|
|
3782
|
-
let { assistDocument, syntheticTasks } = useAssistDocumentContext()
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3827
|
+
let $ = c(9), { assistDocument, syntheticTasks } = useAssistDocumentContext();
|
|
3828
|
+
assistDocument?.tasks;
|
|
3829
|
+
let t0;
|
|
3830
|
+
if ($[0] !== assistDocument?.tasks || $[1] !== syntheticTasks) {
|
|
3831
|
+
bb0: {
|
|
3832
|
+
let anyPresence = [...assistDocument?.tasks ?? [], ...syntheticTasks ?? []].filter(_temp$4)?.flatMap(_temp2$3).find(_temp3$2);
|
|
3833
|
+
if (anyPresence) {
|
|
3834
|
+
t0 = aiPresence(anyPresence, []);
|
|
3835
|
+
break bb0;
|
|
3836
|
+
}
|
|
3837
|
+
let t1;
|
|
3838
|
+
if ($[3] !== assistDocument?.tasks) {
|
|
3839
|
+
let anyRun = assistDocument?.tasks?.filter(_temp4$1)?.find(_temp5);
|
|
3840
|
+
t1 = anyRun ? aiPresence({
|
|
3841
|
+
started: anyRun.started,
|
|
3842
|
+
path: documentRootKey,
|
|
3843
|
+
_key: anyRun._key,
|
|
3844
|
+
_type: fieldPresenceTypeName
|
|
3845
|
+
}, []) : void 0, $[3] = assistDocument?.tasks, $[4] = t1;
|
|
3846
|
+
} else t1 = $[4];
|
|
3847
|
+
t0 = t1;
|
|
3848
|
+
}
|
|
3849
|
+
$[0] = assistDocument?.tasks, $[1] = syntheticTasks, $[2] = t0;
|
|
3850
|
+
} else t0 = $[2];
|
|
3851
|
+
let anyPresence_0 = t0, t1;
|
|
3852
|
+
$[5] === anyPresence_0 ? t1 = $[6] : (t1 = anyPresence_0 && /* @__PURE__ */ jsx(AiFieldPresence, { presence: anyPresence_0 }), $[5] = anyPresence_0, $[6] = t1);
|
|
3853
|
+
let t2;
|
|
3854
|
+
return $[7] === t1 ? t2 = $[8] : (t2 = /* @__PURE__ */ jsx(Card, { children: /* @__PURE__ */ jsx(Flex, {
|
|
3794
3855
|
flex: 1,
|
|
3795
3856
|
justify: "flex-end",
|
|
3796
3857
|
children: /* @__PURE__ */ jsx(Flex, {
|
|
3797
3858
|
gap: 2,
|
|
3798
3859
|
align: "center",
|
|
3799
|
-
children:
|
|
3860
|
+
children: t1
|
|
3800
3861
|
})
|
|
3801
|
-
}) });
|
|
3862
|
+
}) }), $[7] = t1, $[8] = t2), t2;
|
|
3863
|
+
}
|
|
3864
|
+
function _temp5(f_0) {
|
|
3865
|
+
return f_0.started && (/* @__PURE__ */ new Date()).getTime() - new Date(f_0.started).getTime() < 3e4;
|
|
3866
|
+
}
|
|
3867
|
+
function _temp4$1(run_1) {
|
|
3868
|
+
return !run_1.ended && !run_1.reason;
|
|
3869
|
+
}
|
|
3870
|
+
function _temp3$2(f) {
|
|
3871
|
+
return f.started && (/* @__PURE__ */ new Date()).getTime() - new Date(f.started).getTime() < 3e4;
|
|
3872
|
+
}
|
|
3873
|
+
function _temp2$3(run_0) {
|
|
3874
|
+
return run_0.presence ?? [];
|
|
3875
|
+
}
|
|
3876
|
+
function _temp$4(run) {
|
|
3877
|
+
return !run.ended && !run.reason;
|
|
3802
3878
|
}
|
|
3803
3879
|
function BackToInstructionListLink() {
|
|
3804
3880
|
let $ = c(4), { openInspector } = useDocumentPane(), t0;
|
|
@@ -3960,37 +4036,40 @@ function _temp$3(m) {
|
|
|
3960
4036
|
return m.kind === "error" && m.fieldName === "fields";
|
|
3961
4037
|
}
|
|
3962
4038
|
function useSelectedSchema(fieldPath, documentSchema) {
|
|
3963
|
-
let $ = c(
|
|
3964
|
-
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
break bb0;
|
|
3968
|
-
}
|
|
3969
|
-
if (fieldPath === "<document>") {
|
|
3970
|
-
t0 = documentSchema;
|
|
3971
|
-
break bb0;
|
|
3972
|
-
}
|
|
3973
|
-
let t1;
|
|
3974
|
-
$[0] === fieldPath ? t1 = $[1] : (t1 = stringToPath(fieldPath), $[0] = fieldPath, $[1] = t1);
|
|
3975
|
-
let path = t1, currentSchema = documentSchema;
|
|
3976
|
-
for (let i = 0; i < path.length; i++) {
|
|
3977
|
-
let segment = path[i], field = currentSchema?.fields.find((f) => f.name === segment);
|
|
3978
|
-
if (!field) {
|
|
4039
|
+
let $ = c(5), t0;
|
|
4040
|
+
if ($[0] !== documentSchema || $[1] !== fieldPath) {
|
|
4041
|
+
bb0: {
|
|
4042
|
+
if (!fieldPath) {
|
|
3979
4043
|
t0 = void 0;
|
|
3980
4044
|
break bb0;
|
|
3981
4045
|
}
|
|
3982
|
-
if (
|
|
3983
|
-
t0 =
|
|
4046
|
+
if (fieldPath === "<document>") {
|
|
4047
|
+
t0 = documentSchema;
|
|
3984
4048
|
break bb0;
|
|
3985
4049
|
}
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
4050
|
+
let t1;
|
|
4051
|
+
$[3] === fieldPath ? t1 = $[4] : (t1 = stringToPath(fieldPath), $[3] = fieldPath, $[4] = t1);
|
|
4052
|
+
let path = t1, currentSchema = documentSchema;
|
|
4053
|
+
for (let i = 0; i < path.length; i++) {
|
|
4054
|
+
let segment = path[i], field = currentSchema?.fields.find((f) => f.name === segment);
|
|
4055
|
+
if (!field) {
|
|
4056
|
+
t0 = void 0;
|
|
4057
|
+
break bb0;
|
|
4058
|
+
}
|
|
4059
|
+
if (i === path.length - 1) {
|
|
4060
|
+
t0 = field.type;
|
|
4061
|
+
break bb0;
|
|
4062
|
+
}
|
|
4063
|
+
if (field.type.jsonType !== "object") {
|
|
4064
|
+
t0 = void 0;
|
|
4065
|
+
break bb0;
|
|
4066
|
+
}
|
|
4067
|
+
currentSchema = field.type;
|
|
3989
4068
|
}
|
|
3990
|
-
|
|
4069
|
+
t0 = currentSchema;
|
|
3991
4070
|
}
|
|
3992
|
-
|
|
3993
|
-
}
|
|
4071
|
+
$[0] = documentSchema, $[1] = fieldPath, $[2] = t0;
|
|
4072
|
+
} else t0 = $[2];
|
|
3994
4073
|
return t0;
|
|
3995
4074
|
}
|
|
3996
4075
|
function FieldsInitializer(t0) {
|
|
@@ -4186,16 +4265,15 @@ function InstructionInput(props) {
|
|
|
4186
4265
|
}), $[1] = props, $[2] = t1), t1;
|
|
4187
4266
|
}
|
|
4188
4267
|
function ObjectMember(t0) {
|
|
4189
|
-
let $ = c(
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
} else props = $[1], t1 = $[2];
|
|
4268
|
+
let $ = c(9), fieldName, props;
|
|
4269
|
+
$[0] === t0 ? (fieldName = $[1], props = $[2]) : ({fieldName, ...props} = t0, $[0] = t0, $[1] = fieldName, $[2] = props);
|
|
4270
|
+
let t1;
|
|
4271
|
+
$[3] !== fieldName || $[4] !== props.members ? (t1 = findFieldMember(props.members, fieldName), $[3] = fieldName, $[4] = props.members, $[5] = t1) : t1 = $[5];
|
|
4194
4272
|
let member = t1, t2;
|
|
4195
|
-
return $[
|
|
4273
|
+
return $[6] !== member || $[7] !== props ? (t2 = member ? /* @__PURE__ */ jsx(ObjectInputMember, {
|
|
4196
4274
|
...props,
|
|
4197
4275
|
member
|
|
4198
|
-
}) : null, $[
|
|
4276
|
+
}) : null, $[6] = member, $[7] = props, $[8] = t2) : t2 = $[8], t2;
|
|
4199
4277
|
}
|
|
4200
4278
|
const NONE = [];
|
|
4201
4279
|
function NameField(props) {
|
|
@@ -4353,12 +4431,13 @@ function ObjectOutputInput(t0) {
|
|
|
4353
4431
|
useEmptySelectAllValue(value, fields, onChange);
|
|
4354
4432
|
let t2;
|
|
4355
4433
|
$[5] !== fields || $[6] !== onChange || $[7] !== value?.length ? (t2 = (checked, selectedValue) => {
|
|
4356
|
-
if (checked)
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4434
|
+
if (checked) {
|
|
4435
|
+
if (value?.length) onChange(PatchEvent.from(unset([{ _key: selectedValue }])));
|
|
4436
|
+
else {
|
|
4437
|
+
let items = fields.filter((f) => f.name !== selectedValue).map(_temp2$1);
|
|
4438
|
+
onChange(PatchEvent.from([setIfMissing([]), insert(items, "after", [-1])]));
|
|
4439
|
+
}
|
|
4440
|
+
} else {
|
|
4362
4441
|
let patchValue = {
|
|
4363
4442
|
_key: selectedValue,
|
|
4364
4443
|
_type: "sanity.assist.output.field",
|
|
@@ -4406,12 +4485,13 @@ function ArrayOutputInput(t0) {
|
|
|
4406
4485
|
useEmptySelectAllValue(value, ofItems, onChange);
|
|
4407
4486
|
let t2;
|
|
4408
4487
|
$[5] !== ofItems || $[6] !== onChange || $[7] !== value?.length ? (t2 = (checked, selectedValue) => {
|
|
4409
|
-
if (checked)
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4488
|
+
if (checked) {
|
|
4489
|
+
if (value?.length) onChange(PatchEvent.from(unset([{ _key: selectedValue }])));
|
|
4490
|
+
else {
|
|
4491
|
+
let items = ofItems.filter((f) => f.name !== selectedValue).map(_temp4);
|
|
4492
|
+
onChange(PatchEvent.from([setIfMissing([]), insert(items, "after", [-1])]));
|
|
4493
|
+
}
|
|
4494
|
+
} else {
|
|
4415
4495
|
let patchValue = {
|
|
4416
4496
|
_key: selectedValue,
|
|
4417
4497
|
_type: "sanity.assist.output.type",
|
|
@@ -4479,7 +4559,7 @@ function Selectable(t0) {
|
|
|
4479
4559
|
}
|
|
4480
4560
|
const PteMods = styled(Box).withConfig({
|
|
4481
4561
|
displayName: "PteMods",
|
|
4482
|
-
componentId: "sc-
|
|
4562
|
+
componentId: "sc-lca06y-0"
|
|
4483
4563
|
})`& [data-testid='pt-editor__toolbar-card'] > div > div:last-child{display:none;}& [data-testid='pt-editor']{min-height:300px;}& [data-testid='pt-editor'] .pt-inline-object *{max-width:400px;}`;
|
|
4484
4564
|
function PromptInput(props) {
|
|
4485
4565
|
let $ = c(5);
|