{"version":3,"sources":["jsdelivr-header.js","/npm/@octokit/auth-app@8.2.0/dist-src/index.js","/npm/@octokit/auth-app@8.2.0/dist-src/get-app-authentication.js","/npm/@octokit/auth-app@8.2.0/dist-src/cache.js","/npm/@octokit/auth-app@8.2.0/dist-src/to-token-authentication.js","/npm/@octokit/auth-app@8.2.0/dist-src/get-installation-authentication.js","/npm/@octokit/auth-app@8.2.0/dist-src/auth.js","/npm/@octokit/auth-app@8.2.0/dist-src/hook.js","/npm/@octokit/auth-app@8.2.0/dist-src/requires-app-auth.js","/npm/@octokit/auth-app@8.2.0/dist-src/version.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,OCNS,iBAAoB,yCACT,mBAAsB,0BACjC,uBAA0B,iCCF5B,iBAAkB,2BACzB,eAAe,sBAAqB,MAClC,EAAA,WACA,EAAA,eACA,EAAA,UACA,IAEA,IACE,GAAI,EAAW,CACb,MAAM,IAAE,EAAA,UAAK,SAAoB,EAAU,EAAO,GAClD,MAAO,CACL,KAAM,MACN,MAAO,EACP,QACA,YAEJ,CACA,MAAM,EAAc,CAClB,GAAI,EACJ,cAEE,GACF,OAAO,OAAO,EAAa,CACzB,IAAK,KAAK,MAAM,KAAK,MAAQ,KAAO,IAGxC,MAAM,QAA0B,aAAa,GAC7C,MAAO,CACL,KAAM,MACN,MAAO,EAAkB,MACzB,MAAO,EAAkB,MACzB,UAAW,IAAI,KAAoC,IAA/B,EAAkB,YAAkB,cAE5D,OAAS,GACP,KAAmB,oCAAf,EACI,IAAI,MACR,0MAGI,CAEV,CACF,QC1CS,QAAW,aACpB,SAAS,WACP,OAAO,IAAI,IAET,KAEA,MAEJ,CACA,eAAe,IAAI,EAAO,GACxB,MAAM,EAAW,kBAAkB,GAC7B,QAAe,EAAM,IAAI,GAC/B,IAAK,EACH,OAEF,MACE,EACA,EACA,EACA,EACA,EACA,GACE,EAAO,MAAM,KASjB,MAAO,CACL,QACA,YACA,YACA,YAZkB,EAAQ,aAAe,E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AU,SAAS,oBAA0B,EAA6B,4NAE5E,EAGR,MAAM,EAAsB,MAD1B,EAMF,OAJA,EAAM,IAAI,KACR,kGAAkG,YAAkB,EAAY,eAE5H,IAAI,SAAS,GAAY,WAAW,EAAS,KAC5C,uBAAuB,EAAO,EAAS,EAAS,EAAW,EACpE,CACF,CE3FA,IAAM,QAAU,eROP,wBAA2B,2BACpC,SAAS,cAAc,GACrB,IAAK,EAAQ,MACX,MAAM,IAAI,MAAM,gDAElB,IAAK,EAAQ,aAAe,EAAQ,UAClC,MAAM,IAAI,MAAM,qDAClB,GAAW,EAAQ,YAAc,EAAQ,UACvC,MAAM,IAAI,MACR,+EAGJ,GAAI,mBAAoB,IAAY,EAAQ,eAC1C,MAAM,IAAI,MACR,8DAGJ,MAAM,EAAM,EAAQ,KAAO,CAAC,EACJ,mBAAb,EAAI,OACb,EAAI,KAAO,QAAQ,KAAK,KAAK,UAE/B,MAAM,EAAU,EAAQ,SAAW,eAAe,SAAS,CACzD,QAAS,CACP,aAAc,uBAAuB,WAAW,oBAG9C,EAAQ,OAAO,OACnB,CACE,UACA,MAAO,YAET,EACA,EAAQ,eAAiB,CAAE,eAAgB,OAAO,EAAQ,iBAAoB,CAAC,EAC/E,CACE,MACA,SAAU,mBAAmB,CAC3B,WAAY,aACZ,SAAU,EAAQ,UAAY,GAC9B,aAAc,EAAQ,cAAgB,GACtC,cAIN,OAAO,OAAO,OAAO,KAAK,KAAK,KAAM,GAAQ,CAC3C,KAAM,KAAK,KAAK,KAAM,IAE1B,Q","file":"/npm/@octokit/auth-app@8.2.0/dist-node/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@octokit/auth-app@8.2.0/dist-node/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","import { getUserAgent } from \"universal-user-agent\";\nimport { request as defaultRequest } from \"@octokit/request\";\nimport { createOAuthAppAuth } from \"@octokit/auth-oauth-app\";\nimport { auth } from \"./auth.js\";\nimport { hook } from \"./hook.js\";\nimport { getCache } from \"./cache.js\";\nimport { VERSION } from \"./version.js\";\nimport { createOAuthUserAuth } from \"@octokit/auth-oauth-user\";\nfunction createAppAuth(options) {\n  if (!options.appId) {\n    throw new Error(\"[@octokit/auth-app] appId option is required\");\n  }\n  if (!options.privateKey && !options.createJwt) {\n    throw new Error(\"[@octokit/auth-app] privateKey option is required\");\n  } else if (options.privateKey && options.createJwt) {\n    throw new Error(\n      \"[@octokit/auth-app] privateKey and createJwt options are mutually exclusive\"\n    );\n  }\n  if (\"installationId\" in options && !options.installationId) {\n    throw new Error(\n      \"[@octokit/auth-app] installationId is set to a falsy value\"\n    );\n  }\n  const log = options.log || {};\n  if (typeof log.warn !== \"function\") {\n    log.warn = console.warn.bind(console);\n  }\n  const request = options.request || defaultRequest.defaults({\n    headers: {\n      \"user-agent\": `octokit-auth-app.js/${VERSION} ${getUserAgent()}`\n    }\n  });\n  const state = Object.assign(\n    {\n      request,\n      cache: getCache()\n    },\n    options,\n    options.installationId ? { installationId: Number(options.installationId) } : {},\n    {\n      log,\n      oauthApp: createOAuthAppAuth({\n        clientType: \"github-app\",\n        clientId: options.clientId || \"\",\n        clientSecret: options.clientSecret || \"\",\n        request\n      })\n    }\n  );\n  return Object.assign(auth.bind(null, state), {\n    hook: hook.bind(null, state)\n  });\n}\nexport {\n  createAppAuth,\n  createOAuthUserAuth\n};\n","import githubAppJwt from \"universal-github-app-jwt\";\nasync function getAppAuthentication({\n  appId,\n  privateKey,\n  timeDifference,\n  createJwt\n}) {\n  try {\n    if (createJwt) {\n      const { jwt, expiresAt } = await createJwt(appId, timeDifference);\n      return {\n        type: \"app\",\n        token: jwt,\n        appId,\n        expiresAt\n      };\n    }\n    const authOptions = {\n      id: appId,\n      privateKey\n    };\n    if (timeDifference) {\n      Object.assign(authOptions, {\n        now: Math.floor(Date.now() / 1e3) + timeDifference\n      });\n    }\n    const appAuthentication = await githubAppJwt(authOptions);\n    return {\n      type: \"app\",\n      token: appAuthentication.token,\n      appId: appAuthentication.appId,\n      expiresAt: new Date(appAuthentication.expiration * 1e3).toISOString()\n    };\n  } catch (error) {\n    if (privateKey === \"-----BEGIN RSA PRIVATE KEY-----\") {\n      throw new Error(\n        \"The 'privateKey` option contains only the first line '-----BEGIN RSA PRIVATE KEY-----'. If you are setting it using a `.env` file, make sure it is set on a single line with newlines replaced by '\\n'\"\n      );\n    } else {\n      throw error;\n    }\n  }\n}\nexport {\n  getAppAuthentication\n};\n","import { Lru } from \"toad-cache\";\nfunction getCache() {\n  return new Lru(\n    // cache max. 15000 tokens, that will use less than 10mb memory\n    15e3,\n    // Cache for 1 minute less than GitHub expiry\n    1e3 * 60 * 59\n  );\n}\nasync function get(cache, options) {\n  const cacheKey = optionsToCacheKey(options);\n  const result = await cache.get(cacheKey);\n  if (!result) {\n    return;\n  }\n  const [\n    token,\n    createdAt,\n    expiresAt,\n    repositorySelection,\n    permissionsString,\n    singleFileName\n  ] = result.split(\"|\");\n  const permissions = options.permissions || permissionsString.split(/,/).reduce((permissions2, string) => {\n    if (/!$/.test(string)) {\n      permissions2[string.slice(0, -1)] = \"write\";\n    } else {\n      permissions2[string] = \"read\";\n    }\n    return permissions2;\n  }, {});\n  return {\n    token,\n    createdAt,\n    expiresAt,\n    permissions,\n    repositoryIds: options.repositoryIds,\n    repositoryNames: options.repositoryNames,\n    singleFileName,\n    repositorySelection\n  };\n}\nasync function set(cache, options, data) {\n  const key = optionsToCacheKey(options);\n  const permissionsString = options.permissions ? \"\" : Object.keys(data.permissions).map(\n    (name) => `${name}${data.permissions[name] === \"write\" ? \"!\" : \"\"}`\n  ).join(\",\");\n  const value = [\n    data.token,\n    data.createdAt,\n    data.expiresAt,\n    data.repositorySelection,\n    permissionsString,\n    data.singleFileName\n  ].join(\"|\");\n  await cache.set(key, value);\n}\nfunction optionsToCacheKey({\n  installationId,\n  permissions = {},\n  repositoryIds = [],\n  repositoryNames = []\n}) {\n  const permissionsString = Object.keys(permissions).sort().map((name) => permissions[name] === \"read\" ? name : `${name}!`).join(\",\");\n  const repositoryIdsString = repositoryIds.sort().join(\",\");\n  const repositoryNamesString = repositoryNames.join(\",\");\n  return [\n    installationId,\n    repositoryIdsString,\n    repositoryNamesString,\n    permissionsString\n  ].filter(Boolean).join(\"|\");\n}\nexport {\n  get,\n  getCache,\n  optionsToCacheKey,\n  set\n};\n","function toTokenAuthentication({\n  installationId,\n  token,\n  createdAt,\n  expiresAt,\n  repositorySelection,\n  permissions,\n  repositoryIds,\n  repositoryNames,\n  singleFileName\n}) {\n  return Object.assign(\n    {\n      type: \"token\",\n      tokenType: \"installation\",\n      token,\n      installationId,\n      permissions,\n      createdAt,\n      expiresAt,\n      repositorySelection\n    },\n    repositoryIds ? { repositoryIds } : null,\n    repositoryNames ? { repositoryNames } : null,\n    singleFileName ? { singleFileName } : null\n  );\n}\nexport {\n  toTokenAuthentication\n};\n","import { get, optionsToCacheKey, set } from \"./cache.js\";\nimport { getAppAuthentication } from \"./get-app-authentication.js\";\nimport { toTokenAuthentication } from \"./to-token-authentication.js\";\nasync function getInstallationAuthentication(state, options, customRequest) {\n  const installationId = Number(options.installationId || state.installationId);\n  if (!installationId) {\n    throw new Error(\n      \"[@octokit/auth-app] installationId option is required for installation authentication.\"\n    );\n  }\n  if (options.factory) {\n    const { type, factory, oauthApp, ...factoryAuthOptions } = {\n      ...state,\n      ...options\n    };\n    return factory(factoryAuthOptions);\n  }\n  const request = customRequest || state.request;\n  return getInstallationAuthenticationConcurrently(\n    state,\n    { ...options, installationId },\n    request\n  );\n}\nconst pendingPromises = /* @__PURE__ */ new Map();\nfunction getInstallationAuthenticationConcurrently(state, options, request) {\n  const cacheKey = optionsToCacheKey(options);\n  if (pendingPromises.has(cacheKey)) {\n    return pendingPromises.get(cacheKey);\n  }\n  const promise = getInstallationAuthenticationImpl(\n    state,\n    options,\n    request\n  ).finally(() => pendingPromises.delete(cacheKey));\n  pendingPromises.set(cacheKey, promise);\n  return promise;\n}\nasync function getInstallationAuthenticationImpl(state, options, request) {\n  if (!options.refresh) {\n    const result = await get(state.cache, options);\n    if (result) {\n      const {\n        token: token2,\n        createdAt: createdAt2,\n        expiresAt: expiresAt2,\n        permissions: permissions2,\n        repositoryIds: repositoryIds2,\n        repositoryNames: repositoryNames2,\n        singleFileName: singleFileName2,\n        repositorySelection: repositorySelection2\n      } = result;\n      return toTokenAuthentication({\n        installationId: options.installationId,\n        token: token2,\n        createdAt: createdAt2,\n        expiresAt: expiresAt2,\n        permissions: permissions2,\n        repositorySelection: repositorySelection2,\n        repositoryIds: repositoryIds2,\n        repositoryNames: repositoryNames2,\n        singleFileName: singleFileName2\n      });\n    }\n  }\n  const appAuthentication = await getAppAuthentication(state);\n  const payload = {\n    installation_id: options.installationId,\n    mediaType: {\n      previews: [\"machine-man\"]\n    },\n    headers: {\n      authorization: `bearer ${appAuthentication.token}`\n    }\n  };\n  if (options.repositoryIds) {\n    Object.assign(payload, { repository_ids: options.repositoryIds });\n  }\n  if (options.repositoryNames) {\n    Object.assign(payload, {\n      repositories: options.repositoryNames\n    });\n  }\n  if (options.permissions) {\n    Object.assign(payload, { permissions: options.permissions });\n  }\n  const {\n    data: {\n      token,\n      expires_at: expiresAt,\n      repositories,\n      permissions: permissionsOptional,\n      repository_selection: repositorySelectionOptional,\n      single_file: singleFileName\n    }\n  } = await request(\n    \"POST /app/installations/{installation_id}/access_tokens\",\n    payload\n  );\n  const permissions = permissionsOptional || {};\n  const repositorySelection = repositorySelectionOptional || \"all\";\n  const repositoryIds = repositories ? repositories.map((r) => r.id) : void 0;\n  const repositoryNames = repositories ? repositories.map((repo) => repo.name) : void 0;\n  const createdAt = (/* @__PURE__ */ new Date()).toISOString();\n  const cacheOptions = {\n    token,\n    createdAt,\n    expiresAt,\n    repositorySelection,\n    permissions,\n    repositoryIds,\n    repositoryNames\n  };\n  if (singleFileName) {\n    Object.assign(payload, { singleFileName });\n  }\n  await set(state.cache, options, cacheOptions);\n  const cacheData = {\n    installationId: options.installationId,\n    token,\n    createdAt,\n    expiresAt,\n    repositorySelection,\n    permissions,\n    repositoryIds,\n    repositoryNames\n  };\n  if (singleFileName) {\n    Object.assign(cacheData, { singleFileName });\n  }\n  return toTokenAuthentication(cacheData);\n}\nexport {\n  getInstallationAuthentication\n};\n","import { getAppAuthentication } from \"./get-app-authentication.js\";\nimport { getInstallationAuthentication } from \"./get-installation-authentication.js\";\nasync function auth(state, authOptions) {\n  switch (authOptions.type) {\n    case \"app\":\n      return getAppAuthentication(state);\n    case \"oauth-app\":\n      return state.oauthApp({ type: \"oauth-app\" });\n    case \"installation\":\n      authOptions;\n      return getInstallationAuthentication(state, {\n        ...authOptions,\n        type: \"installation\"\n      });\n    case \"oauth-user\":\n      return state.oauthApp(authOptions);\n    default:\n      throw new Error(`Invalid auth type: ${authOptions.type}`);\n  }\n}\nexport {\n  auth\n};\n","import { requiresBasicAuth } from \"@octokit/auth-oauth-user\";\nimport { RequestError } from \"@octokit/request-error\";\nimport { getAppAuthentication } from \"./get-app-authentication.js\";\nimport { getInstallationAuthentication } from \"./get-installation-authentication.js\";\nimport { requiresAppAuth } from \"./requires-app-auth.js\";\nconst FIVE_SECONDS_IN_MS = 5 * 1e3;\nfunction isNotTimeSkewError(error) {\n  return !(error.message.match(\n    /'Expiration time' claim \\('exp'\\) is too far in the future/\n  ) || error.message.match(\n    /'Expiration time' claim \\('exp'\\) must be a numeric value representing the future time at which the assertion expires/\n  ) || error.message.match(\n    /'Issued at' claim \\('iat'\\) must be an Integer representing the time that the assertion was issued/\n  ));\n}\nasync function hook(state, request, route, parameters) {\n  const endpoint = request.endpoint.merge(route, parameters);\n  const url = endpoint.url;\n  if (/\\/login\\/oauth\\/access_token$/.test(url)) {\n    return request(endpoint);\n  }\n  if (requiresAppAuth(url.replace(request.endpoint.DEFAULTS.baseUrl, \"\"))) {\n    const { token: token2 } = await getAppAuthentication(state);\n    endpoint.headers.authorization = `bearer ${token2}`;\n    let response;\n    try {\n      response = await request(endpoint);\n    } catch (error) {\n      if (isNotTimeSkewError(error)) {\n        throw error;\n      }\n      if (typeof error.response.headers.date === \"undefined\") {\n        throw error;\n      }\n      const diff = Math.floor(\n        (Date.parse(error.response.headers.date) - Date.parse((/* @__PURE__ */ new Date()).toString())) / 1e3\n      );\n      state.log.warn(error.message);\n      state.log.warn(\n        `[@octokit/auth-app] GitHub API time and system time are different by ${diff} seconds. Retrying request with the difference accounted for.`\n      );\n      const { token: token3 } = await getAppAuthentication({\n        ...state,\n        timeDifference: diff\n      });\n      endpoint.headers.authorization = `bearer ${token3}`;\n      return request(endpoint);\n    }\n    return response;\n  }\n  if (requiresBasicAuth(url)) {\n    const authentication = await state.oauthApp({ type: \"oauth-app\" });\n    endpoint.headers.authorization = authentication.headers.authorization;\n    return request(endpoint);\n  }\n  const { token, createdAt } = await getInstallationAuthentication(\n    state,\n    // @ts-expect-error TBD\n    {},\n    request.defaults({ baseUrl: endpoint.baseUrl })\n  );\n  endpoint.headers.authorization = `token ${token}`;\n  return sendRequestWithRetries(\n    state,\n    request,\n    endpoint,\n    createdAt\n  );\n}\nasync function sendRequestWithRetries(state, request, options, createdAt, retries = 0) {\n  const timeSinceTokenCreationInMs = +/* @__PURE__ */ new Date() - +new Date(createdAt);\n  try {\n    return await request(options);\n  } catch (error) {\n    if (error.status !== 401) {\n      throw error;\n    }\n    if (timeSinceTokenCreationInMs >= FIVE_SECONDS_IN_MS) {\n      if (retries > 0) {\n        error.message = `After ${retries} retries within ${timeSinceTokenCreationInMs / 1e3}s of creating the installation access token, the response remains 401. At this point, the cause may be an authentication problem or a system outage. Please check https://www.githubstatus.com for status information`;\n      }\n      throw error;\n    }\n    ++retries;\n    const awaitTime = retries * 1e3;\n    state.log.warn(\n      `[@octokit/auth-app] Retrying after 401 response to account for token replication delay (retry: ${retries}, wait: ${awaitTime / 1e3}s)`\n    );\n    await new Promise((resolve) => setTimeout(resolve, awaitTime));\n    return sendRequestWithRetries(state, request, options, createdAt, retries);\n  }\n}\nexport {\n  hook\n};\n","const PATHS = [\n  \"/app\",\n  \"/app/hook/config\",\n  \"/app/hook/deliveries\",\n  \"/app/hook/deliveries/{delivery_id}\",\n  \"/app/hook/deliveries/{delivery_id}/attempts\",\n  \"/app/installations\",\n  \"/app/installations/{installation_id}\",\n  \"/app/installations/{installation_id}/access_tokens\",\n  \"/app/installations/{installation_id}/suspended\",\n  \"/app/installation-requests\",\n  \"/marketplace_listing/accounts/{account_id}\",\n  \"/marketplace_listing/plan\",\n  \"/marketplace_listing/plans\",\n  \"/marketplace_listing/plans/{plan_id}/accounts\",\n  \"/marketplace_listing/stubbed/accounts/{account_id}\",\n  \"/marketplace_listing/stubbed/plan\",\n  \"/marketplace_listing/stubbed/plans\",\n  \"/marketplace_listing/stubbed/plans/{plan_id}/accounts\",\n  \"/orgs/{org}/installation\",\n  \"/repos/{owner}/{repo}/installation\",\n  \"/users/{username}/installation\",\n  \"/enterprises/{enterprise}/installation\"\n];\nfunction routeMatcher(paths) {\n  const regexes = paths.map(\n    (p) => p.split(\"/\").map((c) => c.startsWith(\"{\") ? \"(?:.+?)\" : c).join(\"/\")\n  );\n  const regex = `^(?:${regexes.map((r) => `(?:${r})`).join(\"|\")})$`;\n  return new RegExp(regex, \"i\");\n}\nconst REGEX = routeMatcher(PATHS);\nfunction requiresAppAuth(url) {\n  return !!url && REGEX.test(url.split(\"?\")[0]);\n}\nexport {\n  requiresAppAuth\n};\n","const VERSION = \"8.2.0\";\nexport {\n  VERSION\n};\n"]}