@epam/ai-dial-chat-hooks 1.4.0-dev.8 → 1.4.0-dev.82

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 (118) hide show
  1. package/attachment/useAttachmentAction/useAttachmentAction.d.ts +1 -1
  2. package/attachment/useAttachmentAction/useAttachmentAction.d.ts.map +1 -1
  3. package/attachment/useAttachmentAction/useAttachmentAction.js +35 -44
  4. package/catalog/create-publish-api.d.ts +9 -1
  5. package/catalog/create-publish-api.d.ts.map +1 -1
  6. package/catalog/create-publish-api.js +8 -0
  7. package/catalog/entity-details.d.ts +5 -2
  8. package/catalog/entity-details.d.ts.map +1 -1
  9. package/catalog/map-entity-details-to-catalog.d.ts +4 -0
  10. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  11. package/catalog/map-entity-details-to-catalog.js +15 -13
  12. package/catalog/publish-dependency-icons.d.ts +22 -0
  13. package/catalog/publish-dependency-icons.d.ts.map +1 -0
  14. package/catalog/publish-dependency-icons.js +11 -0
  15. package/catalog/publish.d.ts +15 -2
  16. package/catalog/publish.d.ts.map +1 -1
  17. package/catalog/publish.js +15 -4
  18. package/catalog/use-publish-dependencies.d.ts +19 -0
  19. package/catalog/use-publish-dependencies.d.ts.map +1 -0
  20. package/catalog/use-publish-dependencies.js +25 -0
  21. package/catalog/useVersionHistory/useVersionHistory.d.ts +38 -0
  22. package/catalog/useVersionHistory/useVersionHistory.d.ts.map +1 -0
  23. package/catalog/useVersionHistory/useVersionHistory.js +49 -0
  24. package/catalog/useVersionHistory/useVersionHistorySection.d.ts +30 -0
  25. package/catalog/useVersionHistory/useVersionHistorySection.d.ts.map +1 -0
  26. package/catalog/useVersionHistory/useVersionHistorySection.js +31 -0
  27. package/catalog/version-history.d.ts +42 -0
  28. package/catalog/version-history.d.ts.map +1 -0
  29. package/catalog/version-history.js +27 -0
  30. package/catalog.js +36 -31
  31. package/conversation/announcement-message.d.ts +12 -0
  32. package/conversation/announcement-message.d.ts.map +1 -1
  33. package/conversation/announcement-message.js +16 -10
  34. package/conversation/useConversationStream/generation-resume.d.ts.map +1 -1
  35. package/conversation/useConversationStream/generation-resume.js +119 -96
  36. package/conversation.js +44 -44
  37. package/entry-points/catalog.d.ts +5 -0
  38. package/entry-points/catalog.d.ts.map +1 -1
  39. package/entry-points/file-manager.d.ts +1 -0
  40. package/entry-points/file-manager.d.ts.map +1 -1
  41. package/entry-points/project.d.ts +5 -0
  42. package/entry-points/project.d.ts.map +1 -1
  43. package/entry-points/scheduled-tasks.d.ts +1 -0
  44. package/entry-points/scheduled-tasks.d.ts.map +1 -1
  45. package/entry-points/utils.d.ts +3 -0
  46. package/entry-points/utils.d.ts.map +1 -1
  47. package/file-manager.js +33 -32
  48. package/files/annotation.d.ts +3 -3
  49. package/files/annotation.d.ts.map +1 -1
  50. package/files/annotation.js +12 -11
  51. package/files/attachment-canvas.d.ts +1 -1
  52. package/files/attachment-canvas.d.ts.map +1 -1
  53. package/files/attachment-canvas.js +135 -135
  54. package/files/attachment-type-labels.d.ts +3 -0
  55. package/files/attachment-type-labels.d.ts.map +1 -0
  56. package/files/attachment-type-labels.js +12 -0
  57. package/files/attachment-types.d.ts +0 -2
  58. package/files/attachment-types.d.ts.map +1 -1
  59. package/files/attachment-types.js +7 -14
  60. package/files/dial-file.d.ts +18 -0
  61. package/files/dial-file.d.ts.map +1 -1
  62. package/files/dial-file.js +30 -5
  63. package/index.d.ts +15 -0
  64. package/index.d.ts.map +1 -1
  65. package/index.js +255 -241
  66. package/org-units/models.d.ts +9 -0
  67. package/org-units/models.d.ts.map +1 -0
  68. package/org-units/types.d.ts +14 -0
  69. package/org-units/types.d.ts.map +1 -0
  70. package/org-units/types.js +6 -0
  71. package/org-units/useOrgUnits/useOrgUnits.d.ts +19 -0
  72. package/org-units/useOrgUnits/useOrgUnits.d.ts.map +1 -0
  73. package/org-units/useOrgUnits/useOrgUnits.js +34 -0
  74. package/package.json +19 -19
  75. package/project/project-sharing-client.d.ts +8 -0
  76. package/project/project-sharing-client.d.ts.map +1 -0
  77. package/project/project-sharing-client.js +11 -0
  78. package/project/project-sharing.d.ts +28 -0
  79. package/project/project-sharing.d.ts.map +1 -0
  80. package/project/project-sharing.js +22 -0
  81. package/project/use-pinned-project-chats.d.ts +4 -2
  82. package/project/use-pinned-project-chats.d.ts.map +1 -1
  83. package/project/use-pinned-project-chats.js +152 -96
  84. package/project/use-project-conversations.d.ts.map +1 -1
  85. package/project/use-project-conversations.js +2 -2
  86. package/project/use-project-remove-from-list.d.ts +30 -0
  87. package/project/use-project-remove-from-list.d.ts.map +1 -0
  88. package/project/use-project-remove-from-list.js +39 -0
  89. package/project/use-project-revoke-access.d.ts +15 -0
  90. package/project/use-project-revoke-access.d.ts.map +1 -0
  91. package/project/use-project-revoke-access.js +32 -0
  92. package/project/use-project-share-recipients.d.ts +7 -0
  93. package/project/use-project-share-recipients.d.ts.map +1 -0
  94. package/project/use-project-share-recipients.js +36 -0
  95. package/project/use-projects.d.ts +1 -0
  96. package/project/use-projects.d.ts.map +1 -1
  97. package/project/use-projects.js +2 -1
  98. package/project.js +7 -2
  99. package/scheduled-task/scheduled-task-description.d.ts +19 -13
  100. package/scheduled-task/scheduled-task-description.d.ts.map +1 -1
  101. package/scheduled-task/scheduled-task-description.js +39 -55
  102. package/scheduled-task/scheduled-task-display.d.ts +19 -5
  103. package/scheduled-task/scheduled-task-display.d.ts.map +1 -1
  104. package/scheduled-task/scheduled-task-display.js +43 -38
  105. package/scheduled-task/scheduled-task-next-occurrence.d.ts +7 -5
  106. package/scheduled-task/scheduled-task-next-occurrence.d.ts.map +1 -1
  107. package/scheduled-task/scheduled-task-next-occurrence.js +15 -15
  108. package/scheduled-task/scheduled-task-trigger.d.ts +6 -4
  109. package/scheduled-task/scheduled-task-trigger.d.ts.map +1 -1
  110. package/scheduled-task/scheduled-task-trigger.js +92 -115
  111. package/scheduled-tasks.js +14 -13
  112. package/shared/timezones.d.ts +30 -0
  113. package/shared/timezones.d.ts.map +1 -0
  114. package/shared/timezones.js +102 -0
  115. package/utils.js +5 -3
  116. package/shared/cron-day-of-month.d.ts +0 -21
  117. package/shared/cron-day-of-month.d.ts.map +0 -1
  118. package/shared/cron-day-of-month.js +0 -13
