@magmamath/students-features 1.3.23-rc.2 → 1.3.23-rc.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/dist/commonjs/features/translation/constants.js +11 -0
  2. package/dist/commonjs/features/translation/constants.js.map +1 -0
  3. package/dist/commonjs/features/translation/helpers.js +60 -0
  4. package/dist/commonjs/features/translation/helpers.js.map +1 -0
  5. package/dist/commonjs/features/translation/index.js +105 -0
  6. package/dist/commonjs/features/translation/index.js.map +1 -0
  7. package/dist/commonjs/features/translation/model/TranslationModel.js +122 -0
  8. package/dist/commonjs/features/translation/model/TranslationModel.js.map +1 -0
  9. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js +142 -0
  10. package/dist/commonjs/features/translation/model/TranslationPreprocessor.js.map +1 -0
  11. package/dist/commonjs/features/translation/model/TranslationService.js +112 -0
  12. package/dist/commonjs/features/translation/model/TranslationService.js.map +1 -0
  13. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js +314 -0
  14. package/dist/commonjs/features/translation/preserve/wordsToPreserve.js.map +1 -0
  15. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js +50 -0
  16. package/dist/commonjs/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  17. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js +230 -0
  18. package/dist/commonjs/features/translation/providers/google/supportedLanguages.js.map +1 -0
  19. package/dist/commonjs/features/translation/providers/google.types.js +2 -0
  20. package/dist/commonjs/features/translation/providers/google.types.js.map +1 -0
  21. package/dist/commonjs/features/translation/providers/translation.interface.js +49 -0
  22. package/dist/commonjs/features/translation/providers/translation.interface.js.map +1 -0
  23. package/dist/commonjs/features/translation/types.js +2 -0
  24. package/dist/commonjs/features/translation/types.js.map +1 -0
  25. package/dist/commonjs/features/voice/index.js +4 -4
  26. package/dist/commonjs/features/voice/index.js.map +1 -1
  27. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js +44 -0
  28. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  29. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js +107 -0
  30. package/dist/commonjs/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  31. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js +66 -0
  32. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  33. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +58 -0
  34. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  35. package/dist/commonjs/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +8 -7
  36. package/dist/commonjs/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
  37. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js +128 -0
  38. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
  39. package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +4 -4
  40. package/dist/commonjs/features/voice/playing/model/Dropdown.model.js.map +1 -0
  41. package/dist/commonjs/features/voice/playing/model/PlaybackController.js +183 -0
  42. package/dist/commonjs/features/voice/playing/model/PlaybackController.js.map +1 -0
  43. package/dist/commonjs/features/voice/playing/model/Player.model.js +24 -1
  44. package/dist/commonjs/features/voice/playing/model/Player.model.js.map +1 -1
  45. package/dist/commonjs/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +4 -4
  46. package/dist/commonjs/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
  47. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js +82 -0
  48. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
  49. package/dist/commonjs/features/voice/playing/model/Translation.model.js +62 -0
  50. package/dist/commonjs/features/voice/playing/model/Translation.model.js.map +1 -0
  51. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  52. package/dist/commonjs/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  53. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js +46 -172
  54. package/dist/commonjs/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  55. package/dist/commonjs/features/voice/types.js.map +1 -1
  56. package/dist/commonjs/index.js +12 -0
  57. package/dist/commonjs/index.js.map +1 -1
  58. package/dist/module/features/translation/constants.js +7 -0
  59. package/dist/module/features/translation/constants.js.map +1 -0
  60. package/dist/module/features/translation/helpers.js +53 -0
  61. package/dist/module/features/translation/helpers.js.map +1 -0
  62. package/dist/module/features/translation/index.js +12 -0
  63. package/dist/module/features/translation/index.js.map +1 -0
  64. package/dist/module/features/translation/model/TranslationModel.js +117 -0
  65. package/dist/module/features/translation/model/TranslationModel.js.map +1 -0
  66. package/dist/module/features/translation/model/TranslationPreprocessor.js +137 -0
  67. package/dist/module/features/translation/model/TranslationPreprocessor.js.map +1 -0
  68. package/dist/module/features/translation/model/TranslationService.js +107 -0
  69. package/dist/module/features/translation/model/TranslationService.js.map +1 -0
  70. package/dist/module/features/translation/preserve/wordsToPreserve.js +310 -0
  71. package/dist/module/features/translation/preserve/wordsToPreserve.js.map +1 -0
  72. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js +45 -0
  73. package/dist/module/features/translation/providers/google/GoogleTranslationProvider.js.map +1 -0
  74. package/dist/module/features/translation/providers/google/supportedLanguages.js +225 -0
  75. package/dist/module/features/translation/providers/google/supportedLanguages.js.map +1 -0
  76. package/dist/module/features/translation/providers/google.types.js +2 -0
  77. package/dist/module/features/translation/providers/google.types.js.map +1 -0
  78. package/dist/module/features/translation/providers/translation.interface.js +44 -0
  79. package/dist/module/features/translation/providers/translation.interface.js.map +1 -0
  80. package/dist/module/features/translation/types.js +2 -0
  81. package/dist/module/features/translation/types.js.map +1 -0
  82. package/dist/module/features/voice/index.js +1 -1
  83. package/dist/module/features/voice/index.js.map +1 -1
  84. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js +38 -0
  85. package/dist/module/features/voice/playing/components/VoiceTranscriptContent.js.map +1 -0
  86. package/dist/module/features/voice/playing/components/VoiceTranscription.js +101 -0
  87. package/dist/module/features/voice/playing/components/VoiceTranscription.js.map +1 -0
  88. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js +58 -0
  89. package/dist/module/features/voice/playing/components/VoiceTranscriptionCollapsible.js.map +1 -0
  90. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js +52 -0
  91. package/dist/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.js.map +1 -0
  92. package/dist/module/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.js → useDropdownAnimation.js} +6 -5
  93. package/dist/module/features/voice/playing/hooks/useDropdownAnimation.js.map +1 -0
  94. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js +123 -0
  95. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionController.js.map +1 -0
  96. package/dist/module/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.js → Dropdown.model.js} +2 -2
  97. package/dist/module/features/voice/playing/model/Dropdown.model.js.map +1 -0
  98. package/dist/module/features/voice/playing/model/PlaybackController.js +178 -0
  99. package/dist/module/features/voice/playing/model/PlaybackController.js.map +1 -0
  100. package/dist/module/features/voice/playing/model/Player.model.js +24 -1
  101. package/dist/module/features/voice/playing/model/Player.model.js.map +1 -1
  102. package/dist/module/features/voice/playing/model/{VoiceTranscriptionsCollection.js → TranscriptionsCollection.js} +2 -2
  103. package/dist/module/features/voice/playing/model/TranscriptionsCollection.js.map +1 -0
  104. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js +77 -0
  105. package/dist/module/features/voice/playing/model/TranscriptionsDownloader.model.js.map +1 -0
  106. package/dist/module/features/voice/playing/model/Translation.model.js +57 -0
  107. package/dist/module/features/voice/playing/model/Translation.model.js.map +1 -0
  108. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js +2 -2
  109. package/dist/module/features/voice/playing/model/VoiceFileDownloader.model.js.map +1 -1
  110. package/dist/module/features/voice/playing/model/VoicePlayer.model.js +48 -174
  111. package/dist/module/features/voice/playing/model/VoicePlayer.model.js.map +1 -1
  112. package/dist/module/features/voice/types.js.map +1 -1
  113. package/dist/module/index.js +1 -0
  114. package/dist/module/index.js.map +1 -1
  115. package/dist/typescript/commonjs/features/translation/constants.d.ts +5 -0
  116. package/dist/typescript/commonjs/features/translation/constants.d.ts.map +1 -0
  117. package/dist/typescript/commonjs/features/translation/helpers.d.ts +9 -0
  118. package/dist/typescript/commonjs/features/translation/helpers.d.ts.map +1 -0
  119. package/dist/typescript/commonjs/features/translation/index.d.ts +12 -0
  120. package/dist/typescript/commonjs/features/translation/index.d.ts.map +1 -0
  121. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts +33 -0
  122. package/dist/typescript/commonjs/features/translation/model/TranslationModel.d.ts.map +1 -0
  123. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  124. package/dist/typescript/commonjs/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  125. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts +40 -0
  126. package/dist/typescript/commonjs/features/translation/model/TranslationService.d.ts.map +1 -0
  127. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  128. package/dist/typescript/commonjs/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  129. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  130. package/dist/typescript/commonjs/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  131. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  132. package/dist/typescript/commonjs/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  133. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts +15 -0
  134. package/dist/typescript/commonjs/features/translation/providers/google.types.d.ts.map +1 -0
  135. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts +30 -0
  136. package/dist/typescript/commonjs/features/translation/providers/translation.interface.d.ts.map +1 -0
  137. package/dist/typescript/commonjs/features/translation/types.d.ts +27 -0
  138. package/dist/typescript/commonjs/features/translation/types.d.ts.map +1 -0
  139. package/dist/typescript/commonjs/features/voice/index.d.ts +2 -1
  140. package/dist/typescript/commonjs/features/voice/index.d.ts.map +1 -1
  141. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  142. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  143. package/dist/typescript/{module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts → commonjs/features/voice/playing/components/VoiceTranscription.d.ts} +3 -4
  144. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  145. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  146. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  147. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  148. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  149. package/dist/typescript/{module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts} +3 -3
  150. package/dist/typescript/commonjs/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
  151. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
  152. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
  153. package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → commonjs/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
  154. package/dist/typescript/commonjs/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
  155. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts +28 -0
  156. package/dist/typescript/commonjs/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
  157. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts +3 -0
  158. package/dist/typescript/commonjs/features/voice/playing/model/Player.model.d.ts.map +1 -1
  159. package/dist/typescript/{module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
  160. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
  161. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
  162. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
  163. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts +25 -0
  164. package/dist/typescript/commonjs/features/voice/playing/model/Translation.model.d.ts.map +1 -0
  165. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  166. package/dist/typescript/commonjs/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  167. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts +18 -18
  168. package/dist/typescript/commonjs/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  169. package/dist/typescript/commonjs/features/voice/types.d.ts +5 -1
  170. package/dist/typescript/commonjs/features/voice/types.d.ts.map +1 -1
  171. package/dist/typescript/commonjs/index.d.ts +1 -0
  172. package/dist/typescript/commonjs/index.d.ts.map +1 -1
  173. package/dist/typescript/module/features/translation/constants.d.ts +5 -0
  174. package/dist/typescript/module/features/translation/constants.d.ts.map +1 -0
  175. package/dist/typescript/module/features/translation/helpers.d.ts +9 -0
  176. package/dist/typescript/module/features/translation/helpers.d.ts.map +1 -0
  177. package/dist/typescript/module/features/translation/index.d.ts +12 -0
  178. package/dist/typescript/module/features/translation/index.d.ts.map +1 -0
  179. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts +33 -0
  180. package/dist/typescript/module/features/translation/model/TranslationModel.d.ts.map +1 -0
  181. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts +34 -0
  182. package/dist/typescript/module/features/translation/model/TranslationPreprocessor.d.ts.map +1 -0
  183. package/dist/typescript/module/features/translation/model/TranslationService.d.ts +40 -0
  184. package/dist/typescript/module/features/translation/model/TranslationService.d.ts.map +1 -0
  185. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts +3 -0
  186. package/dist/typescript/module/features/translation/preserve/wordsToPreserve.d.ts.map +1 -0
  187. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts +17 -0
  188. package/dist/typescript/module/features/translation/providers/google/GoogleTranslationProvider.d.ts.map +1 -0
  189. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts +209 -0
  190. package/dist/typescript/module/features/translation/providers/google/supportedLanguages.d.ts.map +1 -0
  191. package/dist/typescript/module/features/translation/providers/google.types.d.ts +15 -0
  192. package/dist/typescript/module/features/translation/providers/google.types.d.ts.map +1 -0
  193. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts +30 -0
  194. package/dist/typescript/module/features/translation/providers/translation.interface.d.ts.map +1 -0
  195. package/dist/typescript/module/features/translation/types.d.ts +27 -0
  196. package/dist/typescript/module/features/translation/types.d.ts.map +1 -0
  197. package/dist/typescript/module/features/voice/index.d.ts +2 -1
  198. package/dist/typescript/module/features/voice/index.d.ts.map +1 -1
  199. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts +8 -0
  200. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptContent.d.ts.map +1 -0
  201. package/dist/typescript/{commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts → module/features/voice/playing/components/VoiceTranscription.d.ts} +3 -4
  202. package/dist/typescript/module/features/voice/playing/components/VoiceTranscription.d.ts.map +1 -0
  203. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts +10 -0
  204. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionCollapsible.d.ts.map +1 -0
  205. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts +12 -0
  206. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionHeaderActions.d.ts.map +1 -0
  207. package/dist/typescript/{commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts → module/features/voice/playing/hooks/useDropdownAnimation.d.ts} +3 -3
  208. package/dist/typescript/module/features/voice/playing/hooks/useDropdownAnimation.d.ts.map +1 -0
  209. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts +30 -0
  210. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionController.d.ts.map +1 -0
  211. package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts → module/features/voice/playing/model/Dropdown.model.d.ts} +2 -2
  212. package/dist/typescript/module/features/voice/playing/model/Dropdown.model.d.ts.map +1 -0
  213. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts +28 -0
  214. package/dist/typescript/module/features/voice/playing/model/PlaybackController.d.ts.map +1 -0
  215. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts +3 -0
  216. package/dist/typescript/module/features/voice/playing/model/Player.model.d.ts.map +1 -1
  217. package/dist/typescript/{commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts → module/features/voice/playing/model/TranscriptionsCollection.d.ts} +2 -2
  218. package/dist/typescript/module/features/voice/playing/model/TranscriptionsCollection.d.ts.map +1 -0
  219. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts +19 -0
  220. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloader.model.d.ts.map +1 -0
  221. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts +25 -0
  222. package/dist/typescript/module/features/voice/playing/model/Translation.model.d.ts.map +1 -0
  223. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts +2 -2
  224. package/dist/typescript/module/features/voice/playing/model/VoiceFileDownloader.model.d.ts.map +1 -1
  225. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts +18 -18
  226. package/dist/typescript/module/features/voice/playing/model/VoicePlayer.model.d.ts.map +1 -1
  227. package/dist/typescript/module/features/voice/types.d.ts +5 -1
  228. package/dist/typescript/module/features/voice/types.d.ts.map +1 -1
  229. package/dist/typescript/module/index.d.ts +1 -0
  230. package/dist/typescript/module/index.d.ts.map +1 -1
  231. package/package.json +28 -1
  232. package/src/features/translation/constants.ts +4 -0
  233. package/src/features/translation/helpers.ts +63 -0
  234. package/src/features/translation/index.ts +30 -0
  235. package/src/features/translation/model/TranslationModel.ts +174 -0
  236. package/src/features/translation/model/TranslationPreprocessor.ts +171 -0
  237. package/src/features/translation/model/TranslationService.ts +148 -0
  238. package/src/features/translation/preserve/wordsToPreserve.ts +87 -0
  239. package/src/features/translation/providers/google/GoogleTranslationProvider.ts +50 -0
  240. package/src/features/translation/providers/google/supportedLanguages.ts +229 -0
  241. package/src/features/translation/providers/google.types.ts +16 -0
  242. package/src/features/translation/providers/translation.interface.ts +63 -0
  243. package/src/features/translation/types.ts +30 -0
  244. package/src/features/voice/index.ts +2 -1
  245. package/src/features/voice/playing/components/VoiceTranscriptContent.tsx +37 -0
  246. package/src/features/voice/playing/components/VoiceTranscription.tsx +117 -0
  247. package/src/features/voice/playing/components/VoiceTranscriptionCollapsible.tsx +59 -0
  248. package/src/features/voice/playing/components/VoiceTranscriptionHeaderActions.tsx +61 -0
  249. package/src/features/voice/playing/hooks/{useVoiceTranscriptionsDropdown.ts → useDropdownAnimation.ts} +5 -5
  250. package/src/features/voice/playing/hooks/useVoiceTranscriptionController.ts +171 -0
  251. package/src/features/voice/playing/model/{VoiceTranscriptionsDropdown.model.ts → Dropdown.model.ts} +2 -2
  252. package/src/features/voice/playing/model/PlaybackController.ts +213 -0
  253. package/src/features/voice/playing/model/Player.model.ts +26 -1
  254. package/src/features/voice/playing/model/{VoiceTranscriptionsCollection.ts → TranscriptionsCollection.ts} +1 -1
  255. package/src/features/voice/playing/model/TranscriptionsDownloader.model.ts +88 -0
  256. package/src/features/voice/playing/model/Translation.model.ts +75 -0
  257. package/src/features/voice/playing/model/VoiceFileDownloader.model.ts +2 -2
  258. package/src/features/voice/playing/model/VoicePlayer.model.ts +57 -194
  259. package/src/features/voice/types.ts +10 -0
  260. package/src/index.ts +1 -0
  261. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -251
  262. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  263. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -109
  264. package/dist/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  265. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  266. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -34
  267. package/dist/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  268. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -66
  269. package/dist/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
  270. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
  271. package/dist/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  272. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js +0 -244
  273. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdown.js.map +0 -1
  274. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js +0 -103
  275. package/dist/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.js.map +0 -1
  276. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.js.map +0 -1
  277. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js +0 -29
  278. package/dist/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.js.map +0 -1
  279. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js +0 -61
  280. package/dist/module/features/voice/playing/model/TranscriptionsDownloaderModel.js.map +0 -1
  281. package/dist/module/features/voice/playing/model/VoiceTranscriptionsCollection.js.map +0 -1
  282. package/dist/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.js.map +0 -1
  283. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  284. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  285. package/dist/typescript/commonjs/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  286. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  287. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  288. package/dist/typescript/commonjs/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  289. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
  290. package/dist/typescript/commonjs/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
  291. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
  292. package/dist/typescript/commonjs/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  293. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdown.d.ts.map +0 -1
  294. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts +0 -12
  295. package/dist/typescript/module/features/voice/playing/components/VoiceTranscriptionsDropdownItem.d.ts.map +0 -1
  296. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdown.d.ts.map +0 -1
  297. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts +0 -11
  298. package/dist/typescript/module/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.d.ts.map +0 -1
  299. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts +0 -15
  300. package/dist/typescript/module/features/voice/playing/model/TranscriptionsDownloaderModel.d.ts.map +0 -1
  301. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsCollection.d.ts.map +0 -1
  302. package/dist/typescript/module/features/voice/playing/model/VoiceTranscriptionsDropdown.model.d.ts.map +0 -1
  303. package/src/features/voice/playing/components/VoiceTranscriptionsDropdown.tsx +0 -302
  304. package/src/features/voice/playing/components/VoiceTranscriptionsDropdownItem.tsx +0 -128
  305. package/src/features/voice/playing/hooks/useVoiceTranscriptionsDropdownItemAnimation.ts +0 -40
  306. package/src/features/voice/playing/model/TranscriptionsDownloaderModel.ts +0 -80
