@tscaps/engine 0.2.1 → 0.3.0
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/README.md +47 -7
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/bidi/BidiAnalyzer.d.ts +23 -0
- package/dist/modules/bidi/BidiAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiAnalyzer.js +2 -0
- package/dist/modules/bidi/BidiAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts +13 -0
- package/dist/modules/bidi/BidiCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js +2 -0
- package/dist/modules/bidi/BidiCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts +14 -0
- package/dist/modules/bidi/BidiJsAnalyzer.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js +19 -0
- package/dist/modules/bidi/BidiJsAnalyzer.js.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts +8 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.d.ts.map +1 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js +19 -0
- package/dist/modules/bidi/BidiJsCharacterClassifier.js.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts +12 -0
- package/dist/modules/bidi/CursiveScriptDetector.d.ts.map +1 -0
- package/dist/modules/bidi/CursiveScriptDetector.js +20 -0
- package/dist/modules/bidi/CursiveScriptDetector.js.map +1 -0
- package/dist/modules/bidi/HorizontalSide.d.ts +18 -0
- package/dist/modules/bidi/HorizontalSide.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSide.js +3 -0
- package/dist/modules/bidi/HorizontalSide.js.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts +21 -0
- package/dist/modules/bidi/HorizontalSideResolver.d.ts.map +1 -0
- package/dist/modules/bidi/HorizontalSideResolver.js +27 -0
- package/dist/modules/bidi/HorizontalSideResolver.js.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts +24 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js +34 -0
- package/dist/modules/bidi/StrongCharacterMajorityTextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/TextDirection.d.ts +9 -0
- package/dist/modules/bidi/TextDirection.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirection.js +2 -0
- package/dist/modules/bidi/TextDirection.js.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts +12 -0
- package/dist/modules/bidi/TextDirectionDetector.d.ts.map +1 -0
- package/dist/modules/bidi/TextDirectionDetector.js +2 -0
- package/dist/modules/bidi/TextDirectionDetector.js.map +1 -0
- package/dist/modules/bidi/WordFragment.d.ts +34 -0
- package/dist/modules/bidi/WordFragment.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragment.js +2 -0
- package/dist/modules/bidi/WordFragment.js.map +1 -0
- package/dist/modules/bidi/WordFragmenter.d.ts +43 -0
- package/dist/modules/bidi/WordFragmenter.d.ts.map +1 -0
- package/dist/modules/bidi/WordFragmenter.js +112 -0
- package/dist/modules/bidi/WordFragmenter.js.map +1 -0
- package/dist/modules/bidi/index.d.ts +14 -0
- package/dist/modules/bidi/index.d.ts.map +1 -0
- package/dist/modules/bidi/index.js +8 -0
- package/dist/modules/bidi/index.js.map +1 -0
- package/dist/modules/css/CssBlockSealer.d.ts +30 -0
- package/dist/modules/css/CssBlockSealer.d.ts.map +1 -0
- package/dist/modules/css/CssBlockSealer.js +64 -0
- package/dist/modules/css/CssBlockSealer.js.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts +13 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.d.ts.map +1 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js +24 -0
- package/dist/modules/css/CssCustomPropertyDefinitionScanner.js.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts +15 -0
- package/dist/modules/css/CssFilterReferenceScanner.d.ts.map +1 -0
- package/dist/modules/css/CssFilterReferenceScanner.js +22 -0
- package/dist/modules/css/CssFilterReferenceScanner.js.map +1 -0
- package/dist/modules/css/CssFragmentParser.d.ts +53 -0
- package/dist/modules/css/CssFragmentParser.d.ts.map +1 -0
- package/dist/modules/css/CssFragmentParser.js +127 -0
- package/dist/modules/css/CssFragmentParser.js.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts +21 -0
- package/dist/modules/css/CssKeyframeNamespacer.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframeNamespacer.js +48 -0
- package/dist/modules/css/CssKeyframeNamespacer.js.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts +29 -0
- package/dist/modules/css/CssKeyframesScanner.d.ts.map +1 -0
- package/dist/modules/css/CssKeyframesScanner.js +102 -0
- package/dist/modules/css/CssKeyframesScanner.js.map +1 -0
- package/dist/modules/css/CssLayer.d.ts +20 -0
- package/dist/modules/css/CssLayer.d.ts.map +1 -0
- package/dist/modules/css/CssLayer.js +21 -0
- package/dist/modules/css/CssLayer.js.map +1 -0
- package/dist/modules/css/CssScoper.d.ts +11 -2
- package/dist/modules/css/CssScoper.d.ts.map +1 -1
- package/dist/modules/css/CssScoper.js +53 -37
- package/dist/modules/css/CssScoper.js.map +1 -1
- package/dist/modules/css/CssSelectorClassScanner.d.ts +25 -0
- package/dist/modules/css/CssSelectorClassScanner.d.ts.map +1 -0
- package/dist/modules/css/CssSelectorClassScanner.js +91 -0
- package/dist/modules/css/CssSelectorClassScanner.js.map +1 -0
- package/dist/modules/css/CssVarReferenceScanner.d.ts +8 -5
- package/dist/modules/css/CssVarReferenceScanner.d.ts.map +1 -1
- package/dist/modules/css/CssVarReferenceScanner.js +14 -7
- package/dist/modules/css/CssVarReferenceScanner.js.map +1 -1
- package/dist/modules/css/index.d.ts +8 -0
- package/dist/modules/css/index.d.ts.map +1 -1
- package/dist/modules/css/index.js +8 -0
- package/dist/modules/css/index.js.map +1 -1
- package/dist/modules/document/CssClass.d.ts +20 -0
- package/dist/modules/document/CssClass.d.ts.map +1 -0
- package/dist/modules/document/CssClass.js +21 -0
- package/dist/modules/document/CssClass.js.map +1 -0
- package/dist/modules/document/CssVariable.d.ts +0 -6
- package/dist/modules/document/CssVariable.d.ts.map +1 -1
- package/dist/modules/document/CssVariable.js +0 -6
- package/dist/modules/document/CssVariable.js.map +1 -1
- package/dist/modules/document/DataAttribute.d.ts +26 -0
- package/dist/modules/document/DataAttribute.d.ts.map +1 -0
- package/dist/modules/document/DataAttribute.js +27 -0
- package/dist/modules/document/DataAttribute.js.map +1 -0
- package/dist/modules/document/DocumentEditor.d.ts +40 -9
- package/dist/modules/document/DocumentEditor.d.ts.map +1 -1
- package/dist/modules/document/DocumentEditor.js +69 -17
- package/dist/modules/document/DocumentEditor.js.map +1 -1
- package/dist/modules/document/DocumentNodeId.d.ts +23 -0
- package/dist/modules/document/DocumentNodeId.d.ts.map +1 -0
- package/dist/modules/document/DocumentNodeId.js +31 -0
- package/dist/modules/document/DocumentNodeId.js.map +1 -0
- package/dist/modules/document/Line.d.ts +1 -1
- package/dist/modules/document/Line.d.ts.map +1 -1
- package/dist/modules/document/Line.js +2 -1
- package/dist/modules/document/Line.js.map +1 -1
- package/dist/modules/document/Section.d.ts +1 -4
- package/dist/modules/document/Section.d.ts.map +1 -1
- package/dist/modules/document/Section.js +2 -17
- package/dist/modules/document/Section.js.map +1 -1
- package/dist/modules/document/Segment.d.ts +14 -7
- package/dist/modules/document/Segment.d.ts.map +1 -1
- package/dist/modules/document/Segment.js +26 -1
- package/dist/modules/document/Segment.js.map +1 -1
- package/dist/modules/document/Word.d.ts +1 -1
- package/dist/modules/document/Word.d.ts.map +1 -1
- package/dist/modules/document/Word.js +2 -1
- package/dist/modules/document/Word.js.map +1 -1
- package/dist/modules/document/index.d.ts +4 -2
- package/dist/modules/document/index.d.ts.map +1 -1
- package/dist/modules/document/index.js +3 -1
- package/dist/modules/document/index.js.map +1 -1
- package/dist/modules/effect/GapFreeEffect.d.ts +15 -0
- package/dist/modules/effect/GapFreeEffect.d.ts.map +1 -1
- package/dist/modules/effect/GapFreeEffect.js +29 -4
- package/dist/modules/effect/GapFreeEffect.js.map +1 -1
- package/dist/modules/pipeline/RenderPipelineBuilder.js +3 -3
- package/dist/modules/pipeline/RenderPipelineBuilder.js.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js +4 -1
- package/dist/modules/rendering/BrowserSubtitleFrameRenderer.js.map +1 -1
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts +27 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.d.ts.map +1 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js +31 -0
- package/dist/modules/rendering/HorizontalPlacementResolver.js.map +1 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts +2 -0
- package/dist/modules/rendering/SubtitleFrameRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/index.d.ts +7 -4
- package/dist/modules/rendering/index.d.ts.map +1 -1
- package/dist/modules/rendering/index.js +5 -2
- package/dist/modules/rendering/index.js.map +1 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts +19 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.d.ts.map +1 -1
- package/dist/modules/rendering/styles/BaselineCssComposer.js +32 -8
- package/dist/modules/rendering/styles/BaselineCssComposer.js.map +1 -1
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.d.ts.map +1 -1
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js +5 -4
- package/dist/modules/rendering/styles/DecorationContainerBaselineCss.js.map +1 -1
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js +28 -0
- package/dist/modules/rendering/styles/FrozenFrameCss.js.map +1 -0
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts +0 -7
- package/dist/modules/rendering/styles/InlineStyleEmitter.d.ts.map +1 -1
- package/dist/modules/rendering/styles/InlineStyleEmitter.js +0 -9
- package/dist/modules/rendering/styles/InlineStyleEmitter.js.map +1 -1
- package/dist/modules/rendering/styles/{VideoFrameLayerClass.d.ts → VideoFrameLayerBaselineCss.d.ts} +3 -10
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.d.ts.map +1 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.js +15 -0
- package/dist/modules/rendering/styles/VideoFrameLayerBaselineCss.js.map +1 -0
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts +3 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js +9 -4
- package/dist/modules/rendering/subtitle/ActiveRenderSessionFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts +23 -9
- package/dist/modules/rendering/subtitle/AnimationProbe.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/AnimationProbe.js +86 -81
- package/dist/modules/rendering/subtitle/AnimationProbe.js.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts +1 -0
- package/dist/modules/rendering/subtitle/BatchPlanner.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/BatchPlanner.js +16 -14
- package/dist/modules/rendering/subtitle/BatchPlanner.js.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts +1 -0
- package/dist/modules/rendering/subtitle/PreparedStyle.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js +1 -1
- package/dist/modules/rendering/subtitle/PreparedStyleFactory.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.js +7 -4
- package/dist/modules/rendering/subtitle/SegmentPaintRegionResolver.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts +30 -2
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js +85 -27
- package/dist/modules/rendering/subtitle/SegmentSubtreeHtmlBuilder.js.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts +3 -8
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js +31 -40
- package/dist/modules/rendering/subtitle/SegmentWrapperRenderer.js.map +1 -1
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts +2 -0
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js +18 -9
- package/dist/modules/rendering/subtitle/SpriteSheetCompositor.js.map +1 -1
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts +8 -15
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js +10 -20
- package/dist/modules/rendering/subtitle/SvgFilterMaterializer.js.map +1 -1
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.d.ts.map +1 -1
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js +12 -3
- package/dist/modules/rendering/subtitle/VideoFrameVarsBuilder.js.map +1 -1
- package/dist/modules/rendering/types/AlignmentConfig.d.ts +16 -4
- package/dist/modules/rendering/types/AlignmentConfig.d.ts.map +1 -1
- package/dist/modules/rendering/types/AlignmentConfig.js +2 -1
- package/dist/modules/rendering/types/AlignmentConfig.js.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts +8 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.d.ts.map +1 -1
- package/dist/modules/rendering/types/ElementRenderOverrides.js +28 -0
- package/dist/modules/rendering/types/ElementRenderOverrides.js.map +1 -1
- package/dist/modules/rendering/types/RenderingConfig.d.ts +7 -2
- package/dist/modules/rendering/types/RenderingConfig.d.ts.map +1 -1
- package/dist/modules/rendering/types/ScopedRenderOverride.d.ts +9 -4
- package/dist/modules/rendering/types/ScopedRenderOverride.d.ts.map +1 -1
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.d.ts +53 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js +133 -0
- package/dist/modules/subtitle-file/AssSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts +20 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js +31 -0
- package/dist/modules/subtitle-file/SbvSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js +33 -0
- package/dist/modules/subtitle-file/SrtSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts +18 -0
- package/dist/modules/subtitle-file/SubtitleCue.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCue.js +20 -0
- package/dist/modules/subtitle-file/SubtitleCue.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts +38 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js +106 -0
- package/dist/modules/subtitle-file/SubtitleCueBuilder.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts +17 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js +2 -0
- package/dist/modules/subtitle-file/SubtitleFileJob.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts +36 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js +44 -0
- package/dist/modules/subtitle-file/SubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js +2 -0
- package/dist/modules/subtitle-file/SubtitleGranularity.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts +11 -0
- package/dist/modules/subtitle-file/SubtitleRow.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleRow.js +14 -0
- package/dist/modules/subtitle-file/SubtitleRow.js.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts +13 -0
- package/dist/modules/subtitle-file/SubtitleToken.d.ts.map +1 -0
- package/dist/modules/subtitle-file/SubtitleToken.js +15 -0
- package/dist/modules/subtitle-file/SubtitleToken.js.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts +19 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js +24 -0
- package/dist/modules/subtitle-file/TextSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/Timecode.d.ts +20 -0
- package/dist/modules/subtitle-file/Timecode.d.ts.map +1 -0
- package/dist/modules/subtitle-file/Timecode.js +32 -0
- package/dist/modules/subtitle-file/Timecode.js.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts +22 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js +57 -0
- package/dist/modules/subtitle-file/TtmlSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts +21 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.d.ts.map +1 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js +39 -0
- package/dist/modules/subtitle-file/VttSubtitleFileSerializer.js.map +1 -0
- package/dist/modules/subtitle-file/index.d.ts +10 -0
- package/dist/modules/subtitle-file/index.d.ts.map +1 -0
- package/dist/modules/subtitle-file/index.js +8 -0
- package/dist/modules/subtitle-file/index.js.map +1 -0
- package/dist/modules/svg-filter/SvgFilter.d.ts +8 -1
- package/dist/modules/svg-filter/SvgFilter.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilter.js +9 -1
- package/dist/modules/svg-filter/SvgFilter.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts +1 -0
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.d.ts.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js +9 -1
- package/dist/modules/svg-filter/SvgFilterDefinitionsParser.js.map +1 -1
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts +44 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.d.ts.map +1 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js +47 -0
- package/dist/modules/svg-filter/SvgFilterDefsRenderer.js.map +1 -0
- package/dist/modules/svg-filter/index.d.ts +2 -0
- package/dist/modules/svg-filter/index.d.ts.map +1 -1
- package/dist/modules/svg-filter/index.js +1 -0
- package/dist/modules/svg-filter/index.js.map +1 -1
- package/dist/modules/tagging/PauseTagger.d.ts.map +1 -1
- package/dist/modules/tagging/PauseTagger.js +2 -1
- package/dist/modules/tagging/PauseTagger.js.map +1 -1
- package/dist/modules/tagging/RegexTagger.js +1 -1
- package/dist/modules/tagging/RegexTagger.js.map +1 -1
- package/dist/modules/tagging/SpanTagger.js +1 -1
- package/dist/modules/tagging/SpanTagger.js.map +1 -1
- package/dist/modules/tagging/StructureTagger.d.ts +0 -1
- package/dist/modules/tagging/StructureTagger.d.ts.map +1 -1
- package/dist/modules/tagging/StructureTagger.js +3 -8
- package/dist/modules/tagging/StructureTagger.js.map +1 -1
- package/dist/modules/tagging/WordlistTagger.js +1 -1
- package/dist/modules/tagging/WordlistTagger.js.map +1 -1
- package/dist/modules/tags/AndTagCondition.d.ts +10 -0
- package/dist/modules/tags/AndTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/AndTagCondition.js +14 -0
- package/dist/modules/tags/AndTagCondition.js.map +1 -0
- package/dist/modules/tags/HasTagCondition.d.ts +10 -0
- package/dist/modules/tags/HasTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/HasTagCondition.js +18 -0
- package/dist/modules/tags/HasTagCondition.js.map +1 -0
- package/dist/modules/tags/NotTagCondition.d.ts +10 -0
- package/dist/modules/tags/NotTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/NotTagCondition.js +14 -0
- package/dist/modules/tags/NotTagCondition.js.map +1 -0
- package/dist/modules/tags/OrTagCondition.d.ts +10 -0
- package/dist/modules/tags/OrTagCondition.d.ts.map +1 -0
- package/dist/modules/tags/OrTagCondition.js +14 -0
- package/dist/modules/tags/OrTagCondition.js.map +1 -0
- package/dist/modules/{document/Tag.d.ts → tags/StructureTag.d.ts} +2 -11
- package/dist/modules/tags/StructureTag.d.ts.map +1 -0
- package/dist/modules/{document/Tag.js → tags/StructureTag.js} +1 -19
- package/dist/modules/tags/StructureTag.js.map +1 -0
- package/dist/modules/tags/Tag.d.ts +8 -0
- package/dist/modules/tags/Tag.d.ts.map +1 -0
- package/dist/modules/tags/Tag.js +16 -0
- package/dist/modules/tags/Tag.js.map +1 -0
- package/dist/modules/tags/TagCondition.d.ts +12 -0
- package/dist/modules/tags/TagCondition.d.ts.map +1 -0
- package/dist/modules/tags/TagCondition.js +2 -0
- package/dist/modules/tags/TagCondition.js.map +1 -0
- package/dist/modules/tags/TagConditionParser.d.ts +21 -0
- package/dist/modules/tags/TagConditionParser.d.ts.map +1 -0
- package/dist/modules/tags/TagConditionParser.js +75 -0
- package/dist/modules/tags/TagConditionParser.js.map +1 -0
- package/dist/modules/tags/index.d.ts +9 -0
- package/dist/modules/tags/index.d.ts.map +1 -0
- package/dist/modules/tags/index.js +8 -0
- package/dist/modules/tags/index.js.map +1 -0
- package/dist/modules/transcription/AudioDecoder.d.ts +9 -4
- package/dist/modules/transcription/AudioDecoder.d.ts.map +1 -1
- package/dist/modules/transcription/BatchedMonoResampler.d.ts +45 -0
- package/dist/modules/transcription/BatchedMonoResampler.d.ts.map +1 -0
- package/dist/modules/transcription/BatchedMonoResampler.js +116 -0
- package/dist/modules/transcription/BatchedMonoResampler.js.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts +38 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js +86 -0
- package/dist/modules/transcription/CacheStorageModelFileCache.js.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts +40 -0
- package/dist/modules/transcription/CueDocumentBuilder.d.ts.map +1 -0
- package/dist/modules/transcription/CueDocumentBuilder.js +77 -0
- package/dist/modules/transcription/CueDocumentBuilder.js.map +1 -0
- package/dist/modules/transcription/CueParseResult.d.ts +16 -0
- package/dist/modules/transcription/CueParseResult.d.ts.map +1 -0
- package/dist/modules/transcription/CueParseResult.js +2 -0
- package/dist/modules/transcription/CueParseResult.js.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts +10 -0
- package/dist/modules/transcription/CueTextTokenizer.d.ts.map +1 -0
- package/dist/modules/transcription/CueTextTokenizer.js +21 -0
- package/dist/modules/transcription/CueTextTokenizer.js.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts +19 -0
- package/dist/modules/transcription/CueTimecodeReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueTimecodeReader.js +45 -0
- package/dist/modules/transcription/CueTimecodeReader.js.map +1 -0
- package/dist/modules/transcription/CueWordReader.d.ts +12 -0
- package/dist/modules/transcription/CueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/CueWordReader.js +2 -0
- package/dist/modules/transcription/CueWordReader.js.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts +16 -0
- package/dist/modules/transcription/EstimatedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js +17 -0
- package/dist/modules/transcription/EstimatedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts +43 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.d.ts.map +1 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js +72 -0
- package/dist/modules/transcription/LogitsProcessorListFactory.js.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts +27 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.d.ts.map +1 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js +76 -0
- package/dist/modules/transcription/MediaBunnyAudioDecoder.js.map +1 -0
- package/dist/modules/transcription/ModelFileCache.d.ts +20 -0
- package/dist/modules/transcription/ModelFileCache.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCache.js +2 -0
- package/dist/modules/transcription/ModelFileCache.js.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js +18 -0
- package/dist/modules/transcription/ModelFileCacheUnavailableError.js.map +1 -0
- package/dist/modules/transcription/SrtTranscriber.d.ts +24 -15
- package/dist/modules/transcription/SrtTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/SrtTranscriber.js +32 -90
- package/dist/modules/transcription/SrtTranscriber.js.map +1 -1
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.d.ts.map +1 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js +22 -0
- package/dist/modules/transcription/SubtitleFileUnreadableError.js.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts +27 -0
- package/dist/modules/transcription/TimestampedCueWordReader.d.ts.map +1 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js +52 -0
- package/dist/modules/transcription/TimestampedCueWordReader.js.map +1 -0
- package/dist/modules/transcription/Transcriber.d.ts +13 -0
- package/dist/modules/transcription/Transcriber.d.ts.map +1 -1
- package/dist/modules/transcription/TransformersRuntime.d.ts +50 -0
- package/dist/modules/transcription/TransformersRuntime.d.ts.map +1 -0
- package/dist/modules/transcription/TransformersRuntime.js +79 -0
- package/dist/modules/transcription/TransformersRuntime.js.map +1 -0
- package/dist/modules/transcription/VttTranscriber.d.ts +25 -7
- package/dist/modules/transcription/VttTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/VttTranscriber.js +36 -15
- package/dist/modules/transcription/VttTranscriber.js.map +1 -1
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts +51 -0
- package/dist/modules/transcription/WhisperChunkStitcher.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js +101 -0
- package/dist/modules/transcription/WhisperChunkStitcher.js.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js +16 -0
- package/dist/modules/transcription/WhisperDeviceUnavailableError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js +16 -0
- package/dist/modules/transcription/WhisperInferenceFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts +61 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js +102 -0
- package/dist/modules/transcription/WhisperInferenceProgressTracker.js.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts +38 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js +94 -0
- package/dist/modules/transcription/WhisperLoopAbortLogitsProcessor.js.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js +15 -0
- package/dist/modules/transcription/WhisperModelLoadFailedError.js.map +1 -0
- package/dist/modules/transcription/WhisperTranscriber.d.ts +106 -7
- package/dist/modules/transcription/WhisperTranscriber.d.ts.map +1 -1
- package/dist/modules/transcription/WhisperTranscriber.js +312 -25
- package/dist/modules/transcription/WhisperTranscriber.js.map +1 -1
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts +79 -0
- package/dist/modules/transcription/WhisperWindowCoverage.d.ts.map +1 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js +129 -0
- package/dist/modules/transcription/WhisperWindowCoverage.js.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts +14 -0
- package/dist/modules/transcription/WordTimingEstimator.d.ts.map +1 -0
- package/dist/modules/transcription/WordTimingEstimator.js +33 -0
- package/dist/modules/transcription/WordTimingEstimator.js.map +1 -0
- package/dist/modules/transcription/index.d.ts +8 -2
- package/dist/modules/transcription/index.d.ts.map +1 -1
- package/dist/modules/transcription/index.js +5 -1
- package/dist/modules/transcription/index.js.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js +8 -0
- package/dist/modules/video/mediabunny/MediaBunnyTranscodeCoordinator.js.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts +3 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.d.ts.map +1 -1
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js +33 -23
- package/dist/modules/video/mediabunny/frame/CurrentFrameVideoSource.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js +1 -1
- package/dist/modules/video/mediabunny/painter/CaptionsOverlayFramePainter.js.map +1 -1
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts +6 -7
- package/dist/modules/video/mediabunny/painter/TopLayerSource.d.ts.map +1 -1
- package/package.json +13 -10
- package/dist/modules/document/Tag.d.ts.map +0 -1
- package/dist/modules/document/Tag.js.map +0 -1
- package/dist/modules/rendering/styles/BehindActorBaselineCss.d.ts +0 -19
- package/dist/modules/rendering/styles/BehindActorBaselineCss.d.ts.map +0 -1
- package/dist/modules/rendering/styles/BehindActorBaselineCss.js +0 -19
- package/dist/modules/rendering/styles/BehindActorBaselineCss.js.map +0 -1
- package/dist/modules/rendering/styles/VideoFrameLayerClass.d.ts.map +0 -1
- package/dist/modules/rendering/styles/VideoFrameLayerClass.js +0 -21
- package/dist/modules/rendering/styles/VideoFrameLayerClass.js.map +0 -1
- package/dist/modules/rendering/types/BehindActorRequirement.d.ts +0 -12
- package/dist/modules/rendering/types/BehindActorRequirement.d.ts.map +0 -1
- package/dist/modules/rendering/types/BehindActorRequirement.js +0 -2
- package/dist/modules/rendering/types/BehindActorRequirement.js.map +0 -1
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts +0 -13
- package/dist/modules/transcription/BrowserAudioDecoder.d.ts.map +0 -1
- package/dist/modules/transcription/BrowserAudioDecoder.js +0 -34
- package/dist/modules/transcription/BrowserAudioDecoder.js.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The inference library, loaded on first use and configured once.
|
|
3
|
+
*
|
|
4
|
+
* It is reached through a dynamic import because a static one makes the
|
|
5
|
+
* whole ONNX runtime a dependency of merely *naming* a transcriber: the
|
|
6
|
+
* package's entry point re-exports this module, so a consumer that
|
|
7
|
+
* imports a document node pulls the runtime with it. In a browser that
|
|
8
|
+
* is a large bundle nobody asked for; in Node it is a native binding
|
|
9
|
+
* loaded — and on musl, failed — for code that never runs inference.
|
|
10
|
+
*
|
|
11
|
+
* The environment settings live here rather than at the call site
|
|
12
|
+
* because they have to be applied before the first pipeline is built and
|
|
13
|
+
* exactly once. Holding the module and the settings together is what
|
|
14
|
+
* makes "loaded" and "configured" the same event.
|
|
15
|
+
*
|
|
16
|
+
* A failed load is not cached: the import can fail on a dead network the
|
|
17
|
+
* same way the weights can, and a caller retrying deserves to reach the
|
|
18
|
+
* network again.
|
|
19
|
+
*/
|
|
20
|
+
export class TransformersRuntime {
|
|
21
|
+
modelFileCache;
|
|
22
|
+
modulePromise = null;
|
|
23
|
+
constructor(modelFileCache) {
|
|
24
|
+
this.modelFileCache = modelFileCache;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Resolves with the library, configured. Concurrent callers share one
|
|
28
|
+
* load, and the settings are applied before any of them sees it.
|
|
29
|
+
*/
|
|
30
|
+
load() {
|
|
31
|
+
if (this.modulePromise === null) {
|
|
32
|
+
const attempt = import('@huggingface/transformers').then((module) => {
|
|
33
|
+
this.configure(module.env);
|
|
34
|
+
return module;
|
|
35
|
+
});
|
|
36
|
+
attempt.catch(() => {
|
|
37
|
+
if (this.modulePromise === attempt)
|
|
38
|
+
this.modulePromise = null;
|
|
39
|
+
});
|
|
40
|
+
this.modulePromise = attempt;
|
|
41
|
+
}
|
|
42
|
+
return this.modulePromise;
|
|
43
|
+
}
|
|
44
|
+
configure(env) {
|
|
45
|
+
env.allowLocalModels = false;
|
|
46
|
+
this.installModelFileCache(env);
|
|
47
|
+
this.configureWasmThreading(env);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Takes over where the downloaded model files are kept.
|
|
51
|
+
*
|
|
52
|
+
* Left to itself the library picks a store from the environment and
|
|
53
|
+
* discards a refused write with nothing but a console warning, so a
|
|
54
|
+
* caller that wants to know when the files did not survive the run
|
|
55
|
+
* has to own the store. Without one, that default stands.
|
|
56
|
+
*/
|
|
57
|
+
installModelFileCache(env) {
|
|
58
|
+
if (!this.modelFileCache)
|
|
59
|
+
return;
|
|
60
|
+
env.useCustomCache = true;
|
|
61
|
+
env.customCache = this.modelFileCache;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Raises the WASM thread count above ORT's built-in ceiling when the
|
|
65
|
+
* runtime supports it. ORT locks the count to 1 without cross-origin
|
|
66
|
+
* isolation, and even with isolation its own default caps at 4 no matter
|
|
67
|
+
* the machine — Whisper's encoder scales past that. On a WebGPU run this
|
|
68
|
+
* has no effect; the WASM backend is not touched.
|
|
69
|
+
*/
|
|
70
|
+
configureWasmThreading(env) {
|
|
71
|
+
if (typeof self === 'undefined' || !self.crossOriginIsolated)
|
|
72
|
+
return;
|
|
73
|
+
const wasm = env.backends.onnx.wasm;
|
|
74
|
+
if (!wasm)
|
|
75
|
+
return;
|
|
76
|
+
wasm.numThreads = Math.min(navigator.hardwareConcurrency || 4, 8);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=TransformersRuntime.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TransformersRuntime.js","sourceRoot":"","sources":["../../../src/modules/transcription/TransformersRuntime.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,OA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,CAAC;QACpC,IAAI,CAAC,IAAI;YAAE,OAAO;QAClB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,mBAAmB,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,CAAC;CACF"}
|
|
@@ -3,24 +3,42 @@ import type { Transcriber, TranscriberOptions, TranscriberProgressEvent } from '
|
|
|
3
3
|
/**
|
|
4
4
|
* Builds a Document by parsing a WebVTT (`.vtt`) caption file. Skips
|
|
5
5
|
* the mandatory `WEBVTT` header block and any `NOTE`, `STYLE`, or
|
|
6
|
-
* `REGION` blocks, then
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `REGION` blocks, then reads the cues below them.
|
|
7
|
+
*
|
|
8
|
+
* WebVTT can mark inside a cue when each word is spoken, and those
|
|
9
|
+
* marks are honoured: a file carrying them yields the word timings it
|
|
10
|
+
* recorded rather than a guess. Where a cue carries no marks, its words
|
|
11
|
+
* are shared out across it the way a format without marks requires.
|
|
10
12
|
*
|
|
11
13
|
* The audio Blob passed to `transcribe` is ignored. Useful when
|
|
12
14
|
* caption text and timing are already known — burning a hand-authored
|
|
13
15
|
* VTT into a video, replaying captions from a subtitle-authoring
|
|
14
16
|
* tool, etc.
|
|
15
17
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
+
* A block that carries no timecode is skipped and announced through
|
|
19
|
+
* `onSkippedCueBlock`, so a single broken cue costs its own text and
|
|
20
|
+
* nothing else. Throws only when the file has blocks and none of them
|
|
21
|
+
* could be read, or when a timecode itself is malformed.
|
|
22
|
+
*
|
|
23
|
+
* Builds its own collaborators rather than receiving them. The
|
|
24
|
+
* constructor is the surface a consumer of the engine reaches for, and
|
|
25
|
+
* it asks for a source and nothing else, so this class is where the
|
|
26
|
+
* parsing side is assembled rather than a participant in someone
|
|
27
|
+
* else's assembly.
|
|
18
28
|
*/
|
|
19
29
|
export declare class VttTranscriber implements Transcriber {
|
|
20
30
|
private readonly source;
|
|
21
31
|
onProgress?: (event: TranscriberProgressEvent) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Fired once per block left out of the document, before
|
|
34
|
+
* `transcribe` resolves, carrying the block verbatim.
|
|
35
|
+
*/
|
|
36
|
+
onSkippedCueBlock?: (block: string) => void;
|
|
37
|
+
private readonly timecodeReader;
|
|
38
|
+
private readonly documentBuilder;
|
|
39
|
+
private readonly wordReader;
|
|
22
40
|
constructor(source: string);
|
|
23
|
-
transcribe(
|
|
41
|
+
transcribe(_audio: Blob, _options?: TranscriberOptions): Promise<Document>;
|
|
24
42
|
private extractCueBlocks;
|
|
25
43
|
private stripWebVttHeader;
|
|
26
44
|
private isCueBlock;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VttTranscriber.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"VttTranscriber.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAM3D,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,oCAAoC,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,cAAe,YAAW,WAAW;IAiBpC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAhBnC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,wBAAwB,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAE5C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;IAC1D,OAAO,CAAC,QAAQ,CAAC,eAAe,CAA+C;IAC/E,OAAO,CAAC,QAAQ,CAAC,UAAU,CAIzB;gBAE2B,MAAM,EAAE,MAAM;IAErC,UAAU,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAOhF,OAAO,CAAC,gBAAgB;IAQxB,OAAO,CAAC,iBAAiB;IAOzB,OAAO,CAAC,UAAU;CAOnB"}
|
|
@@ -1,38 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CueDocumentBuilder } from '../transcription/CueDocumentBuilder';
|
|
2
|
+
import { CueTextTokenizer } from '../transcription/CueTextTokenizer';
|
|
3
|
+
import { CueTimecodeReader } from '../transcription/CueTimecodeReader';
|
|
4
|
+
import { TimestampedCueWordReader } from '../transcription/TimestampedCueWordReader';
|
|
5
|
+
import { WordTimingEstimator } from '../transcription/WordTimingEstimator';
|
|
2
6
|
const BOM_RE = /^\uFEFF/;
|
|
3
7
|
/**
|
|
4
8
|
* Builds a Document by parsing a WebVTT (`.vtt`) caption file. Skips
|
|
5
9
|
* the mandatory `WEBVTT` header block and any `NOTE`, `STYLE`, or
|
|
6
|
-
* `REGION` blocks, then
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
+
* `REGION` blocks, then reads the cues below them.
|
|
11
|
+
*
|
|
12
|
+
* WebVTT can mark inside a cue when each word is spoken, and those
|
|
13
|
+
* marks are honoured: a file carrying them yields the word timings it
|
|
14
|
+
* recorded rather than a guess. Where a cue carries no marks, its words
|
|
15
|
+
* are shared out across it the way a format without marks requires.
|
|
10
16
|
*
|
|
11
17
|
* The audio Blob passed to `transcribe` is ignored. Useful when
|
|
12
18
|
* caption text and timing are already known — burning a hand-authored
|
|
13
19
|
* VTT into a video, replaying captions from a subtitle-authoring
|
|
14
20
|
* tool, etc.
|
|
15
21
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
22
|
+
* A block that carries no timecode is skipped and announced through
|
|
23
|
+
* `onSkippedCueBlock`, so a single broken cue costs its own text and
|
|
24
|
+
* nothing else. Throws only when the file has blocks and none of them
|
|
25
|
+
* could be read, or when a timecode itself is malformed.
|
|
26
|
+
*
|
|
27
|
+
* Builds its own collaborators rather than receiving them. The
|
|
28
|
+
* constructor is the surface a consumer of the engine reaches for, and
|
|
29
|
+
* it asks for a source and nothing else, so this class is where the
|
|
30
|
+
* parsing side is assembled rather than a participant in someone
|
|
31
|
+
* else's assembly.
|
|
18
32
|
*/
|
|
19
33
|
export class VttTranscriber {
|
|
20
34
|
source;
|
|
21
35
|
onProgress;
|
|
36
|
+
/**
|
|
37
|
+
* Fired once per block left out of the document, before
|
|
38
|
+
* `transcribe` resolves, carrying the block verbatim.
|
|
39
|
+
*/
|
|
40
|
+
onSkippedCueBlock;
|
|
41
|
+
timecodeReader = new CueTimecodeReader();
|
|
42
|
+
documentBuilder = new CueDocumentBuilder(this.timecodeReader);
|
|
43
|
+
wordReader = new TimestampedCueWordReader(new CueTextTokenizer(), this.timecodeReader, new WordTimingEstimator());
|
|
22
44
|
constructor(source) {
|
|
23
45
|
this.source = source;
|
|
24
46
|
}
|
|
25
|
-
async transcribe(
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return
|
|
47
|
+
async transcribe(_audio, _options) {
|
|
48
|
+
this.onProgress?.({ stage: 'inferring', progress: 1 });
|
|
49
|
+
const result = this.documentBuilder.build(this.extractCueBlocks(this.source), this.wordReader);
|
|
50
|
+
for (const block of result.skippedBlocks)
|
|
51
|
+
this.onSkippedCueBlock?.(block);
|
|
52
|
+
return result.document;
|
|
31
53
|
}
|
|
32
54
|
extractCueBlocks(source) {
|
|
33
55
|
const normalized = source.replace(BOM_RE, '').replace(/\r\n?/g, '\n');
|
|
34
|
-
|
|
35
|
-
return withoutHeader
|
|
56
|
+
return this.stripWebVttHeader(normalized)
|
|
36
57
|
.split(/\n{2,}/)
|
|
37
58
|
.filter((block) => this.isCueBlock(block))
|
|
38
59
|
.join('\n\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VttTranscriber.js","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VttTranscriber.js","sourceRoot":"","sources":["../../../src/modules/transcription/VttTranscriber.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,yCAAyC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAC7E,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAC3F,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAOjF,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,cAAc;IAiBI;IAhB7B,UAAU,CAA6C;IAEvD;;;OAGG;IACH,iBAAiB,CAA2B;IAE3B,cAAc,GAAG,IAAI,iBAAiB,EAAE,CAAC;IACzC,eAAe,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC9D,UAAU,GAAG,IAAI,wBAAwB,CACxD,IAAI,gBAAgB,EAAE,EACtB,IAAI,CAAC,cAAc,EACnB,IAAI,mBAAmB,EAAE,CAC1B,CAAC;IAEF,YAA6B,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE/C,KAAK,CAAC,UAAU,CAAC,MAAY,EAAE,QAA6B;QAC1D,IAAI,CAAC,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;QACvD,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,MAAM,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AAU,CAAC,OAAO,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC;YAAE,OAAO,KAAK,CAAC;QAC1G,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** One word-timestamped chunk as transformers.js reports it. */
|
|
2
|
+
export interface WhisperChunk {
|
|
3
|
+
text: string;
|
|
4
|
+
timestamp: [number | null, number | null];
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Reconciles the chunk streams from consecutive pipeline windows into
|
|
8
|
+
* one non-duplicated timeline.
|
|
9
|
+
*
|
|
10
|
+
* transformers.js runs Whisper's chunk-and-stitch long-form strategy:
|
|
11
|
+
* consecutive windows overlap by `2 * strideLengthSeconds`, and each
|
|
12
|
+
* window transcribes its full range independently. The library is
|
|
13
|
+
* supposed to discard the overlap zones at stitch time but its word-
|
|
14
|
+
* timestamps path leaks them through — both windows' takes on the
|
|
15
|
+
* same audio land in the final chunks. Under a degenerate loop or a
|
|
16
|
+
* token-ceiling cut, a window can also flood its overlap zone with
|
|
17
|
+
* garbage.
|
|
18
|
+
*
|
|
19
|
+
* This class re-splits the merged chunk stream back into per-window
|
|
20
|
+
* groups (detected via timestamp drops in generation order) and crops
|
|
21
|
+
* each to a single half of every overlap. The split point between two
|
|
22
|
+
* consecutive windows is the later of the overlap midpoint and the
|
|
23
|
+
* next window's own first chunk — so if the next window declared
|
|
24
|
+
* silence over part of its overlap, the previous window's take on
|
|
25
|
+
* that same audio is kept instead of dropped.
|
|
26
|
+
*/
|
|
27
|
+
export declare class WhisperChunkStitcher {
|
|
28
|
+
private readonly chunkLengthSeconds;
|
|
29
|
+
private readonly strideLengthSeconds;
|
|
30
|
+
constructor(chunkLengthSeconds: number, strideLengthSeconds: number);
|
|
31
|
+
stitch(chunks: WhisperChunk[], audioDurationSeconds: number): WhisperChunk[];
|
|
32
|
+
/**
|
|
33
|
+
* Splits the merged chunk stream into per-window groups. Windows emit
|
|
34
|
+
* in generation order and each window's own timestamps are monotonic,
|
|
35
|
+
* so a chunk whose anchor is earlier than the previous chunk's marks
|
|
36
|
+
* the start of the next window.
|
|
37
|
+
*/
|
|
38
|
+
private splitByGenerationWindow;
|
|
39
|
+
/**
|
|
40
|
+
* The split points between consecutive window groups, in absolute
|
|
41
|
+
* seconds. `boundaries[i]` is the second at which trust hands over
|
|
42
|
+
* from window `i` to window `i + 1`.
|
|
43
|
+
*/
|
|
44
|
+
private trustBoundariesBetween;
|
|
45
|
+
private leftBoundaryOf;
|
|
46
|
+
private rightBoundaryOf;
|
|
47
|
+
private cropGroup;
|
|
48
|
+
private anchorOf;
|
|
49
|
+
private firstAnchorOf;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=WhisperChunkStitcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperChunkStitcher.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperChunkStitcher.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,CAAC,MAAM,GAAG,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,oBAAoB;IAE7B,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,mBAAmB;gBADnB,kBAAkB,EAAE,MAAM,EAC1B,mBAAmB,EAAE,MAAM;IAG9C,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,EAAE,oBAAoB,EAAE,MAAM,GAAG,YAAY,EAAE;IAW5E;;;;;OAKG;IACH,OAAO,CAAC,uBAAuB;IAiB/B;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAe9B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,eAAe;IASvB,OAAO,CAAC,SAAS;IAOjB,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,aAAa;CAOtB"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reconciles the chunk streams from consecutive pipeline windows into
|
|
3
|
+
* one non-duplicated timeline.
|
|
4
|
+
*
|
|
5
|
+
* transformers.js runs Whisper's chunk-and-stitch long-form strategy:
|
|
6
|
+
* consecutive windows overlap by `2 * strideLengthSeconds`, and each
|
|
7
|
+
* window transcribes its full range independently. The library is
|
|
8
|
+
* supposed to discard the overlap zones at stitch time but its word-
|
|
9
|
+
* timestamps path leaks them through — both windows' takes on the
|
|
10
|
+
* same audio land in the final chunks. Under a degenerate loop or a
|
|
11
|
+
* token-ceiling cut, a window can also flood its overlap zone with
|
|
12
|
+
* garbage.
|
|
13
|
+
*
|
|
14
|
+
* This class re-splits the merged chunk stream back into per-window
|
|
15
|
+
* groups (detected via timestamp drops in generation order) and crops
|
|
16
|
+
* each to a single half of every overlap. The split point between two
|
|
17
|
+
* consecutive windows is the later of the overlap midpoint and the
|
|
18
|
+
* next window's own first chunk — so if the next window declared
|
|
19
|
+
* silence over part of its overlap, the previous window's take on
|
|
20
|
+
* that same audio is kept instead of dropped.
|
|
21
|
+
*/
|
|
22
|
+
export class WhisperChunkStitcher {
|
|
23
|
+
chunkLengthSeconds;
|
|
24
|
+
strideLengthSeconds;
|
|
25
|
+
constructor(chunkLengthSeconds, strideLengthSeconds) {
|
|
26
|
+
this.chunkLengthSeconds = chunkLengthSeconds;
|
|
27
|
+
this.strideLengthSeconds = strideLengthSeconds;
|
|
28
|
+
}
|
|
29
|
+
stitch(chunks, audioDurationSeconds) {
|
|
30
|
+
const groups = this.splitByGenerationWindow(chunks);
|
|
31
|
+
if (groups.length <= 1)
|
|
32
|
+
return chunks;
|
|
33
|
+
const boundaries = this.trustBoundariesBetween(groups);
|
|
34
|
+
return groups.flatMap((group, index) => this.cropGroup(group, this.leftBoundaryOf(index, boundaries), this.rightBoundaryOf(index, boundaries, groups.length, audioDurationSeconds)));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Splits the merged chunk stream into per-window groups. Windows emit
|
|
38
|
+
* in generation order and each window's own timestamps are monotonic,
|
|
39
|
+
* so a chunk whose anchor is earlier than the previous chunk's marks
|
|
40
|
+
* the start of the next window.
|
|
41
|
+
*/
|
|
42
|
+
splitByGenerationWindow(chunks) {
|
|
43
|
+
const groups = [];
|
|
44
|
+
let current = [];
|
|
45
|
+
let previousAnchor = null;
|
|
46
|
+
for (const chunk of chunks) {
|
|
47
|
+
const anchor = this.anchorOf(chunk);
|
|
48
|
+
if (anchor !== null && previousAnchor !== null && anchor < previousAnchor) {
|
|
49
|
+
groups.push(current);
|
|
50
|
+
current = [];
|
|
51
|
+
}
|
|
52
|
+
current.push(chunk);
|
|
53
|
+
if (anchor !== null)
|
|
54
|
+
previousAnchor = anchor;
|
|
55
|
+
}
|
|
56
|
+
if (current.length > 0)
|
|
57
|
+
groups.push(current);
|
|
58
|
+
return groups;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The split points between consecutive window groups, in absolute
|
|
62
|
+
* seconds. `boundaries[i]` is the second at which trust hands over
|
|
63
|
+
* from window `i` to window `i + 1`.
|
|
64
|
+
*/
|
|
65
|
+
trustBoundariesBetween(groups) {
|
|
66
|
+
const advance = this.chunkLengthSeconds - 2 * this.strideLengthSeconds;
|
|
67
|
+
const boundaries = [];
|
|
68
|
+
for (let index = 0; index < groups.length - 1; index++) {
|
|
69
|
+
const overlapMidpoint = index * advance + this.chunkLengthSeconds - this.strideLengthSeconds;
|
|
70
|
+
const nextGroupFirstAnchor = this.firstAnchorOf(groups[index + 1]);
|
|
71
|
+
boundaries.push(nextGroupFirstAnchor === null
|
|
72
|
+
? overlapMidpoint
|
|
73
|
+
: Math.max(overlapMidpoint, nextGroupFirstAnchor));
|
|
74
|
+
}
|
|
75
|
+
return boundaries;
|
|
76
|
+
}
|
|
77
|
+
leftBoundaryOf(groupIndex, boundaries) {
|
|
78
|
+
return groupIndex === 0 ? 0 : boundaries[groupIndex - 1];
|
|
79
|
+
}
|
|
80
|
+
rightBoundaryOf(groupIndex, boundaries, groupCount, audioDurationSeconds) {
|
|
81
|
+
return groupIndex === groupCount - 1 ? audioDurationSeconds : boundaries[groupIndex];
|
|
82
|
+
}
|
|
83
|
+
cropGroup(group, leftSeconds, rightSeconds) {
|
|
84
|
+
return group.filter((chunk) => {
|
|
85
|
+
const anchor = this.anchorOf(chunk);
|
|
86
|
+
return anchor !== null && anchor >= leftSeconds && anchor < rightSeconds;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
anchorOf(chunk) {
|
|
90
|
+
return chunk.timestamp[0] ?? chunk.timestamp[1];
|
|
91
|
+
}
|
|
92
|
+
firstAnchorOf(group) {
|
|
93
|
+
for (const chunk of group) {
|
|
94
|
+
const anchor = this.anchorOf(chunk);
|
|
95
|
+
if (anchor !== null)
|
|
96
|
+
return anchor;
|
|
97
|
+
}
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=WhisperChunkStitcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperChunkStitcher.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperChunkStitcher.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,oBAAoB;IAEZ;IACA;IAFnB,YACmB,kBAA0B,EAC1B,mBAA2B;QAD3B,uBAAkB,GAAlB,kBAAkB,CAAQ;QAC1B,wBAAmB,GAAnB,mBAAmB,CAAQ;IAC3C,CAAC;IAEJ,MAAM,CAAC,MAAsB,EAAE,oBAA4B;QACzD,MAAM,MAAM,GAAG,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC;QACpD,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC;YAAE,OAAO,MAAM,CAAC;QACtC,MAAM,UAAU,GAAG,IAA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AAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC;IAEO,aAAa,CAAC,KAAqB;QACzC,KAAK,MAAM,KAAK,IAAI,KAAK,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;YACpC,IAAI,MAAM,KAAK,IAAI;gBAAE,OAAO,MAAM,CAAC;QACrC,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the device the transcriber was asked to run on is not
|
|
3
|
+
* usable — either the model does not ship the artefacts needed for
|
|
4
|
+
* that device, or the browser does not expose the runtime that device
|
|
5
|
+
* relies on. Fired before any model file is fetched.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WhisperDeviceUnavailableError extends Error {
|
|
13
|
+
static readonly ERROR_NAME = "WhisperDeviceUnavailableError";
|
|
14
|
+
readonly name = "WhisperDeviceUnavailableError";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperDeviceUnavailableError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperDeviceUnavailableError.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperDeviceUnavailableError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,6BAA8B,SAAQ,KAAK;IACtD,MAAM,CAAC,QAAQ,CAAC,UAAU,mCAAmC;IAC7D,QAAQ,CAAC,IAAI,mCAA4C;CAC1D"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the device the transcriber was asked to run on is not
|
|
3
|
+
* usable — either the model does not ship the artefacts needed for
|
|
4
|
+
* that device, or the browser does not expose the runtime that device
|
|
5
|
+
* relies on. Fired before any model file is fetched.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export class WhisperDeviceUnavailableError extends Error {
|
|
13
|
+
static ERROR_NAME = 'WhisperDeviceUnavailableError';
|
|
14
|
+
name = WhisperDeviceUnavailableError.ERROR_NAME;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperDeviceUnavailableError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperDeviceUnavailableError.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperDeviceUnavailableError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,6BAA8B,SAAQ,KAAK;IACtD,MAAM,CAAU,UAAU,GAAG,+BAA+B,CAAC;IACpD,IAAI,GAAG,6BAA6B,CAAC,UAAU,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the Whisper pipeline was loaded successfully but the
|
|
3
|
+
* inference call itself rejected — the model ran out of memory, the
|
|
4
|
+
* WebGPU device was lost mid-decode, the input audio was too short,
|
|
5
|
+
* or any other runtime error surfaced while transcribing.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export declare class WhisperInferenceFailedError extends Error {
|
|
13
|
+
static readonly ERROR_NAME = "WhisperInferenceFailedError";
|
|
14
|
+
readonly name = "WhisperInferenceFailedError";
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperInferenceFailedError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperInferenceFailedError.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperInferenceFailedError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,qBAAa,2BAA4B,SAAQ,KAAK;IACpD,MAAM,CAAC,QAAQ,CAAC,UAAU,iCAAiC;IAC3D,QAAQ,CAAC,IAAI,iCAA0C;CACxD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raised when the Whisper pipeline was loaded successfully but the
|
|
3
|
+
* inference call itself rejected — the model ran out of memory, the
|
|
4
|
+
* WebGPU device was lost mid-decode, the input audio was too short,
|
|
5
|
+
* or any other runtime error surfaced while transcribing.
|
|
6
|
+
*
|
|
7
|
+
* The `.name` string is set explicitly, and exposed as `ERROR_NAME` on
|
|
8
|
+
* the class, so consumers can recognise the failure across a Worker
|
|
9
|
+
* boundary (where structured cloning preserves the string fields but
|
|
10
|
+
* not the class identity) with a single source of truth.
|
|
11
|
+
*/
|
|
12
|
+
export class WhisperInferenceFailedError extends Error {
|
|
13
|
+
static ERROR_NAME = 'WhisperInferenceFailedError';
|
|
14
|
+
name = WhisperInferenceFailedError.ERROR_NAME;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=WhisperInferenceFailedError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperInferenceFailedError.js","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperInferenceFailedError.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,MAAM,CAAU,UAAU,GAAG,6BAA6B,CAAC;IAClD,IAAI,GAAG,2BAA2B,CAAC,UAAU,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Turns Whisper's chunk-relative timestamp stream into a monotonic
|
|
3
|
+
* fraction of the inference work done so far, in
|
|
4
|
+
* `[0, MAX_STREAMING_FRACTION]`.
|
|
5
|
+
*
|
|
6
|
+
* The transformers.js pipeline slices audio into fixed windows of
|
|
7
|
+
* `chunkLengthSeconds` and slides them by `chunkLengthSeconds - 2 *
|
|
8
|
+
* strideLengthSeconds`, decoding each window independently. Whisper's
|
|
9
|
+
* predicted timestamps restart at zero on every window, so a backward
|
|
10
|
+
* step in the observed stream is treated as the boundary between two
|
|
11
|
+
* pipeline windows. Small backward jitter *within* a window (the
|
|
12
|
+
* decoder occasionally re-emits an earlier timestamp) is tolerated up
|
|
13
|
+
* to `INTRA_CHUNK_TOLERANCE_SECONDS`.
|
|
14
|
+
*
|
|
15
|
+
* Progress is measured against the audio each window decodes, not
|
|
16
|
+
* against the position reached in the source. Consecutive windows
|
|
17
|
+
* overlap by `2 * strideLengthSeconds`, and that overlap is decoded
|
|
18
|
+
* twice: a position-based fraction cannot advance until a new window
|
|
19
|
+
* has re-decoded everything the previous one already covered, which
|
|
20
|
+
* shows up as the bar sitting frozen for the first third of every
|
|
21
|
+
* window. Counting each window's own audio makes the fraction track
|
|
22
|
+
* the decoder's actual cost instead.
|
|
23
|
+
*
|
|
24
|
+
* The returned fraction never decreases and never reaches `1`:
|
|
25
|
+
* Whisper still runs a word-timestamp post-processing pass after the
|
|
26
|
+
* last streamed segment, so a strictly-below-one ceiling leaves room
|
|
27
|
+
* for the caller to emit the terminal `1` from outside the streamer
|
|
28
|
+
* once the whole call actually completes.
|
|
29
|
+
*/
|
|
30
|
+
export declare class WhisperInferenceProgressTracker {
|
|
31
|
+
private static readonly INTRA_CHUNK_TOLERANCE_SECONDS;
|
|
32
|
+
private static readonly MAX_STREAMING_FRACTION;
|
|
33
|
+
private readonly windowSeconds;
|
|
34
|
+
private readonly totalWorkSeconds;
|
|
35
|
+
private readonly windowAdvanceSeconds;
|
|
36
|
+
private currentWindowIndex;
|
|
37
|
+
private workBeforeCurrentWindow;
|
|
38
|
+
private lastReportedChunkTime;
|
|
39
|
+
private lastFraction;
|
|
40
|
+
constructor(durationSeconds: number, chunkLengthSeconds: number, strideLengthSeconds: number);
|
|
41
|
+
/** The audio each pipeline window decodes, in window order. */
|
|
42
|
+
get windowLayout(): readonly number[];
|
|
43
|
+
/** How far the pipeline slides between consecutive windows, in seconds. */
|
|
44
|
+
get advanceSeconds(): number;
|
|
45
|
+
/**
|
|
46
|
+
* Feeds a chunk-relative timestamp and returns the resulting monotonic
|
|
47
|
+
* progress fraction over the whole inference.
|
|
48
|
+
*/
|
|
49
|
+
observeChunkEnd(timeWithinChunk: number): number;
|
|
50
|
+
/**
|
|
51
|
+
* Reproduces the window layout the transformers.js ASR pipeline builds
|
|
52
|
+
* for this audio, as the amount of audio each window carries. The last
|
|
53
|
+
* window is short whenever the audio does not end on a window boundary.
|
|
54
|
+
*/
|
|
55
|
+
private measureWindows;
|
|
56
|
+
private isNewPipelineWindow;
|
|
57
|
+
private advanceWindow;
|
|
58
|
+
private currentWindowSeconds;
|
|
59
|
+
private fractionAt;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=WhisperInferenceProgressTracker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WhisperInferenceProgressTracker.d.ts","sourceRoot":"","sources":["../../../src/modules/transcription/WhisperInferenceProgressTracker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAAa,+BAA+B;IAC1C,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,6BAA6B,CAAK;IAC1D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,sBAAsB,CAAQ;IAEtD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAW;IACzC,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,oBAAoB,CAAS;IAE9C,OAAO,CAAC,kBAAkB,CAAK;IAC/B,OAAO,CAAC,uBAAuB,CAAK;IACpC,OAAO,CAAC,qBAAqB,CAAK;IAClC,OAAO,CAAC,YAAY,CAAK;gBAGvB,eAAe,EAAE,MAAM,EACvB,kBAAkB,EAAE,MAAM,EAC1B,mBAAmB,EAAE,MAAM;IAO7B,+DAA+D;IAC/D,IAAI,YAAY,IAAI,SAAS,MAAM,EAAE,CAEpC;IAED,2EAA2E;IAC3E,IAAI,cAAc,IAAI,MAAM,CAE3B;IAED;;;OAGG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM;IAShD;;;;OAIG;IACH,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,oBAAoB;IAI5B,OAAO,CAAC,UAAU;CAMnB"}
|