@epam/ai-dial-chat-hooks 1.2.0-dev.98 → 1.2.0-rc.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.
Files changed (84) hide show
  1. package/api-error/api-error.js +7 -4
  2. package/catalog/catalog-derivations.js +1 -1
  3. package/catalog/deployment-id.js +8 -2
  4. package/catalog/map-deployment-limits-to-catalog.js +16 -24
  5. package/catalog/map-deployment-limits-to-input.js +81 -9
  6. package/catalog/map-deployment-to-catalog-item.js +34 -34
  7. package/catalog/map-entity-details-to-catalog.js +237 -192
  8. package/catalog/map-skill-to-catalog-item.js +61 -54
  9. package/catalog/publish.js +4 -4
  10. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +122 -101
  11. package/catalog/useCatalogItemDetails.js +9 -8
  12. package/catalog/usePublishFolders/usePublishFolders.js +1 -1
  13. package/catalog.d.ts +171 -34
  14. package/catalog.js +23 -23
  15. package/conversation/conversation-transfer/export-conversation.js +24 -16
  16. package/conversation/conversation-transfer/import-conversation.js +80 -31
  17. package/conversation/create-chat-stream-api.js +85 -49
  18. package/conversation/get-model-id-from-conversation-id.js +15 -9
  19. package/conversation/message-utils.js +44 -2
  20. package/conversation/stage.js +6 -2
  21. package/conversation/useActiveConversationSync/useActiveConversationSync.js +7 -8
  22. package/conversation/useConversationExport/useConversationExport.js +9 -9
  23. package/conversation/useConversationHandlers/message-utils.js +8 -5
  24. package/conversation/useConversationHandlers/useConversationHandlers.js +181 -167
  25. package/conversation/useConversationImport/useConversationImport.js +123 -121
  26. package/conversation/useConversationPanelItems/useConversationPanelItems.js +49 -31
  27. package/conversation/useConversationStream/frame-scheduler.js +39 -0
  28. package/conversation/useConversationStream/generation-resume.js +122 -64
  29. package/conversation/useConversationStream/useConversationStream.js +277 -118
  30. package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
  31. package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
  32. package/conversation-sources.d.ts +1 -1
  33. package/conversation-transfer.d.ts +2 -1
  34. package/conversation.d.ts +205 -22
  35. package/conversation.js +32 -31
  36. package/file-manager-canvas.d.ts +27 -7
  37. package/file-manager.d.ts +87 -32
  38. package/file-manager.js +25 -24
  39. package/files/attachment-canvas.js +67 -44
  40. package/files/dial-file-manager-copy-move.util.js +9 -8
  41. package/files/dial-file-manager-mapping.util.js +2 -1
  42. package/files/dial-file-manager-path.util.js +24 -2
  43. package/files/dial-file-manager.model.js +23 -19
  44. package/files/dial-file-manager.types.js +3 -3
  45. package/files/file-manager-variant.js +1 -1
  46. package/files/resolve-dial-file-api-path.js +11 -12
  47. package/files/useDialFileListing/useDialFileListing.js +140 -127
  48. package/files/useDialFileManager/useDialFileManager.js +139 -135
  49. package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
  50. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -15
  51. package/files/useDialFileMutations/useDialFileMutations.js +65 -60
  52. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
  53. package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +28 -23
  54. package/index.d.ts +630 -128
  55. package/index.js +136 -134
  56. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
  57. package/oauth/authorize-url.js +3 -3
  58. package/oauth/toolset-id.js +5 -3
  59. package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
  60. package/oauth.d.ts +34 -2
  61. package/oauth.js +9 -9
  62. package/package.json +19 -23
  63. package/scheduled-task/scheduled-task-description.js +43 -39
  64. package/scheduled-task/scheduled-task-trigger.js +74 -71
  65. package/scheduled-task/use-scheduled-task-runs.js +162 -50
  66. package/scheduled-task/use-scheduled-tasks.js +52 -48
  67. package/scheduled-tasks.d.ts +27 -6
  68. package/scheduled-tasks.js +2 -2
  69. package/shared/application-schema.js +5 -2
  70. package/shared/cron-day-of-month.js +13 -0
  71. package/skill/skill-archive.js +19 -0
  72. package/skill/skill-types.js +8 -7
  73. package/skill/skill.js +52 -29
  74. package/skill/useSkillArchiveImport/useSkillArchiveImport.js +38 -34
  75. package/skill/useSkillEditorLoad.js +65 -59
  76. package/skill/useSkillEditorSubmit.js +105 -93
  77. package/skill/useSkillFileActions.js +70 -58
  78. package/skill-editor.d.ts +62 -13
  79. package/skill-editor.js +9 -9
  80. package/usage/map-user-usage-to-model-limits.js +137 -95
  81. package/usage.d.ts +8 -3
  82. package/usePageFileDrag/usePageFileDrag.js +3 -3
  83. package/utils.d.ts +26 -6
  84. package/utils.js +10 -10
package/file-manager.d.ts CHANGED
@@ -34,7 +34,6 @@ import { FileUploadResponseDto } from '@epam/ai-dial-chat-api-client';
34
34
  import { FileUploadStatus } from '@epam/ai-dial-chat-shared';
35
35
  import { FileUploadValidationResult } from '@epam/ai-dial-chat-shared';
36
36
  import { FilterChipItem } from '@epam/ai-dial-ui-kit';
37
- import { getParentFolderPath } from '@epam/ai-dial-chat-shared';
38
37
  import { ListFilesItemDto } from '@epam/ai-dial-chat-api-client';
39
38
  import { ListFilesResponseDto } from '@epam/ai-dial-chat-api-client';
40
39
  import { ListPublicFilesRequest } from '@epam/ai-dial-chat-api-client';
@@ -123,12 +122,19 @@ export declare const DATE_OPTIONS: Intl.DateTimeFormatOptions;
123
122
 
124
123
  export declare const deriveActionProfile: (variant: DialFileManagerVariant) => DialFileManagerActionProfile;
125
124
 
125
+ /** Source tabs `useDialFileManagerSections` can merge into the All tab, in display order. */
126
+ export declare const DIAL_FILE_MANAGER_SECTION_TABS: readonly DialFileManagerTabs[];
127
+
126
128
  /** Strip the "files/{bucket}/" prefix from a DIAL Core URL to get the path within the bucket. */
127
129
  export declare const dialCorePathToRelative: (dialCorePath: string, bucket: string) => string;
128
130
 
