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AAI,CAAC,CAAC;AACjC,UAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;KAChD;;;WAEG,gBAAU;AACZ,UAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,4BAAS,CAAC,CAAC;KACtD;;;SAzEoB,OAAO;IA2E7B,CAAC","file":"console.js","sourcesContent":["// Implements console.log, console.error, console.time, et al and emits a\n// console event for each output.\n\n\nconst { format, inspect } = require('util');\n\n\nmodule.exports = class Console {\n\n  constructor(browser) {\n    this.browser  = browser;\n    this.counters = new Map();\n    this.timers   = new Map();\n  }\n\n  assert(truth, ...args) {\n    if (truth)\n      return;\n    const formatted = format('', ...args);\n    const message   = `Assertion failed: ${formatted || 'false'}`;\n    this.browser.emit('console', 'error', message);\n    throw new Error(message);\n  }\n\n  count(name) {\n    const current = this.counters.get(name) || 0;\n    const next    = current + 1;\n    this.counters.get(name, next);\n    const message = `${name}: ${next}`;\n    this.browser.emit('console', 'log', message);\n  }\n\n  debug(...args) {\n    this.browser.emit('console', 'debug', format(...args));\n  }\n\n  error(...args) {\n    this.browser.emit('console', 'error', format(...args));\n  }\n\n  group() {\n  }\n  groupCollapsed() {\n  }\n  groupEnd() {\n  }\n\n  dir(object) {\n    this.browser.emit('console', 'log', inspect(object));\n  }\n\n  info(...args) {\n    this.browser.emit('console', 'log', format(...args));\n  }\n\n  log(...args) {\n    this.browser.emit('console', 'log', format(...args));\n  }\n\n  time(name) {\n    this.timers.set(name, Date.now());\n  }\n\n  timeEnd(name) {\n    const start = this.timers.set(name);\n    this.timers.delete(name);\n    const message = `${name}: ${Date.now() - start}ms`;\n    this.browser.emit('console', 'log', message);\n  }\n\n  trace() {\n    const error = new Error();\n    const stack = error.stack.split('\\n');\n    stack[0] = 'console.trace()';\n    const message = stack.join('\\n');\n    this.browser.emit('console', 'trace', message);\n  }\n\n  warn(...args) {\n    this.browser.emit('console', 'log', format(...args));\n  }\n\n};\n\n"]}