import {CoreString} from "../../../../core/String";
import {JsonExportDispatcher} from "./Dispatcher";
export class SceneJsonExporter {
  constructor(_scene) {
    this._scene = _scene;
    this._data = {};
  }
  data() {
    this._scene.nodesController.reset_node_context_signatures();
    const root_exporter = JsonExportDispatcher.dispatch_node(this._scene.root());
    const nodes_data = root_exporter.data();
    const ui_data = root_exporter.ui_data();
    this._data = {
      properties: {
        frame: this._scene.frame() || 1,
        frameRange: this._scene.frameRange(),
        frameRangeLocked: this._scene.timeController.frameRangeLocked,
        realtimeState: this._scene.timeController.realtimeState,
        masterCameraNodePath: this._scene.camerasController.masterCameraNodePath()
      },
      root: nodes_data,
      ui: ui_data
    };
    return this._data;
  }
  static sanitize_string(word) {
    word = word.replace(/'/g, "'");
    word = CoreString.escapeLineBreaks(word);
    return word;
  }
}