129
- export { DialFileManagerActionProfile }
130
-
131
- export { DialFileManagerVariant }
131
+ /** One source tab rendered as a top-level folder of the All view. */
132
+ export declare interface DialFileManagerSection {
133
+ /** Source tab backing this section — `MyFiles`, `Shared` or `Organization`. */
134
+ tab: DialFileManagerTabs;
135
+ /** Display name of the section's top-level folder; also the first segment of its virtual paths. An empty, slash-containing or repeated label is replaced by the tab id. */
136
+ rootLabel: string;
137
+ }
132
138
 
133
139
  /**
134
140
  * Operation port every file-manager hook that performs network I/O accepts as
@@ -344,7 +350,9 @@ export declare enum FileManagerNotificationReason {
344
350
  /** `onUploadArchive` extracted some entries successfully and some failed; `count`/`names`/`restCount` describe the failures. */
345
351
  UploadArchivePartiallyFailed = "uploadArchivePartiallyFailed",
346
352
  /** `onUploadArchive`'s `uploadArchive` request itself rejected. */
347
- UploadArchiveRequestFailed = "uploadArchiveRequestFailed"
353
+ UploadArchiveRequestFailed = "uploadArchiveRequestFailed",
354
+ /** A copy/move targeted a destination in a different All-view section from its source items; no request was made. */
355
+ CrossSectionTransferUnsupported = "crossSectionTransferUnsupported"
348
356
  }
349
357
 
350
358
  /**
@@ -365,8 +373,6 @@ export declare type FileNameValidationError = {
365
373
  } | {
366
374
  reason: FileNameValidationErrorReason.DuplicateName;
367
375
  existingName: string;
368
- } | {
369
- reason: FileNameValidationErrorReason.LeadingDot;
370
376
  };
371
377
 
372
378
  /**
@@ -379,8 +385,7 @@ export declare enum FileNameValidationErrorReason {
379
385
  ForbiddenSymbols = "forbiddenSymbols",
380
386
  ReservedName = "reservedName",
381
387
  TooLong = "tooLong",
382
- DuplicateName = "duplicateName",
383
- LeadingDot = "leadingDot"
388
+ DuplicateName = "duplicateName"
384
389
  }
385
390
 
386
391
  /**
@@ -397,7 +402,10 @@ export declare enum FileOperationKind {
397
402
  FileCopied = "fileCopied",
398
403
  FilesCopied = "filesCopied",
399
404
  FileMoved = "fileMoved",
400
- FilesMoved = "filesMoved"
405
+ FilesMoved = "filesMoved",
406
+ /** A copy whose every item landed in its own source folder (Duplicate). */
407
+ FileDuplicated = "fileDuplicated",
408
+ FilesDuplicated = "filesDuplicated"
401
409
  }
402
410
 
403
411
  /**
@@ -412,13 +420,15 @@ export declare interface FileOperationSuccessEvent {
412
420
  name?: string;
413
421
  /** Number of items the operation covered, when applicable. */
414
422
  count?: number;
415
- /** Destination folder name, for copy/move operations. */
423
+ /**
424
+ * Destination folder as a slash-joined virtual path starting at the root
425
+ * label (e.g. `My files/reports`), for copy/move/duplicate operations.
426
+ */
416
427
  destinationFolderName?: string;
417
428
  /**
418
- * Whether the affected item is a folder rather than a file. Only set for
419
- * `fileRenamed`, since it is the only kind whose current wording depends
420
- * on the item's node type (a rename toast reads "Folder renamed" vs.
421
- * "File renamed").
429
+ * Whether the affected item is a folder rather than a file. Set for rename,
430
+ * copy, move, and duplicate events; on a multi-item event it describes the
431
+ * first successfully affected item (the one `name` refers to).
422
432
  */
423
433
  isFolder?: boolean;
424
434
  }
@@ -453,8 +463,6 @@ export declare interface FilesApiClient {
453
463
  listSharedByMe: (bucket: string) => Promise<ListFilesResponseDto>;
454
464
  }
455
465
 
456
- export { FileUploadValidationResult }
457
-
458
466
  export declare const findDialFileByPath: (nodes: DialFile[], targetPath: string) => DialFile | undefined;
459
467
 
