var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var app_capability_filters_exports = {};
__export(app_capability_filters_exports, {
  APP_AUTH_FILTER_VALUES: () => APP_AUTH_FILTER_VALUES,
  APP_CONTROLLER_FILTER_VALUES: () => APP_CONTROLLER_FILTER_VALUES,
  APP_SURFACE_FILTER_VALUES: () => APP_SURFACE_FILTER_VALUES,
  hasAppCapabilityFilters: () => hasAppCapabilityFilters,
  isAppAuthFilter: () => isAppAuthFilter,
  isAppControllerFilter: () => isAppControllerFilter,
  isAppSurfaceFilter: () => isAppSurfaceFilter,
  mapAppAuthFilterToMode: () => mapAppAuthFilterToMode,
  mapAppControllerFilterToMode: () => mapAppControllerFilterToMode,
  mapAppSurfaceFilterToSurface: () => mapAppSurfaceFilterToSurface,
  parseAppAuthFilter: () => parseAppAuthFilter,
  parseAppControllerFilter: () => parseAppControllerFilter,
  parseAppSurfaceFilter: () => parseAppSurfaceFilter
});
module.exports = __toCommonJS(app_capability_filters_exports);
const APP_AUTH_FILTER_VALUES = ["required", "optional", "none"];
const APP_CONTROLLER_FILTER_VALUES = ["required", "optional", "none"];
const APP_SURFACE_FILTER_VALUES = ["desktop", "mobile-portrait", "mobile-landscape"];
function isAppAuthFilter(value) {
  if (typeof value !== "string") {
    return false;
  }
  return APP_AUTH_FILTER_VALUES.includes(value.trim().toLowerCase());
}
function parseAppAuthFilter(value) {
  if (typeof value !== "string") {
    return null;
  }
  const normalized = value.trim().toLowerCase();
  return isAppAuthFilter(normalized) ? normalized : null;
}
function isAppControllerFilter(value) {
  if (typeof value !== "string") {
    return false;
  }
  return APP_CONTROLLER_FILTER_VALUES.includes(value.trim().toLowerCase());
}
function parseAppControllerFilter(value) {
  if (typeof value !== "string") {
    return null;
  }
  const normalized = value.trim().toLowerCase();
  return isAppControllerFilter(normalized) ? normalized : null;
}
function isAppSurfaceFilter(value) {
  if (typeof value !== "string") {
    return false;
  }
  return APP_SURFACE_FILTER_VALUES.includes(value.trim().toLowerCase());
}
function parseAppSurfaceFilter(value) {
  if (typeof value !== "string") {
    return null;
  }
  const normalized = value.trim().toLowerCase();
  return isAppSurfaceFilter(normalized) ? normalized : null;
}
function mapAppAuthFilterToMode(value) {
  if (value === "required") {
    return "REQUIRED";
  }
  if (value === "optional") {
    return "OPTIONAL";
  }
  return "NONE";
}
function mapAppControllerFilterToMode(value) {
  if (value === "required") {
    return "REQUIRED";
  }
  if (value === "optional") {
    return "SUPPORTED";
  }
  return "UNSUPPORTED";
}
function mapAppSurfaceFilterToSurface(value) {
  if (value === "desktop") {
    return "DESKTOP";
  }
  if (value === "mobile-portrait") {
    return "MOBILE_PORTRAIT";
  }
  return "MOBILE_LANDSCAPE";
}
function hasAppCapabilityFilters(value) {
  return Boolean(value?.auth || value?.controller || value?.surface);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  APP_AUTH_FILTER_VALUES,
  APP_CONTROLLER_FILTER_VALUES,
  APP_SURFACE_FILTER_VALUES,
  hasAppCapabilityFilters,
  isAppAuthFilter,
  isAppControllerFilter,
  isAppSurfaceFilter,
  mapAppAuthFilterToMode,
  mapAppControllerFilterToMode,
  mapAppSurfaceFilterToSurface,
  parseAppAuthFilter,
  parseAppControllerFilter,
  parseAppSurfaceFilter
});
