"use strict";
const index = require("./orgDomains-W_rFTMBa.cjs");
const refreshOAuthTokens = async (refreshFunction, appSlug, userId) => {
  if (index.APP_CREDENTIAL_SHARING_ENABLED && process.env.CALCOM_CREDENTIAL_SYNC_ENDPOINT && index.CREDENTIAL_SYNC_SECRET && userId) {
    const response = await fetch(process.env.CALCOM_CREDENTIAL_SYNC_ENDPOINT, {
      method: "POST",
      headers: {
        [index.CREDENTIAL_SYNC_SECRET_HEADER_NAME]: index.CREDENTIAL_SYNC_SECRET
      },
      body: new URLSearchParams({
        calcomUserId: userId.toString(),
        appSlug
      })
    });
    return response;
  } else {
    const response = await refreshFunction();
    return response;
  }
};
const refreshOAuthTokens$1 = refreshOAuthTokens;
exports.refreshOAuthTokens = refreshOAuthTokens$1;
