{
  "version": 3,
  "sources": ["captcha.js"],
  "sourcesContent": ["import $ from \"./jquery.js\";\nimport { hasWebCrypto, solveChallenge } from \"./captcha-solver.js\";\nimport { config } from \"./config.js\";\nimport { latent } from \"./latent.js\";\nimport { apiUrl } from \"./urls.js\";\n\n/** The header a solved challenge travels in - see `require_captcha`. */\nexport const CAPTCHA_HEADER = \"X-Photo-Captcha\";\n/** What the API answers a request that needed one and came without. */\nexport const CAPTCHA_REQUIRED = \"captcha_required\";\n\n/**\n * The captcha: a proof of work done unseen, which the API asks of some of the\n * requests open to anyone (`CaptchaService`). Gets a fresh challenge, solves\n * it (`captcha-solver.js`) and resolves with what the request is to carry in\n * `CAPTCHA_HEADER` - good for one request. Rejects when the browser cannot\n * do it.\n *\n * NOTE: Called by `core/api.js` alone, which sends it with a request marked\n *       `captcha: true` and with any request the API answered\n *       `captcha_required` - a module never asks for one itself.\n */\nexport async function solveCaptcha() {\n    const challenge = await $.ajax({\n        url: apiUrl(\"captcha.challenge\"),\n        silent: true,\n        unauthorizedRedirect: false,\n    });\n    if (!hasWebCrypto()) {\n        latent.record(\"captcha.fallback_solver_used\");\n    }\n    const solution = await solveChallenge(challenge, config.captcha.workerUrls);\n    return btoa(JSON.stringify({ challenge, solution }));\n}\n"],
  "mappings": "AAAA,OAAOA,MAAO,cACd,OAAS,gBAAAC,EAAc,kBAAAC,MAAsB,sBAC7C,OAAS,UAAAC,MAAc,cACvB,OAAS,UAAAC,MAAc,cACvB,OAAS,UAAAC,MAAc,YAGhB,aAAM,eAAiB,kBAEjB,iBAAmB,mBAahC,sBAAsB,cAAe,CACjC,MAAMC,EAAY,MAAMN,EAAE,KAAK,CAC3B,IAAKK,EAAO,mBAAmB,EAC/B,OAAQ,GACR,qBAAsB,EAC1B,CAAC,EACIJ,EAAa,GACdG,EAAO,OAAO,8BAA8B,EAEhD,MAAMG,EAAW,MAAML,EAAeI,EAAWH,EAAO,QAAQ,UAAU,EAC1E,OAAO,KAAK,KAAK,UAAU,CAAE,UAAAG,EAAW,SAAAC,CAAS,CAAC,CAAC,CACvD",
  "names": ["$", "hasWebCrypto", "solveChallenge", "config", "latent", "apiUrl", "challenge", "solution"]
}
