import { SelectedScript } from '@/application/Context/State/Selection/SelectedScript' ; import { IUserSelection } from '@/application/Context/State/Selection/IUserSelection' ; import { getScriptId } from '../../../ScriptNodeParser' ; import { IReverter } from './IReverter' ; export class ScriptReverter implements IReverter { private readonly scriptId : string ; constructor ( nodeId ) { this . scriptId = getScriptId ( nodeId ) ; } public getState ( selectedScripts ) { const selectedScript = selectedScripts . find ( ( selected ) => selected . id === this . scriptId ) ; if ( ! selectedScript ) { return false ; } return selectedScript . revert ; } public selectWithRevertState ( newState , selection ) { selection . addOrUpdateSelectedScript ( this . scriptId , newState ) ; } }