@@ -1,23 +1,23 @@
1
- import { isDialFileId as e } from "./dial-file.js";
2
- import { AttachmentContentType as t, AttachmentErrorType as n, OoxmlFileType as r, OoxmlHighlightKind as i, getOoxmlFileType as a } from "@epam/ai-dial-attachment-canvas";
3
- import { MIMEType as o, base64ToBlob as s, tryBase64ToBytes as c } from "@epam/ai-dial-chat-shared";
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
- import { LRUCache as h } from "lru-cache";
1
+ import { isDialFileId as e, isDialStoredFileId as t } from "./dial-file.js";
2
+ import { AttachmentContentType as n, AttachmentErrorType as r, OoxmlFileType as i, OoxmlHighlightKind as a, getOoxmlFileType as o } from "@epam/ai-dial-attachment-canvas";
3
+ import { MIMEType as s, base64ToBlob as c, tryBase64ToBytes as l } from "@epam/ai-dial-chat-shared";
4
+ import { annotationHighlightIds as u, annotationToOfficeHighlightLocations as d, annotationsToPdfHighlights as f, gatherSameSourceAnnotations as p, getAnnotationPdfPage as m, parsePdfPageReference as h } from "@epam/ai-dial-quotations";
5
+ import { LRUCache as g } from "lru-cache";
6
6
  //#region src/files/attachment-canvas.ts
