{
  "version": 3,
  "sources": ["../../js/lib/extensions.ts", "../../js/lib/backoff.ts", "../../js/lib/worker.ts", "../../js/algorithms/fast.ts", "../../../node_modules/wasm-feature-detect/dist/esm/index.js", "../../js/lib/wasm-supported.ts", "../../js/algorithms/wasm2js.ts", "../../js/algorithms/wasm.ts", "../../js/algorithms/index.ts", "../../js/lib/xeact.mjs", "../../js/main.ts"],
  "sourcesContent": ["declare global {\n  interface Window {\n    // Work registered by challenge extension scripts.\n    __anubisExtensions?: Promise<unknown>[];\n  }\n}\n\n/**\n * Register an extension with the global Anubis extensions array.\n *\n * This makes challenge passing block on extension functions\n * finishing.\n *\n * @param ext - the async promise associated with the extension.\n */\nexport function registerExtension(ext: Promise<unknown>) {\n  window.__anubisExtensions ??= [];\n  window.__anubisExtensions.push(ext);\n}\n\n/**\n * Wait for challenge extensions to finish work and submit data to\n * the server. Gives up after timeoutMs.\n *\n * Choose timeoutMs carefully, a longer value makes clients wait\n * longer, which can cause user complaints.\n *\n * @param [timeoutMs=5000] - the timeout for extension functions\n */\nexport async function waitForExtensions(timeoutMs: number = 5000): Promise<void> {\n  const pending = window.__anubisExtensions ?? [];\n  if (pending.length === 0) {\n    return;\n  }\n\n  // XXX(Xe): Normally you'd use Promise.allSettled here, but that is\n  // a Chrome 76 feature. CI tests down to Chrome 75 and for safety's\n  // sake the JS is compiled with Chrome 66 in mind. As such, polyfill\n  // Promise.allSettled by just mapping over the pending promises the\n  // hard way.\n  const settled = Promise.all(\n    pending.map(p => Promise.resolve(p).catch(() => undefined))\n  );\n\n  let timer: ReturnType<typeof setTimeout> | undefined = undefined;\n  const timeout = new Promise<void>((resolve) => {\n    timer = setTimeout(resolve, timeoutMs);\n  });\n\n  await Promise.race([settled, timeout]);\n  clearTimeout(timer);\n}", "// Retry helpers for fetching challenge assets.\n//\n// In order to load things reliably, Anubis needs to have the ability to load\n// JavaScript and other assets using exponential backoff as the assets every\n// challenge page needs come from the same server that's also being hammered.\n// Due to facts and circumstances dating back to the legacy design of the proof\n// of work client code, any failure of loading any assets causes the entire\n// process to fail, which causes an error for the client, which makes the user\n// refresh the page, which adds yet more load.\n//\n// These helpers make those fetches survive transient failures at the cost of\n// using sleep-based exponential backoff, which is an acceptable tradeoff.\n\nexport interface BackoffOptions {\n  attempts?: number;\n  baseDelayMs?: number;\n  maxDelayMs?: number;\n  signal?: AbortSignal | null;\n}\n\nconst DEFAULT_ATTEMPTS = 5;\nconst DEFAULT_BASE_DELAY_MS = 750;\nconst DEFAULT_MAX_DELAY_MS = 10000;\n\n// HTTP status codes that make the request work retrying. Everything else is\n// considered a permanent error and not retried.\nconst RETRYABLE_STATUSES = [\n  408, // Request Timeout\n  425, // Too Early\n  429, // Too Many Requests\n  500, // Internal Server Error\n  502, // Bad Gateway\n  503, // Service Unavailable\n  504, // Gateway Timeout\n];\n\n// XXX(Xe): we need to check the exception by name rather than by\n// `instanceof DOMException` because not every engine that can abort a `fetch`\n// throws a `DOMException` to signal it. I hate it too.\nexport const isAbortError = (err: unknown): boolean =>\n  err != null && typeof err === \"object\" && (err as any).name === \"AbortError\";\n\nconst abortError = () => new DOMException(\"Aborted\", \"AbortError\");\n\n/** sleep resolves after ms milliseconds, or rejects early if signal aborts. */\nexport const sleep = (ms: number, signal?: AbortSignal | null): Promise<void> =>\n  new Promise((resolve, reject) => {\n    if (signal != null && signal.aborted) {\n      reject(abortError());\n      return;\n    }\n\n    const onAbort = () => {\n      clearTimeout(timer);\n      reject(abortError());\n    };\n\n    const timer = setTimeout(() => {\n      if (signal != null) {\n        signal.removeEventListener(\"abort\", onAbort);\n      }\n      resolve();\n    }, ms);\n\n    if (signal != null) {\n      signal.addEventListener(\"abort\", onAbort, { once: true });\n    }\n  });\n\n/**\n * backoffDelay returns a \"full jitter\" exponential backoff delay.\n *\n * This ensures that clients retry actions with exponential backoff\n * including random jitter in order to avoid thundering herd problems.\n *\n * This maxes out at `maxDelayMs` so that you can set the maximum\n * delay threshold to improve user experience.\n */\nexport const backoffDelay = (\n  attempt: number,\n  baseDelayMs: number = DEFAULT_BASE_DELAY_MS,\n  maxDelayMs: number = DEFAULT_MAX_DELAY_MS,\n): number =>\n  Math.random() * Math.min(maxDelayMs, baseDelayMs * Math.pow(attempt, 2));\n\n/**\n * retryAfterMs parses a Retry-After header into milliseconds, in either the\n * delta-seconds or the HTTP-date form. Returns null when absent or unparseable.\n *\n * Anubis doesn't currently return this header, but HTTP middleware in the critical\n * path may end up doing so. In order to be defensive it is better to just handle\n * this before it becomes an issue.\n */\nconst retryAfterMs = (response: Response): number | null => {\n  const header = response.headers.get(\"Retry-After\");\n  if (header === null) {\n    return null;\n  }\n\n  const seconds = Number(header);\n  if (Number.isFinite(seconds)) {\n    return Math.max(0, seconds * 1000);\n  }\n\n  const deadline = Date.parse(header);\n  if (Number.isNaN(deadline)) {\n    return null;\n  }\n\n  return Math.max(0, deadline - Date.now());\n};\n\n/**\n * fetchWithBackoff attempts to do a basic GET fetch of url, retrying\n * transient failures with jittered exponential backoff. It rejects with\n * the last error once attempts are exhausted, immediately on a\n * non-retryable status code, or with an AbortError if the cancellation\n * signal fires.\n */\nexport const fetchWithBackoff = async (\n  url: string,\n  options: BackoffOptions = {},\n): Promise<Response> => {\n  // populate default options\n  const attempts = options.attempts ?? DEFAULT_ATTEMPTS;\n  const baseDelayMs = options.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;\n  const maxDelayMs = options.maxDelayMs ?? DEFAULT_MAX_DELAY_MS;\n  const signal = options.signal ?? null;\n\n  let lastError: Error = new Error(`anubis: ${url} could not be fetched`);\n\n  // If the server told us how long to wait, we wait for this number of\n  // milliseconds instead of using the computed exponential backoff.\n  let serverDelayMs: number | null = null;\n\n  for (let attempt = 0; attempt < attempts; attempt++) {\n    if (attempt > 0) {\n      const delay =\n        serverDelayMs !== null\n          ? serverDelayMs\n          : backoffDelay(attempt - 1, baseDelayMs, maxDelayMs);\n      serverDelayMs = null;\n      await sleep(delay, signal);\n    }\n\n    let response: Response;\n    try {\n      response = await fetch(url, signal === null ? {} : { signal });\n    } catch (err) {\n      if (isAbortError(err)) {\n        throw err;\n      }\n      // If there is a network-level failure such as DNS resolution failure,\n      // connection reset, or a server hang-up: this is the signature of an\n      // overloaded server. Keep trying after backing off.\n      lastError = err instanceof Error ? err : new Error(String(err));\n      continue;\n    }\n\n    if (response.ok) {\n      return response;\n    }\n\n    lastError = new Error(\n      `anubis: ${url} returned HTTP ${response.status} (unretryable failure)`,\n    );\n\n    if (RETRYABLE_STATUSES.indexOf(response.status) === -1) {\n      throw lastError;\n    }\n\n    // XXX(Xe): Honor the server's Retry-After response header but use common\n    // sense: a misconfigured (or actively hostile) upstream should not be\n    // able to park the client for an hour or something ridiculous like that.\n    const requested = retryAfterMs(response);\n    if (requested !== null) {\n      serverDelayMs = Math.min(requested, maxDelayMs);\n    }\n  }\n\n  throw lastError;\n};\n", "import { fetchWithBackoff, isAbortError } from \"@lib/backoff\";\n\nexport const getHardwareConcurrency = () =>\n  navigator.hardwareConcurrency !== undefined\n    ? navigator.hardwareConcurrency\n    : 1;\n\nexport type ProgressCallback = (nonce: number | string) => void;\n\nexport interface ProcessOptions {\n  basePrefix: string;\n  version: string;\n  algorithm: string;\n}\n\nexport interface ProcessResult {\n  hash: string;\n  // The WASM workers don't echo the challenge data back, only the sha256\n  // workers do. Nothing reads it, so it's optional rather than a lie.\n  data?: string;\n  difficulty: number;\n  nonce: number;\n}\n\nexport interface WorkerArgs {\n  data: string;\n  difficulty: number;\n  nonce: number;\n  threads: number;\n}\n\n// A spawner hands out workers that all run the same script. Which flavour of\n// spawner we get depends on whether we could pre-fetch the worker source.\nexport interface WorkerSpawner {\n  // spawn a single worker based on the template\n  spawn: () => Worker;\n  // demote to fallback/less efficient logic instead of using more efficient\n  // logic.\n  demote: () => boolean;\n  // destroy this instance, manual cleanup logic so you don't leak Blob\n  // instances, etc.\n  dispose: () => void;\n}\n\nexport const directSpawner = (webWorkerURL: string): WorkerSpawner => {\n  return {\n    spawn: () => new Worker(webWorkerURL),\n    demote: () => false,\n    dispose: () => {},\n  };\n};\n\n/**\n * createWorkerSpawner fetches the worker source _once_ and hands back a\n * WorkerSpawner instance and hands back a spawner backed by a Blob URL\n * instead of making each worker fetch the worker code individually.\n *\n * Doing it this way prevents a single client with many threads fetching\n * the same worker source code n times for values that are fixed for the\n * entire lifetime of the deployment of Anubis at that version. The old\n * method made a client with 8 threads fetch the worker logic 8 times,\n * which made an overloaded server even more overloaded, causing spurious\n * failures, which cause challenges to fail 100% of the time. This is\n * bad for uptime.\n *\n * Annoyingly, `new Worker(url)` reports a load failure as an opaque event\n * that does not include the status code of the failed load, so there's\n * no real way to detect \"503, back off and retry\" from \"404, you fetched\n * the wrong asset\". To work around this we have to `fetch()` the contents\n * of the worker code and spawn it with a Blob.\n *\n * If anything goes wrong or the server's Content-Security-Policy (CSP)\n * forbids putting worker sources in Blobs, we fall back to the old behaviour\n * with the caveat that doing this is kinda hacky and terrible, but such is\n * life.\n */\nexport const createWorkerSpawner = async (\n  webWorkerURL: string,\n  signal: AbortSignal | null,\n): Promise<WorkerSpawner> => {\n  const direct: WorkerSpawner = directSpawner(webWorkerURL);\n\n  let blobURL: string;\n  try {\n    const response = await fetchWithBackoff(webWorkerURL, { signal });\n    blobURL = URL.createObjectURL(\n      new Blob([await response.text()], { type: \"text/javascript\" }),\n    );\n  } catch (err) {\n    if (isAbortError(err)) {\n      throw err;\n    }\n    // Every retry failed. Fall through to the direct spawner anyway: the\n    // browser may still have a cached copy that `fetch` did not surface, and a\n    // long shot beats a guaranteed failure.\n    console.warn(\n      \"anubis: could not pre-fetch worker source (server may be under attack) using direct spawner in the vain hope that this works\",\n      err,\n    );\n    return direct;\n  }\n\n  let useBlob = true;\n\n  return {\n    spawn: (): Worker => {\n      if (useBlob) {\n        try {\n          return new Worker(blobURL);\n        } catch (err) {\n          // XXX(Xe): Chrome, Firefox, and WebKit won't trigger this, but it's best\n          // to be defensive here.\n          console.warn(\"anubis: blob worker rejected, using direct URL\", err);\n          useBlob = false;\n        }\n      }\n      return new Worker(webWorkerURL);\n    },\n    demote: (): boolean => {\n      if (!useBlob) {\n        return false;\n      }\n\n      console.warn(\n        \"anubis: blob workers are not running, falling back to loading workers from their own URL (does this site's Content-Security-Policy allow blob: in worker-src?)\",\n      );\n      useBlob = false;\n      return true;\n    },\n    dispose: (): void => URL.revokeObjectURL(blobURL),\n  };\n};\n\n/**\n * workerError pulls the error message out of a worker's failure report, or\n * returns null when the payload is an ordinary result.\n */\nconst workerError = (data: unknown): string | null => {\n  if (data == null || typeof data !== \"object\") {\n    return null;\n  }\n  const err = (data as { error?: unknown }).error;\n  return err == null ? null : String(err);\n};\n\n/** defaultThreads is how many workers a challenge spawns when not told otherwise. */\nexport const defaultThreads = (): number =>\n  Math.trunc(Math.max(getHardwareConcurrency() / 2, 1));\n\nexport interface RunWorkersOptions {\n  // URL of the worker script to run.\n  webWorkerURL: string;\n  // Fields merged into every worker's postMessage payload. Each worker also\n  // gets its own `nonce` (its lane) and the total `threads` count.\n  message: Record<string, unknown>;\n  threads: number;\n  signal: AbortSignal | null;\n  progressCallback?: ProgressCallback;\n}\n\n/**\n * runWorkers fans a challenge out across `threads` workers and resolves with\n * the first solution any of them finds.\n *\n * Every challenge algorithm shares this because every one of them has the same\n * failure modes: a server too overloaded to serve the worker script, a\n * Content-Security-Policy that forbids blob: workers, and workers that die\n * partway through. Solving those once here keeps the algorithms from drifting\n * apart on the parts that decide whether a user gets through at all.\n */\nexport const runWorkers = async (\n  opts: RunWorkersOptions,\n): Promise<ProcessResult> => {\n  const spawner = await createWorkerSpawner(opts.webWorkerURL, opts.signal);\n\n  try {\n    return await raceWorkers(spawner, opts);\n  } finally {\n    spawner.dispose();\n  }\n};\n\nconst raceWorkers = (\n  spawner: WorkerSpawner,\n  { message, threads, signal, progressCallback }: RunWorkersOptions,\n): Promise<ProcessResult> => {\n  return new Promise((resolve, reject) => {\n    let workers: Worker[] = [];\n    let settled = false;\n    let deadWorkers = 0;\n    // XXX(Xe): sentinel for workers, if this is not set then a CSP refused\n    // to load scripts normally.\n    let anyOutput = false;\n\n    const onAbort = () => {\n      console.log(\"PoW aborted\");\n      cleanup();\n      reject(new DOMException(\"Aborted\", \"AbortError\"));\n    };\n\n    const stopWorkers = () => {\n      workers.forEach((w) => {\n        w.onmessage = null;\n        w.onerror = null;\n        w.terminate();\n      });\n      workers = [];\n    };\n\n    const cleanup = () => {\n      if (settled) {\n        return;\n      }\n      settled = true;\n      stopWorkers();\n      if (signal != null) {\n        signal.removeEventListener(\"abort\", onAbort);\n      }\n    };\n\n    if (signal != null) {\n      if (signal.aborted) {\n        return onAbort();\n      }\n      signal.addEventListener(\"abort\", onAbort, { once: true });\n    }\n\n    const startWorkers = () => {\n      deadWorkers = 0;\n\n      for (let i = 0; i < threads; i++) {\n        let worker: Worker;\n        try {\n          worker = spawner.spawn();\n        } catch (err) {\n          // If we can't spawn workers, we're in a weird place. Throw an error\n          // up the stack and kill the workers so they don't burn CPU and try\n          // to send a message that won't be read.\n          cleanup();\n          reject(\n            new Error(\n              `anubis: could not start proof of work worker: ${err} (is your browser out of date?)`,\n            ),\n          );\n          return;\n        }\n\n        workers.push(worker);\n\n        worker.onmessage = (event) => {\n          // Feed the watchdog.\n          anyOutput = true;\n\n          if (typeof event.data === \"number\") {\n            progressCallback?.(event.data);\n            return;\n          }\n\n          // XXX(Xe): Workers register `async` message handlers, and a promise\n          // that rejects inside one of those surfaces as an unhandledrejection\n          // in the worker, not as an `error` event on this side. Workers report\n          // those failures by hand so that they can't hang the page forever.\n          const err = workerError(event.data);\n          if (err !== null) {\n            cleanup();\n            reject(new Error(`anubis: proof of work worker failed: ${err}`));\n            return;\n          }\n\n          cleanup();\n          resolve(event.data);\n        };\n\n        const workerDied = (event: unknown) => {\n          // XXX(Xe): Workers should generally be inerrant. If any of them has\n          // died before producing any output then they have never ran because\n          // the browser explicitly rejected the worker script due to an overly\n          // strict Content-Security-Policy.\n          //\n          // Annoyingly, this isn't something that's easy to catch and validate\n          // so we just check to make sure that we've seen at least _any_ output\n          // from the worker and if we haven't then try to run the fallback\n          // logic that makes N requests for N = getHardwareConcurrency().\n          //\n          // This can cause some issues with particularly overloaded servers\n          // that can't route to Anubis due to biblical amounts of load, but\n          // what can you do? At that point you kinda have to pick your battles\n          // between reliability and consistency. Consistency is probably the\n          // better tradeoff.\n          if (!anyOutput && spawner.demote()) {\n            console.warn(\n              \"anubis: proof of work workers died without running, respawning them\",\n            );\n            stopWorkers();\n            startWorkers();\n            return;\n          }\n\n          deadWorkers++;\n          console.warn(\n            `anubis: proof of work worker died (${deadWorkers}/${threads})`,\n            event,\n          );\n\n          // XXX(Xe): Make sure there's at least one worker left alive.\n          //\n          // One way to think about how the parallelism works here is that the\n          // nonce space of challenge solutions is divided into one \"lane\" per\n          // worker. In general solutions should be \"dense\" enough that losing\n          // a few workers should be \"fine enough\".\n          //\n          // If all workers are dead, there is no way to search the entire nonce\n          // space and thus the solution attempt has failed.\n          if (deadWorkers < threads) {\n            return;\n          }\n\n          cleanup();\n          // XXX(Xe): If the worker fails to load, some browsers return non-error\n          // Error values that we can't introspect properly. When we hit this kind\n          // of horrible state, throw an actual error so that the challenge page\n          // has a better error message than \"undefined\".\n          reject(\n            new Error(\n              \"anubis: all proof of work workers failed at runtime (file a bug?)\",\n            ),\n          );\n        };\n\n        worker.onerror = workerDied;\n\n        // A payload we can't deserialize is as fatal to this worker as a\n        // crash, and it is silent otherwise.\n        worker.onmessageerror = (event) => {\n          console.warn(\n            \"anubis: proof of work worker sent a bad message\",\n            event,\n          );\n          workerDied(event);\n        };\n\n        worker.postMessage({\n          ...message,\n          nonce: i,\n          threads,\n        });\n      }\n    };\n\n    startWorkers();\n  });\n};\n", "import {\n  ProgressCallback,\n  ProcessOptions,\n  ProcessResult,\n  defaultThreads,\n  runWorkers,\n} from \"@lib/worker\";\n\nexport default async function process(\n  options: ProcessOptions,\n  data: string,\n  difficulty: number = 5,\n  signal: AbortSignal | null = null,\n  progressCallback?: ProgressCallback,\n  threads: number = defaultThreads(),\n): Promise<ProcessResult> {\n  console.debug(\"fast algo\");\n\n  return runWorkers({\n    webWorkerURL: `${options.basePrefix}/.within.website/x/cmd/anubis/static/js/worker/sha256.mjs?cacheBuster=${options.version}`,\n    message: { data, difficulty },\n    threads,\n    signal,\n    progressCallback,\n  });\n}\n", "export const bigInt=()=>(async e=>{try{return(await WebAssembly.instantiate(e)).instance.exports.b(BigInt(0))===BigInt(0)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,1,126,1,126,3,2,1,0,7,5,1,1,98,0,0,10,6,1,4,0,32,0,11])),bulkMemory=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,3,1,0,1,10,14,1,12,0,65,0,65,0,65,0,252,10,0,0,11])),exceptions=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,6,64,25,11,11])),exceptionsFinal=()=>(async()=>{try{return new WebAssembly.Module(Uint8Array.from(atob(\"AGFzbQEAAAABBAFgAAADAgEAChABDgACaR9AAQMAAAsACxoL\"),(e=>e.codePointAt(0)))),!0}catch(e){return!1}})(),extendedConst=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,0,1,11,9,1,0,65,1,65,2,106,11,0])),gc=()=>(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,95,1,120,0])))(),jsStringBuiltins=()=>(async()=>{try{return await WebAssembly.instantiate(Uint8Array.from(atob(\"AGFzbQEAAAABBgFgAW8BfwIXAQ53YXNtOmpzLXN0cmluZwR0ZXN0AAA=\"),(e=>e.codePointAt(0))),{},{builtins:[\"js-string\"]}),!0}catch(e){return!1}})(),jspi=()=>(async()=>\"Suspending\"in WebAssembly)(),memory64=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,5,3,1,4,1])),multiMemory=()=>(async()=>{try{return new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,5,5,2,0,0,0,0])),!0}catch(e){return!1}})(),multiValue=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,6,1,96,0,2,127,127,3,2,1,0,10,8,1,6,0,65,0,65,0,11])),mutableGlobals=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,2,8,1,1,97,1,98,3,127,1,6,6,1,127,1,65,0,11,7,5,1,1,97,3,1])),referenceTypes=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,7,1,5,0,208,112,26,11])),relaxedSimd=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,15,1,13,0,65,1,253,15,65,2,253,15,253,128,2,11])),saturatedFloatToInt=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,12,1,10,0,67,0,0,0,0,252,0,26,11])),signExtensions=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,8,1,6,0,65,0,192,26,11])),simd=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,5,1,96,0,1,123,3,2,1,0,10,10,1,8,0,65,0,253,15,253,98,11])),streamingCompilation=()=>(async()=>\"compileStreaming\"in WebAssembly)(),tailCall=async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,10,6,1,4,0,18,0,11])),threads=()=>(async e=>{try{return\"undefined\"!=typeof MessageChannel&&(new MessageChannel).port1.postMessage(new SharedArrayBuffer(1)),WebAssembly.validate(e)}catch(e){return!1}})(new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,2,1,0,5,4,1,3,1,1,10,11,1,9,0,65,0,254,16,2,0,26,11])),typeReflection=()=>(async()=>\"Function\"in WebAssembly)(),typedFunctionReferences=()=>(async()=>{try{return new WebAssembly.Module(Uint8Array.from(atob(\"AGFzbQEAAAABEANgAX8Bf2ABZAABf2AAAX8DBAMBAAIJBQEDAAEBChwDCwBBCkEqIAAUAGoLBwAgAEEBagsGANIBEAAL\"),(e=>e.codePointAt(0)))),!0}catch(e){return!1}})(),wideArithmetic=()=>(async()=>WebAssembly.validate(new Uint8Array([0,97,115,109,1,0,0,0,1,10,1,96,4,126,126,126,126,2,126,126,3,2,1,0,10,14,1,12,0,32,0,32,1,32,2,32,3,252,19,11])))();\n", "// https://stackoverflow.com/questions/47879864/how-can-i-check-if-a-browser-supports-webassembly\nconst isWASMSupported = (() => {\n  try {\n    if (\n      typeof WebAssembly === \"object\" &&\n      typeof WebAssembly.instantiate === \"function\"\n    ) {\n      const module = new WebAssembly.Module(\n        Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00),\n      );\n      if (module instanceof WebAssembly.Module)\n        return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;\n    }\n  } catch (e) {\n    return false;\n  }\n  return false;\n})();\n\nexport default isWASMSupported;\n\nexport class WASMUnsupportedError extends Error {\n  constructor() {\n    super(\n      \"WebAssembly is not supported in this browser. This is not a bug in Anubis. Please contact the system administrator for help.\",\n    );\n    this.name = \"WASMUnsupportedError\";\n  }\n}\n", "import {\n  ProgressCallback,\n  ProcessOptions,\n  ProcessResult,\n  defaultThreads,\n  runWorkers,\n} from \"@lib/worker\";\n\nexport default function process(\n  options: ProcessOptions,\n  data: string,\n  difficulty: number = 5,\n  signal: AbortSignal | null = null,\n  progressCallback?: ProgressCallback,\n  threads: number = defaultThreads(),\n): Promise<ProcessResult> {\n  const { basePrefix, version, algorithm } = options;\n\n  return runWorkers({\n    webWorkerURL: `${basePrefix}/.within.website/x/cmd/anubis/static/js/worker/wasm2js.mjs?cacheBuster=${version}`,\n    message: { data, difficulty, algorithm },\n    threads,\n    signal,\n    progressCallback,\n  });\n}\n", "import {\n  ProgressCallback,\n  ProcessOptions,\n  ProcessResult,\n  defaultThreads,\n  runWorkers,\n} from \"@lib/worker\";\nimport { fetchWithBackoff } from \"@lib/backoff\";\nimport { simd } from \"wasm-feature-detect\";\nimport isWASMSupported from \"@lib/wasm-supported\";\nimport wasm2js from \"./wasm2js\";\n\n// compileModule fetches and compiles the WebAssembly module for an algorithm.\n//\n// The module comes from the same server that is already being hammered, so it\n// gets the same exponential backoff treatment as every other challenge asset.\nconst compileModule = async (\n  url: string,\n  signal: AbortSignal | null,\n): Promise<WebAssembly.Module> => {\n  const response = await fetchWithBackoff(url, { signal });\n\n  try {\n    return await WebAssembly.compileStreaming(response.clone());\n  } catch (err) {\n    // XXX(Xe): compileStreaming insists on an `application/wasm` Content-Type.\n    // Anubis serves that, but middleware in front of Anubis has been known to\n    // rewrite it. Buffering the whole module works regardless.\n    console.warn(\n      \"anubis: streaming WebAssembly compilation failed, buffering instead\",\n      err,\n    );\n    return await WebAssembly.compile(await response.arrayBuffer());\n  }\n};\n\nexport default async function process(\n  options: ProcessOptions,\n  data: string,\n  difficulty: number = 5,\n  signal: AbortSignal | null = null,\n  progressCallback?: ProgressCallback,\n  threads: number = defaultThreads(),\n): Promise<ProcessResult> {\n  const { basePrefix, version, algorithm } = options;\n\n  if (!isWASMSupported) {\n    return wasm2js(\n      options,\n      data,\n      difficulty,\n      signal,\n      progressCallback,\n      threads,\n    );\n  }\n\n  const wasmFeatures = (await simd()) ? \"simd128\" : \"baseline\";\n  const module = await compileModule(\n    `${basePrefix}/.within.website/x/cmd/anubis/static/wasm/${wasmFeatures}/${algorithm}.wasm?cacheBuster=${version}`,\n    signal,\n  );\n\n  return runWorkers({\n    webWorkerURL: `${basePrefix}/.within.website/x/cmd/anubis/static/js/worker/wasm.mjs?cacheBuster=${version}`,\n    message: { data, difficulty, algorithm, module },\n    threads,\n    signal,\n    progressCallback,\n  });\n}\n", "import fast from \"./fast\";\nimport wasm from \"./wasm\";\n\nexport default {\n  fast: fast,\n  slow: fast, // XXX(Xe): slow is deprecated, but keep this around in case anything goes bad\n  // These names must match the ones lib/challenge/wasm registers server side.\n  argon2id: wasm,\n  hashx: wasm,\n  sha256: wasm,\n} as Record<string, any>;\n", "/*\nLocal copy of Xeact (https://github.com/Xe/Xeact). Included under the terms\nof the MIT license:\n\nMIT License\n-----------\n\nCopyright (c) 2021 Xe (https://christine.website)\nPermission is hereby granted, free of charge, to any person\nobtaining a copy of this software and associated documentation\nfiles (the \"Software\"), to deal in the Software without\nrestriction, including without limitation the rights to use,\ncopy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the\nSoftware is furnished to do so, subject to the following\nconditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\nOF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\nHOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\nWHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\nOTHER DEALINGS IN THE SOFTWARE.\n*/\n\n/**\n * Creates a DOM element, assigns the properties of `data` to it, and appends all `children`.\n *\n * @type{function(string|Function, Object=, Node|Array.<Node|string>=)}\n */\nconst h = (name, data = {}, children = []) => {\n  const result =\n    typeof name == \"function\"\n      ? name(data)\n      : Object.assign(document.createElement(name), data);\n  if (!Array.isArray(children)) {\n    children = [children];\n  }\n  result.append(...children);\n  return result;\n};\n\n/**\n * Create a text node.\n *\n * Equivalent to `document.createTextNode(text)`\n *\n * @type{function(string): Text}\n */\nconst t = (text) => document.createTextNode(text);\n\n/**\n * Remove all child nodes from a DOM element.\n *\n * @type{function(Node)}\n */\nconst x = (elem) => {\n  while (elem.lastChild) {\n    elem.removeChild(elem.lastChild);\n  }\n};\n\n/**\n * Get all elements with the given ID.\n *\n * Equivalent to `document.getElementById(name)`\n *\n * @type{function(string): HTMLElement}\n */\nconst g = (name) => document.getElementById(name);\n\n/**\n * Get all elements with the given class name.\n *\n * Equivalent to `document.getElementsByClassName(name)`\n *\n * @type{function(string): HTMLCollectionOf.<Element>}\n */\nconst c = (name) => document.getElementsByClassName(name);\n\n/** @type{function(string): HTMLCollectionOf.<Element>} */\nconst n = (name) => document.getElementsByName(name);\n\n/**\n * Get all elements matching the given HTML selector.\n *\n * Matches selectors with `document.querySelectorAll(selector)`\n *\n * @type{function(string): Array.<HTMLElement>}\n */\nconst s = (selector) => Array.from(document.querySelectorAll(selector));\n\n/**\n * Generate a relative URL from `url`, appending all key-value pairs from `params` as URL-encoded parameters.\n *\n * @type{function(string=, Object=): string}\n */\nconst u = (url = \"\", params = {}) => {\n  let result = new URL(url, window.location.href);\n  Object.entries(params).forEach((kv) => {\n    let [k, v] = kv;\n    result.searchParams.set(k, v);\n  });\n  return result.toString();\n};\n\n/**\n * Takes a callback to run when all DOM content is loaded.\n *\n * Equivalent to `window.addEventListener('DOMContentLoaded', callback)`\n *\n * @type{function(function())}\n */\nconst r = (callback) => window.addEventListener(\"DOMContentLoaded\", callback);\n\n/**\n * Allows a stateful value to be tracked by consumers.\n *\n * This is the Xeact version of the React useState hook.\n *\n * @type{function(any): [function(): any, function(any): void]}\n */\nconst useState = (value = undefined) => {\n  return [\n    () => value,\n    (x) => {\n      value = x;\n    },\n  ];\n};\n\n/**\n * Debounce an action for up to ms milliseconds.\n *\n * @type{function(number): function(function(any): void)}\n */\nconst d = (ms) => {\n  let debounceTimer = null;\n  return (f) => {\n    clearTimeout(debounceTimer);\n    debounceTimer = setTimeout(f, ms);\n  };\n};\n\n/**\n * Parse a given element as JSON and return it as a bare\n * object.\n *\n * @type{function(id): any | null}\n */\nconst j = (id) => {\n  const elem = g(id);\n  if (elem === null) {\n    return null;\n  }\n\n  return JSON.parse(elem.textContent);\n};\n\nexport { h, t, x, g, c, n, u, s, r, j, useState, d };\n", "import { waitForExtensions } from \"@lib/extensions\";\nimport algorithms from \"./algorithms\";\nimport { fetchWithBackoff } from \"./lib/backoff\";\nimport { g, u, j } from \"@lib/xeact.mjs\";\n\n// Tell the inline bootstrap in the challenge page that this script made it off\n// the wire and started running.\n\ndeclare global {\n  interface Window {\n    __anubisBooted?: boolean;\n  }\n}\n\nconst alreadyBooted = window.__anubisBooted === true;\nwindow.__anubisBooted = true;\n\nconst imageURL = (\n  mood: string,\n  cacheBuster: string,\n  basePrefix: string,\n): string =>\n  u(`${basePrefix}/.within.website/x/cmd/anubis/static/img/${mood}.webp`, {\n    cacheBuster,\n  });\n\n// Use the browser language from the HTML lang attribute which is set by the server settings or request headers\nconst getBrowserLanguage = async () => document.documentElement.lang;\n\n// Load translations from JSON files\n//\n// This runs before anything else on the challenge page, so it must never throw:\n// an unhandled rejection here leaves the user staring at \"Loading...\" forever.\n// An untranslated challenge page still passes challenges, so the last resort is\n// an empty table, which makes t() fall through to the raw key.\nconst loadTranslations = async (\n  lang: string,\n): Promise<Record<string, string>> => {\n  const basePrefix = j(\"anubis_base_prefix\");\n  if (basePrefix === null) {\n    return {};\n  }\n\n  try {\n    const response = await fetchWithBackoff(\n      `${basePrefix}/.within.website/x/cmd/anubis/static/locales/${lang}.json`,\n    );\n    return (await response.json()) as Record<string, string>;\n  } catch (error) {\n    console.warn(`Failed to load translations for ${lang}`, error);\n    if (lang !== \"en\") {\n      return await loadTranslations(\"en\");\n    }\n    return {};\n  }\n};\n\nconst getRedirectUrl = (): string | null => {\n  const publicUrl = j(\"anubis_public_url\");\n  if (publicUrl === null) {\n    return \"/\";\n  }\n  if (publicUrl && window.location.href.startsWith(publicUrl)) {\n    const urlParams = new URLSearchParams(window.location.search);\n    return urlParams.get(\"redir\");\n  }\n  return window.location.href;\n};\n\nlet translations: Record<string, string> = {};\nlet currentLang;\n\n// Initialize translations\nconst initTranslations = async () => {\n  currentLang = await getBrowserLanguage();\n  translations = await loadTranslations(currentLang);\n};\n\nconst t = (key: string): string =>\n  translations[`js_${key}`] ||\n  translations[key] ||\n  `unknown translatable string: ${key}`;\n\ninterface OhNoesParams {\n  titleMsg: string;\n  statusMsg: string;\n  imageSrc: string;\n}\n\n(async () => {\n  if (alreadyBooted) {\n    console.debug(\"anubis: main.mjs already running, ignoring duplicate load\");\n    return;\n  }\n\n  // Initialize translations first\n  await initTranslations();\n\n  const dependencies = [\n    {\n      name: \"Web Workers\",\n      msg: t(\"web_workers_error\"),\n      value: window.Worker,\n    },\n    {\n      name: \"Cookies\",\n      msg: t(\"cookies_error\"),\n      value: navigator.cookieEnabled,\n    },\n  ];\n\n  const status: HTMLParagraphElement = g(\"status\") as HTMLParagraphElement;\n  const image: HTMLImageElement = g(\"image\") as HTMLImageElement;\n  const title: HTMLHeadingElement = g(\"title\") as HTMLHeadingElement;\n  const progress: HTMLDivElement = g(\"progress\") as HTMLDivElement;\n\n  const anubisVersion = j(\"anubis_version\");\n  const basePrefix = j(\"anubis_base_prefix\");\n  const details = document.querySelector(\"details\");\n  let userReadDetails = false;\n\n  if (details) {\n    details.addEventListener(\"toggle\", () => {\n      if (details.open) {\n        userReadDetails = true;\n      }\n    });\n  }\n\n  const ohNoes = ({ titleMsg, statusMsg, imageSrc }: OhNoesParams) => {\n    title.innerHTML = titleMsg;\n    status.innerHTML = statusMsg;\n    image.src = imageSrc;\n    progress.style.display = \"none\";\n  };\n\n  status.innerHTML = t(\"calculating\");\n\n  for (const { value, name, msg } of dependencies) {\n    if (!value) {\n      ohNoes({\n        titleMsg: `${t(\"missing_feature\")} ${name}`,\n        statusMsg: msg,\n        imageSrc: imageURL(\"reject\", anubisVersion, basePrefix),\n      });\n      return;\n    }\n  }\n\n  const { challenge, rules } = j(\"anubis_challenge\");\n\n  const process = algorithms[rules.algorithm];\n  if (!process) {\n    ohNoes({\n      titleMsg: t(\"challenge_error\"),\n      statusMsg: t(\"challenge_error_msg\"),\n      imageSrc: imageURL(\"reject\", anubisVersion, basePrefix),\n    });\n    return;\n  }\n\n  status.innerHTML = `${t(\"calculating_difficulty\")} ${rules.difficulty}, `;\n  progress.style.display = \"inline-block\";\n\n  // the whole text, including \"Speed:\", as a single node, because some browsers\n  // (Firefox mobile) present screen readers with each node as a separate piece\n  // of text.\n  const rateText = document.createTextNode(`${t(\"speed\")} 0kH/s`);\n  status.appendChild(rateText);\n\n  let lastSpeedUpdate = 0;\n  let showingApology = false;\n  const likelihood = Math.pow(16, -rules.difficulty);\n\n  try {\n    const t0 = Date.now();\n    const { hash, nonce } = await process(\n      { basePrefix, version: anubisVersion, algorithm: rules.algorithm },\n      challenge.randomData,\n      rules.difficulty,\n      null,\n      (iters: number) => {\n        const delta = Date.now() - t0;\n        // only update the speed every second so it's less visually distracting\n        if (delta - lastSpeedUpdate > 1000) {\n          lastSpeedUpdate = delta;\n          rateText.data = `${t(\"speed\")} ${(iters / delta).toFixed(3)}kH/s`;\n        }\n        // the probability of still being on the page is (1 - likelihood) ^ iters.\n        // by definition, half of the time the progress bar only gets to half, so\n        // apply a polynomial ease-out function to move faster in the beginning\n        // and then slow down as things get increasingly unlikely. quadratic felt\n        // the best in testing, but this may need adjustment in the future.\n\n        const probability = Math.pow(1 - likelihood, iters);\n        const distance = (1 - Math.pow(probability, 2)) * 100;\n        progress.ariaValueNow = `${distance}`;\n        if (progress.firstElementChild !== null) {\n          (progress.firstElementChild as HTMLElement).style.width =\n            `${distance}%`;\n        }\n\n        if (probability < 0.1 && !showingApology) {\n          status.append(\n            document.createElement(\"br\"),\n            document.createTextNode(t(\"verification_longer\")),\n          );\n          showingApology = true;\n        }\n      },\n    );\n    const t1 = Date.now();\n    console.log({ hash, nonce });\n\n    await waitForExtensions();\n\n    if (userReadDetails) {\n      const container: HTMLDivElement = document.getElementById(\n        \"progress\",\n      ) as HTMLDivElement;\n\n      // Style progress bar as a continue button\n      container.style.display = \"flex\";\n      container.style.alignItems = \"center\";\n      container.style.justifyContent = \"center\";\n      container.style.height = \"2rem\";\n      container.style.borderRadius = \"1rem\";\n      container.style.cursor = \"pointer\";\n      container.style.background = \"#b16286\";\n      container.style.color = \"white\";\n      container.style.fontWeight = \"bold\";\n      container.style.outline = \"4px solid #b16286\";\n      container.style.outlineOffset = \"2px\";\n      container.style.width = \"min(20rem, 90%)\";\n      container.style.margin = \"1rem auto 2rem\";\n      container.innerHTML = t(\"finished_reading\");\n\n      function onDetailsExpand() {\n        const redir = getRedirectUrl() ?? \"/\";\n        window.location.replace(\n          u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {\n            id: challenge.id,\n            response: hash,\n            nonce,\n            redir,\n            elapsedTime: `${t1 - t0}`,\n          }),\n        );\n      }\n\n      container.onclick = onDetailsExpand;\n      setTimeout(onDetailsExpand, 30000);\n    } else {\n      const redir = getRedirectUrl() ?? \"/\";\n      window.location.replace(\n        u(`${basePrefix}/.within.website/x/cmd/anubis/api/pass-challenge`, {\n          id: challenge.id,\n          response: hash,\n          nonce,\n          redir,\n          elapsedTime: `${t1 - t0}`,\n        }),\n      );\n    }\n  } catch (err: any) {\n    ohNoes({\n      titleMsg: t(\"calculation_error\"),\n      statusMsg: `${t(\"calculation_error_msg\")} ${err.message}`,\n      imageSrc: imageURL(\"reject\", anubisVersion, basePrefix),\n    });\n  }\n})();\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BA,eAAsBA,EAAkBC,EAAoB,IAAqB,CA7BjF,IAAAC,EA8BE,IAAMC,GAAUD,EAAA,OAAO,qBAAP,KAAAA,EAA6B,CAAC,EAC9C,GAAIC,EAAQ,SAAW,EACrB,OAQF,IAAMC,EAAU,QAAQ,IACtBD,EAAQ,IAAIE,GAAK,QAAQ,QAAQA,CAAC,EAAE,MAAM,IAAG,EAAY,CAAC,CAC5D,EAEIC,EACEC,EAAU,IAAI,QAAeC,GAAY,CAC7CF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ACF,GAAG",
  "names": ["waitForExtensions", "timeoutMs", "_a", "pending", "settled", "p", "timer", "timeout", "resolve", "RETRYABLE_STATUSES", "isAbortError", "err", "abortError", "sleep", "ms", "signal", "resolve", "reject", "onAbort", "timer", "backoffDelay", "attempt", "baseDelayMs", "maxDelayMs", "retryAfterMs", "response", "header", "seconds", "deadline", "fetchWithBackoff", "url", "options", "_a", "_b", "_c", "_d", "attempts", "lastError", "serverDelayMs", "delay", "requested", "getHardwareConcurrency", "directSpawner", "webWorkerURL", "createWorkerSpawner", "signal", "direct", "blobURL", "response", "fetchWithBackoff", "err", "isAbortError", "useBlob", "workerError", "data", "defaultThreads", "runWorkers", "opts", "spawner", "raceWorkers", "message", "threads", "progressCallback", "resolve", "reject", "workers", "settled", "deadWorkers", "anyOutput", "onAbort", "cleanup", "stopWorkers", "w", "startWorkers", "i", "worker", "event", "workerDied", "process", "options", "data", "difficulty", "signal", "progressCallback", "threads", "defaultThreads", "runWorkers", "simd", "isWASMSupported", "module", "wasm_supported_default", "process", "options", "data", "difficulty", "signal", "progressCallback", "threads", "defaultThreads", "basePrefix", "version", "algorithm", "runWorkers", "compileModule", "url", "signal", "response", "fetchWithBackoff", "err", "process", "options", "data", "difficulty", "progressCallback", "threads", "defaultThreads", "basePrefix", "version", "algorithm", "wasm_supported_default", "wasmFeatures", "simd", "module", "runWorkers", "algorithms_default", "process", "g", "name", "u", "url", "params", "result", "kv", "k", "v", "j", "id", "elem", "g", "alreadyBooted", "imageURL", "mood", "cacheBuster", "basePrefix", "u", "getBrowserLanguage", "loadTranslations", "lang", "j", "fetchWithBackoff", "error", "getRedirectUrl", "publicUrl", "translations", "currentLang", "initTranslations", "t", "key", "_a", "dependencies", "status", "g", "image", "title", "progress", "anubisVersion", "details", "userReadDetails", "ohNoes", "titleMsg", "statusMsg", "imageSrc", "value", "name", "msg", "challenge", "rules", "process", "algorithms_default", "rateText", "lastSpeedUpdate", "showingApology", "likelihood", "t0", "hash", "nonce", "iters", "delta", "probability", "distance", "t1", "waitForExtensions", "onDetailsExpand", "redir", "container", "err"]
}
