@epam/ai-dial-chat-hooks 1.1.0-dev.423 → 1.1.0-dev.430

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 (178) hide show
  1. package/{api-error-DuLNy43N.js → api-error/api-error.js} +1 -1
  2. package/api-transport/create-csrf-middleware.js +21 -0
  3. package/api-transport/create-unauthorized-middleware.js +41 -0
  4. package/attachment/useAttachmentAction/useAttachmentAction.js +74 -0
  5. package/attachment/useAttachmentValidation/useAttachmentValidation.js +35 -0
  6. package/attachments.js +3 -2
  7. package/catalog/catalog-derivations.js +10 -0
  8. package/catalog/catalog-primary-action.js +21 -0
  9. package/catalog/create-publish-api.js +27 -0
  10. package/catalog/deployment-endpoint-url.js +34 -0
  11. package/{deployment-id-CxWgJTs9.js → catalog/deployment-id.js} +1 -1
  12. package/catalog/entity-details.js +6 -0
  13. package/catalog/map-deployment-limits-to-catalog.js +73 -0
  14. package/catalog/map-deployment-limits-to-input.js +14 -0
  15. package/catalog/map-deployment-to-catalog-item.js +92 -0
  16. package/catalog/map-entity-details-to-catalog.js +350 -0
  17. package/catalog/map-prompt-to-catalog-item.js +49 -0
  18. package/catalog/map-skill-to-catalog-item.js +123 -0
  19. package/catalog/mcp-endpoint-url.js +26 -0
  20. package/catalog/publish.js +18 -0
  21. package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +109 -0
  22. package/catalog/useCatalogItemDetails.js +101 -0
  23. package/catalog/useCatalogToolsetCredentials/useCatalogToolsetCredentials.js +146 -0
  24. package/catalog/useFavoriteEntitiesState/useFavoriteEntitiesState.js +50 -0
  25. package/catalog/usePublishFolders/usePublishFolders.js +72 -0
  26. package/catalog.js +22 -3
  27. package/conversation/announcement-message.js +42 -0
  28. package/conversation/conversation-transfer/async.js +18 -0
  29. package/conversation/conversation-transfer/attachment-refs.js +11 -0
  30. package/conversation/conversation-transfer/build-upload-path.js +27 -0
  31. package/{date-BeuD8G79.js → conversation/conversation-transfer/date.js} +1 -1
  32. package/conversation/conversation-transfer/dial-file-resolve.js +18 -0
  33. package/conversation/conversation-transfer/export-conversation.js +32 -0
  34. package/conversation/conversation-transfer/import-conversation.js +93 -0
  35. package/conversation/conversation-transfer/progress.js +39 -0
  36. package/conversation/conversation-transfer/queue.js +84 -0
  37. package/conversation/conversation-transfer/types.js +9 -0
  38. package/conversation/conversation-transfer/zip-export.js +19 -0
  39. package/conversation/conversation-transfer/zip-import.js +29 -0
  40. package/conversation/create-chat-stream-api.js +96 -0
  41. package/conversation/deriveConversationRowActionState/deriveConversationRowActionState.js +14 -0
  42. package/conversation/display-name-watch.js +5 -0
  43. package/conversation/footer-message.js +23 -0
  44. package/conversation/get-model-id-from-conversation-id.js +14 -0
  45. package/conversation/greeting.js +7 -0
  46. package/conversation/message-factory.js +19 -0
  47. package/conversation/message-utils.js +13 -0
  48. package/conversation/overlay-messages.js +8 -0
  49. package/conversation/quick-app-conversation-starters.js +29 -0
  50. package/conversation/starter-option.js +27 -0
  51. package/conversation/useActiveConversationSync/useActiveConversationSync.js +19 -0
  52. package/conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js +39 -0
  53. package/conversation/useAttachmentUpload/useAttachmentUpload.js +33 -0
  54. package/conversation/useConversationExport/useConversationExport.js +285 -0
  55. package/conversation/useConversationHandlers/attachment-to-dto.js +13 -0
  56. package/conversation/useConversationHandlers/message-factory.js +21 -0
  57. package/conversation/useConversationHandlers/message-utils.js +8 -0
  58. package/conversation/useConversationHandlers/starter-option.js +11 -0
  59. package/conversation/useConversationHandlers/useConversationHandlers.js +263 -0
  60. package/conversation/useConversationImport/useConversationImport.js +239 -0
  61. package/conversation/useConversationLookupMaps/useConversationLookupMaps.js +11 -0
  62. package/conversation/useConversationPanelItems/useConversationPanelItems.js +35 -0
  63. package/{useConversationScroll-CliIMnjP.js → conversation/useConversationScroll/useConversationScroll.js} +1 -1
  64. package/conversation/useConversationStream/apply-chunk.js +78 -0
  65. package/conversation/useConversationStream/buffered-generation.js +18 -0
  66. package/conversation/useConversationStream/conversation-path.js +8 -0
  67. package/conversation/useConversationStream/generation-resume.js +126 -0
  68. package/conversation/useConversationStream/useConversationStream.js +148 -0
  69. package/conversation/useImportFilePicker/useImportFilePicker.js +20 -0
  70. package/conversation/useTranscribeAudio/audio-transcription-error.js +12 -0
  71. package/conversation/useTranscribeAudio/transcription-retry.js +38 -0
  72. package/conversation/useTranscribeAudio/useTranscribeAudio.js +41 -0
  73. package/{useConversationSources-DKaKvjXZ.js → conversation-sources/useConversationSources/useConversationSources.js} +1 -1
  74. package/conversation-sources.js +1 -1
  75. package/conversation-transfer.js +7 -3
  76. package/conversation.d.ts +66 -0
  77. package/conversation.js +31 -2
  78. package/file-manager.d.ts +3 -4
  79. package/file-manager.js +28 -3
  80. package/files/annotation.js +15 -0
  81. package/files/attachment-canvas.js +218 -0
  82. package/files/attachment-dto-to-display.js +15 -0
  83. package/files/attachment-types.js +16 -0
  84. package/files/create-files-api.js +40 -0
  85. package/files/create-upload-file-with-progress.js +42 -0
  86. package/files/dial-file-manager-copy-move.util.js +55 -0
  87. package/files/dial-file-manager-mapping.util.js +140 -0
  88. package/files/dial-file-manager-path.util.js +72 -0
  89. package/files/dial-file-manager.model.js +25 -0
  90. package/files/dial-file-manager.types.js +10 -0
  91. package/files/dial-file-to-attachment.js +37 -0
  92. package/files/dial-file.js +30 -0
  93. package/files/dial-files-api.js +6 -0
  94. package/files/download-destination.js +6 -0
  95. package/files/file-manager-variant.js +11 -0
  96. package/files/file-name.js +19 -0
  97. package/files/prepare-download-destination.js +24 -0
  98. package/files/resolve-dial-file-api-path.js +33 -0
  99. package/files/source-content.js +37 -0
  100. package/files/useDialFileListing/useDialFileListing.js +295 -0
  101. package/files/useDialFileManager/useDialFileManager.js +146 -0
  102. package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +23 -0
  103. package/files/useDialFileMetadata/useDialFileMetadata.js +42 -0
  104. package/files/useDialFileMutations/useDialFileMutations.js +359 -0
  105. package/files/useDialFileSharing/useDialFileSharing.js +70 -0
  106. package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +156 -0
  107. package/index.d.ts +69 -4
  108. package/index.js +134 -28
  109. package/mcp-apps/mcp-apps-api-client.js +48 -0
  110. package/mcp-apps/useMcpAppHostAdapter/useMcpAppHostAdapter.js +26 -0
  111. package/mcp-apps/useMcpAppHostContext/useMcpAppHostContext.js +26 -0
  112. package/mcp-apps/useMcpAppTools/useMcpAppTools.js +71 -0
  113. package/mcp-apps/useOpenMcpAppCanvas/useOpenMcpAppCanvas.js +58 -0
  114. package/mcp-apps.js +6 -2
  115. package/oauth/authorize-url.js +12 -0
  116. package/oauth/handshake.js +65 -0
  117. package/oauth/popup.js +29 -0
  118. package/oauth/toolset-id.js +10 -0
  119. package/oauth/types.js +24 -0
  120. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.js +94 -0
  121. package/oauth/useToolsetLogin/useToolsetLogin.js +73 -0
  122. package/oauth.js +9 -3
  123. package/package.json +35 -23
  124. package/prompt/export-prompt.js +28 -0
  125. package/prompt/prompt-resource.js +15 -0
  126. package/prompt/prompt.js +12 -0
  127. package/prompt/usePromptsState/usePromptsState.js +42 -0
  128. package/scheduled-task/scheduled-task-mapping.js +6 -0
  129. package/{scheduled-task-trigger-D9RZCk52.js → scheduled-task/scheduled-task-trigger.js} +39 -40
  130. package/scheduled-tasks.js +3 -2
  131. package/scroll-anchoring.js +1 -1
  132. package/shared/application-schema.js +4 -0
  133. package/shared/browser-timezone.js +10 -0
  134. package/{cron-weekday-B4w29eAC.js → shared/cron-weekday.js} +1 -1
  135. package/shared/custom-apps.js +30 -0
  136. package/shared/external-services.js +18 -0
  137. package/{formatting-CZyyxBG3.js → shared/formatting.js} +1 -1
  138. package/{prompt-resource-Bt1I-8ri.js → shared/locale.js} +2 -13
  139. package/{string-utils-iBi2Y55C.js → shared/string-utils.js} +1 -1
  140. package/shared/toolset-login-events.js +13 -0
  141. package/sharing.js +3 -3
  142. package/skill/skill-file-batch-validation.js +48 -0
  143. package/skill/skill-file-preview.js +15 -0
  144. package/skill/skill-manifest.js +70 -0
  145. package/skill/skill-types.js +15 -0
  146. package/skill/skill.js +48 -0
  147. package/skill/useSkillEditorLoad.js +103 -0
  148. package/skill/useSkillEditorSubmit.js +135 -0
  149. package/skill/useSkillFileActions.js +99 -0
  150. package/skill/useSkillFilePreview.js +29 -0
  151. package/{useSkillsState-BoLlwmzb.js → skill/useSkillsState/useSkillsState.js} +1 -1
  152. package/skill-editor.js +8 -3
  153. package/skills-state.js +1 -1
  154. package/source-content.d.ts +29 -0
  155. package/source-content.js +2 -0
  156. package/usage/useUsageData/useUsageData.js +32 -0
  157. package/useChatSettingsFormConfig/useChatSettingsFormConfig.js +74 -0
  158. package/{usePanelMaxWidth-BEZYuqF9.js → usePageFileDrag/usePageFileDrag.js} +1 -11
  159. package/usePanelMaxWidth/usePanelMaxWidth.js +8 -0
  160. package/{useShareLink-xkiaxATt.js → useShareLink/useShareLink.js} +1 -1
  161. package/{useShareRecipientsCount-BgwCLKY0.js → useShareRecipientsCount/useShareRecipientsCount.js} +1 -1
  162. package/useToolsMenu/useToolsMenu.js +50 -0
  163. package/useViewportWidth/useViewportWidth.js +12 -0
  164. package/utils.js +17 -7
  165. package/viewport-layout.js +4 -2
  166. package/attachment-types-AAoN9E95.js +0 -7760
  167. package/browser-Btsa0Lmr.js +0 -607
  168. package/skill-manifest-CeG6-WSK.js +0 -4056
  169. package/useAttachmentValidation-CkMTd5lA.js +0 -102
  170. package/useConversationImport-CDRs7JF1.js +0 -826
  171. package/useDialFileManagerTabConfig-CjI46lMo.js +0 -2291
  172. package/useOAuthCallbackCompletion-CvyTKLER.js +0 -93
  173. package/useOpenMcpAppCanvas-C7-AMseH.js +0 -207
  174. package/useSkillFileActions-B-VaGD20.js +0 -373
  175. package/useSkillFilePreview-B5o1n_0F.js +0 -1244
  176. package/useToolsMenu-zURpMEn1.js +0 -1882
  177. package/useToolsetLogin-B05m134e.js +0 -195
  178. package/useUsageData-D7BxloKZ.js +0 -201
