import { LiveData } from '../reactive/LiveData.js';
import { PatchableFileModel } from './PatchableFileModel.js';
export default class PatchableLiveDataContentModel extends PatchableFileModel {
    setupFile(content) {
        this.raw = new LiveData(content);
        this.setupPreviousData(content);
    }
    createRevision() {
        const v = this.value;
        if (!v) {
            throw new Error('LiveData value is not set.');
        }
        return JSON.parse(JSON.stringify(v.value));
    }
    readValue() {
        const v = this.value;
        if (!v) {
            throw new Error('LiveData value is not set.');
        }
        return v.value;
    }
    setValue(value) {
        const v = this.value;
        if (v) {
            v.set(value);
        }
        else {
            this.raw = new LiveData(value);
        }
    }
}
//# sourceMappingURL=PatchableLiveDataContentModel.js.map