@acorex/components 21.0.3-next.40 → 21.0.3-next.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/{acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs → acorex-components-conversation-open-composer-picker-for-files-Duvap4M4.mjs} +2 -3
- package/fesm2022/{acorex-components-conversation-open-composer-picker-for-files-Du8Lj9Sp.mjs.map → acorex-components-conversation-open-composer-picker-for-files-Duvap4M4.mjs.map} +1 -1
- package/fesm2022/acorex-components-conversation.mjs +22456 -1
- package/fesm2022/acorex-components-conversation.mjs.map +1 -1
- package/package.json +3 -3
- package/types/acorex-components-conversation.d.ts +1228 -48
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs +0 -13711
- package/fesm2022/acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs +0 -119
- package/fesm2022/acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs +0 -59
- package/fesm2022/acorex-components-conversation-audio-composer.payload-BHQJNyXz.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs +0 -432
- package/fesm2022/acorex-components-conversation-audio-picker.component-BD_fN2Ip.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs +0 -177
- package/fesm2022/acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs +0 -54
- package/fesm2022/acorex-components-conversation-audio.payload-Bag4aTut.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs +0 -100
- package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs +0 -121
- package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs +0 -84
- package/fesm2022/acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs +0 -238
- package/fesm2022/acorex-components-conversation-conversation-info-media-view.component-Mhk7JE6K.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs +0 -1080
- package/fesm2022/acorex-components-conversation-conversation-info-panel.component-CNaM5ajR.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs +0 -102
- package/fesm2022/acorex-components-conversation-conversation-video.file-type-Pescv4Vu.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs +0 -90
- package/fesm2022/acorex-components-conversation-conversation-voice.file-type-DDd47o4r.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs +0 -44
- package/fesm2022/acorex-components-conversation-fallback-renderer.component-CYh_6O6j.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs +0 -64
- package/fesm2022/acorex-components-conversation-file-composer.payload-Dy7aG-EH.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs +0 -468
- package/fesm2022/acorex-components-conversation-file-picker.component-DCVgl33l.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs +0 -125
- package/fesm2022/acorex-components-conversation-file-renderer.component-DgCi06Mg.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs +0 -50
- package/fesm2022/acorex-components-conversation-file.payload-DyFxTQYn.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs +0 -21
- package/fesm2022/acorex-components-conversation-format-media-DUD4vA6F.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs +0 -77
- package/fesm2022/acorex-components-conversation-image-attachment.component-CLMGxXPl.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs +0 -407
- package/fesm2022/acorex-components-conversation-image-picker.component-CS343UDa.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs +0 -83
- package/fesm2022/acorex-components-conversation-image-renderer.component-Cy0TA6cL.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs +0 -184
- package/fesm2022/acorex-components-conversation-index-3V2b14I0.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs +0 -266
- package/fesm2022/acorex-components-conversation-index-MCvfr9Zd.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs +0 -149
- package/fesm2022/acorex-components-conversation-location-picker.component-DcNQzuoU.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs +0 -118
- package/fesm2022/acorex-components-conversation-location-renderer.component-Cw2PB0LM.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs +0 -17
- package/fesm2022/acorex-components-conversation-media-formatters-DV3wEEno.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs +0 -140
- package/fesm2022/acorex-components-conversation-media-playback-info-bar-banner.component-DbWUl6M2.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs +0 -33
- package/fesm2022/acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs +0 -172
- package/fesm2022/acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs +0 -81
- package/fesm2022/acorex-components-conversation-pagination-demo-data-oIT_YJmN.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs +0 -91
- package/fesm2022/acorex-components-conversation-picker-header.component-BneIFjXq.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs +0 -537
- package/fesm2022/acorex-components-conversation-picker-toolbar.component-BthRvEeE.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs +0 -163
- package/fesm2022/acorex-components-conversation-picker-upload-C-PlKPaU.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs +0 -68
- package/fesm2022/acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs +0 -95
- package/fesm2022/acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs +0 -187
- package/fesm2022/acorex-components-conversation-search.component-B-nc6xiA.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs +0 -170
- package/fesm2022/acorex-components-conversation-send-message-media-BRklgfV7.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs +0 -750
- package/fesm2022/acorex-components-conversation-shared-storage.seed-J9PA4l3c.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs +0 -103
- package/fesm2022/acorex-components-conversation-sticker-renderer.component-BmBwy7Ig.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs +0 -55
- package/fesm2022/acorex-components-conversation-system-renderer.component-uie3tm5N.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs +0 -109
- package/fesm2022/acorex-components-conversation-text-renderer.component-DNAquHYK.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs +0 -105
- package/fesm2022/acorex-components-conversation-video-attachment.component-CGaUhnSb.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs +0 -62
- package/fesm2022/acorex-components-conversation-video-composer.payload-DMqRkafr.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs +0 -446
- package/fesm2022/acorex-components-conversation-video-picker.component-DPwSBnoH.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs +0 -181
- package/fesm2022/acorex-components-conversation-video-renderer.component-DKa9mUe2.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs +0 -54
- package/fesm2022/acorex-components-conversation-video.payload-C8QaqxuX.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs +0 -17
- package/fesm2022/acorex-components-conversation-voice-composer.payload-DLVow7ex.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs +0 -344
- package/fesm2022/acorex-components-conversation-voice-recorder.component-D_rdANZN.mjs.map +0 -1
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs +0 -270
- package/fesm2022/acorex-components-conversation-voice-renderer.component-BY5FJcT8.mjs.map +0 -1
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
import { CommonModule } from '@angular/common';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, DestroyRef, viewChildren, signal, input, computed, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
4
|
-
import { l as copyWithFileTypeFallback, m as AXConversationInfoBarService } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
5
|
-
import { AXFileTypeRegistryService } from '@acorex/core/file';
|
|
6
|
-
import { AXTranslationService } from '@acorex/core/translation';
|
|
7
|
-
import { A as AXConversationMessageRendererCopyHostComponent, m as mediaCopyText } from './acorex-components-conversation-message-renderer-copy-host.component-oXTr_Lfq.mjs';
|
|
8
|
-
import { normalizeAudioPayload } from './acorex-components-conversation-audio.payload-Bag4aTut.mjs';
|
|
9
|
-
import { A as AXConversationAudioAttachmentComponent } from './acorex-components-conversation-audio-attachment.component-CLvS3W8F.mjs';
|
|
10
|
-
import { A as AXConversationMessageRendererStateComponent } from './acorex-components-conversation-message-renderer-state.component-Dp-JdHWr.mjs';
|
|
11
|
-
import { b as bindMediaRendererContentState, r as reportMediaLoadError, s as syncPlaybackInfoBarBanner } from './acorex-components-conversation-playback-banner-sync-D8FFKde6.mjs';
|
|
12
|
-
import './acorex-components-conversation-renderer-shared.styles-Digah3Zn.mjs';
|
|
13
|
-
|
|
14
|
-
class AXConversationAudioRendererComponent extends AXConversationMessageRendererCopyHostComponent {
|
|
15
|
-
copy() {
|
|
16
|
-
return copyWithFileTypeFallback(this.message(), this.fileTypes, () => {
|
|
17
|
-
const p = this.payload();
|
|
18
|
-
return mediaCopyText(p.caption, 'Audio', 'audio files', p.audios.length, p.audios.map((item) => item.title?.trim() || item.url?.trim()));
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
constructor() {
|
|
22
|
-
super();
|
|
23
|
-
this.fileTypes = inject(AXFileTypeRegistryService);
|
|
24
|
-
this.translation = inject(AXTranslationService);
|
|
25
|
-
this.destroyRef = inject(DestroyRef);
|
|
26
|
-
this.infoBarService = inject(AXConversationInfoBarService, { optional: true });
|
|
27
|
-
this.attachments = viewChildren(AXConversationAudioAttachmentComponent, ...(ngDevMode ? [{ debugName: "attachments" }] : /* istanbul ignore next */ []));
|
|
28
|
-
this._contentState = signal('ready', ...(ngDevMode ? [{ debugName: "_contentState" }] : /* istanbul ignore next */ []));
|
|
29
|
-
this.activeTrackIndex = signal(0, ...(ngDevMode ? [{ debugName: "activeTrackIndex" }] : /* istanbul ignore next */ []));
|
|
30
|
-
this.isPlaying = signal(false, ...(ngDevMode ? [{ debugName: "isPlaying" }] : /* istanbul ignore next */ []));
|
|
31
|
-
this.currentTime = signal(0, ...(ngDevMode ? [{ debugName: "currentTime" }] : /* istanbul ignore next */ []));
|
|
32
|
-
this.duration = signal(0, ...(ngDevMode ? [{ debugName: "duration" }] : /* istanbul ignore next */ []));
|
|
33
|
-
this.message = input.required(...(ngDevMode ? [{ debugName: "message" }] : /* istanbul ignore next */ []));
|
|
34
|
-
this.rendererState = computed(() => ({
|
|
35
|
-
deliveryStatus: this.message().status,
|
|
36
|
-
contentState: this._contentState(),
|
|
37
|
-
}), ...(ngDevMode ? [{ debugName: "rendererState" }] : /* istanbul ignore next */ []));
|
|
38
|
-
this.payload = computed(() => normalizeAudioPayload(this.message().payload), ...(ngDevMode ? [{ debugName: "payload" }] : /* istanbul ignore next */ []));
|
|
39
|
-
this.audios = computed(() => this.payload().audios, ...(ngDevMode ? [{ debugName: "audios" }] : /* istanbul ignore next */ []));
|
|
40
|
-
this.caption = computed(() => this.payload().caption?.trim() || '', ...(ngDevMode ? [{ debugName: "caption" }] : /* istanbul ignore next */ []));
|
|
41
|
-
this.audioLoadErrorLabel = computed(() => this.translation.translateSync('@acorex:chat.renderer-state.could-not-load-audio'), ...(ngDevMode ? [{ debugName: "audioLoadErrorLabel" }] : /* istanbul ignore next */ []));
|
|
42
|
-
bindMediaRendererContentState(this.message, this._contentState, () => this.audios());
|
|
43
|
-
this.destroyRef.onDestroy(() => {
|
|
44
|
-
const messageId = this.message()?.id;
|
|
45
|
-
if (messageId && this.infoBarService) {
|
|
46
|
-
this.infoBarService.hideMessageBanner(messageId);
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
onPlayingChange(index, playing) {
|
|
51
|
-
if (playing) {
|
|
52
|
-
this.activeTrackIndex.set(index);
|
|
53
|
-
this.pauseOtherTracks(index);
|
|
54
|
-
this.isPlaying.set(true);
|
|
55
|
-
this.syncInfoBarBanner(true);
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
if (this.activeTrackIndex() === index) {
|
|
59
|
-
this.isPlaying.set(false);
|
|
60
|
-
this.syncInfoBarBanner();
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
onTimeUpdate(index, time) {
|
|
64
|
-
if (this.activeTrackIndex() !== index) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
this.currentTime.set(time);
|
|
68
|
-
this.syncInfoBarBanner();
|
|
69
|
-
}
|
|
70
|
-
onDurationChange(index, duration) {
|
|
71
|
-
if (this.activeTrackIndex() !== index) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
this.duration.set(duration);
|
|
75
|
-
this.syncInfoBarBanner();
|
|
76
|
-
}
|
|
77
|
-
onPlaybackEnded(index) {
|
|
78
|
-
if (this.activeTrackIndex() !== index) {
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
this.isPlaying.set(false);
|
|
82
|
-
this.currentTime.set(0);
|
|
83
|
-
this.syncInfoBarBanner();
|
|
84
|
-
}
|
|
85
|
-
onPlaybackError() {
|
|
86
|
-
if (!reportMediaLoadError(this.message(), this._contentState)) {
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
this.isPlaying.set(false);
|
|
90
|
-
this.infoBarService?.hideMessageBanner(this.message().id);
|
|
91
|
-
}
|
|
92
|
-
togglePlay() {
|
|
93
|
-
this.attachments()[this.activeTrackIndex()]?.togglePlay();
|
|
94
|
-
}
|
|
95
|
-
pauseOtherTracks(activeIndex) {
|
|
96
|
-
this.attachments().forEach((attachment, index) => {
|
|
97
|
-
if (index !== activeIndex) {
|
|
98
|
-
attachment.pause();
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
pausePlayback() {
|
|
103
|
-
this.attachments()[this.activeTrackIndex()]?.pause();
|
|
104
|
-
this.isPlaying.set(false);
|
|
105
|
-
}
|
|
106
|
-
syncInfoBarBanner(forceOpen = false) {
|
|
107
|
-
if (!this.infoBarService) {
|
|
108
|
-
return;
|
|
109
|
-
}
|
|
110
|
-
const message = this.message();
|
|
111
|
-
const track = this.audios()[this.activeTrackIndex()];
|
|
112
|
-
const title = this.payload().caption?.trim() || track?.title?.trim() || 'Audio';
|
|
113
|
-
syncPlaybackInfoBarBanner(this.infoBarService, message, {
|
|
114
|
-
title,
|
|
115
|
-
currentTime: this.currentTime(),
|
|
116
|
-
duration: this.duration() || track?.duration || 0,
|
|
117
|
-
isPlaying: this.isPlaying(),
|
|
118
|
-
onTogglePlay: () => this.togglePlay(),
|
|
119
|
-
onClose: () => this.pausePlayback(),
|
|
120
|
-
}, { forceOpen });
|
|
121
|
-
}
|
|
122
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationAudioRendererComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
123
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.9", type: AXConversationAudioRendererComponent, isStandalone: true, selector: "ax-conversation-audio-renderer", inputs: { message: { classPropertyName: "message", publicName: "message", isSignal: true, isRequired: true, transformFunction: null } }, viewQueries: [{ propertyName: "attachments", predicate: AXConversationAudioAttachmentComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
124
|
-
<div class="ax-conversation-msg ax-conversation-msg--wide">
|
|
125
|
-
<ax-conversation-message-renderer-state
|
|
126
|
-
[rendererState]="rendererState()"
|
|
127
|
-
[message]="message()"
|
|
128
|
-
[contentErrorLabel]="audioLoadErrorLabel()"
|
|
129
|
-
/>
|
|
130
|
-
<div class="ax-conversation-msg__stack">
|
|
131
|
-
@for (audio of audios(); track audio.mediaId ?? audio.url; let i = $index) {
|
|
132
|
-
<ax-conversation-audio-attachment
|
|
133
|
-
[item]="audio"
|
|
134
|
-
(playingChange)="onPlayingChange(i, $event)"
|
|
135
|
-
(timeUpdate)="onTimeUpdate(i, $event)"
|
|
136
|
-
(durationChange)="onDurationChange(i, $event)"
|
|
137
|
-
(playbackEnded)="onPlaybackEnded(i)"
|
|
138
|
-
(playbackError)="onPlaybackError()"
|
|
139
|
-
/>
|
|
140
|
-
}
|
|
141
|
-
</div>
|
|
142
|
-
@if (caption()) {
|
|
143
|
-
<p class="ax-conversation-msg__caption">{{ caption() }}</p>
|
|
144
|
-
}
|
|
145
|
-
</div>
|
|
146
|
-
`, isInline: true, styles: [":host{display:block;max-width:100%}.ax-conversation-msg,.ax-conversation-msg__stack{display:flex;flex-direction:column;gap:.375rem}.ax-conversation-msg__grid{display:grid;gap:2px;width:100%;border-radius:var(--ax-sys-border-radius, .5rem);overflow:hidden;background:rgb(var(--ax-sys-color-border-light-surface))}.ax-conversation-msg__grid--single{grid-template-columns:1fr}.ax-conversation-msg__grid--single ::ng-deep .ax-conversation-image-attachment{max-height:min(50dvh,20rem)}.ax-conversation-msg__grid--dual{grid-template-columns:repeat(2,1fr)}.ax-conversation-msg__grid--multi{grid-template-columns:repeat(3,1fr);grid-auto-rows:10rem}@container (max-width: 380px){.ax-conversation-msg__grid--multi{grid-template-columns:repeat(2,1fr);grid-auto-rows:10rem}}.ax-conversation-msg__caption{margin:0;padding:0 .125rem;font-size:.8125rem;line-height:1.4;word-break:break-word;opacity:.88}.ax-conversation-msg--flush{width:100%;max-width:100%;gap:0}.ax-conversation-msg--flush .ax-conversation-msg__caption{padding:.375rem .625rem 0}.ax-conversation-msg--flush .ax-conversation-msg__grid{border-radius:0;background:transparent}.ax-conversation-msg--flush .ax-conversation-msg__stack{gap:2px}.ax-conversation-msg--flush ::ng-deep .ax-conversation-video{border-radius:0}.ax-conversation-msg__card{border-radius:var(--ax-sys-border-radius, .5rem);border:1px solid rgb(var(--ax-sys-color-border-light-surface));background:rgb(var(--ax-sys-color-surface));overflow:hidden}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "component", type: AXConversationAudioAttachmentComponent, selector: "ax-conversation-audio-attachment", inputs: ["item"], outputs: ["playingChange", "timeUpdate", "durationChange", "playbackEnded", "playbackError"] }, { kind: "component", type: AXConversationMessageRendererStateComponent, selector: "ax-conversation-message-renderer-state", inputs: ["rendererState", "message", "contentErrorLabel", "deliveryFailedLabel", "showContentErrorChrome", "contentErrorStyle", "contentErrorIconClass", "placement", "contentRetryEnabled"], outputs: ["contentRetry"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
147
|
-
}
|
|
148
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationAudioRendererComponent, decorators: [{
|
|
149
|
-
type: Component,
|
|
150
|
-
args: [{ selector: 'ax-conversation-audio-renderer', imports: [CommonModule, AXConversationAudioAttachmentComponent, AXConversationMessageRendererStateComponent], changeDetection: ChangeDetectionStrategy.OnPush, template: `
|
|
151
|
-
<div class="ax-conversation-msg ax-conversation-msg--wide">
|
|
152
|
-
<ax-conversation-message-renderer-state
|
|
153
|
-
[rendererState]="rendererState()"
|
|
154
|
-
[message]="message()"
|
|
155
|
-
[contentErrorLabel]="audioLoadErrorLabel()"
|
|
156
|
-
/>
|
|
157
|
-
<div class="ax-conversation-msg__stack">
|
|
158
|
-
@for (audio of audios(); track audio.mediaId ?? audio.url; let i = $index) {
|
|
159
|
-
<ax-conversation-audio-attachment
|
|
160
|
-
[item]="audio"
|
|
161
|
-
(playingChange)="onPlayingChange(i, $event)"
|
|
162
|
-
(timeUpdate)="onTimeUpdate(i, $event)"
|
|
163
|
-
(durationChange)="onDurationChange(i, $event)"
|
|
164
|
-
(playbackEnded)="onPlaybackEnded(i)"
|
|
165
|
-
(playbackError)="onPlaybackError()"
|
|
166
|
-
/>
|
|
167
|
-
}
|
|
168
|
-
</div>
|
|
169
|
-
@if (caption()) {
|
|
170
|
-
<p class="ax-conversation-msg__caption">{{ caption() }}</p>
|
|
171
|
-
}
|
|
172
|
-
</div>
|
|
173
|
-
`, styles: [":host{display:block;max-width:100%}.ax-conversation-msg,.ax-conversation-msg__stack{display:flex;flex-direction:column;gap:.375rem}.ax-conversation-msg__grid{display:grid;gap:2px;width:100%;border-radius:var(--ax-sys-border-radius, .5rem);overflow:hidden;background:rgb(var(--ax-sys-color-border-light-surface))}.ax-conversation-msg__grid--single{grid-template-columns:1fr}.ax-conversation-msg__grid--single ::ng-deep .ax-conversation-image-attachment{max-height:min(50dvh,20rem)}.ax-conversation-msg__grid--dual{grid-template-columns:repeat(2,1fr)}.ax-conversation-msg__grid--multi{grid-template-columns:repeat(3,1fr);grid-auto-rows:10rem}@container (max-width: 380px){.ax-conversation-msg__grid--multi{grid-template-columns:repeat(2,1fr);grid-auto-rows:10rem}}.ax-conversation-msg__caption{margin:0;padding:0 .125rem;font-size:.8125rem;line-height:1.4;word-break:break-word;opacity:.88}.ax-conversation-msg--flush{width:100%;max-width:100%;gap:0}.ax-conversation-msg--flush .ax-conversation-msg__caption{padding:.375rem .625rem 0}.ax-conversation-msg--flush .ax-conversation-msg__grid{border-radius:0;background:transparent}.ax-conversation-msg--flush .ax-conversation-msg__stack{gap:2px}.ax-conversation-msg--flush ::ng-deep .ax-conversation-video{border-radius:0}.ax-conversation-msg__card{border-radius:var(--ax-sys-border-radius, .5rem);border:1px solid rgb(var(--ax-sys-color-border-light-surface));background:rgb(var(--ax-sys-color-surface));overflow:hidden}\n"] }]
|
|
174
|
-
}], ctorParameters: () => [], propDecorators: { attachments: [{ type: i0.ViewChildren, args: [i0.forwardRef(() => AXConversationAudioAttachmentComponent), { isSignal: true }] }], message: [{ type: i0.Input, args: [{ isSignal: true, alias: "message", required: true }] }] } });
|
|
175
|
-
|
|
176
|
-
export { AXConversationAudioRendererComponent };
|
|
177
|
-
//# sourceMappingURL=acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-conversation-audio-renderer.component-CcxVVprx.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/message-list/components/audio-renderer/audio-renderer.component.ts"],"sourcesContent":["import { CommonModule } from '@angular/common';\nimport {\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n computed,\n inject,\n input,\n signal,\n viewChildren,\n} from '@angular/core';\nimport { AXConversationInfoBarService } from '../../../../components';\nimport type { AXConversationAudioPayload, AXConversationMessage } from '../../../../models';\nimport type { AXConversationMessageRendererContentState } from '../../../../registries/message-renderer.registry';\nimport { AXFileTypeRegistryService } from '@acorex/core/file';\nimport { AXTranslationService } from '@acorex/core/translation';\nimport {\n AXConversationMessageRendererCopyHostComponent,\n mediaCopyText,\n} from '../shared/message-renderer-copy-host.component';\nimport { copyWithFileTypeFallback } from '../../../../utils/file-type-message.resolve';\nimport { normalizeAudioPayload } from './audio.payload';\nimport { AXConversationAudioAttachmentComponent } from '../shared/audio-attachment.component';\nimport { AXConversationMessageRendererStateComponent } from '../shared/message-renderer-state.component';\nimport { bindMediaRendererContentState, reportMediaLoadError } from '../shared/media-renderer-content-state';\nimport { syncPlaybackInfoBarBanner } from '../shared/playback-banner-sync';\nimport { AX_CONVERSATION_RENDERER_SHARED_STYLES } from '../shared/renderer-shared.styles';\n\n@Component({\n selector: 'ax-conversation-audio-renderer',\n imports: [CommonModule, AXConversationAudioAttachmentComponent, AXConversationMessageRendererStateComponent],\n changeDetection: ChangeDetectionStrategy.OnPush,\n template: `\n <div class=\"ax-conversation-msg ax-conversation-msg--wide\">\n <ax-conversation-message-renderer-state\n [rendererState]=\"rendererState()\"\n [message]=\"message()\"\n [contentErrorLabel]=\"audioLoadErrorLabel()\"\n />\n <div class=\"ax-conversation-msg__stack\">\n @for (audio of audios(); track audio.mediaId ?? audio.url; let i = $index) {\n <ax-conversation-audio-attachment\n [item]=\"audio\"\n (playingChange)=\"onPlayingChange(i, $event)\"\n (timeUpdate)=\"onTimeUpdate(i, $event)\"\n (durationChange)=\"onDurationChange(i, $event)\"\n (playbackEnded)=\"onPlaybackEnded(i)\"\n (playbackError)=\"onPlaybackError()\"\n />\n }\n </div>\n @if (caption()) {\n <p class=\"ax-conversation-msg__caption\">{{ caption() }}</p>\n }\n </div>\n `,\n styles: [AX_CONVERSATION_RENDERER_SHARED_STYLES],\n})\nexport class AXConversationAudioRendererComponent extends AXConversationMessageRendererCopyHostComponent {\n private readonly fileTypes = inject(AXFileTypeRegistryService);\n private readonly translation = inject(AXTranslationService);\n private readonly destroyRef = inject(DestroyRef);\n private readonly infoBarService = inject(AXConversationInfoBarService, { optional: true });\n private readonly attachments = viewChildren(AXConversationAudioAttachmentComponent);\n\n private readonly _contentState = signal<AXConversationMessageRendererContentState>('ready');\n private readonly activeTrackIndex = signal(0);\n private readonly isPlaying = signal(false);\n private readonly currentTime = signal(0);\n private readonly duration = signal(0);\n\n readonly message = input.required<AXConversationMessage>();\n readonly rendererState = computed(() => ({\n deliveryStatus: this.message().status,\n contentState: this._contentState(),\n }));\n\n readonly payload = computed(() => normalizeAudioPayload(this.message().payload as AXConversationAudioPayload));\n readonly audios = computed(() => this.payload().audios);\n readonly caption = computed(() => this.payload().caption?.trim() || '');\n\n readonly audioLoadErrorLabel = computed(() =>\n this.translation.translateSync('@acorex:chat.renderer-state.could-not-load-audio'),\n );\n\n copy(): Promise<string> {\n return copyWithFileTypeFallback(this.message(), this.fileTypes, () => {\n const p = this.payload();\n return mediaCopyText(\n p.caption,\n 'Audio',\n 'audio files',\n p.audios.length,\n p.audios.map((item) => item.title?.trim() || item.url?.trim()),\n );\n });\n }\n\n constructor() {\n super();\n bindMediaRendererContentState(this.message, this._contentState, () => this.audios());\n\n this.destroyRef.onDestroy(() => {\n const messageId = this.message()?.id;\n if (messageId && this.infoBarService) {\n this.infoBarService.hideMessageBanner(messageId);\n }\n });\n }\n\n onPlayingChange(index: number, playing: boolean): void {\n if (playing) {\n this.activeTrackIndex.set(index);\n this.pauseOtherTracks(index);\n this.isPlaying.set(true);\n this.syncInfoBarBanner(true);\n return;\n }\n\n if (this.activeTrackIndex() === index) {\n this.isPlaying.set(false);\n this.syncInfoBarBanner();\n }\n }\n\n onTimeUpdate(index: number, time: number): void {\n if (this.activeTrackIndex() !== index) {\n return;\n }\n this.currentTime.set(time);\n this.syncInfoBarBanner();\n }\n\n onDurationChange(index: number, duration: number): void {\n if (this.activeTrackIndex() !== index) {\n return;\n }\n this.duration.set(duration);\n this.syncInfoBarBanner();\n }\n\n onPlaybackEnded(index: number): void {\n if (this.activeTrackIndex() !== index) {\n return;\n }\n this.isPlaying.set(false);\n this.currentTime.set(0);\n this.syncInfoBarBanner();\n }\n\n onPlaybackError(): void {\n if (!reportMediaLoadError(this.message(), this._contentState)) {\n return;\n }\n this.isPlaying.set(false);\n this.infoBarService?.hideMessageBanner(this.message().id);\n }\n\n togglePlay(): void {\n this.attachments()[this.activeTrackIndex()]?.togglePlay();\n }\n\n private pauseOtherTracks(activeIndex: number): void {\n this.attachments().forEach((attachment, index) => {\n if (index !== activeIndex) {\n attachment.pause();\n }\n });\n }\n\n private pausePlayback(): void {\n this.attachments()[this.activeTrackIndex()]?.pause();\n this.isPlaying.set(false);\n }\n\n private syncInfoBarBanner(forceOpen = false): void {\n if (!this.infoBarService) {\n return;\n }\n const message = this.message();\n const track = this.audios()[this.activeTrackIndex()];\n const title = this.payload().caption?.trim() || track?.title?.trim() || 'Audio';\n\n syncPlaybackInfoBarBanner(\n this.infoBarService,\n message,\n {\n title,\n currentTime: this.currentTime(),\n duration: this.duration() || track?.duration || 0,\n isPlaying: this.isPlaying(),\n onTogglePlay: () => this.togglePlay(),\n onClose: () => this.pausePlayback(),\n },\n { forceOpen },\n );\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AA0DM,MAAO,oCAAqC,SAAQ,8CAA8C,CAAA;IA2BtG,IA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A,EAAA,WAAA,EAAA,qBAAA,CAAA,EAAA,OAAA,EAAA,CAAA,cAAA,CAAA,EAAA,CAAA,EAAA,eAAA,EAAA,EAAA,CAAA,uBAAA,CAAA,MAAA,EAAA,CAAA,CAAA;;2FA4BhG,oCAAoC,EAAA,UAAA,EAAA,CAAA;kBA9BhD,SAAS;AACE,YAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,gCAAgC,EAAA,OAAA,EACjC,CAAC,YAAY,EAAE,sCAAsC,EAAE,2CAA2C,CAAC,EAAA,eAAA,EAC3F,uBAAuB,CAAC,MAAM,EAAA,QAAA,EACrC;;;;;;;;;;;;;;;;;;;;;;;AAuBT,EAAA,CAAA,EAAA,MAAA,EAAA,CAAA,87CAAA,CAAA,EAAA;0HAQ2C,sCAAsC,CAAA,EAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,OAAA,EAAA,CAAA,EAAA,IAAA,EAAA,EAAA,CAAA,KAAA,EAAA,IAAA,EAAA,CAAA,EAAA,QAAA,EAAA,IAAA,EAAA,KAAA,EAAA,SAAA,EAAA,QAAA,EAAA,IAAA,EAAA,CAAA,EAAA,CAAA,EAAA,EAAA,CAAA;;;;"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { s as resolvePersistableMediaUrl } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
2
|
-
|
|
3
|
-
function loose(payload) {
|
|
4
|
-
return payload;
|
|
5
|
-
}
|
|
6
|
-
function str(value) {
|
|
7
|
-
return typeof value === 'string' && value.length > 0 ? value : undefined;
|
|
8
|
-
}
|
|
9
|
-
function num(value, fallback = 0) {
|
|
10
|
-
return typeof value === 'number' && Number.isFinite(value) ? value : fallback;
|
|
11
|
-
}
|
|
12
|
-
function sanitizeAudioItem(item) {
|
|
13
|
-
const url = resolvePersistableMediaUrl(item.url);
|
|
14
|
-
if (url === item.url) {
|
|
15
|
-
return item;
|
|
16
|
-
}
|
|
17
|
-
return { ...item, url };
|
|
18
|
-
}
|
|
19
|
-
function normalizeAudioPayload(payload) {
|
|
20
|
-
const raw = loose(payload);
|
|
21
|
-
const existing = raw['audios'];
|
|
22
|
-
if (Array.isArray(existing) && existing.length > 0) {
|
|
23
|
-
return {
|
|
24
|
-
type: 'audio',
|
|
25
|
-
audios: existing.map(sanitizeAudioItem),
|
|
26
|
-
caption: payload.caption,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
const url = resolvePersistableMediaUrl(str(raw['url']));
|
|
30
|
-
const mediaId = str(raw['mediaId']);
|
|
31
|
-
if (url || mediaId) {
|
|
32
|
-
return {
|
|
33
|
-
type: 'audio',
|
|
34
|
-
caption: payload.caption,
|
|
35
|
-
audios: [
|
|
36
|
-
{
|
|
37
|
-
...(url ? { url } : {}),
|
|
38
|
-
title: str(raw['title']),
|
|
39
|
-
duration: num(raw['duration']),
|
|
40
|
-
mimeType: str(raw['mimeType']),
|
|
41
|
-
size: typeof raw['size'] === 'number' ? raw['size'] : undefined,
|
|
42
|
-
mediaId,
|
|
43
|
-
artist: str(raw['artist']),
|
|
44
|
-
coverUrl: str(raw['coverUrl']),
|
|
45
|
-
waveform: Array.isArray(raw['waveform']) ? raw['waveform'] : undefined,
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
return { type: 'audio', audios: [], caption: payload.caption };
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export { normalizeAudioPayload };
|
|
54
|
-
//# sourceMappingURL=acorex-components-conversation-audio.payload-Bag4aTut.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-conversation-audio.payload-Bag4aTut.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/message-list/components/audio-renderer/audio.payload.ts"],"sourcesContent":["import type { AXConversationAudioMediaItem, AXConversationAudioPayload } from '../../../../models';\nimport { resolvePersistableMediaUrl } from '../../../composer/components/shared/persisted-media-url';\n\ntype AXConversationLooseRecord = Record<string, unknown>;\n\nfunction loose(payload: AXConversationAudioPayload): AXConversationLooseRecord {\n return payload as unknown as AXConversationLooseRecord;\n}\n\nfunction str(value: unknown): string | undefined {\n return typeof value === 'string' && value.length > 0 ? value : undefined;\n}\n\nfunction num(value: unknown, fallback = 0): number {\n return typeof value === 'number' && Number.isFinite(value) ? value : fallback;\n}\n\nfunction sanitizeAudioItem(item: AXConversationAudioMediaItem): AXConversationAudioMediaItem {\n const url = resolvePersistableMediaUrl(item.url);\n if (url === item.url) {\n return item;\n }\n return { ...item, url };\n}\n\nexport function normalizeAudioPayload(payload: AXConversationAudioPayload): AXConversationAudioPayload {\n const raw = loose(payload);\n const existing = raw['audios'];\n if (Array.isArray(existing) && existing.length > 0) {\n return {\n type: 'audio',\n audios: (existing as AXConversationAudioMediaItem[]).map(sanitizeAudioItem),\n caption: payload.caption,\n };\n }\n\n const url = resolvePersistableMediaUrl(str(raw['url']));\n const mediaId = str(raw['mediaId']);\n if (url || mediaId) {\n return {\n type: 'audio',\n caption: payload.caption,\n audios: [\n {\n ...(url ? { url } : {}),\n title: str(raw['title']),\n duration: num(raw['duration']),\n mimeType: str(raw['mimeType']),\n size: typeof raw['size'] === 'number' ? raw['size'] : undefined,\n mediaId,\n artist: str(raw['artist']),\n coverUrl: str(raw['coverUrl']),\n waveform: Array.isArray(raw['waveform']) ? (raw['waveform'] as number[]) : undefined,\n },\n ],\n };\n }\n\n return { type: 'audio', audios: [], caption: payload.caption };\n}\n"],"names":[],"mappings":";;AAKA,SAAS,KAAK,CAAC,OAAmC,EAAA;AAChD,IAAA,OAAO,OAA+C;AACxD;AAEA,SAAS,GAAG,CAAC,KAAc,EAAA;AACzB,IAAA,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,SAAS;AAC1E;AAEA,SAAS,GAAG,CAAC,KAAc,EAAE,QAAQ,GAAG,CAAC,EAAA;AACv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AAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC9B,oBAAA,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;AAC9B,oBAAA,IAAI,EAAE,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,SAAS;oBAC/D,OAAO;AACP,oBAAA,MAAM,EAAE,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC1B,oBAAA,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;oBAC9B,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC,GAAI,GAAG,CAAC,UAAU,CAAc,GAAG,SAAS;AACrF,iBAAA;AACF,aAAA;SACF;IACH;AAEA,IAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE;AAChE;;;;"}
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { createFileTypeMetadata, AXFileTypeInfoProvider } from '@acorex/core/file';
|
|
2
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable } from '@angular/core';
|
|
5
|
-
import { p as AX_CONVERSATION_AUDIO_CATALOG } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
6
|
-
import { normalizeAudioPayload } from './acorex-components-conversation-audio.payload-Bag4aTut.mjs';
|
|
7
|
-
import { f as formatDuration, a as formatFileSize } from './acorex-components-conversation-media-formatters-DV3wEEno.mjs';
|
|
8
|
-
|
|
9
|
-
const MB = 1024 * 1024;
|
|
10
|
-
const AX_CONVERSATION_AUDIO_PRESENTATION = {
|
|
11
|
-
icon: 'fa-light fa-music text-amber-500',
|
|
12
|
-
title: 'Audio',
|
|
13
|
-
};
|
|
14
|
-
const AX_CONVERSATION_AUDIO_UTILITY = {
|
|
15
|
-
preview: 'preview',
|
|
16
|
-
duration: 'duration',
|
|
17
|
-
formatSize: 'formatSize',
|
|
18
|
-
formatDuration: 'formatDuration',
|
|
19
|
-
createLocalPreviewUrl: 'createLocalPreviewUrl',
|
|
20
|
-
};
|
|
21
|
-
function blobUrl(ctx, blob) {
|
|
22
|
-
if (!isPlatformBrowser(ctx.platformId)) {
|
|
23
|
-
return '';
|
|
24
|
-
}
|
|
25
|
-
return URL.createObjectURL(blob);
|
|
26
|
-
}
|
|
27
|
-
function mediaDuration(ctx, file) {
|
|
28
|
-
if (!isPlatformBrowser(ctx.platformId)) {
|
|
29
|
-
return Promise.resolve(0);
|
|
30
|
-
}
|
|
31
|
-
return new Promise((resolve, reject) => {
|
|
32
|
-
const el = document.createElement('audio');
|
|
33
|
-
el.preload = 'metadata';
|
|
34
|
-
el.onloadedmetadata = () => {
|
|
35
|
-
URL.revokeObjectURL(el.src);
|
|
36
|
-
resolve(el.duration);
|
|
37
|
-
};
|
|
38
|
-
el.onerror = () => {
|
|
39
|
-
URL.revokeObjectURL(el.src);
|
|
40
|
-
reject(new Error('Failed to load audio metadata'));
|
|
41
|
-
};
|
|
42
|
-
el.src = URL.createObjectURL(file);
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function conversationAudioUtilities() {
|
|
46
|
-
return {
|
|
47
|
-
[AX_CONVERSATION_AUDIO_UTILITY.preview]: (ctx, file) => ctx.readAsDataUrl(file),
|
|
48
|
-
[AX_CONVERSATION_AUDIO_UTILITY.duration]: (ctx, file) => mediaDuration(ctx, file),
|
|
49
|
-
[AX_CONVERSATION_AUDIO_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes),
|
|
50
|
-
[AX_CONVERSATION_AUDIO_UTILITY.formatDuration]: (_ctx, seconds) => formatDuration(seconds),
|
|
51
|
-
[AX_CONVERSATION_AUDIO_UTILITY.createLocalPreviewUrl]: (ctx, source) => blobUrl(ctx, source),
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function createConversationAudioFileType() {
|
|
55
|
-
const presentation = AX_CONVERSATION_AUDIO_PRESENTATION;
|
|
56
|
-
return {
|
|
57
|
-
name: AX_CONVERSATION_AUDIO_CATALOG,
|
|
58
|
-
metadata: createFileTypeMetadata('conversation'),
|
|
59
|
-
title: presentation.title,
|
|
60
|
-
icon: presentation.icon,
|
|
61
|
-
validations: {
|
|
62
|
-
mimeTypes: ['audio/*'],
|
|
63
|
-
minSize: 1,
|
|
64
|
-
maxSize: 50 * MB,
|
|
65
|
-
},
|
|
66
|
-
extensions: [
|
|
67
|
-
{ name: 'mp3', title: 'MP3' },
|
|
68
|
-
{ name: 'wav', title: 'WAV', validations: { maxSize: 30 * MB } },
|
|
69
|
-
{ name: 'ogg', title: 'OGG' },
|
|
70
|
-
{ name: 'm4a', title: 'M4A' },
|
|
71
|
-
],
|
|
72
|
-
utilities: conversationAudioUtilities(),
|
|
73
|
-
copy: (payload) => {
|
|
74
|
-
const audio = normalizeAudioPayload(payload);
|
|
75
|
-
const caption = audio.caption?.trim();
|
|
76
|
-
const items = audio.audios.map((item) => ({
|
|
77
|
-
url: item.url?.trim(),
|
|
78
|
-
title: item.title?.trim(),
|
|
79
|
-
}));
|
|
80
|
-
return {
|
|
81
|
-
text: caption ?? '',
|
|
82
|
-
meta: { kind: 'audio', caption, items, count: audio.audios.length },
|
|
83
|
-
};
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
class AXConversationAudioFileTypeProvider extends AXFileTypeInfoProvider {
|
|
88
|
-
items() {
|
|
89
|
-
return Promise.resolve([createConversationAudioFileType()]);
|
|
90
|
-
}
|
|
91
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationAudioFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
92
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationAudioFileTypeProvider, providedIn: 'root' }); }
|
|
93
|
-
}
|
|
94
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationAudioFileTypeProvider, decorators: [{
|
|
95
|
-
type: Injectable,
|
|
96
|
-
args: [{ providedIn: 'root' }]
|
|
97
|
-
}] });
|
|
98
|
-
|
|
99
|
-
export { AXConversationAudioFileTypeProvider, AX_CONVERSATION_AUDIO_CATALOG, AX_CONVERSATION_AUDIO_PRESENTATION, conversationAudioUtilities, createConversationAudioFileType };
|
|
100
|
-
//# sourceMappingURL=acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map
|
package/fesm2022/acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-conversation-conversation-audio.file-type-CfGSVnMA.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/composer/components/audio-picker/conversation-audio.file-type.ts"],"sourcesContent":["import type { AXFileCopyData, AXFileType } from '@acorex/core/file';\nimport { AXFileTypeInfoProvider, createFileTypeMetadata } from '@acorex/core/file';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport type { AXConversationAudioPayload } from '../../../../models';\nimport { AX_CONVERSATION_AUDIO_CATALOG } from '../../../../models/message-file-type-catalog';\nimport { normalizeAudioPayload } from '../../../message-list/components/audio-renderer/audio.payload';\nimport { formatDuration, formatFileSize } from '../shared/media-formatters';\n\nexport { AX_CONVERSATION_AUDIO_CATALOG };\n\nconst MB = 1024 * 1024;\n\nexport const AX_CONVERSATION_AUDIO_PRESENTATION = {\n icon: 'fa-light fa-music text-amber-500',\n title: 'Audio',\n} as const;\n\ntype AXConversationFileTypeUtilityContext = {\n readAsDataUrl: (file: File | Blob) => Promise<string>;\n platformId: object;\n};\n\nconst AX_CONVERSATION_AUDIO_UTILITY = {\n preview: 'preview',\n duration: 'duration',\n formatSize: 'formatSize',\n formatDuration: 'formatDuration',\n createLocalPreviewUrl: 'createLocalPreviewUrl',\n} as const;\n\nfunction blobUrl(ctx: AXConversationFileTypeUtilityContext, blob: Blob): string {\n if (!isPlatformBrowser(ctx.platformId)) {\n return '';\n }\n return URL.createObjectURL(blob);\n}\n\nfunction mediaDuration(ctx: AXConversationFileTypeUtilityContext, file: File | Blob): Promise<number> {\n if (!isPlatformBrowser(ctx.platformId)) {\n return Promise.resolve(0);\n }\n return new Promise((resolve, reject) => {\n const el = document.createElement('audio');\n el.preload = 'metadata';\n el.onloadedmetadata = () => {\n URL.revokeObjectURL(el.src);\n resolve(el.duration);\n };\n el.onerror = () => {\n URL.revokeObjectURL(el.src);\n reject(new Error('Failed to load audio metadata'));\n };\n el.src = URL.createObjectURL(file);\n });\n}\n\nexport function conversationAudioUtilities(): NonNullable<AXFileType['utilities']> {\n return {\n [AX_CONVERSATION_AUDIO_UTILITY.preview]: (ctx, file) =>\n (ctx as AXConversationFileTypeUtilityContext).readAsDataUrl(file as File),\n [AX_CONVERSATION_AUDIO_UTILITY.duration]: (ctx, file) =>\n mediaDuration(ctx as AXConversationFileTypeUtilityContext, file as File | Blob),\n [AX_CONVERSATION_AUDIO_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes as number),\n [AX_CONVERSATION_AUDIO_UTILITY.formatDuration]: (_ctx, seconds) => formatDuration(seconds as number),\n [AX_CONVERSATION_AUDIO_UTILITY.createLocalPreviewUrl]: (ctx, source) =>\n blobUrl(ctx as AXConversationFileTypeUtilityContext, source as Blob),\n };\n}\n\nexport function createConversationAudioFileType(): AXFileType {\n const presentation = AX_CONVERSATION_AUDIO_PRESENTATION;\n return {\n name: AX_CONVERSATION_AUDIO_CATALOG,\n metadata: createFileTypeMetadata('conversation'),\n title: presentation.title,\n icon: presentation.icon,\n validations: {\n mimeTypes: ['audio/*'],\n minSize: 1,\n maxSize: 50 * MB,\n },\n extensions: [\n { name: 'mp3', title: 'MP3' },\n { name: 'wav', title: 'WAV', validations: { maxSize: 30 * MB } },\n { name: 'ogg', title: 'OGG' },\n { name: 'm4a', title: 'M4A' },\n ],\n utilities: conversationAudioUtilities(),\n copy: (payload): AXFileCopyData => {\n const audio = normalizeAudioPayload(payload as AXConversationAudioPayload);\n const caption = audio.caption?.trim();\n const items = audio.audios.map((item) => ({\n url: item.url?.trim(),\n title: item.title?.trim(),\n }));\n return {\n text: caption ?? '',\n meta: { kind: 'audio', caption, items, count: audio.audios.length },\n };\n },\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXConversationAudioFileTypeProvider extends AXFileTypeInfoProvider {\n items() {\n return Promise.resolve([createConversationAudioFileType()]);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAWA,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI;AAEf,MAAM,kCAAkC,GAAG;AAChD,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,KAAK,EAAE,OAAO;;AAQhB,MAAM,6BAA6B,GAAG;AACpC,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,QAAQ,EAAE,UAAU;AACpB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,cAAc,EAAE,gBAAgB;AAChC,IAAA,qBAAqB,EAAE,uBAAuB;CACtC;AAEV,SAAS,OAAO,CAAC,GAAyC,EAAE,IAAU,EAAA;IACpE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACtC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;AAClC;AAEA,SAAS,aAAa,CAAC,GAAyC,EAAE,IAAiB,EAAA;IACjF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACtC,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3B;IACA,OAAO,IAAI,OAAO,CAAC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AAC,MAAM,CAAC,MAAM,EAAE;aACpE;QACH,CAAC;KACF;AACH;AAGM,MAAO,mCAAoC,SAAQ,sBAAsB,CAAA;IAC7E,KAAK,GAAA;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,+BAA+B,EAAE,CAAC,CAAC;IAC7D;8GAHW,mCAAmC,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAnC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,mCAAmC,cADtB,MAAM,EAAA,CAAA,CAAA;;2FACnB,mCAAmC,EAAA,UAAA,EAAA,CAAA;kBAD/C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
import { createFileTypeMetadata, AXFileTypeInfoProvider } from '@acorex/core/file';
|
|
2
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable } from '@angular/core';
|
|
5
|
-
import { t as AX_CONVERSATION_IMAGE_CATALOG, u as AX_CONVERSATION_VIDEO_CATALOG, p as AX_CONVERSATION_AUDIO_CATALOG, q as AX_CONVERSATION_FILE_CATALOG } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
6
|
-
import { normalizeFilePayload } from './acorex-components-conversation-file.payload-DyFxTQYn.mjs';
|
|
7
|
-
import { a as formatFileSize } from './acorex-components-conversation-media-formatters-DV3wEEno.mjs';
|
|
8
|
-
|
|
9
|
-
const MB = 1024 * 1024;
|
|
10
|
-
const AX_CONVERSATION_FILE_PRESENTATION = {
|
|
11
|
-
icon: 'fa-light fa-file text-neutral-500',
|
|
12
|
-
title: 'File',
|
|
13
|
-
};
|
|
14
|
-
const AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES = [
|
|
15
|
-
'image/*',
|
|
16
|
-
'video/*',
|
|
17
|
-
'audio/*',
|
|
18
|
-
'application/pdf',
|
|
19
|
-
'application/msword',
|
|
20
|
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
|
21
|
-
'application/vnd.ms-excel',
|
|
22
|
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
23
|
-
'application/zip',
|
|
24
|
-
'application/x-zip-compressed',
|
|
25
|
-
'application/x-7z-compressed',
|
|
26
|
-
'application/vnd.rar',
|
|
27
|
-
'application/octet-stream',
|
|
28
|
-
'text/plain',
|
|
29
|
-
];
|
|
30
|
-
const AX_CONVERSATION_FILE_UTILITY = {
|
|
31
|
-
preview: 'preview',
|
|
32
|
-
formatSize: 'formatSize',
|
|
33
|
-
createLocalPreviewUrl: 'createLocalPreviewUrl',
|
|
34
|
-
pickerCatalog: 'pickerCatalog',
|
|
35
|
-
};
|
|
36
|
-
function blobUrl(ctx, blob) {
|
|
37
|
-
if (!isPlatformBrowser(ctx.platformId)) {
|
|
38
|
-
return '';
|
|
39
|
-
}
|
|
40
|
-
return URL.createObjectURL(blob);
|
|
41
|
-
}
|
|
42
|
-
function conversationFileUtilities() {
|
|
43
|
-
return {
|
|
44
|
-
[AX_CONVERSATION_FILE_UTILITY.preview]: async (ctx, file) => {
|
|
45
|
-
const f = file;
|
|
46
|
-
if (f.type.startsWith('image/')) {
|
|
47
|
-
return ctx.readAsDataUrl(f);
|
|
48
|
-
}
|
|
49
|
-
return undefined;
|
|
50
|
-
},
|
|
51
|
-
[AX_CONVERSATION_FILE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes),
|
|
52
|
-
[AX_CONVERSATION_FILE_UTILITY.createLocalPreviewUrl]: (ctx, source) => blobUrl(ctx, source),
|
|
53
|
-
[AX_CONVERSATION_FILE_UTILITY.pickerCatalog]: (_ctx, file) => {
|
|
54
|
-
const f = file;
|
|
55
|
-
if (f.type.startsWith('image/'))
|
|
56
|
-
return AX_CONVERSATION_IMAGE_CATALOG;
|
|
57
|
-
if (f.type.startsWith('video/'))
|
|
58
|
-
return AX_CONVERSATION_VIDEO_CATALOG;
|
|
59
|
-
if (f.type.startsWith('audio/'))
|
|
60
|
-
return AX_CONVERSATION_AUDIO_CATALOG;
|
|
61
|
-
return AX_CONVERSATION_FILE_CATALOG;
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
function createConversationFileFileType() {
|
|
66
|
-
const presentation = AX_CONVERSATION_FILE_PRESENTATION;
|
|
67
|
-
return {
|
|
68
|
-
name: AX_CONVERSATION_FILE_CATALOG,
|
|
69
|
-
metadata: createFileTypeMetadata('conversation'),
|
|
70
|
-
title: presentation.title,
|
|
71
|
-
icon: presentation.icon,
|
|
72
|
-
validations: {
|
|
73
|
-
mimeTypes: [...AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES],
|
|
74
|
-
minSize: 1,
|
|
75
|
-
maxSize: 100 * MB,
|
|
76
|
-
},
|
|
77
|
-
extensions: [
|
|
78
|
-
{ name: 'pdf', title: 'PDF', validations: { mimeTypes: ['application/pdf'], maxSize: 25 * MB } },
|
|
79
|
-
{ name: 'doc', title: 'Word' },
|
|
80
|
-
{ name: 'docx', title: 'Word' },
|
|
81
|
-
{ name: 'txt', title: 'Text', validations: { mimeTypes: ['text/plain'], maxSize: 5 * MB } },
|
|
82
|
-
{
|
|
83
|
-
name: 'zip',
|
|
84
|
-
title: 'ZIP',
|
|
85
|
-
validations: {
|
|
86
|
-
mimeTypes: ['application/zip', 'application/x-zip-compressed', 'application/octet-stream'],
|
|
87
|
-
maxSize: 50 * MB,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
utilities: conversationFileUtilities(),
|
|
92
|
-
copy: (payload) => {
|
|
93
|
-
const file = normalizeFilePayload(payload);
|
|
94
|
-
const caption = file.caption?.trim();
|
|
95
|
-
const items = file.files.map((item) => {
|
|
96
|
-
const name = item.name?.trim();
|
|
97
|
-
const url = item.url?.trim();
|
|
98
|
-
const line = name && url ? `${name} — ${url}` : url || name;
|
|
99
|
-
return { name, url, line };
|
|
100
|
-
});
|
|
101
|
-
return {
|
|
102
|
-
text: caption ?? '',
|
|
103
|
-
meta: { kind: 'file', caption, items, count: file.files.length },
|
|
104
|
-
};
|
|
105
|
-
},
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
class AXConversationFileFileTypeProvider extends AXFileTypeInfoProvider {
|
|
109
|
-
items() {
|
|
110
|
-
return Promise.resolve([createConversationFileFileType()]);
|
|
111
|
-
}
|
|
112
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
113
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, providedIn: 'root' }); }
|
|
114
|
-
}
|
|
115
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationFileFileTypeProvider, decorators: [{
|
|
116
|
-
type: Injectable,
|
|
117
|
-
args: [{ providedIn: 'root' }]
|
|
118
|
-
}] });
|
|
119
|
-
|
|
120
|
-
export { AXConversationFileFileTypeProvider, AX_CONVERSATION_FILE_CATALOG, AX_CONVERSATION_FILE_PRESENTATION, conversationFileUtilities, createConversationFileFileType };
|
|
121
|
-
//# sourceMappingURL=acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map
|
package/fesm2022/acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"acorex-components-conversation-conversation-file.file-type-DB-2xhaC.mjs","sources":["../../../../packages/components/conversation/src/lib/plugins/composer/components/file-picker/conversation-file.file-type.ts"],"sourcesContent":["import type { AXFileCopyData, AXFileType } from '@acorex/core/file';\nimport { AXFileTypeInfoProvider, createFileTypeMetadata } from '@acorex/core/file';\nimport { isPlatformBrowser } from '@angular/common';\nimport { Injectable } from '@angular/core';\nimport type { AXConversationFilePayload } from '../../../../models';\nimport {\n AX_CONVERSATION_AUDIO_CATALOG,\n AX_CONVERSATION_FILE_CATALOG,\n AX_CONVERSATION_IMAGE_CATALOG,\n AX_CONVERSATION_VIDEO_CATALOG,\n} from '../../../../models/message-file-type-catalog';\nimport { normalizeFilePayload } from '../../../message-list/components/file-renderer/file.payload';\nimport { formatFileSize } from '../shared/media-formatters';\n\nexport { AX_CONVERSATION_FILE_CATALOG };\n\nconst MB = 1024 * 1024;\n\nexport const AX_CONVERSATION_FILE_PRESENTATION = {\n icon: 'fa-light fa-file text-neutral-500',\n title: 'File',\n} as const;\n\nconst AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES = [\n 'image/*',\n 'video/*',\n 'audio/*',\n 'application/pdf',\n 'application/msword',\n 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',\n 'application/vnd.ms-excel',\n 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',\n 'application/zip',\n 'application/x-zip-compressed',\n 'application/x-7z-compressed',\n 'application/vnd.rar',\n 'application/octet-stream',\n 'text/plain',\n] as const;\n\ntype AXConversationFileTypeUtilityContext = {\n readAsDataUrl: (file: File | Blob) => Promise<string>;\n platformId: object;\n};\n\nconst AX_CONVERSATION_FILE_UTILITY = {\n preview: 'preview',\n formatSize: 'formatSize',\n createLocalPreviewUrl: 'createLocalPreviewUrl',\n pickerCatalog: 'pickerCatalog',\n} as const;\n\nfunction blobUrl(ctx: AXConversationFileTypeUtilityContext, blob: Blob): string {\n if (!isPlatformBrowser(ctx.platformId)) {\n return '';\n }\n return URL.createObjectURL(blob);\n}\n\nexport function conversationFileUtilities(): NonNullable<AXFileType['utilities']> {\n return {\n [AX_CONVERSATION_FILE_UTILITY.preview]: async (ctx, file) => {\n const f = file as File;\n if (f.type.startsWith('image/')) {\n return (ctx as AXConversationFileTypeUtilityContext).readAsDataUrl(f);\n }\n return undefined;\n },\n [AX_CONVERSATION_FILE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes as number),\n [AX_CONVERSATION_FILE_UTILITY.createLocalPreviewUrl]: (ctx, source) => blobUrl(ctx as AXConversationFileTypeUtilityContext, source as Blob),\n [AX_CONVERSATION_FILE_UTILITY.pickerCatalog]: (_ctx, file) => {\n const f = file as File;\n if (f.type.startsWith('image/')) return AX_CONVERSATION_IMAGE_CATALOG;\n if (f.type.startsWith('video/')) return AX_CONVERSATION_VIDEO_CATALOG;\n if (f.type.startsWith('audio/')) return AX_CONVERSATION_AUDIO_CATALOG;\n return AX_CONVERSATION_FILE_CATALOG;\n },\n };\n}\n\nexport function createConversationFileFileType(): import('@acorex/core/file').AXFileType {\n const presentation = AX_CONVERSATION_FILE_PRESENTATION;\n return {\n name: AX_CONVERSATION_FILE_CATALOG,\n metadata: createFileTypeMetadata('conversation'),\n title: presentation.title,\n icon: presentation.icon,\n validations: {\n mimeTypes: [...AX_CONVERSATION_FILE_ALLOWED_MIME_TYPES],\n minSize: 1,\n maxSize: 100 * MB,\n },\n extensions: [\n { name: 'pdf', title: 'PDF', validations: { mimeTypes: ['application/pdf'], maxSize: 25 * MB } },\n { name: 'doc', title: 'Word' },\n { name: 'docx', title: 'Word' },\n { name: 'txt', title: 'Text', validations: { mimeTypes: ['text/plain'], maxSize: 5 * MB } },\n {\n name: 'zip',\n title: 'ZIP',\n validations: {\n mimeTypes: ['application/zip', 'application/x-zip-compressed', 'application/octet-stream'],\n maxSize: 50 * MB,\n },\n },\n ],\n utilities: conversationFileUtilities(),\n copy: (payload): AXFileCopyData => {\n const file = normalizeFilePayload(payload as AXConversationFilePayload);\n const caption = file.caption?.trim();\n const items = file.files.map((item) => {\n const name = item.name?.trim();\n const url = item.url?.trim();\n const line = name && url ? `${name} — ${url}` : url || name;\n return { name, url, line };\n });\n return {\n text: caption ?? '',\n meta: { kind: 'file', caption, items, count: file.files.length },\n };\n },\n };\n}\n\n@Injectable({ providedIn: 'root' })\nexport class AXConversationFileFileTypeProvider extends AXFileTypeInfoProvider {\n items() {\n return Promise.resolve([createConversationFileFileType()]);\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAgBA,MAAM,EAAE,GAAG,IAAI,GAAG,IAAI;AAEf,MAAM,iCAAiC,GAAG;AAC/C,IAAA,IAAI,EAAE,mCAAmC;AACzC,IAAA,KAAK,EAAE,MAAM;;AAGf,MAAM,uCAAuC,GAAG;IAC9C,SAAS;IACT,SAAS;IACT,SAAS;IACT,iBAAiB;IACjB,oBAAoB;IACpB,yEAAyE;IACzE,0BAA0B;IAC1B,mEAAmE;IACnE,iBAAiB;IACjB,8BAA8B;IAC9B,6BAA6B;IAC7B,qBAAqB;IACrB,0BAA0B;IAC1B,YAAY;CACJ;AAOV,MAAM,4BAA4B,GAAG;AACnC,IAAA,OAAO,EAAE,SAAS;AAClB,IAAA,UAAU,EAAE,YAAY;AACxB,IAAA,qBAAqB,EAAE,uBAAuB;AAC9C,IAAA,aAAa,EAAE,eAAe;CACtB;AAEV,SAAS,OAAO,CAAC,GAAyC,EAAE,IAAU,EAAA;IACpE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;AACtC,QAAA,OAAO,EAAE;IACX;AACA,IAAA,OAAO,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC;AAClC;SAEgB,yBAAyB,GAAA;IACvC,OAAO;QACL,CAAC,4BAA4B,CAAC,OAAO,GAAG,OAAO,GAAG,EAAE,IAAI,KAAI;YAC1D,MAAM,CAAC,GAAG,IAAY;YACtB,IAAI,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE;AAC/B,gBAAA,OAAQ,GAA4C,CAAC,aAAa,CAAC,CAAC,CAAC;YACvE;AAC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,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;aACjE;QACH,CAAC;KACF;AACH;AAGM,MAAO,kCAAmC,SAAQ,sBAAsB,CAAA;IAC5E,KAAK,GAAA;QACH,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,8BAA8B,EAAE,CAAC,CAAC;IAC5D;8GAHW,kCAAkC,EAAA,IAAA,EAAA,IAAA,EAAA,MAAA,EAAA,EAAA,CAAA,eAAA,CAAA,UAAA,EAAA,CAAA,CAAA;AAAlC,IAAA,SAAA,IAAA,CAAA,KAAA,GAAA,EAAA,CAAA,qBAAA,CAAA,EAAA,UAAA,EAAA,QAAA,EAAA,OAAA,EAAA,QAAA,EAAA,QAAA,EAAA,EAAA,EAAA,IAAA,EAAA,kCAAkC,cADrB,MAAM,EAAA,CAAA,CAAA;;2FACnB,kCAAkC,EAAA,UAAA,EAAA,CAAA;kBAD9C,UAAU;mBAAC,EAAE,UAAU,EAAE,MAAM,EAAE;;;;;"}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { createFileTypeMetadata, AXFileTypeInfoProvider } from '@acorex/core/file';
|
|
2
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
3
|
-
import * as i0 from '@angular/core';
|
|
4
|
-
import { Injectable } from '@angular/core';
|
|
5
|
-
import { t as AX_CONVERSATION_IMAGE_CATALOG, n as normalizeImagePayload } from './acorex-components-conversation-acorex-components-conversation-YhVa42TC.mjs';
|
|
6
|
-
import { a as formatFileSize } from './acorex-components-conversation-media-formatters-DV3wEEno.mjs';
|
|
7
|
-
|
|
8
|
-
const MB = 1024 * 1024;
|
|
9
|
-
const AX_CONVERSATION_IMAGE_PRESENTATION = {
|
|
10
|
-
icon: 'fa-light fa-image text-purple-500',
|
|
11
|
-
title: 'Image',
|
|
12
|
-
};
|
|
13
|
-
const AX_CONVERSATION_IMAGE_UTILITY = {
|
|
14
|
-
preview: 'preview',
|
|
15
|
-
formatSize: 'formatSize',
|
|
16
|
-
createLocalPreviewUrl: 'createLocalPreviewUrl',
|
|
17
|
-
};
|
|
18
|
-
function blobUrl(ctx, blob) {
|
|
19
|
-
if (!isPlatformBrowser(ctx.platformId)) {
|
|
20
|
-
return '';
|
|
21
|
-
}
|
|
22
|
-
return URL.createObjectURL(blob);
|
|
23
|
-
}
|
|
24
|
-
function conversationImageUtilities() {
|
|
25
|
-
return {
|
|
26
|
-
[AX_CONVERSATION_IMAGE_UTILITY.preview]: (ctx, file) => ctx.readAsDataUrl(file),
|
|
27
|
-
[AX_CONVERSATION_IMAGE_UTILITY.formatSize]: (_ctx, bytes) => formatFileSize(bytes),
|
|
28
|
-
[AX_CONVERSATION_IMAGE_UTILITY.createLocalPreviewUrl]: (ctx, source) => {
|
|
29
|
-
const blob = source;
|
|
30
|
-
if (blob.type.startsWith('image/')) {
|
|
31
|
-
return ctx.readAsDataUrl(blob);
|
|
32
|
-
}
|
|
33
|
-
return blobUrl(ctx, blob);
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
function createConversationImageFileType() {
|
|
38
|
-
const presentation = AX_CONVERSATION_IMAGE_PRESENTATION;
|
|
39
|
-
return {
|
|
40
|
-
name: AX_CONVERSATION_IMAGE_CATALOG,
|
|
41
|
-
metadata: createFileTypeMetadata('conversation'),
|
|
42
|
-
title: presentation.title,
|
|
43
|
-
icon: presentation.icon,
|
|
44
|
-
validations: {
|
|
45
|
-
mimeTypes: ['image/*'],
|
|
46
|
-
minSize: 1,
|
|
47
|
-
maxSize: 100 * MB,
|
|
48
|
-
},
|
|
49
|
-
extensions: [
|
|
50
|
-
{ name: 'jpg', title: 'JPEG' },
|
|
51
|
-
{ name: 'jpeg', title: 'JPEG', validations: { maxSize: 5 * MB } },
|
|
52
|
-
{ name: 'png', title: 'PNG' },
|
|
53
|
-
{ name: 'gif', title: 'GIF' },
|
|
54
|
-
{ name: 'webp', title: 'WebP' },
|
|
55
|
-
{ name: 'svg', title: 'SVG', validations: { maxSize: 2 * MB } },
|
|
56
|
-
],
|
|
57
|
-
utilities: conversationImageUtilities(),
|
|
58
|
-
copy: (payload) => {
|
|
59
|
-
const image = normalizeImagePayload(payload);
|
|
60
|
-
const caption = image.caption?.trim();
|
|
61
|
-
const urls = image.images
|
|
62
|
-
.map((item) => item.url?.trim() || item.thumbnailUrl?.trim())
|
|
63
|
-
.filter((url) => !!url);
|
|
64
|
-
return {
|
|
65
|
-
text: caption ?? '',
|
|
66
|
-
meta: { kind: 'image', caption, urls, count: image.images.length },
|
|
67
|
-
};
|
|
68
|
-
},
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
class AXConversationImageFileTypeProvider extends AXFileTypeInfoProvider {
|
|
72
|
-
items() {
|
|
73
|
-
return Promise.resolve([createConversationImageFileType()]);
|
|
74
|
-
}
|
|
75
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, deps: null, target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
76
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, providedIn: 'root' }); }
|
|
77
|
-
}
|
|
78
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.9", ngImport: i0, type: AXConversationImageFileTypeProvider, decorators: [{
|
|
79
|
-
type: Injectable,
|
|
80
|
-
args: [{ providedIn: 'root' }]
|
|
81
|
-
}] });
|
|
82
|
-
|
|
83
|
-
export { AXConversationImageFileTypeProvider, AX_CONVERSATION_IMAGE_CATALOG, AX_CONVERSATION_IMAGE_PRESENTATION, conversationImageUtilities, createConversationImageFileType };
|
|
84
|
-
//# sourceMappingURL=acorex-components-conversation-conversation-image.file-type-C02OzZZB.mjs.map
|