{
  "version": 3,
  "sources": ["../dist-src/index.js"],
  "sourcesContent": ["function oauthAuthorizationUrl(options) {\n  const clientType = options.clientType || \"oauth-app\";\n  const baseUrl = options.baseUrl || \"https://github.com\";\n  const result = {\n    clientType,\n    allowSignup: options.allowSignup === false ? false : true,\n    clientId: options.clientId,\n    login: options.login || null,\n    redirectUrl: options.redirectUrl || null,\n    state: options.state || Math.random().toString(36).substr(2),\n    url: \"\"\n  };\n  if (clientType === \"oauth-app\") {\n    const scopes = \"scopes\" in options ? options.scopes : [];\n    result.scopes = typeof scopes === \"string\" ? scopes.split(/[,\\s]+/).filter(Boolean) : scopes;\n  }\n  result.url = urlBuilderAuthorize(`${baseUrl}/login/oauth/authorize`, result);\n  return result;\n}\nfunction urlBuilderAuthorize(base, options) {\n  const map = {\n    allowSignup: \"allow_signup\",\n    clientId: \"client_id\",\n    login: \"login\",\n    redirectUrl: \"redirect_uri\",\n    scopes: \"scope\",\n    state: \"state\"\n  };\n  let url = base;\n  Object.keys(map).filter((k) => options[k] !== null).filter((k) => {\n    if (k !== \"scopes\")\n      return true;\n    if (options.clientType === \"github-app\")\n      return false;\n    return !Array.isArray(options[k]) || options[k].length > 0;\n  }).map((key) => [map[key], `${options[key]}`]).forEach(([key, value], index) => {\n    url += index === 0 ? `?` : \"&\";\n    url += `${key}=${encodeURIComponent(value)}`;\n  });\n  return url;\n}\nexport {\n  oauthAuthorizationUrl\n};\n"],
  "mappings": ";AAAA,SAAS,sBAAsB,SAAS;AACtC,QAAM,aAAa,QAAQ,cAAc;AACzC,QAAM,UAAU,QAAQ,WAAW;AACnC,QAAM,SAAS;AAAA,IACb;AAAA,IACA,aAAa,QAAQ,gBAAgB,QAAQ,QAAQ;AAAA,IACrD,UAAU,QAAQ;AAAA,IAClB,OAAO,QAAQ,SAAS;AAAA,IACxB,aAAa,QAAQ,eAAe;AAAA,IACpC,OAAO,QAAQ,SAAS,KAAK,OAAO,EAAE,SAAS,EAAE,EAAE,OAAO,CAAC;AAAA,I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