{
  "version": 3,
  "sources": ["../dist-src/index.js", "../dist-src/auth.js", "../dist-src/hook.js", "../dist-src/version.js"],
  "sourcesContent": ["import { getUserAgent } from \"universal-user-agent\";\nimport { request } from \"@octokit/request\";\nimport { auth } from \"./auth\";\nimport { hook } from \"./hook\";\nimport { VERSION } from \"./version\";\nimport { createOAuthUserAuth } from \"@octokit/auth-oauth-user\";\nfunction createOAuthAppAuth(options) {\n  const state = Object.assign(\n    {\n      request: request.defaults({\n        headers: {\n          \"user-agent\": `octokit-auth-oauth-app.js/${VERSION} ${getUserAgent()}`\n        }\n      }),\n      clientType: \"oauth-app\"\n    },\n    options\n  );\n  return Object.assign(auth.bind(null, state), {\n    hook: hook.bind(null, state)\n  });\n}\nexport {\n  createOAuthAppAuth,\n  createOAuthUserAuth\n};\n", "import btoa from \"btoa-lite\";\nimport { createOAuthUserAuth } from \"@octokit/auth-oauth-user\";\nasync function auth(state, authOptions) {\n  if (authOptions.type === \"oauth-app\") {\n    return {\n      type: \"oauth-app\",\n      clientId: state.clientId,\n      clientSecret: state.clientSecret,\n      clientType: state.clientType,\n      headers: {\n        authorization: `basic ${btoa(\n          `${state.clientId}:${state.clientSecret}`\n        )}`\n      }\n    };\n  }\n  if (\"factory\" in authOptions) {\n    const { type, ...options } = {\n      ...authOptions,\n      ...state\n    };\n    return authOptions.factory(options);\n  }\n  const common = {\n    clientId: state.clientId,\n    clientSecret: state.clientSecret,\n    request: state.request,\n    ...authOptions\n  };\n  const userAuth = state.clientType === \"oauth-app\" ? await createOAuthUserAuth({\n    ...common,\n    clientType: state.clientType\n  }) : await createOAuthUserAuth({\n    ...common,\n    clientType: state.clientType\n  });\n  return userAuth();\n}\nexport {\n  auth\n};\n", "import btoa from \"btoa-lite\";\nimport { requiresBasicAuth } from \"@octokit/auth-oauth-user\";\nasync function hook(state, request, route, parameters) {\n  let endpoint = request.endpoint.merge(\n    route,\n    parameters\n  );\n  if (/\\/login\\/(oauth\\/access_token|device\\/code)$/.test(endpoint.url)) {\n    return request(endpoint);\n  }\n  if (state.clientType === \"github-app\" && !requiresBasicAuth(endpoint.url)) {\n    throw new Error(\n      `[@octokit/auth-oauth-app] GitHub Apps cannot use their client ID/secret for basic authentication for endpoints other than \"/applications/{client_id}/**\". \"${endpoint.method} ${endpoint.url}\" is not supported.`\n    );\n  }\n  const credentials = btoa(`${state.clientId}:${state.clientSecret}`);\n  endpoint.headers.authorization = `basic ${credentials}`;\n  try {\n    return await request(endpoint);\n  } catch (error) {\n    if (error.status !== 401)\n      throw error;\n    error.message = `[@octokit/auth-oauth-app] \"${endpoint.method} ${endpoint.url}\" does not support clientId/clientSecret basic authentication.`;\n    throw error;\n  }\n}\nexport {\n  hook\n};\n", "const VERSION = \"5.0.6\";\nexport {\n  VERSION\n};\n"],
  "mappings": ";AAAA,SAAS,oBAAoB;AAC7B,SAAS,eAAe;;;ACDxB,OAAO,UAAU;AACjB,SAAS,2BAA2B;AACpC,eAAe,KAAK,OAAO,aAAa;AACtC,MAAI,YAAY,SAAS,aAAa;AACpC,WAAO;AAAA,MACL,MAAM;AAAA,MACN,UAAU,MAAM;AAAA,MAChB,cAAc,MAAM;AAAA,MACpB,YAAY,MAAM;AAAA,MAClB,SAAS;AAAA,QACP,eAAe,SAAS;AAAA,UACtB,GAAG,MAAM,YAAY,MAAM;AAAA,QAC7B;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACA,MAAI,aAAa,aAAa;AAC5B,UAAM,EAAE,MAAM,GAAG,QAAQ,IAAI;AAAA,MAC3B,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AACA,WAAO,YAAY,QAAQ,OAAO;AAAA,EACpC;AACA,QAAM,SAAS;AAAA,IACb,UAAU,MAAM;AAAA,IAChB,cAAc,MAAM;AAAA,IACpB,SAAS,MAAM;AAAA,IACf,GAAG;AAAA,EACL;AACA,QAAM,WAAW,MAAM,eAAe,cAAc,MAAM,oBAAoB;AAAA,IAC5E,GAAG;AAAA,IACH,YAAY,MAAM;AAAA,EACpB,C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