function loadGUIState() {
  const defaultState = {options: {}, debug: {}, debugEnabled: false};
  const guiStateKey = `guiState_${id}`;
  const guiState =
    JSON.parse(localStorage.getItem(guiStateKey)) || defaultState;
  if (window.location.hash) {
    HashState.parse(window.location.hash, guiState.options);
  }
  // Move GUI toolbox state out of options, as it refers to the toolbox name
  // and not the toolbox value.
  if (guiState.options.toolbox) {
    guiState.toolboxName = guiState.options.toolbox;
    delete guiState.options.toolbox;
  }
  // Move GUI theme state out of options, as it refers to the theme name
  // and not the theme object.
  if (guiState.options.theme) {
    guiState.themeName = guiState.options.theme;
    delete guiState.options.theme;
  }
  // If we end up using the 'debugRenderer' we still need to store the name of
  // the original renderer.
  guiState.renderer = guiState.options.renderer;

  // Use the debug renderer.
  if (guiState.debugEnabled) {
    guiState.options.renderer = debugRendererName;
  }

  return guiState;
}
Load the GUI state from local storage and the window hash.
@returns {Object} The GUI state.