@@ -1,56 +1,74 @@
1
1
  "use strict";
2
2
 
3
- import { attach, createEffect, createEvent, restore } from 'effector';
4
- import { VoiceTranscriptionsCollection } from "./VoiceTranscriptionsCollection.js";
3
+ import { createEvent, restore } from 'effector';
4
+ import { TranscriptionsCollection } from "./TranscriptionsCollection.js";
5
5
  import { VoiceFileDownloaderModel } from "./VoiceFileDownloader.model.js";
6
- import { VoiceTranscriptionsDropdownModel } from "./VoiceTranscriptionsDropdown.model.js";
7
- import { PlayerModel, PlayerState } from "./Player.model.js";
8
- import { TranscriptionsDownloaderModel } from "./TranscriptionsDownloaderModel.js";
6
+ import { DropdownModel } from "./Dropdown.model.js";
7
+ import { TranslationModel } from "./Translation.model.js";
8
+ import { PlayerModel } from "./Player.model.js";
9
+ import { TranscriptionsDownloaderModel } from "./TranscriptionsDownloader.model.js";
10
+ import { PlaybackController } from "./PlaybackController.js";
9
11
  export class VoicePlayerModel {
10
- collection = new VoiceTranscriptionsCollection();
11
- downloader = new VoiceFileDownloaderModel();
12
- dropdown = new VoiceTranscriptionsDropdownModel();
12
+ collection = new TranscriptionsCollection();
13
+ dropdown = new DropdownModel();
13
14
  playerModel = new PlayerModel();
14
- currentPlayingAttempt = null;
15
- shouldPreventPlayback = false;
16
15
  setCurrentAttempt = createEvent();
17
16
  reset = createEvent();
18
17
  $currentAttempt = restore(this.setCurrentAttempt, null).reset(this.reset);
19
18
  $playerState = this.playerModel.$playerState;
20
19
  pauseAudio = this.playerModel.pause;
21
- stopAudio = () => {
22
- this.shouldPreventPlayback = true;
23
- this.abortAllDownloads();
24
- this.playerModel.stop();
25
- this.currentPlayingAttempt = null;
26
- this.setCurrentAttempt(null);
27
- };
28
- resetPlayer = () => {
29
- this.shouldPreventPlayback = true;
30
- this.releaseCollectionResources();
31
- this.playerModel.stop();
32
- this.currentPlayingAttempt = null;
33
- this.setCurrentAttempt(null);
34
- this.collection.clear();
35
- };
20
+ seekAudio = this.playerModel.seek;
36
21
  constructor(params) {
37
22
  this.api = params.api;
23
+ this.downloader = new VoiceFileDownloaderModel(params.api);
38
24
  this.loader = new TranscriptionsDownloaderModel(this.collection, params.api);
39
- this.downloader.setApi(params.api);
40
- this.playerModel.playbackFinished.watch(() => {
41
- this.currentPlayingAttempt = null;
42
- this.setCurrentAttempt(null);
25
+ this.translation = new TranslationModel(this.collection, params.api);
26
+ this.playback = new PlaybackController({
27
+ collection: this.collection,
28
+ player: this.playerModel,
29
+ downloader: this.downloader
43
30
  });
31
+ this.togglePlayPause = this.playback.togglePlayPause;
44
32
  if (params.audios) {
45
33
  this.initializeCollectionFromAudios(params.audios);
46
34
  }
47
35
  this.playerModel.setupAudioMode();
48
36
  }
37
+ stopAudio = () => {
38
+ this.playback.halt();
39
+ };
40
+ preloadAudio = attemptNumber => {
41
+ const target = attemptNumber ?? this.$currentAttempt.getState();
42
+ if (target === null) return;
43
+ return this.playback.preloadAudio(target);
44
+ };
45
+ resetPlayer = () => {
46
+ this.playback.releaseResources();
47
+ this.playback.halt();
48
+ this.collection.clear();
49
+ this.translation.clearCache();
50
+ };
49
51
  initializeWithAudios(answerAudio) {
50
- this.loader.setTranscriptsLoaded(false);
51
52
  this.collection.clear();
52
53
  this.initializeCollectionFromAudios(answerAudio);
53
54
  }
55
+ isAudioLoading(attemptNumber) {
56
+ return this.collection.get(attemptNumber)?.audioLoading || false;
57
+ }
58
+ getAllAttempts() {
59
+ return this.collection.getAll();
60
+ }
61
+ reinitializePlayer() {
62
+ this.playerModel.reinitialize();
63
+ }
64
+ cleanup() {
65
+ this.playback.releaseResources();
66
+ this.collection.clear();
67
+ this.reset();
68
+ this.dropdown.reset();
69
+ this.translation.reset();
70
+ this.playerModel.release();
71
+ }
54
72
  initializeCollectionFromAudios(audios) {
55
73
  if (!audios) {
56
74
  console.warn('VoicePlayerModel: audios is not provided');
@@ -70,149 +88,5 @@ export class VoicePlayerModel {
70
88
  });
71
89
  });
72
90
  }
73
- releaseCollectionResources() {
74
- this.collection.getAll().forEach(item => {
75
- if (item.controller) {
76
- this.downloader.abortDownload(item.controller);
77
- }
78
- if (item.audioUri?.startsWith('blob:')) {
79
- try {
80
- URL.revokeObjectURL(item.audioUri);
81
- } catch (e) {}
82
- }
83
- });
84
- }
85
- abortAllDownloads() {
86
- this.collection.getAll().forEach(item => {
87
- if (item.controller && item.audioLoading) {
88
- this.downloader.abortDownload(item.controller);
89
- this.collection.update(item.attemptNumber, {
90
- audioLoading: false,
91
- controller: undefined,
92
- audioDownloadPromise: undefined
93
- });
94
- }
95
- });
96
- }
97
- handlePlayAttempt = createEffect(async attemptNumber => {
98
- this.shouldPreventPlayback = false;
99
- const item = this.collection.get(attemptNumber);
100
- if (!item) return;
101
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
102
- this.abortAllDownloads();
103
- }
104
- if (this.collection.hasAudio(attemptNumber)) {
105
- this.playAudioFx(attemptNumber);
106
- return;
107
- }
108
- try {
109
- this.playerModel.setPlayerState(PlayerState.LOADING);
110
- const {
111
- collectionItem,
112
- downloadPromise
113
- } = await this.downloader.download({
114
- audioFileId: item.audioFileId,
115
- attemptNumber
116
- });
117
- if (this.shouldPreventPlayback) {
118
- collectionItem.controller?.abort();
119
- return;
120
- }
121
- this.collection.update(attemptNumber, collectionItem);
122
- const result = await downloadPromise;
123
- if (this.shouldPreventPlayback) {
124
- if (result.uri?.startsWith('blob:')) {
125
- URL.revokeObjectURL(result.uri);
126
- }
127
- return;
128
- }
129
- this.collection.update(attemptNumber, {
130
- audioUri: result.uri,
131
- audioLoading: false,
132
- audioError: undefined,
133
- controller: undefined,
134
- audioDownloadPromise: undefined
135
- });
136
- this.playerModel.setPlayerState(PlayerState.IDLE);
137
- this.playAudioFx(attemptNumber);
138
- } catch (error) {
139
- console.error('Audio download error:', error);
140
- if (error instanceof Error && error.name === 'AbortError') {
141
- this.playerModel.setPlayerState(PlayerState.IDLE);
142
- return;
143
- }
144
- this.collection.update(attemptNumber, {
145
- audioLoading: false,
146
- audioError: error instanceof Error ? error.message : 'Failed to download audio',
147
- controller: undefined,
148
- audioDownloadPromise: undefined
149
- });
150
- }
151
- });
152
- playAudioFx = createEffect(async attemptNumber => {
153
- if (this.shouldPreventPlayback) return;
154
- const item = this.collection.get(attemptNumber);
155
- if (!item?.audioUri) {
156
- console.warn('No audio URI available for attempt:', attemptNumber);
157
- return;
158
- }
159
- try {
160
- if (this.currentPlayingAttempt !== null && this.currentPlayingAttempt !== attemptNumber) {
161
- this.playerModel.player?.remove();
162
- }
163
- if (this.currentPlayingAttempt === attemptNumber && this.playerModel.player?.playing) {
164
- this.playerModel.pause();
165
- return;
166
- }
167
- if (this.currentPlayingAttempt === attemptNumber && !this.playerModel.player?.playing) {
168
- this.playerModel.resume();
169
- return;
170
- }
171
- this.currentPlayingAttempt = attemptNumber;
172
- this.setCurrentAttempt(attemptNumber);
173
- await this.playerModel.play(item.audioUri);
174
- } catch (error) {
175
- console.error('Error playing audio:', error);
176
- this.playerModel.setPlayerState(PlayerState.IDLE);
177
- this.collection.update(attemptNumber, {
178
- audioError: error instanceof Error ? error.message : 'Failed to play audio'
179
- });
180
- }
181
- });
182
- isAudioLoading(attemptNumber) {
183
- return this.collection.get(attemptNumber)?.audioLoading || false;
184
- }
185
- getAllAttempts() {
186
- return this.collection.getAll();
187
- }
188
- reinitializePlayer() {
189
- this.playerModel.reinitialize();
190
- }
191
- cleanup() {
192
- this.releaseCollectionResources();
193
- this.collection.clear();
194
- this.currentPlayingAttempt = null;
195
- this.reset();
196
- this.loader.reset();
197
- this.dropdown.reset();
198
- this.playerModel.release();
199
- }
200
- togglePlayPause = attach({
201
- source: this.playerModel.$playerState,
202
- mapParams: (attemptNumber, playerState) => ({
203
- attemptNumber,
204
- playerState
205
- }),
206
- effect: createEffect(({
207
- attemptNumber,
208
- playerState
209
- }) => {
210
- if (this.currentPlayingAttempt === attemptNumber && playerState === PlayerState.PLAYING) {
211
- this.pauseAudio();
212
- } else {
213
- this.handlePlayAttempt(attemptNumber);
214
- }
215
- })
216
- });
217
91
  }
