@e-llm-studio/instant-learning 1.3.19 → 1.3.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.
Files changed (94) hide show
  1. package/dist/ComponentRegistry.js +4 -0
  2. package/dist/ComponentRegistry.js.map +1 -1
  3. package/dist/ILMarketplaceWrapper.js +1 -0
  4. package/dist/ILMarketplaceWrapper.js.map +1 -1
  5. package/dist/cjs/ComponentRegistry.js +4 -0
  6. package/dist/cjs/ComponentRegistry.js.map +1 -1
  7. package/dist/cjs/ILMarketplaceWrapper.js +1 -0
  8. package/dist/cjs/ILMarketplaceWrapper.js.map +1 -1
  9. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +21 -7
  10. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js.map +1 -1
  11. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +16 -9
  12. package/dist/cjs/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js.map +1 -1
  13. package/dist/cjs/features/IL-OTJ/_components/hooks/useVariantEditSession.js +21 -7
  14. package/dist/cjs/features/IL-OTJ/_components/hooks/useVariantEditSession.js.map +1 -1
  15. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -0
  16. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
  17. package/dist/cjs/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
  18. package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js +4 -1
  19. package/dist/cjs/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
  20. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js +8 -3
  21. package/dist/cjs/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
  22. package/dist/cjs/features/LearningManagement/store/useEnvStore.js +2 -0
  23. package/dist/cjs/features/LearningManagement/store/useEnvStore.js.map +1 -1
  24. package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +2 -1
  25. package/dist/cjs/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
  26. package/dist/cjs/schema-driven/BPARenderer.js +8 -1
  27. package/dist/cjs/schema-driven/BPARenderer.js.map +1 -1
  28. package/dist/cjs/schema-driven/components/FileUploadField.js +815 -0
  29. package/dist/cjs/schema-driven/components/FileUploadField.js.map +1 -0
  30. package/dist/cjs/schema-driven/components/FileUploadField.module.css.js +12 -0
  31. package/dist/cjs/schema-driven/components/FileUploadField.module.css.js.map +1 -0
  32. package/dist/cjs/schema-driven/components/VariantListField.js +133 -11
  33. package/dist/cjs/schema-driven/components/VariantListField.js.map +1 -1
  34. package/dist/cjs/schema-driven/types.js.map +1 -1
  35. package/dist/cjs/schema-driven/utils/PayloadUtils.js +2 -2
  36. package/dist/cjs/schema-driven/utils/PayloadUtils.js.map +1 -1
  37. package/dist/cjs/schema-driven/utils/fileUploadService.js +461 -0
  38. package/dist/cjs/schema-driven/utils/fileUploadService.js.map +1 -0
  39. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js +21 -7
  40. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.js.map +1 -1
  41. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js +16 -9
  42. package/dist/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.js.map +1 -1
  43. package/dist/features/IL-OTJ/_components/hooks/useVariantEditSession.js +21 -8
  44. package/dist/features/IL-OTJ/_components/hooks/useVariantEditSession.js.map +1 -1
  45. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js +1 -0
  46. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.js.map +1 -1
  47. package/dist/features/IL-marketplace/components/GuidelineLibraryCard.module.css.js +2 -2
  48. package/dist/features/IL-marketplace/components/LearningManagementWrapper.js +4 -1
  49. package/dist/features/IL-marketplace/components/LearningManagementWrapper.js.map +1 -1
  50. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js +8 -3
  51. package/dist/features/LearningManagement/components/InstantLearningModalDynamic.js.map +1 -1
  52. package/dist/features/LearningManagement/store/useEnvStore.js +2 -0
  53. package/dist/features/LearningManagement/store/useEnvStore.js.map +1 -1
  54. package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js +2 -1
  55. package/dist/plugins/ValueTypes/Default/DefaultTeachMeRenderer.js.map +1 -1
  56. package/dist/schema-driven/BPARenderer.js +8 -1
  57. package/dist/schema-driven/BPARenderer.js.map +1 -1
  58. package/dist/schema-driven/components/FileUploadField.js +811 -0
  59. package/dist/schema-driven/components/FileUploadField.js.map +1 -0
  60. package/dist/schema-driven/components/FileUploadField.module.css.js +8 -0
  61. package/dist/schema-driven/components/FileUploadField.module.css.js.map +1 -0
  62. package/dist/schema-driven/components/VariantListField.js +134 -12
  63. package/dist/schema-driven/components/VariantListField.js.map +1 -1
  64. package/dist/schema-driven/types.js.map +1 -1
  65. package/dist/schema-driven/utils/PayloadUtils.js +2 -2
  66. package/dist/schema-driven/utils/PayloadUtils.js.map +1 -1
  67. package/dist/schema-driven/utils/fileUploadService.js +443 -0
  68. package/dist/schema-driven/utils/fileUploadService.js.map +1 -0
  69. package/dist/types/src/ComponentRegistry.d.ts.map +1 -1
  70. package/dist/types/src/ILMarketplaceWrapper.d.ts +1 -1
  71. package/dist/types/src/ILMarketplaceWrapper.d.ts.map +1 -1
  72. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMePlugin.d.ts.map +1 -1
  73. package/dist/types/src/features/IL-OTJ/ValueTypeWrappers/TeachMeWrapper.d.ts.map +1 -1
  74. package/dist/types/src/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts +3 -3
  75. package/dist/types/src/features/IL-OTJ/_components/hooks/useVariantEditSession.d.ts.map +1 -1
  76. package/dist/types/src/features/IL-marketplace/components/GuidelineLibraryCard.d.ts.map +1 -1
  77. package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts +3 -1
  78. package/dist/types/src/features/IL-marketplace/components/LearningManagementWrapper.d.ts.map +1 -1
  79. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts +2 -0
  80. package/dist/types/src/features/LearningManagement/components/InstantLearningModalDynamic.d.ts.map +1 -1
  81. package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts +2 -0
  82. package/dist/types/src/features/LearningManagement/store/useEnvStore.d.ts.map +1 -1
  83. package/dist/types/src/plugins/ValueTypes/Default/DefaultTeachMeRenderer.d.ts.map +1 -1
  84. package/dist/types/src/schema-driven/BPARenderer.d.ts.map +1 -1
  85. package/dist/types/src/schema-driven/components/FileUploadField.d.ts +81 -0
  86. package/dist/types/src/schema-driven/components/FileUploadField.d.ts.map +1 -0
  87. package/dist/types/src/schema-driven/components/VariantListField.d.ts.map +1 -1
  88. package/dist/types/src/schema-driven/demoSchema.d.ts.map +1 -1
  89. package/dist/types/src/schema-driven/types.d.ts +5 -0
  90. package/dist/types/src/schema-driven/types.d.ts.map +1 -1
  91. package/dist/types/src/schema-driven/utils/PayloadUtils.d.ts.map +1 -1
  92. package/dist/types/src/schema-driven/utils/fileUploadService.d.ts +196 -0
  93. package/dist/types/src/schema-driven/utils/fileUploadService.d.ts.map +1 -0
  94. package/package.json +4 -4