460
468
  export declare const findFirstSuccessfulCopyMoveItem: <TDto extends {
@@ -471,8 +479,6 @@ export declare const findFolderByVirtualPath: (nodes: DialFile[], virtualPath: s
471
479
 
472
480
  export declare const formatOperationFolderName: (destinationFolder: string, rootLabel: string) => string;
473
481
 
474
- export { getParentFolderPath }
475
-
476
482
  /**
477
483
  * Returns the last path segment of `url` — its file name — for both absolute
478
484
  * URLs and DIAL-relative resource paths such as
@@ -489,6 +495,9 @@ export declare const hasDialFileWritePermission: (folder?: DialFile) => boolean;
489
495
 
490
496
  export declare const hasForbiddenNameSymbols: (name: string, forbiddenSymbolsRegExp?: RegExp) => boolean;
491
497
 
498
+ /** Returns `true` when both sets contain exactly the same paths. */
499
+ export declare const hasSamePaths: (a: ReadonlySet<string>, b: ReadonlySet<string>) => boolean;
500
+
492
501
  /** Copy/Move/Duplicate are Browse/Full-only — the attach picker excludes them. */
493
502
  export declare const isCopyMoveDuplicateAllowed: (actionProfile: DialFileManagerActionProfile) => boolean;
494
503
 
@@ -572,7 +581,7 @@ export declare interface PreparedCopyMoveItem<TDto> {
572
581
  export declare const prepareDownloadDestination: (filename: string, mimeType?: string) => Promise<DownloadDestination>;
573
582
 
574
583
  /**
575
- * Rename-vs-move disambiguation (design.md D3): entries whose parent folder
584
+ * Rename-vs-move disambiguation (`openspec/changes/archive/2026-07-21-split-use-dial-file-manager/design.md` D3): entries whose parent folder
576
585
  * is unchanged become `renameDtos`; entries whose parent folder changed
577
586
  * become `preparedMoveItems`.
578
587
  */
@@ -634,6 +643,9 @@ export declare const resolveOwnerCoords: (apiPath: string, sharedRootMeta: Map<s
634
643
  */
635
644
  export declare const resolveRelativeDialFilePath: (pathOrFileId: string, bucket: string) => string;
636
645
 
646
+ /** Returns the section whose root label is the first segment of `virtualPath`, or `undefined` when none matches. */
647
+ export declare const resolveSectionByPath: <TSection extends DialFileManagerSection>(virtualPath: string, sections: readonly TSection[]) => TSection | undefined;
648
+
637
649
  /**
638
650
  * Sanitizes a filename for upload by replacing forbidden characters with `_`,
639
651
  * trimming trailing dots/whitespace from the base name, and capping the result
@@ -662,7 +674,10 @@ export declare const splitFileNameExtension: (fileName: string) => {
662
674
 
663
675
  export declare const trimFileNameToByteLimit: (name: string, limit?: number) => string;
664
676
 
665
- export declare const updateEntry: (prev: FileUploadBatchState | null, index: number, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
677
+ /** Returns a new set containing every path from each of `pathSets`. */
678
+ export declare const unionPathSets: (pathSets: readonly ReadonlySet<string>[]) => Set<string>;
679
+
680
+ export declare const updateEntry: (prev: FileUploadBatchState | null, id: string, patch: FileUploadStatus | Partial<Pick<FileUploadEntry, "status" | "percent">>) => FileUploadBatchState | null;
666
681
 
667
682
  /** Max number of files uploaded concurrently within a single upload batch. */
668
683
  export declare const UPLOAD_CONCURRENCY = 3;
@@ -691,14 +706,14 @@ export declare type UploadMode = 'overwrite' | 'create-only';
691
706
  * tree's expand/collapse state, search, and the shared per-folder cache that
692
707
  * `useDialFileUploadBatch`/`useDialFileMutations`/`useDialFileSharing` invalidate
693
708
  * through `invalidateFolders`/`bumpRetry` after their own mutations settle
694
- * (design.md D1) — this hook is the sole owner/writer of that cache.
709
+ * (`openspec/changes/archive/2026-07-21-split-use-dial-file-manager/design.md` D1) — this hook is the sole owner/writer of that cache.
695
710
  *
696
711
  * Supports three listing sources via `activeTab`:
697
712
  * - my_files: user's own bucket via `DialFilesApi.listFiles`
698
713
  * - shared: files shared with the user via `DialFilesApi.listSharedFiles`
699
714
  * - organization: public bucket via `DialFilesApi.listPublicFiles`
700
715
  */
701
- export declare const useDialFileListing: ({ filesApi, bucket, rootLabel, activeTab, onNotification, }: UseDialFileListingOptions) => UseDialFileListingResult;
716
+ export declare const useDialFileListing: ({ filesApi, bucket, rootLabel, activeTab, onNotification, isActive, sessionKey, }: UseDialFileListingOptions) => UseDialFileListingResult;
702
717
 
703
718
  /** Options accepted by `useDialFileListing`. */
704
719
  export declare interface UseDialFileListingOptions {
@@ -712,6 +727,10 @@ export declare interface UseDialFileListingOptions {
712
727
  activeTab: DialFileManagerTabs;
713
728
  /** Called with a structured event when a folder-load operation fails. */
714
729
  onNotification?: (notification: FileManagerNotification) => void;
730
+ /** When false, the hook issues no `DialFilesApi` call and reports `isLoading: false`. Defaults to `true`. */
731
+ isActive?: boolean;
732
+ /** Changing this value resets cache and navigation exactly like an `activeTab` change. Defaults to `undefined`. */
733
+ sessionKey?: string;
715
734
  }
716
735
 
717
736
  /** Values returned by `useDialFileListing`. */
@@ -747,7 +766,7 @@ export declare interface UseDialFileListingResult {
747
766
  /**
748
767
  * Deletes the given API-path cache keys so the next listing fetch/expand for
749
768
  * that folder re-fetches from the server. The only way sibling sub-hooks may
750
- * invalidate the shared cache (design.md D1).
769
+ * invalidate the shared cache (`openspec/changes/archive/2026-07-21-split-use-dial-file-manager/design.md` D1).
751
770
  */
752
771
  invalidateFolders: (apiPaths: string[]) => void;
753
772
  /** Merges a just-created folder into its parent's cache entry (optimistic display for create-folder). */
@@ -768,7 +787,7 @@ export declare interface UseDialFileListingResult {
768
787
  * every translated string reaches it through `labels`,
769
788
  * `disabledNewButtonTooltip`, and `buildValidationErrorMessage`.
770
789
  */
771
- export declare const useDialFileManager: ({ filesApi, bucket, rootLabel, activeTab, onNotification, onOperationSuccess, forbiddenSymbolsRegExp, variant, actionProfile, labels, locale, disabledNewButtonTooltip, downloadDestination, buildValidationErrorMessage, }: UseDialFileManagerOptions) => UseDialFileManagerResult;
790
+ export declare const useDialFileManager: ({ filesApi, bucket, rootLabel, activeTab, isActive, sessionKey, onNotification, onOperationSuccess, forbiddenSymbolsRegExp, variant, actionProfile, labels, locale, disabledNewButtonTooltip, downloadDestination, buildValidationErrorMessage, }: UseDialFileManagerOptions) => UseDialFileManagerResult;
772
791
 
773
792
  export declare interface UseDialFileManagerOptions {
774
793
  /** Injected operation port used for every file-manager network call. */
@@ -779,6 +798,10 @@ export declare interface UseDialFileManagerOptions {
779
798
  rootLabel?: string;
780
799
  /** Active tab — drives listing source and per-tab options. Defaults to MyFiles. */
781
800
  activeTab?: DialFileManagerTabs;
801
+ /** When false, the listing issues no `DialFilesApi` call and reports `isLoading: false`. Defaults to `true`. */
802
+ isActive?: boolean;
803
+ /** Changing this value resets cache and navigation exactly like an `activeTab` change. Defaults to `undefined`. */
804
+ sessionKey?: string;
782
805
  /** Called when a file-manager action should surface a toast notification. */
783
806
  onNotification?: (notification: FileManagerNotification) => void;
784
807
  /** Called when a mutation succeeds, instead of invoking an application notification service directly. */
@@ -833,7 +856,7 @@ export declare interface UseDialFileManagerResult {
833
856
  onSearchFiles: (folder: string, query: string) => void;
834
857
  /** Search: true while a search request is in flight. */
835
858
  isSearching: boolean;
836
- /** Search: flat list of matching files, or null when search is not active. */
859
+ /** Search: flat, unfiltered recursive listing of the current folder, or null when search is not active. */
837
860
  searchResults: DialFile[] | null;
838
861
  /** Search: clears results and exits search mode. */
839
862
  clearSearchResults: () => void;
@@ -857,7 +880,9 @@ export declare interface UseDialFileManagerResult {
857
880
  uploadBatchState: FileUploadBatchState | null;
858
881
  /** Upload: abort all in-flight and queued uploads. */
859
882
  cancelUpload: () => void;
860
- /** Upload: dismiss the progress modal after the batch has settled. */
883
+ /** Upload: abort one queued or in-flight upload by its entry id. */
884
+ cancelUploadFile: (id: string) => void;
885
+ /** Upload: empty the upload queue. */
861
886
  clearUploadBatch: () => void;
862
887
  /** Folder creation: called when user confirms a new folder name. */
863
888
  onCreateFolder: (file: DialUploadFileItem, folderPath: string, fileId: string) => Promise<void>;
@@ -924,7 +949,7 @@ export declare interface UseDialFileManagerResult {
924
949
  /**
925
950
  * True while any mutating file-manager operation is in flight: the OR of
926
951
  * `isCreatingFolder`, `isDownloading`, `isDeleting`, `isRenaming`, `isCopying`,
927
- * `isMoving`, `isUnsharing`, `isRemovingAccess`, and `uploadBatchState != null`.
952
+ * `isMoving`, `isUnsharing`, `isRemovingAccess`, and any upload still queued or running.
928
953
  *
929
954
  * Deliberately excludes three flags, each already fully contained by its own
930
955
  * scoped loading UI:
@@ -935,11 +960,36 @@ export declare interface UseDialFileManagerResult {
935
960
  isAnyOperationInProgress: boolean;
936
961
  }
937
962
 
963
+ /**
964
+ * Composes one `useDialFileManager` per source tab (My files, Shared,
965
+ * Organization) so the File storage page can offer an All tab without a
966
+ * second copy of the per-tab rules. On a single tab it returns that section's
967
+ * result; on All it merges the section roots into one tree and routes every
968
+ * callback to the section owning the path. Section availability and names
969
+ * arrive through `sections` — the hook reads no config, i18n, or context.
970
+ */
971
+ export declare const useDialFileManagerSections: ({ activeTab, sections, ...managerOptions }: UseDialFileManagerSectionsOptions) => UseDialFileManagerSectionsResult;
972
+
973
+ /** Options accepted by `useDialFileManagerSections`. */
974
+ export declare interface UseDialFileManagerSectionsOptions extends Omit<UseDialFileManagerOptions, 'activeTab' | 'rootLabel' | 'isActive' | 'sessionKey'> {
975
+ /** Active tab, including `DialFileManagerTabs.All`. */
976
+ activeTab: DialFileManagerTabs;
977
+ /** Enabled source tabs in display order, each with its translated top-level folder name. */
978
+ sections: DialFileManagerSection[];
979
+ }
980
+
981
+ /** Values returned by `useDialFileManagerSections`. */
982
+ export declare interface UseDialFileManagerSectionsResult extends UseDialFileManagerResult {
983
+ /** Source tab of the browsed folder; never `DialFileManagerTabs.All`. */
984
+ sectionTab: DialFileManagerTabs;
985
+ }
986
+
938
987
  /**
939
988
  * Filters the file-manager's tab list down to the host's configured set and
940
989
  * resets `activeTab` to the highest-priority still-enabled tab when the
941
990
  * current one becomes excluded. A `fileManagerTabs` of `undefined` means no
942
991
  * restriction — every tab in `allTabs` stays enabled and no reset ever fires.
992
+ * The All tab is kept only while at least two source tabs are enabled.
943
993
  */
944
994
  export declare const useDialFileManagerTabConfig: (activeTab: DialFileManagerTabs, onTabChange: (tab: DialFileManagerTabs) => void, allTabs: FilterChipItem<DialFileManagerTabs>[] | undefined, fileManagerTabs: string[] | undefined) => UseDialFileManagerTabConfigResult;
945
995
 
@@ -1070,10 +1120,11 @@ export declare interface UseDialFileSharingResult {
1070
1120
 
1071
1121
  /**
1072
1122
  * Manages upload batches (single-file and ZIP-archive extraction), including
1073
- * concurrency-limited progress tracking and abort. Invalidates the shared
1074
- * listing cache for the destination folder through `invalidateFolders`/
1075
- * `bumpRetry` after a batch settles — it never holds its own copy of the
1076
- * cache.
1123
+ * concurrency-limited progress tracking and per-file abort. A batch started
1124
+ * while another is on screen is appended to it, and settled entries stay in
1125
+ * `uploadBatchState` until `clearUploadBatch`. Invalidates the shared listing
1126
+ * cache for the destination folder through `invalidateFolders`/`bumpRetry`
1127
+ * after a batch settles — it never holds its own copy of the cache.
1077
1128
  */
1078
1129
  export declare const useDialFileUploadBatch: ({ filesApi, bucket, rootLabel, activeTab, cache, sharedRootMetaRef, invalidateFolders, bumpRetry, onNotification, }: UseDialFileUploadBatchOptions) => UseDialFileUploadBatchResult;
1079
1130
 
@@ -1106,6 +1157,7 @@ export declare interface UseDialFileUploadBatchResult {
1106
1157
  onValidateUpload: (files: DialUploadFileItem[], existingFiles: DialFile[], destinationFolder: string) => Promise<FileUploadValidationResult>;
1107
1158
  uploadBatchState: FileUploadBatchState | null;
1108
1159
  cancelUpload: () => void;
1160
+ cancelUploadFile: (id: string) => void;
1109
1161
  clearUploadBatch: () => void;
1110
1162
  }
1111
1163
 
@@ -1179,4 +1231,7 @@ export { UseGridEditingScrollResult }
1179
1231
  */
1180
1232
  export declare const virtualPathToApiPath: (virtualPath: string, rootLabel: string) => string;
1181
1233
 
1234
+ /** Returns `sections` with every root label usable as a unique first path segment, falling back to the tab id. */
1235
+ export declare const withRoutableRootLabels: <TSection extends DialFileManagerSection>(sections: readonly TSection[]) => TSection[];
1236
+
1182
1237
  export { }
package/file-manager.js CHANGED
@@ -3,27 +3,28 @@ import { isDialFileAcceptType as r, mimeTypesToAttachmentExtensionLabels as i, m
3
3
  import { sanitizeFileName as s, splitFileNameExtension as c, trimFileNameToByteLimit as l } from "./files/file-name.js";
4
4
  import { DialFilesApiUploadMode as u } from "./files/dial-files-api.js";
5
5
  import { FileManagerNotificationReason as d, FileNameValidationErrorReason as f, FileOperationKind as p } from "./files/dial-file-manager.types.js";
6
- import { COLUMNS_WITHOUT_AUTHOR as m, COLUMNS_WITH_AUTHOR as h, CORE_PERMISSION_MAP as g, DATE_OPTIONS as _, PATH_SEPARATOR_REGEXP as v, RESERVED_MARKER_NAME as y, UPLOAD_CONCURRENCY as b } from "./files/dial-file-manager.model.js";
7
- import { DialFileManagerActionProfile as x, DialFileManagerVariant as S, deriveActionProfile as C } from "./files/file-manager-variant.js";
8
- import { buildSharedItemVirtualPath as w, dialCorePathToRelative as T, findDialFileByPath as E, findFolderByVirtualPath as D, formatOperationFolderName as O, getVirtualPathName as k, hasDialFileWritePermission as A, hasForbiddenNameSymbols as j, isCopyMoveDuplicateAllowed as M, isShareActionsAllowed as N, normalizeVirtualPath as P, parseNewFolderVirtualPath as F, resolveOwnerCoords as I } from "./files/dial-file-manager-path.util.js";
9
- import { getParentFolderPath as L, resolveDialFileApiPath as R, virtualPathToApiPath as z } from "./files/resolve-dial-file-api-path.js";
10
- import { prepareCopyItems as B, prepareMoveRenameItems as V } from "./files/dial-file-manager-copy-move.util.js";
11
- import { buildFromCache as H, fetchByTab as U, fetchForSearch as W, findFirstSuccessfulCopyMoveItem as G, mapCorePermissions as K, mapFileMetadataToDialFile as q, mapSearchItem as J, mergeCreatedFolderIntoCache as Y, updateEntry as X } from "./files/dial-file-manager-mapping.util.js";
12
- import { createFilesApiClient as Z } from "./files/create-files-api.js";
13
- import { createUploadFileWithProgress as Q } from "./files/create-upload-file-with-progress.js";
14
- import { openAnnotationAttachment as $ } from "./files/annotation.js";
15
- import { getUrlFileName as ee, isExternalSourcePreviewable as te, resolveExternalSourceContentType as ne } from "./files/source-content.js";
16
- import { annotationToDisplayAttachment as re, attachmentDtoToDisplayAttachment as ie, attachmentDtosToDisplayAttachments as ae } from "./files/attachment-dto-to-display.js";
17
- import { dialFileToAttachment as oe, dialFilesToAttachments as se, dialFolderPathToAttachment as ce } from "./files/dial-file-to-attachment.js";
18
- import { DownloadDestinationType as le } from "./files/download-destination.js";
19
- import { prepareDownloadDestination as ue } from "./files/prepare-download-destination.js";
20
- import { useDialFileListing as de } from "./files/useDialFileListing/useDialFileListing.js";
21
- import { useDialFileMetadata as fe } from "./files/useDialFileMetadata/useDialFileMetadata.js";
22
- import { useDialFileMutations as pe } from "./files/useDialFileMutations/useDialFileMutations.js";
23
- import { useDialFileSharing as me } from "./files/useDialFileSharing/useDialFileSharing.js";
24
- import { useDialFileUploadBatch as he } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
25
- import { useDialFileManager as ge } from "./files/useDialFileManager/useDialFileManager.js";
26
- import { useDialFileManagerTabConfig as _e } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
27
- import { useFileAttachmentPicker as ve } from "./files/useFileAttachmentPicker/useFileAttachmentPicker.js";
28
- import { useGridEditingScroll as ye } from "@epam/ai-dial-chat-shared";
29
- export { m as COLUMNS_WITHOUT_AUTHOR, h as COLUMNS_WITH_AUTHOR, g as CORE_PERMISSION_MAP, _ as DATE_OPTIONS, x as DialFileManagerActionProfile, S as DialFileManagerVariant, u as DialFilesApiUploadMode, le as DownloadDestinationType, d as FileManagerNotificationReason, f as FileNameValidationErrorReason, p as FileOperationKind, v as PATH_SEPARATOR_REGEXP, y as RESERVED_MARKER_NAME, b as UPLOAD_CONCURRENCY, re as annotationToDisplayAttachment, ie as attachmentDtoToDisplayAttachment, ae as attachmentDtosToDisplayAttachments, H as buildFromCache, w as buildSharedItemVirtualPath, Z as createFilesApiClient, Q as createUploadFileWithProgress, C as deriveActionProfile, T as dialCorePathToRelative, oe as dialFileToAttachment, se as dialFilesToAttachments, ce as dialFolderPathToAttachment, U as fetchByTab, W as fetchForSearch, E as findDialFileByPath, G as findFirstSuccessfulCopyMoveItem, D as findFolderByVirtualPath, O as formatOperationFolderName, L as getParentFolderPath, ee as getUrlFileName, k as getVirtualPathName, A as hasDialFileWritePermission, j as hasForbiddenNameSymbols, M as isCopyMoveDuplicateAllowed, r as isDialFileAcceptType, e as isDialFileId, te as isExternalSourcePreviewable, N as isShareActionsAllowed, K as mapCorePermissions, q as mapFileMetadataToDialFile, J as mapSearchItem, Y as mergeCreatedFolderIntoCache, i as mimeTypesToAttachmentExtensionLabels, a as mimeTypesToDialFileAcceptTypes, o as mimeTypesToFileAccept, P as normalizeVirtualPath, $ as openAnnotationAttachment, F as parseNewFolderVirtualPath, B as prepareCopyItems, ue as prepareDownloadDestination, V as prepareMoveRenameItems, R as resolveDialFileApiPath, t as resolveDialFileBucketAndPath, ne as resolveExternalSourceContentType, I as resolveOwnerCoords, n as resolveRelativeDialFilePath, s as sanitizeFileName, c as splitFileNameExtension, l as trimFileNameToByteLimit, X as updateEntry, de as useDialFileListing, ge as useDialFileManager, _e as useDialFileManagerTabConfig, fe as useDialFileMetadata, pe as useDialFileMutations, me as useDialFileSharing, he as useDialFileUploadBatch, ve as useFileAttachmentPicker, ye as useGridEditingScroll, z as virtualPathToApiPath };
6
+ import { COLUMNS_WITHOUT_AUTHOR as m, COLUMNS_WITH_AUTHOR as h, CORE_PERMISSION_MAP as g, DATE_OPTIONS as _, DIAL_FILE_MANAGER_SECTION_TABS as v, PATH_SEPARATOR_REGEXP as y, RESERVED_MARKER_NAME as b, UPLOAD_CONCURRENCY as x } from "./files/dial-file-manager.model.js";
7
+ import { buildSharedItemVirtualPath as S, dialCorePathToRelative as C, findDialFileByPath as w, findFolderByVirtualPath as T, formatOperationFolderName as E, getVirtualPathName as D, hasDialFileWritePermission as O, hasForbiddenNameSymbols as k, hasSamePaths as A, isCopyMoveDuplicateAllowed as j, isShareActionsAllowed as M, normalizeVirtualPath as N, parseNewFolderVirtualPath as P, resolveOwnerCoords as F, resolveSectionByPath as I, unionPathSets as L, withRoutableRootLabels as R } from "./files/dial-file-manager-path.util.js";
8
+ import { resolveDialFileApiPath as z, virtualPathToApiPath as B } from "./files/resolve-dial-file-api-path.js";
9
+ import { prepareCopyItems as V, prepareMoveRenameItems as H } from "./files/dial-file-manager-copy-move.util.js";
10
+ import { buildFromCache as U, fetchByTab as W, fetchForSearch as G, findFirstSuccessfulCopyMoveItem as K, mapCorePermissions as q, mapFileMetadataToDialFile as J, mapSearchItem as Y, mergeCreatedFolderIntoCache as X, updateEntry as Z } from "./files/dial-file-manager-mapping.util.js";
11
+ import { createFilesApiClient as Q } from "./files/create-files-api.js";
12
+ import { createUploadFileWithProgress as $ } from "./files/create-upload-file-with-progress.js";
13
+ import { openAnnotationAttachment as ee } from "./files/annotation.js";
14
+ import { getUrlFileName as te, isExternalSourcePreviewable as ne, resolveExternalSourceContentType as re } from "./files/source-content.js";
15
+ import { annotationToDisplayAttachment as ie, attachmentDtoToDisplayAttachment as ae, attachmentDtosToDisplayAttachments as oe } from "./files/attachment-dto-to-display.js";
16
+ import { dialFileToAttachment as se, dialFilesToAttachments as ce, dialFolderPathToAttachment as le } from "./files/dial-file-to-attachment.js";
17
+ import { DownloadDestinationType as ue } from "./files/download-destination.js";
18
+ import { prepareDownloadDestination as de } from "./files/prepare-download-destination.js";
19
+ import { deriveActionProfile as fe } from "./files/file-manager-variant.js";
20
+ import { useDialFileListing as pe } from "./files/useDialFileListing/useDialFileListing.js";
21
+ import { useDialFileMetadata as me } from "./files/useDialFileMetadata/useDialFileMetadata.js";
22
+ import { useDialFileMutations as he } from "./files/useDialFileMutations/useDialFileMutations.js";
23
+ import { useDialFileSharing as ge } from "./files/useDialFileSharing/useDialFileSharing.js";
24
+ import { useDialFileUploadBatch as _e } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
25
+ import { useDialFileManager as ve } from "./files/useDialFileManager/useDialFileManager.js";
26
+ import { useDialFileManagerSections as ye } from "./files/useDialFileManagerSections/useDialFileManagerSections.js";
27
+ import { useDialFileManagerTabConfig as be } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
28
+ import { useFileAttachmentPicker as xe } from "./files/useFileAttachmentPicker/useFileAttachmentPicker.js";
29
+ import { useGridEditingScroll as Se } from "@epam/ai-dial-chat-shared";
30
+ export { m as COLUMNS_WITHOUT_AUTHOR, h as COLUMNS_WITH_AUTHOR, g as CORE_PERMISSION_MAP, _ as DATE_OPTIONS, v as DIAL_FILE_MANAGER_SECTION_TABS, u as DialFilesApiUploadMode, ue as DownloadDestinationType, d as FileManagerNotificationReason, f as FileNameValidationErrorReason, p as FileOperationKind, y as PATH_SEPARATOR_REGEXP, b as RESERVED_MARKER_NAME, x as UPLOAD_CONCURRENCY, ie as annotationToDisplayAttachment, ae as attachmentDtoToDisplayAttachment, oe as attachmentDtosToDisplayAttachments, U as buildFromCache, S as buildSharedItemVirtualPath, Q as createFilesApiClient, $ as createUploadFileWithProgress, fe as deriveActionProfile, C as dialCorePathToRelative, se as dialFileToAttachment, ce as dialFilesToAttachments, le as dialFolderPathToAttachment, W as fetchByTab, G as fetchForSearch, w as findDialFileByPath, K as findFirstSuccessfulCopyMoveItem, T as findFolderByVirtualPath, E as formatOperationFolderName, te as getUrlFileName, D as getVirtualPathName, O as hasDialFileWritePermission, k as hasForbiddenNameSymbols, A as hasSamePaths, j as isCopyMoveDuplicateAllowed, r as isDialFileAcceptType, e as isDialFileId, ne as isExternalSourcePreviewable, M as isShareActionsAllowed, q as mapCorePermissions, J as mapFileMetadataToDialFile, Y as mapSearchItem, X as mergeCreatedFolderIntoCache, i as mimeTypesToAttachmentExtensionLabels, a as mimeTypesToDialFileAcceptTypes, o as mimeTypesToFileAccept, N as normalizeVirtualPath, ee as openAnnotationAttachment, P as parseNewFolderVirtualPath, V as prepareCopyItems, de as prepareDownloadDestination, H as prepareMoveRenameItems, z as resolveDialFileApiPath, t as resolveDialFileBucketAndPath, re as resolveExternalSourceContentType, F as resolveOwnerCoords, n as resolveRelativeDialFilePath, I as resolveSectionByPath, s as sanitizeFileName, c as splitFileNameExtension, l as trimFileNameToByteLimit, L as unionPathSets, Z as updateEntry, pe as useDialFileListing, ve as useDialFileManager, ye as useDialFileManagerSections, be as useDialFileManagerTabConfig, me as useDialFileMetadata, he as useDialFileMutations, ge as useDialFileSharing, _e as useDialFileUploadBatch, xe as useFileAttachmentPicker, Se as useGridEditingScroll, B as virtualPathToApiPath, R as withRoutableRootLabels };
@@ -1,7 +1,7 @@
1
1
  import { isDialFileId as e } from "./dial-file.js";
2
2
  import { AttachmentContentType as t, AttachmentErrorType as n, OoxmlFileType as r, OoxmlHighlightKind as i, getOoxmlFileType as a } from "@epam/ai-dial-attachment-canvas";
3
3
  import { MIMEType as o, base64ToBlob as s, tryBase64ToBytes as c } from "@epam/ai-dial-chat-shared";
4
- import { annotationHighlightId as l, annotationToOfficeHighlightLocations as u, annotationsToPdfHighlights as d, gatherSameSourceAnnotations as f, getAnnotationPdfPage as p, parsePdfPageReference as m } from "@epam/ai-dial-quotations";
4
+ import { annotationHighlightIds as l, annotationToOfficeHighlightLocations as u, annotationsToPdfHighlights as d, gatherSameSourceAnnotations as f, getAnnotationPdfPage as p, parsePdfPageReference as m } from "@epam/ai-dial-quotations";
5
5
  import { LRUCache as h } from "lru-cache";
6
6
  //#region src/files/attachment-canvas.ts
7
7
  var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
@@ -124,31 +124,67 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
124
124
  text: i,
125
125
  language: r
126
126
  } : i;
127
- }, I = async (e, n) => {
128
- let r = await k(e, n);
129
- if (r == null) return null;
130
- if (typeof r != "string") return r;
131
- if (r.length > P) return null;
132
- let i = n.resolveDialUrl(e) ?? void 0;
133
- return {
127
+ }, I = (e) => {
128
+ try {
129
+ return new URL(e, window.location.href).origin;
130
+ } catch {
131
+ return;
132
+ }
133
+ }, L = async (e, n) => {
134
+ let r = n.resolveDialUrl(e) ?? void 0;
135
+ if (r != null) return {
134
136
  type: t.Html,
135
- srcdoc: r,
136
- url: i
137
+ url: r,
138
+ isSameOriginUrl: I(r) === I(window.location.href),
139
+ resolveSourceText: async () => {
140
+ let t = await k(e, n);
141
+ if (t == null || typeof t != "string") throw Error("Failed to resolve HTML source text");
142
+ return t;
143
+ }
137
144
  };
138
- }, L = (n, r, i) => {
145
+ let i = await k(e, n);
146
+ return i == null ? null : typeof i == "string" ? i.length > P ? null : {
147
+ type: t.Html,
148
+ srcdoc: i,
149
+ srcdocHostUrl: n.htmlSrcdocHostUrl
150
+ } : i;
151
+ }, R = (e, t) => ({
152
+ id: e,
153
+ bboxes: [{
154
+ page: t,
155
+ x1: 0,
156
+ y1: 0,
157
+ x2: 0,
158
+ y2: 0
159
+ }],
160
+ style: {
161
+ backgroundColor: "transparent",
162
+ opacity: 0
163
+ }
164
+ }), z = (n, r, i) => {
139
165
  let a = n.body?.source?.attachment;
140
166
  if (a?.type !== o.PDF) return null;
141
167
  let s = e(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
142
168
  if (s == null) return null;
143
- let c = (r.find((e) => e.annotations.includes(n))?.annotations ?? [n]).filter((e) => e.body?.source?.attachment?.url === a.url), u = c.indexOf(n), f = d(c), m = l(n, u);
169
+ let c = (r.find((e) => e.annotations.includes(n))?.annotations ?? [n]).filter((e) => e.body?.source?.attachment?.url === a.url), u = c.indexOf(n), f = d(c), m = l(c)[u], h = p(n), g = f.some((e) => e.id === m);
170
+ if (!g && h != null) {
171
+ let e = `page-anchor-${m}`;
172
+ return {
173
+ type: t.Pdf,
174
+ url: s,
175
+ highlights: [...f, R(e, h)],
176
+ selectedHighlightId: e,
177
+ page: h
178
+ };
179
+ }
144
180
  return {
145
181
  type: t.Pdf,
146
182
  url: s,
147
183
  highlights: f,
148
- selectedHighlightId: f.some((e) => e.id === m) ? m : void 0,
149
- page: p(n)
184
+ selectedHighlightId: g ? m : void 0,
185
+ page: h
150
186
  };
151
- }, R = (e) => {
187
+ }, B = (e) => {
152
188
  switch (e.type) {
153
189
  case "docx_text_anchor": return {
154
190
  kind: i.DocxTableRow,
@@ -184,22 +220,22 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
184
220
  end: e.end
185
221
  };
186
222
  }
187
- }, z = (n, i, o) => {
223
+ }, V = (n, i, o) => {
188
224
  let s = n.body?.source?.attachment;
189
225
  if (s?.url == null) return null;
190
226
  let c = a(s.title ?? s.url, s.type);
191
227
  if (c !== r.Docx && c !== r.Xlsx && c !== r.Pptx) return null;
192
228
  let d = e(s.url) ? o.resolveDialFileDownloadUrl(s.url) : s.url;
193
229
  if (d == null) return null;
194
- let p = f(n, i), m = [], h;
230
+ let p = f(n, i), m = [], h, g = l(p);
195
231
  return p.forEach((e, t) => {
196
232
  let r = u(e);
197
233
  if (r.length === 0) return;
198
- let i = l(e, t);
234
+ let i = g[t];
199
235
  m.push({
200
236
  id: i,
201
- locations: r.map(R)
202
- }), e === n && (h = i);
237
+ locations: r.map(B)
238
+ }), e === n && h == null && (h = i);
203
239
  }), {
204
240
  type: t.Ooxml,
205
241
  url: d,
@@ -209,7 +245,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
209
245
  selectedHighlightId: h
210
246
  } : {}
211
247
  };
212
- }, B = (n, r) => {
248
+ }, H = (n, r) => {
213
249
  let i = m(n.url);
214
250
  if (i == null) return null;
215
251
  let a = e(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
@@ -222,55 +258,42 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
222
258
  return {
223
259
  type: t.Pdf,
224
260
  url: a,
225
- highlights: [{
226
- id: o,
227
- bboxes: [{
228
- page: i.page,
229
- x1: 0,
230
- y1: 0,
231
- x2: 0,
232
- y2: 0
233
- }],
234
- style: {
235
- backgroundColor: "transparent",
236
- opacity: 0
237
- }
238
- }],
261
+ highlights: [R(o, i.page)],
239
262
  selectedHighlightId: o,
240
263
  page: i.page
241
264
  };
242
- }, V = (e) => {
265
+ }, U = (e) => {
243
266
  try {
244
267
  let t = new URL(e).protocol;
245
268
  return t === "http:" || t === "https:" || t === "blob:";
246
269
  } catch {
247
270
  return !1;
248
271
  }
249
- }, H = (t) => t.url != null && !e(t.url) && V(t.url) ? t.url : void 0, U = async (e, n) => {
272
+ }, W = (t) => t.url != null && !e(t.url) && U(t.url) ? t.url : void 0, G = async (e, n) => {
250
273
  let r = await O(e, n);
251
274
  if (r != null) return typeof r == "string" ? {
252
275
  type: t.Pdf,
253
276
  url: r
254
277
  } : r;
255
- let i = H(e);
278
+ let i = W(e);
256
279
  return i == null ? null : {
257
280
  type: t.Pdf,
258
281
  url: i
259
282
  };
260
- }, W = async (e, n, r) => {
283
+ }, K = async (e, n, r) => {
261
284
  let i = await O(e, n);
262
285
  if (i != null) return typeof i == "string" ? {
263
286
  type: t.Ooxml,
264
287
  url: i,
265
288
  format: r
266
289
  } : i;
267
- let a = H(e);
290
+ let a = W(e);
268
291
  return a == null ? null : {
269
292
  type: t.Ooxml,
270
293
  url: a,
271
294
  format: r
272
295
  };
273
- }, G = async (e, n) => {
296
+ }, q = async (e, n) => {
274
297
  let r = await k(e, n);
275
298
  if (r == null) return null;
276
299
  if (typeof r != "string") return r;
@@ -286,7 +309,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
286
309
  text: r
287
310
  };
288
311
  }
289
- }, K = async (e, n, r, i) => {
312
+ }, J = async (e, n, r, i) => {
290
313
  let a = await k(e, n);
291
314
  if (a == null || typeof a != "string") return null;
292
315
  let o = {};
@@ -308,7 +331,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
308
331
  visualizerName: r.title,
309
332
  requestTimeout: r.requestTimeout
310
333
  };
311
- }, q = (e, n, r, i) => {
334
+ }, Y = (e, n, r, i) => {
312
335
  let a = {
313
336
  width: r.width,
314
337
  height: r.height,
@@ -338,4 +361,4 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
338
361
  };
339
362
  };
340
363
  //#endregion
341
- export { z as annotationToOoxmlCanvasContent, L as annotationToPdfCanvasContent, S as clearAttachmentCache, A as hasAttachmentTextSource, B as referenceAttachmentToPdfCanvasContent, F as resolveCodeCanvasContent, q as resolveGroupedVisualizerCanvasContent, I as resolveHtmlCanvasContent, j as resolveImageCanvasContent, G as resolveJsonCanvasContent, N as resolveMarkdownCanvasContent, W as resolveOoxmlCanvasContent, U as resolvePdfCanvasContent, M as resolveTextCanvasContent, K as resolveVisualizerCanvasContent };
364
+ export { V as annotationToOoxmlCanvasContent, z as annotationToPdfCanvasContent, S as clearAttachmentCache, A as hasAttachmentTextSource, H as referenceAttachmentToPdfCanvasContent, F as resolveCodeCanvasContent, Y as resolveGroupedVisualizerCanvasContent, L as resolveHtmlCanvasContent, j as resolveImageCanvasContent, q as resolveJsonCanvasContent, N as resolveMarkdownCanvasContent, K as resolveOoxmlCanvasContent, G as resolvePdfCanvasContent, M as resolveTextCanvasContent, J as resolveVisualizerCanvasContent };
@@ -1,24 +1,25 @@
1
1
  import { getVirtualPathName as e } from "./dial-file-manager-path.util.js";
2
- import { getParentFolderPath as t, virtualPathToApiPath as n } from "./resolve-dial-file-api-path.js";
2
+ import { virtualPathToApiPath as t } from "./resolve-dial-file-api-path.js";
3
+ import { getParentFolderPath as n } from "@epam/ai-dial-chat-shared";
3
4
  import { CopyItemDtoNodeTypeEnum as r, MoveItemDtoNodeTypeEnum as i, RenameItemDtoNodeTypeEnum as a } from "@epam/ai-dial-chat-api-client";
4
5
  import { DialFileNodeType as o } from "@epam/ai-dial-react-file-manager";
5
6
  //#region src/files/dial-file-manager-copy-move.util.ts
6
- var s = (t, i, a) => t.map((t) => {
7
- let s = t.nodeType === o.FOLDER, c = n(t.sourceUrl, a), l = n(t.destinationUrl, a), u = e(t.sourceUrl, c);
7
+ var s = (n, i, a) => n.map((n) => {
8
+ let s = n.nodeType === o.FOLDER, c = t(n.sourceUrl, a), l = t(n.destinationUrl, a), u = e(n.sourceUrl, c);
8
9
  return {
9
- destinationName: e(t.destinationUrl, l),
10
+ destinationName: e(n.destinationUrl, l),
10
11
  dto: {
11
12
  bucket: i,
12
13
  sourcePath: s ? c.endsWith("/") ? c : `${c}/` : c.replace(/\/$/, ""),
13
14
  destinationPath: s ? l.endsWith("/") ? l : `${l}/` : l.replace(/\/$/, ""),
14
- overwrite: t.overwrite === !0,
15
+ overwrite: n.overwrite === !0,
15
16
  nodeType: s ? r.Folder : r.Item,
16
17
  name: u
17
18
  }
18
19
  };
19
20
  }), c = (r, s, c) => {
20
21
  let l = r.map((r) => {
21
- let i = r.nodeType === o.FOLDER, a = n(r.sourceUrl, c), s = n(r.destinationUrl, c), l = e(r.sourceUrl, a), u = e(r.destinationUrl, s), d = i ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, ""), f = i ? s.endsWith("/") ? s : `${s}/` : s.replace(/\/$/, "");
22
+ let i = r.nodeType === o.FOLDER, a = t(r.sourceUrl, c), s = t(r.destinationUrl, c), l = e(r.sourceUrl, a), u = e(r.destinationUrl, s), d = i ? a.endsWith("/") ? a : `${a}/` : a.replace(/\/$/, ""), f = i ? s.endsWith("/") ? s : `${s}/` : s.replace(/\/$/, "");
22
23
  return {
23
24
  isFolder: i,
24
25
  name: l,
@@ -26,8 +27,8 @@ var s = (t, i, a) => t.map((t) => {
26
27
  overwrite: r.overwrite === !0,
27
28
  sourcePath: d,
28
29
  destinationPath: f,
29
- sourceParent: t(d),
30
- destinationParent: t(f)
30
+ sourceParent: n(d),
31
+ destinationParent: n(f)
31
32
  };
32
33
  });
33
34
  return {
@@ -50,7 +50,7 @@ var o = (t) => {
50
50
  return o.some((e) => e.name.toLowerCase() === n.name.toLowerCase()) || o.push(s), a.set(t, o), a;
51
51
  }, u = (e, t, n) => {
52
52
  if (!e) return e;
53
- let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e, n) => n === t ? {
53
+ let r = typeof n == "string" ? { status: n } : n, i = e.files.map((e) => e.id === t ? {
54
54
  ...e,
55
55
  ...r
56
56
  } : e);
@@ -59,6 +59,7 @@ var o = (t) => {
59
59
  files: i
60
60
  };
61
61
  }, d = (e, t, r, a, o) => {
62
+ if (t === i.All) return Promise.reject(/* @__PURE__ */ Error("fetchByTab cannot list the All tab; list each section instead"));
62
63
  if (t === i.Shared) {
63
64
  if (a === "") return e.listSharedFiles({ path: void 0 }).then((e) => ({ items: e.items }));
64
65
  let t = a.indexOf("/"), r = t === -1 ? a : a.slice(0, t), i = o.get(r);