@@ -0,0 +1,12 @@
1
+ //#region src/conversation/useTranscribeAudio/audio-transcription-error.ts
2
+ var e = /* @__PURE__ */ function(e) {
3
+ return e.Unavailable = "unavailable", e.TooLarge = "tooLarge", e.Busy = "busy", e.Failed = "failed", e;
4
+ }({}), t = class extends Error {
5
+ reason;
6
+ limitBytes;
7
+ constructor(e, t) {
8
+ super(e), this.name = "AudioTranscriptionError", this.reason = e, this.limitBytes = t;
9
+ }
10
+ };
11
+ //#endregion
12
+ export { t as AudioTranscriptionError, e as AudioTranscriptionErrorReason };
@@ -0,0 +1,38 @@
1
+ import { AudioTranscriptionError as e, AudioTranscriptionErrorReason as t } from "./audio-transcription-error.js";
2
+ //#region src/conversation/useTranscribeAudio/transcription-retry.ts
3
+ var n = 2, r = 9e4, i = (e, t) => (t.throwIfAborted(), new Promise((n, r) => {
4
+ let i = () => {
5
+ clearTimeout(a), r(t.reason);
6
+ }, a = setTimeout(() => {
7
+ t.removeEventListener("abort", i), n();
8
+ }, e);
9
+ t.addEventListener("abort", i, { once: !0 });
10
+ })), a = (e) => {
11
+ if (!e?.trim()) return;
12
+ let t = Number(e);
13
+ if (Number.isFinite(t)) return t >= 0 ? t * 1e3 : void 0;
14
+ let n = Date.parse(e);
15
+ return Number.isFinite(n) ? Math.max(0, n - Date.now()) : void 0;
16
+ }, o = async (o, s) => {
17
+ let c = 0;
18
+ for (let l = 0;; l++) {
19
+ s.throwIfAborted();
20
+ try {
21
+ return await o();
22
+ } catch (o) {
23
+ s.throwIfAborted();
24
+ let u = typeof o == "object" && o && "response" in o ? o.response : void 0;
25
+ if (!(u instanceof Response) || ![
26
+ 429,
27
+ 502,
28
+ 503,
29
+ 504
30
+ ].includes(u.status)) throw o;
31
+ let d = [429, 503].includes(u.status) ? 3e4 : 2e3, f = Math.max(1e3, a(u.headers.get("retry-after")) ?? d * 2 ** l);
32
+ if (l >= n || c + f > r) throw new e(t.Busy);
33
+ c += f, await i(f, s);
34
+ }
35
+ }
36
+ };
37
+ //#endregion
38
+ export { o as withTranscriptionRetry };
@@ -0,0 +1,41 @@
1
+ import { AudioTranscriptionError as e, AudioTranscriptionErrorReason as t } from "./audio-transcription-error.js";
2
+ import { withTranscriptionRetry as n } from "./transcription-retry.js";
3
+ import { useCallback as r } from "react";
4
+ //#region src/conversation/useTranscribeAudio/useTranscribeAudio.ts
5
+ var i = ({ transcriptionApi: i, filesApi: a, transcribeWithDeployment: o, bucket: s, asrModelId: c, selectedDeploymentId: l, maxSizeBytes: u }) => ({ transcribeAudio: r(async (r, d) => {
6
+ if (d.throwIfAborted(), !s || !c && !l) throw new e(t.Unavailable);
7
+ if (r.size > u) throw new e(t.TooLarge, u);
8
+ try {
9
+ let u = `uploads/${(/* @__PURE__ */ new Date()).toISOString().slice(0, 7)}/${encodeURIComponent(r.name)}`, { url: f } = await a.uploadFile({
10
+ bucket: s,
11
+ path: u,
12
+ file: r
13
+ }, { signal: d });
14
+ if (d.throwIfAborted(), c) {
15
+ if (!i) throw new e(t.Unavailable);
16
+ return await n(async () => (await i.transcribeAudio({ transcribeAudioDto: {
17
+ audioUrl: f,
18
+ mimeType: r.type
19
+ } }, { signal: d })).transcript ?? "", d);
20
+ }
21
+ if (!l || !o) throw new e(t.Unavailable);
22
+ return await n(() => o({
23
+ audioUrl: f,
24
+ mimeType: r.type,
25
+ deployment: l,
26
+ signal: d
27
+ }), d);
28
+ } catch (n) {
29
+ throw d.aborted || n instanceof e ? n : new e(t.Failed);
30
+ }
31
+ }, [
32
+ s,
33
+ c,
34
+ l,
35
+ u,
36
+ a,
37
+ i,
38
+ o
39
+ ]) });
40
+ //#endregion
41
+ export { i as useTranscribeAudio };
@@ -44,4 +44,4 @@ var a = {}, o = (o, s = a) => i(() => {
44
44
  };
45
45
  }, [o, s]);
