export function detectIsBackend() {
  var pathname = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var search = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
  if (typeof window === 'undefined') return false;
  return search.includes('isBackend') || pathname.includes('/system/') || window.location.hash.includes('/system/');
}
export function getCacheSessionKey(isBackend, pathname) {
  if (pathname.includes('resourceQuotaCenter')) {
    return 'quotaCenterFilterLdcCluster';
  }
  return isBackend ? 'mFilterLdcCluster' : 'uFilterLdcCluster';
}
export function readFilterCache(storage, isBackend, pathname) {
  var key = getCacheSessionKey(isBackend, pathname);
  var cacheData = storage.getSession(key);
  if (!cacheData) return {};
  if (typeof cacheData === 'string') {
    try {
      return JSON.parse(cacheData);
    } catch (_unused) {
      return {};
    }
  }
  return cacheData;
}
export function writeFilterCache(storage, isBackend, pathname, params) {
  var key = getCacheSessionKey(isBackend, pathname);
  storage.setSession(key, params);
}