whereEndoState = (platform, env, info) => {
  if (env.XDG_STATE_HOME !== undefined) {
    return `${env.XDG_STATE_HOME}/endo`;
  } else if (platform === 'win32') {
    return `${whereHomeWindows(env, info)}\\Endo`;
  }
  const home = env.HOME !== undefined ? env.HOME : info.home;
  if (platform === 'darwin') {
    if (home !== undefined) {
      return `${home}/Library/Application Support/Endo`;
    }
  }
  return `${home}/.local/state/endo`;
}
Returns the most suitable path for Endo state with this platform and
environment.
Endo uses the state directory for saved files including applications,
durable capabilities, and the user's pet names for them.
Endo also logs here, per XDG's preference to persist logs even when caches
are purged.

@type {typeof import('./types.js').whereEndoState}