import { objectEntries as c } from "@scalar/helpers/object/object-entries";
import { deepClone as f } from "@scalar/workspace-store/helpers/deep-clone";
import { getResolvedRef as p } from "@scalar/workspace-store/helpers/get-resolved-ref";
import { mergeObjects as g } from "@scalar/workspace-store/helpers/merge-object";
import { coerceValue as h } from "@scalar/workspace-store/schemas/typebox-coerce";
import { SecuritySchemeObjectSchema as l } from "@scalar/workspace-store/schemas/v3.1/strict/openapi-document";
import { extractSecuritySchemeSecrets as y } from "./extract-security-scheme-secrets.js";
const D = (m = {}, s = {}, i, n) => {
  const d = c(m).reduce(
    (e, [r, o]) => {
      const t = f(p(o));
      return t && (e[r] = t), e;
    },
    {}
  ), u = g(d, s) ?? {};
  return c(u).reduce((e, [r, o]) => {
    const S = { ...h(l, o), ...o };
    return e[r] = y(S, i, r, n), e;
  }, {});
};
export {
  D as mergeSecurity
};
