import { A as APP_CREDENTIAL_SHARING_ENABLED, C as CREDENTIAL_SYNC_SECRET, o as CREDENTIAL_SYNC_SECRET_HEADER_NAME } from "./i18n-tiaWqB1b.js";
const refreshOAuthTokens = async (refreshFunction, appSlug, userId) => {
  if (APP_CREDENTIAL_SHARING_ENABLED && process.env.CALCOM_CREDENTIAL_SYNC_ENDPOINT && CREDENTIAL_SYNC_SECRET && userId) {
    const response = await fetch(process.env.CALCOM_CREDENTIAL_SYNC_ENDPOINT, {
      method: "POST",
      headers: {
        [CREDENTIAL_SYNC_SECRET_HEADER_NAME]: CREDENTIAL_SYNC_SECRET
      },
      body: new URLSearchParams({
        calcomUserId: userId.toString(),
        appSlug
      })
    });
    return response;
  } else {
    const response = await refreshFunction();
    return response;
  }
};
const refreshOAuthTokens$1 = refreshOAuthTokens;
export {
  refreshOAuthTokens$1 as r
};
