@automovie/viewer 0.3.4 → 0.4.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 +8 -87
- package/lib/IAutoMovieViewerCompletedFrame.d.ts +19 -11
- package/lib/IAutoMovieViewerDisplayMetadata.d.ts +0 -5
- package/lib/IAutoMovieViewerHandle.d.ts +3 -25
- package/lib/IMountViewerOptions.d.ts +24 -38
- package/lib/IViewerCameraStateSnapshot.d.ts +0 -5
- package/lib/IViewerFrameTransfer.d.ts +11 -0
- package/lib/IViewerFrameTransfer.js +3 -0
- package/lib/IViewerFrameTransfer.js.map +1 -0
- package/lib/IViewerFrameTransfer.mjs +0 -0
- package/lib/applyCaptureCanvasSize.d.ts +9 -10
- package/lib/applyCaptureCanvasSize.js +7 -13
- package/lib/applyCaptureCanvasSize.js.map +1 -1
- package/lib/applyCaptureCanvasSize.mjs +7 -10
- package/lib/applyCaptureCanvasSize.mjs.map +1 -1
- package/lib/audio/IAutoMovieAudioCue.d.ts +3 -8
- package/lib/audio/planAutoMovieAudioPlayback.d.ts +8 -21
- package/lib/audio/planAutoMovieAudioPlayback.js +8 -14
- package/lib/audio/planAutoMovieAudioPlayback.js.map +1 -1
- package/lib/audio/planAutoMovieAudioPlayback.mjs +8 -14
- package/lib/audio/planAutoMovieAudioPlayback.mjs.map +1 -1
- package/lib/audio/playAutoMovieAudioCues.d.ts +4 -11
- package/lib/audio/playAutoMovieAudioCues.js +4 -11
- package/lib/audio/playAutoMovieAudioCues.js.map +1 -1
- package/lib/audio/playAutoMovieAudioCues.mjs +4 -11
- package/lib/audio/playAutoMovieAudioCues.mjs.map +1 -1
- package/lib/createViewerCameraState.d.ts +3 -11
- package/lib/createViewerCameraState.js +80 -121
- package/lib/createViewerCameraState.js.map +1 -1
- package/lib/createViewerCameraState.mjs +46 -98
- package/lib/createViewerCameraState.mjs.map +1 -1
- package/lib/createViewerDisplayClock.d.ts +2 -10
- package/lib/createViewerDisplayClock.js +4 -12
- package/lib/createViewerDisplayClock.js.map +1 -1
- package/lib/createViewerDisplayClock.mjs +3 -11
- package/lib/createViewerDisplayClock.mjs.map +1 -1
- package/lib/createViewerDisplayPublication.d.ts +7 -15
- package/lib/createViewerDisplayPublication.js +7 -15
- package/lib/createViewerDisplayPublication.js.map +1 -1
- package/lib/createViewerDisplayPublication.mjs +7 -15
- package/lib/createViewerDisplayPublication.mjs.map +1 -1
- package/lib/createViewerDisplaySave.d.ts +8 -16
- package/lib/createViewerDisplaySave.js +8 -16
- package/lib/createViewerDisplaySave.js.map +1 -1
- package/lib/createViewerDisplaySave.mjs +8 -16
- package/lib/createViewerDisplaySave.mjs.map +1 -1
- package/lib/createViewerFrameControl.d.ts +8 -10
- package/lib/createViewerFrameControl.js +3 -15
- package/lib/createViewerFrameControl.js.map +1 -1
- package/lib/createViewerFrameControl.mjs +3 -12
- package/lib/createViewerFrameControl.mjs.map +1 -1
- package/lib/createViewerViewportResize.d.ts +4 -12
- package/lib/createViewerViewportResize.js +7 -20
- package/lib/createViewerViewportResize.js.map +1 -1
- package/lib/createViewerViewportResize.mjs +6 -14
- package/lib/createViewerViewportResize.mjs.map +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +6 -1
- package/lib/inspector/AutoMovieInspector.d.ts +33 -13
- package/lib/inspector/AutoMovieInspector.js +110 -19
- package/lib/inspector/AutoMovieInspector.js.map +1 -1
- package/lib/inspector/AutoMovieInspector.mjs +121 -18
- package/lib/inspector/AutoMovieInspector.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorBeauty.d.ts +41 -0
- package/lib/inspector/AutoMovieInspectorBeauty.js +56 -0
- package/lib/inspector/AutoMovieInspectorBeauty.js.map +1 -0
- package/lib/inspector/AutoMovieInspectorBeauty.mjs +55 -0
- package/lib/inspector/AutoMovieInspectorBeauty.mjs.map +1 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticLog.d.ts +48 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticLog.js +186 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticLog.js.map +1 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticLog.mjs +171 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticLog.mjs.map +1 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticsPanel.d.ts +23 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticsPanel.js +37 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticsPanel.js.map +1 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticsPanel.mjs +85 -0
- package/lib/inspector/AutoMovieInspectorDiagnosticsPanel.mjs.map +1 -0
- package/lib/inspector/AutoMovieInspectorMarksPanel.d.ts +4 -10
- package/lib/inspector/AutoMovieInspectorMarksPanel.js +18 -35
- package/lib/inspector/AutoMovieInspectorMarksPanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorMarksPanel.mjs +32 -38
- package/lib/inspector/AutoMovieInspectorMarksPanel.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorPlayhead.d.ts +35 -96
- package/lib/inspector/AutoMovieInspectorPlayhead.js +41 -101
- package/lib/inspector/AutoMovieInspectorPlayhead.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorPlayhead.mjs +44 -98
- package/lib/inspector/AutoMovieInspectorPlayhead.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorRequestPanel.d.ts +9 -10
- package/lib/inspector/AutoMovieInspectorRequestPanel.js +18 -12
- package/lib/inspector/AutoMovieInspectorRequestPanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorRequestPanel.mjs +32 -14
- package/lib/inspector/AutoMovieInspectorRequestPanel.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorSelectionPanel.d.ts +0 -8
- package/lib/inspector/AutoMovieInspectorSelectionPanel.js +0 -8
- package/lib/inspector/AutoMovieInspectorSelectionPanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorSelectionPanel.mjs +0 -8
- package/lib/inspector/AutoMovieInspectorSelectionPanel.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorShadePanel.d.ts +2 -9
- package/lib/inspector/AutoMovieInspectorShadePanel.js +18 -25
- package/lib/inspector/AutoMovieInspectorShadePanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorShadePanel.mjs +18 -27
- package/lib/inspector/AutoMovieInspectorShadePanel.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorTimePanel.d.ts +0 -8
- package/lib/inspector/AutoMovieInspectorTimePanel.js +0 -8
- package/lib/inspector/AutoMovieInspectorTimePanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorTimePanel.mjs +0 -8
- package/lib/inspector/AutoMovieInspectorTimePanel.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorTimeReadout.d.ts +0 -8
- package/lib/inspector/AutoMovieInspectorTimeReadout.js +4 -10
- package/lib/inspector/AutoMovieInspectorTimeReadout.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorTimeReadout.mjs +3 -12
- package/lib/inspector/AutoMovieInspectorTimeReadout.mjs.map +1 -1
- package/lib/inspector/AutoMovieInspectorTransition.d.ts +79 -0
- package/lib/inspector/AutoMovieInspectorTransition.js +131 -0
- package/lib/inspector/AutoMovieInspectorTransition.js.map +1 -0
- package/lib/inspector/AutoMovieInspectorTransition.mjs +119 -0
- package/lib/inspector/AutoMovieInspectorTransition.mjs.map +1 -0
- package/lib/inspector/AutoMovieInspectorViewPanel.d.ts +0 -8
- package/lib/inspector/AutoMovieInspectorViewPanel.js +0 -8
- package/lib/inspector/AutoMovieInspectorViewPanel.js.map +1 -1
- package/lib/inspector/AutoMovieInspectorViewPanel.mjs +0 -8
- package/lib/inspector/AutoMovieInspectorViewPanel.mjs.map +1 -1
- package/lib/inspector/IAutoMovieInspectorAction.d.ts +54 -95
- package/lib/inspector/IAutoMovieInspectorLive.d.ts +43 -0
- package/lib/inspector/IAutoMovieInspectorLive.js +3 -0
- package/lib/inspector/IAutoMovieInspectorLive.js.map +1 -0
- package/lib/inspector/IAutoMovieInspectorLive.mjs +0 -0
- package/lib/inspector/IAutoMovieInspectorPathNode.d.ts +14 -9
- package/lib/inspector/IAutoMovieInspectorProps.d.ts +3 -14
- package/lib/inspector/IAutoMovieInspectorScene.d.ts +96 -100
- package/lib/inspector/IAutoMovieInspectorSceneHost.d.ts +37 -102
- package/lib/inspector/IAutoMovieInspectorState.d.ts +6 -7
- package/lib/inspector/assertAutoMovieInspectorRaster.d.ts +7 -0
- package/lib/inspector/assertAutoMovieInspectorRaster.js +19 -0
- package/lib/inspector/assertAutoMovieInspectorRaster.js.map +1 -0
- package/lib/inspector/assertAutoMovieInspectorRaster.mjs +17 -0
- package/lib/inspector/assertAutoMovieInspectorRaster.mjs.map +1 -0
- package/lib/inspector/buildAutoMovieInspectorPathTree.d.ts +9 -10
- package/lib/inspector/buildAutoMovieInspectorPathTree.js +9 -10
- package/lib/inspector/buildAutoMovieInspectorPathTree.js.map +1 -1
- package/lib/inspector/buildAutoMovieInspectorPathTree.mjs +9 -10
- package/lib/inspector/buildAutoMovieInspectorPathTree.mjs.map +1 -1
- package/lib/inspector/changesAutoMovieObservedScene.d.ts +16 -0
- package/lib/inspector/changesAutoMovieObservedScene.js +28 -0
- package/lib/inspector/changesAutoMovieObservedScene.js.map +1 -0
- package/lib/inspector/changesAutoMovieObservedScene.mjs +21 -0
- package/lib/inspector/changesAutoMovieObservedScene.mjs.map +1 -0
- package/lib/inspector/createAutoMovieInspectorAddressWriter.d.ts +13 -11
- package/lib/inspector/createAutoMovieInspectorAddressWriter.js +13 -11
- package/lib/inspector/createAutoMovieInspectorAddressWriter.js.map +1 -1
- package/lib/inspector/createAutoMovieInspectorAddressWriter.mjs +13 -11
- package/lib/inspector/createAutoMovieInspectorAddressWriter.mjs.map +1 -1
- package/lib/inspector/createAutoMovieInspectorCanvasHost.d.ts +7 -10
- package/lib/inspector/createAutoMovieInspectorCanvasHost.js +14 -11
- package/lib/inspector/createAutoMovieInspectorCanvasHost.js.map +1 -1
- package/lib/inspector/createAutoMovieInspectorCanvasHost.mjs +17 -14
- package/lib/inspector/createAutoMovieInspectorCanvasHost.mjs.map +1 -1
- package/lib/inspector/createAutoMovieInspectorState.d.ts +3 -9
- package/lib/inspector/createAutoMovieInspectorState.js +3 -9
- package/lib/inspector/createAutoMovieInspectorState.js.map +1 -1
- package/lib/inspector/createAutoMovieInspectorState.mjs +3 -9
- package/lib/inspector/createAutoMovieInspectorState.mjs.map +1 -1
- package/lib/inspector/firstAutoMovieInspectorSecond.d.ts +6 -0
- package/lib/inspector/firstAutoMovieInspectorSecond.js +13 -0
- package/lib/inspector/firstAutoMovieInspectorSecond.js.map +1 -0
- package/lib/inspector/firstAutoMovieInspectorSecond.mjs +11 -0
- package/lib/inspector/firstAutoMovieInspectorSecond.mjs.map +1 -0
- package/lib/inspector/followAutoMovieInspectorSize.d.ts +11 -0
- package/lib/inspector/followAutoMovieInspectorSize.js +26 -0
- package/lib/inspector/followAutoMovieInspectorSize.js.map +1 -0
- package/lib/inspector/followAutoMovieInspectorSize.mjs +26 -0
- package/lib/inspector/followAutoMovieInspectorSize.mjs.map +1 -0
- package/lib/inspector/formatAutoMovieInspectorAddress.d.ts +11 -10
- package/lib/inspector/formatAutoMovieInspectorAddress.js +15 -11
- package/lib/inspector/formatAutoMovieInspectorAddress.js.map +1 -1
- package/lib/inspector/formatAutoMovieInspectorAddress.mjs +15 -11
- package/lib/inspector/formatAutoMovieInspectorAddress.mjs.map +1 -1
- package/lib/inspector/formatAutoMovieInspectorCommand.d.ts +20 -14
- package/lib/inspector/formatAutoMovieInspectorCommand.js +33 -14
- package/lib/inspector/formatAutoMovieInspectorCommand.js.map +1 -1
- package/lib/inspector/formatAutoMovieInspectorCommand.mjs +26 -15
- package/lib/inspector/formatAutoMovieInspectorCommand.mjs.map +1 -1
- package/lib/inspector/handleAutoMovieInspectorKey.d.ts +24 -15
- package/lib/inspector/handleAutoMovieInspectorKey.js +27 -16
- package/lib/inspector/handleAutoMovieInspectorKey.js.map +1 -1
- package/lib/inspector/handleAutoMovieInspectorKey.mjs +27 -16
- package/lib/inspector/handleAutoMovieInspectorKey.mjs.map +1 -1
- package/lib/inspector/index.d.ts +5 -0
- package/lib/inspector/index.js +5 -0
- package/lib/inspector/index.js.map +1 -1
- package/lib/inspector/index.mjs +6 -1
- package/lib/inspector/inspectAutoMovieInspectorRequest.d.ts +19 -0
- package/lib/inspector/inspectAutoMovieInspectorRequest.js +20 -0
- package/lib/inspector/inspectAutoMovieInspectorRequest.js.map +1 -0
- package/lib/inspector/inspectAutoMovieInspectorRequest.mjs +20 -0
- package/lib/inspector/inspectAutoMovieInspectorRequest.mjs.map +1 -0
- package/lib/inspector/installAutoMovieInspectorRequest.d.ts +20 -0
- package/lib/inspector/installAutoMovieInspectorRequest.js +36 -0
- package/lib/inspector/installAutoMovieInspectorRequest.js.map +1 -0
- package/lib/inspector/installAutoMovieInspectorRequest.mjs +35 -0
- package/lib/inspector/installAutoMovieInspectorRequest.mjs.map +1 -0
- package/lib/inspector/locateAutoMovieInspectorFinding.d.ts +19 -0
- package/lib/inspector/locateAutoMovieInspectorFinding.js +34 -0
- package/lib/inspector/locateAutoMovieInspectorFinding.js.map +1 -0
- package/lib/inspector/locateAutoMovieInspectorFinding.mjs +37 -0
- package/lib/inspector/locateAutoMovieInspectorFinding.mjs.map +1 -0
- package/lib/inspector/messageOfAutoMovieInspectorError.d.ts +2 -0
- package/lib/inspector/messageOfAutoMovieInspectorError.js +8 -0
- package/lib/inspector/messageOfAutoMovieInspectorError.js.map +1 -0
- package/lib/inspector/messageOfAutoMovieInspectorError.mjs +8 -0
- package/lib/inspector/messageOfAutoMovieInspectorError.mjs.map +1 -0
- package/lib/inspector/mountAutoMovieInspectorPage.d.ts +5 -8
- package/lib/inspector/mountAutoMovieInspectorPage.js +3 -9
- package/lib/inspector/mountAutoMovieInspectorPage.js.map +1 -1
- package/lib/inspector/mountAutoMovieInspectorPage.mjs +4 -9
- package/lib/inspector/mountAutoMovieInspectorPage.mjs.map +1 -1
- package/lib/inspector/mountAutoMovieInspectorScene.d.ts +55 -12
- package/lib/inspector/mountAutoMovieInspectorScene.js +238 -164
- package/lib/inspector/mountAutoMovieInspectorScene.js.map +1 -1
- package/lib/inspector/mountAutoMovieInspectorScene.mjs +223 -149
- package/lib/inspector/mountAutoMovieInspectorScene.mjs.map +1 -1
- package/lib/inspector/placeAutoMovieInspectorLabels.d.ts +29 -0
- package/lib/inspector/placeAutoMovieInspectorLabels.js +33 -0
- package/lib/inspector/placeAutoMovieInspectorLabels.js.map +1 -0
- package/lib/inspector/placeAutoMovieInspectorLabels.mjs +32 -0
- package/lib/inspector/placeAutoMovieInspectorLabels.mjs.map +1 -0
- package/lib/inspector/readAutoMovieInspectorAddress.d.ts +8 -11
- package/lib/inspector/readAutoMovieInspectorAddress.js +8 -11
- package/lib/inspector/readAutoMovieInspectorAddress.js.map +1 -1
- package/lib/inspector/readAutoMovieInspectorAddress.mjs +8 -11
- package/lib/inspector/readAutoMovieInspectorAddress.mjs.map +1 -1
- package/lib/inspector/readAutoMovieInspectorFacts.d.ts +17 -0
- package/lib/inspector/readAutoMovieInspectorFacts.js +34 -0
- package/lib/inspector/readAutoMovieInspectorFacts.js.map +1 -0
- package/lib/inspector/readAutoMovieInspectorFacts.mjs +28 -0
- package/lib/inspector/readAutoMovieInspectorFacts.mjs.map +1 -0
- package/lib/inspector/readsAutoMovieInspectorPlacedScene.d.ts +9 -0
- package/lib/inspector/readsAutoMovieInspectorPlacedScene.js +14 -0
- package/lib/inspector/readsAutoMovieInspectorPlacedScene.js.map +1 -0
- package/lib/inspector/readsAutoMovieInspectorPlacedScene.mjs +14 -0
- package/lib/inspector/readsAutoMovieInspectorPlacedScene.mjs.map +1 -0
- package/lib/inspector/reduceAutoMovieInspectorState.d.ts +10 -10
- package/lib/inspector/reduceAutoMovieInspectorState.js +17 -11
- package/lib/inspector/reduceAutoMovieInspectorState.js.map +1 -1
- package/lib/inspector/reduceAutoMovieInspectorState.mjs +16 -11
- package/lib/inspector/reduceAutoMovieInspectorState.mjs.map +1 -1
- package/lib/inspector/releaseAutoMovieInspectorSteps.d.ts +6 -0
- package/lib/inspector/releaseAutoMovieInspectorSteps.js +23 -0
- package/lib/inspector/releaseAutoMovieInspectorSteps.js.map +1 -0
- package/lib/inspector/releaseAutoMovieInspectorSteps.mjs +19 -0
- package/lib/inspector/releaseAutoMovieInspectorSteps.mjs.map +1 -0
- package/lib/inspector/reportAutoMovieInspectorLabels.d.ts +21 -0
- package/lib/inspector/reportAutoMovieInspectorLabels.js +27 -0
- package/lib/inspector/reportAutoMovieInspectorLabels.js.map +1 -0
- package/lib/inspector/reportAutoMovieInspectorLabels.mjs +30 -0
- package/lib/inspector/reportAutoMovieInspectorLabels.mjs.map +1 -0
- package/lib/inspector/resolveAutoMovieInspectorCamera.d.ts +22 -0
- package/lib/inspector/resolveAutoMovieInspectorCamera.js +34 -0
- package/lib/inspector/resolveAutoMovieInspectorCamera.js.map +1 -0
- package/lib/inspector/resolveAutoMovieInspectorCamera.mjs +34 -0
- package/lib/inspector/resolveAutoMovieInspectorCamera.mjs.map +1 -0
- package/lib/inspector/showAutoMovieInspectorFinding.d.ts +25 -0
- package/lib/inspector/showAutoMovieInspectorFinding.js +26 -0
- package/lib/inspector/showAutoMovieInspectorFinding.js.map +1 -0
- package/lib/inspector/showAutoMovieInspectorFinding.mjs +26 -0
- package/lib/inspector/showAutoMovieInspectorFinding.mjs.map +1 -0
- package/lib/inspector/stopAutoMovieInspectorTime.d.ts +11 -0
- package/lib/inspector/stopAutoMovieInspectorTime.js +17 -0
- package/lib/inspector/stopAutoMovieInspectorTime.js.map +1 -0
- package/lib/inspector/stopAutoMovieInspectorTime.mjs +18 -0
- package/lib/inspector/stopAutoMovieInspectorTime.mjs.map +1 -0
- package/lib/inspector/writeAutoMovieInspectorInspection.d.ts +6 -0
- package/lib/inspector/writeAutoMovieInspectorInspection.js +12 -0
- package/lib/inspector/writeAutoMovieInspectorInspection.js.map +1 -0
- package/lib/inspector/writeAutoMovieInspectorInspection.mjs +12 -0
- package/lib/inspector/writeAutoMovieInspectorInspection.mjs.map +1 -0
- package/lib/internal.d.ts +7 -0
- package/lib/internal.js +25 -0
- package/lib/internal.js.map +1 -0
- package/lib/internal.mjs +8 -0
- package/lib/mountViewer.d.ts +16 -10
- package/lib/mountViewer.js +17 -14
- package/lib/mountViewer.js.map +1 -1
- package/lib/mountViewer.mjs +18 -12
- package/lib/mountViewer.mjs.map +1 -1
- package/lib/publishViewerCompletedFrame.d.ts +12 -10
- package/lib/publishViewerCompletedFrame.js +11 -9
- package/lib/publishViewerCompletedFrame.js.map +1 -1
- package/lib/publishViewerCompletedFrame.mjs +11 -9
- package/lib/publishViewerCompletedFrame.mjs.map +1 -1
- package/lib/redrawViewerCompletedFrame.d.ts +2 -10
- package/lib/redrawViewerCompletedFrame.js +4 -12
- package/lib/redrawViewerCompletedFrame.js.map +1 -1
- package/lib/redrawViewerCompletedFrame.mjs +3 -11
- package/lib/redrawViewerCompletedFrame.mjs.map +1 -1
- package/lib/releaseMountedViewer.d.ts +5 -9
- package/lib/releaseMountedViewer.js +5 -9
- package/lib/releaseMountedViewer.js.map +1 -1
- package/lib/releaseMountedViewer.mjs +5 -9
- package/lib/releaseMountedViewer.mjs.map +1 -1
- package/lib/transport/AutoMovieViewerTransport.d.ts +13 -122
- package/lib/transport/AutoMovieViewerTransport.js +10 -74
- package/lib/transport/AutoMovieViewerTransport.js.map +1 -1
- package/lib/transport/AutoMovieViewerTransport.mjs +10 -65
- package/lib/transport/AutoMovieViewerTransport.mjs.map +1 -1
- package/lib/transport/readAutoMovieReviewInterval.d.ts +3 -10
- package/lib/transport/readAutoMovieReviewInterval.js +11 -16
- package/lib/transport/readAutoMovieReviewInterval.js.map +1 -1
- package/lib/transport/readAutoMovieReviewInterval.mjs +8 -14
- package/lib/transport/readAutoMovieReviewInterval.mjs.map +1 -1
- package/package.json +12 -8
- package/src/IAutoMovieViewerCompletedFrame.ts +21 -11
- package/src/IAutoMovieViewerDisplayMetadata.ts +0 -5
- package/src/IAutoMovieViewerHandle.ts +3 -25
- package/src/IMountViewerOptions.ts +24 -38
- package/src/IViewerCameraStateSnapshot.ts +0 -5
- package/src/IViewerFrameTransfer.ts +13 -0
- package/src/applyCaptureCanvasSize.ts +9 -18
- package/src/audio/IAutoMovieAudioCue.ts +3 -8
- package/src/audio/planAutoMovieAudioPlayback.ts +9 -23
- package/src/audio/playAutoMovieAudioCues.ts +4 -11
- package/src/createViewerCameraState.ts +119 -175
- package/src/createViewerDisplayClock.ts +4 -12
- package/src/createViewerDisplayPublication.ts +7 -15
- package/src/createViewerDisplaySave.ts +8 -16
- package/src/createViewerFrameControl.ts +16 -24
- package/src/createViewerViewportResize.ts +7 -23
- package/src/index.ts +1 -0
- package/src/inspector/AutoMovieInspector.tsx +183 -20
- package/src/inspector/AutoMovieInspectorBeauty.ts +89 -0
- package/src/inspector/AutoMovieInspectorDiagnosticLog.ts +235 -0
- package/src/inspector/AutoMovieInspectorDiagnosticsPanel.tsx +118 -0
- package/src/inspector/AutoMovieInspectorMarksPanel.tsx +26 -34
- package/src/inspector/AutoMovieInspectorPlayhead.ts +53 -110
- package/src/inspector/AutoMovieInspectorRequestPanel.tsx +57 -29
- package/src/inspector/AutoMovieInspectorSelectionPanel.tsx +0 -8
- package/src/inspector/AutoMovieInspectorShadePanel.tsx +24 -29
- package/src/inspector/AutoMovieInspectorTimePanel.tsx +0 -8
- package/src/inspector/AutoMovieInspectorTimeReadout.tsx +4 -10
- package/src/inspector/AutoMovieInspectorTransition.ts +178 -0
- package/src/inspector/AutoMovieInspectorViewPanel.tsx +0 -8
- package/src/inspector/IAutoMovieInspectorAction.ts +57 -94
- package/src/inspector/IAutoMovieInspectorLive.ts +62 -0
- package/src/inspector/IAutoMovieInspectorPathNode.ts +14 -9
- package/src/inspector/IAutoMovieInspectorProps.ts +4 -14
- package/src/inspector/IAutoMovieInspectorScene.ts +104 -99
- package/src/inspector/IAutoMovieInspectorSceneHost.ts +43 -102
- package/src/inspector/IAutoMovieInspectorState.ts +6 -7
- package/src/inspector/assertAutoMovieInspectorRaster.ts +23 -0
- package/src/inspector/buildAutoMovieInspectorPathTree.ts +9 -10
- package/src/inspector/changesAutoMovieObservedScene.ts +30 -0
- package/src/inspector/createAutoMovieInspectorAddressWriter.ts +13 -11
- package/src/inspector/createAutoMovieInspectorCanvasHost.ts +14 -12
- package/src/inspector/createAutoMovieInspectorState.ts +3 -9
- package/src/inspector/firstAutoMovieInspectorSecond.ts +13 -0
- package/src/inspector/followAutoMovieInspectorSize.ts +32 -0
- package/src/inspector/formatAutoMovieInspectorAddress.ts +15 -11
- package/src/inspector/formatAutoMovieInspectorCommand.ts +44 -15
- package/src/inspector/handleAutoMovieInspectorKey.ts +27 -16
- package/src/inspector/index.ts +5 -0
- package/src/inspector/inspectAutoMovieInspectorRequest.ts +37 -0
- package/src/inspector/installAutoMovieInspectorRequest.ts +50 -0
- package/src/inspector/locateAutoMovieInspectorFinding.ts +40 -0
- package/src/inspector/messageOfAutoMovieInspectorError.ts +4 -0
- package/src/inspector/mountAutoMovieInspectorPage.tsx +7 -8
- package/src/inspector/mountAutoMovieInspectorScene.ts +290 -232
- package/src/inspector/placeAutoMovieInspectorLabels.ts +53 -0
- package/src/inspector/readAutoMovieInspectorAddress.ts +8 -11
- package/src/inspector/readAutoMovieInspectorFacts.ts +50 -0
- package/src/inspector/readsAutoMovieInspectorPlacedScene.ts +16 -0
- package/src/inspector/reduceAutoMovieInspectorState.ts +17 -11
- package/src/inspector/releaseAutoMovieInspectorSteps.ts +19 -0
- package/src/inspector/reportAutoMovieInspectorLabels.ts +45 -0
- package/src/inspector/resolveAutoMovieInspectorCamera.ts +50 -0
- package/src/inspector/showAutoMovieInspectorFinding.ts +40 -0
- package/src/inspector/stopAutoMovieInspectorTime.ts +19 -0
- package/src/inspector/writeAutoMovieInspectorInspection.ts +12 -0
- package/src/internal.ts +9 -0
- package/src/mountViewer.ts +17 -14
- package/src/publishViewerCompletedFrame.ts +14 -10
- package/src/redrawViewerCompletedFrame.ts +3 -12
- package/src/releaseMountedViewer.ts +5 -9
- package/src/transport/AutoMovieViewerTransport.ts +17 -144
- package/src/transport/readAutoMovieReviewInterval.ts +15 -16
|
@@ -1,50 +1,107 @@
|
|
|
1
|
+
import { AutoMovieInspectorBeauty } from "./AutoMovieInspectorBeauty.mjs";
|
|
2
|
+
import { AutoMovieInspectorDiagnosticLog } from "./AutoMovieInspectorDiagnosticLog.mjs";
|
|
3
|
+
import { AutoMovieInspectorTransition } from "./AutoMovieInspectorTransition.mjs";
|
|
4
|
+
import { assertAutoMovieInspectorRaster } from "./assertAutoMovieInspectorRaster.mjs";
|
|
5
|
+
import { changesAutoMovieObservedScene } from "./changesAutoMovieObservedScene.mjs";
|
|
6
|
+
import { firstAutoMovieInspectorSecond } from "./firstAutoMovieInspectorSecond.mjs";
|
|
7
|
+
import { followAutoMovieInspectorSize } from "./followAutoMovieInspectorSize.mjs";
|
|
8
|
+
import { inspectAutoMovieInspectorRequest } from "./inspectAutoMovieInspectorRequest.mjs";
|
|
9
|
+
import { installAutoMovieInspectorRequest } from "./installAutoMovieInspectorRequest.mjs";
|
|
10
|
+
import { messageOfAutoMovieInspectorError } from "./messageOfAutoMovieInspectorError.mjs";
|
|
1
11
|
import { readAutoMovieInspectorAddress } from "./readAutoMovieInspectorAddress.mjs";
|
|
2
|
-
import {
|
|
12
|
+
import { readAutoMovieInspectorFacts } from "./readAutoMovieInspectorFacts.mjs";
|
|
13
|
+
import { readsAutoMovieInspectorPlacedScene } from "./readsAutoMovieInspectorPlacedScene.mjs";
|
|
14
|
+
import { releaseAutoMovieInspectorSteps } from "./releaseAutoMovieInspectorSteps.mjs";
|
|
15
|
+
import { reportAutoMovieInspectorLabels } from "./reportAutoMovieInspectorLabels.mjs";
|
|
16
|
+
import { resolveAutoMovieInspectorCamera } from "./resolveAutoMovieInspectorCamera.mjs";
|
|
17
|
+
import { writeAutoMovieInspectorInspection } from "./writeAutoMovieInspectorInspection.mjs";
|
|
18
|
+
import { createAutoMovieInspectionDiagnosticOverlay, observeAutoMoviePlacedInspection } from "@automovie/render";
|
|
3
19
|
// src/inspector/mountAutoMovieInspectorScene.ts
|
|
4
20
|
/**
|
|
5
|
-
* Mount a subject on the inspector's canvas: build an instance, apply the
|
|
21
|
+
* Mount a subject on the inspector's canvas: build an instance, apply the
|
|
22
|
+
* request's inspection, and draw it every animation frame at the playhead's
|
|
23
|
+
* second through the request's first view.
|
|
6
24
|
*
|
|
7
|
-
* The instance is created at once and arrives later. When it arrives the mount
|
|
25
|
+
* The instance is created at once and arrives later. When it arrives the mount
|
|
26
|
+
* checks its clock and raster, seeks it to the request's first second and waits
|
|
27
|
+
* until it is ready there, lists its paths and the marks of its first second,
|
|
28
|
+
* applies the inspection of the newest request (or, when the scene refuses it,
|
|
29
|
+
* of the request that asks for nothing, reported through `refused`), sets the
|
|
30
|
+
* playhead's duration and second, reports `ready` and schedules the first
|
|
31
|
+
* frame. Each frame advances a playing playhead by the wall time since the last
|
|
32
|
+
* frame, follows the host's size, and redraws when the playhead's snapshot or
|
|
33
|
+
* the request changed: place the instance and, once it is ready, run the
|
|
34
|
+
* subject's `beforeDraw` on a WebGL renderer, as the draw host does, so its
|
|
35
|
+
* surface feeds show the second drawn with the scene's own materials, then
|
|
36
|
+
* update the inspection with the second's marks, resolve the view and render.
|
|
37
|
+
* An inspection that changes the scene's materials or layers is lifted around
|
|
38
|
+
* the seek of a subject with `beforeDraw` or `inspectPlaced` and applied again
|
|
39
|
+
* after them. Beauty pictures draw through `AutoMovieInspectorBeauty`, the
|
|
40
|
+
* subject's optics and indirect shading as delivery draws one sample. While a
|
|
41
|
+
* seek is pending no other is started, and the next frame seeks the newest
|
|
42
|
+
* second, so a slow subject drops intermediate seconds instead of queueing
|
|
43
|
+
* them. A drawing error pauses playback and is reported once until a frame
|
|
44
|
+
* draws again.
|
|
8
45
|
*
|
|
9
|
-
* The picture's aspect is the subject's raster, not the canvas's, so a view
|
|
46
|
+
* The picture's aspect is the subject's raster, not the canvas's, so a view
|
|
47
|
+
* frames what a capture of the same subject frames; the page gives the canvas
|
|
48
|
+
* that aspect. The mount adds no listener and holds at most one pending frame,
|
|
49
|
+
* so a mount, dispose and mount again on one canvas, as React's StrictMode runs
|
|
50
|
+
* an effect, leaves one renderer and one frame loop; a mount disposed before
|
|
51
|
+
* its instance arrives or is ready disposes the instance then and creates no
|
|
52
|
+
* renderer, and a seek that resolves after dispose draws nothing.
|
|
10
53
|
*
|
|
11
|
-
*
|
|
54
|
+
* An opted-in subject is observed at the second actually placed, before the
|
|
55
|
+
* inspection changes the scene: an inspection that changes layers, materials,
|
|
56
|
+
* mark geometry or clipping is restored before the seek and re-applied after
|
|
57
|
+
* the observation, while one that changes none of them, as the default request,
|
|
58
|
+
* stays applied and only updates its marks, as for any subject. Its findings
|
|
59
|
+
* reach the report and the diagnostic log with the playhead's playing flag and
|
|
60
|
+
* jump count, so uninterrupted playback can join painted samples into an
|
|
61
|
+
* observed span. Its witness cubes are drawn under the beauty shade unless
|
|
62
|
+
* `overlay(false)` hid them; hiding them stops no check and no report.
|
|
12
63
|
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
64
|
+
* `AutoMovieInspectorTransition` places the subject, the shown shot last, so
|
|
65
|
+
* diagnostics, marks, camera and inspection pictures follow it as in the draw
|
|
66
|
+
* page; a plain beauty transition paints and holds its other layers first and
|
|
67
|
+
* composites them by their `playbackLayersAt` weights, under the witness cubes
|
|
68
|
+
* at full strength, so a dissolve and a fade match delivery.
|
|
69
|
+
*
|
|
70
|
+
* The page draws the first view and the first pass of the request; the capture
|
|
71
|
+
* command draws them all. While paused, the labels the request asks for are
|
|
72
|
+
* placed by the inspection on the picture's pixels, with the stamp's font pixel
|
|
73
|
+
* at least one CSS pixel of the canvas as a capture keeps it at least one sheet
|
|
74
|
+
* pixel, and reported in CSS pixels; a named view with a focus is framed on
|
|
75
|
+
* what the focus selects.
|
|
20
76
|
*/
|
|
21
77
|
function mountAutoMovieInspectorScene(props) {
|
|
22
78
|
const { host, playhead, report } = props;
|
|
79
|
+
const diagnosticLog = new AutoMovieInspectorDiagnosticLog(report);
|
|
80
|
+
const witnessCubes = createAutoMovieInspectionDiagnosticOverlay();
|
|
23
81
|
let disposed = false;
|
|
82
|
+
let witnesses = true;
|
|
24
83
|
let wanted = props.request;
|
|
25
84
|
let live;
|
|
26
85
|
props.subject.create().then(async (instance) => {
|
|
27
86
|
if (disposed) instance.dispose();
|
|
28
87
|
else await arrive(instance);
|
|
29
88
|
}).catch((error) => {
|
|
30
|
-
if (!disposed) report.error(
|
|
89
|
+
if (!disposed) report.error(messageOfAutoMovieInspectorError(error));
|
|
31
90
|
});
|
|
32
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* Take an arrived instance into use once it is ready at its first second,
|
|
93
|
+
* releasing it if anything fails.
|
|
94
|
+
*/
|
|
33
95
|
async function arrive(instance) {
|
|
34
96
|
let seconds;
|
|
35
97
|
try {
|
|
36
|
-
|
|
37
|
-
["duration", instance.durationSeconds],
|
|
38
|
-
["fps", instance.fps],
|
|
39
|
-
["width", instance.width],
|
|
40
|
-
["height", instance.height]
|
|
41
|
-
]) if (!(Number.isFinite(value) && value > 0)) throw new Error(`Subject "${props.name}" ${name} ${value} is not positive`);
|
|
98
|
+
assertAutoMovieInspectorRaster(props.name, instance);
|
|
42
99
|
playhead.setDuration(instance.durationSeconds);
|
|
43
|
-
playhead.seek(
|
|
100
|
+
playhead.seek(firstAutoMovieInspectorSecond(wanted));
|
|
44
101
|
seconds = playhead.getSnapshot().seconds;
|
|
45
102
|
await instance.seek(seconds);
|
|
46
103
|
} catch (error) {
|
|
47
|
-
if (!disposed) report.error(
|
|
104
|
+
if (!disposed) report.error(messageOfAutoMovieInspectorError(error));
|
|
48
105
|
instance.dispose();
|
|
49
106
|
return;
|
|
50
107
|
}
|
|
@@ -54,42 +111,48 @@ function mountAutoMovieInspectorScene(props) {
|
|
|
54
111
|
}
|
|
55
112
|
const held = [() => instance.dispose()];
|
|
56
113
|
try {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
marks,
|
|
61
|
-
views: [...Object.keys(instance.views ?? {}), ...autoMovieViewerNamedViewpoints().map(({ id }) => id)],
|
|
62
|
-
width: instance.width,
|
|
63
|
-
height: instance.height,
|
|
64
|
-
durationSeconds: instance.durationSeconds,
|
|
65
|
-
fps: instance.fps
|
|
66
|
-
};
|
|
67
|
-
const renderer = host.createRenderer();
|
|
68
|
-
held.push(() => renderer.dispose());
|
|
69
|
-
const inspect = (request) => applyAutoMovieInspection({
|
|
70
|
-
scene: instance.scene,
|
|
71
|
-
request: request.inspection,
|
|
72
|
-
renderer,
|
|
73
|
-
marks
|
|
114
|
+
const facts = readAutoMovieInspectorFacts({
|
|
115
|
+
instance,
|
|
116
|
+
seconds
|
|
74
117
|
});
|
|
118
|
+
const { marks } = facts;
|
|
119
|
+
const { renderer, compositor } = host.createRenderer();
|
|
120
|
+
held.push(() => renderer.dispose());
|
|
121
|
+
const beauty = new AutoMovieInspectorBeauty();
|
|
122
|
+
held.push(() => beauty.dispose());
|
|
123
|
+
const transition = new AutoMovieInspectorTransition();
|
|
124
|
+
held.push(() => transition.dispose());
|
|
75
125
|
let applied = wanted;
|
|
76
126
|
let inspection;
|
|
77
127
|
let refusal = null;
|
|
78
128
|
try {
|
|
79
|
-
inspection =
|
|
129
|
+
inspection = inspectAutoMovieInspectorRequest({
|
|
130
|
+
instance,
|
|
131
|
+
renderer,
|
|
132
|
+
marks,
|
|
133
|
+
request: applied
|
|
134
|
+
});
|
|
80
135
|
} catch (error) {
|
|
81
|
-
refusal =
|
|
136
|
+
refusal = messageOfAutoMovieInspectorError(error);
|
|
82
137
|
applied = {
|
|
83
138
|
...readAutoMovieInspectorAddress(""),
|
|
84
139
|
subject: wanted.subject
|
|
85
140
|
};
|
|
86
|
-
inspection =
|
|
141
|
+
inspection = inspectAutoMovieInspectorRequest({
|
|
142
|
+
instance,
|
|
143
|
+
renderer,
|
|
144
|
+
marks,
|
|
145
|
+
request: applied
|
|
146
|
+
});
|
|
87
147
|
}
|
|
88
148
|
held.push(() => inspection.restore());
|
|
89
149
|
wanted = applied;
|
|
90
150
|
live = {
|
|
91
151
|
instance,
|
|
92
152
|
renderer,
|
|
153
|
+
compositor,
|
|
154
|
+
beauty,
|
|
155
|
+
transition,
|
|
93
156
|
inspection,
|
|
94
157
|
applied,
|
|
95
158
|
frame: void 0,
|
|
@@ -107,11 +170,14 @@ function mountAutoMovieInspectorScene(props) {
|
|
|
107
170
|
live.frame = host.requestFrame(frame);
|
|
108
171
|
} catch (error) {
|
|
109
172
|
live = void 0;
|
|
110
|
-
report.error(
|
|
111
|
-
|
|
173
|
+
report.error(messageOfAutoMovieInspectorError(error));
|
|
174
|
+
releaseAutoMovieInspectorSteps(held.reverse());
|
|
112
175
|
}
|
|
113
176
|
}
|
|
114
|
-
/**
|
|
177
|
+
/**
|
|
178
|
+
* One animation frame: advance, follow the size, redraw when something
|
|
179
|
+
* changed, schedule the next.
|
|
180
|
+
*/
|
|
115
181
|
function frame(nowMs) {
|
|
116
182
|
const now = live;
|
|
117
183
|
if (disposed || now === void 0) return;
|
|
@@ -119,30 +185,30 @@ function mountAutoMovieInspectorScene(props) {
|
|
|
119
185
|
const wall = now.lastMs === void 0 ? 0 : (nowMs - now.lastMs) / 1e3;
|
|
120
186
|
now.lastMs = nowMs;
|
|
121
187
|
playhead.advance(wall);
|
|
122
|
-
const
|
|
123
|
-
const drawable = [
|
|
124
|
-
size.width,
|
|
125
|
-
size.height,
|
|
126
|
-
size.pixelRatio
|
|
127
|
-
].every((value) => Number.isFinite(value) && value > 0);
|
|
128
|
-
if (drawable && (now.size === void 0 || now.size.width !== size.width || now.size.height !== size.height || now.size.pixelRatio !== size.pixelRatio)) {
|
|
129
|
-
now.renderer.setPixelRatio(size.pixelRatio);
|
|
130
|
-
now.renderer.setSize(size.width, size.height, false);
|
|
131
|
-
now.size = size;
|
|
132
|
-
now.dirty = true;
|
|
133
|
-
}
|
|
188
|
+
const drawable = followAutoMovieInspectorSize(now, host.size());
|
|
134
189
|
const snapshot = playhead.getSnapshot();
|
|
135
190
|
if (drawable && !now.seeking && (now.dirty || snapshot !== now.drawn)) draw(now, snapshot);
|
|
136
191
|
now.frame = host.requestFrame(frame);
|
|
137
192
|
}
|
|
138
|
-
/**
|
|
193
|
+
/**
|
|
194
|
+
* Place one second and draw it once the subject is ready there; frames skip
|
|
195
|
+
* drawing while a placement is pending.
|
|
196
|
+
*/
|
|
139
197
|
function draw(now, snapshot) {
|
|
140
198
|
now.dirty = false;
|
|
141
199
|
now.drawn = snapshot;
|
|
142
200
|
now.seeking = true;
|
|
143
201
|
let ready;
|
|
144
202
|
try {
|
|
145
|
-
|
|
203
|
+
if (readsAutoMovieInspectorPlacedScene(now.instance) && changesAutoMovieObservedScene(now.applied.inspection)) now.inspection.restore();
|
|
204
|
+
ready = now.transition.place({
|
|
205
|
+
name: props.name,
|
|
206
|
+
instance: now.instance,
|
|
207
|
+
request: now.applied.inspection,
|
|
208
|
+
compositor: now.compositor,
|
|
209
|
+
seconds: snapshot.seconds,
|
|
210
|
+
paint: () => beauty(now, filmCamera(now, snapshot.seconds), snapshot.seconds)
|
|
211
|
+
});
|
|
146
212
|
} catch (error) {
|
|
147
213
|
ready = Promise.reject(error instanceof Error ? error : new Error(String(error)));
|
|
148
214
|
}
|
|
@@ -154,41 +220,46 @@ function mountAutoMovieInspectorScene(props) {
|
|
|
154
220
|
if (live === now) fail(now, snapshot, error);
|
|
155
221
|
});
|
|
156
222
|
}
|
|
157
|
-
/**
|
|
223
|
+
/**
|
|
224
|
+
* Draw the second the subject is now at through the applied request's first
|
|
225
|
+
* view.
|
|
226
|
+
*/
|
|
158
227
|
function paint(now, snapshot) {
|
|
159
228
|
const { instance } = now;
|
|
160
229
|
try {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
if (instance.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
167
|
-
const
|
|
168
|
-
const
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
report.
|
|
186
|
-
labels: [],
|
|
187
|
-
lineHeight: 0,
|
|
188
|
-
dropped: 0
|
|
189
|
-
});
|
|
190
|
-
now.labelled = false;
|
|
230
|
+
const diagnostics = observeAutoMoviePlacedInspection(instance, snapshot.seconds, "viewer", void 0, now.transition.byShot);
|
|
231
|
+
if (now.compositor !== null) instance.beforeDraw?.(now.compositor, snapshot.seconds);
|
|
232
|
+
if (readsAutoMovieInspectorPlacedScene(instance) && (changesAutoMovieObservedScene(now.applied.inspection) || changesAutoMovieObservedScene(wanted.inspection) || writeAutoMovieInspectorInspection(wanted) !== writeAutoMovieInspectorInspection(now.applied))) {
|
|
233
|
+
now.inspection.restore();
|
|
234
|
+
if (installInspection(now, wanted, snapshot.seconds)) now.applied = wanted;
|
|
235
|
+
} else now.inspection.update(instance.marks?.(snapshot.seconds));
|
|
236
|
+
const camera = filmCamera(now, snapshot.seconds);
|
|
237
|
+
const shaded = now.applied.inspection.shade === "beauty";
|
|
238
|
+
const shown = () => beauty(now, camera, snapshot.seconds);
|
|
239
|
+
const composited = shaded && now.transition.finish(shown);
|
|
240
|
+
const diagnosticLegend = witnessCubes.render({
|
|
241
|
+
scene: composited ? now.transition.overlay : instance.scene,
|
|
242
|
+
diagnostics: witnesses && shaded ? diagnostics : void 0,
|
|
243
|
+
render: () => {
|
|
244
|
+
if (composited) now.transition.over(camera);
|
|
245
|
+
else if (shaded) shown();
|
|
246
|
+
else now.renderer.render(instance.scene, camera);
|
|
247
|
+
},
|
|
248
|
+
width: now.size.width,
|
|
249
|
+
height: now.size.height,
|
|
250
|
+
stroke: now.applied.inspection.stroke
|
|
251
|
+
});
|
|
252
|
+
if (diagnostics !== void 0) {
|
|
253
|
+
diagnosticLog.observe(diagnostics, snapshot);
|
|
254
|
+
report.diagnostics?.(diagnostics);
|
|
191
255
|
}
|
|
256
|
+
reportAutoMovieInspectorLabels({
|
|
257
|
+
now,
|
|
258
|
+
report,
|
|
259
|
+
camera,
|
|
260
|
+
diagnosticLegend,
|
|
261
|
+
playing: snapshot.playing
|
|
262
|
+
});
|
|
192
263
|
if (now.error !== null) {
|
|
193
264
|
now.error = null;
|
|
194
265
|
report.error(null);
|
|
@@ -197,103 +268,106 @@ function mountAutoMovieInspectorScene(props) {
|
|
|
197
268
|
fail(now, snapshot, error);
|
|
198
269
|
}
|
|
199
270
|
}
|
|
200
|
-
/**
|
|
271
|
+
/** The applied view's camera at a placed second. */
|
|
272
|
+
function filmCamera(now, seconds) {
|
|
273
|
+
return resolveAutoMovieInspectorCamera({
|
|
274
|
+
instance: now.instance,
|
|
275
|
+
text: now.applied.views[0],
|
|
276
|
+
inspection: now.inspection,
|
|
277
|
+
seconds
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Paint the placed scene's beauty picture through the stages delivery draws
|
|
282
|
+
* one sample with.
|
|
283
|
+
*/
|
|
284
|
+
function beauty(now, camera, seconds) {
|
|
285
|
+
now.beauty.draw({
|
|
286
|
+
renderer: now.renderer,
|
|
287
|
+
instance: now.instance,
|
|
288
|
+
camera,
|
|
289
|
+
seconds,
|
|
290
|
+
width: Math.floor(now.size.width * now.size.pixelRatio),
|
|
291
|
+
height: Math.floor(now.size.height * now.size.pixelRatio)
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Report a drawing error once until a frame draws again, and stop playback on
|
|
296
|
+
* it.
|
|
297
|
+
*/
|
|
201
298
|
function fail(now, snapshot, error) {
|
|
202
299
|
if (snapshot.playing) playhead.pause();
|
|
203
|
-
const message =
|
|
300
|
+
const message = messageOfAutoMovieInspectorError(error);
|
|
204
301
|
if (message !== now.error) {
|
|
205
302
|
now.error = message;
|
|
206
303
|
report.error(message);
|
|
207
304
|
}
|
|
208
305
|
}
|
|
306
|
+
/**
|
|
307
|
+
* Install a request on the live subject; on refusal keep the applied one in
|
|
308
|
+
* force and report the refusal.
|
|
309
|
+
*/
|
|
310
|
+
function installInspection(now, request, seconds) {
|
|
311
|
+
return installAutoMovieInspectorRequest({
|
|
312
|
+
now,
|
|
313
|
+
request,
|
|
314
|
+
seconds,
|
|
315
|
+
refused: (error) => {
|
|
316
|
+
wanted = now.applied;
|
|
317
|
+
report.refused(now.applied, messageOfAutoMovieInspectorError(error));
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
}
|
|
209
321
|
return {
|
|
210
322
|
apply: (request) => {
|
|
211
323
|
if (disposed || request === wanted) return;
|
|
212
324
|
wanted = request;
|
|
213
325
|
const now = live;
|
|
214
326
|
if (now === void 0) return;
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
marks: now.instance.marks?.(seconds) ?? []
|
|
222
|
-
});
|
|
327
|
+
if (now.instance.inspectPlaced !== void 0) {
|
|
328
|
+
if (firstAutoMovieInspectorSecond(request) !== firstAutoMovieInspectorSecond(now.applied)) playhead.seek(firstAutoMovieInspectorSecond(request));
|
|
329
|
+
now.dirty = true;
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
if (writeAutoMovieInspectorInspection(request) !== writeAutoMovieInspectorInspection(now.applied)) {
|
|
223
333
|
now.inspection.restore();
|
|
224
|
-
|
|
225
|
-
now.inspection = inspect(request);
|
|
226
|
-
} catch (error) {
|
|
227
|
-
now.inspection = inspect(now.applied);
|
|
228
|
-
wanted = now.applied;
|
|
334
|
+
if (!installInspection(now, request, playhead.getSnapshot().seconds)) {
|
|
229
335
|
now.dirty = true;
|
|
230
|
-
report.refused(now.applied, messageOf(error));
|
|
231
336
|
return;
|
|
232
337
|
}
|
|
233
338
|
report.legend([...now.inspection.legend]);
|
|
234
339
|
}
|
|
235
|
-
if (
|
|
340
|
+
if (firstAutoMovieInspectorSecond(request) !== firstAutoMovieInspectorSecond(now.applied)) playhead.seek(firstAutoMovieInspectorSecond(request));
|
|
236
341
|
now.applied = request;
|
|
237
342
|
now.dirty = true;
|
|
238
343
|
},
|
|
344
|
+
overlay: (show) => {
|
|
345
|
+
if (disposed || show === witnesses) return;
|
|
346
|
+
witnesses = show;
|
|
347
|
+
if (live !== void 0) live.dirty = true;
|
|
348
|
+
},
|
|
239
349
|
dispose: () => {
|
|
240
350
|
if (disposed) return;
|
|
241
351
|
disposed = true;
|
|
242
352
|
const now = live;
|
|
243
353
|
live = void 0;
|
|
244
354
|
if (now === void 0) return;
|
|
245
|
-
|
|
355
|
+
releaseAutoMovieInspectorSteps([
|
|
246
356
|
() => {
|
|
247
357
|
if (now.frame !== void 0) host.cancelFrame(now.frame);
|
|
248
358
|
now.frame = void 0;
|
|
249
359
|
},
|
|
250
360
|
() => now.inspection.restore(),
|
|
361
|
+
() => now.transition.dispose(),
|
|
362
|
+
() => now.beauty.dispose(),
|
|
251
363
|
() => now.renderer.dispose(),
|
|
252
|
-
() => now.instance.dispose()
|
|
364
|
+
() => now.instance.dispose(),
|
|
365
|
+
() => diagnosticLog.dispose(),
|
|
366
|
+
() => witnessCubes.dispose()
|
|
253
367
|
]);
|
|
254
368
|
}
|
|
255
369
|
};
|
|
256
370
|
}
|
|
257
|
-
/** The labels of a paused picture in CSS pixels of the canvas. */
|
|
258
|
-
function place(now, camera) {
|
|
259
|
-
const { width, height } = now.instance;
|
|
260
|
-
const shown = now.size;
|
|
261
|
-
const scale = Math.max(1, Math.ceil(height / shown.height));
|
|
262
|
-
const placed = now.inspection.labels(camera, width, height, scale);
|
|
263
|
-
return {
|
|
264
|
-
labels: placed.labels.map((label) => ({
|
|
265
|
-
path: label.path,
|
|
266
|
-
text: label.text,
|
|
267
|
-
left: label.x * shown.width / width,
|
|
268
|
-
top: label.y * shown.height / height
|
|
269
|
-
})),
|
|
270
|
-
lineHeight: 9 * scale * shown.height / height,
|
|
271
|
-
dropped: placed.dropped.length
|
|
272
|
-
};
|
|
273
|
-
}
|
|
274
|
-
/** The first second a request draws: its first explicit second, or the start of its sampling. */
|
|
275
|
-
function firstSecond(request) {
|
|
276
|
-
return request.sampling.kind === "at" ? request.sampling.seconds[0] : request.sampling.from;
|
|
277
|
-
}
|
|
278
|
-
/** A request's inspection as the text it writes, the identity an applied inspection is reused by. */
|
|
279
|
-
function written(request) {
|
|
280
|
-
return JSON.stringify(formatAutoMovieInspectionRequest(request.inspection));
|
|
281
|
-
}
|
|
282
|
-
/** Run every step, then throw every failure together. */
|
|
283
|
-
function release(steps) {
|
|
284
|
-
const failures = [];
|
|
285
|
-
for (const step of steps) try {
|
|
286
|
-
step();
|
|
287
|
-
} catch (error) {
|
|
288
|
-
failures.push(error);
|
|
289
|
-
}
|
|
290
|
-
if (failures.length === 1) throw failures[0];
|
|
291
|
-
if (failures.length > 1) throw new AggregateError(failures, "The inspector mount failed to release");
|
|
292
|
-
}
|
|
293
|
-
/** The text of a thrown value. */
|
|
294
|
-
function messageOf(error) {
|
|
295
|
-
return error instanceof Error ? error.message : String(error);
|
|
296
|
-
}
|
|
297
371
|
export { mountAutoMovieInspectorScene };
|
|
298
372
|
|
|
299
373
|
//# sourceMappingURL=mountAutoMovieInspectorScene.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mountAutoMovieInspectorScene.mjs","names":[],"sources":["../../src/inspector/mountAutoMovieInspectorScene.ts"],"sourcesContent":["import type {\n IAutoMovieCapturePlanRequest,\n IAutoMovieInspectionLabel,\n IAutoMovieInspectionView,\n} from \"@automovie/interface\";\nimport {\n type IApplyAutoMovieInspectionProps,\n type IAutoMovieDrawScene,\n type IAutoMovieDrawSubject,\n type IAutoMovieInspectionHandle,\n type IAutoMovieViewerViewpoint,\n applyAutoMovieInspection,\n autoMovieViewerNamedViewpoints,\n formatAutoMovieInspectionRequest,\n listAutoMovieInspectionPaths,\n parseAutoMovieInspectionView,\n resolveAutoMovieInspectionView,\n} from \"@automovie/render\";\nimport type * as THREE from \"three\";\n\nimport type { AutoMovieInspectorPlayhead } from \"./AutoMovieInspectorPlayhead.js\";\nimport type { IAutoMovieInspectorScene } from \"./IAutoMovieInspectorScene.js\";\nimport type { IAutoMovieInspectorSceneHost } from \"./IAutoMovieInspectorSceneHost.js\";\nimport { readAutoMovieInspectorAddress } from \"./readAutoMovieInspectorAddress.js\";\n\n/** What a mount holds once its instance is ready. */\ninterface ILive {\n instance: IAutoMovieDrawScene;\n renderer: IAutoMovieInspectorSceneHost.IRenderer;\n inspection: IAutoMovieInspectionHandle;\n applied: IAutoMovieCapturePlanRequest;\n frame: number | undefined;\n lastMs: number | undefined;\n drawn: AutoMovieInspectorPlayhead.ISnapshot | undefined;\n size: IAutoMovieInspectorSceneHost.ISize | undefined;\n dirty: boolean;\n seeking: boolean;\n error: string | null;\n labelled: boolean;\n}\n\n/**\n * Mount a subject on the inspector's canvas: build an instance, apply the request's inspection, and draw it every animation frame at the playhead's second through the request's first view.\n *\n * The instance is created at once and arrives later. When it arrives the mount checks its clock and raster, seeks it to the request's first second and waits until it is ready there, lists its paths and the marks of its first second, applies the inspection of the newest request (or, when the scene refuses it, of the request that asks for nothing, reported through `refused`), sets the playhead's duration and second, reports `ready` and schedules the first frame. Each frame advances a playing playhead by the wall time since the last frame, follows the host's size, and redraws when the playhead's snapshot or the request changed: seek the instance and, once its promise resolves, update the inspection with the second's marks, resolve the view and render. While a seek is pending no other is started, and the next frame seeks the newest second, so a slow subject drops intermediate seconds instead of queueing them. A drawing error pauses playback and is reported once until a frame draws again.\n *\n * The picture's aspect is the subject's raster, not the canvas's, so a view frames what a capture of the same subject frames; the page gives the canvas that aspect. The mount adds no listener and holds at most one pending frame, so a mount, dispose and mount again on one canvas, as React's StrictMode runs an effect, leaves one renderer and one frame loop; a mount disposed before its instance arrives or is ready disposes the instance then and creates no renderer, and a seek that resolves after dispose draws nothing.\n *\n * The page draws the first view and the first pass of the request; the capture command draws them all. While paused, the labels the request asks for are placed by the inspection on the picture's pixels, with the stamp's font pixel at least one CSS pixel of the canvas as a capture keeps it at least one sheet pixel, and reported in CSS pixels; a named view with a focus is framed on what the focus selects.\n *\n * @evidence contracts/development/common.md#meaningful-documentation States the arrival sequence, the fallback on refusal, what a frame does and when it redraws, the error rule, the aspect rule, the lifecycle guarantees, which view and pass are drawn, and how labels and focus are placed.\n * @evidence contracts/development/implementation.md#principled-implementation The scene is changed only through render's inspection, which restores before re-applying; views are resolved by render's view resolver on the inspection's drawn bounds, and the delivery camera takes the raster's aspect as the capture does. Wall time comes from the frame callback's own timestamp, so a frame's advance is the time actually elapsed. The subject's seek promise is the draw contract's readiness signal, so a picture is drawn only once the subject reports it can be.\n * @evidence contracts/development/implementation.md#clear-and-simple-structure One closure owns one mount: arrival, apply, frame, seek, paint, failure and dispose are local steps over one record of what is held; React, the DOM and WebGL stay with the component and the host.\n * @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A refused request is reported with the request still drawn rather than drawn half-applied, an instance that arrives after dispose is released rather than drawn, and no frame is drawn from a size that is not positive.\n * @evidence contracts/development/implementation.md#efficient-algorithms A frame that changed nothing costs one size read and one snapshot comparison; a redraw costs the subject's seek, the inspection's update linear in its marks, one view resolution and the render. Paths and the first second's marks are listed once per mount.\n * @evidence contracts/development/implementation.md#reuse-equivalent-work The applied inspection, the renderer and the instance live for the whole mount; an inspection is re-applied only when its written text changes.\n * @evidence contracts/development/implementation.md#bound-retention-and-release-resources The mount owns one instance, one renderer, one applied inspection and at most one pending frame, released by `dispose` in reverse order, each attempted even when another fails; the playhead is borrowed and gains no listener.\n */\nexport function mountAutoMovieInspectorScene(props: {\n /** The subject to build. */\n subject: IAutoMovieDrawSubject;\n\n /** The subject's name, as the request's `subject` key and the refusals name it. */\n name: string;\n\n /** The request in force when the mount starts. */\n request: IAutoMovieCapturePlanRequest;\n\n /** The playhead the loop advances and reads, borrowed for the mount's life. */\n playhead: AutoMovieInspectorPlayhead;\n\n /** Renderer, frame clock and size. */\n host: IAutoMovieInspectorSceneHost;\n\n /** Where the mount reports what it learns. */\n report: IAutoMovieInspectorScene.IReport;\n}): IAutoMovieInspectorScene {\n const { host, playhead, report } = props;\n let disposed: boolean = false;\n let wanted: IAutoMovieCapturePlanRequest = props.request;\n let live: ILive | undefined;\n\n // The instance arrives later; one that arrives after dispose is released at once.\n props.subject\n .create()\n .then(async (instance: IAutoMovieDrawScene): Promise<void> => {\n if (disposed) instance.dispose();\n else await arrive(instance);\n })\n .catch((error: unknown): void => {\n if (!disposed) report.error(messageOf(error));\n });\n\n /** Take an arrived instance into use once it is ready at its first second, releasing it if anything fails. */\n async function arrive(instance: IAutoMovieDrawScene): Promise<void> {\n let seconds: number;\n try {\n for (const [name, value] of [\n [\"duration\", instance.durationSeconds],\n [\"fps\", instance.fps],\n [\"width\", instance.width],\n [\"height\", instance.height],\n ] as const)\n if (!(Number.isFinite(value) && value > 0))\n throw new Error(\n `Subject \"${props.name}\" ${name} ${value} is not positive`,\n );\n playhead.setDuration(instance.durationSeconds);\n playhead.seek(firstSecond(wanted));\n seconds = playhead.getSnapshot().seconds;\n await instance.seek(seconds);\n } catch (error) {\n if (!disposed) report.error(messageOf(error));\n instance.dispose();\n return;\n }\n\n // A mount disposed while the subject got ready releases it unused.\n if (disposed) {\n instance.dispose();\n return;\n }\n const held: (() => void)[] = [(): void => instance.dispose()];\n try {\n // Paths are listed before the inspection adds its own objects to the scene.\n const marks: NonNullable<IApplyAutoMovieInspectionProps[\"marks\"]> =\n instance.marks?.(seconds) ?? [];\n const facts: IAutoMovieInspectorScene.IFacts = {\n paths: [\n ...listAutoMovieInspectionPaths(instance.scene).map(\n ({ path }: { path: string }): string => path,\n ),\n ...marks.map(({ path }: { path: string }): string => path),\n ],\n marks,\n\n views: [\n ...Object.keys(instance.views ?? {}),\n ...autoMovieViewerNamedViewpoints().map(\n ({ id }: IAutoMovieViewerViewpoint): string => id,\n ),\n ],\n width: instance.width,\n height: instance.height,\n durationSeconds: instance.durationSeconds,\n fps: instance.fps,\n };\n\n const renderer: IAutoMovieInspectorSceneHost.IRenderer =\n host.createRenderer();\n held.push((): void => renderer.dispose());\n const inspect: (\n request: IAutoMovieCapturePlanRequest,\n ) => IAutoMovieInspectionHandle = (\n request: IAutoMovieCapturePlanRequest,\n ): IAutoMovieInspectionHandle =>\n applyAutoMovieInspection({\n scene: instance.scene,\n request: request.inspection,\n renderer,\n marks,\n });\n\n // The newest request, or the one that asks for nothing when the scene refuses it.\n let applied: IAutoMovieCapturePlanRequest = wanted;\n let inspection: IAutoMovieInspectionHandle;\n let refusal: string | null = null;\n try {\n inspection = inspect(applied);\n } catch (error) {\n refusal = messageOf(error);\n applied = {\n ...readAutoMovieInspectorAddress(\"\"),\n subject: wanted.subject,\n };\n inspection = inspect(applied);\n }\n held.push((): void => inspection.restore());\n wanted = applied;\n live = {\n instance,\n renderer,\n inspection,\n applied,\n frame: undefined,\n lastMs: undefined,\n drawn: undefined,\n size: undefined,\n dirty: true,\n seeking: false,\n error: null,\n labelled: false,\n };\n report.ready(facts);\n if (refusal !== null) report.refused(applied, refusal);\n report.legend([...inspection.legend]);\n live.frame = host.requestFrame(frame);\n } catch (error) {\n live = undefined;\n report.error(messageOf(error));\n release(held.reverse());\n }\n }\n\n /** One animation frame: advance, follow the size, redraw when something changed, schedule the next. */\n function frame(nowMs: number): void {\n const now: ILive | undefined = live;\n if (disposed || now === undefined) return;\n now.frame = undefined;\n const wall: number =\n now.lastMs === undefined ? 0 : (nowMs - now.lastMs) / 1000;\n now.lastMs = nowMs;\n playhead.advance(wall);\n\n const size: IAutoMovieInspectorSceneHost.ISize = host.size();\n const drawable: boolean = [size.width, size.height, size.pixelRatio].every(\n (value: number): boolean => Number.isFinite(value) && value > 0,\n );\n if (\n drawable &&\n (now.size === undefined ||\n now.size.width !== size.width ||\n now.size.height !== size.height ||\n now.size.pixelRatio !== size.pixelRatio)\n ) {\n now.renderer.setPixelRatio(size.pixelRatio);\n now.renderer.setSize(size.width, size.height, false);\n now.size = size;\n now.dirty = true;\n }\n\n const snapshot: AutoMovieInspectorPlayhead.ISnapshot =\n playhead.getSnapshot();\n if (drawable && !now.seeking && (now.dirty || snapshot !== now.drawn))\n draw(now, snapshot);\n now.frame = host.requestFrame(frame);\n }\n\n /** Seek one second and draw it once the subject is ready there; frames skip drawing while a seek is pending. */\n function draw(\n now: ILive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n ): void {\n now.dirty = false;\n now.drawn = snapshot;\n now.seeking = true;\n let ready: Promise<void>;\n try {\n ready = now.instance.seek(snapshot.seconds);\n } catch (error) {\n ready = Promise.reject(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n ready\n .then((): void => {\n now.seeking = false;\n if (live === now) paint(now, snapshot);\n })\n .catch((error: unknown): void => {\n now.seeking = false;\n if (live === now) fail(now, snapshot, error);\n });\n }\n\n /** Draw the second the subject is now at through the applied request's first view. */\n function paint(\n now: ILive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n ): void {\n const { instance } = now;\n try {\n now.inspection.update(instance.marks?.(snapshot.seconds));\n\n // The delivery camera takes the raster's aspect, as a capture of the subject does.\n const aspect: number = instance.width / instance.height;\n if (instance.camera.aspect !== aspect) {\n instance.camera.aspect = aspect;\n instance.camera.updateProjectionMatrix();\n }\n const text: string = now.applied.views[0]!;\n const view: IAutoMovieInspectionView = parseAutoMovieInspectionView(text);\n const camera: THREE.Camera = resolveAutoMovieInspectionView({\n view,\n text,\n bounds:\n view.type === \"named\" ? now.inspection.bounds(view.focus) : null,\n camera: instance.camera,\n ...(instance.views === undefined ? {} : { views: instance.views }),\n seconds: snapshot.seconds,\n width: instance.width,\n height: instance.height,\n }).camera;\n now.renderer.render(instance.scene, camera);\n if (!snapshot.playing) {\n report.legend([...now.inspection.legend]);\n report.labels(place(now, camera));\n now.labelled = true;\n } else if (now.labelled) {\n report.labels({ labels: [], lineHeight: 0, dropped: 0 });\n now.labelled = false;\n }\n if (now.error !== null) {\n now.error = null;\n report.error(null);\n }\n } catch (error) {\n fail(now, snapshot, error);\n }\n }\n\n /** Report a drawing error once until a frame draws again, and stop playback on it. */\n function fail(\n now: ILive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n error: unknown,\n ): void {\n if (snapshot.playing) playhead.pause();\n const message: string = messageOf(error);\n if (message !== now.error) {\n now.error = message;\n report.error(message);\n }\n }\n\n return {\n apply: (request: IAutoMovieCapturePlanRequest): void => {\n if (disposed || request === wanted) return;\n wanted = request;\n const now: ILive | undefined = live;\n if (now === undefined) return;\n\n // The inspection is re-applied only when its text changed; a refusal re-applies the previous one.\n if (written(request) !== written(now.applied)) {\n const seconds: number = playhead.getSnapshot().seconds;\n const inspect: (\n next: IAutoMovieCapturePlanRequest,\n ) => IAutoMovieInspectionHandle = (\n next: IAutoMovieCapturePlanRequest,\n ): IAutoMovieInspectionHandle =>\n applyAutoMovieInspection({\n scene: now.instance.scene,\n request: next.inspection,\n renderer: now.renderer,\n marks: now.instance.marks?.(seconds) ?? [],\n });\n now.inspection.restore();\n try {\n now.inspection = inspect(request);\n } catch (error) {\n now.inspection = inspect(now.applied);\n wanted = now.applied;\n now.dirty = true;\n report.refused(now.applied, messageOf(error));\n return;\n }\n report.legend([...now.inspection.legend]);\n }\n if (firstSecond(request) !== firstSecond(now.applied))\n playhead.seek(firstSecond(request));\n now.applied = request;\n now.dirty = true;\n },\n dispose: (): void => {\n if (disposed) return;\n disposed = true;\n const now: ILive | undefined = live;\n live = undefined;\n if (now === undefined) return;\n release([\n (): void => {\n if (now.frame !== undefined) host.cancelFrame(now.frame);\n now.frame = undefined;\n },\n (): void => now.inspection.restore(),\n (): void => now.renderer.dispose(),\n (): void => now.instance.dispose(),\n ]);\n },\n };\n}\n\n/** The labels of a paused picture in CSS pixels of the canvas. */\nfunction place(\n now: ILive,\n camera: THREE.Camera,\n): IAutoMovieInspectorScene.ILabels {\n const { width, height } = now.instance;\n const shown: IAutoMovieInspectorSceneHost.ISize = now.size!;\n\n // The stamp's font pixel stays at least one CSS pixel, as a capture keeps it at least one sheet pixel.\n const scale: number = Math.max(1, Math.ceil(height / shown.height));\n const placed: ReturnType<IAutoMovieInspectionHandle[\"labels\"]> =\n now.inspection.labels(camera, width, height, scale);\n return {\n labels: placed.labels.map(\n (\n label: IAutoMovieInspectionLabel,\n ): IAutoMovieInspectorScene.ILabels[\"labels\"][number] => ({\n path: label.path,\n text: label.text,\n left: (label.x * shown.width) / width,\n top: (label.y * shown.height) / height,\n }),\n ),\n // The stamp's box is nine font pixels high.\n lineHeight: (9 * scale * shown.height) / height,\n dropped: placed.dropped.length,\n };\n}\n\n/** The first second a request draws: its first explicit second, or the start of its sampling. */\nfunction firstSecond(request: IAutoMovieCapturePlanRequest): number {\n return request.sampling.kind === \"at\"\n ? request.sampling.seconds[0]!\n : request.sampling.from;\n}\n\n/** A request's inspection as the text it writes, the identity an applied inspection is reused by. */\nfunction written(request: IAutoMovieCapturePlanRequest): string {\n return JSON.stringify(formatAutoMovieInspectionRequest(request.inspection));\n}\n\n/** Run every step, then throw every failure together. */\nfunction release(steps: readonly (() => void)[]): void {\n const failures: unknown[] = [];\n for (const step of steps)\n try {\n step();\n } catch (error) {\n failures.push(error);\n }\n if (failures.length === 1) throw failures[0];\n if (failures.length > 1)\n throw new AggregateError(failures, \"The inspector mount failed to release\");\n}\n\n/** The text of a thrown value. */\nfunction messageOf(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0DA,SAAgB,6BAA6B,OAkBhB;CAC3B,MAAM,EAAE,MAAM,UAAU,WAAW;CACnC,IAAI,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I,MAAM,SAAU;EAClC,EACF;EAEA,YAAa,IAAI,QAAQ,MAAM,SAAU;EACzC,SAAS,OAAO,QAAQ;CAC1B;AACF;;AAGA,SAAS,YAAY,SAA+C;CAClE,OAAO,QAAQ,SAAS,SAAS,OAC7B,QAAQ,SAAS,QAAQ,KACzB,QAAQ,SAAS;AACvB;;AAGA,SAAS,QAAQ,SAA+C;CAC9D,OAAO,KAAK,UAAU,iCAAiC,QAAQ,UAAU,CAAC;AAC5E;;AAGA,SAAS,QAAQ,OAAsC;CACrD,MAAM,WAAsB,CAAC;CAC7B,KAAK,MAAM,QAAQ,OACjB,IAAI;EACF,KAAK;CACP,SAAS,OAAO;EACd,SAAS,KAAK,KAAK;CACrB;CACF,IAAI,SAAS,WAAW,GAAG,MAAM,SAAS;CAC1C,IAAI,SAAS,SAAS,GACpB,MAAM,IAAI,eAAe,UAAU,uCAAuC;AAC9E;;AAGA,SAAS,UAAU,OAAwB;CACzC,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D"}
|
|
1
|
+
{"version":3,"file":"mountAutoMovieInspectorScene.mjs","names":[],"sources":["../../src/inspector/mountAutoMovieInspectorScene.ts"],"sourcesContent":["import type {\n IAutoMovieCapturePlanRequest,\n IAutoMovieInspectionDiagnostics,\n} from \"@automovie/interface\";\nimport {\n type IAutoMovieDrawScene,\n type IAutoMovieDrawSubject,\n type IAutoMovieInspectionHandle,\n createAutoMovieInspectionDiagnosticOverlay,\n observeAutoMoviePlacedInspection,\n} from \"@automovie/render\";\nimport type * as THREE from \"three\";\n\nimport { AutoMovieInspectorBeauty } from \"./AutoMovieInspectorBeauty.js\";\nimport { AutoMovieInspectorDiagnosticLog } from \"./AutoMovieInspectorDiagnosticLog.js\";\nimport type { AutoMovieInspectorPlayhead } from \"./AutoMovieInspectorPlayhead.js\";\nimport { AutoMovieInspectorTransition } from \"./AutoMovieInspectorTransition.js\";\nimport type { IAutoMovieInspectorLive } from \"./IAutoMovieInspectorLive.js\";\nimport type { IAutoMovieInspectorScene } from \"./IAutoMovieInspectorScene.js\";\nimport type { IAutoMovieInspectorSceneHost } from \"./IAutoMovieInspectorSceneHost.js\";\nimport { assertAutoMovieInspectorRaster } from \"./assertAutoMovieInspectorRaster.js\";\nimport { changesAutoMovieObservedScene } from \"./changesAutoMovieObservedScene.js\";\nimport { firstAutoMovieInspectorSecond } from \"./firstAutoMovieInspectorSecond.js\";\nimport { followAutoMovieInspectorSize } from \"./followAutoMovieInspectorSize.js\";\nimport { inspectAutoMovieInspectorRequest } from \"./inspectAutoMovieInspectorRequest.js\";\nimport { installAutoMovieInspectorRequest } from \"./installAutoMovieInspectorRequest.js\";\nimport { messageOfAutoMovieInspectorError } from \"./messageOfAutoMovieInspectorError.js\";\nimport { readAutoMovieInspectorAddress } from \"./readAutoMovieInspectorAddress.js\";\nimport { readAutoMovieInspectorFacts } from \"./readAutoMovieInspectorFacts.js\";\nimport { readsAutoMovieInspectorPlacedScene } from \"./readsAutoMovieInspectorPlacedScene.js\";\nimport { releaseAutoMovieInspectorSteps } from \"./releaseAutoMovieInspectorSteps.js\";\nimport { reportAutoMovieInspectorLabels } from \"./reportAutoMovieInspectorLabels.js\";\nimport { resolveAutoMovieInspectorCamera } from \"./resolveAutoMovieInspectorCamera.js\";\nimport { writeAutoMovieInspectorInspection } from \"./writeAutoMovieInspectorInspection.js\";\n\n/**\n * Mount a subject on the inspector's canvas: build an instance, apply the\n * request's inspection, and draw it every animation frame at the playhead's\n * second through the request's first view.\n *\n * The instance is created at once and arrives later. When it arrives the mount\n * checks its clock and raster, seeks it to the request's first second and waits\n * until it is ready there, lists its paths and the marks of its first second,\n * applies the inspection of the newest request (or, when the scene refuses it,\n * of the request that asks for nothing, reported through `refused`), sets the\n * playhead's duration and second, reports `ready` and schedules the first\n * frame. Each frame advances a playing playhead by the wall time since the last\n * frame, follows the host's size, and redraws when the playhead's snapshot or\n * the request changed: place the instance and, once it is ready, run the\n * subject's `beforeDraw` on a WebGL renderer, as the draw host does, so its\n * surface feeds show the second drawn with the scene's own materials, then\n * update the inspection with the second's marks, resolve the view and render.\n * An inspection that changes the scene's materials or layers is lifted around\n * the seek of a subject with `beforeDraw` or `inspectPlaced` and applied again\n * after them. Beauty pictures draw through `AutoMovieInspectorBeauty`, the\n * subject's optics and indirect shading as delivery draws one sample. While a\n * seek is pending no other is started, and the next frame seeks the newest\n * second, so a slow subject drops intermediate seconds instead of queueing\n * them. A drawing error pauses playback and is reported once until a frame\n * draws again.\n *\n * The picture's aspect is the subject's raster, not the canvas's, so a view\n * frames what a capture of the same subject frames; the page gives the canvas\n * that aspect. The mount adds no listener and holds at most one pending frame,\n * so a mount, dispose and mount again on one canvas, as React's StrictMode runs\n * an effect, leaves one renderer and one frame loop; a mount disposed before\n * its instance arrives or is ready disposes the instance then and creates no\n * renderer, and a seek that resolves after dispose draws nothing.\n *\n * An opted-in subject is observed at the second actually placed, before the\n * inspection changes the scene: an inspection that changes layers, materials,\n * mark geometry or clipping is restored before the seek and re-applied after\n * the observation, while one that changes none of them, as the default request,\n * stays applied and only updates its marks, as for any subject. Its findings\n * reach the report and the diagnostic log with the playhead's playing flag and\n * jump count, so uninterrupted playback can join painted samples into an\n * observed span. Its witness cubes are drawn under the beauty shade unless\n * `overlay(false)` hid them; hiding them stops no check and no report.\n *\n * `AutoMovieInspectorTransition` places the subject, the shown shot last, so\n * diagnostics, marks, camera and inspection pictures follow it as in the draw\n * page; a plain beauty transition paints and holds its other layers first and\n * composites them by their `playbackLayersAt` weights, under the witness cubes\n * at full strength, so a dissolve and a fade match delivery.\n *\n * The page draws the first view and the first pass of the request; the capture\n * command draws them all. While paused, the labels the request asks for are\n * placed by the inspection on the picture's pixels, with the stamp's font pixel\n * at least one CSS pixel of the canvas as a capture keeps it at least one sheet\n * pixel, and reported in CSS pixels; a named view with a focus is framed on\n * what the focus selects.\n */\nexport function mountAutoMovieInspectorScene(props: {\n /** The subject to build. */\n subject: IAutoMovieDrawSubject;\n\n /**\n * The subject's name, as the request's `subject` key and the refusals name\n * it.\n */\n name: string;\n\n /** The request in force when the mount starts. */\n request: IAutoMovieCapturePlanRequest;\n\n /** The playhead the loop advances and reads, borrowed for the mount's life. */\n playhead: AutoMovieInspectorPlayhead;\n\n /** Renderer, frame clock and size. */\n host: IAutoMovieInspectorSceneHost;\n\n /** Where the mount reports what it learns. */\n report: IAutoMovieInspectorScene.IReport;\n}): IAutoMovieInspectorScene {\n const { host, playhead, report } = props;\n const diagnosticLog: AutoMovieInspectorDiagnosticLog =\n new AutoMovieInspectorDiagnosticLog(report);\n const witnessCubes: ReturnType<\n typeof createAutoMovieInspectionDiagnosticOverlay\n > = createAutoMovieInspectionDiagnosticOverlay();\n let disposed: boolean = false;\n let witnesses: boolean = true;\n let wanted: IAutoMovieCapturePlanRequest = props.request;\n let live: IAutoMovieInspectorLive | undefined;\n\n // The instance arrives later; one that arrives after dispose is released at once.\n props.subject\n .create()\n .then(async (instance: IAutoMovieDrawScene): Promise<void> => {\n if (disposed) instance.dispose();\n else await arrive(instance);\n })\n .catch((error: unknown): void => {\n if (!disposed) report.error(messageOfAutoMovieInspectorError(error));\n });\n\n /**\n * Take an arrived instance into use once it is ready at its first second,\n * releasing it if anything fails.\n */\n async function arrive(instance: IAutoMovieDrawScene): Promise<void> {\n let seconds: number;\n try {\n assertAutoMovieInspectorRaster(props.name, instance);\n playhead.setDuration(instance.durationSeconds);\n playhead.seek(firstAutoMovieInspectorSecond(wanted));\n seconds = playhead.getSnapshot().seconds;\n await instance.seek(seconds);\n } catch (error) {\n if (!disposed) report.error(messageOfAutoMovieInspectorError(error));\n instance.dispose();\n return;\n }\n\n // A mount disposed while the subject got ready releases it unused.\n if (disposed) {\n instance.dispose();\n return;\n }\n const held: (() => void)[] = [(): void => instance.dispose()];\n try {\n // Facts are read before the inspection adds its own objects to the scene.\n const facts: IAutoMovieInspectorScene.IFacts =\n readAutoMovieInspectorFacts({ instance, seconds });\n const { marks } = facts;\n\n const { renderer, compositor }: IAutoMovieInspectorSceneHost.ICreated =\n host.createRenderer();\n held.push((): void => renderer.dispose());\n const beauty: AutoMovieInspectorBeauty = new AutoMovieInspectorBeauty();\n held.push((): void => beauty.dispose());\n const transition: AutoMovieInspectorTransition =\n new AutoMovieInspectorTransition();\n held.push((): void => transition.dispose());\n\n // The newest request, or the one that asks for nothing when the scene refuses it.\n let applied: IAutoMovieCapturePlanRequest = wanted;\n let inspection: IAutoMovieInspectionHandle;\n let refusal: string | null = null;\n try {\n inspection = inspectAutoMovieInspectorRequest({\n ...{ instance, renderer, marks },\n request: applied,\n });\n } catch (error) {\n refusal = messageOfAutoMovieInspectorError(error);\n applied = {\n ...readAutoMovieInspectorAddress(\"\"),\n subject: wanted.subject,\n };\n inspection = inspectAutoMovieInspectorRequest({\n ...{ instance, renderer, marks },\n request: applied,\n });\n }\n held.push((): void => inspection.restore());\n wanted = applied;\n live = {\n instance,\n renderer,\n compositor,\n beauty,\n transition,\n inspection,\n applied,\n frame: undefined,\n lastMs: undefined,\n drawn: undefined,\n size: undefined,\n dirty: true,\n seeking: false,\n error: null,\n labelled: false,\n };\n report.ready(facts);\n if (refusal !== null) report.refused(applied, refusal);\n report.legend([...inspection.legend]);\n live.frame = host.requestFrame(frame);\n } catch (error) {\n live = undefined;\n report.error(messageOfAutoMovieInspectorError(error));\n releaseAutoMovieInspectorSteps(held.reverse());\n }\n }\n\n /**\n * One animation frame: advance, follow the size, redraw when something\n * changed, schedule the next.\n */\n function frame(nowMs: number): void {\n const now: IAutoMovieInspectorLive | undefined = live;\n if (disposed || now === undefined) return;\n now.frame = undefined;\n const wall: number =\n now.lastMs === undefined ? 0 : (nowMs - now.lastMs) / 1000;\n now.lastMs = nowMs;\n playhead.advance(wall);\n\n const drawable: boolean = followAutoMovieInspectorSize(now, host.size());\n\n const snapshot: AutoMovieInspectorPlayhead.ISnapshot =\n playhead.getSnapshot();\n if (drawable && !now.seeking && (now.dirty || snapshot !== now.drawn))\n draw(now, snapshot);\n now.frame = host.requestFrame(frame);\n }\n\n /**\n * Place one second and draw it once the subject is ready there; frames skip\n * drawing while a placement is pending.\n */\n function draw(\n now: IAutoMovieInspectorLive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n ): void {\n now.dirty = false;\n now.drawn = snapshot;\n now.seeking = true;\n let ready: Promise<void>;\n try {\n // An observation and the subject's feeds read the scene as placed, without what the inspection changed.\n if (\n readsAutoMovieInspectorPlacedScene(now.instance) &&\n changesAutoMovieObservedScene(now.applied.inspection)\n )\n now.inspection.restore();\n // A transition's other layers are placed, painted and held, and the shot the picture shows most of is placed last.\n ready = now.transition.place({\n name: props.name,\n instance: now.instance,\n request: now.applied.inspection,\n compositor: now.compositor,\n seconds: snapshot.seconds,\n paint: (): void =>\n beauty(now, filmCamera(now, snapshot.seconds), snapshot.seconds),\n });\n } catch (error) {\n ready = Promise.reject(\n error instanceof Error ? error : new Error(String(error)),\n );\n }\n ready\n .then((): void => {\n now.seeking = false;\n if (live === now) paint(now, snapshot);\n })\n .catch((error: unknown): void => {\n now.seeking = false;\n if (live === now) fail(now, snapshot, error);\n });\n }\n\n /**\n * Draw the second the subject is now at through the applied request's first\n * view.\n */\n function paint(\n now: IAutoMovieInspectorLive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n ): void {\n const { instance } = now;\n try {\n const diagnostics: IAutoMovieInspectionDiagnostics | undefined =\n observeAutoMoviePlacedInspection(\n instance,\n snapshot.seconds,\n \"viewer\",\n undefined,\n now.transition.byShot,\n );\n // The subject's render-target work, such as surface feeds, runs once on the placed scene's own materials before any shade applies, as the draw host runs it; only a WebGL renderer has render targets.\n if (now.compositor !== null)\n instance.beforeDraw?.(now.compositor, snapshot.seconds);\n // Re-apply only an inspection that was restored for the scene's readers or changed; otherwise update its marks.\n if (\n readsAutoMovieInspectorPlacedScene(instance) &&\n (changesAutoMovieObservedScene(now.applied.inspection) ||\n changesAutoMovieObservedScene(wanted.inspection) ||\n writeAutoMovieInspectorInspection(wanted) !==\n writeAutoMovieInspectorInspection(now.applied))\n ) {\n now.inspection.restore();\n if (installInspection(now, wanted, snapshot.seconds))\n now.applied = wanted;\n } else now.inspection.update(instance.marks?.(snapshot.seconds));\n\n const camera: THREE.Camera = filmCamera(now, snapshot.seconds);\n const shaded: boolean = now.applied.inspection.shade === \"beauty\";\n const shown: () => void = (): void =>\n beauty(now, camera, snapshot.seconds);\n // A composited transition takes its witness cubes over the composite, at full strength.\n const composited: boolean = shaded && now.transition.finish(shown);\n const diagnosticLegend: ReturnType<typeof witnessCubes.render> =\n witnessCubes.render({\n scene: composited ? now.transition.overlay : instance.scene,\n diagnostics: witnesses && shaded ? diagnostics : undefined,\n render: (): void => {\n // The beauty shade shows the delivered picture: the subject's optics, through the stage delivery draws with.\n if (composited) now.transition.over(camera);\n else if (shaded) shown();\n else now.renderer.render(instance.scene, camera);\n },\n width: now.size!.width,\n height: now.size!.height,\n stroke: now.applied.inspection.stroke,\n });\n if (diagnostics !== undefined) {\n diagnosticLog.observe(diagnostics, snapshot);\n report.diagnostics?.(diagnostics);\n }\n reportAutoMovieInspectorLabels({\n ...{ now, report, camera, diagnosticLegend },\n playing: snapshot.playing,\n });\n if (now.error !== null) {\n now.error = null;\n report.error(null);\n }\n } catch (error) {\n fail(now, snapshot, error);\n }\n }\n\n /** The applied view's camera at a placed second. */\n function filmCamera(\n now: IAutoMovieInspectorLive,\n seconds: number,\n ): THREE.Camera {\n return resolveAutoMovieInspectorCamera({\n instance: now.instance,\n text: now.applied.views[0]!,\n inspection: now.inspection,\n seconds,\n });\n }\n\n /**\n * Paint the placed scene's beauty picture through the stages delivery draws\n * one sample with.\n */\n function beauty(\n now: IAutoMovieInspectorLive,\n camera: THREE.Camera,\n seconds: number,\n ): void {\n now.beauty.draw({\n renderer: now.renderer,\n instance: now.instance,\n camera,\n seconds,\n width: Math.floor(now.size!.width * now.size!.pixelRatio),\n height: Math.floor(now.size!.height * now.size!.pixelRatio),\n });\n }\n\n /**\n * Report a drawing error once until a frame draws again, and stop playback on\n * it.\n */\n function fail(\n now: IAutoMovieInspectorLive,\n snapshot: AutoMovieInspectorPlayhead.ISnapshot,\n error: unknown,\n ): void {\n if (snapshot.playing) playhead.pause();\n const message: string = messageOfAutoMovieInspectorError(error);\n if (message !== now.error) {\n now.error = message;\n report.error(message);\n }\n }\n\n /**\n * Install a request on the live subject; on refusal keep the applied one in\n * force and report the refusal.\n */\n function installInspection(\n now: IAutoMovieInspectorLive,\n request: IAutoMovieCapturePlanRequest,\n seconds: number,\n ): boolean {\n return installAutoMovieInspectorRequest({\n ...{ now, request, seconds },\n refused: (error: unknown): void => {\n wanted = now.applied;\n report.refused(now.applied, messageOfAutoMovieInspectorError(error));\n },\n });\n }\n return {\n apply: (request: IAutoMovieCapturePlanRequest): void => {\n if (disposed || request === wanted) return;\n wanted = request;\n const now: IAutoMovieInspectorLive | undefined = live;\n if (now === undefined) return;\n\n // Opted-in subjects apply each request only after the current settled scene is observed.\n if (now.instance.inspectPlaced !== undefined) {\n if (\n firstAutoMovieInspectorSecond(request) !==\n firstAutoMovieInspectorSecond(now.applied)\n )\n playhead.seek(firstAutoMovieInspectorSecond(request));\n now.dirty = true;\n return;\n }\n\n // A generic subject keeps its inspection until its request changes.\n if (\n writeAutoMovieInspectorInspection(request) !==\n writeAutoMovieInspectorInspection(now.applied)\n ) {\n now.inspection.restore();\n const accepted: boolean = installInspection(\n now,\n request,\n playhead.getSnapshot().seconds,\n );\n if (!accepted) {\n now.dirty = true;\n return;\n }\n report.legend([...now.inspection.legend]);\n }\n if (\n firstAutoMovieInspectorSecond(request) !==\n firstAutoMovieInspectorSecond(now.applied)\n )\n playhead.seek(firstAutoMovieInspectorSecond(request));\n now.applied = request;\n now.dirty = true;\n },\n overlay: (show: boolean): void => {\n if (disposed || show === witnesses) return;\n witnesses = show;\n if (live !== undefined) live.dirty = true;\n },\n dispose: (): void => {\n if (disposed) return;\n disposed = true;\n const now: IAutoMovieInspectorLive | undefined = live;\n live = undefined;\n if (now === undefined) return;\n releaseAutoMovieInspectorSteps([\n (): void => {\n if (now.frame !== undefined) host.cancelFrame(now.frame);\n now.frame = undefined;\n },\n (): void => now.inspection.restore(),\n (): void => now.transition.dispose(),\n (): void => now.beauty.dispose(),\n (): void => now.renderer.dispose(),\n (): void => now.instance.dispose(),\n (): void => diagnosticLog.dispose(),\n (): void => witnessCubes.dispose(),\n ]);\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4FA,SAAgB,6BAA6B,OAqBhB;CAC3B,MAAM,EAAE,MAAM,UAAU,WAAW;CACnC,MAAM,gBACJ,IAAI,gCAAgC,MAAM;CAC5C,MAAM,eAEF,2CAA2C;CAC/C,IAAI,WAAoB;CACxB,IAAI,YAAqB;CACzB,IAAI,SAAuC,MAAM;CACjD,IAAI;CAGJ,MAAM,QACH,OAAO,CAAC,CACR,KAAK,OAAO,aAAiD;EAC5D,IAAI,UAAU,SAAS,QAAQ;OAC1B,MAAM,OAAO,QAAQ;CAC5B,CAAC,CAAC,CACD,OAAO,UAAyB;EAC/B,IAAI,CAAC,UAAU,OAAO,MAAM,iCAAiC,KAAK,CAAC;CACrE,CAAC;;;;;CAMH,eAAe,OAAO,UAA8C;EAClE,IAAI;EACJ,IAAI;GACF,+BAA+B,MAAM,MAAM,QAAQ;GACnD,SAAS,YAAY,SAAS,eAAe;GAC7C,SAAS,KAAK,8BAA8B,MAAM,CAAC;GACnD,UAAU,SAAS,YAAY,CAAC,CAAC;GACjC,MAAM,SAAS,KAAK,OAAO;EAC7B,SAAS,OAAO;GACd,IAAI,CAAC,UAAU,OAAO,MAAM,iCAAiC,KAAK,CAAC;GACnE,SAAS,QAAQ;GACjB;EACF;EAGA,IAAI,UAAU;GACZ,SAAS,QAAQ;GACjB;EACF;EACA,MAAM,OAAuB,OAAa,SAAS,QAAQ,CAAC;EAC5D,IAAI;GAEF,MAAM,QACJ,4BAA4B;IAAE;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