@magmamath/students-features 0.9.114-rc.13 → 0.9.114-rc.15
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/dist/commonjs/features/voice/playing/model/{TranscriptionsLoader.model.js → TranscriptionsDownloaderModel.js} +4 -4
- package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +8 -2
- package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/module/features/voice/playing/model/{TranscriptionsLoader.model.js → TranscriptionsDownloaderModel.js} +2 -2
- package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +1 -0
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js +8 -2
- package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
- package/dist/typescript/commonjs/features/voice/playing/model/{TranscriptionsLoader.model.d.ts → TranscriptionsDownloaderModel.d.ts} +2 -2
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +3 -2
- package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/dist/typescript/module/features/voice/playing/model/{TranscriptionsLoader.model.d.ts → TranscriptionsDownloaderModel.d.ts} +2 -2
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +1 -0
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +3 -2
- package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/features/voice/playing/model/{TranscriptionsLoader.model.ts → TranscriptionsDownloaderModel.ts} +1 -1
- package/src/features/voice/playing/model/VoicePlayer.model.ts +10 -3
- package/dist/commonjs/features/voice/playing/model/TranscriptionsLoader.model.js.map +0 -1
- package/dist/module/features/voice/playing/model/TranscriptionsLoader.model.js.map +0 -1
- package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsLoader.model.d.ts.map +0 -1
- package/dist/typescript/module/features/voice/playing/model/TranscriptionsLoader.model.d.ts.map +0 -1
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.
|
|
6
|
+
exports.TranscriptionsDownloaderModel = void 0;
|
|
7
7
|
var _effector = require("effector");
|
|
8
8
|
var _constants = require("../../constants.js");
|
|
9
|
-
class
|
|
9
|
+
class TranscriptionsDownloaderModel {
|
|
10
10
|
setTranscriptsLoaded = (0, _effector.createEvent)();
|
|
11
11
|
reset = (0, _effector.createEvent)();
|
|
12
12
|
$transcriptsLoaded = (0, _effector.restore)(this.setTranscriptsLoaded, false).reset(this.reset);
|
|
@@ -62,5 +62,5 @@ class TranscriptionsLoaderModel {
|
|
|
62
62
|
return this.collection.get(attemptNumber)?.transcriptLoading || false;
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
exports.
|
|
66
|
-
//# sourceMappingURL=
|
|
65
|
+
exports.TranscriptionsDownloaderModel = TranscriptionsDownloaderModel;
|
|
66
|
+
//# sourceMappingURL=TranscriptionsDownloaderModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_effector","require","_constants","TranscriptionsDownloaderModel","setTranscriptsLoaded","createEvent","reset","$transcriptsLoaded","restore","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","TRANSCRIPT_MAX_RETRIES","response","getAudioFileTranscript","status","text","NO_AUDIO_BE_MESSAGE","Promise","resolve","setTimeout","TRANSCRIPT_RETRY_INTERVAL_MS","loadAllTranscripts","createEffect","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptError","undefined","error","Error","message","all","getTranscript","get","isTranscriptLoading","exports"],"sourceRoot":"../../../../../../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sCollection.js
|
|
|
9
9
|
var _VoiceFileDownloaderModel = require("./VoiceFileDownloader.model.js");
|
|
10
10
|
var _VoiceTranscriptionsDropdownModel = require("./VoiceTranscriptionsDropdown.model.js");
|
|
11
11
|
var _PlayerModel = require("./Player.model.js");
|
|
12
|
-
var
|
|
12
|
+
var _TranscriptionsDownloaderModel = require("./TranscriptionsDownloaderModel.js");
|
|
13
13
|
class VoicePlayerModel {
|
|
14
14
|
collection = new _VoiceTranscriptionsCollection.VoiceTranscriptionsCollection();
|
|
15
15
|
downloader = new _VoiceFileDownloaderModel.VoiceFileDownloaderModel();
|
|
16
16
|
dropdown = new _VoiceTranscriptionsDropdownModel.VoiceTranscriptionsDropdownModel();
|
|
17
17
|
playerModel = new _PlayerModel.PlayerModel();
|
|
18
18
|
currentPlayingAttempt = null;
|
|
19
|
+
shouldPreventPlayback = false;
|
|
19
20
|
setCurrentAttempt = (0, _effector.createEvent)();
|
|
20
21
|
reset = (0, _effector.createEvent)();
|
|
21
22
|
$currentAttempt = (0, _effector.restore)(this.setCurrentAttempt, null).reset(this.reset);
|
|
22
23
|
$playerState = this.playerModel.$playerState;
|
|
23
24
|
pauseAudio = this.playerModel.pause;
|
|
24
25
|
stopAudio = (0, _effector.createEffect)(() => {
|
|
26
|
+
this.shouldPreventPlayback = true;
|
|
25
27
|
this.abortCurrentDownload();
|
|
26
28
|
this.playerModel.stop();
|
|
27
29
|
this.currentPlayingAttempt = null;
|
|
@@ -29,7 +31,7 @@ class VoicePlayerModel {
|
|
|
29
31
|
});
|
|
30
32
|
constructor(params) {
|
|
31
33
|
this.api = params.api;
|
|
32
|
-
this.loader = new
|
|
34
|
+
this.loader = new _TranscriptionsDownloaderModel.TranscriptionsDownloaderModel(this.collection, params.api);
|
|
33
35
|
this.downloader.setApi(params.api);
|
|
34
36
|
this.playerModel.playbackFinished.watch(() => {
|
|
35
37
|
this.currentPlayingAttempt = null;
|
|
@@ -77,6 +79,7 @@ class VoicePlayerModel {
|
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
81
|
handlePlayAttempt = (0, _effector.createEffect)(async attemptNumber => {
|
|
82
|
+
this.shouldPreventPlayback = false;
|
|
80
83
|
const item = this.collection.get(attemptNumber);
|
|
81
84
|
if (!item) return;
|
|
82
85
|
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
@@ -87,6 +90,8 @@ class VoicePlayerModel {
|
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
89
92
|
try {
|
|
93
|
+
this.currentPlayingAttempt = attemptNumber;
|
|
94
|
+
this.setCurrentAttempt(attemptNumber);
|
|
90
95
|
this.playerModel.setPlayerState(_PlayerModel.PlayerState.LOADING);
|
|
91
96
|
const {
|
|
92
97
|
collectionItem,
|
|
@@ -121,6 +126,7 @@ class VoicePlayerModel {
|
|
|
121
126
|
}
|
|
122
127
|
});
|
|
123
128
|
playAudioFx = (0, _effector.createEffect)(async attemptNumber => {
|
|
129
|
+
if (this.shouldPreventPlayback) return;
|
|
124
130
|
const item = this.collection.get(attemptNumber);
|
|
125
131
|
if (!item?.audioUri) {
|
|
126
132
|
console.warn('No audio URI available for attempt:', attemptNumber);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_VoiceTranscriptionsCollection","_VoiceFileDownloaderModel","_VoiceTranscriptionsDropdownModel","_PlayerModel","
|
|
1
|
+
{"version":3,"names":["_effector","require","_VoiceTranscriptionsCollection","_VoiceFileDownloaderModel","_VoiceTranscriptionsDropdownModel","_PlayerModel","_TranscriptionsDownloaderModel","VoicePlayerModel","collection","VoiceTranscriptionsCollection","downloader","VoiceFileDownloaderModel","dropdown","VoiceTranscriptionsDropdownModel","playerModel","PlayerModel","currentPlayingAttempt","shouldPreventPlayback","setCurrentAttempt","createEvent","reset","$currentAttempt","restore","$playerState","pauseAudio","pause","stopAudio","createEffect","abortCurrentDownload","stop","constructor","params","api","loader","TranscriptionsDownloaderModel","setApi","playbackFinished","watch","audios","initializeCollectionFromAudios","setupAudioMode","initializeWithAudios","answerAudio","setTranscriptsLoaded","clear","console","warn","forEach","audio","index","attemptNumber","audioFileId","add","_id","hasDrawing","drawing","item","get","controller","audioLoading","abortDownload","update","undefined","audioDownloadPromise","handlePlayAttempt","hasAudio","playAudioFx","setPlayerState","PlayerState","LOADING","collectionItem","downloadPromise","download","result","audioUri","uri","audioError","IDLE","error","Error","name","message","player","remove","playing","resume","play","isAudioLoading","getAllAttempts","getAll","reinitializePlayer","reinitialize","cleanup","startsWith","URL","revokeObjectURL","e","release","togglePlayPause","attach","source","mapParams","playerState","effect","PLAYING","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoicePlayer.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AACA,IAAAE,yBAAA,GAAAF,OAAA;AACA,IAAAG,iCAAA,GAAAH,OAAA;AAEA,IAAAI,YAAA,GAAAJ,OAAA;AACA,IAAAK,8BAAA,GAAAL,OAAA;AAWO,MAAMM,gBAAgB,CAAC;EACZC,UAAU,GAAG,IAAIC,4DAA6B,CAAC,CAAC;EAChDC,UAAU,GAAG,IAAIC,kDAAwB,CAAC,CAAC;EAC3CC,QAAQ,GAAG,IAAIC,kEAAgC,CAAC,CAAC;EACjDC,WAAW,GAAG,IAAIC,wBAAW,CAAC,CAAC;EAGvCC,qBAAqB,GAAkB,IAAI;EAC3CC,qBAAqB,GAAG,KAAK;EAErBC,iBAAiB,GAAG,IAAAC,qBAAW,EAAgB,CAAC;EAChDC,KAAK,GAAG,IAAAD,qBAAW,EAAC,CAAC;EAErBE,eAAe,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACJ,iBAAiB,EAAE,IAAI,CAAC,CAACE,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EACzEG,YAAY,GAAG,IAAI,CAACT,WAAW,CAACS,YAAY;EAE5CC,UAAU,GAAG,IAAI,CAACV,WAAW,CAACW,KAA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,IAAI,CAACR,QAAQ,CAACQ,KAAK,CAAC,CAAC;IACrB,IAAI,CAACN,WAAW,CAACmF,OAAO,CAAC,CAAC;EAC5B;EAEOC,eAAe,GAAG,IAAAC,gBAAM,EAAC;IAC9BC,MAAM,EAAE,IAAI,CAACtF,WAAW,CAACS,YAAY;IACrC8E,SAAS,EAAEA,CAACnD,aAAqB,EAAEoD,WAAW,MAAM;MAAEpD,aAAa;MAAEoD;IAAY,CAAC,CAAC;IACnFC,MAAM,EAAE,IAAA5E,sBAAY,EAAC,CAAC;MAAEuB,aAAa;MAAEoD;IAAmC,CAAC,KAAK;MAC9E,IAAI,IAAI,CAACtF,qBAAqB,KAAKkC,aAAa,IAAIoD,WAAW,KAAKlC,wBAAW,CAACoC,OAAO,EAAE;QACvF,IAAI,CAAChF,UAAU,CAAC,CAAC;MACnB,CAAC,MAAM;QACL,IAAI,CAACwC,iBAAiB,CAACd,aAAa,CAAC;MACvC;IACF,CAAC;EACH,CAAC,CAAC;AACJ;AAACuD,OAAA,CAAAlG,gBAAA,GAAAA,gBAAA","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { createEffect, createEvent, restore } from 'effector';
|
|
4
4
|
import { NO_AUDIO_BE_MESSAGE, TRANSCRIPT_MAX_RETRIES, TRANSCRIPT_RETRY_INTERVAL_MS } from "../../constants.js";
|
|
5
|
-
export class
|
|
5
|
+
export class TranscriptionsDownloaderModel {
|
|
6
6
|
setTranscriptsLoaded = createEvent();
|
|
7
7
|
reset = createEvent();
|
|
8
8
|
$transcriptsLoaded = restore(this.setTranscriptsLoaded, false).reset(this.reset);
|
|
@@ -58,4 +58,4 @@ export class TranscriptionsLoaderModel {
|
|
|
58
58
|
return this.collection.get(attemptNumber)?.transcriptLoading || false;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
//# sourceMappingURL=
|
|
61
|
+
//# sourceMappingURL=TranscriptionsDownloaderModel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["createEffect","createEvent","restore","NO_AUDIO_BE_MESSAGE","TRANSCRIPT_MAX_RETRIES","TRANSCRIPT_RETRY_INTERVAL_MS","TranscriptionsDownloaderModel","setTranscriptsLoaded","reset","$transcriptsLoaded","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","response","getAudioFileTranscript","status","text","Promise","resolve","setTimeout","loadAllTranscripts","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptError","undefined","error","Error","message","all","getTranscript","get","isTranscriptLoading"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsDownloaderModel.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAG7D,SACEC,mBAAmB,EACnBC,sBAAsB,EACtBC,4BAA4B,QACvB,oBAAiB;AAExB,OAAO,MAAMC,6BAA6B,CAAC;EAIzBC,oBAAoB,GAAGN,WAAW,CAAU,CAAC;EAC7CO,KAAK,GAAGP,WAAW,CAAC,CAAC;EAErBQ,kBAAkB,GAAGP,OAAO,CAAC,IAAI,CAACK,oBAAoB,EAAE,KAAK,CAAC,CAACC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EAEhGE,WAAWA,CAACC,UAAyC,EAAEC,GAAmB,EAAE;IAC1E,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,GAAG,GAAGA,GAAG;EAChB;EAEA,MAAcC,wBAAwBA,CAACC,WAAmB,EAAmB;IAC3E,KAAK,IAAIC,OAAO,GAAG,CAAC,EAAEA,OAAO,GAAGX,sBAAsB,EAAEW,OAAO,EAAE,EAAE;MACjE,MAAMC,QAAQ,GAAG,MAAM,IAAI,CAACJ,GAAG,CAACK,sBAAsB,CAACH,WAAW,CAAC;MAEnE,IAAIE,QAAQ,CAACE,MAAM,KAAK,WAAW,EAAE;QACnC,OAAOF,QAAQ,CAACG,IAAI;MACt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BAAoB,CAAC,IAAI,CAAC;EACjC,CAAC,CAAC;EAEKiC,aAAaA,CAACV,aAAqB,EAAsB;IAC9D,OAAO,IAAI,CAACnB,UAAU,CAAC8B,GAAG,CAACX,aAAa,CAAC,EAAEG,UAAU;EACvD;EAEOS,mBAAmBA,CAACZ,aAAqB,EAAW;IACzD,OAAO,IAAI,CAACnB,UAAU,CAAC8B,GAAG,CAACX,aAAa,CAAC,EAAEE,iBAAiB,IAAI,KAAK;EACvE;AACF","ignoreList":[]}
|
|
@@ -5,19 +5,21 @@ import { VoiceTranscriptionsCollection } from "./VoiceTranscriptionsCollection.j
|
|
|
5
5
|
import { VoiceFileDownloaderModel } from "./VoiceFileDownloader.model.js";
|
|
6
6
|
import { VoiceTranscriptionsDropdownModel } from "./VoiceTranscriptionsDropdown.model.js";
|
|
7
7
|
import { PlayerModel, PlayerState } from "./Player.model.js";
|
|
8
|
-
import {
|
|
8
|
+
import { TranscriptionsDownloaderModel } from "./TranscriptionsDownloaderModel.js";
|
|
9
9
|
export class VoicePlayerModel {
|
|
10
10
|
collection = new VoiceTranscriptionsCollection();
|
|
11
11
|
downloader = new VoiceFileDownloaderModel();
|
|
12
12
|
dropdown = new VoiceTranscriptionsDropdownModel();
|
|
13
13
|
playerModel = new PlayerModel();
|
|
14
14
|
currentPlayingAttempt = null;
|
|
15
|
+
shouldPreventPlayback = false;
|
|
15
16
|
setCurrentAttempt = createEvent();
|
|
16
17
|
reset = createEvent();
|
|
17
18
|
$currentAttempt = restore(this.setCurrentAttempt, null).reset(this.reset);
|
|
18
19
|
$playerState = this.playerModel.$playerState;
|
|
19
20
|
pauseAudio = this.playerModel.pause;
|
|
20
21
|
stopAudio = createEffect(() => {
|
|
22
|
+
this.shouldPreventPlayback = true;
|
|
21
23
|
this.abortCurrentDownload();
|
|
22
24
|
this.playerModel.stop();
|
|
23
25
|
this.currentPlayingAttempt = null;
|
|
@@ -25,7 +27,7 @@ export class VoicePlayerModel {
|
|
|
25
27
|
});
|
|
26
28
|
constructor(params) {
|
|
27
29
|
this.api = params.api;
|
|
28
|
-
this.loader = new
|
|
30
|
+
this.loader = new TranscriptionsDownloaderModel(this.collection, params.api);
|
|
29
31
|
this.downloader.setApi(params.api);
|
|
30
32
|
this.playerModel.playbackFinished.watch(() => {
|
|
31
33
|
this.currentPlayingAttempt = null;
|
|
@@ -73,6 +75,7 @@ export class VoicePlayerModel {
|
|
|
73
75
|
}
|
|
74
76
|
}
|
|
75
77
|
handlePlayAttempt = createEffect(async attemptNumber => {
|
|
78
|
+
this.shouldPreventPlayback = false;
|
|
76
79
|
const item = this.collection.get(attemptNumber);
|
|
77
80
|
if (!item) return;
|
|
78
81
|
if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
|
|
@@ -83,6 +86,8 @@ export class VoicePlayerModel {
|
|
|
83
86
|
return;
|
|
84
87
|
}
|
|
85
88
|
try {
|
|
89
|
+
this.currentPlayingAttempt = attemptNumber;
|
|
90
|
+
this.setCurrentAttempt(attemptNumber);
|
|
86
91
|
this.playerModel.setPlayerState(PlayerState.LOADING);
|
|
87
92
|
const {
|
|
88
93
|
collectionItem,
|
|
@@ -117,6 +122,7 @@ export class VoicePlayerModel {
|
|
|
117
122
|
}
|
|
118
123
|
});
|
|
119
124
|
playAudioFx = createEffect(async attemptNumber => {
|
|
125
|
+
if (this.shouldPreventPlayback) return;
|
|
120
126
|
const item = this.collection.get(attemptNumber);
|
|
121
127
|
if (!item?.audioUri) {
|
|
122
128
|
console.warn('No audio URI available for attempt:', attemptNumber);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["attach","createEffect","createEvent","restore","VoiceTranscriptionsCollection","VoiceFileDownloaderModel","VoiceTranscriptionsDropdownModel","PlayerModel","PlayerState","
|
|
1
|
+
{"version":3,"names":["attach","createEffect","createEvent","restore","VoiceTranscriptionsCollection","VoiceFileDownloaderModel","VoiceTranscriptionsDropdownModel","PlayerModel","PlayerState","TranscriptionsDownloaderModel","VoicePlayerModel","collection","downloader","dropdown","playerModel","currentPlayingAttempt","shouldPreventPlayback","setCurrentAttempt","reset","$currentAttempt","$playerState","pauseAudio","pause","stopAudio","abortCurrentDownload","stop","constructor","params","api","loader","setApi","playbackFinished","watch","audios","initializeCollectionFromAudios","setupAudioMode","initializeWithAudios","answerAudio","setTranscriptsLoaded","clear","console","warn","forEach","audio","index","attemptNumber","audioFileId","add","_id","hasDrawing","drawing","item","get","controller","audioLoading","abortDownload","update","undefined","audioDownloadPromise","handlePlayAttempt","hasAudio","playAudioFx","setPlayerState","LOADING","collectionItem","downloadPromise","download","result","audioUri","uri","audioError","IDLE","error","Error","name","message","player","remove","playing","resume","play","isAudioLoading","getAllAttempts","getAll","reinitializePlayer","reinitialize","cleanup","startsWith","URL","revokeObjectURL","e","release","togglePlayPause","source","mapParams","playerState","effect","PLAYING"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoicePlayer.model.ts"],"mappings":";;AAAA,SAASA,MAAM,EAAEC,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AACrE,SAASC,6BAA6B,QAAQ,oCAAiC;AAC/E,SAASC,wBAAwB,QAAQ,gCAA6B;AACtE,SAASC,gCAAgC,QAAQ,wCAAqC;AAEtF,SAASC,WAAW,EAAEC,WAAW,QAAQ,mBAAgB;AACzD,SAASC,6BAA6B,QAAQ,oCAAiC;AAW/E,OAAO,MAAMC,gBAAgB,CAAC;EACZC,UAAU,GAAG,IAAIP,6BAA6B,CAAC,CAAC;EAChDQ,UAAU,GAAG,IAAIP,wBAAwB,CAAC,CAAC;EAC3CQ,QAAQ,GAAG,IAAIP,gCAAgC,CAAC,CAAC;EACjDQ,WAAW,GAAG,IAAIP,WAAW,CAAC,CAAC;EAGvCQ,qBAAqB,GAAkB,IAAI;EAC3CC,qBAAqB,GAAG,KAAK;EAErBC,iBAAiB,GAAGf,WAAW,CAAgB,CAAC;EAChDgB,KAAK,GAAGhB,WAAW,CAAC,CAAC;EAErBiB,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ACE,UAAU,CAAC;MAChD;IACF,CAAC,CAAC;IAEF,IAAI,CAAC1C,UAAU,CAAC4B,KAAK,CAAC,CAAC;IACvB,IAAI,CAACxB,qBAAqB,GAAG,IAAI;IACjC,IAAI,CAACG,KAAK,CAAC,CAAC;IACZ,IAAI,CAACW,MAAM,CAACX,KAAK,CAAC,CAAC;IACnB,IAAI,CAACL,QAAQ,CAACK,KAAK,CAAC,CAAC;IACrB,IAAI,CAACJ,WAAW,CAAC6E,OAAO,CAAC,CAAC;EAC5B;EAEOC,eAAe,GAAG5F,MAAM,CAAC;IAC9B6F,MAAM,EAAE,IAAI,CAAC/E,WAAW,CAACM,YAAY;IACrC0E,SAAS,EAAEA,CAACjD,aAAqB,EAAEkD,WAAW,MAAM;MAAElD,aAAa;MAAEkD;IAAY,CAAC,CAAC;IACnFC,MAAM,EAAE/F,YAAY,CAAC,CAAC;MAAE4C,aAAa;MAAEkD;IAAmC,CAAC,KAAK;MAC9E,IAAI,IAAI,CAAChF,qBAAqB,KAAK8B,aAAa,IAAIkD,WAAW,KAAKvF,WAAW,CAACyF,OAAO,EAAE;QACvF,IAAI,CAAC5E,UAAU,CAAC,CAAC;MACnB,CAAC,MAAM;QACL,IAAI,CAACsC,iBAAiB,CAACd,aAAa,CAAC;MACvC;IACF,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VoiceTranscriptionsCollection } from './VoiceTranscriptionsCollection';
|
|
2
2
|
import { VoicePlayerApi } from '../../types';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class TranscriptionsDownloaderModel {
|
|
4
4
|
private readonly collection;
|
|
5
5
|
private readonly api;
|
|
6
6
|
readonly setTranscriptsLoaded: import("effector").EventCallable<boolean>;
|
|
@@ -12,4 +12,4 @@ export declare class TranscriptionsLoaderModel {
|
|
|
12
12
|
getTranscript(attemptNumber: number): string | undefined;
|
|
13
13
|
isTranscriptLoading(attemptNumber: number): boolean;
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=TranscriptionsDownloaderModel.d.ts.map
|
package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranscriptionsDownloaderModel.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/TranscriptionsDownloaderModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAO5C,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IAEpC,SAAgB,oBAAoB,4CAAyB;IAC7D,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,kBAAkB,4CAA8D;gBAEpF,UAAU,EAAE,6BAA6B,EAAE,GAAG,EAAE,cAAc;YAK5D,wBAAwB;IAmBtC,SAAgB,kBAAkB,+CA4BhC;IAEK,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAG3D"}
|
|
@@ -3,7 +3,7 @@ import { VoiceFileDownloaderModel } from './VoiceFileDownloader.model';
|
|
|
3
3
|
import { VoiceTranscriptionsDropdownModel } from './VoiceTranscriptionsDropdown.model';
|
|
4
4
|
import { AnswerAudio, VoicePlayerApi, VoiceTranscriptionItem } from '../../types';
|
|
5
5
|
import { PlayerModel, PlayerState } from './Player.model';
|
|
6
|
-
import {
|
|
6
|
+
import { TranscriptionsDownloaderModel } from './TranscriptionsDownloaderModel';
|
|
7
7
|
type VoiceTranscriptionsPlayerModelParams = {
|
|
8
8
|
api: VoicePlayerApi;
|
|
9
9
|
audios?: AnswerAudio[];
|
|
@@ -13,9 +13,10 @@ export declare class VoicePlayerModel {
|
|
|
13
13
|
readonly downloader: VoiceFileDownloaderModel;
|
|
14
14
|
readonly dropdown: VoiceTranscriptionsDropdownModel;
|
|
15
15
|
readonly playerModel: PlayerModel;
|
|
16
|
-
readonly loader:
|
|
16
|
+
readonly loader: TranscriptionsDownloaderModel;
|
|
17
17
|
readonly api: VoicePlayerApi;
|
|
18
18
|
private currentPlayingAttempt;
|
|
19
|
+
private shouldPreventPlayback;
|
|
19
20
|
readonly setCurrentAttempt: import("effector").EventCallable<number | null>;
|
|
20
21
|
readonly reset: import("effector").EventCallable<void>;
|
|
21
22
|
readonly $currentAttempt: import("effector").StoreWritable<number | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoicePlayer.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/VoicePlayer.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VoicePlayer.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/VoicePlayer.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAE/E,KAAK,oCAAoC,GAAG;IAC1C,GAAG,EAAE,cAAc,CAAA;IACnB,MAAM,CAAC,EAAE,WAAW,EAAE,CAAA;CACvB,CAAA;AAMD,qBAAa,gBAAgB;IAC3B,SAAgB,UAAU,gCAAsC;IAChE,SAAgB,UAAU,2BAAiC;IAC3D,SAAgB,QAAQ,mCAAyC;IACjE,SAAgB,WAAW,cAAoB;IAC/C,SAAgB,MAAM,EAAE,6BAA6B,CAAA;IACrD,SAAgB,GAAG,EAAE,cAAc,CAAA;IACnC,OAAO,CAAC,qBAAqB,CAAsB;IACnD,OAAO,CAAC,qBAAqB,CAAQ;IAErC,SAAgB,iBAAiB,kDAA+B;IAChE,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,eAAe,kDAA0D;IACzF,SAAgB,YAAY,gDAAgC;IAE5D,SAAgB,UAAU,+CAAyB;IAEnD,SAAgB,SAAS,+CAMvB;gBAEU,MAAM,EAAE,oCAAoC;IAiBjD,oBAAoB,CAAC,WAAW,EAAE,WAAW,EAAE;IAMtD,OAAO,CAAC,8BAA8B;IAoBtC,OAAO,CAAC,oBAAoB;IAa5B,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAmDhC;IAEF,OAAO,CAAC,WAAW,CAmCjB;IAEK,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;IAI9C,cAAc,IAAI,sBAAsB,EAAE;IAI1C,kBAAkB;IAIlB,OAAO;IAoBP,eAAe,iDAUpB;CACH"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VoiceTranscriptionsCollection } from './VoiceTranscriptionsCollection';
|
|
2
2
|
import { VoicePlayerApi } from '../../types';
|
|
3
|
-
export declare class
|
|
3
|
+
export declare class TranscriptionsDownloaderModel {
|
|
4
4
|
private readonly collection;
|
|
5
5
|
private readonly api;
|
|
6
6
|
readonly setTranscriptsLoaded: import("effector").EventCallable<boolean>;
|
|
@@ -12,4 +12,4 @@ export declare class TranscriptionsLoaderModel {
|
|
|
12
12
|
getTranscript(attemptNumber: number): string | undefined;
|
|
13
13
|
isTranscriptLoading(attemptNumber: number): boolean;
|
|
14
14
|
}
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=TranscriptionsDownloaderModel.d.ts.map
|
package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TranscriptionsDownloaderModel.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/TranscriptionsDownloaderModel.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAO5C,qBAAa,6BAA6B;IACxC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IAEpC,SAAgB,oBAAoB,4CAAyB;IAC7D,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,kBAAkB,4CAA8D;gBAEpF,UAAU,EAAE,6BAA6B,EAAE,GAAG,EAAE,cAAc;YAK5D,wBAAwB;IAmBtC,SAAgB,kBAAkB,+CA4BhC;IAEK,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAG3D"}
|
|
@@ -3,7 +3,7 @@ import { VoiceFileDownloaderModel } from './VoiceFileDownloader.model';
|
|
|
3
3
|
import { VoiceTranscriptionsDropdownModel } from './VoiceTranscriptionsDropdown.model';
|
|
4
4
|
import { AnswerAudio, VoicePlayerApi, VoiceTranscriptionItem } from '../../types';
|
|
5
5
|
import { PlayerModel, PlayerState } from './Player.model';
|
|
6
|
-
import {
|
|
6
|
+
import { TranscriptionsDownloaderModel } from './TranscriptionsDownloaderModel';
|
|
7
7
|
type VoiceTranscriptionsPlayerModelParams = {
|
|
8
8
|
api: VoicePlayerApi;
|
|
9
9
|
audios?: AnswerAudio[];
|
|
@@ -13,9 +13,10 @@ export declare class VoicePlayerModel {
|
|
|
13
13
|
readonly downloader: VoiceFileDownloaderModel;
|
|
14
14
|
readonly dropdown: VoiceTranscriptionsDropdownModel;
|
|
15
15
|
readonly playerModel: PlayerModel;
|
|
16
|
-
readonly loader:
|
|
16
|
+
readonly loader: TranscriptionsDownloaderModel;
|
|
17
17
|
readonly api: VoicePlayerApi;
|
|
18
18
|
private currentPlayingAttempt;
|
|
19
|
+
private shouldPreventPlayback;
|
|
19
20
|
readonly setCurrentAttempt: import("effector").EventCallable<number | null>;
|
|
20
21
|
readonly reset: import("effector").EventCallable<void>;
|
|
21
22
|
readonly $currentAttempt: import("effector").StoreWritable<number | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoicePlayer.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/VoicePlayer.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAA;AACtE,OAAO,EAAE,gCAAgC,EAAE,MAAM,qCAAqC,CAAA;AACtF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VoicePlayer.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/VoicePlayer.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,wBAA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|
|
|
7
7
|
TRANSCRIPT_RETRY_INTERVAL_MS,
|
|
8
8
|
} from '../../constants'
|
|
9
9
|
|
|
10
|
-
export class
|
|
10
|
+
export class TranscriptionsDownloaderModel {
|
|
11
11
|
private readonly collection: VoiceTranscriptionsCollection
|
|
12
12
|
private readonly api: VoicePlayerApi
|
|
13
13
|
|
|
@@ -4,7 +4,7 @@ import { VoiceFileDownloaderModel } from './VoiceFileDownloader.model'
|
|
|
4
4
|
import { VoiceTranscriptionsDropdownModel } from './VoiceTranscriptionsDropdown.model'
|
|
5
5
|
import { AnswerAudio, VoicePlayerApi, VoiceTranscriptionItem } from '../../types'
|
|
6
6
|
import { PlayerModel, PlayerState } from './Player.model'
|
|
7
|
-
import {
|
|
7
|
+
import { TranscriptionsDownloaderModel } from './TranscriptionsDownloaderModel'
|
|
8
8
|
|
|
9
9
|
type VoiceTranscriptionsPlayerModelParams = {
|
|
10
10
|
api: VoicePlayerApi
|
|
@@ -20,9 +20,10 @@ export class VoicePlayerModel {
|
|
|
20
20
|
public readonly downloader = new VoiceFileDownloaderModel()
|
|
21
21
|
public readonly dropdown = new VoiceTranscriptionsDropdownModel()
|
|
22
22
|
public readonly playerModel = new PlayerModel()
|
|
23
|
-
public readonly loader:
|
|
23
|
+
public readonly loader: TranscriptionsDownloaderModel
|
|
24
24
|
public readonly api: VoicePlayerApi
|
|
25
25
|
private currentPlayingAttempt: number | null = null
|
|
26
|
+
private shouldPreventPlayback = false
|
|
26
27
|
|
|
27
28
|
public readonly setCurrentAttempt = createEvent<number | null>()
|
|
28
29
|
public readonly reset = createEvent()
|
|
@@ -33,6 +34,7 @@ export class VoicePlayerModel {
|
|
|
33
34
|
public readonly pauseAudio = this.playerModel.pause
|
|
34
35
|
|
|
35
36
|
public readonly stopAudio = createEffect(() => {
|
|
37
|
+
this.shouldPreventPlayback = true
|
|
36
38
|
this.abortCurrentDownload()
|
|
37
39
|
this.playerModel.stop()
|
|
38
40
|
this.currentPlayingAttempt = null
|
|
@@ -41,7 +43,7 @@ export class VoicePlayerModel {
|
|
|
41
43
|
|
|
42
44
|
constructor(params: VoiceTranscriptionsPlayerModelParams) {
|
|
43
45
|
this.api = params.api
|
|
44
|
-
this.loader = new
|
|
46
|
+
this.loader = new TranscriptionsDownloaderModel(this.collection, params.api)
|
|
45
47
|
this.downloader.setApi(params.api)
|
|
46
48
|
|
|
47
49
|
this.playerModel.playbackFinished.watch(() => {
|
|
@@ -96,6 +98,7 @@ export class VoicePlayerModel {
|
|
|
96
98
|
}
|
|
97
99
|
|
|
98
100
|
private readonly handlePlayAttempt = createEffect(async (attemptNumber: number) => {
|
|
101
|
+
this.shouldPreventPlayback = false
|
|
99
102
|
const item = this.collection.get(attemptNumber)
|
|
100
103
|
if (!item) return
|
|
101
104
|
|
|
@@ -109,6 +112,8 @@ export class VoicePlayerModel {
|
|
|
109
112
|
}
|
|
110
113
|
|
|
111
114
|
try {
|
|
115
|
+
this.currentPlayingAttempt = attemptNumber
|
|
116
|
+
this.setCurrentAttempt(attemptNumber)
|
|
112
117
|
this.playerModel.setPlayerState(PlayerState.LOADING)
|
|
113
118
|
const { collectionItem, downloadPromise } = await this.downloader.download({
|
|
114
119
|
audioFileId: item.audioFileId,
|
|
@@ -146,6 +151,8 @@ export class VoicePlayerModel {
|
|
|
146
151
|
})
|
|
147
152
|
|
|
148
153
|
private playAudioFx = createEffect(async (attemptNumber: number) => {
|
|
154
|
+
if (this.shouldPreventPlayback) return
|
|
155
|
+
|
|
149
156
|
const item = this.collection.get(attemptNumber)
|
|
150
157
|
if (!item?.audioUri) {
|
|
151
158
|
console.warn('No audio URI available for attempt:', attemptNumber)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["_effector","require","_constants","TranscriptionsLoaderModel","setTranscriptsLoaded","createEvent","reset","$transcriptsLoaded","restore","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","TRANSCRIPT_MAX_RETRIES","response","getAudioFileTranscript","status","text","NO_AUDIO_BE_MESSAGE","Promise","resolve","setTimeout","TRANSCRIPT_RETRY_INTERVAL_MS","loadAllTranscripts","createEffect","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptError","undefined","error","Error","message","all","getTranscript","get","isTranscriptLoading","exports"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsLoader.model.ts"],"mappings":";;;;;;AAAA,IAAAA,SAAA,GAAAC,OAAA;AAGA,IAAAC,UAAA,GAAAD,OAAA;AAMO,MAAME,yBAAyB,CAAC;EAIrBC,oBAAoB,GAAG,IAAAC,qBAAW,EAAU,CAAC;EAC7CC,KAAK,GAAG,IAAAD,qBAAW,EAAC,CAAC;EAErBE,kBAAkB,GAAG,IAAAC,iBAAO,EAAC,IAAI,CAACJ,oBAAoB,EAAE,KAAK,CAAC,CAACE,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EAEhGG,WAAWA,CAACC,UAAyC,EAAEC,GAAmB,EAAE;IAC1E,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,GAAG,GAAGA,GAAG;EAChB;EAEA,MAAcC,wBAAwBA,CAACC,WAAmB,EAAmB;IAC3E,KAAK,IAAIC,OAAO,GAAG,CAAC,EAAEA,OAAO,GAAGC,iCAAsB,EAAED,OAAO,EAAE,EAAE;MACjE,MAAME,QAAQ,GAAG,MAAM,IAAI,CAACL,GAAG,CAACM,sBAAsB,CAACJ,WAAW,CAAC;MAEnE,IAAIG,QAAQ,CAACE,MAAM,KAAK,WAAW,EAAE;QACnC,OAAOF,QAAQ,CAACG,IAAI;MACtB;MAEA,IAAIH,QAAQ,CAACE,MAAM,KAAK,QAAQ,EAAE;QAChC,OAAOE,8BAAmB;MAC5B;MAEA,IAAIN,OAAO,GAAGC,iCAAsB,GAAG,CAAC,EAAE;QACxC,MAAM,IAAIM,OAAO,CAAEC,OAAO,IAAKC,UAAU,CAACD,OAAO,EAAEE,uCAA4B,CAAC,CAAC;MACnF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ACvB,UAAU,CAACkC,GAAG,CAACX,aAAa,CAAC,EAAEE,iBAAiB,IAAI,KAAK;EACvE;AACF;AAACW,OAAA,CAAA3C,yBAAA,GAAAA,yBAAA","ignoreList":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["createEffect","createEvent","restore","NO_AUDIO_BE_MESSAGE","TRANSCRIPT_MAX_RETRIES","TRANSCRIPT_RETRY_INTERVAL_MS","TranscriptionsLoaderModel","setTranscriptsLoaded","reset","$transcriptsLoaded","constructor","collection","api","fetchTranscriptWithRetry","audioFileId","attempt","response","getAudioFileTranscript","status","text","Promise","resolve","setTimeout","loadAllTranscripts","attempts","getAll","transcriptPromises","map","item","hasTranscript","attemptNumber","update","transcriptLoading","transcript","transcriptError","undefined","error","Error","message","all","getTranscript","get","isTranscriptLoading"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/TranscriptionsLoader.model.ts"],"mappings":";;AAAA,SAASA,YAAY,EAAEC,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAG7D,SACEC,mBAAmB,EACnBC,sBAAsB,EACtBC,4BAA4B,QACvB,oBAAiB;AAExB,OAAO,MAAMC,yBAAyB,CAAC;EAIrBC,oBAAoB,GAAGN,WAAW,CAAU,CAAC;EAC7CO,KAAK,GAAGP,WAAW,CAAC,CAAC;EAErBQ,kBAAkB,GAAGP,OAAO,CAAC,IAAI,CAACK,oBAAoB,EAAE,KAAK,CAAC,CAACC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EAEhGE,WAAWA,CAACC,UAAyC,EAAEC,GAAmB,EAAE;IAC1E,IAAI,CAACD,UAAU,GAAGA,UAAU;IAC5B,IAAI,CAACC,GAAG,GAAGA,GAAG;EAChB;EAEA,MAAcC,wBAAwBA,CAACC,WAAmB,EAAmB;IAC3E,KAAK,IAAIC,OAAO,GAAG,CAAC,EAAEA,OAAO,GAAGX,sBAAsB,EAAEW,OAAO,EAAE,EAAE;MACjE,MAAMC,QAAQ,GAA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GAAGD,KAAK,CAACE,OAAO,GAAG;QAC5D,CAAC,CAAC;MACJ;IACF,CAAC,CAAC;IAEF,MAAMlB,OAAO,CAACmB,GAAG,CAACb,kBAAkB,CAAC;IACrC,IAAI,CAACnB,oBAAoB,CAAC,IAAI,CAAC;EACjC,CAAC,CAAC;EAEKiC,aAAaA,CAACV,aAAqB,EAAsB;IAC9D,OAAO,IAAI,CAACnB,UAAU,CAAC8B,GAAG,CAACX,aAAa,CAAC,EAAEG,UAAU;EACvD;EAEOS,mBAAmBA,CAACZ,aAAqB,EAAW;IACzD,OAAO,IAAI,CAACnB,UAAU,CAAC8B,GAAG,CAACX,aAAa,CAAC,EAAEE,iBAAiB,IAAI,KAAK;EACvE;AACF","ignoreList":[]}
|
package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsLoader.model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptionsLoader.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/TranscriptionsLoader.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAO5C,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IAEpC,SAAgB,oBAAoB,4CAAyB;IAC7D,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,kBAAkB,4CAA8D;gBAEpF,UAAU,EAAE,6BAA6B,EAAE,GAAG,EAAE,cAAc;YAK5D,wBAAwB;IAmBtC,SAAgB,kBAAkB,+CA4BhC;IAEK,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAG3D"}
|
package/dist/typescript/module/features/voice/playing/model/TranscriptionsLoader.model.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranscriptionsLoader.model.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/voice/playing/model/TranscriptionsLoader.model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,6BAA6B,EAAE,MAAM,iCAAiC,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAO5C,qBAAa,yBAAyB;IACpC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAA+B;IAC1D,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAgB;IAEpC,SAAgB,oBAAoB,4CAAyB;IAC7D,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,kBAAkB,4CAA8D;gBAEpF,UAAU,EAAE,6BAA6B,EAAE,GAAG,EAAE,cAAc;YAK5D,wBAAwB;IAmBtC,SAAgB,kBAAkB,+CA4BhC;IAEK,aAAa,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIxD,mBAAmB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO;CAG3D"}
|