46
46
  //#endregion
47
- export { o as t };
47
+ export { o as useConversationSources };
@@ -1,2 +1,2 @@
1
- import { t as e } from "./useConversationSources-DKaKvjXZ.js";
1
+ import { useConversationSources as e } from "./conversation-sources/useConversationSources/useConversationSources.js";
2
2
  export { e as useConversationSources };
@@ -1,3 +1,7 @@
1
- import { n as e, t } from "./date-BeuD8G79.js";
2
- import { a as n, c as r, i, l as a, n as o, o as s, r as c, s as l, t as u } from "./useConversationImport-CDRs7JF1.js";
3
- export { s as ConversationExportMode, l as ConversationTransferErrorCode, r as ConversationTransferWarningCode, o as DEFAULT_MAX_ARCHIVE_BYTES, n as EXPORT_APP_NAME, a as ExportFileNameKind, t as formatDateYM, e as formatDateYMD, i as formatQuotedNameList, c as useConversationExport, u as useConversationImport };
1
+ import { formatDateYM as e, formatDateYMD as t } from "./conversation/conversation-transfer/date.js";
2
+ import { ConversationExportMode as n, ConversationTransferErrorCode as r, ConversationTransferWarningCode as i, ExportFileNameKind as a } from "./conversation/conversation-transfer/types.js";
3
+ import { EXPORT_APP_NAME as o } from "./conversation/conversation-transfer/export-conversation.js";
4
+ import { formatQuotedNameList as s } from "./conversation/conversation-transfer/import-conversation.js";
5
+ import { DEFAULT_MAX_ARCHIVE_BYTES as c, useConversationExport as l } from "./conversation/useConversationExport/useConversationExport.js";
6
+ import { useConversationImport as u } from "./conversation/useConversationImport/useConversationImport.js";
7
+ export { n as ConversationExportMode, r as ConversationTransferErrorCode, i as ConversationTransferWarningCode, c as DEFAULT_MAX_ARCHIVE_BYTES, o as EXPORT_APP_NAME, a as ExportFileNameKind, e as formatDateYM, t as formatDateYMD, s as formatQuotedNameList, l as useConversationExport, u as useConversationImport };
package/conversation.d.ts CHANGED
@@ -27,6 +27,7 @@ import { StarterOption } from '@epam/ai-dial-chat-shared';
27
27
  import { StatusMessage } from '@epam/ai-dial-chat-shared';
28
28
  import { StreamChunk } from '@epam/ai-dial-chat-shared';
29
29
  import { ToolMenuItem } from '@epam/ai-dial-chat-shared';
30
+ import { TranscriptionApi } from '@epam/ai-dial-chat-api-client';
30
31
 
31
32
  /** Structured announcement banner content. */