218
92
  //# sourceMappingURL=VoicePlayer.model.js.map
@@ -1 +1 @@
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","abortAllDownloads","stop","resetPlayer","releaseCollectionResources","clear","constructor","params","api","loader","setApi","playbackFinished","watch","audios","initializeCollectionFromAudios","setupAudioMode","initializeWithAudios","answerAudio","setTranscriptsLoaded","console","warn","forEach","audio","index","attemptNumber","audioFileId","add","_id","hasDrawing","drawing","getAll","item","controller","abortDownload","audioUri","startsWith","URL","revokeObjectURL","e","audioLoading","update","undefined","audioDownloadPromise","handlePlayAttempt","get","hasAudio","playAudioFx","setPlayerState","LOADING","collectionItem","downloadPromise","download","abort","result","uri","audioError","IDLE","error","Error","name","message","player","remove","playing","resume","play","isAudioLoading","getAllAttempts","reinitializePlayer","reinitialize","cleanup","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,eAAe,GAAGhB,OAAO,CAAC,IAAI,CAACc,iBAAiB,EAAE,IAAI,CAAC,CAACC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EACzEE,YAAY,GAAG,IAAI,CAACN,WAAW,CAACM,YAAY;EAE5CC,UAAU,GAAG,IAAI,CAACP,WAAW,CAACQ,KAAK;EAEnCC,SAAS,GAAGA,CAAA,KAAM;IAChC,IAAI,CAACP,qB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AAcA,CAAA,EAA6B;IAChD,OAAO,IAAI,CAAC/E,UAAU,CAAC0C,MAAM,CAAC,CAAC;EACjC;EAEOsC,kBAAkBA,CAAA,EAAG;IAC1B,IAAI,CAAC7E,WAAW,CAAC8E,YAAY,CAAC,CAAC;EACjC;EAEOC,OAAOA,CAAA,EAAG;IACf,IAAI,CAAClE,0BAA0B,CAAC,CAAC;IACjC,IAAI,CAAChB,UAAU,CAACiB,KAAK,CAAC,CAAC;IACvB,IAAI,CAACb,qBAAqB,GAAG,IAAI;IACjC,IAAI,CAACG,KAAK,CAAC,CAAC;IACZ,IAAI,CAACc,MAAM,CAACd,KAAK,CAAC,CAAC;IACnB,IAAI,CAACL,QAAQ,CAACK,KAAK,CAAC,CAAC;IACrB,IAAI,CAACJ,WAAW,CAACgF,OAAO,CAAC,CAAC;EAC5B;EAEOC,eAAe,GAAG/F,MAAM,CAAC;IAC9BgG,MAAM,EAAE,IAAI,CAAClF,WAAW,CAACM,YAAY;IACrC6E,SAAS,EAAEA,CAAClD,aAAqB,EAAEmD,WAAW,MAAM;MAAEnD,aAAa;MAAEmD;IAAY,CAAC,CAAC;IACnFC,MAAM,EAAElG,YAAY,CAAC,CAAC;MAAE8C,aAAa;MAAEmD;IAAmC,CAAC,KAAK;MAC9E,IAAI,IAAI,CAACnF,qBAAqB,KAAKgC,aAAa,IAAImD,WAAW,KAAK1F,WAAW,CAAC4F,OAAO,EAAE;QACvF,IAAI,CAAC/E,UAAU,CAAC,CAAC;MACnB,CAAC,MAAM;QACL,IAAI,CAAC6C,iBAAiB,CAACnB,aAAa,CAAC;MACvC;IACF,CAAC;EACH,CAAC,CAAC;AACJ","ignoreList":[]}
1
+ {"version":3,"names":["createEvent","restore","TranscriptionsCollection","VoiceFileDownloaderModel","DropdownModel","TranslationModel","PlayerModel","TranscriptionsDownloaderModel","PlaybackController","VoicePlayerModel","collection","dropdown","playerModel","setCurrentAttempt","reset","$currentAttempt","$playerState","pauseAudio","pause","seekAudio","seek","constructor","params","api","downloader","loader","translation","playback","player","togglePlayPause","audios","initializeCollectionFromAudios","setupAudioMode","stopAudio","halt","preloadAudio","attemptNumber","target","getState","resetPlayer","releaseResources","clear","clearCache","initializeWithAudios","answerAudio","isAudioLoading","get","audioLoading","getAllAttempts","getAll","reinitializePlayer","reinitialize","cleanup","release","console","warn","forEach","audio","index","audioFileId","add","_id","hasDrawing","drawing"],"sourceRoot":"../../../../../../src","sources":["features/voice/playing/model/VoicePlayer.model.ts"],"mappings":";;AAAA,SAASA,WAAW,EAAEC,OAAO,QAAQ,UAAU;AAC/C,SAASC,wBAAwB,QAAQ,+BAA4B;AACrE,SAASC,wBAAwB,QAAQ,gCAA6B;AACtE,SAASC,aAAa,QAAQ,qBAAkB;AAChD,SAASC,gBAAgB,QAAQ,wBAAqB;AAEtD,SAASC,WAAW,QAAQ,mBAAgB;AAC5C,SAASC,6BAA6B,QAAQ,qCAAkC;AAChF,SAASC,kBAAkB,QAAQ,yBAAsB;AAOzD,OAAO,MAAMC,gBAAgB,CAAC;EACZC,UAAU,GAAG,IAAIR,wBAAwB,CAAC,CAAC;EAC3CS,QAAQ,GAAG,IAAIP,aAAa,CAAC,CAAC;EAC9BQ,WAAW,GAAG,IAAIN,WAAW,CAAC,CAAC;EAO/BO,iBAAiB,GAAGb,WAAW,CAAgB,CAAC;EAChDc,KAAK,GAAGd,WAAW,CAAC,CAAC;EAErBe,eAAe,GAAGd,OAAO,CAAC,IAAI,CAACY,iBAAiB,EAAE,IAAI,CAAC,CAACC,KAAK,CAAC,IAAI,CAACA,KAAK,CAAC;EACzEE,YAAY,GAAG,IAAI,CAACJ,WAAW,CAACI,YAAY;EAE5CC,UAAU,GAAG,IAAI,CAACL,WAAW,CAACM,KAAK;EACnCC,SAAS,GAAG,IAAI,CAACP,WAAW,CAACQ,IAAI;EAIjDC,WAAWA,CAACC,MAA8B,EAAE;IAC1C,IAAI,CAACC,GAAG,GAAGD,MAAM,CAACC,GAAG;IACrB,IAAI,CAACC,UAAU,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W;QAC9BE,GAAG,EAAEJ,KAAK,CAACI,GAAG;QACdC,UAAU,EAAE,CAAC,CAACL,KAAK,CAACM;MACtB,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"names":["RecordButtonVariant","VoiceTranscriptionVariant"],"sourceRoot":"../../../../src","sources":["features/voice/types.ts"],"mappings":";;AAqFA,WAAYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAK/B,WAAYC,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA","ignoreList":[]}
1
+ {"version":3,"names":["RecordButtonVariant","VoiceTranscriptionVariant"],"sourceRoot":"../../../../src","sources":["features/voice/types.ts"],"mappings":";;AA8FA,WAAYA,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAK/B,WAAYC,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA","ignoreList":[]}
@@ -16,4 +16,5 @@ export * from "./shared/icons/index.js";
16
16
  export * from "./features/voice/index.js";
17
17
  export * from "./features/featureUsage/index.js";
18
18
  export * from "./features/uiMode/index.js";
19
+ export * from "./features/translation/index.js";
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,8BAAqB;AACnC,cAAc,gCAAuB;AACrC,cAAc,+BAAsB;AACpC,cAAc,yBAAgB;AAC9B,cAAc,2BAAkB;AAChC,cAAc,kCAAyB;AACvC,cAAc,4BAAmB","ignoreList":[]}
1
+ {"version":3,"names":["generateRandomId"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,0BAAuB;AACxD,cAAc,6BAAoB;AAClC,cAAc,8BAAqB;AACnC,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,kCAAyB;AACvC,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,qCAA4B;AAC1C,cAAc,8BAAqB;AACnC,cAAc,gCAAuB;AACrC,cAAc,+BAAsB;AACpC,cAAc,yBAAgB;AAC9B,cAAc,2BAAkB;AAChC,cAAc,kCAAyB;AACvC,cAAc,4BAAmB;AACjC,cAAc,iCAAwB","ignoreList":[]}
@@ -0,0 +1,5 @@
1
+ export declare const GBD_TEXT_CACHE_SUFFIX = "::gbd";
2
+ export declare const DESCRIPTION_CACHE_KEY_SUFFIX = "::description";
3
+ export declare const CHOICES_CACHE_KEY_SUFFIX = "::choices";
4
+ export declare const PRACTICE_THEORY_CACHE_KEY_SUFFIX = "::practice-theory";
5
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,UAAU,CAAA;AAC5C,eAAO,MAAM,4BAA4B,kBAAkB,CAAA;AAC3D,eAAO,MAAM,wBAAwB,cAAc,CAAA;AACnD,eAAO,MAAM,gCAAgC,sBAAsB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { MaskSegmentParams } from './types';
2
+ export declare function replaceMappedTokens(input: string, map: Record<string, string>): string;
3
+ /**
4
+ * Masks text segments matched by `regex` with a placeholder,
5
+ * while preserving spaces around the original match.
6
+ */
7
+ export declare const maskSegment: ({ text, regex, placeholder, replacements, shouldSkip, }: MaskSegmentParams) => string;
8
+ export declare const decodeHtmlEntities: (text: string) => string;
9
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAE3C,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAWtF;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,4DAMrB,iBAAiB,KAAG,MAkBtB,CAAA;AAWD,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAQjD,CAAA"}
@@ -0,0 +1,12 @@
1
+ export { TranslationModel } from './model/TranslationModel';
2
+ export { TranslationService, type TranslateConfigProps } from './model/TranslationService';
3
+ export { TranslationKatexPreprocessor } from './model/TranslationPreprocessor';
4
+ export { TranslationProvider, type LanguageGlossary } from './providers/translation.interface';
5
+ export { GoogleTranslationProvider } from './providers/google/GoogleTranslationProvider';
6
+ export { GoogleTranslateLanguage } from './providers/google/supportedLanguages';
7
+ export type { GoogleTranslateProps, GoogleTranslateResponse, GoogleTranslation, } from './providers/google.types';
8
+ export { wordsToPreserve, preservedWordsReplacers } from './preserve/wordsToPreserve';
9
+ export { GBD_TEXT_CACHE_SUFFIX, DESCRIPTION_CACHE_KEY_SUFFIX, CHOICES_CACHE_KEY_SUFFIX, PRACTICE_THEORY_CACHE_KEY_SUFFIX, } from './constants';
10
+ export { replaceMappedTokens, maskSegment, decodeHtmlEntities, } from './helpers';
11
+ export type { TranslatableProblem, TranslateAllFxParams, TranslateFxParams, Replacement, MaskSegmentParams, } from './types';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/features/translation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAC3D,OAAO,EAAE,kBAAkB,EAAE,KAAK,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAC1F,OAAO,EAAE,4BAA4B,EAAE,MAAM,iCAAiC,CAAA;AAC9E,OAAO,EAAE,mBAAmB,EAAE,KAAK,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AAC9F,OAAO,EAAE,yBAAyB,EAAE,MAAM,8CAA8C,CAAA;AACxF,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAA;AAC/E,YAAY,EACV,oBAAoB,EACpB,uBAAuB,EACvB,iBAAiB,GAClB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAA;AACrF,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,wBAAwB,EACxB,gCAAgC,GACjC,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,mBAAmB,EACnB,WAAW,EACX,kBAAkB,GACnB,MAAM,WAAW,CAAA;AAClB,YAAY,EACV,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,GAClB,MAAM,SAAS,CAAA"}
@@ -0,0 +1,33 @@
1
+ import { Store, Unit } from 'effector';
2
+ import { GoogleTranslateProps, GoogleTranslateResponse } from '../providers/google.types';
3
+ import { TranslatableProblem, TranslateFxParams } from '../types';
4
+ type TranslationModelProps<TProblem extends TranslatableProblem> = {
5
+ $problem: Store<TProblem | null>;
6
+ $problemId: Store<string>;
7
+ $assignmentId: Store<string>;
8
+ $currentProblemIndex: Store<number>;
9
+ $translationLanguageCode: Store<string>;
10
+ $contentLanguageCode?: Store<string>;
11
+ $isTranslationLocked: Store<boolean>;
12
+ languageChanged: Unit<unknown>;
13
+ api: {
14
+ translateRequest: (payload: GoogleTranslateProps) => Promise<GoogleTranslateResponse>;
15
+ };
16
+ getGreatWorkFeedbackText?: () => string;
17
+ };
18
+ export declare class TranslationModel<TProblem extends TranslatableProblem = TranslatableProblem> {
19
+ private readonly service;
20
+ readonly toggle: import("effector").EventCallable<void>;
21
+ readonly setTranslated: import("effector").EventCallable<boolean>;
22
+ readonly reset: import("effector").EventCallable<void>;
23
+ readonly $isTranslationActive: import("effector").StoreWritable<boolean>;
24
+ readonly $isTranslated: import("effector").StoreWritable<boolean>;
25
+ readonly $isTranslationPending: Store<boolean>;
26
+ readonly translateFx: import("effector").Effect<TranslateFxParams, string, Error>;
27
+ readonly translateAllFx: import("effector").Effect<void, unknown[] | undefined, Error>;
28
+ constructor({ $problem, $problemId, $assignmentId, $currentProblemIndex, $translationLanguageCode, $contentLanguageCode, $isTranslationLocked, languageChanged, api, getGreatWorkFeedbackText, }: TranslationModelProps<TProblem>);
29
+ getTranslated<T extends string | string[]>(key: string): T | undefined;
30
+ clearCache(): void;
31
+ }
32
+ export {};
33
+ //# sourceMappingURL=TranslationModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationModel.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationModel.ts"],"names":[],"mappings":"AAAA,OAAO,EAQL,KAAK,EACL,IAAI,EACL,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,2BAA2B,CAAA;AAWlC,OAAO,EACL,mBAAmB,EAEnB,iBAAiB,EAClB,MAAM,UAAU,CAAA;AAEjB,KAAK,qBAAqB,CAAC,QAAQ,SAAS,mBAAmB,IAAI;IACjE,QAAQ,EAAE,KAAK,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAA;IAChC,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACzB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IAC5B,oBAAoB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACnC,wBAAwB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACvC,oBAAoB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;IACpC,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACpC,eAAe,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;IAC9B,GAAG,EAAE;QACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;KACtF,CAAA;IACD,wBAAwB,CAAC,EAAE,MAAM,MAAM,CAAA;CACxC,CAAA;AAED,qBAAa,gBAAgB,CAAC,QAAQ,SAAS,mBAAmB,GAAG,mBAAmB;IACtF,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAoB;IAE5C,SAAgB,MAAM,yCAAgB;IACtC,SAAgB,aAAa,4CAAyB;IACtD,SAAgB,KAAK,yCAAgB;IAErC,SAAgB,oBAAoB,4CAAuD;IAC3F,SAAgB,aAAa,4CAA4B;IACzD,SAAgB,qBAAqB,iBAAA;IAErC,SAAgB,WAAW,8DAAA;IAC3B,SAAgB,cAAc,gEAAA;gBAElB,EACV,QAAQ,EACR,UAAU,EACV,aAAa,EACb,oBAAoB,EACpB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,eAAe,EACf,GAAG,EACH,wBAAwB,GACzB,EAAE,qBAAqB,CAAC,QAAQ,CAAC;IA8F3B,aAAa,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAItE,UAAU;CAGlB"}
@@ -0,0 +1,34 @@
1
+ import { LanguageGlossary } from '../providers/translation.interface';
2
+ import { Replacement } from '../types';
3
+ type SetupPreservableProps = {
4
+ glossaryToPreserve: LanguageGlossary;
5
+ preserveWordsReplacers: [RegExp, string][];
6
+ };
7
+ export declare class TranslationKatexPreprocessor {
8
+ private static plaintextConverter;
9
+ static setPlaintextConverter(converter: (text: string) => string): void;
10
+ static shouldSkipTranslation(text?: string | string[]): boolean;
11
+ static isMathExpressionOnly(text: string): boolean;
12
+ static isSingleLetter(text: string): boolean;
13
+ static isMathSymbolsOnly(text: string): boolean;
14
+ private globalTargetLanguage;
15
+ private preserveWordsMap;
16
+ private preserveWordsReplacers;
17
+ private normalizePlaceholderSpacing;
18
+ sanitize(text: string): {
19
+ sanitized: string;
20
+ replacements: Replacement[];
21
+ };
22
+ restore(text: string, replacements: Replacement[]): string;
23
+ sanitizeBatch(texts: string[]): {
24
+ sanitized: string[];
25
+ replacements: Replacement[][];
26
+ };
27
+ restoreBatch(texts: string[], replacementsArray: Replacement[][]): string[];
28
+ setupPreservable({ glossaryToPreserve, preserveWordsReplacers }: SetupPreservableProps): void;
29
+ setupTarget(language: string): void;
30
+ private skipCustomReplacerSanitizeWithoutGlossary;
31
+ private applyPreserved;
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=TranslationPreprocessor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationPreprocessor.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationPreprocessor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAA;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AA2BtC,KAAK,qBAAqB,GAAG;IAC3B,kBAAkB,EAAE,gBAAgB,CAAA;IACpC,sBAAsB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;CAC3C,CAAA;AAED,qBAAa,4BAA4B;IACvC,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAA2C;WAE9D,qBAAqB,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM;WAIzD,qBAAqB,CAAC,IAAI,GAAE,MAAM,GAAG,MAAM,EAAO;WAYlD,oBAAoB,CAAC,IAAI,EAAE,MAAM;WAIjC,cAAc,CAAC,IAAI,EAAE,MAAM;WAI3B,iBAAiB,CAAC,IAAI,EAAE,MAAM;IAO5C,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,gBAAgB,CAAuB;IAC/C,OAAO,CAAC,sBAAsB,CAAyB;IAEvD,OAAO,CAAC,2BAA2B;IAM5B,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,CAAA;KAAE;IA8B1E,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,YAAY,EAAE,WAAW,EAAE;IAUjD,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG;QAAE,SAAS,EAAE,MAAM,EAAE,CAAC;QAAC,YAAY,EAAE,WAAW,EAAE,EAAE,CAAA;KAAE;IAatF,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,iBAAiB,EAAE,WAAW,EAAE,EAAE;IAYhE,gBAAgB,CAAC,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,EAAE,qBAAqB;IAKtF,WAAW,CAAC,QAAQ,EAAE,MAAM;IAInC,OAAO,CAAC,yCAAyC;IAYjD,OAAO,CAAC,cAAc;CAMvB"}
@@ -0,0 +1,40 @@
1
+ import { Store } from 'effector';
2
+ import { LanguageGlossary, TranslationProvider } from '../providers/translation.interface';
3
+ type TranslationServiceProps = {
4
+ providers: TranslationProvider[];
5
+ preserve?: {
6
+ map: LanguageGlossary;
7
+ replacers: [RegExp, string][];
8
+ };
9
+ onError?: () => void;
10
+ };
11
+ export type TranslateConfigProps = {
12
+ targetLang?: string;
13
+ sourceLang?: string;
14
+ cacheKeySuffix?: string;
15
+ cacheKey?: string;
16
+ };
17
+ export declare class TranslationService {
18
+ private readonly preprocessor;
19
+ private readonly cache;
20
+ private readonly providers;
21
+ private readonly onError;
22
+ private globalTargetLanguage;
23
+ private sourceLanguage;
24
+ private customCacheKeyFn;
25
+ constructor({ providers, preserve, onError }: TranslationServiceProps);
26
+ private getTargetLanguage;
27
+ private getProvider;
28
+ private createCacheKey;
29
+ translate: <T extends string | string[]>(text?: T, config?: TranslateConfigProps) => Promise<T>;
30
+ bindTargetLanguage<T extends string>(store: Store<T>, callback?: (value: T) => string): this;
31
+ bindSourceLanguage<T extends string>(store: Store<T>): this;
32
+ bindCustomCacheKey<T extends string>(store: Store<T>, callback: (value: T, input: {
33
+ text: string | string[];
34
+ target: string;
35
+ }) => string): this;
36
+ getCached<T extends string | string[]>(key: string): T | undefined;
37
+ reset(): void;
38
+ }
39
+ export {};
40
+ //# sourceMappingURL=TranslationService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TranslationService.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/model/TranslationService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AAEhC,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAA;AAE1F,KAAK,uBAAuB,GAAG;IAC7B,SAAS,EAAE,mBAAmB,EAAE,CAAA;IAChC,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,gBAAgB,CAAA;QACrB,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAA;KAC9B,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAqC;IAClE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAuC;IAC7D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA4B;IACtD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAA;IAExB,OAAO,CAAC,oBAAoB,CAAsB;IAClD,OAAO,CAAC,cAAc,CAAsB;IAC5C,OAAO,CAAC,gBAAgB,CAAqE;gBAEjF,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,uBAAuB;IAYrE,OAAO,CAAC,iBAAiB;IAUzB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,cAAc;IAYf,SAAS,GAAU,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,SAC7C,CAAC,WACE,oBAAoB,KAC5B,OAAO,CAAC,CAAC,CAAC,CAgCZ;IAEM,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GAC9B,IAAI;IAUA,kBAAkB,CAAC,CAAC,SAAS,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI;IAQ3D,kBAAkB,CAAC,CAAC,SAAS,MAAM,EACxC,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,GACjF,IAAI;IASA,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAIlE,KAAK;CAGb"}
@@ -0,0 +1,3 @@
1
+ export declare const wordsToPreserve: Record<string, Record<string, string>>;
2
+ export declare const preservedWordsReplacers: [RegExp, string][];
3
+ //# sourceMappingURL=wordsToPreserve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wordsToPreserve.d.ts","sourceRoot":"","sources":["../../../../../../src/features/translation/preserve/wordsToPreserve.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CA4ElE,CAAA;AAOD,eAAO,MAAM,uBAAuB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAGrD,CAAA"}
@@ -0,0 +1,17 @@
1
+ import { LanguageGlossary, TranslationProvider } from '../translation.interface';
2
+ import { GoogleTranslateProps, GoogleTranslateResponse } from '../google.types';
3
+ type GoogleTranslationProviderProps = {
4
+ api: {
5
+ translateRequest: (payload: GoogleTranslateProps) => Promise<GoogleTranslateResponse>;
6
+ };
7
+ glossaries?: LanguageGlossary;
8
+ };
9
+ export declare class GoogleTranslationProvider extends TranslationProvider {
10
+ private readonly getTranslationFx;
11
+ constructor({ api, glossaries }: GoogleTranslationProviderProps);
12
+ resolveLanguage(language: string): string | null;
13
+ request(text: string, targetLanguage: string, sourceLanguage?: string): Promise<string>;
14
+ requestBatch(text: string[], targetLanguage: string, sourceLanguage?: string): Promise<string[]>;
15
+ }
16
+ export {};
17
+ //# sourceMappingURL=GoogleTranslationProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GoogleTranslationProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/features/translation/providers/google/GoogleTranslationProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAEhF,OAAO,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAG/E,KAAK,8BAA8B,GAAG;IACpC,GAAG,EAAE;QACH,gBAAgB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,OAAO,CAAC,uBAAuB,CAAC,CAAA;KACtF,CAAA;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAA;CAC9B,CAAA;AAED,qBAAa,yBAA0B,SAAQ,mBAAmB;IAChE,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAuD;gBAE5E,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,8BAA8B;IAKxD,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;IAI1C,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;IAYrE,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,MAAM;CAY1F"}