@@ -0,0 +1,815 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var jsxRuntime = require('react/jsx-runtime');
6
+ var React = require('react');
7
+ var lucideReact = require('lucide-react');
8
+ var SectionWrapper = require('../../features/IL-OTJ/_components/molecules/Sections/SectionWrapper.js');
9
+ var InputDataReasoningCard = require('../../features/IL-OTJ/_components/InputDataReasoningCard.js');
10
+ var ButtonCognitiveIcon = require('../../features/IL-OTJ/_components/_svg/ButtonCognitiveIcon.js');
11
+ var useDynamicFormStore = require('../store/useDynamicFormStore.js');
12
+ var useEnvStore = require('../../features/LearningManagement/store/useEnvStore.js');
13
+ var useConfigStore = require('../../features/LearningManagement/store/useConfigStore.js');
14
+ var useLearningTemplateStore = require('../../features/LearningManagement/store/useLearningTemplateStore.js');
15
+ var useAuthStore = require('../../features/LearningManagement/store/useAuthStore.js');
16
+ var fileUploadService = require('../utils/fileUploadService.js');
17
+ var guideline_runtime_config = require('../../features/IL-marketplace/services/guideline.runtime.config.js');
18
+ var FileUploadField_module = require('./FileUploadField.module.css.js');
19
+
20
+ function FileUploadField(props) {
21
+ var _a, _b, _c, _d, _e, _f, _g;
22
+ const {
23
+ id,
24
+ schema,
25
+ title = (schema == null ? void 0 : schema.title) || "Supporting documents",
26
+ subtitle = (schema == null ? void 0 : schema.subtitle) || "Upload any supporting documents, such as user journey files, technical or integration documentation, or PDFs",
27
+ value,
28
+ onChange,
29
+ readOnly = false,
30
+ required = (schema == null ? void 0 : schema.is_required) || false,
31
+ citation,
32
+ isMirage,
33
+ tierKey,
34
+ variantIndex,
35
+ state,
36
+ uiState,
37
+ enableInlineEdit = false,
38
+ hideEditControls,
39
+ parentEditing,
40
+ activeEditId,
41
+ setActiveEditId,
42
+ isAiStreaming: propAiStreaming,
43
+ accept: propAccept,
44
+ uploadType: propUploadType,
45
+ maxUploads: propMaxUploads,
46
+ maxSize: propMaxSize,
47
+ bordered: propBordered,
48
+ collapsible: propCollapsible,
49
+ defaultOpen: propDefaultOpen,
50
+ openSections: propOpenSections,
51
+ setOpenSections: propSetOpenSections
52
+ } = props;
53
+ const isBordered = propBordered !== void 0 ? !!propBordered : (schema == null ? void 0 : schema.bordered) !== void 0 ? !!schema.bordered : true;
54
+ const isCollapsible = propCollapsible !== void 0 ? !!propCollapsible : (schema == null ? void 0 : schema.collapsible) !== void 0 ? !!schema.collapsible : true;
55
+ const resolvedDefaultOpen = propDefaultOpen !== void 0 ? !!propDefaultOpen : (schema == null ? void 0 : schema.default_open) !== void 0 ? !!schema.default_open : (schema == null ? void 0 : schema.defaultOpen) !== void 0 ? !!schema.defaultOpen : true;
56
+ const rawUploadType = (propUploadType || (schema == null ? void 0 : schema.upload_type) || "multiple").toString().trim().toLowerCase();
57
+ const isSingleUpload = rawUploadType === "single";
58
+ const rawMaxUploads = propMaxUploads != null ? propMaxUploads : schema == null ? void 0 : schema.max_uploads;
59
+ const effectiveMaxUploads = React.useMemo(() => {
60
+ if (isSingleUpload) return 1;
61
+ if (rawMaxUploads !== void 0 && rawMaxUploads !== null && rawMaxUploads !== "") {
62
+ const parsed = Number(rawMaxUploads);
63
+ if (!isNaN(parsed) && parsed > 0) return parsed;
64
+ }
65
+ return Infinity;
66
+ }, [isSingleUpload, rawMaxUploads]);
67
+ const rawMaxSize = propMaxSize != null ? propMaxSize : schema == null ? void 0 : schema.max_size;
68
+ const effectiveMaxFileSizeBytes = React.useMemo(
69
+ () => fileUploadService.parseMaxFileSizeBytes(rawMaxSize),
70
+ [rawMaxSize]
71
+ );
72
+ const maxFileSizeLabel = effectiveMaxFileSizeBytes ? fileUploadService.formatFileSize(effectiveMaxFileSizeBytes) : null;
73
+ const rawAccept = propAccept || props.acceptedFormats || props.acceptedFileTypes || props.allowedExtensions || (schema == null ? void 0 : schema.accept) || (schema == null ? void 0 : schema.accepted_formats) || (schema == null ? void 0 : schema.accepted_file_types) || (schema == null ? void 0 : schema.allowed_extensions);
74
+ const normalizedAccept = React.useMemo(() => fileUploadService.normalizeAcceptString(rawAccept), [rawAccept]);
75
+ const acceptedFormatsLabel = React.useMemo(
76
+ () => normalizedAccept == null ? void 0 : normalizedAccept.split(",").map((format) => format.trim()).join(", "),
77
+ [normalizedAccept]
78
+ );
79
+ const [isReasoningOpen, setIsReasoningOpen] = React.useState(false);
80
+ const [isDragging, setIsDragging] = React.useState(false);
81
+ const [isUploading, setIsUploading] = React.useState(false);
82
+ const [duplicateWarning, setDuplicateWarning] = React.useState(null);
83
+ const [formatWarning, setFormatWarning] = React.useState(null);
84
+ const [sizeWarning, setSizeWarning] = React.useState(null);
85
+ const [limitWarning, setLimitWarning] = React.useState(null);
86
+ const fileInputRef = React.useRef(null);
87
+ const { getGlobalField, getVariantField, clearAllMirages, getGlobalMirage, getVariantMirage } = useDynamicFormStore.useDynamicFormStore();
88
+ const dataKey = (schema == null ? void 0 : schema.data_key) || id;
89
+ const cleanKey = dataKey.replace("global.", "");
90
+ const isGlobal = dataKey.startsWith("global.") || variantIndex === void 0;
91
+ React.useEffect(() => {
92
+ if (!isMirage) return;
93
+ const currentMirage = isGlobal ? getGlobalMirage(cleanKey) : getVariantMirage(tierKey != null ? tierKey : "", variantIndex != null ? variantIndex : 0, cleanKey);
94
+ const currentStoreValue = isGlobal ? getGlobalField(cleanKey) : getVariantField(tierKey != null ? tierKey : "", variantIndex != null ? variantIndex : 0, cleanKey);
95
+ if (currentStoreValue !== void 0 && currentStoreValue !== currentMirage && currentStoreValue !== "") {
96
+ clearAllMirages();
97
+ }
98
+ }, [value, isMirage, isGlobal, cleanKey, tierKey, variantIndex, getGlobalMirage, getVariantMirage, getGlobalField, getVariantField, clearAllMirages]);
99
+ const envProjectId = useEnvStore["default"]((s) => s.projectId);
100
+ const configProjectId = useConfigStore.useConfigStore(
101
+ (s) => {
102
+ var _a2, _b2;
103
+ return ((_a2 = s.configuration) == null ? void 0 : _a2.PROJECT_ID) || ((_b2 = s.configuration) == null ? void 0 : _b2.projectId);
104
+ }
105
+ );
106
+ const resolvedProjectId = props.projectId || (schema == null ? void 0 : schema.project_id) || envProjectId || configProjectId || (uiState == null ? void 0 : uiState.projectId) || (state == null ? void 0 : state.projectId) || (typeof window !== "undefined" ? window.__PROJECT_ID__ : void 0) || (typeof process !== "undefined" ? (_a = process.env) == null ? void 0 : _a.REACT_APP_PROJECT_ID : void 0) || null;
107
+ const runtimeConfig = guideline_runtime_config.getOptionalGuidelineRuntimeConfig();
108
+ const templateToken = useLearningTemplateStore.useLearningTemplateStore((s) => s.token);
109
+ const authUser = useAuthStore["default"]((s) => s.user);
110
+ const runtimeToken = (_c = (_b = runtimeConfig == null ? void 0 : runtimeConfig.getHostContext) == null ? void 0 : _b.call(runtimeConfig)) == null ? void 0 : _c.authToken;
111
+ const resolvedToken = templateToken || (authUser == null ? void 0 : authUser.accessToken) || runtimeToken || "";
112
+ const resolvedUserName = props.artifactUserName || ((authUser == null ? void 0 : authUser.firstname) ? `${authUser.firstname} ${authUser.lastname || ""}`.trim() : null) || (authUser == null ? void 0 : authUser.email) || ((_e = (_d = runtimeConfig == null ? void 0 : runtimeConfig.getHostContext) == null ? void 0 : _d.call(runtimeConfig)) == null ? void 0 : _e.userName) || null;
113
+ const resolvedUserEmail = props.artifactUserEmail || (authUser == null ? void 0 : authUser.email) || ((_g = (_f = runtimeConfig == null ? void 0 : runtimeConfig.getHostContext) == null ? void 0 : _f.call(runtimeConfig)) == null ? void 0 : _g.userEmail) || null;
114
+ const filesList = React.useMemo(() => {
115
+ if (!value) return [];
116
+ if (Array.isArray(value)) {
117
+ return value.map((item, index) => {
118
+ var _a2;
119
+ if (typeof item === "string") {
120
+ return {
121
+ id: `file-${index}-${item}`,
122
+ name: item.split("/").pop() || item,
123
+ filename: item.split("/").pop() || item,
124
+ url: item,
125
+ signedUrl: item.startsWith("http") ? item : void 0,
126
+ status: "success"
127
+ };
128
+ }
129
+ return {
130
+ id: item.id || `file-${index}`,
131
+ name: item.name || item.filename || "Uploaded Document",
132
+ filename: item.filename || item.name,
133
+ url: item.url,
134
+ signedUrl: item.signedUrl || item.signed_url || (((_a2 = item.url) == null ? void 0 : _a2.startsWith("http")) ? item.url : void 0),
135
+ previewUrl: item.previewUrl,
136
+ size: item.size,
137
+ type: item.type,
138
+ status: item.status || "success",
139
+ progress: item.progress,
140
+ error: item.error
141
+ };
142
+ });
143
+ }
144
+ if (typeof value === "string") {
145
+ try {
146
+ const parsed = JSON.parse(value);
147
+ if (Array.isArray(parsed)) {
148
+ return parsed.map((item, index) => {
149
+ var _a2;
150
+ if (typeof item === "string") {
151
+ return {
152
+ id: `file-${index}-${item}`,
153
+ name: item.split("/").pop() || item,
154
+ filename: item.split("/").pop() || item,
155
+ url: item,
156
+ signedUrl: item.startsWith("http") ? item : void 0,
157
+ status: "success"
158
+ };
159
+ }
160
+ return {
161
+ id: item.id || `file-${index}`,
162
+ name: item.name || item.filename || "Uploaded Document",
163
+ filename: item.filename || item.name,
164
+ url: item.url,
165
+ signedUrl: item.signedUrl || item.signed_url || (((_a2 = item.url) == null ? void 0 : _a2.startsWith("http")) ? item.url : void 0),
166
+ previewUrl: item.previewUrl,
167
+ size: item.size,
168
+ type: item.type,
169
+ status: item.status || "success",
170
+ progress: item.progress,
171
+ error: item.error
172
+ };
173
+ });
174
+ }
175
+ } catch (e) {
176
+ return [
177
+ {
178
+ id: "file-0",
179
+ name: value.split("/").pop() || value,
180
+ filename: value.split("/").pop() || value,
181
+ url: value,
182
+ signedUrl: value.startsWith("http") ? value : void 0,
183
+ status: "success"
184
+ }
185
+ ];
186
+ }
187
+ }
188
+ return [];
189
+ }, [value]);
190
+ const [signedUrlMap, setSignedUrlMap] = React.useState({});
191
+ React.useEffect(() => {
192
+ const filesNeedingSignedUrl = filesList.filter((f) => {
193
+ const path = f.url;
194
+ if (!path) return false;
195
+ if (f.signedUrl) return false;
196
+ if (signedUrlMap[path]) return false;
197
+ return true;
198
+ });
199
+ if (filesNeedingSignedUrl.length === 0) return;
200
+ let isMounted = true;
201
+ void Promise.all(
202
+ filesNeedingSignedUrl.map(async (file) => {
203
+ const path = file.url;
204
+ try {
205
+ const fetchedUrl = await fileUploadService.getGCSSignedUrl(path, {
206
+ token: resolvedToken
207
+ });
208
+ return { path, url: fetchedUrl };
209
+ } catch (e) {
210
+ return { path, url: null };
211
+ }
212
+ })
213
+ ).then((results) => {
214
+ if (!isMounted) return;
215
+ setSignedUrlMap((prev) => {
216
+ const next = { ...prev };
217
+ let hasNew = false;
218
+ results.forEach(({ path, url }) => {
219
+ if (url && next[path] !== url) {
220
+ next[path] = url;
221
+ hasNew = true;
222
+ }
223
+ });
224
+ return hasNew ? next : prev;
225
+ });
226
+ });
227
+ return () => {
228
+ isMounted = false;
229
+ };
230
+ }, [filesList, resolvedToken, signedUrlMap]);
231
+ const isStreaming = propAiStreaming || (uiState == null ? void 0 : uiState.isAiStreaming) || false;
232
+ const isParentControlled = hideEditControls !== void 0 ? !!hideEditControls : false;
233
+ const isEditing = !readOnly && !isStreaming && (isParentControlled ? !!parentEditing : enableInlineEdit ? activeEditId === id : true);
234
+ const isEditingRef = React.useRef(isEditing);
235
+ React.useEffect(() => {
236
+ isEditingRef.current = isEditing;
237
+ }, [isEditing]);
238
+ const isUploadLimitReached = filesList.length >= effectiveMaxUploads;
239
+ const canUploadMore = isEditing && !isUploadLimitReached;
240
+ const helperTextContent = React.useMemo(() => {
241
+ const parts = [];
242
+ if (acceptedFormatsLabel) {
243
+ parts.push(acceptedFormatsLabel);
244
+ } else {
245
+ parts.push("All file formats accepted");
246
+ }
247
+ if (isFinite(effectiveMaxUploads)) {
248
+ parts.push(`Up to ${effectiveMaxUploads} ${effectiveMaxUploads === 1 ? "file" : "files"}`);
249
+ }
250
+ if (maxFileSizeLabel) {
251
+ parts.push(`Maximum file size: ${maxFileSizeLabel} per file`);
252
+ } else {
253
+ parts.push("No file size limit");
254
+ }
255
+ return parts.join(" \u2022 ");
256
+ }, [effectiveMaxUploads, acceptedFormatsLabel, maxFileSizeLabel]);
257
+ const handleUploadFiles = React.useCallback(
258
+ async (rawFiles) => {
259
+ if (!isEditing || !onChange) return;
260
+ const fileArray = Array.from(rawFiles);
261
+ if (fileArray.length === 0) return;
262
+ setDuplicateWarning(null);
263
+ setFormatWarning(null);
264
+ setSizeWarning(null);
265
+ setLimitWarning(null);
266
+ const remainingSlots = isFinite(effectiveMaxUploads) ? Math.max(0, effectiveMaxUploads - filesList.length) : Infinity;
267
+ if (remainingSlots <= 0) {
268
+ setLimitWarning(
269
+ isSingleUpload ? "Only 1 file can be uploaded. Delete the current file to upload a new one." : `Maximum upload limit of ${effectiveMaxUploads} ${effectiveMaxUploads === 1 ? "file" : "files"} reached.`
270
+ );
271
+ if (fileInputRef.current) {
272
+ fileInputRef.current.value = "";
273
+ }
274
+ return;
275
+ }
276
+ let filesToProcess = fileArray;
277
+ if (isSingleUpload && fileArray.length > 1) {
278
+ setLimitWarning("Single upload mode: only the first file was selected.");
279
+ filesToProcess = [fileArray[0]];
280
+ } else if (fileArray.length > remainingSlots) {
281
+ setLimitWarning(
282
+ `Maximum ${effectiveMaxUploads} files allowed. Only the first ${remainingSlots} ${remainingSlots === 1 ? "file was" : "files were"} accepted.`
283
+ );
284
+ filesToProcess = fileArray.slice(0, remainingSlots);
285
+ }
286
+ const validFiles = [];
287
+ const invalidFiles = [];
288
+ const oversizedFiles = [];
289
+ for (const file of filesToProcess) {
290
+ if (!fileUploadService.isFileAccepted(file, normalizedAccept)) {
291
+ invalidFiles.push(file);
292
+ } else if (effectiveMaxFileSizeBytes !== null && file.size > effectiveMaxFileSizeBytes) {
293
+ oversizedFiles.push(file);
294
+ } else {
295
+ validFiles.push(file);
296
+ }
297
+ }
298
+ if (invalidFiles.length > 0) {
299
+ const invalidNames = invalidFiles.map((f) => f.name).join(", ");
300
+ const message = invalidFiles.length === 1 ? `File "${invalidNames}" is not an accepted format. Accepted formats: ${normalizedAccept}` : `Files "${invalidNames}" are not accepted formats. Accepted formats: ${normalizedAccept}`;
301
+ setFormatWarning(message);
302
+ }
303
+ if (oversizedFiles.length > 0 && maxFileSizeLabel) {
304
+ const oversizedNames = oversizedFiles.map((file) => file.name).join(", ");
305
+ const message = oversizedFiles.length === 1 ? `File "${oversizedNames}" exceeds the ${maxFileSizeLabel} per-file size limit.` : `Files "${oversizedNames}" exceed the ${maxFileSizeLabel} per-file size limit.`;
306
+ setSizeWarning(message);
307
+ }
308
+ if (validFiles.length === 0) {
309
+ if (fileInputRef.current) {
310
+ fileInputRef.current.value = "";
311
+ }
312
+ return;
313
+ }
314
+ setIsUploading(true);
315
+ const optimisticItems = validFiles.map((file, i) => {
316
+ const isImg = fileUploadService.isImageFile(file.name, file.type);
317
+ let previewBlobUrl = void 0;
318
+ try {
319
+ if (isImg && typeof URL !== "undefined" && typeof URL.createObjectURL === "function") {
320
+ previewBlobUrl = URL.createObjectURL(file);
321
+ }
322
+ } catch (e) {
323
+ }
324
+ return {
325
+ id: `upload-${Date.now()}-${i}-${file.name}`,
326
+ name: file.name,
327
+ filename: file.name,
328
+ size: file.size,
329
+ type: file.type,
330
+ status: "uploading",
331
+ progress: 0,
332
+ previewUrl: previewBlobUrl
333
+ };
334
+ });
335
+ let currentList = [...filesList, ...optimisticItems];
336
+ onChange(currentList);
337
+ try {
338
+ const result = await fileUploadService.uploadFilesBatch({
339
+ projectId: resolvedProjectId || "",
340
+ files: validFiles,
341
+ token: resolvedToken,
342
+ artifactUserName: resolvedUserName,
343
+ artifactUserEmail: resolvedUserEmail,
344
+ onProgress: (_totalPct, fileProgressMap) => {
345
+ if (!isEditingRef.current || !fileProgressMap) return;
346
+ currentList = currentList.map((item) => {
347
+ if (item.status === "uploading" && fileProgressMap[item.name || item.filename || ""] !== void 0) {
348
+ const fileBytes = item.size || 1;
349
+ const loaded = fileProgressMap[item.name || item.filename || ""];
350
+ const pct = Math.min(99, Math.round(loaded / fileBytes * 100));
351
+ return { ...item, progress: pct };
352
+ }
353
+ return item;
354
+ });
355
+ onChange(currentList);
356
+ }
357
+ });
358
+ if (!isEditingRef.current) return;
359
+ if (result.duplicates.length > 0) {
360
+ const dupNames = result.duplicates.join(", ");
361
+ const message = result.duplicates.length === 1 ? `File "${dupNames}" already exists.` : `Files "${dupNames}" already exist.`;
362
+ setDuplicateWarning(message);
363
+ }
364
+ const updatedList = [];
365
+ for (const item of currentList) {
366
+ const optimisticMatch = optimisticItems.find((opt) => opt.id === item.id);
367
+ if (!optimisticMatch) {
368
+ updatedList.push(item);
369
+ continue;
370
+ }
371
+ const fileName = item.name || item.filename || "";
372
+ if (result.duplicates.includes(fileName)) {
373
+ continue;
374
+ }
375
+ const uploadedSuccess = result.uploaded.find(
376
+ (u) => u.name === fileName || u.filename === fileName
377
+ );
378
+ if (uploadedSuccess) {
379
+ if (uploadedSuccess.url && uploadedSuccess.signedUrl) {
380
+ setSignedUrlMap((prev) => ({
381
+ ...prev,
382
+ [uploadedSuccess.url]: uploadedSuccess.signedUrl
383
+ }));
384
+ }
385
+ updatedList.push({
386
+ ...uploadedSuccess,
387
+ id: item.id,
388
+ previewUrl: uploadedSuccess.previewUrl || item.previewUrl
389
+ });
390
+ continue;
391
+ }
392
+ const fileSpecificError = result.errors.find((err) => err.includes(fileName));
393
+ const generalError = result.errors.length > 0 ? result.errors[0] : null;
394
+ updatedList.push({
395
+ ...item,
396
+ status: "error",
397
+ error: fileSpecificError || generalError || "Failed to upload"
398
+ });
399
+ }
400
+ if (!isEditingRef.current) return;
401
+ onChange(updatedList);
402
+ } catch (err) {
403
+ if (!isEditingRef.current) return;
404
+ console.error("[FileUploadField] Upload process error:", err);
405
+ const errorList = currentList.map((item) => {
406
+ const optimisticMatch = optimisticItems.find((opt) => opt.id === item.id);
407
+ if (optimisticMatch) {
408
+ return {
409
+ ...item,
410
+ status: "error",
411
+ error: (err == null ? void 0 : err.message) || "Upload failed"
412
+ };
413
+ }
414
+ return item;
415
+ });
416
+ onChange(errorList);
417
+ } finally {
418
+ setIsUploading(false);
419
+ if (fileInputRef.current) {
420
+ fileInputRef.current.value = "";
421
+ }
422
+ }
423
+ },
424
+ [
425
+ isEditing,
426
+ onChange,
427
+ filesList,
428
+ resolvedProjectId,
429
+ resolvedToken,
430
+ resolvedUserName,
431
+ resolvedUserEmail,
432
+ normalizedAccept,
433
+ effectiveMaxUploads,
434
+ effectiveMaxFileSizeBytes,
435
+ maxFileSizeLabel,
436
+ isSingleUpload
437
+ ]
438
+ );
439
+ const handleDragOver = (e) => {
440
+ e.preventDefault();
441
+ e.stopPropagation();
442
+ if (isEditing && !isDragging) {
443
+ setIsDragging(true);
444
+ }
445
+ };
446
+ const handleDragLeave = (e) => {
447
+ e.preventDefault();
448
+ e.stopPropagation();
449
+ if (isDragging) {
450
+ setIsDragging(false);
451
+ }
452
+ };
453
+ const handleDrop = (e) => {
454
+ var _a2;
455
+ e.preventDefault();
456
+ e.stopPropagation();
457
+ setIsDragging(false);
458
+ if (!isEditing) return;
459
+ if (((_a2 = e.dataTransfer) == null ? void 0 : _a2.files) && e.dataTransfer.files.length > 0) {
460
+ void handleUploadFiles(e.dataTransfer.files);
461
+ }
462
+ };
463
+ const handleNativeFileChange = (e) => {
464
+ if (!isEditing) return;
465
+ if (e.target.files && e.target.files.length > 0) {
466
+ void handleUploadFiles(e.target.files);
467
+ }
468
+ };
469
+ const handleBrowseClick = (e) => {
470
+ var _a2;
471
+ e.stopPropagation();
472
+ if (!isEditing) return;
473
+ (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
474
+ };
475
+ const handleDropzoneClick = () => {
476
+ var _a2;
477
+ if (!isEditing) return;
478
+ (_a2 = fileInputRef.current) == null ? void 0 : _a2.click();
479
+ };
480
+ const handleRemoveFile = (targetId, e) => {
481
+ e.stopPropagation();
482
+ if (!isEditing || !onChange) return;
483
+ setDuplicateWarning(null);
484
+ setFormatWarning(null);
485
+ setSizeWarning(null);
486
+ setLimitWarning(null);
487
+ if (fileInputRef.current) {
488
+ fileInputRef.current.value = "";
489
+ }
490
+ const nextList = filesList.filter((item) => item.id !== targetId);
491
+ onChange(nextList);
492
+ };
493
+ const inlineSnapshotRef = React.useRef(null);
494
+ const handleInlineStart = () => {
495
+ setDuplicateWarning(null);
496
+ setFormatWarning(null);
497
+ setSizeWarning(null);
498
+ setLimitWarning(null);
499
+ inlineSnapshotRef.current = JSON.parse(JSON.stringify(filesList));
500
+ setActiveEditId == null ? void 0 : setActiveEditId(id);
501
+ };
502
+ const handleInlineCancel = () => {
503
+ if (inlineSnapshotRef.current !== null && onChange) {
504
+ onChange(inlineSnapshotRef.current);
505
+ }
506
+ inlineSnapshotRef.current = null;
507
+ setDuplicateWarning(null);
508
+ setFormatWarning(null);
509
+ setSizeWarning(null);
510
+ setLimitWarning(null);
511
+ setActiveEditId == null ? void 0 : setActiveEditId(null);
512
+ };
513
+ const handleInlineDone = () => {
514
+ inlineSnapshotRef.current = null;
515
+ setActiveEditId == null ? void 0 : setActiveEditId(null);
516
+ };
517
+ const inlineEditActions = enableInlineEdit && !isParentControlled && !readOnly ? isEditing ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "6px" }, children: [
518
+ /* @__PURE__ */ jsxRuntime.jsxs(
519
+ "button",
520
+ {
521
+ type: "button",
522
+ title: "Apply changes",
523
+ onClick: handleInlineDone,
524
+ style: {
525
+ display: "flex",
526
+ alignItems: "center",
527
+ gap: "4px",
528
+ padding: "4px 8px",
529
+ borderRadius: "6px",
530
+ border: "1px solid var(--il-primary, #2563EB)",
531
+ backgroundColor: "var(--il-primary, #2563EB)",
532
+ color: "#ffffff",
533
+ fontSize: "12px",
534
+ fontWeight: 500,
535
+ cursor: "pointer"
536
+ },
537
+ children: [
538
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Check, { size: 14 }),
539
+ " Done"
540
+ ]
541
+ }
542
+ ),
543
+ /* @__PURE__ */ jsxRuntime.jsxs(
544
+ "button",
545
+ {
546
+ type: "button",
547
+ title: "Cancel changes",
548
+ onClick: handleInlineCancel,
549
+ style: {
550
+ display: "flex",
551
+ alignItems: "center",
552
+ gap: "4px",
553
+ padding: "4px 8px",
554
+ borderRadius: "6px",
555
+ border: "1px solid var(--il-border, #CBD5E1)",
556
+ backgroundColor: "var(--il-surface, #ffffff)",
557
+ color: "var(--il-muted, #64748B)",
558
+ fontSize: "12px",
559
+ fontWeight: 500,
560
+ cursor: "pointer"
561
+ },
562
+ children: [
563
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 }),
564
+ " Cancel"
565
+ ]
566
+ }
567
+ )
568
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(
569
+ "button",
570
+ {
571
+ type: "button",
572
+ title: "Edit",
573
+ onClick: handleInlineStart,
574
+ disabled: isStreaming,
575
+ style: {
576
+ display: "flex",
577
+ alignItems: "center",
578
+ gap: "4px",
579
+ padding: "4px 8px",
580
+ borderRadius: "6px",
581
+ border: "1px solid var(--il-border, #CBD5E1)",
582
+ backgroundColor: "var(--il-surface, #ffffff)",
583
+ color: "var(--il-muted, #64748B)",
584
+ fontSize: "12px",
585
+ fontWeight: 500,
586
+ cursor: isStreaming ? "not-allowed" : "pointer",
587
+ opacity: isStreaming ? 0.5 : 1
588
+ },
589
+ children: [
590
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Pencil, { size: 14 }),
591
+ " Edit"
592
+ ]
593
+ }
594
+ ) : null;
595
+ const headerActions = citation || inlineEditActions ? /* @__PURE__ */ jsxRuntime.jsxs("div", { style: { display: "flex", alignItems: "center", gap: "8px" }, children: [
596
+ inlineEditActions,
597
+ citation && /* @__PURE__ */ jsxRuntime.jsx(
598
+ "button",
599
+ {
600
+ type: "button",
601
+ onClick: () => setIsReasoningOpen((prev) => !prev),
602
+ style: {
603
+ background: "none",
604
+ border: "none",
605
+ padding: "4px",
606
+ cursor: "pointer",
607
+ display: "flex",
608
+ alignItems: "center",
609
+ justifyContent: "center"
610
+ },
611
+ title: "Why this value?",
612
+ "aria-label": "Toggle cognitive reasoning",
613
+ children: /* @__PURE__ */ jsxRuntime.jsx(ButtonCognitiveIcon.ButtonCognitiveIcon, {})
614
+ }
615
+ )
616
+ ] }) : null;
617
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
618
+ /* @__PURE__ */ jsxRuntime.jsx(
619
+ SectionWrapper.SectionWrapper,
620
+ {
621
+ id,
622
+ required,
623
+ title,
624
+ subtitle,
625
+ collapsible: isCollapsible,
626
+ defaultOpen: resolvedDefaultOpen,
627
+ bordered: isBordered,
628
+ openSections: propOpenSections,
629
+ setOpenSections: propSetOpenSections,
630
+ readOnly: !isEditing,
631
+ headerActions,
632
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].container, children: [
633
+ /* @__PURE__ */ jsxRuntime.jsx(
634
+ "input",
635
+ {
636
+ ref: fileInputRef,
637
+ type: "file",
638
+ multiple: !isSingleUpload && effectiveMaxUploads > 1,
639
+ disabled: !canUploadMore,
640
+ accept: normalizedAccept,
641
+ style: { display: "none" },
642
+ onChange: handleNativeFileChange
643
+ }
644
+ ),
645
+ (duplicateWarning || formatWarning || sizeWarning || limitWarning) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].warningBanner, role: "alert", children: [
646
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].warningContent, children: [
647
+ /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { size: 16, color: "#D97706", style: { flexShrink: 0 } }),
648
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].warningText, children: [duplicateWarning, formatWarning, sizeWarning, limitWarning].filter(Boolean).join(" ") })
649
+ ] }),
650
+ /* @__PURE__ */ jsxRuntime.jsx(
651
+ "button",
652
+ {
653
+ type: "button",
654
+ onClick: () => {
655
+ setDuplicateWarning(null);
656
+ setFormatWarning(null);
657
+ setSizeWarning(null);
658
+ setLimitWarning(null);
659
+ },
660
+ className: FileUploadField_module["default"].warningCloseBtn,
661
+ title: "Dismiss notification",
662
+ "aria-label": "Dismiss notification",
663
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 14 })
664
+ }
665
+ )
666
+ ] }),
667
+ canUploadMore ? /* @__PURE__ */ jsxRuntime.jsxs(
668
+ "div",
669
+ {
670
+ className: `${FileUploadField_module["default"].dropzone} ${isDragging ? FileUploadField_module["default"].dropzoneActive : ""}`,
671
+ onClick: handleDropzoneClick,
672
+ onDragOver: handleDragOver,
673
+ onDragEnter: handleDragOver,
674
+ onDragLeave: handleDragLeave,
675
+ onDrop: handleDrop,
676
+ role: "button",
677
+ tabIndex: 0,
678
+ "aria-label": "Upload files dropzone",
679
+ children: [
680
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].uploadIconWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { size: 24, strokeWidth: 2 }) }),
681
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: FileUploadField_module["default"].promptText, children: isSingleUpload ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
682
+ "Drag and drop a file here, or",
683
+ " ",
684
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].browseLink, onClick: handleBrowseClick, children: "browse" })
685
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
686
+ "Drag and drop files here, or",
687
+ " ",
688
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].browseLink, onClick: handleBrowseClick, children: "browse" })
689
+ ] }) }),
690
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: FileUploadField_module["default"].helperText, children: helperTextContent })
691
+ ]
692
+ }
693
+ ) : filesList.length === 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
694
+ "div",
695
+ {
696
+ className: `${FileUploadField_module["default"].dropzone} ${FileUploadField_module["default"].dropzoneDisabled}`,
697
+ role: "region",
698
+ "aria-label": "Upload files disabled",
699
+ children: [
700
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].uploadIconWrapper, style: { color: "var(--il-muted, #94a3b8)" }, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Upload, { size: 24, strokeWidth: 2 }) }),
701
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: FileUploadField_module["default"].promptText, style: { color: "var(--il-muted, #64748B)" }, children: "No documents uploaded" }),
702
+ /* @__PURE__ */ jsxRuntime.jsxs("p", { className: FileUploadField_module["default"].helperText, children: [
703
+ helperTextContent,
704
+ " \u2022 Edit this section to upload documents"
705
+ ] })
706
+ ]
707
+ }
708
+ ) : null,
709
+ filesList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileList, children: filesList.map((file) => {
710
+ var _a2, _b2;
711
+ const extension = fileUploadService.getFileExtension(file.name || file.filename);
712
+ const isItemUploading = file.status === "uploading";
713
+ const hasError = file.status === "error";
714
+ const isImg = fileUploadService.isImageFile(file.name || file.filename, file.type);
715
+ const fileGcsUrl = file.url || "";
716
+ const effectiveSignedUrl = file.signedUrl || (fileGcsUrl ? signedUrlMap[fileGcsUrl] : void 0);
717
+ const effectiveLink = effectiveSignedUrl || (fileGcsUrl.startsWith("http") ? fileGcsUrl : void 0);
718
+ const effectiveImageSrc = effectiveSignedUrl || file.previewUrl || (fileGcsUrl.startsWith("http") ? fileGcsUrl : void 0);
719
+ return /* @__PURE__ */ jsxRuntime.jsxs(
720
+ "div",
721
+ {
722
+ className: `${FileUploadField_module["default"].fileCard} ${hasError ? FileUploadField_module["default"].fileCardError : ""}`,
723
+ children: [
724
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].fileInfoLeft, children: [
725
+ hasError ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileIcon, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.AlertCircle, { size: 22, color: "#EF4444" }) }) : isImg ? effectiveImageSrc ? /* @__PURE__ */ jsxRuntime.jsx(
726
+ "a",
727
+ {
728
+ href: effectiveLink || effectiveImageSrc,
729
+ target: "_blank",
730
+ rel: "noopener noreferrer",
731
+ className: FileUploadField_module["default"].imagePreviewSquare,
732
+ onClick: (e) => {
733
+ if (!effectiveLink && !effectiveImageSrc) {
734
+ e.preventDefault();
735
+ }
736
+ e.stopPropagation();
737
+ },
738
+ title: `Preview ${file.name}`,
739
+ children: /* @__PURE__ */ jsxRuntime.jsx(
740
+ "img",
741
+ {
742
+ src: effectiveImageSrc,
743
+ alt: file.name,
744
+ className: FileUploadField_module["default"].imageThumbnail
745
+ }
746
+ )
747
+ }
748
+ ) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].imagePreviewSquare, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { size: 26, strokeWidth: 1.8, color: "#7C3AED" }) }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileIcon, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.FileText, { size: 22, strokeWidth: 1.8 }) }),
749
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].fileMeta, children: [
750
+ effectiveLink && !hasError && !isItemUploading ? /* @__PURE__ */ jsxRuntime.jsx(
751
+ "a",
752
+ {
753
+ href: effectiveLink,
754
+ target: "_blank",
755
+ rel: "noopener noreferrer",
756
+ className: FileUploadField_module["default"].fileName,
757
+ title: file.name,
758
+ onClick: (e) => e.stopPropagation(),
759
+ children: file.name
760
+ }
761
+ ) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].fileName, title: file.name, children: file.name }),
762
+ hasError ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: FileUploadField_module["default"].fileErrorText, children: file.error || "Failed to upload" }) : isItemUploading ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: FileUploadField_module["default"].progressContainer, children: [
763
+ /* @__PURE__ */ jsxRuntime.jsxs("span", { className: FileUploadField_module["default"].progressLabel, children: [
764
+ "Uploading... ",
765
+ (_a2 = file.progress) != null ? _a2 : 0,
766
+ "%"
767
+ ] }),
768
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].progressBarWrapper, children: /* @__PURE__ */ jsxRuntime.jsx(
769
+ "div",
770
+ {
771
+ className: FileUploadField_module["default"].progressBarFill,
772
+ style: { width: `${Math.max((_b2 = file.progress) != null ? _b2 : 15, 10)}%` }
773
+ }
774
+ ) })
775
+ ] }) : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: FileUploadField_module["default"].fileType, children: [
776
+ extension,
777
+ file.size ? ` \u2022 ${fileUploadService.formatFileSize(file.size)}` : ""
778
+ ] })
779
+ ] })
780
+ ] }),
781
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: FileUploadField_module["default"].fileActionsRight, children: isItemUploading ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { size: 18, className: FileUploadField_module["default"].loadingSpinner }) : isEditing ? /* @__PURE__ */ jsxRuntime.jsx(
782
+ "button",
783
+ {
784
+ type: "button",
785
+ className: FileUploadField_module["default"].removeButton,
786
+ title: "Remove file",
787
+ "aria-label": `Remove ${file.name}`,
788
+ onClick: (e) => handleRemoveFile(file.id, e),
789
+ children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 18 })
790
+ }
791
+ ) : null })
792
+ ]
793
+ },
794
+ file.id
795
+ );
796
+ }) }),
797
+ !canUploadMore && filesList.length > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: FileUploadField_module["default"].helperText, children: helperTextContent })
798
+ ] })
799
+ }
800
+ ),
801
+ citation && /* @__PURE__ */ jsxRuntime.jsx(
802
+ InputDataReasoningCard.InputDataReasoningCard,
803
+ {
804
+ isVisible: isReasoningOpen,
805
+ citation,
806
+ citations: state == null ? void 0 : state.citations,
807
+ fieldName: title,
808
+ fieldValue: value
809
+ }
810
+ )
811
+ ] });
812
+ }
813
+
814
+ exports["default"] = FileUploadField;
815
+ //# sourceMappingURL=FileUploadField.js.map