32
33
  export declare interface AnnouncementContent {
@@ -78,6 +79,26 @@ export declare const attachmentsToDtos: (attachments: Attachment[]) => Attachmen
78
79
  /** Maps an already-uploaded attachment to its DTO shape. Throws if the attachment has no `url` yet. */
79
80
  export declare const attachmentToDto: (attachment: Attachment) => AttachmentDto;
80
81
 
82
+ /** Thrown by `transcribeAudio`; carries a machine-readable `reason` instead of translated text. */
83
+ export declare class AudioTranscriptionError extends Error {
84
+ readonly reason: AudioTranscriptionErrorReason;
85
+ /** The size limit that was exceeded, present only when `reason` is `TooLarge`. */
86
+ readonly limitBytes?: number;
87
+ constructor(reason: AudioTranscriptionErrorReason, limitBytes?: number);
88
+ }
89
+
90
+ /** Reason a {@link useTranscribeAudio} call failed, translation-free — the host maps it to text. */
91
+ export declare enum AudioTranscriptionErrorReason {
92
+ /** No usable ASR model or deployment is configured for the current bucket. */
93
+ Unavailable = "unavailable",
94
+ /** The recording exceeds the caller's configured size limit. */
95
+ TooLarge = "tooLarge",
96
+ /** The upstream ASR provider stayed rate-limited or unavailable after retrying. */
97
+ Busy = "busy",
98
+ /** Recognition failed for any other reason. */
99
+ Failed = "failed"
100
+ }
101
+
81
102
  /**
82
103
  * Builds the value persisted under `StorageKey.TextOfClosedAnnouncement` when
83
104
  * the user dismisses the banner. Dismissal is content-keyed: the banner stays
@@ -554,6 +575,14 @@ export declare interface StreamCompletionOptions {
554
575
  /** Maps chat messages to the DIAL Chat Overlay protocol's message shape. */
555
576
  export declare const toOverlayMessages: (messages: Message[]) => OverlayChatMessage[];
556
577
 
578
+ /** Request shape the host's selected-deployment recognition call accepts. */
579
+ export declare interface TranscribeWithDeploymentParams {
580
+ audioUrl: string;
581
+ mimeType: string;
582
+ deployment: string;
583
+ signal: AbortSignal;
584
+ }
585
+
557
586
  /**
558
587
  * Synchronises the active conversation with the conversation list and returns
559
588
  * the panel-space id of the active conversation, or `undefined` when none is active.
@@ -906,4 +935,41 @@ export declare type UseToolsMenuResult = {
906
935
  restoreToolConfiguration: (configurationValue: Record<string, unknown> | undefined) => void;
907
936
  };
908
937
 
938
+ /**
939
+ * Uploads a complete voice recording to DIAL Core storage and recognizes it,
940
+ * preferring the configured ASR model and falling back to the selected
941
+ * deployment. Retries transient upstream failures. Error text is not this
942
+ * library's concern — callers translate `AudioTranscriptionErrorReason` at
943
+ * the call site.
944
+ */
945
+ export declare const useTranscribeAudio: ({ transcriptionApi, filesApi, transcribeWithDeployment, bucket, asrModelId, selectedDeploymentId, maxSizeBytes, }: UseTranscribeAudioParams) => UseTranscribeAudioResult;
946
+
947
+ /** Parameters for {@link useTranscribeAudio}. */
948
+ export declare interface UseTranscribeAudioParams {
949
+ /** Already-configured generated-client instance used for the ASR-model path. */
950
+ transcriptionApi?: Pick<TranscriptionApi, 'transcribeAudio'>;
951
+ /** Already-configured generated-client instance used to upload the recording. */
952
+ filesApi: Pick<FilesApi, 'uploadFile'>;
953
+ /**
954
+ * Host-configured call for the selected-deployment path. The generated
955
+ * chat-completions client cannot express this endpoint's `custom_content`
956
+ * request shape, so the host supplies its own raw request.
957
+ */
958
+ transcribeWithDeployment?: (params: TranscribeWithDeploymentParams) => Promise<string>;
959
+ /** DIAL Core bucket the recording is uploaded into. */
960
+ bucket: string | undefined | null;
961
+ /** Recognizes via `transcriptionApi` when set; otherwise `selectedDeploymentId` is used. */
962
+ asrModelId?: string;
963
+ /** Deployment id used for recognition when `asrModelId` is not set. */
964
+ selectedDeploymentId?: string | null;
965
+ /** Recordings larger than this are rejected with `TooLarge` before upload. */
966
+ maxSizeBytes: number;
967
+ }
968
+
969
+ /** Return value of {@link useTranscribeAudio}. */
970
+ export declare interface UseTranscribeAudioResult {
971
+ /** Uploads and recognizes one complete recording; rejects with an {@link AudioTranscriptionError}. */
972
+ transcribeAudio: (file: File, signal: AbortSignal) => Promise<string>;
973
+ }
974
+
909
975
  export { }
package/conversation.js CHANGED
@@ -1,2 +1,31 @@
1
- import { A as e, B as t, C as n, D as r, E as i, F as a, H as o, I as s, L as c, M as l, N as u, O as d, P as f, R as p, S as m, T as h, V as g, _, a as v, b as y, c as b, d as x, f as S, g as C, h as w, i as T, j as E, k as D, l as O, m as k, n as A, o as j, p as M, r as N, s as P, t as F, u as I, v as L, w as R, x as z, y as B, z as V } from "./useToolsMenu-zURpMEn1.js";
2
- export { S as attachmentToDto, M as attachmentsToDtos, p as buildAnnouncementSignature, c as createChatStreamApi, E as createDeploymentChangedMessage, x as createMessagePair, z as deriveConversationRowActionState, f as formatAppVersion, j as getConversationPath, C as getConversationSource, i as getLastDeploymentId, r as getLastUserMessageToolConfiguration, u as getModelIdFromConversationId, R as getQuickAppConversationStarters, P as getStarterConversationText, m as getStarterPopulateText, b as getStarterSubmitText, n as getStartersFromSchema, l as getTimeOfDayGreeting, O as hasActiveToolConfig, V as hasAnnouncementContent, t as hasStructuredAnnouncement, T as isAwaitingGenerationResume, I as isMessageChanged, d as isMessageStreaming, D as messageHasStages, e as normalizeResponseFormat, g as sanitizeAnnouncementHtml, o as sanitizeAnnouncementMessageHtml, a as sanitizeFooterHtml, s as shouldWatchForDisplayNameUpdate, h as toOverlayMessages, y as useActiveConversationSync, B as useAsyncConfirmDialog, k as useAttachmentUpload, A as useChatSettingsFormConfig, v as useConversationHandlers, L as useConversationLookupMaps, _ as useConversationPanelItems, N as useConversationStream, w as useImportFilePicker, F as useToolsMenu };
1
+ import { buildAnnouncementSignature as e, hasAnnouncementContent as t, hasStructuredAnnouncement as n, sanitizeAnnouncementHtml as r, sanitizeAnnouncementMessageHtml as i } from "./conversation/announcement-message.js";
2
+ import { createChatStreamApi as a } from "./conversation/create-chat-stream-api.js";
3
+ import { shouldWatchForDisplayNameUpdate as o } from "./conversation/display-name-watch.js";
4
+ import { formatAppVersion as s, sanitizeFooterHtml as c } from "./conversation/footer-message.js";
5
+ import { getModelIdFromConversationId as l } from "./conversation/get-model-id-from-conversation-id.js";
6
+ import { getTimeOfDayGreeting as u } from "./conversation/greeting.js";
7
+ import { createDeploymentChangedMessage as d } from "./conversation/message-factory.js";
8
+ import { getLastDeploymentId as f, getLastUserMessageToolConfiguration as p, isMessageStreaming as m, messageHasStages as h, normalizeResponseFormat as g } from "./conversation/message-utils.js";
9
+ import { toOverlayMessages as _ } from "./conversation/overlay-messages.js";
10
+ import { getQuickAppConversationStarters as v } from "./conversation/quick-app-conversation-starters.js";
11
+ import { getStarterPopulateText as y, getStartersFromSchema as b } from "./conversation/starter-option.js";
12
+ import { deriveConversationRowActionState as x } from "./conversation/deriveConversationRowActionState/deriveConversationRowActionState.js";
13
+ import { useActiveConversationSync as S } from "./conversation/useActiveConversationSync/useActiveConversationSync.js";
14
+ import { useAsyncConfirmDialog as C } from "./conversation/useAsyncConfirmDialog/useAsyncConfirmDialog.js";
15
+ import { useConversationLookupMaps as w } from "./conversation/useConversationLookupMaps/useConversationLookupMaps.js";
16
+ import { getConversationSource as T, useConversationPanelItems as E } from "./conversation/useConversationPanelItems/useConversationPanelItems.js";
17
+ import { useImportFilePicker as D } from "./conversation/useImportFilePicker/useImportFilePicker.js";
18
+ import { useAttachmentUpload as O } from "./conversation/useAttachmentUpload/useAttachmentUpload.js";
19
+ import { AudioTranscriptionError as k, AudioTranscriptionErrorReason as A } from "./conversation/useTranscribeAudio/audio-transcription-error.js";
20
+ import { useTranscribeAudio as j } from "./conversation/useTranscribeAudio/useTranscribeAudio.js";
21
+ import { attachmentToDto as M, attachmentsToDtos as N } from "./conversation/useConversationHandlers/attachment-to-dto.js";
22
+ import { createMessagePair as P } from "./conversation/useConversationHandlers/message-factory.js";
23
+ import { hasActiveToolConfig as F, isMessageChanged as I } from "./conversation/useConversationHandlers/message-utils.js";
24
+ import { getStarterConversationText as L, getStarterSubmitText as R } from "./conversation/useConversationHandlers/starter-option.js";
25
+ import { getConversationPath as z } from "./conversation/useConversationStream/conversation-path.js";
26
+ import { useConversationHandlers as B } from "./conversation/useConversationHandlers/useConversationHandlers.js";
27
+ import { isAwaitingGenerationResume as V } from "./conversation/useConversationStream/generation-resume.js";
28
+ import { useConversationStream as H } from "./conversation/useConversationStream/useConversationStream.js";
29
+ import { useChatSettingsFormConfig as U } from "./useChatSettingsFormConfig/useChatSettingsFormConfig.js";
30
+ import { useToolsMenu as W } from "./useToolsMenu/useToolsMenu.js";
31
+ export { k as AudioTranscriptionError, A as AudioTranscriptionErrorReason, M as attachmentToDto, N as attachmentsToDtos, e as buildAnnouncementSignature, a as createChatStreamApi, d as createDeploymentChangedMessage, P as createMessagePair, x as deriveConversationRowActionState, s as formatAppVersion, z as getConversationPath, T as getConversationSource, f as getLastDeploymentId, p as getLastUserMessageToolConfiguration, l as getModelIdFromConversationId, v as getQuickAppConversationStarters, L as getStarterConversationText, y as getStarterPopulateText, R as getStarterSubmitText, b as getStartersFromSchema, u as getTimeOfDayGreeting, F as hasActiveToolConfig, t as hasAnnouncementContent, n as hasStructuredAnnouncement, V as isAwaitingGenerationResume, I as isMessageChanged, m as isMessageStreaming, h as messageHasStages, g as normalizeResponseFormat, r as sanitizeAnnouncementHtml, i as sanitizeAnnouncementMessageHtml, c as sanitizeFooterHtml, o as shouldWatchForDisplayNameUpdate, _ as toOverlayMessages, S as useActiveConversationSync, C as useAsyncConfirmDialog, O as useAttachmentUpload, U as useChatSettingsFormConfig, B as useConversationHandlers, w as useConversationLookupMaps, E as useConversationPanelItems, H as useConversationStream, D as useImportFilePicker, W as useToolsMenu, j as useTranscribeAudio };
package/file-manager.d.ts CHANGED
@@ -766,10 +766,9 @@ declare type ResolveDownloadUrl = (fileId: string) => string | undefined;
766
766
  /**
767
767
  * Returns the content type to trust for an external citation source: `contentType`
768
768
  * unchanged when it is already an image/audio/PDF/document-renderer marker,
769
- * otherwise the type implied by `url`'s path extension (`MIMEType.PDF` for
770
- * `.pdf`, the
771
- * canonical MIME for `.docx`/`.xlsx`/`.pptx`/`.csv`) when that extension is
772
- * recognized, otherwise `contentType` unchanged.
769
+ * otherwise the type implied by `url`'s path extension (`application/pdf` for
770
+ * `.pdf`, the canonical MIME for `.docx`/`.xlsx`/`.pptx`/`.csv`) when that
771
+ * extension is recognized, otherwise `contentType` unchanged.
773
772
  *
774
773
  * Web-search grounding APIs label every reference — PDFs and Office documents
775
774
  * included — as `text/markdown`, so a mislabeled `contentType` must not win
package/file-manager.js CHANGED
@@ -1,4 +1,29 @@
1
- import { a as e, i as t, n, o as r, r as i, s as a, t as o } from "./attachment-types-AAoN9E95.js";
2
- import { $ as s, A as c, B as l, C as u, Ct as d, D as f, E as p, F as m, G as h, H as g, I as _, J as v, K as y, L as b, M as x, N as S, O as C, P as w, Q as T, R as E, S as D, St as O, T as k, U as A, V as j, W as M, X as N, Y as P, Z as F, _ as I, _t as L, a as R, at as z, b as B, bt as V, c as H, ct as U, d as W, dt as G, et as K, f as q, ft as J, g as Y, gt as X, h as Z, ht as Q, i as $, it as ee, j as te, k as ne, l as re, lt as ie, m as ae, mt as oe, n as se, nt as ce, o as le, ot as ue, p as de, pt as fe, q as pe, r as me, rt as he, s as ge, st as _e, t as ve, tt as ye, u as be, ut as xe, v as Se, vt as Ce, w as we, wt as Te, x as Ee, xt as De, y as Oe, yt as ke, z as Ae } from "./useDialFileManagerTabConfig-CjI46lMo.js";
1
+ import { isDialFileId as e, resolveDialFileBucketAndPath as t, resolveRelativeDialFilePath as n } from "./files/dial-file.js";
2
+ import { isDialFileAcceptType as r, mimeTypesToAttachmentExtensionLabels as i, mimeTypesToDialFileAcceptTypes as a, mimeTypesToFileAccept as o } from "./files/attachment-types.js";
3
+ import { DialFilesApiUploadMode as s } from "./files/dial-files-api.js";
4
+ import { FileManagerNotificationReason as c, FileNameValidationErrorReason as l, FileOperationKind as u } from "./files/dial-file-manager.types.js";
5
+ import { COLUMNS_WITHOUT_AUTHOR as d, COLUMNS_WITH_AUTHOR as f, CORE_PERMISSION_MAP as p, DATE_OPTIONS as m, PATH_SEPARATOR_REGEXP as h, RESERVED_MARKER_NAME as g, UPLOAD_CONCURRENCY as _ } from "./files/dial-file-manager.model.js";
6
+ import { DialFileManagerActionProfile as v, DialFileManagerVariant as y, deriveActionProfile as b } from "./files/file-manager-variant.js";
7
+ import { buildSharedItemVirtualPath as x, dialCorePathToRelative as S, findDialFileByPath as C, findFolderByVirtualPath as w, formatOperationFolderName as T, getVirtualPathName as E, hasDialFileWritePermission as D, hasForbiddenNameSymbols as O, isCopyMoveDuplicateAllowed as k, isShareActionsAllowed as A, normalizeVirtualPath as j, parseNewFolderVirtualPath as M, resolveOwnerCoords as N } from "./files/dial-file-manager-path.util.js";
8
+ import { getParentFolderPath as P, resolveDialFileApiPath as F, virtualPathToApiPath as I } from "./files/resolve-dial-file-api-path.js";
9
+ import { prepareCopyItems as L, prepareMoveRenameItems as R } from "./files/dial-file-manager-copy-move.util.js";
10
+ import { buildFromCache as z, fetchByTab as B, fetchForSearch as V, findFirstSuccessfulCopyMoveItem as H, mapCorePermissions as U, mapFileMetadataToDialFile as W, mapSearchItem as G, mergeCreatedFolderIntoCache as K, updateEntry as q } from "./files/dial-file-manager-mapping.util.js";
11
+ import { createFilesApiClient as J } from "./files/create-files-api.js";
12
+ import { createUploadFileWithProgress as Y } from "./files/create-upload-file-with-progress.js";
13
+ import { openAnnotationAttachment as X } from "./files/annotation.js";
14
+ import { annotationToPdfCanvasContent as Z, clearAttachmentCache as Q, hasAttachmentTextSource as $, referenceAttachmentToPdfCanvasContent as ee, resolveCodeCanvasContent as te, resolveHtmlCanvasContent as ne, resolveImageCanvasContent as re, resolveJsonCanvasContent as ie, resolveMarkdownCanvasContent as ae, resolveOoxmlCanvasContent as oe, resolvePdfCanvasContent as se, resolveTextCanvasContent as ce, resolveVisualizerCanvasContent as le } from "./files/attachment-canvas.js";
15
+ import { getUrlFileName as ue, isExternalSourcePreviewable as de, resolveExternalSourceContentType as fe } from "./files/source-content.js";
16
+ import { annotationToDisplayAttachment as pe, attachmentDtoToDisplayAttachment as me, attachmentDtosToDisplayAttachments as he } from "./files/attachment-dto-to-display.js";
17
+ import { dialFileToAttachment as ge, dialFilesToAttachments as _e, dialFolderPathToAttachment as ve } from "./files/dial-file-to-attachment.js";
18
+ import { DownloadDestinationType as ye } from "./files/download-destination.js";
19
+ import { prepareDownloadDestination as be } from "./files/prepare-download-destination.js";
20
+ import { sanitizeFileName as xe, splitFileNameExtension as Se, trimFileNameToByteLimit as Ce } from "./files/file-name.js";
21
+ import { useDialFileListing as we } from "./files/useDialFileListing/useDialFileListing.js";
22
+ import { useDialFileMetadata as Te } from "./files/useDialFileMetadata/useDialFileMetadata.js";
23
+ import { useDialFileMutations as Ee } from "./files/useDialFileMutations/useDialFileMutations.js";
24
+ import { useDialFileSharing as De } from "./files/useDialFileSharing/useDialFileSharing.js";
25
+ import { useDialFileUploadBatch as Oe } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
26
+ import { useDialFileManager as ke } from "./files/useDialFileManager/useDialFileManager.js";
27
+ import { useDialFileManagerTabConfig as Ae } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
3
28
  import { useGridEditingScroll as je } from "@epam/ai-dial-chat-shared";
4
- export { oe as COLUMNS_WITHOUT_AUTHOR, Q as COLUMNS_WITH_AUTHOR, X as CORE_PERMISSION_MAP, L as DATE_OPTIONS, G as DialFileManagerActionProfile, J as DialFileManagerVariant, Te as DialFilesApiUploadMode, q as DownloadDestinationType, De as FileManagerNotificationReason, O as FileNameValidationErrorReason, d as FileOperationKind, Ce as PATH_SEPARATOR_REGEXP, ke as RESERVED_MARKER_NAME, V as UPLOAD_CONCURRENCY, Y as annotationToDisplayAttachment, Oe as annotationToPdfCanvasContent, I as attachmentDtoToDisplayAttachment, Se as attachmentDtosToDisplayAttachments, E as buildFromCache, T as buildSharedItemVirtualPath, B as clearAttachmentCache, b as createFilesApiClient, _ as createUploadFileWithProgress, fe as deriveActionProfile, s as dialCorePathToRelative, de as dialFileToAttachment, ae as dialFilesToAttachments, Z as dialFolderPathToAttachment, Ae as fetchByTab, l as fetchForSearch, K as findDialFileByPath, j as findFirstSuccessfulCopyMoveItem, ye as findFolderByVirtualPath, ce as formatOperationFolderName, P as getParentFolderPath, Ee as getUrlFileName, he as getVirtualPathName, D as hasAttachmentTextSource, ee as hasDialFileWritePermission, z as hasForbiddenNameSymbols, ue as isCopyMoveDuplicateAllowed, o as isDialFileAcceptType, e as isDialFileId, u as isExternalSourcePreviewable, _e as isShareActionsAllowed, g as mapCorePermissions, A as mapFileMetadataToDialFile, M as mapSearchItem, h as mergeCreatedFolderIntoCache, n as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, t as mimeTypesToFileAccept, U as normalizeVirtualPath, m as openAnnotationAttachment, ie as parseNewFolderVirtualPath, pe as prepareCopyItems, W as prepareDownloadDestination, v as prepareMoveRenameItems, we as referenceAttachmentToPdfCanvasContent, k as resolveCodeCanvasContent, N as resolveDialFileApiPath, r as resolveDialFileBucketAndPath, p as resolveExternalSourceContentType, f as resolveHtmlCanvasContent, C as resolveImageCanvasContent, ne as resolveJsonCanvasContent, c as resolveMarkdownCanvasContent, te as resolveOoxmlCanvasContent, xe as resolveOwnerCoords, x as resolvePdfCanvasContent, a as resolveRelativeDialFilePath, S as resolveTextCanvasContent, w as resolveVisualizerCanvasContent, H as sanitizeFileName, re as splitFileNameExtension, be as trimFileNameToByteLimit, y as updateEntry, ge as useDialFileListing, se as useDialFileManager, ve as useDialFileManagerTabConfig, le as useDialFileMetadata, R as useDialFileMutations, $ as useDialFileSharing, me as useDialFileUploadBatch, je as useGridEditingScroll, F as virtualPathToApiPath };
29
+ export { d as COLUMNS_WITHOUT_AUTHOR, f as COLUMNS_WITH_AUTHOR, p as CORE_PERMISSION_MAP, m as DATE_OPTIONS, v as DialFileManagerActionProfile, y as DialFileManagerVariant, s as DialFilesApiUploadMode, ye as DownloadDestinationType, c as FileManagerNotificationReason, l as FileNameValidationErrorReason, u as FileOperationKind, h as PATH_SEPARATOR_REGEXP, g as RESERVED_MARKER_NAME, _ as UPLOAD_CONCURRENCY, pe as annotationToDisplayAttachment, Z as annotationToPdfCanvasContent, me as attachmentDtoToDisplayAttachment, he as attachmentDtosToDisplayAttachments, z as buildFromCache, x as buildSharedItemVirtualPath, Q as clearAttachmentCache, J as createFilesApiClient, Y as createUploadFileWithProgress, b as deriveActionProfile, S as dialCorePathToRelative, ge as dialFileToAttachment, _e as dialFilesToAttachments, ve as dialFolderPathToAttachment, B as fetchByTab, V as fetchForSearch, C as findDialFileByPath, H as findFirstSuccessfulCopyMoveItem, w as findFolderByVirtualPath, T as formatOperationFolderName, P as getParentFolderPath, ue as getUrlFileName, E as getVirtualPathName, $ as hasAttachmentTextSource, D as hasDialFileWritePermission, O as hasForbiddenNameSymbols, k as isCopyMoveDuplicateAllowed, r as isDialFileAcceptType, e as isDialFileId, de as isExternalSourcePreviewable, A as isShareActionsAllowed, U as mapCorePermissions, W as mapFileMetadataToDialFile, G as mapSearchItem, K as mergeCreatedFolderIntoCache, i as mimeTypesToAttachmentExtensionLabels, a as mimeTypesToDialFileAcceptTypes, o as mimeTypesToFileAccept, j as normalizeVirtualPath, X as openAnnotationAttachment, M as parseNewFolderVirtualPath, L as prepareCopyItems, be as prepareDownloadDestination, R as prepareMoveRenameItems, ee as referenceAttachmentToPdfCanvasContent, te as resolveCodeCanvasContent, F as resolveDialFileApiPath, t as resolveDialFileBucketAndPath, fe as resolveExternalSourceContentType, ne as resolveHtmlCanvasContent, re as resolveImageCanvasContent, ie as resolveJsonCanvasContent, ae as resolveMarkdownCanvasContent, oe as resolveOoxmlCanvasContent, N as resolveOwnerCoords, se as resolvePdfCanvasContent, n as resolveRelativeDialFilePath, ce as resolveTextCanvasContent, le as resolveVisualizerCanvasContent, xe as sanitizeFileName, Se as splitFileNameExtension, Ce as trimFileNameToByteLimit, q as updateEntry, we as useDialFileListing, ke as useDialFileManager, Ae as useDialFileManagerTabConfig, Te as useDialFileMetadata, Ee as useDialFileMutations, De as useDialFileSharing, Oe as useDialFileUploadBatch, je as useGridEditingScroll, I as virtualPathToApiPath };
@@ -0,0 +1,15 @@
1
+ import { isDialFileId as e } from "./dial-file.js";
2
+ import { triggerAnchorDownload as t } from "@epam/ai-dial-chat-shared";
3
+ //#region src/files/annotation.ts
4
+ var n = (n, r) => {
5
+ let { url: i } = n;
6
+ if (i == null) return;
7
+ let a = i.split("#")[0];
8
+ if (e(a)) {
9
+ let e = r(a);
10
+ if (e == null) return;
11
+ t(e, n.title ?? a.split("/").pop() ?? "");
12
+ } else window.open(i, "_blank", "noopener,noreferrer");
13
+ };
14
+ //#endregion
15
+ export { n as openAnnotationAttachment };
@@ -0,0 +1,218 @@
1
+ import { isDialFileId as e } from "./dial-file.js";
2
+ import { AttachmentContentType as t, AttachmentErrorType as n } from "@epam/ai-dial-attachment-canvas";
3
+ import { MIMEType as r, base64ToBlob as i, tryBase64ToBytes as a } from "@epam/ai-dial-chat-shared";
4
+ import { annotationHighlightId as o, annotationsToPdfHighlights as s, getAnnotationPdfPage as c, parsePdfPageReference as l } from "@epam/ai-dial-quotations";
5
+ import { LRUCache as u } from "lru-cache";
6
+ //#region src/files/attachment-canvas.ts
7
+ var d = (e, t) => URL.createObjectURL(i(e, t)), f = (e) => {
8
+ let t = a(e);
9
+ return t == null ? e : new TextDecoder().decode(t);
10
+ }, p = (e, r) => ({
11
+ type: t.Error,
12
+ errorType: e === 403 ? n.Forbidden : n.LoadFailed,
13
+ url: r
14
+ }), m = (e) => ({
15
+ type: t.Error,
16
+ errorType: n.LoadFailed,
17
+ url: e
18
+ }), h = new u({ max: 10 }), g = new u({ max: 50 }), _ = () => {
19
+ h.clear(), g.clear();
20
+ }, v = (e) => {
21
+ let t = h.get(e);
22
+ return t ?? (t = fetch(e).then((e) => {
23
+ if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
24
+ return e.blob();
25
+ }).catch((t) => {
26
+ throw h.delete(e), t;
27
+ }), h.set(e, t)), t;
28
+ }, y = (e) => {
29
+ let t = g.get(e);
30
+ return t ?? (t = fetch(e).then((e) => {
31
+ if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
32
+ return e.text();
33
+ }).catch((t) => {
34
+ throw g.delete(e), t;
35
+ }), g.set(e, t)), t;
36
+ }, b = async (e, t) => {
37
+ if ("file" in e) return URL.createObjectURL(e.file);
38
+ let n = t.resolveDialUrl(e);
39
+ if (n != null) try {
40
+ let e = await v(n);
41
+ return URL.createObjectURL(e);
42
+ } catch (e) {
43
+ let t = e.status;
44
+ return t == null ? m(n) : p(t, n);
45
+ }
46
+ if (e.previewUrl != null) return e.previewUrl;
47
+ if (e.data != null) return d(e.data, e.contentType);
48
+ }, x = async (e, t) => {
49
+ if (e.data != null) return f(e.data);
50
+ let n = t.resolveDialUrl(e);
51
+ if (n != null) try {
52
+ return await y(n);
53
+ } catch (e) {
54
+ let t = e.status;
55
+ return t == null ? m(n) : p(t, n);
56
+ }
57
+ if ("file" in e) return e.file.text();
58
+ }, S = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, C = (e, n) => {
59
+ if ("file" in e) return {
60
+ type: t.Image,
61
+ url: URL.createObjectURL(e.file)
62
+ };
63
+ let r = n.resolveDialUrl(e);
64
+ return r == null ? e.previewUrl == null ? e.data == null ? null : {
65
+ type: t.Image,
66
+ url: d(e.data, e.contentType)
67
+ } : {
68
+ type: t.Image,
69
+ url: e.previewUrl
70
+ } : {
71
+ type: t.Image,
72
+ url: r
73
+ };
74
+ }, w = async (e, n) => {
75
+ let r = await x(e, n);
76
+ return r == null ? null : typeof r == "string" ? {
77
+ type: t.PlainText,
78
+ text: r
79
+ } : r;
80
+ }, T = async (e, n) => {
81
+ let r = await x(e, n);
82
+ return r == null ? null : typeof r == "string" ? {
83
+ type: t.Markdown,
84
+ text: r
85
+ } : r;
86
+ }, E = 1048576, D = async (e, n, r) => {
87
+ let i = await x(e, n);
88
+ return i == null ? null : typeof i == "string" ? {
89
+ type: t.Code,
90
+ text: i,
91
+ language: r
92
+ } : i;
93
+ }, O = async (e, n) => {
94
+ let r = await x(e, n);
95
+ if (r == null) return null;
96
+ if (typeof r != "string") return r;
97
+ if (r.length > E) return null;
98
+ let i = n.resolveDialUrl(e) ?? void 0;
99
+ return {
100
+ type: t.Html,
101
+ srcdoc: r,
102
+ url: i
103
+ };
104
+ }, k = (n, i, a) => {
105
+ let l = n.body?.source?.attachment;
106
+ if (l?.type !== r.PDF) return null;
107
+ let u = e(l.url) ? a.resolveDialFileDownloadUrl(l.url) : l.url;
108
+ if (u == null) return null;
109
+ let d = (i.find((e) => e.annotations.includes(n))?.annotations ?? [n]).filter((e) => e.body?.source?.attachment?.url === l.url), f = d.indexOf(n), p = s(d), m = o(n, f);
110
+ return {
111
+ type: t.Pdf,
112
+ url: u,
113
+ highlights: p,
114
+ selectedHighlightId: p.some((e) => e.id === m) ? m : void 0,
115
+ page: c(n)
116
+ };
117
+ }, A = (n, r) => {
118
+ let i = l(n.url);
119
+ if (i == null) return null;
120
+ let a = e(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
121
+ if (a == null) return null;
122
+ if (i.page == null) return {
123
+ type: t.Pdf,
124
+ url: a
125
+ };
126
+ let o = `reference-page-${i.page}`;
127
+ return {
128
+ type: t.Pdf,
129
+ url: a,
130
+ highlights: [{
131
+ id: o,
132
+ bboxes: [{
133
+ page: i.page,
134
+ x1: 0,
135
+ y1: 0,
136
+ x2: 0,
137
+ y2: 0
138
+ }],
139
+ style: {
140
+ backgroundColor: "transparent",
141
+ opacity: 0
142
+ }
143
+ }],
144
+ selectedHighlightId: o,
145
+ page: i.page
146
+ };
147
+ }, j = (e) => {
148
+ try {
149
+ let t = new URL(e).protocol;
150
+ return t === "http:" || t === "https:" || t === "blob:";
151
+ } catch {
152
+ return !1;
153
+ }
154
+ }, M = (t) => t.url != null && !e(t.url) && j(t.url) ? t.url : void 0, N = async (e, n) => {
155
+ let r = await b(e, n);
156
+ if (r != null) return typeof r == "string" ? {
157
+ type: t.Pdf,
158
+ url: r
159
+ } : r;
160
+ let i = M(e);
161
+ return i == null ? null : {
162
+ type: t.Pdf,
163
+ url: i
164
+ };
165
+ }, P = async (e, n, r) => {
166
+ let i = await b(e, n);
167
+ if (i != null) return typeof i == "string" ? {
168
+ type: t.Ooxml,
169
+ url: i,
170
+ format: r
171
+ } : i;
172
+ let a = M(e);
173
+ return a == null ? null : {
174
+ type: t.Ooxml,
175
+ url: a,
176
+ format: r
177
+ };
178
+ }, F = async (e, n) => {
179
+ let r = await x(e, n);
180
+ if (r == null) return null;
181
+ if (typeof r != "string") return r;
182
+ try {
183
+ let e = JSON.parse(r);
184
+ return {
185
+ type: t.Json,
186
+ value: e
187
+ };
188
+ } catch {
189
+ return {
190
+ type: t.PlainText,
191
+ text: r
192
+ };
193
+ }
194
+ }, I = async (e, n, r, i) => {
195
+ let a = await x(e, n);
196
+ if (a == null || typeof a != "string") return null;
197
+ let o = {};
198
+ try {
199
+ let e = JSON.parse(a);
200
+ typeof e == "object" && e && (o = e);
201
+ } catch {}
202
+ return {
203
+ type: t.Visualizer,
204
+ url: r.url,
205
+ mimeType: e.contentType,
206
+ data: o,
207
+ layout: {
208
+ width: r.width,
209
+ height: r.height,
210
+ mobileHeight: r.mobileHeight,
211
+ themeId: i
212
+ },
213
+ visualizerName: r.title,
214
+ requestTimeout: r.requestTimeout
215
+ };
216
+ };
217
+ //#endregion
218
+ export { k as annotationToPdfCanvasContent, _ as clearAttachmentCache, S as hasAttachmentTextSource, A as referenceAttachmentToPdfCanvasContent, D as resolveCodeCanvasContent, O as resolveHtmlCanvasContent, C as resolveImageCanvasContent, F as resolveJsonCanvasContent, T as resolveMarkdownCanvasContent, P as resolveOoxmlCanvasContent, N as resolvePdfCanvasContent, w as resolveTextCanvasContent, I as resolveVisualizerCanvasContent };
@@ -0,0 +1,15 @@
1
+ import { AttachmentType as e, RequestStatus as t, messageAttachmentToDisplayAttachment as n } from "@epam/ai-dial-chat-shared";
2
+ //#region src/files/attachment-dto-to-display.ts
3
+ var r = (e, t) => n(e, t), i = (n) => {
4
+ let r = n.body?.source?.attachment;
5
+ return r == null ? null : {
6
+ id: r.url,
7
+ name: r.url.split("/").pop() ?? r.url,
8
+ contentType: r.type,
9
+ type: r.type.startsWith("image/") ? e.Image : e.File,
10
+ status: t.Idle,
11
+ url: r.url
12
+ };
13
+ }, a = (e, t) => e?.map((e) => r(e, t)) ?? [];
14
+ //#endregion
15
+ export { i as annotationToDisplayAttachment, r as attachmentDtoToDisplayAttachment, a as attachmentDtosToDisplayAttachments };
@@ -0,0 +1,16 @@
1
+ import { extension as e } from "mime-types";
2
+ //#region src/files/attachment-types.ts
3
+ var t = "*/*", n = (e) => e.startsWith(".") || e.includes("/"), r = (e) => {
4
+ if (e != null) return e.map((e) => e === "*" ? t : e).filter(n);
5
+ }, i = (e) => {
6
+ let n = r(e);
7
+ if (!(n == null || n.length === 0) && !n.some((e) => e === t)) return n.join(",");
8
+ }, a = (t) => t.map((t) => {
9
+ if (t.endsWith("/*")) return t;
10
+ let n = e(t);
11
+ if (n !== !1) return `.${n}`;
12
+ let r = t.split("/")[1];
13
+ return r == null ? t : `.${r.toLowerCase()}`;
14
+ }).join(", ");
15
+ //#endregion
16
+ export { n as isDialFileAcceptType, a as mimeTypesToAttachmentExtensionLabels, r as mimeTypesToDialFileAcceptTypes, i as mimeTypesToFileAccept };
@@ -0,0 +1,40 @@
1
+ //#region src/files/create-files-api.ts
2
+ var e = (e) => e instanceof AbortSignal ? { signal: e } : e ?? {}, t = (t, n) => ({
3
+ listPublicFiles: (e) => t.listPublicFiles(e),
4
+ listSharedFiles: (e) => t.listSharedFiles(e),
5
+ listFiles: (e, n) => t.listFiles(e, n ? { signal: n } : void 0),
6
+ uploadFile: (r, i, a, o) => {
7
+ let { signal: s, onProgress: c, uploadMode: l } = e(o);
8
+ return c == null ? t.uploadFile({
9
+ bucket: r,
10
+ path: i,
11
+ file: a,
12
+ uploadMode: l
13
+ }, s ? { signal: s } : void 0) : n(r, i, a, {
14
+ signal: s,
15
+ onProgress: c,
16
+ uploadMode: l
17
+ });
18
+ },
19
+ uploadArchive: (e, n, r) => t.uploadArchive({
20
+ file: e,
21
+ bucket: n,
22
+ destinationPath: r
23
+ }),
24
+ getFileMetadata: (e) => t.getFileMetadata(e),
25
+ downloadFile: async (e, n, r) => (await t.downloadFileRaw({
26
+ bucket: e,
27
+ path: n
28
+ }, ...r ? [{ signal: r }] : [])).raw,
29
+ createFolder: (e) => t.createFolder({ createFolderDto: e }),
30
+ deleteFiles: (e) => t.deleteFiles({ deleteFilesDto: { items: e } }),
31
+ renameFiles: (e) => t.renameFiles({ renameFilesDto: { items: e } }),
32
+ copyFiles: (e, n) => t.copyFiles({ copyFilesDto: { items: e } }, n ? { signal: n } : void 0),
33
+ moveFiles: (e, n) => t.moveFiles({ moveFilesDto: { items: e } }, n ? { signal: n } : void 0),
34
+ downloadArchive: async (e) => (await t.downloadArchiveRaw({ downloadArchiveDto: { items: e } })).raw,
35
+ revokeAccess: (e) => t.revokeAccess({ revokeAccessDto: { items: e } }),
36
+ discardShared: (e) => t.discardShared({ discardSharedDto: { items: e } }),
37
+ listSharedByMe: (e) => t.listSharedByMe({ bucket: e })
38
+ });
39
+ //#endregion
40
+ export { t as createFilesApiClient };