7
- var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
8
- let t = c(e);
7
+ var _ = (e, t) => URL.createObjectURL(c(e, t)), v = (e) => {
8
+ let t = l(e);
9
9
  return t == null ? e : new TextDecoder().decode(t);
10
- }, v = (e, r) => ({
11
- type: t.Error,
12
- errorType: e === 403 ? n.Forbidden : n.LoadFailed,
13
- url: r
14
- }), y = (e) => ({
15
- type: t.Error,
16
- errorType: n.LoadFailed,
10
+ }, y = (e, t) => ({
11
+ type: n.Error,
12
+ errorType: e === 403 ? r.Forbidden : r.LoadFailed,
13
+ url: t
14
+ }), b = (e) => ({
15
+ type: n.Error,
16
+ errorType: r.LoadFailed,
17
17
  url: e
18
- }), b = new h({ max: 10 }), x = new h({ max: 50 }), S = () => {
19
- b.clear(), x.clear();
20
- }, C = async (e, t) => {
18
+ }), x = new g({ max: 10 }), S = new g({ max: 50 }), C = () => {
19
+ x.clear(), S.clear();
20
+ }, w = async (e, t) => {
21
21
  let n = t.resolveDialFileMetadataUrl(e);
22
22
  if (n != null) try {
23
23
  let e = await fetch(n);
@@ -27,128 +27,128 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
27
27
  } catch {
28
28
  return;
29
29
  }
30
- }, w = async (e, t, n) => {
31
- let r = await C(t, n);
30
+ }, T = async (e, t, n) => {
31
+ let r = await w(t, n);
32
32
  if (r == null) return fetch(e).then((e) => {
33
33
  if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
34
34
  return e.blob();
35
35
  });
36
- let i = b.get(e);
36
+ let i = x.get(e);
37
37
  if (i != null && i.etag === r) return i.promise;
38
- b.delete(e);
38
+ x.delete(e);
39
39
  let a = fetch(e).then((e) => {
40
40
  if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
41
41
  return e.blob();
42
42
  }).catch((t) => {
43
- throw b.delete(e), t;
43
+ throw x.delete(e), t;
44
44
  });
45
- return b.set(e, {
45
+ return x.set(e, {
46
46
  etag: r,
47
47
  promise: a
48
48
  }), a;
49
- }, T = async (e, t, n) => {
50
- let r = await C(t, n);
49
+ }, E = async (e, t, n) => {
50
+ let r = await w(t, n);
51
51
  if (r == null) return fetch(e).then((e) => {
52
52
  if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
53
53
  return e.text();
54
54
  });
55
- let i = x.get(e);
55
+ let i = S.get(e);
56
56
  if (i != null && i.etag === r) return i.promise;
57
- x.delete(e);
57
+ S.delete(e);
58
58
  let a = fetch(e).then((e) => {
59
59
  if (!e.ok) throw Object.assign(/* @__PURE__ */ Error(`HTTP ${e.status}`), { status: e.status });
60
60
  return e.text();
61
61
  }).catch((t) => {
62
- throw x.delete(e), t;
62
+ throw S.delete(e), t;
63
63
  });
64
- return x.set(e, {
64
+ return S.set(e, {
65
65
  etag: r,
66
66
  promise: a
67
67
  }), a;
68
- }, E = (e) => e.split("#")[0], D = (t) => {
69
- if (t.url != null && e(t.url)) return E(t.url);
70
- if (t.referenceUrl != null && e(t.referenceUrl)) return E(t.referenceUrl);
71
- }, O = async (e, t) => {
68
+ }, D = (e) => e.split("#")[0], O = (t) => {
69
+ if (t.url != null && e(t.url)) return D(t.url);
70
+ if (t.referenceUrl != null && e(t.referenceUrl)) return D(t.referenceUrl);
71
+ }, k = async (e, t) => {
72
72
  let n = "file" in e ? e.file : void 0, r = n != null && n.size === 0, i = n != null && !r ? void 0 : t.resolveDialUrl(e);
73
73
  if (n != null && i == null) return URL.createObjectURL(n);
74
74
  if (i != null) try {
75
- let n = await w(i, D(e) ?? "", t);
75
+ let n = await T(i, O(e) ?? "", t);
76
76
  return URL.createObjectURL(n);
77
77
  } catch (e) {
78
78
  let t = e.status;
79
- return t == null ? y(i) : v(t, i);
79
+ return t == null ? b(i) : y(t, i);
80
80
  }
81
81
  if (e.previewUrl != null) return e.previewUrl;
82
- if (e.data != null) return g(e.data, e.contentType);
83
- }, k = async (e, t) => {
84
- if (e.data != null) return _(e.data);
82
+ if (e.data != null) return _(e.data, e.contentType);
83
+ }, A = async (e, t) => {
84
+ if (e.data != null) return v(e.data);
85
85
  let n = t.resolveDialUrl(e);
86
86
  if (n != null) try {
87
- return await T(n, D(e) ?? "", t);
87
+ return await E(n, O(e) ?? "", t);
88
88
  } catch (e) {
89
89
  let t = e.status;
90
- return t == null ? y(n) : v(t, n);
90
+ return t == null ? b(n) : y(t, n);
91
91
  }
92
92
  if ("file" in e) return e.file.text();
93
- }, A = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, j = (e, n) => {
94
- let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 : n.resolveDialUrl(e);
93
+ }, j = (e, t) => e.data != null || t.resolveDialUrl(e) != null || "file" in e, M = (e, t) => {
94
+ let r = "file" in e ? e.file : void 0, i = r != null && r.size === 0, a = r != null && !i ? void 0 : t.resolveDialUrl(e);
95
95
  return r != null && a == null ? {
96
- type: t.Image,
96
+ type: n.Image,
97
97
  url: URL.createObjectURL(r)
98
98
  } : a == null ? e.previewUrl == null ? e.data == null ? null : {
99
- type: t.Image,
100
- url: g(e.data, e.contentType)
99
+ type: n.Image,
100
+ url: _(e.data, e.contentType)
101
101
  } : {
102
- type: t.Image,
102
+ type: n.Image,
103
103
  url: e.previewUrl
104
104
  } : {
105
- type: t.Image,
105
+ type: n.Image,
106
106
  url: a
107
107
  };
108
- }, M = async (e, n) => {
109
- let r = await k(e, n);
108
+ }, N = async (e, t) => {
109
+ let r = await A(e, t);
110
110
  return r == null ? null : typeof r == "string" ? {
111
- type: t.PlainText,
111
+ type: n.PlainText,
112
112
  text: r
113
113
  } : r;
114
- }, N = async (e, n) => {
115
- let r = await k(e, n);
114
+ }, P = async (e, t) => {
115
+ let r = await A(e, t);
116
116
  return r == null ? null : typeof r == "string" ? {
117
- type: t.Markdown,
117
+ type: n.Markdown,
118
118
  text: r
119
119
  } : r;
120
- }, P = 1048576, F = async (e, n, r) => {
121
- let i = await k(e, n);
120
+ }, F = 1048576, I = async (e, t, r) => {
121
+ let i = await A(e, t);
122
122
  return i == null ? null : typeof i == "string" ? {
123
- type: t.Code,
123
+ type: n.Code,
124
124
  text: i,
125
125
  language: r
126
126
  } : i;
127
- }, I = (e) => {
127
+ }, L = (e) => {
128
128
  try {
129
129
  return new URL(e, window.location.href).origin;
130
130
  } catch {
131
131
  return;
132
132
  }
133
- }, L = async (e, n) => {
134
- let r = n.resolveDialUrl(e) ?? void 0;
133
+ }, R = async (e, t) => {
134
+ let r = t.resolveDialUrl(e) ?? void 0;
135
135
  if (r != null) return {
136
- type: t.Html,
136
+ type: n.Html,
137
137
  url: r,
138
- isSameOriginUrl: I(r) === I(window.location.href),
138
+ isSameOriginUrl: L(r) === L(window.location.href),
139
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;
140
+ let n = await A(e, t);
141
+ if (n == null || typeof n != "string") throw Error("Failed to resolve HTML source text");
142
+ return n;
143
143
  }
144
144
  };
145
- let i = await k(e, n);
146
- return i == null ? null : typeof i == "string" ? i.length > P ? null : {
147
- type: t.Html,
145
+ let i = await A(e, t);
146
+ return i == null ? null : typeof i == "string" ? i.length > F ? null : {
147
+ type: n.Html,
148
148
  srcdoc: i,
149
- srcdocHostUrl: n.htmlSrcdocHostUrl
149
+ srcdocHostUrl: t.htmlSrcdocHostUrl
150
150
  } : i;
151
- }, R = (e, t) => ({
151
+ }, z = (e, t) => ({
152
152
  id: e,
153
153
  bboxes: [{
154
154
  page: t,
@@ -161,44 +161,44 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
161
161
  backgroundColor: "transparent",
162
162
  opacity: 0
163
163
  }
164
- }), z = (n, r, i) => {
165
- let a = n.body?.source?.attachment;
166
- if (a?.type !== o.PDF) return null;
167
- let s = e(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
168
- if (s == null) return null;
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);
164
+ }), B = (e, r, i) => {
165
+ let a = e.body?.source?.attachment;
166
+ if (a?.type !== s.PDF) return null;
167
+ let o = t(a.url) ? i.resolveDialFileDownloadUrl(a.url) : a.url;
168
+ if (o == null) return null;
169
+ let c = (r.find((t) => t.annotations.includes(e))?.annotations ?? [e]).filter((e) => e.body?.source?.attachment?.url === a.url), l = c.indexOf(e), d = f(c), p = u(c)[l], h = m(e), g = d.some((e) => e.id === p);
170
170
  if (!g && h != null) {
171
- let e = `page-anchor-${m}`;
171
+ let e = `page-anchor-${p}`;
172
172
  return {
173
- type: t.Pdf,
174
- url: s,
175
- highlights: [...f, R(e, h)],
173
+ type: n.Pdf,
174
+ url: o,
175
+ highlights: [...d, z(e, h)],
176
176
  selectedHighlightId: e,
177
177
  page: h
178
178
  };
179
179
  }
180
180
  return {
181
- type: t.Pdf,
182
- url: s,
183
- highlights: f,
184
- selectedHighlightId: g ? m : void 0,
181
+ type: n.Pdf,
182
+ url: o,
183
+ highlights: d,
184
+ selectedHighlightId: g ? p : void 0,
185
185
  page: h
186
186
  };
187
- }, B = (e) => {
187
+ }, V = (e) => {
188
188
  switch (e.type) {
189
189
  case "docx_text_anchor": return {
190
- kind: i.DocxTableRow,
190
+ kind: a.DocxTableRow,
191
191
  cells: e.cells,
192
192
  occurrence: e.occurrence
193
193
  };
194
194
  case "pptx_text_anchor": return {
195
- kind: i.PptxTableRow,
195
+ kind: a.PptxTableRow,
196
196
  cells: e.cells,
197
197
  occurrence: e.occurrence,
198
198
  slide: e.slide
199
199
  };
200
200
  case "docx_text_range": return {
201
- kind: i.DocxTextRange,
201
+ kind: a.DocxTextRange,
202
202
  story: e.story,
203
203
  path: e.path,
204
204
  start: e.start,
@@ -206,7 +206,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
206
206
  text: e.text
207
207
  };
208
208
  case "pptx_text_range": return {
209
- kind: i.PptxTextRange,
209
+ kind: a.PptxTextRange,
210
210
  slide: e.slide,
211
211
  shapeId: e.shapeId,
212
212
  start: e.start,
@@ -214,111 +214,111 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
214
214
  text: e.text
215
215
  };
216
216
  case "excel_rc_range": return {
217
- kind: i.XlsxCellRange,
217
+ kind: a.XlsxCellRange,
218
218
  sheet: e.sheet,
219
219
  start: e.start,
220
220
  end: e.end
221
221
  };
222
222
  }
223
- }, V = (n, i, o) => {
224
- let s = n.body?.source?.attachment;
223
+ }, H = (e, r, a) => {
224
+ let s = e.body?.source?.attachment;
225
225
  if (s?.url == null) return null;
226
- let c = a(s.title ?? s.url, s.type);
227
- if (c !== r.Docx && c !== r.Xlsx && c !== r.Pptx) return null;
228
- let d = e(s.url) ? o.resolveDialFileDownloadUrl(s.url) : s.url;
229
- if (d == null) return null;
230
- let p = f(n, i), m = [], h, g = l(p);
231
- return p.forEach((e, t) => {
232
- let r = u(e);
226
+ let c = o(s.title ?? s.url, s.type);
227
+ if (c !== i.Docx && c !== i.Xlsx && c !== i.Pptx) return null;
228
+ let l = t(s.url) ? a.resolveDialFileDownloadUrl(s.url) : s.url;
229
+ if (l == null) return null;
230
+ let f = p(e, r), m = [], h, g = u(f);
231
+ return f.forEach((t, n) => {
232
+ let r = d(t);
233
233
  if (r.length === 0) return;
234
- let i = g[t];
234
+ let i = g[n];
235
235
  m.push({
236
236
  id: i,
237
- locations: r.map(B)
238
- }), e === n && h == null && (h = i);
237
+ locations: r.map(V)
238
+ }), t === e && h == null && (h = i);
239
239
  }), {
240
- type: t.Ooxml,
241
- url: d,
240
+ type: n.Ooxml,
241
+ url: l,
242
242
  format: c,
243
243
  ...m.length > 0 ? {
244
244
  highlights: m,
245
245
  selectedHighlightId: h
246
246
  } : {}
247
247
  };
248
- }, H = (e, t, n, r) => {
249
- let i = z(e, t, r) ?? V(e, n, r);
248
+ }, U = (e, t, n, r) => {
249
+ let i = B(e, t, r) ?? H(e, n, r);
250
250
  if (i == null) return null;
251
251
  let a = e.body?.source?.attachment, o = a?.url?.split("/").pop() ?? "";
252
252
  return {
253
253
  content: i,
254
254
  fileName: a?.title || decodeURIComponent(o)
255
255
  };
256
- }, U = (n, r) => {
257
- let i = m(n.url);
256
+ }, W = (e, r) => {
257
+ let i = h(e.url);
258
258
  if (i == null) return null;
259
- let a = e(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
259
+ let a = t(i.baseUrl) ? r.resolveDialFileDownloadUrl(i.baseUrl) : i.baseUrl;
260
260
  if (a == null) return null;
261
261
  if (i.page == null) return {
262
- type: t.Pdf,
262
+ type: n.Pdf,
263
263
  url: a
264
264
  };
265
265
  let o = `reference-page-${i.page}`;
266
266
  return {
267
- type: t.Pdf,
267
+ type: n.Pdf,
268
268
  url: a,
269
- highlights: [R(o, i.page)],
269
+ highlights: [z(o, i.page)],
270
270
  selectedHighlightId: o,
271
271
  page: i.page
272
272
  };
273
- }, W = (e) => {
273
+ }, G = (e) => {
274
274
  try {
275
275
  let t = new URL(e).protocol;
276
276
  return t === "http:" || t === "https:" || t === "blob:";
277
277
  } catch {
278
278
  return !1;
279
279
  }
280
- }, G = (t) => t.url != null && !e(t.url) && W(t.url) ? t.url : void 0, K = async (e, n) => {
281
- let r = await O(e, n);
280
+ }, K = (t) => t.url != null && !e(t.url) && G(t.url) ? t.url : void 0, q = async (e, t) => {
281
+ let r = await k(e, t);
282
282
  if (r != null) return typeof r == "string" ? {
283
- type: t.Pdf,
283
+ type: n.Pdf,
284
284
  url: r
285
285
  } : r;
286
- let i = G(e);
286
+ let i = K(e);
287
287
  return i == null ? null : {
288
- type: t.Pdf,
288
+ type: n.Pdf,
289
289
  url: i
290
290
  };
291
- }, q = async (e, n, r) => {
292
- let i = await O(e, n);
291
+ }, J = async (e, t, r) => {
292
+ let i = await k(e, t);
293
293
  if (i != null) return typeof i == "string" ? {
294
- type: t.Ooxml,
294
+ type: n.Ooxml,
295
295
  url: i,
296
296
  format: r
297
297
  } : i;
298
- let a = G(e);
298
+ let a = K(e);
299
299
  return a == null ? null : {
300
- type: t.Ooxml,
300
+ type: n.Ooxml,
301
301
  url: a,
302
302
  format: r
303
303
  };
304
- }, J = async (e, n) => {
305
- let r = await k(e, n);
304
+ }, Y = async (e, t) => {
305
+ let r = await A(e, t);
306
306
  if (r == null) return null;
307
307
  if (typeof r != "string") return r;
308
308
  try {
309
309
  let e = JSON.parse(r);
310
310
  return {
311
- type: t.Json,
311
+ type: n.Json,
312
312
  value: e
313
313
  };
314
314
  } catch {
315
315
  return {
316
- type: t.PlainText,
316
+ type: n.PlainText,
317
317
  text: r
318
318
  };
319
319
  }
320
- }, Y = async (e, n, r, i) => {
321
- let a = await k(e, n);
320
+ }, X = async (e, t, r, i) => {
321
+ let a = await A(e, t);
322
322
  if (a == null || typeof a != "string") return null;
323
323
  let o = {};
324
324
  try {
@@ -326,7 +326,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
326
326
  typeof e == "object" && e && (o = e);
327
327
  } catch {}
328
328
  return {
329
- type: t.Visualizer,
329
+ type: n.Visualizer,
330
330
  url: r.url,
331
331
  mimeType: e.contentType,
332
332
  data: o,
@@ -339,7 +339,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
339
339
  visualizerName: r.title,
340
340
  requestTimeout: r.requestTimeout
341
341
  };
342
- }, X = (e, n, r, i) => {
342
+ }, Z = (e, t, r, i) => {
343
343
  let a = {
344
344
  width: r.width,
345
345
  height: r.height,
@@ -347,9 +347,9 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
347
347
  themeId: i
348
348
  }, o = [], s = [];
349
349
  return e.forEach((e) => {
350
- let t = n(e);
351
- t != null && (s.push(e), o.push({
352
- url: t,
350
+ let n = t(e);
351
+ n != null && (s.push(e), o.push({
352
+ url: n,
353
353
  mimeType: e.contentType,
354
354
  visualizerData: { layout: a }
355
355
  }));
@@ -358,7 +358,7 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
358
358
  resolved: []
359
359
  } : {
360
360
  content: {
361
- type: t.GroupedVisualizer,
361
+ type: n.GroupedVisualizer,
362
362
  url: r.url,
363
363
  attachments: o,
364
364
  layout: a,
@@ -369,4 +369,4 @@ var g = (e, t) => URL.createObjectURL(s(e, t)), _ = (e) => {
369
369
  };
370
370
  };
371
371
  //#endregion
372
- export { V as annotationToOoxmlCanvasContent, z as annotationToPdfCanvasContent, S as clearAttachmentCache, A as hasAttachmentTextSource, U as referenceAttachmentToPdfCanvasContent, H as resolveAnnotationCanvasContent, F as resolveCodeCanvasContent, X as resolveGroupedVisualizerCanvasContent, L as resolveHtmlCanvasContent, j as resolveImageCanvasContent, J as resolveJsonCanvasContent, N as resolveMarkdownCanvasContent, q as resolveOoxmlCanvasContent, K as resolvePdfCanvasContent, M as resolveTextCanvasContent, Y as resolveVisualizerCanvasContent };
372
+ export { H as annotationToOoxmlCanvasContent, B as annotationToPdfCanvasContent, C as clearAttachmentCache, j as hasAttachmentTextSource, W as referenceAttachmentToPdfCanvasContent, U as resolveAnnotationCanvasContent, I as resolveCodeCanvasContent, Z as resolveGroupedVisualizerCanvasContent, R as resolveHtmlCanvasContent, M as resolveImageCanvasContent, Y as resolveJsonCanvasContent, P as resolveMarkdownCanvasContent, J as resolveOoxmlCanvasContent, q as resolvePdfCanvasContent, N as resolveTextCanvasContent, X as resolveVisualizerCanvasContent };
@@ -0,0 +1,3 @@
1
+ /** Formats MIME types as a human-readable, comma-separated list of dotted extensions (or the MIME type itself for wildcards). */
2
+ export declare const mimeTypesToAttachmentExtensionLabels: (types: string[]) => string;
3
+ //# sourceMappingURL=attachment-type-labels.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attachment-type-labels.d.ts","sourceRoot":"","sources":["../../src/files/attachment-type-labels.ts"],"names":[],"mappings":"AASA,iIAAiI;AACjI,eAAO,MAAM,oCAAoC,GAAI,OAAO,MAAM,EAAE,KAAG,MAiBxD,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { normalizeMimeType as e } from "@epam/ai-dial-chat-shared";
2
+ import { extension as t } from "mime-types";
3
+ //#region src/files/attachment-type-labels.ts
4
+ var n = (n) => n.map((n) => {
5
+ if (n.endsWith("/*")) return n;
6
+ let r = e(n), i = t(r);
7
+ if (i !== !1) return `.${i}`;
8
+ let a = r.split("/")[1];
9
+ return a == null ? n : `.${a.toLowerCase()}`;
10
+ }).join(", ");
11
+ //#endregion
12
+ export { n as mimeTypesToAttachmentExtensionLabels };
@@ -16,6 +16,4 @@ export declare const mimeTypesToDialFileAcceptTypes: (types?: string[]) => DialF
16
16
  * given or any type accepts everything.
17
17
  */
18
18
  export declare const mimeTypesToFileAccept: (types?: string[]) => string | undefined;
19
- /** Formats MIME types as a human-readable, comma-separated list of dotted extensions (or the MIME type itself for wildcards). */
20
- export declare const mimeTypesToAttachmentExtensionLabels: (types: string[]) => string;
21
19
  //# sourceMappingURL=attachment-types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"attachment-types.d.ts","sourceRoot":"","sources":["../../src/files/attachment-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,KACX,IAAI,IAAI,kBAAgE,CAAC;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EAAE,KACf,kBAAkB,EAAE,GAAG,SAYzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,KAAG,MAAM,GAAG,SASjE,CAAC;AAEF,iIAAiI;AACjI,eAAO,MAAM,oCAAoC,GAAI,OAAO,MAAM,EAAE,KAAG,MAiBxD,CAAC"}
1
+ {"version":3,"file":"attachment-types.d.ts","sourceRoot":"","sources":["../../src/files/attachment-types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAI3E,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,KACX,IAAI,IAAI,kBAAgE,CAAC;AAE5E;;;;;;;GAOG;AACH,eAAO,MAAM,8BAA8B,GACzC,QAAQ,MAAM,EAAE,KACf,kBAAkB,EAAE,GAAG,SAYzB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,QAAQ,MAAM,EAAE,KAAG,MAAM,GAAG,SASjE,CAAC"}
@@ -1,17 +1,10 @@
1
1
  import { normalizeMimeType as e } from "@epam/ai-dial-chat-shared";
2
- import { extension as t } from "mime-types";
3
2
  //#region src/files/attachment-types.ts
4
- var n = "*/*", r = (e) => e.startsWith(".") || e.includes("/"), i = (t) => {
5
- if (t != null) return t.map((t) => t === "*" ? n : t.startsWith(".") ? t : e(t)).filter(r);
6
- }, a = (e) => {
7
- let t = i(e);
8
- if (t != null && t.length !== 0 && !t.some((e) => e === n)) return t.join(",");
9
- }, o = (n) => n.map((n) => {
10
- if (n.endsWith("/*")) return n;
11
- let r = e(n), i = t(r);
12
- if (i !== !1) return `.${i}`;
13
- let a = r.split("/")[1];
14
- return a == null ? n : `.${a.toLowerCase()}`;
15
- }).join(", ");
3
+ var t = "*/*", n = (e) => e.startsWith(".") || e.includes("/"), r = (r) => {
4
+ if (r != null) return r.map((n) => n === "*" ? t : n.startsWith(".") ? n : e(n)).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
+ };
16
9
  //#endregion
17
- export { r as isDialFileAcceptType, o as mimeTypesToAttachmentExtensionLabels, i as mimeTypesToDialFileAcceptTypes, a as mimeTypesToFileAccept };
10
+ export { n as isDialFileAcceptType, r as mimeTypesToDialFileAcceptTypes, i as mimeTypesToFileAccept };
@@ -1,6 +1,24 @@
1
1
  import { DialFile } from '@epam/ai-dial-ui-kit';
2
2
  /** True when `url` looks like a DIAL Core file id (`files/{bucket}/{path}`). */
3
3
  export declare const isDialFileId: (url: string) => boolean;
4
+ /** The decoded parts of a DIAL Core project file id, `projects/{bucket}/{path}/files/{filePath}`. */
5
+ export interface DialProjectFileIdParts {
6
+ /** The project id, `projects/{bucket}/{path}`, with every segment decoded. */
7
+ projectId: string;
8
+ /** The decoded segments of the file path inside the project, e.g. `['artifacts', 'run-1', 'data.csv']`. */
9
+ filePath: string[];
10
+ }
11
+ /**
12
+ * Returns the decoded parts of a DIAL Core project file id, ignoring any
13
+ * `#...` fragment, or `undefined` when `url` is not one: no `projects/`
14
+ * prefix, no project path, a folder (trailing `/`), an empty segment or a
15
+ * malformed escape.
16
+ */
17
+ export declare const parseDialProjectFileId: (url: string) => DialProjectFileIdParts | undefined;
18
+ /** True when `url` is a DIAL Core id of a file inside a project, `projects/{bucket}/{path}/files/{filePath}`; see {@link parseDialProjectFileId}. */
19
+ export declare const isDialProjectFileId: (url: string) => boolean;
20
+ /** True when `url` is a DIAL Core file id (`files/…`) or a project file id (`projects/…/files/…`): an id the host resolves to one of its own download routes. */
21
+ export declare const isDialStoredFileId: (url: string) => boolean;
4
22
  /** True when `url` is a DIAL Core folder id: a file id ending with `/`, ignoring any `#...` fragment. */
5
23
  export declare const isDialFolderId: (url: string) => boolean;
6
24
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"dial-file.d.ts","sourceRoot":"","sources":["../../src/files/dial-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGvE,gFAAgF;AAChF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAAmC,CAAC;AAE/E,yGAAyG;AACzG,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OACS,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,cAAc,MAAM,EACpB,QAAQ,MAAM,KACb,MAmBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,KACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAcrC,CAAC;AAEF,oFAAoF;AACpF,oBAAY,iBAAiB;IAC3B,wBAAwB;IACxB,IAAI,SAAS;IACb,0BAA0B;IAC1B,MAAM,WAAW;IACjB,6BAA6B;IAC7B,QAAQ,aAAa;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,KAC3C,iBAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC,EAC7C,QAAQ,MAAM,KACb,MAAM,GAAG,IAcX,CAAC"}
1
+ {"version":3,"file":"dial-file.d.ts","sourceRoot":"","sources":["../../src/files/dial-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,KAAK,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGvE,gFAAgF;AAChF,eAAO,MAAM,YAAY,GAAI,KAAK,MAAM,KAAG,OAAmC,CAAC;AAK/E,qGAAqG;AACrG,MAAM,WAAW,sBAAsB;IACrC,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAkBD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GACjC,KAAK,MAAM,KACV,sBAAsB,GAAG,SAqB3B,CAAC;AAEF,qJAAqJ;AACrJ,eAAO,MAAM,mBAAmB,GAAI,KAAK,MAAM,KAAG,OACb,CAAC;AAEtC,iKAAiK;AACjK,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,KAAG,OACF,CAAC;AAEhD,yGAAyG;AACzG,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,KAAG,OACS,CAAC;AAEvD;;;GAGG;AACH,eAAO,MAAM,2BAA2B,GACtC,cAAc,MAAM,EACpB,QAAQ,MAAM,KACb,MAmBF,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,MAAM,KACb;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,SAcrC,CAAC;AAEF,oFAAoF;AACpF,oBAAY,iBAAiB;IAC3B,wBAAwB;IACxB,IAAI,SAAS;IACb,0BAA0B;IAC1B,MAAM,WAAW;IACjB,6BAA6B;IAC7B,QAAQ,aAAa;CACtB;AAED,4EAA4E;AAC5E,eAAO,MAAM,oBAAoB,GAC/B,OAAO,SAAS,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,EAAE,KAC3C,iBAKF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,IAAI,GAAG,QAAQ,CAAC,EAC7C,QAAQ,MAAM,KACb,MAAM,GAAG,IAcX,CAAC"}
@@ -1,7 +1,32 @@
1
1
  import { safeDecodeURI as e } from "../shared/string-utils.js";
2
2
  import { DialFileNodeType as t } from "@epam/ai-dial-ui-kit";
3
3
  //#region src/files/dial-file.ts
4
- var n = (e) => e.startsWith("files/"), r = (e) => n(e) && e.split("#")[0].endsWith("/"), i = (t, r) => {
4
+ var n = (e) => e.startsWith("files/"), r = "projects/", i = "/files/", a = (e) => {
5
+ let t = [];
6
+ for (let n of e.split("/")) {
7
+ let e;
8
+ try {
9
+ e = decodeURIComponent(n);
10
+ } catch {
11
+ return;
12
+ }
13
+ if (e === "") return;
14
+ t.push(e);
15
+ }
16
+ return t;
17
+ }, o = (e) => {
18
+ let t = e.split("#")[0];
19
+ if (!t.startsWith(r)) return;
20
+ let n = t.indexOf("/", 9);
21
+ if (n <= 9) return;
22
+ let o = t.indexOf(i, n);
23
+ if (o <= n) return;
24
+ let s = a(t.slice(9, o)), c = a(t.slice(o + 7));
25
+ if (s != null && c != null) return {
26
+ projectId: `${r}${s.join("/")}`,
27
+ filePath: c
28
+ };
29
+ }, s = (e) => o(e) != null, c = (e) => n(e) || s(e), l = (e) => n(e) && e.split("#")[0].endsWith("/"), u = (t, r) => {
5
30
  let i = `files/${r}/`;
6
31
  if (t.startsWith(i)) return e(t.slice(i.length));
7
32
  if (n(t)) {
@@ -12,7 +37,7 @@ var n = (e) => e.startsWith("files/"), r = (e) => n(e) && e.split("#")[0].endsWi
12
37
  }
13
38
  }
14
39
  return t;
15
- }, a = (e) => {
40
+ }, d = (e) => {
16
41
  if (!n(e)) return;
17
42
  let t = e.slice(6), r = t.indexOf("/");
18
43
  if (r < 0) return;
@@ -26,13 +51,13 @@ var n = (e) => e.startsWith("files/"), r = (e) => n(e) && e.split("#")[0].endsWi
26
51
  bucket: i,
27
52
  path: o
28
53
  };
29
- }, o = /* @__PURE__ */ function(e) {
54
+ }, f = /* @__PURE__ */ function(e) {
30
55
  return e.File = "file", e.Folder = "folder", e.Multiple = "multiple", e;
31
- }({}), s = (e) => e.length === 1 ? e[0].nodeType === t.FOLDER ? "folder" : "file" : "multiple", c = (e, t) => {
56
+ }({}), p = (e) => e.length === 1 ? e[0].nodeType === t.FOLDER ? "folder" : "file" : "multiple", m = (e, t) => {
32
57
  let r = e.url ?? e.id ?? "";
33
58
  if (!r) return null;
34
59
  let i = (n(r) ? r : `files/${e.bucket ?? t}/${r.replace(/^\/+/, "")}`).split("/").filter((e) => e !== ".." && e !== ".").join("/");
35
60
  return i.endsWith("/") ? i : `${i}/`;
36
61
  };
37
62
  //#endregion
38
- export { o as FileSelectionKind, s as getFileSelectionKind, n as isDialFileId, r as isDialFolderId, a as resolveDialFileBucketAndPath, c as resolveDialFolderPath, i as resolveRelativeDialFilePath };
63
+ export { f as FileSelectionKind, p as getFileSelectionKind, n as isDialFileId, l as isDialFolderId, s as isDialProjectFileId, c as isDialStoredFileId, o as parseDialProjectFileId, d as resolveDialFileBucketAndPath, m as resolveDialFolderPath, u as resolveRelativeDialFilePath };