diff --git a/node_modules/.bin/chrome-debug b/node_modules/.bin/chrome-debug index fd2047af2..be8b68b8b 120000 --- a/node_modules/.bin/chrome-debug +++ b/node_modules/.bin/chrome-debug @@ -1 +1 @@ -../lighthouse/lighthouse-core/scripts/manual-chrome-launcher.js \ No newline at end of file +../lighthouse/core/scripts/manual-chrome-launcher.js \ No newline at end of file diff --git a/node_modules/.bin/lighthouse b/node_modules/.bin/lighthouse index e2d548045..fe948ef45 120000 --- a/node_modules/.bin/lighthouse +++ b/node_modules/.bin/lighthouse @@ -1 +1 @@ -../lighthouse/lighthouse-cli/index.js \ No newline at end of file +../lighthouse/cli/index.js \ No newline at end of file diff --git a/node_modules/@lhci/cli/node_modules/.bin/chrome-debug b/node_modules/@lhci/cli/node_modules/.bin/chrome-debug index 2a498dc0e..6a5bd8606 120000 --- a/node_modules/@lhci/cli/node_modules/.bin/chrome-debug +++ b/node_modules/@lhci/cli/node_modules/.bin/chrome-debug @@ -1 +1 @@ -../../../../lighthouse/lighthouse-core/scripts/manual-chrome-launcher.js \ No newline at end of file +../../../../lighthouse/core/scripts/manual-chrome-launcher.js \ No newline at end of file diff --git a/node_modules/@lhci/cli/node_modules/.bin/lighthouse b/node_modules/@lhci/cli/node_modules/.bin/lighthouse index c3094e20a..5b03dcd7c 120000 --- a/node_modules/@lhci/cli/node_modules/.bin/lighthouse +++ b/node_modules/@lhci/cli/node_modules/.bin/lighthouse @@ -1 +1 @@ -../../../../lighthouse/lighthouse-cli/index.js \ No newline at end of file +../../../../lighthouse/cli/index.js \ No newline at end of file diff --git a/node_modules/lighthouse/node_modules/cliui/LICENSE.txt b/node_modules/@lhci/cli/node_modules/cliui/LICENSE.txt similarity index 100% rename from node_modules/lighthouse/node_modules/cliui/LICENSE.txt rename to node_modules/@lhci/cli/node_modules/cliui/LICENSE.txt diff --git a/node_modules/cliui/index.js b/node_modules/@lhci/cli/node_modules/cliui/index.js similarity index 100% rename from node_modules/cliui/index.js rename to node_modules/@lhci/cli/node_modules/cliui/index.js diff --git a/node_modules/@lhci/cli/node_modules/cliui/package.json b/node_modules/@lhci/cli/node_modules/cliui/package.json new file mode 100644 index 000000000..f92fd103a --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/cliui/package.json @@ -0,0 +1,65 @@ +{ + "name": "cliui", + "version": "6.0.0", + "description": "easily create complex multi-column command-line-interfaces", + "main": "index.js", + "scripts": { + "pretest": "standard", + "test": "nyc mocha", + "coverage": "nyc --reporter=text-lcov mocha | coveralls" + }, + "repository": { + "type": "git", + "url": "http://github.com/yargs/cliui.git" + }, + "config": { + "blanket": { + "pattern": [ + "index.js" + ], + "data-cover-never": [ + "node_modules", + "test" + ], + "output-reporter": "spec" + } + }, + "standard": { + "ignore": [ + "**/example/**" + ], + "globals": [ + "it" + ] + }, + "keywords": [ + "cli", + "command-line", + "layout", + "design", + "console", + "wrap", + "table" + ], + "author": "Ben Coe ", + "license": "ISC", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + }, + "devDependencies": { + "chai": "^4.2.0", + "chalk": "^3.0.0", + "coveralls": "^3.0.3", + "mocha": "^6.2.2", + "nyc": "^14.1.1", + "standard": "^12.0.1" + }, + "files": [ + "index.js" + ], + "engine": { + "node": ">=8" + } +} diff --git a/node_modules/lighthouse/node_modules/wrap-ansi/index.js b/node_modules/@lhci/cli/node_modules/wrap-ansi/index.js similarity index 68% rename from node_modules/lighthouse/node_modules/wrap-ansi/index.js rename to node_modules/@lhci/cli/node_modules/wrap-ansi/index.js index d502255bd..a6e54431b 100755 --- a/node_modules/lighthouse/node_modules/wrap-ansi/index.js +++ b/node_modules/@lhci/cli/node_modules/wrap-ansi/index.js @@ -10,14 +10,7 @@ const ESCAPES = new Set([ const END_CODE = 39; -const ANSI_ESCAPE_BELL = '\u0007'; -const ANSI_CSI = '['; -const ANSI_OSC = ']'; -const ANSI_SGR_TERMINATOR = 'm'; -const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`; - -const wrapAnsi = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`; -const wrapAnsiHyperlink = uri => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`; +const wrapAnsi = code => `${ESCAPES.values().next().value}[${code}m`; // Calculate the length of words split on ' ', ignoring // the extra characters added by ansi escape codes @@ -29,7 +22,6 @@ const wrapWord = (rows, word, columns) => { const characters = [...word]; let isInsideEscape = false; - let isInsideLinkEscape = false; let visible = stringWidth(stripAnsi(rows[rows.length - 1])); for (const [index, character] of characters.entries()) { @@ -44,19 +36,12 @@ const wrapWord = (rows, word, columns) => { if (ESCAPES.has(character)) { isInsideEscape = true; - isInsideLinkEscape = characters.slice(index + 1).join('').startsWith(ANSI_ESCAPE_LINK); + } else if (isInsideEscape && character === 'm') { + isInsideEscape = false; + continue; } if (isInsideEscape) { - if (isInsideLinkEscape) { - if (character === ANSI_ESCAPE_BELL) { - isInsideEscape = false; - isInsideLinkEscape = false; - } - } else if (character === ANSI_SGR_TERMINATOR) { - isInsideEscape = false; - } - continue; } @@ -76,8 +61,8 @@ const wrapWord = (rows, word, columns) => { }; // Trims spaces from a string ignoring invisible sequences -const stringVisibleTrimSpacesRight = string => { - const words = string.split(' '); +const stringVisibleTrimSpacesRight = str => { + const words = str.split(' '); let last = words.length; while (last > 0) { @@ -89,7 +74,7 @@ const stringVisibleTrimSpacesRight = string => { } if (last === words.length) { - return string; + return str; } return words.slice(0, last).join(' ') + words.slice(last).join(''); @@ -105,16 +90,16 @@ const exec = (string, columns, options = {}) => { return ''; } - let returnValue = ''; + let pre = ''; + let ret = ''; let escapeCode; - let escapeUrl; const lengths = wordLengths(string); let rows = ['']; for (const [index, word] of string.split(' ').entries()) { if (options.trim !== false) { - rows[rows.length - 1] = rows[rows.length - 1].trimStart(); + rows[rows.length - 1] = rows[rows.length - 1].trimLeft(); } let rowLength = stringWidth(rows[rows.length - 1]); @@ -166,43 +151,28 @@ const exec = (string, columns, options = {}) => { rows = rows.map(stringVisibleTrimSpacesRight); } - const pre = [...rows.join('\n')]; + pre = rows.join('\n'); - for (const [index, character] of pre.entries()) { - returnValue += character; + for (const [index, character] of [...pre].entries()) { + ret += character; if (ESCAPES.has(character)) { - const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?\\d+)m|\\${ANSI_ESCAPE_LINK}(?.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join('')) || {groups: {}}; - if (groups.code !== undefined) { - const code = Number.parseFloat(groups.code); - escapeCode = code === END_CODE ? undefined : code; - } else if (groups.uri !== undefined) { - escapeUrl = groups.uri.length === 0 ? undefined : groups.uri; - } + const code = parseFloat(/\d[^m]*/.exec(pre.slice(index, index + 4))); + escapeCode = code === END_CODE ? null : code; } const code = ansiStyles.codes.get(Number(escapeCode)); - if (pre[index + 1] === '\n') { - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(''); - } - - if (escapeCode && code) { - returnValue += wrapAnsi(code); - } - } else if (character === '\n') { - if (escapeCode && code) { - returnValue += wrapAnsi(escapeCode); - } - - if (escapeUrl) { - returnValue += wrapAnsiHyperlink(escapeUrl); + if (escapeCode && code) { + if (pre[index + 1] === '\n') { + ret += wrapAnsi(code); + } else if (character === '\n') { + ret += wrapAnsi(escapeCode); } } } - return returnValue; + return ret; }; // For each newline, invoke the method separately diff --git a/node_modules/lighthouse/node_modules/wrap-ansi/package.json b/node_modules/@lhci/cli/node_modules/wrap-ansi/package.json similarity index 78% rename from node_modules/lighthouse/node_modules/wrap-ansi/package.json rename to node_modules/@lhci/cli/node_modules/wrap-ansi/package.json index dfb2f4f10..1d57c9f14 100644 --- a/node_modules/lighthouse/node_modules/wrap-ansi/package.json +++ b/node_modules/@lhci/cli/node_modules/wrap-ansi/package.json @@ -1,17 +1,16 @@ { "name": "wrap-ansi", - "version": "7.0.0", + "version": "6.2.0", "description": "Wordwrap a string with ANSI escape codes", "license": "MIT", "repository": "chalk/wrap-ansi", - "funding": "https://github.com/chalk/wrap-ansi?sponsor=1", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "https://sindresorhus.com" + "url": "sindresorhus.com" }, "engines": { - "node": ">=10" + "node": ">=8" }, "scripts": { "test": "xo && nyc ava" @@ -53,10 +52,10 @@ }, "devDependencies": { "ava": "^2.1.0", - "chalk": "^4.0.0", + "chalk": "^2.4.2", "coveralls": "^3.0.3", - "has-ansi": "^4.0.0", - "nyc": "^15.0.1", - "xo": "^0.29.1" + "has-ansi": "^3.0.0", + "nyc": "^14.1.1", + "xo": "^0.24.0" } } diff --git a/node_modules/y18n/index.js b/node_modules/@lhci/cli/node_modules/y18n/index.js similarity index 100% rename from node_modules/y18n/index.js rename to node_modules/@lhci/cli/node_modules/y18n/index.js diff --git a/node_modules/@lhci/cli/node_modules/y18n/package.json b/node_modules/@lhci/cli/node_modules/y18n/package.json new file mode 100644 index 000000000..6f08863e9 --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/y18n/package.json @@ -0,0 +1,39 @@ +{ + "name": "y18n", + "version": "4.0.3", + "description": "the bare-bones internationalization library used by yargs", + "main": "index.js", + "scripts": { + "pretest": "standard", + "test": "nyc mocha", + "coverage": "nyc report --reporter=text-lcov | coveralls", + "release": "standard-version" + }, + "repository": { + "type": "git", + "url": "git@github.com:yargs/y18n.git" + }, + "files": [ + "index.js" + ], + "keywords": [ + "i18n", + "internationalization", + "yargs" + ], + "author": "Ben Coe ", + "license": "ISC", + "bugs": { + "url": "https://github.com/yargs/y18n/issues" + }, + "homepage": "https://github.com/yargs/y18n", + "devDependencies": { + "chai": "^4.0.1", + "coveralls": "^3.0.0", + "mocha": "^4.0.1", + "nyc": "^11.0.1", + "rimraf": "^2.5.0", + "standard": "^10.0.0-beta.0", + "standard-version": "^4.2.0" + } +} diff --git a/node_modules/yargs/build/lib/apply-extends.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/apply-extends.js similarity index 100% rename from node_modules/yargs/build/lib/apply-extends.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/apply-extends.js diff --git a/node_modules/lighthouse/node_modules/yargs/build/lib/argsert.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/argsert.js similarity index 59% rename from node_modules/lighthouse/node_modules/yargs/build/lib/argsert.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/argsert.js index be5b3aa69..40cb091a8 100644 --- a/node_modules/lighthouse/node_modules/yargs/build/lib/argsert.js +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/argsert.js @@ -1,31 +1,33 @@ -import { YError } from './yerror.js'; -import { parseCommand } from './parse-command.js'; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.argsert = void 0; +const yerror_1 = require("./yerror"); +const parse_command_1 = require("./parse-command"); const positionName = ['first', 'second', 'third', 'fourth', 'fifth', 'sixth']; -export function argsert(arg1, arg2, arg3) { +function argsert(arg1, arg2, arg3) { function parseArgs() { return typeof arg1 === 'object' ? [{ demanded: [], optional: [] }, arg1, arg2] - : [ - parseCommand(`cmd ${arg1}`), - arg2, - arg3, - ]; + : [parse_command_1.parseCommand(`cmd ${arg1}`), arg2, arg3]; } + // TODO: should this eventually raise an exception. try { + // preface the argument description with "cmd", so + // that we can run it through yargs' command parser. let position = 0; - const [parsed, callerArguments, _length] = parseArgs(); + let [parsed, callerArguments, length] = parseArgs(); const args = [].slice.call(callerArguments); while (args.length && args[args.length - 1] === undefined) args.pop(); - const length = _length || args.length; + length = length || args.length; if (length < parsed.demanded.length) { - throw new YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`); + throw new yerror_1.YError(`Not enough arguments provided. Expected ${parsed.demanded.length} but received ${args.length}.`); } const totalCommands = parsed.demanded.length + parsed.optional.length; if (length > totalCommands) { - throw new YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`); + throw new yerror_1.YError(`Too many arguments provided. Expected max ${totalCommands} but received ${length}.`); } - parsed.demanded.forEach(demanded => { + parsed.demanded.forEach((demanded) => { const arg = args.shift(); const observedType = guessType(arg); const matchingTypes = demanded.cmd.filter(type => type === observedType || type === '*'); @@ -33,7 +35,7 @@ export function argsert(arg1, arg2, arg3) { argumentTypeError(observedType, demanded.cmd, position); position += 1; }); - parsed.optional.forEach(optional => { + parsed.optional.forEach((optional) => { if (args.length === 0) return; const arg = args.shift(); @@ -48,6 +50,7 @@ export function argsert(arg1, arg2, arg3) { console.warn(err.stack); } } +exports.argsert = argsert; function guessType(arg) { if (Array.isArray(arg)) { return 'array'; @@ -58,5 +61,5 @@ function guessType(arg) { return typeof arg; } function argumentTypeError(observedType, allowedTypes, position) { - throw new YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`); + throw new yerror_1.YError(`Invalid ${positionName[position] || 'manyith'} argument. Expected ${allowedTypes.join(' or ')} but received ${observedType}.`); } diff --git a/node_modules/@lhci/cli/node_modules/yargs/build/lib/command.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/command.js new file mode 100644 index 000000000..d90c4559a --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/command.js @@ -0,0 +1,416 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.isCommandBuilderCallback = exports.isCommandBuilderDefinition = exports.isCommandHandlerDefinition = exports.command = void 0; +const common_types_1 = require("./common-types"); +const is_promise_1 = require("./is-promise"); +const middleware_1 = require("./middleware"); +const parse_command_1 = require("./parse-command"); +const path = require("path"); +const util_1 = require("util"); +const yargs_1 = require("./yargs"); +const requireDirectory = require("require-directory"); +const whichModule = require("which-module"); +const Parser = require("yargs-parser"); +const DEFAULT_MARKER = /(^\*)|(^\$0)/; +// handles parsing positional arguments, +// and populating argv with said positional +// arguments. +function command(yargs, usage, validation, globalMiddleware = []) { + const self = {}; + let handlers = {}; + let aliasMap = {}; + let defaultCommand; + self.addHandler = function addHandler(cmd, description, builder, handler, commandMiddleware, deprecated) { + let aliases = []; + const middlewares = middleware_1.commandMiddlewareFactory(commandMiddleware); + handler = handler || (() => { }); + if (Array.isArray(cmd)) { + aliases = cmd.slice(1); + cmd = cmd[0]; + } + else if (isCommandHandlerDefinition(cmd)) { + let command = (Array.isArray(cmd.command) || typeof cmd.command === 'string') ? cmd.command : moduleName(cmd); + if (cmd.aliases) + command = [].concat(command).concat(cmd.aliases); + self.addHandler(command, extractDesc(cmd), cmd.builder, cmd.handler, cmd.middlewares, cmd.deprecated); + return; + } + // allow a module to be provided instead of separate builder and handler + if (isCommandBuilderDefinition(builder)) { + self.addHandler([cmd].concat(aliases), description, builder.builder, builder.handler, builder.middlewares, builder.deprecated); + return; + } + // parse positionals out of cmd string + const parsedCommand = parse_command_1.parseCommand(cmd); + // remove positional args from aliases only + aliases = aliases.map(alias => parse_command_1.parseCommand(alias).cmd); + // check for default and filter out '*'' + let isDefault = false; + const parsedAliases = [parsedCommand.cmd].concat(aliases).filter((c) => { + if (DEFAULT_MARKER.test(c)) { + isDefault = true; + return false; + } + return true; + }); + // standardize on $0 for default command. + if (parsedAliases.length === 0 && isDefault) + parsedAliases.push('$0'); + // shift cmd and aliases after filtering out '*' + if (isDefault) { + parsedCommand.cmd = parsedAliases[0]; + aliases = parsedAliases.slice(1); + cmd = cmd.replace(DEFAULT_MARKER, parsedCommand.cmd); + } + // populate aliasMap + aliases.forEach((alias) => { + aliasMap[alias] = parsedCommand.cmd; + }); + if (description !== false) { + usage.command(cmd, description, isDefault, aliases, deprecated); + } + handlers[parsedCommand.cmd] = { + original: cmd, + description, + handler, + builder: builder || {}, + middlewares, + deprecated, + demanded: parsedCommand.demanded, + optional: parsedCommand.optional + }; + if (isDefault) + defaultCommand = handlers[parsedCommand.cmd]; + }; + self.addDirectory = function addDirectory(dir, context, req, callerFile, opts) { + opts = opts || {}; + // disable recursion to support nested directories of subcommands + if (typeof opts.recurse !== 'boolean') + opts.recurse = false; + // exclude 'json', 'coffee' from require-directory defaults + if (!Array.isArray(opts.extensions)) + opts.extensions = ['js']; + // allow consumer to define their own visitor function + const parentVisit = typeof opts.visit === 'function' ? opts.visit : (o) => o; + // call addHandler via visitor function + opts.visit = function visit(obj, joined, filename) { + const visited = parentVisit(obj, joined, filename); + // allow consumer to skip modules with their own visitor + if (visited) { + // check for cyclic reference + // each command file path should only be seen once per execution + if (~context.files.indexOf(joined)) + return visited; + // keep track of visited files in context.files + context.files.push(joined); + self.addHandler(visited); + } + return visited; + }; + requireDirectory({ require: req, filename: callerFile }, dir, opts); + }; + // lookup module object from require()d command and derive name + // if module was not require()d and no name given, throw error + function moduleName(obj) { + const mod = whichModule(obj); + if (!mod) + throw new Error(`No command name given for module: ${util_1.inspect(obj)}`); + return commandFromFilename(mod.filename); + } + // derive command name from filename + function commandFromFilename(filename) { + return path.basename(filename, path.extname(filename)); + } + function extractDesc({ describe, description, desc }) { + for (const test of [describe, description, desc]) { + if (typeof test === 'string' || test === false) + return test; + common_types_1.assertNotStrictEqual(test, true); + } + return false; + } + self.getCommands = () => Object.keys(handlers).concat(Object.keys(aliasMap)); + self.getCommandHandlers = () => handlers; + self.hasDefaultCommand = () => !!defaultCommand; + self.runCommand = function runCommand(command, yargs, parsed, commandIndex) { + let aliases = parsed.aliases; + const commandHandler = handlers[command] || handlers[aliasMap[command]] || defaultCommand; + const currentContext = yargs.getContext(); + let numFiles = currentContext.files.length; + const parentCommands = currentContext.commands.slice(); + // what does yargs look like after the builder is run? + let innerArgv = parsed.argv; + let positionalMap = {}; + if (command) { + currentContext.commands.push(command); + currentContext.fullCommands.push(commandHandler.original); + } + const builder = commandHandler.builder; + if (isCommandBuilderCallback(builder)) { + // a function can be provided, which builds + // up a yargs chain and possibly returns it. + const builderOutput = builder(yargs.reset(parsed.aliases)); + const innerYargs = yargs_1.isYargsInstance(builderOutput) ? builderOutput : yargs; + if (shouldUpdateUsage(innerYargs)) { + innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); + } + innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); + aliases = innerYargs.parsed.aliases; + } + else if (isCommandBuilderOptionDefinitions(builder)) { + // as a short hand, an object can instead be provided, specifying + // the options that a command takes. + const innerYargs = yargs.reset(parsed.aliases); + if (shouldUpdateUsage(innerYargs)) { + innerYargs.getUsageInstance().usage(usageFromParentCommandsCommandHandler(parentCommands, commandHandler), commandHandler.description); + } + Object.keys(commandHandler.builder).forEach((key) => { + innerYargs.option(key, builder[key]); + }); + innerArgv = innerYargs._parseArgs(null, null, true, commandIndex); + aliases = innerYargs.parsed.aliases; + } + if (!yargs._hasOutput()) { + positionalMap = populatePositionals(commandHandler, innerArgv, currentContext); + } + const middlewares = globalMiddleware.slice(0).concat(commandHandler.middlewares); + middleware_1.applyMiddleware(innerArgv, yargs, middlewares, true); + // we apply validation post-hoc, so that custom + // checks get passed populated positional arguments. + if (!yargs._hasOutput()) { + yargs._runValidation(innerArgv, aliases, positionalMap, yargs.parsed.error, !command); + } + if (commandHandler.handler && !yargs._hasOutput()) { + yargs._setHasOutput(); + // to simplify the parsing of positionals in commands, + // we temporarily populate '--' rather than _, with arguments + const populateDoubleDash = !!yargs.getOptions().configuration['populate--']; + if (!populateDoubleDash) + yargs._copyDoubleDash(innerArgv); + innerArgv = middleware_1.applyMiddleware(innerArgv, yargs, middlewares, false); + let handlerResult; + if (is_promise_1.isPromise(innerArgv)) { + handlerResult = innerArgv.then(argv => commandHandler.handler(argv)); + } + else { + handlerResult = commandHandler.handler(innerArgv); + } + const handlerFinishCommand = yargs.getHandlerFinishCommand(); + if (is_promise_1.isPromise(handlerResult)) { + yargs.getUsageInstance().cacheHelpMessage(); + handlerResult + .then(value => { + if (handlerFinishCommand) { + handlerFinishCommand(value); + } + }) + .catch(error => { + try { + yargs.getUsageInstance().fail(null, error); + } + catch (err) { + // fail's throwing would cause an unhandled rejection. + } + }) + .then(() => { + yargs.getUsageInstance().clearCachedHelpMessage(); + }); + } + else { + if (handlerFinishCommand) { + handlerFinishCommand(handlerResult); + } + } + } + if (command) { + currentContext.commands.pop(); + currentContext.fullCommands.pop(); + } + numFiles = currentContext.files.length - numFiles; + if (numFiles > 0) + currentContext.files.splice(numFiles * -1, numFiles); + return innerArgv; + }; + function shouldUpdateUsage(yargs) { + return !yargs.getUsageInstance().getUsageDisabled() && + yargs.getUsageInstance().getUsage().length === 0; + } + function usageFromParentCommandsCommandHandler(parentCommands, commandHandler) { + const c = DEFAULT_MARKER.test(commandHandler.original) ? commandHandler.original.replace(DEFAULT_MARKER, '').trim() : commandHandler.original; + const pc = parentCommands.filter((c) => { return !DEFAULT_MARKER.test(c); }); + pc.push(c); + return `$0 ${pc.join(' ')}`; + } + self.runDefaultBuilderOn = function (yargs) { + common_types_1.assertNotStrictEqual(defaultCommand, undefined); + if (shouldUpdateUsage(yargs)) { + // build the root-level command string from the default string. + const commandString = DEFAULT_MARKER.test(defaultCommand.original) + ? defaultCommand.original : defaultCommand.original.replace(/^[^[\]<>]*/, '$0 '); + yargs.getUsageInstance().usage(commandString, defaultCommand.description); + } + const builder = defaultCommand.builder; + if (isCommandBuilderCallback(builder)) { + builder(yargs); + } + else { + Object.keys(builder).forEach((key) => { + yargs.option(key, builder[key]); + }); + } + }; + // transcribe all positional arguments "command [apple]" + // onto argv. + function populatePositionals(commandHandler, argv, context) { + argv._ = argv._.slice(context.commands.length); // nuke the current commands + const demanded = commandHandler.demanded.slice(0); + const optional = commandHandler.optional.slice(0); + const positionalMap = {}; + validation.positionalCount(demanded.length, argv._.length); + while (demanded.length) { + const demand = demanded.shift(); + populatePositional(demand, argv, positionalMap); + } + while (optional.length) { + const maybe = optional.shift(); + populatePositional(maybe, argv, positionalMap); + } + argv._ = context.commands.concat(argv._); + postProcessPositionals(argv, positionalMap, self.cmdToParseOptions(commandHandler.original)); + return positionalMap; + } + function populatePositional(positional, argv, positionalMap) { + const cmd = positional.cmd[0]; + if (positional.variadic) { + positionalMap[cmd] = argv._.splice(0).map(String); + } + else { + if (argv._.length) + positionalMap[cmd] = [String(argv._.shift())]; + } + } + // we run yargs-parser against the positional arguments + // applying the same parsing logic used for flags. + function postProcessPositionals(argv, positionalMap, parseOptions) { + // combine the parsing hints we've inferred from the command + // string with explicitly configured parsing hints. + const options = Object.assign({}, yargs.getOptions()); + options.default = Object.assign(parseOptions.default, options.default); + for (const key of Object.keys(parseOptions.alias)) { + options.alias[key] = (options.alias[key] || []).concat(parseOptions.alias[key]); + } + options.array = options.array.concat(parseOptions.array); + delete options.config; // don't load config when processing positionals. + const unparsed = []; + Object.keys(positionalMap).forEach((key) => { + positionalMap[key].map((value) => { + if (options.configuration['unknown-options-as-args']) + options.key[key] = true; + unparsed.push(`--${key}`); + unparsed.push(value); + }); + }); + // short-circuit parse. + if (!unparsed.length) + return; + const config = Object.assign({}, options.configuration, { + 'populate--': true + }); + const parsed = Parser.detailed(unparsed, Object.assign({}, options, { + configuration: config + })); + if (parsed.error) { + yargs.getUsageInstance().fail(parsed.error.message, parsed.error); + } + else { + // only copy over positional keys (don't overwrite + // flag arguments that were already parsed). + const positionalKeys = Object.keys(positionalMap); + Object.keys(positionalMap).forEach((key) => { + positionalKeys.push(...parsed.aliases[key]); + }); + Object.keys(parsed.argv).forEach((key) => { + if (positionalKeys.indexOf(key) !== -1) { + // any new aliases need to be placed in positionalMap, which + // is used for validation. + if (!positionalMap[key]) + positionalMap[key] = parsed.argv[key]; + argv[key] = parsed.argv[key]; + } + }); + } + } + self.cmdToParseOptions = function (cmdString) { + const parseOptions = { + array: [], + default: {}, + alias: {}, + demand: {} + }; + const parsed = parse_command_1.parseCommand(cmdString); + parsed.demanded.forEach((d) => { + const [cmd, ...aliases] = d.cmd; + if (d.variadic) { + parseOptions.array.push(cmd); + parseOptions.default[cmd] = []; + } + parseOptions.alias[cmd] = aliases; + parseOptions.demand[cmd] = true; + }); + parsed.optional.forEach((o) => { + const [cmd, ...aliases] = o.cmd; + if (o.variadic) { + parseOptions.array.push(cmd); + parseOptions.default[cmd] = []; + } + parseOptions.alias[cmd] = aliases; + }); + return parseOptions; + }; + self.reset = () => { + handlers = {}; + aliasMap = {}; + defaultCommand = undefined; + return self; + }; + // used by yargs.parse() to freeze + // the state of commands such that + // we can apply .parse() multiple times + // with the same yargs instance. + const frozens = []; + self.freeze = () => { + frozens.push({ + handlers, + aliasMap, + defaultCommand + }); + }; + self.unfreeze = () => { + const frozen = frozens.pop(); + common_types_1.assertNotStrictEqual(frozen, undefined); + ({ + handlers, + aliasMap, + defaultCommand + } = frozen); + }; + return self; +} +exports.command = command; +function isCommandHandlerDefinition(cmd) { + return typeof cmd === 'object'; +} +exports.isCommandHandlerDefinition = isCommandHandlerDefinition; +function isCommandBuilderDefinition(builder) { + return typeof builder === 'object' && + !!builder.builder && + typeof builder.handler === 'function'; +} +exports.isCommandBuilderDefinition = isCommandBuilderDefinition; +function isCommandBuilderCallback(builder) { + return typeof builder === 'function'; +} +exports.isCommandBuilderCallback = isCommandBuilderCallback; +function isCommandBuilderOptionDefinitions(builder) { + return typeof builder === 'object'; +} diff --git a/node_modules/yargs/build/lib/common-types.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/common-types.js similarity index 100% rename from node_modules/yargs/build/lib/common-types.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/common-types.js diff --git a/node_modules/lighthouse/node_modules/yargs/build/lib/completion-templates.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/completion-templates.js similarity index 71% rename from node_modules/lighthouse/node_modules/yargs/build/lib/completion-templates.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/completion-templates.js index 2c4dcb580..3ee0e0685 100644 --- a/node_modules/lighthouse/node_modules/yargs/build/lib/completion-templates.js +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/completion-templates.js @@ -1,11 +1,14 @@ -export const completionShTemplate = `###-begin-{{app_name}}-completions-### +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.completionZshTemplate = exports.completionShTemplate = void 0; +exports.completionShTemplate = `###-begin-{{app_name}}-completions-### # # yargs command completion script # # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX. # -_{{app_name}}_yargs_completions() +_yargs_completions() { local cur_word args type_list @@ -24,16 +27,15 @@ _{{app_name}}_yargs_completions() return 0 } -complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}} +complete -o default -F _yargs_completions {{app_name}} ###-end-{{app_name}}-completions-### `; -export const completionZshTemplate = `#compdef {{app_name}} -###-begin-{{app_name}}-completions-### +exports.completionZshTemplate = `###-begin-{{app_name}}-completions-### # # yargs command completion script # # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc -# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX. +# or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX. # _{{app_name}}_yargs_completions() { diff --git a/node_modules/@lhci/cli/node_modules/yargs/build/lib/completion.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/completion.js new file mode 100644 index 000000000..d65925ab8 --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/completion.js @@ -0,0 +1,135 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.completion = void 0; +const command_1 = require("./command"); +const templates = require("./completion-templates"); +const is_promise_1 = require("./is-promise"); +const parse_command_1 = require("./parse-command"); +const path = require("path"); +const common_types_1 = require("./common-types"); +// add bash completions to your +// yargs-powered applications. +function completion(yargs, usage, command) { + const self = { + completionKey: 'get-yargs-completions' + }; + let aliases; + self.setParsed = function setParsed(parsed) { + aliases = parsed.aliases; + }; + const zshShell = (process.env.SHELL && process.env.SHELL.indexOf('zsh') !== -1) || + (process.env.ZSH_NAME && process.env.ZSH_NAME.indexOf('zsh') !== -1); + // get a list of completion commands. + // 'args' is the array of strings from the line to be completed + self.getCompletion = function getCompletion(args, done) { + const completions = []; + const current = args.length ? args[args.length - 1] : ''; + const argv = yargs.parse(args, true); + const parentCommands = yargs.getContext().commands; + // a custom completion function can be provided + // to completion(). + function runCompletionFunction(argv) { + common_types_1.assertNotStrictEqual(completionFunction, null); + if (isSyncCompletionFunction(completionFunction)) { + const result = completionFunction(current, argv); + // promise based completion function. + if (is_promise_1.isPromise(result)) { + return result.then((list) => { + process.nextTick(() => { done(list); }); + }).catch((err) => { + process.nextTick(() => { throw err; }); + }); + } + // synchronous completion function. + return done(result); + } + else { + // asynchronous completion function + return completionFunction(current, argv, (completions) => { + done(completions); + }); + } + } + if (completionFunction) { + return is_promise_1.isPromise(argv) ? argv.then(runCompletionFunction) : runCompletionFunction(argv); + } + const handlers = command.getCommandHandlers(); + for (let i = 0, ii = args.length; i < ii; ++i) { + if (handlers[args[i]] && handlers[args[i]].builder) { + const builder = handlers[args[i]].builder; + if (command_1.isCommandBuilderCallback(builder)) { + const y = yargs.reset(); + builder(y); + return y.argv; + } + } + } + if (!current.match(/^-/) && parentCommands[parentCommands.length - 1] !== current) { + usage.getCommands().forEach((usageCommand) => { + const commandName = parse_command_1.parseCommand(usageCommand[0]).cmd; + if (args.indexOf(commandName) === -1) { + if (!zshShell) { + completions.push(commandName); + } + else { + const desc = usageCommand[1] || ''; + completions.push(commandName.replace(/:/g, '\\:') + ':' + desc); + } + } + }); + } + if (current.match(/^-/) || (current === '' && completions.length === 0)) { + const descs = usage.getDescriptions(); + const options = yargs.getOptions(); + Object.keys(options.key).forEach((key) => { + const negable = !!options.configuration['boolean-negation'] && options.boolean.includes(key); + // If the key and its aliases aren't in 'args', add the key to 'completions' + let keyAndAliases = [key].concat(aliases[key] || []); + if (negable) + keyAndAliases = keyAndAliases.concat(keyAndAliases.map(key => `no-${key}`)); + function completeOptionKey(key) { + const notInArgs = keyAndAliases.every(val => args.indexOf(`--${val}`) === -1); + if (notInArgs) { + const startsByTwoDashes = (s) => /^--/.test(s); + const isShortOption = (s) => /^[^0-9]$/.test(s); + const dashes = !startsByTwoDashes(current) && isShortOption(key) ? '-' : '--'; + if (!zshShell) { + completions.push(dashes + key); + } + else { + const desc = descs[key] || ''; + completions.push(dashes + `${key.replace(/:/g, '\\:')}:${desc.replace('__yargsString__:', '')}`); + } + } + } + completeOptionKey(key); + if (negable && !!options.default[key]) + completeOptionKey(`no-${key}`); + }); + } + done(completions); + }; + // generate the completion script to add to your .bashrc. + self.generateCompletionScript = function generateCompletionScript($0, cmd) { + let script = zshShell ? templates.completionZshTemplate : templates.completionShTemplate; + const name = path.basename($0); + // add ./to applications not yet installed as bin. + if ($0.match(/\.js$/)) + $0 = `./${$0}`; + script = script.replace(/{{app_name}}/g, name); + script = script.replace(/{{completion_command}}/g, cmd); + return script.replace(/{{app_path}}/g, $0); + }; + // register a function to perform your own custom + // completions., this function can be either + // synchrnous or asynchronous. + let completionFunction = null; + self.registerFunction = (fn) => { + completionFunction = fn; + }; + return self; +} +exports.completion = completion; +function isSyncCompletionFunction(completionFunction) { + return completionFunction.length < 3; +} diff --git a/node_modules/yargs/build/lib/is-promise.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/is-promise.js similarity index 100% rename from node_modules/yargs/build/lib/is-promise.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/is-promise.js diff --git a/node_modules/yargs/build/lib/levenshtein.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/levenshtein.js similarity index 100% rename from node_modules/yargs/build/lib/levenshtein.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/levenshtein.js diff --git a/node_modules/@lhci/cli/node_modules/yargs/build/lib/middleware.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/middleware.js new file mode 100644 index 000000000..e93b6d277 --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/middleware.js @@ -0,0 +1,57 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.applyMiddleware = exports.commandMiddlewareFactory = exports.globalMiddlewareFactory = void 0; +const argsert_1 = require("./argsert"); +const is_promise_1 = require("./is-promise"); +function globalMiddlewareFactory(globalMiddleware, context) { + return function (callback, applyBeforeValidation = false) { + argsert_1.argsert(' [boolean]', [callback, applyBeforeValidation], arguments.length); + if (Array.isArray(callback)) { + for (let i = 0; i < callback.length; i++) { + if (typeof callback[i] !== 'function') { + throw Error('middleware must be a function'); + } + callback[i].applyBeforeValidation = applyBeforeValidation; + } + Array.prototype.push.apply(globalMiddleware, callback); + } + else if (typeof callback === 'function') { + callback.applyBeforeValidation = applyBeforeValidation; + globalMiddleware.push(callback); + } + return context; + }; +} +exports.globalMiddlewareFactory = globalMiddlewareFactory; +function commandMiddlewareFactory(commandMiddleware) { + if (!commandMiddleware) + return []; + return commandMiddleware.map(middleware => { + middleware.applyBeforeValidation = false; + return middleware; + }); +} +exports.commandMiddlewareFactory = commandMiddlewareFactory; +function applyMiddleware(argv, yargs, middlewares, beforeValidation) { + const beforeValidationError = new Error('middleware cannot return a promise when applyBeforeValidation is true'); + return middlewares + .reduce((acc, middleware) => { + if (middleware.applyBeforeValidation !== beforeValidation) { + return acc; + } + if (is_promise_1.isPromise(acc)) { + return acc + .then(initialObj => Promise.all([initialObj, middleware(initialObj, yargs)])) + .then(([initialObj, middlewareObj]) => Object.assign(initialObj, middlewareObj)); + } + else { + const result = middleware(acc, yargs); + if (beforeValidation && is_promise_1.isPromise(result)) + throw beforeValidationError; + return is_promise_1.isPromise(result) + ? result.then(middlewareObj => Object.assign(acc, middlewareObj)) + : Object.assign(acc, result); + } + }, argv); +} +exports.applyMiddleware = applyMiddleware; diff --git a/node_modules/yargs/build/lib/obj-filter.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/obj-filter.js similarity index 100% rename from node_modules/yargs/build/lib/obj-filter.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/obj-filter.js diff --git a/node_modules/lighthouse/node_modules/yargs/build/lib/parse-command.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/parse-command.js similarity index 79% rename from node_modules/lighthouse/node_modules/yargs/build/lib/parse-command.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/parse-command.js index 4989f5310..aaf232727 100644 --- a/node_modules/lighthouse/node_modules/yargs/build/lib/parse-command.js +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/parse-command.js @@ -1,4 +1,7 @@ -export function parseCommand(cmd) { +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseCommand = void 0; +function parseCommand(cmd) { const extraSpacesStrippedCommand = cmd.replace(/\s{2,}/g, ' '); const splitCommand = extraSpacesStrippedCommand.split(/\s+(?![^[]*]|[^<]*>)/); const bregex = /\.*[\][<>]/g; @@ -8,7 +11,7 @@ export function parseCommand(cmd) { const parsedCommand = { cmd: firstCommand.replace(bregex, ''), demanded: [], - optional: [], + optional: [] }; splitCommand.forEach((cmd, i) => { let variadic = false; @@ -18,15 +21,16 @@ export function parseCommand(cmd) { if (/^\[/.test(cmd)) { parsedCommand.optional.push({ cmd: cmd.replace(bregex, '').split('|'), - variadic, + variadic }); } else { parsedCommand.demanded.push({ cmd: cmd.replace(bregex, '').split('|'), - variadic, + variadic }); } }); return parsedCommand; } +exports.parseCommand = parseCommand; diff --git a/node_modules/yargs/build/lib/process-argv.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/process-argv.js similarity index 100% rename from node_modules/yargs/build/lib/process-argv.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/process-argv.js diff --git a/node_modules/lighthouse/node_modules/yargs/build/lib/usage.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/usage.js similarity index 55% rename from node_modules/lighthouse/node_modules/yargs/build/lib/usage.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/usage.js index 0127c130d..73f7b2448 100644 --- a/node_modules/lighthouse/node_modules/yargs/build/lib/usage.js +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/usage.js @@ -1,48 +1,46 @@ -import { objFilter } from './utils/obj-filter.js'; -import { YError } from './yerror.js'; -import setBlocking from './utils/set-blocking.js'; -function isBoolean(fail) { - return typeof fail === 'boolean'; -} -export function usage(yargs, shim) { - const __ = shim.y18n.__; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.usage = void 0; +// this file handles outputting usage instructions, +// failures, etc. keeps logging in one place. +const common_types_1 = require("./common-types"); +const obj_filter_1 = require("./obj-filter"); +const path = require("path"); +const yerror_1 = require("./yerror"); +const decamelize = require("decamelize"); +const setBlocking = require("set-blocking"); +const stringWidth = require("string-width"); +function usage(yargs, y18n) { + const __ = y18n.__; const self = {}; + // methods for ouputting/building failure message. const fails = []; self.failFn = function failFn(f) { fails.push(f); }; let failMessage = null; - let globalFailMessage = null; let showHelpOnFail = true; self.showHelpOnFail = function showHelpOnFailFn(arg1 = true, arg2) { - const [enabled, message] = typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2]; - if (yargs.getInternalMethods().isGlobalContext()) { - globalFailMessage = message; + function parseFunctionArgs() { + return typeof arg1 === 'string' ? [true, arg1] : [arg1, arg2]; } + const [enabled, message] = parseFunctionArgs(); failMessage = message; showHelpOnFail = enabled; return self; }; let failureOutput = false; self.fail = function fail(msg, err) { - const logger = yargs.getInternalMethods().getLoggerInstance(); + const logger = yargs._getLoggerInstance(); if (fails.length) { for (let i = fails.length - 1; i >= 0; --i) { - const fail = fails[i]; - if (isBoolean(fail)) { - if (err) - throw err; - else if (msg) - throw Error(msg); - } - else { - fail(msg, err, self); - } + fails[i](msg, err, self); } } else { if (yargs.getExitProcess()) setBlocking(true); + // don't output failure message more than once if (!failureOutput) { failureOutput = true; if (showHelpOnFail) { @@ -51,18 +49,17 @@ export function usage(yargs, shim) { } if (msg || err) logger.error(msg || err); - const globalOrCommandFailMessage = failMessage || globalFailMessage; - if (globalOrCommandFailMessage) { + if (failMessage) { if (msg || err) logger.error(''); - logger.error(globalOrCommandFailMessage); + logger.error(failMessage); } } - err = err || new YError(msg); + err = err || new yerror_1.YError(msg); if (yargs.getExitProcess()) { return yargs.exit(1); } - else if (yargs.getInternalMethods().hasParseCallback()) { + else if (yargs._hasParseCallback()) { return yargs.exit(1, err); } else { @@ -70,6 +67,7 @@ export function usage(yargs, shim) { } } }; + // methods for ouputting/building help (usage) message. let usages = []; let usageDisabled = false; self.usage = (msg, description) => { @@ -97,8 +95,9 @@ export function usage(yargs, shim) { }; let commands = []; self.command = function command(cmd, description, isDefault, aliases, deprecated = false) { + // the last default wins, so cancel out any previously set default if (isDefault) { - commands = commands.map(cmdArray => { + commands = commands.map((cmdArray) => { cmdArray[2] = false; return cmdArray; }); @@ -109,12 +108,12 @@ export function usage(yargs, shim) { let descriptions = {}; self.describe = function describe(keyOrKeys, desc) { if (Array.isArray(keyOrKeys)) { - keyOrKeys.forEach(k => { + keyOrKeys.forEach((k) => { self.describe(k, desc); }); } else if (typeof keyOrKeys === 'object') { - Object.keys(keyOrKeys).forEach(k => { + Object.keys(keyOrKeys).forEach((k) => { self.describe(k, keyOrKeys[k]); }); } @@ -124,34 +123,30 @@ export function usage(yargs, shim) { }; self.getDescriptions = () => descriptions; let epilogs = []; - self.epilog = msg => { + self.epilog = (msg) => { epilogs.push(msg); }; let wrapSet = false; let wrap; - self.wrap = cols => { + self.wrap = (cols) => { wrapSet = true; wrap = cols; }; - self.getWrap = () => { - if (shim.getEnv('YARGS_DISABLE_WRAP')) { - return null; - } + function getWrap() { if (!wrapSet) { wrap = windowWidth(); wrapSet = true; } return wrap; - }; + } const deferY18nLookupPrefix = '__yargsString__:'; self.deferY18nLookup = str => deferY18nLookupPrefix + str; self.help = function help() { if (cachedHelpMessage) return cachedHelpMessage; normalizeAliases(); - const base$0 = yargs.customScriptName - ? yargs.$0 - : shim.path.basename(yargs.$0); + // handle old demanded API + const base$0 = yargs.customScriptName ? yargs.$0 : path.basename(yargs.$0); const demandedOptions = yargs.getDemandedOptions(); const demandedCommands = yargs.getDemandedCommands(); const deprecatedOptions = yargs.getDeprecatedOptions(); @@ -168,15 +163,17 @@ export function usage(yargs, shim) { acc[key] = true; return acc; }, {})); - const theWrap = self.getWrap(); - const ui = shim.cliui({ + const theWrap = getWrap(); + const ui = require('cliui')({ width: theWrap, - wrap: !!theWrap, + wrap: !!theWrap }); + // the usage string. if (!usageDisabled) { if (usages.length) { - usages.forEach(usage => { - ui.div({ text: `${usage[0].replace(/\$0/g, base$0)}` }); + // user-defined usage. + usages.forEach((usage) => { + ui.div(`${usage[0].replace(/\$0/g, base$0)}`); if (usage[1]) { ui.div({ text: `${usage[1]}`, padding: [1, 0, 0, 0] }); } @@ -185,6 +182,7 @@ export function usage(yargs, shim) { } else if (commands.length) { let u = null; + // demonstrate how commands are used. if (demandedCommands._) { u = `${base$0} <${__('command')}>\n`; } @@ -194,23 +192,21 @@ export function usage(yargs, shim) { ui.div(`${u}`); } } - if (commands.length > 1 || (commands.length === 1 && !commands[0][2])) { + // your application's commands, i.e., non-option + // arguments populated in '_'. + if (commands.length) { ui.div(__('Commands:')); - const context = yargs.getInternalMethods().getContext(); - const parentCommands = context.commands.length - ? `${context.commands.join(' ')} ` - : ''; - if (yargs.getInternalMethods().getParserConfiguration()['sort-commands'] === - true) { + const context = yargs.getContext(); + const parentCommands = context.commands.length ? `${context.commands.join(' ')} ` : ''; + if (yargs.getParserConfiguration()['sort-commands'] === true) { commands = commands.sort((a, b) => a[0].localeCompare(b[0])); } - const prefix = base$0 ? `${base$0} ` : ''; - commands.forEach(command => { - const commandString = `${prefix}${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; + commands.forEach((command) => { + const commandString = `${base$0} ${parentCommands}${command[0].replace(/^\$0 ?/, '')}`; // drop $0 from default commands. ui.span({ text: commandString, padding: [0, 2, 0, 2], - width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4, + width: maxWidth(commands, theWrap, `${base$0}${parentCommands}`) + 4 }, { text: command[1] }); const hints = []; if (command[2]) @@ -227,11 +223,7 @@ export function usage(yargs, shim) { } } if (hints.length) { - ui.div({ - text: hints.join(' '), - padding: [0, 0, 0, 2], - align: 'right', - }); + ui.div({ text: hints.join(' '), padding: [0, 0, 0, 2], align: 'right' }); } else { ui.div(); @@ -239,207 +231,192 @@ export function usage(yargs, shim) { }); ui.div(); } - const aliasKeys = (Object.keys(options.alias) || []).concat(Object.keys(yargs.parsed.newAliases) || []); - keys = keys.filter(key => !yargs.parsed.newAliases[key] && - aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)); + // perform some cleanup on the keys array, making it + // only include top-level keys not their aliases. + const aliasKeys = (Object.keys(options.alias) || []) + .concat(Object.keys(yargs.parsed.newAliases) || []); + keys = keys.filter(key => !yargs.parsed.newAliases[key] && aliasKeys.every(alias => (options.alias[alias] || []).indexOf(key) === -1)); + // populate 'Options:' group with any keys that have not + // explicitly had a group set. const defaultGroup = __('Options:'); if (!groups[defaultGroup]) groups[defaultGroup] = []; addUngroupedKeys(keys, options.alias, groups, defaultGroup); - const isLongSwitch = (sw) => /^--/.test(getText(sw)); - const displayedGroups = Object.keys(groups) - .filter(groupName => groups[groupName].length > 0) - .map(groupName => { - const normalizedKeys = groups[groupName] - .filter(filterHiddenOptions) - .map(key => { - if (aliasKeys.includes(key)) + // display 'Options:' table along with any custom tables: + Object.keys(groups).forEach((groupName) => { + if (!groups[groupName].length) + return; + // if we've grouped the key 'f', but 'f' aliases 'foobar', + // normalizedKeys should contain only 'foobar'. + const normalizedKeys = groups[groupName].filter(filterHiddenOptions).map((key) => { + if (~aliasKeys.indexOf(key)) return key; for (let i = 0, aliasKey; (aliasKey = aliasKeys[i]) !== undefined; i++) { - if ((options.alias[aliasKey] || []).includes(key)) + if (~(options.alias[aliasKey] || []).indexOf(key)) return aliasKey; } return key; }); - return { groupName, normalizedKeys }; - }) - .filter(({ normalizedKeys }) => normalizedKeys.length > 0) - .map(({ groupName, normalizedKeys }) => { + if (normalizedKeys.length < 1) + return; + ui.div(groupName); + // actually generate the switches string --foo, -f, --bar. const switches = normalizedKeys.reduce((acc, key) => { - acc[key] = [key] - .concat(options.alias[key] || []) + acc[key] = [key].concat(options.alias[key] || []) .map(sw => { + // for the special positional group don't + // add '--' or '-' prefix. if (groupName === self.getPositionalGroupName()) return sw; else { - return ((/^[0-9]$/.test(sw) - ? options.boolean.includes(key) - ? '-' - : '--' - : sw.length > 1 - ? '--' - : '-') + sw); + return ( + // matches yargs-parser logic in which single-digits + // aliases declared with a boolean type are now valid + /^[0-9]$/.test(sw) + ? ~options.boolean.indexOf(key) ? '-' : '--' + : sw.length > 1 ? '--' : '-') + sw; } }) - .sort((sw1, sw2) => isLongSwitch(sw1) === isLongSwitch(sw2) - ? 0 - : isLongSwitch(sw1) - ? 1 - : -1) .join(', '); return acc; }, {}); - return { groupName, normalizedKeys, switches }; - }); - const shortSwitchesUsed = displayedGroups - .filter(({ groupName }) => groupName !== self.getPositionalGroupName()) - .some(({ normalizedKeys, switches }) => !normalizedKeys.every(key => isLongSwitch(switches[key]))); - if (shortSwitchesUsed) { - displayedGroups - .filter(({ groupName }) => groupName !== self.getPositionalGroupName()) - .forEach(({ normalizedKeys, switches }) => { - normalizedKeys.forEach(key => { - if (isLongSwitch(switches[key])) { - switches[key] = addIndentation(switches[key], '-x, '.length); - } - }); - }); - } - displayedGroups.forEach(({ groupName, normalizedKeys, switches }) => { - ui.div(groupName); - normalizedKeys.forEach(key => { + normalizedKeys.forEach((key) => { const kswitch = switches[key]; let desc = descriptions[key] || ''; let type = null; - if (desc.includes(deferY18nLookupPrefix)) + if (~desc.lastIndexOf(deferY18nLookupPrefix)) desc = __(desc.substring(deferY18nLookupPrefix.length)); - if (options.boolean.includes(key)) + if (~options.boolean.indexOf(key)) type = `[${__('boolean')}]`; - if (options.count.includes(key)) + if (~options.count.indexOf(key)) type = `[${__('count')}]`; - if (options.string.includes(key)) + if (~options.string.indexOf(key)) type = `[${__('string')}]`; - if (options.normalize.includes(key)) + if (~options.normalize.indexOf(key)) type = `[${__('string')}]`; - if (options.array.includes(key)) + if (~options.array.indexOf(key)) type = `[${__('array')}]`; - if (options.number.includes(key)) + if (~options.number.indexOf(key)) type = `[${__('number')}]`; const deprecatedExtra = (deprecated) => typeof deprecated === 'string' ? `[${__('deprecated: %s', deprecated)}]` : `[${__('deprecated')}]`; const extra = [ - key in deprecatedOptions - ? deprecatedExtra(deprecatedOptions[key]) - : null, + (key in deprecatedOptions) ? deprecatedExtra(deprecatedOptions[key]) : null, type, - key in demandedOptions ? `[${__('required')}]` : null, - options.choices && options.choices[key] - ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` - : null, - defaultString(options.default[key], options.defaultDescription[key]), - ] - .filter(Boolean) - .join(' '); - ui.span({ - text: getText(kswitch), - padding: [0, 2, 0, 2 + getIndentation(kswitch)], - width: maxWidth(switches, theWrap) + 4, - }, desc); - const shouldHideOptionExtras = yargs.getInternalMethods().getUsageConfiguration()['hide-types'] === - true; - if (extra && !shouldHideOptionExtras) + (key in demandedOptions) ? `[${__('required')}]` : null, + options.choices && options.choices[key] ? `[${__('choices:')} ${self.stringifiedValues(options.choices[key])}]` : null, + defaultString(options.default[key], options.defaultDescription[key]) + ].filter(Boolean).join(' '); + ui.span({ text: kswitch, padding: [0, 2, 0, 2], width: maxWidth(switches, theWrap) + 4 }, desc); + if (extra) ui.div({ text: extra, padding: [0, 0, 0, 2], align: 'right' }); else ui.div(); }); ui.div(); }); + // describe some common use-cases for your application. if (examples.length) { ui.div(__('Examples:')); - examples.forEach(example => { + examples.forEach((example) => { example[0] = example[0].replace(/\$0/g, base$0); }); - examples.forEach(example => { + examples.forEach((example) => { if (example[1] === '') { ui.div({ text: example[0], - padding: [0, 2, 0, 2], + padding: [0, 2, 0, 2] }); } else { ui.div({ text: example[0], padding: [0, 2, 0, 2], - width: maxWidth(examples, theWrap) + 4, + width: maxWidth(examples, theWrap) + 4 }, { - text: example[1], + text: example[1] }); } }); ui.div(); } + // the usage string. if (epilogs.length > 0) { - const e = epilogs - .map(epilog => epilog.replace(/\$0/g, base$0)) - .join('\n'); + const e = epilogs.map(epilog => epilog.replace(/\$0/g, base$0)).join('\n'); ui.div(`${e}\n`); } + // Remove the trailing white spaces return ui.toString().replace(/\s*$/, ''); }; + // return the maximum width of a string + // in the left-hand column of a table. function maxWidth(table, theWrap, modifier) { let width = 0; + // table might be of the form [leftColumn], + // or {key: leftColumn} if (!Array.isArray(table)) { table = Object.values(table).map(v => [v]); } - table.forEach(v => { - width = Math.max(shim.stringWidth(modifier ? `${modifier} ${getText(v[0])}` : getText(v[0])) + getIndentation(v[0]), width); + table.forEach((v) => { + width = Math.max(stringWidth(modifier ? `${modifier} ${v[0]}` : v[0]), width); }); + // if we've enabled 'wrap' we should limit + // the max-width of the left-column. if (theWrap) width = Math.min(width, parseInt((theWrap * 0.5).toString(), 10)); return width; } + // make sure any options set for aliases, + // are copied to the keys being aliased. function normalizeAliases() { + // handle old demanded API const demandedOptions = yargs.getDemandedOptions(); const options = yargs.getOptions(); - (Object.keys(options.alias) || []).forEach(key => { - options.alias[key].forEach(alias => { + (Object.keys(options.alias) || []).forEach((key) => { + options.alias[key].forEach((alias) => { + // copy descriptions. if (descriptions[alias]) self.describe(key, descriptions[alias]); + // copy demanded. if (alias in demandedOptions) yargs.demandOption(key, demandedOptions[alias]); - if (options.boolean.includes(alias)) + // type messages. + if (~options.boolean.indexOf(alias)) yargs.boolean(key); - if (options.count.includes(alias)) + if (~options.count.indexOf(alias)) yargs.count(key); - if (options.string.includes(alias)) + if (~options.string.indexOf(alias)) yargs.string(key); - if (options.normalize.includes(alias)) + if (~options.normalize.indexOf(alias)) yargs.normalize(key); - if (options.array.includes(alias)) + if (~options.array.indexOf(alias)) yargs.array(key); - if (options.number.includes(alias)) + if (~options.number.indexOf(alias)) yargs.number(key); }); }); } + // if yargs is executing an async handler, we take a snapshot of the + // help message to display on failure: let cachedHelpMessage; self.cacheHelpMessage = function () { cachedHelpMessage = this.help(); }; + // however this snapshot must be cleared afterwards + // not to be be used by next calls to parse self.clearCachedHelpMessage = function () { cachedHelpMessage = undefined; }; - self.hasCachedHelpMessage = function () { - return !!cachedHelpMessage; - }; + // given a set of keys, place any keys that are + // ungrouped under the 'Options:' grouping. function addUngroupedKeys(keys, aliases, groups, defaultGroup) { let groupedKeys = []; let toCheck = null; - Object.keys(groups).forEach(group => { + Object.keys(groups).forEach((group) => { groupedKeys = groupedKeys.concat(groups[group]); }); - keys.forEach(key => { + keys.forEach((key) => { toCheck = [key].concat(aliases[key]); if (!toCheck.some(k => groupedKeys.indexOf(k) !== -1)) { groups[defaultGroup].push(key); @@ -448,20 +425,17 @@ export function usage(yargs, shim) { return groupedKeys; } function filterHiddenOptions(key) { - return (yargs.getOptions().hiddenOptions.indexOf(key) < 0 || - yargs.parsed.argv[yargs.getOptions().showHiddenOpt]); + return yargs.getOptions().hiddenOptions.indexOf(key) < 0 || yargs.parsed.argv[yargs.getOptions().showHiddenOpt]; } self.showHelp = (level) => { - const logger = yargs.getInternalMethods().getLoggerInstance(); + const logger = yargs._getLoggerInstance(); if (!level) level = 'error'; const emit = typeof level === 'function' ? level : logger[level]; emit(self.help()); }; - self.functionDescription = fn => { - const description = fn.name - ? shim.Parser.decamelize(fn.name, '-') - : __('generated-value'); + self.functionDescription = (fn) => { + const description = fn.name ? decamelize(fn.name, '-') : __('generated-value'); return ['(', description, ')'].join(''); }; self.stringifiedValues = function stringifiedValues(values, separator) { @@ -470,13 +444,15 @@ export function usage(yargs, shim) { const array = [].concat(values); if (!values || !array.length) return string; - array.forEach(value => { + array.forEach((value) => { if (string.length) string += sep; string += JSON.stringify(value); }); return string; }; + // format the default-value-string displayed in + // the right-hand column. function defaultString(value, defaultDescription) { let string = `[${__('default:')} `; if (value === undefined && !defaultDescription) @@ -498,27 +474,30 @@ export function usage(yargs, shim) { } return `${string}]`; } + // guess the width of the console window, max-width 80. function windowWidth() { const maxWidth = 80; - if (shim.process.stdColumns) { - return Math.min(maxWidth, shim.process.stdColumns); + // CI is not a TTY + /* c8 ignore next 2 */ + if (typeof process === 'object' && process.stdout && process.stdout.columns) { + return Math.min(maxWidth, process.stdout.columns); } else { return maxWidth; } } + // logic for displaying application version. let version = null; - self.version = ver => { + self.version = (ver) => { version = ver; }; - self.showVersion = level => { - const logger = yargs.getInternalMethods().getLoggerInstance(); - if (!level) - level = 'error'; - const emit = typeof level === 'function' ? level : logger[level]; - emit(version); + self.showVersion = () => { + const logger = yargs._getLoggerInstance(); + logger.log(version); }; self.reset = function reset(localLookup) { + // do not reset wrap here + // do not reset fails here failMessage = null; failureOutput = false; usages = []; @@ -526,7 +505,7 @@ export function usage(yargs, shim) { epilogs = []; examples = []; commands = []; - descriptions = objFilter(descriptions, k => !localLookup[k]); + descriptions = obj_filter_1.objFilter(descriptions, k => !localLookup[k]); return self; }; const frozens = []; @@ -539,46 +518,23 @@ export function usage(yargs, shim) { epilogs, examples, commands, - descriptions, + descriptions }); }; - self.unfreeze = function unfreeze(defaultCommand = false) { + self.unfreeze = function unfreeze() { const frozen = frozens.pop(); - if (!frozen) - return; - if (defaultCommand) { - descriptions = { ...frozen.descriptions, ...descriptions }; - commands = [...frozen.commands, ...commands]; - usages = [...frozen.usages, ...usages]; - examples = [...frozen.examples, ...examples]; - epilogs = [...frozen.epilogs, ...epilogs]; - } - else { - ({ - failMessage, - failureOutput, - usages, - usageDisabled, - epilogs, - examples, - commands, - descriptions, - } = frozen); - } + common_types_1.assertNotStrictEqual(frozen, undefined); + ({ + failMessage, + failureOutput, + usages, + usageDisabled, + epilogs, + examples, + commands, + descriptions + } = frozen); }; return self; } -function isIndentedText(text) { - return typeof text === 'object'; -} -function addIndentation(text, indent) { - return isIndentedText(text) - ? { text: text.text, indentation: text.indentation + indent } - : { text, indentation: indent }; -} -function getIndentation(text) { - return isIndentedText(text) ? text.indentation : 0; -} -function getText(text) { - return isIndentedText(text) ? text.text : text; -} +exports.usage = usage; diff --git a/node_modules/lighthouse/node_modules/yargs/build/lib/validation.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/validation.js similarity index 54% rename from node_modules/lighthouse/node_modules/yargs/build/lib/validation.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/validation.js index bd2e1b8b1..60c5e43b4 100644 --- a/node_modules/lighthouse/node_modules/yargs/build/lib/validation.js +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/validation.js @@ -1,54 +1,63 @@ -import { argsert } from './argsert.js'; -import { assertNotStrictEqual, } from './typings/common-types.js'; -import { levenshtein as distance } from './utils/levenshtein.js'; -import { objFilter } from './utils/obj-filter.js'; +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.validation = void 0; +const argsert_1 = require("./argsert"); +const common_types_1 = require("./common-types"); +const levenshtein_1 = require("./levenshtein"); +const obj_filter_1 = require("./obj-filter"); const specialKeys = ['$0', '--', '_']; -export function validation(yargs, usage, shim) { - const __ = shim.y18n.__; - const __n = shim.y18n.__n; +// validation-type-stuff, missing params, +// bad implications, custom checks. +function validation(yargs, usage, y18n) { + const __ = y18n.__; + const __n = y18n.__n; const self = {}; + // validate appropriate # of non-option + // arguments were provided, i.e., '_'. self.nonOptionCount = function nonOptionCount(argv) { const demandedCommands = yargs.getDemandedCommands(); - const positionalCount = argv._.length + (argv['--'] ? argv['--'].length : 0); - const _s = positionalCount - yargs.getInternalMethods().getContext().commands.length; - if (demandedCommands._ && - (_s < demandedCommands._.min || _s > demandedCommands._.max)) { + // don't count currently executing commands + const _s = argv._.length - yargs.getContext().commands.length; + if (demandedCommands._ && (_s < demandedCommands._.min || _s > demandedCommands._.max)) { if (_s < demandedCommands._.min) { if (demandedCommands._.minMsg !== undefined) { - usage.fail(demandedCommands._.minMsg - ? demandedCommands._.minMsg - .replace(/\$0/g, _s.toString()) - .replace(/\$1/, demandedCommands._.min.toString()) + usage.fail( + // replace $0 with observed, $1 with expected. + demandedCommands._.minMsg + ? demandedCommands._.minMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.min.toString()) : null); } else { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s.toString(), demandedCommands._.min.toString())); + usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', _s, _s, demandedCommands._.min)); } } else if (_s > demandedCommands._.max) { if (demandedCommands._.maxMsg !== undefined) { - usage.fail(demandedCommands._.maxMsg - ? demandedCommands._.maxMsg - .replace(/\$0/g, _s.toString()) - .replace(/\$1/, demandedCommands._.max.toString()) + usage.fail( + // replace $0 with observed, $1 with expected. + demandedCommands._.maxMsg + ? demandedCommands._.maxMsg.replace(/\$0/g, _s.toString()).replace(/\$1/, demandedCommands._.max.toString()) : null); } else { - usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s.toString(), demandedCommands._.max.toString())); + usage.fail(__n('Too many non-option arguments: got %s, maximum of %s', 'Too many non-option arguments: got %s, maximum of %s', _s, _s, demandedCommands._.max)); } } } }; + // validate the appropriate # of + // positional arguments were provided: self.positionalCount = function positionalCount(required, observed) { if (observed < required) { - usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed + '', required + '')); + usage.fail(__n('Not enough non-option arguments: got %s, need at least %s', 'Not enough non-option arguments: got %s, need at least %s', observed, observed, required)); } }; - self.requiredArguments = function requiredArguments(argv, demandedOptions) { + // make sure all the required arguments are present. + self.requiredArguments = function requiredArguments(argv) { + const demandedOptions = yargs.getDemandedOptions(); let missing = null; for (const key of Object.keys(demandedOptions)) { - if (!Object.prototype.hasOwnProperty.call(argv, key) || - typeof argv[key] === 'undefined') { + if (!Object.prototype.hasOwnProperty.call(argv, key) || typeof argv[key] === 'undefined') { missing = missing || {}; missing[key] = demandedOptions[key]; } @@ -65,61 +74,38 @@ export function validation(yargs, usage, shim) { usage.fail(__n('Missing required argument: %s', 'Missing required arguments: %s', Object.keys(missing).length, Object.keys(missing).join(', ') + customMsg)); } }; - self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand, checkPositionals = true) { - var _a; - const commandKeys = yargs - .getInternalMethods() - .getCommandInstance() - .getCommands(); + // check for unknown arguments (strict-mode). + self.unknownArguments = function unknownArguments(argv, aliases, positionalMap, isDefaultCommand) { + const commandKeys = yargs.getCommandInstance().getCommands(); const unknown = []; - const currentContext = yargs.getInternalMethods().getContext(); - Object.keys(argv).forEach(key => { - if (!specialKeys.includes(key) && + const currentContext = yargs.getContext(); + Object.keys(argv).forEach((key) => { + if (specialKeys.indexOf(key) === -1 && !Object.prototype.hasOwnProperty.call(positionalMap, key) && - !Object.prototype.hasOwnProperty.call(yargs.getInternalMethods().getParseContext(), key) && + !Object.prototype.hasOwnProperty.call(yargs._getParseContext(), key) && !self.isValidAndSomeAliasIsNotNew(key, aliases)) { unknown.push(key); } }); - if (checkPositionals && - (currentContext.commands.length > 0 || - commandKeys.length > 0 || - isDefaultCommand)) { - argv._.slice(currentContext.commands.length).forEach(key => { - if (!commandKeys.includes('' + key)) { - unknown.push('' + key); + if ((currentContext.commands.length > 0) || (commandKeys.length > 0) || isDefaultCommand) { + argv._.slice(currentContext.commands.length).forEach((key) => { + if (commandKeys.indexOf(key) === -1) { + unknown.push(key); } }); } - if (checkPositionals) { - const demandedCommands = yargs.getDemandedCommands(); - const maxNonOptDemanded = ((_a = demandedCommands._) === null || _a === void 0 ? void 0 : _a.max) || 0; - const expected = currentContext.commands.length + maxNonOptDemanded; - if (expected < argv._.length) { - argv._.slice(expected).forEach(key => { - key = String(key); - if (!currentContext.commands.includes(key) && - !unknown.includes(key)) { - unknown.push(key); - } - }); - } - } - if (unknown.length) { - usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.map(s => (s.trim() ? s : `"${s}"`)).join(', '))); + if (unknown.length > 0) { + usage.fail(__n('Unknown argument: %s', 'Unknown arguments: %s', unknown.length, unknown.join(', '))); } }; self.unknownCommands = function unknownCommands(argv) { - const commandKeys = yargs - .getInternalMethods() - .getCommandInstance() - .getCommands(); + const commandKeys = yargs.getCommandInstance().getCommands(); const unknown = []; - const currentContext = yargs.getInternalMethods().getContext(); - if (currentContext.commands.length > 0 || commandKeys.length > 0) { - argv._.slice(currentContext.commands.length).forEach(key => { - if (!commandKeys.includes('' + key)) { - unknown.push('' + key); + const currentContext = yargs.getContext(); + if ((currentContext.commands.length > 0) || (commandKeys.length > 0)) { + argv._.slice(currentContext.commands.length).forEach((key) => { + if (commandKeys.indexOf(key) === -1) { + unknown.push(key); } }); } @@ -131,22 +117,31 @@ export function validation(yargs, usage, shim) { return false; } }; + // check for a key that is not an alias, or for which every alias is new, + // implying that it was invented by the parser, e.g., during camelization self.isValidAndSomeAliasIsNotNew = function isValidAndSomeAliasIsNotNew(key, aliases) { if (!Object.prototype.hasOwnProperty.call(aliases, key)) { return false; } const newAliases = yargs.parsed.newAliases; - return [key, ...aliases[key]].some(a => !Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]); + for (const a of [key, ...aliases[key]]) { + if (!Object.prototype.hasOwnProperty.call(newAliases, a) || !newAliases[key]) { + return true; + } + } + return false; }; + // validate arguments limited to enumerated choices self.limitedChoices = function limitedChoices(argv) { const options = yargs.getOptions(); const invalid = {}; if (!Object.keys(options.choices).length) return; - Object.keys(argv).forEach(key => { + Object.keys(argv).forEach((key) => { if (specialKeys.indexOf(key) === -1 && Object.prototype.hasOwnProperty.call(options.choices, key)) { - [].concat(argv[key]).forEach(value => { + [].concat(argv[key]).forEach((value) => { + // TODO case-insensitive configurability if (options.choices[key].indexOf(value) === -1 && value !== undefined) { invalid[key] = (invalid[key] || []).concat(value); @@ -158,16 +153,44 @@ export function validation(yargs, usage, shim) { if (!invalidKeys.length) return; let msg = __('Invalid values:'); - invalidKeys.forEach(key => { + invalidKeys.forEach((key) => { msg += `\n ${__('Argument: %s, Given: %s, Choices: %s', key, usage.stringifiedValues(invalid[key]), usage.stringifiedValues(options.choices[key]))}`; }); usage.fail(msg); }; + // custom checks, added using the `check` option on yargs. + let checks = []; + self.check = function check(f, global) { + checks.push({ + func: f, + global + }); + }; + self.customChecks = function customChecks(argv, aliases) { + for (let i = 0, f; (f = checks[i]) !== undefined; i++) { + const func = f.func; + let result = null; + try { + result = func(argv, aliases); + } + catch (err) { + usage.fail(err.message ? err.message : err, err); + continue; + } + if (!result) { + usage.fail(__('Argument check failed: %s', func.toString())); + } + else if (typeof result === 'string' || result instanceof Error) { + usage.fail(result.toString(), result); + } + } + }; + // check implications, argument foo implies => argument bar. let implied = {}; self.implies = function implies(key, value) { - argsert(' [array|number|string]', [key, value], arguments.length); + argsert_1.argsert(' [array|number|string]', [key, value], arguments.length); if (typeof key === 'object') { - Object.keys(key).forEach(k => { + Object.keys(key).forEach((k) => { self.implies(k, key[k]); }); } @@ -177,10 +200,10 @@ export function validation(yargs, usage, shim) { implied[key] = []; } if (Array.isArray(value)) { - value.forEach(i => self.implies(key, i)); + value.forEach((i) => self.implies(key, i)); } else { - assertNotStrictEqual(value, undefined, shim); + common_types_1.assertNotStrictEqual(value, undefined); implied[key].push(value); } } @@ -189,25 +212,29 @@ export function validation(yargs, usage, shim) { return implied; }; function keyExists(argv, val) { + // convert string '1' to number 1 const num = Number(val); val = isNaN(num) ? val : num; if (typeof val === 'number') { + // check length of argv._ val = argv._.length >= val; } else if (val.match(/^--no-.+/)) { + // check if key/value doesn't exist val = val.match(/^--no-(.+)/)[1]; - val = !Object.prototype.hasOwnProperty.call(argv, val); + val = !argv[val]; } else { - val = Object.prototype.hasOwnProperty.call(argv, val); + // check if key/value exists + val = argv[val]; } return val; } self.implications = function implications(argv) { const implyFail = []; - Object.keys(implied).forEach(key => { + Object.keys(implied).forEach((key) => { const origKey = key; - (implied[key] || []).forEach(value => { + (implied[key] || []).forEach((value) => { let key = origKey; const origValue = value; key = keyExists(argv, key); @@ -219,17 +246,17 @@ export function validation(yargs, usage, shim) { }); if (implyFail.length) { let msg = `${__('Implications failed:')}\n`; - implyFail.forEach(value => { - msg += value; + implyFail.forEach((value) => { + msg += (value); }); usage.fail(msg); } }; let conflicting = {}; self.conflicts = function conflicts(key, value) { - argsert(' [array|string]', [key, value], arguments.length); + argsert_1.argsert(' [array|string]', [key, value], arguments.length); if (typeof key === 'object') { - Object.keys(key).forEach(k => { + Object.keys(key).forEach((k) => { self.conflicts(k, key[k]); }); } @@ -239,7 +266,7 @@ export function validation(yargs, usage, shim) { conflicting[key] = []; } if (Array.isArray(value)) { - value.forEach(i => self.conflicts(key, i)); + value.forEach((i) => self.conflicts(key, i)); } else { conflicting[key].push(value); @@ -248,34 +275,25 @@ export function validation(yargs, usage, shim) { }; self.getConflicting = () => conflicting; self.conflicting = function conflictingFn(argv) { - Object.keys(argv).forEach(key => { + Object.keys(argv).forEach((key) => { if (conflicting[key]) { - conflicting[key].forEach(value => { + conflicting[key].forEach((value) => { + // we default keys to 'undefined' that have been configured, we should not + // apply conflicting check unless they are a value other than 'undefined'. if (value && argv[key] !== undefined && argv[value] !== undefined) { usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); } }); } }); - if (yargs.getInternalMethods().getParserConfiguration()['strip-dashed']) { - Object.keys(conflicting).forEach(key => { - conflicting[key].forEach(value => { - if (value && - argv[shim.Parser.camelCase(key)] !== undefined && - argv[shim.Parser.camelCase(value)] !== undefined) { - usage.fail(__('Arguments %s and %s are mutually exclusive', key, value)); - } - }); - }); - } }; self.recommendCommands = function recommendCommands(cmd, potentialCommands) { - const threshold = 3; + const threshold = 3; // if it takes more than three edits, let's move on. potentialCommands = potentialCommands.sort((a, b) => b.length - a.length); let recommended = null; let bestDistance = Infinity; for (let i = 0, candidate; (candidate = potentialCommands[i]) !== undefined; i++) { - const d = distance(cmd, candidate); + const d = levenshtein_1.levenshtein(cmd, candidate); if (d <= threshold && d < bestDistance) { bestDistance = d; recommended = candidate; @@ -285,21 +303,28 @@ export function validation(yargs, usage, shim) { usage.fail(__('Did you mean %s?', recommended)); }; self.reset = function reset(localLookup) { - implied = objFilter(implied, k => !localLookup[k]); - conflicting = objFilter(conflicting, k => !localLookup[k]); + implied = obj_filter_1.objFilter(implied, k => !localLookup[k]); + conflicting = obj_filter_1.objFilter(conflicting, k => !localLookup[k]); + checks = checks.filter(c => c.global); return self; }; const frozens = []; self.freeze = function freeze() { frozens.push({ implied, - conflicting, + checks, + conflicting }); }; self.unfreeze = function unfreeze() { const frozen = frozens.pop(); - assertNotStrictEqual(frozen, undefined, shim); - ({ implied, conflicting } = frozen); + common_types_1.assertNotStrictEqual(frozen, undefined); + ({ + implied, + checks, + conflicting + } = frozen); }; return self; } +exports.validation = validation; diff --git a/node_modules/yargs/build/lib/yargs.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/yargs.js similarity index 100% rename from node_modules/yargs/build/lib/yargs.js rename to node_modules/@lhci/cli/node_modules/yargs/build/lib/yargs.js diff --git a/node_modules/@lhci/cli/node_modules/yargs/build/lib/yerror.js b/node_modules/@lhci/cli/node_modules/yargs/build/lib/yerror.js new file mode 100644 index 000000000..0fa146e56 --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/build/lib/yerror.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.YError = void 0; +class YError extends Error { + constructor(msg) { + super(msg || 'yargs error'); + this.name = 'YError'; + Error.captureStackTrace(this, YError); + } +} +exports.YError = YError; diff --git a/node_modules/yargs/index.js b/node_modules/@lhci/cli/node_modules/yargs/index.js similarity index 100% rename from node_modules/yargs/index.js rename to node_modules/@lhci/cli/node_modules/yargs/index.js diff --git a/node_modules/lighthouse/node_modules/yargs/locales/be.json b/node_modules/@lhci/cli/node_modules/yargs/locales/be.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/be.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/be.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/de.json b/node_modules/@lhci/cli/node_modules/yargs/locales/de.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/de.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/de.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/en.json b/node_modules/@lhci/cli/node_modules/yargs/locales/en.json similarity index 94% rename from node_modules/lighthouse/node_modules/yargs/locales/en.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/en.json index af096a110..d794947dc 100644 --- a/node_modules/lighthouse/node_modules/yargs/locales/en.json +++ b/node_modules/@lhci/cli/node_modules/yargs/locales/en.json @@ -33,10 +33,6 @@ "one": "Unknown argument: %s", "other": "Unknown arguments: %s" }, - "Unknown command: %s": { - "one": "Unknown command: %s", - "other": "Unknown commands: %s" - }, "Invalid values:": "Invalid values:", "Argument: %s, Given: %s, Choices: %s": "Argument: %s, Given: %s, Choices: %s", "Argument check failed: %s": "Argument check failed: %s", diff --git a/node_modules/lighthouse/node_modules/yargs/locales/es.json b/node_modules/@lhci/cli/node_modules/yargs/locales/es.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/es.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/es.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/fi.json b/node_modules/@lhci/cli/node_modules/yargs/locales/fi.json similarity index 98% rename from node_modules/lighthouse/node_modules/yargs/locales/fi.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/fi.json index 481feb710..0728c5784 100644 --- a/node_modules/lighthouse/node_modules/yargs/locales/fi.json +++ b/node_modules/@lhci/cli/node_modules/yargs/locales/fi.json @@ -30,7 +30,7 @@ "other": "Pakollisia argumentteja puuttuu: %s" }, "Unknown argument: %s": { - "one": "Tuntematon argumentti: %s", + "one": "Tuntematon argumenttn: %s", "other": "Tuntemattomia argumentteja: %s" }, "Invalid values:": "Virheelliset arvot:", diff --git a/node_modules/lighthouse/node_modules/yargs/locales/fr.json b/node_modules/@lhci/cli/node_modules/yargs/locales/fr.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/fr.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/fr.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/hi.json b/node_modules/@lhci/cli/node_modules/yargs/locales/hi.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/hi.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/hi.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/hu.json b/node_modules/@lhci/cli/node_modules/yargs/locales/hu.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/hu.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/hu.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/id.json b/node_modules/@lhci/cli/node_modules/yargs/locales/id.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/id.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/id.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/it.json b/node_modules/@lhci/cli/node_modules/yargs/locales/it.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/it.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/it.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/ja.json b/node_modules/@lhci/cli/node_modules/yargs/locales/ja.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/ja.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/ja.json diff --git a/node_modules/@lhci/cli/node_modules/yargs/locales/ko.json b/node_modules/@lhci/cli/node_modules/yargs/locales/ko.json new file mode 100644 index 000000000..e3187eafd --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/locales/ko.json @@ -0,0 +1,49 @@ +{ + "Commands:": "명령:", + "Options:": "옵션:", + "Examples:": "예시:", + "boolean": "여부", + "count": "개수", + "string": "문자열", + "number": "숫자", + "array": "배열", + "required": "필수", + "default": "기본", + "default:": "기본:", + "choices:": "선택:", + "aliases:": "별칭:", + "generated-value": "생성된 값", + "Not enough non-option arguments: got %s, need at least %s": { + "one": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다", + "other": "옵션이 아닌 인자가 충분치 않습니다: %s개를 받았지만, 적어도 %s개는 필요합니다" + }, + "Too many non-option arguments: got %s, maximum of %s": { + "one": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다", + "other": "옵션이 아닌 인자가 너무 많습니다: %s개를 받았지만, %s개 이하여야 합니다" + }, + "Missing argument value: %s": { + "one": "인자값을 받지 못했습니다: %s", + "other": "인자값들을 받지 못했습니다: %s" + }, + "Missing required argument: %s": { + "one": "필수 인자를 받지 못했습니다: %s", + "other": "필수 인자들을 받지 못했습니다: %s" + }, + "Unknown argument: %s": { + "one": "알 수 없는 인자입니다: %s", + "other": "알 수 없는 인자들입니다: %s" + }, + "Invalid values:": "잘못된 값입니다:", + "Argument: %s, Given: %s, Choices: %s": "인자: %s, 입력받은 값: %s, 선택지: %s", + "Argument check failed: %s": "유효하지 않은 인자입니다: %s", + "Implications failed:": "옵션의 조합이 잘못되었습니다:", + "Not enough arguments following: %s": "인자가 충분하게 주어지지 않았습니다: %s", + "Invalid JSON config file: %s": "유효하지 않은 JSON 설정파일입니다: %s", + "Path to JSON config file": "JSON 설정파일 경로", + "Show help": "도움말을 보여줍니다", + "Show version number": "버전 넘버를 보여줍니다", + "Did you mean %s?": "찾고계신게 %s입니까?", + "Arguments %s and %s are mutually exclusive" : "%s와 %s 인자는 같이 사용될 수 없습니다", + "Positionals:": "위치:", + "command": "명령" +} diff --git a/node_modules/lighthouse/node_modules/yargs/locales/nb.json b/node_modules/@lhci/cli/node_modules/yargs/locales/nb.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/nb.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/nb.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/nl.json b/node_modules/@lhci/cli/node_modules/yargs/locales/nl.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/nl.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/nl.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/nn.json b/node_modules/@lhci/cli/node_modules/yargs/locales/nn.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/nn.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/nn.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/pirate.json b/node_modules/@lhci/cli/node_modules/yargs/locales/pirate.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/pirate.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/pirate.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/pl.json b/node_modules/@lhci/cli/node_modules/yargs/locales/pl.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/pl.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/pl.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/pt.json b/node_modules/@lhci/cli/node_modules/yargs/locales/pt.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/pt.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/pt.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/pt_BR.json b/node_modules/@lhci/cli/node_modules/yargs/locales/pt_BR.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/pt_BR.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/pt_BR.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/ru.json b/node_modules/@lhci/cli/node_modules/yargs/locales/ru.json similarity index 88% rename from node_modules/lighthouse/node_modules/yargs/locales/ru.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/ru.json index d5c9e323b..5f7f76810 100644 --- a/node_modules/lighthouse/node_modules/yargs/locales/ru.json +++ b/node_modules/@lhci/cli/node_modules/yargs/locales/ru.json @@ -42,10 +42,5 @@ "Path to JSON config file": "Путь к файлу конфигурации JSON", "Show help": "Показать помощь", "Show version number": "Показать номер версии", - "Did you mean %s?": "Вы имели в виду %s?", - "Arguments %s and %s are mutually exclusive": "Аргументы %s и %s являются взаимоисключающими", - "Positionals:": "Позиционные аргументы:", - "command": "команда", - "deprecated": "устар.", - "deprecated: %s": "устар.: %s" + "Did you mean %s?": "Вы имели в виду %s?" } diff --git a/node_modules/lighthouse/node_modules/yargs/locales/th.json b/node_modules/@lhci/cli/node_modules/yargs/locales/th.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/th.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/th.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/tr.json b/node_modules/@lhci/cli/node_modules/yargs/locales/tr.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/tr.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/tr.json diff --git a/node_modules/lighthouse/node_modules/yargs/locales/zh_CN.json b/node_modules/@lhci/cli/node_modules/yargs/locales/zh_CN.json similarity index 100% rename from node_modules/lighthouse/node_modules/yargs/locales/zh_CN.json rename to node_modules/@lhci/cli/node_modules/yargs/locales/zh_CN.json diff --git a/node_modules/@lhci/cli/node_modules/yargs/locales/zh_TW.json b/node_modules/@lhci/cli/node_modules/yargs/locales/zh_TW.json new file mode 100644 index 000000000..e3c7bcf4e --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/locales/zh_TW.json @@ -0,0 +1,47 @@ +{ + "Commands:": "命令:", + "Options:": "選項:", + "Examples:": "例:", + "boolean": "布林", + "count": "次數", + "string": "字串", + "number": "數字", + "array": "陣列", + "required": "必須", + "default": "預設值", + "default:": "預設值:", + "choices:": "可選值:", + "aliases:": "別名:", + "generated-value": "生成的值", + "Not enough non-option arguments: got %s, need at least %s": { + "one": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個", + "other": "non-option 引數不足:只傳入了 %s 個, 至少要 %s 個" + }, + "Too many non-option arguments: got %s, maximum of %s": { + "one": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個", + "other": "non-option 引數過多:傳入了 %s 個, 但最多 %s 個" + }, + "Missing argument value: %s": { + "one": "此引數無指定值:%s", + "other": "這些引數無指定值:%s" + }, + "Missing required argument: %s": { + "one": "缺少必須的引數:%s", + "other": "缺少這些必須的引數:%s" + }, + "Unknown argument: %s": { + "one": "未知的引數:%s", + "other": "未知的這些引數:%s" + }, + "Invalid values:": "無效的選項值:", + "Argument: %s, Given: %s, Choices: %s": "引數名稱: %s, 傳入的值: %s, 可選的值:%s", + "Argument check failed: %s": "引數驗證失敗:%s", + "Implications failed:": "缺少依賴的選項:", + "Not enough arguments following: %s": "沒有提供足夠的值給此引數:%s", + "Invalid JSON config file: %s": "無效的 JSON 設置文件:%s", + "Path to JSON config file": "JSON 設置文件的路徑", + "Show help": "顯示說明", + "Show version number": "顯示版本", + "Did you mean %s?": "是指 %s?", + "Arguments %s and %s are mutually exclusive" : "引數 %s 和 %s 是互斥的" +} diff --git a/node_modules/yargs/node_modules/yargs-parser/LICENSE.txt b/node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/LICENSE.txt similarity index 100% rename from node_modules/yargs/node_modules/yargs-parser/LICENSE.txt rename to node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/LICENSE.txt diff --git a/node_modules/yargs/node_modules/yargs-parser/index.js b/node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/index.js similarity index 100% rename from node_modules/yargs/node_modules/yargs-parser/index.js rename to node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/index.js diff --git a/node_modules/yargs/node_modules/yargs-parser/lib/tokenize-arg-string.js b/node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/lib/tokenize-arg-string.js similarity index 100% rename from node_modules/yargs/node_modules/yargs-parser/lib/tokenize-arg-string.js rename to node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/lib/tokenize-arg-string.js diff --git a/node_modules/yargs/node_modules/yargs-parser/package.json b/node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/package.json similarity index 100% rename from node_modules/yargs/node_modules/yargs-parser/package.json rename to node_modules/@lhci/cli/node_modules/yargs/node_modules/yargs-parser/package.json diff --git a/node_modules/@lhci/cli/node_modules/yargs/package.json b/node_modules/@lhci/cli/node_modules/yargs/package.json new file mode 100644 index 000000000..dc3018aee --- /dev/null +++ b/node_modules/@lhci/cli/node_modules/yargs/package.json @@ -0,0 +1,92 @@ +{ + "name": "yargs", + "version": "15.4.1", + "description": "yargs the modern, pirate-themed, successor to optimist.", + "main": "./index.js", + "contributors": [ + { + "name": "Yargs Contributors", + "url": "https://github.com/yargs/yargs/graphs/contributors" + } + ], + "files": [ + "index.js", + "yargs.js", + "build", + "locales", + "LICENSE" + ], + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "devDependencies": { + "@types/chai": "^4.2.11", + "@types/decamelize": "^1.2.0", + "@types/mocha": "^7.0.2", + "@types/node": "^10.0.3", + "@typescript-eslint/eslint-plugin": "^3.0.0", + "@typescript-eslint/parser": "^3.0.0", + "c8": "^7.0.0", + "chai": "^4.2.0", + "chalk": "^4.0.0", + "coveralls": "^3.0.9", + "cpr": "^3.0.1", + "cross-spawn": "^7.0.0", + "es6-promise": "^4.2.5", + "eslint": "^6.8.0", + "eslint-plugin-import": "^2.20.1", + "eslint-plugin-node": "^11.0.0", + "gts": "^2.0.0-alpha.4", + "hashish": "0.0.4", + "mocha": "^7.0.0", + "rimraf": "^3.0.2", + "standardx": "^5.0.0", + "typescript": "^3.7.0", + "which": "^2.0.0", + "yargs-test-extends": "^1.0.1" + }, + "scripts": { + "fix": "standardx --fix && standardx --fix **/*.ts", + "posttest": "npm run check", + "test": "c8 mocha --require ./test/before.js --timeout=12000 --check-leaks", + "coverage": "c8 report --check-coverage", + "check": "standardx && standardx **/*.ts", + "compile": "rimraf build && tsc", + "prepare": "npm run compile", + "pretest": "npm run compile -- -p tsconfig.test.json" + }, + "repository": { + "type": "git", + "url": "https://github.com/yargs/yargs.git" + }, + "homepage": "https://yargs.js.org/", + "standardx": { + "ignore": [ + "build", + "**/example/**" + ] + }, + "keywords": [ + "argument", + "args", + "option", + "parser", + "parsing", + "cli", + "command" + ], + "license": "MIT", + "engines": { + "node": ">=8" + } +} diff --git a/node_modules/yargs/yargs.js b/node_modules/@lhci/cli/node_modules/yargs/yargs.js similarity index 100% rename from node_modules/yargs/yargs.js rename to node_modules/@lhci/cli/node_modules/yargs/yargs.js diff --git a/node_modules/@lhci/cli/package.json b/node_modules/@lhci/cli/package.json index cd28cd26e..4127e65bd 100644 --- a/node_modules/@lhci/cli/package.json +++ b/node_modules/@lhci/cli/package.json @@ -1,6 +1,6 @@ { "name": "@lhci/cli", - "version": "0.11.0", + "version": "0.12.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -13,7 +13,7 @@ "lhci": "./src/cli.js" }, "dependencies": { - "@lhci/utils": "0.11.0", + "@lhci/utils": "0.12.0", "chrome-launcher": "^0.13.4", "compression": "^1.7.4", "debug": "^4.3.1", @@ -21,7 +21,7 @@ "https-proxy-agent": "^5.0.0", "inquirer": "^6.3.1", "isomorphic-fetch": "^3.0.0", - "lighthouse": "9.6.8", + "lighthouse": "10.1.0", "lighthouse-logger": "1.2.0", "open": "^7.1.0", "tmp": "^0.1.0", @@ -29,5 +29,5 @@ "yargs": "^15.4.1", "yargs-parser": "^13.1.2" }, - "gitHead": "2618b5f43ee1582bb8c3f2c089b3865832cefc37" + "gitHead": "badea06e0df9aad6d0a26ae89c1f69f4da1fed6c" } diff --git a/node_modules/@lhci/cli/src/assert/assert.js b/node_modules/@lhci/cli/src/assert/assert.js index fe300f6af..e9bedabd6 100644 --- a/node_modules/@lhci/cli/src/assert/assert.js +++ b/node_modules/@lhci/cli/src/assert/assert.js @@ -51,7 +51,7 @@ async function runCommand(options) { if (!areAssertionsSet && !budgetsFile) throw new Error('No assertions to use'); if (budgetsFile && areAssertionsSet) throw new Error('Cannot use both budgets AND assertions'); // If we have a budgets file, convert it to our assertions format. - if (budgetsFile) options = convertBudgetsToAssertions(readBudgets(budgetsFile)); + if (budgetsFile) options = await convertBudgetsToAssertions(readBudgets(budgetsFile)); const lhrs = loadSavedLHRs().map(json => JSON.parse(json)); const uniqueUrls = new Set(lhrs.map(lhr => lhr.finalUrl)); diff --git a/node_modules/@lhci/cli/src/autorun/autorun.js b/node_modules/@lhci/cli/src/autorun/autorun.js index cc7db5800..a19c681c9 100644 --- a/node_modules/@lhci/cli/src/autorun/autorun.js +++ b/node_modules/@lhci/cli/src/autorun/autorun.js @@ -28,6 +28,9 @@ const BUILD_DIR_PRIORITY = [ // likely a built version of the site // default name for next.js 'out', + // likely a built version of the site + // default name for 11ty + '_site', // riskier, sometimes is a built version of the site but also can be just a dir of static assets // default name for gatsby 'public', diff --git a/node_modules/@lhci/cli/src/collect/collect.js b/node_modules/@lhci/cli/src/collect/collect.js index eae748f1d..048420398 100644 --- a/node_modules/@lhci/cli/src/collect/collect.js +++ b/node_modules/@lhci/cli/src/collect/collect.js @@ -125,7 +125,7 @@ async function runOnUrl(url, options, context) { ...options, settings, }); - saveLHR(lhr); + await saveLHR(lhr); process.stdout.write('done.\n'); // PSI caches results for a minute. Ensure each run is unique by waiting 60s between runs. diff --git a/node_modules/@lhci/cli/src/collect/node-runner.js b/node_modules/@lhci/cli/src/collect/node-runner.js index faa290159..3f1047e7c 100644 --- a/node_modules/@lhci/cli/src/collect/node-runner.js +++ b/node_modules/@lhci/cli/src/collect/node-runner.js @@ -12,7 +12,7 @@ const uuid = require('uuid'); const childProcess = require('child_process'); const {getSavedReportsDirectory} = require('@lhci/utils/src/saved-reports.js'); -const LH_CLI_PATH = path.join(require.resolve('lighthouse'), '../../lighthouse-cli/index.js'); +const LH_CLI_PATH = path.join(require.resolve('lighthouse'), '../../cli/index.js'); class LighthouseRunner { /** @param {string} output */ diff --git a/node_modules/@lhci/cli/src/open/open.js b/node_modules/@lhci/cli/src/open/open.js index 8962d6f63..cba5df5ac 100644 --- a/node_modules/@lhci/cli/src/open/open.js +++ b/node_modules/@lhci/cli/src/open/open.js @@ -45,7 +45,7 @@ async function runCommand(options) { process.stdout.write(`Opening median report for ${lhr.finalUrl}...\n`); const tmpFile = tmp.fileSync({postfix: '.html'}); - fs.writeFileSync(tmpFile.name, getHTMLReportForLHR(lhr)); + fs.writeFileSync(tmpFile.name, await getHTMLReportForLHR(lhr)); await open(tmpFile.name); } diff --git a/node_modules/@lhci/cli/src/upload/upload.js b/node_modules/@lhci/cli/src/upload/upload.js index 107fc3721..f969a4ba6 100644 --- a/node_modules/@lhci/cli/src/upload/upload.js +++ b/node_modules/@lhci/cli/src/upload/upload.js @@ -478,7 +478,7 @@ async function runTemporaryPublicStorageTarget(options) { const response = await fetch(TEMPORARY_PUBLIC_STORAGE_URL, { method: 'POST', headers: {'content-type': 'text/html'}, - body: getHTMLReportForLHR(lhr), + body: await getHTMLReportForLHR(lhr), }); const {success, url} = await response.json(); @@ -569,7 +569,7 @@ async function runFilesystemTarget(options) { }, /** @type {Record} */ ({})), }; - fs.writeFileSync(entry.htmlPath, getHTMLReportForLHR(lhr)); + fs.writeFileSync(entry.htmlPath, await getHTMLReportForLHR(lhr)); fs.writeFileSync(entry.jsonPath, JSON.stringify(lhr)); manifest.push(entry); } diff --git a/node_modules/@lhci/utils/package.json b/node_modules/@lhci/utils/package.json index 11a849772..76fcc905f 100644 --- a/node_modules/@lhci/utils/package.json +++ b/node_modules/@lhci/utils/package.json @@ -1,6 +1,6 @@ { "name": "@lhci/utils", - "version": "0.11.0", + "version": "0.12.0", "license": "Apache-2.0", "repository": { "type": "git", @@ -13,8 +13,8 @@ "debug": "^4.3.1", "isomorphic-fetch": "^3.0.0", "js-yaml": "^3.13.1", - "lighthouse": "9.6.8", + "lighthouse": "10.1.0", "tree-kill": "^1.2.1" }, - "gitHead": "2618b5f43ee1582bb8c3f2c089b3865832cefc37" + "gitHead": "badea06e0df9aad6d0a26ae89c1f69f4da1fed6c" } diff --git a/node_modules/@lhci/utils/src/audit-diff-finder.js b/node_modules/@lhci/utils/src/audit-diff-finder.js index e3f395a5a..c7a862502 100644 --- a/node_modules/@lhci/utils/src/audit-diff-finder.js +++ b/node_modules/@lhci/utils/src/audit-diff-finder.js @@ -12,6 +12,9 @@ const {getGroupForAuditId} = require('./seed-data/lhr-generator.js'); /** @typedef {'better'|'worse'|'added'|'removed'|'ambiguous'|'no change'} RowLabel */ /** @typedef {{item: Record, kind?: string, index: number}} DetailItemEntry */ +// Hardcoded audit ids that arent worth diffing and generally regress the UX when done. +const auditsToNotDIff = ['main-thread-tasks', 'screenshot-thumbnails', 'metrics']; + /** * @param {number} delta * @param {'audit'|'score'} deltaType @@ -381,8 +384,8 @@ function deepPruneItemForKeySerialization(item) { /** @param {Record} item @return {string} */ function getItemKey(item) { - // For most opportunities, diagnostics, etc where 1 row === 1 resource - if (typeof item.url === 'string' && item.url) return item.url; + // Do most specific checks at the top. most general at bottom.. + // // For sourcemapped opportunities that identify a source location const source = item.source; if (typeof source === 'string') return source; @@ -397,6 +400,18 @@ function getItemKey(item) { if (typeof item.statistic === 'string') return item.statistic; // For third-party-summary if (item.entity && typeof item.entity.text === 'string') return item.entity.text; + // For node + if (typeof item.node?.path === 'string') return item.node.path; + // Tap-targets + if ( + typeof item.tapTarget?.path === 'string' && + typeof item.overlappingTarget?.path === 'string' + ) { + return `${item.tapTarget.path} + ${item.overlappingTarget.path}`; + } + // For most opportunities, diagnostics, etc where 1 row === 1 resource + if (typeof item.url === 'string' && item.url) return item.url; + if (typeof item.origin === 'string' && item.origin) return item.origin; // For everything else, use the entire object, actually works OK on most nodes. return JSON.stringify(deepPruneItemForKeySerialization(item)); @@ -580,6 +595,8 @@ function findAuditDiffs(baseAudit, compareAudit, options = {}) { /** @type {Array} */ const diffs = []; + if (auditsToNotDIff.includes(auditId)) return diffs; + if (typeof baseAudit.score === 'number' || typeof compareAudit.score === 'number') { diffs.push( createAuditDiff({ diff --git a/node_modules/@lhci/utils/src/budgets-converter.js b/node_modules/@lhci/utils/src/budgets-converter.js index c2a855385..1a57a516f 100644 --- a/node_modules/@lhci/utils/src/budgets-converter.js +++ b/node_modules/@lhci/utils/src/budgets-converter.js @@ -20,11 +20,10 @@ function convertPathExpressionToRegExp(path) { /** * @param {Array} budgets - * @return {LHCI.AssertCommand.Options} + * @return {Promise} */ -function convertBudgetsToAssertions(budgets) { - // @ts-ignore - .d.ts files no yet shipped with lighthouse - const Budget = require('lighthouse/lighthouse-core/config/budget.js'); +async function convertBudgetsToAssertions(budgets) { + const {Budget} = await import('lighthouse/core/config/budget.js'); // Normalize the definition using built-in Lighthouse validation. budgets = Budget.initializeBudget(budgets); diff --git a/node_modules/@lhci/utils/src/presets/all.js b/node_modules/@lhci/utils/src/presets/all.js index a381b4682..02026add3 100644 --- a/node_modules/@lhci/utils/src/presets/all.js +++ b/node_modules/@lhci/utils/src/presets/all.js @@ -7,8 +7,12 @@ module.exports = { assertions: { + // Not applicable in navigation mode (off) + // TODO: Enable this to support user flows + 'experimental-interaction-to-next-paint': ['off', {}], + 'uses-responsive-images-snapshot': ['off', {}], + 'work-during-interaction': ['off', {}], // Not useful or invisible diagnostic audits (off) - 'full-page-screenshot': ['off', {}], 'critical-request-chains': ['off', {}], 'final-screenshot': ['off', {}], 'js-libraries': ['off', {}], @@ -27,7 +31,6 @@ module.exports = { diagnostics: ['off', {}], metrics: ['off', {}], // All the rest of the audits (error) - 'apple-touch-icon': ['error', {}], 'aria-allowed-attr': ['error', {}], 'aria-command-name': ['error', {}], 'aria-hidden-body': ['error', {}], @@ -44,6 +47,7 @@ module.exports = { 'aria-treeitem-name': ['error', {}], 'aria-valid-attr': ['error', {}], 'aria-valid-attr-value': ['error', {}], + 'bf-cache': ['error', {}], 'bootup-time': ['error', {}], 'button-name': ['error', {}], 'color-contrast': ['error', {}], @@ -93,15 +97,14 @@ module.exports = { 'modern-image-formats': ['error', {}], 'no-document-write': ['error', {}], 'no-unload-listeners': ['error', {}], - 'no-vulnerable-libraries': ['error', {}], 'non-composited-animations': ['error', {}], 'notification-on-start': ['error', {}], 'object-alt': ['error', {}], 'offscreen-images': ['error', {}], - 'password-inputs-can-be-pasted-into': ['error', {}], + 'paste-preventing-inputs': ['error', {}], 'performance-budget': ['error', {}], 'preload-fonts': ['error', {}], - 'preload-lcp-image': ['error', {}], + 'prioritize-lcp-image': ['error', {}], 'render-blocking-resources': ['error', {}], 'robots-txt': ['error', {}], 'server-response-time': ['error', {}], diff --git a/node_modules/@lhci/utils/src/presets/no-pwa.js b/node_modules/@lhci/utils/src/presets/no-pwa.js index c98bf7b1e..2b6cc0f82 100644 --- a/node_modules/@lhci/utils/src/presets/no-pwa.js +++ b/node_modules/@lhci/utils/src/presets/no-pwa.js @@ -18,7 +18,6 @@ module.exports = { 'themed-omnibox': 'off', 'content-width': 'off', viewport: 'off', - 'apple-touch-icon': 'off', 'maskable-icon': 'off', }, }; diff --git a/node_modules/@lhci/utils/src/saved-reports.js b/node_modules/@lhci/utils/src/saved-reports.js index b5da63947..62c80a922 100644 --- a/node_modules/@lhci/utils/src/saved-reports.js +++ b/node_modules/@lhci/utils/src/saved-reports.js @@ -38,22 +38,22 @@ function loadSavedLHRs() { /** * @param {string} lhr */ -function saveLHR(lhr, baseDir = LHCI_DIR) { +async function saveLHR(lhr, baseDir = LHCI_DIR) { const baseFilename = `lhr-${Date.now()}`; const basePath = path.join(baseDir, baseFilename); ensureDirectoryExists(baseDir); fs.writeFileSync(`${basePath}.json`, lhr); - fs.writeFileSync(`${basePath}.html`, getHTMLReportForLHR(JSON.parse(lhr))); + fs.writeFileSync(`${basePath}.html`, await getHTMLReportForLHR(JSON.parse(lhr))); } /** * @param {LH.Result} lhr - * @return {string} + * @return {Promise} */ -function getHTMLReportForLHR(lhr) { - // @ts-ignore - lighthouse doesn't publish .d.ts files yet - const ReportGenerator = require('lighthouse/report/generator/report-generator.js'); - return ReportGenerator.generateReportHtml(lhr); +async function getHTMLReportForLHR(lhr) { + const {generateReport} = await import('lighthouse'); + // @ts-expect-error TODO: Import exact types from Lighthouse. + return generateReport(lhr); } function clearSavedReportsAndLHRs() { diff --git a/node_modules/@puppeteer/browsers/lib/cjs/CLI.js b/node_modules/@puppeteer/browsers/lib/cjs/CLI.js new file mode 100644 index 000000000..dad0f223c --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/CLI.js @@ -0,0 +1,242 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _CLI_instances, _CLI_cachePath, _CLI_rl, _CLI_defineBrowserParameter, _CLI_definePlatformParameter, _CLI_definePathParameter, _CLI_parseBrowser, _CLI_parseBuildId; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.makeProgressCallback = exports.CLI = void 0; +const process_1 = require("process"); +const readline = __importStar(require("readline")); +const progress_1 = __importDefault(require("progress")); +const helpers_1 = require("yargs/helpers"); +const yargs_1 = __importDefault(require("yargs/yargs")); +const browser_data_js_1 = require("./browser-data/browser-data.js"); +const Cache_js_1 = require("./Cache.js"); +const detectPlatform_js_1 = require("./detectPlatform.js"); +const install_js_1 = require("./install.js"); +const launch_js_1 = require("./launch.js"); +/** + * @public + */ +class CLI { + constructor(cachePath = process.cwd(), rl) { + _CLI_instances.add(this); + _CLI_cachePath.set(this, void 0); + _CLI_rl.set(this, void 0); + __classPrivateFieldSet(this, _CLI_cachePath, cachePath, "f"); + __classPrivateFieldSet(this, _CLI_rl, rl, "f"); + } + async run(argv) { + const yargsInstance = (0, yargs_1.default)((0, helpers_1.hideBin)(argv)); + await yargsInstance + .scriptName('@puppeteer/browsers') + .command('install ', 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: @ ).', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_defineBrowserParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePlatformParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs); + yargs.option('base-url', { + type: 'string', + desc: 'Base URL to download from', + }); + yargs.example('$0 install chrome', 'Install the latest available build of the Chrome browser.'); + yargs.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.'); + yargs.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.'); + yargs.example('$0 install firefox', 'Install the latest available build of the Firefox browser.'); + yargs.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.'); + yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.'); + }, async (argv) => { + var _a, _b, _c; + const args = argv; + (_a = args.platform) !== null && _a !== void 0 ? _a : (args.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); + if (!args.platform) { + throw new Error(`Could not resolve the current platform`); + } + args.browser.buildId = await (0, browser_data_js_1.resolveBuildId)(args.browser.name, args.platform, args.browser.buildId); + await (0, install_js_1.install)({ + browser: args.browser.name, + buildId: args.browser.buildId, + platform: args.platform, + cacheDir: (_b = args.path) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId), + baseUrl: args.baseUrl, + }); + console.log(`${args.browser.name}@${args.browser.buildId} ${(0, launch_js_1.computeExecutablePath)({ + browser: args.browser.name, + buildId: args.browser.buildId, + cacheDir: (_c = args.path) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + platform: args.platform, + })}`); + }) + .command('launch ', 'Launch the specified browser', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_defineBrowserParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePlatformParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs); + yargs.option('detached', { + type: 'boolean', + desc: 'Detach the child process.', + default: false, + }); + yargs.option('system', { + type: 'boolean', + desc: 'Search for a browser installed on the system instead of the cache folder.', + default: false, + }); + yargs.example('$0 launch chrome@1083080', 'Launch the Chrome browser identified by the revision 1083080.'); + yargs.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.'); + yargs.example('$0 launch chrome@1083080 --detached', 'Launch the browser but detach the sub-processes.'); + yargs.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.'); + }, async (argv) => { + var _a; + const args = argv; + const executablePath = args.system + ? (0, launch_js_1.computeSystemExecutablePath)({ + browser: args.browser.name, + // TODO: throw an error if not a ChromeReleaseChannel is provided. + channel: args.browser.buildId, + platform: args.platform, + }) + : (0, launch_js_1.computeExecutablePath)({ + browser: args.browser.name, + buildId: args.browser.buildId, + cacheDir: (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + platform: args.platform, + }); + (0, launch_js_1.launch)({ + executablePath, + detached: args.detached, + }); + }) + .command('clear', 'Removes all installed browsers from the specified cache directory', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs, true); + }, async (argv) => { + var _a, _b; + const args = argv; + const cacheDir = (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"); + const rl = (_b = __classPrivateFieldGet(this, _CLI_rl, "f")) !== null && _b !== void 0 ? _b : readline.createInterface({ input: process_1.stdin, output: process_1.stdout }); + rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => { + rl.close(); + if (!['y', 'yes'].includes(answer.toLowerCase().trim())) { + console.log('Cancelled.'); + return; + } + const cache = new Cache_js_1.Cache(cacheDir); + cache.clear(); + console.log(`${cacheDir} cleared.`); + }); + }) + .demandCommand(1) + .help() + .wrap(Math.min(120, yargsInstance.terminalWidth())) + .parse(); + } +} +exports.CLI = CLI; +_CLI_cachePath = new WeakMap(), _CLI_rl = new WeakMap(), _CLI_instances = new WeakSet(), _CLI_defineBrowserParameter = function _CLI_defineBrowserParameter(yargs) { + yargs.positional('browser', { + description: 'Which browser to install [@]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.', + type: 'string', + coerce: (opt) => { + return { + name: __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_parseBrowser).call(this, opt), + buildId: __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_parseBuildId).call(this, opt), + }; + }, + }); +}, _CLI_definePlatformParameter = function _CLI_definePlatformParameter(yargs) { + yargs.option('platform', { + type: 'string', + desc: 'Platform that the binary needs to be compatible with.', + choices: Object.values(browser_data_js_1.BrowserPlatform), + defaultDescription: 'Auto-detected', + }); +}, _CLI_definePathParameter = function _CLI_definePathParameter(yargs, required = false) { + yargs.option('path', { + type: 'string', + desc: 'Path to the root folder for the browser downloads and installation. The installation folder structure is compatible with the cache structure used by Puppeteer.', + defaultDescription: 'Current working directory', + ...(required ? {} : { default: process.cwd() }), + }); + if (required) { + yargs.demandOption('path'); + } +}, _CLI_parseBrowser = function _CLI_parseBrowser(version) { + return version.split('@').shift(); +}, _CLI_parseBuildId = function _CLI_parseBuildId(version) { + var _a; + return (_a = version.split('@').pop()) !== null && _a !== void 0 ? _a : 'latest'; +}; +/** + * @public + */ +function makeProgressCallback(browser, buildId) { + let progressBar; + let lastDownloadedBytes = 0; + return (downloadedBytes, totalBytes) => { + if (!progressBar) { + progressBar = new progress_1.default(`Downloading ${browser} r${buildId} - ${toMegabytes(totalBytes)} [:bar] :percent :etas `, { + complete: '=', + incomplete: ' ', + width: 20, + total: totalBytes, + }); + } + const delta = downloadedBytes - lastDownloadedBytes; + lastDownloadedBytes = downloadedBytes; + progressBar.tick(delta); + }; +} +exports.makeProgressCallback = makeProgressCallback; +function toMegabytes(bytes) { + const mb = bytes / 1000 / 1000; + return `${Math.round(mb * 10) / 10} MB`; +} +//# sourceMappingURL=CLI.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/Cache.js b/node_modules/@puppeteer/browsers/lib/cjs/Cache.js new file mode 100644 index 000000000..5645b6bd5 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/Cache.js @@ -0,0 +1,115 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _Cache_rootDir; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Cache = void 0; +const fs_1 = __importDefault(require("fs")); +const path_1 = __importDefault(require("path")); +const browser_data_js_1 = require("./browser-data/browser-data.js"); +/** + * The cache used by Puppeteer relies on the following structure: + * + * - rootDir + * -- | browserRoot(browser1) + * ---- - | installationDir() + * ------ the browser-platform-buildId + * ------ specific structure. + * -- | browserRoot(browser2) + * ---- - | installationDir() + * ------ the browser-platform-buildId + * ------ specific structure. + * @internal + */ +class Cache { + constructor(rootDir) { + _Cache_rootDir.set(this, void 0); + __classPrivateFieldSet(this, _Cache_rootDir, rootDir, "f"); + } + browserRoot(browser) { + // Chromium is a special case for backward compatibility: we install it in + // the Chrome folder so that Puppeteer can find it. + return path_1.default.join(__classPrivateFieldGet(this, _Cache_rootDir, "f"), browser === browser_data_js_1.Browser.CHROMIUM ? browser_data_js_1.Browser.CHROME : browser); + } + installationDir(browser, platform, buildId) { + return path_1.default.join(this.browserRoot(browser), `${platform}-${buildId}`); + } + clear() { + fs_1.default.rmSync(__classPrivateFieldGet(this, _Cache_rootDir, "f"), { + force: true, + recursive: true, + maxRetries: 10, + retryDelay: 500, + }); + } + getInstalledBrowsers() { + if (!fs_1.default.existsSync(__classPrivateFieldGet(this, _Cache_rootDir, "f"))) { + return []; + } + const types = fs_1.default.readdirSync(__classPrivateFieldGet(this, _Cache_rootDir, "f")); + const browsers = types.filter((t) => { + return Object.values(browser_data_js_1.Browser).includes(t); + }); + return browsers.flatMap(browser => { + const files = fs_1.default.readdirSync(this.browserRoot(browser)); + return files + .map(file => { + const result = parseFolderPath(path_1.default.join(this.browserRoot(browser), file)); + if (!result) { + return null; + } + return { + path: path_1.default.join(this.browserRoot(browser), file), + browser, + platform: result.platform, + buildId: result.buildId, + }; + }) + .filter((item) => { + return item !== null; + }); + }); + } +} +exports.Cache = Cache; +_Cache_rootDir = new WeakMap(); +function parseFolderPath(folderPath) { + const name = path_1.default.basename(folderPath); + const splits = name.split('-'); + if (splits.length !== 2) { + return; + } + const [platform, buildId] = splits; + if (!buildId || !platform) { + return; + } + return { platform, buildId }; +} +//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js new file mode 100644 index 000000000..ea64574b5 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/browser-data.js @@ -0,0 +1,127 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSystemExecutablePath = exports.createProfile = exports.resolveBuildId = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.executablePathByBrowser = exports.downloadPaths = exports.downloadUrls = void 0; +const chrome = __importStar(require("./chrome.js")); +const chromedriver = __importStar(require("./chromedriver.js")); +const chromium = __importStar(require("./chromium.js")); +const firefox = __importStar(require("./firefox.js")); +const types_js_1 = require("./types.js"); +Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return types_js_1.Browser; } }); +Object.defineProperty(exports, "BrowserPlatform", { enumerable: true, get: function () { return types_js_1.BrowserPlatform; } }); +Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return types_js_1.ChromeReleaseChannel; } }); +exports.downloadUrls = { + [types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl, + [types_js_1.Browser.CHROME]: chrome.resolveDownloadUrl, + [types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadUrl, + [types_js_1.Browser.FIREFOX]: firefox.resolveDownloadUrl, +}; +exports.downloadPaths = { + [types_js_1.Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath, + [types_js_1.Browser.CHROME]: chrome.resolveDownloadPath, + [types_js_1.Browser.CHROMIUM]: chromium.resolveDownloadPath, + [types_js_1.Browser.FIREFOX]: firefox.resolveDownloadPath, +}; +exports.executablePathByBrowser = { + [types_js_1.Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath, + [types_js_1.Browser.CHROME]: chrome.relativeExecutablePath, + [types_js_1.Browser.CHROMIUM]: chromium.relativeExecutablePath, + [types_js_1.Browser.FIREFOX]: firefox.relativeExecutablePath, +}; +/** + * @public + */ +async function resolveBuildId(browser, platform, tag) { + switch (browser) { + case types_js_1.Browser.FIREFOX: + switch (tag) { + case types_js_1.BrowserTag.LATEST: + return await firefox.resolveBuildId('FIREFOX_NIGHTLY'); + } + case types_js_1.Browser.CHROME: + switch (tag) { + case types_js_1.BrowserTag.LATEST: + // In CfT beta is the latest version. + return await chrome.resolveBuildId(platform, 'beta'); + } + case types_js_1.Browser.CHROMEDRIVER: + switch (tag) { + case types_js_1.BrowserTag.LATEST: + return await chromedriver.resolveBuildId('latest'); + } + case types_js_1.Browser.CHROMIUM: + switch (tag) { + case types_js_1.BrowserTag.LATEST: + return await chromium.resolveBuildId(platform, 'latest'); + } + } + // We assume the tag is the buildId if it didn't match any keywords. + return tag; +} +exports.resolveBuildId = resolveBuildId; +/** + * @public + */ +async function createProfile(browser, opts) { + switch (browser) { + case types_js_1.Browser.FIREFOX: + return await firefox.createProfile(opts); + case types_js_1.Browser.CHROME: + case types_js_1.Browser.CHROMIUM: + throw new Error(`Profile creation is not support for ${browser} yet`); + } +} +exports.createProfile = createProfile; +/** + * @public + */ +function resolveSystemExecutablePath(browser, platform, channel) { + switch (browser) { + case types_js_1.Browser.CHROMEDRIVER: + case types_js_1.Browser.FIREFOX: + throw new Error(`System browser detection is not supported for ${browser} yet.`); + case types_js_1.Browser.CHROME: + return chromium.resolveSystemExecutablePath(platform, channel); + case types_js_1.Browser.CHROMIUM: + return chrome.resolveSystemExecutablePath(platform, channel); + } +} +exports.resolveSystemExecutablePath = resolveSystemExecutablePath; +//# sourceMappingURL=browser-data.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js new file mode 100644 index 000000000..2b0a88d28 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chrome.js @@ -0,0 +1,139 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveSystemExecutablePath = exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0; +const path_1 = __importDefault(require("path")); +const httpUtil_js_1 = require("../httpUtil.js"); +const types_js_1 = require("./types.js"); +function folder(platform) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return 'linux64'; + case types_js_1.BrowserPlatform.MAC_ARM: + return 'mac-arm64'; + case types_js_1.BrowserPlatform.MAC: + return 'mac-x64'; + case types_js_1.BrowserPlatform.WIN32: + return 'win32'; + case types_js_1.BrowserPlatform.WIN64: + return 'win64'; + } +} +function chromiumDashPlatform(platform) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return 'linux'; + case types_js_1.BrowserPlatform.MAC_ARM: + return 'mac'; + case types_js_1.BrowserPlatform.MAC: + return 'mac'; + case types_js_1.BrowserPlatform.WIN32: + return 'win'; + case types_js_1.BrowserPlatform.WIN64: + return 'win64'; + } +} +function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +exports.resolveDownloadUrl = resolveDownloadUrl; +function resolveDownloadPath(platform, buildId) { + return [buildId, folder(platform), `chrome-${folder(platform)}.zip`]; +} +exports.resolveDownloadPath = resolveDownloadPath; +function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.MAC: + case types_js_1.BrowserPlatform.MAC_ARM: + return path_1.default.join('chrome-' + folder(platform), 'Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing'); + case types_js_1.BrowserPlatform.LINUX: + return path_1.default.join('chrome-linux64', 'chrome'); + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return path_1.default.join('chrome-' + folder(platform), 'chrome.exe'); + } +} +exports.relativeExecutablePath = relativeExecutablePath; +async function resolveBuildId(platform, channel = 'beta') { + return new Promise((resolve, reject) => { + const request = (0, httpUtil_js_1.httpRequest)(new URL(`https://chromiumdash.appspot.com/fetch_releases?platform=${chromiumDashPlatform(platform)}&channel=${channel}`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + const response = JSON.parse(String(data)); + return resolve(response[0].version); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +exports.resolveBuildId = resolveBuildId; +function resolveSystemExecutablePath(platform, channel) { + switch (platform) { + case types_js_1.BrowserPlatform.WIN64: + case types_js_1.BrowserPlatform.WIN32: + switch (channel) { + case types_js_1.ChromeReleaseChannel.STABLE: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome\\Application\\chrome.exe`; + case types_js_1.ChromeReleaseChannel.BETA: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome Beta\\Application\\chrome.exe`; + case types_js_1.ChromeReleaseChannel.CANARY: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome SxS\\Application\\chrome.exe`; + case types_js_1.ChromeReleaseChannel.DEV: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome Dev\\Application\\chrome.exe`; + } + case types_js_1.BrowserPlatform.MAC_ARM: + case types_js_1.BrowserPlatform.MAC: + switch (channel) { + case types_js_1.ChromeReleaseChannel.STABLE: + return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; + case types_js_1.ChromeReleaseChannel.BETA: + return '/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta'; + case types_js_1.ChromeReleaseChannel.CANARY: + return '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'; + case types_js_1.ChromeReleaseChannel.DEV: + return '/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev'; + } + case types_js_1.BrowserPlatform.LINUX: + switch (channel) { + case types_js_1.ChromeReleaseChannel.STABLE: + return '/opt/google/chrome/chrome'; + case types_js_1.ChromeReleaseChannel.BETA: + return '/opt/google/chrome-beta/chrome'; + case types_js_1.ChromeReleaseChannel.DEV: + return '/opt/google/chrome-unstable/chrome'; + } + } + throw new Error(`Unable to detect browser executable path for '${channel}' on ${platform}.`); +} +exports.resolveSystemExecutablePath = resolveSystemExecutablePath; +//# sourceMappingURL=chrome.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js new file mode 100644 index 000000000..2e38929f8 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromedriver.js @@ -0,0 +1,79 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0; +const httpUtil_js_1 = require("../httpUtil.js"); +const types_js_1 = require("./types.js"); +function archive(platform) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return 'chromedriver_linux64'; + case types_js_1.BrowserPlatform.MAC_ARM: + return 'chromedriver_mac_arm64'; + case types_js_1.BrowserPlatform.MAC: + return 'chromedriver_mac64'; + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return 'chromedriver_win32'; + } +} +function resolveDownloadUrl(platform, buildId, baseUrl = 'https://chromedriver.storage.googleapis.com') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +exports.resolveDownloadUrl = resolveDownloadUrl; +function resolveDownloadPath(platform, buildId) { + return [buildId, `${archive(platform)}.zip`]; +} +exports.resolveDownloadPath = resolveDownloadPath; +function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.MAC: + case types_js_1.BrowserPlatform.MAC_ARM: + case types_js_1.BrowserPlatform.LINUX: + return 'chromedriver'; + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return 'chromedriver.exe'; + } +} +exports.relativeExecutablePath = relativeExecutablePath; +async function resolveBuildId(_channel = 'latest') { + return new Promise((resolve, reject) => { + const request = (0, httpUtil_js_1.httpRequest)(new URL(`https://chromedriver.storage.googleapis.com/LATEST_RELEASE`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + return resolve(String(data)); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +exports.resolveBuildId = resolveBuildId; +//# sourceMappingURL=chromedriver.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js new file mode 100644 index 000000000..ceeaba67b --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/chromium.js @@ -0,0 +1,102 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = exports.resolveSystemExecutablePath = void 0; +const path_1 = __importDefault(require("path")); +const httpUtil_js_1 = require("../httpUtil.js"); +const types_js_1 = require("./types.js"); +var chrome_js_1 = require("./chrome.js"); +Object.defineProperty(exports, "resolveSystemExecutablePath", { enumerable: true, get: function () { return chrome_js_1.resolveSystemExecutablePath; } }); +function archive(platform, buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return 'chrome-linux'; + case types_js_1.BrowserPlatform.MAC_ARM: + case types_js_1.BrowserPlatform.MAC: + return 'chrome-mac'; + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + // Windows archive name changed at r591479. + return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32'; + } +} +function folder(platform) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return 'Linux_x64'; + case types_js_1.BrowserPlatform.MAC_ARM: + return 'Mac_Arm'; + case types_js_1.BrowserPlatform.MAC: + return 'Mac'; + case types_js_1.BrowserPlatform.WIN32: + return 'Win'; + case types_js_1.BrowserPlatform.WIN64: + return 'Win_x64'; + } +} +function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +exports.resolveDownloadUrl = resolveDownloadUrl; +function resolveDownloadPath(platform, buildId) { + return [folder(platform), buildId, `${archive(platform, buildId)}.zip`]; +} +exports.resolveDownloadPath = resolveDownloadPath; +function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.MAC: + case types_js_1.BrowserPlatform.MAC_ARM: + return path_1.default.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'); + case types_js_1.BrowserPlatform.LINUX: + return path_1.default.join('chrome-linux', 'chrome'); + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return path_1.default.join('chrome-win', 'chrome.exe'); + } +} +exports.relativeExecutablePath = relativeExecutablePath; +async function resolveBuildId(platform, +// We will need it for other channels/keywords. +_channel = 'latest') { + return new Promise((resolve, reject) => { + const request = (0, httpUtil_js_1.httpRequest)(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + return resolve(String(data)); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +exports.resolveBuildId = resolveBuildId; +//# sourceMappingURL=chromium.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js new file mode 100644 index 000000000..1dee24f0d --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/firefox.js @@ -0,0 +1,285 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.createProfile = exports.resolveBuildId = exports.relativeExecutablePath = exports.resolveDownloadPath = exports.resolveDownloadUrl = void 0; +const fs_1 = __importDefault(require("fs")); +const path_1 = __importDefault(require("path")); +const httpUtil_js_1 = require("../httpUtil.js"); +const types_js_1 = require("./types.js"); +function archive(platform, buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.LINUX: + return `firefox-${buildId}.en-US.${platform}-x86_64.tar.bz2`; + case types_js_1.BrowserPlatform.MAC_ARM: + case types_js_1.BrowserPlatform.MAC: + return `firefox-${buildId}.en-US.mac.dmg`; + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return `firefox-${buildId}.en-US.${platform}.zip`; + } +} +function resolveDownloadUrl(platform, buildId, baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +exports.resolveDownloadUrl = resolveDownloadUrl; +function resolveDownloadPath(platform, buildId) { + return [archive(platform, buildId)]; +} +exports.resolveDownloadPath = resolveDownloadPath; +function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case types_js_1.BrowserPlatform.MAC_ARM: + case types_js_1.BrowserPlatform.MAC: + return path_1.default.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox'); + case types_js_1.BrowserPlatform.LINUX: + return path_1.default.join('firefox', 'firefox'); + case types_js_1.BrowserPlatform.WIN32: + case types_js_1.BrowserPlatform.WIN64: + return path_1.default.join('firefox', 'firefox.exe'); + } +} +exports.relativeExecutablePath = relativeExecutablePath; +async function resolveBuildId(channel = 'FIREFOX_NIGHTLY') { + return new Promise((resolve, reject) => { + const request = (0, httpUtil_js_1.httpRequest)(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json'), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + const versions = JSON.parse(data); + return resolve(versions[channel]); + } + catch { + return reject(new Error('Firefox version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +exports.resolveBuildId = resolveBuildId; +async function createProfile(options) { + if (!fs_1.default.existsSync(options.path)) { + await fs_1.default.promises.mkdir(options.path, { + recursive: true, + }); + } + await writePreferences({ + preferences: { + ...defaultProfilePreferences(options.preferences), + ...options.preferences, + }, + path: options.path, + }); +} +exports.createProfile = createProfile; +function defaultProfilePreferences(extraPrefs) { + const server = 'dummy.test'; + const defaultPrefs = { + // Make sure Shield doesn't hit the network. + 'app.normandy.api_url': '', + // Disable Firefox old build background check + 'app.update.checkInstallTime': false, + // Disable automatically upgrading Firefox + 'app.update.disabledForTesting': true, + // Increase the APZ content response timeout to 1 minute + 'apz.content_response_timeout': 60000, + // Prevent various error message on the console + // jest-puppeteer asserts that no error message is emitted by the console + 'browser.contentblocking.features.standard': '-tp,tpPrivate,cookieBehavior0,-cm,-fp', + // Enable the dump function: which sends messages to the system + // console + // https://bugzilla.mozilla.org/show_bug.cgi?id=1543115 + 'browser.dom.window.dump.enabled': true, + // Disable topstories + 'browser.newtabpage.activity-stream.feeds.system.topstories': false, + // Always display a blank page + 'browser.newtabpage.enabled': false, + // Background thumbnails in particular cause grief: and disabling + // thumbnails in general cannot hurt + 'browser.pagethumbnails.capturing_disabled': true, + // Disable safebrowsing components. + 'browser.safebrowsing.blockedURIs.enabled': false, + 'browser.safebrowsing.downloads.enabled': false, + 'browser.safebrowsing.malware.enabled': false, + 'browser.safebrowsing.passwords.enabled': false, + 'browser.safebrowsing.phishing.enabled': false, + // Disable updates to search engines. + 'browser.search.update': false, + // Do not restore the last open set of tabs if the browser has crashed + 'browser.sessionstore.resume_from_crash': false, + // Skip check for default browser on startup + 'browser.shell.checkDefaultBrowser': false, + // Disable newtabpage + 'browser.startup.homepage': 'about:blank', + // Do not redirect user when a milstone upgrade of Firefox is detected + 'browser.startup.homepage_override.mstone': 'ignore', + // Start with a blank page about:blank + 'browser.startup.page': 0, + // Do not allow background tabs to be zombified on Android: otherwise for + // tests that open additional tabs: the test harness tab itself might get + // unloaded + 'browser.tabs.disableBackgroundZombification': false, + // Do not warn when closing all other open tabs + 'browser.tabs.warnOnCloseOtherTabs': false, + // Do not warn when multiple tabs will be opened + 'browser.tabs.warnOnOpen': false, + // Disable the UI tour. + 'browser.uitour.enabled': false, + // Turn off search suggestions in the location bar so as not to trigger + // network connections. + 'browser.urlbar.suggest.searches': false, + // Disable first run splash page on Windows 10 + 'browser.usedOnWindows10.introURL': '', + // Do not warn on quitting Firefox + 'browser.warnOnQuit': false, + // Defensively disable data reporting systems + 'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`, + 'datareporting.healthreport.logging.consoleEnabled': false, + 'datareporting.healthreport.service.enabled': false, + 'datareporting.healthreport.service.firstRun': false, + 'datareporting.healthreport.uploadEnabled': false, + // Do not show datareporting policy notifications which can interfere with tests + 'datareporting.policy.dataSubmissionEnabled': false, + 'datareporting.policy.dataSubmissionPolicyBypassNotification': true, + // DevTools JSONViewer sometimes fails to load dependencies with its require.js. + // This doesn't affect Puppeteer but spams console (Bug 1424372) + 'devtools.jsonview.enabled': false, + // Disable popup-blocker + 'dom.disable_open_during_load': false, + // Enable the support for File object creation in the content process + // Required for |Page.setFileInputFiles| protocol method. + 'dom.file.createInChild': true, + // Disable the ProcessHangMonitor + 'dom.ipc.reportProcessHangs': false, + // Disable slow script dialogues + 'dom.max_chrome_script_run_time': 0, + 'dom.max_script_run_time': 0, + // Only load extensions from the application and user profile + // AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION + 'extensions.autoDisableScopes': 0, + 'extensions.enabledScopes': 5, + // Disable metadata caching for installed add-ons by default + 'extensions.getAddons.cache.enabled': false, + // Disable installing any distribution extensions or add-ons. + 'extensions.installDistroAddons': false, + // Disabled screenshots extension + 'extensions.screenshots.disabled': true, + // Turn off extension updates so they do not bother tests + 'extensions.update.enabled': false, + // Turn off extension updates so they do not bother tests + 'extensions.update.notifyUser': false, + // Make sure opening about:addons will not hit the network + 'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`, + // Temporarily force disable BFCache in parent (https://bit.ly/bug-1732263) + 'fission.bfcacheInParent': false, + // Force all web content to use a single content process + 'fission.webContentIsolationStrategy': 0, + // Allow the application to have focus even it runs in the background + 'focusmanager.testmode': true, + // Disable useragent updates + 'general.useragent.updates.enabled': false, + // Always use network provider for geolocation tests so we bypass the + // macOS dialog raised by the corelocation provider + 'geo.provider.testing': true, + // Do not scan Wifi + 'geo.wifi.scan': false, + // No hang monitor + 'hangmonitor.timeout': 0, + // Show chrome errors and warnings in the error console + 'javascript.options.showInConsole': true, + // Disable download and usage of OpenH264: and Widevine plugins + 'media.gmp-manager.updateEnabled': false, + // Prevent various error message on the console + // jest-puppeteer asserts that no error message is emitted by the console + 'network.cookie.cookieBehavior': 0, + // Disable experimental feature that is only available in Nightly + 'network.cookie.sameSite.laxByDefault': false, + // Do not prompt for temporary redirects + 'network.http.prompt-temp-redirect': false, + // Disable speculative connections so they are not reported as leaking + // when they are hanging around + 'network.http.speculative-parallel-limit': 0, + // Do not automatically switch between offline and online + 'network.manage-offline-status': false, + // Make sure SNTP requests do not hit the network + 'network.sntp.pools': server, + // Disable Flash. + 'plugin.state.flash': 0, + 'privacy.trackingprotection.enabled': false, + // Can be removed once Firefox 89 is no longer supported + // https://bugzilla.mozilla.org/show_bug.cgi?id=1710839 + 'remote.enabled': true, + // Don't do network connections for mitm priming + 'security.certerrors.mitm.priming.enabled': false, + // Local documents have access to all other local documents, + // including directory listings + 'security.fileuri.strict_origin_policy': false, + // Do not wait for the notification button security delay + 'security.notification_enable_delay': 0, + // Ensure blocklist updates do not hit the network + 'services.settings.server': `http://${server}/dummy/blocklist/`, + // Do not automatically fill sign-in forms with known usernames and + // passwords + 'signon.autofillForms': false, + // Disable password capture, so that tests that include forms are not + // influenced by the presence of the persistent doorhanger notification + 'signon.rememberSignons': false, + // Disable first-run welcome page + 'startup.homepage_welcome_url': 'about:blank', + // Disable first-run welcome page + 'startup.homepage_welcome_url.additional': '', + // Disable browser animations (tabs, fullscreen, sliding alerts) + 'toolkit.cosmeticAnimations.enabled': false, + // Prevent starting into safe mode after application crashes + 'toolkit.startup.max_resumed_crashes': -1, + }; + return Object.assign(defaultPrefs, extraPrefs); +} +/** + * Populates the user.js file with custom preferences as needed to allow + * Firefox's CDP support to properly function. These preferences will be + * automatically copied over to prefs.js during startup of Firefox. To be + * able to restore the original values of preferences a backup of prefs.js + * will be created. + * + * @param prefs - List of preferences to add. + * @param profilePath - Firefox profile to write the preferences to. + */ +async function writePreferences(options) { + const lines = Object.entries(options.preferences).map(([key, value]) => { + return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`; + }); + await fs_1.default.promises.writeFile(path_1.default.join(options.path, 'user.js'), lines.join('\n')); + // Create a backup of the preferences file if it already exitsts. + const prefsPath = path_1.default.join(options.path, 'prefs.js'); + if (fs_1.default.existsSync(prefsPath)) { + const prefsBackupPath = path_1.default.join(options.path, 'prefs.js.puppeteer'); + await fs_1.default.promises.copyFile(prefsPath, prefsBackupPath); + } +} +//# sourceMappingURL=firefox.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js new file mode 100644 index 000000000..2dc1d62c1 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/browser-data/types.js @@ -0,0 +1,92 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ChromeReleaseChannel = exports.BrowserTag = exports.downloadUrls = exports.BrowserPlatform = exports.Browser = void 0; +const chrome = __importStar(require("./chrome.js")); +const firefox = __importStar(require("./firefox.js")); +/** + * Supported browsers. + * + * @public + */ +var Browser; +(function (Browser) { + Browser["CHROME"] = "chrome"; + Browser["CHROMIUM"] = "chromium"; + Browser["FIREFOX"] = "firefox"; + Browser["CHROMEDRIVER"] = "chromedriver"; +})(Browser = exports.Browser || (exports.Browser = {})); +/** + * Platform names used to identify a OS platfrom x architecture combination in the way + * that is relevant for the browser download. + * + * @public + */ +var BrowserPlatform; +(function (BrowserPlatform) { + BrowserPlatform["LINUX"] = "linux"; + BrowserPlatform["MAC"] = "mac"; + BrowserPlatform["MAC_ARM"] = "mac_arm"; + BrowserPlatform["WIN32"] = "win32"; + BrowserPlatform["WIN64"] = "win64"; +})(BrowserPlatform = exports.BrowserPlatform || (exports.BrowserPlatform = {})); +exports.downloadUrls = { + [Browser.CHROME]: chrome.resolveDownloadUrl, + [Browser.CHROMIUM]: chrome.resolveDownloadUrl, + [Browser.FIREFOX]: firefox.resolveDownloadUrl, +}; +/** + * @public + */ +var BrowserTag; +(function (BrowserTag) { + BrowserTag["LATEST"] = "latest"; +})(BrowserTag = exports.BrowserTag || (exports.BrowserTag = {})); +/** + * @public + */ +var ChromeReleaseChannel; +(function (ChromeReleaseChannel) { + ChromeReleaseChannel["STABLE"] = "stable"; + ChromeReleaseChannel["DEV"] = "dev"; + ChromeReleaseChannel["CANARY"] = "canary"; + ChromeReleaseChannel["BETA"] = "beta"; +})(ChromeReleaseChannel = exports.ChromeReleaseChannel || (exports.ChromeReleaseChannel = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js b/node_modules/@puppeteer/browsers/lib/cjs/debug.js similarity index 62% rename from node_modules/puppeteer-core/lib/cjs/puppeteer/node.js rename to node_modules/@puppeteer/browsers/lib/cjs/debug.js index f2c12ae65..4eed5486d 100644 --- a/node_modules/puppeteer-core/lib/cjs/puppeteer/node.js +++ b/node_modules/@puppeteer/browsers/lib/cjs/debug.js @@ -1,6 +1,6 @@ "use strict"; /** - * Copyright 2017 Google Inc. All rights reserved. + * Copyright 2023 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,11 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; Object.defineProperty(exports, "__esModule", { value: true }); -const initialize_node_js_1 = require("./initialize-node.js"); -const environment_js_1 = require("./environment.js"); -if (!environment_js_1.isNode) { - throw new Error('Trying to run Puppeteer-Node in a web environment.'); -} -exports.default = (0, initialize_node_js_1.initializePuppeteerNode)('puppeteer'); -//# sourceMappingURL=node.js.map \ No newline at end of file +exports.debug = void 0; +const debug_1 = __importDefault(require("debug")); +exports.debug = debug_1.default; +//# sourceMappingURL=debug.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js b/node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js new file mode 100644 index 000000000..a7fce5a87 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/detectPlatform.js @@ -0,0 +1,63 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.detectBrowserPlatform = void 0; +const os_1 = __importDefault(require("os")); +const browser_data_js_1 = require("./browser-data/browser-data.js"); +/** + * @public + */ +function detectBrowserPlatform() { + const platform = os_1.default.platform(); + switch (platform) { + case 'darwin': + return os_1.default.arch() === 'arm64' + ? browser_data_js_1.BrowserPlatform.MAC_ARM + : browser_data_js_1.BrowserPlatform.MAC; + case 'linux': + return browser_data_js_1.BrowserPlatform.LINUX; + case 'win32': + return os_1.default.arch() === 'x64' || + // Windows 11 for ARM supports x64 emulation + (os_1.default.arch() === 'arm64' && isWindows11(os_1.default.release())) + ? browser_data_js_1.BrowserPlatform.WIN64 + : browser_data_js_1.BrowserPlatform.WIN32; + default: + return undefined; + } +} +exports.detectBrowserPlatform = detectBrowserPlatform; +/** + * Windows 11 is identified by the version 10.0.22000 or greater + * @internal + */ +function isWindows11(version) { + const parts = version.split('.'); + if (parts.length > 2) { + const major = parseInt(parts[0], 10); + const minor = parseInt(parts[1], 10); + const patch = parseInt(parts[2], 10); + return (major > 10 || + (major === 10 && minor > 0) || + (major === 10 && minor === 0 && patch >= 22000)); + } + return false; +} +//# sourceMappingURL=detectPlatform.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js b/node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js new file mode 100644 index 000000000..5ee69c3f0 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/fileUtil.js @@ -0,0 +1,110 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.unpackArchive = void 0; +const child_process_1 = require("child_process"); +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +const path = __importStar(require("path")); +const util_1 = require("util"); +const extract_zip_1 = __importDefault(require("extract-zip")); +const tar_fs_1 = __importDefault(require("tar-fs")); +const unbzip2_stream_1 = __importDefault(require("unbzip2-stream")); +const exec = (0, util_1.promisify)(child_process_1.exec); +/** + * @internal + */ +async function unpackArchive(archivePath, folderPath) { + if (archivePath.endsWith('.zip')) { + await (0, extract_zip_1.default)(archivePath, { dir: folderPath }); + } + else if (archivePath.endsWith('.tar.bz2')) { + await extractTar(archivePath, folderPath); + } + else if (archivePath.endsWith('.dmg')) { + await (0, promises_1.mkdir)(folderPath); + await installDMG(archivePath, folderPath); + } + else { + throw new Error(`Unsupported archive format: ${archivePath}`); + } +} +exports.unpackArchive = unpackArchive; +/** + * @internal + */ +function extractTar(tarPath, folderPath) { + return new Promise((fulfill, reject) => { + const tarStream = tar_fs_1.default.extract(folderPath); + tarStream.on('error', reject); + tarStream.on('finish', fulfill); + const readStream = (0, fs_1.createReadStream)(tarPath); + readStream.pipe((0, unbzip2_stream_1.default)()).pipe(tarStream); + }); +} +/** + * @internal + */ +async function installDMG(dmgPath, folderPath) { + const { stdout } = await exec(`hdiutil attach -nobrowse -noautoopen "${dmgPath}"`); + const volumes = stdout.match(/\/Volumes\/(.*)/m); + if (!volumes) { + throw new Error(`Could not find volume path in ${stdout}`); + } + const mountPath = volumes[0]; + try { + const fileNames = await (0, promises_1.readdir)(mountPath); + const appName = fileNames.find(item => { + return typeof item === 'string' && item.endsWith('.app'); + }); + if (!appName) { + throw new Error(`Cannot find app in ${mountPath}`); + } + const mountedPath = path.join(mountPath, appName); + await exec(`cp -R "${mountedPath}" "${folderPath}"`); + } + finally { + await exec(`hdiutil detach "${mountPath}" -quiet`); + } +} +//# sourceMappingURL=fileUtil.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js b/node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js new file mode 100644 index 000000000..816f6333b --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/httpUtil.js @@ -0,0 +1,146 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.downloadFile = exports.httpRequest = exports.headHttpRequest = void 0; +const fs_1 = require("fs"); +const http = __importStar(require("http")); +const https = __importStar(require("https")); +const url_1 = require("url"); +const https_proxy_agent_1 = __importDefault(require("https-proxy-agent")); +const proxy_from_env_1 = require("proxy-from-env"); +function headHttpRequest(url) { + return new Promise(resolve => { + const request = httpRequest(url, 'HEAD', response => { + resolve(response.statusCode === 200); + }, false); + request.on('error', () => { + resolve(false); + }); + }); +} +exports.headHttpRequest = headHttpRequest; +function httpRequest(url, method, response, keepAlive = true) { + const options = { + protocol: url.protocol, + hostname: url.hostname, + port: url.port, + path: url.pathname + url.search, + method, + headers: keepAlive ? { Connection: 'keep-alive' } : undefined, + }; + const proxyURL = (0, proxy_from_env_1.getProxyForUrl)(url.toString()); + if (proxyURL) { + const proxy = new url_1.URL(proxyURL); + if (proxy.protocol === 'http:') { + options.path = url.href; + options.hostname = proxy.hostname; + options.protocol = proxy.protocol; + options.port = proxy.port; + } + else { + options.agent = (0, https_proxy_agent_1.default)({ + host: proxy.host, + path: proxy.pathname, + port: proxy.port, + secureProxy: proxy.protocol === 'https:', + headers: options.headers, + }); + } + } + const requestCallback = (res) => { + if (res.statusCode && + res.statusCode >= 300 && + res.statusCode < 400 && + res.headers.location) { + httpRequest(new url_1.URL(res.headers.location), method, response); + } + else { + response(res); + } + }; + const request = options.protocol === 'https:' + ? https.request(options, requestCallback) + : http.request(options, requestCallback); + request.end(); + return request; +} +exports.httpRequest = httpRequest; +/** + * @internal + */ +function downloadFile(url, destinationPath, progressCallback) { + return new Promise((resolve, reject) => { + let downloadedBytes = 0; + let totalBytes = 0; + function onData(chunk) { + downloadedBytes += chunk.length; + progressCallback(downloadedBytes, totalBytes); + } + const request = httpRequest(url, 'GET', response => { + if (response.statusCode !== 200) { + const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`); + // consume response data to free up memory + response.resume(); + reject(error); + return; + } + const file = (0, fs_1.createWriteStream)(destinationPath); + file.on('finish', () => { + return resolve(); + }); + file.on('error', error => { + return reject(error); + }); + response.pipe(file); + totalBytes = parseInt(response.headers['content-length'], 10); + if (progressCallback) { + response.on('data', onData); + } + }); + request.on('error', error => { + return reject(error); + }); + }); +} +exports.downloadFile = downloadFile; +//# sourceMappingURL=httpUtil.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/install.js b/node_modules/@puppeteer/browsers/lib/cjs/install.js new file mode 100644 index 000000000..750ba42ce --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/install.js @@ -0,0 +1,141 @@ +"use strict"; +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.canDownload = exports.install = void 0; +const assert_1 = __importDefault(require("assert")); +const fs_1 = require("fs"); +const promises_1 = require("fs/promises"); +const os_1 = __importDefault(require("os")); +const path_1 = __importDefault(require("path")); +const browser_data_js_1 = require("./browser-data/browser-data.js"); +const Cache_js_1 = require("./Cache.js"); +const debug_js_1 = require("./debug.js"); +const detectPlatform_js_1 = require("./detectPlatform.js"); +const fileUtil_js_1 = require("./fileUtil.js"); +const httpUtil_js_1 = require("./httpUtil.js"); +const debugInstall = (0, debug_js_1.debug)('puppeteer:browsers:install'); +const times = new Map(); +function debugTime(label) { + times.set(label, process.hrtime()); +} +function debugTimeEnd(label) { + const end = process.hrtime(); + const start = times.get(label); + if (!start) { + return; + } + const duration = end[0] * 1000 + end[1] / 1e6 - (start[0] * 1000 + start[1] / 1e6); // calculate duration in milliseconds + debugInstall(`Duration for ${label}: ${duration}ms`); +} +/** + * @public + */ +async function install(options) { + var _a, _b; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); + (_b = options.unpack) !== null && _b !== void 0 ? _b : (options.unpack = true); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); + } + const url = getDownloadUrl(options.browser, options.platform, options.buildId, options.baseUrl); + const fileName = url.toString().split('/').pop(); + (0, assert_1.default)(fileName, `A malformed download URL was found: ${url}.`); + const structure = new Cache_js_1.Cache(options.cacheDir); + const browserRoot = structure.browserRoot(options.browser); + const archivePath = path_1.default.join(browserRoot, fileName); + if (!(0, fs_1.existsSync)(browserRoot)) { + await (0, promises_1.mkdir)(browserRoot, { recursive: true }); + } + if (!options.unpack) { + if ((0, fs_1.existsSync)(archivePath)) { + return { + path: archivePath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + debugInstall(`Downloading binary from ${url}`); + debugTime('download'); + await (0, httpUtil_js_1.downloadFile)(url, archivePath, options.downloadProgressCallback); + debugTimeEnd('download'); + return { + path: archivePath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + const outputPath = structure.installationDir(options.browser, options.platform, options.buildId); + if ((0, fs_1.existsSync)(outputPath)) { + return { + path: outputPath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + try { + debugInstall(`Downloading binary from ${url}`); + try { + debugTime('download'); + await (0, httpUtil_js_1.downloadFile)(url, archivePath, options.downloadProgressCallback); + } + finally { + debugTimeEnd('download'); + } + debugInstall(`Installing ${archivePath} to ${outputPath}`); + try { + debugTime('extract'); + await (0, fileUtil_js_1.unpackArchive)(archivePath, outputPath); + } + finally { + debugTimeEnd('extract'); + } + } + finally { + if ((0, fs_1.existsSync)(archivePath)) { + await (0, promises_1.unlink)(archivePath); + } + } + return { + path: outputPath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; +} +exports.install = install; +/** + * @public + */ +async function canDownload(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); + } + return await (0, httpUtil_js_1.headHttpRequest)(getDownloadUrl(options.browser, options.platform, options.buildId, options.baseUrl)); +} +exports.canDownload = canDownload; +function getDownloadUrl(browser, platform, buildId, baseUrl) { + return new URL(browser_data_js_1.downloadUrls[browser](platform, buildId, baseUrl)); +} +//# sourceMappingURL=install.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/launch.js b/node_modules/@puppeteer/browsers/lib/cjs/launch.js new file mode 100644 index 000000000..fb0175d5c --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/launch.js @@ -0,0 +1,366 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _Process_instances, _Process_executablePath, _Process_args, _Process_browserProcess, _Process_exited, _Process_hooksRan, _Process_onExitHook, _Process_browserProcessExiting, _Process_runHooks, _Process_configureStdio, _Process_clearListeners, _Process_onDriverProcessExit, _Process_onDriverProcessSignal; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TimeoutError = exports.isErrnoException = exports.isErrorLike = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.launch = exports.computeSystemExecutablePath = exports.computeExecutablePath = void 0; +const child_process_1 = __importDefault(require("child_process")); +const fs_1 = require("fs"); +const os_1 = __importDefault(require("os")); +const path_1 = __importDefault(require("path")); +const readline_1 = __importDefault(require("readline")); +const browser_data_js_1 = require("./browser-data/browser-data.js"); +const Cache_js_1 = require("./Cache.js"); +const debug_js_1 = require("./debug.js"); +const detectPlatform_js_1 = require("./detectPlatform.js"); +const debugLaunch = (0, debug_js_1.debug)('puppeteer:browsers:launcher'); +/** + * @public + */ +function computeExecutablePath(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); + } + const installationDir = new Cache_js_1.Cache(options.cacheDir).installationDir(options.browser, options.platform, options.buildId); + return path_1.default.join(installationDir, browser_data_js_1.executablePathByBrowser[options.browser](options.platform, options.buildId)); +} +exports.computeExecutablePath = computeExecutablePath; +/** + * @public + */ +function computeSystemExecutablePath(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = (0, detectPlatform_js_1.detectBrowserPlatform)()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os_1.default.platform()} (${os_1.default.arch()})`); + } + const path = (0, browser_data_js_1.resolveSystemExecutablePath)(options.browser, options.platform, options.channel); + try { + (0, fs_1.accessSync)(path); + } + catch (error) { + throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`); + } + return path; +} +exports.computeSystemExecutablePath = computeSystemExecutablePath; +/** + * @public + */ +function launch(opts) { + return new Process(opts); +} +exports.launch = launch; +/** + * @public + */ +exports.CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/; +/** + * @public + */ +exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/; +/** + * @public + */ +class Process { + constructor(opts) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + _Process_instances.add(this); + _Process_executablePath.set(this, void 0); + _Process_args.set(this, void 0); + _Process_browserProcess.set(this, void 0); + _Process_exited.set(this, false); + // The browser process can be closed externally or from the driver process. We + // need to invoke the hooks only once though but we don't know how many times + // we will be invoked. + _Process_hooksRan.set(this, false); + _Process_onExitHook.set(this, async () => { }); + _Process_browserProcessExiting.set(this, void 0); + _Process_onDriverProcessExit.set(this, (_code) => { + this.kill(); + }); + _Process_onDriverProcessSignal.set(this, (signal) => { + switch (signal) { + case 'SIGINT': + this.kill(); + process.exit(130); + case 'SIGTERM': + case 'SIGHUP': + this.close(); + break; + } + }); + __classPrivateFieldSet(this, _Process_executablePath, opts.executablePath, "f"); + __classPrivateFieldSet(this, _Process_args, (_a = opts.args) !== null && _a !== void 0 ? _a : [], "f"); + (_b = opts.pipe) !== null && _b !== void 0 ? _b : (opts.pipe = false); + (_c = opts.dumpio) !== null && _c !== void 0 ? _c : (opts.dumpio = false); + (_d = opts.handleSIGINT) !== null && _d !== void 0 ? _d : (opts.handleSIGINT = true); + (_e = opts.handleSIGTERM) !== null && _e !== void 0 ? _e : (opts.handleSIGTERM = true); + (_f = opts.handleSIGHUP) !== null && _f !== void 0 ? _f : (opts.handleSIGHUP = true); + // On non-windows platforms, `detached: true` makes child process a + // leader of a new process group, making it possible to kill child + // process tree with `.kill(-pid)` command. @see + // https://nodejs.org/api/child_process.html#child_process_options_detached + (_g = opts.detached) !== null && _g !== void 0 ? _g : (opts.detached = process.platform !== 'win32'); + const stdio = __classPrivateFieldGet(this, _Process_instances, "m", _Process_configureStdio).call(this, { + pipe: opts.pipe, + dumpio: opts.dumpio, + }); + debugLaunch(`Launching ${__classPrivateFieldGet(this, _Process_executablePath, "f")} ${__classPrivateFieldGet(this, _Process_args, "f").join(' ')}`, { + detached: opts.detached, + env: opts.env, + stdio, + }); + __classPrivateFieldSet(this, _Process_browserProcess, child_process_1.default.spawn(__classPrivateFieldGet(this, _Process_executablePath, "f"), __classPrivateFieldGet(this, _Process_args, "f"), { + detached: opts.detached, + env: opts.env, + stdio, + }), "f"); + debugLaunch(`Launched ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid}`); + if (opts.dumpio) { + (_h = __classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) === null || _h === void 0 ? void 0 : _h.pipe(process.stderr); + (_j = __classPrivateFieldGet(this, _Process_browserProcess, "f").stdout) === null || _j === void 0 ? void 0 : _j.pipe(process.stdout); + } + process.on('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); + if (opts.handleSIGINT) { + process.on('SIGINT', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.handleSIGTERM) { + process.on('SIGTERM', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.handleSIGHUP) { + process.on('SIGHUP', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.onExit) { + __classPrivateFieldSet(this, _Process_onExitHook, opts.onExit, "f"); + } + __classPrivateFieldSet(this, _Process_browserProcessExiting, new Promise((resolve, reject) => { + __classPrivateFieldGet(this, _Process_browserProcess, "f").once('exit', async () => { + debugLaunch(`Browser process ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} onExit`); + __classPrivateFieldGet(this, _Process_instances, "m", _Process_clearListeners).call(this); + __classPrivateFieldSet(this, _Process_exited, true, "f"); + try { + await __classPrivateFieldGet(this, _Process_instances, "m", _Process_runHooks).call(this); + } + catch (err) { + reject(err); + return; + } + resolve(); + }); + }), "f"); + } + get nodeProcess() { + return __classPrivateFieldGet(this, _Process_browserProcess, "f"); + } + async close() { + await __classPrivateFieldGet(this, _Process_instances, "m", _Process_runHooks).call(this); + if (!__classPrivateFieldGet(this, _Process_exited, "f")) { + this.kill(); + } + return __classPrivateFieldGet(this, _Process_browserProcessExiting, "f"); + } + hasClosed() { + return __classPrivateFieldGet(this, _Process_browserProcessExiting, "f"); + } + kill() { + debugLaunch(`Trying to kill ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid}`); + // If the process failed to launch (for example if the browser executable path + // is invalid), then the process does not get a pid assigned. A call to + // `proc.kill` would error, as the `pid` to-be-killed can not be found. + if (__classPrivateFieldGet(this, _Process_browserProcess, "f") && + __classPrivateFieldGet(this, _Process_browserProcess, "f").pid && + pidExists(__classPrivateFieldGet(this, _Process_browserProcess, "f").pid)) { + try { + debugLaunch(`Browser process ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} exists`); + if (process.platform === 'win32') { + try { + child_process_1.default.execSync(`taskkill /pid ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} /T /F`); + } + catch (error) { + debugLaunch(`Killing ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} using taskkill failed`, error); + // taskkill can fail to kill the process e.g. due to missing permissions. + // Let's kill the process via Node API. This delays killing of all child + // processes of `this.proc` until the main Node.js process dies. + __classPrivateFieldGet(this, _Process_browserProcess, "f").kill(); + } + } + else { + // on linux the process group can be killed with the group id prefixed with + // a minus sign. The process group id is the group leader's pid. + const processGroupId = -__classPrivateFieldGet(this, _Process_browserProcess, "f").pid; + try { + process.kill(processGroupId, 'SIGKILL'); + } + catch (error) { + debugLaunch(`Killing ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} using process.kill failed`, error); + // Killing the process group can fail due e.g. to missing permissions. + // Let's kill the process via Node API. This delays killing of all child + // processes of `this.proc` until the main Node.js process dies. + __classPrivateFieldGet(this, _Process_browserProcess, "f").kill('SIGKILL'); + } + } + } + catch (error) { + throw new Error(`${PROCESS_ERROR_EXPLANATION}\nError cause: ${isErrorLike(error) ? error.stack : error}`); + } + } + __classPrivateFieldGet(this, _Process_instances, "m", _Process_clearListeners).call(this); + } + waitForLineOutput(regex, timeout) { + if (!__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) { + throw new Error('`browserProcess` does not have stderr.'); + } + const rl = readline_1.default.createInterface(__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr); + let stderr = ''; + return new Promise((resolve, reject) => { + rl.on('line', onLine); + rl.on('close', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").on('exit', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").on('error', onClose); + const timeoutId = timeout ? setTimeout(onTimeout, timeout) : 0; + const cleanup = () => { + if (timeoutId) { + clearTimeout(timeoutId); + } + rl.off('line', onLine); + rl.off('close', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").off('exit', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").off('error', onClose); + }; + function onClose(error) { + cleanup(); + reject(new Error([ + `Failed to launch the browser process!${error ? ' ' + error.message : ''}`, + stderr, + '', + 'TROUBLESHOOTING: https://pptr.dev/troubleshooting', + '', + ].join('\n'))); + } + function onTimeout() { + cleanup(); + reject(new TimeoutError(`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`)); + } + function onLine(line) { + stderr += line + '\n'; + const match = line.match(regex); + if (!match) { + return; + } + cleanup(); + // The RegExp matches, so this will obviously exist. + resolve(match[1]); + } + }); + } +} +exports.Process = Process; +_Process_executablePath = new WeakMap(), _Process_args = new WeakMap(), _Process_browserProcess = new WeakMap(), _Process_exited = new WeakMap(), _Process_hooksRan = new WeakMap(), _Process_onExitHook = new WeakMap(), _Process_browserProcessExiting = new WeakMap(), _Process_onDriverProcessExit = new WeakMap(), _Process_onDriverProcessSignal = new WeakMap(), _Process_instances = new WeakSet(), _Process_runHooks = async function _Process_runHooks() { + if (__classPrivateFieldGet(this, _Process_hooksRan, "f")) { + return; + } + __classPrivateFieldSet(this, _Process_hooksRan, true, "f"); + await __classPrivateFieldGet(this, _Process_onExitHook, "f").call(this); +}, _Process_configureStdio = function _Process_configureStdio(opts) { + if (opts.pipe) { + if (opts.dumpio) { + return ['ignore', 'pipe', 'pipe', 'pipe', 'pipe']; + } + else { + return ['ignore', 'ignore', 'ignore', 'pipe', 'pipe']; + } + } + else { + if (opts.dumpio) { + return ['pipe', 'pipe', 'pipe']; + } + else { + return ['pipe', 'ignore', 'pipe']; + } + } +}, _Process_clearListeners = function _Process_clearListeners() { + process.off('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); + process.off('SIGINT', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + process.off('SIGTERM', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + process.off('SIGHUP', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); +}; +const PROCESS_ERROR_EXPLANATION = `Puppeteer was unable to kill the process which ran the browser binary. +This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser. +Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed. +If you think this is a bug, please report it on the Puppeteer issue tracker.`; +/** + * @internal + */ +function pidExists(pid) { + try { + return process.kill(pid, 0); + } + catch (error) { + if (isErrnoException(error)) { + if (error.code && error.code === 'ESRCH') { + return false; + } + } + throw error; + } +} +/** + * @internal + */ +function isErrorLike(obj) { + return (typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj); +} +exports.isErrorLike = isErrorLike; +/** + * @internal + */ +function isErrnoException(obj) { + return (isErrorLike(obj) && + ('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj)); +} +exports.isErrnoException = isErrnoException; +/** + * @public + */ +class TimeoutError extends Error { + /** + * @internal + */ + constructor(message) { + super(message); + this.name = this.constructor.name; + Error.captureStackTrace(this, this.constructor); + } +} +exports.TimeoutError = TimeoutError; +//# sourceMappingURL=launch.js.map \ No newline at end of file diff --git a/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js b/node_modules/@puppeteer/browsers/lib/cjs/main-cli.js old mode 100644 new mode 100755 similarity index 63% rename from node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js rename to node_modules/@puppeteer/browsers/lib/cjs/main-cli.js index d1bbf76ac..b2f577145 --- a/node_modules/puppeteer-core/lib/esm/puppeteer/initialize-web.js +++ b/node_modules/@puppeteer/browsers/lib/cjs/main-cli.js @@ -1,5 +1,7 @@ +#!/usr/bin/env node +"use strict"; /** - * Copyright 2020 Google Inc. All rights reserved. + * Copyright 2023 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,11 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Puppeteer } from './common/Puppeteer.js'; -export const initializePuppeteerWeb = (packageName) => { - const isPuppeteerCore = packageName === 'puppeteer-core'; - return new Puppeteer({ - isPuppeteerCore, - }); -}; -//# sourceMappingURL=initialize-web.js.map \ No newline at end of file +Object.defineProperty(exports, "__esModule", { value: true }); +const CLI_js_1 = require("./CLI.js"); +new CLI_js_1.CLI().run(process.argv); +//# sourceMappingURL=main-cli.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/cjs/main.js b/node_modules/@puppeteer/browsers/lib/cjs/main.js new file mode 100644 index 000000000..ece025ee2 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/cjs/main.js @@ -0,0 +1,43 @@ +"use strict"; +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Cache = exports.makeProgressCallback = exports.CLI = exports.createProfile = exports.ChromeReleaseChannel = exports.BrowserPlatform = exports.Browser = exports.resolveBuildId = exports.detectBrowserPlatform = exports.canDownload = exports.install = exports.Process = exports.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = exports.CDP_WEBSOCKET_ENDPOINT_REGEX = exports.TimeoutError = exports.computeSystemExecutablePath = exports.computeExecutablePath = exports.launch = void 0; +var launch_js_1 = require("./launch.js"); +Object.defineProperty(exports, "launch", { enumerable: true, get: function () { return launch_js_1.launch; } }); +Object.defineProperty(exports, "computeExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeExecutablePath; } }); +Object.defineProperty(exports, "computeSystemExecutablePath", { enumerable: true, get: function () { return launch_js_1.computeSystemExecutablePath; } }); +Object.defineProperty(exports, "TimeoutError", { enumerable: true, get: function () { return launch_js_1.TimeoutError; } }); +Object.defineProperty(exports, "CDP_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.CDP_WEBSOCKET_ENDPOINT_REGEX; } }); +Object.defineProperty(exports, "WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX", { enumerable: true, get: function () { return launch_js_1.WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX; } }); +Object.defineProperty(exports, "Process", { enumerable: true, get: function () { return launch_js_1.Process; } }); +var install_js_1 = require("./install.js"); +Object.defineProperty(exports, "install", { enumerable: true, get: function () { return install_js_1.install; } }); +Object.defineProperty(exports, "canDownload", { enumerable: true, get: function () { return install_js_1.canDownload; } }); +var detectPlatform_js_1 = require("./detectPlatform.js"); +Object.defineProperty(exports, "detectBrowserPlatform", { enumerable: true, get: function () { return detectPlatform_js_1.detectBrowserPlatform; } }); +var browser_data_js_1 = require("./browser-data/browser-data.js"); +Object.defineProperty(exports, "resolveBuildId", { enumerable: true, get: function () { return browser_data_js_1.resolveBuildId; } }); +Object.defineProperty(exports, "Browser", { enumerable: true, get: function () { return browser_data_js_1.Browser; } }); +Object.defineProperty(exports, "BrowserPlatform", { enumerable: true, get: function () { return browser_data_js_1.BrowserPlatform; } }); +Object.defineProperty(exports, "ChromeReleaseChannel", { enumerable: true, get: function () { return browser_data_js_1.ChromeReleaseChannel; } }); +Object.defineProperty(exports, "createProfile", { enumerable: true, get: function () { return browser_data_js_1.createProfile; } }); +var CLI_js_1 = require("./CLI.js"); +Object.defineProperty(exports, "CLI", { enumerable: true, get: function () { return CLI_js_1.CLI; } }); +Object.defineProperty(exports, "makeProgressCallback", { enumerable: true, get: function () { return CLI_js_1.makeProgressCallback; } }); +var Cache_js_1 = require("./Cache.js"); +Object.defineProperty(exports, "Cache", { enumerable: true, get: function () { return Cache_js_1.Cache; } }); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/CLI.js b/node_modules/@puppeteer/browsers/lib/esm/CLI.js new file mode 100644 index 000000000..1f58bdf82 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/CLI.js @@ -0,0 +1,211 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _CLI_instances, _CLI_cachePath, _CLI_rl, _CLI_defineBrowserParameter, _CLI_definePlatformParameter, _CLI_definePathParameter, _CLI_parseBrowser, _CLI_parseBuildId; +import { stdin as input, stdout as output } from 'process'; +import * as readline from 'readline'; +import ProgressBar from 'progress'; +import { hideBin } from 'yargs/helpers'; +import yargs from 'yargs/yargs'; +import { resolveBuildId, BrowserPlatform, } from './browser-data/browser-data.js'; +import { Cache } from './Cache.js'; +import { detectBrowserPlatform } from './detectPlatform.js'; +import { install } from './install.js'; +import { computeExecutablePath, computeSystemExecutablePath, launch, } from './launch.js'; +/** + * @public + */ +export class CLI { + constructor(cachePath = process.cwd(), rl) { + _CLI_instances.add(this); + _CLI_cachePath.set(this, void 0); + _CLI_rl.set(this, void 0); + __classPrivateFieldSet(this, _CLI_cachePath, cachePath, "f"); + __classPrivateFieldSet(this, _CLI_rl, rl, "f"); + } + async run(argv) { + const yargsInstance = yargs(hideBin(argv)); + await yargsInstance + .scriptName('@puppeteer/browsers') + .command('install ', 'Download and install the specified browser. If successful, the command outputs the actual browser buildId that was installed and the absolute path to the browser executable (format: @ ).', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_defineBrowserParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePlatformParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs); + yargs.option('base-url', { + type: 'string', + desc: 'Base URL to download from', + }); + yargs.example('$0 install chrome', 'Install the latest available build of the Chrome browser.'); + yargs.example('$0 install chrome@latest', 'Install the latest available build for the Chrome browser.'); + yargs.example('$0 install chromium@1083080', 'Install the revision 1083080 of the Chromium browser.'); + yargs.example('$0 install firefox', 'Install the latest available build of the Firefox browser.'); + yargs.example('$0 install firefox --platform mac', 'Install the latest Mac (Intel) build of the Firefox browser.'); + yargs.example('$0 install firefox --path /tmp/my-browser-cache', 'Install to the specified cache directory.'); + }, async (argv) => { + var _a, _b, _c; + const args = argv; + (_a = args.platform) !== null && _a !== void 0 ? _a : (args.platform = detectBrowserPlatform()); + if (!args.platform) { + throw new Error(`Could not resolve the current platform`); + } + args.browser.buildId = await resolveBuildId(args.browser.name, args.platform, args.browser.buildId); + await install({ + browser: args.browser.name, + buildId: args.browser.buildId, + platform: args.platform, + cacheDir: (_b = args.path) !== null && _b !== void 0 ? _b : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + downloadProgressCallback: makeProgressCallback(args.browser.name, args.browser.buildId), + baseUrl: args.baseUrl, + }); + console.log(`${args.browser.name}@${args.browser.buildId} ${computeExecutablePath({ + browser: args.browser.name, + buildId: args.browser.buildId, + cacheDir: (_c = args.path) !== null && _c !== void 0 ? _c : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + platform: args.platform, + })}`); + }) + .command('launch ', 'Launch the specified browser', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_defineBrowserParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePlatformParameter).call(this, yargs); + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs); + yargs.option('detached', { + type: 'boolean', + desc: 'Detach the child process.', + default: false, + }); + yargs.option('system', { + type: 'boolean', + desc: 'Search for a browser installed on the system instead of the cache folder.', + default: false, + }); + yargs.example('$0 launch chrome@1083080', 'Launch the Chrome browser identified by the revision 1083080.'); + yargs.example('$0 launch firefox@112.0a1', 'Launch the Firefox browser identified by the milestone 112.0a1.'); + yargs.example('$0 launch chrome@1083080 --detached', 'Launch the browser but detach the sub-processes.'); + yargs.example('$0 launch chrome@canary --system', 'Try to locate the Canary build of Chrome installed on the system and launch it.'); + }, async (argv) => { + var _a; + const args = argv; + const executablePath = args.system + ? computeSystemExecutablePath({ + browser: args.browser.name, + // TODO: throw an error if not a ChromeReleaseChannel is provided. + channel: args.browser.buildId, + platform: args.platform, + }) + : computeExecutablePath({ + browser: args.browser.name, + buildId: args.browser.buildId, + cacheDir: (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"), + platform: args.platform, + }); + launch({ + executablePath, + detached: args.detached, + }); + }) + .command('clear', 'Removes all installed browsers from the specified cache directory', yargs => { + __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_definePathParameter).call(this, yargs, true); + }, async (argv) => { + var _a, _b; + const args = argv; + const cacheDir = (_a = args.path) !== null && _a !== void 0 ? _a : __classPrivateFieldGet(this, _CLI_cachePath, "f"); + const rl = (_b = __classPrivateFieldGet(this, _CLI_rl, "f")) !== null && _b !== void 0 ? _b : readline.createInterface({ input, output }); + rl.question(`Do you want to permanently and recursively delete the content of ${cacheDir} (yes/No)? `, answer => { + rl.close(); + if (!['y', 'yes'].includes(answer.toLowerCase().trim())) { + console.log('Cancelled.'); + return; + } + const cache = new Cache(cacheDir); + cache.clear(); + console.log(`${cacheDir} cleared.`); + }); + }) + .demandCommand(1) + .help() + .wrap(Math.min(120, yargsInstance.terminalWidth())) + .parse(); + } +} +_CLI_cachePath = new WeakMap(), _CLI_rl = new WeakMap(), _CLI_instances = new WeakSet(), _CLI_defineBrowserParameter = function _CLI_defineBrowserParameter(yargs) { + yargs.positional('browser', { + description: 'Which browser to install [@]. `latest` will try to find the latest available build. `buildId` is a browser-specific identifier such as a version or a revision.', + type: 'string', + coerce: (opt) => { + return { + name: __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_parseBrowser).call(this, opt), + buildId: __classPrivateFieldGet(this, _CLI_instances, "m", _CLI_parseBuildId).call(this, opt), + }; + }, + }); +}, _CLI_definePlatformParameter = function _CLI_definePlatformParameter(yargs) { + yargs.option('platform', { + type: 'string', + desc: 'Platform that the binary needs to be compatible with.', + choices: Object.values(BrowserPlatform), + defaultDescription: 'Auto-detected', + }); +}, _CLI_definePathParameter = function _CLI_definePathParameter(yargs, required = false) { + yargs.option('path', { + type: 'string', + desc: 'Path to the root folder for the browser downloads and installation. The installation folder structure is compatible with the cache structure used by Puppeteer.', + defaultDescription: 'Current working directory', + ...(required ? {} : { default: process.cwd() }), + }); + if (required) { + yargs.demandOption('path'); + } +}, _CLI_parseBrowser = function _CLI_parseBrowser(version) { + return version.split('@').shift(); +}, _CLI_parseBuildId = function _CLI_parseBuildId(version) { + var _a; + return (_a = version.split('@').pop()) !== null && _a !== void 0 ? _a : 'latest'; +}; +/** + * @public + */ +export function makeProgressCallback(browser, buildId) { + let progressBar; + let lastDownloadedBytes = 0; + return (downloadedBytes, totalBytes) => { + if (!progressBar) { + progressBar = new ProgressBar(`Downloading ${browser} r${buildId} - ${toMegabytes(totalBytes)} [:bar] :percent :etas `, { + complete: '=', + incomplete: ' ', + width: 20, + total: totalBytes, + }); + } + const delta = downloadedBytes - lastDownloadedBytes; + lastDownloadedBytes = downloadedBytes; + progressBar.tick(delta); + }; +} +function toMegabytes(bytes) { + const mb = bytes / 1000 / 1000; + return `${Math.round(mb * 10) / 10} MB`; +} +//# sourceMappingURL=CLI.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/Cache.js b/node_modules/@puppeteer/browsers/lib/esm/Cache.js new file mode 100644 index 000000000..3c2afd865 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/Cache.js @@ -0,0 +1,108 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Cache_rootDir; +import fs from 'fs'; +import path from 'path'; +import { Browser } from './browser-data/browser-data.js'; +/** + * The cache used by Puppeteer relies on the following structure: + * + * - rootDir + * -- | browserRoot(browser1) + * ---- - | installationDir() + * ------ the browser-platform-buildId + * ------ specific structure. + * -- | browserRoot(browser2) + * ---- - | installationDir() + * ------ the browser-platform-buildId + * ------ specific structure. + * @internal + */ +export class Cache { + constructor(rootDir) { + _Cache_rootDir.set(this, void 0); + __classPrivateFieldSet(this, _Cache_rootDir, rootDir, "f"); + } + browserRoot(browser) { + // Chromium is a special case for backward compatibility: we install it in + // the Chrome folder so that Puppeteer can find it. + return path.join(__classPrivateFieldGet(this, _Cache_rootDir, "f"), browser === Browser.CHROMIUM ? Browser.CHROME : browser); + } + installationDir(browser, platform, buildId) { + return path.join(this.browserRoot(browser), `${platform}-${buildId}`); + } + clear() { + fs.rmSync(__classPrivateFieldGet(this, _Cache_rootDir, "f"), { + force: true, + recursive: true, + maxRetries: 10, + retryDelay: 500, + }); + } + getInstalledBrowsers() { + if (!fs.existsSync(__classPrivateFieldGet(this, _Cache_rootDir, "f"))) { + return []; + } + const types = fs.readdirSync(__classPrivateFieldGet(this, _Cache_rootDir, "f")); + const browsers = types.filter((t) => { + return Object.values(Browser).includes(t); + }); + return browsers.flatMap(browser => { + const files = fs.readdirSync(this.browserRoot(browser)); + return files + .map(file => { + const result = parseFolderPath(path.join(this.browserRoot(browser), file)); + if (!result) { + return null; + } + return { + path: path.join(this.browserRoot(browser), file), + browser, + platform: result.platform, + buildId: result.buildId, + }; + }) + .filter((item) => { + return item !== null; + }); + }); + } +} +_Cache_rootDir = new WeakMap(); +function parseFolderPath(folderPath) { + const name = path.basename(folderPath); + const splits = name.split('-'); + if (splits.length !== 2) { + return; + } + const [platform, buildId] = splits; + if (!buildId || !platform) { + return; + } + return { platform, buildId }; +} +//# sourceMappingURL=Cache.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/browser-data.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/browser-data.js new file mode 100644 index 000000000..87516afde --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/browser-data.js @@ -0,0 +1,96 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as chrome from './chrome.js'; +import * as chromedriver from './chromedriver.js'; +import * as chromium from './chromium.js'; +import * as firefox from './firefox.js'; +import { Browser, BrowserPlatform, BrowserTag, ChromeReleaseChannel, } from './types.js'; +export const downloadUrls = { + [Browser.CHROMEDRIVER]: chromedriver.resolveDownloadUrl, + [Browser.CHROME]: chrome.resolveDownloadUrl, + [Browser.CHROMIUM]: chromium.resolveDownloadUrl, + [Browser.FIREFOX]: firefox.resolveDownloadUrl, +}; +export const downloadPaths = { + [Browser.CHROMEDRIVER]: chromedriver.resolveDownloadPath, + [Browser.CHROME]: chrome.resolveDownloadPath, + [Browser.CHROMIUM]: chromium.resolveDownloadPath, + [Browser.FIREFOX]: firefox.resolveDownloadPath, +}; +export const executablePathByBrowser = { + [Browser.CHROMEDRIVER]: chromedriver.relativeExecutablePath, + [Browser.CHROME]: chrome.relativeExecutablePath, + [Browser.CHROMIUM]: chromium.relativeExecutablePath, + [Browser.FIREFOX]: firefox.relativeExecutablePath, +}; +export { Browser, BrowserPlatform, ChromeReleaseChannel }; +/** + * @public + */ +export async function resolveBuildId(browser, platform, tag) { + switch (browser) { + case Browser.FIREFOX: + switch (tag) { + case BrowserTag.LATEST: + return await firefox.resolveBuildId('FIREFOX_NIGHTLY'); + } + case Browser.CHROME: + switch (tag) { + case BrowserTag.LATEST: + // In CfT beta is the latest version. + return await chrome.resolveBuildId(platform, 'beta'); + } + case Browser.CHROMEDRIVER: + switch (tag) { + case BrowserTag.LATEST: + return await chromedriver.resolveBuildId('latest'); + } + case Browser.CHROMIUM: + switch (tag) { + case BrowserTag.LATEST: + return await chromium.resolveBuildId(platform, 'latest'); + } + } + // We assume the tag is the buildId if it didn't match any keywords. + return tag; +} +/** + * @public + */ +export async function createProfile(browser, opts) { + switch (browser) { + case Browser.FIREFOX: + return await firefox.createProfile(opts); + case Browser.CHROME: + case Browser.CHROMIUM: + throw new Error(`Profile creation is not support for ${browser} yet`); + } +} +/** + * @public + */ +export function resolveSystemExecutablePath(browser, platform, channel) { + switch (browser) { + case Browser.CHROMEDRIVER: + case Browser.FIREFOX: + throw new Error(`System browser detection is not supported for ${browser} yet.`); + case Browser.CHROME: + return chromium.resolveSystemExecutablePath(platform, channel); + case Browser.CHROMIUM: + return chrome.resolveSystemExecutablePath(platform, channel); + } +} +//# sourceMappingURL=browser-data.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js new file mode 100644 index 000000000..b626904e8 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chrome.js @@ -0,0 +1,128 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import path from 'path'; +import { httpRequest } from '../httpUtil.js'; +import { BrowserPlatform, ChromeReleaseChannel } from './types.js'; +function folder(platform) { + switch (platform) { + case BrowserPlatform.LINUX: + return 'linux64'; + case BrowserPlatform.MAC_ARM: + return 'mac-arm64'; + case BrowserPlatform.MAC: + return 'mac-x64'; + case BrowserPlatform.WIN32: + return 'win32'; + case BrowserPlatform.WIN64: + return 'win64'; + } +} +function chromiumDashPlatform(platform) { + switch (platform) { + case BrowserPlatform.LINUX: + return 'linux'; + case BrowserPlatform.MAC_ARM: + return 'mac'; + case BrowserPlatform.MAC: + return 'mac'; + case BrowserPlatform.WIN32: + return 'win'; + case BrowserPlatform.WIN64: + return 'win64'; + } +} +export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://edgedl.me.gvt1.com/edgedl/chrome/chrome-for-testing') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +export function resolveDownloadPath(platform, buildId) { + return [buildId, folder(platform), `chrome-${folder(platform)}.zip`]; +} +export function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case BrowserPlatform.MAC: + case BrowserPlatform.MAC_ARM: + return path.join('chrome-' + folder(platform), 'Google Chrome for Testing.app', 'Contents', 'MacOS', 'Google Chrome for Testing'); + case BrowserPlatform.LINUX: + return path.join('chrome-linux64', 'chrome'); + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return path.join('chrome-' + folder(platform), 'chrome.exe'); + } +} +export async function resolveBuildId(platform, channel = 'beta') { + return new Promise((resolve, reject) => { + const request = httpRequest(new URL(`https://chromiumdash.appspot.com/fetch_releases?platform=${chromiumDashPlatform(platform)}&channel=${channel}`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + const response = JSON.parse(String(data)); + return resolve(response[0].version); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +export function resolveSystemExecutablePath(platform, channel) { + switch (platform) { + case BrowserPlatform.WIN64: + case BrowserPlatform.WIN32: + switch (channel) { + case ChromeReleaseChannel.STABLE: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome\\Application\\chrome.exe`; + case ChromeReleaseChannel.BETA: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome Beta\\Application\\chrome.exe`; + case ChromeReleaseChannel.CANARY: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome SxS\\Application\\chrome.exe`; + case ChromeReleaseChannel.DEV: + return `${process.env['PROGRAMFILES']}\\Google\\Chrome Dev\\Application\\chrome.exe`; + } + case BrowserPlatform.MAC_ARM: + case BrowserPlatform.MAC: + switch (channel) { + case ChromeReleaseChannel.STABLE: + return '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'; + case ChromeReleaseChannel.BETA: + return '/Applications/Google Chrome Beta.app/Contents/MacOS/Google Chrome Beta'; + case ChromeReleaseChannel.CANARY: + return '/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary'; + case ChromeReleaseChannel.DEV: + return '/Applications/Google Chrome Dev.app/Contents/MacOS/Google Chrome Dev'; + } + case BrowserPlatform.LINUX: + switch (channel) { + case ChromeReleaseChannel.STABLE: + return '/opt/google/chrome/chrome'; + case ChromeReleaseChannel.BETA: + return '/opt/google/chrome-beta/chrome'; + case ChromeReleaseChannel.DEV: + return '/opt/google/chrome-unstable/chrome'; + } + } + throw new Error(`Unable to detect browser executable path for '${channel}' on ${platform}.`); +} +//# sourceMappingURL=chrome.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromedriver.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromedriver.js new file mode 100644 index 000000000..048b830d1 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromedriver.js @@ -0,0 +1,72 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { httpRequest } from '../httpUtil.js'; +import { BrowserPlatform } from './types.js'; +function archive(platform) { + switch (platform) { + case BrowserPlatform.LINUX: + return 'chromedriver_linux64'; + case BrowserPlatform.MAC_ARM: + return 'chromedriver_mac_arm64'; + case BrowserPlatform.MAC: + return 'chromedriver_mac64'; + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return 'chromedriver_win32'; + } +} +export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://chromedriver.storage.googleapis.com') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +export function resolveDownloadPath(platform, buildId) { + return [buildId, `${archive(platform)}.zip`]; +} +export function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case BrowserPlatform.MAC: + case BrowserPlatform.MAC_ARM: + case BrowserPlatform.LINUX: + return 'chromedriver'; + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return 'chromedriver.exe'; + } +} +export async function resolveBuildId(_channel = 'latest') { + return new Promise((resolve, reject) => { + const request = httpRequest(new URL(`https://chromedriver.storage.googleapis.com/LATEST_RELEASE`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + return resolve(String(data)); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +//# sourceMappingURL=chromedriver.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromium.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromium.js new file mode 100644 index 000000000..3ffdd36f3 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/chromium.js @@ -0,0 +1,91 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import path from 'path'; +import { httpRequest } from '../httpUtil.js'; +import { BrowserPlatform } from './types.js'; +export { resolveSystemExecutablePath } from './chrome.js'; +function archive(platform, buildId) { + switch (platform) { + case BrowserPlatform.LINUX: + return 'chrome-linux'; + case BrowserPlatform.MAC_ARM: + case BrowserPlatform.MAC: + return 'chrome-mac'; + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + // Windows archive name changed at r591479. + return parseInt(buildId, 10) > 591479 ? 'chrome-win' : 'chrome-win32'; + } +} +function folder(platform) { + switch (platform) { + case BrowserPlatform.LINUX: + return 'Linux_x64'; + case BrowserPlatform.MAC_ARM: + return 'Mac_Arm'; + case BrowserPlatform.MAC: + return 'Mac'; + case BrowserPlatform.WIN32: + return 'Win'; + case BrowserPlatform.WIN64: + return 'Win_x64'; + } +} +export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://storage.googleapis.com/chromium-browser-snapshots') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +export function resolveDownloadPath(platform, buildId) { + return [folder(platform), buildId, `${archive(platform, buildId)}.zip`]; +} +export function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case BrowserPlatform.MAC: + case BrowserPlatform.MAC_ARM: + return path.join('chrome-mac', 'Chromium.app', 'Contents', 'MacOS', 'Chromium'); + case BrowserPlatform.LINUX: + return path.join('chrome-linux', 'chrome'); + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return path.join('chrome-win', 'chrome.exe'); + } +} +export async function resolveBuildId(platform, +// We will need it for other channels/keywords. +_channel = 'latest') { + return new Promise((resolve, reject) => { + const request = httpRequest(new URL(`https://storage.googleapis.com/chromium-browser-snapshots/${folder(platform)}/LAST_CHANGE`), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + return resolve(String(data)); + } + catch { + return reject(new Error('Chrome version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +//# sourceMappingURL=chromium.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/firefox.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/firefox.js new file mode 100644 index 000000000..3c9dab7d0 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/firefox.js @@ -0,0 +1,274 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import fs from 'fs'; +import path from 'path'; +import { httpRequest } from '../httpUtil.js'; +import { BrowserPlatform } from './types.js'; +function archive(platform, buildId) { + switch (platform) { + case BrowserPlatform.LINUX: + return `firefox-${buildId}.en-US.${platform}-x86_64.tar.bz2`; + case BrowserPlatform.MAC_ARM: + case BrowserPlatform.MAC: + return `firefox-${buildId}.en-US.mac.dmg`; + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return `firefox-${buildId}.en-US.${platform}.zip`; + } +} +export function resolveDownloadUrl(platform, buildId, baseUrl = 'https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central') { + return `${baseUrl}/${resolveDownloadPath(platform, buildId).join('/')}`; +} +export function resolveDownloadPath(platform, buildId) { + return [archive(platform, buildId)]; +} +export function relativeExecutablePath(platform, _buildId) { + switch (platform) { + case BrowserPlatform.MAC_ARM: + case BrowserPlatform.MAC: + return path.join('Firefox Nightly.app', 'Contents', 'MacOS', 'firefox'); + case BrowserPlatform.LINUX: + return path.join('firefox', 'firefox'); + case BrowserPlatform.WIN32: + case BrowserPlatform.WIN64: + return path.join('firefox', 'firefox.exe'); + } +} +export async function resolveBuildId(channel = 'FIREFOX_NIGHTLY') { + return new Promise((resolve, reject) => { + const request = httpRequest(new URL('https://product-details.mozilla.org/1.0/firefox_versions.json'), 'GET', response => { + let data = ''; + if (response.statusCode && response.statusCode >= 400) { + return reject(new Error(`Got status code ${response.statusCode}`)); + } + response.on('data', chunk => { + data += chunk; + }); + response.on('end', () => { + try { + const versions = JSON.parse(data); + return resolve(versions[channel]); + } + catch { + return reject(new Error('Firefox version not found')); + } + }); + }, false); + request.on('error', err => { + reject(err); + }); + }); +} +export async function createProfile(options) { + if (!fs.existsSync(options.path)) { + await fs.promises.mkdir(options.path, { + recursive: true, + }); + } + await writePreferences({ + preferences: { + ...defaultProfilePreferences(options.preferences), + ...options.preferences, + }, + path: options.path, + }); +} +function defaultProfilePreferences(extraPrefs) { + const server = 'dummy.test'; + const defaultPrefs = { + // Make sure Shield doesn't hit the network. + 'app.normandy.api_url': '', + // Disable Firefox old build background check + 'app.update.checkInstallTime': false, + // Disable automatically upgrading Firefox + 'app.update.disabledForTesting': true, + // Increase the APZ content response timeout to 1 minute + 'apz.content_response_timeout': 60000, + // Prevent various error message on the console + // jest-puppeteer asserts that no error message is emitted by the console + 'browser.contentblocking.features.standard': '-tp,tpPrivate,cookieBehavior0,-cm,-fp', + // Enable the dump function: which sends messages to the system + // console + // https://bugzilla.mozilla.org/show_bug.cgi?id=1543115 + 'browser.dom.window.dump.enabled': true, + // Disable topstories + 'browser.newtabpage.activity-stream.feeds.system.topstories': false, + // Always display a blank page + 'browser.newtabpage.enabled': false, + // Background thumbnails in particular cause grief: and disabling + // thumbnails in general cannot hurt + 'browser.pagethumbnails.capturing_disabled': true, + // Disable safebrowsing components. + 'browser.safebrowsing.blockedURIs.enabled': false, + 'browser.safebrowsing.downloads.enabled': false, + 'browser.safebrowsing.malware.enabled': false, + 'browser.safebrowsing.passwords.enabled': false, + 'browser.safebrowsing.phishing.enabled': false, + // Disable updates to search engines. + 'browser.search.update': false, + // Do not restore the last open set of tabs if the browser has crashed + 'browser.sessionstore.resume_from_crash': false, + // Skip check for default browser on startup + 'browser.shell.checkDefaultBrowser': false, + // Disable newtabpage + 'browser.startup.homepage': 'about:blank', + // Do not redirect user when a milstone upgrade of Firefox is detected + 'browser.startup.homepage_override.mstone': 'ignore', + // Start with a blank page about:blank + 'browser.startup.page': 0, + // Do not allow background tabs to be zombified on Android: otherwise for + // tests that open additional tabs: the test harness tab itself might get + // unloaded + 'browser.tabs.disableBackgroundZombification': false, + // Do not warn when closing all other open tabs + 'browser.tabs.warnOnCloseOtherTabs': false, + // Do not warn when multiple tabs will be opened + 'browser.tabs.warnOnOpen': false, + // Disable the UI tour. + 'browser.uitour.enabled': false, + // Turn off search suggestions in the location bar so as not to trigger + // network connections. + 'browser.urlbar.suggest.searches': false, + // Disable first run splash page on Windows 10 + 'browser.usedOnWindows10.introURL': '', + // Do not warn on quitting Firefox + 'browser.warnOnQuit': false, + // Defensively disable data reporting systems + 'datareporting.healthreport.documentServerURI': `http://${server}/dummy/healthreport/`, + 'datareporting.healthreport.logging.consoleEnabled': false, + 'datareporting.healthreport.service.enabled': false, + 'datareporting.healthreport.service.firstRun': false, + 'datareporting.healthreport.uploadEnabled': false, + // Do not show datareporting policy notifications which can interfere with tests + 'datareporting.policy.dataSubmissionEnabled': false, + 'datareporting.policy.dataSubmissionPolicyBypassNotification': true, + // DevTools JSONViewer sometimes fails to load dependencies with its require.js. + // This doesn't affect Puppeteer but spams console (Bug 1424372) + 'devtools.jsonview.enabled': false, + // Disable popup-blocker + 'dom.disable_open_during_load': false, + // Enable the support for File object creation in the content process + // Required for |Page.setFileInputFiles| protocol method. + 'dom.file.createInChild': true, + // Disable the ProcessHangMonitor + 'dom.ipc.reportProcessHangs': false, + // Disable slow script dialogues + 'dom.max_chrome_script_run_time': 0, + 'dom.max_script_run_time': 0, + // Only load extensions from the application and user profile + // AddonManager.SCOPE_PROFILE + AddonManager.SCOPE_APPLICATION + 'extensions.autoDisableScopes': 0, + 'extensions.enabledScopes': 5, + // Disable metadata caching for installed add-ons by default + 'extensions.getAddons.cache.enabled': false, + // Disable installing any distribution extensions or add-ons. + 'extensions.installDistroAddons': false, + // Disabled screenshots extension + 'extensions.screenshots.disabled': true, + // Turn off extension updates so they do not bother tests + 'extensions.update.enabled': false, + // Turn off extension updates so they do not bother tests + 'extensions.update.notifyUser': false, + // Make sure opening about:addons will not hit the network + 'extensions.webservice.discoverURL': `http://${server}/dummy/discoveryURL`, + // Temporarily force disable BFCache in parent (https://bit.ly/bug-1732263) + 'fission.bfcacheInParent': false, + // Force all web content to use a single content process + 'fission.webContentIsolationStrategy': 0, + // Allow the application to have focus even it runs in the background + 'focusmanager.testmode': true, + // Disable useragent updates + 'general.useragent.updates.enabled': false, + // Always use network provider for geolocation tests so we bypass the + // macOS dialog raised by the corelocation provider + 'geo.provider.testing': true, + // Do not scan Wifi + 'geo.wifi.scan': false, + // No hang monitor + 'hangmonitor.timeout': 0, + // Show chrome errors and warnings in the error console + 'javascript.options.showInConsole': true, + // Disable download and usage of OpenH264: and Widevine plugins + 'media.gmp-manager.updateEnabled': false, + // Prevent various error message on the console + // jest-puppeteer asserts that no error message is emitted by the console + 'network.cookie.cookieBehavior': 0, + // Disable experimental feature that is only available in Nightly + 'network.cookie.sameSite.laxByDefault': false, + // Do not prompt for temporary redirects + 'network.http.prompt-temp-redirect': false, + // Disable speculative connections so they are not reported as leaking + // when they are hanging around + 'network.http.speculative-parallel-limit': 0, + // Do not automatically switch between offline and online + 'network.manage-offline-status': false, + // Make sure SNTP requests do not hit the network + 'network.sntp.pools': server, + // Disable Flash. + 'plugin.state.flash': 0, + 'privacy.trackingprotection.enabled': false, + // Can be removed once Firefox 89 is no longer supported + // https://bugzilla.mozilla.org/show_bug.cgi?id=1710839 + 'remote.enabled': true, + // Don't do network connections for mitm priming + 'security.certerrors.mitm.priming.enabled': false, + // Local documents have access to all other local documents, + // including directory listings + 'security.fileuri.strict_origin_policy': false, + // Do not wait for the notification button security delay + 'security.notification_enable_delay': 0, + // Ensure blocklist updates do not hit the network + 'services.settings.server': `http://${server}/dummy/blocklist/`, + // Do not automatically fill sign-in forms with known usernames and + // passwords + 'signon.autofillForms': false, + // Disable password capture, so that tests that include forms are not + // influenced by the presence of the persistent doorhanger notification + 'signon.rememberSignons': false, + // Disable first-run welcome page + 'startup.homepage_welcome_url': 'about:blank', + // Disable first-run welcome page + 'startup.homepage_welcome_url.additional': '', + // Disable browser animations (tabs, fullscreen, sliding alerts) + 'toolkit.cosmeticAnimations.enabled': false, + // Prevent starting into safe mode after application crashes + 'toolkit.startup.max_resumed_crashes': -1, + }; + return Object.assign(defaultPrefs, extraPrefs); +} +/** + * Populates the user.js file with custom preferences as needed to allow + * Firefox's CDP support to properly function. These preferences will be + * automatically copied over to prefs.js during startup of Firefox. To be + * able to restore the original values of preferences a backup of prefs.js + * will be created. + * + * @param prefs - List of preferences to add. + * @param profilePath - Firefox profile to write the preferences to. + */ +async function writePreferences(options) { + const lines = Object.entries(options.preferences).map(([key, value]) => { + return `user_pref(${JSON.stringify(key)}, ${JSON.stringify(value)});`; + }); + await fs.promises.writeFile(path.join(options.path, 'user.js'), lines.join('\n')); + // Create a backup of the preferences file if it already exitsts. + const prefsPath = path.join(options.path, 'prefs.js'); + if (fs.existsSync(prefsPath)) { + const prefsBackupPath = path.join(options.path, 'prefs.js.puppeteer'); + await fs.promises.copyFile(prefsPath, prefsBackupPath); + } +} +//# sourceMappingURL=firefox.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/browser-data/types.js b/node_modules/@puppeteer/browsers/lib/esm/browser-data/types.js new file mode 100644 index 000000000..1e0c2f1e9 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/browser-data/types.js @@ -0,0 +1,66 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import * as chrome from './chrome.js'; +import * as firefox from './firefox.js'; +/** + * Supported browsers. + * + * @public + */ +export var Browser; +(function (Browser) { + Browser["CHROME"] = "chrome"; + Browser["CHROMIUM"] = "chromium"; + Browser["FIREFOX"] = "firefox"; + Browser["CHROMEDRIVER"] = "chromedriver"; +})(Browser || (Browser = {})); +/** + * Platform names used to identify a OS platfrom x architecture combination in the way + * that is relevant for the browser download. + * + * @public + */ +export var BrowserPlatform; +(function (BrowserPlatform) { + BrowserPlatform["LINUX"] = "linux"; + BrowserPlatform["MAC"] = "mac"; + BrowserPlatform["MAC_ARM"] = "mac_arm"; + BrowserPlatform["WIN32"] = "win32"; + BrowserPlatform["WIN64"] = "win64"; +})(BrowserPlatform || (BrowserPlatform = {})); +export const downloadUrls = { + [Browser.CHROME]: chrome.resolveDownloadUrl, + [Browser.CHROMIUM]: chrome.resolveDownloadUrl, + [Browser.FIREFOX]: firefox.resolveDownloadUrl, +}; +/** + * @public + */ +export var BrowserTag; +(function (BrowserTag) { + BrowserTag["LATEST"] = "latest"; +})(BrowserTag || (BrowserTag = {})); +/** + * @public + */ +export var ChromeReleaseChannel; +(function (ChromeReleaseChannel) { + ChromeReleaseChannel["STABLE"] = "stable"; + ChromeReleaseChannel["DEV"] = "dev"; + ChromeReleaseChannel["CANARY"] = "canary"; + ChromeReleaseChannel["BETA"] = "beta"; +})(ChromeReleaseChannel || (ChromeReleaseChannel = {})); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/node_modules/puppeteer-core/lib/esm/puppeteer/web.js b/node_modules/@puppeteer/browsers/lib/esm/debug.js similarity index 63% rename from node_modules/puppeteer-core/lib/esm/puppeteer/web.js rename to node_modules/@puppeteer/browsers/lib/esm/debug.js index f1be494ef..9d430f4f0 100644 --- a/node_modules/puppeteer-core/lib/esm/puppeteer/web.js +++ b/node_modules/@puppeteer/browsers/lib/esm/debug.js @@ -1,5 +1,5 @@ /** - * Copyright 2020 Google Inc. All rights reserved. + * Copyright 2023 Google Inc. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,10 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { initializePuppeteerWeb } from './initialize-web.js'; -import { isNode } from './environment.js'; -if (isNode) { - throw new Error('Trying to run Puppeteer-Web in a Node environment'); -} -export default initializePuppeteerWeb('puppeteer'); -//# sourceMappingURL=web.js.map \ No newline at end of file +import debug from 'debug'; +export { debug }; +//# sourceMappingURL=debug.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/detectPlatform.js b/node_modules/@puppeteer/browsers/lib/esm/detectPlatform.js new file mode 100644 index 000000000..7dc7cea7b --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/detectPlatform.js @@ -0,0 +1,56 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import os from 'os'; +import { BrowserPlatform } from './browser-data/browser-data.js'; +/** + * @public + */ +export function detectBrowserPlatform() { + const platform = os.platform(); + switch (platform) { + case 'darwin': + return os.arch() === 'arm64' + ? BrowserPlatform.MAC_ARM + : BrowserPlatform.MAC; + case 'linux': + return BrowserPlatform.LINUX; + case 'win32': + return os.arch() === 'x64' || + // Windows 11 for ARM supports x64 emulation + (os.arch() === 'arm64' && isWindows11(os.release())) + ? BrowserPlatform.WIN64 + : BrowserPlatform.WIN32; + default: + return undefined; + } +} +/** + * Windows 11 is identified by the version 10.0.22000 or greater + * @internal + */ +function isWindows11(version) { + const parts = version.split('.'); + if (parts.length > 2) { + const major = parseInt(parts[0], 10); + const minor = parseInt(parts[1], 10); + const patch = parseInt(parts[2], 10); + return (major > 10 || + (major === 10 && minor > 0) || + (major === 10 && minor === 0 && patch >= 22000)); + } + return false; +} +//# sourceMappingURL=detectPlatform.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js b/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js new file mode 100644 index 000000000..ad178f895 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/fileUtil.js @@ -0,0 +1,80 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { exec as execChildProcess } from 'child_process'; +import { createReadStream } from 'fs'; +import { mkdir, readdir } from 'fs/promises'; +import * as path from 'path'; +import { promisify } from 'util'; +import extractZip from 'extract-zip'; +import tar from 'tar-fs'; +import bzip from 'unbzip2-stream'; +const exec = promisify(execChildProcess); +/** + * @internal + */ +export async function unpackArchive(archivePath, folderPath) { + if (archivePath.endsWith('.zip')) { + await extractZip(archivePath, { dir: folderPath }); + } + else if (archivePath.endsWith('.tar.bz2')) { + await extractTar(archivePath, folderPath); + } + else if (archivePath.endsWith('.dmg')) { + await mkdir(folderPath); + await installDMG(archivePath, folderPath); + } + else { + throw new Error(`Unsupported archive format: ${archivePath}`); + } +} +/** + * @internal + */ +function extractTar(tarPath, folderPath) { + return new Promise((fulfill, reject) => { + const tarStream = tar.extract(folderPath); + tarStream.on('error', reject); + tarStream.on('finish', fulfill); + const readStream = createReadStream(tarPath); + readStream.pipe(bzip()).pipe(tarStream); + }); +} +/** + * @internal + */ +async function installDMG(dmgPath, folderPath) { + const { stdout } = await exec(`hdiutil attach -nobrowse -noautoopen "${dmgPath}"`); + const volumes = stdout.match(/\/Volumes\/(.*)/m); + if (!volumes) { + throw new Error(`Could not find volume path in ${stdout}`); + } + const mountPath = volumes[0]; + try { + const fileNames = await readdir(mountPath); + const appName = fileNames.find(item => { + return typeof item === 'string' && item.endsWith('.app'); + }); + if (!appName) { + throw new Error(`Cannot find app in ${mountPath}`); + } + const mountedPath = path.join(mountPath, appName); + await exec(`cp -R "${mountedPath}" "${folderPath}"`); + } + finally { + await exec(`hdiutil detach "${mountPath}" -quiet`); + } +} +//# sourceMappingURL=fileUtil.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/httpUtil.js b/node_modules/@puppeteer/browsers/lib/esm/httpUtil.js new file mode 100644 index 000000000..8603b4113 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/httpUtil.js @@ -0,0 +1,114 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { createWriteStream } from 'fs'; +import * as http from 'http'; +import * as https from 'https'; +import { URL } from 'url'; +import createHttpsProxyAgent from 'https-proxy-agent'; +import { getProxyForUrl } from 'proxy-from-env'; +export function headHttpRequest(url) { + return new Promise(resolve => { + const request = httpRequest(url, 'HEAD', response => { + resolve(response.statusCode === 200); + }, false); + request.on('error', () => { + resolve(false); + }); + }); +} +export function httpRequest(url, method, response, keepAlive = true) { + const options = { + protocol: url.protocol, + hostname: url.hostname, + port: url.port, + path: url.pathname + url.search, + method, + headers: keepAlive ? { Connection: 'keep-alive' } : undefined, + }; + const proxyURL = getProxyForUrl(url.toString()); + if (proxyURL) { + const proxy = new URL(proxyURL); + if (proxy.protocol === 'http:') { + options.path = url.href; + options.hostname = proxy.hostname; + options.protocol = proxy.protocol; + options.port = proxy.port; + } + else { + options.agent = createHttpsProxyAgent({ + host: proxy.host, + path: proxy.pathname, + port: proxy.port, + secureProxy: proxy.protocol === 'https:', + headers: options.headers, + }); + } + } + const requestCallback = (res) => { + if (res.statusCode && + res.statusCode >= 300 && + res.statusCode < 400 && + res.headers.location) { + httpRequest(new URL(res.headers.location), method, response); + } + else { + response(res); + } + }; + const request = options.protocol === 'https:' + ? https.request(options, requestCallback) + : http.request(options, requestCallback); + request.end(); + return request; +} +/** + * @internal + */ +export function downloadFile(url, destinationPath, progressCallback) { + return new Promise((resolve, reject) => { + let downloadedBytes = 0; + let totalBytes = 0; + function onData(chunk) { + downloadedBytes += chunk.length; + progressCallback(downloadedBytes, totalBytes); + } + const request = httpRequest(url, 'GET', response => { + if (response.statusCode !== 200) { + const error = new Error(`Download failed: server returned code ${response.statusCode}. URL: ${url}`); + // consume response data to free up memory + response.resume(); + reject(error); + return; + } + const file = createWriteStream(destinationPath); + file.on('finish', () => { + return resolve(); + }); + file.on('error', error => { + return reject(error); + }); + response.pipe(file); + totalBytes = parseInt(response.headers['content-length'], 10); + if (progressCallback) { + response.on('data', onData); + } + }); + request.on('error', error => { + return reject(error); + }); + }); +} +//# sourceMappingURL=httpUtil.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/install.js b/node_modules/@puppeteer/browsers/lib/esm/install.js new file mode 100644 index 000000000..92269962e --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/install.js @@ -0,0 +1,133 @@ +/** + * Copyright 2017 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import assert from 'assert'; +import { existsSync } from 'fs'; +import { mkdir, unlink } from 'fs/promises'; +import os from 'os'; +import path from 'path'; +import { downloadUrls, } from './browser-data/browser-data.js'; +import { Cache } from './Cache.js'; +import { debug } from './debug.js'; +import { detectBrowserPlatform } from './detectPlatform.js'; +import { unpackArchive } from './fileUtil.js'; +import { downloadFile, headHttpRequest } from './httpUtil.js'; +const debugInstall = debug('puppeteer:browsers:install'); +const times = new Map(); +function debugTime(label) { + times.set(label, process.hrtime()); +} +function debugTimeEnd(label) { + const end = process.hrtime(); + const start = times.get(label); + if (!start) { + return; + } + const duration = end[0] * 1000 + end[1] / 1e6 - (start[0] * 1000 + start[1] / 1e6); // calculate duration in milliseconds + debugInstall(`Duration for ${label}: ${duration}ms`); +} +/** + * @public + */ +export async function install(options) { + var _a, _b; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); + (_b = options.unpack) !== null && _b !== void 0 ? _b : (options.unpack = true); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); + } + const url = getDownloadUrl(options.browser, options.platform, options.buildId, options.baseUrl); + const fileName = url.toString().split('/').pop(); + assert(fileName, `A malformed download URL was found: ${url}.`); + const structure = new Cache(options.cacheDir); + const browserRoot = structure.browserRoot(options.browser); + const archivePath = path.join(browserRoot, fileName); + if (!existsSync(browserRoot)) { + await mkdir(browserRoot, { recursive: true }); + } + if (!options.unpack) { + if (existsSync(archivePath)) { + return { + path: archivePath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + debugInstall(`Downloading binary from ${url}`); + debugTime('download'); + await downloadFile(url, archivePath, options.downloadProgressCallback); + debugTimeEnd('download'); + return { + path: archivePath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + const outputPath = structure.installationDir(options.browser, options.platform, options.buildId); + if (existsSync(outputPath)) { + return { + path: outputPath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; + } + try { + debugInstall(`Downloading binary from ${url}`); + try { + debugTime('download'); + await downloadFile(url, archivePath, options.downloadProgressCallback); + } + finally { + debugTimeEnd('download'); + } + debugInstall(`Installing ${archivePath} to ${outputPath}`); + try { + debugTime('extract'); + await unpackArchive(archivePath, outputPath); + } + finally { + debugTimeEnd('extract'); + } + } + finally { + if (existsSync(archivePath)) { + await unlink(archivePath); + } + } + return { + path: outputPath, + browser: options.browser, + platform: options.platform, + buildId: options.buildId, + }; +} +/** + * @public + */ +export async function canDownload(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); + } + return await headHttpRequest(getDownloadUrl(options.browser, options.platform, options.buildId, options.baseUrl)); +} +function getDownloadUrl(browser, platform, buildId, baseUrl) { + return new URL(downloadUrls[browser](platform, buildId, baseUrl)); +} +//# sourceMappingURL=install.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/launch.js b/node_modules/@puppeteer/browsers/lib/esm/launch.js new file mode 100644 index 000000000..2fce1775b --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/launch.js @@ -0,0 +1,353 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Process_instances, _Process_executablePath, _Process_args, _Process_browserProcess, _Process_exited, _Process_hooksRan, _Process_onExitHook, _Process_browserProcessExiting, _Process_runHooks, _Process_configureStdio, _Process_clearListeners, _Process_onDriverProcessExit, _Process_onDriverProcessSignal; +import childProcess from 'child_process'; +import { accessSync } from 'fs'; +import os from 'os'; +import path from 'path'; +import readline from 'readline'; +import { executablePathByBrowser, resolveSystemExecutablePath, } from './browser-data/browser-data.js'; +import { Cache } from './Cache.js'; +import { debug } from './debug.js'; +import { detectBrowserPlatform } from './detectPlatform.js'; +const debugLaunch = debug('puppeteer:browsers:launcher'); +/** + * @public + */ +export function computeExecutablePath(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); + } + const installationDir = new Cache(options.cacheDir).installationDir(options.browser, options.platform, options.buildId); + return path.join(installationDir, executablePathByBrowser[options.browser](options.platform, options.buildId)); +} +/** + * @public + */ +export function computeSystemExecutablePath(options) { + var _a; + (_a = options.platform) !== null && _a !== void 0 ? _a : (options.platform = detectBrowserPlatform()); + if (!options.platform) { + throw new Error(`Cannot download a binary for the provided platform: ${os.platform()} (${os.arch()})`); + } + const path = resolveSystemExecutablePath(options.browser, options.platform, options.channel); + try { + accessSync(path); + } + catch (error) { + throw new Error(`Could not find Google Chrome executable for channel '${options.channel}' at '${path}'.`); + } + return path; +} +/** + * @public + */ +export function launch(opts) { + return new Process(opts); +} +/** + * @public + */ +export const CDP_WEBSOCKET_ENDPOINT_REGEX = /^DevTools listening on (ws:\/\/.*)$/; +/** + * @public + */ +export const WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX = /^WebDriver BiDi listening on (ws:\/\/.*)$/; +/** + * @public + */ +export class Process { + constructor(opts) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j; + _Process_instances.add(this); + _Process_executablePath.set(this, void 0); + _Process_args.set(this, void 0); + _Process_browserProcess.set(this, void 0); + _Process_exited.set(this, false); + // The browser process can be closed externally or from the driver process. We + // need to invoke the hooks only once though but we don't know how many times + // we will be invoked. + _Process_hooksRan.set(this, false); + _Process_onExitHook.set(this, async () => { }); + _Process_browserProcessExiting.set(this, void 0); + _Process_onDriverProcessExit.set(this, (_code) => { + this.kill(); + }); + _Process_onDriverProcessSignal.set(this, (signal) => { + switch (signal) { + case 'SIGINT': + this.kill(); + process.exit(130); + case 'SIGTERM': + case 'SIGHUP': + this.close(); + break; + } + }); + __classPrivateFieldSet(this, _Process_executablePath, opts.executablePath, "f"); + __classPrivateFieldSet(this, _Process_args, (_a = opts.args) !== null && _a !== void 0 ? _a : [], "f"); + (_b = opts.pipe) !== null && _b !== void 0 ? _b : (opts.pipe = false); + (_c = opts.dumpio) !== null && _c !== void 0 ? _c : (opts.dumpio = false); + (_d = opts.handleSIGINT) !== null && _d !== void 0 ? _d : (opts.handleSIGINT = true); + (_e = opts.handleSIGTERM) !== null && _e !== void 0 ? _e : (opts.handleSIGTERM = true); + (_f = opts.handleSIGHUP) !== null && _f !== void 0 ? _f : (opts.handleSIGHUP = true); + // On non-windows platforms, `detached: true` makes child process a + // leader of a new process group, making it possible to kill child + // process tree with `.kill(-pid)` command. @see + // https://nodejs.org/api/child_process.html#child_process_options_detached + (_g = opts.detached) !== null && _g !== void 0 ? _g : (opts.detached = process.platform !== 'win32'); + const stdio = __classPrivateFieldGet(this, _Process_instances, "m", _Process_configureStdio).call(this, { + pipe: opts.pipe, + dumpio: opts.dumpio, + }); + debugLaunch(`Launching ${__classPrivateFieldGet(this, _Process_executablePath, "f")} ${__classPrivateFieldGet(this, _Process_args, "f").join(' ')}`, { + detached: opts.detached, + env: opts.env, + stdio, + }); + __classPrivateFieldSet(this, _Process_browserProcess, childProcess.spawn(__classPrivateFieldGet(this, _Process_executablePath, "f"), __classPrivateFieldGet(this, _Process_args, "f"), { + detached: opts.detached, + env: opts.env, + stdio, + }), "f"); + debugLaunch(`Launched ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid}`); + if (opts.dumpio) { + (_h = __classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) === null || _h === void 0 ? void 0 : _h.pipe(process.stderr); + (_j = __classPrivateFieldGet(this, _Process_browserProcess, "f").stdout) === null || _j === void 0 ? void 0 : _j.pipe(process.stdout); + } + process.on('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); + if (opts.handleSIGINT) { + process.on('SIGINT', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.handleSIGTERM) { + process.on('SIGTERM', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.handleSIGHUP) { + process.on('SIGHUP', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + } + if (opts.onExit) { + __classPrivateFieldSet(this, _Process_onExitHook, opts.onExit, "f"); + } + __classPrivateFieldSet(this, _Process_browserProcessExiting, new Promise((resolve, reject) => { + __classPrivateFieldGet(this, _Process_browserProcess, "f").once('exit', async () => { + debugLaunch(`Browser process ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} onExit`); + __classPrivateFieldGet(this, _Process_instances, "m", _Process_clearListeners).call(this); + __classPrivateFieldSet(this, _Process_exited, true, "f"); + try { + await __classPrivateFieldGet(this, _Process_instances, "m", _Process_runHooks).call(this); + } + catch (err) { + reject(err); + return; + } + resolve(); + }); + }), "f"); + } + get nodeProcess() { + return __classPrivateFieldGet(this, _Process_browserProcess, "f"); + } + async close() { + await __classPrivateFieldGet(this, _Process_instances, "m", _Process_runHooks).call(this); + if (!__classPrivateFieldGet(this, _Process_exited, "f")) { + this.kill(); + } + return __classPrivateFieldGet(this, _Process_browserProcessExiting, "f"); + } + hasClosed() { + return __classPrivateFieldGet(this, _Process_browserProcessExiting, "f"); + } + kill() { + debugLaunch(`Trying to kill ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid}`); + // If the process failed to launch (for example if the browser executable path + // is invalid), then the process does not get a pid assigned. A call to + // `proc.kill` would error, as the `pid` to-be-killed can not be found. + if (__classPrivateFieldGet(this, _Process_browserProcess, "f") && + __classPrivateFieldGet(this, _Process_browserProcess, "f").pid && + pidExists(__classPrivateFieldGet(this, _Process_browserProcess, "f").pid)) { + try { + debugLaunch(`Browser process ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} exists`); + if (process.platform === 'win32') { + try { + childProcess.execSync(`taskkill /pid ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} /T /F`); + } + catch (error) { + debugLaunch(`Killing ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} using taskkill failed`, error); + // taskkill can fail to kill the process e.g. due to missing permissions. + // Let's kill the process via Node API. This delays killing of all child + // processes of `this.proc` until the main Node.js process dies. + __classPrivateFieldGet(this, _Process_browserProcess, "f").kill(); + } + } + else { + // on linux the process group can be killed with the group id prefixed with + // a minus sign. The process group id is the group leader's pid. + const processGroupId = -__classPrivateFieldGet(this, _Process_browserProcess, "f").pid; + try { + process.kill(processGroupId, 'SIGKILL'); + } + catch (error) { + debugLaunch(`Killing ${__classPrivateFieldGet(this, _Process_browserProcess, "f").pid} using process.kill failed`, error); + // Killing the process group can fail due e.g. to missing permissions. + // Let's kill the process via Node API. This delays killing of all child + // processes of `this.proc` until the main Node.js process dies. + __classPrivateFieldGet(this, _Process_browserProcess, "f").kill('SIGKILL'); + } + } + } + catch (error) { + throw new Error(`${PROCESS_ERROR_EXPLANATION}\nError cause: ${isErrorLike(error) ? error.stack : error}`); + } + } + __classPrivateFieldGet(this, _Process_instances, "m", _Process_clearListeners).call(this); + } + waitForLineOutput(regex, timeout) { + if (!__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr) { + throw new Error('`browserProcess` does not have stderr.'); + } + const rl = readline.createInterface(__classPrivateFieldGet(this, _Process_browserProcess, "f").stderr); + let stderr = ''; + return new Promise((resolve, reject) => { + rl.on('line', onLine); + rl.on('close', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").on('exit', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").on('error', onClose); + const timeoutId = timeout ? setTimeout(onTimeout, timeout) : 0; + const cleanup = () => { + if (timeoutId) { + clearTimeout(timeoutId); + } + rl.off('line', onLine); + rl.off('close', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").off('exit', onClose); + __classPrivateFieldGet(this, _Process_browserProcess, "f").off('error', onClose); + }; + function onClose(error) { + cleanup(); + reject(new Error([ + `Failed to launch the browser process!${error ? ' ' + error.message : ''}`, + stderr, + '', + 'TROUBLESHOOTING: https://pptr.dev/troubleshooting', + '', + ].join('\n'))); + } + function onTimeout() { + cleanup(); + reject(new TimeoutError(`Timed out after ${timeout} ms while waiting for the WS endpoint URL to appear in stdout!`)); + } + function onLine(line) { + stderr += line + '\n'; + const match = line.match(regex); + if (!match) { + return; + } + cleanup(); + // The RegExp matches, so this will obviously exist. + resolve(match[1]); + } + }); + } +} +_Process_executablePath = new WeakMap(), _Process_args = new WeakMap(), _Process_browserProcess = new WeakMap(), _Process_exited = new WeakMap(), _Process_hooksRan = new WeakMap(), _Process_onExitHook = new WeakMap(), _Process_browserProcessExiting = new WeakMap(), _Process_onDriverProcessExit = new WeakMap(), _Process_onDriverProcessSignal = new WeakMap(), _Process_instances = new WeakSet(), _Process_runHooks = async function _Process_runHooks() { + if (__classPrivateFieldGet(this, _Process_hooksRan, "f")) { + return; + } + __classPrivateFieldSet(this, _Process_hooksRan, true, "f"); + await __classPrivateFieldGet(this, _Process_onExitHook, "f").call(this); +}, _Process_configureStdio = function _Process_configureStdio(opts) { + if (opts.pipe) { + if (opts.dumpio) { + return ['ignore', 'pipe', 'pipe', 'pipe', 'pipe']; + } + else { + return ['ignore', 'ignore', 'ignore', 'pipe', 'pipe']; + } + } + else { + if (opts.dumpio) { + return ['pipe', 'pipe', 'pipe']; + } + else { + return ['pipe', 'ignore', 'pipe']; + } + } +}, _Process_clearListeners = function _Process_clearListeners() { + process.off('exit', __classPrivateFieldGet(this, _Process_onDriverProcessExit, "f")); + process.off('SIGINT', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + process.off('SIGTERM', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); + process.off('SIGHUP', __classPrivateFieldGet(this, _Process_onDriverProcessSignal, "f")); +}; +const PROCESS_ERROR_EXPLANATION = `Puppeteer was unable to kill the process which ran the browser binary. +This means that, on future Puppeteer launches, Puppeteer might not be able to launch the browser. +Please check your open processes and ensure that the browser processes that Puppeteer launched have been killed. +If you think this is a bug, please report it on the Puppeteer issue tracker.`; +/** + * @internal + */ +function pidExists(pid) { + try { + return process.kill(pid, 0); + } + catch (error) { + if (isErrnoException(error)) { + if (error.code && error.code === 'ESRCH') { + return false; + } + } + throw error; + } +} +/** + * @internal + */ +export function isErrorLike(obj) { + return (typeof obj === 'object' && obj !== null && 'name' in obj && 'message' in obj); +} +/** + * @internal + */ +export function isErrnoException(obj) { + return (isErrorLike(obj) && + ('errno' in obj || 'code' in obj || 'path' in obj || 'syscall' in obj)); +} +/** + * @public + */ +export class TimeoutError extends Error { + /** + * @internal + */ + constructor(message) { + super(message); + this.name = this.constructor.name; + Error.captureStackTrace(this, this.constructor); + } +} +//# sourceMappingURL=launch.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/main-cli.js b/node_modules/@puppeteer/browsers/lib/esm/main-cli.js new file mode 100755 index 000000000..5effca97f --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/main-cli.js @@ -0,0 +1,19 @@ +#!/usr/bin/env node +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { CLI } from './CLI.js'; +new CLI().run(process.argv); +//# sourceMappingURL=main-cli.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/main.js b/node_modules/@puppeteer/browsers/lib/esm/main.js new file mode 100644 index 000000000..0f051d050 --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/main.js @@ -0,0 +1,22 @@ +/** + * Copyright 2023 Google Inc. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +export { launch, computeExecutablePath, computeSystemExecutablePath, TimeoutError, CDP_WEBSOCKET_ENDPOINT_REGEX, WEBDRIVER_BIDI_WEBSOCKET_ENDPOINT_REGEX, Process, } from './launch.js'; +export { install, canDownload } from './install.js'; +export { detectBrowserPlatform } from './detectPlatform.js'; +export { resolveBuildId, Browser, BrowserPlatform, ChromeReleaseChannel, createProfile, } from './browser-data/browser-data.js'; +export { CLI, makeProgressCallback } from './CLI.js'; +export { Cache } from './Cache.js'; +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/lib/esm/package.json b/node_modules/@puppeteer/browsers/lib/esm/package.json new file mode 100644 index 000000000..1632c2c4d --- /dev/null +++ b/node_modules/@puppeteer/browsers/lib/esm/package.json @@ -0,0 +1 @@ +{"type": "module"} \ No newline at end of file diff --git a/node_modules/@puppeteer/browsers/node_modules/debug/package.json b/node_modules/@puppeteer/browsers/node_modules/debug/package.json new file mode 100644 index 000000000..3bcdc242f --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/debug/package.json @@ -0,0 +1,59 @@ +{ + "name": "debug", + "version": "4.3.4", + "repository": { + "type": "git", + "url": "git://github.com/debug-js/debug.git" + }, + "description": "Lightweight debugging utility for Node.js and the browser", + "keywords": [ + "debug", + "log", + "debugger" + ], + "files": [ + "src", + "LICENSE", + "README.md" + ], + "author": "Josh Junon ", + "contributors": [ + "TJ Holowaychuk ", + "Nathan Rajlich (http://n8.io)", + "Andrew Rhyne " + ], + "license": "MIT", + "scripts": { + "lint": "xo", + "test": "npm run test:node && npm run test:browser && npm run lint", + "test:node": "istanbul cover _mocha -- test.js", + "test:browser": "karma start --single-run", + "test:coverage": "cat ./coverage/lcov.info | coveralls" + }, + "dependencies": { + "ms": "2.1.2" + }, + "devDependencies": { + "brfs": "^2.0.1", + "browserify": "^16.2.3", + "coveralls": "^3.0.2", + "istanbul": "^0.4.5", + "karma": "^3.1.4", + "karma-browserify": "^6.0.0", + "karma-chrome-launcher": "^2.2.0", + "karma-mocha": "^1.3.0", + "mocha": "^5.2.0", + "mocha-lcov-reporter": "^1.2.0", + "xo": "^0.23.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + }, + "main": "./src/index.js", + "browser": "./src/browser.js", + "engines": { + "node": ">=6.0" + } +} diff --git a/node_modules/@puppeteer/browsers/node_modules/debug/src/browser.js b/node_modules/@puppeteer/browsers/node_modules/debug/src/browser.js new file mode 100644 index 000000000..cd0fc35d1 --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/debug/src/browser.js @@ -0,0 +1,269 @@ +/* eslint-env browser */ + +/** + * This is the web browser implementation of `debug()`. + */ + +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.storage = localstorage(); +exports.destroy = (() => { + let warned = false; + + return () => { + if (!warned) { + warned = true; + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + }; +})(); + +/** + * Colors. + */ + +exports.colors = [ + '#0000CC', + '#0000FF', + '#0033CC', + '#0033FF', + '#0066CC', + '#0066FF', + '#0099CC', + '#0099FF', + '#00CC00', + '#00CC33', + '#00CC66', + '#00CC99', + '#00CCCC', + '#00CCFF', + '#3300CC', + '#3300FF', + '#3333CC', + '#3333FF', + '#3366CC', + '#3366FF', + '#3399CC', + '#3399FF', + '#33CC00', + '#33CC33', + '#33CC66', + '#33CC99', + '#33CCCC', + '#33CCFF', + '#6600CC', + '#6600FF', + '#6633CC', + '#6633FF', + '#66CC00', + '#66CC33', + '#9900CC', + '#9900FF', + '#9933CC', + '#9933FF', + '#99CC00', + '#99CC33', + '#CC0000', + '#CC0033', + '#CC0066', + '#CC0099', + '#CC00CC', + '#CC00FF', + '#CC3300', + '#CC3333', + '#CC3366', + '#CC3399', + '#CC33CC', + '#CC33FF', + '#CC6600', + '#CC6633', + '#CC9900', + '#CC9933', + '#CCCC00', + '#CCCC33', + '#FF0000', + '#FF0033', + '#FF0066', + '#FF0099', + '#FF00CC', + '#FF00FF', + '#FF3300', + '#FF3333', + '#FF3366', + '#FF3399', + '#FF33CC', + '#FF33FF', + '#FF6600', + '#FF6633', + '#FF9900', + '#FF9933', + '#FFCC00', + '#FFCC33' +]; + +/** + * Currently only WebKit-based Web Inspectors, Firefox >= v31, + * and the Firebug extension (any Firefox version) are known + * to support "%c" CSS customizations. + * + * TODO: add a `localStorage` variable to explicitly enable/disable colors + */ + +// eslint-disable-next-line complexity +function useColors() { + // NB: In an Electron preload script, document will be defined but not fully + // initialized. Since we know we're in Chrome, we'll just detect this case + // explicitly + if (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) { + return true; + } + + // Internet Explorer and Edge do not support colors. + if (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) { + return false; + } + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + return (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) || + // Is firebug? http://stackoverflow.com/a/398120/376773 + (typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) || + // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || + // Double check webkit in userAgent just in case we are in a worker + (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); +} + +/** + * Colorize log arguments if enabled. + * + * @api public + */ + +function formatArgs(args) { + args[0] = (this.useColors ? '%c' : '') + + this.namespace + + (this.useColors ? ' %c' : ' ') + + args[0] + + (this.useColors ? '%c ' : ' ') + + '+' + module.exports.humanize(this.diff); + + if (!this.useColors) { + return; + } + + const c = 'color: ' + this.color; + args.splice(1, 0, c, 'color: inherit'); + + // The final "%c" is somewhat tricky, because there could be other + // arguments passed either before or after the %c, so we need to + // figure out the correct index to insert the CSS into + let index = 0; + let lastC = 0; + args[0].replace(/%[a-zA-Z%]/g, match => { + if (match === '%%') { + return; + } + index++; + if (match === '%c') { + // We only are interested in the *last* %c + // (the user may have provided their own) + lastC = index; + } + }); + + args.splice(lastC, 0, c); +} + +/** + * Invokes `console.debug()` when available. + * No-op when `console.debug` is not a "function". + * If `console.debug` is not available, falls back + * to `console.log`. + * + * @api public + */ +exports.log = console.debug || console.log || (() => {}); + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + try { + if (namespaces) { + exports.storage.setItem('debug', namespaces); + } else { + exports.storage.removeItem('debug'); + } + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ +function load() { + let r; + try { + r = exports.storage.getItem('debug'); + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } + + // If debug isn't set in LS, and we're in Electron, try to load $DEBUG + if (!r && typeof process !== 'undefined' && 'env' in process) { + r = process.env.DEBUG; + } + + return r; +} + +/** + * Localstorage attempts to return the localstorage. + * + * This is necessary because safari throws + * when a user disables cookies/localstorage + * and you attempt to access it. + * + * @return {LocalStorage} + * @api private + */ + +function localstorage() { + try { + // TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context + // The Browser also has localStorage in the global context. + return localStorage; + } catch (error) { + // Swallow + // XXX (@Qix-) should we be logging these? + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. + */ + +formatters.j = function (v) { + try { + return JSON.stringify(v); + } catch (error) { + return '[UnexpectedJSONParseError]: ' + error.message; + } +}; diff --git a/node_modules/@puppeteer/browsers/node_modules/debug/src/common.js b/node_modules/@puppeteer/browsers/node_modules/debug/src/common.js new file mode 100644 index 000000000..e3291b20f --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/debug/src/common.js @@ -0,0 +1,274 @@ + +/** + * This is the common logic for both the Node.js and web browser + * implementations of `debug()`. + */ + +function setup(env) { + createDebug.debug = createDebug; + createDebug.default = createDebug; + createDebug.coerce = coerce; + createDebug.disable = disable; + createDebug.enable = enable; + createDebug.enabled = enabled; + createDebug.humanize = require('ms'); + createDebug.destroy = destroy; + + Object.keys(env).forEach(key => { + createDebug[key] = env[key]; + }); + + /** + * The currently active debug mode names, and names to skip. + */ + + createDebug.names = []; + createDebug.skips = []; + + /** + * Map of special "%n" handling functions, for the debug "format" argument. + * + * Valid key names are a single, lower or upper-case letter, i.e. "n" and "N". + */ + createDebug.formatters = {}; + + /** + * Selects a color for a debug namespace + * @param {String} namespace The namespace string for the debug instance to be colored + * @return {Number|String} An ANSI color code for the given namespace + * @api private + */ + function selectColor(namespace) { + let hash = 0; + + for (let i = 0; i < namespace.length; i++) { + hash = ((hash << 5) - hash) + namespace.charCodeAt(i); + hash |= 0; // Convert to 32bit integer + } + + return createDebug.colors[Math.abs(hash) % createDebug.colors.length]; + } + createDebug.selectColor = selectColor; + + /** + * Create a debugger with the given `namespace`. + * + * @param {String} namespace + * @return {Function} + * @api public + */ + function createDebug(namespace) { + let prevTime; + let enableOverride = null; + let namespacesCache; + let enabledCache; + + function debug(...args) { + // Disabled? + if (!debug.enabled) { + return; + } + + const self = debug; + + // Set `diff` timestamp + const curr = Number(new Date()); + const ms = curr - (prevTime || curr); + self.diff = ms; + self.prev = prevTime; + self.curr = curr; + prevTime = curr; + + args[0] = createDebug.coerce(args[0]); + + if (typeof args[0] !== 'string') { + // Anything else let's inspect with %O + args.unshift('%O'); + } + + // Apply any `formatters` transformations + let index = 0; + args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => { + // If we encounter an escaped % then don't increase the array index + if (match === '%%') { + return '%'; + } + index++; + const formatter = createDebug.formatters[format]; + if (typeof formatter === 'function') { + const val = args[index]; + match = formatter.call(self, val); + + // Now we need to remove `args[index]` since it's inlined in the `format` + args.splice(index, 1); + index--; + } + return match; + }); + + // Apply env-specific formatting (colors, etc.) + createDebug.formatArgs.call(self, args); + + const logFn = self.log || createDebug.log; + logFn.apply(self, args); + } + + debug.namespace = namespace; + debug.useColors = createDebug.useColors(); + debug.color = createDebug.selectColor(namespace); + debug.extend = extend; + debug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release. + + Object.defineProperty(debug, 'enabled', { + enumerable: true, + configurable: false, + get: () => { + if (enableOverride !== null) { + return enableOverride; + } + if (namespacesCache !== createDebug.namespaces) { + namespacesCache = createDebug.namespaces; + enabledCache = createDebug.enabled(namespace); + } + + return enabledCache; + }, + set: v => { + enableOverride = v; + } + }); + + // Env-specific initialization logic for debug instances + if (typeof createDebug.init === 'function') { + createDebug.init(debug); + } + + return debug; + } + + function extend(namespace, delimiter) { + const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace); + newDebug.log = this.log; + return newDebug; + } + + /** + * Enables a debug mode by namespaces. This can include modes + * separated by a colon and wildcards. + * + * @param {String} namespaces + * @api public + */ + function enable(namespaces) { + createDebug.save(namespaces); + createDebug.namespaces = namespaces; + + createDebug.names = []; + createDebug.skips = []; + + let i; + const split = (typeof namespaces === 'string' ? namespaces : '').split(/[\s,]+/); + const len = split.length; + + for (i = 0; i < len; i++) { + if (!split[i]) { + // ignore empty strings + continue; + } + + namespaces = split[i].replace(/\*/g, '.*?'); + + if (namespaces[0] === '-') { + createDebug.skips.push(new RegExp('^' + namespaces.slice(1) + '$')); + } else { + createDebug.names.push(new RegExp('^' + namespaces + '$')); + } + } + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names.map(toNamespace), + ...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace) + ].join(','); + createDebug.enable(''); + return namespaces; + } + + /** + * Returns true if the given mode name is enabled, false otherwise. + * + * @param {String} name + * @return {Boolean} + * @api public + */ + function enabled(name) { + if (name[name.length - 1] === '*') { + return true; + } + + let i; + let len; + + for (i = 0, len = createDebug.skips.length; i < len; i++) { + if (createDebug.skips[i].test(name)) { + return false; + } + } + + for (i = 0, len = createDebug.names.length; i < len; i++) { + if (createDebug.names[i].test(name)) { + return true; + } + } + + return false; + } + + /** + * Convert regexp to namespace + * + * @param {RegExp} regxep + * @return {String} namespace + * @api private + */ + function toNamespace(regexp) { + return regexp.toString() + .substring(2, regexp.toString().length - 2) + .replace(/\.\*\?$/, '*'); + } + + /** + * Coerce `val`. + * + * @param {Mixed} val + * @return {Mixed} + * @api private + */ + function coerce(val) { + if (val instanceof Error) { + return val.stack || val.message; + } + return val; + } + + /** + * XXX DO NOT USE. This is a temporary stub function. + * XXX It WILL be removed in the next major release. + */ + function destroy() { + console.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'); + } + + createDebug.enable(createDebug.load()); + + return createDebug; +} + +module.exports = setup; diff --git a/node_modules/@puppeteer/browsers/node_modules/debug/src/index.js b/node_modules/@puppeteer/browsers/node_modules/debug/src/index.js new file mode 100644 index 000000000..bf4c57f25 --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/debug/src/index.js @@ -0,0 +1,10 @@ +/** + * Detect Electron renderer / nwjs process, which is node, but we should + * treat as a browser. + */ + +if (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) { + module.exports = require('./browser.js'); +} else { + module.exports = require('./node.js'); +} diff --git a/node_modules/@puppeteer/browsers/node_modules/debug/src/node.js b/node_modules/@puppeteer/browsers/node_modules/debug/src/node.js new file mode 100644 index 000000000..79bc085cb --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/debug/src/node.js @@ -0,0 +1,263 @@ +/** + * Module dependencies. + */ + +const tty = require('tty'); +const util = require('util'); + +/** + * This is the Node.js implementation of `debug()`. + */ + +exports.init = init; +exports.log = log; +exports.formatArgs = formatArgs; +exports.save = save; +exports.load = load; +exports.useColors = useColors; +exports.destroy = util.deprecate( + () => {}, + 'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.' +); + +/** + * Colors. + */ + +exports.colors = [6, 2, 3, 4, 5, 1]; + +try { + // Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json) + // eslint-disable-next-line import/no-extraneous-dependencies + const supportsColor = require('supports-color'); + + if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) { + exports.colors = [ + 20, + 21, + 26, + 27, + 32, + 33, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 56, + 57, + 62, + 63, + 68, + 69, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 92, + 93, + 98, + 99, + 112, + 113, + 128, + 129, + 134, + 135, + 148, + 149, + 160, + 161, + 162, + 163, + 164, + 165, + 166, + 167, + 168, + 169, + 170, + 171, + 172, + 173, + 178, + 179, + 184, + 185, + 196, + 197, + 198, + 199, + 200, + 201, + 202, + 203, + 204, + 205, + 206, + 207, + 208, + 209, + 214, + 215, + 220, + 221 + ]; + } +} catch (error) { + // Swallow - we only care if `supports-color` is available; it doesn't have to be. +} + +/** + * Build up the default `inspectOpts` object from the environment variables. + * + * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js + */ + +exports.inspectOpts = Object.keys(process.env).filter(key => { + return /^debug_/i.test(key); +}).reduce((obj, key) => { + // Camel-case + const prop = key + .substring(6) + .toLowerCase() + .replace(/_([a-z])/g, (_, k) => { + return k.toUpperCase(); + }); + + // Coerce string value into JS value + let val = process.env[key]; + if (/^(yes|on|true|enabled)$/i.test(val)) { + val = true; + } else if (/^(no|off|false|disabled)$/i.test(val)) { + val = false; + } else if (val === 'null') { + val = null; + } else { + val = Number(val); + } + + obj[prop] = val; + return obj; +}, {}); + +/** + * Is stdout a TTY? Colored output is enabled when `true`. + */ + +function useColors() { + return 'colors' in exports.inspectOpts ? + Boolean(exports.inspectOpts.colors) : + tty.isatty(process.stderr.fd); +} + +/** + * Adds ANSI color escape codes if enabled. + * + * @api public + */ + +function formatArgs(args) { + const {namespace: name, useColors} = this; + + if (useColors) { + const c = this.color; + const colorCode = '\u001B[3' + (c < 8 ? c : '8;5;' + c); + const prefix = ` ${colorCode};1m${name} \u001B[0m`; + + args[0] = prefix + args[0].split('\n').join('\n' + prefix); + args.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\u001B[0m'); + } else { + args[0] = getDate() + name + ' ' + args[0]; + } +} + +function getDate() { + if (exports.inspectOpts.hideDate) { + return ''; + } + return new Date().toISOString() + ' '; +} + +/** + * Invokes `util.format()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.format(...args) + '\n'); +} + +/** + * Save `namespaces`. + * + * @param {String} namespaces + * @api private + */ +function save(namespaces) { + if (namespaces) { + process.env.DEBUG = namespaces; + } else { + // If you set a process.env field to null or undefined, it gets cast to the + // string 'null' or 'undefined'. Just delete instead. + delete process.env.DEBUG; + } +} + +/** + * Load `namespaces`. + * + * @return {String} returns the previously persisted debug modes + * @api private + */ + +function load() { + return process.env.DEBUG; +} + +/** + * Init logic for `debug` instances. + * + * Create a new `inspectOpts` object in case `useColors` is set + * differently for a particular `debug` instance. + */ + +function init(debug) { + debug.inspectOpts = {}; + + const keys = Object.keys(exports.inspectOpts); + for (let i = 0; i < keys.length; i++) { + debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]]; + } +} + +module.exports = require('./common')(exports); + +const {formatters} = module.exports; + +/** + * Map %o to `util.inspect()`, all on a single line. + */ + +formatters.o = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts) + .split('\n') + .map(str => str.trim()) + .join(' '); +}; + +/** + * Map %O to `util.inspect()`, allowing multiple lines if needed. + */ + +formatters.O = function (v) { + this.inspectOpts.colors = this.useColors; + return util.inspect(v, this.inspectOpts); +}; diff --git a/node_modules/@puppeteer/browsers/node_modules/ms/index.js b/node_modules/@puppeteer/browsers/node_modules/ms/index.js new file mode 100644 index 000000000..c4498bcc2 --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/ms/index.js @@ -0,0 +1,162 @@ +/** + * Helpers. + */ + +var s = 1000; +var m = s * 60; +var h = m * 60; +var d = h * 24; +var w = d * 7; +var y = d * 365.25; + +/** + * Parse or format the given `val`. + * + * Options: + * + * - `long` verbose formatting [false] + * + * @param {String|Number} val + * @param {Object} [options] + * @throws {Error} throw an error if val is not a non-empty string or a number + * @return {String|Number} + * @api public + */ + +module.exports = function(val, options) { + options = options || {}; + var type = typeof val; + if (type === 'string' && val.length > 0) { + return parse(val); + } else if (type === 'number' && isFinite(val)) { + return options.long ? fmtLong(val) : fmtShort(val); + } + throw new Error( + 'val is not a non-empty string or a valid number. val=' + + JSON.stringify(val) + ); +}; + +/** + * Parse the given `str` and return milliseconds. + * + * @param {String} str + * @return {Number} + * @api private + */ + +function parse(str) { + str = String(str); + if (str.length > 100) { + return; + } + var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec( + str + ); + if (!match) { + return; + } + var n = parseFloat(match[1]); + var type = (match[2] || 'ms').toLowerCase(); + switch (type) { + case 'years': + case 'year': + case 'yrs': + case 'yr': + case 'y': + return n * y; + case 'weeks': + case 'week': + case 'w': + return n * w; + case 'days': + case 'day': + case 'd': + return n * d; + case 'hours': + case 'hour': + case 'hrs': + case 'hr': + case 'h': + return n * h; + case 'minutes': + case 'minute': + case 'mins': + case 'min': + case 'm': + return n * m; + case 'seconds': + case 'second': + case 'secs': + case 'sec': + case 's': + return n * s; + case 'milliseconds': + case 'millisecond': + case 'msecs': + case 'msec': + case 'ms': + return n; + default: + return undefined; + } +} + +/** + * Short format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtShort(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return Math.round(ms / d) + 'd'; + } + if (msAbs >= h) { + return Math.round(ms / h) + 'h'; + } + if (msAbs >= m) { + return Math.round(ms / m) + 'm'; + } + if (msAbs >= s) { + return Math.round(ms / s) + 's'; + } + return ms + 'ms'; +} + +/** + * Long format for `ms`. + * + * @param {Number} ms + * @return {String} + * @api private + */ + +function fmtLong(ms) { + var msAbs = Math.abs(ms); + if (msAbs >= d) { + return plural(ms, msAbs, d, 'day'); + } + if (msAbs >= h) { + return plural(ms, msAbs, h, 'hour'); + } + if (msAbs >= m) { + return plural(ms, msAbs, m, 'minute'); + } + if (msAbs >= s) { + return plural(ms, msAbs, s, 'second'); + } + return ms + ' ms'; +} + +/** + * Pluralization helper. + */ + +function plural(ms, msAbs, n, name) { + var isPlural = msAbs >= n * 1.5; + return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : ''); +} diff --git a/node_modules/@puppeteer/browsers/node_modules/ms/package.json b/node_modules/@puppeteer/browsers/node_modules/ms/package.json new file mode 100644 index 000000000..eea666e1f --- /dev/null +++ b/node_modules/@puppeteer/browsers/node_modules/ms/package.json @@ -0,0 +1,37 @@ +{ + "name": "ms", + "version": "2.1.2", + "description": "Tiny millisecond conversion utility", + "repository": "zeit/ms", + "main": "./index", + "files": [ + "index.js" + ], + "scripts": { + "precommit": "lint-staged", + "lint": "eslint lib/* bin/*", + "test": "mocha tests.js" + }, + "eslintConfig": { + "extends": "eslint:recommended", + "env": { + "node": true, + "es6": true + } + }, + "lint-staged": { + "*.js": [ + "npm run lint", + "prettier --single-quote --write", + "git add" + ] + }, + "license": "MIT", + "devDependencies": { + "eslint": "4.12.1", + "expect.js": "0.3.1", + "husky": "0.14.3", + "lint-staged": "5.0.0", + "mocha": "4.0.1" + } +} diff --git a/node_modules/@puppeteer/browsers/package.json b/node_modules/@puppeteer/browsers/package.json new file mode 100644 index 000000000..7ae065e97 --- /dev/null +++ b/node_modules/@puppeteer/browsers/package.json @@ -0,0 +1,123 @@ +{ + "name": "@puppeteer/browsers", + "version": "0.5.0", + "description": "Download and launch browsers", + "scripts": { + "build:docs": "wireit", + "build": "wireit", + "build:test": "wireit", + "clean": "tsc --build --clean && rm -rf lib", + "test": "wireit" + }, + "bin": { + "@puppeteer/browsers": "lib/cjs/main-cli.js" + }, + "main": "./lib/cjs/main.js", + "module": "./lib/esm/main.js", + "type": "commonjs", + "exports": { + ".": { + "import": "./lib/esm/main.js", + "require": "./lib/cjs/main.js" + } + }, + "wireit": { + "build": { + "command": "tsc -b && tsx ../../tools/chmod.ts 755 lib/cjs/main-cli.js lib/esm/main-cli.js", + "files": [ + "src/**/*.ts", + "tsconfig.json" + ], + "clean": "if-file-deleted", + "output": [ + "lib/**", + "!lib/esm/package.json" + ], + "dependencies": [ + "generate:package-json" + ] + }, + "generate:package-json": { + "command": "tsx ../../tools/generate_module_package_json.ts lib/esm/package.json", + "files": [ + "../../tools/generate_module_package_json.ts" + ], + "output": [ + "lib/esm/package.json" + ] + }, + "build:docs": { + "command": "api-extractor run --local --config \"./api-extractor.docs.json\"", + "files": [ + "api-extractor.docs.json", + "lib/esm/main.d.ts", + "tsconfig.json" + ], + "dependencies": [ + "build" + ] + }, + "build:test": { + "command": "tsc -b test/src/tsconfig.json", + "files": [ + "test/**/*.ts", + "test/src/tsconfig.json" + ], + "output": [ + "test/build/**" + ], + "dependencies": [ + "build", + "../testserver:build" + ] + }, + "test": { + "command": "node tools/downloadTestBrowsers.mjs && cross-env DEBUG=puppeteer:* mocha", + "files": [ + ".mocharc.cjs" + ], + "dependencies": [ + "build:test" + ] + } + }, + "keywords": [ + "puppeteer", + "browsers" + ], + "repository": { + "type": "git", + "url": "https://github.com/puppeteer/puppeteer/tree/main/packages/browsers" + }, + "author": "The Chromium Authors", + "license": "Apache-2.0", + "engines": { + "node": ">=14.1.0" + }, + "files": [ + "lib", + "!*.tsbuildinfo" + ], + "dependencies": { + "debug": "4.3.4", + "extract-zip": "2.0.1", + "https-proxy-agent": "5.0.1", + "progress": "2.0.3", + "proxy-from-env": "1.1.0", + "tar-fs": "2.1.1", + "unbzip2-stream": "1.4.3", + "yargs": "17.7.1" + }, + "devDependencies": { + "@types/node": "^14.15.0", + "@types/yargs": "17.0.22" + }, + "peerDependencies": { + "typescript": ">= 4.7.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } +} diff --git a/node_modules/axe-core/axe.js b/node_modules/axe-core/axe.js index f9bd3849f..905530ab3 100644 --- a/node_modules/axe-core/axe.js +++ b/node_modules/axe-core/axe.js @@ -1,5 +1,5 @@ -/*! axe v4.4.1 - * Copyright (c) 2022 Deque Systems, Inc. +/*! axe v4.6.3 + * Copyright (c) 2023 Deque Systems, Inc. * * Your use of this Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this @@ -22,7 +22,7 @@ }, _typeof(obj); } var axe = axe || {}; - axe.version = '4.4.1'; + axe.version = '4.6.3'; if (typeof define === 'function' && define.amd) { define('axe-core', [], function() { return axe; @@ -49,8 +49,12 @@ SupportError.prototype = Object.create(Error.prototype); SupportError.prototype.constructor = SupportError; 'use strict'; - var _excluded = [ 'node' ], _excluded2 = [ 'node' ], _excluded3 = [ 'variant' ], _excluded4 = [ 'matches' ], _excluded5 = [ 'chromium' ], _excluded6 = [ 'noImplicit' ], _excluded7 = [ 'noPresentational' ], _excluded8 = [ 'nodes' ], _excluded9 = [ 'node' ], _excluded10 = [ 'relatedNodes' ], _excluded11 = [ 'environmentData' ], _excluded12 = [ 'environmentData' ], _excluded13 = [ 'node' ], _excluded14 = [ 'environmentData' ], _excluded15 = [ 'environmentData' ], _excluded16 = [ 'environmentData' ]; + var _excluded = [ 'node' ], _excluded2 = [ 'variant' ], _excluded3 = [ 'matches' ], _excluded4 = [ 'chromium' ], _excluded5 = [ 'noImplicit' ], _excluded6 = [ 'noPresentational' ], _excluded7 = [ 'node' ], _excluded8 = [ 'nodes' ], _excluded9 = [ 'node' ], _excluded10 = [ 'relatedNodes' ], _excluded11 = [ 'environmentData' ], _excluded12 = [ 'environmentData' ], _excluded13 = [ 'node' ], _excluded14 = [ 'environmentData' ], _excluded15 = [ 'environmentData' ], _excluded16 = [ 'environmentData' ]; + function _toArray(arr) { + return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); + } function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, @@ -82,7 +86,7 @@ } } function _setPrototypeOf(o, p) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; @@ -133,7 +137,7 @@ } } function _getPrototypeOf(o) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); @@ -191,6 +195,20 @@ return _arrayLikeToArray(arr); } } + function _extends() { + _extends = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } @@ -198,56 +216,40 @@ throw new TypeError('Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.'); } function _iterableToArrayLimit(arr, i) { - var _i = arr == null ? null : typeof Symbol !== 'undefined' && arr[Symbol.iterator] || arr['@@iterator']; - if (_i == null) { - return; - } - var _arr = []; - var _n = true; - var _d = false; - var _s, _e; - try { - for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - if (i && _arr.length === i) { - break; - } - } - } catch (err) { - _d = true; - _e = err; - } finally { + var _i = null == arr ? null : 'undefined' != typeof Symbol && arr[Symbol.iterator] || arr['@@iterator']; + if (null != _i) { + var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { - if (!_n && _i['return'] != null) { - _i['return'](); + if (_x = (_i = _i.call(arr)).next, 0 === i) { + if (Object(_i) !== _i) { + return; + } + _n = !1; + } else { + for (;!(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { + } } + } catch (err) { + _d = !0, _e = err; } finally { - if (_d) { - throw _e; + try { + if (!_n && null != _i['return'] && (_r = _i['return'](), Object(_r) !== _r)) { + return; + } + } finally { + if (_d) { + throw _e; + } } } + return _arr; } - return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) { return arr; } } - function _extends() { - _extends = Object.assign || function(target) { - for (var i = 1; i < arguments.length; i++) { - var source = arguments[i]; - for (var key in source) { - if (Object.prototype.hasOwnProperty.call(source, key)) { - target[key] = source[key]; - } - } - } - return target; - }; - return _extends.apply(this, arguments); - } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); @@ -261,7 +263,7 @@ if ('value' in descriptor) { descriptor.writable = true; } - Object.defineProperty(target, descriptor.key, descriptor); + Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } function _createClass(Constructor, protoProps, staticProps) { @@ -276,6 +278,24 @@ }); return Constructor; } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, 'string'); + return _typeof(key) === 'symbol' ? key : String(key); + } + function _toPrimitive(input, hint) { + if (_typeof(input) !== 'object' || input === null) { + return input; + } + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || 'default'); + if (_typeof(res) !== 'object') { + return res; + } + throw new TypeError('@@toPrimitive must return a primitive value.'); + } + return (hint === 'string' ? String : Number)(input); + } function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== 'undefined' && o[Symbol.iterator] || o['@@iterator']; if (!it) { @@ -380,19 +400,14 @@ value: true }); }; - var __commonJS = function __commonJS(callback, module) { + var __commonJS = function __commonJS(cb, mod) { return function() { - if (!module) { - module = { - exports: {} - }; - callback(module.exports, module); - } - return module.exports; + return mod || cb((mod = { + exports: {} + }).exports, mod), mod.exports; }; }; var __export = function __export(target, all) { - __markAsModule(target); for (var name in all) { __defProp(target, name, { get: all[name], @@ -401,8 +416,7 @@ } }; var __exportStar = function __exportStar(target, module, desc) { - __markAsModule(target); - if (_typeof(module) === 'object' || typeof module === 'function') { + if (module && _typeof(module) === 'object' || typeof module === 'function') { var _iterator = _createForOfIteratorHelper(__getOwnPropNames(module)), _step; try { var _loop = function _loop() { @@ -428,13 +442,15 @@ return target; }; var __toModule = function __toModule(module) { - if (module && module.__esModule) { - return module; - } - return __exportStar(__defProp(__create(__getProtoOf(module)), 'default', { + return __exportStar(__markAsModule(__defProp(module != null ? __create(__getProtoOf(module)) : {}, 'default', module && module.__esModule && 'default' in module ? { + get: function get() { + return module['default']; + }, + enumerable: true + } : { value: module, enumerable: true - }), module); + })), module); }; var require_utils = __commonJS(function(exports) { 'use strict'; @@ -693,15 +709,15 @@ var selector = { type: 'ruleSet' }; - var rule3 = parseRule(); - if (!rule3) { + var rule = parseRule(); + if (!rule) { return null; } var currentRule = selector; - while (rule3) { - rule3.type = 'rule'; - currentRule.rule = rule3; - currentRule = rule3; + while (rule) { + rule.type = 'rule'; + currentRule.rule = rule; + currentRule = rule; skipWhitespace(); chr = str.charAt(pos); if (pos >= l || chr === ',' || chr === ')') { @@ -711,36 +727,36 @@ var op = chr; pos++; skipWhitespace(); - rule3 = parseRule(); - if (!rule3) { + rule = parseRule(); + if (!rule) { throw Error('Rule expected after "' + op + '".'); } - rule3.nestingOperator = op; + rule.nestingOperator = op; } else { - rule3 = parseRule(); - if (rule3) { - rule3.nestingOperator = null; + rule = parseRule(); + if (rule) { + rule.nestingOperator = null; } } } return selector; } function parseRule() { - var rule3 = null; + var rule = null; while (pos < l) { chr = str.charAt(pos); if (chr === '*') { pos++; - (rule3 = rule3 || {}).tagName = '*'; + (rule = rule || {}).tagName = '*'; } else if (utils_1.isIdentStart(chr) || chr === '\\') { - (rule3 = rule3 || {}).tagName = getIdent(); + (rule = rule || {}).tagName = getIdent(); } else if (chr === '.') { pos++; - rule3 = rule3 || {}; - (rule3.classNames = rule3.classNames || []).push(getIdent()); + rule = rule || {}; + (rule.classNames = rule.classNames || []).push(getIdent()); } else if (chr === '#') { pos++; - (rule3 = rule3 || {}).id = getIdent(); + (rule = rule || {}).id = getIdent(); } else if (chr === '[') { pos++; skipWhitespace(); @@ -797,8 +813,8 @@ pos++; attr.value = attrValue; } - rule3 = rule3 || {}; - (rule3.attrs = rule3.attrs || []).push(attr); + rule = rule || {}; + (rule.attrs = rule.attrs || []).push(attr); } else if (chr === ':') { pos++; var pseudoName = getIdent(); @@ -844,13 +860,13 @@ pos++; pseudo.value = value; } - rule3 = rule3 || {}; - (rule3.pseudos = rule3.pseudos || []).push(pseudo); + rule = rule || {}; + (rule.pseudos = rule.pseudos || []).push(pseudo); } else { break; } } - return rule3; + return rule; } return parse2(); } @@ -1391,11 +1407,11 @@ } else { mixin = require_mixin(); generate = function() { - var cache21 = []; + var cache2 = []; return function(length) { var args, i = 0; - if (cache21[length]) { - return cache21[length]; + if (cache2[length]) { + return cache2[length]; } args = []; while (length--) { @@ -1525,7 +1541,7 @@ var isPlainFunction = require_is5(); var assign = require_assign(); var normalizeOpts = require_normalize_options(); - var contains6 = require_contains(); + var contains3 = require_contains(); var d = module.exports = function(dscr, value) { var c, e, w, options, desc; if (arguments.length < 2 || typeof dscr !== 'string') { @@ -1536,9 +1552,9 @@ options = arguments[2]; } if (isValue(dscr)) { - c = contains6.call(dscr, 'c'); - e = contains6.call(dscr, 'e'); - w = contains6.call(dscr, 'w'); + c = contains3.call(dscr, 'c'); + e = contains3.call(dscr, 'e'); + w = contains3.call(dscr, 'w'); } else { c = w = true; e = false; @@ -1573,8 +1589,8 @@ set = void 0; } if (isValue(dscr)) { - c = contains6.call(dscr, 'c'); - e = contains6.call(dscr, 'e'); + c = contains3.call(dscr, 'c'); + e = contains3.call(dscr, 'e'); } else { c = true; e = false; @@ -2214,7 +2230,7 @@ var _on = ee.on; var emit = ee.emit; module.exports = function(original, length, options) { - var cache21 = create(null), conf, memLength, _get, set, del, _clear, extDel, extGet, extHas, normalizer, getListeners, setListeners, deleteListeners, memoized, resolve; + var cache2 = create(null), conf, memLength, _get, set, del, _clear, extDel, extGet, extHas, normalizer, getListeners, setListeners, deleteListeners, memoized, resolve; if (length !== false) { memLength = length; } else if (isNaN(original.length)) { @@ -2240,11 +2256,11 @@ } id = _get(args); if (id !== null) { - if (hasOwnProperty.call(cache21, id)) { + if (hasOwnProperty.call(cache2, id)) { if (getListeners) { conf.emit('get', id, args, this); } - return cache21[id]; + return cache2[id]; } } if (args.length === 1) { @@ -2258,10 +2274,10 @@ throw customError('Circular invocation', 'CIRCULAR_INVOCATION'); } id = set(args); - } else if (hasOwnProperty.call(cache21, id)) { + } else if (hasOwnProperty.call(cache2, id)) { throw customError('Circular invocation', 'CIRCULAR_INVOCATION'); } - cache21[id] = result; + cache2[id] = result; if (setListeners) { conf.emit('set', id, null, result); } @@ -2270,21 +2286,21 @@ } else if (length === 0) { memoized = function memoized() { var result; - if (hasOwnProperty.call(cache21, 'data')) { + if (hasOwnProperty.call(cache2, 'data')) { if (getListeners) { conf.emit('get', 'data', arguments, this); } - return cache21.data; + return cache2.data; } if (arguments.length) { result = apply.call(original, this, arguments); } else { result = call.call(original, this); } - if (hasOwnProperty.call(cache21, 'data')) { + if (hasOwnProperty.call(cache2, 'data')) { throw customError('Circular invocation', 'CIRCULAR_INVOCATION'); } - cache21.data = result; + cache2.data = result; if (setListeners) { conf.emit('set', 'data', null, result); } @@ -2297,21 +2313,21 @@ args = resolve(arguments); } id = String(args[0]); - if (hasOwnProperty.call(cache21, id)) { + if (hasOwnProperty.call(cache2, id)) { if (getListeners) { conf.emit('get', id, args, this); } - return cache21[id]; + return cache2[id]; } if (args.length === 1) { result = call.call(original, this, args[0]); } else { result = apply.call(original, this, args); } - if (hasOwnProperty.call(cache21, id)) { + if (hasOwnProperty.call(cache2, id)) { throw customError('Circular invocation', 'CIRCULAR_INVOCATION'); } - cache21[id] = result; + cache2[id] = result; if (setListeners) { conf.emit('set', id, null, result); } @@ -2332,28 +2348,28 @@ return String(args[0]); }, has: function has(id) { - return hasOwnProperty.call(cache21, id); + return hasOwnProperty.call(cache2, id); }, delete: function _delete(id) { var result; - if (!hasOwnProperty.call(cache21, id)) { + if (!hasOwnProperty.call(cache2, id)) { return; } if (del) { del(id); } - result = cache21[id]; - delete cache21[id]; + result = cache2[id]; + delete cache2[id]; if (deleteListeners) { conf.emit('delete', id, result); } }, clear: function clear() { - var oldCache = cache21; + var oldCache = cache2; if (_clear) { _clear(); } - cache21 = create(null); + cache2 = create(null); conf.emit('clear', oldCache); }, on: function on(type, listener) { @@ -2398,7 +2414,7 @@ extGet = defineLength(function() { var id, args = arguments; if (length === 0) { - return cache21.data; + return cache2.data; } if (resolve) { args = resolve(args); @@ -2408,7 +2424,7 @@ } else { id = String(args[0]); } - return cache21[id]; + return cache2[id]; }); extHas = defineLength(function() { var id, args = arguments; @@ -2443,7 +2459,7 @@ var callable = require_valid_callable(); var forEach = require_for_each(); var extensions = require_registered_extensions(); - var configure5 = require_configure_map(); + var configure4 = require_configure_map(); var resolveLength = require_resolve_length(); module.exports = function self2(fn) { var options, length, conf; @@ -2456,7 +2472,7 @@ return fn; } length = resolveLength(options.length, fn.length, options.async && extensions.async); - conf = configure5(fn, length, options); + conf = configure4(fn, length, options); forEach(extensions, function(extFn, name) { if (options[name]) { extFn(options[name], conf, options); @@ -2559,7 +2575,7 @@ var indexOf = require_e_index_of(); var create = Object.create; module.exports = function() { - var lastId = 0, map = [], cache21 = create(null); + var lastId = 0, map = [], cache2 = create(null); return { get: function get(args) { var index = 0, set = map, i, length = args.length; @@ -2607,11 +2623,11 @@ } set[1][i] = ++lastId; } - cache21[lastId] = args; + cache2[lastId] = args; return lastId; }, delete: function _delete(id) { - var index = 0, set = map, i, args = cache21[id], length = args.length, path = []; + var index = 0, set = map, i, args = cache2[id], length = args.length, path = []; if (length === 0) { delete set[length]; } else if (set = set[length]) { @@ -2638,11 +2654,11 @@ set[1].splice(i, 1); } } - delete cache21[id]; + delete cache2[id]; }, clear: function clear() { map = []; - cache21 = create(null); + cache2 = create(null); } }; }; @@ -2651,27 +2667,27 @@ 'use strict'; var indexOf = require_e_index_of(); module.exports = function() { - var lastId = 0, argsMap = [], cache21 = []; + var lastId = 0, argsMap = [], cache2 = []; return { get: function get(args) { var index = indexOf.call(argsMap, args[0]); - return index === -1 ? null : cache21[index]; + return index === -1 ? null : cache2[index]; }, set: function set(args) { argsMap.push(args[0]); - cache21.push(++lastId); + cache2.push(++lastId); return lastId; }, delete: function _delete(id) { - var index = indexOf.call(cache21, id); + var index = indexOf.call(cache2, id); if (index !== -1) { argsMap.splice(index, 1); - cache21.splice(index, 1); + cache2.splice(index, 1); } }, clear: function clear() { argsMap = []; - cache21 = []; + cache2 = []; } }; }; @@ -2681,7 +2697,7 @@ var indexOf = require_e_index_of(); var create = Object.create; module.exports = function(length) { - var lastId = 0, map = [ [], [] ], cache21 = create(null); + var lastId = 0, map = [ [], [] ], cache2 = create(null); return { get: function get(args) { var index = 0, set = map, i; @@ -2715,11 +2731,11 @@ i = set[0].push(args[index]) - 1; } set[1][i] = ++lastId; - cache21[lastId] = args; + cache2[lastId] = args; return lastId; }, delete: function _delete(id) { - var index = 0, set = map, i, path = [], args = cache21[id]; + var index = 0, set = map, i, path = [], args = cache2[id]; while (index < length - 1) { i = indexOf.call(set[0], args[index]); if (i === -1) { @@ -2742,11 +2758,11 @@ set[0].splice(i, 1); set[1].splice(i, 1); } - delete cache21[id]; + delete cache2[id]; }, clear: function clear() { map = [ [], [] ]; - cache21 = create(null); + cache2 = create(null); } }; }; @@ -2774,19 +2790,19 @@ return fn; }; var byObserver = function byObserver(Observer) { - var node = document.createTextNode(''), queue4, currentQueue, i = 0; + var node = document.createTextNode(''), queue2, currentQueue, i = 0; new Observer(function() { var callback; - if (!queue4) { + if (!queue2) { if (!currentQueue) { return; } - queue4 = currentQueue; + queue2 = currentQueue; } else if (currentQueue) { - queue4 = currentQueue.concat(queue4); + queue2 = currentQueue.concat(queue2); } - currentQueue = queue4; - queue4 = null; + currentQueue = queue2; + queue2 = null; if (typeof currentQueue === 'function') { callback = currentQueue; currentQueue = null; @@ -2806,15 +2822,15 @@ }); return function(fn) { ensureCallable(fn); - if (queue4) { - if (typeof queue4 === 'function') { - queue4 = [ queue4, fn ]; + if (queue2) { + if (typeof queue2 === 'function') { + queue2 = [ queue2, fn ]; } else { - queue4.push(fn); + queue2.push(fn); } return; } - queue4 = fn; + queue2 = fn; node.data = i = ++i % 2; }; }; @@ -2859,7 +2875,7 @@ var apply = Function.prototype.apply; var create = Object.create; require_registered_extensions().async = function(tbi, conf) { - var waiting = create(null), cache21 = create(null), base = conf.memoized, original = conf.original, currentCallback, currentContext, currentArgs; + var waiting = create(null), cache2 = create(null), base = conf.memoized, original = conf.original, currentCallback, currentContext, currentArgs; conf.memoized = defineLength(function(arg) { var args = arguments, last = args[args.length - 1]; if (typeof last === 'function') { @@ -2872,7 +2888,7 @@ mixin(conf.memoized, base); } catch (ignore) {} conf.on('get', function(id) { - var cb, context5, args; + var cb, context, args; if (!currentCallback) { return; } @@ -2886,20 +2902,20 @@ return; } cb = currentCallback; - context5 = currentContext; + context = currentContext; args = currentArgs; currentCallback = currentContext = currentArgs = null; nextTick(function() { var data2; - if (hasOwnProperty.call(cache21, id)) { - data2 = cache21[id]; - conf.emit('getasync', id, args, context5); + if (hasOwnProperty.call(cache2, id)) { + data2 = cache2[id]; + conf.emit('getasync', id, args, context); apply.call(cb, data2.context, data2.args); } else { currentCallback = cb; - currentContext = context5; + currentContext = context; currentArgs = args; - base.apply(context5, args); + base.apply(context, args); } }); }); @@ -2926,7 +2942,7 @@ if (err2) { conf['delete'](id); } else { - cache21[id] = { + cache2[id] = { context: this, args: args2 }; @@ -2973,16 +2989,16 @@ if (hasOwnProperty.call(waiting, id)) { return; } - if (!cache21[id]) { + if (!cache2[id]) { return; } - result = cache21[id]; - delete cache21[id]; + result = cache2[id]; + delete cache2[id]; conf.emit('deleteasync', id, slice.call(result.args, 1)); }); conf.on('clear', function() { - var oldCache = cache21; - cache21 = create(null); + var oldCache = cache2; + cache2 = create(null); conf.emit('clearasync', objectMap(oldCache, function(data2) { return slice.call(data2.args, 1); })); @@ -3076,7 +3092,7 @@ var create = Object.create; var supportedModes = primitiveSet('then', 'then:finally', 'done', 'done:finally'); require_registered_extensions().promise = function(mode, conf) { - var waiting = create(null), cache21 = create(null), promises = create(null); + var waiting = create(null), cache2 = create(null), promises = create(null); if (mode === true) { mode = null; } else { @@ -3088,7 +3104,7 @@ conf.on('set', function(id, ignore, promise) { var isFailed = false; if (!isPromise(promise)) { - cache21[id] = promise; + cache2[id] = promise; conf.emit('setasync', id, 1); return; } @@ -3103,7 +3119,7 @@ return; } delete waiting[id]; - cache21[id] = result; + cache2[id] = result; conf.emit('setasync', id, count); }; var onFailure = function onFailure() { @@ -3145,7 +3161,7 @@ promise['finally'](onFailure); } }); - conf.on('get', function(id, args, context5) { + conf.on('get', function(id, args, context) { var promise; if (waiting[id]) { ++waiting[id]; @@ -3153,7 +3169,7 @@ } promise = promises[id]; var emit = function emit() { - conf.emit('getasync', id, args, context5); + conf.emit('getasync', id, args, context); }; if (isPromise(promise)) { if (typeof promise.done === 'function') { @@ -3173,16 +3189,16 @@ delete waiting[id]; return; } - if (!hasOwnProperty.call(cache21, id)) { + if (!hasOwnProperty.call(cache2, id)) { return; } - var result = cache21[id]; - delete cache21[id]; + var result = cache2[id]; + delete cache2[id]; conf.emit('deleteasync', id, [ result ]); }); conf.on('clear', function() { - var oldCache = cache21; - cache21 = create(null); + var oldCache = cache2; + cache2 = create(null); waiting = create(null); promises = create(null); conf.emit('clearasync', objectMap(oldCache, function(data2) { @@ -3204,8 +3220,8 @@ conf.on('deleteasync', del = function del(id, resultArray) { apply.call(dispose, null, resultArray); }); - conf.on('clearasync', function(cache21) { - forEach(cache21, function(result, id) { + conf.on('clearasync', function(cache2) { + forEach(cache2, function(result, id) { del(id, result); }); }); @@ -3214,8 +3230,8 @@ conf.on('delete', del = function del(id, result) { dispose(result); }); - conf.on('clear', function(cache21) { - forEach(cache21, function(result, id) { + conf.on('clear', function(cache2) { + forEach(cache2, function(result, id) { del(id, result); }); }); @@ -3299,7 +3315,7 @@ if (preFetchAge) { preFetchTimeouts = {}; preFetchAge = (1 - preFetchAge) * maxAge; - conf.on('get' + postfix, function(id, args, context5) { + conf.on('get' + postfix, function(id, args, context) { if (!preFetchTimeouts[id]) { preFetchTimeouts[id] = 'nextTick'; nextTick(function() { @@ -3313,7 +3329,7 @@ args = aFrom(args); args.push(noop3); } - result = conf.memoized.apply(context5, args); + result = conf.memoized.apply(context, args); if (options.promise) { if (isPromise(result)) { if (typeof result.done === 'function') { @@ -3350,27 +3366,27 @@ var create = Object.create; var hasOwnProperty2 = Object.prototype.hasOwnProperty; module.exports = function(limit) { - var size = 0, base = 1, queue4 = create(null), map = create(null), index = 0, del; + var size = 0, base = 1, queue2 = create(null), map = create(null), index = 0, del; limit = toPosInt(limit); return { hit: function hit(id) { var oldIndex = map[id], nuIndex = ++index; - queue4[nuIndex] = id; + queue2[nuIndex] = id; map[id] = nuIndex; if (!oldIndex) { ++size; if (size <= limit) { return; } - id = queue4[base]; + id = queue2[base]; del(id); return id; } - delete queue4[oldIndex]; + delete queue2[oldIndex]; if (base !== oldIndex) { return; } - while (!hasOwnProperty2.call(queue4, ++base)) { + while (!hasOwnProperty2.call(queue2, ++base)) { continue; } }, @@ -3379,7 +3395,7 @@ if (!oldIndex) { return; } - delete queue4[oldIndex]; + delete queue2[oldIndex]; delete map[id]; --size; if (base !== oldIndex) { @@ -3390,14 +3406,14 @@ base = 1; return; } - while (!hasOwnProperty2.call(queue4, ++base)) { + while (!hasOwnProperty2.call(queue2, ++base)) { continue; } }, clear: function clear() { size = 0; base = 1; - queue4 = create(null); + queue2 = create(null); map = create(null); index = 0; } @@ -3410,23 +3426,23 @@ var lruQueue = require_lru_queue(); var extensions = require_registered_extensions(); extensions.max = function(max, conf, options) { - var postfix, queue4, hit; + var postfix, queue2, hit; max = toPosInteger(max); if (!max) { return; } - queue4 = lruQueue(max); + queue2 = lruQueue(max); postfix = options.async && extensions.async || options.promise && extensions.promise ? 'async' : ''; conf.on('set' + postfix, hit = function hit(id) { - id = queue4.hit(id); + id = queue2.hit(id); if (id === void 0) { return; } conf['delete'](id); }); conf.on('get' + postfix, hit); - conf.on('delete' + postfix, queue4['delete']); - conf.on('clear' + postfix, queue4.clear); + conf.on('delete' + postfix, queue2['delete']); + conf.on('clear' + postfix, queue2.clear); }; }); var require_ref_counter = __commonJS(function() { @@ -3436,20 +3452,20 @@ var create = Object.create; var defineProperties = Object.defineProperties; extensions.refCounter = function(ignore, conf, options) { - var cache21, postfix; - cache21 = create(null); + var cache2, postfix; + cache2 = create(null); postfix = options.async && extensions.async || options.promise && extensions.promise ? 'async' : ''; conf.on('set' + postfix, function(id, length) { - cache21[id] = length || 1; + cache2[id] = length || 1; }); conf.on('get' + postfix, function(id) { - ++cache21[id]; + ++cache2[id]; }); conf.on('delete' + postfix, function(id) { - delete cache21[id]; + delete cache2[id]; }); conf.on('clear' + postfix, function() { - cache21 = {}; + cache2 = {}; }); defineProperties(conf.memoized, { deleteRef: d(function() { @@ -3457,10 +3473,10 @@ if (id === null) { return null; } - if (!cache21[id]) { + if (!cache2[id]) { return null; } - if (!--cache21[id]) { + if (!--cache2[id]) { conf['delete'](id); return true; } @@ -3471,10 +3487,10 @@ if (id === null) { return 0; } - if (!cache21[id]) { + if (!cache2[id]) { return 0; } - return cache21[id]; + return cache2[id]; }) }); }; @@ -3525,12 +3541,6 @@ return plain(fn, options); }; }); - var require_emoji_regex = __commonJS(function(exports, module) { - 'use strict'; - module.exports = function() { - return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g; - }; - }); var require_doT = __commonJS(function(exports, module) { (function() { 'use strict'; @@ -3731,8 +3741,8 @@ var vertxNext = void 0; var customSchedulerFn = void 0; var asap = function asap2(callback, arg) { - queue4[len] = callback; - queue4[len + 1] = arg; + queue2[len] = callback; + queue2[len + 1] = arg; len += 2; if (len === 2) { if (customSchedulerFn) { @@ -3790,14 +3800,14 @@ return globalSetTimeout(flush, 1); }; } - var queue4 = new Array(1e3); + var queue2 = new Array(1e3); function flush() { for (var i = 0; i < len; i += 2) { - var callback = queue4[i]; - var arg = queue4[i + 1]; + var callback = queue2[i]; + var arg = queue2[i + 1]; callback(arg); - queue4[i] = void 0; - queue4[i + 1] = void 0; + queue2[i] = void 0; + queue2[i + 1] = void 0; } len = 0; } @@ -4225,10 +4235,10 @@ }); }); var require_typedarray = __commonJS(function(exports) { - var undefined2 = void 0; var MAX_ARRAY_LENGTH = 1e5; var ECMAScript = function() { - var opts = Object.prototype.toString, ophop = Object.prototype.hasOwnProperty; + var opts = Object.prototype.toString; + var ophop = Object.prototype.hasOwnProperty; return { Class: function Class(v) { return opts.call(v).replace(/^\[object *|\]$/g, ''); @@ -4253,23 +4263,25 @@ var LN2 = Math.LN2; var abs = Math.abs; var floor = Math.floor; - var log9 = Math.log; + var log2 = Math.log; var min = Math.min; var pow = Math.pow; var round = Math.round; - function configureProperties(obj) { - if (getOwnPropNames && defineProp) { - var props = getOwnPropNames(obj), i; - for (i = 0; i < props.length; i += 1) { - defineProp(obj, props[i], { - value: obj[props[i]], - writable: false, - enumerable: false, - configurable: false - }); + function clamp2(v, minimum, max) { + return v < minimum ? minimum : v > max ? max : v; + } + var getOwnPropNames = Object.getOwnPropertyNames || function(o) { + if (o !== Object(o)) { + throw new TypeError('Object.getOwnPropertyNames called on non-object'); + } + var props = [], p; + for (p in o) { + if (ECMAScript.HasOwnProperty(o, p)) { + props.push(p); } } - } + return props; + }; var defineProp; if (Object.defineProperty && function() { try { @@ -4297,18 +4309,19 @@ return o; }; } - var getOwnPropNames = Object.getOwnPropertyNames || function(o) { - if (o !== Object(o)) { - throw new TypeError('Object.getOwnPropertyNames called on non-object'); - } - var props = [], p; - for (p in o) { - if (ECMAScript.HasOwnProperty(o, p)) { - props.push(p); + function configureProperties(obj) { + if (getOwnPropNames && defineProp) { + var props = getOwnPropNames(obj), i; + for (i = 0; i < props.length; i += 1) { + defineProp(obj, props[i], { + value: obj[props[i]], + writable: false, + enumerable: false, + configurable: false + }); } } - return props; - }; + } function makeArrayAccessors(obj) { if (!defineProp) { return; @@ -4382,13 +4395,15 @@ return as_unsigned(bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], 32); } function packIEEE754(v, ebits, fbits) { - var bias = (1 << ebits - 1) - 1, s, e, f, ln, i, bits, str, bytes; + var bias = (1 << ebits - 1) - 1; + var s, e, f, i, bits, str, bytes; function roundToEven(n) { - var w = floor(n), f2 = n - w; - if (f2 < .5) { + var w = floor(n); + var fl = n - w; + if (fl < .5) { return w; } - if (f2 > .5) { + if (fl > .5) { return w + 1; } return w % 2 ? w + 1 : w; @@ -4409,7 +4424,7 @@ s = v < 0; v = abs(v); if (v >= pow(2, 1 - bias)) { - e = min(floor(log9(v) / LN2), 1023); + e = min(floor(log2(v) / LN2), 1023); f = roundToEven(v / pow(2, e) * pow(2, fbits)); if (f / pow(2, fbits) >= 2) { e = e + 1; @@ -4462,14 +4477,13 @@ e = parseInt(str.substring(1, 1 + ebits), 2); f = parseInt(str.substring(1 + ebits), 2); if (e === (1 << ebits) - 1) { - return f !== 0 ? NaN : s * Infinity; + return f === 0 ? s * Infinity : NaN; } else if (e > 0) { return s * pow(2, e - bias) * (1 + f / pow(2, fbits)); } else if (f !== 0) { return s * pow(2, -(bias - 1)) * (f / pow(2, fbits)); - } else { - return s < 0 ? -0 : 0; } + return s < 0 ? -0 : 0; } function unpackF64(b) { return unpackIEEE754(b, 11, 52); @@ -4484,7 +4498,7 @@ return packIEEE754(v, 8, 23); } (function() { - var ArrayBuffer = function ArrayBuffer2(length) { + function ArrayBuffer(length) { length = ECMAScript.ToInt32(length); if (length < 0) { throw new RangeError('ArrayBuffer size is not a small enough positive integer'); @@ -4497,9 +4511,9 @@ this._bytes[i] = 0; } configureProperties(this); - }; + } exports.ArrayBuffer = exports.ArrayBuffer || ArrayBuffer; - var ArrayBufferView = function ArrayBufferView2() {}; + function ArrayBufferView() {} function makeConstructor(bytesPerElement, pack, unpack) { var _ctor; _ctor = function ctor(buffer, byteOffset, length) { @@ -4571,10 +4585,10 @@ } index = ECMAScript.ToUint32(index); if (index >= this.length) { - return undefined2; + return void 0; } - var bytes = [], i, o; - for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; i < this.BYTES_PER_ELEMENT; i += 1, + var bytes = []; + for (var i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; i < this.BYTES_PER_ELEMENT; i += 1, o += 1) { bytes.push(this.buffer._bytes[o]); } @@ -4586,13 +4600,14 @@ throw new SyntaxError('Not enough arguments'); } index = ECMAScript.ToUint32(index); - if (index >= this.length) { - return undefined2; - } - var bytes = this._pack(value), i, o; - for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; i < this.BYTES_PER_ELEMENT; i += 1, - o += 1) { - this.buffer._bytes[o] = bytes[i]; + if (index < this.length) { + var bytes = this._pack(value); + var i; + var o; + for (i = 0, o = this.byteOffset + index * this.BYTES_PER_ELEMENT; i < this.BYTES_PER_ELEMENT; i += 1, + o += 1) { + this.buffer._bytes[o] = bytes[i]; + } } }; _ctor.prototype.set = function(index, value) { @@ -4617,8 +4632,8 @@ this.buffer._bytes[d] = tmp[i]; } } else { - for (i = 0, s = array.byteOffset, d = byteOffset; i < byteLength; i += 1, s += 1, - d += 1) { + for (i = 0, s = array.byteOffset, d = byteOffset; i < byteLength; i += 1, + s += 1, d += 1) { this.buffer._bytes[d] = array.buffer._bytes[s]; } } @@ -4638,9 +4653,6 @@ } }; _ctor.prototype.subarray = function(start, end) { - function clamp2(v, min2, max) { - return v < min2 ? min2 : v > max ? max : v; - } start = ECMAScript.ToInt32(start); end = ECMAScript.ToInt32(end); if (arguments.length < 1) { @@ -4692,7 +4704,7 @@ var u16array = new exports.Uint16Array([ 4660 ]), u8array = new exports.Uint8Array(u16array.buffer); return r(u8array, 0) === 18; }(); - var DataView = function DataView2(buffer, byteOffset, byteLength) { + function DataView(buffer, byteOffset, byteLength) { if (arguments.length === 0) { buffer = new exports.ArrayBuffer(0); } else if (!(buffer instanceof exports.ArrayBuffer || ECMAScript.Class(buffer) === 'ArrayBuffer')) { @@ -4712,7 +4724,7 @@ throw new RangeError('byteOffset and length reference an area beyond the end of the buffer'); } configureProperties(this); - }; + } function makeGetter(arrayType) { return function(byteOffset, littleEndian) { byteOffset = ECMAScript.ToUint32(byteOffset); @@ -4890,6 +4902,7 @@ } ]; var constants = { helpUrlBase: 'https://dequeuniversity.com/rules/', + gridSize: 200, results: [], resultGroups: [], resultGroupMap: {}, @@ -5018,7 +5031,7 @@ return extend_meta_data_default; }, filterHtmlAttrs: function filterHtmlAttrs() { - return filter_html_attrs_default; + return _filterHtmlAttrs; }, finalizeRuleResult: function finalizeRuleResult() { return finalize_result_default; @@ -5102,7 +5115,7 @@ return is_html_element_default; }, isNodeInContext: function isNodeInContext() { - return is_node_in_context_default; + return _isNodeInContext; }, isShadowRoot: function isShadowRoot() { return is_shadow_root_default; @@ -5180,7 +5193,7 @@ return rule_should_run_default; }, select: function select() { - return select_default; + return _select; }, sendCommandToFrame: function sendCommandToFrame() { return _sendCommandToFrame; @@ -5191,6 +5204,9 @@ shadowSelect: function shadowSelect() { return _shadowSelect; }, + shadowSelectAll: function shadowSelectAll() { + return _shadowSelectAll; + }, shouldPreload: function shouldPreload() { return _shouldPreload; }, @@ -5213,847 +5229,498 @@ return _validLangs; } }); - var errorTypes = Object.freeze([ 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError' ]); - function stringifyMessage(_ref) { - var topic = _ref.topic, channelId = _ref.channelId, message = _ref.message, messageId = _ref.messageId, keepalive = _ref.keepalive; - var data2 = { - channelId: channelId, - topic: topic, - messageId: messageId, - keepalive: !!keepalive, - source: getSource() - }; - if (message instanceof Error) { - data2.error = { - name: message.name, - message: message.message, - stack: message.stack - }; - } else { - data2.payload = message; - } - return JSON.stringify(data2); - } - function parseMessage(dataString) { - var data2; - try { - data2 = JSON.parse(dataString); - } catch (e) { - return; - } - if (!isRespondableMessage(data2)) { - return; + function aggregate(map, values, initial) { + values = values.slice(); + if (initial) { + values.push(initial); } - var _data = data2, topic = _data.topic, channelId = _data.channelId, messageId = _data.messageId, keepalive = _data.keepalive; - var message = _typeof(data2.error) === 'object' ? buildErrorObject(data2.error) : data2.payload; - return { - topic: topic, - message: message, - messageId: messageId, - channelId: channelId, - keepalive: !!keepalive - }; + var sorting = values.map(function(val) { + return map.indexOf(val); + }).sort(); + return map[sorting.pop()]; } - function isRespondableMessage(postedMessage) { - return postedMessage !== null && _typeof(postedMessage) === 'object' && typeof postedMessage.channelId === 'string' && postedMessage.source === getSource(); + var aggregate_default = aggregate; + var CANTTELL_PRIO = constants_default.CANTTELL_PRIO, FAIL_PRIO = constants_default.FAIL_PRIO; + var checkMap = []; + checkMap[constants_default.PASS_PRIO] = true; + checkMap[constants_default.CANTTELL_PRIO] = null; + checkMap[constants_default.FAIL_PRIO] = false; + var checkTypes = [ 'any', 'all', 'none' ]; + function anyAllNone(obj, functor) { + return checkTypes.reduce(function(out, type) { + out[type] = (obj[type] || []).map(function(val) { + return functor(val, type); + }); + return out; + }, {}); } - function buildErrorObject(error) { - var msg = error.message || 'Unknown error occurred'; - var errorName = errorTypes.includes(error.name) ? error.name : 'Error'; - var ErrConstructor = window[errorName] || Error; - if (error.stack) { - msg += '\n' + error.stack.replace(error.message, ''); + function aggregateChecks(nodeResOriginal) { + var nodeResult = Object.assign({}, nodeResOriginal); + anyAllNone(nodeResult, function(check, type) { + var i = typeof check.result === 'undefined' ? -1 : checkMap.indexOf(check.result); + check.priority = i !== -1 ? i : constants_default.CANTTELL_PRIO; + if (type === 'none') { + if (check.priority === constants_default.PASS_PRIO) { + check.priority = constants_default.FAIL_PRIO; + } else if (check.priority === constants_default.FAIL_PRIO) { + check.priority = constants_default.PASS_PRIO; + } + } + }); + var priorities = { + all: nodeResult.all.reduce(function(a, b) { + return Math.max(a, b.priority); + }, 0), + none: nodeResult.none.reduce(function(a, b) { + return Math.max(a, b.priority); + }, 0), + any: nodeResult.any.reduce(function(a, b) { + return Math.min(a, b.priority); + }, 4) % 4 + }; + nodeResult.priority = Math.max(priorities.all, priorities.none, priorities.any); + var impacts = []; + checkTypes.forEach(function(type) { + nodeResult[type] = nodeResult[type].filter(function(check) { + return check.priority === nodeResult.priority && check.priority === priorities[type]; + }); + nodeResult[type].forEach(function(check) { + return impacts.push(check.impact); + }); + }); + if ([ CANTTELL_PRIO, FAIL_PRIO ].includes(nodeResult.priority)) { + nodeResult.impact = aggregate_default(constants_default.impact, impacts); + } else { + nodeResult.impact = null; } - return new ErrConstructor(msg); + anyAllNone(nodeResult, function(c) { + delete c.result; + delete c.priority; + }); + nodeResult.result = constants_default.results[nodeResult.priority]; + delete nodeResult.priority; + return nodeResult; } - function getSource() { - var application = 'axeAPI'; - var version = ''; - if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) { - application = axe._audit.application; - } - if (typeof axe !== 'undefined') { - version = axe.version; + var aggregate_checks_default = aggregateChecks; + function finalizeRuleResult(ruleResult) { + var rule = axe._audit.rules.find(function(rule2) { + return rule2.id === ruleResult.id; + }); + if (rule && rule.impact) { + ruleResult.nodes.forEach(function(node) { + [ 'any', 'all', 'none' ].forEach(function(checkType) { + (node[checkType] || []).forEach(function(checkResult) { + checkResult.impact = rule.impact; + }); + }); + }); } - return application + '.' + version; + Object.assign(ruleResult, aggregate_node_results_default(ruleResult.nodes)); + delete ruleResult.nodes; + return ruleResult; } - function assert(bool, message) { - if (!bool) { - throw new Error(message); + var finalize_result_default = finalizeRuleResult; + function aggregateNodeResults(nodeResults) { + var ruleResult = {}; + nodeResults = nodeResults.map(function(nodeResult) { + if (nodeResult.any && nodeResult.all && nodeResult.none) { + return aggregate_checks_default(nodeResult); + } else if (Array.isArray(nodeResult.node)) { + return finalize_result_default(nodeResult); + } else { + throw new TypeError('Invalid Result type'); + } + }); + if (nodeResults && nodeResults.length) { + var resultList = nodeResults.map(function(node) { + return node.result; + }); + ruleResult.result = aggregate_default(constants_default.results, resultList, ruleResult.result); + } else { + ruleResult.result = 'inapplicable'; } + constants_default.resultGroups.forEach(function(group) { + return ruleResult[group] = []; + }); + nodeResults.forEach(function(nodeResult) { + var groupName = constants_default.resultGroupMap[nodeResult.result]; + ruleResult[groupName].push(nodeResult); + }); + var impactGroup = constants_default.FAIL_GROUP; + if (ruleResult[impactGroup].length === 0) { + impactGroup = constants_default.CANTTELL_GROUP; + } + if (ruleResult[impactGroup].length > 0) { + var impactList = ruleResult[impactGroup].map(function(failure) { + return failure.impact; + }); + ruleResult.impact = aggregate_default(constants_default.impact, impactList) || null; + } else { + ruleResult.impact = null; + } + return ruleResult; } - var assert_default = assert; - function assertIsParentWindow(win) { - assetNotGlobalWindow(win); - assert_default(window.parent === win, 'Source of the response must be the parent window.'); - } - function assertIsFrameWindow(win) { - assetNotGlobalWindow(win); - assert_default(win.parent === window, 'Respondable target must be a frame in the current window'); - } - function assetNotGlobalWindow(win) { - assert_default(window !== win, 'Messages can not be sent to the same window.'); - } - var channels = {}; - function storeReplyHandler(channelId, replyHandler) { - var sendToParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - assert_default(!channels[channelId], 'A replyHandler already exists for this message channel.'); - channels[channelId] = { - replyHandler: replyHandler, - sendToParent: sendToParent - }; - } - function getReplyHandler(channelId) { - return channels[channelId]; - } - function deleteReplyHandler(channelId) { - delete channels[channelId]; - } - var uuid; - var _rng; - var _crypto = window.crypto || window.msCrypto; - if (!_rng && _crypto && _crypto.getRandomValues) { - var _rnds8 = new Uint8Array(16); - _rng = function whatwgRNG() { - _crypto.getRandomValues(_rnds8); - return _rnds8; - }; - } - if (!_rng) { - var _rnds = new Array(16); - _rng = function _rng() { - for (var i = 0, r; i < 16; i++) { - if ((i & 3) === 0) { - r = Math.random() * 4294967296; - } - _rnds[i] = r >>> ((i & 3) << 3) & 255; - } - return _rnds; - }; - } - var BufferClass = typeof window.Buffer == 'function' ? window.Buffer : Array; - var _byteToHex = []; - var _hexToByte = {}; - for (var i = 0; i < 256; i++) { - _byteToHex[i] = (i + 256).toString(16).substr(1); - _hexToByte[_byteToHex[i]] = i; + var aggregate_node_results_default = aggregateNodeResults; + function copyToGroup(resultObject, subResult, group) { + var resultCopy = Object.assign({}, subResult); + resultCopy.nodes = (resultCopy[group] || []).concat(); + constants_default.resultGroups.forEach(function(group2) { + delete resultCopy[group2]; + }); + resultObject[group].push(resultCopy); } - function parse(s, buf, offset) { - var i = buf && offset || 0, ii = 0; - buf = buf || []; - s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { - if (ii < 16) { - buf[i + ii++] = _hexToByte[oct]; + function aggregateResult(results) { + var resultObject = {}; + constants_default.resultGroups.forEach(function(groupName) { + return resultObject[groupName] = []; + }); + results.forEach(function(subResult) { + if (subResult.error) { + copyToGroup(resultObject, subResult, constants_default.CANTTELL_GROUP); + } else if (subResult.result === constants_default.NA) { + copyToGroup(resultObject, subResult, constants_default.NA_GROUP); + } else { + constants_default.resultGroups.forEach(function(group) { + if (Array.isArray(subResult[group]) && subResult[group].length > 0) { + copyToGroup(resultObject, subResult, group); + } + }); } }); - while (ii < 16) { - buf[i + ii++] = 0; - } - return buf; - } - function unparse(buf, offset) { - var i = offset || 0, bth = _byteToHex; - return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; + return resultObject; } - var _seedBytes = _rng(); - var _nodeId = [ _seedBytes[0] | 1, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] ]; - var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 16383; - var _lastMSecs = 0; - var _lastNSecs = 0; - function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - options = options || {}; - var clockseq = options.clockseq != null ? options.clockseq : _clockseq; - var msecs = options.msecs != null ? options.msecs : new Date().getTime(); - var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1; - var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; - if (dt < 0 && options.clockseq == null) { - clockseq = clockseq + 1 & 16383; - } - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) { - nsecs = 0; + var aggregate_result_default = aggregateResult; + function areStylesSet(el, styles, stopAt) { + var styl = window.getComputedStyle(el, null); + if (!styl) { + return false; } - if (nsecs >= 1e4) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); + for (var i = 0; i < styles.length; ++i) { + var att = styles[i]; + if (styl.getPropertyValue(att.property) === att.value) { + return true; + } } - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - msecs += 122192928e5; - var tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; - b[i++] = tl >>> 24 & 255; - b[i++] = tl >>> 16 & 255; - b[i++] = tl >>> 8 & 255; - b[i++] = tl & 255; - var tmh = msecs / 4294967296 * 1e4 & 268435455; - b[i++] = tmh >>> 8 & 255; - b[i++] = tmh & 255; - b[i++] = tmh >>> 24 & 15 | 16; - b[i++] = tmh >>> 16 & 255; - b[i++] = clockseq >>> 8 | 128; - b[i++] = clockseq & 255; - var node = options.node || _nodeId; - for (var n = 0; n < 6; n++) { - b[i + n] = node[n]; + if (!el.parentNode || el.nodeName.toUpperCase() === stopAt.toUpperCase()) { + return false; } - return buf ? buf : unparse(b); + return areStylesSet(el.parentNode, styles, stopAt); } - function v4(options, buf, offset) { - var i = buf && offset || 0; - if (typeof options == 'string') { - buf = options == 'binary' ? new BufferClass(16) : null; - options = null; + var are_styles_set_default = areStylesSet; + function assert(bool, message) { + if (!bool) { + throw new Error(message); } - options = options || {}; - var rnds = options.random || (options.rng || _rng)(); - rnds[6] = rnds[6] & 15 | 64; - rnds[8] = rnds[8] & 63 | 128; - if (buf) { - for (var ii = 0; ii < 16; ii++) { - buf[i + ii] = rnds[ii]; + } + var assert_default = assert; + function toArray(thing) { + return Array.prototype.slice.call(thing); + } + var to_array_default = toArray; + function escapeSelector(value) { + var string = String(value); + var length = string.length; + var index = -1; + var codeUnit; + var result = ''; + var firstCodeUnit = string.charCodeAt(0); + while (++index < length) { + codeUnit = string.charCodeAt(index); + if (codeUnit == 0) { + result += '\ufffd'; + continue; + } + if (codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || index == 0 && codeUnit >= 48 && codeUnit <= 57 || index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45) { + result += '\\' + codeUnit.toString(16) + ' '; + continue; + } + if (index == 0 && length == 1 && codeUnit == 45) { + result += '\\' + string.charAt(index); + continue; + } + if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) { + result += string.charAt(index); + continue; } + result += '\\' + string.charAt(index); } - return buf || unparse(rnds); + return result; } - uuid = v4; - uuid.v1 = v1; - uuid.v4 = v4; - uuid.parse = parse; - uuid.unparse = unparse; - uuid.BufferClass = BufferClass; - axe._uuid = v1(); - var uuid_default = v4; - var messageIds = []; - function createMessageId() { - var uuid5 = ''.concat(v4(), ':').concat(v4()); - if (messageIds.includes(uuid5)) { - return createMessageId(); - } - messageIds.push(uuid5); - return uuid5; + var escape_selector_default = escapeSelector; + function isMostlyNumbers() { + var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + return str.length !== 0 && (str.match(/[0-9]/g) || '').length >= str.length / 2; } - function isNewMessage(uuid5) { - if (messageIds.includes(uuid5)) { - return false; - } - messageIds.push(uuid5); - return true; + function splitString(str, splitIndex) { + return [ str.substring(0, splitIndex), str.substring(splitIndex) ]; } - function postMessage(win, data2, sendToParent, replyHandler) { - if (typeof replyHandler === 'function') { - storeReplyHandler(data2.channelId, replyHandler, sendToParent); - } - sendToParent ? assertIsParentWindow(win) : assertIsFrameWindow(win); - if (data2.message instanceof Error && !sendToParent) { - axe.log(data2.message); - return false; + function trimRight(str) { + return str.replace(/\s+$/, ''); + } + function uriParser(url) { + var original = url; + var protocol = '', domain = '', port = '', path = '', query = '', hash = ''; + if (url.includes('#')) { + var _splitString = splitString(url, url.indexOf('#')); + var _splitString2 = _slicedToArray(_splitString, 2); + url = _splitString2[0]; + hash = _splitString2[1]; } - var dataString = stringifyMessage(_extends({ - messageId: createMessageId() - }, data2)); - var allowedOrigins = axe._audit.allowedOrigins; - if (!allowedOrigins || !allowedOrigins.length) { - return false; + if (url.includes('?')) { + var _splitString3 = splitString(url, url.indexOf('?')); + var _splitString4 = _slicedToArray(_splitString3, 2); + url = _splitString4[0]; + query = _splitString4[1]; } - allowedOrigins.forEach(function(origin) { - try { - win.postMessage(dataString, origin); - } catch (err2) { - if (err2 instanceof win.DOMException) { - throw new Error('allowedOrigins value "'.concat(origin, '" is not a valid origin')); - } - throw err2; - } - }); - return true; - } - function processError(win, error, channelId) { - if (!win.parent !== window) { - return axe.log(error); + if (url.includes('://')) { + var _url$split = url.split('://'); + var _url$split2 = _slicedToArray(_url$split, 2); + protocol = _url$split2[0]; + url = _url$split2[1]; + var _splitString5 = splitString(url, url.indexOf('/')); + var _splitString6 = _slicedToArray(_splitString5, 2); + domain = _splitString6[0]; + url = _splitString6[1]; + } else if (url.substr(0, 2) === '//') { + url = url.substr(2); + var _splitString7 = splitString(url, url.indexOf('/')); + var _splitString8 = _slicedToArray(_splitString7, 2); + domain = _splitString8[0]; + url = _splitString8[1]; } - try { - postMessage(win, { - topic: null, - channelId: channelId, - message: error, - messageId: createMessageId(), - keepalive: true - }, true); - } catch (err2) { - return axe.log(err2); + if (domain.substr(0, 4) === 'www.') { + domain = domain.substr(4); } - } - function createResponder(win, channelId) { - var sendToParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; - return function respond(message, keepalive, replyHandler) { - var data2 = { - channelId: channelId, - message: message, - keepalive: keepalive - }; - postMessage(win, data2, sendToParent, replyHandler); + if (domain && domain.includes(':')) { + var _splitString9 = splitString(domain, domain.indexOf(':')); + var _splitString10 = _slicedToArray(_splitString9, 2); + domain = _splitString10[0]; + port = _splitString10[1]; + } + path = url; + return { + original: original, + protocol: protocol, + domain: domain, + port: port, + path: path, + query: query, + hash: hash }; } - function originIsAllowed(origin) { - var allowedOrigins = axe._audit.allowedOrigins; - return allowedOrigins && allowedOrigins.includes('*') || allowedOrigins.includes(origin); - } - function messageHandler(_ref2, topicHandler) { - var origin = _ref2.origin, dataString = _ref2.data, win = _ref2.source; - try { - var data2 = parseMessage(dataString) || {}; - var channelId = data2.channelId, message = data2.message, messageId = data2.messageId; - if (!originIsAllowed(origin) || !isNewMessage(messageId)) { + function getFriendlyUriEnd() { + var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (uri.length <= 1 || uri.substr(0, 5) === 'data:' || uri.substr(0, 11) === 'javascript:' || uri.includes('?')) { + return; + } + var currentDomain = options.currentDomain, _options$maxLength = options.maxLength, maxLength = _options$maxLength === void 0 ? 25 : _options$maxLength; + var _uriParser = uriParser(uri), path = _uriParser.path, domain = _uriParser.domain, hash = _uriParser.hash; + var pathEnd = path.substr(path.substr(0, path.length - 2).lastIndexOf('/') + 1); + if (hash) { + if (pathEnd && (pathEnd + hash).length <= maxLength) { + return trimRight(pathEnd + hash); + } else if (pathEnd.length < 2 && hash.length > 2 && hash.length <= maxLength) { + return trimRight(hash); + } else { return; } - if (message instanceof Error && win.parent !== window) { - axe.log(message); - return false; - } - try { - if (data2.topic) { - var responder = createResponder(win, channelId); - assertIsParentWindow(win); - topicHandler(data2, responder); - } else { - callReplyHandler(win, data2); - } - } catch (error) { - processError(win, error, channelId); - } - } catch (error) { - axe.log(error); - return false; + } else if (domain && domain.length < maxLength && path.length <= 1) { + return trimRight(domain + path); } - } - function callReplyHandler(win, data2) { - var channelId = data2.channelId, message = data2.message, keepalive = data2.keepalive; - var _ref3 = getReplyHandler(channelId) || {}, replyHandler = _ref3.replyHandler, sendToParent = _ref3.sendToParent; - if (!replyHandler) { - return; + if (path === '/' + pathEnd && domain && currentDomain && domain !== currentDomain && (domain + path).length <= maxLength) { + return trimRight(domain + path); } - sendToParent ? assertIsParentWindow(win) : assertIsFrameWindow(win); - var responder = createResponder(win, channelId, sendToParent); - if (!keepalive && channelId) { - deleteReplyHandler(channelId); + var lastDotIndex = pathEnd.lastIndexOf('.'); + if ((lastDotIndex === -1 || lastDotIndex > 1) && (lastDotIndex !== -1 || pathEnd.length > 2) && pathEnd.length <= maxLength && !pathEnd.match(/index(\.[a-zA-Z]{2-4})?/) && !isMostlyNumbers(pathEnd)) { + return trimRight(pathEnd); } - try { - replyHandler(message, keepalive, responder); - } catch (error) { - axe.log(error); - responder(error, keepalive); + } + var get_friendly_uri_end_default = getFriendlyUriEnd; + function getNodeAttributes(node) { + if (node.attributes instanceof window.NamedNodeMap) { + return node.attributes; } + return node.cloneNode(false).attributes; } - var frameMessenger = { - open: function open(topicHandler) { - if (typeof window.addEventListener !== 'function') { - return; + var get_node_attributes_default = getNodeAttributes; + var matchesSelector = function() { + var method; + function getMethod(node) { + var index, candidate, candidates = [ 'matches', 'matchesSelector', 'mozMatchesSelector', 'webkitMatchesSelector', 'msMatchesSelector' ], length = candidates.length; + for (index = 0; index < length; index++) { + candidate = candidates[index]; + if (node[candidate]) { + return candidate; + } } - var handler = function handler(messageEvent) { - messageHandler(messageEvent, topicHandler); - }; - window.addEventListener('message', handler, false); - return function() { - window.removeEventListener('message', handler, false); - }; - }, - post: function post(win, data2, replyHandler) { - if (typeof window.addEventListener !== 'function') { - return false; + } + return function(node, selector) { + if (!method || !node[method]) { + method = getMethod(node); } - return postMessage(win, data2, false, replyHandler); + if (node[method]) { + return node[method](selector); + } + return false; + }; + }(); + var element_matches_default = matchesSelector; + function isXHTML(doc) { + if (!doc.createElement) { + return false; } - }; - function setDefaultFrameMessenger(respondable5) { - respondable5.updateMessenger(frameMessenger); + return doc.createElement('A').localName === 'A'; } - function aggregate(map, values, initial) { - values = values.slice(); - if (initial) { - values.push(initial); + var is_xhtml_default = isXHTML; + function getShadowSelector(generateSelector2, elm) { + var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + if (!elm) { + return ''; } - var sorting = values.map(function(val) { - return map.indexOf(val); - }).sort(); - return map[sorting.pop()]; - } - var aggregate_default = aggregate; - var CANTTELL_PRIO = constants_default.CANTTELL_PRIO, FAIL_PRIO = constants_default.FAIL_PRIO; - var checkMap = []; - checkMap[constants_default.PASS_PRIO] = true; - checkMap[constants_default.CANTTELL_PRIO] = null; - checkMap[constants_default.FAIL_PRIO] = false; - var checkTypes = [ 'any', 'all', 'none' ]; - function anyAllNone(obj, functor) { - return checkTypes.reduce(function(out, type) { - out[type] = (obj[type] || []).map(function(val) { - return functor(val, type); - }); - return out; - }, {}); - } - function aggregateChecks(nodeResOriginal) { - var nodeResult = Object.assign({}, nodeResOriginal); - anyAllNone(nodeResult, function(check4, type) { - var i = typeof check4.result === 'undefined' ? -1 : checkMap.indexOf(check4.result); - check4.priority = i !== -1 ? i : constants_default.CANTTELL_PRIO; - if (type === 'none') { - if (check4.priority === constants_default.PASS_PRIO) { - check4.priority = constants_default.FAIL_PRIO; - } else if (check4.priority === constants_default.FAIL_PRIO) { - check4.priority = constants_default.PASS_PRIO; - } + var doc = elm.getRootNode && elm.getRootNode() || document; + if (doc.nodeType !== 11) { + return generateSelector2(elm, options, doc); + } + var stack = []; + while (doc.nodeType === 11) { + if (!doc.host) { + return ''; } - }); - var priorities = { - all: nodeResult.all.reduce(function(a, b) { - return Math.max(a, b.priority); - }, 0), - none: nodeResult.none.reduce(function(a, b) { - return Math.max(a, b.priority); - }, 0), - any: nodeResult.any.reduce(function(a, b) { - return Math.min(a, b.priority); - }, 4) % 4 - }; - nodeResult.priority = Math.max(priorities.all, priorities.none, priorities.any); - var impacts = []; - checkTypes.forEach(function(type) { - nodeResult[type] = nodeResult[type].filter(function(check4) { - return check4.priority === nodeResult.priority && check4.priority === priorities[type]; - }); - nodeResult[type].forEach(function(check4) { - return impacts.push(check4.impact); + stack.unshift({ + elm: elm, + doc: doc }); - }); - if ([ CANTTELL_PRIO, FAIL_PRIO ].includes(nodeResult.priority)) { - nodeResult.impact = aggregate_default(constants_default.impact, impacts); - } else { - nodeResult.impact = null; + elm = doc.host; + doc = elm.getRootNode(); } - anyAllNone(nodeResult, function(c) { - delete c.result; - delete c.priority; + stack.unshift({ + elm: elm, + doc: doc }); - nodeResult.result = constants_default.results[nodeResult.priority]; - delete nodeResult.priority; - return nodeResult; - } - var aggregate_checks_default = aggregateChecks; - function finalizeRuleResult(ruleResult) { - var rule3 = axe._audit.rules.find(function(rule4) { - return rule4.id === ruleResult.id; + return stack.map(function(_ref) { + var elm2 = _ref.elm, doc2 = _ref.doc; + return generateSelector2(elm2, options, doc2); }); - if (rule3 && rule3.impact) { - ruleResult.nodes.forEach(function(node) { - [ 'any', 'all', 'none' ].forEach(function(checkType) { - (node[checkType] || []).forEach(function(checkResult) { - checkResult.impact = rule3.impact; - }); - }); - }); - } - Object.assign(ruleResult, aggregate_node_results_default(ruleResult.nodes)); - delete ruleResult.nodes; - return ruleResult; } - var finalize_result_default = finalizeRuleResult; - function aggregateNodeResults(nodeResults) { - var ruleResult = {}; - nodeResults = nodeResults.map(function(nodeResult) { - if (nodeResult.any && nodeResult.all && nodeResult.none) { - return aggregate_checks_default(nodeResult); - } else if (Array.isArray(nodeResult.node)) { - return finalize_result_default(nodeResult); + var get_shadow_selector_default = getShadowSelector; + var xhtml; + var ignoredAttributes = [ 'class', 'style', 'id', 'selected', 'checked', 'disabled', 'tabindex', 'aria-checked', 'aria-selected', 'aria-invalid', 'aria-activedescendant', 'aria-busy', 'aria-disabled', 'aria-expanded', 'aria-grabbed', 'aria-pressed', 'aria-valuenow' ]; + var MAXATTRIBUTELENGTH = 31; + var attrCharsRegex = /([\\"])/g; + var newlineChars = /(\r\n|\r|\n)/g; + function escapeAttribute(str) { + return str.replace(attrCharsRegex, '\\$1').replace(newlineChars, '\\a '); + } + function getAttributeNameValue(node, at) { + var name = at.name; + var atnv; + if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) { + var friendly = get_friendly_uri_end_default(node.getAttribute(name)); + if (friendly) { + atnv = escape_selector_default(at.name) + '$="' + escapeAttribute(friendly) + '"'; } else { - throw new TypeError('Invalid Result type'); + atnv = escape_selector_default(at.name) + '="' + escapeAttribute(node.getAttribute(name)) + '"'; } - }); - if (nodeResults && nodeResults.length) { - var resultList = nodeResults.map(function(node) { - return node.result; - }); - ruleResult.result = aggregate_default(constants_default.results, resultList, ruleResult.result); - } else { - ruleResult.result = 'inapplicable'; - } - constants_default.resultGroups.forEach(function(group) { - return ruleResult[group] = []; - }); - nodeResults.forEach(function(nodeResult) { - var groupName = constants_default.resultGroupMap[nodeResult.result]; - ruleResult[groupName].push(nodeResult); - }); - var impactGroup = constants_default.FAIL_GROUP; - if (ruleResult[impactGroup].length === 0) { - impactGroup = constants_default.CANTTELL_GROUP; - } - if (ruleResult[impactGroup].length > 0) { - var impactList = ruleResult[impactGroup].map(function(failure) { - return failure.impact; - }); - ruleResult.impact = aggregate_default(constants_default.impact, impactList) || null; } else { - ruleResult.impact = null; + atnv = escape_selector_default(name) + '="' + escapeAttribute(at.value) + '"'; } - return ruleResult; - } - var aggregate_node_results_default = aggregateNodeResults; - function copyToGroup(resultObject, subResult, group) { - var resultCopy = Object.assign({}, subResult); - resultCopy.nodes = (resultCopy[group] || []).concat(); - constants_default.resultGroups.forEach(function(group2) { - delete resultCopy[group2]; - }); - resultObject[group].push(resultCopy); - } - function aggregateResult(results) { - var resultObject = {}; - constants_default.resultGroups.forEach(function(groupName) { - return resultObject[groupName] = []; - }); - results.forEach(function(subResult) { - if (subResult.error) { - copyToGroup(resultObject, subResult, constants_default.CANTTELL_GROUP); - } else if (subResult.result === constants_default.NA) { - copyToGroup(resultObject, subResult, constants_default.NA_GROUP); - } else { - constants_default.resultGroups.forEach(function(group) { - if (Array.isArray(subResult[group]) && subResult[group].length > 0) { - copyToGroup(resultObject, subResult, group); - } - }); - } - }); - return resultObject; + return atnv; } - var aggregate_result_default = aggregateResult; - function areStylesSet(el, styles, stopAt) { - var styl = window.getComputedStyle(el, null); - if (!styl) { - return false; - } - for (var i = 0; i < styles.length; ++i) { - var att = styles[i]; - if (styl.getPropertyValue(att.property) === att.value) { - return true; - } - } - if (!el.parentNode || el.nodeName.toUpperCase() === stopAt.toUpperCase()) { - return false; - } - return areStylesSet(el.parentNode, styles, stopAt); + function countSort(a, b) { + return a.count < b.count ? -1 : a.count === b.count ? 0 : 1; } - var are_styles_set_default = areStylesSet; - function toArray(thing) { - return Array.prototype.slice.call(thing); + function filterAttributes(at) { + return !ignoredAttributes.includes(at.name) && at.name.indexOf(':') === -1 && (!at.value || at.value.length < MAXATTRIBUTELENGTH); } - var to_array_default = toArray; - function escapeSelector(value) { - var string = String(value); - var length = string.length; - var index = -1; - var codeUnit; - var result = ''; - var firstCodeUnit = string.charCodeAt(0); - while (++index < length) { - codeUnit = string.charCodeAt(index); - if (codeUnit == 0) { - result += '\ufffd'; - continue; - } - if (codeUnit >= 1 && codeUnit <= 31 || codeUnit == 127 || index == 0 && codeUnit >= 48 && codeUnit <= 57 || index == 1 && codeUnit >= 48 && codeUnit <= 57 && firstCodeUnit == 45) { - result += '\\' + codeUnit.toString(16) + ' '; - continue; + function _getSelectorData(domTree) { + var data2 = { + classes: {}, + tags: {}, + attributes: {} + }; + domTree = Array.isArray(domTree) ? domTree : [ domTree ]; + var currentLevel = domTree.slice(); + var stack = []; + var _loop2 = function _loop2() { + var current = currentLevel.pop(); + var node = current.actualNode; + if (!!node.querySelectorAll) { + var tag = node.nodeName; + if (data2.tags[tag]) { + data2.tags[tag]++; + } else { + data2.tags[tag] = 1; + } + if (node.classList) { + Array.from(node.classList).forEach(function(cl) { + var ind = escape_selector_default(cl); + if (data2.classes[ind]) { + data2.classes[ind]++; + } else { + data2.classes[ind] = 1; + } + }); + } + if (node.hasAttributes()) { + Array.from(get_node_attributes_default(node)).filter(filterAttributes).forEach(function(at) { + var atnv = getAttributeNameValue(node, at); + if (atnv) { + if (data2.attributes[atnv]) { + data2.attributes[atnv]++; + } else { + data2.attributes[atnv] = 1; + } + } + }); + } } - if (index == 0 && length == 1 && codeUnit == 45) { - result += '\\' + string.charAt(index); - continue; + if (current.children.length) { + stack.push(currentLevel); + currentLevel = current.children.slice(); } - if (codeUnit >= 128 || codeUnit == 45 || codeUnit == 95 || codeUnit >= 48 && codeUnit <= 57 || codeUnit >= 65 && codeUnit <= 90 || codeUnit >= 97 && codeUnit <= 122) { - result += string.charAt(index); - continue; + while (!currentLevel.length && stack.length) { + currentLevel = stack.pop(); } - result += '\\' + string.charAt(index); + }; + while (currentLevel.length) { + _loop2(); } - return result; - } - var escape_selector_default = escapeSelector; - function isMostlyNumbers() { - var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - return str.length !== 0 && (str.match(/[0-9]/g) || '').length >= str.length / 2; - } - function splitString(str, splitIndex) { - return [ str.substring(0, splitIndex), str.substring(splitIndex) ]; + return data2; } - function trimRight(str) { - return str.replace(/\s+$/, ''); + function uncommonClasses(node, selectorData) { + var retVal = []; + var classData = selectorData.classes; + var tagData = selectorData.tags; + if (node.classList) { + Array.from(node.classList).forEach(function(cl) { + var ind = escape_selector_default(cl); + if (classData[ind] < tagData[node.nodeName]) { + retVal.push({ + name: ind, + count: classData[ind], + species: 'class' + }); + } + }); + } + return retVal.sort(countSort); } - function uriParser(url) { - var original = url; - var protocol = '', domain = '', port = '', path = '', query = '', hash = ''; - if (url.includes('#')) { - var _splitString = splitString(url, url.indexOf('#')); - var _splitString2 = _slicedToArray(_splitString, 2); - url = _splitString2[0]; - hash = _splitString2[1]; + function getNthChildString(elm, selector) { + var siblings = elm.parentNode && Array.from(elm.parentNode.children || '') || []; + var hasMatchingSiblings = siblings.find(function(sibling) { + return sibling !== elm && element_matches_default(sibling, selector); + }); + if (hasMatchingSiblings) { + var nthChild = 1 + siblings.indexOf(elm); + return ':nth-child(' + nthChild + ')'; + } else { + return ''; } - if (url.includes('?')) { - var _splitString3 = splitString(url, url.indexOf('?')); - var _splitString4 = _slicedToArray(_splitString3, 2); - url = _splitString4[0]; - query = _splitString4[1]; - } - if (url.includes('://')) { - var _url$split = url.split('://'); - var _url$split2 = _slicedToArray(_url$split, 2); - protocol = _url$split2[0]; - url = _url$split2[1]; - var _splitString5 = splitString(url, url.indexOf('/')); - var _splitString6 = _slicedToArray(_splitString5, 2); - domain = _splitString6[0]; - url = _splitString6[1]; - } else if (url.substr(0, 2) === '//') { - url = url.substr(2); - var _splitString7 = splitString(url, url.indexOf('/')); - var _splitString8 = _slicedToArray(_splitString7, 2); - domain = _splitString8[0]; - url = _splitString8[1]; - } - if (domain.substr(0, 4) === 'www.') { - domain = domain.substr(4); - } - if (domain && domain.includes(':')) { - var _splitString9 = splitString(domain, domain.indexOf(':')); - var _splitString10 = _slicedToArray(_splitString9, 2); - domain = _splitString10[0]; - port = _splitString10[1]; - } - path = url; - return { - original: original, - protocol: protocol, - domain: domain, - port: port, - path: path, - query: query, - hash: hash - }; - } - function getFriendlyUriEnd() { - var uri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (uri.length <= 1 || uri.substr(0, 5) === 'data:' || uri.substr(0, 11) === 'javascript:' || uri.includes('?')) { - return; - } - var currentDomain = options.currentDomain, _options$maxLength = options.maxLength, maxLength = _options$maxLength === void 0 ? 25 : _options$maxLength; - var _uriParser = uriParser(uri), path = _uriParser.path, domain = _uriParser.domain, hash = _uriParser.hash; - var pathEnd = path.substr(path.substr(0, path.length - 2).lastIndexOf('/') + 1); - if (hash) { - if (pathEnd && (pathEnd + hash).length <= maxLength) { - return trimRight(pathEnd + hash); - } else if (pathEnd.length < 2 && hash.length > 2 && hash.length <= maxLength) { - return trimRight(hash); - } else { - return; - } - } else if (domain && domain.length < maxLength && path.length <= 1) { - return trimRight(domain + path); - } - if (path === '/' + pathEnd && domain && currentDomain && domain !== currentDomain && (domain + path).length <= maxLength) { - return trimRight(domain + path); - } - var lastDotIndex = pathEnd.lastIndexOf('.'); - if ((lastDotIndex === -1 || lastDotIndex > 1) && (lastDotIndex !== -1 || pathEnd.length > 2) && pathEnd.length <= maxLength && !pathEnd.match(/index(\.[a-zA-Z]{2-4})?/) && !isMostlyNumbers(pathEnd)) { - return trimRight(pathEnd); - } - } - var get_friendly_uri_end_default = getFriendlyUriEnd; - function getNodeAttributes(node) { - if (node.attributes instanceof window.NamedNodeMap) { - return node.attributes; - } - return node.cloneNode(false).attributes; - } - var get_node_attributes_default = getNodeAttributes; - var matchesSelector = function() { - var method; - function getMethod(node) { - var index, candidate, candidates = [ 'matches', 'matchesSelector', 'mozMatchesSelector', 'webkitMatchesSelector', 'msMatchesSelector' ], length = candidates.length; - for (index = 0; index < length; index++) { - candidate = candidates[index]; - if (node[candidate]) { - return candidate; - } - } - } - return function(node, selector) { - if (!method || !node[method]) { - method = getMethod(node); - } - if (node[method]) { - return node[method](selector); - } - return false; - }; - }(); - var element_matches_default = matchesSelector; - function isXHTML(doc) { - if (!doc.createElement) { - return false; - } - return doc.createElement('A').localName === 'A'; - } - var is_xhtml_default = isXHTML; - function getShadowSelector(generateSelector2, elm) { - var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; - if (!elm) { - return ''; - } - var doc = elm.getRootNode && elm.getRootNode() || document; - if (doc.nodeType !== 11) { - return generateSelector2(elm, options, doc); - } - var stack = []; - while (doc.nodeType === 11) { - if (!doc.host) { - return ''; - } - stack.unshift({ - elm: elm, - doc: doc - }); - elm = doc.host; - doc = elm.getRootNode(); - } - stack.unshift({ - elm: elm, - doc: doc - }); - return stack.map(function(_ref4) { - var elm2 = _ref4.elm, doc2 = _ref4.doc; - return generateSelector2(elm2, options, doc2); - }); - } - var get_shadow_selector_default = getShadowSelector; - var xhtml; - var ignoredAttributes = [ 'class', 'style', 'id', 'selected', 'checked', 'disabled', 'tabindex', 'aria-checked', 'aria-selected', 'aria-invalid', 'aria-activedescendant', 'aria-busy', 'aria-disabled', 'aria-expanded', 'aria-grabbed', 'aria-pressed', 'aria-valuenow' ]; - var MAXATTRIBUTELENGTH = 31; - var attrCharsRegex = /([\\"])/g; - var newlineChars = /(\r\n|\r|\n)/g; - function escapeAttribute(str) { - return str.replace(attrCharsRegex, '\\$1').replace(newlineChars, '\\a '); - } - function getAttributeNameValue(node, at) { - var name = at.name; - var atnv; - if (name.indexOf('href') !== -1 || name.indexOf('src') !== -1) { - var friendly = get_friendly_uri_end_default(node.getAttribute(name)); - if (friendly) { - atnv = escape_selector_default(at.name) + '$="' + escapeAttribute(friendly) + '"'; - } else { - atnv = escape_selector_default(at.name) + '="' + escapeAttribute(node.getAttribute(name)) + '"'; - } - } else { - atnv = escape_selector_default(name) + '="' + escapeAttribute(at.value) + '"'; - } - return atnv; - } - function countSort(a, b) { - return a.count < b.count ? -1 : a.count === b.count ? 0 : 1; - } - function filterAttributes(at) { - return !ignoredAttributes.includes(at.name) && at.name.indexOf(':') === -1 && (!at.value || at.value.length < MAXATTRIBUTELENGTH); - } - function _getSelectorData(domTree) { - var data2 = { - classes: {}, - tags: {}, - attributes: {} - }; - domTree = Array.isArray(domTree) ? domTree : [ domTree ]; - var currentLevel = domTree.slice(); - var stack = []; - var _loop2 = function _loop2() { - var current = currentLevel.pop(); - var node = current.actualNode; - if (!!node.querySelectorAll) { - var tag = node.nodeName; - if (data2.tags[tag]) { - data2.tags[tag]++; - } else { - data2.tags[tag] = 1; - } - if (node.classList) { - Array.from(node.classList).forEach(function(cl) { - var ind = escape_selector_default(cl); - if (data2.classes[ind]) { - data2.classes[ind]++; - } else { - data2.classes[ind] = 1; - } - }); - } - if (node.hasAttributes()) { - Array.from(get_node_attributes_default(node)).filter(filterAttributes).forEach(function(at) { - var atnv = getAttributeNameValue(node, at); - if (atnv) { - if (data2.attributes[atnv]) { - data2.attributes[atnv]++; - } else { - data2.attributes[atnv] = 1; - } - } - }); - } - } - if (current.children.length) { - stack.push(currentLevel); - currentLevel = current.children.slice(); - } - while (!currentLevel.length && stack.length) { - currentLevel = stack.pop(); - } - }; - while (currentLevel.length) { - _loop2(); - } - return data2; - } - function uncommonClasses(node, selectorData) { - var retVal = []; - var classData = selectorData.classes; - var tagData = selectorData.tags; - if (node.classList) { - Array.from(node.classList).forEach(function(cl) { - var ind = escape_selector_default(cl); - if (classData[ind] < tagData[node.nodeName]) { - retVal.push({ - name: ind, - count: classData[ind], - species: 'class' - }); - } - }); - } - return retVal.sort(countSort); - } - function getNthChildString(elm, selector) { - var siblings = elm.parentNode && Array.from(elm.parentNode.children || '') || []; - var hasMatchingSiblings = siblings.find(function(sibling) { - return sibling !== elm && element_matches_default(sibling, selector); - }); - if (hasMatchingSiblings) { - var nthChild = 1 + siblings.indexOf(elm); - return ':nth-child(' + nthChild + ')'; - } else { - return ''; - } - } - function getElmId(elm) { - if (!elm.getAttribute('id')) { - return; + } + function getElmId(elm) { + if (!elm.getAttribute('id')) { + return; } var doc = elm.getRootNode && elm.getRootNode() || document; var id = '#' + escape_selector_default(elm.getAttribute('id') || ''); @@ -6243,15 +5910,32 @@ var _cache = {}; var cache = { set: function set(key, value) { + validateKey(key); _cache[key] = value; }, - get: function get(key) { - return _cache[key]; + get: function get(key, creator) { + validateCreator(creator); + if (key in _cache) { + return _cache[key]; + } + if (typeof creator === 'function') { + var value = creator(); + assert_default(value !== void 0, 'Cache creator function should not return undefined'); + this.set(key, value); + return _cache[key]; + } }, clear: function clear() { _cache = {}; } }; + function validateKey(key) { + assert_default(typeof key === 'string', 'key must be a string, ' + _typeof(key) + ' given'); + assert_default(key !== '', 'key must not be empty'); + } + function validateCreator(creator) { + assert_default(typeof creator === 'function' || typeof creator === 'undefined', 'creator must be a function or undefined, ' + _typeof(creator) + ' given'); + } var cache_default = cache; function getNodeFromTree(vNode, node) { var el = node || vNode; @@ -6266,13 +5950,13 @@ } return str; } - function getSource2(element) { + function getSource(element) { if (!(element !== null && element !== void 0 && element.outerHTML)) { return ''; } var source = element.outerHTML; - if (!source && typeof XMLSerializer === 'function') { - source = new XMLSerializer().serializeToString(element); + if (!source && typeof window.XMLSerializer === 'function') { + source = new window.XMLSerializer().serializeToString(element); } return truncate(source || ''); } @@ -6303,7 +5987,7 @@ this.source = null; if (!axe._audit.noHtml) { var _this$spec$source; - this.source = (_this$spec$source = this.spec.source) !== null && _this$spec$source !== void 0 ? _this$spec$source : getSource2(this._element); + this.source = (_this$spec$source = this.spec.source) !== null && _this$spec$source !== void 0 ? _this$spec$source : getSource(this._element); } } DqElement.prototype = { @@ -6398,8 +6082,8 @@ return out; } var clone_default = clone; - var css_selector_parser = __toModule(require_lib()); - var parser = new css_selector_parser.CssSelectorParser(); + var import_css_selector_parser = __toModule(require_lib()); + var parser = new import_css_selector_parser.CssSelectorParser(); parser.registerSelectorPseudos('not'); parser.registerSelectorPseudos('is'); parser.registerNestingOperators('>'); @@ -6416,7 +6100,7 @@ function matchesAttributes(vNode, exp) { return !exp.attributes || exp.attributes.every(function(att) { var nodeAtt = vNode.attr(att.key); - return nodeAtt !== null && (!att.value || att.test(nodeAtt)); + return nodeAtt !== null && att.test(nodeAtt); }); } function matchesId(vNode, exp) { @@ -6495,7 +6179,7 @@ default: test = function test(value) { - return !!value; + return value !== null; }; } if (attributeValue === '' && /^[*$^]=$/.test(att.operator)) { @@ -6511,6 +6195,7 @@ return { key: attributeKey, value: attributeValue, + type: typeof att.value === 'undefined' ? 'attrExist' : 'attrValue', test: test }; }); @@ -6548,17 +6233,17 @@ function convertExpressions(expressions) { return expressions.map(function(exp) { var newExp = []; - var rule3 = exp.rule; - while (rule3) { + var rule = exp.rule; + while (rule) { newExp.push({ - tag: rule3.tagName ? rule3.tagName.toLowerCase() : '*', - combinator: rule3.nestingOperator ? rule3.nestingOperator : ' ', - id: rule3.id, - attributes: convertAttributes(rule3.attrs), - classes: convertClasses(rule3.classNames), - pseudos: convertPseudos(rule3.pseudos) + tag: rule.tagName ? rule.tagName.toLowerCase() : '*', + combinator: rule.nestingOperator ? rule.nestingOperator : ' ', + id: rule.id, + attributes: convertAttributes(rule.attrs), + classes: convertClasses(rule.classNames), + pseudos: convertPseudos(rule.pseudos) }); - rule3 = rule3.rule; + rule = rule.rule; } return newExp; }); @@ -6569,20 +6254,23 @@ return convertExpressions(expressions); } function optimizedMatchesExpression(vNode, expressions, index, matchAnyParent) { + if (!vNode) { + return false; + } var isArray = Array.isArray(expressions); var expression = isArray ? expressions[index] : expressions; - var matches14 = matchExpression(vNode, expression); - while (!matches14 && matchAnyParent && vNode.parent) { + var matches4 = matchExpression(vNode, expression); + while (!matches4 && matchAnyParent && vNode.parent) { vNode = vNode.parent; - matches14 = matchExpression(vNode, expression); + matches4 = matchExpression(vNode, expression); } if (index > 0) { if ([ ' ', '>' ].includes(expression.combinator) === false) { throw new Error('axe.utils.matchesExpression does not support the combinator: ' + expression.combinator); } - matches14 = matches14 && optimizedMatchesExpression(vNode.parent, expressions, index - 1, expression.combinator === ' '); + matches4 = matches4 && optimizedMatchesExpression(vNode.parent, expressions, index - 1, expression.combinator === ' '); } - return matches14; + return matches4; } function _matchesExpression(vNode, expressions, matchAnyParent) { return optimizedMatchesExpression(vNode, expressions, expressions.length - 1, matchAnyParent); @@ -6706,632 +6394,919 @@ return q; } var queue_default = queue; - var closeHandler; - var postMessage2; - var topicHandlers = {}; - function _respondable(win, topic, message, keepalive, replyHandler) { - var data2 = { - topic: topic, - message: message, - channelId: ''.concat(v4(), ':').concat(v4()), - keepalive: keepalive + var uuid; + var _rng; + var _crypto = window.crypto || window.msCrypto; + if (!_rng && _crypto && _crypto.getRandomValues) { + _rnds8 = new Uint8Array(16); + _rng = function whatwgRNG() { + _crypto.getRandomValues(_rnds8); + return _rnds8; }; - return postMessage2(win, data2, replyHandler); } - function messageListener(data2, responder) { - var topic = data2.topic, message = data2.message, keepalive = data2.keepalive; - var topicHandler = topicHandlers[topic]; - if (!topicHandler) { - return; + var _rnds8; + if (!_rng) { + _rnds = new Array(16); + _rng = function _rng() { + for (var i = 0, r; i < 16; i++) { + if ((i & 3) === 0) { + r = Math.random() * 4294967296; + } + _rnds[i] = r >>> ((i & 3) << 3) & 255; + } + return _rnds; + }; + } + var _rnds; + var BufferClass = typeof window.Buffer == 'function' ? window.Buffer : Array; + var _byteToHex = []; + var _hexToByte = {}; + for (var i = 0; i < 256; i++) { + _byteToHex[i] = (i + 256).toString(16).substr(1); + _hexToByte[_byteToHex[i]] = i; + } + function parse(s, buf, offset) { + var i = buf && offset || 0, ii = 0; + buf = buf || []; + s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { + if (ii < 16) { + buf[i + ii++] = _hexToByte[oct]; + } + }); + while (ii < 16) { + buf[i + ii++] = 0; } - try { - topicHandler(message, keepalive, responder); - } catch (error) { - axe.log(error); - responder(error, keepalive); + return buf; + } + function unparse(buf, offset) { + var i = offset || 0, bth = _byteToHex; + return bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + '-' + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]] + bth[buf[i++]]; + } + var _seedBytes = _rng(); + var _nodeId = [ _seedBytes[0] | 1, _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] ]; + var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 16383; + var _lastMSecs = 0; + var _lastNSecs = 0; + function v1(options, buf, offset) { + var i = buf && offset || 0; + var b = buf || []; + options = options || {}; + var clockseq = options.clockseq != null ? options.clockseq : _clockseq; + var msecs = options.msecs != null ? options.msecs : new Date().getTime(); + var nsecs = options.nsecs != null ? options.nsecs : _lastNSecs + 1; + var dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 1e4; + if (dt < 0 && options.clockseq == null) { + clockseq = clockseq + 1 & 16383; + } + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) { + nsecs = 0; + } + if (nsecs >= 1e4) { + throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); + } + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; + msecs += 122192928e5; + var tl = ((msecs & 268435455) * 1e4 + nsecs) % 4294967296; + b[i++] = tl >>> 24 & 255; + b[i++] = tl >>> 16 & 255; + b[i++] = tl >>> 8 & 255; + b[i++] = tl & 255; + var tmh = msecs / 4294967296 * 1e4 & 268435455; + b[i++] = tmh >>> 8 & 255; + b[i++] = tmh & 255; + b[i++] = tmh >>> 24 & 15 | 16; + b[i++] = tmh >>> 16 & 255; + b[i++] = clockseq >>> 8 | 128; + b[i++] = clockseq & 255; + var node = options.node || _nodeId; + for (var n = 0; n < 6; n++) { + b[i + n] = node[n]; } + return buf ? buf : unparse(b); } - _respondable.updateMessenger = function updateMessenger(_ref5) { - var open = _ref5.open, post = _ref5.post; - assert_default(typeof open === 'function', 'open callback must be a function'); - assert_default(typeof post === 'function', 'post callback must be a function'); - if (closeHandler) { - closeHandler(); + function v4(options, buf, offset) { + var i = buf && offset || 0; + if (typeof options == 'string') { + buf = options == 'binary' ? new BufferClass(16) : null; + options = null; } - var close = open(messageListener); - if (close) { - assert_default(typeof close === 'function', 'open callback must return a cleanup function'); - closeHandler = close; + options = options || {}; + var rnds = options.random || (options.rng || _rng)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + if (buf) { + for (var ii = 0; ii < 16; ii++) { + buf[i + ii] = rnds[ii]; + } + } + return buf || unparse(rnds); + } + uuid = v4; + uuid.v1 = v1; + uuid.v4 = v4; + uuid.parse = parse; + uuid.unparse = unparse; + uuid.BufferClass = BufferClass; + axe._uuid = v1(); + var uuid_default = v4; + var errorTypes = Object.freeze([ 'EvalError', 'RangeError', 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError' ]); + function stringifyMessage(_ref2) { + var topic = _ref2.topic, channelId = _ref2.channelId, message = _ref2.message, messageId = _ref2.messageId, keepalive = _ref2.keepalive; + var data2 = { + channelId: channelId, + topic: topic, + messageId: messageId, + keepalive: !!keepalive, + source: getSource2() + }; + if (message instanceof Error) { + data2.error = { + name: message.name, + message: message.message, + stack: message.stack + }; } else { - closeHandler = null; + data2.payload = message; } - postMessage2 = post; - }; - _respondable.subscribe = function subscribe(topic, topicHandler) { - assert_default(typeof topicHandler === 'function', 'Subscriber callback must be a function'); - assert_default(!topicHandlers[topic], 'Topic '.concat(topic, ' is already registered to.')); - topicHandlers[topic] = topicHandler; - }; - _respondable.isInFrame = function isInFrame() { - var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; - return !!win.frameElement; - }; - setDefaultFrameMessenger(_respondable); - function _sendCommandToFrame(node, parameters, resolve, reject) { - var _parameters$options$p, _parameters$options; - var win = node.contentWindow; - var pingWaitTime = (_parameters$options$p = (_parameters$options = parameters.options) === null || _parameters$options === void 0 ? void 0 : _parameters$options.pingWaitTime) !== null && _parameters$options$p !== void 0 ? _parameters$options$p : 500; - if (!win) { - log_default('Frame does not have a content window', node); - resolve(null); + return JSON.stringify(data2); + } + function parseMessage(dataString) { + var data2; + try { + data2 = JSON.parse(dataString); + } catch (e) { return; } - if (pingWaitTime === 0) { - callAxeStart(node, parameters, resolve, reject); + if (!isRespondableMessage(data2)) { return; } - var timeout = setTimeout(function() { - timeout = setTimeout(function() { - if (!parameters.debug) { - resolve(null); - } else { - reject(err('No response from frame', node)); - } - }, 0); - }, pingWaitTime); - _respondable(win, 'axe.ping', null, void 0, function() { - clearTimeout(timeout); - callAxeStart(node, parameters, resolve, reject); - }); + var _data = data2, topic = _data.topic, channelId = _data.channelId, messageId = _data.messageId, keepalive = _data.keepalive; + var message = _typeof(data2.error) === 'object' ? buildErrorObject(data2.error) : data2.payload; + return { + topic: topic, + message: message, + messageId: messageId, + channelId: channelId, + keepalive: !!keepalive + }; } - function callAxeStart(node, parameters, resolve, reject) { - var _parameters$options$f, _parameters$options2; - var frameWaitTime = (_parameters$options$f = (_parameters$options2 = parameters.options) === null || _parameters$options2 === void 0 ? void 0 : _parameters$options2.frameWaitTime) !== null && _parameters$options$f !== void 0 ? _parameters$options$f : 6e4; - var win = node.contentWindow; - var timeout = setTimeout(function collectResultFramesTimeout() { - reject(err('Axe in frame timed out', node)); - }, frameWaitTime); - _respondable(win, 'axe.start', parameters, void 0, function(data2) { - clearTimeout(timeout); - if (data2 instanceof Error === false) { - resolve(data2); - } else { - reject(data2); - } - }); + function isRespondableMessage(postedMessage) { + return postedMessage !== null && _typeof(postedMessage) === 'object' && typeof postedMessage.channelId === 'string' && postedMessage.source === getSource2(); } - function err(message, node) { - var selector; - if (axe._tree) { - selector = _getSelector(node); + function buildErrorObject(error) { + var msg = error.message || 'Unknown error occurred'; + var errorName = errorTypes.includes(error.name) ? error.name : 'Error'; + var ErrConstructor = window[errorName] || Error; + if (error.stack) { + msg += '\n' + error.stack.replace(error.message, ''); } - return new Error(message + ': ' + (selector || node)); - } - function getAllChecks(object) { - var result = []; - return result.concat(object.any || []).concat(object.all || []).concat(object.none || []); + return new ErrConstructor(msg); } - var get_all_checks_default = getAllChecks; - function findBy(array, key, value) { - if (Array.isArray(array)) { - return array.find(function(obj) { - return _typeof(obj) === 'object' && obj[key] === value; - }); + function getSource2() { + var application = 'axeAPI'; + var version = ''; + if (typeof axe !== 'undefined' && axe._audit && axe._audit.application) { + application = axe._audit.application; + } + if (typeof axe !== 'undefined') { + version = axe.version; } + return application + '.' + version; } - var find_by_default = findBy; - function pushFrame(resultSet, options, frameSpec) { - resultSet.forEach(function(res) { - res.node = dq_element_default.fromFrame(res.node, options, frameSpec); - var checks = get_all_checks_default(res); - checks.forEach(function(check4) { - check4.relatedNodes = check4.relatedNodes.map(function(node) { - return dq_element_default.fromFrame(node, options, frameSpec); - }); - }); - }); + function assertIsParentWindow(win) { + assetNotGlobalWindow(win); + assert_default(window.parent === win, 'Source of the response must be the parent window.'); } - function spliceNodes(target, to) { - var firstFromFrame = to[0].node; - for (var _i2 = 0; _i2 < target.length; _i2++) { - var node = target[_i2].node; - var resultSort = nodeIndexSort(node.nodeIndexes, firstFromFrame.nodeIndexes); - if (resultSort > 0 || resultSort === 0 && firstFromFrame.selector.length < node.selector.length) { - target.splice.apply(target, [ _i2, 0 ].concat(_toConsumableArray(to))); - return; - } + function assertIsFrameWindow(win) { + assetNotGlobalWindow(win); + assert_default(win.parent === window, 'Respondable target must be a frame in the current window'); + } + function assetNotGlobalWindow(win) { + assert_default(window !== win, 'Messages can not be sent to the same window.'); + } + var channels = {}; + function storeReplyHandler(channelId, replyHandler) { + var sendToParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + assert_default(!channels[channelId], 'A replyHandler already exists for this message channel.'); + channels[channelId] = { + replyHandler: replyHandler, + sendToParent: sendToParent + }; + } + function getReplyHandler(channelId) { + return channels[channelId]; + } + function deleteReplyHandler(channelId) { + delete channels[channelId]; + } + var messageIds = []; + function createMessageId() { + var uuid2 = ''.concat(v4(), ':').concat(v4()); + if (messageIds.includes(uuid2)) { + return createMessageId(); } - target.push.apply(target, _toConsumableArray(to)); + messageIds.push(uuid2); + return uuid2; } - function normalizeResult(result) { - if (!result || !result.results) { - return null; + function isNewMessage(uuid2) { + if (messageIds.includes(uuid2)) { + return false; } - if (!Array.isArray(result.results)) { - return [ result.results ]; + messageIds.push(uuid2); + return true; + } + function postMessage(win, data2, sendToParent, replyHandler) { + if (typeof replyHandler === 'function') { + storeReplyHandler(data2.channelId, replyHandler, sendToParent); } - if (!result.results.length) { - return null; + sendToParent ? assertIsParentWindow(win) : assertIsFrameWindow(win); + if (data2.message instanceof Error && !sendToParent) { + axe.log(data2.message); + return false; } - return result.results; - } - function mergeResults(frameResults, options) { - var mergedResult = []; - frameResults.forEach(function(frameResult) { - var results = normalizeResult(frameResult); - if (!results || !results.length) { - return; - } - var frameSpec = getFrameSpec(frameResult, options); - results.forEach(function(ruleResult) { - if (ruleResult.nodes && frameSpec) { - pushFrame(ruleResult.nodes, options, frameSpec); - } - var res = find_by_default(mergedResult, 'id', ruleResult.id); - if (!res) { - mergedResult.push(ruleResult); - } else { - if (ruleResult.nodes.length) { - spliceNodes(res.nodes, ruleResult.nodes); - } + var dataString = stringifyMessage(_extends({ + messageId: createMessageId() + }, data2)); + var allowedOrigins = axe._audit.allowedOrigins; + if (!allowedOrigins || !allowedOrigins.length) { + return false; + } + allowedOrigins.forEach(function(origin) { + try { + win.postMessage(dataString, origin); + } catch (err2) { + if (err2 instanceof win.DOMException) { + throw new Error('allowedOrigins value "'.concat(origin, '" is not a valid origin')); } - }); - }); - mergedResult.forEach(function(result) { - if (result.nodes) { - result.nodes.sort(function(nodeA, nodeB) { - return nodeIndexSort(nodeA.node.nodeIndexes, nodeB.node.nodeIndexes); - }); + throw err2; } }); - return mergedResult; + return true; } - function nodeIndexSort() { - var nodeIndexesA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; - var nodeIndexesB = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - var length = Math.max(nodeIndexesA === null || nodeIndexesA === void 0 ? void 0 : nodeIndexesA.length, nodeIndexesB === null || nodeIndexesB === void 0 ? void 0 : nodeIndexesB.length); - for (var _i3 = 0; _i3 < length; _i3++) { - var indexA = nodeIndexesA === null || nodeIndexesA === void 0 ? void 0 : nodeIndexesA[_i3]; - var indexB = nodeIndexesB === null || nodeIndexesB === void 0 ? void 0 : nodeIndexesB[_i3]; - if (typeof indexA !== 'number' || isNaN(indexA)) { - return _i3 === 0 ? 1 : -1; - } - if (typeof indexB !== 'number' || isNaN(indexB)) { - return _i3 === 0 ? -1 : 1; - } - if (indexA !== indexB) { - return indexA - indexB; - } + function processError(win, error, channelId) { + if (!win.parent !== window) { + return axe.log(error); } - return 0; - } - var merge_results_default = mergeResults; - function getFrameSpec(frameResult, options) { - if (frameResult.frameElement) { - return new dq_element_default(frameResult.frameElement, options); - } else if (frameResult.frameSpec) { - return frameResult.frameSpec; + try { + postMessage(win, { + topic: null, + channelId: channelId, + message: error, + messageId: createMessageId(), + keepalive: true + }, true); + } catch (err2) { + return axe.log(err2); } - return null; } - function _collectResultsFromFrames(parentContent, options, command, parameter, resolve, reject) { - var q = queue_default(); - var frames = parentContent.frames; - frames.forEach(function(_ref6) { - var frameElement = _ref6.node, context5 = _objectWithoutProperties(_ref6, _excluded); - q.defer(function(res, rej) { - var params = { - options: options, - command: command, - parameter: parameter, - context: context5 - }; - function callback(results) { - if (!results) { - return res(null); - } - return res({ - results: results, - frameElement: frameElement - }); - } - _sendCommandToFrame(frameElement, params, callback, rej); - }); - }); - q.then(function(data2) { - resolve(merge_results_default(data2, options)); - })['catch'](reject); + function createResponder(win, channelId) { + var sendToParent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; + return function respond(message, keepalive, replyHandler) { + var data2 = { + channelId: channelId, + message: message, + keepalive: keepalive + }; + postMessage(win, data2, sendToParent, replyHandler); + }; } - function _contains(vNode, otherVNode) { - if (vNode.shadowId || otherVNode.shadowId) { - do { - if (vNode.shadowId === otherVNode.shadowId) { - return true; + function originIsAllowed(origin) { + var allowedOrigins = axe._audit.allowedOrigins; + return allowedOrigins && allowedOrigins.includes('*') || allowedOrigins.includes(origin); + } + function messageHandler(_ref3, topicHandler) { + var origin = _ref3.origin, dataString = _ref3.data, win = _ref3.source; + try { + var data2 = parseMessage(dataString) || {}; + var channelId = data2.channelId, message = data2.message, messageId = data2.messageId; + if (!originIsAllowed(origin) || !isNewMessage(messageId)) { + return; + } + if (message instanceof Error && win.parent !== window) { + axe.log(message); + return false; + } + try { + if (data2.topic) { + var responder = createResponder(win, channelId); + assertIsParentWindow(win); + topicHandler(data2, responder); + } else { + callReplyHandler(win, data2); } - otherVNode = otherVNode.parent; - } while (otherVNode); + } catch (error) { + processError(win, error, channelId); + } + } catch (error) { + axe.log(error); return false; } - if (!vNode.actualNode) { - do { - if (otherVNode === vNode) { - return true; - } - otherVNode = otherVNode.parent; - } while (otherVNode); + } + function callReplyHandler(win, data2) { + var channelId = data2.channelId, message = data2.message, keepalive = data2.keepalive; + var _ref4 = getReplyHandler(channelId) || {}, replyHandler = _ref4.replyHandler, sendToParent = _ref4.sendToParent; + if (!replyHandler) { + return; } - if (typeof vNode.actualNode.contains !== 'function') { - var position = vNode.actualNode.compareDocumentPosition(otherVNode.actualNode); - return !!(position & 16); + sendToParent ? assertIsParentWindow(win) : assertIsFrameWindow(win); + var responder = createResponder(win, channelId, sendToParent); + if (!keepalive && channelId) { + deleteReplyHandler(channelId); } - return vNode.actualNode.contains(otherVNode.actualNode); - } - function deepMerge() { - var target = {}; - for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { - sources[_key] = arguments[_key]; + try { + replyHandler(message, keepalive, responder); + } catch (error) { + axe.log(error); + responder(error, keepalive); } - sources.forEach(function(source) { - if (!source || _typeof(source) !== 'object' || Array.isArray(source)) { + } + var frameMessenger = { + open: function open(topicHandler) { + if (typeof window.addEventListener !== 'function') { return; } - for (var _i4 = 0, _Object$keys = Object.keys(source); _i4 < _Object$keys.length; _i4++) { - var key = _Object$keys[_i4]; - if (!target.hasOwnProperty(key) || _typeof(source[key]) !== 'object' || Array.isArray(target[key])) { - target[key] = source[key]; - } else { - target[key] = deepMerge(target[key], source[key]); - } + var handler = function handler(messageEvent) { + messageHandler(messageEvent, topicHandler); + }; + window.addEventListener('message', handler, false); + return function() { + window.removeEventListener('message', handler, false); + }; + }, + post: function post(win, data2, replyHandler) { + if (typeof window.addEventListener !== 'function') { + return false; } - }); - return target; + return postMessage(win, data2, false, replyHandler); + } + }; + function setDefaultFrameMessenger(respondable2) { + respondable2.updateMessenger(frameMessenger); } - var deep_merge_default = deepMerge; - function extendMetaData(to, from) { - Object.assign(to, from); - Object.keys(from).filter(function(prop) { - return typeof from[prop] === 'function'; - }).forEach(function(prop) { - to[prop] = null; - try { - to[prop] = from[prop](to); - } catch (e) {} - }); - } - var extend_meta_data_default = extendMetaData; - var possibleShadowRoots = [ 'article', 'aside', 'blockquote', 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span' ]; - function isShadowRoot(node) { - if (node.shadowRoot) { - var nodeName2 = node.nodeName.toLowerCase(); - if (possibleShadowRoots.includes(nodeName2) || /^[a-z][a-z0-9_.-]*-[a-z0-9_.-]*$/.test(nodeName2)) { - return true; - } - } - return false; + var closeHandler; + var postMessage2; + var topicHandlers = {}; + function _respondable(win, topic, message, keepalive, replyHandler) { + var data2 = { + topic: topic, + message: message, + channelId: ''.concat(v4(), ':').concat(v4()), + keepalive: keepalive + }; + return postMessage2(win, data2, replyHandler); } - var is_shadow_root_default = isShadowRoot; - var dom_exports = {}; - __export(dom_exports, { - findElmsInContext: function findElmsInContext() { - return find_elms_in_context_default; - }, - findUp: function findUp() { - return find_up_default; - }, - findUpVirtual: function findUpVirtual() { - return find_up_virtual_default; - }, - getComposedParent: function getComposedParent() { - return get_composed_parent_default; - }, - getElementByReference: function getElementByReference() { - return get_element_by_reference_default; - }, - getElementCoordinates: function getElementCoordinates() { - return get_element_coordinates_default; - }, - getElementStack: function getElementStack() { - return get_element_stack_default; - }, - getRootNode: function getRootNode() { - return get_root_node_default2; - }, - getScrollOffset: function getScrollOffset() { - return get_scroll_offset_default; - }, - getTabbableElements: function getTabbableElements() { - return get_tabbable_elements_default; - }, - getTextElementStack: function getTextElementStack() { - return get_text_element_stack_default; - }, - getViewportSize: function getViewportSize() { - return get_viewport_size_default; - }, - hasContent: function hasContent() { - return has_content_default; - }, - hasContentVirtual: function hasContentVirtual() { - return has_content_virtual_default; - }, - idrefs: function idrefs() { - return idrefs_default; - }, - insertedIntoFocusOrder: function insertedIntoFocusOrder() { - return inserted_into_focus_order_default; - }, - isCurrentPageLink: function isCurrentPageLink() { - return _isCurrentPageLink; - }, - isFocusable: function isFocusable() { - return is_focusable_default; - }, - isHTML5: function isHTML5() { - return is_html5_default; - }, - isHiddenWithCSS: function isHiddenWithCSS() { - return is_hidden_with_css_default; - }, - isInTextBlock: function isInTextBlock() { - return is_in_text_block_default; - }, - isModalOpen: function isModalOpen() { - return is_modal_open_default; - }, - isNativelyFocusable: function isNativelyFocusable() { - return is_natively_focusable_default; - }, - isNode: function isNode() { - return is_node_default; - }, - isOffscreen: function isOffscreen() { - return is_offscreen_default; - }, - isOpaque: function isOpaque() { - return is_opaque_default; - }, - isSkipLink: function isSkipLink() { - return _isSkipLink; - }, - isVisible: function isVisible() { - return is_visible_default; - }, - isVisualContent: function isVisualContent() { - return is_visual_content_default; - }, - reduceToElementsBelowFloating: function reduceToElementsBelowFloating() { - return reduce_to_elements_below_floating_default; - }, - shadowElementsFromPoint: function shadowElementsFromPoint() { - return shadow_elements_from_point_default; - }, - urlPropsFromAttribute: function urlPropsFromAttribute() { - return url_props_from_attribute_default; - }, - visuallyContains: function visuallyContains() { - return _visuallyContains; - }, - visuallyOverlaps: function visuallyOverlaps() { - return visually_overlaps_default; + function messageListener(data2, responder) { + var topic = data2.topic, message = data2.message, keepalive = data2.keepalive; + var topicHandler = topicHandlers[topic]; + if (!topicHandler) { + return; } - }); - function getRootNode(node) { - var doc = node.getRootNode && node.getRootNode() || document; - if (doc === node) { - doc = document; + try { + topicHandler(message, keepalive, responder); + } catch (error) { + axe.log(error); + responder(error, keepalive); } - return doc; } - var get_root_node_default = getRootNode; - var get_root_node_default2 = get_root_node_default; - function findElmsInContext(_ref7) { - var context5 = _ref7.context, value = _ref7.value, attr = _ref7.attr, _ref7$elm = _ref7.elm, elm = _ref7$elm === void 0 ? '' : _ref7$elm; - var root; - var escapedValue = escape_selector_default(value); - if (context5.nodeType === 9 || context5.nodeType === 11) { - root = context5; + _respondable.updateMessenger = function updateMessenger(_ref5) { + var open = _ref5.open, post = _ref5.post; + assert_default(typeof open === 'function', 'open callback must be a function'); + assert_default(typeof post === 'function', 'post callback must be a function'); + if (closeHandler) { + closeHandler(); + } + var close = open(messageListener); + if (close) { + assert_default(typeof close === 'function', 'open callback must return a cleanup function'); + closeHandler = close; } else { - root = get_root_node_default2(context5); + closeHandler = null; } - return Array.from(root.querySelectorAll(elm + '[' + attr + '=' + escapedValue + ']')); - } - var find_elms_in_context_default = findElmsInContext; - function findUpVirtual(element, target) { - var parent; - parent = element.actualNode; - if (!element.shadowId && typeof element.actualNode.closest === 'function') { - var match = element.actualNode.closest(target); - if (match) { - return match; - } - return null; + postMessage2 = post; + }; + _respondable.subscribe = function subscribe(topic, topicHandler) { + assert_default(typeof topicHandler === 'function', 'Subscriber callback must be a function'); + assert_default(!topicHandlers[topic], 'Topic '.concat(topic, ' is already registered to.')); + topicHandlers[topic] = topicHandler; + }; + _respondable.isInFrame = function isInFrame() { + var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; + return !!win.frameElement; + }; + setDefaultFrameMessenger(_respondable); + function _sendCommandToFrame(node, parameters, resolve, reject) { + var _parameters$options$p, _parameters$options; + var win = node.contentWindow; + var pingWaitTime = (_parameters$options$p = (_parameters$options = parameters.options) === null || _parameters$options === void 0 ? void 0 : _parameters$options.pingWaitTime) !== null && _parameters$options$p !== void 0 ? _parameters$options$p : 500; + if (!win) { + log_default('Frame does not have a content window', node); + resolve(null); + return; } - do { - parent = parent.assignedSlot ? parent.assignedSlot : parent.parentNode; - if (parent && parent.nodeType === 11) { - parent = parent.host; - } - } while (parent && !element_matches_default(parent, target) && parent !== document.documentElement); - if (!parent) { - return null; + if (pingWaitTime === 0) { + callAxeStart(node, parameters, resolve, reject); + return; } - if (!element_matches_default(parent, target)) { - return null; + var timeout = setTimeout(function() { + timeout = setTimeout(function() { + if (!parameters.debug) { + resolve(null); + } else { + reject(err('No response from frame', node)); + } + }, 0); + }, pingWaitTime); + _respondable(win, 'axe.ping', null, void 0, function() { + clearTimeout(timeout); + callAxeStart(node, parameters, resolve, reject); + }); + } + function callAxeStart(node, parameters, resolve, reject) { + var _parameters$options$f, _parameters$options2; + var frameWaitTime = (_parameters$options$f = (_parameters$options2 = parameters.options) === null || _parameters$options2 === void 0 ? void 0 : _parameters$options2.frameWaitTime) !== null && _parameters$options$f !== void 0 ? _parameters$options$f : 6e4; + var win = node.contentWindow; + var timeout = setTimeout(function collectResultFramesTimeout() { + reject(err('Axe in frame timed out', node)); + }, frameWaitTime); + _respondable(win, 'axe.start', parameters, void 0, function(data2) { + clearTimeout(timeout); + if (data2 instanceof Error === false) { + resolve(data2); + } else { + reject(data2); + } + }); + } + function err(message, node) { + var selector; + if (axe._tree) { + selector = _getSelector(node); } - return parent; + return new Error(message + ': ' + (selector || node)); } - var find_up_virtual_default = findUpVirtual; - function findUp(element, target) { - return find_up_virtual_default(get_node_from_tree_default(element), target); + function getAllChecks(object) { + var result = []; + return result.concat(object.any || []).concat(object.all || []).concat(object.none || []); } - var find_up_default = findUp; - function getComposedParent(element) { - if (element.assignedSlot) { - return getComposedParent(element.assignedSlot); - } else if (element.parentNode) { - var parentNode = element.parentNode; - if (parentNode.nodeType === 1) { - return parentNode; - } else if (parentNode.host) { - return parentNode.host; - } + var get_all_checks_default = getAllChecks; + function findBy(array, key, value) { + if (Array.isArray(array)) { + return array.find(function(obj) { + return _typeof(obj) === 'object' && obj[key] === value; + }); } - return null; } - var get_composed_parent_default = getComposedParent; - var angularSkipLinkRegex = /^\/\#/; - var angularRouterLinkRegex = /^#[!/]/; - function _isCurrentPageLink(anchor) { - var _window$location; - var href = anchor.getAttribute('href'); - if (!href || href === '#') { - return false; - } - if (angularSkipLinkRegex.test(href)) { - return true; - } - var hash = anchor.hash, protocol = anchor.protocol, hostname = anchor.hostname, port = anchor.port, pathname = anchor.pathname; - if (angularRouterLinkRegex.test(hash)) { - return false; - } - if (href.charAt(0) === '#') { - return true; - } - if (typeof ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.origin) !== 'string' || window.location.origin.indexOf('://') === -1) { - return null; - } - var currentPageUrl = window.location.origin + window.location.pathname; - var url; - if (!hostname) { - url = window.location.origin; - } else { - url = ''.concat(protocol, '//').concat(hostname).concat(port ? ':'.concat(port) : ''); - } - if (!pathname) { - url += window.location.pathname; - } else { - url += (pathname[0] !== '/' ? '/' : '') + pathname; - } - return url === currentPageUrl; + var find_by_default = findBy; + function pushFrame(resultSet, options, frameSpec) { + resultSet.forEach(function(res) { + res.node = dq_element_default.fromFrame(res.node, options, frameSpec); + var checks = get_all_checks_default(res); + checks.forEach(function(check) { + check.relatedNodes = check.relatedNodes.map(function(node) { + return dq_element_default.fromFrame(node, options, frameSpec); + }); + }); + }); } - function getElementByReference(node, attr) { - var fragment = node.getAttribute(attr); - if (!fragment) { - return null; + function spliceNodes(target, to) { + var firstFromFrame = to[0].node; + for (var _i2 = 0; _i2 < target.length; _i2++) { + var node = target[_i2].node; + var resultSort = nodeIndexSort(node.nodeIndexes, firstFromFrame.nodeIndexes); + if (resultSort > 0 || resultSort === 0 && firstFromFrame.selector.length < node.selector.length) { + target.splice.apply(target, [ _i2, 0 ].concat(_toConsumableArray(to))); + return; + } } - if (attr === 'href' && !_isCurrentPageLink(node)) { + target.push.apply(target, _toConsumableArray(to)); + } + function normalizeResult(result) { + if (!result || !result.results) { return null; } - if (fragment.indexOf('#') !== -1) { - fragment = decodeURIComponent(fragment.substr(fragment.indexOf('#') + 1)); - } - var candidate = document.getElementById(fragment); - if (candidate) { - return candidate; - } - candidate = document.getElementsByName(fragment); - if (candidate.length) { - return candidate[0]; - } - return null; - } - var get_element_by_reference_default = getElementByReference; - function getScrollOffset(element) { - if (!element.nodeType && element.document) { - element = element.document; + if (!Array.isArray(result.results)) { + return [ result.results ]; } - if (element.nodeType === 9) { - var docElement = element.documentElement, body = element.body; - return { - left: docElement && docElement.scrollLeft || body && body.scrollLeft || 0, - top: docElement && docElement.scrollTop || body && body.scrollTop || 0 - }; + if (!result.results.length) { + return null; } - return { - left: element.scrollLeft, - top: element.scrollTop - }; + return result.results; } - var get_scroll_offset_default = getScrollOffset; - function getElementCoordinates(element) { - var scrollOffset = get_scroll_offset_default(document), xOffset = scrollOffset.left, yOffset = scrollOffset.top, coords = element.getBoundingClientRect(); - return { - top: coords.top + yOffset, - right: coords.right + xOffset, - bottom: coords.bottom + yOffset, - left: coords.left + xOffset, - width: coords.right - coords.left, - height: coords.bottom - coords.top - }; + function mergeResults(frameResults, options) { + var mergedResult = []; + frameResults.forEach(function(frameResult) { + var results = normalizeResult(frameResult); + if (!results || !results.length) { + return; + } + var frameSpec = getFrameSpec(frameResult, options); + results.forEach(function(ruleResult) { + if (ruleResult.nodes && frameSpec) { + pushFrame(ruleResult.nodes, options, frameSpec); + } + var res = find_by_default(mergedResult, 'id', ruleResult.id); + if (!res) { + mergedResult.push(ruleResult); + } else { + if (ruleResult.nodes.length) { + spliceNodes(res.nodes, ruleResult.nodes); + } + } + }); + }); + mergedResult.forEach(function(result) { + if (result.nodes) { + result.nodes.sort(function(nodeA, nodeB) { + return nodeIndexSort(nodeA.node.nodeIndexes, nodeB.node.nodeIndexes); + }); + } + }); + return mergedResult; } - var get_element_coordinates_default = getElementCoordinates; - function getViewportSize(win) { - var doc = win.document; - var docElement = doc.documentElement; - if (win.innerWidth) { - return { - width: win.innerWidth, - height: win.innerHeight - }; + function nodeIndexSort() { + var nodeIndexesA = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var nodeIndexesB = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var length = Math.max(nodeIndexesA === null || nodeIndexesA === void 0 ? void 0 : nodeIndexesA.length, nodeIndexesB === null || nodeIndexesB === void 0 ? void 0 : nodeIndexesB.length); + for (var _i3 = 0; _i3 < length; _i3++) { + var indexA = nodeIndexesA === null || nodeIndexesA === void 0 ? void 0 : nodeIndexesA[_i3]; + var indexB = nodeIndexesB === null || nodeIndexesB === void 0 ? void 0 : nodeIndexesB[_i3]; + if (typeof indexA !== 'number' || isNaN(indexA)) { + return _i3 === 0 ? 1 : -1; + } + if (typeof indexB !== 'number' || isNaN(indexB)) { + return _i3 === 0 ? -1 : 1; + } + if (indexA !== indexB) { + return indexA - indexB; + } } - if (docElement) { - return { - width: docElement.clientWidth, - height: docElement.clientHeight - }; + return 0; + } + var merge_results_default = mergeResults; + function getFrameSpec(frameResult, options) { + if (frameResult.frameElement) { + return new dq_element_default(frameResult.frameElement, options); + } else if (frameResult.frameSpec) { + return frameResult.frameSpec; } - var body = doc.body; - return { - width: body.clientWidth, - height: body.clientHeight - }; + return null; } - var get_viewport_size_default = getViewportSize; - function noParentScrolled(element, offset) { - element = get_composed_parent_default(element); - while (element && element.nodeName.toLowerCase() !== 'html') { - if (element.scrollTop) { - offset += element.scrollTop; - if (offset >= 0) { - return false; + function _collectResultsFromFrames(parentContent, options, command, parameter, resolve, reject) { + var q = queue_default(); + var frames = parentContent.frames; + frames.forEach(function(_ref6) { + var frameElement = _ref6.node, context = _objectWithoutProperties(_ref6, _excluded); + q.defer(function(res, rej) { + var params = { + options: options, + command: command, + parameter: parameter, + context: context + }; + function callback(results) { + if (!results) { + return res(null); + } + return res({ + results: results, + frameElement: frameElement + }); } - } - element = get_composed_parent_default(element); - } - return true; + _sendCommandToFrame(frameElement, params, callback, rej); + }); + }); + q.then(function(data2) { + resolve(merge_results_default(data2, options)); + })['catch'](reject); } - function isOffscreen(element) { - var leftBoundary; - var docElement = document.documentElement; - var styl = window.getComputedStyle(element); - var dir = window.getComputedStyle(document.body || docElement).getPropertyValue('direction'); - var coords = get_element_coordinates_default(element); - if (coords.bottom < 0 && (noParentScrolled(element, coords.bottom) || styl.position === 'absolute')) { - return true; - } - if (coords.left === 0 && coords.right === 0) { - return false; + function _contains(vNode, otherVNode) { + if (!vNode.shadowId && !otherVNode.shadowId && vNode.actualNode && typeof vNode.actualNode.contains === 'function') { + return vNode.actualNode.contains(otherVNode.actualNode); } - if (dir === 'ltr') { - if (coords.right <= 0) { - return true; - } - } else { - leftBoundary = Math.max(docElement.scrollWidth, get_viewport_size_default(window).width); - if (coords.left >= leftBoundary) { + do { + if (vNode === otherVNode) { return true; + } else if (otherVNode.nodeIndex < vNode.nodeIndex) { + return false; } - } + otherVNode = otherVNode.parent; + } while (otherVNode); return false; } - var is_offscreen_default = isOffscreen; - var clipRegex = /rect\s*\(([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px\s*\)/; + function deepMerge() { + var target = {}; + for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) { + sources[_key] = arguments[_key]; + } + sources.forEach(function(source) { + if (!source || _typeof(source) !== 'object' || Array.isArray(source)) { + return; + } + for (var _i4 = 0, _Object$keys = Object.keys(source); _i4 < _Object$keys.length; _i4++) { + var key = _Object$keys[_i4]; + if (!target.hasOwnProperty(key) || _typeof(source[key]) !== 'object' || Array.isArray(target[key])) { + target[key] = source[key]; + } else { + target[key] = deepMerge(target[key], source[key]); + } + } + }); + return target; + } + var deep_merge_default = deepMerge; + function extendMetaData(to, from) { + Object.assign(to, from); + Object.keys(from).filter(function(prop) { + return typeof from[prop] === 'function'; + }).forEach(function(prop) { + to[prop] = null; + try { + to[prop] = from[prop](to); + } catch (e) {} + }); + } + var extend_meta_data_default = extendMetaData; + var possibleShadowRoots = [ 'article', 'aside', 'blockquote', 'body', 'div', 'footer', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'main', 'nav', 'p', 'section', 'span' ]; + function isShadowRoot(node) { + if (node.shadowRoot) { + var nodeName2 = node.nodeName.toLowerCase(); + if (possibleShadowRoots.includes(nodeName2) || /^[a-z][a-z0-9_.-]*-[a-z0-9_.-]*$/.test(nodeName2)) { + return true; + } + } + return false; + } + var is_shadow_root_default = isShadowRoot; + var dom_exports = {}; + __export(dom_exports, { + createGrid: function createGrid() { + return _createGrid; + }, + findElmsInContext: function findElmsInContext() { + return find_elms_in_context_default; + }, + findNearbyElms: function findNearbyElms() { + return _findNearbyElms; + }, + findUp: function findUp() { + return find_up_default; + }, + findUpVirtual: function findUpVirtual() { + return find_up_virtual_default; + }, + focusDisabled: function focusDisabled() { + return focus_disabled_default; + }, + getComposedParent: function getComposedParent() { + return get_composed_parent_default; + }, + getElementByReference: function getElementByReference() { + return get_element_by_reference_default; + }, + getElementCoordinates: function getElementCoordinates() { + return get_element_coordinates_default; + }, + getElementStack: function getElementStack() { + return get_element_stack_default; + }, + getOverflowHiddenAncestors: function getOverflowHiddenAncestors() { + return get_overflow_hidden_ancestors_default; + }, + getRootNode: function getRootNode() { + return get_root_node_default2; + }, + getScrollOffset: function getScrollOffset() { + return get_scroll_offset_default; + }, + getTabbableElements: function getTabbableElements() { + return get_tabbable_elements_default; + }, + getTextElementStack: function getTextElementStack() { + return get_text_element_stack_default; + }, + getViewportSize: function getViewportSize() { + return get_viewport_size_default; + }, + getVisibleChildTextRects: function getVisibleChildTextRects() { + return get_visible_child_text_rects_default; + }, + hasContent: function hasContent() { + return has_content_default; + }, + hasContentVirtual: function hasContentVirtual() { + return has_content_virtual_default; + }, + hasLangText: function hasLangText() { + return _hasLangText; + }, + idrefs: function idrefs() { + return idrefs_default; + }, + insertedIntoFocusOrder: function insertedIntoFocusOrder() { + return inserted_into_focus_order_default; + }, + isCurrentPageLink: function isCurrentPageLink() { + return _isCurrentPageLink; + }, + isFocusable: function isFocusable() { + return _isFocusable; + }, + isHTML5: function isHTML5() { + return is_html5_default; + }, + isHiddenForEveryone: function isHiddenForEveryone() { + return _isHiddenForEveryone; + }, + isHiddenWithCSS: function isHiddenWithCSS() { + return is_hidden_with_css_default; + }, + isInTabOrder: function isInTabOrder() { + return _isInTabOrder; + }, + isInTextBlock: function isInTextBlock() { + return is_in_text_block_default; + }, + isModalOpen: function isModalOpen() { + return is_modal_open_default; + }, + isMultiline: function isMultiline() { + return _isMultiline; + }, + isNativelyFocusable: function isNativelyFocusable() { + return is_natively_focusable_default; + }, + isNode: function isNode() { + return is_node_default; + }, + isOffscreen: function isOffscreen() { + return is_offscreen_default; + }, + isOpaque: function isOpaque() { + return is_opaque_default; + }, + isSkipLink: function isSkipLink() { + return _isSkipLink; + }, + isVisible: function isVisible() { + return is_visible_default; + }, + isVisibleOnScreen: function isVisibleOnScreen() { + return _isVisibleOnScreen; + }, + isVisibleToScreenReaders: function isVisibleToScreenReaders() { + return _isVisibleToScreenReaders; + }, + isVisualContent: function isVisualContent() { + return is_visual_content_default; + }, + reduceToElementsBelowFloating: function reduceToElementsBelowFloating() { + return reduce_to_elements_below_floating_default; + }, + shadowElementsFromPoint: function shadowElementsFromPoint() { + return shadow_elements_from_point_default; + }, + urlPropsFromAttribute: function urlPropsFromAttribute() { + return url_props_from_attribute_default; + }, + visuallyContains: function visuallyContains() { + return _visuallyContains; + }, + visuallyOverlaps: function visuallyOverlaps() { + return visually_overlaps_default; + }, + visuallySort: function visuallySort() { + return _visuallySort; + } + }); + function getRootNode(node) { + var doc = node.getRootNode && node.getRootNode() || document; + if (doc === node) { + doc = document; + } + return doc; + } + var get_root_node_default = getRootNode; + var get_root_node_default2 = get_root_node_default; + function findElmsInContext(_ref7) { + var context = _ref7.context, value = _ref7.value, attr = _ref7.attr, _ref7$elm = _ref7.elm, elm = _ref7$elm === void 0 ? '' : _ref7$elm; + var root; + var escapedValue = escape_selector_default(value); + if (context.nodeType === 9 || context.nodeType === 11) { + root = context; + } else { + root = get_root_node_default2(context); + } + return Array.from(root.querySelectorAll(elm + '[' + attr + '=' + escapedValue + ']')); + } + var find_elms_in_context_default = findElmsInContext; + function findUpVirtual(element, target) { + var parent; + parent = element.actualNode; + if (!element.shadowId && typeof element.actualNode.closest === 'function') { + var match = element.actualNode.closest(target); + if (match) { + return match; + } + return null; + } + do { + parent = parent.assignedSlot ? parent.assignedSlot : parent.parentNode; + if (parent && parent.nodeType === 11) { + parent = parent.host; + } + } while (parent && !element_matches_default(parent, target) && parent !== document.documentElement); + if (!parent) { + return null; + } + if (!element_matches_default(parent, target)) { + return null; + } + return parent; + } + var find_up_virtual_default = findUpVirtual; + function findUp(element, target) { + return find_up_virtual_default(get_node_from_tree_default(element), target); + } + var find_up_default = findUp; + var import_memoizee = __toModule(require_memoizee()); + axe._memoizedFns = []; + function memoizeImplementation(fn) { + var memoized = (0, import_memoizee['default'])(fn); + axe._memoizedFns.push(memoized); + return memoized; + } + var memoize_default = memoizeImplementation; + function _rectsOverlap(rect1, rect2) { + return (rect1.left | 0) < (rect2.right | 0) && (rect1.right | 0) > (rect2.left | 0) && (rect1.top | 0) < (rect2.bottom | 0) && (rect1.bottom | 0) > (rect2.top | 0); + } + var getOverflowHiddenAncestors = memoize_default(function getOverflowHiddenAncestorsMemoized(vNode) { + var ancestors = []; + if (!vNode) { + return ancestors; + } + var overflow = vNode.getComputedStylePropertyValue('overflow'); + if (overflow === 'hidden') { + ancestors.push(vNode); + } + return ancestors.concat(getOverflowHiddenAncestors(vNode.parent)); + }); + var get_overflow_hidden_ancestors_default = getOverflowHiddenAncestors; + var clipRegex = /rect\s*\(([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px\s*\)/; var clipPathRegex = /(\w+)\((\d+)/; - function isClipped(style) { - var matchesClip = style.getPropertyValue('clip').match(clipRegex); - var matchesClipPath = style.getPropertyValue('clip-path').match(clipPathRegex); + function nativelyHidden(vNode) { + return [ 'style', 'script', 'noscript', 'template' ].includes(vNode.props.nodeName); + } + function displayHidden(vNode) { + if (vNode.props.nodeName === 'area') { + return false; + } + return vNode.getComputedStylePropertyValue('display') === 'none'; + } + function visibilityHidden(vNode) { + var _ref8 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, isAncestor = _ref8.isAncestor; + return !isAncestor && [ 'hidden', 'collapse' ].includes(vNode.getComputedStylePropertyValue('visibility')); + } + function contentVisibiltyHidden(vNode) { + var _ref9 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, isAncestor = _ref9.isAncestor; + return !!isAncestor && vNode.getComputedStylePropertyValue('content-visibility') === 'hidden'; + } + function ariaHidden(vNode) { + return vNode.attr('aria-hidden') === 'true'; + } + function opacityHidden(vNode) { + return vNode.getComputedStylePropertyValue('opacity') === '0'; + } + function scrollHidden(vNode) { + var scroll = _getScroll(vNode.actualNode); + var elHeight = parseInt(vNode.getComputedStylePropertyValue('height')); + var elWidth = parseInt(vNode.getComputedStylePropertyValue('width')); + return !!scroll && (elHeight === 0 || elWidth === 0); + } + function overflowHidden(vNode) { + var _ref10 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, isAncestor = _ref10.isAncestor; + if (isAncestor) { + return false; + } + var rect = vNode.boundingClientRect; + var nodes = get_overflow_hidden_ancestors_default(vNode); + if (!nodes.length) { + return false; + } + return nodes.some(function(node) { + var nodeRect = node.boundingClientRect; + if (nodeRect.width < 2 || nodeRect.height < 2) { + return true; + } + return !_rectsOverlap(rect, nodeRect); + }); + } + function clipHidden(vNode) { + var matchesClip = vNode.getComputedStylePropertyValue('clip').match(clipRegex); + var matchesClipPath = vNode.getComputedStylePropertyValue('clip-path').match(clipPathRegex); if (matchesClip && matchesClip.length === 5) { - var position = style.getPropertyValue('position'); + var position = vNode.getComputedStylePropertyValue('position'); if ([ 'fixed', 'absolute' ].includes(position)) { return matchesClip[3] - matchesClip[1] <= 0 && matchesClip[2] - matchesClip[4] <= 0; } @@ -7351,121 +7326,248 @@ } return false; } - function isAreaVisible(el, screenReader, recursed) { - var mapEl = find_up_default(el, 'map'); + function areaHidden(vNode, visibleFunction) { + var mapEl = closest_default(vNode, 'map'); if (!mapEl) { - return false; + return true; } - var mapElName = mapEl.getAttribute('name'); + var mapElName = mapEl.attr('name'); if (!mapElName) { - return false; + return true; } - var mapElRootNode = get_root_node_default2(el); + var mapElRootNode = get_root_node_default(vNode.actualNode); if (!mapElRootNode || mapElRootNode.nodeType !== 9) { - return false; + return true; } var refs = query_selector_all_default(axe._tree, 'img[usemap="#'.concat(escape_selector_default(mapElName), '"]')); if (!refs || !refs.length) { - return false; + return true; } - return refs.some(function(_ref8) { - var actualNode = _ref8.actualNode; - return isVisible(actualNode, screenReader, recursed); + return refs.some(function(ref) { + return !visibleFunction(ref); }); } - function isVisible(el, screenReader, recursed) { - var _window$Node; - if (!el) { - throw new TypeError('Cannot determine if element is visible for non-DOM nodes'); + function detailsHidden(vNode) { + var _vNode$parent; + if (((_vNode$parent = vNode.parent) === null || _vNode$parent === void 0 ? void 0 : _vNode$parent.props.nodeName) !== 'details') { + return false; } - var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); - el = vNode ? vNode.actualNode : el; - var cacheName = '_isVisible' + (screenReader ? 'ScreenReader' : ''); - var _ref9 = (_window$Node = window.Node) !== null && _window$Node !== void 0 ? _window$Node : {}, DOCUMENT_NODE = _ref9.DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE = _ref9.DOCUMENT_FRAGMENT_NODE; - var nodeType = vNode ? vNode.props.nodeType : el.nodeType; - var nodeName2 = vNode ? vNode.props.nodeName : el.nodeName.toLowerCase(); - if (vNode && typeof vNode[cacheName] !== 'undefined') { - return vNode[cacheName]; + if (vNode.props.nodeName === 'summary') { + var firstSummary = vNode.parent.children.find(function(node) { + return node.props.nodeName === 'summary'; + }); + if (firstSummary === vNode) { + return false; + } } - if (nodeType === DOCUMENT_NODE) { + return !vNode.parent.hasAttr('open'); + } + var hiddenMethods = [ displayHidden, visibilityHidden, contentVisibiltyHidden, detailsHidden ]; + function _isHiddenForEveryone(vNode) { + var _ref11 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, skipAncestors = _ref11.skipAncestors, _ref11$isAncestor = _ref11.isAncestor, isAncestor = _ref11$isAncestor === void 0 ? false : _ref11$isAncestor; + vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); + if (skipAncestors) { + return isHiddenSelf(vNode, isAncestor); + } + return isHiddenAncestors(vNode, isAncestor); + } + var isHiddenSelf = memoize_default(function isHiddenSelfMemoized(vNode, isAncestor) { + if (nativelyHidden(vNode)) { return true; } - if ([ 'style', 'script', 'noscript', 'template' ].includes(nodeName2)) { + if (!vNode.actualNode) { return false; } - if (el && nodeType === DOCUMENT_FRAGMENT_NODE) { - el = el.host; + if (hiddenMethods.some(function(method) { + return method(vNode, { + isAncestor: isAncestor + }); + })) { + return true; } - if (screenReader) { - var ariaHiddenValue = vNode ? vNode.attr('aria-hidden') : el.getAttribute('aria-hidden'); - if (ariaHiddenValue === 'true') { - return false; - } + if (!vNode.actualNode.isConnected) { + return true; } - if (!el) { - var parent2 = vNode.parent; - var visible5 = true; - if (parent2) { - visible5 = isVisible(parent2, screenReader, true); + return false; + }); + var isHiddenAncestors = memoize_default(function isHiddenAncestorsMemoized(vNode, isAncestor) { + if (isHiddenSelf(vNode, isAncestor)) { + return true; + } + if (!vNode.parent) { + return false; + } + return isHiddenAncestors(vNode.parent, true); + }); + function getComposedParent(element) { + if (element.assignedSlot) { + return getComposedParent(element.assignedSlot); + } else if (element.parentNode) { + var parentNode = element.parentNode; + if (parentNode.nodeType === 1) { + return parentNode; + } else if (parentNode.host) { + return parentNode.host; } - if (vNode) { - vNode[cacheName] = visible5; + } + return null; + } + var get_composed_parent_default = getComposedParent; + function getScrollOffset(element) { + if (!element.nodeType && element.document) { + element = element.document; + } + if (element.nodeType === 9) { + var docElement = element.documentElement, body = element.body; + return { + left: docElement && docElement.scrollLeft || body && body.scrollLeft || 0, + top: docElement && docElement.scrollTop || body && body.scrollTop || 0 + }; + } + return { + left: element.scrollLeft, + top: element.scrollTop + }; + } + var get_scroll_offset_default = getScrollOffset; + function getElementCoordinates(element) { + var scrollOffset = get_scroll_offset_default(document), xOffset = scrollOffset.left, yOffset = scrollOffset.top, coords = element.getBoundingClientRect(); + return { + top: coords.top + yOffset, + right: coords.right + xOffset, + bottom: coords.bottom + yOffset, + left: coords.left + xOffset, + width: coords.right - coords.left, + height: coords.bottom - coords.top + }; + } + var get_element_coordinates_default = getElementCoordinates; + function getViewportSize(win) { + var doc = win.document; + var docElement = doc.documentElement; + if (win.innerWidth) { + return { + width: win.innerWidth, + height: win.innerHeight + }; + } + if (docElement) { + return { + width: docElement.clientWidth, + height: docElement.clientHeight + }; + } + var body = doc.body; + return { + width: body.clientWidth, + height: body.clientHeight + }; + } + var get_viewport_size_default = getViewportSize; + function noParentScrolled(element, offset) { + element = get_composed_parent_default(element); + while (element && element.nodeName.toLowerCase() !== 'html') { + if (element.scrollTop) { + offset += element.scrollTop; + if (offset >= 0) { + return false; + } } - return visible5; + element = get_composed_parent_default(element); } - var style = window.getComputedStyle(el, null); - if (style === null) { + return true; + } + function isOffscreen(element) { + var _ref12 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, isAncestor = _ref12.isAncestor; + if (isAncestor) { return false; } - if (nodeName2 === 'area') { - return isAreaVisible(el, screenReader, recursed); + element = element instanceof abstract_virtual_node_default ? element.actualNode : element; + if (!element) { + return void 0; } - if (style.getPropertyValue('display') === 'none') { - return false; + var leftBoundary; + var docElement = document.documentElement; + var styl = window.getComputedStyle(element); + var dir = window.getComputedStyle(document.body || docElement).getPropertyValue('direction'); + var coords = get_element_coordinates_default(element); + if (coords.bottom < 0 && (noParentScrolled(element, coords.bottom) || styl.position === 'absolute')) { + return true; } - var elHeight = parseInt(style.getPropertyValue('height')); - var elWidth = parseInt(style.getPropertyValue('width')); - var scroll = _getScroll(el); - var scrollableWithZeroHeight = scroll && elHeight === 0; - var scrollableWithZeroWidth = scroll && elWidth === 0; - var posAbsoluteOverflowHiddenAndSmall = style.getPropertyValue('position') === 'absolute' && (elHeight < 2 || elWidth < 2) && style.getPropertyValue('overflow') === 'hidden'; - if (!screenReader && (isClipped(style) || style.getPropertyValue('opacity') === '0' || scrollableWithZeroHeight || scrollableWithZeroWidth || posAbsoluteOverflowHiddenAndSmall)) { + if (coords.left === 0 && coords.right === 0) { return false; } - if (!recursed && (style.getPropertyValue('visibility') === 'hidden' || !screenReader && is_offscreen_default(el))) { + if (dir === 'ltr') { + if (coords.right <= 0) { + return true; + } + } else { + leftBoundary = Math.max(docElement.scrollWidth, get_viewport_size_default(window).width); + if (coords.left >= leftBoundary) { + return true; + } + } + return false; + } + var is_offscreen_default = isOffscreen; + var hiddenMethods2 = [ opacityHidden, scrollHidden, overflowHidden, clipHidden, is_offscreen_default ]; + function _isVisibleOnScreen(vNode) { + vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); + return isVisibleOnScreenVirtual(vNode); + } + var isVisibleOnScreenVirtual = memoize_default(function isVisibleOnScreenMemoized(vNode, isAncestor) { + if (vNode.actualNode && vNode.props.nodeName === 'area') { + return !areaHidden(vNode, isVisibleOnScreenVirtual); + } + if (_isHiddenForEveryone(vNode, { + skipAncestors: true, + isAncestor: isAncestor + })) { return false; } - var parent = el.assignedSlot ? el.assignedSlot : el.parentNode; - var visible4 = false; - if (parent) { - visible4 = isVisible(parent, screenReader, true); + if (vNode.actualNode && hiddenMethods2.some(function(method) { + return method(vNode, { + isAncestor: isAncestor + }); + })) { + return false; } - if (vNode) { - vNode[cacheName] = visible4; + if (!vNode.parent) { + return true; } - return visible4; - } - var is_visible_default = isVisible; - var gridSize = 200; - function createGrid() { + return isVisibleOnScreenVirtual(vNode.parent, true); + }); + function _getBoundingRect(rectA, rectB) { + var top = Math.min(rectA.top, rectB.top); + var right = Math.max(rectA.right, rectB.right); + var bottom = Math.max(rectA.bottom, rectB.bottom); + var left = Math.min(rectA.left, rectB.left); + return new window.DOMRect(left, top, right - left, bottom - top); + } + function _isPointInRect(_ref13, _ref14) { + var x = _ref13.x, y = _ref13.y; + var top = _ref14.top, right = _ref14.right, bottom = _ref14.bottom, left = _ref14.left; + return y >= top && x <= right && y <= bottom && x >= left; + } + function _createGrid() { var root = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body; - var rootGrid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { - container: null, - cells: [] - }; + var rootGrid = arguments.length > 1 ? arguments[1] : undefined; var parentVNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; + if (cache_default.get('gridCreated') && !parentVNode) { + return constants_default.gridSize; + } + cache_default.set('gridCreated', true); if (!parentVNode) { + var _rootGrid; var vNode = get_node_from_tree_default(document.documentElement); if (!vNode) { vNode = new virtual_node_default(document.documentElement); } vNode._stackingOrder = [ 0 ]; + (_rootGrid = rootGrid) !== null && _rootGrid !== void 0 ? _rootGrid : rootGrid = new Grid(); addNodeToGrid(rootGrid, vNode); if (_getScroll(vNode.actualNode)) { - var subGrid = { - container: vNode, - cells: [] - }; + var subGrid = new Grid(vNode); vNode._subGrid = subGrid; } } @@ -7473,7 +7575,11 @@ var node = parentVNode ? treeWalker.nextNode() : treeWalker.currentNode; while (node) { var _vNode = get_node_from_tree_default(node); - if (node.parentElement) { + if (_vNode && _vNode.parent) { + parentVNode = _vNode.parent; + } else if (node.assignedSlot) { + parentVNode = get_node_from_tree_default(node.assignedSlot); + } else if (node.parentElement) { parentVNode = get_node_from_tree_default(node.parentElement); } else if (node.parentNode && get_node_from_tree_default(node.parentNode)) { parentVNode = get_node_from_tree_default(node.parentNode); @@ -7485,51 +7591,19 @@ var scrollRegionParent = findScrollRegionParent(_vNode, parentVNode); var grid = scrollRegionParent ? scrollRegionParent._subGrid : rootGrid; if (_getScroll(_vNode.actualNode)) { - var _subGrid = { - container: _vNode, - cells: [] - }; + var _subGrid = new Grid(_vNode); _vNode._subGrid = _subGrid; } var rect = _vNode.boundingClientRect; - if (rect.width !== 0 && rect.height !== 0 && is_visible_default(node)) { + if (rect.width !== 0 && rect.height !== 0 && _isVisibleOnScreen(node)) { addNodeToGrid(grid, _vNode); } if (is_shadow_root_default(node)) { - createGrid(node.shadowRoot, grid, _vNode); + _createGrid(node.shadowRoot, grid, _vNode); } node = treeWalker.nextNode(); } - } - function getRectStack(grid, rect) { - var _grid$cells$row$col$f, _grid$cells$row$col; - var recursed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; - var x = rect.left + rect.width / 2; - var y = rect.top + rect.height / 2; - var row = y / gridSize | 0; - var col = x / gridSize | 0; - if (row > grid.cells.length || col > grid.numCols) { - throw new Error('Element midpoint exceeds the grid bounds'); - } - var stack = (_grid$cells$row$col$f = (_grid$cells$row$col = grid.cells[row][col]) === null || _grid$cells$row$col === void 0 ? void 0 : _grid$cells$row$col.filter(function(gridCellNode) { - return gridCellNode.clientRects.find(function(clientRect) { - var rectX = clientRect.left; - var rectY = clientRect.top; - return x <= rectX + clientRect.width && x >= rectX && y <= rectY + clientRect.height && y >= rectY; - }); - })) !== null && _grid$cells$row$col$f !== void 0 ? _grid$cells$row$col$f : []; - var gridContainer = grid.container; - if (gridContainer) { - stack = getRectStack(gridContainer._grid, gridContainer.boundingClientRect, true).concat(stack); - } - if (!recursed) { - stack = stack.sort(visuallySort).map(function(vNode) { - return vNode.actualNode; - }).concat(document.documentElement).filter(function(node, index, array) { - return array.indexOf(node) === index; - }); - } - return stack; + return constants_default.gridSize; } function isStackingContext(vNode, parentVNode) { var position = vNode.getComputedStylePropertyValue('position'); @@ -7597,80 +7671,6 @@ } return false; } - function isFloated(vNode) { - if (!vNode) { - return false; - } - if (vNode._isFloated !== void 0) { - return vNode._isFloated; - } - var floatStyle = vNode.getComputedStylePropertyValue('float'); - if (floatStyle !== 'none') { - vNode._isFloated = true; - return true; - } - var floated = isFloated(vNode.parent); - vNode._isFloated = floated; - return floated; - } - function getPositionOrder(vNode) { - if (vNode.getComputedStylePropertyValue('display').indexOf('inline') !== -1) { - return 2; - } - if (isFloated(vNode)) { - return 1; - } - return 0; - } - function visuallySort(a, b) { - var length = Math.max(a._stackingOrder.length, b._stackingOrder.length); - for (var _i5 = 0; _i5 < length; _i5++) { - if (typeof b._stackingOrder[_i5] === 'undefined') { - return -1; - } else if (typeof a._stackingOrder[_i5] === 'undefined') { - return 1; - } - if (b._stackingOrder[_i5] > a._stackingOrder[_i5]) { - return 1; - } - if (b._stackingOrder[_i5] < a._stackingOrder[_i5]) { - return -1; - } - } - var aNode = a.actualNode; - var bNode = b.actualNode; - if (aNode.getRootNode && aNode.getRootNode() !== bNode.getRootNode()) { - var boundaries = []; - while (aNode) { - boundaries.push({ - root: aNode.getRootNode(), - node: aNode - }); - aNode = aNode.getRootNode().host; - } - while (bNode && !boundaries.find(function(boundary) { - return boundary.root === bNode.getRootNode(); - })) { - bNode = bNode.getRootNode().host; - } - aNode = boundaries.find(function(boundary) { - return boundary.root === bNode.getRootNode(); - }).node; - if (aNode === bNode) { - return a.actualNode.getRootNode() !== aNode.getRootNode() ? -1 : 1; - } - } - var _window$Node2 = window.Node, DOCUMENT_POSITION_FOLLOWING = _window$Node2.DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS = _window$Node2.DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY = _window$Node2.DOCUMENT_POSITION_CONTAINED_BY; - var docPosition = aNode.compareDocumentPosition(bNode); - var DOMOrder = docPosition & DOCUMENT_POSITION_FOLLOWING ? 1 : -1; - var isDescendant = docPosition & DOCUMENT_POSITION_CONTAINS || docPosition & DOCUMENT_POSITION_CONTAINED_BY; - var aPosition = getPositionOrder(a); - var bPosition = getPositionOrder(b); - if (aPosition === bPosition || isDescendant) { - return DOMOrder; - } - return bPosition - aPosition; - } function getStackingOrder(vNode, parentVNode) { var stackingOrder = parentVNode._stackingOrder.slice(); var zIndex = vNode.getComputedStylePropertyValue('z-index'); @@ -7717,252 +7717,137 @@ return scrollRegionParent; } function addNodeToGrid(grid, vNode) { - vNode._grid = grid; vNode.clientRects.forEach(function(rect) { - var _grid$numCols; - var x = rect.left; - var y = rect.top; - var startRow = y / gridSize | 0; - var startCol = x / gridSize | 0; - var endRow = (y + rect.height) / gridSize | 0; - var endCol = (x + rect.width) / gridSize | 0; - grid.numCols = Math.max((_grid$numCols = grid.numCols) !== null && _grid$numCols !== void 0 ? _grid$numCols : 0, endCol); - for (var row = startRow; row <= endRow; row++) { - grid.cells[row] = grid.cells[row] || []; - for (var col = startCol; col <= endCol; col++) { - grid.cells[row][col] = grid.cells[row][col] || []; - if (!grid.cells[row][col].includes(vNode)) { - grid.cells[row][col].push(vNode); - } + var _vNode$_grid; + (_vNode$_grid = vNode._grid) !== null && _vNode$_grid !== void 0 ? _vNode$_grid : vNode._grid = grid; + var gridRect = grid.getGridPositionOfRect(rect); + grid.loopGridPosition(gridRect, function(gridCell) { + if (!gridCell.includes(vNode)) { + gridCell.push(vNode); } - } - }); - } - function getElementStack(node) { - if (!cache_default.get('gridCreated')) { - createGrid(); - cache_default.set('gridCreated', true); - } - var vNode = get_node_from_tree_default(node); - var grid = vNode._grid; - if (!grid) { - return []; - } - return getRectStack(grid, vNode.boundingClientRect); - } - var get_element_stack_default = getElementStack; - function getTabbableElements(virtualNode) { - var nodeAndDescendents = query_selector_all_default(virtualNode, '*'); - var tabbableElements = nodeAndDescendents.filter(function(vNode) { - var isFocusable2 = vNode.isFocusable; - var tabIndex = vNode.actualNode.getAttribute('tabindex'); - tabIndex = tabIndex && !isNaN(parseInt(tabIndex, 10)) ? parseInt(tabIndex) : null; - return tabIndex ? isFocusable2 && tabIndex >= 0 : isFocusable2; + }); }); - return tabbableElements; - } - var get_tabbable_elements_default = getTabbableElements; - function sanitize(str) { - if (!str) { - return ''; - } - return str.replace(/\r\n/g, '\n').replace(/\u00A0/g, ' ').replace(/[\s]{2,}/g, ' ').trim(); } - var sanitize_default = sanitize; - function getTextElementStack(node) { - if (!cache_default.get('gridCreated')) { - createGrid(); - cache_default.set('gridCreated', true); - } - var vNode = get_node_from_tree_default(node); - var grid = vNode._grid; - if (!grid) { - return []; + var Grid = function() { + function Grid() { + var container = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + _classCallCheck(this, Grid); + this.container = container; + this.cells = []; } - var nodeRect = vNode.boundingClientRect; - var clientRects = []; - Array.from(node.childNodes).forEach(function(elm) { - if (elm.nodeType === 3 && sanitize_default(elm.textContent) !== '') { - var range = document.createRange(); - range.selectNodeContents(elm); - var rects = range.getClientRects(); - var outsideRectBounds = Array.from(rects).some(function(rect) { - var horizontalMidpoint = rect.left + rect.width / 2; - var verticalMidpoint = rect.top + rect.height / 2; - return horizontalMidpoint < nodeRect.left || horizontalMidpoint > nodeRect.right || verticalMidpoint < nodeRect.top || verticalMidpoint > nodeRect.bottom; - }); - if (outsideRectBounds) { - return; - } - for (var _i6 = 0; _i6 < rects.length; _i6++) { - var rect = rects[_i6]; - if (rect.width >= 1 && rect.height >= 1) { - clientRects.push(rect); - } - } + _createClass(Grid, [ { + key: 'toGridIndex', + value: function toGridIndex(num) { + return Math.floor(num / constants_default.gridSize); } - }); - if (!clientRects.length) { - return [ get_element_stack_default(node) ]; - } - return clientRects.map(function(rect) { - return getRectStack(grid, rect); - }); - } - var get_text_element_stack_default = getTextElementStack; - var visualRoles = [ 'checkbox', 'img', 'radio', 'range', 'slider', 'spinbutton', 'textbox' ]; - function isVisualContent(element) { - var role = element.getAttribute('role'); - if (role) { - return visualRoles.indexOf(role) !== -1; - } - switch (element.nodeName.toUpperCase()) { - case 'IMG': - case 'IFRAME': - case 'OBJECT': - case 'VIDEO': - case 'AUDIO': - case 'CANVAS': - case 'SVG': - case 'MATH': - case 'BUTTON': - case 'SELECT': - case 'TEXTAREA': - case 'KEYGEN': - case 'PROGRESS': - case 'METER': - return true; - - case 'INPUT': - return element.type !== 'hidden'; - - default: - return false; - } - } - var is_visual_content_default = isVisualContent; - function idrefs(node, attr) { - node = node.actualNode || node; - try { - var doc = get_root_node_default2(node); - var result = []; - var attrValue = node.getAttribute(attr); - if (attrValue) { - attrValue = token_list_default(attrValue); - for (var index = 0; index < attrValue.length; index++) { - result.push(doc.getElementById(attrValue[index])); - } + }, { + key: 'getCellFromPoint', + value: function getCellFromPoint(_ref15) { + var _this$cells, _row; + var x = _ref15.x, y = _ref15.y; + assert_default(this.boundaries, 'Grid does not have cells added'); + var rowIndex = this.toGridIndex(y); + var colIndex = this.toGridIndex(x); + assert_default(_isPointInRect({ + y: rowIndex, + x: colIndex + }, this.boundaries), 'Element midpoint exceeds the grid bounds'); + var row = (_this$cells = this.cells[rowIndex - this.cells._negativeIndex]) !== null && _this$cells !== void 0 ? _this$cells : []; + return (_row = row[colIndex - row._negativeIndex]) !== null && _row !== void 0 ? _row : []; } - return result; - } catch (e) { - throw new TypeError('Cannot resolve id references for non-DOM nodes'); - } - } - var idrefs_default = idrefs; - function visibleVirtual(element, screenReader, noRecursing) { - var vNode = element instanceof abstract_virtual_node_default ? element : get_node_from_tree_default(element); - var visible4 = !element.actualNode || element.actualNode && is_visible_default(element.actualNode, screenReader); - var result = vNode.children.map(function(child) { - var _child$props = child.props, nodeType = _child$props.nodeType, nodeValue = _child$props.nodeValue; - if (nodeType === 3) { - if (nodeValue && visible4) { - return nodeValue; - } - } else if (!noRecursing) { - return visibleVirtual(child, screenReader); + }, { + key: 'loopGridPosition', + value: function loopGridPosition(gridPosition, callback) { + var _gridPosition = gridPosition, left = _gridPosition.left, right = _gridPosition.right, top = _gridPosition.top, bottom = _gridPosition.bottom; + if (this.boundaries) { + gridPosition = _getBoundingRect(this.boundaries, gridPosition); + } + this.boundaries = gridPosition; + loopNegativeIndexMatrix(this.cells, top, bottom, function(gridRow, row) { + loopNegativeIndexMatrix(gridRow, left, right, function(gridCell, col) { + callback(gridCell, { + row: row, + col: col + }); + }); + }); } - }).join(''); - return sanitize_default(result); - } - var visible_virtual_default = visibleVirtual; - function labelVirtual(virtualNode) { - var ref, candidate; - if (virtualNode.attr('aria-labelledby')) { - ref = idrefs_default(virtualNode.actualNode, 'aria-labelledby'); - candidate = ref.map(function(thing) { - var vNode = get_node_from_tree_default(thing); - return vNode ? visible_virtual_default(vNode) : ''; - }).join(' ').trim(); - if (candidate) { - return candidate; + }, { + key: 'getGridPositionOfRect', + value: function getGridPositionOfRect(_ref16) { + var top = _ref16.top, right = _ref16.right, bottom = _ref16.bottom, left = _ref16.left; + var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + top = this.toGridIndex(top - margin); + right = this.toGridIndex(right + margin - 1); + bottom = this.toGridIndex(bottom + margin - 1); + left = this.toGridIndex(left - margin); + return new window.DOMRect(left, top, right - left, bottom - top); } + } ]); + return Grid; + }(); + function loopNegativeIndexMatrix(matrix, start, end, callback) { + var _matrix$_negativeInde; + (_matrix$_negativeInde = matrix._negativeIndex) !== null && _matrix$_negativeInde !== void 0 ? _matrix$_negativeInde : matrix._negativeIndex = 0; + if (start < matrix._negativeIndex) { + for (var _i5 = 0; _i5 < matrix._negativeIndex - start; _i5++) { + matrix.splice(0, 0, []); + } + matrix._negativeIndex = start; + } + var startOffset = start - matrix._negativeIndex; + var endOffset = end - matrix._negativeIndex; + for (var index = startOffset; index <= endOffset; index++) { + var _index, _matrix$_index; + (_matrix$_index = matrix[_index = index]) !== null && _matrix$_index !== void 0 ? _matrix$_index : matrix[_index] = []; + callback(matrix[index], index + matrix._negativeIndex); + } + } + function _findNearbyElms(vNode) { + var _vNode$_grid2, _vNode$_grid2$cells; + var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + _createGrid(); + if (!((_vNode$_grid2 = vNode._grid) !== null && _vNode$_grid2 !== void 0 && (_vNode$_grid2$cells = _vNode$_grid2.cells) !== null && _vNode$_grid2$cells !== void 0 && _vNode$_grid2$cells.length)) { + return []; } - candidate = virtualNode.attr('aria-label'); - if (candidate) { - candidate = sanitize_default(candidate); - if (candidate) { - return candidate; + var rect = vNode.boundingClientRect; + var grid = vNode._grid; + var selfIsFixed = hasFixedPosition(vNode); + var gridPosition = grid.getGridPositionOfRect(rect, margin); + var neighbors = []; + grid.loopGridPosition(gridPosition, function(vNeighbors) { + var _iterator2 = _createForOfIteratorHelper(vNeighbors), _step2; + try { + for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { + var vNeighbor = _step2.value; + if (vNeighbor && vNeighbor !== vNode && !neighbors.includes(vNeighbor) && selfIsFixed === hasFixedPosition(vNeighbor)) { + neighbors.push(vNeighbor); + } + } + } catch (err) { + _iterator2.e(err); + } finally { + _iterator2.f(); } - } - return null; - } - var label_virtual_default = labelVirtual; - var hiddenTextElms = [ 'HEAD', 'TITLE', 'TEMPLATE', 'SCRIPT', 'STYLE', 'IFRAME', 'OBJECT', 'VIDEO', 'AUDIO', 'NOSCRIPT' ]; - function hasChildTextNodes(elm) { - if (!hiddenTextElms.includes(elm.actualNode.nodeName.toUpperCase())) { - return elm.children.some(function(_ref10) { - var actualNode = _ref10.actualNode; - return actualNode.nodeType === 3 && actualNode.nodeValue.trim(); - }); - } - } - function hasContentVirtual(elm, noRecursion, ignoreAria) { - return hasChildTextNodes(elm) || is_visual_content_default(elm.actualNode) || !ignoreAria && !!label_virtual_default(elm) || !noRecursion && elm.children.some(function(child) { - return child.actualNode.nodeType === 1 && hasContentVirtual(child); }); + return neighbors; } - var has_content_virtual_default = hasContentVirtual; - function hasContent(elm, noRecursion, ignoreAria) { - elm = get_node_from_tree_default(elm); - return has_content_virtual_default(elm, noRecursion, ignoreAria); - } - var has_content_default = hasContent; - function isHiddenWithCSS(el, descendentVisibilityValue) { - var vNode = get_node_from_tree_default(el); + var hasFixedPosition = memoize_default(function(vNode) { if (!vNode) { - return _isHiddenWithCSS(el, descendentVisibilityValue); - } - if (vNode._isHiddenWithCSS === void 0) { - vNode._isHiddenWithCSS = _isHiddenWithCSS(el, descendentVisibilityValue); - } - return vNode._isHiddenWithCSS; - } - function _isHiddenWithCSS(el, descendentVisibilityValue) { - if (el.nodeType === 9) { - return false; - } - if (el.nodeType === 11) { - el = el.host; - } - if ([ 'STYLE', 'SCRIPT' ].includes(el.nodeName.toUpperCase())) { return false; } - var style = window.getComputedStyle(el, null); - if (!style) { - throw new Error('Style does not exist for the given element.'); - } - var displayValue = style.getPropertyValue('display'); - if (displayValue === 'none') { - return true; - } - var HIDDEN_VISIBILITY_VALUES = [ 'hidden', 'collapse' ]; - var visibilityValue = style.getPropertyValue('visibility'); - if (HIDDEN_VISIBILITY_VALUES.includes(visibilityValue) && !descendentVisibilityValue) { - return true; - } - if (HIDDEN_VISIBILITY_VALUES.includes(visibilityValue) && descendentVisibilityValue && HIDDEN_VISIBILITY_VALUES.includes(descendentVisibilityValue)) { + if (vNode.getComputedStylePropertyValue('position') === 'fixed') { return true; } - var parent = get_composed_parent_default(el); - if (parent && !HIDDEN_VISIBILITY_VALUES.includes(visibilityValue)) { - return isHiddenWithCSS(parent, visibilityValue); - } - return false; + return hasFixedPosition(vNode.parent); + }); + var allowedDisabledNodeNames = [ 'button', 'command', 'fieldset', 'keygen', 'optgroup', 'option', 'select', 'textarea', 'input' ]; + function isDisabledAttrAllowed(nodeName2) { + return allowedDisabledNodeNames.includes(nodeName2); } - var is_hidden_with_css_default = isHiddenWithCSS; function focusDisabled(el) { var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); - if (vNode.hasAttr('disabled')) { + if (isDisabledAttrAllowed(vNode.props.nodeName) && vNode.hasAttr('disabled')) { return true; } var parentNode = vNode.parent; @@ -7992,428 +7877,766 @@ if (!vNode.actualNode) { return false; } - return is_hidden_with_css_default(vNode.actualNode); + return _isHiddenForEveryone(vNode); } return false; } var focus_disabled_default = focusDisabled; - function isNativelyFocusable(el) { - var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); - if (!vNode || focus_disabled_default(vNode)) { + var angularSkipLinkRegex = /^\/\#/; + var angularRouterLinkRegex = /^#[!/]/; + function _isCurrentPageLink(anchor) { + var _window$location; + var href = anchor.getAttribute('href'); + if (!href || href === '#') { return false; } - switch (vNode.props.nodeName) { - case 'a': - case 'area': - if (vNode.hasAttr('href')) { - return true; - } - break; - - case 'input': - return vNode.props.type !== 'hidden'; - - case 'textarea': - case 'select': - case 'summary': - case 'button': + if (angularSkipLinkRegex.test(href)) { return true; - - case 'details': - return !query_selector_all_default(vNode, 'summary').length; } - return false; - } - var is_natively_focusable_default = isNativelyFocusable; - function isFocusable(el) { - var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); - if (vNode.props.nodeType !== 1) { + var hash = anchor.hash, protocol = anchor.protocol, hostname = anchor.hostname, port = anchor.port, pathname = anchor.pathname; + if (angularRouterLinkRegex.test(hash)) { return false; } - if (focus_disabled_default(vNode)) { - return false; - } else if (is_natively_focusable_default(vNode)) { + if (href.charAt(0) === '#') { return true; } - var tabindex = vNode.attr('tabindex'); - if (tabindex && !isNaN(parseInt(tabindex, 10))) { - return true; + if (typeof ((_window$location = window.location) === null || _window$location === void 0 ? void 0 : _window$location.origin) !== 'string' || window.location.origin.indexOf('://') === -1) { + return null; } - return false; - } - var is_focusable_default = isFocusable; - function insertedIntoFocusOrder(el) { - var tabIndex = parseInt(el.getAttribute('tabindex'), 10); - return tabIndex > -1 && is_focusable_default(el) && !is_natively_focusable_default(el); - } - var inserted_into_focus_order_default = insertedIntoFocusOrder; - function isHTML5(doc) { - var node = doc.doctype; - if (node === null) { - return false; + var currentPageUrl = window.location.origin + window.location.pathname; + var url; + if (!hostname) { + url = window.location.origin; + } else { + url = ''.concat(protocol, '//').concat(hostname).concat(port ? ':'.concat(port) : ''); } - return node.name === 'html' && !node.publicId && !node.systemId; - } - var is_html5_default = isHTML5; - function walkDomNode(node, functor) { - if (functor(node.actualNode) !== false) { - node.children.forEach(function(child) { - return walkDomNode(child, functor); - }); + if (!pathname) { + url += window.location.pathname; + } else { + url += (pathname[0] !== '/' ? '/' : '') + pathname; } + return url === currentPageUrl; } - var blockLike = [ 'block', 'list-item', 'table', 'flex', 'grid', 'inline-block' ]; - function isBlock(elm) { - var display = window.getComputedStyle(elm).getPropertyValue('display'); - return blockLike.includes(display) || display.substr(0, 6) === 'table-'; - } - function getBlockParent(node) { - var parentBlock = get_composed_parent_default(node); - while (parentBlock && !isBlock(parentBlock)) { - parentBlock = get_composed_parent_default(parentBlock); + function getElementByReference(node, attr) { + var fragment = node.getAttribute(attr); + if (!fragment) { + return null; } - return get_node_from_tree_default(parentBlock); - } - function isInTextBlock(node) { - if (isBlock(node)) { - return false; + if (attr === 'href' && !_isCurrentPageLink(node)) { + return null; } - var virtualParent = getBlockParent(node); - var parentText = ''; - var linkText = ''; - var inBrBlock = 0; - walkDomNode(virtualParent, function(currNode) { - if (inBrBlock === 2) { - return false; - } - if (currNode.nodeType === 3) { - parentText += currNode.nodeValue; + if (fragment.indexOf('#') !== -1) { + fragment = decodeURIComponent(fragment.substr(fragment.indexOf('#') + 1)); + } + var candidate = document.getElementById(fragment); + if (candidate) { + return candidate; + } + candidate = document.getElementsByName(fragment); + if (candidate.length) { + return candidate[0]; + } + return null; + } + var get_element_by_reference_default = getElementByReference; + function _visuallySort(a, b) { + _createGrid(); + var length = Math.max(a._stackingOrder.length, b._stackingOrder.length); + for (var _i6 = 0; _i6 < length; _i6++) { + if (typeof b._stackingOrder[_i6] === 'undefined') { + return -1; + } else if (typeof a._stackingOrder[_i6] === 'undefined') { + return 1; } - if (currNode.nodeType !== 1) { - return; + if (b._stackingOrder[_i6] > a._stackingOrder[_i6]) { + return 1; } - var nodeName2 = (currNode.nodeName || '').toUpperCase(); - if ([ 'BR', 'HR' ].includes(nodeName2)) { - if (inBrBlock === 0) { - parentText = ''; - linkText = ''; - } else { - inBrBlock = 2; - } - } else if (currNode.style.display === 'none' || currNode.style.overflow === 'hidden' || ![ '', null, 'none' ].includes(currNode.style['float']) || ![ '', null, 'relative' ].includes(currNode.style.position)) { - return false; - } else if (nodeName2 === 'A' && currNode.href || (currNode.getAttribute('role') || '').toLowerCase() === 'link') { - if (currNode === node) { - inBrBlock = 1; - } - linkText += currNode.textContent; - return false; + if (b._stackingOrder[_i6] < a._stackingOrder[_i6]) { + return -1; } - }); - parentText = sanitize_default(parentText); - linkText = sanitize_default(linkText); - return parentText.length > linkText.length; - } - var is_in_text_block_default = isInTextBlock; - function isModalOpen(options) { - options = options || {}; - var modalPercent = options.modalPercent || .75; - if (cache_default.get('isModalOpen')) { - return cache_default.get('isModalOpen'); } - var definiteModals = query_selector_all_filter_default(axe._tree[0], 'dialog, [role=dialog], [aria-modal=true]', function(vNode) { - return is_visible_default(vNode.actualNode); - }); - if (definiteModals.length) { - cache_default.set('isModalOpen', true); - return true; - } - var viewport = get_viewport_size_default(window); - var percentWidth = viewport.width * modalPercent; - var percentHeight = viewport.height * modalPercent; - var x = (viewport.width - percentWidth) / 2; - var y = (viewport.height - percentHeight) / 2; - var points = [ { - x: x, - y: y - }, { - x: viewport.width - x, - y: y - }, { - x: viewport.width / 2, - y: viewport.height / 2 - }, { - x: x, - y: viewport.height - y - }, { - x: viewport.width - x, - y: viewport.height - y - } ]; - var stacks = points.map(function(point) { - return Array.from(document.elementsFromPoint(point.x, point.y)); - }); - var _loop3 = function _loop3(_i7) { - var modalElement = stacks[_i7].find(function(elm) { - var style = window.getComputedStyle(elm); - return parseInt(style.width, 10) >= percentWidth && parseInt(style.height, 10) >= percentHeight && style.getPropertyValue('pointer-events') !== 'none' && (style.position === 'absolute' || style.position === 'fixed'); - }); - if (modalElement && stacks.every(function(stack) { - return stack.includes(modalElement); + var aNode = a.actualNode; + var bNode = b.actualNode; + if (aNode.getRootNode && aNode.getRootNode() !== bNode.getRootNode()) { + var boundaries = []; + while (aNode) { + boundaries.push({ + root: aNode.getRootNode(), + node: aNode + }); + aNode = aNode.getRootNode().host; + } + while (bNode && !boundaries.find(function(boundary) { + return boundary.root === bNode.getRootNode(); })) { - cache_default.set('isModalOpen', true); - return { - v: true - }; + bNode = bNode.getRootNode().host; } - }; - for (var _i7 = 0; _i7 < stacks.length; _i7++) { - var _ret = _loop3(_i7); - if (_typeof(_ret) === 'object') { - return _ret.v; + aNode = boundaries.find(function(boundary) { + return boundary.root === bNode.getRootNode(); + }).node; + if (aNode === bNode) { + return a.actualNode.getRootNode() !== aNode.getRootNode() ? -1 : 1; } } - cache_default.set('isModalOpen', void 0); - return void 0; + var _window$Node = window.Node, DOCUMENT_POSITION_FOLLOWING = _window$Node.DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_CONTAINS = _window$Node.DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_CONTAINED_BY = _window$Node.DOCUMENT_POSITION_CONTAINED_BY; + var docPosition = aNode.compareDocumentPosition(bNode); + var DOMOrder = docPosition & DOCUMENT_POSITION_FOLLOWING ? 1 : -1; + var isDescendant = docPosition & DOCUMENT_POSITION_CONTAINS || docPosition & DOCUMENT_POSITION_CONTAINED_BY; + var aPosition = getPositionOrder(a); + var bPosition = getPositionOrder(b); + if (aPosition === bPosition || isDescendant) { + return DOMOrder; + } + return bPosition - aPosition; } - var is_modal_open_default = isModalOpen; - function isNode(element) { - return element instanceof window.Node; + function getPositionOrder(vNode) { + if (vNode.getComputedStylePropertyValue('display').indexOf('inline') !== -1) { + return 2; + } + if (isFloated(vNode)) { + return 1; + } + return 0; } - var is_node_default = isNode; - var data = {}; - var incompleteData = { - set: function set(key, reason) { - if (typeof key !== 'string') { - throw new Error('Incomplete data: key must be a string'); - } - if (reason) { - data[key] = reason; - } - return data[key]; - }, - get: function get(key) { - return data[key]; - }, - clear: function clear() { - data = {}; + function isFloated(vNode) { + if (!vNode) { + return false; } - }; - var incomplete_data_default = incompleteData; - function elementHasImage(elm, style) { - var graphicNodes = [ 'IMG', 'CANVAS', 'OBJECT', 'IFRAME', 'VIDEO', 'SVG' ]; - var nodeName2 = elm.nodeName.toUpperCase(); - if (graphicNodes.includes(nodeName2)) { - incomplete_data_default.set('bgColor', 'imgNode'); - return true; + if (vNode._isFloated !== void 0) { + return vNode._isFloated; } - style = style || window.getComputedStyle(elm); - var bgImageStyle = style.getPropertyValue('background-image'); - var hasBgImage = bgImageStyle !== 'none'; - if (hasBgImage) { - var hasGradient = /gradient/.test(bgImageStyle); - incomplete_data_default.set('bgColor', hasGradient ? 'bgGradient' : 'bgImage'); + var floatStyle = vNode.getComputedStylePropertyValue('float'); + if (floatStyle !== 'none') { + vNode._isFloated = true; + return true; } - return hasBgImage; + var floated = isFloated(vNode.parent); + vNode._isFloated = floated; + return floated; } - var element_has_image_default = elementHasImage; - var ariaAttrs = { - 'aria-activedescendant': { - type: 'idref', - allowEmpty: true - }, - 'aria-atomic': { - type: 'boolean', - global: true - }, - 'aria-autocomplete': { - type: 'nmtoken', - values: [ 'inline', 'list', 'both', 'none' ] - }, - 'aria-busy': { - type: 'boolean', - global: true - }, - 'aria-checked': { - type: 'nmtoken', - values: [ 'false', 'mixed', 'true', 'undefined' ] - }, - 'aria-colcount': { - type: 'int', - minValue: -1 - }, - 'aria-colindex': { - type: 'int', - minValue: 1 - }, - 'aria-colspan': { - type: 'int', - minValue: 1 - }, - 'aria-controls': { - type: 'idrefs', - allowEmpty: true, - global: true - }, - 'aria-current': { - type: 'nmtoken', - allowEmpty: true, - values: [ 'page', 'step', 'location', 'date', 'time', 'true', 'false' ], - global: true + var math_exports = {}; + __export(math_exports, { + getBoundingRect: function getBoundingRect() { + return _getBoundingRect; }, - 'aria-describedby': { - type: 'idrefs', - allowEmpty: true, - global: true + getIntersectionRect: function getIntersectionRect() { + return _getIntersectionRect; }, - 'aria-details': { - type: 'idref', - allowEmpty: true, - global: true + getOffset: function getOffset() { + return _getOffset; }, - 'aria-disabled': { - type: 'boolean', - global: true + getRectCenter: function getRectCenter() { + return _getRectCenter; }, - 'aria-dropeffect': { - type: 'nmtokens', - values: [ 'copy', 'execute', 'link', 'move', 'none', 'popup' ], - global: true + hasVisualOverlap: function hasVisualOverlap() { + return _hasVisualOverlap; }, - 'aria-errormessage': { - type: 'idref', - allowEmpty: true, - global: true + isPointInRect: function isPointInRect() { + return _isPointInRect; }, - 'aria-expanded': { - type: 'nmtoken', - values: [ 'true', 'false', 'undefined' ] + rectsOverlap: function rectsOverlap() { + return _rectsOverlap; }, - 'aria-flowto': { - type: 'idrefs', - allowEmpty: true, - global: true - }, - 'aria-grabbed': { - type: 'nmtoken', - values: [ 'true', 'false', 'undefined' ], - global: true - }, - 'aria-haspopup': { - type: 'nmtoken', - allowEmpty: true, - values: [ 'true', 'false', 'menu', 'listbox', 'tree', 'grid', 'dialog' ], - global: true - }, - 'aria-hidden': { - type: 'nmtoken', - values: [ 'true', 'false', 'undefined' ], - global: true - }, - 'aria-invalid': { - type: 'nmtoken', - allowEmpty: true, - values: [ 'grammar', 'false', 'spelling', 'true' ], - global: true - }, - 'aria-keyshortcuts': { - type: 'string', - allowEmpty: true, - global: true - }, - 'aria-label': { - type: 'string', - allowEmpty: true, - global: true - }, - 'aria-labelledby': { - type: 'idrefs', - allowEmpty: true, - global: true - }, - 'aria-level': { - type: 'int', - minValue: 1 + splitRects: function splitRects() { + return _splitRects; + } + }); + function _getIntersectionRect(rect1, rect2) { + var leftX = Math.max(rect1.left, rect2.left); + var rightX = Math.min(rect1.right, rect2.right); + var topY = Math.max(rect1.top, rect2.top); + var bottomY = Math.min(rect1.bottom, rect2.bottom); + if (leftX >= rightX || topY >= bottomY) { + return null; + } + return new window.DOMRect(leftX, topY, rightX - leftX, bottomY - topY); + } + function _getOffset(vNodeA, vNodeB) { + var rectA = vNodeA.boundingClientRect; + var rectB = vNodeB.boundingClientRect; + var pointA = getFarthestPoint(rectA, rectB); + var pointB = getClosestPoint(pointA, rectA, rectB); + return pointDistance(pointA, pointB); + } + function getFarthestPoint(rectA, rectB) { + var dimensionProps = [ [ 'x', 'left', 'right', 'width' ], [ 'y', 'top', 'bottom', 'height' ] ]; + var farthestPoint = {}; + dimensionProps.forEach(function(_ref17) { + var _ref18 = _slicedToArray(_ref17, 4), axis = _ref18[0], start = _ref18[1], end = _ref18[2], diameter = _ref18[3]; + if (rectB[start] < rectA[start] && rectB[end] > rectA[end]) { + farthestPoint[axis] = rectA[start] + rectA[diameter] / 2; + return; + } + var centerB = rectB[start] + rectB[diameter] / 2; + var startDistance = Math.abs(centerB - rectA[start]); + var endDistance = Math.abs(centerB - rectA[end]); + if (startDistance >= endDistance) { + farthestPoint[axis] = rectA[start]; + } else { + farthestPoint[axis] = rectA[end]; + } + }); + return farthestPoint; + } + function getClosestPoint(_ref19, ownRect, adjacentRect) { + var x = _ref19.x, y = _ref19.y; + if (pointInRect({ + x: x, + y: y + }, adjacentRect)) { + var closestPoint = getCornerInAdjacentRect({ + x: x, + y: y + }, ownRect, adjacentRect); + if (closestPoint !== null) { + return closestPoint; + } + adjacentRect = ownRect; + } + var _adjacentRect = adjacentRect, top = _adjacentRect.top, right = _adjacentRect.right, bottom = _adjacentRect.bottom, left = _adjacentRect.left; + var xAligned = x >= left && x <= right; + var yAligned = y >= top && y <= bottom; + var closestX = Math.abs(left - x) < Math.abs(right - x) ? left : right; + var closestY = Math.abs(top - y) < Math.abs(bottom - y) ? top : bottom; + if (!xAligned && yAligned) { + return { + x: closestX, + y: y + }; + } else if (xAligned && !yAligned) { + return { + x: x, + y: closestY + }; + } else if (!xAligned && !yAligned) { + return { + x: closestX, + y: closestY + }; + } + if (Math.abs(x - closestX) < Math.abs(y - closestY)) { + return { + x: closestX, + y: y + }; + } else { + return { + x: x, + y: closestY + }; + } + } + function pointDistance(pointA, pointB) { + var xDistance = Math.abs(pointA.x - pointB.x); + var yDistance = Math.abs(pointA.y - pointB.y); + if (!xDistance || !yDistance) { + return xDistance || yDistance; + } + return Math.sqrt(Math.pow(xDistance, 2) + Math.pow(yDistance, 2)); + } + function pointInRect(_ref20, rect) { + var x = _ref20.x, y = _ref20.y; + return y >= rect.top && x <= rect.right && y <= rect.bottom && x >= rect.left; + } + function getCornerInAdjacentRect(_ref21, ownRect, adjacentRect) { + var x = _ref21.x, y = _ref21.y; + var closestX, closestY; + if (x === ownRect.left && ownRect.right < adjacentRect.right) { + closestX = ownRect.right; + } else if (x === ownRect.right && ownRect.left > adjacentRect.left) { + closestX = ownRect.left; + } + if (y === ownRect.top && ownRect.bottom < adjacentRect.bottom) { + closestY = ownRect.bottom; + } else if (y === ownRect.bottom && ownRect.top > adjacentRect.top) { + closestY = ownRect.top; + } + if (!closestX && !closestY) { + return null; + } else if (!closestY) { + return { + x: closestX, + y: y + }; + } else if (!closestX) { + return { + x: x, + y: closestY + }; + } + if (Math.abs(x - closestX) < Math.abs(y - closestY)) { + return { + x: closestX, + y: y + }; + } else { + return { + x: x, + y: closestY + }; + } + } + function _getRectCenter(_ref22) { + var left = _ref22.left, top = _ref22.top, width = _ref22.width, height = _ref22.height; + return new window.DOMPoint(left + width / 2, top + height / 2); + } + function _hasVisualOverlap(vNodeA, vNodeB) { + var rectA = vNodeA.boundingClientRect; + var rectB = vNodeB.boundingClientRect; + if (rectA.left >= rectB.right || rectA.right <= rectB.left || rectA.top >= rectB.bottom || rectA.bottom <= rectB.top) { + return false; + } + return _visuallySort(vNodeA, vNodeB) > 0; + } + function _splitRects(outerRect, overlapRects) { + var uniqueRects = [ outerRect ]; + var _iterator3 = _createForOfIteratorHelper(overlapRects), _step3; + try { + var _loop3 = function _loop3() { + var overlapRect = _step3.value; + uniqueRects = uniqueRects.reduce(function(uniqueRects2, inputRect) { + return uniqueRects2.concat(splitRect(inputRect, overlapRect)); + }, []); + }; + for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { + _loop3(); + } + } catch (err) { + _iterator3.e(err); + } finally { + _iterator3.f(); + } + return uniqueRects; + } + function splitRect(inputRect, clipRect) { + var top = inputRect.top, left = inputRect.left, bottom = inputRect.bottom, right = inputRect.right; + var yAligned = top < clipRect.bottom && bottom > clipRect.top; + var xAligned = left < clipRect.right && right > clipRect.left; + var rects = []; + if (between(clipRect.top, top, bottom) && xAligned) { + rects.push({ + top: top, + left: left, + bottom: clipRect.top, + right: right + }); + } + if (between(clipRect.right, left, right) && yAligned) { + rects.push({ + top: top, + left: clipRect.right, + bottom: bottom, + right: right + }); + } + if (between(clipRect.bottom, top, bottom) && xAligned) { + rects.push({ + top: clipRect.bottom, + right: right, + bottom: bottom, + left: left + }); + } + if (between(clipRect.left, left, right) && yAligned) { + rects.push({ + top: top, + left: left, + bottom: bottom, + right: clipRect.left + }); + } + if (rects.length === 0) { + rects.push(inputRect); + } + return rects.map(computeRect); + } + var between = function between(num, min, max) { + return num > min && num < max; + }; + function computeRect(baseRect) { + return _extends({}, baseRect, { + x: baseRect.left, + y: baseRect.top, + height: baseRect.bottom - baseRect.top, + width: baseRect.right - baseRect.left + }); + } + function getRectStack(grid, rect) { + var recursed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + var center = _getRectCenter(rect); + var gridCell = grid.getCellFromPoint(center) || []; + var floorX = Math.floor(center.x); + var floorY = Math.floor(center.y); + var stack = gridCell.filter(function(gridCellNode) { + return gridCellNode.clientRects.some(function(clientRect) { + var rectX = clientRect.left; + var rectY = clientRect.top; + return floorX < Math.floor(rectX + clientRect.width) && floorX >= Math.floor(rectX) && floorY < Math.floor(rectY + clientRect.height) && floorY >= Math.floor(rectY); + }); + }); + var gridContainer = grid.container; + if (gridContainer) { + stack = getRectStack(gridContainer._grid, gridContainer.boundingClientRect, true).concat(stack); + } + if (!recursed) { + stack = stack.sort(_visuallySort).map(function(vNode) { + return vNode.actualNode; + }).concat(document.documentElement).filter(function(node, index, array) { + return array.indexOf(node) === index; + }); + } + return stack; + } + function getElementStack(node) { + _createGrid(); + var vNode = get_node_from_tree_default(node); + var grid = vNode._grid; + if (!grid) { + return []; + } + return getRectStack(grid, vNode.boundingClientRect); + } + var get_element_stack_default = getElementStack; + function getTabbableElements(virtualNode) { + var nodeAndDescendents = query_selector_all_default(virtualNode, '*'); + var tabbableElements = nodeAndDescendents.filter(function(vNode) { + var isFocusable2 = vNode.isFocusable; + var tabIndex = vNode.actualNode.getAttribute('tabindex'); + tabIndex = tabIndex && !isNaN(parseInt(tabIndex, 10)) ? parseInt(tabIndex) : null; + return tabIndex ? isFocusable2 && tabIndex >= 0 : isFocusable2; + }); + return tabbableElements; + } + var get_tabbable_elements_default = getTabbableElements; + var text_exports = {}; + __export(text_exports, { + accessibleText: function accessibleText() { + return accessible_text_default; }, - 'aria-live': { - type: 'nmtoken', - values: [ 'assertive', 'off', 'polite' ], - global: true + accessibleTextVirtual: function accessibleTextVirtual() { + return accessible_text_virtual_default; }, - 'aria-modal': { - type: 'boolean' + autocomplete: function autocomplete() { + return _autocomplete; }, - 'aria-multiline': { - type: 'boolean' + formControlValue: function formControlValue() { + return form_control_value_default; }, - 'aria-multiselectable': { - type: 'boolean' + formControlValueMethods: function formControlValueMethods() { + return _formControlValueMethods; }, - 'aria-orientation': { - type: 'nmtoken', - values: [ 'horizontal', 'undefined', 'vertical' ] + hasUnicode: function hasUnicode() { + return has_unicode_default; }, - 'aria-owns': { - type: 'idrefs', - allowEmpty: true, - global: true + isHumanInterpretable: function isHumanInterpretable() { + return is_human_interpretable_default; }, - 'aria-placeholder': { - type: 'string', - allowEmpty: true + isIconLigature: function isIconLigature() { + return is_icon_ligature_default; }, - 'aria-posinset': { - type: 'int', - minValue: 1 + isValidAutocomplete: function isValidAutocomplete() { + return is_valid_autocomplete_default; }, - 'aria-pressed': { - type: 'nmtoken', - values: [ 'false', 'mixed', 'true', 'undefined' ] + label: function label() { + return label_default; }, - 'aria-readonly': { - type: 'boolean' + labelText: function labelText() { + return label_text_default; }, - 'aria-relevant': { - type: 'nmtokens', - values: [ 'additions', 'all', 'removals', 'text' ], - global: true + labelVirtual: function labelVirtual() { + return label_virtual_default2; }, - 'aria-required': { - type: 'boolean' + nativeElementType: function nativeElementType() { + return native_element_type_default; }, - 'aria-roledescription': { - type: 'string', - allowEmpty: true, - global: true + nativeTextAlternative: function nativeTextAlternative() { + return native_text_alternative_default; }, - 'aria-rowcount': { - type: 'int', - minValue: -1 + nativeTextMethods: function nativeTextMethods() { + return native_text_methods_default; }, - 'aria-rowindex': { - type: 'int', - minValue: 1 + removeUnicode: function removeUnicode() { + return remove_unicode_default; }, - 'aria-rowspan': { - type: 'int', - minValue: 0 + sanitize: function sanitize() { + return sanitize_default; }, - 'aria-selected': { - type: 'nmtoken', - values: [ 'false', 'true', 'undefined' ] + subtreeText: function subtreeText() { + return subtree_text_default; }, - 'aria-setsize': { - type: 'int', - minValue: -1 + titleText: function titleText() { + return title_text_default; }, - 'aria-sort': { - type: 'nmtoken', - values: [ 'ascending', 'descending', 'none', 'other' ] + unsupported: function unsupported() { + return unsupported_default; }, - 'aria-valuemax': { - type: 'decimal' + visible: function visible() { + return visible_default; }, - 'aria-valuemin': { - type: 'decimal' + visibleTextNodes: function visibleTextNodes() { + return visible_text_nodes_default; + }, + visibleVirtual: function visibleVirtual() { + return visible_virtual_default; + } + }); + function idrefs(node, attr) { + node = node.actualNode || node; + try { + var doc = get_root_node_default2(node); + var result = []; + var attrValue = node.getAttribute(attr); + if (attrValue) { + attrValue = token_list_default(attrValue); + for (var index = 0; index < attrValue.length; index++) { + result.push(doc.getElementById(attrValue[index])); + } + } + return result; + } catch (e) { + throw new TypeError('Cannot resolve id references for non-DOM nodes'); + } + } + var idrefs_default = idrefs; + function accessibleText(element, context) { + var virtualNode = get_node_from_tree_default(element); + return accessible_text_virtual_default(virtualNode, context); + } + var accessible_text_default = accessibleText; + function arialabelledbyText(vNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (!(vNode instanceof abstract_virtual_node_default)) { + if (vNode.nodeType !== 1) { + return ''; + } + vNode = get_node_from_tree_default(vNode); + } + if (vNode.props.nodeType !== 1 || context.inLabelledByContext || context.inControlContext || !vNode.attr('aria-labelledby')) { + return ''; + } + var refs = idrefs_default(vNode, 'aria-labelledby').filter(function(elm) { + return elm; + }); + return refs.reduce(function(accessibleName, elm) { + var accessibleNameAdd = accessible_text_default(elm, _extends({ + inLabelledByContext: true, + startNode: context.startNode || vNode + }, context)); + if (!accessibleName) { + return accessibleNameAdd; + } else { + return ''.concat(accessibleName, ' ').concat(accessibleNameAdd); + } + }, ''); + } + var arialabelledby_text_default = arialabelledbyText; + function arialabelText(vNode) { + if (!(vNode instanceof abstract_virtual_node_default)) { + if (vNode.nodeType !== 1) { + return ''; + } + vNode = get_node_from_tree_default(vNode); + } + return vNode.attr('aria-label') || ''; + } + var arialabel_text_default = arialabelText; + var ariaAttrs = { + 'aria-activedescendant': { + type: 'idref', + allowEmpty: true + }, + 'aria-atomic': { + type: 'boolean', + global: true + }, + 'aria-autocomplete': { + type: 'nmtoken', + values: [ 'inline', 'list', 'both', 'none' ] + }, + 'aria-busy': { + type: 'boolean', + global: true + }, + 'aria-checked': { + type: 'nmtoken', + values: [ 'false', 'mixed', 'true', 'undefined' ] + }, + 'aria-colcount': { + type: 'int', + minValue: -1 + }, + 'aria-colindex': { + type: 'int', + minValue: 1 + }, + 'aria-colspan': { + type: 'int', + minValue: 1 + }, + 'aria-controls': { + type: 'idrefs', + allowEmpty: true, + global: true + }, + 'aria-current': { + type: 'nmtoken', + allowEmpty: true, + values: [ 'page', 'step', 'location', 'date', 'time', 'true', 'false' ], + global: true + }, + 'aria-describedby': { + type: 'idrefs', + allowEmpty: true, + global: true + }, + 'aria-details': { + type: 'idref', + allowEmpty: true, + global: true + }, + 'aria-disabled': { + type: 'boolean', + global: true + }, + 'aria-dropeffect': { + type: 'nmtokens', + values: [ 'copy', 'execute', 'link', 'move', 'none', 'popup' ], + global: true + }, + 'aria-errormessage': { + type: 'idref', + allowEmpty: true, + global: true + }, + 'aria-expanded': { + type: 'nmtoken', + values: [ 'true', 'false', 'undefined' ] + }, + 'aria-flowto': { + type: 'idrefs', + allowEmpty: true, + global: true + }, + 'aria-grabbed': { + type: 'nmtoken', + values: [ 'true', 'false', 'undefined' ], + global: true + }, + 'aria-haspopup': { + type: 'nmtoken', + allowEmpty: true, + values: [ 'true', 'false', 'menu', 'listbox', 'tree', 'grid', 'dialog' ], + global: true + }, + 'aria-hidden': { + type: 'nmtoken', + values: [ 'true', 'false', 'undefined' ], + global: true + }, + 'aria-invalid': { + type: 'nmtoken', + values: [ 'grammar', 'false', 'spelling', 'true' ], + global: true + }, + 'aria-keyshortcuts': { + type: 'string', + allowEmpty: true, + global: true + }, + 'aria-label': { + type: 'string', + allowEmpty: true, + global: true + }, + 'aria-labelledby': { + type: 'idrefs', + allowEmpty: true, + global: true + }, + 'aria-level': { + type: 'int', + minValue: 1 + }, + 'aria-live': { + type: 'nmtoken', + values: [ 'assertive', 'off', 'polite' ], + global: true + }, + 'aria-modal': { + type: 'boolean' + }, + 'aria-multiline': { + type: 'boolean' + }, + 'aria-multiselectable': { + type: 'boolean' + }, + 'aria-orientation': { + type: 'nmtoken', + values: [ 'horizontal', 'undefined', 'vertical' ] + }, + 'aria-owns': { + type: 'idrefs', + allowEmpty: true, + global: true + }, + 'aria-placeholder': { + type: 'string', + allowEmpty: true + }, + 'aria-posinset': { + type: 'int', + minValue: 1 + }, + 'aria-pressed': { + type: 'nmtoken', + values: [ 'false', 'mixed', 'true', 'undefined' ] + }, + 'aria-readonly': { + type: 'boolean' + }, + 'aria-relevant': { + type: 'nmtokens', + values: [ 'additions', 'all', 'removals', 'text' ], + global: true + }, + 'aria-required': { + type: 'boolean' + }, + 'aria-roledescription': { + type: 'string', + allowEmpty: true, + global: true + }, + 'aria-rowcount': { + type: 'int', + minValue: -1 + }, + 'aria-rowindex': { + type: 'int', + minValue: 1 + }, + 'aria-rowspan': { + type: 'int', + minValue: 0 + }, + 'aria-selected': { + type: 'nmtoken', + values: [ 'false', 'true', 'undefined' ] + }, + 'aria-setsize': { + type: 'int', + minValue: -1 + }, + 'aria-sort': { + type: 'nmtoken', + values: [ 'ascending', 'descending', 'none', 'other' ] + }, + 'aria-valuemax': { + type: 'decimal' + }, + 'aria-valuemin': { + type: 'decimal' }, 'aria-valuenow': { type: 'decimal' @@ -8478,7 +8701,8 @@ }, checkbox: { type: 'widget', - allowedAttrs: [ 'aria-checked', 'aria-readonly', 'aria-required' ], + requiredAttrs: [ 'aria-checked' ], + allowedAttrs: [ 'aria-readonly', 'aria-required' ], superclassRole: [ 'input' ], accessibleNameRequired: true, nameFromContent: true, @@ -8498,7 +8722,7 @@ nameFromContent: true }, combobox: { - type: 'composite', + type: 'widget', requiredAttrs: [ 'aria-expanded', 'aria-controls' ], allowedAttrs: [ 'aria-owns', 'aria-autocomplete', 'aria-readonly', 'aria-required', 'aria-activedescendant', 'aria-orientation' ], superclassRole: [ 'select' ], @@ -8632,12 +8856,12 @@ }, list: { type: 'structure', - requiredOwned: [ 'group', 'listitem' ], + requiredOwned: [ 'listitem' ], allowedAttrs: [ 'aria-expanded' ], superclassRole: [ 'section' ] }, listbox: { - type: 'composite', + type: 'widget', requiredOwned: [ 'group', 'option' ], allowedAttrs: [ 'aria-multiselectable', 'aria-readonly', 'aria-required', 'aria-activedescendant', 'aria-expanded', 'aria-orientation' ], superclassRole: [ 'select' ], @@ -8645,7 +8869,7 @@ }, listitem: { type: 'structure', - requiredContext: [ 'list', 'group' ], + requiredContext: [ 'list' ], allowedAttrs: [ 'aria-level', 'aria-posinset', 'aria-setsize', 'aria-expanded' ], superclassRole: [ 'section' ], nameFromContent: true @@ -8673,13 +8897,13 @@ }, menu: { type: 'composite', - requiredOwned: [ 'group', 'menuitemradio', 'menuitem', 'menuitemcheckbox' ], + requiredOwned: [ 'group', 'menuitemradio', 'menuitem', 'menuitemcheckbox', 'menu', 'separator' ], allowedAttrs: [ 'aria-activedescendant', 'aria-expanded', 'aria-orientation' ], superclassRole: [ 'select' ] }, menubar: { type: 'composite', - requiredOwned: [ 'group', 'menuitemradio', 'menuitem', 'menuitemcheckbox' ], + requiredOwned: [ 'group', 'menuitemradio', 'menuitem', 'menuitemcheckbox', 'menu', 'separator' ], allowedAttrs: [ 'aria-activedescendant', 'aria-expanded', 'aria-orientation' ], superclassRole: [ 'menu' ] }, @@ -8694,7 +8918,8 @@ menuitemcheckbox: { type: 'widget', requiredContext: [ 'menu', 'menubar', 'group' ], - allowedAttrs: [ 'aria-checked', 'aria-posinset', 'aria-readonly', 'aria-setsize' ], + requiredAttrs: [ 'aria-checked' ], + allowedAttrs: [ 'aria-posinset', 'aria-readonly', 'aria-setsize' ], superclassRole: [ 'checkbox', 'menuitem' ], accessibleNameRequired: true, nameFromContent: true, @@ -8703,7 +8928,8 @@ menuitemradio: { type: 'widget', requiredContext: [ 'menu', 'menubar', 'group' ], - allowedAttrs: [ 'aria-checked', 'aria-posinset', 'aria-readonly', 'aria-setsize' ], + requiredAttrs: [ 'aria-checked' ], + allowedAttrs: [ 'aria-posinset', 'aria-readonly', 'aria-setsize' ], superclassRole: [ 'menuitemcheckbox', 'radio' ], accessibleNameRequired: true, nameFromContent: true, @@ -8711,8 +8937,8 @@ }, meter: { type: 'structure', - allowedAttrs: [ 'aria-valuetext' ], - requiredAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-valuenow' ], + requiredAttrs: [ 'aria-valuenow' ], + allowedAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-valuetext' ], superclassRole: [ 'range' ], accessibleNameRequired: true, childrenPresentational: true @@ -8765,7 +8991,8 @@ }, radio: { type: 'widget', - allowedAttrs: [ 'aria-checked', 'aria-posinset', 'aria-setsize', 'aria-required' ], + requiredAttrs: [ 'aria-checked' ], + allowedAttrs: [ 'aria-posinset', 'aria-setsize', 'aria-required' ], superclassRole: [ 'input' ], accessibleNameRequired: true, nameFromContent: true, @@ -8773,7 +9000,6 @@ }, radiogroup: { type: 'composite', - requiredOwned: [ 'radio' ], allowedAttrs: [ 'aria-readonly', 'aria-required', 'aria-activedescendant', 'aria-expanded', 'aria-orientation' ], superclassRole: [ 'select' ], accessibleNameRequired: false @@ -8849,7 +9075,8 @@ }, separator: { type: 'structure', - allowedAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-orientation', 'aria-valuetext' ], + requiredAttrs: [ 'aria-valuenow' ], + allowedAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-orientation', 'aria-valuetext' ], superclassRole: [ 'structure', 'widget' ], childrenPresentational: true }, @@ -8863,8 +9090,7 @@ }, spinbutton: { type: 'widget', - requiredAttrs: [ 'aria-valuenow' ], - allowedAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-readonly', 'aria-required', 'aria-activedescendant', 'aria-valuetext' ], + allowedAttrs: [ 'aria-valuemax', 'aria-valuemin', 'aria-readonly', 'aria-required', 'aria-activedescendant', 'aria-valuetext', 'aria-valuenow' ], superclassRole: [ 'composite', 'input', 'range' ], accessibleNameRequired: true }, @@ -9247,7 +9473,7 @@ contentTypes: [ 'phrasing', 'flow' ], allowedRoles: true }, - addres: { + address: { contentTypes: [ 'flow' ], allowedRoles: true }, @@ -9318,7 +9544,7 @@ }, button: { contentTypes: [ 'interactive', 'phrasing', 'flow' ], - allowedRoles: [ 'checkbox', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'radio', 'switch', 'tab' ], + allowedRoles: [ 'checkbox', 'combobox', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'radio', 'switch', 'tab' ], namingMethods: [ 'subtreeText' ] }, canvas: { @@ -9529,7 +9755,7 @@ type: 'button' } }, - allowedRoles: [ 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'radio', 'switch', 'tab' ] + allowedRoles: [ 'checkbox', 'combobox', 'link', 'menuitem', 'menuitemcheckbox', 'menuitemradio', 'option', 'radio', 'switch', 'tab' ] }, buttonType: { matches: { @@ -9693,7 +9919,7 @@ }, nav: { contentTypes: [ 'sectioning', 'flow' ], - allowedRoles: [ 'doc-index', 'doc-pagelist', 'doc-toc', 'menu', 'menubar', 'tablist' ], + allowedRoles: [ 'doc-index', 'doc-pagelist', 'doc-toc', 'menu', 'menubar', 'none', 'presentation', 'tablist' ], shadowRoot: true }, noscript: { @@ -10107,3722 +10333,4704 @@ }); } var standards_default = standards; - function convertColorVal(colorFunc, value, index) { - if (/%$/.test(value)) { - if (index === 3) { - return parseFloat(value) / 100; - } - return parseFloat(value) * 255 / 100; - } - if (colorFunc[index] === 'h') { - if (/turn$/.test(value)) { - return parseFloat(value) * 360; - } - if (/rad$/.test(value)) { - return parseFloat(value) * 57.3; - } - } - return parseFloat(value); + function isUnsupportedRole(role) { + var roleDefinition = standards_default.ariaRoles[role]; + return roleDefinition ? !!roleDefinition.unsupported : false; } - function hslToRgb(_ref11) { - var _ref12 = _slicedToArray(_ref11, 4), hue = _ref12[0], saturation = _ref12[1], lightness = _ref12[2], alpha = _ref12[3]; - saturation /= 255; - lightness /= 255; - var high = (1 - Math.abs(2 * lightness - 1)) * saturation; - var low = high * (1 - Math.abs(hue / 60 % 2 - 1)); - var base = lightness - high / 2; - var colors; - if (hue < 60) { - colors = [ high, low, 0 ]; - } else if (hue < 120) { - colors = [ low, high, 0 ]; - } else if (hue < 180) { - colors = [ 0, high, low ]; - } else if (hue < 240) { - colors = [ 0, low, high ]; - } else if (hue < 300) { - colors = [ low, 0, high ]; - } else { - colors = [ high, 0, low ]; + var is_unsupported_role_default = isUnsupportedRole; + function isValidRole(role) { + var _ref23 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, allowAbstract = _ref23.allowAbstract, _ref23$flagUnsupporte = _ref23.flagUnsupported, flagUnsupported = _ref23$flagUnsupporte === void 0 ? false : _ref23$flagUnsupporte; + var roleDefinition = standards_default.ariaRoles[role]; + var isRoleUnsupported = is_unsupported_role_default(role); + if (!roleDefinition || flagUnsupported && isRoleUnsupported) { + return false; } - return colors.map(function(color11) { - return Math.round((color11 + base) * 255); - }).concat(alpha); + return allowAbstract ? true : roleDefinition.type !== 'abstract'; } - function Color(red, green, blue, alpha) { - this.red = red; - this.green = green; - this.blue = blue; - this.alpha = alpha; - this.toHexString = function toHexString() { - var redString = Math.round(this.red).toString(16); - var greenString = Math.round(this.green).toString(16); - var blueString = Math.round(this.blue).toString(16); - return '#' + (this.red > 15.5 ? redString : '0' + redString) + (this.green > 15.5 ? greenString : '0' + greenString) + (this.blue > 15.5 ? blueString : '0' + blueString); - }; - var hexRegex = /^#[0-9a-f]{3,8}$/i; - var colorFnRegex = /^((?:rgb|hsl)a?)\s*\(([^\)]*)\)/i; - this.parseString = function parseString(colorString) { - if (standards_default.cssColors[colorString] || colorString === 'transparent') { - var _ref13 = standards_default.cssColors[colorString] || [ 0, 0, 0 ], _ref14 = _slicedToArray(_ref13, 3), red2 = _ref14[0], green2 = _ref14[1], blue2 = _ref14[2]; - this.red = red2; - this.green = green2; - this.blue = blue2; - this.alpha = colorString === 'transparent' ? 0 : 1; - return; - } - if (colorString.match(colorFnRegex)) { - this.parseColorFnString(colorString); - return; - } - if (colorString.match(hexRegex)) { - this.parseHexString(colorString); - return; - } - throw new Error('Unable to parse color "'.concat(colorString, '"')); - }; - this.parseRgbString = function parseRgbString(colorString) { - if (colorString === 'transparent') { - this.red = 0; - this.green = 0; - this.blue = 0; - this.alpha = 0; - return; - } - this.parseColorFnString(colorString); - }; - this.parseHexString = function parseHexString(colorString) { - if (!colorString.match(hexRegex) || [ 6, 8 ].includes(colorString.length)) { - return; + var is_valid_role_default = isValidRole; + function getExplicitRole(vNode) { + var _ref24 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, fallback = _ref24.fallback, abstracts = _ref24.abstracts, dpub = _ref24.dpub; + vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); + if (vNode.props.nodeType !== 1) { + return null; + } + var roleAttr = (vNode.attr('role') || '').trim().toLowerCase(); + var roleList = fallback ? token_list_default(roleAttr) : [ roleAttr ]; + var firstValidRole = roleList.find(function(role) { + if (!dpub && role.substr(0, 4) === 'doc-') { + return false; } - colorString = colorString.replace('#', ''); - if (colorString.length < 6) { - var _colorString = colorString, _colorString2 = _slicedToArray(_colorString, 4), r = _colorString2[0], g = _colorString2[1], b = _colorString2[2], a = _colorString2[3]; - colorString = r + r + g + g + b + b; - if (a) { - colorString += a + a; - } + return is_valid_role_default(role, { + allowAbstract: abstracts + }); + }); + return firstValidRole || null; + } + var get_explicit_role_default = getExplicitRole; + function getElementsByContentType(type) { + return Object.keys(standards_default.htmlElms).filter(function(nodeName2) { + var elm = standards_default.htmlElms[nodeName2]; + if (elm.contentTypes) { + return elm.contentTypes.includes(type); } - var aRgbHex = colorString.match(/.{1,2}/g); - this.red = parseInt(aRgbHex[0], 16); - this.green = parseInt(aRgbHex[1], 16); - this.blue = parseInt(aRgbHex[2], 16); - if (aRgbHex[3]) { - this.alpha = parseInt(aRgbHex[3], 16) / 255; - } else { - this.alpha = 1; + if (!elm.variant) { + return false; } - }; - this.parseColorFnString = function parseColorFnString(colorString) { - var _ref15 = colorString.match(colorFnRegex) || [], _ref16 = _slicedToArray(_ref15, 3), colorFunc = _ref16[1], colorValStr = _ref16[2]; - if (!colorFunc || !colorValStr) { - return; + if (elm.variant['default'] && elm.variant['default'].contentTypes) { + return elm.variant['default'].contentTypes.includes(type); } - var colorVals = colorValStr.split(/\s*[,\/\s]\s*/).map(function(str) { - return str.replace(',', '').trim(); - }).filter(function(str) { - return str !== ''; - }); - var colorNums = colorVals.map(function(val, index) { - return convertColorVal(colorFunc, val, index); + return false; + }); + } + var get_elements_by_content_type_default = getElementsByContentType; + function getGlobalAriaAttrs() { + return cache_default.get('globalAriaAttrs', function() { + return Object.keys(standards_default.ariaAttrs).filter(function(attrName) { + return standards_default.ariaAttrs[attrName].global; }); - if (colorFunc.substr(0, 3) === 'hsl') { - colorNums = hslToRgb(colorNums); - } - this.red = colorNums[0]; - this.green = colorNums[1]; - this.blue = colorNums[2]; - this.alpha = typeof colorNums[3] === 'number' ? colorNums[3] : 1; - }; - this.getRelativeLuminance = function getRelativeLuminance() { - var rSRGB = this.red / 255; - var gSRGB = this.green / 255; - var bSRGB = this.blue / 255; - var r = rSRGB <= .03928 ? rSRGB / 12.92 : Math.pow((rSRGB + .055) / 1.055, 2.4); - var g = gSRGB <= .03928 ? gSRGB / 12.92 : Math.pow((gSRGB + .055) / 1.055, 2.4); - var b = bSRGB <= .03928 ? bSRGB / 12.92 : Math.pow((bSRGB + .055) / 1.055, 2.4); - return .2126 * r + .7152 * g + .0722 * b; - }; + }); } - var color_default = Color; - function getOwnBackgroundColor(elmStyle) { - var bgColor = new color_default(); - bgColor.parseString(elmStyle.getPropertyValue('background-color')); - if (bgColor.alpha !== 0) { - var opacity = elmStyle.getPropertyValue('opacity'); - bgColor.alpha = bgColor.alpha * opacity; + var get_global_aria_attrs_default = getGlobalAriaAttrs; + function toGrid(node) { + var table = []; + var rows = node.rows; + for (var i = 0, rowLength = rows.length; i < rowLength; i++) { + var cells = rows[i].cells; + table[i] = table[i] || []; + var columnIndex = 0; + for (var j = 0, cellLength = cells.length; j < cellLength; j++) { + for (var colSpan = 0; colSpan < cells[j].colSpan; colSpan++) { + var rowspanAttr = cells[j].getAttribute('rowspan'); + var rowspanValue = parseInt(rowspanAttr) === 0 || cells[j].rowspan === 0 ? rows.length : cells[j].rowSpan; + for (var rowSpan = 0; rowSpan < rowspanValue; rowSpan++) { + table[i + rowSpan] = table[i + rowSpan] || []; + while (table[i + rowSpan][columnIndex]) { + columnIndex++; + } + table[i + rowSpan][columnIndex] = cells[j]; + } + columnIndex++; + } + } } - return bgColor; + return table; } - var get_own_background_color_default = getOwnBackgroundColor; - function isOpaque(node) { - var style = window.getComputedStyle(node); - return element_has_image_default(node, style) || get_own_background_color_default(style).alpha === 1; - } - var is_opaque_default = isOpaque; - function _isSkipLink(element) { - if (!element.href) { - return false; + var to_grid_default = memoize_default(toGrid); + function getCellPosition(cell, tableGrid) { + var rowIndex, index; + if (!tableGrid) { + tableGrid = to_grid_default(find_up_default(cell, 'table')); } - var firstPageLink; - if (typeof cache_default.get('firstPageLink') !== 'undefined') { - firstPageLink = cache_default.get('firstPageLink'); - } else { - if (!window.location.origin) { - firstPageLink = query_selector_all_default(axe._tree, 'a:not([href^="#"]):not([href^="/#"]):not([href^="javascript:"])')[0]; - } else { - firstPageLink = query_selector_all_default(axe._tree, 'a[href]:not([href^="javascript:"])').find(function(link) { - return !_isCurrentPageLink(link.actualNode); - }); + for (rowIndex = 0; rowIndex < tableGrid.length; rowIndex++) { + if (tableGrid[rowIndex]) { + index = tableGrid[rowIndex].indexOf(cell); + if (index !== -1) { + return { + x: index, + y: rowIndex + }; + } } - cache_default.set('firstPageLink', firstPageLink || null); - } - if (!firstPageLink) { - return true; } - return element.compareDocumentPosition(firstPageLink.actualNode) === element.DOCUMENT_POSITION_FOLLOWING; } - function reduceToElementsBelowFloating(elements, targetNode) { - var floatingPositions = [ 'fixed', 'sticky' ]; - var finalElements = []; - var targetFound = false; - for (var index = 0; index < elements.length; ++index) { - var currentNode = elements[index]; - if (currentNode === targetNode) { - targetFound = true; - } - var style = window.getComputedStyle(currentNode); - if (!targetFound && floatingPositions.indexOf(style.position) !== -1) { - finalElements = []; - continue; - } - finalElements.push(currentNode); + var get_cell_position_default = memoize_default(getCellPosition); + function getScope(cell) { + var vNode = cell instanceof abstract_virtual_node_default ? cell : get_node_from_tree_default(cell); + cell = vNode.actualNode; + var scope = vNode.attr('scope'); + var role = vNode.attr('role'); + if (![ 'td', 'th' ].includes(vNode.props.nodeName)) { + throw new TypeError('Expected TD or TH element'); } - return finalElements; - } - var reduce_to_elements_below_floating_default = reduceToElementsBelowFloating; - function _visuallyContains(node, parent) { - var parentScrollAncestor = getScrollAncestor(parent); - do { - var nextScrollAncestor = getScrollAncestor(node); - if (nextScrollAncestor === parentScrollAncestor || nextScrollAncestor === parent) { - return contains2(node, parent); - } - node = nextScrollAncestor; - } while (node); - return false; - } - function getScrollAncestor(node) { - var vNode = get_node_from_tree_default(node); - var ancestor = vNode.parent; - while (ancestor) { - if (_getScroll(ancestor.actualNode)) { - return ancestor.actualNode; - } - ancestor = ancestor.parent; - } - } - function contains2(node, parent) { - var style = window.getComputedStyle(parent); - var overflow = style.getPropertyValue('overflow'); - if (style.getPropertyValue('display') === 'inline') { - return true; - } - var clientRects = Array.from(node.getClientRects()); - var boundingRect = parent.getBoundingClientRect(); - var rect = { - left: boundingRect.left, - top: boundingRect.top, - width: boundingRect.width, - height: boundingRect.height - }; - if ([ 'scroll', 'auto' ].includes(overflow) || parent instanceof window.HTMLHtmlElement) { - rect.width = parent.scrollWidth; - rect.height = parent.scrollHeight; + if (role === 'columnheader') { + return 'col'; + } else if (role === 'rowheader') { + return 'row'; + } else if (scope === 'col' || scope === 'row') { + return scope; + } else if (vNode.props.nodeName !== 'th') { + return false; + } else if (!vNode.actualNode) { + return 'auto'; } - if (clientRects.length === 1 && overflow === 'hidden' && style.getPropertyValue('white-space') === 'nowrap') { - clientRects[0] = rect; + var tableGrid = to_grid_default(find_up_default(cell, 'table')); + var pos = get_cell_position_default(cell, tableGrid); + var headerRow = tableGrid[pos.y].reduce(function(headerRow2, cell2) { + return headerRow2 && cell2.nodeName.toUpperCase() === 'TH'; + }, true); + if (headerRow) { + return 'col'; } - return clientRects.some(function(clientRect) { - return !(Math.ceil(clientRect.left) < Math.floor(rect.left) || Math.ceil(clientRect.top) < Math.floor(rect.top) || Math.floor(clientRect.left + clientRect.width) > Math.ceil(rect.left + rect.width) || Math.floor(clientRect.top + clientRect.height) > Math.ceil(rect.top + rect.height)); - }); - } - function shadowElementsFromPoint(nodeX, nodeY) { - var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; - var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; - if (i > 999) { - throw new Error('Infinite loop detected'); + var headerCol = tableGrid.map(function(col) { + return col[pos.x]; + }).reduce(function(headerCol2, cell2) { + return headerCol2 && cell2 && cell2.nodeName.toUpperCase() === 'TH'; + }, true); + if (headerCol) { + return 'row'; } - return Array.from(root.elementsFromPoint(nodeX, nodeY) || []).filter(function(nodes) { - return get_root_node_default2(nodes) === root; - }).reduce(function(stack, elm) { - if (is_shadow_root_default(elm)) { - var shadowStack = shadowElementsFromPoint(nodeX, nodeY, elm.shadowRoot, i + 1); - stack = stack.concat(shadowStack); - if (stack.length && _visuallyContains(stack[0], elm)) { - stack.push(elm); - } - } else { - stack.push(elm); - } - return stack; - }, []); + return 'auto'; } - var shadow_elements_from_point_default = shadowElementsFromPoint; - function urlPropsFromAttribute(node, attribute) { - if (!node.hasAttribute(attribute)) { - return void 0; - } - var nodeName2 = node.nodeName.toUpperCase(); - var parser2 = node; - if (![ 'A', 'AREA' ].includes(nodeName2) || node.ownerSVGElement) { - parser2 = document.createElement('a'); - parser2.href = node.getAttribute(attribute); - } - var protocol = [ 'https:', 'ftps:' ].includes(parser2.protocol) ? parser2.protocol.replace(/s:$/, ':') : parser2.protocol; - var parserPathname = /^\//.test(parser2.pathname) ? parser2.pathname : '/'.concat(parser2.pathname); - var _getPathnameOrFilenam = getPathnameOrFilename(parserPathname), pathname = _getPathnameOrFilenam.pathname, filename = _getPathnameOrFilenam.filename; - return { - protocol: protocol, - hostname: parser2.hostname, - port: getPort(parser2.port), - pathname: /\/$/.test(pathname) ? pathname : ''.concat(pathname, '/'), - search: getSearchPairs(parser2.search), - hash: getHashRoute(parser2.hash), - filename: filename - }; + var get_scope_default = getScope; + function isColumnHeader(element) { + return [ 'col', 'auto' ].indexOf(get_scope_default(element)) !== -1; } - function getPort(port) { - var excludePorts = [ '443', '80' ]; - return !excludePorts.includes(port) ? port : ''; + var is_column_header_default = isColumnHeader; + function isRowHeader(cell) { + return [ 'row', 'auto' ].includes(get_scope_default(cell)); } - function getPathnameOrFilename(pathname) { - var filename = pathname.split('/').pop(); - if (!filename || filename.indexOf('.') === -1) { - return { - pathname: pathname, - filename: '' - }; + var is_row_header_default = isRowHeader; + function sanitize(str) { + if (!str) { + return ''; } - return { - pathname: pathname.replace(filename, ''), - filename: /index./.test(filename) ? '' : filename - }; + return str.replace(/\r\n/g, '\n').replace(/\u00A0/g, ' ').replace(/[\s]{2,}/g, ' ').trim(); } - function getSearchPairs(searchStr) { - var query = {}; - if (!searchStr || !searchStr.length) { - return query; - } - var pairs = searchStr.substring(1).split('&'); - if (!pairs || !pairs.length) { - return query; + var sanitize_default = sanitize; + function isNativelyFocusable(el) { + var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); + if (!vNode || focus_disabled_default(vNode)) { + return false; } - for (var index = 0; index < pairs.length; index++) { - var pair = pairs[index]; - var _pair$split = pair.split('='), _pair$split2 = _slicedToArray(_pair$split, 2), key = _pair$split2[0], _pair$split2$ = _pair$split2[1], value = _pair$split2$ === void 0 ? '' : _pair$split2$; - query[decodeURIComponent(key)] = decodeURIComponent(value); + switch (vNode.props.nodeName) { + case 'a': + case 'area': + if (vNode.hasAttr('href')) { + return true; + } + break; + + case 'input': + return vNode.props.type !== 'hidden'; + + case 'textarea': + case 'select': + case 'summary': + case 'button': + return true; + + case 'details': + return !query_selector_all_default(vNode, 'summary').length; } - return query; + return false; } - function getHashRoute(hash) { - if (!hash) { - return ''; - } - var hashRegex = /#!?\/?/g; - var hasMatch = hash.match(hashRegex); - if (!hasMatch) { - return ''; - } - var _hasMatch = _slicedToArray(hasMatch, 1), matchedStr = _hasMatch[0]; - if (matchedStr === '#') { - return ''; + var is_natively_focusable_default = isNativelyFocusable; + function _isFocusable(el) { + var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); + if (vNode.props.nodeType !== 1) { + return false; } - return hash; - } - var url_props_from_attribute_default = urlPropsFromAttribute; - function visuallyOverlaps(rect, parent) { - var parentRect = parent.getBoundingClientRect(); - var parentTop = parentRect.top; - var parentLeft = parentRect.left; - var parentScrollArea = { - top: parentTop - parent.scrollTop, - bottom: parentTop - parent.scrollTop + parent.scrollHeight, - left: parentLeft - parent.scrollLeft, - right: parentLeft - parent.scrollLeft + parent.scrollWidth - }; - if (rect.left > parentScrollArea.right && rect.left > parentRect.right || rect.top > parentScrollArea.bottom && rect.top > parentRect.bottom || rect.right < parentScrollArea.left && rect.right < parentRect.left || rect.bottom < parentScrollArea.top && rect.bottom < parentRect.top) { + if (focus_disabled_default(vNode)) { return false; + } else if (is_natively_focusable_default(vNode)) { + return true; } - var style = window.getComputedStyle(parent); - if (rect.left > parentRect.right || rect.top > parentRect.bottom) { - return style.overflow === 'scroll' || style.overflow === 'auto' || parent instanceof window.HTMLBodyElement || parent instanceof window.HTMLHtmlElement; + var tabindex = vNode.attr('tabindex'); + if (tabindex && !isNaN(parseInt(tabindex, 10))) { + return true; } - return true; + return false; } - var visually_overlaps_default = visuallyOverlaps; - var isXHTMLGlobal; - var nodeIndex = 0; - var VirtualNode = function(_abstract_virtual_nod) { - _inherits(VirtualNode, _abstract_virtual_nod); - var _super = _createSuper(VirtualNode); - function VirtualNode(node, parent, shadowId) { - var _this; - _classCallCheck(this, VirtualNode); - _this = _super.call(this); - _this.shadowId = shadowId; - _this.children = []; - _this.actualNode = node; - _this.parent = parent; - if (!parent) { - nodeIndex = 0; - } - _this.nodeIndex = nodeIndex++; - _this._isHidden = null; - _this._cache = {}; - if (typeof isXHTMLGlobal === 'undefined') { - isXHTMLGlobal = is_xhtml_default(node.ownerDocument); - } - _this._isXHTML = isXHTMLGlobal; - if (node.nodeName.toLowerCase() === 'input') { - var type = node.getAttribute('type'); - type = _this._isXHTML ? type : (type || '').toLowerCase(); - if (!valid_input_type_default().includes(type)) { - type = 'text'; - } - _this._type = type; - } - if (cache_default.get('nodeMap')) { - cache_default.get('nodeMap').set(node, _assertThisInitialized(_this)); - } - return _this; - } - _createClass(VirtualNode, [ { - key: 'props', - get: function get() { - if (!this._cache.hasOwnProperty('props')) { - var _this$actualNode = this.actualNode, nodeType = _this$actualNode.nodeType, nodeName2 = _this$actualNode.nodeName, id = _this$actualNode.id, multiple = _this$actualNode.multiple, nodeValue = _this$actualNode.nodeValue, value = _this$actualNode.value, selected = _this$actualNode.selected; - this._cache.props = { - nodeType: nodeType, - nodeName: this._isXHTML ? nodeName2 : nodeName2.toLowerCase(), - id: id, - type: this._type, - multiple: multiple, - nodeValue: nodeValue, - value: value, - selected: selected - }; - } - return this._cache.props; - } - }, { - key: 'attr', - value: function attr(attrName) { - if (typeof this.actualNode.getAttribute !== 'function') { - return null; - } - return this.actualNode.getAttribute(attrName); - } - }, { - key: 'hasAttr', - value: function hasAttr(attrName) { - if (typeof this.actualNode.hasAttribute !== 'function') { - return false; - } - return this.actualNode.hasAttribute(attrName); - } - }, { - key: 'attrNames', - get: function get() { - if (!this._cache.hasOwnProperty('attrNames')) { - var attrs; - if (this.actualNode.attributes instanceof window.NamedNodeMap) { - attrs = this.actualNode.attributes; - } else { - attrs = this.actualNode.cloneNode(false).attributes; - } - this._cache.attrNames = Array.from(attrs).map(function(attr) { - return attr.name; - }); - } - return this._cache.attrNames; + var sectioningElementSelector = get_elements_by_content_type_default('sectioning').map(function(nodeName2) { + return ''.concat(nodeName2, ':not([role])'); + }).join(', ') + ' , main:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]'; + function hasAccessibleName(vNode) { + var ariaLabelledby = sanitize_default(arialabelledby_text_default(vNode)); + var ariaLabel = sanitize_default(arialabel_text_default(vNode)); + return !!(ariaLabelledby || ariaLabel); + } + var implicitHtmlRoles = { + a: function a(vNode) { + return vNode.hasAttr('href') ? 'link' : null; + }, + area: function area(vNode) { + return vNode.hasAttr('href') ? 'link' : null; + }, + article: 'article', + aside: 'complementary', + body: 'document', + button: 'button', + datalist: 'listbox', + dd: 'definition', + dfn: 'term', + details: 'group', + dialog: 'dialog', + dt: 'term', + fieldset: 'group', + figure: 'figure', + footer: function footer(vNode) { + var sectioningElement = closest_default(vNode, sectioningElementSelector); + return !sectioningElement ? 'contentinfo' : null; + }, + form: function form(vNode) { + return hasAccessibleName(vNode) ? 'form' : null; + }, + h1: 'heading', + h2: 'heading', + h3: 'heading', + h4: 'heading', + h5: 'heading', + h6: 'heading', + header: function header(vNode) { + var sectioningElement = closest_default(vNode, sectioningElementSelector); + return !sectioningElement ? 'banner' : null; + }, + hr: 'separator', + img: function img(vNode) { + var emptyAlt = vNode.hasAttr('alt') && !vNode.attr('alt'); + var hasGlobalAria = get_global_aria_attrs_default().find(function(attr) { + return vNode.hasAttr(attr); + }); + return emptyAlt && !hasGlobalAria && !_isFocusable(vNode) ? 'presentation' : 'img'; + }, + input: function input(vNode) { + var suggestionsSourceElement; + if (vNode.hasAttr('list')) { + var listElement = idrefs_default(vNode.actualNode, 'list').filter(function(node) { + return !!node; + })[0]; + suggestionsSourceElement = listElement && listElement.nodeName.toLowerCase() === 'datalist'; } - }, { - key: 'getComputedStylePropertyValue', - value: function getComputedStylePropertyValue(property) { - var key = 'computedStyle_' + property; - if (!this._cache.hasOwnProperty(key)) { - if (!this._cache.hasOwnProperty('computedStyle')) { - this._cache.computedStyle = window.getComputedStyle(this.actualNode); - } - this._cache[key] = this._cache.computedStyle.getPropertyValue(property); - } - return this._cache[key]; + switch (vNode.props.type) { + case 'checkbox': + return 'checkbox'; + + case 'number': + return 'spinbutton'; + + case 'radio': + return 'radio'; + + case 'range': + return 'slider'; + + case 'search': + return !suggestionsSourceElement ? 'searchbox' : 'combobox'; + + case 'button': + case 'image': + case 'reset': + case 'submit': + return 'button'; + + case 'text': + case 'tel': + case 'url': + case 'email': + case '': + return !suggestionsSourceElement ? 'textbox' : 'combobox'; + + default: + return 'textbox'; } - }, { - key: 'isFocusable', - get: function get() { - if (!this._cache.hasOwnProperty('isFocusable')) { - this._cache.isFocusable = is_focusable_default(this.actualNode); - } - return this._cache.isFocusable; + }, + li: 'listitem', + main: 'main', + math: 'math', + menu: 'list', + nav: 'navigation', + ol: 'list', + optgroup: 'group', + option: 'option', + output: 'status', + progress: 'progressbar', + section: function section(vNode) { + return hasAccessibleName(vNode) ? 'region' : null; + }, + select: function select(vNode) { + return vNode.hasAttr('multiple') || parseInt(vNode.attr('size')) > 1 ? 'listbox' : 'combobox'; + }, + summary: 'button', + table: 'table', + tbody: 'rowgroup', + td: function td(vNode) { + var table = closest_default(vNode, 'table'); + var role = get_explicit_role_default(table); + return [ 'grid', 'treegrid' ].includes(role) ? 'gridcell' : 'cell'; + }, + textarea: 'textbox', + tfoot: 'rowgroup', + th: function th(vNode) { + if (is_column_header_default(vNode)) { + return 'columnheader'; } - }, { - key: 'tabbableElements', - get: function get() { - if (!this._cache.hasOwnProperty('tabbableElements')) { - this._cache.tabbableElements = get_tabbable_elements_default(this); - } - return this._cache.tabbableElements; + if (is_row_header_default(vNode)) { + return 'rowheader'; } - }, { - key: 'clientRects', - get: function get() { - if (!this._cache.hasOwnProperty('clientRects')) { - this._cache.clientRects = Array.from(this.actualNode.getClientRects()).filter(function(rect) { - return rect.width > 0; - }); - } - return this._cache.clientRects; + }, + thead: 'rowgroup', + tr: 'row', + ul: 'list' + }; + var implicit_html_roles_default = implicitHtmlRoles; + function fromPrimative(someString, matcher) { + var matcherType = _typeof(matcher); + if (Array.isArray(matcher) && typeof someString !== 'undefined') { + return matcher.includes(someString); + } + if (matcherType === 'function') { + return !!matcher(someString); + } + if (someString !== null && someString !== void 0) { + if (matcher instanceof RegExp) { + return matcher.test(someString); } - }, { - key: 'boundingClientRect', - get: function get() { - if (!this._cache.hasOwnProperty('boundingClientRect')) { - this._cache.boundingClientRect = this.actualNode.getBoundingClientRect(); - } - return this._cache.boundingClientRect; + if (/^\/.*\/$/.test(matcher)) { + var pattern = matcher.substring(1, matcher.length - 1); + return new RegExp(pattern).test(someString); } - } ]); - return VirtualNode; - }(abstract_virtual_node_default); - var virtual_node_default = VirtualNode; - function getSlotChildren(node) { - var retVal = []; - node = node.firstChild; - while (node) { - retVal.push(node); - node = node.nextSibling; } - return retVal; + return matcher === someString; + } + var from_primative_default = fromPrimative; + function hasAccessibleName2(vNode, matcher) { + return from_primative_default(!!accessible_text_virtual_default(vNode), matcher); + } + var has_accessible_name_default = hasAccessibleName2; + function fromFunction(getValue, matcher) { + var matcherType = _typeof(matcher); + if (matcherType !== 'object' || Array.isArray(matcher) || matcher instanceof RegExp) { + throw new Error('Expect matcher to be an object'); + } + return Object.keys(matcher).every(function(propName) { + return from_primative_default(getValue(propName), matcher[propName]); + }); + } + var from_function_default = fromFunction; + function attributes(vNode, matcher) { + if (!(vNode instanceof abstract_virtual_node_default)) { + vNode = get_node_from_tree_default(vNode); + } + return from_function_default(function(attrName) { + return vNode.attr(attrName); + }, matcher); + } + var attributes_default = attributes; + function condition(arg, condition2) { + return !!condition2(arg); + } + var condition_default = condition; + function explicitRole(vNode, matcher) { + return from_primative_default(get_explicit_role_default(vNode), matcher); + } + var explicit_role_default = explicitRole; + function implicitRole(vNode, matcher) { + return from_primative_default(implicit_role_default(vNode), matcher); + } + var implicit_role_default2 = implicitRole; + function nodeName(vNode, matcher) { + if (!(vNode instanceof abstract_virtual_node_default)) { + vNode = get_node_from_tree_default(vNode); + } + return from_primative_default(vNode.props.nodeName, matcher); + } + var node_name_default = nodeName; + function properties(vNode, matcher) { + if (!(vNode instanceof abstract_virtual_node_default)) { + vNode = get_node_from_tree_default(vNode); + } + return from_function_default(function(propName) { + return vNode.props[propName]; + }, matcher); + } + var properties_default = properties; + function semanticRole(vNode, matcher) { + return from_primative_default(get_role_default(vNode), matcher); + } + var semantic_role_default = semanticRole; + var matchers = { + hasAccessibleName: has_accessible_name_default, + attributes: attributes_default, + condition: condition_default, + explicitRole: explicit_role_default, + implicitRole: implicit_role_default2, + nodeName: node_name_default, + properties: properties_default, + semanticRole: semantic_role_default + }; + function fromDefinition(vNode, definition) { + if (!(vNode instanceof abstract_virtual_node_default)) { + vNode = get_node_from_tree_default(vNode); + } + if (Array.isArray(definition)) { + return definition.some(function(definitionItem) { + return fromDefinition(vNode, definitionItem); + }); + } + if (typeof definition === 'string') { + return matches_default(vNode, definition); + } + return Object.keys(definition).every(function(matcherName) { + if (!matchers[matcherName]) { + throw new Error('Unknown matcher type "'.concat(matcherName, '"')); + } + var matchMethod = matchers[matcherName]; + var matcher = definition[matcherName]; + return matchMethod(vNode, matcher); + }); + } + var from_definition_default = fromDefinition; + function matches2(vNode, definition) { + return from_definition_default(vNode, definition); + } + var matches_default2 = matches2; + matches_default2.hasAccessibleName = has_accessible_name_default; + matches_default2.attributes = attributes_default; + matches_default2.condition = condition_default; + matches_default2.explicitRole = explicit_role_default; + matches_default2.fromDefinition = from_definition_default; + matches_default2.fromFunction = from_function_default; + matches_default2.fromPrimative = from_primative_default; + matches_default2.implicitRole = implicit_role_default2; + matches_default2.nodeName = node_name_default; + matches_default2.properties = properties_default; + matches_default2.semanticRole = semantic_role_default; + var matches_default3 = matches_default2; + function getElementSpec(vNode) { + var _ref25 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref25$noMatchAccessi = _ref25.noMatchAccessibleName, noMatchAccessibleName = _ref25$noMatchAccessi === void 0 ? false : _ref25$noMatchAccessi; + var standard = standards_default.htmlElms[vNode.props.nodeName]; + if (!standard) { + return {}; + } + if (!standard.variant) { + return standard; + } + var variant = standard.variant, spec = _objectWithoutProperties(standard, _excluded2); + for (var variantName in variant) { + if (!variant.hasOwnProperty(variantName) || variantName === 'default') { + continue; + } + var _variant$variantName = variant[variantName], matches4 = _variant$variantName.matches, props = _objectWithoutProperties(_variant$variantName, _excluded3); + var matchProperties = Array.isArray(matches4) ? matches4 : [ matches4 ]; + for (var _i7 = 0; _i7 < matchProperties.length && noMatchAccessibleName; _i7++) { + if (matchProperties[_i7].hasOwnProperty('hasAccessibleName')) { + return standard; + } + } + if (matches_default3(vNode, matches4)) { + for (var propName in props) { + if (props.hasOwnProperty(propName)) { + spec[propName] = props[propName]; + } + } + } + } + for (var _propName in variant['default']) { + if (variant['default'].hasOwnProperty(_propName) && typeof spec[_propName] === 'undefined') { + spec[_propName] = variant['default'][_propName]; + } + } + return spec; + } + var get_element_spec_default = getElementSpec; + function implicitRole2(node) { + var _ref26 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, chromium = _ref26.chromium; + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + node = vNode.actualNode; + if (!vNode) { + throw new ReferenceError('Cannot get implicit role of a node outside the current scope.'); + } + var nodeName2 = vNode.props.nodeName; + var role = implicit_html_roles_default[nodeName2]; + if (!role && chromium) { + var _get_element_spec_def = get_element_spec_default(vNode), chromiumRole = _get_element_spec_def.chromiumRole; + return chromiumRole || null; + } + if (typeof role === 'function') { + return role(vNode); + } + return role || null; + } + var implicit_role_default = implicitRole2; + var inheritsPresentationChain = { + td: [ 'tr' ], + th: [ 'tr' ], + tr: [ 'thead', 'tbody', 'tfoot', 'table' ], + thead: [ 'table' ], + tbody: [ 'table' ], + tfoot: [ 'table' ], + li: [ 'ol', 'ul' ], + dt: [ 'dl', 'div' ], + dd: [ 'dl', 'div' ], + div: [ 'dl' ] + }; + function getInheritedRole(vNode, explicitRoleOptions) { + var parentNodeNames = inheritsPresentationChain[vNode.props.nodeName]; + if (!parentNodeNames) { + return null; + } + if (!vNode.parent) { + if (!vNode.actualNode) { + return null; + } + throw new ReferenceError('Cannot determine role presentational inheritance of a required parent outside the current scope.'); + } + if (!parentNodeNames.includes(vNode.parent.props.nodeName)) { + return null; + } + var parentRole = get_explicit_role_default(vNode.parent, explicitRoleOptions); + if ([ 'none', 'presentation' ].includes(parentRole) && !hasConflictResolution(vNode.parent)) { + return parentRole; + } + if (parentRole) { + return null; + } + return getInheritedRole(vNode.parent, explicitRoleOptions); + } + function resolveImplicitRole(vNode, _ref27) { + var chromium = _ref27.chromium, explicitRoleOptions = _objectWithoutProperties(_ref27, _excluded4); + var implicitRole3 = implicit_role_default(vNode, { + chromium: chromium + }); + if (!implicitRole3) { + return null; + } + var presentationalRole = getInheritedRole(vNode, explicitRoleOptions); + if (presentationalRole) { + return presentationalRole; + } + return implicitRole3; + } + function hasConflictResolution(vNode) { + var hasGlobalAria = get_global_aria_attrs_default().some(function(attr) { + return vNode.hasAttr(attr); + }); + return hasGlobalAria || _isFocusable(vNode); + } + function resolveRole(node) { + var _ref28 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var noImplicit = _ref28.noImplicit, roleOptions = _objectWithoutProperties(_ref28, _excluded5); + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (vNode.props.nodeType !== 1) { + return null; + } + var explicitRole2 = get_explicit_role_default(vNode, roleOptions); + if (!explicitRole2) { + return noImplicit ? null : resolveImplicitRole(vNode, roleOptions); + } + if (![ 'presentation', 'none' ].includes(explicitRole2)) { + return explicitRole2; + } + if (hasConflictResolution(vNode)) { + return noImplicit ? null : resolveImplicitRole(vNode, roleOptions); + } + return explicitRole2; + } + function getRole(node) { + var _ref29 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var noPresentational = _ref29.noPresentational, options = _objectWithoutProperties(_ref29, _excluded6); + var role = resolveRole(node, options); + if (noPresentational && [ 'presentation', 'none' ].includes(role)) { + return null; + } + return role; + } + var get_role_default = getRole; + var alwaysTitleElements = [ 'iframe' ]; + function titleText(node) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (vNode.props.nodeType !== 1 || !node.hasAttr('title')) { + return ''; + } + if (!matches_default2(vNode, alwaysTitleElements) && [ 'none', 'presentation' ].includes(get_role_default(vNode))) { + return ''; + } + return vNode.attr('title'); + } + var title_text_default = titleText; + function namedFromContents(vNode) { + var _ref30 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, strict = _ref30.strict; + vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); + if (vNode.props.nodeType !== 1) { + return false; + } + var role = get_role_default(vNode); + var roleDef = standards_default.ariaRoles[role]; + if (roleDef && roleDef.nameFromContent) { + return true; + } + if (strict) { + return false; + } + return !roleDef || [ 'presentation', 'none' ].includes(role); + } + var named_from_contents_default = namedFromContents; + function getOwnedVirtual(virtualNode) { + var actualNode = virtualNode.actualNode, children = virtualNode.children; + if (!children) { + throw new Error('getOwnedVirtual requires a virtual node'); + } + if (virtualNode.hasAttr('aria-owns')) { + var owns = idrefs_default(actualNode, 'aria-owns').filter(function(element) { + return !!element; + }).map(function(element) { + return axe.utils.getNodeFromTree(element); + }); + return [].concat(_toConsumableArray(children), _toConsumableArray(owns)); + } + return _toConsumableArray(children); + } + var get_owned_virtual_default = getOwnedVirtual; + function subtreeText(virtualNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var alreadyProcessed2 = accessible_text_virtual_default.alreadyProcessed; + context.startNode = context.startNode || virtualNode; + var _context = context, strict = _context.strict, inControlContext = _context.inControlContext, inLabelledByContext = _context.inLabelledByContext; + var _get_element_spec_def2 = get_element_spec_default(virtualNode, { + noMatchAccessibleName: true + }), contentTypes = _get_element_spec_def2.contentTypes; + if (alreadyProcessed2(virtualNode, context) || virtualNode.props.nodeType !== 1 || contentTypes !== null && contentTypes !== void 0 && contentTypes.includes('embedded')) { + return ''; + } + if (!named_from_contents_default(virtualNode, { + strict: strict + }) && !context.subtreeDescendant) { + return ''; + } + if (!strict) { + var subtreeDescendant = !inControlContext && !inLabelledByContext; + context = _extends({ + subtreeDescendant: subtreeDescendant + }, context); + } + return get_owned_virtual_default(virtualNode).reduce(function(contentText, child) { + return appendAccessibleText(contentText, child, context); + }, ''); + } + var phrasingElements = get_elements_by_content_type_default('phrasing').concat([ '#text' ]); + function appendAccessibleText(contentText, virtualNode, context) { + var nodeName2 = virtualNode.props.nodeName; + var contentTextAdd = accessible_text_virtual_default(virtualNode, context); + if (!contentTextAdd) { + return contentText; + } + if (!phrasingElements.includes(nodeName2)) { + if (contentTextAdd[0] !== ' ') { + contentTextAdd += ' '; + } + if (contentText && contentText[contentText.length - 1] !== ' ') { + contentTextAdd = ' ' + contentTextAdd; + } + } + return contentText + contentTextAdd; + } + var subtree_text_default = subtreeText; + function labelText(virtualNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var alreadyProcessed2 = accessible_text_virtual_default.alreadyProcessed; + if (context.inControlContext || context.inLabelledByContext || alreadyProcessed2(virtualNode, context)) { + return ''; + } + if (!context.startNode) { + context.startNode = virtualNode; + } + var labelContext = _extends({ + inControlContext: true + }, context); + var explicitLabels = getExplicitLabels(virtualNode); + var implicitLabel = closest_default(virtualNode, 'label'); + var labels; + if (implicitLabel) { + labels = [].concat(_toConsumableArray(explicitLabels), [ implicitLabel.actualNode ]); + labels.sort(node_sorter_default); + } else { + labels = explicitLabels; + } + return labels.map(function(label3) { + return accessible_text_default(label3, labelContext); + }).filter(function(text) { + return text !== ''; + }).join(' '); + } + function getExplicitLabels(virtualNode) { + if (!virtualNode.attr('id')) { + return []; + } + if (!virtualNode.actualNode) { + throw new TypeError('Cannot resolve explicit label reference for non-DOM nodes'); + } + return find_elms_in_context_default({ + elm: 'label', + attr: 'for', + value: virtualNode.attr('id'), + context: virtualNode.actualNode + }); + } + var label_text_default = labelText; + var defaultButtonValues = { + submit: 'Submit', + image: 'Submit', + reset: 'Reset', + button: '' + }; + var nativeTextMethods = { + valueText: function valueText(_ref31) { + var actualNode = _ref31.actualNode; + return actualNode.value || ''; + }, + buttonDefaultText: function buttonDefaultText(_ref32) { + var actualNode = _ref32.actualNode; + return defaultButtonValues[actualNode.type] || ''; + }, + tableCaptionText: descendantText.bind(null, 'caption'), + figureText: descendantText.bind(null, 'figcaption'), + svgTitleText: descendantText.bind(null, 'title'), + fieldsetLegendText: descendantText.bind(null, 'legend'), + altText: attrText.bind(null, 'alt'), + tableSummaryText: attrText.bind(null, 'summary'), + titleText: title_text_default, + subtreeText: subtree_text_default, + labelText: label_text_default, + singleSpace: function singleSpace() { + return ' '; + }, + placeholderText: attrText.bind(null, 'placeholder') + }; + function attrText(attr, vNode) { + return vNode.attr(attr) || ''; + } + function descendantText(nodeName2, _ref33, context) { + var actualNode = _ref33.actualNode; + nodeName2 = nodeName2.toLowerCase(); + var nodeNames2 = [ nodeName2, actualNode.nodeName.toLowerCase() ].join(','); + var candidate = actualNode.querySelector(nodeNames2); + if (!candidate || candidate.nodeName.toLowerCase() !== nodeName2) { + return ''; + } + return accessible_text_default(candidate, context); + } + var native_text_methods_default = nativeTextMethods; + function nativeTextAlternative(virtualNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var actualNode = virtualNode.actualNode; + if (virtualNode.props.nodeType !== 1 || [ 'presentation', 'none' ].includes(get_role_default(virtualNode))) { + return ''; + } + var textMethods = findTextMethods(virtualNode); + var accName = textMethods.reduce(function(accName2, step) { + return accName2 || step(virtualNode, context); + }, ''); + if (context.debug) { + axe.log(accName || '{empty-value}', actualNode, context); + } + return accName; + } + function findTextMethods(virtualNode) { + var elmSpec = get_element_spec_default(virtualNode, { + noMatchAccessibleName: true + }); + var methods = elmSpec.namingMethods || []; + return methods.map(function(methodName) { + return native_text_methods_default[methodName]; + }); + } + var native_text_alternative_default = nativeTextAlternative; + var unsupported = { + accessibleNameFromFieldValue: [ 'combobox', 'listbox', 'progressbar' ] + }; + var unsupported_default = unsupported; + function _isVisibleToScreenReaders(vNode) { + vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); + return isVisibleToScreenReadersVirtual(vNode); + } + var isVisibleToScreenReadersVirtual = memoize_default(function isVisibleToScreenReadersMemoized(vNode, isAncestor) { + if (ariaHidden(vNode)) { + return false; + } + if (vNode.actualNode && vNode.props.nodeName === 'area') { + return !areaHidden(vNode, isVisibleToScreenReadersVirtual); + } + if (_isHiddenForEveryone(vNode, { + skipAncestors: true, + isAncestor: isAncestor + })) { + return false; + } + if (!vNode.parent) { + return true; + } + return isVisibleToScreenReadersVirtual(vNode.parent, true); + }); + function visibleVirtual(element, screenReader, noRecursing) { + var vNode = element instanceof abstract_virtual_node_default ? element : get_node_from_tree_default(element); + var visibleMethod = screenReader ? _isVisibleToScreenReaders : _isVisibleOnScreen; + var visible2 = !element.actualNode || element.actualNode && visibleMethod(element); + var result = vNode.children.map(function(child) { + var _child$props = child.props, nodeType = _child$props.nodeType, nodeValue = _child$props.nodeValue; + if (nodeType === 3) { + if (nodeValue && visible2) { + return nodeValue; + } + } else if (!noRecursing) { + return visibleVirtual(child, screenReader); + } + }).join(''); + return sanitize_default(result); + } + var visible_virtual_default = visibleVirtual; + var nonTextInputTypes = [ 'button', 'checkbox', 'color', 'file', 'hidden', 'image', 'password', 'radio', 'reset', 'submit' ]; + function isNativeTextbox(node) { + node = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + var nodeName2 = node.props.nodeName; + return nodeName2 === 'textarea' || nodeName2 === 'input' && !nonTextInputTypes.includes((node.attr('type') || '').toLowerCase()); + } + var is_native_textbox_default = isNativeTextbox; + function isNativeSelect(node) { + node = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + var nodeName2 = node.props.nodeName; + return nodeName2 === 'select'; + } + var is_native_select_default = isNativeSelect; + function isAriaTextbox(node) { + var role = get_explicit_role_default(node); + return role === 'textbox'; + } + var is_aria_textbox_default = isAriaTextbox; + function isAriaListbox(node) { + var role = get_explicit_role_default(node); + return role === 'listbox'; + } + var is_aria_listbox_default = isAriaListbox; + function isAriaCombobox(node) { + var role = get_explicit_role_default(node); + return role === 'combobox'; + } + var is_aria_combobox_default = isAriaCombobox; + var rangeRoles = [ 'progressbar', 'scrollbar', 'slider', 'spinbutton' ]; + function isAriaRange(node) { + var role = get_explicit_role_default(node); + return rangeRoles.includes(role); + } + var is_aria_range_default = isAriaRange; + var controlValueRoles = [ 'textbox', 'progressbar', 'scrollbar', 'slider', 'spinbutton', 'combobox', 'listbox' ]; + var _formControlValueMethods = { + nativeTextboxValue: nativeTextboxValue, + nativeSelectValue: nativeSelectValue, + ariaTextboxValue: ariaTextboxValue, + ariaListboxValue: ariaListboxValue, + ariaComboboxValue: ariaComboboxValue, + ariaRangeValue: ariaRangeValue + }; + function formControlValue(virtualNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var actualNode = virtualNode.actualNode; + var unsupportedRoles = unsupported_default.accessibleNameFromFieldValue || []; + var role = get_role_default(virtualNode); + if (context.startNode === virtualNode || !controlValueRoles.includes(role) || unsupportedRoles.includes(role)) { + return ''; + } + var valueMethods = Object.keys(_formControlValueMethods).map(function(name) { + return _formControlValueMethods[name]; + }); + var valueString = valueMethods.reduce(function(accName, step) { + return accName || step(virtualNode, context); + }, ''); + if (context.debug) { + log_default(valueString || '{empty-value}', actualNode, context); + } + return valueString; + } + function nativeTextboxValue(node) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (is_native_textbox_default(vNode)) { + return vNode.props.value || ''; + } + return ''; + } + function nativeSelectValue(node) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (!is_native_select_default(vNode)) { + return ''; + } + var options = query_selector_all_default(vNode, 'option'); + var selectedOptions = options.filter(function(option) { + return option.props.selected; + }); + if (!selectedOptions.length) { + selectedOptions.push(options[0]); + } + return selectedOptions.map(function(option) { + return visible_virtual_default(option); + }).join(' ') || ''; + } + function ariaTextboxValue(node) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + var actualNode = vNode.actualNode; + if (!is_aria_textbox_default(vNode)) { + return ''; + } + if (!actualNode || actualNode && !_isHiddenForEveryone(actualNode)) { + return visible_virtual_default(vNode, true); + } else { + return actualNode.textContent; + } + } + function ariaListboxValue(node, context) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (!is_aria_listbox_default(vNode)) { + return ''; + } + var selected = get_owned_virtual_default(vNode).filter(function(owned) { + return get_role_default(owned) === 'option' && owned.attr('aria-selected') === 'true'; + }); + if (selected.length === 0) { + return ''; + } + return accessible_text_virtual_default(selected[0], context); + } + function ariaComboboxValue(node, context) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (!is_aria_combobox_default(vNode)) { + return ''; + } + var listbox = get_owned_virtual_default(vNode).filter(function(elm) { + return get_role_default(elm) === 'listbox'; + })[0]; + return listbox ? ariaListboxValue(listbox, context) : ''; + } + function ariaRangeValue(node) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + if (!is_aria_range_default(vNode) || !vNode.hasAttr('aria-valuenow')) { + return ''; + } + var valueNow = +vNode.attr('aria-valuenow'); + return !isNaN(valueNow) ? String(valueNow) : '0'; + } + var form_control_value_default = formControlValue; + function getUnicodeNonBmpRegExp() { + return /[\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u20A0-\u20CF\u20D0-\u20FF\u2100-\u214F\u2150-\u218F\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u2400-\u243F\u2440-\u245F\u2460-\u24FF\u2500-\u257F\u2580-\u259F\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\uE000-\uF8FF]/g; + } + function getPunctuationRegExp() { + return /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&\xa3\xa2\xa5\xa7\u20ac()*+,\-.\/:;<=>?@\[\]^_`{|}~\xb1]/g; + } + function getSupplementaryPrivateUseRegExp() { + return /[\uDB80-\uDBBF][\uDC00-\uDFFF]/g; + } + var emoji_regex_default = function emoji_regex_default() { + return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g; + }; + function hasUnicode(str, options) { + var emoji = options.emoji, nonBmp = options.nonBmp, punctuations = options.punctuations; + if (emoji) { + return emoji_regex_default().test(str); + } + if (nonBmp) { + return getUnicodeNonBmpRegExp().test(str) || getSupplementaryPrivateUseRegExp().test(str); + } + if (punctuations) { + return getPunctuationRegExp().test(str); + } + return false; + } + var has_unicode_default = hasUnicode; + function isIconLigature(textVNode) { + var differenceThreshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15; + var occurrenceThreshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3; + var nodeValue = textVNode.actualNode.nodeValue.trim(); + if (!sanitize_default(nodeValue) || has_unicode_default(nodeValue, { + emoji: true, + nonBmp: true + })) { + return false; + } + var canvasContext = cache_default.get('canvasContext', function() { + return document.createElement('canvas').getContext('2d'); + }); + var canvas = canvasContext.canvas; + if (!cache_default.get('fonts')) { + cache_default.set('fonts', {}); + } + var fonts = cache_default.get('fonts'); + var style = window.getComputedStyle(textVNode.parent.actualNode); + var fontFamily = style.getPropertyValue('font-family'); + if (!fonts[fontFamily]) { + fonts[fontFamily] = { + occurrences: 0, + numLigatures: 0 + }; + } + var font = fonts[fontFamily]; + if (font.occurrences >= occurrenceThreshold) { + if (font.numLigatures / font.occurrences === 1) { + return true; + } else if (font.numLigatures === 0) { + return false; + } + } + font.occurrences++; + var fontSize = 30; + var fontStyle = ''.concat(fontSize, 'px ').concat(fontFamily); + canvasContext.font = fontStyle; + var firstChar = nodeValue.charAt(0); + var width = canvasContext.measureText(firstChar).width; + if (width < 30) { + var diff = 30 / width; + width *= diff; + fontSize *= diff; + fontStyle = ''.concat(fontSize, 'px ').concat(fontFamily); + } + canvas.width = width; + canvas.height = fontSize; + canvasContext.font = fontStyle; + canvasContext.textAlign = 'left'; + canvasContext.textBaseline = 'top'; + canvasContext.fillText(firstChar, 0, 0); + var compareData = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer); + if (!compareData.some(function(pixel) { + return pixel; + })) { + font.numLigatures++; + return true; + } + canvasContext.clearRect(0, 0, width, fontSize); + canvasContext.fillText(nodeValue, 0, 0); + var compareWith = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer); + var differences = compareData.reduce(function(diff, pixel, i) { + if (pixel === 0 && compareWith[i] === 0) { + return diff; + } + if (pixel !== 0 && compareWith[i] !== 0) { + return diff; + } + return ++diff; + }, 0); + var expectedWidth = nodeValue.split('').reduce(function(width2, _char2) { + return width2 + canvasContext.measureText(_char2).width; + }, 0); + var actualWidth = canvasContext.measureText(nodeValue).width; + var pixelDifference = differences / compareData.length; + var sizeDifference = 1 - actualWidth / expectedWidth; + if (pixelDifference >= differenceThreshold && sizeDifference >= differenceThreshold) { + font.numLigatures++; + return true; + } + return false; } - function flattenTree(node, shadowId, parent) { - var retVal, realArray, nodeName2; - function reduceShadowDOM(res, child, parent2) { - var replacements = flattenTree(child, shadowId, parent2); - if (replacements) { - res = res.concat(replacements); - } - return res; + var is_icon_ligature_default = isIconLigature; + function accessibleTextVirtual(virtualNode) { + var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + context = prepareContext(virtualNode, context); + if (shouldIgnoreHidden(virtualNode, context)) { + return ''; } - if (node.documentElement) { - node = node.documentElement; + if (shouldIgnoreIconLigature(virtualNode, context)) { + return ''; } - nodeName2 = node.nodeName.toLowerCase(); - if (is_shadow_root_default(node)) { - retVal = new virtual_node_default(node, parent, shadowId); - shadowId = 'a' + Math.random().toString().substring(2); - realArray = Array.from(node.shadowRoot.childNodes); - retVal.children = realArray.reduce(function(res, child) { - return reduceShadowDOM(res, child, retVal); - }, []); - return [ retVal ]; - } else { - if (nodeName2 === 'content' && typeof node.getDistributedNodes === 'function') { - realArray = Array.from(node.getDistributedNodes()); - return realArray.reduce(function(res, child) { - return reduceShadowDOM(res, child, parent); - }, []); - } else if (nodeName2 === 'slot' && typeof node.assignedNodes === 'function') { - realArray = Array.from(node.assignedNodes()); - if (!realArray.length) { - realArray = getSlotChildren(node); - } - var styl = window.getComputedStyle(node); - if (false) { - retVal = new virtual_node_default(node, parent, shadowId); - retVal.children = realArray.reduce(function(res, child) { - return reduceShadowDOM(res, child, retVal); - }, []); - return [ retVal ]; - } else { - return realArray.reduce(function(res, child) { - return reduceShadowDOM(res, child, parent); - }, []); - } - } else { - if (node.nodeType === 1) { - retVal = new virtual_node_default(node, parent, shadowId); - realArray = Array.from(node.childNodes); - retVal.children = realArray.reduce(function(res, child) { - return reduceShadowDOM(res, child, retVal); - }, []); - return [ retVal ]; - } else if (node.nodeType === 3) { - return [ new virtual_node_default(node, parent) ]; - } - return void 0; + var computationSteps = [ arialabelledby_text_default, arialabel_text_default, native_text_alternative_default, form_control_value_default, subtree_text_default, textNodeValue, title_text_default ]; + var accName = computationSteps.reduce(function(accName2, step) { + if (context.startNode === virtualNode) { + accName2 = sanitize_default(accName2); + } + if (accName2 !== '') { + return accName2; } + return step(virtualNode, context); + }, ''); + if (context.debug) { + axe.log(accName || '{empty-value}', virtualNode.actualNode, context); } + return accName; } - function getFlattenedTree() { - var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement; - var shadowId = arguments.length > 1 ? arguments[1] : undefined; - cache_default.set('nodeMap', new WeakMap()); - return flattenTree(node, shadowId, null); - } - var get_flattened_tree_default = getFlattenedTree; - function getBaseLang(lang) { - if (!lang) { + function textNodeValue(virtualNode) { + if (virtualNode.props.nodeType !== 3) { return ''; } - return lang.trim().split('-')[0].toLowerCase(); - } - var get_base_lang_default = getBaseLang; - function failureSummary(nodeData) { - var failingChecks = {}; - failingChecks.none = nodeData.none.concat(nodeData.all); - failingChecks.any = nodeData.any; - return Object.keys(failingChecks).map(function(key) { - if (!failingChecks[key].length) { - return; - } - var sum = axe._audit.data.failureSummaries[key]; - if (sum && typeof sum.failureMessage === 'function') { - return sum.failureMessage(failingChecks[key].map(function(check4) { - return check4.message || ''; - })); - } - }).filter(function(i) { - return i !== void 0; - }).join('\n\n'); + return virtualNode.props.nodeValue; } - var failure_summary_default = failureSummary; - function incompleteFallbackMessage() { - var incompleteFallbackMessage2 = axe._audit.data.incompleteFallbackMessage; - if (typeof incompleteFallbackMessage2 === 'function') { - incompleteFallbackMessage2 = incompleteFallbackMessage2(); + function shouldIgnoreHidden(virtualNode, context) { + if (!virtualNode) { + return false; } - if (typeof incompleteFallbackMessage2 !== 'string') { - return ''; + if (virtualNode.props.nodeType !== 1 || context.includeHidden) { + return false; } - return incompleteFallbackMessage2; + return !_isVisibleToScreenReaders(virtualNode); } - function normalizeRelatedNodes(node, options) { - [ 'any', 'all', 'none' ].forEach(function(type) { - if (!Array.isArray(node[type])) { - return; - } - node[type].filter(function(checkRes) { - return Array.isArray(checkRes.relatedNodes); - }).forEach(function(checkRes) { - checkRes.relatedNodes = checkRes.relatedNodes.map(function(relatedNode) { - var res = { - html: relatedNode.source - }; - if (options.elementRef && !relatedNode.fromFrame) { - res.element = relatedNode.element; - } - if (options.selectors !== false || relatedNode.fromFrame) { - res.target = relatedNode.selector; - } - if (options.ancestry) { - res.ancestry = relatedNode.ancestry; - } - if (options.xpath) { - res.xpath = relatedNode.xpath; - } - return res; - }); - }); - }); + function shouldIgnoreIconLigature(virtualNode, context) { + var _context$occurrenceTh; + var ignoreIconLigature = context.ignoreIconLigature, pixelThreshold = context.pixelThreshold; + var occurrenceThreshold = (_context$occurrenceTh = context.occurrenceThreshold) !== null && _context$occurrenceTh !== void 0 ? _context$occurrenceTh : context.occuranceThreshold; + if (virtualNode.props.nodeType !== 3 || !ignoreIconLigature) { + return false; + } + return is_icon_ligature_default(virtualNode, pixelThreshold, occurrenceThreshold); } - var resultKeys = constants_default.resultGroups; - function processAggregate(results, options) { - var resultObject = axe.utils.aggregateResult(results); - resultKeys.forEach(function(key) { - if (options.resultTypes && !options.resultTypes.includes(key)) { - (resultObject[key] || []).forEach(function(ruleResult) { - if (Array.isArray(ruleResult.nodes) && ruleResult.nodes.length > 0) { - ruleResult.nodes = [ ruleResult.nodes[0] ]; - } - }); - } - resultObject[key] = (resultObject[key] || []).map(function(ruleResult) { - ruleResult = Object.assign({}, ruleResult); - if (Array.isArray(ruleResult.nodes) && ruleResult.nodes.length > 0) { - ruleResult.nodes = ruleResult.nodes.map(function(subResult) { - if (_typeof(subResult.node) === 'object') { - subResult.html = subResult.node.source; - if (options.elementRef && !subResult.node.fromFrame) { - subResult.element = subResult.node.element; - } - if (options.selectors !== false || subResult.node.fromFrame) { - subResult.target = subResult.node.selector; - } - if (options.ancestry) { - subResult.ancestry = subResult.node.ancestry; - } - if (options.xpath) { - subResult.xpath = subResult.node.xpath; - } - } - delete subResult.result; - delete subResult.node; - normalizeRelatedNodes(subResult, options); - return subResult; - }); - } - resultKeys.forEach(function(key2) { - return delete ruleResult[key2]; - }); - delete ruleResult.pageLevel; - delete ruleResult.result; - return ruleResult; - }); - }); - return resultObject; + function prepareContext(virtualNode, context) { + if (!context.startNode) { + context = _extends({ + startNode: virtualNode + }, context); + } + if (virtualNode.props.nodeType === 1 && context.inLabelledByContext && context.includeHidden === void 0) { + context = _extends({ + includeHidden: !_isVisibleToScreenReaders(virtualNode) + }, context); + } + return context; } - var process_aggregate_default = processAggregate; - axe._thisWillBeDeletedDoNotUse = axe._thisWillBeDeletedDoNotUse || {}; - axe._thisWillBeDeletedDoNotUse.helpers = { - failureSummary: failure_summary_default, - incompleteFallbackMessage: incompleteFallbackMessage, - processAggregate: process_aggregate_default + accessibleTextVirtual.alreadyProcessed = function alreadyProcessed(virtualnode, context) { + context.processed = context.processed || []; + if (context.processed.includes(virtualnode)) { + return true; + } + context.processed.push(virtualnode); + return false; }; - var dataRegex = /\$\{\s?data\s?\}/g; - function substitute(str, data2) { - if (typeof data2 === 'string') { - return str.replace(dataRegex, data2); + var accessible_text_virtual_default = accessibleTextVirtual; + function removeUnicode(str, options) { + var emoji = options.emoji, nonBmp = options.nonBmp, punctuations = options.punctuations; + if (emoji) { + str = str.replace(emoji_regex_default(), ''); } - for (var prop in data2) { - if (data2.hasOwnProperty(prop)) { - var regex = new RegExp('\\${\\s?data\\.' + prop + '\\s?}', 'g'); - var replace = typeof data2[prop] === 'undefined' ? '' : String(data2[prop]); - str = str.replace(regex, replace); - } + if (nonBmp) { + str = str.replace(getUnicodeNonBmpRegExp(), ''); + str = str.replace(getSupplementaryPrivateUseRegExp(), ''); + } + if (punctuations) { + str = str.replace(getPunctuationRegExp(), ''); } return str; } - function processMessage(message, data2) { - if (!message) { - return; - } - if (Array.isArray(data2)) { - data2.values = data2.join(', '); - if (typeof message.singular === 'string' && typeof message.plural === 'string') { - var str2 = data2.length === 1 ? message.singular : message.plural; - return substitute(str2, data2); - } - return substitute(message, data2); - } - if (typeof message === 'string') { - return substitute(message, data2); + var remove_unicode_default = removeUnicode; + function isHumanInterpretable(str) { + if (!str.length) { + return 0; } - if (typeof data2 === 'string') { - var _str = message[data2]; - return substitute(_str, data2); + var alphaNumericIconMap = [ 'x', 'i' ]; + if (alphaNumericIconMap.includes(str)) { + return 0; } - var str = message['default'] || incompleteFallbackMessage(); - if (data2 && data2.messageKey && message[data2.messageKey]) { - str = message[data2.messageKey]; + var noUnicodeStr = remove_unicode_default(str, { + emoji: true, + nonBmp: true, + punctuations: true + }); + if (!sanitize_default(noUnicodeStr)) { + return 0; } - return processMessage(str, data2); + return 1; } - var process_message_default = processMessage; - function getCheckMessage(checkId, type, data2) { - var check4 = axe._audit.data.checks[checkId]; - if (!check4) { - throw new Error('Cannot get message for unknown check: '.concat(checkId, '.')); + var is_human_interpretable_default = isHumanInterpretable; + var _autocomplete = { + stateTerms: [ 'on', 'off' ], + standaloneTerms: [ 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo', 'one-time-code' ], + qualifiers: [ 'home', 'work', 'mobile', 'fax', 'pager' ], + qualifiedTerms: [ 'tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'email', 'impp' ], + locations: [ 'billing', 'shipping' ] + }; + function isValidAutocomplete(autocompleteValue) { + var _ref34 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref34$looseTyped = _ref34.looseTyped, looseTyped = _ref34$looseTyped === void 0 ? false : _ref34$looseTyped, _ref34$stateTerms = _ref34.stateTerms, stateTerms = _ref34$stateTerms === void 0 ? [] : _ref34$stateTerms, _ref34$locations = _ref34.locations, locations = _ref34$locations === void 0 ? [] : _ref34$locations, _ref34$qualifiers = _ref34.qualifiers, qualifiers = _ref34$qualifiers === void 0 ? [] : _ref34$qualifiers, _ref34$standaloneTerm = _ref34.standaloneTerms, standaloneTerms = _ref34$standaloneTerm === void 0 ? [] : _ref34$standaloneTerm, _ref34$qualifiedTerms = _ref34.qualifiedTerms, qualifiedTerms = _ref34$qualifiedTerms === void 0 ? [] : _ref34$qualifiedTerms; + autocompleteValue = autocompleteValue.toLowerCase().trim(); + stateTerms = stateTerms.concat(_autocomplete.stateTerms); + if (stateTerms.includes(autocompleteValue) || autocompleteValue === '') { + return true; } - if (!check4.messages[type]) { - throw new Error('Check "'.concat(checkId, '"" does not have a "').concat(type, '" message.')); + qualifiers = qualifiers.concat(_autocomplete.qualifiers); + locations = locations.concat(_autocomplete.locations); + standaloneTerms = standaloneTerms.concat(_autocomplete.standaloneTerms); + qualifiedTerms = qualifiedTerms.concat(_autocomplete.qualifiedTerms); + var autocompleteTerms = autocompleteValue.split(/\s+/g); + if (autocompleteTerms[autocompleteTerms.length - 1] === 'webauthn') { + autocompleteTerms.pop(); + if (autocompleteTerms.length === 0) { + return false; + } } - return process_message_default(check4.messages[type], data2); - } - var get_check_message_default = getCheckMessage; - function getCheckOption(check4, ruleID, options) { - var ruleCheckOption = ((options.rules && options.rules[ruleID] || {}).checks || {})[check4.id]; - var checkOption = (options.checks || {})[check4.id]; - var enabled = check4.enabled; - var opts = check4.options; - if (checkOption) { - if (checkOption.hasOwnProperty('enabled')) { - enabled = checkOption.enabled; + if (!looseTyped) { + if (autocompleteTerms[0].length > 8 && autocompleteTerms[0].substr(0, 8) === 'section-') { + autocompleteTerms.shift(); } - if (checkOption.hasOwnProperty('options')) { - opts = checkOption.options; + if (locations.includes(autocompleteTerms[0])) { + autocompleteTerms.shift(); } - } - if (ruleCheckOption) { - if (ruleCheckOption.hasOwnProperty('enabled')) { - enabled = ruleCheckOption.enabled; + if (qualifiers.includes(autocompleteTerms[0])) { + autocompleteTerms.shift(); + standaloneTerms = []; } - if (ruleCheckOption.hasOwnProperty('options')) { - opts = ruleCheckOption.options; + if (autocompleteTerms.length !== 1) { + return false; } } - return { - enabled: enabled, - options: opts, - absolutePaths: options.absolutePaths - }; + var purposeTerm = autocompleteTerms[autocompleteTerms.length - 1]; + return standaloneTerms.includes(purposeTerm) || qualifiedTerms.includes(purposeTerm); } - var get_check_option_default = getCheckOption; - function _getEnvironmentData() { - var _win$location; - var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; - var win = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; - if (metadata && _typeof(metadata) === 'object') { - return metadata; - } else if (_typeof(win) !== 'object') { - return {}; + var is_valid_autocomplete_default = isValidAutocomplete; + function labelVirtual(virtualNode) { + var ref, candidate; + if (virtualNode.attr('aria-labelledby')) { + ref = idrefs_default(virtualNode.actualNode, 'aria-labelledby'); + candidate = ref.map(function(thing) { + var vNode = get_node_from_tree_default(thing); + return vNode ? visible_virtual_default(vNode) : ''; + }).join(' ').trim(); + if (candidate) { + return candidate; + } } - return { - testEngine: { - name: 'axe-core', - version: axe.version - }, - testRunner: { - name: axe._audit.brand - }, - testEnvironment: getTestEnvironment(win), - timestamp: new Date().toISOString(), - url: (_win$location = win.location) === null || _win$location === void 0 ? void 0 : _win$location.href - }; - } - function getTestEnvironment(win) { - if (!win.navigator || _typeof(win.navigator) !== 'object') { - return {}; + candidate = virtualNode.attr('aria-label'); + if (candidate) { + candidate = sanitize_default(candidate); + if (candidate) { + return candidate; + } } - var navigator = win.navigator, innerHeight = win.innerHeight, innerWidth = win.innerWidth; - var _ref17 = getOrientation(win) || {}, angle = _ref17.angle, type = _ref17.type; - return { - userAgent: navigator.userAgent, - windowWidth: innerWidth, - windowHeight: innerHeight, - orientationAngle: angle, - orientationType: type - }; - } - function getOrientation(_ref18) { - var screen = _ref18.screen; - return screen.orientation || screen.msOrientation || screen.mozOrientation; + return null; } - function createFrameContext(frame, _ref19) { - var focusable = _ref19.focusable, page = _ref19.page; - return { - node: frame, - include: [], - exclude: [], - initiator: false, - focusable: focusable && frameFocusable(frame), - size: getBoundingSize(frame), - page: page - }; + var label_virtual_default = labelVirtual; + function visible(element, screenReader, noRecursing) { + element = get_node_from_tree_default(element); + return visible_virtual_default(element, screenReader, noRecursing); } - function frameFocusable(frame) { - var tabIndex = frame.getAttribute('tabindex'); - if (!tabIndex) { - return true; + var visible_default = visible; + function labelVirtual2(virtualNode) { + var ref, candidate, doc; + candidate = label_virtual_default(virtualNode); + if (candidate) { + return candidate; } - var _int = parseInt(tabIndex, 10); - return isNaN(_int) || _int >= 0; - } - function getBoundingSize(domNode) { - var width = parseInt(domNode.getAttribute('width'), 10); - var height = parseInt(domNode.getAttribute('height'), 10); - if (isNaN(width) || isNaN(height)) { - var rect = domNode.getBoundingClientRect(); - width = isNaN(width) ? rect.width : width; - height = isNaN(height) ? rect.height : height; + if (virtualNode.attr('id')) { + if (!virtualNode.actualNode) { + throw new TypeError('Cannot resolve explicit label reference for non-DOM nodes'); + } + var id = escape_selector_default(virtualNode.attr('id')); + doc = get_root_node_default2(virtualNode.actualNode); + ref = doc.querySelector('label[for="' + id + '"]'); + candidate = ref && visible_default(ref, true); + if (candidate) { + return candidate; + } } - return { - width: width, - height: height - }; - } - function pushUniqueFrame(context5, frame) { - if (is_hidden_default(frame) || find_by_default(context5.frames, 'node', frame)) { - return; + ref = closest_default(virtualNode, 'label'); + candidate = ref && visible_virtual_default(ref, true); + if (candidate) { + return candidate; } - context5.frames.push(createFrameContext(frame, context5)); + return null; } - function isPageContext(_ref20) { - var include = _ref20.include; - return include.length === 1 && include[0].actualNode === document.documentElement; + var label_virtual_default2 = labelVirtual2; + function label(node) { + node = get_node_from_tree_default(node); + return label_virtual_default2(node); } - function pushUniqueFrameSelector(context5, type, selectorArray) { - context5.frames = context5.frames || []; - var frameSelector = selectorArray.shift(); - var frames = document.querySelectorAll(frameSelector); - Array.from(frames).forEach(function(frame) { - context5.frames.forEach(function(contextFrame) { - if (contextFrame.node === frame) { - contextFrame[type].push(selectorArray); - } - }); - if (!context5.frames.find(function(result) { - return result.node === frame; - })) { - var result = createFrameContext(frame, context5); - if (selectorArray) { - result[type].push(selectorArray); - } - context5.frames.push(result); + var label_default = label; + var nativeElementType = [ { + matches: [ { + nodeName: 'textarea' + }, { + nodeName: 'input', + properties: { + type: [ 'text', 'password', 'search', 'tel', 'email', 'url' ] } - }); - } - function normalizeContext(context5) { - if (context5 && _typeof(context5) === 'object' || context5 instanceof window.NodeList) { - if (context5 instanceof window.Node) { - return { - include: [ context5 ], - exclude: [] - }; + } ], + namingMethods: 'labelText' + }, { + matches: { + nodeName: 'input', + properties: { + type: [ 'button', 'submit', 'reset' ] } - if (context5.hasOwnProperty('include') || context5.hasOwnProperty('exclude')) { - return { - include: context5.include && +context5.include.length ? context5.include : [ document ], - exclude: context5.exclude || [] - }; + }, + namingMethods: [ 'valueText', 'titleText', 'buttonDefaultText' ] + }, { + matches: { + nodeName: 'input', + properties: { + type: 'image' } - if (context5.length === +context5.length) { - return { - include: context5, - exclude: [] - }; + }, + namingMethods: [ 'altText', 'valueText', 'labelText', 'titleText', 'buttonDefaultText' ] + }, { + matches: 'button', + namingMethods: 'subtreeText' + }, { + matches: 'fieldset', + namingMethods: 'fieldsetLegendText' + }, { + matches: 'OUTPUT', + namingMethods: 'subtreeText' + }, { + matches: [ { + nodeName: 'select' + }, { + nodeName: 'input', + properties: { + type: /^(?!text|password|search|tel|email|url|button|submit|reset)/ } - } - if (typeof context5 === 'string') { - return { - include: [ context5 ], - exclude: [] - }; - } - return { - include: [ document ], - exclude: [] - }; - } - function parseSelectorArray(context5, type) { - var item, result = [], nodeList; - for (var i = 0, l = context5[type].length; i < l; i++) { - item = context5[type][i]; - if (typeof item === 'string') { - nodeList = Array.from(document.querySelectorAll(item)); - result = result.concat(nodeList.map(function(node) { - return get_node_from_tree_default(node); - })); - break; - } else if (item && item.length && !(item instanceof window.Node)) { - if (item.length > 1) { - pushUniqueFrameSelector(context5, type, item); - } else { - nodeList = Array.from(document.querySelectorAll(item[0])); - result = result.concat(nodeList.map(function(node) { - return get_node_from_tree_default(node); - })); - } - } else if (item instanceof window.Node) { - if (item.documentElement instanceof window.Node) { - result.push(context5.flatTree[0]); - } else { - result.push(get_node_from_tree_default(item)); + } ], + namingMethods: 'labelText' + }, { + matches: 'summary', + namingMethods: 'subtreeText' + }, { + matches: 'figure', + namingMethods: [ 'figureText', 'titleText' ] + }, { + matches: 'img', + namingMethods: 'altText' + }, { + matches: 'table', + namingMethods: [ 'tableCaptionText', 'tableSummaryText' ] + }, { + matches: [ 'hr', 'br' ], + namingMethods: [ 'titleText', 'singleSpace' ] + } ]; + var native_element_type_default = nativeElementType; + function visibleTextNodes(vNode) { + var parentVisible = _isVisibleOnScreen(vNode); + var nodes = []; + vNode.children.forEach(function(child) { + if (child.actualNode.nodeType === 3) { + if (parentVisible) { + nodes.push(child); } + } else { + nodes = nodes.concat(visibleTextNodes(child)); } - } - return result.filter(function(r) { - return r; }); + return nodes; } - function validateContext(context5) { - if (context5.include.length === 0) { - if (context5.frames.length === 0) { - var env = _respondable.isInFrame() ? 'frame' : 'page'; - return new Error('No elements found for include in ' + env + ' Context'); - } - context5.frames.forEach(function(frame, i) { - if (frame.include.length === 0) { - return new Error('No elements found for include in Context of frame ' + i); - } - }); - } - } - function getRootNode2(_ref21) { - var include = _ref21.include, exclude = _ref21.exclude; - var selectors = Array.from(include).concat(Array.from(exclude)); - for (var i = 0; i < selectors.length; ++i) { - var item = selectors[i]; - if (item instanceof window.Element) { - return item.ownerDocument.documentElement; + var visible_text_nodes_default = visibleTextNodes; + var getVisibleChildTextRects = memoize_default(function getVisibleChildTextRectsMemoized(node) { + var vNode = get_node_from_tree_default(node); + var nodeRect = vNode.boundingClientRect; + var clientRects = []; + var overflowHiddenNodes = get_overflow_hidden_ancestors_default(vNode); + node.childNodes.forEach(function(textNode) { + if (textNode.nodeType !== 3 || sanitize_default(textNode.nodeValue) === '') { + return; } - if (item instanceof window.Document) { - return item.documentElement; + var contentRects = getContentRects(textNode); + if (isOutsideNodeBounds(contentRects, nodeRect)) { + return; } - } - return document.documentElement; + clientRects.push.apply(clientRects, _toConsumableArray(filterHiddenRects(contentRects, overflowHiddenNodes))); + }); + return clientRects.length ? clientRects : [ nodeRect ]; + }); + var get_visible_child_text_rects_default = getVisibleChildTextRects; + function getContentRects(node) { + var range = document.createRange(); + range.selectNodeContents(node); + return Array.from(range.getClientRects()); } - function Context(spec, flatTree) { - var _spec, _spec2, _spec3, _spec4, _this2 = this; - spec = clone_default(spec); - this.frames = []; - this.page = typeof ((_spec = spec) === null || _spec === void 0 ? void 0 : _spec.page) === 'boolean' ? spec.page : void 0; - this.initiator = typeof ((_spec2 = spec) === null || _spec2 === void 0 ? void 0 : _spec2.initiator) === 'boolean' ? spec.initiator : true; - this.focusable = typeof ((_spec3 = spec) === null || _spec3 === void 0 ? void 0 : _spec3.focusable) === 'boolean' ? spec.focusable : true; - this.size = _typeof((_spec4 = spec) === null || _spec4 === void 0 ? void 0 : _spec4.size) === 'object' ? spec.size : {}; - spec = normalizeContext(spec); - this.flatTree = flatTree !== null && flatTree !== void 0 ? flatTree : get_flattened_tree_default(getRootNode2(spec)); - this.exclude = spec.exclude; - this.include = spec.include; - this.include = parseSelectorArray(this, 'include'); - this.exclude = parseSelectorArray(this, 'exclude'); - select_default('frame, iframe', this).forEach(function(frame) { - if (is_node_in_context_default(frame, _this2)) { - pushUniqueFrame(_this2, frame.actualNode); + function isOutsideNodeBounds(rects, nodeRect) { + return rects.some(function(rect) { + var centerPoint = _getRectCenter(rect); + return !_isPointInRect(centerPoint, nodeRect); + }); + } + function filterHiddenRects(contentRects, overflowHiddenNodes) { + var visibleRects = []; + contentRects.forEach(function(contentRect) { + if (contentRect.width < 1 || contentRect.height < 1) { + return; + } + var visibleRect = overflowHiddenNodes.reduce(function(rect, overflowNode) { + return rect && _getIntersectionRect(rect, overflowNode.boundingClientRect); + }, contentRect); + if (visibleRect) { + visibleRects.push(visibleRect); } }); - if (typeof this.page === 'undefined') { - this.page = isPageContext(this); - this.frames.forEach(function(frame) { - frame.page = _this2.page; - }); - } - var err2 = validateContext(this); - if (err2 instanceof Error) { - throw err2; - } - if (!Array.isArray(this.include)) { - this.include = Array.from(this.include); - } - this.include.sort(node_sorter_default); + return visibleRects; } - function _getFrameContexts(context5) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (options.iframes === false) { + function getTextElementStack(node) { + _createGrid(); + var vNode = get_node_from_tree_default(node); + var grid = vNode._grid; + if (!grid) { return []; } - var _Context = new Context(context5), frames = _Context.frames; - return frames.map(function(_ref22) { - var node = _ref22.node, frameContext = _objectWithoutProperties(_ref22, _excluded2); - frameContext.initiator = false; - var frameSelector = _getAncestry(node); - return { - frameSelector: frameSelector, - frameContext: frameContext - }; - }); - } - function getRule(ruleId) { - var rule3 = axe._audit.rules.find(function(rule4) { - return rule4.id === ruleId; + var clientRects = get_visible_child_text_rects_default(node); + return clientRects.map(function(rect) { + return getRectStack(grid, rect); }); - if (!rule3) { - throw new Error('Cannot find rule by id: '.concat(ruleId)); - } - return rule3; } - var get_rule_default = getRule; - function _getScroll(elm) { - var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; - var overflowX = elm.scrollWidth > elm.clientWidth + buffer; - var overflowY = elm.scrollHeight > elm.clientHeight + buffer; - if (!(overflowX || overflowY)) { - return; + var get_text_element_stack_default = getTextElementStack; + var visualRoles = [ 'checkbox', 'img', 'meter', 'progressbar', 'scrollbar', 'radio', 'slider', 'spinbutton', 'textbox' ]; + function isVisualContent(el) { + var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); + var role = axe.commons.aria.getExplicitRole(vNode); + if (role) { + return visualRoles.indexOf(role) !== -1; } - var style = window.getComputedStyle(elm); - var scrollableX = isScrollable(style, 'overflow-x'); - var scrollableY = isScrollable(style, 'overflow-y'); - if (overflowX && scrollableX || overflowY && scrollableY) { - return { - elm: elm, - top: elm.scrollTop, - left: elm.scrollLeft - }; + switch (vNode.props.nodeName) { + case 'img': + case 'iframe': + case 'object': + case 'video': + case 'audio': + case 'canvas': + case 'svg': + case 'math': + case 'button': + case 'select': + case 'textarea': + case 'keygen': + case 'progress': + case 'meter': + return true; + + case 'input': + return vNode.props.type !== 'hidden'; + + default: + return false; } } - function isScrollable(style, prop) { - var overflowProp = style.getPropertyValue(prop); - return [ 'scroll', 'auto' ].includes(overflowProp); - } - function getElmScrollRecursive(root) { - return Array.from(root.children || root.childNodes || []).reduce(function(scrolls, elm) { - var scroll = _getScroll(elm); - if (scroll) { - scrolls.push(scroll); - } - return scrolls.concat(getElmScrollRecursive(elm)); - }, []); + var is_visual_content_default = isVisualContent; + var hiddenTextElms = [ 'head', 'title', 'template', 'script', 'style', 'iframe', 'object', 'video', 'audio', 'noscript' ]; + function hasChildTextNodes(elm) { + if (hiddenTextElms.includes(elm.props.nodeName)) { + return false; + } + return elm.children.some(function(_ref35) { + var props = _ref35.props; + return props.nodeType === 3 && props.nodeValue.trim(); + }); } - function getScrollState() { - var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; - var root = win.document.documentElement; - var windowScroll = [ win.pageXOffset !== void 0 ? { - elm: win, - top: win.pageYOffset, - left: win.pageXOffset - } : { - elm: root, - top: root.scrollTop, - left: root.scrollLeft - } ]; - return windowScroll.concat(getElmScrollRecursive(document.body)); + function hasContentVirtual(elm, noRecursion, ignoreAria) { + return hasChildTextNodes(elm) || is_visual_content_default(elm.actualNode) || !ignoreAria && !!label_virtual_default(elm) || !noRecursion && elm.children.some(function(child) { + return child.actualNode.nodeType === 1 && hasContentVirtual(child); + }); } - var get_scroll_state_default = getScrollState; - function _getStandards() { - return clone_default(standards_default); + var has_content_virtual_default = hasContentVirtual; + function hasContent(elm, noRecursion, ignoreAria) { + elm = get_node_from_tree_default(elm); + return has_content_virtual_default(elm, noRecursion, ignoreAria); } - function getStyleSheetFactory(dynamicDoc) { - if (!dynamicDoc) { - throw new Error('axe.utils.getStyleSheetFactory should be invoked with an argument'); + var has_content_default = hasContent; + function _hasLangText(virtualNode) { + if (typeof virtualNode.children === 'undefined' || hasChildTextNodes(virtualNode)) { + return true; } - return function(options) { - var data2 = options.data, _options$isCrossOrigi = options.isCrossOrigin, isCrossOrigin = _options$isCrossOrigi === void 0 ? false : _options$isCrossOrigi, shadowId = options.shadowId, root = options.root, priority = options.priority, _options$isLink = options.isLink, isLink = _options$isLink === void 0 ? false : _options$isLink; - var style = dynamicDoc.createElement('style'); - if (isLink) { - var text32 = dynamicDoc.createTextNode('@import "'.concat(data2.href, '"')); - style.appendChild(text32); - } else { - style.appendChild(dynamicDoc.createTextNode(data2)); - } - dynamicDoc.head.appendChild(style); - return { - sheet: style.sheet, - isCrossOrigin: isCrossOrigin, - shadowId: shadowId, - root: root, - priority: priority - }; - }; - } - var get_stylesheet_factory_default = getStyleSheetFactory; - var styleSheet; - function injectStyle(style) { - if (styleSheet && styleSheet.parentNode) { - if (styleSheet.styleSheet === void 0) { - styleSheet.appendChild(document.createTextNode(style)); - } else { - styleSheet.styleSheet.cssText += style; - } - return styleSheet; + if (virtualNode.props.nodeType === 1 && is_visual_content_default(virtualNode)) { + return !!axe.commons.text.accessibleTextVirtual(virtualNode); } - if (!style) { - return; + return virtualNode.children.some(function(child) { + return !child.attr('lang') && _hasLangText(child) && !_isHiddenForEveryone(child); + }); + } + function insertedIntoFocusOrder(el) { + var tabIndex = parseInt(el.getAttribute('tabindex'), 10); + return tabIndex > -1 && _isFocusable(el) && !is_natively_focusable_default(el); + } + var inserted_into_focus_order_default = insertedIntoFocusOrder; + function isHiddenWithCSS(node, descendentVisibilityValue) { + var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); + var el = node instanceof window.Node ? node : vNode === null || vNode === void 0 ? void 0 : vNode.actualNode; + if (!vNode) { + return _isHiddenWithCSS(el, descendentVisibilityValue); } - var head = document.head || document.getElementsByTagName('head')[0]; - styleSheet = document.createElement('style'); - styleSheet.type = 'text/css'; - if (styleSheet.styleSheet === void 0) { - styleSheet.appendChild(document.createTextNode(style)); - } else { - styleSheet.styleSheet.cssText = style; + if (vNode._isHiddenWithCSS === void 0) { + vNode._isHiddenWithCSS = _isHiddenWithCSS(el, descendentVisibilityValue); } - head.appendChild(styleSheet); - return styleSheet; + return vNode._isHiddenWithCSS; } - var inject_style_default = injectStyle; - function isHidden(el, recursed) { - var node = get_node_from_tree_default(el); + function _isHiddenWithCSS(el, descendentVisibilityValue) { if (el.nodeType === 9) { return false; } if (el.nodeType === 11) { el = el.host; } - if (node && node._isHidden !== null) { - return node._isHidden; + if ([ 'STYLE', 'SCRIPT' ].includes(el.nodeName.toUpperCase())) { + return false; } var style = window.getComputedStyle(el, null); - if (!style || !el.parentNode || style.getPropertyValue('display') === 'none' || !recursed && style.getPropertyValue('visibility') === 'hidden' || el.getAttribute('aria-hidden') === 'true') { - return true; + if (!style) { + throw new Error('Style does not exist for the given element.'); } - var parent = el.assignedSlot ? el.assignedSlot : el.parentNode; - var hidden = isHidden(parent, true); - if (node) { - node._isHidden = hidden; + var displayValue = style.getPropertyValue('display'); + if (displayValue === 'none') { + return true; } - return hidden; - } - var is_hidden_default = isHidden; - function isHtmlElement(node) { - var _node$props$nodeName, _node$props; - var nodeName2 = (_node$props$nodeName = (_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.nodeName) !== null && _node$props$nodeName !== void 0 ? _node$props$nodeName : node.nodeName.toLowerCase(); - if (node.namespaceURI === 'http://www.w3.org/2000/svg') { - return false; + var HIDDEN_VISIBILITY_VALUES = [ 'hidden', 'collapse' ]; + var visibilityValue = style.getPropertyValue('visibility'); + if (HIDDEN_VISIBILITY_VALUES.includes(visibilityValue) && !descendentVisibilityValue) { + return true; } - return !!standards_default.htmlElms[nodeName2]; - } - var is_html_element_default = isHtmlElement; - function getDeepest(collection) { - return collection.sort(function(a, b) { - if (_contains(a, b)) { - return 1; - } - return -1; - })[0]; - } - function isNodeInContext(node, context5) { - var include = context5.include && getDeepest(context5.include.filter(function(candidate) { - return _contains(candidate, node); - })); - var exclude = context5.exclude && getDeepest(context5.exclude.filter(function(candidate) { - return _contains(candidate, node); - })); - if (!exclude && include || exclude && _contains(exclude, include)) { + if (HIDDEN_VISIBILITY_VALUES.includes(visibilityValue) && descendentVisibilityValue && HIDDEN_VISIBILITY_VALUES.includes(descendentVisibilityValue)) { return true; } + var parent = get_composed_parent_default(el); + if (parent && !HIDDEN_VISIBILITY_VALUES.includes(visibilityValue)) { + return isHiddenWithCSS(parent, visibilityValue); + } return false; } - var is_node_in_context_default = isNodeInContext; - function matchAncestry(ancestryA, ancestryB) { - if (ancestryA.length !== ancestryB.length) { + var is_hidden_with_css_default = isHiddenWithCSS; + function isHTML5(doc) { + var node = doc.doctype; + if (node === null) { return false; } - return ancestryA.every(function(selectorA, index) { - var selectorB = ancestryB[index]; - if (!Array.isArray(selectorA)) { - return selectorA === selectorB; - } - if (selectorA.length !== selectorB.length) { - return false; - } - return selectorA.every(function(str, index2) { - return selectorB[index2] === str; - }); - }); - } - var match_ancestry_default = matchAncestry; - var memoizee = __toModule(require_memoizee()); - axe._memoizedFns = []; - function memoizeImplementation(fn) { - var memoized = memoizee['default'](fn); - axe._memoizedFns.push(memoized); - return memoized; + return node.name === 'html' && !node.publicId && !node.systemId; } - var memoize_default = memoizeImplementation; - function nodeSorter(nodeA, nodeB) { - nodeA = nodeA.actualNode || nodeA; - nodeB = nodeB.actualNode || nodeB; - if (nodeA === nodeB) { - return 0; + var is_html5_default = isHTML5; + function _isInTabOrder(el) { + var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); + if (vNode.props.nodeType !== 1) { + return false; } - if (nodeA.compareDocumentPosition(nodeB) & 4) { - return -1; - } else { - return 1; + var tabindex = parseInt(vNode.attr('tabindex', 10)); + if (tabindex <= -1) { + return false; } + return _isFocusable(vNode); } - var node_sorter_default = nodeSorter; - function parseSameOriginStylesheet(sheet, options, priority, importedUrls) { - var isCrossOrigin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - var rules = Array.from(sheet.cssRules); - if (!rules) { - return Promise.resolve(); + function getRoleType(role) { + var _window3; + if (role instanceof abstract_virtual_node_default || (_window3 = window) !== null && _window3 !== void 0 && _window3.Node && role instanceof window.Node) { + role = axe.commons.aria.getRole(role); } - var cssImportRules = rules.filter(function(r) { - return r.type === 3; - }); - if (!cssImportRules.length) { - return Promise.resolve({ - isCrossOrigin: isCrossOrigin, - priority: priority, - root: options.rootNode, - shadowId: options.shadowId, - sheet: sheet + var roleDef = standards_default.ariaRoles[role]; + return (roleDef === null || roleDef === void 0 ? void 0 : roleDef.type) || null; + } + var get_role_type_default = getRoleType; + function walkDomNode(node, functor) { + if (functor(node.actualNode) !== false) { + node.children.forEach(function(child) { + return walkDomNode(child, functor); }); } - var cssImportUrlsNotAlreadyImported = cssImportRules.filter(function(rule3) { - return rule3.href; - }).map(function(rule3) { - return rule3.href; - }).filter(function(url) { - return !importedUrls.includes(url); - }); - var promises = cssImportUrlsNotAlreadyImported.map(function(importUrl, cssRuleIndex) { - var newPriority = [].concat(_toConsumableArray(priority), [ cssRuleIndex ]); - var isCrossOriginRequest = /^https?:\/\/|^\/\//i.test(importUrl); - return parse_crossorigin_stylesheet_default(importUrl, options, newPriority, importedUrls, isCrossOriginRequest); - }); - var nonImportCSSRules = rules.filter(function(r) { - return r.type !== 3; - }); - if (!nonImportCSSRules.length) { - return Promise.all(promises); - } - promises.push(Promise.resolve(options.convertDataToStylesheet({ - data: nonImportCSSRules.map(function(rule3) { - return rule3.cssText; - }).join(), - isCrossOrigin: isCrossOrigin, - priority: priority, - root: options.rootNode, - shadowId: options.shadowId - }))); - return Promise.all(promises); } - var parse_sameorigin_stylesheet_default = parseSameOriginStylesheet; - function parseStylesheet(sheet, options, priority, importedUrls) { - var isCrossOrigin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; - var isSameOrigin = isSameOriginStylesheet(sheet); - if (isSameOrigin) { - return parse_sameorigin_stylesheet_default(sheet, options, priority, importedUrls, isCrossOrigin); + var blockLike = [ 'block', 'list-item', 'table', 'flex', 'grid', 'inline-block' ]; + function isBlock(elm) { + var display = window.getComputedStyle(elm).getPropertyValue('display'); + return blockLike.includes(display) || display.substr(0, 6) === 'table-'; + } + function getBlockParent(node) { + var parentBlock = get_composed_parent_default(node); + while (parentBlock && !isBlock(parentBlock)) { + parentBlock = get_composed_parent_default(parentBlock); } - return parse_crossorigin_stylesheet_default(sheet.href, options, priority, importedUrls, true); + return get_node_from_tree_default(parentBlock); } - function isSameOriginStylesheet(sheet) { - try { - var rules = sheet.cssRules; - if (!rules && sheet.href) { - return false; - } - return true; - } catch (e) { + function isInTextBlock(node, options) { + if (isBlock(node)) { return false; } - } - var parse_stylesheet_default = parseStylesheet; - function parseCrossOriginStylesheet(url, options, priority, importedUrls, isCrossOrigin) { - importedUrls.push(url); - return new Promise(function(resolve, reject) { - var request = new XMLHttpRequest(); - request.open('GET', url); - request.timeout = constants_default.preload.timeout; - request.addEventListener('error', reject); - request.addEventListener('timeout', reject); - request.addEventListener('loadend', function(event) { - if (event.loaded && request.responseText) { - return resolve(request.responseText); + var virtualParent = getBlockParent(node); + var parentText = ''; + var widgetText = ''; + var inBrBlock = 0; + walkDomNode(virtualParent, function(currNode) { + if (inBrBlock === 2) { + return false; + } + if (currNode.nodeType === 3) { + parentText += currNode.nodeValue; + } + if (currNode.nodeType !== 1) { + return; + } + var nodeName2 = (currNode.nodeName || '').toUpperCase(); + if (currNode === node) { + inBrBlock = 1; + } + if ([ 'BR', 'HR' ].includes(nodeName2)) { + if (inBrBlock === 0) { + parentText = ''; + widgetText = ''; + } else { + inBrBlock = 2; } - reject(request.responseText); - }); - request.send(); - }).then(function(data2) { - var result = options.convertDataToStylesheet({ - data: data2, - isCrossOrigin: isCrossOrigin, - priority: priority, - root: options.rootNode, - shadowId: options.shadowId - }); - return parse_stylesheet_default(result.sheet, options, priority, importedUrls, result.isCrossOrigin); + } else if (currNode.style.display === 'none' || currNode.style.overflow === 'hidden' || ![ '', null, 'none' ].includes(currNode.style['float']) || ![ '', null, 'relative' ].includes(currNode.style.position)) { + return false; + } else if (get_role_type_default(currNode) === 'widget') { + widgetText += currNode.textContent; + return false; + } }); + parentText = sanitize_default(parentText); + if (options !== null && options !== void 0 && options.noLengthCompare) { + return parentText.length !== 0; + } + widgetText = sanitize_default(widgetText); + return parentText.length > widgetText.length; } - var parse_crossorigin_stylesheet_default = parseCrossOriginStylesheet; - var performanceTimer = function() { - function now() { - if (window.performance && window.performance) { - return window.performance.now(); - } + var is_in_text_block_default = isInTextBlock; + function isModalOpen(options) { + options = options || {}; + var modalPercent = options.modalPercent || .75; + if (cache_default.get('isModalOpen')) { + return cache_default.get('isModalOpen'); } - var originalTime = null; - var lastRecordedTime = now(); - return { - start: function start() { - this.mark('mark_axe_start'); - }, - end: function end() { - this.mark('mark_axe_end'); - this.measure('axe', 'mark_axe_start', 'mark_axe_end'); - this.logMeasures('axe'); - }, - auditStart: function auditStart() { - this.mark('mark_audit_start'); - }, - auditEnd: function auditEnd() { - this.mark('mark_audit_end'); - this.measure('audit_start_to_end', 'mark_audit_start', 'mark_audit_end'); - this.logMeasures(); - }, - mark: function mark(markName) { - if (window.performance && window.performance.mark !== void 0) { - window.performance.mark(markName); - } - }, - measure: function measure(measureName, startMark, endMark) { - if (window.performance && window.performance.measure !== void 0) { - window.performance.measure(measureName, startMark, endMark); - } - }, - logMeasures: function logMeasures(measureName) { - function logMeasure(req2) { - log_default('Measure ' + req2.name + ' took ' + req2.duration + 'ms'); - } - if (window.performance && window.performance.getEntriesByType !== void 0) { - var axeStart = window.performance.getEntriesByName('mark_axe_start')[0]; - var measures = window.performance.getEntriesByType('measure').filter(function(measure) { - return measure.startTime >= axeStart.startTime; - }); - for (var i = 0; i < measures.length; ++i) { - var req = measures[i]; - if (req.name === measureName) { - logMeasure(req); - return; - } - logMeasure(req); - } - } - }, - timeElapsed: function timeElapsed() { - return now() - lastRecordedTime; - }, - reset: function reset() { - if (!originalTime) { - originalTime = now(); - } - lastRecordedTime = now(); + var definiteModals = query_selector_all_filter_default(axe._tree[0], 'dialog, [role=dialog], [aria-modal=true]', _isVisibleOnScreen); + if (definiteModals.length) { + cache_default.set('isModalOpen', true); + return true; + } + var viewport = get_viewport_size_default(window); + var percentWidth = viewport.width * modalPercent; + var percentHeight = viewport.height * modalPercent; + var x = (viewport.width - percentWidth) / 2; + var y = (viewport.height - percentHeight) / 2; + var points = [ { + x: x, + y: y + }, { + x: viewport.width - x, + y: y + }, { + x: viewport.width / 2, + y: viewport.height / 2 + }, { + x: x, + y: viewport.height - y + }, { + x: viewport.width - x, + y: viewport.height - y + } ]; + var stacks = points.map(function(point) { + return Array.from(document.elementsFromPoint(point.x, point.y)); + }); + var _loop4 = function _loop4(_i8) { + var modalElement = stacks[_i8].find(function(elm) { + var style = window.getComputedStyle(elm); + return parseInt(style.width, 10) >= percentWidth && parseInt(style.height, 10) >= percentHeight && style.getPropertyValue('pointer-events') !== 'none' && (style.position === 'absolute' || style.position === 'fixed'); + }); + if (modalElement && stacks.every(function(stack) { + return stack.includes(modalElement); + })) { + cache_default.set('isModalOpen', true); + return { + v: true + }; } }; - }(); - var performance_timer_default = performanceTimer; - if (typeof Object.assign !== 'function') { - (function() { - Object.assign = function(target) { - if (target === void 0 || target === null) { - throw new TypeError('Cannot convert undefined or null to object'); - } - var output = Object(target); - for (var index = 1; index < arguments.length; index++) { - var source = arguments[index]; - if (source !== void 0 && source !== null) { - for (var nextKey in source) { - if (source.hasOwnProperty(nextKey)) { - output[nextKey] = source[nextKey]; - } - } - } - } - return output; - }; - })(); + for (var _i8 = 0; _i8 < stacks.length; _i8++) { + var _ret = _loop4(_i8); + if (_typeof(_ret) === 'object') { + return _ret.v; + } + } + cache_default.set('isModalOpen', void 0); + return void 0; } - if (!Array.prototype.find) { - Object.defineProperty(Array.prototype, 'find', { - value: function value(predicate) { - if (this === null) { - throw new TypeError('Array.prototype.find called on null or undefined'); - } - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); + var is_modal_open_default = isModalOpen; + function _isMultiline(domNode) { + var margin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2; + var range = domNode.ownerDocument.createRange(); + range.setStart(domNode, 0); + range.setEnd(domNode, domNode.childNodes.length); + var lastLineEnd = 0; + var lineCount = 0; + var _iterator4 = _createForOfIteratorHelper(range.getClientRects()), _step4; + try { + for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { + var rect = _step4.value; + if (rect.height <= margin) { + continue; } - var list = Object(this); - var length = list.length >>> 0; - var thisArg = arguments[1]; - var value; - for (var i = 0; i < length; i++) { - value = list[i]; - if (predicate.call(thisArg, value, i, list)) { - return value; - } + if (lastLineEnd > rect.top + margin) { + lastLineEnd = Math.max(lastLineEnd, rect.bottom); + } else if (lineCount === 0) { + lastLineEnd = rect.bottom; + lineCount++; + } else { + return true; } - return void 0; } - }); + } catch (err) { + _iterator4.e(err); + } finally { + _iterator4.f(); + } + return false; } - if (!Array.prototype.findIndex) { - Object.defineProperty(Array.prototype, 'findIndex', { - value: function value(predicate, thisArg) { - if (this === null) { - throw new TypeError('Array.prototype.find called on null or undefined'); - } - if (typeof predicate !== 'function') { - throw new TypeError('predicate must be a function'); - } - var list = Object(this); - var length = list.length >>> 0; - var value; - for (var i = 0; i < length; i++) { - value = list[i]; - if (predicate.call(thisArg, value, i, list)) { - return i; - } - } - return -1; + function isNode(element) { + return element instanceof window.Node; + } + var is_node_default = isNode; + var data = {}; + var incompleteData = { + set: function set(key, reason) { + if (typeof key !== 'string') { + throw new Error('Incomplete data: key must be a string'); } - }); + if (reason) { + data[key] = reason; + } + return data[key]; + }, + get: function get(key) { + return data[key]; + }, + clear: function clear() { + data = {}; + } + }; + var incomplete_data_default = incompleteData; + function elementHasImage(elm, style) { + var graphicNodes = [ 'IMG', 'CANVAS', 'OBJECT', 'IFRAME', 'VIDEO', 'SVG' ]; + var nodeName2 = elm.nodeName.toUpperCase(); + if (graphicNodes.includes(nodeName2)) { + incomplete_data_default.set('bgColor', 'imgNode'); + return true; + } + style = style || window.getComputedStyle(elm); + var bgImageStyle = style.getPropertyValue('background-image'); + var hasBgImage = bgImageStyle !== 'none'; + if (hasBgImage) { + var hasGradient = /gradient/.test(bgImageStyle); + incomplete_data_default.set('bgColor', hasGradient ? 'bgGradient' : 'bgImage'); + } + return hasBgImage; } - function _pollyfillElementsFromPoint() { - if (document.elementsFromPoint) { - return document.elementsFromPoint; + var element_has_image_default = elementHasImage; + function convertColorVal(colorFunc, value, index) { + if (/%$/.test(value)) { + if (index === 3) { + return parseFloat(value) / 100; + } + return parseFloat(value) * 255 / 100; } - if (document.msElementsFromPoint) { - return document.msElementsFromPoint; + if (colorFunc[index] === 'h') { + if (/turn$/.test(value)) { + return parseFloat(value) * 360; + } + if (/rad$/.test(value)) { + return parseFloat(value) * 57.3; + } } - var usePointer = function() { - var element = document.createElement('x'); - element.style.cssText = 'pointer-events:auto'; - return element.style.pointerEvents === 'auto'; - }(); - var cssProp = usePointer ? 'pointer-events' : 'visibility'; - var cssDisableVal = usePointer ? 'none' : 'hidden'; - var style = document.createElement('style'); - style.innerHTML = usePointer ? '* { pointer-events: all }' : '* { visibility: visible }'; - return function(x, y) { - var current, i, d; - var elements = []; - var previousPointerEvents = []; - document.head.appendChild(style); - while ((current = document.elementFromPoint(x, y)) && elements.indexOf(current) === -1) { - elements.push(current); - previousPointerEvents.push({ - value: current.style.getPropertyValue(cssProp), - priority: current.style.getPropertyPriority(cssProp) - }); - current.style.setProperty(cssProp, cssDisableVal, 'important'); + return parseFloat(value); + } + function hslToRgb(_ref36) { + var _ref37 = _slicedToArray(_ref36, 4), hue = _ref37[0], saturation = _ref37[1], lightness = _ref37[2], alpha = _ref37[3]; + saturation /= 255; + lightness /= 255; + var high = (1 - Math.abs(2 * lightness - 1)) * saturation; + var low = high * (1 - Math.abs(hue / 60 % 2 - 1)); + var base = lightness - high / 2; + var colors; + if (hue < 60) { + colors = [ high, low, 0 ]; + } else if (hue < 120) { + colors = [ low, high, 0 ]; + } else if (hue < 180) { + colors = [ 0, high, low ]; + } else if (hue < 240) { + colors = [ 0, low, high ]; + } else if (hue < 300) { + colors = [ low, 0, high ]; + } else { + colors = [ high, 0, low ]; + } + return colors.map(function(color) { + return Math.round((color + base) * 255); + }).concat(alpha); + } + function Color(red, green, blue) { + var alpha = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1; + this.red = red; + this.green = green; + this.blue = blue; + this.alpha = alpha; + this.toHexString = function toHexString() { + var redString = Math.round(this.red).toString(16); + var greenString = Math.round(this.green).toString(16); + var blueString = Math.round(this.blue).toString(16); + return '#' + (this.red > 15.5 ? redString : '0' + redString) + (this.green > 15.5 ? greenString : '0' + greenString) + (this.blue > 15.5 ? blueString : '0' + blueString); + }; + this.toJSON = function toJSON() { + var red2 = this.red, green2 = this.green, blue2 = this.blue, alpha2 = this.alpha; + return { + red: red2, + green: green2, + blue: blue2, + alpha: alpha2 + }; + }; + var hexRegex = /^#[0-9a-f]{3,8}$/i; + var colorFnRegex = /^((?:rgb|hsl)a?)\s*\(([^\)]*)\)/i; + this.parseString = function parseString(colorString) { + if (standards_default.cssColors[colorString] || colorString === 'transparent') { + var _ref38 = standards_default.cssColors[colorString] || [ 0, 0, 0 ], _ref39 = _slicedToArray(_ref38, 3), red2 = _ref39[0], green2 = _ref39[1], blue2 = _ref39[2]; + this.red = red2; + this.green = green2; + this.blue = blue2; + this.alpha = colorString === 'transparent' ? 0 : 1; + return this; } - if (elements.indexOf(document.documentElement) < elements.length - 1) { - elements.splice(elements.indexOf(document.documentElement), 1); - elements.push(document.documentElement); + if (colorString.match(colorFnRegex)) { + this.parseColorFnString(colorString); + return this; + } + if (colorString.match(hexRegex)) { + this.parseHexString(colorString); + return this; + } + throw new Error('Unable to parse color "'.concat(colorString, '"')); + }; + this.parseRgbString = function parseRgbString(colorString) { + if (colorString === 'transparent') { + this.red = 0; + this.green = 0; + this.blue = 0; + this.alpha = 0; + return; + } + this.parseColorFnString(colorString); + }; + this.parseHexString = function parseHexString(colorString) { + if (!colorString.match(hexRegex) || [ 6, 8 ].includes(colorString.length)) { + return; + } + colorString = colorString.replace('#', ''); + if (colorString.length < 6) { + var _colorString = colorString, _colorString2 = _slicedToArray(_colorString, 4), r = _colorString2[0], g = _colorString2[1], b = _colorString2[2], a = _colorString2[3]; + colorString = r + r + g + g + b + b; + if (a) { + colorString += a + a; + } + } + var aRgbHex = colorString.match(/.{1,2}/g); + this.red = parseInt(aRgbHex[0], 16); + this.green = parseInt(aRgbHex[1], 16); + this.blue = parseInt(aRgbHex[2], 16); + if (aRgbHex[3]) { + this.alpha = parseInt(aRgbHex[3], 16) / 255; + } else { + this.alpha = 1; } - for (i = previousPointerEvents.length; !!(d = previousPointerEvents[--i]); ) { - elements[i].style.setProperty(cssProp, d.value ? d.value : '', d.priority); + }; + this.parseColorFnString = function parseColorFnString(colorString) { + var _ref40 = colorString.match(colorFnRegex) || [], _ref41 = _slicedToArray(_ref40, 3), colorFunc = _ref41[1], colorValStr = _ref41[2]; + if (!colorFunc || !colorValStr) { + return; } - document.head.removeChild(style); - return elements; + var colorVals = colorValStr.split(/\s*[,\/\s]\s*/).map(function(str) { + return str.replace(',', '').trim(); + }).filter(function(str) { + return str !== ''; + }); + var colorNums = colorVals.map(function(val, index) { + return convertColorVal(colorFunc, val, index); + }); + if (colorFunc.substr(0, 3) === 'hsl') { + colorNums = hslToRgb(colorNums); + } + this.red = colorNums[0]; + this.green = colorNums[1]; + this.blue = colorNums[2]; + this.alpha = typeof colorNums[3] === 'number' ? colorNums[3] : 1; + }; + this.getRelativeLuminance = function getRelativeLuminance() { + var rSRGB = this.red / 255; + var gSRGB = this.green / 255; + var bSRGB = this.blue / 255; + var r = rSRGB <= .03928 ? rSRGB / 12.92 : Math.pow((rSRGB + .055) / 1.055, 2.4); + var g = gSRGB <= .03928 ? gSRGB / 12.92 : Math.pow((gSRGB + .055) / 1.055, 2.4); + var b = bSRGB <= .03928 ? bSRGB / 12.92 : Math.pow((bSRGB + .055) / 1.055, 2.4); + return .2126 * r + .7152 * g + .0722 * b; }; } - if (typeof window.addEventListener === 'function') { - document.elementsFromPoint = _pollyfillElementsFromPoint(); + var color_default = Color; + function getOwnBackgroundColor(elmStyle) { + var bgColor = new color_default(); + bgColor.parseString(elmStyle.getPropertyValue('background-color')); + if (bgColor.alpha !== 0) { + var opacity = elmStyle.getPropertyValue('opacity'); + bgColor.alpha = bgColor.alpha * opacity; + } + return bgColor; } - if (!Array.prototype.includes) { - Object.defineProperty(Array.prototype, 'includes', { - value: function value(searchElement) { - var O = Object(this); - var len = parseInt(O.length, 10) || 0; - if (len === 0) { - return false; - } - var n = parseInt(arguments[1], 10) || 0; - var k; - if (n >= 0) { - k = n; - } else { - k = len + n; - if (k < 0) { - k = 0; - } - } - var currentElement; - while (k < len) { - currentElement = O[k]; - if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { - return true; - } - k++; - } - return false; + var get_own_background_color_default = getOwnBackgroundColor; + function isOpaque(node) { + var style = window.getComputedStyle(node); + return element_has_image_default(node, style) || get_own_background_color_default(style).alpha === 1; + } + var is_opaque_default = isOpaque; + function _isSkipLink(element) { + if (!element.href) { + return false; + } + var firstPageLink = cache_default.get('firstPageLink', generateFirstPageLink); + if (!firstPageLink) { + return true; + } + return element.compareDocumentPosition(firstPageLink.actualNode) === element.DOCUMENT_POSITION_FOLLOWING; + } + function generateFirstPageLink() { + var firstPageLink; + if (!window.location.origin) { + firstPageLink = query_selector_all_default(axe._tree, 'a:not([href^="#"]):not([href^="/#"]):not([href^="javascript:"])')[0]; + } else { + firstPageLink = query_selector_all_default(axe._tree, 'a[href]:not([href^="javascript:"])').find(function(link) { + return !_isCurrentPageLink(link.actualNode); + }); + } + return firstPageLink || null; + } + var clipRegex2 = /rect\s*\(([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px,?\s*([0-9]+)px\s*\)/; + var clipPathRegex2 = /(\w+)\((\d+)/; + function isClipped(style) { + var matchesClip = style.getPropertyValue('clip').match(clipRegex2); + var matchesClipPath = style.getPropertyValue('clip-path').match(clipPathRegex2); + if (matchesClip && matchesClip.length === 5) { + var position = style.getPropertyValue('position'); + if ([ 'fixed', 'absolute' ].includes(position)) { + return matchesClip[3] - matchesClip[1] <= 0 && matchesClip[2] - matchesClip[4] <= 0; + } + } + if (matchesClipPath) { + var type = matchesClipPath[1]; + var value = parseInt(matchesClipPath[2], 10); + switch (type) { + case 'inset': + return value >= 50; + + case 'circle': + return value === 0; + + default: } + } + return false; + } + function isAreaVisible(el, screenReader, recursed) { + var mapEl = find_up_default(el, 'map'); + if (!mapEl) { + return false; + } + var mapElName = mapEl.getAttribute('name'); + if (!mapElName) { + return false; + } + var mapElRootNode = get_root_node_default2(el); + if (!mapElRootNode || mapElRootNode.nodeType !== 9) { + return false; + } + var refs = query_selector_all_default(axe._tree, 'img[usemap="#'.concat(escape_selector_default(mapElName), '"]')); + if (!refs || !refs.length) { + return false; + } + return refs.some(function(_ref42) { + var actualNode = _ref42.actualNode; + return isVisible(actualNode, screenReader, recursed); }); } - if (!Array.prototype.some) { - Object.defineProperty(Array.prototype, 'some', { - value: function value(fun) { - if (this == null) { - throw new TypeError('Array.prototype.some called on null or undefined'); - } - if (typeof fun !== 'function') { - throw new TypeError(); - } - var t = Object(this); - var len = t.length >>> 0; - var thisArg = arguments.length >= 2 ? arguments[1] : void 0; - for (var i = 0; i < len; i++) { - if (i in t && fun.call(thisArg, t[i], i, t)) { - return true; - } - } + function isVisible(el, screenReader, recursed) { + var _window$Node2; + if (!el) { + throw new TypeError('Cannot determine if element is visible for non-DOM nodes'); + } + var vNode = el instanceof abstract_virtual_node_default ? el : get_node_from_tree_default(el); + el = vNode ? vNode.actualNode : el; + var cacheName = '_isVisible' + (screenReader ? 'ScreenReader' : ''); + var _ref43 = (_window$Node2 = window.Node) !== null && _window$Node2 !== void 0 ? _window$Node2 : {}, DOCUMENT_NODE = _ref43.DOCUMENT_NODE, DOCUMENT_FRAGMENT_NODE = _ref43.DOCUMENT_FRAGMENT_NODE; + var nodeType = vNode ? vNode.props.nodeType : el.nodeType; + var nodeName2 = vNode ? vNode.props.nodeName : el.nodeName.toLowerCase(); + if (vNode && typeof vNode[cacheName] !== 'undefined') { + return vNode[cacheName]; + } + if (nodeType === DOCUMENT_NODE) { + return true; + } + if ([ 'style', 'script', 'noscript', 'template' ].includes(nodeName2)) { + return false; + } + if (el && nodeType === DOCUMENT_FRAGMENT_NODE) { + el = el.host; + } + if (screenReader) { + var ariaHiddenValue = vNode ? vNode.attr('aria-hidden') : el.getAttribute('aria-hidden'); + if (ariaHiddenValue === 'true') { return false; } - }); - } - if (!Array.from) { - Object.defineProperty(Array, 'from', { - value: function() { - var toStr = Object.prototype.toString; - var isCallable = function isCallable(fn) { - return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; - }; - var toInteger = function toInteger(value) { - var number = Number(value); - if (isNaN(number)) { - return 0; - } - if (number === 0 || !isFinite(number)) { - return number; - } - return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); - }; - var maxSafeInteger = Math.pow(2, 53) - 1; - var toLength = function toLength(value) { - var len = toInteger(value); - return Math.min(Math.max(len, 0), maxSafeInteger); - }; - return function from(arrayLike) { - var C = this; - var items = Object(arrayLike); - if (arrayLike == null) { - throw new TypeError('Array.from requires an array-like object - not null or undefined'); - } - var mapFn = arguments.length > 1 ? arguments[1] : void 0; - var T; - if (typeof mapFn !== 'undefined') { - if (!isCallable(mapFn)) { - throw new TypeError('Array.from: when provided, the second argument must be a function'); - } - if (arguments.length > 2) { - T = arguments[2]; - } - } - var len = toLength(items.length); - var A = isCallable(C) ? Object(new C(len)) : new Array(len); - var k = 0; - var kValue; - while (k < len) { - kValue = items[k]; - if (mapFn) { - A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); - } else { - A[k] = kValue; - } - k += 1; - } - A.length = len; - return A; - }; - }() - }); + } + if (!el) { + var parent2 = vNode.parent; + var visible3 = true; + if (parent2) { + visible3 = isVisible(parent2, screenReader, true); + } + if (vNode) { + vNode[cacheName] = visible3; + } + return visible3; + } + var style = window.getComputedStyle(el, null); + if (style === null) { + return false; + } + if (nodeName2 === 'area') { + return isAreaVisible(el, screenReader, recursed); + } + if (style.getPropertyValue('display') === 'none') { + return false; + } + var elHeight = parseInt(style.getPropertyValue('height')); + var elWidth = parseInt(style.getPropertyValue('width')); + var scroll = _getScroll(el); + var scrollableWithZeroHeight = scroll && elHeight === 0; + var scrollableWithZeroWidth = scroll && elWidth === 0; + var posAbsoluteOverflowHiddenAndSmall = style.getPropertyValue('position') === 'absolute' && (elHeight < 2 || elWidth < 2) && style.getPropertyValue('overflow') === 'hidden'; + if (!screenReader && (isClipped(style) || style.getPropertyValue('opacity') === '0' || scrollableWithZeroHeight || scrollableWithZeroWidth || posAbsoluteOverflowHiddenAndSmall)) { + return false; + } + if (!recursed && (style.getPropertyValue('visibility') === 'hidden' || !screenReader && is_offscreen_default(el))) { + return false; + } + var parent = el.assignedSlot ? el.assignedSlot : el.parentNode; + var visible2 = false; + if (parent) { + visible2 = isVisible(parent, screenReader, true); + } + if (vNode) { + vNode[cacheName] = visible2; + } + return visible2; } - if (!String.prototype.includes) { - String.prototype.includes = function(search, start) { - if (typeof start !== 'number') { - start = 0; + var is_visible_default = isVisible; + function reduceToElementsBelowFloating(elements, targetNode) { + var floatingPositions = [ 'fixed', 'sticky' ]; + var finalElements = []; + var targetFound = false; + for (var index = 0; index < elements.length; ++index) { + var currentNode = elements[index]; + if (currentNode === targetNode) { + targetFound = true; } - if (start + search.length > this.length) { - return false; - } else { - return this.indexOf(search, start) !== -1; + var style = window.getComputedStyle(currentNode); + if (!targetFound && floatingPositions.indexOf(style.position) !== -1) { + finalElements = []; + continue; } - }; - } - if (!Array.prototype.flat) { - Object.defineProperty(Array.prototype, 'flat', { - configurable: true, - value: function flat() { - var depth = isNaN(arguments[0]) ? 1 : Number(arguments[0]); - return depth ? Array.prototype.reduce.call(this, function(acc, cur) { - if (Array.isArray(cur)) { - acc.push.apply(acc, flat.call(cur, depth - 1)); - } else { - acc.push(cur); - } - return acc; - }, []) : Array.prototype.slice.call(this); - }, - writable: true - }); - } - function uniqueArray(arr1, arr2) { - return arr1.concat(arr2).filter(function(elem, pos, arr) { - return arr.indexOf(elem) === pos; - }); - } - var unique_array_default = uniqueArray; - function createLocalVariables(vNodes, anyLevel, thisLevel, parentShadowId, recycledLocalVariable) { - var retVal = recycledLocalVariable || {}; - retVal.vNodes = vNodes; - retVal.vNodesIndex = 0; - retVal.anyLevel = anyLevel; - retVal.thisLevel = thisLevel; - retVal.parentShadowId = parentShadowId; - return retVal; + finalElements.push(currentNode); + } + return finalElements; } - var recycledLocalVariables = []; - function matchExpressions(domTree, expressions, filter) { - var stack = []; - var vNodes = Array.isArray(domTree) ? domTree : [ domTree ]; - var currentLevel = createLocalVariables(vNodes, expressions, null, domTree[0].shadowId, recycledLocalVariables.pop()); - var result = []; - while (currentLevel.vNodesIndex < currentLevel.vNodes.length) { - var _currentLevel$anyLeve, _currentLevel$thisLev; - var vNode = currentLevel.vNodes[currentLevel.vNodesIndex++]; - var childOnly = null; - var childAny = null; - var combinedLength = (((_currentLevel$anyLeve = currentLevel.anyLevel) === null || _currentLevel$anyLeve === void 0 ? void 0 : _currentLevel$anyLeve.length) || 0) + (((_currentLevel$thisLev = currentLevel.thisLevel) === null || _currentLevel$thisLev === void 0 ? void 0 : _currentLevel$thisLev.length) || 0); - var added = false; - for (var _i8 = 0; _i8 < combinedLength; _i8++) { - var _currentLevel$anyLeve2, _currentLevel$anyLeve3, _currentLevel$anyLeve4; - var exp = _i8 < (((_currentLevel$anyLeve2 = currentLevel.anyLevel) === null || _currentLevel$anyLeve2 === void 0 ? void 0 : _currentLevel$anyLeve2.length) || 0) ? currentLevel.anyLevel[_i8] : currentLevel.thisLevel[_i8 - (((_currentLevel$anyLeve3 = currentLevel.anyLevel) === null || _currentLevel$anyLeve3 === void 0 ? void 0 : _currentLevel$anyLeve3.length) || 0)]; - if ((!exp[0].id || vNode.shadowId === currentLevel.parentShadowId) && _matchesExpression(vNode, exp[0])) { - if (exp.length === 1) { - if (!added && (!filter || filter(vNode))) { - result.push(vNode); - added = true; - } - } else { - var rest = exp.slice(1); - if ([ ' ', '>' ].includes(rest[0].combinator) === false) { - throw new Error('axe.utils.querySelectorAll does not support the combinator: ' + exp[1].combinator); - } - if (rest[0].combinator === '>') { - (childOnly = childOnly || []).push(rest); - } else { - (childAny = childAny || []).push(rest); - } - } - } - if ((!exp[0].id || vNode.shadowId === currentLevel.parentShadowId) && (_currentLevel$anyLeve4 = currentLevel.anyLevel) !== null && _currentLevel$anyLeve4 !== void 0 && _currentLevel$anyLeve4.includes(exp)) { - (childAny = childAny || []).push(exp); - } - } - if (vNode.children && vNode.children.length) { - stack.push(currentLevel); - currentLevel = createLocalVariables(vNode.children, childAny, childOnly, vNode.shadowId, recycledLocalVariables.pop()); + var reduce_to_elements_below_floating_default = reduceToElementsBelowFloating; + function _visuallyContains(node, parent) { + var parentScrollAncestor = getScrollAncestor(parent); + do { + var nextScrollAncestor = getScrollAncestor(node); + if (nextScrollAncestor === parentScrollAncestor || nextScrollAncestor === parent) { + return contains2(node, parent); } - while (currentLevel.vNodesIndex === currentLevel.vNodes.length && stack.length) { - recycledLocalVariables.push(currentLevel); - currentLevel = stack.pop(); + node = nextScrollAncestor; + } while (node); + return false; + } + function getScrollAncestor(node) { + var vNode = get_node_from_tree_default(node); + var ancestor = vNode.parent; + while (ancestor) { + if (_getScroll(ancestor.actualNode)) { + return ancestor.actualNode; } + ancestor = ancestor.parent; } - return result; - } - function querySelectorAllFilter(domTree, selector, filter) { - domTree = Array.isArray(domTree) ? domTree : [ domTree ]; - var expressions = _convertSelector(selector); - return matchExpressions(domTree, expressions, filter); } - var query_selector_all_filter_default = querySelectorAllFilter; - function preloadCssom(_ref23) { - var _ref23$treeRoot = _ref23.treeRoot, treeRoot = _ref23$treeRoot === void 0 ? axe._tree[0] : _ref23$treeRoot; - var rootNodes = getAllRootNodesInTree(treeRoot); - if (!rootNodes.length) { - return Promise.resolve(); + function contains2(node, parent) { + var style = window.getComputedStyle(parent); + var overflow = style.getPropertyValue('overflow'); + if (style.getPropertyValue('display') === 'inline') { + return true; } - var dynamicDoc = document.implementation.createHTMLDocument('Dynamic document for loading cssom'); - var convertDataToStylesheet = get_stylesheet_factory_default(dynamicDoc); - return getCssomForAllRootNodes(rootNodes, convertDataToStylesheet).then(function(assets) { - return flattenAssets(assets); + var clientRects = Array.from(node.getClientRects()); + var boundingRect = parent.getBoundingClientRect(); + var rect = { + left: boundingRect.left, + top: boundingRect.top, + width: boundingRect.width, + height: boundingRect.height + }; + if ([ 'scroll', 'auto' ].includes(overflow) || parent instanceof window.HTMLHtmlElement) { + rect.width = parent.scrollWidth; + rect.height = parent.scrollHeight; + } + if (clientRects.length === 1 && overflow === 'hidden' && style.getPropertyValue('white-space') === 'nowrap') { + clientRects[0] = rect; + } + return clientRects.some(function(clientRect) { + return !(Math.ceil(clientRect.left) < Math.floor(rect.left) || Math.ceil(clientRect.top) < Math.floor(rect.top) || Math.floor(clientRect.left + clientRect.width) > Math.ceil(rect.left + rect.width) || Math.floor(clientRect.top + clientRect.height) > Math.ceil(rect.top + rect.height)); }); } - var preload_cssom_default = preloadCssom; - function getAllRootNodesInTree(tree) { - var ids = []; - var rootNodes = query_selector_all_filter_default(tree, '*', function(node) { - if (ids.includes(node.shadowId)) { - return false; + function shadowElementsFromPoint(nodeX, nodeY) { + var root = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : document; + var i = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0; + if (i > 999) { + throw new Error('Infinite loop detected'); + } + return Array.from(root.elementsFromPoint(nodeX, nodeY) || []).filter(function(nodes) { + return get_root_node_default2(nodes) === root; + }).reduce(function(stack, elm) { + if (is_shadow_root_default(elm)) { + var shadowStack = shadowElementsFromPoint(nodeX, nodeY, elm.shadowRoot, i + 1); + stack = stack.concat(shadowStack); + if (stack.length && _visuallyContains(stack[0], elm)) { + stack.push(elm); + } + } else { + stack.push(elm); } - ids.push(node.shadowId); - return true; - }).map(function(node) { - return { - shadowId: node.shadowId, - rootNode: get_root_node_default(node.actualNode) - }; - }); - return unique_array_default(rootNodes, []); + return stack; + }, []); } - function getCssomForAllRootNodes(rootNodes, convertDataToStylesheet) { - var promises = []; - rootNodes.forEach(function(_ref24, index) { - var rootNode = _ref24.rootNode, shadowId = _ref24.shadowId; - var sheets = getStylesheetsOfRootNode(rootNode, shadowId, convertDataToStylesheet); - if (!sheets) { - return Promise.all(promises); - } - var rootIndex = index + 1; - var parseOptions = { - rootNode: rootNode, - shadowId: shadowId, - convertDataToStylesheet: convertDataToStylesheet, - rootIndex: rootIndex - }; - var importedUrls = []; - var p = Promise.all(sheets.map(function(sheet, sheetIndex) { - var priority = [ rootIndex, sheetIndex ]; - return parse_stylesheet_default(sheet, parseOptions, priority, importedUrls); - })); - promises.push(p); - }); - return Promise.all(promises); + var shadow_elements_from_point_default = shadowElementsFromPoint; + function urlPropsFromAttribute(node, attribute) { + if (!node.hasAttribute(attribute)) { + return void 0; + } + var nodeName2 = node.nodeName.toUpperCase(); + var parser2 = node; + if (![ 'A', 'AREA' ].includes(nodeName2) || node.ownerSVGElement) { + parser2 = document.createElement('a'); + parser2.href = node.getAttribute(attribute); + } + var protocol = [ 'https:', 'ftps:' ].includes(parser2.protocol) ? parser2.protocol.replace(/s:$/, ':') : parser2.protocol; + var parserPathname = /^\//.test(parser2.pathname) ? parser2.pathname : '/'.concat(parser2.pathname); + var _getPathnameOrFilenam = getPathnameOrFilename(parserPathname), pathname = _getPathnameOrFilenam.pathname, filename = _getPathnameOrFilenam.filename; + return { + protocol: protocol, + hostname: parser2.hostname, + port: getPort(parser2.port), + pathname: /\/$/.test(pathname) ? pathname : ''.concat(pathname, '/'), + search: getSearchPairs(parser2.search), + hash: getHashRoute(parser2.hash), + filename: filename + }; } - function flattenAssets(assets) { - return assets.reduce(function(acc, val) { - return Array.isArray(val) ? acc.concat(flattenAssets(val)) : acc.concat(val); - }, []); + function getPort(port) { + var excludePorts = [ '443', '80' ]; + return !excludePorts.includes(port) ? port : ''; } - function getStylesheetsOfRootNode(rootNode, shadowId, convertDataToStylesheet) { - var sheets; - if (rootNode.nodeType === 11 && shadowId) { - sheets = getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet); - } else { - sheets = getStylesheetsFromDocument(rootNode); + function getPathnameOrFilename(pathname) { + var filename = pathname.split('/').pop(); + if (!filename || filename.indexOf('.') === -1) { + return { + pathname: pathname, + filename: '' + }; } - return filterStylesheetsWithSameHref(sheets); - } - function getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet) { - return Array.from(rootNode.children).filter(filerStyleAndLinkAttributesInDocumentFragment).reduce(function(out, node) { - var nodeName2 = node.nodeName.toUpperCase(); - var data2 = nodeName2 === 'STYLE' ? node.textContent : node; - var isLink = nodeName2 === 'LINK'; - var stylesheet = convertDataToStylesheet({ - data: data2, - isLink: isLink, - root: rootNode - }); - out.push(stylesheet.sheet); - return out; - }, []); + return { + pathname: pathname.replace(filename, ''), + filename: /index./.test(filename) ? '' : filename + }; } - function getStylesheetsFromDocument(rootNode) { - return Array.from(rootNode.styleSheets).filter(function(sheet) { - return filterMediaIsPrint(sheet.media.mediaText); - }); + function getSearchPairs(searchStr) { + var query = {}; + if (!searchStr || !searchStr.length) { + return query; + } + var pairs = searchStr.substring(1).split('&'); + if (!pairs || !pairs.length) { + return query; + } + for (var index = 0; index < pairs.length; index++) { + var pair = pairs[index]; + var _pair$split = pair.split('='), _pair$split2 = _slicedToArray(_pair$split, 2), key = _pair$split2[0], _pair$split2$ = _pair$split2[1], value = _pair$split2$ === void 0 ? '' : _pair$split2$; + query[decodeURIComponent(key)] = decodeURIComponent(value); + } + return query; } - function filerStyleAndLinkAttributesInDocumentFragment(node) { - var nodeName2 = node.nodeName.toUpperCase(); - var linkHref = node.getAttribute('href'); - var linkRel = node.getAttribute('rel'); - var isLink = nodeName2 === 'LINK' && linkHref && linkRel && node.rel.toUpperCase().includes('STYLESHEET'); - var isStyle = nodeName2 === 'STYLE'; - return isStyle || isLink && filterMediaIsPrint(node.media); + function getHashRoute(hash) { + if (!hash) { + return ''; + } + var hashRegex = /#!?\/?/g; + var hasMatch = hash.match(hashRegex); + if (!hasMatch) { + return ''; + } + var _hasMatch = _slicedToArray(hasMatch, 1), matchedStr = _hasMatch[0]; + if (matchedStr === '#') { + return ''; + } + return hash; } - function filterMediaIsPrint(media) { - if (!media) { - return true; + var url_props_from_attribute_default = urlPropsFromAttribute; + function visuallyOverlaps(rect, parent) { + var parentRect = parent.getBoundingClientRect(); + var parentTop = parentRect.top; + var parentLeft = parentRect.left; + var parentScrollArea = { + top: parentTop - parent.scrollTop, + bottom: parentTop - parent.scrollTop + parent.scrollHeight, + left: parentLeft - parent.scrollLeft, + right: parentLeft - parent.scrollLeft + parent.scrollWidth + }; + if (rect.left > parentScrollArea.right && rect.left > parentRect.right || rect.top > parentScrollArea.bottom && rect.top > parentRect.bottom || rect.right < parentScrollArea.left && rect.right < parentRect.left || rect.bottom < parentScrollArea.top && rect.bottom < parentRect.top) { + return false; } - return !media.toUpperCase().includes('PRINT'); + var style = window.getComputedStyle(parent); + if (rect.left > parentRect.right || rect.top > parentRect.bottom) { + return style.overflow === 'scroll' || style.overflow === 'auto' || parent instanceof window.HTMLBodyElement || parent instanceof window.HTMLHtmlElement; + } + return true; } - function filterStylesheetsWithSameHref(sheets) { - var hrefs = []; - return sheets.filter(function(sheet) { - if (!sheet.href) { - return true; + var visually_overlaps_default = visuallyOverlaps; + var isXHTMLGlobal; + var nodeIndex = 0; + var VirtualNode = function(_abstract_virtual_nod) { + _inherits(VirtualNode, _abstract_virtual_nod); + var _super = _createSuper(VirtualNode); + function VirtualNode(node, parent, shadowId) { + var _this; + _classCallCheck(this, VirtualNode); + _this = _super.call(this); + _this.shadowId = shadowId; + _this.children = []; + _this.actualNode = node; + _this.parent = parent; + if (!parent) { + nodeIndex = 0; } - if (hrefs.includes(sheet.href)) { - return false; + _this.nodeIndex = nodeIndex++; + _this._isHidden = null; + _this._cache = {}; + if (typeof isXHTMLGlobal === 'undefined') { + isXHTMLGlobal = is_xhtml_default(node.ownerDocument); } - hrefs.push(sheet.href); - return true; - }); - } - function preloadMedia(_ref25) { - var _ref25$treeRoot = _ref25.treeRoot, treeRoot = _ref25$treeRoot === void 0 ? axe._tree[0] : _ref25$treeRoot; - var mediaVirtualNodes = query_selector_all_filter_default(treeRoot, 'video, audio', function(_ref26) { - var actualNode = _ref26.actualNode; - if (actualNode.hasAttribute('src')) { - return !!actualNode.getAttribute('src'); + _this._isXHTML = isXHTMLGlobal; + if (node.nodeName.toLowerCase() === 'input') { + var type = node.getAttribute('type'); + type = _this._isXHTML ? type : (type || '').toLowerCase(); + if (!valid_input_type_default().includes(type)) { + type = 'text'; + } + _this._type = type; } - var sourceWithSrc = Array.from(actualNode.getElementsByTagName('source')).filter(function(source) { - return !!source.getAttribute('src'); - }); - if (sourceWithSrc.length <= 0) { - return false; + if (cache_default.get('nodeMap')) { + cache_default.get('nodeMap').set(node, _assertThisInitialized(_this)); } - return true; - }); - return Promise.all(mediaVirtualNodes.map(function(_ref27) { - var actualNode = _ref27.actualNode; - return isMediaElementReady(actualNode); - })); - } - var preload_media_default = preloadMedia; - function isMediaElementReady(elm) { - return new Promise(function(resolve) { - if (elm.readyState > 0) { - resolve(elm); + return _this; + } + _createClass(VirtualNode, [ { + key: 'props', + get: function get() { + if (!this._cache.hasOwnProperty('props')) { + var _this$actualNode = this.actualNode, nodeType = _this$actualNode.nodeType, nodeName2 = _this$actualNode.nodeName, id = _this$actualNode.id, multiple = _this$actualNode.multiple, nodeValue = _this$actualNode.nodeValue, value = _this$actualNode.value, selected = _this$actualNode.selected; + this._cache.props = { + nodeType: nodeType, + nodeName: this._isXHTML ? nodeName2 : nodeName2.toLowerCase(), + id: id, + type: this._type, + multiple: multiple, + nodeValue: nodeValue, + value: value, + selected: selected + }; + } + return this._cache.props; } - function onMediaReady() { - elm.removeEventListener('loadedmetadata', onMediaReady); - resolve(elm); + }, { + key: 'attr', + value: function attr(attrName) { + if (typeof this.actualNode.getAttribute !== 'function') { + return null; + } + return this.actualNode.getAttribute(attrName); } - elm.addEventListener('loadedmetadata', onMediaReady); - }); - } - function isValidPreloadObject(preload3) { - return _typeof(preload3) === 'object' && Array.isArray(preload3.assets); - } - function _shouldPreload(options) { - if (!options || options.preload === void 0 || options.preload === null) { - return true; - } - if (typeof options.preload === 'boolean') { - return options.preload; - } - return isValidPreloadObject(options.preload); + }, { + key: 'hasAttr', + value: function hasAttr(attrName) { + if (typeof this.actualNode.hasAttribute !== 'function') { + return false; + } + return this.actualNode.hasAttribute(attrName); + } + }, { + key: 'attrNames', + get: function get() { + if (!this._cache.hasOwnProperty('attrNames')) { + var attrs; + if (this.actualNode.attributes instanceof window.NamedNodeMap) { + attrs = this.actualNode.attributes; + } else { + attrs = this.actualNode.cloneNode(false).attributes; + } + this._cache.attrNames = Array.from(attrs).map(function(attr) { + return attr.name; + }); + } + return this._cache.attrNames; + } + }, { + key: 'getComputedStylePropertyValue', + value: function getComputedStylePropertyValue(property) { + var key = 'computedStyle_' + property; + if (!this._cache.hasOwnProperty(key)) { + if (!this._cache.hasOwnProperty('computedStyle')) { + this._cache.computedStyle = window.getComputedStyle(this.actualNode); + } + this._cache[key] = this._cache.computedStyle.getPropertyValue(property); + } + return this._cache[key]; + } + }, { + key: 'isFocusable', + get: function get() { + if (!this._cache.hasOwnProperty('isFocusable')) { + this._cache.isFocusable = _isFocusable(this.actualNode); + } + return this._cache.isFocusable; + } + }, { + key: 'tabbableElements', + get: function get() { + if (!this._cache.hasOwnProperty('tabbableElements')) { + this._cache.tabbableElements = get_tabbable_elements_default(this); + } + return this._cache.tabbableElements; + } + }, { + key: 'clientRects', + get: function get() { + if (!this._cache.hasOwnProperty('clientRects')) { + this._cache.clientRects = Array.from(this.actualNode.getClientRects()).filter(function(rect) { + return rect.width > 0; + }); + } + return this._cache.clientRects; + } + }, { + key: 'boundingClientRect', + get: function get() { + if (!this._cache.hasOwnProperty('boundingClientRect')) { + this._cache.boundingClientRect = this.actualNode.getBoundingClientRect(); + } + return this._cache.boundingClientRect; + } + } ]); + return VirtualNode; + }(abstract_virtual_node_default); + var virtual_node_default = VirtualNode; + function tokenList(str) { + return (str || '').trim().replace(/\s{2,}/g, ' ').split(' '); } - function _getPreloadConfig(options) { - var _constants_default$pr = constants_default.preload, assets = _constants_default$pr.assets, timeout = _constants_default$pr.timeout; - var config = { - assets: assets, - timeout: timeout - }; - if (!options.preload) { - return config; + var token_list_default = tokenList; + var idsKey = ' [idsMap]'; + function getNodesMatchingExpression(domTree, expressions, filter) { + var selectorMap = domTree[0]._selectorMap; + if (!selectorMap) { + return; } - if (typeof options.preload === 'boolean') { - return config; + var shadowId = domTree[0].shadowId; + for (var _i9 = 0; _i9 < expressions.length; _i9++) { + if (expressions[_i9].length > 1 && expressions[_i9].some(function(expression) { + return isGlobalSelector(expression); + })) { + return; + } } - var areRequestedAssetsValid = options.preload.assets.every(function(a) { - return assets.includes(a.toLowerCase()); + var nodeSet = new Set(); + expressions.forEach(function(expression) { + var _matchingNodes$nodes; + var matchingNodes = findMatchingNodes(expression, selectorMap, shadowId); + matchingNodes === null || matchingNodes === void 0 ? void 0 : (_matchingNodes$nodes = matchingNodes.nodes) === null || _matchingNodes$nodes === void 0 ? void 0 : _matchingNodes$nodes.forEach(function(node) { + if (matchingNodes.isComplexSelector && !_matchesExpression(node, expression)) { + return; + } + nodeSet.add(node); + }); }); - if (!areRequestedAssetsValid) { - throw new Error('Requested assets, not supported. Supported assets are: '.concat(assets.join(', '), '.')); - } - config.assets = unique_array_default(options.preload.assets.map(function(a) { - return a.toLowerCase(); - }), []); - if (options.preload.timeout && typeof options.preload.timeout === 'number' && !isNaN(options.preload.timeout)) { - config.timeout = options.preload.timeout; - } - return config; - } - function preload(options) { - var preloadFunctionsMap = { - cssom: preload_cssom_default, - media: preload_media_default - }; - if (!_shouldPreload(options)) { - return Promise.resolve(); + var matchedNodes = []; + nodeSet.forEach(function(node) { + return matchedNodes.push(node); + }); + if (filter) { + matchedNodes = matchedNodes.filter(filter); } - return new Promise(function(resolve, reject) { - var _getPreloadConfig2 = _getPreloadConfig(options), assets = _getPreloadConfig2.assets, timeout = _getPreloadConfig2.timeout; - var preloadTimeout = setTimeout(function() { - return reject(new Error('Preload assets timed out.')); - }, timeout); - Promise.all(assets.map(function(asset) { - return preloadFunctionsMap[asset](options).then(function(results) { - return _defineProperty({}, asset, results); - }); - })).then(function(results) { - var preloadAssets = results.reduce(function(out, result) { - return _extends({}, out, result); - }, {}); - clearTimeout(preloadTimeout); - resolve(preloadAssets); - })['catch'](function(err2) { - clearTimeout(preloadTimeout); - reject(err2); - }); + return matchedNodes.sort(function(a, b) { + return a.nodeIndex - b.nodeIndex; }); } - var preload_default = preload; - function getIncompleteReason(checkData, messages) { - function getDefaultMsg(messages2) { - if (messages2.incomplete && messages2.incomplete['default']) { - return messages2.incomplete['default']; - } else { - return incompleteFallbackMessage(); - } - } - if (checkData && checkData.missingData) { - try { - var msg = messages.incomplete[checkData.missingData[0].reason]; - if (!msg) { - throw new Error(); - } - return msg; - } catch (e) { - if (typeof checkData.missingData === 'string') { - return messages.incomplete[checkData.missingData]; - } else { - return getDefaultMsg(messages); + function findMatchingNodes(expression, selectorMap, shadowId) { + var exp = expression[expression.length - 1]; + var nodes = null; + var isComplexSelector = expression.length > 1 || !!exp.pseudos || !!exp.classes; + if (isGlobalSelector(exp)) { + nodes = selectorMap['*']; + } else { + if (exp.id) { + var _selectorMap$idsKey$e; + if (!selectorMap[idsKey] || !((_selectorMap$idsKey$e = selectorMap[idsKey][exp.id]) !== null && _selectorMap$idsKey$e !== void 0 && _selectorMap$idsKey$e.length)) { + return; } + nodes = selectorMap[idsKey][exp.id].filter(function(node) { + return node.shadowId === shadowId; + }); } - } else if (checkData && checkData.messageKey) { - return messages.incomplete[checkData.messageKey]; - } else { - return getDefaultMsg(messages); - } - } - function extender(checksData, shouldBeTrue, rule3) { - return function(check4) { - var sourceData = checksData[check4.id] || {}; - var messages = sourceData.messages || {}; - var data2 = Object.assign({}, sourceData); - delete data2.messages; - if (!rule3.reviewOnFail && check4.result === void 0) { - if (_typeof(messages.incomplete) === 'object' && !Array.isArray(check4.data)) { - data2.message = getIncompleteReason(check4.data, messages); + if (exp.tag && exp.tag !== '*') { + var _selectorMap$exp$tag; + if (!((_selectorMap$exp$tag = selectorMap[exp.tag]) !== null && _selectorMap$exp$tag !== void 0 && _selectorMap$exp$tag.length)) { + return; } - if (!data2.message) { - data2.message = messages.incomplete; + var cachedNodes = selectorMap[exp.tag]; + nodes = nodes ? getSharedValues(cachedNodes, nodes) : cachedNodes; + } + if (exp.classes) { + var _selectorMap$Class; + if (!((_selectorMap$Class = selectorMap['[class]']) !== null && _selectorMap$Class !== void 0 && _selectorMap$Class.length)) { + return; } - } else { - data2.message = check4.result === shouldBeTrue ? messages.pass : messages.fail; + var _cachedNodes = selectorMap['[class]']; + nodes = nodes ? getSharedValues(_cachedNodes, nodes) : _cachedNodes; } - if (typeof data2.message !== 'function') { - data2.message = process_message_default(data2.message, check4.data); + if (exp.attributes) { + for (var _i10 = 0; _i10 < exp.attributes.length; _i10++) { + var _selectorMap; + var attr = exp.attributes[_i10]; + if (attr.type === 'attrValue') { + isComplexSelector = true; + } + if (!((_selectorMap = selectorMap['['.concat(attr.key, ']')]) !== null && _selectorMap !== void 0 && _selectorMap.length)) { + return; + } + var _cachedNodes2 = selectorMap['['.concat(attr.key, ']')]; + nodes = nodes ? getSharedValues(_cachedNodes2, nodes) : _cachedNodes2; + } } - extend_meta_data_default(check4, data2); + } + return { + nodes: nodes, + isComplexSelector: isComplexSelector }; } - function publishMetaData(ruleResult) { - var checksData = axe._audit.data.checks || {}; - var rulesData = axe._audit.data.rules || {}; - var rule3 = find_by_default(axe._audit.rules, 'id', ruleResult.id) || {}; - ruleResult.tags = clone_default(rule3.tags || []); - var shouldBeTrue = extender(checksData, true, rule3); - var shouldBeFalse = extender(checksData, false, rule3); - ruleResult.nodes.forEach(function(detail) { - detail.any.forEach(shouldBeTrue); - detail.all.forEach(shouldBeTrue); - detail.none.forEach(shouldBeFalse); + function isGlobalSelector(expression) { + return expression.tag === '*' && !expression.attributes && !expression.id && !expression.classes; + } + function getSharedValues(a, b) { + return a.filter(function(node) { + return b.includes(node); }); - extend_meta_data_default(ruleResult, clone_default(rulesData[ruleResult.id] || {})); } - var publish_metadata_default = publishMetaData; - function querySelectorAll(domTree, selector) { - return query_selector_all_filter_default(domTree, selector); + function cacheSelector(key, vNode, map) { + map[key] = map[key] || []; + map[key].push(vNode); } - var query_selector_all_default = querySelectorAll; - function matchTags(rule3, runOnly) { - var include, exclude, matching; - var defaultExclude = axe._audit && axe._audit.tagExclude ? axe._audit.tagExclude : []; - if (runOnly.hasOwnProperty('include') || runOnly.hasOwnProperty('exclude')) { - include = runOnly.include || []; - include = Array.isArray(include) ? include : [ include ]; - exclude = runOnly.exclude || []; - exclude = Array.isArray(exclude) ? exclude : [ exclude ]; - exclude = exclude.concat(defaultExclude.filter(function(tag) { - return include.indexOf(tag) === -1; - })); - } else { - include = Array.isArray(runOnly) ? runOnly : [ runOnly ]; - exclude = defaultExclude.filter(function(tag) { - return include.indexOf(tag) === -1; - }); + function cacheNodeSelectors(vNode, selectorMap) { + if (vNode.props.nodeType !== 1) { + return; } - matching = include.some(function(tag) { - return rule3.tags.indexOf(tag) !== -1; + cacheSelector(vNode.props.nodeName, vNode, selectorMap); + cacheSelector('*', vNode, selectorMap); + vNode.attrNames.forEach(function(attrName) { + if (attrName === 'id') { + selectorMap[idsKey] = selectorMap[idsKey] || {}; + token_list_default(vNode.attr(attrName)).forEach(function(value) { + cacheSelector(value, vNode, selectorMap[idsKey]); + }); + } + cacheSelector('['.concat(attrName, ']'), vNode, selectorMap); }); - if (matching || include.length === 0 && rule3.enabled !== false) { - return exclude.every(function(tag) { - return rule3.tags.indexOf(tag) === -1; - }); - } else { - return false; + } + var hasShadowRoot; + function getSlotChildren(node) { + var retVal = []; + node = node.firstChild; + while (node) { + retVal.push(node); + node = node.nextSibling; } + return retVal; } - function ruleShouldRun(rule3, context5, options) { - var runOnly = options.runOnly || {}; - var ruleOptions = (options.rules || {})[rule3.id]; - if (rule3.pageLevel && !context5.page) { - return false; - } else if (runOnly.type === 'rule') { - return runOnly.values.indexOf(rule3.id) !== -1; - } else if (ruleOptions && typeof ruleOptions.enabled === 'boolean') { - return ruleOptions.enabled; - } else if (runOnly.type === 'tag' && runOnly.values) { - return matchTags(rule3, runOnly.values); + function createNode(node, parent, shadowId) { + var vNode = new virtual_node_default(node, parent, shadowId); + cacheNodeSelectors(vNode, cache_default.get('selectorMap')); + return vNode; + } + function flattenTree(node, shadowId, parent) { + var retVal, realArray, nodeName2; + function reduceShadowDOM(res, child, parent2) { + var replacements = flattenTree(child, shadowId, parent2); + if (replacements) { + res = res.concat(replacements); + } + return res; + } + if (node.documentElement) { + node = node.documentElement; + } + nodeName2 = node.nodeName.toLowerCase(); + if (is_shadow_root_default(node)) { + hasShadowRoot = true; + retVal = createNode(node, parent, shadowId); + shadowId = 'a' + Math.random().toString().substring(2); + realArray = Array.from(node.shadowRoot.childNodes); + retVal.children = realArray.reduce(function(res, child) { + return reduceShadowDOM(res, child, retVal); + }, []); + return [ retVal ]; } else { - return matchTags(rule3, []); + if (nodeName2 === 'content' && typeof node.getDistributedNodes === 'function') { + realArray = Array.from(node.getDistributedNodes()); + return realArray.reduce(function(res, child) { + return reduceShadowDOM(res, child, parent); + }, []); + } else if (nodeName2 === 'slot' && typeof node.assignedNodes === 'function') { + realArray = Array.from(node.assignedNodes()); + if (!realArray.length) { + realArray = getSlotChildren(node); + } + var styl = window.getComputedStyle(node); + if (false) { + retVal = createNode(node, parent, shadowId); + retVal.children = realArray.reduce(function(res, child) { + return reduceShadowDOM(res, child, retVal); + }, []); + return [ retVal ]; + } else { + return realArray.reduce(function(res, child) { + return reduceShadowDOM(res, child, parent); + }, []); + } + } else { + if (node.nodeType === 1) { + retVal = createNode(node, parent, shadowId); + realArray = Array.from(node.childNodes); + retVal.children = realArray.reduce(function(res, child) { + return reduceShadowDOM(res, child, retVal); + }, []); + return [ retVal ]; + } else if (node.nodeType === 3) { + return [ createNode(node, parent) ]; + } + return void 0; + } } } - var rule_should_run_default = ruleShouldRun; - function attributeMatches(node, attrName, filterAttrs) { - if (typeof filterAttrs[attrName] === 'undefined') { - return false; + function getFlattenedTree() { + var node = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.documentElement; + var shadowId = arguments.length > 1 ? arguments[1] : undefined; + hasShadowRoot = false; + var selectorMap = {}; + cache_default.set('nodeMap', new WeakMap()); + cache_default.set('selectorMap', selectorMap); + var tree = flattenTree(node, shadowId, null); + tree[0]._selectorMap = selectorMap; + tree[0]._hasShadowRoot = hasShadowRoot; + return tree; + } + var get_flattened_tree_default = getFlattenedTree; + function getBaseLang(lang) { + if (!lang) { + return ''; } - if (filterAttrs[attrName] === true) { - return true; + return lang.trim().split('-')[0].toLowerCase(); + } + var get_base_lang_default = getBaseLang; + function failureSummary(nodeData) { + var failingChecks = {}; + failingChecks.none = nodeData.none.concat(nodeData.all); + failingChecks.any = nodeData.any; + return Object.keys(failingChecks).map(function(key) { + if (!failingChecks[key].length) { + return; + } + var sum = axe._audit.data.failureSummaries[key]; + if (sum && typeof sum.failureMessage === 'function') { + return sum.failureMessage(failingChecks[key].map(function(check) { + return check.message || ''; + })); + } + }).filter(function(i) { + return i !== void 0; + }).join('\n\n'); + } + var failure_summary_default = failureSummary; + function incompleteFallbackMessage() { + var incompleteFallbackMessage2 = axe._audit.data.incompleteFallbackMessage; + if (typeof incompleteFallbackMessage2 === 'function') { + incompleteFallbackMessage2 = incompleteFallbackMessage2(); } - return element_matches_default(node, filterAttrs[attrName]); + if (typeof incompleteFallbackMessage2 !== 'string') { + return ''; + } + return incompleteFallbackMessage2; + } + function normalizeRelatedNodes(node, options) { + [ 'any', 'all', 'none' ].forEach(function(type) { + if (!Array.isArray(node[type])) { + return; + } + node[type].filter(function(checkRes) { + return Array.isArray(checkRes.relatedNodes); + }).forEach(function(checkRes) { + checkRes.relatedNodes = checkRes.relatedNodes.map(function(relatedNode) { + var _relatedNode$source; + var res = { + html: (_relatedNode$source = relatedNode === null || relatedNode === void 0 ? void 0 : relatedNode.source) !== null && _relatedNode$source !== void 0 ? _relatedNode$source : 'Undefined' + }; + if (options.elementRef && !(relatedNode !== null && relatedNode !== void 0 && relatedNode.fromFrame)) { + var _relatedNode$element; + res.element = (_relatedNode$element = relatedNode === null || relatedNode === void 0 ? void 0 : relatedNode.element) !== null && _relatedNode$element !== void 0 ? _relatedNode$element : null; + } + if (options.selectors !== false || relatedNode !== null && relatedNode !== void 0 && relatedNode.fromFrame) { + var _relatedNode$selector; + res.target = (_relatedNode$selector = relatedNode === null || relatedNode === void 0 ? void 0 : relatedNode.selector) !== null && _relatedNode$selector !== void 0 ? _relatedNode$selector : [ ':root' ]; + } + if (options.ancestry) { + var _relatedNode$ancestry; + res.ancestry = (_relatedNode$ancestry = relatedNode === null || relatedNode === void 0 ? void 0 : relatedNode.ancestry) !== null && _relatedNode$ancestry !== void 0 ? _relatedNode$ancestry : [ ':root' ]; + } + if (options.xpath) { + var _relatedNode$xpath; + res.xpath = (_relatedNode$xpath = relatedNode === null || relatedNode === void 0 ? void 0 : relatedNode.xpath) !== null && _relatedNode$xpath !== void 0 ? _relatedNode$xpath : [ '/' ]; + } + return res; + }); + }); + }); } - function filterHtmlAttrs(element, filterAttrs) { - if (!filterAttrs) { - return element; - } - var node = element.cloneNode(false); - var outerHTML = node.outerHTML; - var attributes4 = get_node_attributes_default(node); - if (cache_default.get(outerHTML)) { - node = cache_default.get(outerHTML); - } else if (attributes4) { - node = document.createElement(node.nodeName); - Array.from(attributes4).forEach(function(attr) { - if (!attributeMatches(element, attr.name, filterAttrs)) { - node.setAttribute(attr.name, attr.value); + var resultKeys = constants_default.resultGroups; + function processAggregate(results, options) { + var resultObject = axe.utils.aggregateResult(results); + resultKeys.forEach(function(key) { + if (options.resultTypes && !options.resultTypes.includes(key)) { + (resultObject[key] || []).forEach(function(ruleResult) { + if (Array.isArray(ruleResult.nodes) && ruleResult.nodes.length > 0) { + ruleResult.nodes = [ ruleResult.nodes[0] ]; + } + }); + } + resultObject[key] = (resultObject[key] || []).map(function(ruleResult) { + ruleResult = Object.assign({}, ruleResult); + if (Array.isArray(ruleResult.nodes) && ruleResult.nodes.length > 0) { + ruleResult.nodes = ruleResult.nodes.map(function(subResult) { + if (_typeof(subResult.node) === 'object') { + subResult.html = subResult.node.source; + if (options.elementRef && !subResult.node.fromFrame) { + subResult.element = subResult.node.element; + } + if (options.selectors !== false || subResult.node.fromFrame) { + subResult.target = subResult.node.selector; + } + if (options.ancestry) { + subResult.ancestry = subResult.node.ancestry; + } + if (options.xpath) { + subResult.xpath = subResult.node.xpath; + } + } + delete subResult.result; + delete subResult.node; + normalizeRelatedNodes(subResult, options); + return subResult; + }); } + resultKeys.forEach(function(key2) { + return delete ruleResult[key2]; + }); + delete ruleResult.pageLevel; + delete ruleResult.result; + return ruleResult; }); - cache_default.set(outerHTML, node); - } - Array.from(element.childNodes).forEach(function(child) { - node.appendChild(filterHtmlAttrs(child, filterAttrs)); }); - return node; + return resultObject; } - var filter_html_attrs_default = filterHtmlAttrs; - function pushNode(result, nodes) { - var temp; - if (result.length === 0) { - return nodes; - } - if (result.length < nodes.length) { - temp = result; - result = nodes; - nodes = temp; + var process_aggregate_default = processAggregate; + var dataRegex = /\$\{\s?data\s?\}/g; + function substitute(str, data2) { + if (typeof data2 === 'string') { + return str.replace(dataRegex, data2); } - for (var _i9 = 0, l = nodes.length; _i9 < l; _i9++) { - if (!result.includes(nodes[_i9])) { - result.push(nodes[_i9]); + for (var prop in data2) { + if (data2.hasOwnProperty(prop)) { + var regex = new RegExp('\\${\\s?data\\.' + prop + '\\s?}', 'g'); + var replace = typeof data2[prop] === 'undefined' ? '' : String(data2[prop]); + str = str.replace(regex, replace); } } - return result; - } - function getOuterIncludes(includes) { - return includes.reduce(function(res, el) { - if (!res.length || !_contains(res[res.length - 1], el)) { - res.push(el); - } - return res; - }, []); + return str; } - function select(selector, context5) { - var result = []; - var candidate; - if (axe._selectCache) { - for (var j = 0, l = axe._selectCache.length; j < l; j++) { - var item = axe._selectCache[j]; - if (item.selector === selector) { - return item.result; - } - } + function processMessage(message, data2) { + if (!message) { + return; } - var outerIncludes = getOuterIncludes(context5.include); - var isInContext = getContextFilter(context5); - for (var _i10 = 0; _i10 < outerIncludes.length; _i10++) { - candidate = outerIncludes[_i10]; - var nodes = query_selector_all_filter_default(candidate, selector, isInContext); - result = pushNode(result, nodes); + if (Array.isArray(data2)) { + data2.values = data2.join(', '); + if (typeof message.singular === 'string' && typeof message.plural === 'string') { + var str2 = data2.length === 1 ? message.singular : message.plural; + return substitute(str2, data2); + } + return substitute(message, data2); } - if (axe._selectCache) { - axe._selectCache.push({ - selector: selector, - result: result - }); + if (typeof message === 'string') { + return substitute(message, data2); } - return result; - } - var select_default = select; - function getContextFilter(context5) { - if (!context5.exclude || context5.exclude.length === 0) { - return null; + if (typeof data2 === 'string') { + var _str = message[data2]; + return substitute(_str, data2); } - return function(node) { - return is_node_in_context_default(node, context5); - }; - } - function setScroll(elm, top, left) { - if (elm === window) { - return elm.scroll(left, top); - } else { - elm.scrollTop = top; - elm.scrollLeft = left; + var str = message['default'] || incompleteFallbackMessage(); + if (data2 && data2.messageKey && message[data2.messageKey]) { + str = message[data2.messageKey]; } + return processMessage(str, data2); } - function setScrollState(scrollState) { - scrollState.forEach(function(_ref29) { - var elm = _ref29.elm, top = _ref29.top, left = _ref29.left; - return setScroll(elm, top, left); - }); - } - var set_scroll_state_default = setScrollState; - function _shadowSelect(selectors) { - var selectorArr = Array.isArray(selectors) ? _toConsumableArray(selectors) : [ selectors ]; - return selectRecursive(selectorArr, document); - } - function selectRecursive(selectors, doc) { - var selectorStr = selectors.shift(); - var elm = selectorStr ? doc.querySelector(selectorStr) : null; - if (selectors.length === 0) { - return elm; + var process_message_default = processMessage; + function getCheckMessage(checkId, type, data2) { + var check = axe._audit.data.checks[checkId]; + if (!check) { + throw new Error('Cannot get message for unknown check: '.concat(checkId, '.')); } - if (!(elm !== null && elm !== void 0 && elm.shadowRoot)) { - return null; + if (!check.messages[type]) { + throw new Error('Check "'.concat(checkId, '"" does not have a "').concat(type, '" message.')); } - return selectRecursive(selectors, elm.shadowRoot); - } - function tokenList(str) { - return (str || '').trim().replace(/\s{2,}/g, ' ').split(' '); - } - var token_list_default = tokenList; - function validInputTypes() { - return [ 'hidden', 'text', 'search', 'tel', 'url', 'email', 'password', 'date', 'month', 'week', 'time', 'datetime-local', 'number', 'range', 'color', 'checkbox', 'radio', 'file', 'submit', 'image', 'reset', 'button' ]; + return process_message_default(check.messages[type], data2); } - var valid_input_type_default = validInputTypes; - var langs = [ , [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , , , , , 1, 1, 1, 1, , , 1, 1, 1, , 1, , 1, , 1, 1 ], [ 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, , , 1, 1, 1, , , 1, 1, 1, , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , , , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, , , , , , 1, , 1, , , , , 1, , 1, , , , 1, 1, , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, , , 1, , , , , 1, 1, 1, , 1, , 1, , 1, , , , , , 1 ], [ 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, , 1, , 1, , , , , 1, , 1, 1, 1, 1, 1, , , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , 1, , 1, , , , 1, 1, 1, , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ 1, 1, 1, 1, 1, , , 1, , , 1, , , 1, 1, 1, , , , , 1, , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, , 1, 1, 1, , 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, , , 1, 1, , , , , , 1, 1 ], [ 1, 1, 1, , , , , 1, , , , 1, 1, , 1, , , , , , 1, , , , , 1 ], [ , 1, , , 1, , , 1, , , , , , 1 ], [ , 1, , 1, , , , 1, , , , 1 ], [ 1, , 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, , , 1, , 1, 1, , 1, , 1, , , , , 1, , 1 ], [ , 1, , , , 1, , , 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, , , 1, , , 1 ], [ , 1, 1, , , , , , 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, , 1, , , , , 1, 1, , 1, , 1 ], [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, , , , 1, 1, 1, , 1, 1, , , 1, 1, , 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, , 1, 1, 1, , 1, , , , , 1, 1, 1, , , 1, , 1, , , 1, 1 ], [ , , , , 1, , , , , , , , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, , 1, 1, 1, , 1, 1, , , , 1, 1, 1, 1, 1, , , 1, 1, 1, , , , , 1 ], [ 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , , , , , 1, , , , , , , 1 ], [ , 1, 1, , 1, 1, , 1, , , , , , , , , , , , , 1 ], , [ 1, 1, 1, , , , , , , , , , , , , 1 ], [ , , , , , , , , 1, , , 1, , , 1, 1, , , , , 1 ] ], [ , [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , , , 1, , , , , , , , , , , , , , , 1 ], [ , 1, , , 1, 1, , 1, , 1, 1, , , , 1, 1, , , 1, 1, , , , 1 ], [ 1, , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , 1, , , , 1 ], , [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, , , 1, 1, 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, , , 1, , 1, , , 1, 1, 1, 1, , , 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, , , 1, , , 1, , 1 ], [ , 1, , , , , , , , , , 1, 1, , , , , , 1, 1, , , , , 1 ], [ , , , , , , , 1, , , , 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, , , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, , 1, 1, 1, , , 1, 1, , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, , 1, 1, , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , , , , , , 1 ], , [ , 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, , 1 ], [ , , 1, , , 1, , , 1, 1, , , 1, , 1, 1, , 1 ], [ , 1, 1, , 1, , , , 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1 ], [ , 1, , , , , , , , , , 1, 1, , , , , , 1, 1, , 1, , 1, , 1, 1 ], , [ , 1, 1, , 1, , , 1, , 1, , , , 1, 1, 1, , , , , , 1, , , , 1 ], [ 1, 1, , , 1, 1, , 1, , , , , 1, , 1 ] ], [ , [ , 1 ], [ , , , 1, , , , 1, , , , 1, , , , 1, , , 1, , , 1 ], [ , , , , , , , , , , , , , , , , , , 1, 1, , , , , , 1 ], , [ 1, , , , , 1 ], [ , 1, , , , 1, , , , 1 ], [ , 1, , , , , , , , , , , 1, , , 1, , , , , , , , , 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , 1, , , , 1, , 1 ], [ , 1 ], [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, , 1, 1, , 1, , , , , , , 1 ], [ 1, , , , , 1, , , 1, 1, , 1, , 1, , 1, 1, , , , , 1, , , 1 ], [ , 1, 1, , , 1, , 1, , 1, , 1, , 1, 1, 1, 1, , , 1, , 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, , 1, , , , 1, 1, 1, 1, , 1, 1, , , 1, 1, 1, 1 ], [ 1, , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , 1 ], , [ , 1, , , , , , 1, 1, 1, , 1, , , , 1, , , 1, 1, 1, , , 1 ], [ 1, , , , , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, , 1, , 1, , 1, , , 1, 1 ], [ 1, , 1, 1, , , , , 1, , , , , , 1, 1, , , 1, 1, 1, 1, , , 1, , 1 ], [ 1, , , , , , , , , , , , , , , , , 1 ], [ , , , , , 1, , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , , 1 ], [ , 1, , , , 1 ] ], [ , [ 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, , , 1, 1, 1 ], [ , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], , [ , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , , , , , , , 1, , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], , [ 1, 1, , , , 1, 1, , , , , , 1, , , , 1, , 1, , 1, 1, , 1 ], [ 1 ], [ , , , , , , , , , , , 1, , , , , , , , , , , 1 ], [ , 1, , , , , , , 1, 1, , , 1, , 1, , , , 1, , , , , , , 1 ], [ , , , , , , , , , , , , , , , , 1, , , , , 1 ], [ , , 1, , , , , 1, , 1 ], [ 1, , , , 1, , , , , 1, , , , 1, 1, , , , 1, 1, , , , , 1 ], [ , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , 1, 1, , , , , , , 1, , 1, , 1, 1, 1, 1, 1, 1 ], [ , , , , , 1, , , , , , , 1, , , , , , , 1 ], , [ , , 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, 1, , , 1, 1, , 1, 1, 1, , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , 1 ], , [ 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, , , , , , 1, , 1, , , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1, , , 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , 1, , , , , , , , , 1, , , , 1 ], [ , 1, 1, , 1, 1, , 1, , , , 1, 1, , 1, 1, , , 1, , 1, 1, , 1 ], [ , 1, , 1, , 1, , , 1, , , 1, 1, , 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , , , , , , , , , 1, , 1, , 1, 1, , , , 1, , , 1 ], [ , 1, , , 1, 1, , , , , , , , , 1, 1, 1, , , , , 1 ], [ 1, , , 1, 1, , , , 1, 1, 1, 1, 1, , , 1, , , 1, , , 1, , 1, , 1 ], [ , 1, 1, , 1, 1, , 1, 1, , , , 1, 1, 1, , , 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , , 1 ], [ , 1, , , , , , , , 1, , , , , 1, , , , 1, , , 1 ], [ , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , 1, , 1, , , , , 1, 1, 1, 1, 1, , , 1, , , , 1 ], [ , 1, , , , , , , , 1, , , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, , 1, , 1, 1, , , , 1, , 1, 1, 1, 1, 1, , 1, 1, , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1, 1, , , , 1, , 1, 1, , 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , 1, 1, 1, 1, , 1, , , 1, 1, 1, 1, , , 1, , , , , , , 1 ], [ , 1, , , , , , , , 1, , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1 ], [ , 1, 1, , , , , , , , , , , , 1, 1, , , , , , 1 ], [ , 1, , , , , , , 1 ], [ , , , , , , , , , , , , , , 1, , , , , 1, , , , , , 1 ], [ 1, 1, , , 1, , , 1, 1, 1, , , , 1 ], , [ , , , , , , , , , , , , , 1, , , , , , , , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , 1, , , , , , , 1 ], [ 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, , , 1, , 1, , , 1, 1 ], [ , , , , , , , , , 1 ], [ , 1, , , , 1, , , , , , 1, , , 1, , , , , 1 ], [ , 1, 1, , 1, 1, , , , , , , , , , , , , , , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, 1, 1, 1, , , , 1, 1, , , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, 1, , 1, 1 ], [ , , , , , , , , , , , , , , , 1, , , , 1 ], , [ 1, 1, , 1, , 1, , , , , , 1, , 1, , 1, 1, , 1, , 1, 1, , 1, 1, , 1 ], [ , , 1, , , , , , 1, , , , 1, , 1, , , , , 1 ], [ 1, , , , , , , , , 1, , , , , , 1, , , , 1, , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, , 1, , , , , , 1, , , 1, , , , , , , , 1 ], [ , 1, , 1, , , , , , , , , , , , 1 ], , [ 1, 1, , , , , , , , , , , , , , , , , , , , , , 1, 1 ], [ 1 ] ], [ , [ 1, , , , , , , , , 1, , , , , 1, , 1, , 1 ], [ , 1, 1, , 1, 1, , 1, 1, 1, , , 1, 1, 1, , , , 1, , , 1, , , , 1 ], [ , 1, , , , , , , 1, , , , 1, , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , , , 1, , , , , , , , , 1, 1, 1, 1 ], [ 1 ], [ , 1, 1, , , 1, 1, , , , , 1, , 1, , , , , , , , 1, , , , 1 ], [ 1, , 1, , , 1, , 1, , , , , 1, 1, 1, 1, , , , 1, , , , 1 ], [ , , 1, , , , , , , 1, , , , , , , 1, , , , , , , 1 ], [ 1, , , , , , , , , , , , , , 1, , , , 1 ], [ , , , 1, , 1, , , , , 1, , , , 1, 1, , , , 1 ], [ 1, , , , , 1, , , , 1, , 1, 1, , , 1, 1, , 1, 1, 1, , 1, 1, 1, , 1 ], [ , 1, 1, , , , , 1, , 1, , 1, 1, 1, , 1, 1, , , 1, , 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , , 1, , 1, 1, , , 1, 1, , , , , , 1 ], [ 1, , 1, 1, , 1, , 1, 1, , 1, , 1, 1, 1, 1, 1, , , 1, 1, , , , , , 1 ], [ 1, , , , , , , , , , , , , , , , , , 1, , , 1, , 1 ], [ , , , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , , 1, , 1 ], [ , 1, , , , 1, , , 1, 1, , 1, , , 1, 1, , , 1, , , 1, , , 1, 1 ], [ 1, 1, , 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, , , 1, , 1, 1 ], [ 1, , 1, 1, 1, 1, , , , 1, , 1, 1, 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, , , , , , , , , , , , , 1 ], [ , , 1, , , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , , , , , , , , , 1, , 1, , 1, , , , 1 ], [ , , , 1, , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , , 1, , , , , , , , , 1 ], [ , , , , , , , , 1, 1, , , , , , , , , 1, , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , , , , , 1, , , , 1, 1, 1, , , 1, 1, , , 1, , 1, 1, , 1 ], [ , , , , , , , , , , , , , , , , , , , 1, 1 ], [ , 1, , , , , , 1, , , , , , , , , , , , , 1 ], [ , , 1, , , 1, , 1, 1, 1, , 1, 1, , 1, , , , 1, , 1, 1 ], , [ , , 1, , , 1, , , , , , 1, , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, 1, , 1, , 1, , , 1, 1, 1, , , 1 ], [ , , , , , 1, , , , , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , 1, , 1, 1, , 1, , , 1 ], [ , , , , , 1, , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, 1, , , , , 1, , , 1, , 1, , , , 1, 1, , , , 1, 1 ], [ , 1, , , 1, , , 1, , 1, 1, , 1, , , , , , , 1 ], [ , , 1, , 1, , , 1, , , , , , , , , , , 1, 1, , , , 1 ], [ , 1, , , , , , , , , , , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , , , , , , , , , , , , , , , 1, , 1, 1 ], [ , , , , , , , , , , , , 1 ], , [ , 1, 1, 1, 1, , , , 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, , 1 ], [ 1, , , , 1, , , , , , , , , , 1 ], [ 1, , , , , , , , , 1 ], , [ , 1, , , , 1, , , , , , , , , , , , , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, , , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, , 1, , , , 1, 1, , , 1, 1, , 1 ], [ , 1, 1, , 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ 1, 1, 1, , , , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, , 1, 1, , , , , 1 ], [ , 1, , , , , , , 1, 1, , , 1, 1, 1, , 1, , , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , , 1, , , , 1, , , , , , , 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , 1, , , 1, 1, 1, 1, , 1, 1, 1, 1, , , , 1, , 1, , 1, , , 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , , 1, 1, , , , , , , , , 1 ], , [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , , 1, , 1, , 1, , , , 1 ], [ , 1, , , 1, 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , , 1 ], [ 1, , , 1, , , , 1, 1, 1, , , , , 1, 1, , , , 1, , 1 ], [ 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, , , , , , , , 1, , 1, , , , , , , , 1, , 1 ], [ , 1, , , , 1, , 1, 1, , , , 1, 1, , 1, , , , 1, 1, 1, , 1 ], , [ , 1, , , , , , 1, , , , , , , 1 ], [ , , , , , , , , 1, , , , 1, , 1, , , , , , , , , , , , 1 ] ], [ , [ , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, , , , , , , , 1, , , , , , 1, , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, , , , , 1, 1, 1, , , 1, , 1, 1, , , , 1, , 1, , , 1, 1 ], [ , , , , , , , 1, , , , 1, 1, 1, 1, 1, , 1, , , , , , , , 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, 1, , 1, , 1, , 1, 1, , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , 1, 1, , 1, , 1, 1, 1, , 1, , 1, 1, , 1, 1, , 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , , , , , , 1, , , , , 1, , 1 ], [ , 1, 1, 1, , 1, , 1, , 1, , , , 1, , 1, , , 1, , , , , , 1, 1 ], [ , 1, , , 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, , 1, 1, , , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , , , 1, , 1, , 1, , , , , , 1, , 1, , , , 1, 1 ] ], [ , [ , 1, , 1, , , , , , , , , , , , , , , 1, , , , 1 ], [ , , , , , , , , , 1, , 1, 1, 1, , 1, , , 1, , 1, 1 ], [ 1, 1, , , , , , , 1, , , , , , , 1, , , , , , 1 ], [ , 1, , , , , , , , , , 1, , , , , , , , , 1, 1 ], , [ , , , , , , , , , , , , , , , 1, , , , 1, , 1 ], [ , , 1, 1, , 1, , 1, , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , 1, 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ 1, , 1, 1, , , , 1, , , , , , , , , 1, , , 1, , , 1, 1 ], [ , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, 1, , , , , , 1, , 1, , 1, , , 1, , 1, 1 ], [ 1, 1, 1, 1, , 1, , 1, , 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, , , 1, , 1, , 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, , 1, 1 ], [ , , , , 1, , , 1, , , , , , , 1, , , , 1, 1 ], [ , 1, , , , , , , , , , 1, , 1, , 1, , , , , 1, , , , , 1 ], , [ 1, 1, , 1, , 1, , 1, 1, , , , , , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, , , , , , 1, , , , , , 1, 1, , , , 1, 1, , , 1 ], [ , 1, 1, , 1, 1, , , , 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, , , 1, , , , 1, , , , 1, 1 ], [ , , , , 1 ], [ , , , , , , , , , 1, , , 1 ], , [ , , 1, , 1, , , , , , , , , 1, , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, , 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , , , , 1 ], [ , 1, , 1, , , , , , 1, , , , , 1, 1, , , , , 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , , 1, , 1, 1, 1 ], [ , 1, , , , 1, , , , , , , 1 ], [ , 1, , , 1, , , 1, , 1, , 1, 1, , 1, , , , , 1, , 1, , , , 1, 1 ], [ , 1, , , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, , , , 1, 1, , , , , , 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , 1, , , , , , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1 ], [ 1, 1, , , , , , , 1, 1, , , , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], , [ , 1, 1, , , , , 1, , 1, , , , 1, 1, 1, , , 1, , , , , 1 ], [ , , , , , , , , , , , , , 1 ], [ , , , , , 1, , , , , , , , 1, 1, , , , , 1, , 1, , , 1, 1 ], [ , , , , , , , , , , , , , , 1 ] ], [ , [ , 1 ], , , , , , , , , , , , , , , , , , , , [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, , , , 1, , 1, 1 ], [ , 1, , 1, , 1, , , 1, , , , , 1, , , , , , 1, 1 ], [ , 1, , 1, , , , , 1, , , , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, , , , , , , , , , , , , , , 1 ] ], [ , [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , , , , , , , 1, 1, , , , 1 ], [ , , , , , , 1 ], [ , , 1 ], [ , 1, 1, , , 1, , 1, , 1, 1, , 1, 1, 1, , , , 1, 1, 1, , , , , 1 ], , [ , 1, , , , 1, , , , , , 1, , , 1, , , , 1, 1, , 1 ], [ , , , , , , , 1, , , , , , , , , 1 ], [ , 1, , , , 1, 1, , , , , , 1, 1, 1, , , , 1, , 1, 1 ], [ , , , , , , , 1, , 1, , , , , , , , , , 1 ], [ , 1, 1, , , , , , 1, 1, , , , 1, , , , , , , 1, , , 1 ], , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , , 1, , , 1, , , , , 1, , 1, , 1, , 1, , , , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , , , , 1, 1, , 1, 1, , 1, , , 1, , 1 ], [ , , , , , , , , , , , , , , 1, , , , , , 1 ], , [ , , , , , , , , , 1, , , , , , 1, , , , , 1 ], [ , , 1, , , , , , , 1, , , 1, 1 ], [ , , , 1, , , , , 1, , , , , 1, , , , , , 1, , , , 1 ], [ 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, , , , 1, 1, 1, , , 1, 1, , , , 1, 1 ], , [ 1, 1, , , , , , , , , , 1, , 1, , 1, , , 1 ], [ , , , , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , 1, , , , , 1, , 1 ], [ , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , , 1, , , 1, , , , , , , , 1, , , , , , 1, , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, , 1, , , , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, , , , , , , 1, , 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, , , , , , 1, , 1, , , , , 1, 1, , , , , 1 ], [ 1, , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, , 1, , 1, , , , 1, 1, 1, 1, 1, , , 1, 1, , 1, , 1 ], [ , 1, 1, 1, 1, , , , , 1, , 1, 1, 1, 1, 1, , , 1, 1, , , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, , , , , 1, , 1, , 1, , , 1, , , 1, 1, , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , 1, , , , , 1, 1, , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , 1, , 1, 1, , 1, 1, 1, 1, 1, , , 1, , 1, , 1 ], [ 1, 1, 1, , 1, 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , , , , , , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , , , , , 1, 1, 1, 1, 1, , , , 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1 ], [ , 1, 1, 1, , 1, , 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1 ], [ 1, 1, , , , 1, , , 1, 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , 1, , 1 ], [ , 1, , , , , , , 1, , 1, , 1, 1, 1, 1, , , , , , , , , 1 ] ], [ , [ , , , , , , , , , , , , , 1, 1, , , , 1 ], [ , 1, , , , , , , , 1, , , 1, , , , , , 1, , , 1, , , , 1 ], , [ , 1, , , , 1, , 1, , 1, 1, , 1, 1, , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , 1 ], [ 1, 1, 1, , , 1, , , , , , , , , 1, 1, , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1, , , 1 ], [ , , , , , , , , , 1 ], [ 1, 1, , , , , , 1, 1, 1, , 1, 1, , , , 1, 1, , 1, , 1, 1, 1, , 1 ], [ , 1, 1, 1, , 1, 1, , , 1, , 1, 1, 1, 1, , , , , , , 1, , 1 ], [ , 1, 1, 1, 1, , , 1, , 1, , , , 1, 1, 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , 1, 1, , 1, , 1, , , 1, , , 1, , 1 ], [ , , , , , , , , , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , , , , , 1 ], , [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , 1, 1, , 1, , , , , 1, , , 1, , 1 ], [ , 1, , , , 1, , , 1, , , , , , , , 1, , 1, , , 1 ], [ , , , , , , , , , , , , , 1, 1, , , , 1, , , 1 ], [ , , , , , 1, , , 1, , , , 1 ], [ , 1 ], , [ , 1 ], [ 1, , , , , , , , , , , , , , 1, , , , , 1 ] ], [ , [ , 1, , , , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, , , 1 ], [ , , 1, , , , , , , , , 1 ], , , [ 1, , , 1, 1, , , , , , , , 1, 1, , 1, 1, , 1 ], , [ , , , , , , , , , , , , , , , , , , 1, , 1 ], , [ 1, , , 1, 1, , 1, 1, , , , , 1, , 1, , , , , 1, 1, , 1 ], , [ , 1, , , , , , , , 1, 1, 1, 1, 1, , 1, 1, , , , 1, 1 ], [ , , , , , , , , , , , , , , , , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , 1, , 1, , , 1 ], [ 1, , , , , , , , , , , , , , , , , , 1, , 1 ], , , [ , 1, , , , , , , , , , , , , , 1, , , , 1, 1 ], [ , , , , , , , , , 1, , , 1, , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , 1, 1, , , , , , 1 ], , [ , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , , 1, 1, , 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, , , , , , , , 1 ], [ , , , , 1, , , 1, , , 1, 1, , , , , , , , , , 1, , , , 1 ], [ , 1, , 1, 1, , , 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , , , , , , , 1 ], [ , 1, 1, , , , , 1, , 1, , , , , , 1, , , , , , 1, , 1, , 1 ], [ , 1, , , , , , 1, , , , 1, , , , , , , , , , 1 ], [ , , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, , , , , , , , 1 ], [ , 1, 1, , 1, , , , , , , , 1, , , , , , 1, , , 1, , 1, , 1 ], [ , 1, , 1, , 1, , 1, 1, 1, , 1, 1, 1, , 1, , , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, , , , 1, 1, 1, , , , 1, 1, , , 1, 1 ], [ , , 1, 1, 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, , , , , 1, , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, , , 1, 1, , , , 1, , 1 ], [ , , , 1 ], , [ , 1, 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , 1, , 1, , 1, , , , , , , 1, 1, , 1, 1 ], [ , , , , , , 1, , 1, 1, , 1, , 1, , , , , , , , , , 1 ], [ , 1, 1, , 1, , , , 1, , , , 1, 1, 1, , , , 1, , 1, 1, 1, , 1, 1 ], , [ , 1, 1, , , , , , , , , , , , , 1, , , 1, , , , , 1 ], [ , 1, , , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , , , , , , 1, , , , 1, , , , , 1, , , , , , , 1 ] ], [ , [ , 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, , 1, , 1, 1, , , 1, 1, 1, 1, , 1, , , , , 1, 1, 1 ], [ , , 1, 1, , 1, , 1, 1, , , , 1, 1, 1, 1, , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, , 1, , , , , , , , 1, , 1, , 1, , , , , , , , , , 1 ], [ , , 1, , 1, , , 1, , , , , 1, 1, , , 1, , 1, 1, 1, 1 ], [ , 1 ], [ , 1, 1, , 1, , 1, 1, , 1, , , 1, 1, 1, , , , 1, , , 1, , 1 ], [ 1, 1, , 1, 1, 1, , , , , , , , , , , , , 1, , 1, 1, 1 ], [ , 1, 1, , , , , , , 1, , , 1, , 1, , 1, , 1, 1, , , 1, , , 1 ], [ , , 1, , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, , 1, , , , , 1, 1, 1, , , 1, , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , 1, 1, 1, , 1, , 1, 1, 1, , , 1, 1, 1, 1, , , , 1, 1 ], [ , , , 1, 1, , , 1, , 1, , 1, , 1, 1, 1, 1, , 1, , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , 1, 1, , 1, , 1, , , , 1, 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, , 1, , , 1, , , 1, , 1, 1, 1, 1, 1, , 1, , 1, 1 ], [ , , , , , 1, , , , 1, , , , , 1, 1, , , , 1 ], [ , 1, , 1, 1, 1, , 1, , , 1, 1, 1, , , 1, , , 1, , 1, , , 1 ], [ , , 1, , , , , , , , , 1, , 1, , , , , 1, , 1 ], [ , 1, 1, , , , , , , , 1, 1, 1, , , , , , , , 1, , , , , 1 ], [ , , , , , , , , 1, , , , , 1, , , 1 ] ], [ , [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, , , , , , , , , 1, 1 ], [ , , , , , , , , 1, , , , 1, , 1, , 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , , , , , , , 1 ], [ , 1, , 1, , 1, , , , 1, 1, , 1, , 1, , , , 1, 1, 1, 1, 1, , , 1 ], , [ , 1, , , , , , , , 1, , , 1, 1, , , 1, , 1, 1, , 1, , 1 ], [ , 1, , , 1, , , , , , , , 1, , , , , , , 1 ], [ 1, 1, , , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], , [ , 1, , , , , , 1, , 1, , 1, 1, 1, 1, 1, , , 1, , 1, 1, , , , 1 ], [ , 1, 1, , , 1, , 1, , 1, , , 1, 1, 1, 1, , , 1, , , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1 ], [ , 1, , , 1, 1, , 1, 1, , , 1, 1, , 1, 1, , 1, , 1, , 1 ], [ 1, , 1, , , , , 1, , 1, , 1, 1, 1, 1, , , , , 1, 1, , , , 1, 1 ], [ , 1, 1, , , , , 1, 1, , , 1, , 1, 1, 1, 1, , , , , , , , , , 1 ], , [ , 1, 1, , , 1, , , , 1, , 1, 1, 1, 1, 1, , , , 1, , , , 1, , 1 ], [ , , , 1, 1, , , 1, , , , , 1, , 1, 1, 1, , 1, 1, , , , , , 1 ], [ , 1, , , , , , , , , , , 1, , , , 1, , , , , , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , , , 1, , , , , 1, , 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, , , , , , 1, , , , , 1, 1, , , , , , , , 1, , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1, , , 1, , , , , 1 ], [ , , , , , , , 1, , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, , , , , , , 1, , , , , , , , 1, , , 1 ], [ , 1, , , , , , , 1 ], [ , , , , , , , , , , 1 ], [ , 1, , , , , , 1, 1, , , , , , 1 ], , [ , 1, 1, , , , , , 1, , , , , 1, 1, , , , 1 ], [ 1, , 1, , 1, , , , , 1, , , , , 1, , , , , , , , , 1, 1 ], [ , 1, 1, , , , , , , , , 1, 1, 1, 1, , , , 1, , , , , 1, , , 1 ], , [ , 1, 1, , 1, , , 1, 1, , , 1, , , 1, 1, 1, , 1, , 1, 1, 1, , , , 1 ], [ , , , , , 1, , , , , 1, , , 1, 1, , , 1, , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , , , , , , , 1 ], [ , , , 1, , , , , 1, , , , , 1, , 1, , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , 1 ], [ , 1, , , , , , 1, , , , , , , 1, 1, 1, , , 1 ], [ , 1, , , , , , , , , , 1, 1, 1, , , , , 1, , , 1 ], [ , , , , , 1, , 1, , , , , 1, 1, 1, , 1, 1, , 1, 1, 1, , , 1, 1 ], [ 1, 1, , , , , , , 1, , , , , 1, 1, , , , , , , , , , , 1 ], , [ , 1 ], [ , , , , , , , , , , , , , , , , , , , , , , , , 1 ], [ , , 1, , , , , 1, , , 1, , , , 1, , 1 ], [ , 1, , , , , , , , , 1 ] ] ]; - function isValidLang(lang) { - var array = langs; - while (lang.length < 3) { - lang += '`'; - } - for (var _i11 = 0; _i11 <= lang.length - 1; _i11++) { - var index = lang.charCodeAt(_i11) - 96; - array = array[index]; - if (!array) { - return false; + var get_check_message_default = getCheckMessage; + function getCheckOption(check, ruleID, options) { + var ruleCheckOption = ((options.rules && options.rules[ruleID] || {}).checks || {})[check.id]; + var checkOption = (options.checks || {})[check.id]; + var enabled = check.enabled; + var opts = check.options; + if (checkOption) { + if (checkOption.hasOwnProperty('enabled')) { + enabled = checkOption.enabled; } - } - return true; - } - function _validLangs(langArray) { - langArray = Array.isArray(langArray) ? langArray : langs; - var codes = []; - langArray.forEach(function(lang, index) { - var _char2 = String.fromCharCode(index + 96).replace('`', ''); - if (Array.isArray(lang)) { - codes = codes.concat(_validLangs(lang).map(function(newLang) { - return _char2 + newLang; - })); - } else { - codes.push(_char2); + if (checkOption.hasOwnProperty('options')) { + opts = checkOption.options; } - }); - return codes; - } - var valid_langs_default = isValidLang; - axe._thisWillBeDeletedDoNotUse = axe._thisWillBeDeletedDoNotUse || {}; - axe._thisWillBeDeletedDoNotUse.utils = { - setDefaultFrameMessenger: setDefaultFrameMessenger - }; - var SerialVirtualNode = function(_abstract_virtual_nod2) { - _inherits(SerialVirtualNode, _abstract_virtual_nod2); - var _super2 = _createSuper(SerialVirtualNode); - function SerialVirtualNode(serialNode) { - var _this3; - _classCallCheck(this, SerialVirtualNode); - _this3 = _super2.call(this); - _this3._props = normaliseProps(serialNode); - _this3._attrs = normaliseAttrs(serialNode); - return _this3; } - _createClass(SerialVirtualNode, [ { - key: 'props', - get: function get() { - return this._props; - } - }, { - key: 'attr', - value: function attr(attrName) { - var _this$_attrs$attrName; - return (_this$_attrs$attrName = this._attrs[attrName]) !== null && _this$_attrs$attrName !== void 0 ? _this$_attrs$attrName : null; - } - }, { - key: 'hasAttr', - value: function hasAttr(attrName) { - return this._attrs[attrName] !== void 0; - } - }, { - key: 'attrNames', - get: function get() { - return Object.keys(this._attrs); - } - } ]); - return SerialVirtualNode; - }(abstract_virtual_node_default); - var nodeNamesToTypes = { - '#cdata-section': 2, - '#text': 3, - '#comment': 8, - '#document': 9, - '#document-fragment': 11 - }; - var nodeTypeToName = {}; - var nodeNames = Object.keys(nodeNamesToTypes); - nodeNames.forEach(function(nodeName2) { - nodeTypeToName[nodeNamesToTypes[nodeName2]] = nodeName2; - }); - function normaliseProps(serialNode) { - var _serialNode$nodeName, _ref30, _serialNode$nodeType; - var nodeName2 = (_serialNode$nodeName = serialNode.nodeName) !== null && _serialNode$nodeName !== void 0 ? _serialNode$nodeName : nodeTypeToName[serialNode.nodeType]; - var nodeType = (_ref30 = (_serialNode$nodeType = serialNode.nodeType) !== null && _serialNode$nodeType !== void 0 ? _serialNode$nodeType : nodeNamesToTypes[serialNode.nodeName]) !== null && _ref30 !== void 0 ? _ref30 : 1; - assert_default(typeof nodeType === 'number', 'nodeType has to be a number, got \''.concat(nodeType, '\'')); - assert_default(typeof nodeName2 === 'string', 'nodeName has to be a string, got \''.concat(nodeName2, '\'')); - nodeName2 = nodeName2.toLowerCase(); - var type = null; - if (nodeName2 === 'input') { - type = (serialNode.type || serialNode.attributes && serialNode.attributes.type || '').toLowerCase(); - if (!valid_input_type_default().includes(type)) { - type = 'text'; + if (ruleCheckOption) { + if (ruleCheckOption.hasOwnProperty('enabled')) { + enabled = ruleCheckOption.enabled; + } + if (ruleCheckOption.hasOwnProperty('options')) { + opts = ruleCheckOption.options; } } - var props = _extends({}, serialNode, { - nodeType: nodeType, - nodeName: nodeName2 - }); - if (type) { - props.type = type; + return { + enabled: enabled, + options: opts, + absolutePaths: options.absolutePaths + }; + } + var get_check_option_default = getCheckOption; + function _getEnvironmentData() { + var _win$location; + var metadata = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; + var win = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; + if (metadata && _typeof(metadata) === 'object') { + return metadata; + } else if (_typeof(win) !== 'object') { + return {}; } - delete props.attributes; - return Object.freeze(props); + return { + testEngine: { + name: 'axe-core', + version: axe.version + }, + testRunner: { + name: axe._audit.brand + }, + testEnvironment: getTestEnvironment(win), + timestamp: new Date().toISOString(), + url: (_win$location = win.location) === null || _win$location === void 0 ? void 0 : _win$location.href + }; } - function normaliseAttrs(_ref31) { - var _ref31$attributes = _ref31.attributes, attributes4 = _ref31$attributes === void 0 ? {} : _ref31$attributes; - var attrMap = { - htmlFor: 'for', - className: 'class' + function getTestEnvironment(win) { + if (!win.navigator || _typeof(win.navigator) !== 'object') { + return {}; + } + var navigator = win.navigator, innerHeight = win.innerHeight, innerWidth = win.innerWidth; + var _ref44 = getOrientation(win) || {}, angle = _ref44.angle, type = _ref44.type; + return { + userAgent: navigator.userAgent, + windowWidth: innerWidth, + windowHeight: innerHeight, + orientationAngle: angle, + orientationType: type }; - return Object.keys(attributes4).reduce(function(attrs, attrName) { - var value = attributes4[attrName]; - assert_default(_typeof(value) !== 'object' || value === null, 'expects attributes not to be an object, \''.concat(attrName, '\' was')); - if (value !== void 0) { - var mappedName = attrMap[attrName] || attrName; - attrs[mappedName] = value !== null ? String(value) : null; - } - return attrs; - }, {}); } - var serial_virtual_node_default = SerialVirtualNode; - var aria_exports = {}; - __export(aria_exports, { - allowedAttr: function allowedAttr() { - return allowed_attr_default; - }, - arialabelText: function arialabelText() { - return arialabel_text_default; - }, - arialabelledbyText: function arialabelledbyText() { - return arialabelledby_text_default; - }, - getAccessibleRefs: function getAccessibleRefs() { - return get_accessible_refs_default; - }, - getElementUnallowedRoles: function getElementUnallowedRoles() { - return get_element_unallowed_roles_default; - }, - getExplicitRole: function getExplicitRole() { - return get_explicit_role_default; - }, - getImplicitRole: function getImplicitRole() { - return implicit_role_default; - }, - getOwnedVirtual: function getOwnedVirtual() { - return get_owned_virtual_default; - }, - getRole: function getRole() { - return get_role_default; - }, - getRoleType: function getRoleType() { - return get_role_type_default; - }, - getRolesByType: function getRolesByType() { - return get_roles_by_type_default; - }, - getRolesWithNameFromContents: function getRolesWithNameFromContents() { - return get_roles_with_name_from_contents_default; - }, - implicitNodes: function implicitNodes() { - return implicit_nodes_default; - }, - implicitRole: function implicitRole() { - return implicit_role_default; - }, - isAccessibleRef: function isAccessibleRef() { - return is_accessible_ref_default; - }, - isAriaRoleAllowedOnElement: function isAriaRoleAllowedOnElement() { - return is_aria_role_allowed_on_element_default; - }, - isUnsupportedRole: function isUnsupportedRole() { - return is_unsupported_role_default; - }, - isValidRole: function isValidRole() { - return is_valid_role_default; - }, - label: function label() { - return label_default2; - }, - labelVirtual: function labelVirtual() { - return label_virtual_default; - }, - lookupTable: function lookupTable() { - return lookup_table_default; - }, - namedFromContents: function namedFromContents() { - return named_from_contents_default; - }, - requiredAttr: function requiredAttr() { - return required_attr_default; - }, - requiredContext: function requiredContext() { - return required_context_default; - }, - requiredOwned: function requiredOwned() { - return required_owned_default; - }, - validateAttr: function validateAttr() { - return validate_attr_default; - }, - validateAttrValue: function validateAttrValue() { - return validate_attr_value_default; + function getOrientation(_ref45) { + var screen = _ref45.screen; + return screen.orientation || screen.msOrientation || screen.mozOrientation; + } + function createFrameContext(frame, _ref46) { + var focusable = _ref46.focusable, page = _ref46.page; + return { + node: frame, + include: [], + exclude: [], + initiator: false, + focusable: focusable && frameFocusable(frame), + size: getBoundingSize(frame), + page: page + }; + } + function frameFocusable(frame) { + var tabIndex = frame.getAttribute('tabindex'); + if (!tabIndex) { + return true; } - }); - function getGlobalAriaAttrs() { - if (cache_default.get('globalAriaAttrs')) { - return cache_default.get('globalAriaAttrs'); + var _int = parseInt(tabIndex, 10); + return isNaN(_int) || _int >= 0; + } + function getBoundingSize(domNode) { + var width = parseInt(domNode.getAttribute('width'), 10); + var height = parseInt(domNode.getAttribute('height'), 10); + if (isNaN(width) || isNaN(height)) { + var rect = domNode.getBoundingClientRect(); + width = isNaN(width) ? rect.width : width; + height = isNaN(height) ? rect.height : height; } - var globalAttrs = Object.keys(standards_default.ariaAttrs).filter(function(attrName) { - return standards_default.ariaAttrs[attrName].global; - }); - cache_default.set('globalAriaAttrs', globalAttrs); - return globalAttrs; + return { + width: width, + height: height + }; } - var get_global_aria_attrs_default = getGlobalAriaAttrs; - function allowedAttr(role) { - var roleDef = standards_default.ariaRoles[role]; - var attrs = _toConsumableArray(get_global_aria_attrs_default()); - if (!roleDef) { - return attrs; + function normalizeContext(contextSpec) { + if (isContextObject(contextSpec)) { + var msg = ' must be used inside include or exclude. It should not be on the same object.'; + assert2(!objectHasOwn(contextSpec, 'fromFrames'), 'fromFrames' + msg); + assert2(!objectHasOwn(contextSpec, 'fromShadowDom'), 'fromShadowDom' + msg); + } else if (isContextProp(contextSpec)) { + contextSpec = { + include: contextSpec, + exclude: [] + }; + } else { + return { + include: [ document ], + exclude: [] + }; } - if (roleDef.allowedAttrs) { - attrs.push.apply(attrs, _toConsumableArray(roleDef.allowedAttrs)); + var include = normalizeContextList(contextSpec.include); + if (include.length === 0) { + include.push(document); } - if (roleDef.requiredAttrs) { - attrs.push.apply(attrs, _toConsumableArray(roleDef.requiredAttrs)); + var exclude = normalizeContextList(contextSpec.exclude); + return { + include: include, + exclude: exclude + }; + } + function isContextSpec(contextSpec) { + return isContextObject(contextSpec) || isContextProp(contextSpec); + } + function normalizeContextList() { + var selectorList = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + var normalizedList = []; + if (!isArrayLike(selectorList)) { + selectorList = [ selectorList ]; } - return attrs; + for (var _i11 = 0; _i11 < selectorList.length; _i11++) { + var normalizedSelector = normalizeContextSelector(selectorList[_i11]); + if (normalizedSelector) { + normalizedList.push(normalizedSelector); + } + } + return normalizedList; } - var allowed_attr_default = allowedAttr; - function arialabelText(vNode) { - if (!(vNode instanceof abstract_virtual_node_default)) { - if (vNode.nodeType !== 1) { - return ''; + function normalizeContextSelector(selector) { + if (selector instanceof window.Node) { + return selector; + } + if (typeof selector === 'string') { + return [ selector ]; + } + if (isLabelledFramesSelector(selector)) { + assertLabelledFrameSelector(selector); + selector = selector.fromFrames; + } else if (isLabelledShadowDomSelector(selector)) { + selector = [ selector ]; + } + return normalizeFrameSelectors(selector); + } + function normalizeFrameSelectors(frameSelectors) { + if (!Array.isArray(frameSelectors)) { + return; + } + var normalizedSelectors = []; + var _iterator5 = _createForOfIteratorHelper(frameSelectors), _step5; + try { + for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) { + var selector = _step5.value; + if (isLabelledShadowDomSelector(selector)) { + assertLabelledShadowDomSelector(selector); + selector = selector.fromShadowDom; + } + if (typeof selector !== 'string' && !isShadowSelector(selector)) { + return; + } + normalizedSelectors.push(selector); } - vNode = get_node_from_tree_default(vNode); + } catch (err) { + _iterator5.e(err); + } finally { + _iterator5.f(); } - return vNode.attr('aria-label') || ''; + return normalizedSelectors; } - var arialabel_text_default = arialabelText; - function isUnsupportedRole(role) { - var roleDefinition = standards_default.ariaRoles[role]; - return roleDefinition ? !!roleDefinition.unsupported : false; + function isContextObject(contextSpec) { + return [ 'include', 'exclude' ].some(function(prop) { + return objectHasOwn(contextSpec, prop) && isContextProp(contextSpec[prop]); + }); } - var is_unsupported_role_default = isUnsupportedRole; - function isValidRole(role) { - var _ref32 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, allowAbstract = _ref32.allowAbstract, _ref32$flagUnsupporte = _ref32.flagUnsupported, flagUnsupported = _ref32$flagUnsupporte === void 0 ? false : _ref32$flagUnsupporte; - var roleDefinition = standards_default.ariaRoles[role]; - var isRoleUnsupported = is_unsupported_role_default(role); - if (!roleDefinition || flagUnsupported && isRoleUnsupported) { + function isContextProp(contextList) { + return typeof contextList === 'string' || contextList instanceof window.Node || isLabelledFramesSelector(contextList) || isLabelledShadowDomSelector(contextList) || isArrayLike(contextList); + } + function isLabelledFramesSelector(selector) { + return objectHasOwn(selector, 'fromFrames'); + } + function isLabelledShadowDomSelector(selector) { + return objectHasOwn(selector, 'fromShadowDom'); + } + function assertLabelledFrameSelector(selector) { + assert2(Array.isArray(selector.fromFrames), 'fromFrames property must be an array'); + assert2(selector.fromFrames.every(function(selector2) { + return !objectHasOwn(selector2, 'fromFrames'); + }), 'Invalid context; fromFrames selector must be appended, rather than nested'); + assert2(!objectHasOwn(selector, 'fromShadowDom'), 'fromFrames and fromShadowDom cannot be used on the same object'); + } + function assertLabelledShadowDomSelector(selector) { + assert2(Array.isArray(selector.fromShadowDom), 'fromShadowDom property must be an array'); + assert2(selector.fromShadowDom.every(function(selector2) { + return !objectHasOwn(selector2, 'fromFrames'); + }), 'shadow selector must be inside fromFrame instead'); + assert2(selector.fromShadowDom.every(function(selector2) { + return !objectHasOwn(selector2, 'fromShadowDom'); + }), 'fromShadowDom selector must be appended, rather than nested'); + } + function isShadowSelector(selector) { + return Array.isArray(selector) && selector.every(function(str) { + return typeof str === 'string'; + }); + } + function isArrayLike(arr) { + return arr && _typeof(arr) === 'object' && typeof arr.length === 'number' && arr instanceof window.Node === false; + } + function assert2(bool, str) { + assert_default(bool, 'Invalid context; '.concat(str, '\nSee: https://github.com/dequelabs/axe-core/blob/master/doc/context.md')); + } + function objectHasOwn(obj, prop) { + if (!obj || _typeof(obj) !== 'object') { return false; } - return allowAbstract ? true : roleDefinition.type !== 'abstract'; + return Object.prototype.hasOwnProperty.call(obj, prop); } - var is_valid_role_default = isValidRole; - function getExplicitRole(vNode) { - var _ref33 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, fallback = _ref33.fallback, abstracts = _ref33.abstracts, dpub = _ref33.dpub; - vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); - if (vNode.props.nodeType !== 1) { - return null; - } - var roleAttr = (vNode.attr('role') || '').trim().toLowerCase(); - var roleList = fallback ? token_list_default(roleAttr) : [ roleAttr ]; - var firstValidRole = roleList.find(function(role) { - if (!dpub && role.substr(0, 4) === 'doc-') { - return false; - } - return is_valid_role_default(role, { - allowAbstract: abstracts - }); + function parseSelectorArray(context, type) { + var result = []; + for (var _i12 = 0, l = context[type].length; _i12 < l; _i12++) { + var item = context[type][_i12]; + if (item instanceof window.Node) { + if (item.documentElement instanceof window.Node) { + result.push(context.flatTree[0]); + } else { + result.push(get_node_from_tree_default(item)); + } + } else if (item && item.length) { + if (item.length > 1) { + pushUniqueFrameSelector(context, type, item); + } else { + var nodeList = _shadowSelectAll(item[0]); + result.push.apply(result, _toConsumableArray(nodeList.map(function(node) { + return get_node_from_tree_default(node); + }))); + } + } + } + return result.filter(function(r) { + return r; }); - return firstValidRole || null; } - var get_explicit_role_default = getExplicitRole; - function getElementsByContentType(type) { - return Object.keys(standards_default.htmlElms).filter(function(nodeName2) { - var elm = standards_default.htmlElms[nodeName2]; - if (elm.contentTypes) { - return elm.contentTypes.includes(type); - } - if (!elm.variant) { - return false; - } - if (elm.variant['default'] && elm.variant['default'].contentTypes) { - return elm.variant['default'].contentTypes.includes(type); + function pushUniqueFrameSelector(context, type, selectorArray) { + context.frames = context.frames || []; + var frameSelector = selectorArray.shift(); + var frames = _shadowSelectAll(frameSelector); + frames.forEach(function(frame) { + var frameContext = context.frames.find(function(result) { + return result.node === frame; + }); + if (!frameContext) { + frameContext = createFrameContext(frame, context); + context.frames.push(frameContext); } - return false; + frameContext[type].push(selectorArray); }); } - var get_elements_by_content_type_default = getElementsByContentType; - function toGrid(node) { - var table5 = []; - var rows = node.rows; - for (var i = 0, rowLength = rows.length; i < rowLength; i++) { - var cells = rows[i].cells; - table5[i] = table5[i] || []; - var columnIndex = 0; - for (var j = 0, cellLength = cells.length; j < cellLength; j++) { - for (var colSpan = 0; colSpan < cells[j].colSpan; colSpan++) { - var rowspanAttr = cells[j].getAttribute('rowspan'); - var rowspanValue = parseInt(rowspanAttr) === 0 || cells[j].rowspan === 0 ? rows.length : cells[j].rowSpan; - for (var rowSpan = 0; rowSpan < rowspanValue; rowSpan++) { - table5[i + rowSpan] = table5[i + rowSpan] || []; - while (table5[i + rowSpan][columnIndex]) { - columnIndex++; - } - table5[i + rowSpan][columnIndex] = cells[j]; - } - columnIndex++; - } + function Context(spec, flatTree) { + var _spec, _spec2, _spec3, _spec4, _this2 = this; + spec = clone_default(spec); + this.frames = []; + this.page = typeof ((_spec = spec) === null || _spec === void 0 ? void 0 : _spec.page) === 'boolean' ? spec.page : void 0; + this.initiator = typeof ((_spec2 = spec) === null || _spec2 === void 0 ? void 0 : _spec2.initiator) === 'boolean' ? spec.initiator : true; + this.focusable = typeof ((_spec3 = spec) === null || _spec3 === void 0 ? void 0 : _spec3.focusable) === 'boolean' ? spec.focusable : true; + this.size = _typeof((_spec4 = spec) === null || _spec4 === void 0 ? void 0 : _spec4.size) === 'object' ? spec.size : {}; + spec = normalizeContext(spec); + this.flatTree = flatTree !== null && flatTree !== void 0 ? flatTree : get_flattened_tree_default(getRootNode2(spec)); + this.exclude = spec.exclude; + this.include = spec.include; + this.include = parseSelectorArray(this, 'include'); + this.exclude = parseSelectorArray(this, 'exclude'); + _select('frame, iframe', this).forEach(function(frame) { + if (_isNodeInContext(frame, _this2)) { + pushUniqueFrame(_this2, frame.actualNode); } + }); + if (typeof this.page === 'undefined') { + this.page = isPageContext(this); + this.frames.forEach(function(frame) { + frame.page = _this2.page; + }); + } + validateContext(this); + if (!Array.isArray(this.include)) { + this.include = Array.from(this.include); } - return table5; + this.include.sort(node_sorter_default); } - var to_grid_default = memoize_default(toGrid); - function getCellPosition(cell, tableGrid) { - var rowIndex, index; - if (!tableGrid) { - tableGrid = to_grid_default(find_up_default(cell, 'table')); + function pushUniqueFrame(context, frame) { + if (!_isVisibleToScreenReaders(frame) || find_by_default(context.frames, 'node', frame)) { + return; } - for (rowIndex = 0; rowIndex < tableGrid.length; rowIndex++) { - if (tableGrid[rowIndex]) { - index = tableGrid[rowIndex].indexOf(cell); - if (index !== -1) { - return { - x: index, - y: rowIndex - }; - } + context.frames.push(createFrameContext(frame, context)); + } + function isPageContext(_ref47) { + var include = _ref47.include; + return include.length === 1 && include[0].actualNode === document.documentElement; + } + function validateContext(context) { + if (context.include.length === 0 && context.frames.length === 0) { + var env = _respondable.isInFrame() ? 'frame' : 'page'; + throw new Error('No elements found for include in ' + env + ' Context'); + } + } + function getRootNode2(_ref48) { + var include = _ref48.include, exclude = _ref48.exclude; + var selectors = Array.from(include).concat(Array.from(exclude)); + for (var _i13 = 0; _i13 < selectors.length; _i13++) { + var item = selectors[_i13]; + if (item instanceof window.Element) { + return item.ownerDocument.documentElement; + } + if (item instanceof window.Document) { + return item.documentElement; } } + return document.documentElement; } - var get_cell_position_default = memoize_default(getCellPosition); - function getScope(cell) { - var scope = cell.getAttribute('scope'); - var role = cell.getAttribute('role'); - if (cell instanceof window.Element === false || [ 'TD', 'TH' ].indexOf(cell.nodeName.toUpperCase()) === -1) { - throw new TypeError('Expected TD or TH element'); + function _getFrameContexts(context) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (options.iframes === false) { + return []; } - if (role === 'columnheader') { - return 'col'; - } else if (role === 'rowheader') { - return 'row'; - } else if (scope === 'col' || scope === 'row') { - return scope; - } else if (cell.nodeName.toUpperCase() !== 'TH') { - return false; + var _Context = new Context(context), frames = _Context.frames; + return frames.map(function(_ref49) { + var node = _ref49.node, frameContext = _objectWithoutProperties(_ref49, _excluded7); + frameContext.initiator = false; + var frameSelector = _getAncestry(node); + return { + frameSelector: frameSelector, + frameContext: frameContext + }; + }); + } + function getRule(ruleId) { + var rule = axe._audit.rules.find(function(rule2) { + return rule2.id === ruleId; + }); + if (!rule) { + throw new Error('Cannot find rule by id: '.concat(ruleId)); } - var tableGrid = to_grid_default(find_up_default(cell, 'table')); - var pos = get_cell_position_default(cell, tableGrid); - var headerRow = tableGrid[pos.y].reduce(function(headerRow2, cell2) { - return headerRow2 && cell2.nodeName.toUpperCase() === 'TH'; - }, true); - if (headerRow) { - return 'col'; + return rule; + } + var get_rule_default = getRule; + function _getScroll(elm) { + var buffer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + var overflowX = elm.scrollWidth > elm.clientWidth + buffer; + var overflowY = elm.scrollHeight > elm.clientHeight + buffer; + if (!(overflowX || overflowY)) { + return; } - var headerCol = tableGrid.map(function(col) { - return col[pos.x]; - }).reduce(function(headerCol2, cell2) { - return headerCol2 && cell2 && cell2.nodeName.toUpperCase() === 'TH'; - }, true); - if (headerCol) { - return 'row'; + var style = window.getComputedStyle(elm); + var scrollableX = isScrollable(style, 'overflow-x'); + var scrollableY = isScrollable(style, 'overflow-y'); + if (overflowX && scrollableX || overflowY && scrollableY) { + return { + elm: elm, + top: elm.scrollTop, + left: elm.scrollLeft + }; } - return 'auto'; - } - var get_scope_default = getScope; - function isColumnHeader(element) { - return [ 'col', 'auto' ].indexOf(get_scope_default(element)) !== -1; - } - var is_column_header_default = isColumnHeader; - function isRowHeader(cell) { - return [ 'row', 'auto' ].includes(get_scope_default(cell)); } - var is_row_header_default = isRowHeader; - var sectioningElementSelector = get_elements_by_content_type_default('sectioning').map(function(nodeName2) { - return ''.concat(nodeName2, ':not([role])'); - }).join(', ') + ' , main:not([role]), [role=article], [role=complementary], [role=main], [role=navigation], [role=region]'; - function hasAccessibleName(vNode) { - var ariaLabelledby = sanitize_default(arialabelledby_text_default(vNode)); - var ariaLabel = sanitize_default(arialabel_text_default(vNode)); - return !!(ariaLabelledby || ariaLabel); + function isScrollable(style, prop) { + var overflowProp = style.getPropertyValue(prop); + return [ 'scroll', 'auto' ].includes(overflowProp); } - var implicitHtmlRoles = { - a: function a(vNode) { - return vNode.hasAttr('href') ? 'link' : null; - }, - area: function area(vNode) { - return vNode.hasAttr('href') ? 'link' : null; - }, - article: 'article', - aside: 'complementary', - body: 'document', - button: 'button', - datalist: 'listbox', - dd: 'definition', - dfn: 'term', - details: 'group', - dialog: 'dialog', - dt: 'term', - fieldset: 'group', - figure: 'figure', - footer: function footer(vNode) { - var sectioningElement = closest_default(vNode, sectioningElementSelector); - return !sectioningElement ? 'contentinfo' : null; - }, - form: function form(vNode) { - return hasAccessibleName(vNode) ? 'form' : null; - }, - h1: 'heading', - h2: 'heading', - h3: 'heading', - h4: 'heading', - h5: 'heading', - h6: 'heading', - header: function header(vNode) { - var sectioningElement = closest_default(vNode, sectioningElementSelector); - return !sectioningElement ? 'banner' : null; - }, - hr: 'separator', - img: function img(vNode) { - var emptyAlt = vNode.hasAttr('alt') && !vNode.attr('alt'); - var hasGlobalAria = get_global_aria_attrs_default().find(function(attr) { - return vNode.hasAttr(attr); - }); - return emptyAlt && !hasGlobalAria && !is_focusable_default(vNode) ? 'presentation' : 'img'; - }, - input: function input(vNode) { - var suggestionsSourceElement; - if (vNode.hasAttr('list')) { - var listElement = idrefs_default(vNode.actualNode, 'list').filter(function(node) { - return !!node; - })[0]; - suggestionsSourceElement = listElement && listElement.nodeName.toLowerCase() === 'datalist'; + function getElmScrollRecursive(root) { + return Array.from(root.children || root.childNodes || []).reduce(function(scrolls, elm) { + var scroll = _getScroll(elm); + if (scroll) { + scrolls.push(scroll); } - switch (vNode.props.type) { - case 'checkbox': - return 'checkbox'; - - case 'number': - return 'spinbutton'; - - case 'radio': - return 'radio'; - - case 'range': - return 'slider'; - - case 'search': - return !suggestionsSourceElement ? 'searchbox' : 'combobox'; - - case 'button': - case 'image': - case 'reset': - case 'submit': - return 'button'; - - case 'text': - case 'tel': - case 'url': - case 'email': - case '': - return !suggestionsSourceElement ? 'textbox' : 'combobox'; - - default: - return 'textbox'; + return scrolls.concat(getElmScrollRecursive(elm)); + }, []); + } + function getScrollState() { + var win = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : window; + var root = win.document.documentElement; + var windowScroll = [ win.pageXOffset !== void 0 ? { + elm: win, + top: win.pageYOffset, + left: win.pageXOffset + } : { + elm: root, + top: root.scrollTop, + left: root.scrollLeft + } ]; + return windowScroll.concat(getElmScrollRecursive(document.body)); + } + var get_scroll_state_default = getScrollState; + function _getStandards() { + return clone_default(standards_default); + } + function getStyleSheetFactory(dynamicDoc) { + if (!dynamicDoc) { + throw new Error('axe.utils.getStyleSheetFactory should be invoked with an argument'); + } + return function(options) { + var data2 = options.data, _options$isCrossOrigi = options.isCrossOrigin, isCrossOrigin = _options$isCrossOrigi === void 0 ? false : _options$isCrossOrigi, shadowId = options.shadowId, root = options.root, priority = options.priority, _options$isLink = options.isLink, isLink = _options$isLink === void 0 ? false : _options$isLink; + var style = dynamicDoc.createElement('style'); + if (isLink) { + var text = dynamicDoc.createTextNode('@import "'.concat(data2.href, '"')); + style.appendChild(text); + } else { + style.appendChild(dynamicDoc.createTextNode(data2)); } - }, - li: 'listitem', - main: 'main', - math: 'math', - menu: 'list', - nav: 'navigation', - ol: 'list', - optgroup: 'group', - option: 'option', - output: 'status', - progress: 'progressbar', - section: function section(vNode) { - return hasAccessibleName(vNode) ? 'region' : null; - }, - select: function select(vNode) { - return vNode.hasAttr('multiple') || parseInt(vNode.attr('size')) > 1 ? 'listbox' : 'combobox'; - }, - summary: 'button', - table: 'table', - tbody: 'rowgroup', - td: function td(vNode) { - var table5 = closest_default(vNode, 'table'); - var role = get_explicit_role_default(table5); - return [ 'grid', 'treegrid' ].includes(role) ? 'gridcell' : 'cell'; - }, - textarea: 'textbox', - tfoot: 'rowgroup', - th: function th(vNode) { - if (is_column_header_default(vNode.actualNode)) { - return 'columnheader'; + dynamicDoc.head.appendChild(style); + return { + sheet: style.sheet, + isCrossOrigin: isCrossOrigin, + shadowId: shadowId, + root: root, + priority: priority + }; + }; + } + var get_stylesheet_factory_default = getStyleSheetFactory; + var styleSheet; + function injectStyle(style) { + if (styleSheet && styleSheet.parentNode) { + if (styleSheet.styleSheet === void 0) { + styleSheet.appendChild(document.createTextNode(style)); + } else { + styleSheet.styleSheet.cssText += style; } - if (is_row_header_default(vNode.actualNode)) { - return 'rowheader'; + return styleSheet; + } + if (!style) { + return; + } + var head = document.head || document.getElementsByTagName('head')[0]; + styleSheet = document.createElement('style'); + styleSheet.type = 'text/css'; + if (styleSheet.styleSheet === void 0) { + styleSheet.appendChild(document.createTextNode(style)); + } else { + styleSheet.styleSheet.cssText = style; + } + head.appendChild(styleSheet); + return styleSheet; + } + var inject_style_default = injectStyle; + function isHidden(el, recursed) { + var node = get_node_from_tree_default(el); + if (el.nodeType === 9) { + return false; + } + if (el.nodeType === 11) { + el = el.host; + } + if (node && node._isHidden !== null) { + return node._isHidden; + } + var style = window.getComputedStyle(el, null); + if (!style || !el.parentNode || style.getPropertyValue('display') === 'none' || !recursed && style.getPropertyValue('visibility') === 'hidden' || el.getAttribute('aria-hidden') === 'true') { + return true; + } + var parent = el.assignedSlot ? el.assignedSlot : el.parentNode; + var hidden = isHidden(parent, true); + if (node) { + node._isHidden = hidden; + } + return hidden; + } + var is_hidden_default = isHidden; + function isHtmlElement(node) { + var _node$props$nodeName, _node$props; + var nodeName2 = (_node$props$nodeName = (_node$props = node.props) === null || _node$props === void 0 ? void 0 : _node$props.nodeName) !== null && _node$props$nodeName !== void 0 ? _node$props$nodeName : node.nodeName.toLowerCase(); + if (node.namespaceURI === 'http://www.w3.org/2000/svg') { + return false; + } + return !!standards_default.htmlElms[nodeName2]; + } + var is_html_element_default = isHtmlElement; + function _isNodeInContext(node, _ref50) { + var _ref50$include = _ref50.include, include = _ref50$include === void 0 ? [] : _ref50$include, _ref50$exclude = _ref50.exclude, exclude = _ref50$exclude === void 0 ? [] : _ref50$exclude; + var filterInclude = include.filter(function(candidate) { + return _contains(candidate, node); + }); + if (filterInclude.length === 0) { + return false; + } + var filterExcluded = exclude.filter(function(candidate) { + return _contains(candidate, node); + }); + if (filterExcluded.length === 0) { + return true; + } + var deepestInclude = getDeepest(filterInclude); + var deepestExclude = getDeepest(filterExcluded); + return _contains(deepestExclude, deepestInclude); + } + function getDeepest(collection) { + var deepest; + var _iterator6 = _createForOfIteratorHelper(collection), _step6; + try { + for (_iterator6.s(); !(_step6 = _iterator6.n()).done; ) { + var node = _step6.value; + if (!deepest || !_contains(node, deepest)) { + deepest = node; + } } - }, - thead: 'rowgroup', - tr: 'row', - ul: 'list' - }; - var implicit_html_roles_default = implicitHtmlRoles; - function fromPrimative(someString, matcher) { - var matcherType = _typeof(matcher); - if (Array.isArray(matcher) && typeof someString !== 'undefined') { - return matcher.includes(someString); + } catch (err) { + _iterator6.e(err); + } finally { + _iterator6.f(); } - if (matcherType === 'function') { - return !!matcher(someString); + return deepest; + } + function matchAncestry(ancestryA, ancestryB) { + if (ancestryA.length !== ancestryB.length) { + return false; } - if (someString !== null && someString !== void 0) { - if (matcher instanceof RegExp) { - return matcher.test(someString); + return ancestryA.every(function(selectorA, index) { + var selectorB = ancestryB[index]; + if (!Array.isArray(selectorA)) { + return selectorA === selectorB; } - if (/^\/.*\/$/.test(matcher)) { - var pattern = matcher.substring(1, matcher.length - 1); - return new RegExp(pattern).test(someString); + if (selectorA.length !== selectorB.length) { + return false; } + return selectorA.every(function(str, index2) { + return selectorB[index2] === str; + }); + }); + } + var match_ancestry_default = matchAncestry; + function nodeSorter(nodeA, nodeB) { + nodeA = nodeA.actualNode || nodeA; + nodeB = nodeB.actualNode || nodeB; + if (nodeA === nodeB) { + return 0; + } + if (nodeA.compareDocumentPosition(nodeB) & 4) { + return -1; + } else { + return 1; } - return matcher === someString; } - var from_primative_default = fromPrimative; - function hasAccessibleName2(vNode, matcher) { - return from_primative_default(!!accessible_text_virtual_default(vNode), matcher); + var node_sorter_default = nodeSorter; + function parseSameOriginStylesheet(sheet, options, priority, importedUrls) { + var isCrossOrigin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + var rules = Array.from(sheet.cssRules); + if (!rules) { + return Promise.resolve(); + } + var cssImportRules = rules.filter(function(r) { + return r.type === 3; + }); + if (!cssImportRules.length) { + return Promise.resolve({ + isCrossOrigin: isCrossOrigin, + priority: priority, + root: options.rootNode, + shadowId: options.shadowId, + sheet: sheet + }); + } + var cssImportUrlsNotAlreadyImported = cssImportRules.filter(function(rule) { + return rule.href; + }).map(function(rule) { + return rule.href; + }).filter(function(url) { + return !importedUrls.includes(url); + }); + var promises = cssImportUrlsNotAlreadyImported.map(function(importUrl, cssRuleIndex) { + var newPriority = [].concat(_toConsumableArray(priority), [ cssRuleIndex ]); + var isCrossOriginRequest = /^https?:\/\/|^\/\//i.test(importUrl); + return parse_crossorigin_stylesheet_default(importUrl, options, newPriority, importedUrls, isCrossOriginRequest); + }); + var nonImportCSSRules = rules.filter(function(r) { + return r.type !== 3; + }); + if (!nonImportCSSRules.length) { + return Promise.all(promises); + } + promises.push(Promise.resolve(options.convertDataToStylesheet({ + data: nonImportCSSRules.map(function(rule) { + return rule.cssText; + }).join(), + isCrossOrigin: isCrossOrigin, + priority: priority, + root: options.rootNode, + shadowId: options.shadowId + }))); + return Promise.all(promises); } - var has_accessible_name_default = hasAccessibleName2; - function fromFunction(getValue, matcher) { - var matcherType = _typeof(matcher); - if (matcherType !== 'object' || Array.isArray(matcher) || matcher instanceof RegExp) { - throw new Error('Expect matcher to be an object'); + var parse_sameorigin_stylesheet_default = parseSameOriginStylesheet; + function parseStylesheet(sheet, options, priority, importedUrls) { + var isCrossOrigin = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + var isSameOrigin = isSameOriginStylesheet(sheet); + if (isSameOrigin) { + return parse_sameorigin_stylesheet_default(sheet, options, priority, importedUrls, isCrossOrigin); } - return Object.keys(matcher).every(function(propName) { - return from_primative_default(getValue(propName), matcher[propName]); + return parse_crossorigin_stylesheet_default(sheet.href, options, priority, importedUrls, true); + } + function isSameOriginStylesheet(sheet) { + try { + var rules = sheet.cssRules; + if (!rules && sheet.href) { + return false; + } + return true; + } catch (e) { + return false; + } + } + var parse_stylesheet_default = parseStylesheet; + function parseCrossOriginStylesheet(url, options, priority, importedUrls, isCrossOrigin) { + importedUrls.push(url); + return new Promise(function(resolve, reject) { + var request = new window.XMLHttpRequest(); + request.open('GET', url); + request.timeout = constants_default.preload.timeout; + request.addEventListener('error', reject); + request.addEventListener('timeout', reject); + request.addEventListener('loadend', function(event) { + if (event.loaded && request.responseText) { + return resolve(request.responseText); + } + reject(request.responseText); + }); + request.send(); + }).then(function(data2) { + var result = options.convertDataToStylesheet({ + data: data2, + isCrossOrigin: isCrossOrigin, + priority: priority, + root: options.rootNode, + shadowId: options.shadowId + }); + return parse_stylesheet_default(result.sheet, options, priority, importedUrls, result.isCrossOrigin); }); } - var from_function_default = fromFunction; - function attributes(vNode, matcher) { - if (!(vNode instanceof abstract_virtual_node_default)) { - vNode = get_node_from_tree_default(vNode); + var parse_crossorigin_stylesheet_default = parseCrossOriginStylesheet; + var performanceTimer = function() { + function now() { + if (window.performance && window.performance) { + return window.performance.now(); + } } - return from_function_default(function(attrName) { - return vNode.attr(attrName); - }, matcher); - } - var attributes_default = attributes; - function condition(arg, condition4) { - return !!condition4(arg); + var originalTime = null; + var lastRecordedTime = now(); + return { + start: function start() { + this.mark('mark_axe_start'); + }, + end: function end() { + this.mark('mark_axe_end'); + this.measure('axe', 'mark_axe_start', 'mark_axe_end'); + this.logMeasures('axe'); + }, + auditStart: function auditStart() { + this.mark('mark_audit_start'); + }, + auditEnd: function auditEnd() { + this.mark('mark_audit_end'); + this.measure('audit_start_to_end', 'mark_audit_start', 'mark_audit_end'); + this.logMeasures(); + }, + mark: function mark(markName) { + if (window.performance && window.performance.mark !== void 0) { + window.performance.mark(markName); + } + }, + measure: function measure(measureName, startMark, endMark) { + if (window.performance && window.performance.measure !== void 0) { + window.performance.measure(measureName, startMark, endMark); + } + }, + logMeasures: function logMeasures(measureName) { + function logMeasure(req2) { + log_default('Measure ' + req2.name + ' took ' + req2.duration + 'ms'); + } + if (window.performance && window.performance.getEntriesByType !== void 0) { + var axeStart = window.performance.getEntriesByName('mark_axe_start')[0]; + var measures = window.performance.getEntriesByType('measure').filter(function(measure) { + return measure.startTime >= axeStart.startTime; + }); + for (var i = 0; i < measures.length; ++i) { + var req = measures[i]; + if (req.name === measureName) { + logMeasure(req); + return; + } + logMeasure(req); + } + } + }, + timeElapsed: function timeElapsed() { + return now() - lastRecordedTime; + }, + reset: function reset() { + if (!originalTime) { + originalTime = now(); + } + lastRecordedTime = now(); + } + }; + }(); + var performance_timer_default = performanceTimer; + if (typeof Object.assign !== 'function') { + (function() { + Object.assign = function(target) { + if (target === void 0 || target === null) { + throw new TypeError('Cannot convert undefined or null to object'); + } + var output = Object(target); + for (var index = 1; index < arguments.length; index++) { + var source = arguments[index]; + if (source !== void 0 && source !== null) { + for (var nextKey in source) { + if (source.hasOwnProperty(nextKey)) { + output[nextKey] = source[nextKey]; + } + } + } + } + return output; + }; + })(); } - var condition_default = condition; - function explicitRole(vNode, matcher) { - return from_primative_default(get_explicit_role_default(vNode), matcher); + if (!Array.prototype.find) { + Object.defineProperty(Array.prototype, 'find', { + value: function value(predicate) { + if (this === null) { + throw new TypeError('Array.prototype.find called on null or undefined'); + } + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + var list = Object(this); + var length = list.length >>> 0; + var thisArg = arguments[1]; + var value; + for (var i = 0; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) { + return value; + } + } + return void 0; + } + }); } - var explicit_role_default = explicitRole; - function implicitRole(vNode, matcher) { - return from_primative_default(implicit_role_default(vNode), matcher); + if (!Array.prototype.findIndex) { + Object.defineProperty(Array.prototype, 'findIndex', { + value: function value(predicate, thisArg) { + if (this === null) { + throw new TypeError('Array.prototype.find called on null or undefined'); + } + if (typeof predicate !== 'function') { + throw new TypeError('predicate must be a function'); + } + var list = Object(this); + var length = list.length >>> 0; + var value; + for (var i = 0; i < length; i++) { + value = list[i]; + if (predicate.call(thisArg, value, i, list)) { + return i; + } + } + return -1; + } + }); } - var implicit_role_default2 = implicitRole; - function nodeName(vNode, matcher) { - if (!(vNode instanceof abstract_virtual_node_default)) { - vNode = get_node_from_tree_default(vNode); + function _pollyfillElementsFromPoint() { + if (document.elementsFromPoint) { + return document.elementsFromPoint; } - return from_primative_default(vNode.props.nodeName, matcher); - } - var node_name_default = nodeName; - function properties(vNode, matcher) { - if (!(vNode instanceof abstract_virtual_node_default)) { - vNode = get_node_from_tree_default(vNode); + if (document.msElementsFromPoint) { + return document.msElementsFromPoint; } - return from_function_default(function(propName) { - return vNode.props[propName]; - }, matcher); + var usePointer = function() { + var element = document.createElement('x'); + element.style.cssText = 'pointer-events:auto'; + return element.style.pointerEvents === 'auto'; + }(); + var cssProp = usePointer ? 'pointer-events' : 'visibility'; + var cssDisableVal = usePointer ? 'none' : 'hidden'; + var style = document.createElement('style'); + style.innerHTML = usePointer ? '* { pointer-events: all }' : '* { visibility: visible }'; + return function(x, y) { + var current, i, d; + var elements = []; + var previousPointerEvents = []; + document.head.appendChild(style); + while ((current = document.elementFromPoint(x, y)) && elements.indexOf(current) === -1) { + elements.push(current); + previousPointerEvents.push({ + value: current.style.getPropertyValue(cssProp), + priority: current.style.getPropertyPriority(cssProp) + }); + current.style.setProperty(cssProp, cssDisableVal, 'important'); + } + if (elements.indexOf(document.documentElement) < elements.length - 1) { + elements.splice(elements.indexOf(document.documentElement), 1); + elements.push(document.documentElement); + } + for (i = previousPointerEvents.length; !!(d = previousPointerEvents[--i]); ) { + elements[i].style.setProperty(cssProp, d.value ? d.value : '', d.priority); + } + document.head.removeChild(style); + return elements; + }; } - var properties_default = properties; - function semanticRole(vNode, matcher) { - return from_primative_default(get_role_default(vNode), matcher); + if (typeof window.addEventListener === 'function') { + document.elementsFromPoint = _pollyfillElementsFromPoint(); } - var semantic_role_default = semanticRole; - var matchers = { - hasAccessibleName: has_accessible_name_default, - attributes: attributes_default, - condition: condition_default, - explicitRole: explicit_role_default, - implicitRole: implicit_role_default2, - nodeName: node_name_default, - properties: properties_default, - semanticRole: semantic_role_default - }; - function fromDefinition(vNode, definition) { - if (!(vNode instanceof abstract_virtual_node_default)) { - vNode = get_node_from_tree_default(vNode); - } - if (Array.isArray(definition)) { - return definition.some(function(definitionItem) { - return fromDefinition(vNode, definitionItem); - }); - } - if (typeof definition === 'string') { - return matches_default(vNode, definition); - } - return Object.keys(definition).every(function(matcherName) { - if (!matchers[matcherName]) { - throw new Error('Unknown matcher type "'.concat(matcherName, '"')); + if (!Array.prototype.includes) { + Object.defineProperty(Array.prototype, 'includes', { + value: function value(searchElement) { + var O = Object(this); + var len = parseInt(O.length, 10) || 0; + if (len === 0) { + return false; + } + var n = parseInt(arguments[1], 10) || 0; + var k; + if (n >= 0) { + k = n; + } else { + k = len + n; + if (k < 0) { + k = 0; + } + } + var currentElement; + while (k < len) { + currentElement = O[k]; + if (searchElement === currentElement || searchElement !== searchElement && currentElement !== currentElement) { + return true; + } + k++; + } + return false; } - var matchMethod = matchers[matcherName]; - var matcher = definition[matcherName]; - return matchMethod(vNode, matcher); }); } - var from_definition_default = fromDefinition; - function matches5(vNode, definition) { - return from_definition_default(vNode, definition); - } - var matches_default2 = matches5; - matches_default2.hasAccessibleName = has_accessible_name_default; - matches_default2.attributes = attributes_default; - matches_default2.condition = condition_default; - matches_default2.explicitRole = explicit_role_default; - matches_default2.fromDefinition = from_definition_default; - matches_default2.fromFunction = from_function_default; - matches_default2.fromPrimative = from_primative_default; - matches_default2.implicitRole = implicit_role_default2; - matches_default2.nodeName = node_name_default; - matches_default2.properties = properties_default; - matches_default2.semanticRole = semantic_role_default; - var matches_default3 = matches_default2; - function getElementSpec(vNode) { - var _ref34 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref34$noMatchAccessi = _ref34.noMatchAccessibleName, noMatchAccessibleName = _ref34$noMatchAccessi === void 0 ? false : _ref34$noMatchAccessi; - var standard = standards_default.htmlElms[vNode.props.nodeName]; - if (!standard) { - return {}; - } - if (!standard.variant) { - return standard; - } - var variant = standard.variant, spec = _objectWithoutProperties(standard, _excluded3); - for (var variantName in variant) { - if (!variant.hasOwnProperty(variantName) || variantName === 'default') { - continue; - } - var _variant$variantName = variant[variantName], matches14 = _variant$variantName.matches, props = _objectWithoutProperties(_variant$variantName, _excluded4); - var matchProperties = Array.isArray(matches14) ? matches14 : [ matches14 ]; - for (var _i12 = 0; _i12 < matchProperties.length && noMatchAccessibleName; _i12++) { - if (matchProperties[_i12].hasOwnProperty('hasAccessibleName')) { - return standard; + if (!Array.prototype.some) { + Object.defineProperty(Array.prototype, 'some', { + value: function value(fun) { + if (this == null) { + throw new TypeError('Array.prototype.some called on null or undefined'); } - } - if (matches_default3(vNode, matches14)) { - for (var propName in props) { - if (props.hasOwnProperty(propName)) { - spec[propName] = props[propName]; + if (typeof fun !== 'function') { + throw new TypeError(); + } + var t = Object(this); + var len = t.length >>> 0; + var thisArg = arguments.length >= 2 ? arguments[1] : void 0; + for (var i = 0; i < len; i++) { + if (i in t && fun.call(thisArg, t[i], i, t)) { + return true; } } + return false; } - } - for (var _propName in variant['default']) { - if (variant['default'].hasOwnProperty(_propName) && typeof spec[_propName] === 'undefined') { - spec[_propName] = variant['default'][_propName]; - } - } - return spec; - } - var get_element_spec_default = getElementSpec; - function implicitRole2(node) { - var _ref35 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, chromium = _ref35.chromium; - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - node = vNode.actualNode; - if (!vNode) { - throw new ReferenceError('Cannot get implicit role of a node outside the current scope.'); - } - var nodeName2 = vNode.props.nodeName; - var role = implicit_html_roles_default[nodeName2]; - if (!role && chromium) { - var _get_element_spec_def = get_element_spec_default(vNode), chromiumRole = _get_element_spec_def.chromiumRole; - return chromiumRole || null; - } - if (typeof role === 'function') { - return role(vNode); - } - return role || null; - } - var implicit_role_default = implicitRole2; - var inheritsPresentationChain = { - td: [ 'tr' ], - th: [ 'tr' ], - tr: [ 'thead', 'tbody', 'tfoot', 'table' ], - thead: [ 'table' ], - tbody: [ 'table' ], - tfoot: [ 'table' ], - li: [ 'ol', 'ul' ], - dt: [ 'dl', 'div' ], - dd: [ 'dl', 'div' ], - div: [ 'dl' ] - }; - function getInheritedRole(vNode, explicitRoleOptions) { - var parentNodeNames = inheritsPresentationChain[vNode.props.nodeName]; - if (!parentNodeNames) { - return null; - } - if (!vNode.parent) { - throw new ReferenceError('Cannot determine role presentational inheritance of a required parent outside the current scope.'); - } - if (!parentNodeNames.includes(vNode.parent.props.nodeName)) { - return null; - } - var parentRole = get_explicit_role_default(vNode.parent, explicitRoleOptions); - if ([ 'none', 'presentation' ].includes(parentRole) && !hasConflictResolution(vNode.parent)) { - return parentRole; - } - if (parentRole) { - return null; - } - return getInheritedRole(vNode.parent, explicitRoleOptions); - } - function resolveImplicitRole(vNode, _ref36) { - var chromium = _ref36.chromium, explicitRoleOptions = _objectWithoutProperties(_ref36, _excluded5); - var implicitRole3 = implicit_role_default(vNode, { - chromium: chromium }); - if (!implicitRole3) { - return null; - } - var presentationalRole = getInheritedRole(vNode, explicitRoleOptions); - if (presentationalRole) { - return presentationalRole; - } - return implicitRole3; } - function hasConflictResolution(vNode) { - var hasGlobalAria = get_global_aria_attrs_default().some(function(attr) { - return vNode.hasAttr(attr); + if (!Array.from) { + Object.defineProperty(Array, 'from', { + value: function() { + var toStr = Object.prototype.toString; + var isCallable = function isCallable(fn) { + return typeof fn === 'function' || toStr.call(fn) === '[object Function]'; + }; + var toInteger = function toInteger(value) { + var number = Number(value); + if (isNaN(number)) { + return 0; + } + if (number === 0 || !isFinite(number)) { + return number; + } + return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number)); + }; + var maxSafeInteger = Math.pow(2, 53) - 1; + var toLength = function toLength(value) { + var len = toInteger(value); + return Math.min(Math.max(len, 0), maxSafeInteger); + }; + return function from(arrayLike) { + var C = this; + var items = Object(arrayLike); + if (arrayLike == null) { + throw new TypeError('Array.from requires an array-like object - not null or undefined'); + } + var mapFn = arguments.length > 1 ? arguments[1] : void 0; + var T; + if (typeof mapFn !== 'undefined') { + if (!isCallable(mapFn)) { + throw new TypeError('Array.from: when provided, the second argument must be a function'); + } + if (arguments.length > 2) { + T = arguments[2]; + } + } + var len = toLength(items.length); + var A = isCallable(C) ? Object(new C(len)) : new Array(len); + var k = 0; + var kValue; + while (k < len) { + kValue = items[k]; + if (mapFn) { + A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k); + } else { + A[k] = kValue; + } + k += 1; + } + A.length = len; + return A; + }; + }() }); - return hasGlobalAria || is_focusable_default(vNode); } - function resolveRole(node) { - var _ref37 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var noImplicit = _ref37.noImplicit, roleOptions = _objectWithoutProperties(_ref37, _excluded6); - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (vNode.props.nodeType !== 1) { - return null; - } - var explicitRole2 = get_explicit_role_default(vNode, roleOptions); - if (!explicitRole2) { - return noImplicit ? null : resolveImplicitRole(vNode, roleOptions); - } - if (![ 'presentation', 'none' ].includes(explicitRole2)) { - return explicitRole2; - } - if (hasConflictResolution(vNode)) { - return noImplicit ? null : resolveImplicitRole(vNode, roleOptions); - } - return explicitRole2; - } - function getRole(node) { - var _ref38 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var noPresentational = _ref38.noPresentational, options = _objectWithoutProperties(_ref38, _excluded7); - var role = resolveRole(node, options); - if (noPresentational && [ 'presentation', 'none' ].includes(role)) { - return null; - } - return role; - } - var get_role_default = getRole; - var alwaysTitleElements = [ 'iframe' ]; - function titleText(node) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (vNode.props.nodeType !== 1 || !node.hasAttr('title')) { - return ''; - } - if (!matches_default2(vNode, alwaysTitleElements) && [ 'none', 'presentation' ].includes(get_role_default(vNode))) { - return ''; - } - return vNode.attr('title'); + if (!String.prototype.includes) { + String.prototype.includes = function(search, start) { + if (typeof start !== 'number') { + start = 0; + } + if (start + search.length > this.length) { + return false; + } else { + return this.indexOf(search, start) !== -1; + } + }; } - var title_text_default = titleText; - function namedFromContents(vNode) { - var _ref39 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, strict = _ref39.strict; - vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); - if (vNode.props.nodeType !== 1) { - return false; - } - var role = get_role_default(vNode); - var roleDef = standards_default.ariaRoles[role]; - if (roleDef && roleDef.nameFromContent) { - return true; - } - if (strict) { - return false; - } - return !roleDef || [ 'presentation', 'none' ].includes(role); + if (!Array.prototype.flat) { + Object.defineProperty(Array.prototype, 'flat', { + configurable: true, + value: function flat() { + var depth = isNaN(arguments[0]) ? 1 : Number(arguments[0]); + return depth ? Array.prototype.reduce.call(this, function(acc, cur) { + if (Array.isArray(cur)) { + acc.push.apply(acc, flat.call(cur, depth - 1)); + } else { + acc.push(cur); + } + return acc; + }, []) : Array.prototype.slice.call(this); + }, + writable: true + }); } - var named_from_contents_default = namedFromContents; - function getOwnedVirtual(virtualNode) { - var actualNode = virtualNode.actualNode, children = virtualNode.children; - if (!children) { - throw new Error('getOwnedVirtual requires a virtual node'); - } - if (virtualNode.hasAttr('aria-owns')) { - var owns = idrefs_default(actualNode, 'aria-owns').filter(function(element) { - return !!element; - }).map(function(element) { - return axe.utils.getNodeFromTree(element); - }); - return [].concat(_toConsumableArray(children), _toConsumableArray(owns)); - } - return _toConsumableArray(children); + if (window.Node && !('isConnected' in window.Node.prototype)) { + Object.defineProperty(window.Node.prototype, 'isConnected', { + get: function get() { + return !this.ownerDocument || !(this.ownerDocument.compareDocumentPosition(this) & this.DOCUMENT_POSITION_DISCONNECTED); + } + }); } - var get_owned_virtual_default = getOwnedVirtual; - function subtreeText(virtualNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var alreadyProcessed2 = accessible_text_virtual_default.alreadyProcessed; - context5.startNode = context5.startNode || virtualNode; - var _context = context5, strict = _context.strict, inControlContext = _context.inControlContext, inLabelledByContext = _context.inLabelledByContext; - var _get_element_spec_def2 = get_element_spec_default(virtualNode, { - noMatchAccessibleName: true - }), contentTypes = _get_element_spec_def2.contentTypes; - if (alreadyProcessed2(virtualNode, context5) || virtualNode.props.nodeType !== 1 || contentTypes !== null && contentTypes !== void 0 && contentTypes.includes('embedded')) { - return ''; - } - if (!named_from_contents_default(virtualNode, { - strict: strict - }) && !context5.subtreeDescendant) { - return ''; - } - if (!strict) { - var subtreeDescendant = !inControlContext && !inLabelledByContext; - context5 = _extends({ - subtreeDescendant: subtreeDescendant - }, context5); - } - return get_owned_virtual_default(virtualNode).reduce(function(contentText, child) { - return appendAccessibleText(contentText, child, context5); - }, ''); + function uniqueArray(arr1, arr2) { + return arr1.concat(arr2).filter(function(elem, pos, arr) { + return arr.indexOf(elem) === pos; + }); } - var phrasingElements = get_elements_by_content_type_default('phrasing').concat([ '#text' ]); - function appendAccessibleText(contentText, virtualNode, context5) { - var nodeName2 = virtualNode.props.nodeName; - var contentTextAdd = accessible_text_virtual_default(virtualNode, context5); - if (!contentTextAdd) { - return contentText; - } - if (!phrasingElements.includes(nodeName2)) { - if (contentTextAdd[0] !== ' ') { - contentTextAdd += ' '; + var unique_array_default = uniqueArray; + function createLocalVariables(vNodes, anyLevel, thisLevel, parentShadowId, recycledLocalVariable) { + var retVal = recycledLocalVariable || {}; + retVal.vNodes = vNodes; + retVal.vNodesIndex = 0; + retVal.anyLevel = anyLevel; + retVal.thisLevel = thisLevel; + retVal.parentShadowId = parentShadowId; + return retVal; + } + var recycledLocalVariables = []; + function matchExpressions(domTree, expressions, filter) { + var stack = []; + var vNodes = Array.isArray(domTree) ? domTree : [ domTree ]; + var currentLevel = createLocalVariables(vNodes, expressions, null, domTree[0].shadowId, recycledLocalVariables.pop()); + var result = []; + while (currentLevel.vNodesIndex < currentLevel.vNodes.length) { + var _currentLevel$anyLeve, _currentLevel$thisLev; + var vNode = currentLevel.vNodes[currentLevel.vNodesIndex++]; + var childOnly = null; + var childAny = null; + var combinedLength = (((_currentLevel$anyLeve = currentLevel.anyLevel) === null || _currentLevel$anyLeve === void 0 ? void 0 : _currentLevel$anyLeve.length) || 0) + (((_currentLevel$thisLev = currentLevel.thisLevel) === null || _currentLevel$thisLev === void 0 ? void 0 : _currentLevel$thisLev.length) || 0); + var added = false; + for (var _i14 = 0; _i14 < combinedLength; _i14++) { + var _currentLevel$anyLeve2, _currentLevel$anyLeve3, _currentLevel$anyLeve4; + var exp = _i14 < (((_currentLevel$anyLeve2 = currentLevel.anyLevel) === null || _currentLevel$anyLeve2 === void 0 ? void 0 : _currentLevel$anyLeve2.length) || 0) ? currentLevel.anyLevel[_i14] : currentLevel.thisLevel[_i14 - (((_currentLevel$anyLeve3 = currentLevel.anyLevel) === null || _currentLevel$anyLeve3 === void 0 ? void 0 : _currentLevel$anyLeve3.length) || 0)]; + if ((!exp[0].id || vNode.shadowId === currentLevel.parentShadowId) && _matchesExpression(vNode, exp[0])) { + if (exp.length === 1) { + if (!added && (!filter || filter(vNode))) { + result.push(vNode); + added = true; + } + } else { + var rest = exp.slice(1); + if ([ ' ', '>' ].includes(rest[0].combinator) === false) { + throw new Error('axe.utils.querySelectorAll does not support the combinator: ' + exp[1].combinator); + } + if (rest[0].combinator === '>') { + (childOnly = childOnly || []).push(rest); + } else { + (childAny = childAny || []).push(rest); + } + } + } + if ((!exp[0].id || vNode.shadowId === currentLevel.parentShadowId) && (_currentLevel$anyLeve4 = currentLevel.anyLevel) !== null && _currentLevel$anyLeve4 !== void 0 && _currentLevel$anyLeve4.includes(exp)) { + (childAny = childAny || []).push(exp); + } } - if (contentText && contentText[contentText.length - 1] !== ' ') { - contentTextAdd = ' ' + contentTextAdd; + if (vNode.children && vNode.children.length) { + stack.push(currentLevel); + currentLevel = createLocalVariables(vNode.children, childAny, childOnly, vNode.shadowId, recycledLocalVariables.pop()); + } + while (currentLevel.vNodesIndex === currentLevel.vNodes.length && stack.length) { + recycledLocalVariables.push(currentLevel); + currentLevel = stack.pop(); } } - return contentText + contentTextAdd; + return result; } - var subtree_text_default = subtreeText; - function labelText(virtualNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var alreadyProcessed2 = accessible_text_virtual_default.alreadyProcessed; - if (context5.inControlContext || context5.inLabelledByContext || alreadyProcessed2(virtualNode, context5)) { - return ''; - } - if (!context5.startNode) { - context5.startNode = virtualNode; - } - var labelContext = _extends({ - inControlContext: true - }, context5); - var explicitLabels = getExplicitLabels(virtualNode); - var implicitLabel = closest_default(virtualNode, 'label'); - var labels; - if (implicitLabel) { - labels = [].concat(_toConsumableArray(explicitLabels), [ implicitLabel.actualNode ]); - labels.sort(node_sorter_default); - } else { - labels = explicitLabels; + function querySelectorAllFilter(domTree, selector, filter) { + domTree = Array.isArray(domTree) ? domTree : [ domTree ]; + var expressions = _convertSelector(selector); + var nodes = getNodesMatchingExpression(domTree, expressions, filter); + if (nodes) { + return nodes; } - return labels.map(function(label5) { - return accessible_text_default(label5, labelContext); - }).filter(function(text32) { - return text32 !== ''; - }).join(' '); + return matchExpressions(domTree, expressions, filter); } - function getExplicitLabels(virtualNode) { - if (!virtualNode.attr('id')) { - return []; - } - if (!virtualNode.actualNode) { - throw new TypeError('Cannot resolve explicit label reference for non-DOM nodes'); + var query_selector_all_filter_default = querySelectorAllFilter; + function preloadCssom(_ref51) { + var _ref51$treeRoot = _ref51.treeRoot, treeRoot = _ref51$treeRoot === void 0 ? axe._tree[0] : _ref51$treeRoot; + var rootNodes = getAllRootNodesInTree(treeRoot); + if (!rootNodes.length) { + return Promise.resolve(); } - return find_elms_in_context_default({ - elm: 'label', - attr: 'for', - value: virtualNode.attr('id'), - context: virtualNode.actualNode + var dynamicDoc = document.implementation.createHTMLDocument('Dynamic document for loading cssom'); + var convertDataToStylesheet = get_stylesheet_factory_default(dynamicDoc); + return getCssomForAllRootNodes(rootNodes, convertDataToStylesheet).then(function(assets) { + return flattenAssets(assets); }); } - var label_text_default = labelText; - var defaultButtonValues = { - submit: 'Submit', - image: 'Submit', - reset: 'Reset', - button: '' - }; - var nativeTextMethods = { - valueText: function valueText(_ref40) { - var actualNode = _ref40.actualNode; - return actualNode.value || ''; - }, - buttonDefaultText: function buttonDefaultText(_ref41) { - var actualNode = _ref41.actualNode; - return defaultButtonValues[actualNode.type] || ''; - }, - tableCaptionText: descendantText.bind(null, 'caption'), - figureText: descendantText.bind(null, 'figcaption'), - svgTitleText: descendantText.bind(null, 'title'), - fieldsetLegendText: descendantText.bind(null, 'legend'), - altText: attrText.bind(null, 'alt'), - tableSummaryText: attrText.bind(null, 'summary'), - titleText: title_text_default, - subtreeText: subtree_text_default, - labelText: label_text_default, - singleSpace: function singleSpace() { - return ' '; - }, - placeholderText: attrText.bind(null, 'placeholder') - }; - function attrText(attr, vNode) { - return vNode.attr(attr) || ''; + var preload_cssom_default = preloadCssom; + function getAllRootNodesInTree(tree) { + var ids = []; + var rootNodes = query_selector_all_filter_default(tree, '*', function(node) { + if (ids.includes(node.shadowId)) { + return false; + } + ids.push(node.shadowId); + return true; + }).map(function(node) { + return { + shadowId: node.shadowId, + rootNode: get_root_node_default(node.actualNode) + }; + }); + return unique_array_default(rootNodes, []); } - function descendantText(nodeName2, _ref42, context5) { - var actualNode = _ref42.actualNode; - nodeName2 = nodeName2.toLowerCase(); - var nodeNames2 = [ nodeName2, actualNode.nodeName.toLowerCase() ].join(','); - var candidate = actualNode.querySelector(nodeNames2); - if (!candidate || candidate.nodeName.toLowerCase() !== nodeName2) { - return ''; - } - return accessible_text_default(candidate, context5); + function getCssomForAllRootNodes(rootNodes, convertDataToStylesheet) { + var promises = []; + rootNodes.forEach(function(_ref52, index) { + var rootNode = _ref52.rootNode, shadowId = _ref52.shadowId; + var sheets = getStylesheetsOfRootNode(rootNode, shadowId, convertDataToStylesheet); + if (!sheets) { + return Promise.all(promises); + } + var rootIndex = index + 1; + var parseOptions = { + rootNode: rootNode, + shadowId: shadowId, + convertDataToStylesheet: convertDataToStylesheet, + rootIndex: rootIndex + }; + var importedUrls = []; + var p = Promise.all(sheets.map(function(sheet, sheetIndex) { + var priority = [ rootIndex, sheetIndex ]; + return parse_stylesheet_default(sheet, parseOptions, priority, importedUrls); + })); + promises.push(p); + }); + return Promise.all(promises); } - var native_text_methods_default = nativeTextMethods; - function nativeTextAlternative(virtualNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var actualNode = virtualNode.actualNode; - if (virtualNode.props.nodeType !== 1 || [ 'presentation', 'none' ].includes(get_role_default(virtualNode))) { - return ''; - } - var textMethods = findTextMethods(virtualNode); - var accName = textMethods.reduce(function(accName2, step) { - return accName2 || step(virtualNode, context5); - }, ''); - if (context5.debug) { - axe.log(accName || '{empty-value}', actualNode, context5); + function flattenAssets(assets) { + return assets.reduce(function(acc, val) { + return Array.isArray(val) ? acc.concat(flattenAssets(val)) : acc.concat(val); + }, []); + } + function getStylesheetsOfRootNode(rootNode, shadowId, convertDataToStylesheet) { + var sheets; + if (rootNode.nodeType === 11 && shadowId) { + sheets = getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet); + } else { + sheets = getStylesheetsFromDocument(rootNode); } - return accName; + return filterStylesheetsWithSameHref(sheets); + } + function getStylesheetsFromDocumentFragment(rootNode, convertDataToStylesheet) { + return Array.from(rootNode.children).filter(filerStyleAndLinkAttributesInDocumentFragment).reduce(function(out, node) { + var nodeName2 = node.nodeName.toUpperCase(); + var data2 = nodeName2 === 'STYLE' ? node.textContent : node; + var isLink = nodeName2 === 'LINK'; + var stylesheet = convertDataToStylesheet({ + data: data2, + isLink: isLink, + root: rootNode + }); + out.push(stylesheet.sheet); + return out; + }, []); } - function findTextMethods(virtualNode) { - var elmSpec = get_element_spec_default(virtualNode, { - noMatchAccessibleName: true - }); - var methods = elmSpec.namingMethods || []; - return methods.map(function(methodName) { - return native_text_methods_default[methodName]; + function getStylesheetsFromDocument(rootNode) { + return Array.from(rootNode.styleSheets).filter(function(sheet) { + if (!sheet.media) { + return false; + } + return filterMediaIsPrint(sheet.media.mediaText); }); } - var native_text_alternative_default = nativeTextAlternative; - var unsupported = { - accessibleNameFromFieldValue: [ 'combobox', 'listbox', 'progressbar' ] - }; - var unsupported_default = unsupported; - var nonTextInputTypes = [ 'button', 'checkbox', 'color', 'file', 'hidden', 'image', 'password', 'radio', 'reset', 'submit' ]; - function isNativeTextbox(node) { - node = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - var nodeName2 = node.props.nodeName; - return nodeName2 === 'textarea' || nodeName2 === 'input' && !nonTextInputTypes.includes((node.attr('type') || '').toLowerCase()); + function filerStyleAndLinkAttributesInDocumentFragment(node) { + var nodeName2 = node.nodeName.toUpperCase(); + var linkHref = node.getAttribute('href'); + var linkRel = node.getAttribute('rel'); + var isLink = nodeName2 === 'LINK' && linkHref && linkRel && node.rel.toUpperCase().includes('STYLESHEET'); + var isStyle = nodeName2 === 'STYLE'; + return isStyle || isLink && filterMediaIsPrint(node.media); } - var is_native_textbox_default = isNativeTextbox; - function isNativeSelect(node) { - node = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - var nodeName2 = node.props.nodeName; - return nodeName2 === 'select'; + function filterMediaIsPrint(media) { + if (!media) { + return true; + } + return !media.toUpperCase().includes('PRINT'); } - var is_native_select_default = isNativeSelect; - function isAriaTextbox(node) { - var role = get_explicit_role_default(node); - return role === 'textbox'; + function filterStylesheetsWithSameHref(sheets) { + var hrefs = []; + return sheets.filter(function(sheet) { + if (!sheet.href) { + return true; + } + if (hrefs.includes(sheet.href)) { + return false; + } + hrefs.push(sheet.href); + return true; + }); } - var is_aria_textbox_default = isAriaTextbox; - function isAriaListbox(node) { - var role = get_explicit_role_default(node); - return role === 'listbox'; + function preloadMedia(_ref53) { + var _ref53$treeRoot = _ref53.treeRoot, treeRoot = _ref53$treeRoot === void 0 ? axe._tree[0] : _ref53$treeRoot; + var mediaVirtualNodes = query_selector_all_filter_default(treeRoot, 'video, audio', function(_ref54) { + var actualNode = _ref54.actualNode; + if (actualNode.hasAttribute('src')) { + return !!actualNode.getAttribute('src'); + } + var sourceWithSrc = Array.from(actualNode.getElementsByTagName('source')).filter(function(source) { + return !!source.getAttribute('src'); + }); + if (sourceWithSrc.length <= 0) { + return false; + } + return true; + }); + return Promise.all(mediaVirtualNodes.map(function(_ref55) { + var actualNode = _ref55.actualNode; + return isMediaElementReady(actualNode); + })); } - var is_aria_listbox_default = isAriaListbox; - function isAriaCombobox(node) { - var role = get_explicit_role_default(node); - return role === 'combobox'; + var preload_media_default = preloadMedia; + function isMediaElementReady(elm) { + return new Promise(function(resolve) { + if (elm.readyState > 0) { + resolve(elm); + } + function onMediaReady() { + elm.removeEventListener('loadedmetadata', onMediaReady); + resolve(elm); + } + elm.addEventListener('loadedmetadata', onMediaReady); + }); } - var is_aria_combobox_default = isAriaCombobox; - var rangeRoles = [ 'progressbar', 'scrollbar', 'slider', 'spinbutton' ]; - function isAriaRange(node) { - var role = get_explicit_role_default(node); - return rangeRoles.includes(role); + function isValidPreloadObject(preload2) { + return _typeof(preload2) === 'object' && Array.isArray(preload2.assets); } - var is_aria_range_default = isAriaRange; - var controlValueRoles = [ 'textbox', 'progressbar', 'scrollbar', 'slider', 'spinbutton', 'combobox', 'listbox' ]; - var _formControlValueMethods = { - nativeTextboxValue: nativeTextboxValue, - nativeSelectValue: nativeSelectValue, - ariaTextboxValue: ariaTextboxValue, - ariaListboxValue: ariaListboxValue, - ariaComboboxValue: ariaComboboxValue, - ariaRangeValue: ariaRangeValue - }; - function formControlValue(virtualNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var actualNode = virtualNode.actualNode; - var unsupportedRoles = unsupported_default.accessibleNameFromFieldValue || []; - var role = get_role_default(virtualNode); - if (context5.startNode === virtualNode || !controlValueRoles.includes(role) || unsupportedRoles.includes(role)) { - return ''; + function _shouldPreload(options) { + if (!options || options.preload === void 0 || options.preload === null) { + return true; } - var valueMethods = Object.keys(_formControlValueMethods).map(function(name) { - return _formControlValueMethods[name]; - }); - var valueString = valueMethods.reduce(function(accName, step) { - return accName || step(virtualNode, context5); - }, ''); - if (context5.debug) { - log_default(valueString || '{empty-value}', actualNode, context5); + if (typeof options.preload === 'boolean') { + return options.preload; } - return valueString; + return isValidPreloadObject(options.preload); } - function nativeTextboxValue(node) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (is_native_textbox_default(vNode)) { - return vNode.props.value || ''; + function _getPreloadConfig(options) { + var _constants_default$pr = constants_default.preload, assets = _constants_default$pr.assets, timeout = _constants_default$pr.timeout; + var config = { + assets: assets, + timeout: timeout + }; + if (!options.preload) { + return config; } - return ''; - } - function nativeSelectValue(node) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (!is_native_select_default(vNode)) { - return ''; + if (typeof options.preload === 'boolean') { + return config; } - var options = query_selector_all_default(vNode, 'option'); - var selectedOptions = options.filter(function(option) { - return option.props.selected; + var areRequestedAssetsValid = options.preload.assets.every(function(a) { + return assets.includes(a.toLowerCase()); }); - if (!selectedOptions.length) { - selectedOptions.push(options[0]); + if (!areRequestedAssetsValid) { + throw new Error('Requested assets, not supported. Supported assets are: '.concat(assets.join(', '), '.')); } - return selectedOptions.map(function(option) { - return visible_virtual_default(option); - }).join(' ') || ''; + config.assets = unique_array_default(options.preload.assets.map(function(a) { + return a.toLowerCase(); + }), []); + if (options.preload.timeout && typeof options.preload.timeout === 'number' && !isNaN(options.preload.timeout)) { + config.timeout = options.preload.timeout; + } + return config; } - function ariaTextboxValue(node) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - var actualNode = vNode.actualNode; - if (!is_aria_textbox_default(vNode)) { - return ''; + function preload(options) { + var preloadFunctionsMap = { + cssom: preload_cssom_default, + media: preload_media_default + }; + if (!_shouldPreload(options)) { + return Promise.resolve(); } - if (!actualNode || actualNode && !is_hidden_with_css_default(actualNode)) { - return visible_virtual_default(vNode, true); + return new Promise(function(resolve, reject) { + var _getPreloadConfig2 = _getPreloadConfig(options), assets = _getPreloadConfig2.assets, timeout = _getPreloadConfig2.timeout; + var preloadTimeout = setTimeout(function() { + return reject(new Error('Preload assets timed out.')); + }, timeout); + Promise.all(assets.map(function(asset) { + return preloadFunctionsMap[asset](options).then(function(results) { + return _defineProperty({}, asset, results); + }); + })).then(function(results) { + var preloadAssets = results.reduce(function(out, result) { + return _extends({}, out, result); + }, {}); + clearTimeout(preloadTimeout); + resolve(preloadAssets); + })['catch'](function(err2) { + clearTimeout(preloadTimeout); + reject(err2); + }); + }); + } + var preload_default = preload; + function getIncompleteReason(checkData, messages) { + function getDefaultMsg(messages2) { + if (messages2.incomplete && messages2.incomplete['default']) { + return messages2.incomplete['default']; + } else { + return incompleteFallbackMessage(); + } + } + if (checkData && checkData.missingData) { + try { + var msg = messages.incomplete[checkData.missingData[0].reason]; + if (!msg) { + throw new Error(); + } + return msg; + } catch (e) { + if (typeof checkData.missingData === 'string') { + return messages.incomplete[checkData.missingData]; + } else { + return getDefaultMsg(messages); + } + } + } else if (checkData && checkData.messageKey) { + return messages.incomplete[checkData.messageKey]; } else { - return actualNode.textContent; + return getDefaultMsg(messages); } } - function ariaListboxValue(node, context5) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (!is_aria_listbox_default(vNode)) { - return ''; + function extender(checksData, shouldBeTrue, rule) { + return function(check) { + var sourceData = checksData[check.id] || {}; + var messages = sourceData.messages || {}; + var data2 = Object.assign({}, sourceData); + delete data2.messages; + if (!rule.reviewOnFail && check.result === void 0) { + if (_typeof(messages.incomplete) === 'object' && !Array.isArray(check.data)) { + data2.message = getIncompleteReason(check.data, messages); + } + if (!data2.message) { + data2.message = messages.incomplete; + } + } else { + data2.message = check.result === shouldBeTrue ? messages.pass : messages.fail; + } + if (typeof data2.message !== 'function') { + data2.message = process_message_default(data2.message, check.data); + } + extend_meta_data_default(check, data2); + }; + } + function publishMetaData(ruleResult) { + var checksData = axe._audit.data.checks || {}; + var rulesData = axe._audit.data.rules || {}; + var rule = find_by_default(axe._audit.rules, 'id', ruleResult.id) || {}; + ruleResult.tags = clone_default(rule.tags || []); + var shouldBeTrue = extender(checksData, true, rule); + var shouldBeFalse = extender(checksData, false, rule); + ruleResult.nodes.forEach(function(detail) { + detail.any.forEach(shouldBeTrue); + detail.all.forEach(shouldBeTrue); + detail.none.forEach(shouldBeFalse); + }); + extend_meta_data_default(ruleResult, clone_default(rulesData[ruleResult.id] || {})); + } + var publish_metadata_default = publishMetaData; + function querySelectorAll(domTree, selector) { + return query_selector_all_filter_default(domTree, selector); + } + var query_selector_all_default = querySelectorAll; + function matchTags(rule, runOnly) { + var include, exclude, matching; + var defaultExclude = axe._audit && axe._audit.tagExclude ? axe._audit.tagExclude : []; + if (runOnly.hasOwnProperty('include') || runOnly.hasOwnProperty('exclude')) { + include = runOnly.include || []; + include = Array.isArray(include) ? include : [ include ]; + exclude = runOnly.exclude || []; + exclude = Array.isArray(exclude) ? exclude : [ exclude ]; + exclude = exclude.concat(defaultExclude.filter(function(tag) { + return include.indexOf(tag) === -1; + })); + } else { + include = Array.isArray(runOnly) ? runOnly : [ runOnly ]; + exclude = defaultExclude.filter(function(tag) { + return include.indexOf(tag) === -1; + }); } - var selected = get_owned_virtual_default(vNode).filter(function(owned) { - return get_role_default(owned) === 'option' && owned.attr('aria-selected') === 'true'; + matching = include.some(function(tag) { + return rule.tags.indexOf(tag) !== -1; }); - if (selected.length === 0) { - return ''; - } - return accessible_text_virtual_default(selected[0], context5); - } - function ariaComboboxValue(node, context5) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (!is_aria_combobox_default(vNode)) { - return ''; + if (matching || include.length === 0 && rule.enabled !== false) { + return exclude.every(function(tag) { + return rule.tags.indexOf(tag) === -1; + }); + } else { + return false; } - var listbox = get_owned_virtual_default(vNode).filter(function(elm) { - return get_role_default(elm) === 'listbox'; - })[0]; - return listbox ? ariaListboxValue(listbox, context5) : ''; } - function ariaRangeValue(node) { - var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); - if (!is_aria_range_default(vNode) || !vNode.hasAttr('aria-valuenow')) { - return ''; + function ruleShouldRun(rule, context, options) { + var runOnly = options.runOnly || {}; + var ruleOptions = (options.rules || {})[rule.id]; + if (rule.pageLevel && !context.page) { + return false; + } else if (runOnly.type === 'rule') { + return runOnly.values.indexOf(rule.id) !== -1; + } else if (ruleOptions && typeof ruleOptions.enabled === 'boolean') { + return ruleOptions.enabled; + } else if (runOnly.type === 'tag' && runOnly.values) { + return matchTags(rule, runOnly.values); + } else { + return matchTags(rule, []); } - var valueNow = +vNode.attr('aria-valuenow'); - return !isNaN(valueNow) ? String(valueNow) : '0'; - } - var form_control_value_default = formControlValue; - function getUnicodeNonBmpRegExp() { - return /[\u1D00-\u1D7F\u1D80-\u1DBF\u1DC0-\u1DFF\u20A0-\u20CF\u20D0-\u20FF\u2100-\u214F\u2150-\u218F\u2190-\u21FF\u2200-\u22FF\u2300-\u23FF\u2400-\u243F\u2440-\u245F\u2460-\u24FF\u2500-\u257F\u2580-\u259F\u25A0-\u25FF\u2600-\u26FF\u2700-\u27BF\uE000-\uF8FF]/g; - } - function getPunctuationRegExp() { - return /[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&\xa3\xa2\xa5\xa7\u20ac()*+,\-.\/:;<=>?@\[\]^_`{|}~\xb1]/g; } - function getSupplementaryPrivateUseRegExp() { - return /[\uDB80-\uDBBF][\uDC00-\uDFFF]/g; - } - var emoji_regex = __toModule(require_emoji_regex()); - function hasUnicode(str, options) { - var emoji = options.emoji, nonBmp = options.nonBmp, punctuations = options.punctuations; - if (emoji) { - return emoji_regex['default']().test(str); + var rule_should_run_default = ruleShouldRun; + function _filterHtmlAttrs(element, filterAttrs) { + if (!filterAttrs) { + return element; } - if (nonBmp) { - return getUnicodeNonBmpRegExp().test(str) || getSupplementaryPrivateUseRegExp().test(str); + var node = element.cloneNode(false); + var attributes2 = get_node_attributes_default(node); + if (node.nodeType === 1) { + var outerHTML = node.outerHTML; + node = cache_default.get(outerHTML, function() { + return setNodeAttributes(node, attributes2, element, filterAttrs); + }); + } else { + node = setNodeAttributes(node, attributes2, element, filterAttrs); } - if (punctuations) { - return getPunctuationRegExp().test(str); + Array.from(element.childNodes).forEach(function(child) { + node.appendChild(_filterHtmlAttrs(child, filterAttrs)); + }); + return node; + } + function setNodeAttributes(node, attributes2, element, filterAttrs) { + if (!attributes2) { + return node; } - return false; + node = document.createElement(node.nodeName); + Array.from(attributes2).forEach(function(attr) { + if (!attributeMatches(element, attr.name, filterAttrs)) { + node.setAttribute(attr.name, attr.value); + } + }); + return node; } - var has_unicode_default = hasUnicode; - function isIconLigature(textVNode) { - var differenceThreshold = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : .15; - var occuranceThreshold = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 3; - var nodeValue = textVNode.actualNode.nodeValue.trim(); - if (!sanitize_default(nodeValue) || has_unicode_default(nodeValue, { - emoji: true, - nonBmp: true - })) { + function attributeMatches(node, attrName, filterAttrs) { + if (typeof filterAttrs[attrName] === 'undefined') { return false; } - if (!cache_default.get('canvasContext')) { - cache_default.set('canvasContext', document.createElement('canvas').getContext('2d')); - } - var canvasContext = cache_default.get('canvasContext'); - var canvas = canvasContext.canvas; - if (!cache_default.get('fonts')) { - cache_default.set('fonts', {}); - } - var fonts = cache_default.get('fonts'); - var style = window.getComputedStyle(textVNode.parent.actualNode); - var fontFamily = style.getPropertyValue('font-family'); - if (!fonts[fontFamily]) { - fonts[fontFamily] = { - occurances: 0, - numLigatures: 0 - }; + if (filterAttrs[attrName] === true) { + return true; } - var font = fonts[fontFamily]; - if (font.occurances >= occuranceThreshold) { - if (font.numLigatures / font.occurances === 1) { - return true; - } else if (font.numLigatures === 0) { - return false; + return element_matches_default(node, filterAttrs[attrName]); + } + function _select(selector, context) { + var result = []; + var candidate; + if (axe._selectCache) { + for (var j = 0, l = axe._selectCache.length; j < l; j++) { + var item = axe._selectCache[j]; + if (item.selector === selector) { + return item.result; + } } } - font.occurances++; - var fontSize = 30; - var fontStyle = ''.concat(fontSize, 'px ').concat(fontFamily); - canvasContext.font = fontStyle; - var firstChar = nodeValue.charAt(0); - var width = canvasContext.measureText(firstChar).width; - if (width < 30) { - var diff = 30 / width; - width *= diff; - fontSize *= diff; - fontStyle = ''.concat(fontSize, 'px ').concat(fontFamily); + var outerIncludes = getOuterIncludes(context.include); + var isInContext = getContextFilter(context); + for (var _i15 = 0; _i15 < outerIncludes.length; _i15++) { + candidate = outerIncludes[_i15]; + var nodes = query_selector_all_filter_default(candidate, selector, isInContext); + result = mergeArrayUniques(result, nodes); } - canvas.width = width; - canvas.height = fontSize; - canvasContext.font = fontStyle; - canvasContext.textAlign = 'left'; - canvasContext.textBaseline = 'top'; - canvasContext.fillText(firstChar, 0, 0); - var compareData = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer); - if (!compareData.some(function(pixel) { - return pixel; - })) { - font.numLigatures++; - return true; + if (axe._selectCache) { + axe._selectCache.push({ + selector: selector, + result: result + }); } - canvasContext.clearRect(0, 0, width, fontSize); - canvasContext.fillText(nodeValue, 0, 0); - var compareWith = new Uint32Array(canvasContext.getImageData(0, 0, width, fontSize).data.buffer); - var differences = compareData.reduce(function(diff, pixel, i) { - if (pixel === 0 && compareWith[i] === 0) { - return diff; - } - if (pixel !== 0 && compareWith[i] !== 0) { - return diff; + return result; + } + function getOuterIncludes(includes) { + return includes.reduce(function(res, el) { + if (!res.length || !_contains(res[res.length - 1], el)) { + res.push(el); } - return ++diff; - }, 0); - var expectedWidth = nodeValue.split('').reduce(function(width2, _char3) { - return width2 + canvasContext.measureText(_char3).width; - }, 0); - var actualWidth = canvasContext.measureText(nodeValue).width; - var pixelDifference = differences / compareData.length; - var sizeDifference = 1 - actualWidth / expectedWidth; - if (pixelDifference >= differenceThreshold && sizeDifference >= differenceThreshold) { - font.numLigatures++; - return true; + return res; + }, []); + } + function getContextFilter(context) { + if (!context.exclude || context.exclude.length === 0) { + return null; } - return false; + return function(node) { + return _isNodeInContext(node, context); + }; } - var is_icon_ligature_default = isIconLigature; - function accessibleTextVirtual(virtualNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var actualNode = virtualNode.actualNode; - context5 = prepareContext(virtualNode, context5); - if (shouldIgnoreHidden(virtualNode, context5)) { - return ''; + function mergeArrayUniques(arr1, arr2) { + if (arr1.length === 0) { + return arr2; } - if (shouldIgnoreIconLigature(virtualNode, context5)) { - return ''; + if (arr1.length < arr2.length) { + var temp = arr1; + arr1 = arr2; + arr2 = temp; } - var computationSteps = [ arialabelledby_text_default, arialabel_text_default, native_text_alternative_default, form_control_value_default, subtree_text_default, textNodeValue, title_text_default ]; - var accName = computationSteps.reduce(function(accName2, step) { - if (context5.startNode === virtualNode) { - accName2 = sanitize_default(accName2); - } - if (accName2 !== '') { - return accName2; + for (var _i16 = 0, l = arr2.length; _i16 < l; _i16++) { + if (!arr1.includes(arr2[_i16])) { + arr1.push(arr2[_i16]); } - return step(virtualNode, context5); - }, ''); - if (context5.debug) { - axe.log(accName || '{empty-value}', actualNode, context5); } - return accName; + return arr1; } - function textNodeValue(virtualNode) { - if (virtualNode.props.nodeType !== 3) { - return ''; + function setScroll(elm, top, left) { + if (elm === window) { + return elm.scroll(left, top); + } else { + elm.scrollTop = top; + elm.scrollLeft = left; } - return virtualNode.props.nodeValue; } - function shouldIgnoreHidden(_ref43, context5) { - var actualNode = _ref43.actualNode; - if (!actualNode) { - return false; + function setScrollState(scrollState) { + scrollState.forEach(function(_ref57) { + var elm = _ref57.elm, top = _ref57.top, left = _ref57.left; + return setScroll(elm, top, left); + }); + } + var set_scroll_state_default = setScrollState; + function _shadowSelect(selectors) { + var selectorArr = Array.isArray(selectors) ? _toConsumableArray(selectors) : [ selectors ]; + return selectRecursive(selectorArr, document); + } + function selectRecursive(selectors, doc) { + var selectorStr = selectors.shift(); + var elm = selectorStr ? doc.querySelector(selectorStr) : null; + if (selectors.length === 0) { + return elm; } - if (actualNode.nodeType !== 1 || context5.includeHidden) { - return false; + if (!(elm !== null && elm !== void 0 && elm.shadowRoot)) { + return null; } - return !is_visible_default(actualNode, true); + return selectRecursive(selectors, elm.shadowRoot); } - function shouldIgnoreIconLigature(virtualNode, context5) { - var ignoreIconLigature = context5.ignoreIconLigature, pixelThreshold = context5.pixelThreshold, occuranceThreshold = context5.occuranceThreshold; - if (virtualNode.props.nodeType !== 3 || !ignoreIconLigature) { - return false; + function _shadowSelectAll(selectors) { + var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; + var selectorArr = Array.isArray(selectors) ? _toConsumableArray(selectors) : [ selectors ]; + if (selectors.length === 0) { + return []; } - return is_icon_ligature_default(virtualNode, pixelThreshold, occuranceThreshold); + return selectAllRecursive(selectorArr, doc); } - function prepareContext(virtualNode, context5) { - var actualNode = virtualNode.actualNode; - if (!context5.startNode) { - context5 = _extends({ - startNode: virtualNode - }, context5); + function selectAllRecursive(_ref58, doc) { + var _ref59 = _toArray(_ref58), selectorStr = _ref59[0], restSelector = _ref59.slice(1); + var elms = doc.querySelectorAll(selectorStr); + if (restSelector.length === 0) { + return Array.from(elms); + } + var selected = []; + var _iterator7 = _createForOfIteratorHelper(elms), _step7; + try { + for (_iterator7.s(); !(_step7 = _iterator7.n()).done; ) { + var elm = _step7.value; + if (elm !== null && elm !== void 0 && elm.shadowRoot) { + selected.push.apply(selected, _toConsumableArray(selectAllRecursive(restSelector, elm.shadowRoot))); + } + } + } catch (err) { + _iterator7.e(err); + } finally { + _iterator7.f(); } - if (!actualNode) { - return context5; + return selected; + } + function validInputTypes() { + return [ 'hidden', 'text', 'search', 'tel', 'url', 'email', 'password', 'date', 'month', 'week', 'time', 'datetime-local', 'number', 'range', 'color', 'checkbox', 'radio', 'file', 'submit', 'image', 'reset', 'button' ]; + } + var valid_input_type_default = validInputTypes; + var langs = [ , [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , , , , , 1, 1, 1, 1, , , 1, 1, 1, , 1, , 1, , 1, 1 ], [ 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, , , 1, 1, 1, , , 1, 1, 1, , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , , , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, , , , , , 1, , 1, , , , , 1, , 1, , , , 1, 1, , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, , , 1, , , , , 1, 1, 1, , 1, , 1, , 1, , , , , , 1 ], [ 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, , 1, , 1, , , , , 1, , 1, 1, 1, 1, 1, , , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , 1, , 1, , , , 1, 1, 1, , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ 1, 1, 1, 1, 1, , , 1, , , 1, , , 1, 1, 1, , , , , 1, , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, , 1, 1, 1, , 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, , , 1, 1, , , , , , 1, 1 ], [ 1, 1, 1, , , , , 1, , , , 1, 1, , 1, , , , , , 1, , , , , 1 ], [ , 1, , , 1, , , 1, , , , , , 1 ], [ , 1, , 1, , , , 1, , , , 1 ], [ 1, , 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, , , 1, , 1, 1, , 1, , 1, , , , , 1, , 1 ], [ , 1, , , , 1, , , 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, , , 1, , , 1 ], [ , 1, 1, , , , , , 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, , 1, , , , , 1, 1, , 1, , 1 ], [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, , , , 1, 1, 1, , 1, 1, , , 1, 1, , 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, , 1, 1, 1, , 1, , , , , 1, 1, 1, , , 1, , 1, , , 1, 1 ], [ , , , , 1, , , , , , , , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, , 1, 1, 1, , 1, 1, , , , 1, 1, 1, 1, 1, , , 1, 1, 1, , , , , 1 ], [ 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , , , , , 1, , , , , , , 1 ], [ , 1, 1, , 1, 1, , 1, , , , , , , , , , , , , 1 ], , [ 1, 1, 1, , , , , , , , , , , , , 1 ], [ , , , , , , , , 1, , , 1, , , 1, 1, , , , , 1 ] ], [ , [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , , , 1, , , , , , , , , , , , , , , 1 ], [ , 1, , , 1, 1, , 1, , 1, 1, , , , 1, 1, , , 1, 1, , , , 1 ], [ 1, , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , 1, , , , 1 ], , [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, , , 1, 1, 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, , , 1, , 1, , , 1, 1, 1, 1, , , 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, , , 1, , , 1, , 1 ], [ , 1, , , , , , , , , , 1, 1, , , , , , 1, 1, , , , , 1 ], [ , , , , , , , 1, , , , 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, , , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, , 1, 1, 1, , , 1, 1, , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, , 1, 1, , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , , , , , , 1 ], , [ , 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, , 1 ], [ , , 1, , , 1, , , 1, 1, , , 1, , 1, 1, , 1 ], [ , 1, 1, , 1, , , , 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1 ], [ , 1, , , , , , , , , , 1, 1, , , , , , 1, 1, , 1, , 1, , 1, 1 ], , [ , 1, 1, , 1, , , 1, , 1, , , , 1, 1, 1, , , , , , 1, , , , 1 ], [ 1, 1, , , 1, 1, , 1, , , , , 1, , 1 ] ], [ , [ , 1 ], [ , , , 1, , , , 1, , , , 1, , , , 1, , , 1, , , 1 ], [ , , , , , , , , , , , , , , , , , , 1, 1, , , , , , 1 ], , [ 1, , , , , 1 ], [ , 1, , , , 1, , , , 1 ], [ , 1, , , , , , , , , , , 1, , , 1, , , , , , , , , 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , 1, , , , 1, , 1 ], [ , 1 ], [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, , 1, 1, , 1, , , , , , , 1 ], [ 1, , , , , 1, , , 1, 1, , 1, , 1, , 1, 1, , , , , 1, , , 1 ], [ , 1, 1, , , 1, , 1, , 1, , 1, , 1, 1, 1, 1, , , 1, , 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, , 1, , , , 1, 1, 1, 1, , 1, 1, , , 1, 1, 1, 1 ], [ 1, , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , 1 ], , [ , 1, , , , , , 1, 1, 1, , 1, , , , 1, , , 1, 1, 1, , , 1 ], [ 1, , , , , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, , 1, , 1, , 1, , , 1, 1 ], [ 1, , 1, 1, , , , , 1, , , , , , 1, 1, , , 1, 1, 1, 1, , , 1, , 1 ], [ 1, , , , , , , , , , , , , , , , , 1 ], [ , , , , , 1, , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , , 1 ], [ , 1, , , , 1 ] ], [ , [ 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, , , 1, 1, 1 ], [ , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], , [ , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , , , , , , , 1, , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], , [ 1, 1, , , , 1, 1, , , , , , 1, , , , 1, , 1, , 1, 1, , 1 ], [ 1 ], [ , , , , , , , , , , , 1, , , , , , , , , , , 1 ], [ , 1, , , , , , , 1, 1, , , 1, , 1, , , , 1, , , , , , , 1 ], [ , , , , , , , , , , , , , , , , 1, , , , , 1 ], [ , , 1, , , , , 1, , 1 ], [ 1, , , , 1, , , , , 1, , , , 1, 1, , , , 1, 1, , , , , 1 ], [ , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , 1, 1, , , , , , , 1, , 1, , 1, 1, 1, 1, 1, 1 ], [ , , , , , 1, , , , , , , 1, , , , , , , 1 ], , [ , , 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, 1, , , 1, 1, , 1, 1, 1, , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , 1 ], , [ 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, , , , , , 1, , 1, , , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1 ], [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1, , , 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , 1, , , , , , , , , 1, , , , 1 ], [ , 1, 1, , 1, 1, , 1, , , , 1, 1, , 1, 1, , , 1, , 1, 1, , 1 ], [ , 1, , 1, , 1, , , 1, , , 1, 1, , 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , , , , , , , , , 1, , 1, , 1, 1, , , , 1, , , 1 ], [ , 1, , , 1, 1, , , , , , , , , 1, 1, 1, , , , , 1 ], [ 1, , , 1, 1, , , , 1, 1, 1, 1, 1, , , 1, , , 1, , , 1, , 1, , 1 ], [ , 1, 1, , 1, 1, , 1, 1, , , , 1, 1, 1, , , 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , , 1 ], [ , 1, , , , , , , , 1, , , , , 1, , , , 1, , , 1 ], [ , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , 1, , 1, , , , , 1, 1, 1, 1, 1, , , 1, , , , 1 ], [ , 1, , , , , , , , 1, , , , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, , 1, , 1, 1, , , , 1, , 1, 1, 1, 1, 1, , 1, 1, , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1, 1, , , , 1, , 1, 1, , 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , 1, 1, 1, 1, , 1, , , 1, 1, 1, 1, , , 1, , , , , , , 1 ], [ , 1, , , , , , , , 1, , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1 ], [ , 1, 1, , , , , , , , , , , , 1, 1, , , , , , 1 ], [ , 1, , , , , , , 1 ], [ , , , , , , , , , , , , , , 1, , , , , 1, , , , , , 1 ], [ 1, 1, , , 1, , , 1, 1, 1, , , , 1 ], , [ , , , , , , , , , , , , , 1, , , , , , , , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , 1, , , , , , , 1 ], [ 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, , , 1, , 1, , , 1, 1 ], [ , , , , , , , , , 1 ], [ , 1, , , , 1, , , , , , 1, , , 1, , , , , 1 ], [ , 1, 1, , 1, 1, , , , , , , , , , , , , , , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, 1, 1, 1, , , , 1, 1, , , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, 1, , 1, 1 ], [ , , , , , , , , , , , , , , , 1, , , , 1 ], , [ 1, 1, , 1, , 1, , , , , , 1, , 1, , 1, 1, , 1, , 1, 1, , 1, 1, , 1 ], [ , , 1, , , , , , 1, , , , 1, , 1, , , , , 1 ], [ 1, , , , , , , , , 1, , , , , , 1, , , , 1, , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, , 1, , , , , , 1, , , 1, , , , , , , , 1 ], [ , 1, , 1, , , , , , , , , , , , 1 ], , [ 1, 1, , , , , , , , , , , , , , , , , , , , , , 1, 1 ], [ 1 ] ], [ , [ 1, , , , , , , , , 1, , , , , 1, , 1, , 1 ], [ , 1, 1, , 1, 1, , 1, 1, 1, , , 1, 1, 1, , , , 1, , , 1, , , , 1 ], [ , 1, , , , , , , 1, , , , 1, , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , , , 1, , , , , , , , , 1, 1, 1, 1 ], [ 1 ], [ , 1, 1, , , 1, 1, , , , , 1, , 1, , , , , , , , 1, , , , 1 ], [ 1, , 1, , , 1, , 1, , , , , 1, 1, 1, 1, , , , 1, , , , 1 ], [ , , 1, , , , , , , 1, , , , , , , 1, , , , , , , 1 ], [ 1, , , , , , , , , , , , , , 1, , , , 1 ], [ , , , 1, , 1, , , , , 1, , , , 1, 1, , , , 1 ], [ 1, , , , , 1, , , , 1, , 1, 1, , , 1, 1, , 1, 1, 1, , 1, 1, 1, , 1 ], [ , 1, 1, , , , , 1, , 1, , 1, 1, 1, , 1, 1, , , 1, , 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , , 1, , 1, 1, , , 1, 1, , , , , , 1 ], [ 1, , 1, 1, , 1, , 1, 1, , 1, , 1, 1, 1, 1, 1, , , 1, 1, , , , , , 1 ], [ 1, , , , , , , , , , , , , , , , , , 1, , , 1, , 1 ], [ , , , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , , 1, , 1 ], [ , 1, , , , 1, , , 1, 1, , 1, , , 1, 1, , , 1, , , 1, , , 1, 1 ], [ 1, 1, , 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, , , 1, , 1, 1 ], [ 1, , 1, 1, 1, 1, , , , 1, , 1, 1, 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, , , , , , , , , , , , , 1 ], [ , , 1, , , , , , , , , , , , , , , , , , , , 1 ], [ 1, , , , , , , , , , , 1, , 1, , 1, , , , 1 ], [ , , , 1, , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , , 1, , , , , , , , , 1 ], [ , , , , , , , , 1, 1, , , , , , , , , 1, , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1, 1 ], [ , , , , , 1, , , , 1, 1, 1, , , 1, 1, , , 1, , 1, 1, , 1 ], [ , , , , , , , , , , , , , , , , , , , 1, 1 ], [ , 1, , , , , , 1, , , , , , , , , , , , , 1 ], [ , , 1, , , 1, , 1, 1, 1, , 1, 1, , 1, , , , 1, , 1, 1 ], , [ , , 1, , , 1, , , , , , 1, , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, , , 1, 1, , 1, , 1, , , 1, 1, 1, , , 1 ], [ , , , , , 1, , , , , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , 1, , 1, 1, , 1, , , 1 ], [ , , , , , 1, , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, 1, , , , , 1, , , 1, , 1, , , , 1, 1, , , , 1, 1 ], [ , 1, , , 1, , , 1, , 1, 1, , 1, , , , , , , 1 ], [ , , 1, , 1, , , 1, , , , , , , , , , , 1, 1, , , , 1 ], [ , 1, , , , , , , , , , , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , , , , , , , , , , , , , , , 1, , 1, 1 ], [ , , , , , , , , , , , , 1 ], , [ , 1, 1, 1, 1, , , , 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, , 1 ], [ 1, , , , 1, , , , , , , , , , 1 ], [ 1, , , , , , , , , 1 ], , [ , 1, , , , 1, , , , , , , , , , , , , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, , , , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, , 1, , , , 1, 1, , , 1, 1, , 1 ], [ , 1, 1, , 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ 1, 1, 1, , , , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, , 1, 1, , , , , 1 ], [ , 1, , , , , , , 1, 1, , , 1, 1, 1, , 1, , , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , , 1, , , , 1, , , , , , , 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , 1, , , 1, 1, 1, 1, , 1, 1, 1, 1, , , , 1, , 1, , 1, , , 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , , 1, 1, , , , , , , , , 1 ], , [ , 1, , 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , , 1, , 1, , 1, , , , 1 ], [ , 1, , , 1, 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , , 1 ], [ 1, , , 1, , , , 1, 1, 1, , , , , 1, 1, , , , 1, , 1 ], [ 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, , , , , , , , 1, , 1, , , , , , , , 1, , 1 ], [ , 1, , , , 1, , 1, 1, , , , 1, 1, , 1, , , , 1, 1, 1, , 1 ], , [ , 1, , , , , , 1, , , , , , , 1 ], [ , , , , , , , , 1, , , , 1, , 1, , , , , , , , , , , , 1 ] ], [ , [ , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, , , , , , , , 1, , , , , , 1, , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , , 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, , , , , 1, 1, 1, , , 1, , 1, 1, , , , 1, , 1, , , 1, 1 ], [ , , , , , , , 1, , , , 1, 1, 1, 1, 1, , 1, , , , , , , , 1 ], [ 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, 1, , 1, , 1, , 1, 1, , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , 1, 1, , 1, , 1, 1, 1, , 1, , 1, 1, , 1, 1, , 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , , , , , , 1, , , , , 1, , 1 ], [ , 1, 1, 1, , 1, , 1, , 1, , , , 1, , 1, , , 1, , , , , , 1, 1 ], [ , 1, , , 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, , 1, 1, , , 1, , , 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , , , 1, , 1, , 1, , , , , , 1, , 1, , , , 1, 1 ] ], [ , [ , 1, , 1, , , , , , , , , , , , , , , 1, , , , 1 ], [ , , , , , , , , , 1, , 1, 1, 1, , 1, , , 1, , 1, 1 ], [ 1, 1, , , , , , , 1, , , , , , , 1, , , , , , 1 ], [ , 1, , , , , , , , , , 1, , , , , , , , , 1, 1 ], , [ , , , , , , , , , , , , , , , 1, , , , 1, , 1 ], [ , , 1, 1, , 1, , 1, , , , , , , , 1, , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , , 1, 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ 1, , 1, 1, , , , 1, , , , , , , , , 1, , , 1, , , 1, 1 ], [ , 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, 1, , , , , , 1, , 1, , 1, , , 1, , 1, 1 ], [ 1, 1, 1, 1, , 1, , 1, , 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, , , 1, , 1, , 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, , 1, 1 ], [ , , , , 1, , , 1, , , , , , , 1, , , , 1, 1 ], [ , 1, , , , , , , , , , 1, , 1, , 1, , , , , 1, , , , , 1 ], , [ 1, 1, , 1, , 1, , 1, 1, , , , , , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, , , , , , 1, , , , , , 1, 1, , , , 1, 1, , , 1 ], [ , 1, 1, , 1, 1, , , , 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, , , 1, , , , 1, , , , 1, 1 ], [ , , , , 1 ], [ , , , , , , , , , 1, , , 1 ], , [ , , 1, , 1, , , , , , , , , 1, , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, , 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , , , , 1 ], [ , 1, , 1, , , , , , 1, , , , , 1, 1, , , , , 1, 1 ], [ , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , , 1, , 1, 1, 1 ], [ , 1, , , , 1, , , , , , , 1 ], [ , 1, , , 1, , , 1, , 1, , 1, 1, , 1, , , , , 1, , 1, , , , 1, 1 ], [ , 1, , , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, , , , 1, 1, , , , , , 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , 1, , , , , , , , 1, , , , , , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, , 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1 ], [ 1, 1, , , , , , , 1, 1, , , , , 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], , [ , 1, 1, , , , , 1, , 1, , , , 1, 1, 1, , , 1, , , , , 1 ], [ , , , , , , , , , , , , , 1 ], [ , , , , , 1, , , , , , , , 1, 1, , , , , 1, , 1, , , 1, 1 ], [ , , , , , , , , , , , , , , 1 ] ], [ , [ , 1 ], , , , , , , , , , , , , , , , , , , , [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, , , 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, , , , 1, , 1, 1 ], [ , 1, , 1, , 1, , , 1, , , , , 1, , , , , , 1, 1 ], [ , 1, , 1, , , , , 1, , , , 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, , , , , , , , , , , , , , , 1 ] ], [ , [ , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , , , , , , , 1, 1, , , , 1 ], [ , , , , , , 1 ], [ , , 1 ], [ , 1, 1, , , 1, , 1, , 1, 1, , 1, 1, 1, , , , 1, 1, 1, , , , , 1 ], , [ , 1, , , , 1, , , , , , 1, , , 1, , , , 1, 1, , 1 ], [ , , , , , , , 1, , , , , , , , , 1 ], [ , 1, , , , 1, 1, , , , , , 1, 1, 1, , , , 1, , 1, 1 ], [ , , , , , , , 1, , 1, , , , , , , , , , 1 ], [ , 1, 1, , , , , , 1, 1, , , , 1, , , , , , , 1, , , 1 ], , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , , 1, , , 1, , , , , 1, , 1, , 1, , 1, , , , , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , , , , 1, 1, , 1, 1, , 1, , , 1, , 1 ], [ , , , , , , , , , , , , , , 1, , , , , , 1 ], , [ , , , , , , , , , 1, , , , , , 1, , , , , 1 ], [ , , 1, , , , , , , 1, , , 1, 1 ], [ , , , 1, , , , , 1, , , , , 1, , , , , , 1, , , , 1 ], [ 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, , , , 1, 1, 1, , , 1, 1, , , , 1, 1 ], , [ 1, 1, , , , , , , , , , 1, , 1, , 1, , , 1 ], [ , , , , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , 1, , , , , 1, , 1 ], [ , , , , , , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , , 1, , , 1, , , , , , , , 1, , , , , , 1, , , , 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, , 1, , , , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, , , , , , , 1, , 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, , 1, , , , , , 1, , 1, , , , , 1, 1, , , , , 1 ], [ 1, , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, 1, , 1, , 1, , , , 1, 1, 1, 1, 1, , , 1, 1, , 1, , 1 ], [ , 1, 1, 1, 1, , , , , 1, , 1, 1, 1, 1, 1, , , 1, 1, , , , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, , , , , 1, , 1, , 1, , , 1, , , 1, 1, , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , 1, , , , , 1, 1, , , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , , 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , 1, , 1, 1, , 1, 1, 1, 1, 1, , , 1, , 1, , 1 ], [ 1, 1, 1, , 1, 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , , 1, , , , , , , , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , , , , , 1, 1, 1, 1, 1, , , , 1, 1, 1, , 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1 ], [ , 1, 1, 1, , 1, , 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, , , 1, 1 ], [ 1, 1, , , , 1, , , 1, 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, 1, , 1, , 1 ], [ , 1, , , , , , , 1, , 1, , 1, 1, 1, 1, , , , , , , , , 1 ] ], [ , [ , , , , , , , , , , , , , 1, 1, , , , 1 ], [ , 1, , , , , , , , 1, , , 1, , , , , , 1, , , 1, , , , 1 ], , [ , 1, , , , 1, , 1, , 1, 1, , 1, 1, , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , 1 ], [ 1, 1, 1, , , 1, , , , , , , , , 1, 1, , , , , , , , , , 1 ], [ , 1, , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , , , , , 1, , , 1 ], [ , , , , , , , , , 1 ], [ 1, 1, , , , , , 1, 1, 1, , 1, 1, , , , 1, 1, , 1, , 1, 1, 1, , 1 ], [ , 1, 1, 1, , 1, 1, , , 1, , 1, 1, 1, 1, , , , , , , 1, , 1 ], [ , 1, 1, 1, 1, , , 1, , 1, , , , 1, 1, 1, 1, , 1, 1, , 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , 1, 1, , 1, , 1, , , 1, , , 1, , 1 ], [ , , , , , , , , , , , 1 ], [ , , , , , , , , , 1, , , , , , , , , , , , , 1 ], , [ 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , 1, 1, , 1, , , , , 1, , , 1, , 1 ], [ , 1, , , , 1, , , 1, , , , , , , , 1, , 1, , , 1 ], [ , , , , , , , , , , , , , 1, 1, , , , 1, , , 1 ], [ , , , , , 1, , , 1, , , , 1 ], [ , 1 ], , [ , 1 ], [ 1, , , , , , , , , , , , , , 1, , , , , 1 ] ], [ , [ , 1, , , , 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, , 1, 1, , 1, 1, , , 1 ], [ , , 1, , , , , , , , , 1 ], , , [ 1, , , 1, 1, , , , , , , , 1, 1, , 1, 1, , 1 ], , [ , , , , , , , , , , , , , , , , , , 1, , 1 ], , [ 1, , , 1, 1, , 1, 1, , , , , 1, , 1, , , , , 1, 1, , 1 ], , [ , 1, , , , , , , , 1, 1, 1, 1, 1, , 1, 1, , , , 1, 1 ], [ , , , , , , , , , , , , , , , , 1, , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , , , , , , , , , , , 1, , 1, , , 1 ], [ 1, , , , , , , , , , , , , , , , , , 1, , 1 ], , , [ , 1, , , , , , , , , , , , , , 1, , , , 1, 1 ], [ , , , , , , , , , 1, , , 1, , , , , , , , , , 1 ], [ , , , , , , , , , , , , , , , 1 ], [ , , , , , , , , , , , , , 1, 1, , , , , , 1 ], , [ , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , , 1, 1, , 1, 1, 1, 1, 1, 1, , , 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, , , , , , , , 1 ], [ , , , , 1, , , 1, , , 1, 1, , , , , , , , , , 1, , , , 1 ], [ , 1, , 1, 1, , , 1, 1, 1, , , , 1, 1, 1, 1, , 1, 1, 1, 1, , 1 ], [ , , , , , , , 1 ], [ , 1, 1, , , , , 1, , 1, , , , , , 1, , , , , , 1, , 1, , 1 ], [ , 1, , , , , , 1, , , , 1, , , , , , , , , , 1 ], [ , , 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, , , , , , , , 1 ], [ , 1, 1, , 1, , , , , , , , 1, , , , , , 1, , , 1, , 1, , 1 ], [ , 1, , 1, , 1, , 1, 1, 1, , 1, 1, 1, , 1, , , 1, 1, , 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, , , , 1, 1, 1, , , , 1, 1, , , 1, 1 ], [ , , 1, 1, 1, 1, , 1, , 1, , 1, , 1, 1, 1, 1, , , , , 1, , 1, , 1 ], [ 1, 1, 1, 1, 1, 1, 1, 1, , 1, , 1, , 1, 1, 1, , , 1, 1, , , , 1, , 1 ], [ , , , 1 ], , [ , 1, 1, , 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, , 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , 1, , 1, , 1, , , , , , , 1, 1, , 1, 1 ], [ , , , , , , 1, , 1, 1, , 1, , 1, , , , , , , , , , 1 ], [ , 1, 1, , 1, , , , 1, , , , 1, 1, 1, , , , 1, , 1, 1, 1, , 1, 1 ], , [ , 1, 1, , , , , , , , , , , , , 1, , , 1, , , , , 1 ], [ , 1, , , , , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , , , , , , 1, , , , 1, , , , , 1, , , , , , , 1 ] ], [ , [ , 1, 1, 1, 1, 1, , 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, , 1, , 1, 1, , , 1, 1, 1, 1, , 1, , , , , 1, 1, 1 ], [ , , 1, 1, , 1, , 1, 1, , , , 1, 1, 1, 1, , , 1, , 1, 1, 1, 1, , 1 ], [ , 1, , 1, , , , , , , , 1, , 1, , 1, , , , , , , , , , 1 ], [ , , 1, , 1, , , 1, , , , , 1, 1, , , 1, , 1, 1, 1, 1 ], [ , 1 ], [ , 1, 1, , 1, , 1, 1, , 1, , , 1, 1, 1, , , , 1, , , 1, , 1 ], [ 1, 1, , 1, 1, 1, , , , , , , , , , , , , 1, , 1, 1, 1 ], [ , 1, 1, , , , , , , 1, , , 1, , 1, , 1, , 1, 1, , , 1, , , 1 ], [ , , 1, , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, 1, 1, 1, , 1, , 1, , , , , 1, 1, 1, , , 1, , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, , , 1, 1, 1, , 1, , 1, 1, 1, , , 1, 1, 1, 1, , , , 1, 1 ], [ , , , 1, 1, , , 1, , 1, , 1, , 1, 1, 1, 1, , 1, , , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , 1, 1, , 1, 1, , 1, , 1, , , , 1, 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, 1, 1, 1, 1, , , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, , , 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1 ], [ , 1, 1, , 1, , , 1, , , 1, , 1, 1, 1, 1, 1, , 1, , 1, 1 ], [ , , , , , 1, , , , 1, , , , , 1, 1, , , , 1 ], [ , 1, , 1, 1, 1, , 1, , , 1, 1, 1, , , 1, , , 1, , 1, , , 1 ], [ , , 1, , , , , , , , , 1, , 1, , , , , 1, , 1 ], [ , 1, 1, , , , , , , , 1, 1, 1, , , , , , , , 1, , , , , 1 ], [ , , , , , , , , 1, , , , , 1, , , 1 ] ], [ , [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, 1, , 1, 1, , , 1, 1, 1, 1, 1, 1, 1, 1, , , , , , , , , 1, 1 ], [ , , , , , , , , 1, , , , 1, , 1, , 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , , , , , , , 1 ], [ , 1, , 1, , 1, , , , 1, 1, , 1, , 1, , , , 1, 1, 1, 1, 1, , , 1 ], , [ , 1, , , , , , , , 1, , , 1, 1, , , 1, , 1, 1, , 1, , 1 ], [ , 1, , , 1, , , , , , , , 1, , , , , , , 1 ], [ 1, 1, , , , , 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1 ], , [ , 1, , , , , , 1, , 1, , 1, 1, 1, 1, 1, , , 1, , 1, 1, , , , 1 ], [ , 1, 1, , , 1, , 1, , 1, , , 1, 1, 1, 1, , , 1, , , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , , , 1, , 1 ], [ , 1, , , 1, 1, , 1, 1, , , 1, 1, , 1, 1, , 1, , 1, , 1 ], [ 1, , 1, , , , , 1, , 1, , 1, 1, 1, 1, , , , , 1, 1, , , , 1, 1 ], [ , 1, 1, , , , , 1, 1, , , 1, , 1, 1, 1, 1, , , , , , , , , , 1 ], , [ , 1, 1, , , 1, , , , 1, , 1, 1, 1, 1, 1, , , , 1, , , , 1, , 1 ], [ , , , 1, 1, , , 1, , , , , 1, , 1, 1, 1, , 1, 1, , , , , , 1 ], [ , 1, , , , , , , , , , , 1, , , , 1, , , , , , , 1, , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, , 1, 1, 1, , 1, 1, , 1, 1, 1, 1 ], [ , 1, , , , , , , , , , , , , , , , , , , 1 ], [ , 1, , , , , , 1, , , , , 1, , 1, , , 1, 1, , 1, 1, , 1 ], [ , 1, , , , , , 1, , , , , 1, 1, , , , , , , , 1, , , , 1 ], [ , , , , , , , , , , , , , , , , , , 1, , , 1, , , , , 1 ], [ , , , , , , , 1, , , , 1 ] ], [ , [ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , 1, , 1, , , , , , , 1, , , , , , , , 1, , , 1 ], [ , 1, , , , , , , 1 ], [ , , , , , , , , , , 1 ], [ , 1, , , , , , 1, 1, , , , , , 1 ], , [ , 1, 1, , , , , , 1, , , , , 1, 1, , , , 1 ], [ 1, , 1, , 1, , , , , 1, , , , , 1, , , , , , , , , 1, 1 ], [ , 1, 1, , , , , , , , , 1, 1, 1, 1, , , , 1, , , , , 1, , , 1 ], , [ , 1, 1, , 1, , , 1, 1, , , 1, , , 1, 1, 1, , 1, , 1, 1, 1, , , , 1 ], [ , , , , , 1, , , , , 1, , , 1, 1, , , 1, , 1, , , , 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , 1, , , 1, 1, , 1, , , , 1, , , , , , , , 1 ], [ , , , 1, , , , , 1, , , , , 1, , 1, , 1, 1, 1 ], [ , 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ], [ , , , , , 1 ], [ , 1, , , , , , 1, , , , , , , 1, 1, 1, , , 1 ], [ , 1, , , , , , , , , , 1, 1, 1, , , , , 1, , , 1 ], [ , , , , , 1, , 1, , , , , 1, 1, 1, , 1, 1, , 1, 1, 1, , , 1, 1 ], [ 1, 1, , , , , , , 1, , , , , 1, 1, , , , , , , , , , , 1 ], , [ , 1 ], [ , , , , , , , , , , , , , , , , , , , , , , , , 1 ], [ , , 1, , , , , 1, , , 1, , , , 1, , 1 ], [ , 1, , , , , , , , , 1 ] ] ]; + function isValidLang(lang) { + var array = langs; + while (lang.length < 3) { + lang += '`'; } - if (actualNode.nodeType === 1 && context5.inLabelledByContext && context5.includeHidden === void 0) { - context5 = _extends({ - includeHidden: !is_visible_default(actualNode, true) - }, context5); + for (var _i17 = 0; _i17 <= lang.length - 1; _i17++) { + var index = lang.charCodeAt(_i17) - 96; + array = array[index]; + if (!array) { + return false; + } } - return context5; + return true; + } + function _validLangs(langArray) { + langArray = Array.isArray(langArray) ? langArray : langs; + var codes = []; + langArray.forEach(function(lang, index) { + var _char3 = String.fromCharCode(index + 96).replace('`', ''); + if (Array.isArray(lang)) { + codes = codes.concat(_validLangs(lang).map(function(newLang) { + return _char3 + newLang; + })); + } else { + codes.push(_char3); + } + }); + return codes; } - accessibleTextVirtual.alreadyProcessed = function alreadyProcessed(virtualnode, context5) { - context5.processed = context5.processed || []; - if (context5.processed.includes(virtualnode)) { - return true; + var valid_langs_default = isValidLang; + var SerialVirtualNode = function(_abstract_virtual_nod2) { + _inherits(SerialVirtualNode, _abstract_virtual_nod2); + var _super2 = _createSuper(SerialVirtualNode); + function SerialVirtualNode(serialNode) { + var _this3; + _classCallCheck(this, SerialVirtualNode); + _this3 = _super2.call(this); + _this3._props = normaliseProps(serialNode); + _this3._attrs = normaliseAttrs(serialNode); + return _this3; } - context5.processed.push(virtualnode); - return false; + _createClass(SerialVirtualNode, [ { + key: 'props', + get: function get() { + return this._props; + } + }, { + key: 'attr', + value: function attr(attrName) { + var _this$_attrs$attrName; + return (_this$_attrs$attrName = this._attrs[attrName]) !== null && _this$_attrs$attrName !== void 0 ? _this$_attrs$attrName : null; + } + }, { + key: 'hasAttr', + value: function hasAttr(attrName) { + return this._attrs[attrName] !== void 0; + } + }, { + key: 'attrNames', + get: function get() { + return Object.keys(this._attrs); + } + } ]); + return SerialVirtualNode; + }(abstract_virtual_node_default); + var nodeNamesToTypes = { + '#cdata-section': 2, + '#text': 3, + '#comment': 8, + '#document': 9, + '#document-fragment': 11 }; - var accessible_text_virtual_default = accessibleTextVirtual; - function accessibleText(element, context5) { - var virtualNode = get_node_from_tree_default(element); - return accessible_text_virtual_default(virtualNode, context5); - } - var accessible_text_default = accessibleText; - function arialabelledbyText(vNode) { - var context5 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - if (!(vNode instanceof abstract_virtual_node_default)) { - if (vNode.nodeType !== 1) { - return ''; + var nodeTypeToName = {}; + var nodeNames = Object.keys(nodeNamesToTypes); + nodeNames.forEach(function(nodeName2) { + nodeTypeToName[nodeNamesToTypes[nodeName2]] = nodeName2; + }); + function normaliseProps(serialNode) { + var _serialNode$nodeName, _ref60, _serialNode$nodeType; + var nodeName2 = (_serialNode$nodeName = serialNode.nodeName) !== null && _serialNode$nodeName !== void 0 ? _serialNode$nodeName : nodeTypeToName[serialNode.nodeType]; + var nodeType = (_ref60 = (_serialNode$nodeType = serialNode.nodeType) !== null && _serialNode$nodeType !== void 0 ? _serialNode$nodeType : nodeNamesToTypes[serialNode.nodeName]) !== null && _ref60 !== void 0 ? _ref60 : 1; + assert_default(typeof nodeType === 'number', 'nodeType has to be a number, got \''.concat(nodeType, '\'')); + assert_default(typeof nodeName2 === 'string', 'nodeName has to be a string, got \''.concat(nodeName2, '\'')); + nodeName2 = nodeName2.toLowerCase(); + var type = null; + if (nodeName2 === 'input') { + type = (serialNode.type || serialNode.attributes && serialNode.attributes.type || '').toLowerCase(); + if (!valid_input_type_default().includes(type)) { + type = 'text'; } - vNode = get_node_from_tree_default(vNode); - } - if (vNode.props.nodeType !== 1 || context5.inLabelledByContext || context5.inControlContext || !vNode.attr('aria-labelledby')) { - return ''; } - var refs = idrefs_default(vNode, 'aria-labelledby').filter(function(elm) { - return elm; + var props = _extends({}, serialNode, { + nodeType: nodeType, + nodeName: nodeName2 }); - return refs.reduce(function(accessibleName, elm) { - var accessibleNameAdd = accessible_text_default(elm, _extends({ - inLabelledByContext: true, - startNode: context5.startNode || vNode - }, context5)); - if (!accessibleName) { - return accessibleNameAdd; - } else { - return ''.concat(accessibleName, ' ').concat(accessibleNameAdd); + if (type) { + props.type = type; + } + delete props.attributes; + return Object.freeze(props); + } + function normaliseAttrs(_ref61) { + var _ref61$attributes = _ref61.attributes, attributes2 = _ref61$attributes === void 0 ? {} : _ref61$attributes; + var attrMap = { + htmlFor: 'for', + className: 'class' + }; + return Object.keys(attributes2).reduce(function(attrs, attrName) { + var value = attributes2[attrName]; + assert_default(_typeof(value) !== 'object' || value === null, 'expects attributes not to be an object, \''.concat(attrName, '\' was')); + if (value !== void 0) { + var mappedName = attrMap[attrName] || attrName; + attrs[mappedName] = value !== null ? String(value) : null; } - }, ''); + return attrs; + }, {}); } - var arialabelledby_text_default = arialabelledbyText; - var text_exports = {}; - __export(text_exports, { - accessibleText: function accessibleText() { - return accessible_text_default; - }, - accessibleTextVirtual: function accessibleTextVirtual() { - return accessible_text_virtual_default; - }, - autocomplete: function autocomplete() { - return _autocomplete; - }, - formControlValue: function formControlValue() { - return form_control_value_default; - }, - formControlValueMethods: function formControlValueMethods() { - return _formControlValueMethods; - }, - hasUnicode: function hasUnicode() { - return has_unicode_default; - }, - isHumanInterpretable: function isHumanInterpretable() { - return is_human_interpretable_default; - }, - isIconLigature: function isIconLigature() { - return is_icon_ligature_default; - }, - isValidAutocomplete: function isValidAutocomplete() { - return is_valid_autocomplete_default; - }, - label: function label() { - return label_default; - }, - labelText: function labelText() { - return label_text_default; - }, - labelVirtual: function labelVirtual() { - return label_virtual_default2; - }, - nativeElementType: function nativeElementType() { - return native_element_type_default; - }, - nativeTextAlternative: function nativeTextAlternative() { - return native_text_alternative_default; - }, - nativeTextMethods: function nativeTextMethods() { - return native_text_methods_default; - }, - removeUnicode: function removeUnicode() { - return remove_unicode_default; - }, - sanitize: function sanitize() { - return sanitize_default; - }, - subtreeText: function subtreeText() { - return subtree_text_default; - }, - titleText: function titleText() { - return title_text_default; - }, - unsupported: function unsupported() { - return unsupported_default; + var serial_virtual_node_default = SerialVirtualNode; + var imports_exports = {}; + __export(imports_exports, { + CssSelectorParser: function CssSelectorParser() { + return import_css_selector_parser2.CssSelectorParser; }, - visible: function visible() { - return visible_default; + doT: function doT() { + return import_dot['default']; }, - visibleTextNodes: function visibleTextNodes() { - return visible_text_nodes_default; + emojiRegexText: function emojiRegexText() { + return emoji_regex_default; }, - visibleVirtual: function visibleVirtual() { - return visible_virtual_default; + memoize: function memoize() { + return import_memoizee2['default']; } }); - var emoji_regex2 = __toModule(require_emoji_regex()); - function removeUnicode(str, options) { - var emoji = options.emoji, nonBmp = options.nonBmp, punctuations = options.punctuations; - if (emoji) { - str = str.replace(emoji_regex2['default'](), ''); + var import_css_selector_parser2 = __toModule(require_lib()); + var import_dot = __toModule(require_doT()); + var import_memoizee2 = __toModule(require_memoizee()); + var import_es6_promise = __toModule(require_es6_promise()); + var import_typedarray = __toModule(require_typedarray()); + var import_weakmap_polyfill = __toModule(require_weakmap_polyfill()); + import_dot['default'].templateSettings.strip = false; + if (!('Promise' in window)) { + import_es6_promise['default'].polyfill(); + } + if (!('Uint32Array' in window)) { + window.Uint32Array = import_typedarray.Uint32Array; + } + if (window.Uint32Array) { + if (!('some' in window.Uint32Array.prototype)) { + Object.defineProperty(window.Uint32Array.prototype, 'some', { + value: Array.prototype.some + }); } - if (nonBmp) { - str = str.replace(getUnicodeNonBmpRegExp(), ''); - str = str.replace(getSupplementaryPrivateUseRegExp(), ''); + if (!('reduce' in window.Uint32Array.prototype)) { + Object.defineProperty(window.Uint32Array.prototype, 'reduce', { + value: Array.prototype.reduce + }); } - if (punctuations) { - str = str.replace(getPunctuationRegExp(), ''); + } + function cleanup(resolve, reject) { + resolve = resolve || function res() {}; + reject = reject || axe.log; + if (!axe._audit) { + throw new Error('No audit configured'); } - return str; + var q = axe.utils.queue(); + var cleanupErrors = []; + Object.keys(axe.plugins).forEach(function(key) { + q.defer(function(res) { + var rej = function rej2(err2) { + cleanupErrors.push(err2); + res(); + }; + try { + axe.plugins[key].cleanup(res, rej); + } catch (err2) { + rej(err2); + } + }); + }); + var flattenedTree = axe.utils.getFlattenedTree(document.body); + axe.utils.querySelectorAll(flattenedTree, 'iframe, frame').forEach(function(node) { + q.defer(function(res, rej) { + return axe.utils.sendCommandToFrame(node.actualNode, { + command: 'cleanup-plugin' + }, res, rej); + }); + }); + q.then(function(results) { + if (cleanupErrors.length === 0) { + resolve(results); + } else { + reject(cleanupErrors); + } + })['catch'](reject); } - var remove_unicode_default = removeUnicode; - function isHumanInterpretable(str) { - if (!str.length) { - return 0; + var cleanup_default = cleanup; + var reporters = {}; + var defaultReporter; + function hasReporter(reporterName) { + return reporters.hasOwnProperty(reporterName); + } + function getReporter(reporter) { + if (typeof reporter === 'string' && reporters[reporter]) { + return reporters[reporter]; } - var alphaNumericIconMap = [ 'x', 'i' ]; - if (alphaNumericIconMap.includes(str)) { - return 0; + if (typeof reporter === 'function') { + return reporter; } - var noUnicodeStr = remove_unicode_default(str, { - emoji: true, - nonBmp: true, - punctuations: true - }); - if (!sanitize_default(noUnicodeStr)) { - return 0; + return defaultReporter; + } + function addReporter(name, cb, isDefault) { + reporters[name] = cb; + if (isDefault) { + defaultReporter = cb; } - return 1; } - var is_human_interpretable_default = isHumanInterpretable; - var _autocomplete = { - stateTerms: [ 'on', 'off' ], - standaloneTerms: [ 'name', 'honorific-prefix', 'given-name', 'additional-name', 'family-name', 'honorific-suffix', 'nickname', 'username', 'new-password', 'current-password', 'organization-title', 'organization', 'street-address', 'address-line1', 'address-line2', 'address-line3', 'address-level4', 'address-level3', 'address-level2', 'address-level1', 'country', 'country-name', 'postal-code', 'cc-name', 'cc-given-name', 'cc-additional-name', 'cc-family-name', 'cc-number', 'cc-exp', 'cc-exp-month', 'cc-exp-year', 'cc-csc', 'cc-type', 'transaction-currency', 'transaction-amount', 'language', 'bday', 'bday-day', 'bday-month', 'bday-year', 'sex', 'url', 'photo', 'one-time-code' ], - qualifiers: [ 'home', 'work', 'mobile', 'fax', 'pager' ], - qualifiedTerms: [ 'tel', 'tel-country-code', 'tel-national', 'tel-area-code', 'tel-local', 'tel-local-prefix', 'tel-local-suffix', 'tel-extension', 'email', 'impp' ], - locations: [ 'billing', 'shipping' ] - }; - function isValidAutocomplete(autocompleteValue) { - var _ref44 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, _ref44$looseTyped = _ref44.looseTyped, looseTyped = _ref44$looseTyped === void 0 ? false : _ref44$looseTyped, _ref44$stateTerms = _ref44.stateTerms, stateTerms = _ref44$stateTerms === void 0 ? [] : _ref44$stateTerms, _ref44$locations = _ref44.locations, locations = _ref44$locations === void 0 ? [] : _ref44$locations, _ref44$qualifiers = _ref44.qualifiers, qualifiers = _ref44$qualifiers === void 0 ? [] : _ref44$qualifiers, _ref44$standaloneTerm = _ref44.standaloneTerms, standaloneTerms = _ref44$standaloneTerm === void 0 ? [] : _ref44$standaloneTerm, _ref44$qualifiedTerms = _ref44.qualifiedTerms, qualifiedTerms = _ref44$qualifiedTerms === void 0 ? [] : _ref44$qualifiedTerms; - autocompleteValue = autocompleteValue.toLowerCase().trim(); - stateTerms = stateTerms.concat(_autocomplete.stateTerms); - if (stateTerms.includes(autocompleteValue) || autocompleteValue === '') { - return true; + function configure(spec) { + var audit; + audit = axe._audit; + if (!audit) { + throw new Error('No audit configured'); } - qualifiers = qualifiers.concat(_autocomplete.qualifiers); - locations = locations.concat(_autocomplete.locations); - standaloneTerms = standaloneTerms.concat(_autocomplete.standaloneTerms); - qualifiedTerms = qualifiedTerms.concat(_autocomplete.qualifiedTerms); - var autocompleteTerms = autocompleteValue.split(/\s+/g); - if (!looseTyped) { - if (autocompleteTerms[0].length > 8 && autocompleteTerms[0].substr(0, 8) === 'section-') { - autocompleteTerms.shift(); + if (spec.axeVersion || spec.ver) { + var specVersion = spec.axeVersion || spec.ver; + if (!/^\d+\.\d+\.\d+(-canary)?/.test(specVersion)) { + throw new Error('Invalid configured version '.concat(specVersion)); } - if (locations.includes(autocompleteTerms[0])) { - autocompleteTerms.shift(); + var _specVersion$split = specVersion.split('-'), _specVersion$split2 = _slicedToArray(_specVersion$split, 2), version = _specVersion$split2[0], canary = _specVersion$split2[1]; + var _version$split$map = version.split('.').map(Number), _version$split$map2 = _slicedToArray(_version$split$map, 3), major = _version$split$map2[0], minor = _version$split$map2[1], patch = _version$split$map2[2]; + var _axe$version$split = axe.version.split('-'), _axe$version$split2 = _slicedToArray(_axe$version$split, 2), axeVersion = _axe$version$split2[0], axeCanary = _axe$version$split2[1]; + var _axeVersion$split$map = axeVersion.split('.').map(Number), _axeVersion$split$map2 = _slicedToArray(_axeVersion$split$map, 3), axeMajor = _axeVersion$split$map2[0], axeMinor = _axeVersion$split$map2[1], axePatch = _axeVersion$split$map2[2]; + if (major !== axeMajor || axeMinor < minor || axeMinor === minor && axePatch < patch || major === axeMajor && minor === axeMinor && patch === axePatch && canary && canary !== axeCanary) { + throw new Error('Configured version '.concat(specVersion, ' is not compatible with current axe version ').concat(axe.version)); } - if (qualifiers.includes(autocompleteTerms[0])) { - autocompleteTerms.shift(); - standaloneTerms = []; + } + if (spec.reporter && (typeof spec.reporter === 'function' || hasReporter(spec.reporter))) { + audit.reporter = spec.reporter; + } + if (spec.checks) { + if (!Array.isArray(spec.checks)) { + throw new TypeError('Checks property must be an array'); } - if (autocompleteTerms.length !== 1) { - return false; + spec.checks.forEach(function(check) { + if (!check.id) { + throw new TypeError('Configured check '.concat(JSON.stringify(check), ' is invalid. Checks must be an object with at least an id property')); + } + audit.addCheck(check); + }); + } + var modifiedRules = []; + if (spec.rules) { + if (!Array.isArray(spec.rules)) { + throw new TypeError('Rules property must be an array'); } + spec.rules.forEach(function(rule) { + if (!rule.id) { + throw new TypeError('Configured rule '.concat(JSON.stringify(rule), ' is invalid. Rules must be an object with at least an id property')); + } + modifiedRules.push(rule.id); + audit.addRule(rule); + }); } - var purposeTerm = autocompleteTerms[autocompleteTerms.length - 1]; - return standaloneTerms.includes(purposeTerm) || qualifiedTerms.includes(purposeTerm); - } - var is_valid_autocomplete_default = isValidAutocomplete; - function visible(element, screenReader, noRecursing) { - element = get_node_from_tree_default(element); - return visible_virtual_default(element, screenReader, noRecursing); - } - var visible_default = visible; - function labelVirtual2(virtualNode) { - var ref, candidate, doc; - candidate = label_virtual_default(virtualNode); - if (candidate) { - return candidate; + if (spec.disableOtherRules) { + audit.rules.forEach(function(rule) { + if (modifiedRules.includes(rule.id) === false) { + rule.enabled = false; + } + }); } - if (virtualNode.attr('id')) { - if (!virtualNode.actualNode) { - throw new TypeError('Cannot resolve explicit label reference for non-DOM nodes'); + if (typeof spec.branding !== 'undefined') { + audit.setBranding(spec.branding); + } else { + audit._constructHelpUrls(); + } + if (spec.tagExclude) { + audit.tagExclude = spec.tagExclude; + } + if (spec.locale) { + audit.applyLocale(spec.locale); + } + if (spec.standards) { + configureStandards(spec.standards); + } + if (spec.noHtml) { + audit.noHtml = true; + } + if (spec.allowedOrigins) { + if (!Array.isArray(spec.allowedOrigins)) { + throw new TypeError('Allowed origins property must be an array'); } - var id = escape_selector_default(virtualNode.attr('id')); - doc = get_root_node_default2(virtualNode.actualNode); - ref = doc.querySelector('label[for="' + id + '"]'); - candidate = ref && visible_default(ref, true); - if (candidate) { - return candidate; + if (spec.allowedOrigins.includes('*')) { + throw new Error('"*" is not allowed. Use "'.concat(constants_default.allOrigins, '" instead')); } + audit.setAllowedOrigins(spec.allowedOrigins); } - ref = closest_default(virtualNode, 'label'); - candidate = ref && visible_virtual_default(ref, true); - if (candidate) { - return candidate; - } - return null; } - var label_virtual_default2 = labelVirtual2; - function label(node) { - node = get_node_from_tree_default(node); - return label_virtual_default2(node); + var configure_default = configure; + function frameMessenger2(frameHandler) { + _respondable.updateMessenger(frameHandler); } - var label_default = label; - var nativeElementType = [ { - matches: [ { - nodeName: 'textarea' - }, { - nodeName: 'input', - properties: { - type: [ 'text', 'password', 'search', 'tel', 'email', 'url' ] - } - } ], - namingMethods: 'labelText' - }, { - matches: { - nodeName: 'input', - properties: { - type: [ 'button', 'submit', 'reset' ] - } + function getRules(tags) { + tags = tags || []; + var matchingRules = !tags.length ? axe._audit.rules : axe._audit.rules.filter(function(item) { + return !!tags.filter(function(tag) { + return item.tags.indexOf(tag) !== -1; + }).length; + }); + var ruleData = axe._audit.data.rules || {}; + return matchingRules.map(function(matchingRule) { + var rd = ruleData[matchingRule.id] || {}; + return { + ruleId: matchingRule.id, + description: rd.description, + help: rd.help, + helpUrl: rd.helpUrl, + tags: matchingRule.tags, + actIds: matchingRule.actIds + }; + }); + } + var get_rules_default = getRules; + var aria_exports = {}; + __export(aria_exports, { + allowedAttr: function allowedAttr() { + return allowed_attr_default; }, - namingMethods: [ 'valueText', 'titleText', 'buttonDefaultText' ] - }, { - matches: { - nodeName: 'input', - properties: { - type: 'image' - } + arialabelText: function arialabelText() { + return arialabel_text_default; }, - namingMethods: [ 'altText', 'valueText', 'labelText', 'titleText', 'buttonDefaultText' ] - }, { - matches: 'button', - namingMethods: 'subtreeText' - }, { - matches: 'fieldset', - namingMethods: 'fieldsetLegendText' - }, { - matches: 'OUTPUT', - namingMethods: 'subtreeText' - }, { - matches: [ { - nodeName: 'select' - }, { - nodeName: 'input', - properties: { - type: /^(?!text|password|search|tel|email|url|button|submit|reset)/ - } - } ], - namingMethods: 'labelText' - }, { - matches: 'summary', - namingMethods: 'subtreeText' - }, { - matches: 'figure', - namingMethods: [ 'figureText', 'titleText' ] - }, { - matches: 'img', - namingMethods: 'altText' - }, { - matches: 'table', - namingMethods: [ 'tableCaptionText', 'tableSummaryText' ] - }, { - matches: [ 'hr', 'br' ], - namingMethods: [ 'titleText', 'singleSpace' ] - } ]; - var native_element_type_default = nativeElementType; - function visibleTextNodes(vNode) { - var parentVisible = is_visible_default(vNode.actualNode); - var nodes = []; - vNode.children.forEach(function(child) { - if (child.actualNode.nodeType === 3) { - if (parentVisible) { - nodes.push(child); - } - } else { - nodes = nodes.concat(visibleTextNodes(child)); - } - }); - return nodes; + arialabelledbyText: function arialabelledbyText() { + return arialabelledby_text_default; + }, + getAccessibleRefs: function getAccessibleRefs() { + return get_accessible_refs_default; + }, + getElementUnallowedRoles: function getElementUnallowedRoles() { + return get_element_unallowed_roles_default; + }, + getExplicitRole: function getExplicitRole() { + return get_explicit_role_default; + }, + getImplicitRole: function getImplicitRole() { + return implicit_role_default; + }, + getOwnedVirtual: function getOwnedVirtual() { + return get_owned_virtual_default; + }, + getRole: function getRole() { + return get_role_default; + }, + getRoleType: function getRoleType() { + return get_role_type_default; + }, + getRolesByType: function getRolesByType() { + return get_roles_by_type_default; + }, + getRolesWithNameFromContents: function getRolesWithNameFromContents() { + return get_roles_with_name_from_contents_default; + }, + implicitNodes: function implicitNodes() { + return implicit_nodes_default; + }, + implicitRole: function implicitRole() { + return implicit_role_default; + }, + isAccessibleRef: function isAccessibleRef() { + return is_accessible_ref_default; + }, + isAriaRoleAllowedOnElement: function isAriaRoleAllowedOnElement() { + return is_aria_role_allowed_on_element_default; + }, + isUnsupportedRole: function isUnsupportedRole() { + return is_unsupported_role_default; + }, + isValidRole: function isValidRole() { + return is_valid_role_default; + }, + label: function label() { + return label_default2; + }, + labelVirtual: function labelVirtual() { + return label_virtual_default; + }, + lookupTable: function lookupTable() { + return lookup_table_default; + }, + namedFromContents: function namedFromContents() { + return named_from_contents_default; + }, + requiredAttr: function requiredAttr() { + return required_attr_default; + }, + requiredContext: function requiredContext() { + return required_context_default; + }, + requiredOwned: function requiredOwned() { + return required_owned_default; + }, + validateAttr: function validateAttr() { + return validate_attr_default; + }, + validateAttrValue: function validateAttrValue() { + return validate_attr_value_default; + } + }); + function allowedAttr(role) { + var roleDef = standards_default.ariaRoles[role]; + var attrs = _toConsumableArray(get_global_aria_attrs_default()); + if (!roleDef) { + return attrs; + } + if (roleDef.allowedAttrs) { + attrs.push.apply(attrs, _toConsumableArray(roleDef.allowedAttrs)); + } + if (roleDef.requiredAttrs) { + attrs.push.apply(attrs, _toConsumableArray(roleDef.requiredAttrs)); + } + return attrs; } - var visible_text_nodes_default = visibleTextNodes; + var allowed_attr_default = allowedAttr; var idRefsRegex = /^idrefs?$/; function cacheIdRefs(node, idRefs, refAttrs) { if (node.hasAttribute) { @@ -13831,8 +15039,8 @@ idRefs[id] = idRefs[id] || []; idRefs[id].push(node); } - for (var _i13 = 0; _i13 < refAttrs.length; ++_i13) { - var attr = refAttrs[_i13]; + for (var _i18 = 0; _i18 < refAttrs.length; ++_i18) { + var attr = refAttrs[_i18]; var attrValue = sanitize_default(node.getAttribute(attr) || ''); if (!attrValue) { continue; @@ -13844,9 +15052,9 @@ } } } - for (var _i14 = 0; _i14 < node.childNodes.length; _i14++) { - if (node.childNodes[_i14].nodeType === 1) { - cacheIdRefs(node.childNodes[_i14], idRefs, refAttrs); + for (var _i19 = 0; _i19 < node.childNodes.length; _i19++) { + if (node.childNodes[_i19].nodeType === 1) { + cacheIdRefs(node.childNodes[_i19], idRefs, refAttrs); } } } @@ -13854,11 +15062,9 @@ node = node.actualNode || node; var root = get_root_node_default2(node); root = root.documentElement || root; - var idRefsByRoot = cache_default.get('idRefsByRoot'); - if (!idRefsByRoot) { - idRefsByRoot = new WeakMap(); - cache_default.set('idRefsByRoot', idRefsByRoot); - } + var idRefsByRoot = cache_default.get('idRefsByRoot', function() { + return new WeakMap(); + }); var idRefs = idRefsByRoot.get(root); if (!idRefs) { idRefs = {}; @@ -13872,14 +15078,6 @@ return idRefs[node.id] || []; } var get_accessible_refs_default = getAccessibleRefs; - function getRoleType(role) { - var roleDef = standards_default.ariaRoles[role]; - if (!roleDef) { - return null; - } - return roleDef.type; - } - var get_role_type_default = getRoleType; function isAriaRoleAllowedOnElement(node, role) { var vNode = node instanceof abstract_virtual_node_default ? node : get_node_from_tree_default(node); var implicitRole3 = implicit_role_default(vNode); @@ -13945,14 +15143,11 @@ } var get_roles_by_type_default = getRolesByType; function getAriaRolesSupportingNameFromContent() { - if (cache_default.get('ariaRolesNameFromContent')) { - return cache_default.get('ariaRolesNameFromContent'); - } - var contentRoles = Object.keys(standards_default.ariaRoles).filter(function(roleName) { - return standards_default.ariaRoles[roleName].nameFromContent; + return cache_default.get('ariaRolesNameFromContent', function() { + return Object.keys(standards_default.ariaRoles).filter(function(roleName) { + return standards_default.ariaRoles[roleName].nameFromContent; + }); }); - cache_default.set('ariaRolesNameFromContent', contentRoles); - return contentRoles; } var get_aria_roles_supporting_name_from_content_default = getAriaRolesSupportingNameFromContent; function getRolesWithNameFromContents() { @@ -15706,8 +16901,8 @@ nodeName: [ 'abbr', 'address', 'canvas', 'div', 'p', 'pre', 'blockquote', 'ins', 'del', 'output', 'span', 'table', 'tbody', 'thead', 'tfoot', 'td', 'em', 'strong', 'small', 's', 'cite', 'q', 'dfn', 'abbr', 'time', 'code', 'var', 'samp', 'kbd', 'sub', 'sup', 'i', 'b', 'u', 'mark', 'ruby', 'rt', 'rp', 'bdi', 'bdo', 'br', 'wbr', 'th', 'tr' ] } ]; lookupTable.evaluateRoleForElement = { - A: function A(_ref45) { - var node = _ref45.node, out = _ref45.out; + A: function A(_ref62) { + var node = _ref62.node, out = _ref62.out; if (node.namespaceURI === 'http://www.w3.org/2000/svg') { return true; } @@ -15716,19 +16911,19 @@ } return true; }, - AREA: function AREA(_ref46) { - var node = _ref46.node; + AREA: function AREA(_ref63) { + var node = _ref63.node; return !node.href; }, - BUTTON: function BUTTON(_ref47) { - var node = _ref47.node, role = _ref47.role, out = _ref47.out; + BUTTON: function BUTTON(_ref64) { + var node = _ref64.node, role = _ref64.role, out = _ref64.out; if (node.getAttribute('type') === 'menu') { return role === 'menuitem'; } return out; }, - IMG: function IMG(_ref48) { - var node = _ref48.node, role = _ref48.role, out = _ref48.out; + IMG: function IMG(_ref65) { + var node = _ref65.node, role = _ref65.role, out = _ref65.out; switch (node.alt) { case null: return out; @@ -15740,8 +16935,8 @@ return role !== 'presentation' && role !== 'none'; } }, - INPUT: function INPUT(_ref49) { - var node = _ref49.node, role = _ref49.role, out = _ref49.out; + INPUT: function INPUT(_ref66) { + var node = _ref66.node, role = _ref66.role, out = _ref66.out; switch (node.type) { case 'button': case 'image': @@ -15771,32 +16966,32 @@ return false; } }, - LI: function LI(_ref50) { - var node = _ref50.node, out = _ref50.out; + LI: function LI(_ref67) { + var node = _ref67.node, out = _ref67.out; var hasImplicitListitemRole = axe.utils.matchesSelector(node, 'ol li, ul li'); if (hasImplicitListitemRole) { return out; } return true; }, - MENU: function MENU(_ref51) { - var node = _ref51.node; + MENU: function MENU(_ref68) { + var node = _ref68.node; if (node.getAttribute('type') === 'context') { return false; } return true; }, - OPTION: function OPTION(_ref52) { - var node = _ref52.node; + OPTION: function OPTION(_ref69) { + var node = _ref69.node; var withinOptionList = axe.utils.matchesSelector(node, 'select > option, datalist > option, optgroup > option'); return !withinOptionList; }, - SELECT: function SELECT(_ref53) { - var node = _ref53.node, role = _ref53.role; + SELECT: function SELECT(_ref70) { + var node = _ref70.node, role = _ref70.role; return !node.multiple && node.size <= 1 && role === 'menu'; }, - SVG: function SVG(_ref54) { - var node = _ref54.node, out = _ref54.out; + SVG: function SVG(_ref71) { + var node = _ref71.node, out = _ref71.out; if (node.parentNode && node.parentNode.namespaceURI === 'http://www.w3.org/2000/svg') { return true; } @@ -15820,11 +17015,11 @@ return !!get_accessible_refs_default(node).length; } var is_accessible_ref_default = isAccessibleRef; - function label3(node) { + function label2(node) { node = get_node_from_tree_default(node); return label_virtual_default(node); } - var label_default2 = label3; + var label_default2 = label2; function requiredAttr(role) { var roleDef = standards_default.ariaRoles[role]; if (!roleDef || !Array.isArray(roleDef.requiredAttrs)) { @@ -15851,7 +17046,7 @@ var required_owned_default = requiredOwned; function validateAttrValue(vNode, attr) { vNode = vNode instanceof abstract_virtual_node_default ? vNode : get_node_from_tree_default(vNode); - var matches14; + var matches4; var list; var value = vNode.attr(attr); var attrInfo = standards_default.ariaAttrs[attr]; @@ -15891,8 +17086,8 @@ return value.trim() !== ''; case 'decimal': - matches14 = value.match(/^[-+]?([0-9]*)\.?([0-9]*)$/); - return !!(matches14 && (matches14[1] || matches14[2])); + matches4 = value.match(/^[-+]?([0-9]*)\.?([0-9]*)$/); + return !!(matches4 && (matches4[1] || matches4[2])); case 'int': var minValue = typeof attrInfo.minValue !== 'undefined' ? attrInfo.minValue : -Infinity; @@ -15924,18 +17119,16 @@ if (Array.isArray(options[role])) { allowed = unique_array_default(options[role].concat(allowed)); } - var tableMap = cache_default.get('aria-allowed-attr-table'); - if (!tableMap) { - tableMap = new WeakMap(); - cache_default.set('aria-allowed-attr-table', tableMap); - } + var tableMap = cache_default.get('aria-allowed-attr-table', function() { + return new WeakMap(); + }); function validateRowAttrs() { if (virtualNode.parent && role === 'row') { - var table5 = closest_default(virtualNode, 'table, [role="treegrid"], [role="table"], [role="grid"]'); - var tableRole = tableMap.get(table5); - if (table5 && !tableRole) { - tableRole = get_role_default(table5); - tableMap.set(table5, tableRole); + var table = closest_default(virtualNode, 'table, [role="treegrid"], [role="table"], [role="grid"]'); + var tableRole = tableMap.get(table); + if (table && !tableRole) { + tableRole = get_role_default(table); + tableMap.set(table, tableRole); } if ([ 'table', 'grid' ].includes(tableRole) && role === 'row') { return true; @@ -15948,9 +17141,9 @@ preChecks[attr] = validateRowAttrs; }); if (allowed) { - for (var _i15 = 0; _i15 < attrs.length; _i15++) { + for (var _i20 = 0; _i20 < attrs.length; _i20++) { var _preChecks$attrName; - var attrName = attrs[_i15]; + var attrName = attrs[_i20]; if (validate_attr_default(attrName) && (_preChecks$attrName = preChecks[attrName]) !== null && _preChecks$attrName !== void 0 && _preChecks$attrName.call(preChecks)) { invalid.push(attrName + '="' + virtualNode.attr(attrName) + '"'); } else if (validate_attr_default(attrName) && !allowed.includes(attrName)) { @@ -15960,14 +17153,13 @@ } if (invalid.length) { this.data(invalid); - if (!is_html_element_default(virtualNode) && !role && !is_focusable_default(virtualNode)) { + if (!is_html_element_default(virtualNode) && !role && !_isFocusable(virtualNode)) { return void 0; } return false; } return true; } - var aria_allowed_attr_evaluate_default = ariaAllowedAttrEvaluate; function ariaAllowedRoleEvaluate(node) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var virtualNode = arguments.length > 2 ? arguments[2] : undefined; @@ -15981,7 +17173,7 @@ var unallowedRoles = get_element_unallowed_roles_default(virtualNode, allowImplicit); if (unallowedRoles.length) { this.data(unallowedRoles); - if (!is_visible_default(virtualNode, true)) { + if (!_isVisibleToScreenReaders(virtualNode)) { return void 0; } return false; @@ -15989,6 +17181,9 @@ return true; } var aria_allowed_role_evaluate_default = ariaAllowedRoleEvaluate; + function ariaBusyEvaluate(node, options, virtualNode) { + return virtualNode.attr('aria-busy') === 'true'; + } function ariaErrormessageEvaluate(node, options, virtualNode) { options = Array.isArray(options) ? options : []; var attr = virtualNode.attr('aria-errormessage'); @@ -16013,7 +17208,7 @@ return void 0; } if (idref) { - if (!is_visible_default(idref, true)) { + if (!_isVisibleToScreenReaders(idref)) { this.data({ messageKey: 'hidden', values: token_list_default(attr2) @@ -16112,64 +17307,82 @@ function ariaRequiredAttrEvaluate(node) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var virtualNode = arguments.length > 2 ? arguments[2] : undefined; - var missing = []; - var attrs = virtualNode.attrNames; var role = get_explicit_role_default(virtualNode); - if (attrs.length) { - var required = required_attr_default(role); - var elmSpec = get_element_spec_default(virtualNode); - if (Array.isArray(options[role])) { - required = unique_array_default(options[role], required); - } - if (role && required) { - for (var _i16 = 0, l = required.length; _i16 < l; _i16++) { - var attr = required[_i16]; - if (!virtualNode.attr(attr) && !(elmSpec.implicitAttrs && typeof elmSpec.implicitAttrs[attr] !== 'undefined')) { - missing.push(attr); - } - } - } + var attrs = virtualNode.attrNames; + var requiredAttrs = required_attr_default(role); + if (Array.isArray(options[role])) { + requiredAttrs = unique_array_default(options[role], requiredAttrs); + } + if (!role || !attrs.length || !requiredAttrs.length) { + return true; } - var comboboxMissingControls = role === 'combobox' && missing.includes('aria-controls'); - if (comboboxMissingControls && (virtualNode.hasAttr('aria-owns') || virtualNode.attr('aria-expanded') !== 'true')) { - missing.splice(missing.indexOf('aria-controls', 1)); + if (isStaticSeparator(virtualNode, role) || isClosedCombobox(virtualNode, role)) { + return true; } - if (missing.length) { - this.data(missing); + var elmSpec = get_element_spec_default(virtualNode); + var missingAttrs = requiredAttrs.filter(function(requiredAttr2) { + return !virtualNode.attr(requiredAttr2) && !hasImplicitAttr(elmSpec, requiredAttr2); + }); + if (missingAttrs.length) { + this.data(missingAttrs); return false; } return true; } - var aria_required_attr_evaluate_default = ariaRequiredAttrEvaluate; + function isStaticSeparator(vNode, role) { + return role === 'separator' && !_isFocusable(vNode); + } + function hasImplicitAttr(elmSpec, attr) { + var _elmSpec$implicitAttr; + return ((_elmSpec$implicitAttr = elmSpec.implicitAttrs) === null || _elmSpec$implicitAttr === void 0 ? void 0 : _elmSpec$implicitAttr[attr]) !== void 0; + } + function isClosedCombobox(vNode, role) { + return role === 'combobox' && vNode.attr('aria-expanded') === 'false'; + } function getOwnedRoles(virtualNode, required) { var ownedRoles = []; var ownedElements = get_owned_virtual_default(virtualNode); - var _loop4 = function _loop4(_i17) { - var ownedElement = ownedElements[_i17]; + var _loop5 = function _loop5(_i21) { + var ownedElement = ownedElements[_i21]; var role = get_role_default(ownedElement, { noPresentational: true }); - if (!role || [ 'group', 'rowgroup' ].includes(role) && required.some(function(requiredRole) { + var hasGlobalAria = get_global_aria_attrs_default().some(function(attr) { + return ownedElement.hasAttr(attr); + }); + var hasGlobalAriaOrFocusable = hasGlobalAria || _isFocusable(ownedElement); + if (!role && !hasGlobalAriaOrFocusable || [ 'group', 'rowgroup' ].includes(role) && required.some(function(requiredRole) { return requiredRole === role; })) { ownedElements.push.apply(ownedElements, _toConsumableArray(ownedElement.children)); - } else if (role) { - ownedRoles.push(role); + } else if (role || hasGlobalAriaOrFocusable) { + ownedRoles.push({ + role: role, + ownedElement: ownedElement + }); } }; - for (var _i17 = 0; _i17 < ownedElements.length; _i17++) { - _loop4(_i17); + for (var _i21 = 0; _i21 < ownedElements.length; _i21++) { + _loop5(_i21); } return ownedRoles; } function missingRequiredChildren(virtualNode, role, required, ownedRoles) { - for (var _i18 = 0; _i18 < ownedRoles.length; _i18++) { - var ownedRole = ownedRoles[_i18]; - if (required.includes(ownedRole)) { + var _loop6 = function _loop6(_i22) { + var role2 = ownedRoles[_i22].role; + if (required.includes(role2)) { required = required.filter(function(requiredRole) { - return requiredRole !== ownedRole; + return requiredRole !== role2; }); - return null; + return { + v: null + }; + } + }; + for (var _i22 = 0; _i22 < ownedRoles.length; _i22++) { + var _ret2 = _loop6(_i22); + if (_typeof(_ret2) === 'object') { + return _ret2.v; } } if (required.length) { @@ -16187,6 +17400,20 @@ return true; } var ownedRoles = getOwnedRoles(virtualNode, required); + var unallowed = ownedRoles.filter(function(_ref72) { + var role2 = _ref72.role; + return !required.includes(role2); + }); + if (unallowed.length) { + this.relatedNodes(unallowed.map(function(_ref73) { + var ownedElement = _ref73.ownedElement; + return ownedElement; + })); + this.data({ + messageKey: 'unallowed' + }); + return false; + } var missing = missingRequiredChildren(virtualNode, role, required, ownedRoles); if (!missing) { return true; @@ -16206,10 +17433,15 @@ if (!reqContext) { return null; } + var allowsGroup = reqContext.includes('group'); var vNode = includeElement ? virtualNode : virtualNode.parent; while (vNode) { - var parentRole = get_role_default(vNode); - if (reqContext.includes('group') && parentRole === 'group') { + var role = get_role_default(vNode, { + noPresentational: true + }); + if (!role) { + vNode = vNode.parent; + } else if (role === 'group' && allowsGroup) { if (ownGroupRoles.includes(explicitRole2)) { reqContext.push(explicitRole2); } @@ -16217,14 +17449,11 @@ return r !== 'group'; }); vNode = vNode.parent; - continue; - } - if (reqContext.includes(parentRole)) { + } else if (reqContext.includes(role)) { return null; - } else if (parentRole && ![ 'presentation', 'none' ].includes(parentRole)) { + } else { return reqContext; } - vNode = vNode.parent; } return reqContext; } @@ -16251,8 +17480,8 @@ } var owners = getAriaOwners(node); if (owners) { - for (var _i19 = 0, l = owners.length; _i19 < l; _i19++) { - missingParents = getMissingContext(get_node_from_tree_default(owners[_i19]), ownGroupRoles, missingParents, true); + for (var _i23 = 0, l = owners.length; _i23 < l; _i23++) { + missingParents = getMissingContext(get_node_from_tree_default(owners[_i23]), ownGroupRoles, missingParents, true); if (!missingParents) { return true; } @@ -16264,7 +17493,8 @@ var aria_required_parent_evaluate_default = ariaRequiredParentEvaluate; function ariaRoledescriptionEvaluate(node) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var role = get_role_default(node); + var virtualNode = arguments.length > 2 ? arguments[2] : undefined; + var role = get_role_default(virtualNode); var supportedRoles = options.supportedRoles || []; if (supportedRoles.includes(role)) { return true; @@ -16281,11 +17511,11 @@ if (!validate_attr_default(name)) { return false; } - var unsupported4 = attribute.unsupported; - if (_typeof(unsupported4) !== 'object') { - return !!unsupported4; + var unsupported2 = attribute.unsupported; + if (_typeof(unsupported2) !== 'object') { + return !!unsupported2; } - return !matches_default3(node, unsupported4.exceptions); + return !matches_default3(node, unsupported2.exceptions); }); if (unsupportedAttrs.length) { this.data(unsupportedAttrs); @@ -16297,9 +17527,9 @@ function ariaValidAttrEvaluate(node, options, virtualNode) { options = Array.isArray(options.value) ? options.value : []; var invalid = []; - var aria48 = /^aria-/; + var aria = /^aria-/; virtualNode.attrNames.forEach(function(attr) { - if (options.indexOf(attr) === -1 && aria48.test(attr) && !validate_attr_default(attr)) { + if (options.indexOf(attr) === -1 && aria.test(attr) && !validate_attr_default(attr)) { invalid.push(attr); } }); @@ -16315,7 +17545,7 @@ var needsReview = ''; var messageKey = ''; var invalid = []; - var aria48 = /^aria-/; + var aria = /^aria-/; var skipAttrs = [ 'aria-errormessage' ]; var preChecks = { 'aria-controls': function ariaControls() { @@ -16334,19 +17564,19 @@ 'aria-describedby': function ariaDescribedby(validValue) { if (!validValue) { needsReview = 'aria-describedby="'.concat(virtualNode.attr('aria-describedby'), '"'); - messageKey = 'noId'; + messageKey = axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId'; } return; }, 'aria-labelledby': function ariaLabelledby(validValue) { if (!validValue) { needsReview = 'aria-labelledby="'.concat(virtualNode.attr('aria-labelledby'), '"'); - messageKey = 'noId'; + messageKey = axe._tree && axe._tree[0]._hasShadowRoot ? 'noIdShadow' : 'noId'; } } }; virtualNode.attrNames.forEach(function(attrName) { - if (skipAttrs.includes(attrName) || options.includes(attrName) || !aria48.test(attrName)) { + if (skipAttrs.includes(attrName) || options.includes(attrName) || !aria.test(attrName)) { return; } var validValue; @@ -16356,11 +17586,21 @@ } catch (e) { needsReview = ''.concat(attrName, '="').concat(attrValue, '"'); messageKey = 'idrefs'; + return; } if ((preChecks[attrName] ? preChecks[attrName](validValue) : true) && !validValue) { - invalid.push(''.concat(attrName, '="').concat(attrValue, '"')); + if (attrValue === '' && !isStringType(attrName)) { + needsReview = attrName; + messageKey = 'empty'; + } else { + invalid.push(''.concat(attrName, '="').concat(attrValue, '"')); + } } }); + if (invalid.length) { + this.data(invalid); + return false; + } if (needsReview) { this.data({ messageKey: messageKey, @@ -16368,13 +17608,12 @@ }); return void 0; } - if (invalid.length) { - this.data(invalid); - return false; - } return true; } - var aria_valid_attr_value_evaluate_default = ariaValidAttrValueEvaluate; + function isStringType(attrName) { + var _standards_default$ar; + return ((_standards_default$ar = standards_default.ariaAttrs[attrName]) === null || _standards_default$ar === void 0 ? void 0 : _standards_default$ar.type) === 'string'; + } function deprecatedroleEvaluate(node, options, virtualNode) { var role = get_role_default(virtualNode, { dpub: true, @@ -16407,12 +17646,6 @@ return globalAttrs.length > 0; } var has_global_aria_attribute_evaluate_default = hasGlobalAriaAttributeEvaluate; - function hasImplicitChromiumRoleMatches(node, virtualNode) { - return implicit_role_default(virtualNode, { - chromium: true - }) !== null; - } - var has_implicit_chromium_role_matches_default = hasImplicitChromiumRoleMatches; function hasWidgetRoleEvaluate(node) { var role = node.getAttribute('role'); if (role === null) { @@ -16437,7 +17670,7 @@ } var invalidrole_evaluate_default = invalidroleEvaluate; function isElementFocusableEvaluate(node, options, virtualNode) { - return is_focusable_default(virtualNode); + return _isFocusable(virtualNode); } var is_element_focusable_evaluate_default = isElementFocusableEvaluate; function noImplicitExplicitLabelEvaluate(node, options, virtualNode) { @@ -16445,28 +17678,36 @@ noImplicit: true }); this.data(role); - var label5; + var label3; var accText; try { - label5 = sanitize_default(label_text_default(virtualNode)).toLowerCase(); + label3 = sanitize_default(label_text_default(virtualNode)).toLowerCase(); accText = sanitize_default(accessible_text_virtual_default(virtualNode)).toLowerCase(); } catch (e) { return void 0; } - if (!accText && !label5) { + if (!accText && !label3) { return false; } - if (!accText && label5) { + if (!accText && label3) { return void 0; } - if (!accText.includes(label5)) { + if (!accText.includes(label3)) { return void 0; } return false; } var no_implicit_explicit_label_evaluate_default = noImplicitExplicitLabelEvaluate; function unsupportedroleEvaluate(node, options, virtualNode) { - return is_unsupported_role_default(get_role_default(virtualNode)); + var role = get_role_default(virtualNode, { + dpub: true, + fallback: true + }); + var isUnsupported = is_unsupported_role_default(role); + if (isUnsupported) { + this.data(role); + } + return isUnsupported; } var unsupportedrole_evaluate_default = unsupportedroleEvaluate; var VALID_TAG_NAMES_FOR_SCROLLABLE_REGIONS = { @@ -16495,2884 +17736,3347 @@ if (!role) { return false; } - return VALID_ROLES_FOR_SCROLLABLE_REGIONS[role] || options.roles.includes(role) || false; + return VALID_ROLES_FOR_SCROLLABLE_REGIONS[role] || options.roles.includes(role) || false; + } + function validScrollableSemanticsEvaluate(node, options) { + return validScrollableRole(node, options) || validScrollableTagName(node); + } + var valid_scrollable_semantics_evaluate_default = validScrollableSemanticsEvaluate; + var color_exports = {}; + __export(color_exports, { + Color: function Color() { + return color_default; + }, + centerPointOfRect: function centerPointOfRect() { + return center_point_of_rect_default; + }, + elementHasImage: function elementHasImage() { + return element_has_image_default; + }, + elementIsDistinct: function elementIsDistinct() { + return element_is_distinct_default; + }, + filteredRectStack: function filteredRectStack() { + return filtered_rect_stack_default; + }, + flattenColors: function flattenColors() { + return flatten_colors_default; + }, + flattenShadowColors: function flattenShadowColors() { + return _flattenShadowColors; + }, + getBackgroundColor: function getBackgroundColor() { + return _getBackgroundColor2; + }, + getBackgroundStack: function getBackgroundStack() { + return _getBackgroundStack; + }, + getContrast: function getContrast() { + return get_contrast_default; + }, + getForegroundColor: function getForegroundColor() { + return _getForegroundColor; + }, + getOwnBackgroundColor: function getOwnBackgroundColor() { + return get_own_background_color_default; + }, + getRectStack: function getRectStack() { + return get_rect_stack_default; + }, + getTextShadowColors: function getTextShadowColors() { + return get_text_shadow_colors_default; + }, + hasValidContrastRatio: function hasValidContrastRatio() { + return has_valid_contrast_ratio_default; + }, + incompleteData: function incompleteData() { + return incomplete_data_default; + } + }); + function centerPointOfRect(rect) { + if (rect.left > window.innerWidth) { + return void 0; + } + if (rect.top > window.innerHeight) { + return void 0; + } + var x = Math.min(Math.ceil(rect.left + rect.width / 2), window.innerWidth - 1); + var y = Math.min(Math.ceil(rect.top + rect.height / 2), window.innerHeight - 1); + return { + x: x, + y: y + }; + } + var center_point_of_rect_default = centerPointOfRect; + function _getFonts(style) { + return style.getPropertyValue('font-family').split(/[,;]/g).map(function(font) { + return font.trim().toLowerCase(); + }); + } + function elementIsDistinct(node, ancestorNode) { + var nodeStyle = window.getComputedStyle(node); + if (nodeStyle.getPropertyValue('background-image') !== 'none') { + return true; + } + var hasBorder = [ 'border-bottom', 'border-top', 'outline' ].reduce(function(result, edge) { + var borderClr = new color_default(); + borderClr.parseString(nodeStyle.getPropertyValue(edge + '-color')); + return result || nodeStyle.getPropertyValue(edge + '-style') !== 'none' && parseFloat(nodeStyle.getPropertyValue(edge + '-width')) > 0 && borderClr.alpha !== 0; + }, false); + if (hasBorder) { + return true; + } + var parentStyle = window.getComputedStyle(ancestorNode); + if (_getFonts(nodeStyle)[0] !== _getFonts(parentStyle)[0]) { + return true; + } + var hasStyle = [ 'text-decoration-line', 'text-decoration-style', 'font-weight', 'font-style', 'font-size' ].reduce(function(result, cssProp) { + return result || nodeStyle.getPropertyValue(cssProp) !== parentStyle.getPropertyValue(cssProp); + }, false); + var tDec = nodeStyle.getPropertyValue('text-decoration'); + if (tDec.split(' ').length < 3) { + hasStyle = hasStyle || tDec !== parentStyle.getPropertyValue('text-decoration'); + } + return hasStyle; + } + var element_is_distinct_default = elementIsDistinct; + function getRectStack2(elm) { + var boundingStack = get_element_stack_default(elm); + var filteredArr = get_text_element_stack_default(elm); + if (!filteredArr || filteredArr.length <= 1) { + return [ boundingStack ]; + } + if (filteredArr.some(function(stack) { + return stack === void 0; + })) { + return null; + } + filteredArr.splice(0, 0, boundingStack); + return filteredArr; + } + var get_rect_stack_default = getRectStack2; + function filteredRectStack(elm) { + var rectStack = get_rect_stack_default(elm); + if (rectStack && rectStack.length === 1) { + return rectStack[0]; + } + if (rectStack && rectStack.length > 1) { + var boundingStack = rectStack.shift(); + var isSame; + rectStack.forEach(function(rectList, index) { + if (index === 0) { + return; + } + var rectA = rectStack[index - 1], rectB = rectStack[index]; + isSame = rectA.every(function(element, elementIndex) { + return element === rectB[elementIndex]; + }) || boundingStack.includes(elm); + }); + if (!isSame) { + incomplete_data_default.set('bgColor', 'elmPartiallyObscuring'); + return null; + } + return rectStack[0]; + } + incomplete_data_default.set('bgColor', 'outsideViewport'); + return null; } - function validScrollableSemanticsEvaluate(node, options) { - return validScrollableRole(node, options) || validScrollableTagName(node); + var filtered_rect_stack_default = filteredRectStack; + function clamp(value, min, max) { + return Math.min(Math.max(min, value), max); } - var valid_scrollable_semantics_evaluate_default = validScrollableSemanticsEvaluate; - var table_exports = {}; - __export(table_exports, { - getAllCells: function getAllCells() { - return get_all_cells_default; + var blendFunctions = { + normal: function normal(Cb, Cs) { + return Cs; }, - getCellPosition: function getCellPosition() { - return get_cell_position_default; + multiply: function multiply(Cb, Cs) { + return Cs * Cb; }, - getHeaders: function getHeaders() { - return get_headers_default; + screen: function screen(Cb, Cs) { + return Cb + Cs - Cb * Cs; }, - getScope: function getScope() { - return get_scope_default; + overlay: function overlay(Cb, Cs) { + return this['hard-light'](Cs, Cb); }, - isColumnHeader: function isColumnHeader() { - return is_column_header_default; + darken: function darken(Cb, Cs) { + return Math.min(Cb, Cs); }, - isDataCell: function isDataCell() { - return is_data_cell_default; + lighten: function lighten(Cb, Cs) { + return Math.max(Cb, Cs); }, - isDataTable: function isDataTable() { - return is_data_table_default; + 'color-dodge': function colorDodge(Cb, Cs) { + return Cb === 0 ? 0 : Cs === 1 ? 1 : Math.min(1, Cb / (1 - Cs)); }, - isHeader: function isHeader() { - return is_header_default; + 'color-burn': function colorBurn(Cb, Cs) { + return Cb === 1 ? 1 : Cs === 0 ? 0 : 1 - Math.min(1, (1 - Cb) / Cs); }, - isRowHeader: function isRowHeader() { - return is_row_header_default; + 'hard-light': function hardLight(Cb, Cs) { + return Cs <= .5 ? this.multiply(Cb, 2 * Cs) : this.screen(Cb, 2 * Cs - 1); }, - toArray: function toArray() { - return to_grid_default; + 'soft-light': function softLight(Cb, Cs) { + if (Cs <= .5) { + return Cb - (1 - 2 * Cs) * Cb * (1 - Cb); + } else { + var D = Cb <= .25 ? ((16 * Cb - 12) * Cb + 4) * Cb : Math.sqrt(Cb); + return Cb + (2 * Cs - 1) * (D - Cb); + } }, - toGrid: function toGrid() { - return to_grid_default; + difference: function difference(Cb, Cs) { + return Math.abs(Cb - Cs); }, - traverse: function traverse() { - return traverse_default; - } - }); - function getAllCells(tableElm) { - var rowIndex, cellIndex, rowLength, cellLength; - var cells = []; - for (rowIndex = 0, rowLength = tableElm.rows.length; rowIndex < rowLength; rowIndex++) { - for (cellIndex = 0, cellLength = tableElm.rows[rowIndex].cells.length; cellIndex < cellLength; cellIndex++) { - cells.push(tableElm.rows[rowIndex].cells[cellIndex]); - } - } - return cells; - } - var get_all_cells_default = getAllCells; - function traverseForHeaders(headerType, position, tableGrid) { - var property = headerType === 'row' ? '_rowHeaders' : '_colHeaders'; - var predicate = headerType === 'row' ? is_row_header_default : is_column_header_default; - var startCell = tableGrid[position.y][position.x]; - var colspan = startCell.colSpan - 1; - var rowspanAttr = startCell.getAttribute('rowspan'); - var rowspanValue = parseInt(rowspanAttr) === 0 || startCell.rowspan === 0 ? tableGrid.length : startCell.rowSpan; - var rowspan = rowspanValue - 1; - var rowStart = position.y + rowspan; - var colStart = position.x + colspan; - var rowEnd = headerType === 'row' ? position.y : 0; - var colEnd = headerType === 'row' ? 0 : position.x; - var headers; - var cells = []; - for (var row = rowStart; row >= rowEnd && !headers; row--) { - for (var col = colStart; col >= colEnd; col--) { - var cell = tableGrid[row] ? tableGrid[row][col] : void 0; - if (!cell) { - continue; - } - var vNode = axe.utils.getNodeFromTree(cell); - if (vNode[property]) { - headers = vNode[property]; - break; - } - cells.push(cell); - } + exclusion: function exclusion(Cb, Cs) { + return Cb + Cs - 2 * Cb * Cs; } - headers = (headers || []).concat(cells.filter(predicate)); - cells.forEach(function(tableCell) { - var vNode = axe.utils.getNodeFromTree(tableCell); - vNode[property] = headers; - }); - return headers; + }; + function simpleAlphaCompositing(Cs, \u03b1s, Cb, \u03b1b, blendMode) { + return \u03b1s * (1 - \u03b1b) * Cs + \u03b1s * \u03b1b * blendFunctions[blendMode](Cb / 255, Cs / 255) * 255 + (1 - \u03b1s) * \u03b1b * Cb; } - function getHeaders(cell, tableGrid) { - if (cell.getAttribute('headers')) { - var headers = idrefs_default(cell, 'headers'); - if (headers.filter(function(header) { - return header; - }).length) { - return headers; - } - } - if (!tableGrid) { - tableGrid = to_grid_default(find_up_default(cell, 'table')); + function flattenColors(fgColor, bgColor) { + var blendMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'normal'; + var r = simpleAlphaCompositing(fgColor.red, fgColor.alpha, bgColor.red, bgColor.alpha, blendMode); + var g = simpleAlphaCompositing(fgColor.green, fgColor.alpha, bgColor.green, bgColor.alpha, blendMode); + var b = simpleAlphaCompositing(fgColor.blue, fgColor.alpha, bgColor.blue, bgColor.alpha, blendMode); + var \u03b1o = clamp(fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha), 0, 1); + if (\u03b1o === 0) { + return new color_default(r, g, b, \u03b1o); } - var position = get_cell_position_default(cell, tableGrid); - var rowHeaders = traverseForHeaders('row', position, tableGrid); - var colHeaders = traverseForHeaders('col', position, tableGrid); - return [].concat(rowHeaders, colHeaders).reverse(); + var Cr = Math.round(r / \u03b1o); + var Cg = Math.round(g / \u03b1o); + var Cb = Math.round(b / \u03b1o); + return new color_default(Cr, Cg, Cb, \u03b1o); } - var get_headers_default = getHeaders; - function isDataCell(cell) { - if (!cell.children.length && !cell.textContent.trim()) { - return false; - } - var role = cell.getAttribute('role'); - if (is_valid_role_default(role)) { - return [ 'cell', 'gridcell' ].includes(role); - } else { - return cell.nodeName.toUpperCase() === 'TD'; - } + var flatten_colors_default = flattenColors; + function _flattenShadowColors(fgColor, bgColor) { + var alpha = fgColor.alpha; + var r = (1 - alpha) * bgColor.red + alpha * fgColor.red; + var g = (1 - alpha) * bgColor.green + alpha * fgColor.green; + var b = (1 - alpha) * bgColor.blue + alpha * fgColor.blue; + var a = fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha); + return new color_default(r, g, b, a); } - var is_data_cell_default = isDataCell; - function isDataTable(node) { - var role = (node.getAttribute('role') || '').toLowerCase(); - if ((role === 'presentation' || role === 'none') && !is_focusable_default(node)) { - return false; - } - if (node.getAttribute('contenteditable') === 'true' || find_up_default(node, '[contenteditable="true"]')) { - return true; - } - if (role === 'grid' || role === 'treegrid' || role === 'table') { - return true; - } - if (get_role_type_default(role) === 'landmark') { - return true; - } - if (node.getAttribute('datatable') === '0') { - return false; - } - if (node.getAttribute('summary')) { - return true; - } - if (node.tHead || node.tFoot || node.caption) { - return true; - } - for (var childIndex = 0, childLength = node.children.length; childIndex < childLength; childIndex++) { - if (node.children[childIndex].nodeName.toUpperCase() === 'COLGROUP') { - return true; + function _getBackgroundStack(node) { + var stacks = get_text_element_stack_default(node).map(function(stack) { + stack = reduce_to_elements_below_floating_default(stack, node); + stack = sortPageBackground(stack); + return stack; + }); + for (var index = 0; index < stacks.length; index++) { + var stack = stacks[index]; + if (stack[0] !== node) { + incomplete_data_default.set('bgColor', 'bgOverlap'); + return null; } - } - var cells = 0; - var rowLength = node.rows.length; - var row, cell; - var hasBorder = false; - for (var rowIndex = 0; rowIndex < rowLength; rowIndex++) { - row = node.rows[rowIndex]; - for (var cellIndex = 0, cellLength = row.cells.length; cellIndex < cellLength; cellIndex++) { - cell = row.cells[cellIndex]; - if (cell.nodeName.toUpperCase() === 'TH') { - return true; - } - if (!hasBorder && (cell.offsetWidth !== cell.clientWidth || cell.offsetHeight !== cell.clientHeight)) { - hasBorder = true; - } - if (cell.getAttribute('scope') || cell.getAttribute('headers') || cell.getAttribute('abbr')) { - return true; - } - if ([ 'columnheader', 'rowheader' ].includes((cell.getAttribute('role') || '').toLowerCase())) { - return true; - } - if (cell.children.length === 1 && cell.children[0].nodeName.toUpperCase() === 'ABBR') { - return true; - } - cells++; + if (index !== 0 && !shallowArraysEqual(stack, stacks[0])) { + incomplete_data_default.set('bgColor', 'elmPartiallyObscuring'); + return null; } } - if (node.getElementsByTagName('table').length) { - return false; - } - if (rowLength < 2) { - return false; - } - var sampleRow = node.rows[Math.ceil(rowLength / 2)]; - if (sampleRow.cells.length === 1 && sampleRow.cells[0].colSpan === 1) { - return false; - } - if (sampleRow.cells.length >= 5) { - return true; - } - if (hasBorder) { - return true; - } - var bgColor, bgImage; - for (rowIndex = 0; rowIndex < rowLength; rowIndex++) { - row = node.rows[rowIndex]; - if (bgColor && bgColor !== window.getComputedStyle(row).getPropertyValue('background-color')) { - return true; - } else { - bgColor = window.getComputedStyle(row).getPropertyValue('background-color'); + return stacks[0] || null; + } + function sortPageBackground(elmStack) { + var bodyIndex = elmStack.indexOf(document.body); + var bgNodes = elmStack; + var htmlBgColor = get_own_background_color_default(window.getComputedStyle(document.documentElement)); + if (bodyIndex > 1 && htmlBgColor.alpha === 0 && !element_has_image_default(document.documentElement)) { + if (bodyIndex > 1) { + bgNodes.splice(bodyIndex, 1); + bgNodes.push(document.body); } - if (bgImage && bgImage !== window.getComputedStyle(row).getPropertyValue('background-image')) { - return true; - } else { - bgImage = window.getComputedStyle(row).getPropertyValue('background-image'); + var htmlIndex = bgNodes.indexOf(document.documentElement); + if (htmlIndex > 0) { + bgNodes.splice(htmlIndex, 1); + bgNodes.push(document.documentElement); } } - if (rowLength >= 20) { + return bgNodes; + } + function shallowArraysEqual(a, b) { + if (a === b) { return true; } - if (get_element_coordinates_default(node).width > get_viewport_size_default(window).width * .95) { + if (a === null || b === null) { return false; } - if (cells < 10) { + if (a.length !== b.length) { return false; } - if (node.querySelector('object, embed, iframe, applet')) { - return false; + for (var i = 0; i < a.length; ++i) { + if (a[i] !== b[i]) { + return false; + } } return true; } - var is_data_table_default = isDataTable; - function isHeader(cell) { - if (is_column_header_default(cell) || is_row_header_default(cell)) { - return true; - } - if (cell.getAttribute('id')) { - var id = escape_selector_default(cell.getAttribute('id')); - return !!document.querySelector('[headers~="'.concat(id, '"]')); - } - return false; - } - var is_header_default = isHeader; - function traverseTable(dir, position, tableGrid, callback) { - var result; - var cell = tableGrid[position.y] ? tableGrid[position.y][position.x] : void 0; - if (!cell) { + function getTextShadowColors(node) { + var _ref74 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, minRatio = _ref74.minRatio, maxRatio = _ref74.maxRatio; + var style = window.getComputedStyle(node); + var textShadow = style.getPropertyValue('text-shadow'); + if (textShadow === 'none') { return []; } - if (typeof callback === 'function') { - result = callback(cell, position, tableGrid); - if (result === true) { - return [ cell ]; + var fontSizeStr = style.getPropertyValue('font-size'); + var fontSize = parseInt(fontSizeStr); + assert_default(isNaN(fontSize) === false, 'Unable to determine font-size value '.concat(fontSizeStr)); + var shadowColors = []; + var shadows = parseTextShadows(textShadow); + shadows.forEach(function(_ref75) { + var colorStr = _ref75.colorStr, pixels = _ref75.pixels; + colorStr = colorStr || style.getPropertyValue('color'); + var _pixels = _slicedToArray(pixels, 3), offsetY = _pixels[0], offsetX = _pixels[1], _pixels$ = _pixels[2], blurRadius = _pixels$ === void 0 ? 0 : _pixels$; + if ((!minRatio || blurRadius >= fontSize * minRatio) && (!maxRatio || blurRadius < fontSize * maxRatio)) { + var color = textShadowColor({ + colorStr: colorStr, + offsetY: offsetY, + offsetX: offsetX, + blurRadius: blurRadius, + fontSize: fontSize + }); + shadowColors.push(color); } - } - result = traverseTable(dir, { - x: position.x + dir.x, - y: position.y + dir.y - }, tableGrid, callback); - result.unshift(cell); - return result; + }); + return shadowColors; } - function traverse(dir, startPos, tableGrid, callback) { - if (Array.isArray(startPos)) { - callback = tableGrid; - tableGrid = startPos; - startPos = { - x: 0, - y: 0 - }; + function parseTextShadows(textShadow) { + var current = { + pixels: [] + }; + var str = textShadow.trim(); + var shadows = [ current ]; + if (!str) { + return []; } - if (typeof dir === 'string') { - switch (dir) { - case 'left': - dir = { - x: -1, - y: 0 - }; - break; - - case 'up': - dir = { - x: 0, - y: -1 - }; - break; - - case 'right': - dir = { - x: 1, - y: 0 - }; - break; - - case 'down': - dir = { - x: 0, - y: 1 + while (str) { + var colorMatch = str.match(/^rgba?\([0-9,.\s]+\)/i) || str.match(/^[a-z]+/i) || str.match(/^#[0-9a-f]+/i); + var pixelMatch = str.match(/^([0-9.-]+)px/i) || str.match(/^(0)/); + if (colorMatch) { + assert_default(!current.colorStr, 'Multiple colors identified in text-shadow: '.concat(textShadow)); + str = str.replace(colorMatch[0], '').trim(); + current.colorStr = colorMatch[0]; + } else if (pixelMatch) { + assert_default(current.pixels.length < 3, 'Too many pixel units in text-shadow: '.concat(textShadow)); + str = str.replace(pixelMatch[0], '').trim(); + var pixelUnit = parseFloat((pixelMatch[1][0] === '.' ? '0' : '') + pixelMatch[1]); + current.pixels.push(pixelUnit); + } else if (str[0] === ',') { + assert_default(current.pixels.length >= 2, 'Missing pixel value in text-shadow: '.concat(textShadow)); + current = { + pixels: [] }; - break; + shadows.push(current); + str = str.substr(1).trim(); + } else { + throw new Error('Unable to process text-shadows: '.concat(textShadow)); } } - return traverseTable(dir, { - x: startPos.x + dir.x, - y: startPos.y + dir.y - }, tableGrid, callback); + return shadows; } - var traverse_default = traverse; - function captionFakedEvaluate(node) { - var table5 = to_grid_default(node); - var firstRow = table5[0]; - if (table5.length <= 1 || firstRow.length <= 1 || node.rows.length <= 1) { - return true; + function textShadowColor(_ref76) { + var colorStr = _ref76.colorStr, offsetX = _ref76.offsetX, offsetY = _ref76.offsetY, blurRadius = _ref76.blurRadius, fontSize = _ref76.fontSize; + if (offsetX > blurRadius || offsetY > blurRadius) { + return new color_default(0, 0, 0, 0); } - return firstRow.reduce(function(out, curr, i) { - return out || curr !== firstRow[i + 1] && firstRow[i + 1] !== void 0; - }, false); + var shadowColor = new color_default(); + shadowColor.parseString(colorStr); + shadowColor.alpha *= blurRadiusToAlpha(blurRadius, fontSize); + return shadowColor; } - var caption_faked_evaluate_default = captionFakedEvaluate; - function html5ScopeEvaluate(node) { - if (!is_html5_default(document)) { - return true; + function blurRadiusToAlpha(blurRadius, fontSize) { + if (blurRadius === 0) { + return 1; } - return node.nodeName.toUpperCase() === 'TH'; - } - var html5_scope_evaluate_default = html5ScopeEvaluate; - function sameCaptionSummaryEvaluate(node) { - return !!(node.summary && node.caption) && node.summary.toLowerCase() === accessible_text_default(node.caption).toLowerCase(); - } - var same_caption_summary_evaluate_default = sameCaptionSummaryEvaluate; - function scopeValueEvaluate(node, options) { - var value = node.getAttribute('scope').toLowerCase(); - return options.values.indexOf(value) !== -1; + var relativeBlur = blurRadius / fontSize; + return .185 / (relativeBlur + .4); } - var scope_value_evaluate_default = scopeValueEvaluate; - function tdHasHeaderEvaluate(node) { - var badCells = []; - var cells = get_all_cells_default(node); - var tableGrid = to_grid_default(node); - cells.forEach(function(cell) { - if (has_content_default(cell) && is_data_cell_default(cell) && !label_default2(cell)) { - var hasHeaders = get_headers_default(cell, tableGrid).some(function(header) { - return header !== null && !!has_content_default(header); - }); - if (!hasHeaders) { - badCells.push(cell); - } - } - }); - if (badCells.length) { - this.relatedNodes(badCells); - return false; - } - return true; + var get_text_shadow_colors_default = getTextShadowColors; + function _getBackgroundColor2(elm) { + var bgElms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; + var shadowOutlineEmMax = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .1; + var vNode = get_node_from_tree_default(elm); + var bgColorCache = vNode._cache.getBackgroundColor; + if (bgColorCache) { + bgElms.push.apply(bgElms, _toConsumableArray(bgColorCache.bgElms)); + incomplete_data_default.set('bgColor', bgColorCache.incompleteData); + return bgColorCache.bgColor; + } + var bgColor = _getBackgroundColor(elm, bgElms, shadowOutlineEmMax); + vNode._cache.getBackgroundColor = { + bgColor: bgColor, + bgElms: bgElms, + incompleteData: incomplete_data_default.get('bgColor') + }; + return bgColor; } - var td_has_header_evaluate_default = tdHasHeaderEvaluate; - function tdHeadersAttrEvaluate(node) { - var cells = []; - var reviewCells = []; - var badCells = []; - for (var rowIndex = 0; rowIndex < node.rows.length; rowIndex++) { - var row = node.rows[rowIndex]; - for (var cellIndex = 0; cellIndex < row.cells.length; cellIndex++) { - cells.push(row.cells[cellIndex]); - } - } - var ids = cells.reduce(function(ids2, cell) { - if (cell.getAttribute('id')) { - ids2.push(cell.getAttribute('id')); - } - return ids2; - }, []); - cells.forEach(function(cell) { - var isSelf = false; - var notOfTable = false; - if (!cell.hasAttribute('headers')) { - return; - } - var headersAttr = cell.getAttribute('headers').trim(); - if (!headersAttr) { - return reviewCells.push(cell); - } - var headers = token_list_default(headersAttr); - if (headers.length !== 0) { - if (cell.getAttribute('id')) { - isSelf = headers.indexOf(cell.getAttribute('id').trim()) !== -1; - } - notOfTable = headers.some(function(header) { - return !ids.includes(header); - }); - if (isSelf || notOfTable) { - badCells.push(cell); - } - } + function _getBackgroundColor(elm, bgElms, shadowOutlineEmMax) { + var _bgColors; + var bgColors = get_text_shadow_colors_default(elm, { + minRatio: shadowOutlineEmMax }); - if (badCells.length > 0) { - this.relatedNodes(badCells); - return false; - } - if (reviewCells.length) { - this.relatedNodes(reviewCells); - return void 0; + if (bgColors.length) { + bgColors = [ { + color: bgColors.reduce(_flattenShadowColors) + } ]; } - return true; - } - var td_headers_attr_evaluate_default = tdHeadersAttrEvaluate; - function thHasDataCellsEvaluate(node) { - var cells = get_all_cells_default(node); - var checkResult = this; - var reffedHeaders = []; - cells.forEach(function(cell) { - var headers2 = cell.getAttribute('headers'); - if (headers2) { - reffedHeaders = reffedHeaders.concat(headers2.split(/\s+/)); - } - var ariaLabel = cell.getAttribute('aria-labelledby'); - if (ariaLabel) { - reffedHeaders = reffedHeaders.concat(ariaLabel.split(/\s+/)); - } - }); - var headers = cells.filter(function(cell) { - if (sanitize_default(cell.textContent) === '') { + var elmStack = _getBackgroundStack(elm); + var textRects = get_visible_child_text_rects_default(elm); + (elmStack || []).some(function(bgElm) { + var bgElmStyle = window.getComputedStyle(bgElm); + if (element_has_image_default(bgElm, bgElmStyle)) { + bgColors = null; + bgElms.push(bgElm); + return true; + } + var bgColor = get_own_background_color_default(bgElmStyle); + if (bgColor.alpha === 0) { return false; } - return cell.nodeName.toUpperCase() === 'TH' || [ 'rowheader', 'columnheader' ].indexOf(cell.getAttribute('role')) !== -1; - }); - var tableGrid = to_grid_default(node); - var out = true; - headers.forEach(function(header) { - if (header.getAttribute('id') && reffedHeaders.includes(header.getAttribute('id'))) { - return; + if (bgElmStyle.getPropertyValue('display') !== 'inline' && !fullyEncompasses(bgElm, textRects)) { + bgColors = null; + bgElms.push(bgElm); + incomplete_data_default.set('bgColor', 'elmPartiallyObscured'); + return true; } - var pos = get_cell_position_default(header, tableGrid); - var hasCell = false; - if (is_column_header_default(header)) { - hasCell = traverse_default('down', pos, tableGrid).find(function(cell) { - return !is_column_header_default(cell) && get_headers_default(cell, tableGrid).includes(header); + bgElms.push(bgElm); + var blendMode = bgElmStyle.getPropertyValue('mix-blend-mode'); + bgColors.unshift({ + color: bgColor, + blendMode: normalizeBlendMode(blendMode) + }); + return bgColor.alpha === 1; + }); + if (bgColors === null || elmStack === null) { + return null; + } + var pageBgs = getPageBackgroundColors(elm, elmStack.includes(document.body)); + (_bgColors = bgColors).unshift.apply(_bgColors, _toConsumableArray(pageBgs)); + if (bgColors.length === 0) { + return new color_default(255, 255, 255, 1); + } + var blendedColor = bgColors.reduce(function(bgColor, fgColor) { + return flatten_colors_default(fgColor.color, bgColor.color instanceof color_default ? bgColor.color : bgColor, fgColor.blendMode); + }); + return flatten_colors_default(blendedColor.color instanceof color_default ? blendedColor.color : blendedColor, new color_default(255, 255, 255, 1)); + } + function fullyEncompasses(node, rects) { + rects = Array.isArray(rects) ? rects : [ rects ]; + var nodeRect = node.getBoundingClientRect(); + var right = nodeRect.right, bottom = nodeRect.bottom; + var style = window.getComputedStyle(node); + var overflow = style.getPropertyValue('overflow'); + if ([ 'scroll', 'auto' ].includes(overflow) || node instanceof window.HTMLHtmlElement) { + right = nodeRect.left + node.scrollWidth; + bottom = nodeRect.top + node.scrollHeight; + } + return rects.every(function(rect) { + return rect.top >= nodeRect.top && rect.bottom <= bottom && rect.left >= nodeRect.left && rect.right <= right; + }); + } + function normalizeBlendMode(blendmode) { + return !!blendmode ? blendmode : void 0; + } + function getPageBackgroundColors(elm, stackContainsBody) { + var pageColors = []; + if (!stackContainsBody) { + var html = document.documentElement; + var body = document.body; + var htmlStyle = window.getComputedStyle(html); + var bodyStyle = window.getComputedStyle(body); + var htmlBgColor = get_own_background_color_default(htmlStyle); + var bodyBgColor = get_own_background_color_default(bodyStyle); + var bodyBgColorApplies = bodyBgColor.alpha !== 0 && fullyEncompasses(body, elm.getBoundingClientRect()); + if (bodyBgColor.alpha !== 0 && htmlBgColor.alpha === 0 || bodyBgColorApplies && bodyBgColor.alpha !== 1) { + pageColors.unshift({ + color: bodyBgColor, + blendMode: normalizeBlendMode(bodyStyle.getPropertyValue('mix-blend-mode')) }); } - if (!hasCell && is_row_header_default(header)) { - hasCell = traverse_default('right', pos, tableGrid).find(function(cell) { - return !is_row_header_default(cell) && get_headers_default(cell, tableGrid).includes(header); + if (htmlBgColor.alpha !== 0 && (!bodyBgColorApplies || bodyBgColorApplies && bodyBgColor.alpha !== 1)) { + pageColors.unshift({ + color: htmlBgColor, + blendMode: normalizeBlendMode(htmlStyle.getPropertyValue('mix-blend-mode')) }); } - if (!hasCell) { - checkResult.relatedNodes(header); - } - out = out && hasCell; + } + return pageColors; + } + function getContrast(bgColor, fgColor) { + if (!fgColor || !bgColor) { + return null; + } + if (fgColor.alpha < 1) { + fgColor = flatten_colors_default(fgColor, bgColor); + } + var bL = bgColor.getRelativeLuminance(); + var fL = fgColor.getRelativeLuminance(); + return (Math.max(fL, bL) + .05) / (Math.min(fL, bL) + .05); + } + var get_contrast_default = getContrast; + function _getForegroundColor(node, _, bgColor) { + var _bgColor; + var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + var nodeStyle = window.getComputedStyle(node); + var opacity = getOpacity(node, nodeStyle); + var strokeColor = getStrokeColor(nodeStyle, options); + if (strokeColor && strokeColor.alpha * opacity === 1) { + strokeColor.alpha = 1; + return strokeColor; + } + var textColor = getTextColor(nodeStyle); + var fgColor = strokeColor ? flatten_colors_default(strokeColor, textColor) : textColor; + if (fgColor.alpha * opacity === 1) { + fgColor.alpha = 1; + return fgColor; + } + var textShadowColors = get_text_shadow_colors_default(node, { + minRatio: 0 }); - return out ? true : void 0; + fgColor = textShadowColors.reduce(function(colorA, colorB) { + return flatten_colors_default(colorA, colorB); + }, fgColor); + if (fgColor.alpha * opacity === 1) { + fgColor.alpha = 1; + return fgColor; + } + (_bgColor = bgColor) !== null && _bgColor !== void 0 ? _bgColor : bgColor = _getBackgroundColor2(node, []); + if (bgColor === null) { + var reason = incomplete_data_default.get('bgColor'); + incomplete_data_default.set('fgColor', reason); + return null; + } + fgColor.alpha = fgColor.alpha * opacity; + return flatten_colors_default(fgColor, bgColor); } - var th_has_data_cells_evaluate_default = thHasDataCellsEvaluate; - function hiddenContentEvaluate(node, options, virtualNode) { - var allowlist = [ 'SCRIPT', 'HEAD', 'TITLE', 'NOSCRIPT', 'STYLE', 'TEMPLATE' ]; - if (!allowlist.includes(node.nodeName.toUpperCase()) && has_content_virtual_default(virtualNode)) { - var styles = window.getComputedStyle(node); - if (styles.getPropertyValue('display') === 'none') { - return void 0; - } else if (styles.getPropertyValue('visibility') === 'hidden') { - var parent = get_composed_parent_default(node); - var parentStyle = parent && window.getComputedStyle(parent); - if (!parentStyle || parentStyle.getPropertyValue('visibility') !== 'hidden') { - return void 0; - } - } + function getTextColor(nodeStyle) { + return new color_default().parseString(nodeStyle.getPropertyValue('-webkit-text-fill-color') || nodeStyle.getPropertyValue('color')); + } + function getStrokeColor(nodeStyle, _ref77) { + var _ref77$textStrokeEmMi = _ref77.textStrokeEmMin, textStrokeEmMin = _ref77$textStrokeEmMi === void 0 ? 0 : _ref77$textStrokeEmMi; + var strokeWidth = parseFloat(nodeStyle.getPropertyValue('-webkit-text-stroke-width')); + if (strokeWidth === 0) { + return null; } - return true; + var fontSize = nodeStyle.getPropertyValue('font-size'); + var relativeStrokeWidth = strokeWidth / parseFloat(fontSize); + if (isNaN(relativeStrokeWidth) || relativeStrokeWidth < textStrokeEmMin) { + return null; + } + var strokeColor = nodeStyle.getPropertyValue('-webkit-text-stroke-color'); + return new color_default().parseString(strokeColor); } - var hidden_content_evaluate_default = hiddenContentEvaluate; - var color_exports = {}; - __export(color_exports, { - Color: function Color() { - return color_default; - }, - centerPointOfRect: function centerPointOfRect() { - return center_point_of_rect_default; - }, - elementHasImage: function elementHasImage() { - return element_has_image_default; - }, - elementIsDistinct: function elementIsDistinct() { - return element_is_distinct_default; - }, - filteredRectStack: function filteredRectStack() { - return filtered_rect_stack_default; - }, - flattenColors: function flattenColors() { - return flatten_colors_default; - }, - flattenShadowColors: function flattenShadowColors() { - return flatten_shadow_colors_default; - }, - getBackgroundColor: function getBackgroundColor() { - return _getBackgroundColor; - }, - getBackgroundStack: function getBackgroundStack() { - return get_background_stack_default; - }, - getContrast: function getContrast() { - return get_contrast_default; - }, - getForegroundColor: function getForegroundColor() { - return get_foreground_color_default; - }, - getOwnBackgroundColor: function getOwnBackgroundColor() { - return get_own_background_color_default; - }, - getRectStack: function getRectStack() { - return get_rect_stack_default; - }, - getTextShadowColors: function getTextShadowColors() { - return get_text_shadow_colors_default; - }, - hasValidContrastRatio: function hasValidContrastRatio() { - return has_valid_contrast_ratio_default; - }, - incompleteData: function incompleteData() { - return incomplete_data_default; + function getOpacity(node, nodeStyle) { + var _nodeStyle; + if (!node) { + return 1; } - }); - function centerPointOfRect(rect) { - if (rect.left > window.innerWidth) { + var vNode = get_node_from_tree_default(node); + if (vNode && vNode._opacity !== void 0 && vNode._opacity !== null) { + return vNode._opacity; + } + (_nodeStyle = nodeStyle) !== null && _nodeStyle !== void 0 ? _nodeStyle : nodeStyle = window.getComputedStyle(node); + var opacity = nodeStyle.getPropertyValue('opacity'); + var finalOpacity = opacity * getOpacity(node.parentElement); + if (vNode) { + vNode._opacity = finalOpacity; + } + return finalOpacity; + } + function hasValidContrastRatio(bg, fg, fontSize, isBold) { + var contrast = get_contrast_default(bg, fg); + var isSmallFont = isBold && Math.ceil(fontSize * 72) / 96 < 14 || !isBold && Math.ceil(fontSize * 72) / 96 < 18; + var expectedContrastRatio = isSmallFont ? 4.5 : 3; + return { + isValid: contrast > expectedContrastRatio, + contrastRatio: contrast, + expectedContrastRatio: expectedContrastRatio + }; + } + var has_valid_contrast_ratio_default = hasValidContrastRatio; + function colorContrastEvaluate(node, options, virtualNode) { + var ignoreUnicode = options.ignoreUnicode, ignoreLength = options.ignoreLength, ignorePseudo = options.ignorePseudo, boldValue = options.boldValue, boldTextPt = options.boldTextPt, largeTextPt = options.largeTextPt, contrastRatio = options.contrastRatio, shadowOutlineEmMax = options.shadowOutlineEmMax, pseudoSizeThreshold = options.pseudoSizeThreshold; + if (!_isVisibleOnScreen(node)) { + this.data({ + messageKey: 'hidden' + }); + return true; + } + var visibleText = visible_virtual_default(virtualNode, false, true); + if (ignoreUnicode && textIsEmojis(visibleText)) { + this.data({ + messageKey: 'nonBmp' + }); + return void 0; + } + var nodeStyle = window.getComputedStyle(node); + var fontSize = parseFloat(nodeStyle.getPropertyValue('font-size')); + var fontWeight = nodeStyle.getPropertyValue('font-weight'); + var bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold'; + var ptSize = Math.ceil(fontSize * 72) / 96; + var isSmallFont = bold && ptSize < boldTextPt || !bold && ptSize < largeTextPt; + var _ref78 = isSmallFont ? contrastRatio.normal : contrastRatio.large, expected = _ref78.expected, minThreshold = _ref78.minThreshold, maxThreshold = _ref78.maxThreshold; + var pseudoElm = findPseudoElement(virtualNode, { + ignorePseudo: ignorePseudo, + pseudoSizeThreshold: pseudoSizeThreshold + }); + if (pseudoElm) { + this.data({ + fontSize: ''.concat((fontSize * 72 / 96).toFixed(1), 'pt (').concat(fontSize, 'px)'), + fontWeight: bold ? 'bold' : 'normal', + messageKey: 'pseudoContent', + expectedContrastRatio: expected + ':1' + }); + this.relatedNodes(pseudoElm.actualNode); + return void 0; + } + var bgNodes = []; + var bgColor = _getBackgroundColor2(node, bgNodes, shadowOutlineEmMax); + var fgColor = _getForegroundColor(node, false, bgColor, options); + var shadowColors = get_text_shadow_colors_default(node, { + minRatio: .001, + maxRatio: shadowOutlineEmMax + }); + var contrast = null; + var contrastContributor = null; + var shadowColor = null; + if (shadowColors.length === 0) { + contrast = get_contrast_default(bgColor, fgColor); + } else if (fgColor && bgColor) { + shadowColor = [].concat(_toConsumableArray(shadowColors), [ bgColor ]).reduce(_flattenShadowColors); + var fgBgContrast = get_contrast_default(bgColor, fgColor); + var bgShContrast = get_contrast_default(bgColor, shadowColor); + var fgShContrast = get_contrast_default(shadowColor, fgColor); + contrast = Math.max(fgBgContrast, bgShContrast, fgShContrast); + if (contrast !== fgBgContrast) { + contrastContributor = bgShContrast > fgShContrast ? 'shadowOnBgColor' : 'fgOnShadowColor'; + } + } + var isValid = contrast > expected; + if (typeof minThreshold === 'number' && (typeof contrast !== 'number' || contrast < minThreshold) || typeof maxThreshold === 'number' && (typeof contrast !== 'number' || contrast > maxThreshold)) { + this.data({ + contrastRatio: contrast + }); + return true; + } + var truncatedResult = Math.floor(contrast * 100) / 100; + var missing; + if (bgColor === null) { + missing = incomplete_data_default.get('bgColor'); + } else if (!isValid) { + missing = contrastContributor; + } + var equalRatio = truncatedResult === 1; + var shortTextContent = visibleText.length === 1; + if (equalRatio) { + missing = incomplete_data_default.set('bgColor', 'equalRatio'); + } else if (!isValid && shortTextContent && !ignoreLength) { + missing = 'shortTextContent'; + } + this.data({ + fgColor: fgColor ? fgColor.toHexString() : void 0, + bgColor: bgColor ? bgColor.toHexString() : void 0, + contrastRatio: truncatedResult, + fontSize: ''.concat((fontSize * 72 / 96).toFixed(1), 'pt (').concat(fontSize, 'px)'), + fontWeight: bold ? 'bold' : 'normal', + messageKey: missing, + expectedContrastRatio: expected + ':1', + shadowColor: shadowColor ? shadowColor.toHexString() : void 0 + }); + if (fgColor === null || bgColor === null || equalRatio || shortTextContent && !ignoreLength && !isValid) { + missing = null; + incomplete_data_default.clear(); + this.relatedNodes(bgNodes); return void 0; } - if (rect.top > window.innerHeight) { - return void 0; + if (!isValid) { + this.relatedNodes(bgNodes); } - var x = Math.min(Math.ceil(rect.left + rect.width / 2), window.innerWidth - 1); - var y = Math.min(Math.ceil(rect.top + rect.height / 2), window.innerHeight - 1); + return isValid; + } + function findPseudoElement(vNode, _ref79) { + var _ref79$pseudoSizeThre = _ref79.pseudoSizeThreshold, pseudoSizeThreshold = _ref79$pseudoSizeThre === void 0 ? .25 : _ref79$pseudoSizeThre, _ref79$ignorePseudo = _ref79.ignorePseudo, ignorePseudo = _ref79$ignorePseudo === void 0 ? false : _ref79$ignorePseudo; + if (ignorePseudo) { + return; + } + var rect = vNode.boundingClientRect; + var minimumSize = rect.width * rect.height * pseudoSizeThreshold; + do { + var beforeSize = getPseudoElementArea(vNode.actualNode, ':before'); + var afterSize = getPseudoElementArea(vNode.actualNode, ':after'); + if (beforeSize + afterSize > minimumSize) { + return vNode; + } + } while (vNode = vNode.parent); + } + var getPseudoElementArea = memoize_default(function getPseudoElementArea2(node, pseudo) { + var style = window.getComputedStyle(node, pseudo); + var matchPseudoStyle = function matchPseudoStyle(prop, value) { + return style.getPropertyValue(prop) === value; + }; + if (matchPseudoStyle('content', 'none') || matchPseudoStyle('display', 'none') || matchPseudoStyle('visibility', 'hidden') || matchPseudoStyle('position', 'absolute') === false) { + return 0; + } + if (get_own_background_color_default(style).alpha === 0 && matchPseudoStyle('background-image', 'none')) { + return 0; + } + var pseudoWidth = parseUnit(style.getPropertyValue('width')); + var pseudoHeight = parseUnit(style.getPropertyValue('height')); + if (pseudoWidth.unit !== 'px' || pseudoHeight.unit !== 'px') { + return pseudoWidth.value === 0 || pseudoHeight.value === 0 ? 0 : Infinity; + } + return pseudoWidth.value * pseudoHeight.value; + }); + function textIsEmojis(visibleText) { + var options = { + nonBmp: true + }; + var hasUnicodeChars = has_unicode_default(visibleText, options); + var hasNonUnicodeChars = sanitize_default(remove_unicode_default(visibleText, options)) === ''; + return hasUnicodeChars && hasNonUnicodeChars; + } + function parseUnit(str) { + var unitRegex = /^([0-9.]+)([a-z]+)$/i; + var _ref80 = str.match(unitRegex) || [], _ref81 = _slicedToArray(_ref80, 3), _ref81$ = _ref81[1], value = _ref81$ === void 0 ? '' : _ref81$, _ref81$2 = _ref81[2], unit = _ref81$2 === void 0 ? '' : _ref81$2; return { - x: x, - y: y + value: parseFloat(value), + unit: unit.toLowerCase() }; } - var center_point_of_rect_default = centerPointOfRect; - function _getFonts(style) { - return style.getPropertyValue('font-family').split(/[,;]/g).map(function(font) { - return font.trim().toLowerCase(); - }); + function getContrast2(color1, color2) { + var c1lum = color1.getRelativeLuminance(); + var c2lum = color2.getRelativeLuminance(); + return (Math.max(c1lum, c2lum) + .05) / (Math.min(c1lum, c2lum) + .05); } - function elementIsDistinct(node, ancestorNode) { - var nodeStyle = window.getComputedStyle(node); - if (nodeStyle.getPropertyValue('background-image') !== 'none') { + var blockLike2 = [ 'block', 'list-item', 'table', 'flex', 'grid', 'inline-block' ]; + function isBlock2(elm) { + var display = window.getComputedStyle(elm).getPropertyValue('display'); + return blockLike2.indexOf(display) !== -1 || display.substr(0, 6) === 'table-'; + } + function linkInTextBlockEvaluate(node, options) { + var requiredContrastRatio = options.requiredContrastRatio, allowSameColor = options.allowSameColor; + if (isBlock2(node)) { + return false; + } + var parentBlock = get_composed_parent_default(node); + while (parentBlock && parentBlock.nodeType === 1 && !isBlock2(parentBlock)) { + parentBlock = get_composed_parent_default(parentBlock); + } + if (!parentBlock) { + return void 0; + } + this.relatedNodes([ parentBlock ]); + var nodeColor = _getForegroundColor(node); + var parentColor = _getForegroundColor(parentBlock); + var nodeBackgroundColor = _getBackgroundColor2(node); + var parentBackgroundColor = _getBackgroundColor2(parentBlock); + var textContrast = nodeColor && parentColor ? getContrast2(nodeColor, parentColor) : void 0; + if (textContrast) { + textContrast = Math.floor(textContrast * 100) / 100; + } + if (textContrast && textContrast >= requiredContrastRatio) { return true; } - var hasBorder = [ 'border-bottom', 'border-top', 'outline' ].reduce(function(result, edge) { - var borderClr = new color_default(); - borderClr.parseString(nodeStyle.getPropertyValue(edge + '-color')); - return result || nodeStyle.getPropertyValue(edge + '-style') !== 'none' && parseFloat(nodeStyle.getPropertyValue(edge + '-width')) > 0 && borderClr.alpha !== 0; - }, false); - if (hasBorder) { + var backgroundContrast = nodeBackgroundColor && parentBackgroundColor ? getContrast2(nodeBackgroundColor, parentBackgroundColor) : void 0; + if (backgroundContrast) { + backgroundContrast = Math.floor(backgroundContrast * 100) / 100; + } + if (backgroundContrast && backgroundContrast >= requiredContrastRatio) { return true; } - var parentStyle = window.getComputedStyle(ancestorNode); - if (_getFonts(nodeStyle)[0] !== _getFonts(parentStyle)[0]) { + if (!backgroundContrast) { + var _incomplete_data_defa; + var reason = (_incomplete_data_defa = incomplete_data_default.get('bgColor')) !== null && _incomplete_data_defa !== void 0 ? _incomplete_data_defa : 'bgContrast'; + this.data({ + messageKey: reason + }); + incomplete_data_default.clear(); + return void 0; + } + if (!textContrast) { + return void 0; + } + if (allowSameColor && textContrast === 1 && backgroundContrast === 1) { return true; } - var hasStyle = [ 'text-decoration-line', 'text-decoration-style', 'font-weight', 'font-style', 'font-size' ].reduce(function(result, cssProp) { - return result || nodeStyle.getPropertyValue(cssProp) !== parentStyle.getPropertyValue(cssProp); - }, false); - var tDec = nodeStyle.getPropertyValue('text-decoration'); - if (tDec.split(' ').length < 3) { - hasStyle = hasStyle || tDec !== parentStyle.getPropertyValue('text-decoration'); + if (textContrast === 1 && backgroundContrast > 1) { + this.data({ + messageKey: 'bgContrast', + contrastRatio: backgroundContrast, + requiredContrastRatio: requiredContrastRatio, + nodeBackgroundColor: nodeBackgroundColor ? nodeBackgroundColor.toHexString() : void 0, + parentBackgroundColor: parentBackgroundColor ? parentBackgroundColor.toHexString() : void 0 + }); + return false; } - return hasStyle; + this.data({ + messageKey: 'fgContrast', + contrastRatio: textContrast, + requiredContrastRatio: requiredContrastRatio, + nodeColor: nodeColor ? nodeColor.toHexString() : void 0, + parentColor: parentColor ? parentColor.toHexString() : void 0 + }); + return false; } - var element_is_distinct_default = elementIsDistinct; - function getRectStack2(elm) { - var boundingStack = get_element_stack_default(elm); - var filteredArr = get_text_element_stack_default(elm); - if (!filteredArr || filteredArr.length <= 1) { - return [ boundingStack ]; + var link_in_text_block_evaluate_default = linkInTextBlockEvaluate; + var blockLike3 = [ 'block', 'list-item', 'table', 'flex', 'grid', 'inline-block' ]; + function isBlock3(elm) { + var display = window.getComputedStyle(elm).getPropertyValue('display'); + return blockLike3.indexOf(display) !== -1 || display.substr(0, 6) === 'table-'; + } + function linkInTextBlockStyleEvaluate(node) { + if (isBlock3(node)) { + return false; } - if (filteredArr.some(function(stack) { - return stack === void 0; - })) { - return null; + var parentBlock = get_composed_parent_default(node); + while (parentBlock && parentBlock.nodeType === 1 && !isBlock3(parentBlock)) { + parentBlock = get_composed_parent_default(parentBlock); } - filteredArr.splice(0, 0, boundingStack); - return filteredArr; + if (!parentBlock) { + return void 0; + } + this.relatedNodes([ parentBlock ]); + return element_is_distinct_default(node, parentBlock); } - var get_rect_stack_default = getRectStack2; - function filteredRectStack(elm) { - var rectStack = get_rect_stack_default(elm); - if (rectStack && rectStack.length === 1) { - return rectStack[0]; + var link_in_text_block_style_evaluate_default = linkInTextBlockStyleEvaluate; + function autocompleteAppropriateEvaluate(node, options, virtualNode) { + if (virtualNode.props.nodeName !== 'input') { + return true; } - if (rectStack && rectStack.length > 1) { - var boundingStack = rectStack.shift(); - var isSame; - rectStack.forEach(function(rectList, index) { - if (index === 0) { - return; + var number = [ 'text', 'search', 'number', 'tel' ]; + var url = [ 'text', 'search', 'url' ]; + var allowedTypesMap = { + bday: [ 'text', 'search', 'date' ], + email: [ 'text', 'search', 'email' ], + username: [ 'text', 'search', 'email' ], + 'street-address': [ 'text' ], + tel: [ 'text', 'search', 'tel' ], + 'tel-country-code': [ 'text', 'search', 'tel' ], + 'tel-national': [ 'text', 'search', 'tel' ], + 'tel-area-code': [ 'text', 'search', 'tel' ], + 'tel-local': [ 'text', 'search', 'tel' ], + 'tel-local-prefix': [ 'text', 'search', 'tel' ], + 'tel-local-suffix': [ 'text', 'search', 'tel' ], + 'tel-extension': [ 'text', 'search', 'tel' ], + 'cc-number': number, + 'cc-exp': [ 'text', 'search', 'month', 'tel' ], + 'cc-exp-month': number, + 'cc-exp-year': number, + 'cc-csc': number, + 'transaction-amount': number, + 'bday-day': number, + 'bday-month': number, + 'bday-year': number, + 'new-password': [ 'text', 'search', 'password' ], + 'current-password': [ 'text', 'search', 'password' ], + url: url, + photo: url, + impp: url + }; + if (_typeof(options) === 'object') { + Object.keys(options).forEach(function(key) { + if (!allowedTypesMap[key]) { + allowedTypesMap[key] = []; } - var rectA = rectStack[index - 1], rectB = rectStack[index]; - isSame = rectA.every(function(element, elementIndex) { - return element === rectB[elementIndex]; - }) || boundingStack.includes(elm); + allowedTypesMap[key] = allowedTypesMap[key].concat(options[key]); }); - if (!isSame) { - incomplete_data_default.set('bgColor', 'elmPartiallyObscuring'); - return null; - } - return rectStack[0]; } - incomplete_data_default.set('bgColor', 'outsideViewport'); - return null; - } - var filtered_rect_stack_default = filteredRectStack; - function clamp(value, min, max) { - return Math.min(Math.max(min, value), max); + var autocompleteAttr = virtualNode.attr('autocomplete'); + var autocompleteTerms = autocompleteAttr.split(/\s+/g).map(function(term) { + return term.toLowerCase(); + }); + var purposeTerm = autocompleteTerms[autocompleteTerms.length - 1]; + if (_autocomplete.stateTerms.includes(purposeTerm)) { + return true; + } + var allowedTypes = allowedTypesMap[purposeTerm]; + var type = virtualNode.hasAttr('type') ? sanitize_default(virtualNode.attr('type')).toLowerCase() : 'text'; + type = valid_input_type_default().includes(type) ? type : 'text'; + if (typeof allowedTypes === 'undefined') { + return type === 'text'; + } + return allowedTypes.includes(type); + } + var autocomplete_appropriate_evaluate_default = autocompleteAppropriateEvaluate; + function autocompleteValidEvaluate(node, options, virtualNode) { + var autocomplete2 = virtualNode.attr('autocomplete') || ''; + return is_valid_autocomplete_default(autocomplete2, options); + } + var autocomplete_valid_evaluate_default = autocompleteValidEvaluate; + function attrNonSpaceContentEvaluate(node) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var vNode = arguments.length > 2 ? arguments[2] : undefined; + if (!options.attribute || typeof options.attribute !== 'string') { + throw new TypeError('attr-non-space-content requires options.attribute to be a string'); + } + if (!vNode.hasAttr(options.attribute)) { + this.data({ + messageKey: 'noAttr' + }); + return false; + } + var attribute = vNode.attr(options.attribute); + var attributeIsEmpty = !sanitize_default(attribute); + if (attributeIsEmpty) { + this.data({ + messageKey: 'emptyAttr' + }); + return false; + } + return true; + } + var attr_non_space_content_evaluate_default = attrNonSpaceContentEvaluate; + function pageHasElmAfter(results) { + var elmUsedAnywhere = results.some(function(frameResult) { + return frameResult.result === true; + }); + if (elmUsedAnywhere) { + results.forEach(function(result) { + result.result = true; + }); + } + return results; + } + var has_descendant_after_default = pageHasElmAfter; + function hasDescendant(node, options, virtualNode) { + if (!options || !options.selector || typeof options.selector !== 'string') { + throw new TypeError('has-descendant requires options.selector to be a string'); + } + if (options.passForModal && is_modal_open_default()) { + return true; + } + var matchingElms = query_selector_all_filter_default(virtualNode, options.selector, function(vNode) { + return _isVisibleToScreenReaders(vNode); + }); + this.relatedNodes(matchingElms.map(function(vNode) { + return vNode.actualNode; + })); + return matchingElms.length > 0; } - var blendFunctions = { - normal: function normal(Cb, Cs) { - return Cs; - }, - multiply: function multiply(Cb, Cs) { - return Cs * Cb; - }, - screen: function screen(Cb, Cs) { - return Cb + Cs - Cb * Cs; - }, - overlay: function overlay(Cb, Cs) { - return this['hard-light'](Cs, Cb); - }, - darken: function darken(Cb, Cs) { - return Math.min(Cb, Cs); - }, - lighten: function lighten(Cb, Cs) { - return Math.max(Cb, Cs); - }, - 'color-dodge': function colorDodge(Cb, Cs) { - return Cb === 0 ? 0 : Cs === 1 ? 1 : Math.min(1, Cb / (1 - Cs)); - }, - 'color-burn': function colorBurn(Cb, Cs) { - return Cb === 1 ? 1 : Cs === 0 ? 0 : 1 - Math.min(1, (1 - Cb) / Cs); - }, - 'hard-light': function hardLight(Cb, Cs) { - return Cs <= .5 ? this.multiply(Cb, 2 * Cs) : this.screen(Cb, 2 * Cs - 1); - }, - 'soft-light': function softLight(Cb, Cs) { - if (Cs <= .5) { - return Cb - (1 - 2 * Cs) * Cb * (1 - Cb); - } else { - var D = Cb <= .25 ? ((16 * Cb - 12) * Cb + 4) * Cb : Math.sqrt(Cb); - return Cb + (2 * Cs - 1) * (D - Cb); - } - }, - difference: function difference(Cb, Cs) { - return Math.abs(Cb - Cs); - }, - exclusion: function exclusion(Cb, Cs) { - return Cb + Cs - 2 * Cb * Cs; + var has_descendant_evaluate_default = hasDescendant; + function hasTextContentEvaluate(node, options, virtualNode) { + try { + return sanitize_default(subtree_text_default(virtualNode)) !== ''; + } catch (e) { + return void 0; } - }; - function simpleAlphaCompositing(Cs, \u03b1s, Cb, \u03b1b, blendMode) { - return \u03b1s * (1 - \u03b1b) * Cs + \u03b1s * \u03b1b * blendFunctions[blendMode](Cb / 255, Cs / 255) * 255 + (1 - \u03b1s) * \u03b1b * Cb; } - function flattenColors(fgColor, bgColor) { - var blendMode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'normal'; - var r = simpleAlphaCompositing(fgColor.red, fgColor.alpha, bgColor.red, bgColor.alpha, blendMode); - var g = simpleAlphaCompositing(fgColor.green, fgColor.alpha, bgColor.green, bgColor.alpha, blendMode); - var b = simpleAlphaCompositing(fgColor.blue, fgColor.alpha, bgColor.blue, bgColor.alpha, blendMode); - var \u03b1o = clamp(fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha), 0, 1); - var Cr = Math.round(r / \u03b1o); - var Cg = Math.round(g / \u03b1o); - var Cb = Math.round(b / \u03b1o); - return new color_default(Cr, Cg, Cb, \u03b1o); + function matchesDefinitionEvaluate(_, options, virtualNode) { + return matches_default3(virtualNode, options.matcher); } - var flatten_colors_default = flattenColors; - function flattenColors2(fgColor, bgColor) { - var alpha = fgColor.alpha; - var r = (1 - alpha) * bgColor.red + alpha * fgColor.red; - var g = (1 - alpha) * bgColor.green + alpha * fgColor.green; - var b = (1 - alpha) * bgColor.blue + alpha * fgColor.blue; - var a = fgColor.alpha + bgColor.alpha * (1 - fgColor.alpha); - return new color_default(r, g, b, a); + var matches_definition_evaluate_default = matchesDefinitionEvaluate; + function pageNoDuplicateAfter(results) { + return results.filter(function(checkResult) { + return checkResult.data !== 'ignored'; + }); } - var flatten_shadow_colors_default = flattenColors2; - function isInlineDescendant(node, descendant) { - var CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY; - if (!(node.compareDocumentPosition(descendant) & CONTAINED_BY)) { - return false; + var page_no_duplicate_after_default = pageNoDuplicateAfter; + function pageNoDuplicateEvaluate(node, options, virtualNode) { + if (!options || !options.selector || typeof options.selector !== 'string') { + throw new TypeError('page-no-duplicate requires options.selector to be a string'); } - var style = window.getComputedStyle(descendant); - var display = style.getPropertyValue('display'); - if (!display.includes('inline')) { - return false; + var key = 'page-no-duplicate;' + options.selector; + if (cache_default.get(key)) { + this.data('ignored'); + return; + } + cache_default.set(key, true); + var elms = query_selector_all_filter_default(axe._tree[0], options.selector, function(elm) { + return _isVisibleToScreenReaders(elm); + }); + if (typeof options.nativeScopeFilter === 'string') { + elms = elms.filter(function(elm) { + return elm.actualNode.hasAttribute('role') || !find_up_virtual_default(elm, options.nativeScopeFilter); + }); } - var position = style.getPropertyValue('position'); - return position === 'static'; + this.relatedNodes(elms.filter(function(elm) { + return elm !== virtualNode; + }).map(function(elm) { + return elm.actualNode; + })); + return elms.length <= 1; } - function calculateObscuringElement(elmIndex, elmStack, originalElm) { - for (var _i20 = elmIndex - 1; _i20 >= 0; _i20--) { - if (!isInlineDescendant(originalElm, elmStack[_i20])) { + var page_no_duplicate_evaluate_default = pageNoDuplicateEvaluate; + function accesskeysAfter(results) { + var seen = {}; + return results.filter(function(r) { + if (!r.data) { + return false; + } + var key = r.data.toUpperCase(); + if (!seen[key]) { + seen[key] = r; + r.relatedNodes = []; return true; } - elmStack.splice(_i20, 1); + seen[key].relatedNodes.push(r.relatedNodes[0]); + return false; + }).map(function(r) { + r.result = !!r.relatedNodes.length; + return r; + }); + } + var accesskeys_after_default = accesskeysAfter; + function accesskeysEvaluate(node, options, vNode) { + if (!_isHiddenForEveryone(vNode)) { + this.data(vNode.attr('accesskey')); + this.relatedNodes([ node ]); } - return false; + return true; } - function sortPageBackground(elmStack) { - var bodyIndex = elmStack.indexOf(document.body); - var bgNodes = elmStack; - var htmlBgColor = get_own_background_color_default(window.getComputedStyle(document.documentElement)); - if (bodyIndex > 1 && htmlBgColor.alpha === 0 && !element_has_image_default(document.documentElement)) { - if (bodyIndex > 1) { - bgNodes.splice(bodyIndex, 1); - bgNodes.push(document.body); - } - var htmlIndex = bgNodes.indexOf(document.documentElement); - if (htmlIndex > 0) { - bgNodes.splice(htmlIndex, 1); - bgNodes.push(document.documentElement); - } + var accesskeys_evaluate_default = accesskeysEvaluate; + function focusableContentEvaluate(node, options, virtualNode) { + var tabbableElements = virtualNode.tabbableElements; + if (!tabbableElements) { + return false; } - return bgNodes; + var tabbableContentElements = tabbableElements.filter(function(el) { + return el !== virtualNode; + }); + return tabbableContentElements.length > 0; } - function getBackgroundStack(elm) { - var elmStack = filtered_rect_stack_default(elm); - if (elmStack === null) { - return null; + var focusable_content_evaluate_default = focusableContentEvaluate; + function focusableDisabledEvaluate(node, options, virtualNode) { + var elementsThatCanBeDisabled = [ 'button', 'fieldset', 'input', 'select', 'textarea' ]; + var tabbableElements = virtualNode.tabbableElements; + if (!tabbableElements || !tabbableElements.length) { + return true; } - elmStack = reduce_to_elements_below_floating_default(elmStack, elm); - elmStack = sortPageBackground(elmStack); - var elmIndex = elmStack.indexOf(elm); - if (calculateObscuringElement(elmIndex, elmStack, elm)) { - incomplete_data_default.set('bgColor', 'bgOverlap'); - return null; + var relatedNodes = tabbableElements.filter(function(vNode) { + return elementsThatCanBeDisabled.includes(vNode.props.nodeName); + }); + this.relatedNodes(relatedNodes.map(function(vNode) { + return vNode.actualNode; + })); + if (relatedNodes.length === 0 || is_modal_open_default()) { + return true; } - return elmIndex !== -1 ? elmStack : null; + return relatedNodes.every(function(vNode) { + var pointerEvents = vNode.getComputedStylePropertyValue('pointer-events'); + var width = parseInt(vNode.getComputedStylePropertyValue('width')); + var height = parseInt(vNode.getComputedStylePropertyValue('height')); + return vNode.actualNode.onfocus || (width === 0 || height === 0) && pointerEvents === 'none'; + }) ? void 0 : false; } - var get_background_stack_default = getBackgroundStack; - function getTextShadowColors(node) { - var _ref55 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, minRatio = _ref55.minRatio, maxRatio = _ref55.maxRatio; - var style = window.getComputedStyle(node); - var textShadow = style.getPropertyValue('text-shadow'); - if (textShadow === 'none') { - return []; + var focusable_disabled_evaluate_default = focusableDisabledEvaluate; + function focusableElementEvaluate(node, options, virtualNode) { + if (virtualNode.hasAttr('contenteditable') && isContenteditable(virtualNode)) { + return true; } - var fontSizeStr = style.getPropertyValue('font-size'); - var fontSize = parseInt(fontSizeStr); - assert_default(isNaN(fontSize) === false, 'Unable to determine font-size value '.concat(fontSizeStr)); - var shadowColors = []; - var shadows = parseTextShadows(textShadow); - shadows.forEach(function(_ref56) { - var colorStr = _ref56.colorStr, pixels = _ref56.pixels; - colorStr = colorStr || style.getPropertyValue('color'); - var _pixels = _slicedToArray(pixels, 3), offsetY = _pixels[0], offsetX = _pixels[1], _pixels$ = _pixels[2], blurRadius = _pixels$ === void 0 ? 0 : _pixels$; - if ((!minRatio || blurRadius >= fontSize * minRatio) && (!maxRatio || blurRadius < fontSize * maxRatio)) { - var color11 = textShadowColor({ - colorStr: colorStr, - offsetY: offsetY, - offsetX: offsetX, - blurRadius: blurRadius, - fontSize: fontSize - }); - shadowColors.push(color11); + return _isInTabOrder(virtualNode); + function isContenteditable(vNode) { + var contenteditable = vNode.attr('contenteditable'); + if (contenteditable === 'true' || contenteditable === '') { + return true; + } + if (contenteditable === 'false') { + return false; + } + var ancestor = closest_default(virtualNode.parent, '[contenteditable]'); + if (!ancestor) { + return false; } + return isContenteditable(ancestor); + } + } + var focusable_element_evaluate_default = focusableElementEvaluate; + function focusableModalOpenEvaluate(node, options, virtualNode) { + var tabbableElements = virtualNode.tabbableElements.map(function(_ref82) { + var actualNode = _ref82.actualNode; + return actualNode; }); - return shadowColors; + if (!tabbableElements || !tabbableElements.length) { + return true; + } + if (is_modal_open_default()) { + this.relatedNodes(tabbableElements); + return void 0; + } + return true; } - function parseTextShadows(textShadow) { - var current = { - pixels: [] - }; - var str = textShadow.trim(); - var shadows = [ current ]; - if (!str) { - return []; + var focusable_modal_open_evaluate_default = focusableModalOpenEvaluate; + function focusableNoNameEvaluate(node, options, virtualNode) { + var tabIndex = virtualNode.attr('tabindex'); + var inFocusOrder = _isFocusable(virtualNode) && tabIndex > -1; + if (!inFocusOrder) { + return false; } - while (str) { - var colorMatch = str.match(/^rgba?\([0-9,.\s]+\)/i) || str.match(/^[a-z]+/i) || str.match(/^#[0-9a-f]+/i); - var pixelMatch = str.match(/^([0-9.-]+)px/i) || str.match(/^(0)/); - if (colorMatch) { - assert_default(!current.colorStr, 'Multiple colors identified in text-shadow: '.concat(textShadow)); - str = str.replace(colorMatch[0], '').trim(); - current.colorStr = colorMatch[0]; - } else if (pixelMatch) { - assert_default(current.pixels.length < 3, 'Too many pixel units in text-shadow: '.concat(textShadow)); - str = str.replace(pixelMatch[0], '').trim(); - var pixelUnit = parseFloat((pixelMatch[1][0] === '.' ? '0' : '') + pixelMatch[1]); - current.pixels.push(pixelUnit); - } else if (str[0] === ',') { - assert_default(current.pixels.length >= 2, 'Missing pixel value in text-shadow: '.concat(textShadow)); - current = { - pixels: [] - }; - shadows.push(current); - str = str.substr(1).trim(); - } else { - throw new Error('Unable to process text-shadows: '.concat(textShadow)); - } + try { + return !accessible_text_virtual_default(virtualNode); + } catch (e) { + return void 0; } - return shadows; } - function textShadowColor(_ref57) { - var colorStr = _ref57.colorStr, offsetX = _ref57.offsetX, offsetY = _ref57.offsetY, blurRadius = _ref57.blurRadius, fontSize = _ref57.fontSize; - if (offsetX > blurRadius || offsetY > blurRadius) { - return new color_default(0, 0, 0, 0); + var focusable_no_name_evaluate_default = focusableNoNameEvaluate; + function focusableNotTabbableEvaluate(node, options, virtualNode) { + var elementsThatCanBeDisabled = [ 'button', 'fieldset', 'input', 'select', 'textarea' ]; + var tabbableElements = virtualNode.tabbableElements; + if (!tabbableElements || !tabbableElements.length) { + return true; } - var shadowColor = new color_default(); - shadowColor.parseString(colorStr); - shadowColor.alpha *= blurRadiusToAlpha(blurRadius, fontSize); - return shadowColor; + var relatedNodes = tabbableElements.filter(function(vNode) { + return !elementsThatCanBeDisabled.includes(vNode.props.nodeName); + }); + this.relatedNodes(relatedNodes.map(function(vNode) { + return vNode.actualNode; + })); + if (relatedNodes.length === 0 || is_modal_open_default()) { + return true; + } + return relatedNodes.every(function(vNode) { + var pointerEvents = vNode.getComputedStylePropertyValue('pointer-events'); + var width = parseInt(vNode.getComputedStylePropertyValue('width')); + var height = parseInt(vNode.getComputedStylePropertyValue('height')); + return vNode.actualNode.onfocus || (width === 0 || height === 0) && pointerEvents === 'none'; + }) ? void 0 : false; } - function blurRadiusToAlpha(blurRadius, fontSize) { - if (blurRadius === 0) { - return 1; + var focusable_not_tabbable_evaluate_default = focusableNotTabbableEvaluate; + function frameFocusableContentEvaluate(node, options, virtualNode) { + if (!virtualNode.children) { + return void 0; + } + try { + return !virtualNode.children.some(function(child) { + return focusableDescendants(child); + }); + } catch (e) { + return void 0; } - var relativeBlur = blurRadius / fontSize; - return .185 / (relativeBlur + .4); } - var get_text_shadow_colors_default = getTextShadowColors; - function _getBackgroundColor(elm) { - var _bgColors; - var bgElms = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; - var shadowOutlineEmMax = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : .1; - var bgColors = get_text_shadow_colors_default(elm, { - minRatio: shadowOutlineEmMax + function focusableDescendants(vNode) { + if (_isInTabOrder(vNode)) { + return true; + } + if (!vNode.children) { + if (vNode.props.nodeType === 1) { + throw new Error('Cannot determine children'); + } + return false; + } + return vNode.children.some(function(child) { + return focusableDescendants(child); }); - if (bgColors.length) { - bgColors = [ { - color: bgColors.reduce(flatten_shadow_colors_default) - } ]; + } + function landmarkIsTopLevelEvaluate(node) { + var landmarks = get_aria_roles_by_type_default('landmark'); + var parent = get_composed_parent_default(node); + var nodeRole = get_role_default(node); + this.data({ + role: nodeRole + }); + while (parent) { + var role = parent.getAttribute('role'); + if (!role && parent.nodeName.toUpperCase() !== 'FORM') { + role = implicit_role_default(parent); + } + if (role && landmarks.includes(role) && !(role === 'main' && nodeRole === 'complementary')) { + return false; + } + parent = get_composed_parent_default(parent); } - var elmStack = get_background_stack_default(elm); - (elmStack || []).some(function(bgElm) { - var bgElmStyle = window.getComputedStyle(bgElm); - var bgColor = get_own_background_color_default(bgElmStyle); - if (elmPartiallyObscured(elm, bgElm, bgColor) || element_has_image_default(bgElm, bgElmStyle)) { - bgColors = null; - bgElms.push(bgElm); + return true; + } + var landmark_is_top_level_evaluate_default = landmarkIsTopLevelEvaluate; + function noFocusableContentEvaluate(node, options, virtualNode) { + if (!virtualNode.children) { + return void 0; + } + try { + var focusableDescendants2 = getFocusableDescendants(virtualNode); + if (!focusableDescendants2.length) { return true; } - if (bgColor.alpha !== 0) { - bgElms.push(bgElm); - var blendMode = bgElmStyle.getPropertyValue('mix-blend-mode'); - bgColors.unshift({ - color: bgColor, - blendMode: normalizeBlendMode(blendMode) + var notHiddenElements = focusableDescendants2.filter(usesUnreliableHidingStrategy); + if (notHiddenElements.length > 0) { + this.data({ + messageKey: 'notHidden' }); - return bgColor.alpha === 1; + this.relatedNodes(notHiddenElements); } else { - return false; + this.relatedNodes(focusableDescendants2); } - }); - if (bgColors === null || elmStack === null) { - return null; + return false; + } catch (e) { + return void 0; } - var pageBgs = getPageBackgroundColors(elm, elmStack.includes(document.body)); - (_bgColors = bgColors).unshift.apply(_bgColors, _toConsumableArray(pageBgs)); - if (bgColors.length === 0) { - return new color_default(255, 255, 255, 1); + } + function getFocusableDescendants(vNode) { + if (!vNode.children) { + if (vNode.props.nodeType === 1) { + throw new Error('Cannot determine children'); + } + return []; } - var blendedColor = bgColors.reduce(function(bgColor, fgColor) { - return flatten_colors_default(fgColor.color, bgColor.color instanceof color_default ? bgColor.color : bgColor, fgColor.blendMode); + var retVal = []; + vNode.children.forEach(function(child) { + if (get_role_type_default(child) === 'widget' && _isFocusable(child)) { + retVal.push(child); + } else { + retVal.push.apply(retVal, _toConsumableArray(getFocusableDescendants(child))); + } }); - return flatten_colors_default(blendedColor.color instanceof color_default ? blendedColor.color : blendedColor, new color_default(255, 255, 255, 1)); + return retVal; + } + function usesUnreliableHidingStrategy(vNode) { + var tabIndex = parseInt(vNode.attr('tabindex'), 10); + return !isNaN(tabIndex) && tabIndex < 0; + } + function tabindexEvaluate(node, options, virtualNode) { + var tabIndex = parseInt(virtualNode.attr('tabindex'), 10); + return isNaN(tabIndex) ? true : tabIndex <= 0; + } + var tabindex_evaluate_default = tabindexEvaluate; + function altSpaceValueEvaluate(node, options, virtualNode) { + var alt = virtualNode.attr('alt'); + var isOnlySpace = /^\s+$/; + return typeof alt === 'string' && isOnlySpace.test(alt); } - function elmPartiallyObscured(elm, bgElm, bgColor) { - var obscured = elm !== bgElm && !_visuallyContains(elm, bgElm) && bgColor.alpha !== 0; - if (obscured) { - incomplete_data_default.set('bgColor', 'elmPartiallyObscured'); + var alt_space_value_evaluate_default = altSpaceValueEvaluate; + function duplicateImgLabelEvaluate(node, options, virtualNode) { + if ([ 'none', 'presentation' ].includes(get_role_default(virtualNode))) { + return false; + } + var parentVNode = closest_default(virtualNode, options.parentSelector); + if (!parentVNode) { + return false; } - return obscured; + var visibleText = visible_virtual_default(parentVNode, true).toLowerCase(); + if (visibleText === '') { + return false; + } + return visibleText === accessible_text_virtual_default(virtualNode).toLowerCase(); } - function normalizeBlendMode(blendmode) { - return !!blendmode ? blendmode : void 0; + var duplicate_img_label_evaluate_default = duplicateImgLabelEvaluate; + function explicitEvaluate(node, options, virtualNode) { + var _this4 = this; + if (!virtualNode.attr('id')) { + return false; + } + if (!virtualNode.actualNode) { + return void 0; + } + var root = get_root_node_default2(virtualNode.actualNode); + var id = escape_selector_default(virtualNode.attr('id')); + var labels = Array.from(root.querySelectorAll('label[for="'.concat(id, '"]'))); + this.relatedNodes(labels); + if (!labels.length) { + return false; + } + try { + return labels.some(function(label3) { + if (!_isVisibleOnScreen(label3)) { + return true; + } else { + var explicitLabel = sanitize_default(accessible_text_default(label3, { + inControlContext: true, + startNode: virtualNode + })); + _this4.data({ + explicitLabel: explicitLabel + }); + return !!explicitLabel; + } + }); + } catch (e) { + return void 0; + } } - function getPageBackgroundColors(elm, stackContainsBody) { - var pageColors = []; - if (!stackContainsBody) { - var html = document.documentElement; - var body = document.body; - var htmlStyle = window.getComputedStyle(html); - var bodyStyle = window.getComputedStyle(body); - var htmlBgColor = get_own_background_color_default(htmlStyle); - var bodyBgColor = get_own_background_color_default(bodyStyle); - var bodyBgColorApplies = bodyBgColor.alpha !== 0 && _visuallyContains(elm, body); - if (bodyBgColor.alpha !== 0 && htmlBgColor.alpha === 0 || bodyBgColorApplies && bodyBgColor.alpha !== 1) { - pageColors.unshift({ - color: bodyBgColor, - blendMode: normalizeBlendMode(bodyStyle.getPropertyValue('mix-blend-mode')) - }); + var explicit_evaluate_default = explicitEvaluate; + function helpSameAsLabelEvaluate(node, options, virtualNode) { + var labelText2 = label_virtual_default2(virtualNode), check = node.getAttribute('title'); + if (!labelText2) { + return false; + } + if (!check) { + check = ''; + if (node.getAttribute('aria-describedby')) { + var ref = idrefs_default(node, 'aria-describedby'); + check = ref.map(function(thing) { + return thing ? accessible_text_default(thing) : ''; + }).join(''); } - if (htmlBgColor.alpha !== 0 && (!bodyBgColorApplies || bodyBgColorApplies && bodyBgColor.alpha !== 1)) { - pageColors.unshift({ - color: htmlBgColor, - blendMode: normalizeBlendMode(htmlStyle.getPropertyValue('mix-blend-mode')) - }); + } + return sanitize_default(check) === sanitize_default(labelText2); + } + var help_same_as_label_evaluate_default = helpSameAsLabelEvaluate; + function hiddenExplicitLabelEvaluate(node, options, virtualNode) { + if (virtualNode.hasAttr('id')) { + if (!virtualNode.actualNode) { + return void 0; + } + var root = get_root_node_default2(node); + var id = escape_selector_default(node.getAttribute('id')); + var label3 = root.querySelector('label[for="'.concat(id, '"]')); + if (label3 && !_isVisibleToScreenReaders(label3)) { + var name; + try { + name = accessible_text_virtual_default(virtualNode).trim(); + } catch (e) { + return void 0; + } + var isNameEmpty = name === ''; + return isNameEmpty; } } - return pageColors; + return false; } - function getContrast(bgColor, fgColor) { - if (!fgColor || !bgColor) { - return null; + var hidden_explicit_label_evaluate_default = hiddenExplicitLabelEvaluate; + function implicitEvaluate(node, options, virtualNode) { + try { + var label3 = closest_default(virtualNode, 'label'); + if (label3) { + var implicitLabel = sanitize_default(accessible_text_virtual_default(label3, { + inControlContext: true, + startNode: virtualNode + })); + if (label3.actualNode) { + this.relatedNodes([ label3.actualNode ]); + } + this.data({ + implicitLabel: implicitLabel + }); + return !!implicitLabel; + } + return false; + } catch (e) { + return void 0; } - if (fgColor.alpha < 1) { - fgColor = flatten_colors_default(fgColor, bgColor); + } + var implicit_evaluate_default = implicitEvaluate; + function isStringContained(compare, compareWith) { + var curatedCompareWith = curateString(compareWith); + var curatedCompare = curateString(compare); + if (!curatedCompareWith || !curatedCompare) { + return false; } - var bL = bgColor.getRelativeLuminance(); - var fL = fgColor.getRelativeLuminance(); - return (Math.max(fL, bL) + .05) / (Math.min(fL, bL) + .05); + return curatedCompareWith.includes(curatedCompare); + } + function curateString(str) { + var noUnicodeStr = remove_unicode_default(str, { + emoji: true, + nonBmp: true, + punctuations: true + }); + return sanitize_default(noUnicodeStr); } - var get_contrast_default = getContrast; - function getOpacity(node) { - if (!node) { - return 1; + function labelContentNameMismatchEvaluate(node, options, virtualNode) { + var _options$occurrenceTh; + var pixelThreshold = options === null || options === void 0 ? void 0 : options.pixelThreshold; + var occurrenceThreshold = (_options$occurrenceTh = options === null || options === void 0 ? void 0 : options.occurrenceThreshold) !== null && _options$occurrenceTh !== void 0 ? _options$occurrenceTh : options === null || options === void 0 ? void 0 : options.occuranceThreshold; + var accText = accessible_text_default(node).toLowerCase(); + if (is_human_interpretable_default(accText) < 1) { + return void 0; } - var vNode = get_node_from_tree_default(node); - if (vNode && vNode._opacity !== void 0 && vNode._opacity !== null) { - return vNode._opacity; + var visibleText = sanitize_default(subtree_text_default(virtualNode, { + subtreeDescendant: true, + ignoreIconLigature: true, + pixelThreshold: pixelThreshold, + occurrenceThreshold: occurrenceThreshold + })).toLowerCase(); + if (!visibleText) { + return true; } - var nodeStyle = window.getComputedStyle(node); - var opacity = nodeStyle.getPropertyValue('opacity'); - var finalOpacity = opacity * getOpacity(node.parentElement); - if (vNode) { - vNode._opacity = finalOpacity; + if (is_human_interpretable_default(visibleText) < 1) { + if (isStringContained(visibleText, accText)) { + return true; + } + return void 0; } - return finalOpacity; + return isStringContained(visibleText, accText); } - function getForegroundColor(node, _, bgColor) { - var nodeStyle = window.getComputedStyle(node); - var fgColor = new color_default(); - fgColor.parseString(nodeStyle.getPropertyValue('color')); - var opacity = getOpacity(node); - fgColor.alpha = fgColor.alpha * opacity; - if (fgColor.alpha === 1) { - return fgColor; - } - if (!bgColor) { - bgColor = _getBackgroundColor(node, []); + var label_content_name_mismatch_evaluate_default = labelContentNameMismatchEvaluate; + function multipleLabelEvaluate(node) { + var id = escape_selector_default(node.getAttribute('id')); + var parent = node.parentNode; + var root = get_root_node_default2(node); + root = root.documentElement || root; + var labels = Array.from(root.querySelectorAll('label[for="'.concat(id, '"]'))); + if (labels.length) { + labels = labels.filter(function(label3) { + return !_isHiddenForEveryone(label3); + }); } - if (bgColor === null) { - var reason = incomplete_data_default.get('bgColor'); - incomplete_data_default.set('fgColor', reason); - return null; + while (parent) { + if (parent.nodeName.toUpperCase() === 'LABEL' && labels.indexOf(parent) === -1) { + labels.push(parent); + } + parent = parent.parentNode; } - if (fgColor.alpha < 1) { - var textShadowColors = get_text_shadow_colors_default(node, { - minRatio: 0 + this.relatedNodes(labels); + if (labels.length > 1) { + var ATVisibleLabels = labels.filter(function(label3) { + return _isVisibleToScreenReaders(label3); }); - return [ fgColor ].concat(_toConsumableArray(textShadowColors), [ bgColor ]).reduce(flatten_shadow_colors_default); + if (ATVisibleLabels.length > 1) { + return void 0; + } + var labelledby = idrefs_default(node, 'aria-labelledby'); + return !labelledby.includes(ATVisibleLabels[0]) ? void 0 : false; } - return flatten_colors_default(fgColor, bgColor); + return false; } - var get_foreground_color_default = getForegroundColor; - function hasValidContrastRatio(bg, fg, fontSize, isBold) { - var contrast = get_contrast_default(bg, fg); - var isSmallFont = isBold && Math.ceil(fontSize * 72) / 96 < 14 || !isBold && Math.ceil(fontSize * 72) / 96 < 18; - var expectedContrastRatio = isSmallFont ? 4.5 : 3; - return { - isValid: contrast > expectedContrastRatio, - contrastRatio: contrast, - expectedContrastRatio: expectedContrastRatio - }; + var multiple_label_evaluate_default = multipleLabelEvaluate; + function titleOnlyEvaluate(node, options, virtualNode) { + var labelText2 = label_virtual_default2(virtualNode); + var title = title_text_default(virtualNode); + var ariaDescribedBy = virtualNode.attr('aria-describedby'); + return !labelText2 && !!(title || ariaDescribedBy); } - var has_valid_contrast_ratio_default = hasValidContrastRatio; - function colorContrastEvaluate(node, options, virtualNode) { - var ignoreUnicode = options.ignoreUnicode, ignoreLength = options.ignoreLength, ignorePseudo = options.ignorePseudo, boldValue = options.boldValue, boldTextPt = options.boldTextPt, largeTextPt = options.largeTextPt, contrastRatio = options.contrastRatio, shadowOutlineEmMax = options.shadowOutlineEmMax, pseudoSizeThreshold = options.pseudoSizeThreshold; - if (!is_visible_default(node, false)) { + var title_only_evaluate_default = titleOnlyEvaluate; + function landmarkIsUniqueAfter(results) { + var uniqueLandmarks = []; + return results.filter(function(currentResult) { + var findMatch = function findMatch(someResult) { + return currentResult.data.role === someResult.data.role && currentResult.data.accessibleText === someResult.data.accessibleText; + }; + var matchedResult = uniqueLandmarks.find(findMatch); + if (matchedResult) { + matchedResult.result = false; + matchedResult.relatedNodes.push(currentResult.relatedNodes[0]); + return false; + } + uniqueLandmarks.push(currentResult); + currentResult.relatedNodes = []; return true; - } - var visibleText = visible_virtual_default(virtualNode, false, true); - if (ignoreUnicode && textIsEmojis(visibleText)) { + }); + } + var landmark_is_unique_after_default = landmarkIsUniqueAfter; + function landmarkIsUniqueEvaluate(node, options, virtualNode) { + var role = get_role_default(node); + var accessibleText2 = accessible_text_virtual_default(virtualNode); + accessibleText2 = accessibleText2 ? accessibleText2.toLowerCase() : null; + this.data({ + role: role, + accessibleText: accessibleText2 + }); + this.relatedNodes([ node ]); + return true; + } + var landmark_is_unique_evaluate_default = landmarkIsUniqueEvaluate; + function hasValue(value) { + return (value || '').trim() !== ''; + } + function hasLangEvaluate(node, options, virtualNode) { + var xhtml2 = typeof document !== 'undefined' ? is_xhtml_default(document) : false; + if (options.attributes.includes('xml:lang') && options.attributes.includes('lang') && hasValue(virtualNode.attr('xml:lang')) && !hasValue(virtualNode.attr('lang')) && !xhtml2) { this.data({ - messageKey: 'nonBmp' + messageKey: 'noXHTML' }); - return void 0; + return false; } - var pseudoElm = findPseudoElement(virtualNode, { - ignorePseudo: ignorePseudo, - pseudoSizeThreshold: pseudoSizeThreshold + var hasLang = options.attributes.some(function(name) { + return hasValue(virtualNode.attr(name)); }); - if (pseudoElm) { + if (!hasLang) { this.data({ - messageKey: 'pseudoContent' + messageKey: 'noLang' }); - this.relatedNodes(pseudoElm.actualNode); - return void 0; + return false; } - var bgNodes = []; - var bgColor = _getBackgroundColor(node, bgNodes, shadowOutlineEmMax); - var fgColor = get_foreground_color_default(node, false, bgColor); - var shadowColors = get_text_shadow_colors_default(node, { - minRatio: .001, - maxRatio: shadowOutlineEmMax - }); - var nodeStyle = window.getComputedStyle(node); - var fontSize = parseFloat(nodeStyle.getPropertyValue('font-size')); - var fontWeight = nodeStyle.getPropertyValue('font-weight'); - var bold = parseFloat(fontWeight) >= boldValue || fontWeight === 'bold'; - var contrast = null; - var contrastContributor = null; - var shadowColor = null; - if (shadowColors.length === 0) { - contrast = get_contrast_default(bgColor, fgColor); - } else if (fgColor && bgColor) { - shadowColor = [].concat(_toConsumableArray(shadowColors), [ bgColor ]).reduce(flatten_shadow_colors_default); - var fgBgContrast = get_contrast_default(bgColor, fgColor); - var bgShContrast = get_contrast_default(bgColor, shadowColor); - var fgShContrast = get_contrast_default(shadowColor, fgColor); - contrast = Math.max(fgBgContrast, bgShContrast, fgShContrast); - if (contrast !== fgBgContrast) { - contrastContributor = bgShContrast > fgShContrast ? 'shadowOnBgColor' : 'fgOnShadowColor'; + return true; + } + var has_lang_evaluate_default = hasLangEvaluate; + function validLangEvaluate(node, options, virtualNode) { + var invalid = []; + options.attributes.forEach(function(langAttr) { + var langVal = virtualNode.attr(langAttr); + if (typeof langVal !== 'string') { + return; } + var baselangVal = get_base_lang_default(langVal); + var invalidLang = options.value ? !options.value.map(get_base_lang_default).includes(baselangVal) : !valid_langs_default(baselangVal); + if (baselangVal !== '' && invalidLang || langVal !== '' && !sanitize_default(langVal)) { + invalid.push(langAttr + '="' + virtualNode.attr(langAttr) + '"'); + } + }); + if (!invalid.length) { + return false; } - var ptSize = Math.ceil(fontSize * 72) / 96; - var isSmallFont = bold && ptSize < boldTextPt || !bold && ptSize < largeTextPt; - var _ref58 = isSmallFont ? contrastRatio.normal : contrastRatio.large, expected = _ref58.expected, minThreshold = _ref58.minThreshold, maxThreshold = _ref58.maxThreshold; - var isValid = contrast > expected; - if (typeof minThreshold === 'number' && contrast < minThreshold || typeof maxThreshold === 'number' && contrast > maxThreshold) { - return true; - } - var truncatedResult = Math.floor(contrast * 100) / 100; - var missing; - if (bgColor === null) { - missing = incomplete_data_default.get('bgColor'); - } else if (!isValid) { - missing = contrastContributor; + if (virtualNode.props.nodeName !== 'html' && !_hasLangText(virtualNode)) { + return false; } - var equalRatio = truncatedResult === 1; - var shortTextContent = visibleText.length === 1; - if (equalRatio) { - missing = incomplete_data_default.set('bgColor', 'equalRatio'); - } else if (!isValid && shortTextContent && !ignoreLength) { - missing = 'shortTextContent'; + this.data(invalid); + return true; + } + var valid_lang_evaluate_default = validLangEvaluate; + function xmlLangMismatchEvaluate(node, options, vNode) { + var primaryLangValue = get_base_lang_default(vNode.attr('lang')); + var primaryXmlLangValue = get_base_lang_default(vNode.attr('xml:lang')); + return primaryLangValue === primaryXmlLangValue; + } + var xml_lang_mismatch_evaluate_default = xmlLangMismatchEvaluate; + function dlitemEvaluate(node) { + var parent = get_composed_parent_default(node); + var parentTagName = parent.nodeName.toUpperCase(); + var parentRole = get_explicit_role_default(parent); + if (parentTagName === 'DIV' && [ 'presentation', 'none', null ].includes(parentRole)) { + parent = get_composed_parent_default(parent); + parentTagName = parent.nodeName.toUpperCase(); + parentRole = get_explicit_role_default(parent); } - this.data({ - fgColor: fgColor ? fgColor.toHexString() : void 0, - bgColor: bgColor ? bgColor.toHexString() : void 0, - contrastRatio: truncatedResult, - fontSize: ''.concat((fontSize * 72 / 96).toFixed(1), 'pt (').concat(fontSize, 'px)'), - fontWeight: bold ? 'bold' : 'normal', - messageKey: missing, - expectedContrastRatio: expected + ':1', - shadowColor: shadowColor ? shadowColor.toHexString() : void 0 - }); - if (fgColor === null || bgColor === null || equalRatio || shortTextContent && !ignoreLength && !isValid) { - missing = null; - incomplete_data_default.clear(); - this.relatedNodes(bgNodes); - return void 0; + if (parentTagName !== 'DL') { + return false; } - if (!isValid) { - this.relatedNodes(bgNodes); + if (!parentRole || [ 'presentation', 'none', 'list' ].includes(parentRole)) { + return true; } - return isValid; + return false; } - function findPseudoElement(vNode, _ref59) { - var _ref59$pseudoSizeThre = _ref59.pseudoSizeThreshold, pseudoSizeThreshold = _ref59$pseudoSizeThre === void 0 ? .25 : _ref59$pseudoSizeThre, _ref59$ignorePseudo = _ref59.ignorePseudo, ignorePseudo = _ref59$ignorePseudo === void 0 ? false : _ref59$ignorePseudo; - if (ignorePseudo) { - return; + var dlitem_evaluate_default = dlitemEvaluate; + function invalidChildrenEvaluate(node) { + var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + var virtualNode = arguments.length > 2 ? arguments[2] : undefined; + var relatedNodes = []; + var issues = []; + if (!virtualNode.children) { + return void 0; } - var rect = vNode.boundingClientRect; - var minimumSize = rect.width * rect.height * pseudoSizeThreshold; - do { - var beforeSize = getPseudoElementArea(vNode.actualNode, ':before'); - var afterSize = getPseudoElementArea(vNode.actualNode, ':after'); - if (beforeSize + afterSize > minimumSize) { - return vNode; + var vChildren = mapWithNested(virtualNode.children); + while (vChildren.length) { + var _vChild$actualNode; + var _vChildren$shift = vChildren.shift(), vChild = _vChildren$shift.vChild, nested = _vChildren$shift.nested; + if (options.divGroups && !nested && isDivGroup(vChild)) { + if (!vChild.children) { + return void 0; + } + var vGrandChildren = mapWithNested(vChild.children, true); + vChildren.push.apply(vChildren, _toConsumableArray(vGrandChildren)); + continue; } - } while (vNode = vNode.parent); + var issue = getInvalidSelector(vChild, nested, options); + if (!issue) { + continue; + } + if (!issues.includes(issue)) { + issues.push(issue); + } + if ((vChild === null || vChild === void 0 ? void 0 : (_vChild$actualNode = vChild.actualNode) === null || _vChild$actualNode === void 0 ? void 0 : _vChild$actualNode.nodeType) === 1) { + relatedNodes.push(vChild.actualNode); + } + } + if (issues.length === 0) { + return false; + } + this.data({ + values: issues.join(', ') + }); + this.relatedNodes(relatedNodes); + return true; } - var getPseudoElementArea = memoize_default(function getPseudoElementArea2(node, pseudo) { - var style = window.getComputedStyle(node, pseudo); - var matchPseudoStyle = function matchPseudoStyle(prop, value) { - return style.getPropertyValue(prop) === value; - }; - if (matchPseudoStyle('content', 'none') || matchPseudoStyle('display', 'none') || matchPseudoStyle('visibility', 'hidden') || matchPseudoStyle('position', 'absolute') === false) { - return 0; + function getInvalidSelector(vChild, nested, _ref83) { + var _ref83$validRoles = _ref83.validRoles, validRoles = _ref83$validRoles === void 0 ? [] : _ref83$validRoles, _ref83$validNodeNames = _ref83.validNodeNames, validNodeNames = _ref83$validNodeNames === void 0 ? [] : _ref83$validNodeNames; + var _vChild$props = vChild.props, nodeName2 = _vChild$props.nodeName, nodeType = _vChild$props.nodeType, nodeValue = _vChild$props.nodeValue; + var selector = nested ? 'div > ' : ''; + if (nodeType === 3 && nodeValue.trim() !== '') { + return selector + '#text'; } - if (get_own_background_color_default(style).alpha === 0 && matchPseudoStyle('background-image', 'none')) { - return 0; + if (nodeType !== 1 || !_isVisibleToScreenReaders(vChild)) { + return false; } - var pseudoWidth = parseUnit(style.getPropertyValue('width')); - var pseudoHeight = parseUnit(style.getPropertyValue('height')); - if (pseudoWidth.unit !== 'px' || pseudoHeight.unit !== 'px') { - return pseudoWidth.value === 0 || pseudoHeight.value === 0 ? 0 : Infinity; + var role = get_explicit_role_default(vChild); + if (role) { + return validRoles.includes(role) ? false : selector + '[role='.concat(role, ']'); + } else { + return validNodeNames.includes(nodeName2) ? false : selector + nodeName2; } - return pseudoWidth.value * pseudoHeight.value; - }); - function textIsEmojis(visibleText) { - var options = { - nonBmp: true - }; - var hasUnicodeChars = has_unicode_default(visibleText, options); - var hasNonUnicodeChars = sanitize_default(remove_unicode_default(visibleText, options)) === ''; - return hasUnicodeChars && hasNonUnicodeChars; - } - function parseUnit(str) { - var unitRegex = /^([0-9.]+)([a-z]+)$/i; - var _ref60 = str.match(unitRegex) || [], _ref61 = _slicedToArray(_ref60, 3), _ref61$ = _ref61[1], value = _ref61$ === void 0 ? '' : _ref61$, _ref61$2 = _ref61[2], unit = _ref61$2 === void 0 ? '' : _ref61$2; - return { - value: parseFloat(value), - unit: unit.toLowerCase() - }; } - function getContrast2(color1, color22) { - var c1lum = color1.getRelativeLuminance(); - var c2lum = color22.getRelativeLuminance(); - return (Math.max(c1lum, c2lum) + .05) / (Math.min(c1lum, c2lum) + .05); + function isDivGroup(vNode) { + return vNode.props.nodeName === 'div' && get_explicit_role_default(vNode) === null; } - var blockLike2 = [ 'block', 'list-item', 'table', 'flex', 'grid', 'inline-block' ]; - function isBlock2(elm) { - var display = window.getComputedStyle(elm).getPropertyValue('display'); - return blockLike2.indexOf(display) !== -1 || display.substr(0, 6) === 'table-'; + function mapWithNested(vNodes) { + var nested = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; + return vNodes.map(function(vChild) { + return { + vChild: vChild, + nested: nested + }; + }); } - function linkInTextBlockEvaluate(node) { - if (isBlock2(node)) { - return false; - } - var parentBlock = get_composed_parent_default(node); - while (parentBlock.nodeType === 1 && !isBlock2(parentBlock)) { - parentBlock = get_composed_parent_default(parentBlock); + function listitemEvaluate(node, options, virtualNode) { + var parent = virtualNode.parent; + if (!parent) { + return void 0; } - this.relatedNodes([ parentBlock ]); - if (element_is_distinct_default(node, parentBlock)) { + var parentNodeName = parent.props.nodeName; + var parentRole = get_explicit_role_default(parent); + if ([ 'presentation', 'none', 'list' ].includes(parentRole)) { return true; - } else { - var nodeColor, parentColor; - nodeColor = get_foreground_color_default(node); - parentColor = get_foreground_color_default(parentBlock); - if (!nodeColor || !parentColor) { - return void 0; - } - var contrast = getContrast2(nodeColor, parentColor); - if (contrast === 1) { - return true; - } else if (contrast >= 3) { - incomplete_data_default.set('fgColor', 'bgContrast'); - this.data({ - messageKey: incomplete_data_default.get('fgColor') - }); - incomplete_data_default.clear(); - return void 0; + } + if (parentRole && is_valid_role_default(parentRole)) { + this.data({ + messageKey: 'roleNotValid' + }); + return false; + } + return [ 'ul', 'ol', 'menu' ].includes(parentNodeName); + } + function onlyDlitemsEvaluate(node, options, virtualNode) { + var ALLOWED_ROLES = [ 'definition', 'term', 'list' ]; + var base = { + badNodes: [], + hasNonEmptyTextNode: false + }; + var content = virtualNode.children.reduce(function(content2, child) { + var actualNode = child.actualNode; + if (actualNode.nodeName.toUpperCase() === 'DIV' && get_role_default(actualNode) === null) { + return content2.concat(child.children); } - nodeColor = _getBackgroundColor(node); - parentColor = _getBackgroundColor(parentBlock); - if (!nodeColor || !parentColor || getContrast2(nodeColor, parentColor) >= 3) { - var reason; - if (!nodeColor || !parentColor) { - reason = incomplete_data_default.get('bgColor'); - } else { - reason = 'bgContrast'; + return content2.concat(child); + }, []); + var result = content.reduce(function(out, childNode) { + var actualNode = childNode.actualNode; + var tagName = actualNode.nodeName.toUpperCase(); + if (actualNode.nodeType === 1 && _isVisibleToScreenReaders(actualNode)) { + var explicitRole2 = get_explicit_role_default(actualNode); + if (tagName !== 'DT' && tagName !== 'DD' || explicitRole2) { + if (!ALLOWED_ROLES.includes(explicitRole2)) { + out.badNodes.push(actualNode); + } } - incomplete_data_default.set('fgColor', reason); - this.data({ - messageKey: incomplete_data_default.get('fgColor') - }); - incomplete_data_default.clear(); - return void 0; + } else if (actualNode.nodeType === 3 && actualNode.nodeValue.trim() !== '') { + out.hasNonEmptyTextNode = true; } + return out; + }, base); + if (result.badNodes.length) { + this.relatedNodes(result.badNodes); } - return false; + return !!result.badNodes.length || result.hasNonEmptyTextNode; } - var link_in_text_block_evaluate_default = linkInTextBlockEvaluate; - function autocompleteAppropriateEvaluate(node, options, virtualNode) { - if (virtualNode.props.nodeName !== 'input') { + var only_dlitems_evaluate_default = onlyDlitemsEvaluate; + function onlyListitemsEvaluate(node, options, virtualNode) { + var hasNonEmptyTextNode = false; + var atLeastOneListitem = false; + var isEmpty = true; + var badNodes = []; + var badRoleNodes = []; + var badRoles = []; + virtualNode.children.forEach(function(vNode) { + var actualNode = vNode.actualNode; + if (actualNode.nodeType === 3 && actualNode.nodeValue.trim() !== '') { + hasNonEmptyTextNode = true; + return; + } + if (actualNode.nodeType !== 1 || !_isVisibleToScreenReaders(actualNode)) { + return; + } + isEmpty = false; + var isLi = actualNode.nodeName.toUpperCase() === 'LI'; + var role = get_role_default(vNode); + var isListItemRole = role === 'listitem'; + if (!isLi && !isListItemRole) { + badNodes.push(actualNode); + } + if (isLi && !isListItemRole) { + badRoleNodes.push(actualNode); + if (!badRoles.includes(role)) { + badRoles.push(role); + } + } + if (isListItemRole) { + atLeastOneListitem = true; + } + }); + if (hasNonEmptyTextNode || badNodes.length) { + this.relatedNodes(badNodes); return true; } - var number = [ 'text', 'search', 'number', 'tel' ]; - var url = [ 'text', 'search', 'url' ]; - var allowedTypesMap = { - bday: [ 'text', 'search', 'date' ], - email: [ 'text', 'search', 'email' ], - username: [ 'text', 'search', 'email' ], - 'street-address': [ 'text' ], - tel: [ 'text', 'search', 'tel' ], - 'tel-country-code': [ 'text', 'search', 'tel' ], - 'tel-national': [ 'text', 'search', 'tel' ], - 'tel-area-code': [ 'text', 'search', 'tel' ], - 'tel-local': [ 'text', 'search', 'tel' ], - 'tel-local-prefix': [ 'text', 'search', 'tel' ], - 'tel-local-suffix': [ 'text', 'search', 'tel' ], - 'tel-extension': [ 'text', 'search', 'tel' ], - 'cc-number': number, - 'cc-exp': [ 'text', 'search', 'month', 'tel' ], - 'cc-exp-month': number, - 'cc-exp-year': number, - 'cc-csc': number, - 'transaction-amount': number, - 'bday-day': number, - 'bday-month': number, - 'bday-year': number, - 'new-password': [ 'text', 'search', 'password' ], - 'current-password': [ 'text', 'search', 'password' ], - url: url, - photo: url, - impp: url - }; - if (_typeof(options) === 'object') { - Object.keys(options).forEach(function(key) { - if (!allowedTypesMap[key]) { - allowedTypesMap[key] = []; - } - allowedTypesMap[key] = allowedTypesMap[key].concat(options[key]); - }); + if (isEmpty || atLeastOneListitem) { + return false; } - var autocompleteAttr = virtualNode.attr('autocomplete'); - var autocompleteTerms = autocompleteAttr.split(/\s+/g).map(function(term) { - return term.toLowerCase(); + this.relatedNodes(badRoleNodes); + this.data({ + messageKey: 'roleNotValid', + roles: badRoles.join(', ') }); - var purposeTerm = autocompleteTerms[autocompleteTerms.length - 1]; - if (_autocomplete.stateTerms.includes(purposeTerm)) { - return true; + return true; + } + var only_listitems_evaluate_default = onlyListitemsEvaluate; + function structuredDlitemsEvaluate(node, options, virtualNode) { + var children = virtualNode.children; + if (!children || !children.length) { + return false; } - var allowedTypes = allowedTypesMap[purposeTerm]; - var type = virtualNode.hasAttr('type') ? sanitize_default(virtualNode.attr('type')).toLowerCase() : 'text'; - type = valid_input_type_default().includes(type) ? type : 'text'; - if (typeof allowedTypes === 'undefined') { - return type === 'text'; + var hasDt = false, hasDd = false, nodeName2; + for (var i = 0; i < children.length; i++) { + nodeName2 = children[i].props.nodeName.toUpperCase(); + if (nodeName2 === 'DT') { + hasDt = true; + } + if (hasDt && nodeName2 === 'DD') { + return false; + } + if (nodeName2 === 'DD') { + hasDd = true; + } } - return allowedTypes.includes(type); + return hasDt || hasDd; } - var autocomplete_appropriate_evaluate_default = autocompleteAppropriateEvaluate; - function autocompleteValidEvaluate(node, options, virtualNode) { - var autocomplete2 = virtualNode.attr('autocomplete') || ''; - return is_valid_autocomplete_default(autocomplete2, options); + var structured_dlitems_evaluate_default = structuredDlitemsEvaluate; + function captionEvaluate(node, options, virtualNode) { + var tracks = query_selector_all_default(virtualNode, 'track'); + var hasCaptions = tracks.some(function(vNode) { + return (vNode.attr('kind') || '').toLowerCase() === 'captions'; + }); + return hasCaptions ? false : void 0; } - var autocomplete_valid_evaluate_default = autocompleteValidEvaluate; - function attrNonSpaceContentEvaluate(node) { - var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; - var vNode = arguments.length > 2 ? arguments[2] : undefined; - if (!options.attribute || typeof options.attribute !== 'string') { - throw new TypeError('attr-non-space-content requires options.attribute to be a string'); + var caption_evaluate_default = captionEvaluate; + var joinStr = ' > '; + function frameTestedAfter(results) { + var iframes = {}; + return results.filter(function(result) { + var frameResult = result.node.ancestry[result.node.ancestry.length - 1] !== 'html'; + if (frameResult) { + var ancestry2 = result.node.ancestry.flat(Infinity).join(joinStr); + iframes[ancestry2] = result; + return true; + } + var ancestry = result.node.ancestry.slice(0, result.node.ancestry.length - 1).flat(Infinity).join(joinStr); + if (iframes[ancestry]) { + iframes[ancestry].result = true; + } + return false; + }); + } + var frame_tested_after_default = frameTestedAfter; + function frameTestedEvaluate(node, options) { + return options.isViolation ? false : void 0; + } + var frame_tested_evaluate_default = frameTestedEvaluate; + function noAutoplayAudioEvaluate(node, options) { + if (!node.duration) { + console.warn('axe.utils.preloadMedia did not load metadata'); + return void 0; } - if (!vNode.hasAttr(options.attribute)) { - this.data({ - messageKey: 'noAttr' - }); - return false; + var _options$allowedDurat = options.allowedDuration, allowedDuration = _options$allowedDurat === void 0 ? 3 : _options$allowedDurat; + var playableDuration = getPlayableDuration(node); + if (playableDuration <= allowedDuration && !node.hasAttribute('loop')) { + return true; } - var attribute = vNode.attr(options.attribute); - var attributeIsEmpty = !sanitize_default(attribute); - if (attributeIsEmpty) { - this.data({ - messageKey: 'emptyAttr' - }); + if (!node.hasAttribute('controls')) { return false; } return true; - } - var attr_non_space_content_evaluate_default = attrNonSpaceContentEvaluate; - function pageHasElmAfter(results) { - var elmUsedAnywhere = results.some(function(frameResult) { - return frameResult.result === true; - }); - if (elmUsedAnywhere) { - results.forEach(function(result) { - result.result = true; + function getPlayableDuration(elm) { + if (!elm.currentSrc) { + return 0; + } + var playbackRange = getPlaybackRange(elm.currentSrc); + if (!playbackRange) { + return Math.abs(elm.duration - (elm.currentTime || 0)); + } + if (playbackRange.length === 1) { + return Math.abs(elm.duration - playbackRange[0]); + } + return Math.abs(playbackRange[1] - playbackRange[0]); + } + function getPlaybackRange(src) { + var match = src.match(/#t=(.*)/); + if (!match) { + return; + } + var _match = _slicedToArray(match, 2), value = _match[1]; + var ranges = value.split(','); + return ranges.map(function(range) { + if (/:/.test(range)) { + return convertHourMinSecToSeconds(range); + } + return parseFloat(range); }); } - return results; - } - var has_descendant_after_default = pageHasElmAfter; - function hasDescendant(node, options, virtualNode) { - if (!options || !options.selector || typeof options.selector !== 'string') { - throw new TypeError('has-descendant requires options.selector to be a string'); + function convertHourMinSecToSeconds(hhMmSs) { + var parts = hhMmSs.split(':'); + var secs = 0; + var mins = 1; + while (parts.length > 0) { + secs += mins * parseInt(parts.pop(), 10); + mins *= 60; + } + return parseFloat(secs); } - var matchingElms = query_selector_all_filter_default(virtualNode, options.selector, function(vNode) { - return is_visible_default(vNode.actualNode, true); - }); - this.relatedNodes(matchingElms.map(function(vNode) { - return vNode.actualNode; - })); - return matchingElms.length > 0; } - var has_descendant_evaluate_default = hasDescendant; - function hasTextContentEvaluate(node, options, virtualNode) { - try { - return sanitize_default(subtree_text_default(virtualNode)) !== ''; - } catch (e) { + var no_autoplay_audio_evaluate_default = noAutoplayAudioEvaluate; + function cssOrientationLockEvaluate(node, options, virtualNode, context) { + var _ref84 = context || {}, _ref84$cssom = _ref84.cssom, cssom = _ref84$cssom === void 0 ? void 0 : _ref84$cssom; + var _ref85 = options || {}, _ref85$degreeThreshol = _ref85.degreeThreshold, degreeThreshold = _ref85$degreeThreshol === void 0 ? 0 : _ref85$degreeThreshol; + if (!cssom || !cssom.length) { return void 0; } - } - var has_text_content_evaluate_default = hasTextContentEvaluate; - function matchesDefinitionEvaluate(_, options, virtualNode) { - return matches_default3(virtualNode, options.matcher); - } - var matches_definition_evaluate_default = matchesDefinitionEvaluate; - function pageNoDuplicateAfter(results) { - return results.filter(function(checkResult) { - return checkResult.data !== 'ignored'; - }); - } - var page_no_duplicate_after_default = pageNoDuplicateAfter; - function pageNoDuplicateEvaluate(node, options, virtualNode) { - if (!options || !options.selector || typeof options.selector !== 'string') { - throw new TypeError('page-no-duplicate requires options.selector to be a string'); - } - var key = 'page-no-duplicate;' + options.selector; - if (cache_default.get(key)) { - this.data('ignored'); - return; - } - cache_default.set(key, true); - var elms = query_selector_all_filter_default(axe._tree[0], options.selector, function(elm) { - return is_visible_default(elm.actualNode, true); - }); - if (typeof options.nativeScopeFilter === 'string') { - elms = elms.filter(function(elm) { - return elm.actualNode.hasAttribute('role') || !find_up_virtual_default(elm, options.nativeScopeFilter); + var isLocked = false; + var relatedElements = []; + var rulesGroupByDocumentFragment = groupCssomByDocument(cssom); + var _loop7 = function _loop7() { + var key = _Object$keys2[_i24]; + var _rulesGroupByDocument = rulesGroupByDocumentFragment[key], root = _rulesGroupByDocument.root, rules = _rulesGroupByDocument.rules; + var orientationRules = rules.filter(isMediaRuleWithOrientation); + if (!orientationRules.length) { + return 'continue'; + } + orientationRules.forEach(function(_ref86) { + var cssRules = _ref86.cssRules; + Array.from(cssRules).forEach(function(cssRule) { + var locked = getIsOrientationLocked(cssRule); + if (locked && cssRule.selectorText.toUpperCase() !== 'HTML') { + var elms = Array.from(root.querySelectorAll(cssRule.selectorText)) || []; + relatedElements = relatedElements.concat(elms); + } + isLocked = isLocked || locked; + }); }); + }; + for (var _i24 = 0, _Object$keys2 = Object.keys(rulesGroupByDocumentFragment); _i24 < _Object$keys2.length; _i24++) { + var _ret3 = _loop7(); + if (_ret3 === 'continue') { + continue; + } } - this.relatedNodes(elms.filter(function(elm) { - return elm !== virtualNode; - }).map(function(elm) { - return elm.actualNode; - })); - return elms.length <= 1; - } - var page_no_duplicate_evaluate_default = pageNoDuplicateEvaluate; - function headingOrderAfter(results) { - var headingOrder = getHeadingOrder(results); - results.forEach(function(result) { - result.result = getHeadingOrderOutcome(result, headingOrder); - }); - return results; - } - function getHeadingOrderOutcome(result, headingOrder) { - var _headingOrder$index$l, _headingOrder$index, _headingOrder$level, _headingOrder; - var index = findHeadingOrderIndex(headingOrder, result.node.ancestry); - var currLevel = (_headingOrder$index$l = (_headingOrder$index = headingOrder[index]) === null || _headingOrder$index === void 0 ? void 0 : _headingOrder$index.level) !== null && _headingOrder$index$l !== void 0 ? _headingOrder$index$l : -1; - var prevLevel = (_headingOrder$level = (_headingOrder = headingOrder[index - 1]) === null || _headingOrder === void 0 ? void 0 : _headingOrder.level) !== null && _headingOrder$level !== void 0 ? _headingOrder$level : -1; - if (index === 0) { + if (!isLocked) { return true; } - if (currLevel === -1) { - return void 0; + if (relatedElements.length) { + this.relatedNodes(relatedElements); } - return currLevel - prevLevel <= 1; - } - function getHeadingOrder(results) { - results = _toConsumableArray(results); - results.sort(function(_ref62, _ref63) { - var nodeA = _ref62.node; - var nodeB = _ref63.node; - return nodeA.ancestry.length - nodeB.ancestry.length; - }); - var headingOrder = results.reduce(mergeHeadingOrder, []); - return headingOrder.filter(function(_ref64) { - var level = _ref64.level; - return level !== -1; - }); - } - function mergeHeadingOrder(mergedHeadingOrder, result) { - var _result$data; - var frameHeadingOrder = (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.headingOrder; - var frameAncestry = shortenArray(result.node.ancestry, 1); - if (!frameHeadingOrder) { - return mergedHeadingOrder; + return false; + function groupCssomByDocument(cssObjectModel) { + return cssObjectModel.reduce(function(out, _ref87) { + var sheet = _ref87.sheet, root = _ref87.root, shadowId = _ref87.shadowId; + var key = shadowId ? shadowId : 'topDocument'; + if (!out[key]) { + out[key] = { + root: root, + rules: [] + }; + } + if (!sheet || !sheet.cssRules) { + return out; + } + var rules = Array.from(sheet.cssRules); + out[key].rules = out[key].rules.concat(rules); + return out; + }, {}); } - var normalizedHeadingOrder = frameHeadingOrder.map(function(heading) { - return addFrameToHeadingAncestry(heading, frameAncestry); - }); - var index = getFrameIndex(mergedHeadingOrder, frameAncestry); - if (index === -1) { - mergedHeadingOrder.push.apply(mergedHeadingOrder, _toConsumableArray(normalizedHeadingOrder)); - } else { - mergedHeadingOrder.splice.apply(mergedHeadingOrder, [ index, 0 ].concat(_toConsumableArray(normalizedHeadingOrder))); + function isMediaRuleWithOrientation(_ref88) { + var type = _ref88.type, cssText = _ref88.cssText; + if (type !== 4) { + return false; + } + return /orientation:\s*landscape/i.test(cssText) || /orientation:\s*portrait/i.test(cssText); } - return mergedHeadingOrder; - } - function getFrameIndex(headingOrder, frameAncestry) { - while (frameAncestry.length) { - var index = findHeadingOrderIndex(headingOrder, frameAncestry); - if (index !== -1) { - return index; + function getIsOrientationLocked(_ref89) { + var selectorText = _ref89.selectorText, style = _ref89.style; + if (!selectorText || style.length <= 0) { + return false; + } + var transformStyle = style.transform || style.webkitTransform || style.msTransform || false; + if (!transformStyle) { + return false; + } + var matches4 = transformStyle.match(/(rotate|rotateZ|rotate3d|matrix|matrix3d)\(([^)]+)\)(?!.*(rotate|rotateZ|rotate3d|matrix|matrix3d))/); + if (!matches4) { + return false; + } + var _matches = _slicedToArray(matches4, 3), transformFn = _matches[1], transformFnValue = _matches[2]; + var degrees = getRotationInDegrees(transformFn, transformFnValue); + if (!degrees) { + return false; + } + degrees = Math.abs(degrees); + if (Math.abs(degrees - 180) % 180 <= degreeThreshold) { + return false; + } + return Math.abs(degrees - 90) % 90 <= degreeThreshold; + } + function getRotationInDegrees(transformFunction, transformFnValue) { + switch (transformFunction) { + case 'rotate': + case 'rotateZ': + return getAngleInDegrees(transformFnValue); + + case 'rotate3d': + var _transformFnValue$spl = transformFnValue.split(',').map(function(value) { + return value.trim(); + }), _transformFnValue$spl2 = _slicedToArray(_transformFnValue$spl, 4), z = _transformFnValue$spl2[2], angleWithUnit = _transformFnValue$spl2[3]; + if (parseInt(z) === 0) { + return; + } + return getAngleInDegrees(angleWithUnit); + + case 'matrix': + case 'matrix3d': + return getAngleInDegreesFromMatrixTransform(transformFnValue); + + default: + return; + } + } + function getAngleInDegrees(angleWithUnit) { + var _ref90 = angleWithUnit.match(/(deg|grad|rad|turn)/) || [], _ref91 = _slicedToArray(_ref90, 1), unit = _ref91[0]; + if (!unit) { + return; + } + var angle = parseFloat(angleWithUnit.replace(unit, '')); + switch (unit) { + case 'rad': + return convertRadToDeg(angle); + + case 'grad': + return convertGradToDeg(angle); + + case 'turn': + return convertTurnToDeg(angle); + + case 'deg': + default: + return parseInt(angle); } - frameAncestry = shortenArray(frameAncestry, 1); } - return -1; - } - function findHeadingOrderIndex(headingOrder, ancestry) { - return headingOrder.findIndex(function(heading) { - return match_ancestry_default(heading.ancestry, ancestry); - }); - } - function addFrameToHeadingAncestry(heading, frameAncestry) { - var ancestry = frameAncestry.concat(heading.ancestry); - return _extends({}, heading, { - ancestry: ancestry - }); - } - function shortenArray(arr, spliceLength) { - return arr.slice(0, arr.length - spliceLength); - } - function getLevel(vNode) { - var role = get_role_default(vNode); - var headingRole = role && role.includes('heading'); - var ariaHeadingLevel = vNode.attr('aria-level'); - var ariaLevel = parseInt(ariaHeadingLevel, 10); - var _ref65 = vNode.props.nodeName.match(/h(\d)/) || [], _ref66 = _slicedToArray(_ref65, 2), headingLevel = _ref66[1]; - if (!headingRole) { - return -1; + function getAngleInDegreesFromMatrixTransform(transformFnValue) { + var values = transformFnValue.split(','); + if (values.length <= 6) { + var _values = _slicedToArray(values, 2), a = _values[0], b2 = _values[1]; + var radians = Math.atan2(parseFloat(b2), parseFloat(a)); + return convertRadToDeg(radians); + } + var sinB = parseFloat(values[8]); + var b = Math.asin(sinB); + var cosB = Math.cos(b); + var rotateZRadians = Math.acos(parseFloat(values[0]) / cosB); + return convertRadToDeg(rotateZRadians); } - if (headingLevel && !ariaHeadingLevel) { - return parseInt(headingLevel, 10); + function convertRadToDeg(radians) { + return Math.round(radians * (180 / Math.PI)); } - if (isNaN(ariaLevel) || ariaLevel < 1) { - if (headingLevel) { - return parseInt(headingLevel, 10); + function convertGradToDeg(grad) { + grad = grad % 400; + if (grad < 0) { + grad += 400; } - return 2; + return Math.round(grad / 400 * 360); } - if (ariaLevel) { - return ariaLevel; + function convertTurnToDeg(turn) { + return Math.round(360 / (1 / turn)); } - return -1; } - function headingOrderEvaluate() { - var headingOrder = cache_default.get('headingOrder'); - if (headingOrder) { + var css_orientation_lock_evaluate_default = cssOrientationLockEvaluate; + function metaViewportScaleEvaluate(node, options, virtualNode) { + var _ref92 = options || {}, _ref92$scaleMinimum = _ref92.scaleMinimum, scaleMinimum = _ref92$scaleMinimum === void 0 ? 2 : _ref92$scaleMinimum, _ref92$lowerBound = _ref92.lowerBound, lowerBound = _ref92$lowerBound === void 0 ? false : _ref92$lowerBound; + var content = virtualNode.attr('content') || ''; + if (!content) { return true; } - var selector = 'h1, h2, h3, h4, h5, h6, [role=heading], iframe, frame'; - var vNodes = query_selector_all_filter_default(axe._tree[0], selector, function(vNode) { - return is_visible_default(vNode.actualNode, true); - }); - headingOrder = vNodes.map(function(vNode) { - return { - ancestry: [ _getAncestry(vNode.actualNode) ], - level: getLevel(vNode) - }; - }); - this.data({ - headingOrder: headingOrder - }); - cache_default.set('headingOrder', vNodes); - return true; - } - var heading_order_evaluate_default = headingOrderEvaluate; - function isIdenticalObject(a, b) { - if (!a || !b) { - return false; - } - var aProps = Object.getOwnPropertyNames(a); - var bProps = Object.getOwnPropertyNames(b); - if (aProps.length !== bProps.length) { - return false; - } - var result = aProps.every(function(propName) { - var aValue = a[propName]; - var bValue = b[propName]; - if (_typeof(aValue) !== _typeof(bValue)) { - return false; - } - if (typeof aValue === 'object' || typeof bValue === 'object') { - return isIdenticalObject(aValue, bValue); + var result = content.split(/[;,]/).reduce(function(out, item) { + var contentValue = item.trim(); + if (!contentValue) { + return out; } - return aValue === bValue; - }); - return result; - } - function identicalLinksSamePurposeAfter(results) { - if (results.length < 2) { - return results; - } - var incompleteResults = results.filter(function(_ref67) { - var result = _ref67.result; - return result !== void 0; - }); - var uniqueResults = []; - var nameMap = {}; - var _loop5 = function _loop5(index) { - var _currentResult$relate; - var currentResult = incompleteResults[index]; - var _currentResult$data = currentResult.data, name = _currentResult$data.name, urlProps = _currentResult$data.urlProps; - if (nameMap[name]) { - return 'continue'; + var _contentValue$split = contentValue.split('='), _contentValue$split2 = _slicedToArray(_contentValue$split, 2), key = _contentValue$split2[0], value = _contentValue$split2[1]; + if (!key || !value) { + return out; } - var sameNameResults = incompleteResults.filter(function(_ref68, resultNum) { - var data2 = _ref68.data; - return data2.name === name && resultNum !== index; - }); - var isSameUrl = sameNameResults.every(function(_ref69) { - var data2 = _ref69.data; - return isIdenticalObject(data2.urlProps, urlProps); - }); - if (sameNameResults.length && !isSameUrl) { - currentResult.result = void 0; + var curatedKey = key.toLowerCase().trim(); + var curatedValue = value.toLowerCase().trim(); + if (curatedKey === 'maximum-scale' && curatedValue === 'yes') { + curatedValue = 1; } - currentResult.relatedNodes = []; - (_currentResult$relate = currentResult.relatedNodes).push.apply(_currentResult$relate, _toConsumableArray(sameNameResults.map(function(node) { - return node.relatedNodes[0]; - }))); - nameMap[name] = sameNameResults; - uniqueResults.push(currentResult); - }; - for (var index = 0; index < incompleteResults.length; index++) { - var _ret2 = _loop5(index); - if (_ret2 === 'continue') { - continue; + if (curatedKey === 'maximum-scale' && parseFloat(curatedValue) < 0) { + return out; } + out[curatedKey] = curatedValue; + return out; + }, {}); + if (lowerBound && result['maximum-scale'] && parseFloat(result['maximum-scale']) < lowerBound) { + return true; } - return uniqueResults; - } - var identical_links_same_purpose_after_default = identicalLinksSamePurposeAfter; - var commons_exports = {}; - __export(commons_exports, { - aria: function aria() { - return aria_exports; - }, - color: function color() { - return color_exports; - }, - dom: function dom() { - return dom_exports; - }, - forms: function forms() { - return forms_exports; - }, - matches: function matches() { - return matches_default3; - }, - standards: function standards() { - return standards_exports; - }, - table: function table() { - return table_exports; - }, - text: function text() { - return text_exports; - }, - utils: function utils() { - return utils_exports; - } - }); - var forms_exports = {}; - __export(forms_exports, { - isAriaCombobox: function isAriaCombobox() { - return is_aria_combobox_default; - }, - isAriaListbox: function isAriaListbox() { - return is_aria_listbox_default; - }, - isAriaRange: function isAriaRange() { - return is_aria_range_default; - }, - isAriaTextbox: function isAriaTextbox() { - return is_aria_textbox_default; - }, - isDisabled: function isDisabled() { - return is_disabled_default; - }, - isNativeSelect: function isNativeSelect() { - return is_native_select_default; - }, - isNativeTextbox: function isNativeTextbox() { - return is_native_textbox_default; + if (!lowerBound && result['user-scalable'] === 'no') { + this.data('user-scalable=no'); + return false; } - }); - var disabledNodeNames = [ 'fieldset', 'button', 'select', 'input', 'textarea' ]; - function isDisabled(virtualNode) { - var disabledState = virtualNode._isDisabled; - if (typeof disabledState === 'boolean') { - return disabledState; + var userScalableAsFloat = parseFloat(result['user-scalable']); + if (!lowerBound && result['user-scalable'] && (userScalableAsFloat || userScalableAsFloat === 0) && userScalableAsFloat > -1 && userScalableAsFloat < 1) { + this.data('user-scalable'); + return false; } - var nodeName2 = virtualNode.props.nodeName; - var ariaDisabled = virtualNode.attr('aria-disabled'); - if (disabledNodeNames.includes(nodeName2) && virtualNode.hasAttr('disabled')) { - disabledState = true; - } else if (ariaDisabled) { - disabledState = ariaDisabled.toLowerCase() === 'true'; - } else if (virtualNode.parent) { - disabledState = isDisabled(virtualNode.parent); - } else { - disabledState = false; + if (result['maximum-scale'] && parseFloat(result['maximum-scale']) < scaleMinimum) { + this.data('maximum-scale'); + return false; } - virtualNode._isDisabled = disabledState; - return disabledState; + return true; } - var is_disabled_default = isDisabled; - var commons = { - aria: aria_exports, - color: color_exports, - dom: dom_exports, - forms: forms_exports, - matches: matches_default3, - standards: standards_exports, - table: table_exports, - text: text_exports, - utils: utils_exports - }; - function identicalLinksSamePurposeEvaluate(node, options, virtualNode) { - var accText = text_exports.accessibleTextVirtual(virtualNode); - var name = text_exports.sanitize(text_exports.removeUnicode(accText, { - emoji: true, - nonBmp: true, - punctuations: true - })).toLowerCase(); - if (!name) { + var meta_viewport_scale_evaluate_default = metaViewportScaleEvaluate; + var roundingMargin = .05; + function targetOffsetEvaluate(node, options, vNode) { + var minOffset = (options === null || options === void 0 ? void 0 : options.minOffset) || 24; + var closeNeighbors = []; + var closestOffset = minOffset; + var _iterator8 = _createForOfIteratorHelper(_findNearbyElms(vNode, minOffset)), _step8; + try { + for (_iterator8.s(); !(_step8 = _iterator8.n()).done; ) { + var vNeighbor = _step8.value; + if (get_role_type_default(vNeighbor) !== 'widget' || !_isFocusable(vNeighbor)) { + continue; + } + var offset = roundToSingleDecimal(_getOffset(vNode, vNeighbor)); + if (offset + roundingMargin >= minOffset) { + continue; + } + closestOffset = Math.min(closestOffset, offset); + closeNeighbors.push(vNeighbor); + } + } catch (err) { + _iterator8.e(err); + } finally { + _iterator8.f(); + } + if (closeNeighbors.length === 0) { + this.data({ + closestOffset: closestOffset, + minOffset: minOffset + }); + return true; + } + this.relatedNodes(closeNeighbors.map(function(_ref93) { + var actualNode = _ref93.actualNode; + return actualNode; + })); + if (!closeNeighbors.some(_isInTabOrder)) { + this.data({ + messageKey: 'nonTabbableNeighbor', + closestOffset: closestOffset, + minOffset: minOffset + }); return void 0; } - var afterData = { - name: name, - urlProps: dom_exports.urlPropsFromAttribute(node, 'href') - }; - this.data(afterData); - this.relatedNodes([ node ]); - return true; - } - var identical_links_same_purpose_evaluate_default = identicalLinksSamePurposeEvaluate; - function internalLinkPresentEvaluate(node, options, virtualNode) { - var links = query_selector_all_default(virtualNode, 'a[href]'); - return links.some(function(vLink) { - return /^#[^/!]/.test(vLink.attr('href')); + this.data({ + closestOffset: closestOffset, + minOffset: minOffset }); + return _isInTabOrder(vNode) ? false : void 0; } - var internal_link_present_evaluate_default = internalLinkPresentEvaluate; - function metaRefreshEvaluate(node, options, virtualNode) { - var content = virtualNode.attr('content') || '', parsedParams = content.split(/[;,]/); - return content === '' || parsedParams[0] === '0'; + function roundToSingleDecimal(num) { + return Math.round(num * 10) / 10; } - var meta_refresh_evaluate_default = metaRefreshEvaluate; - function normalizeFontWeight(weight) { - switch (weight) { - case 'lighter': - return 100; - - case 'normal': - return 400; - - case 'bold': - return 700; - - case 'bolder': - return 900; + var roundingMargin2 = .05; + function targetSize(node, options, vNode) { + var minSize = (options === null || options === void 0 ? void 0 : options.minSize) || 24; + var nodeRect = vNode.boundingClientRect; + var hasMinimumSize = rectHasMinimumSize.bind(null, minSize); + var nearbyElms = _findNearbyElms(vNode); + var overflowingContent = filterOverflowingContent(vNode, nearbyElms); + var _filterByElmsOverlap = filterByElmsOverlap(vNode, nearbyElms), fullyObscuringElms = _filterByElmsOverlap.fullyObscuringElms, partialObscuringElms = _filterByElmsOverlap.partialObscuringElms; + if (fullyObscuringElms.length && !overflowingContent.length) { + this.relatedNodes(mapActualNodes(fullyObscuringElms)); + this.data({ + messageKey: 'obscured' + }); + return true; } - weight = parseInt(weight); - return !isNaN(weight) ? weight : 400; + var negativeOutcome = _isInTabOrder(vNode) ? false : void 0; + if (!hasMinimumSize(nodeRect) && !overflowingContent.length) { + this.data(_extends({ + minSize: minSize + }, toDecimalSize(nodeRect))); + return negativeOutcome; + } + var obscuredWidgets = filterFocusableWidgets(partialObscuringElms); + var largestInnerRect = getLargestUnobscuredArea(vNode, obscuredWidgets); + if (overflowingContent.length) { + if (fullyObscuringElms.length || !hasMinimumSize(largestInnerRect || nodeRect)) { + this.data({ + minSize: minSize, + messageKey: 'contentOverflow' + }); + this.relatedNodes(mapActualNodes(overflowingContent)); + return void 0; + } + } + if (obscuredWidgets.length !== 0 && !hasMinimumSize(largestInnerRect)) { + var allTabbable = obscuredWidgets.every(_isInTabOrder); + var messageKey = 'partiallyObscured'.concat(allTabbable ? '' : 'NonTabbable'); + this.data(_extends({ + messageKey: messageKey, + minSize: minSize + }, toDecimalSize(largestInnerRect))); + this.relatedNodes(mapActualNodes(obscuredWidgets)); + return allTabbable ? negativeOutcome : void 0; + } + this.data(_extends({ + minSize: minSize + }, toDecimalSize(largestInnerRect || nodeRect))); + this.relatedNodes(mapActualNodes(obscuredWidgets)); + return true; } - function getTextContainer(elm) { - var nextNode = elm; - var outerText = elm.textContent.trim(); - var innerText = outerText; - while (innerText === outerText && nextNode !== void 0) { - var _i21 = -1; - elm = nextNode; - if (elm.children.length === 0) { - return elm; + function filterOverflowingContent(vNode, nearbyElms) { + return nearbyElms.filter(function(nearbyElm) { + return !isEnclosedRect(nearbyElm, vNode) && isDescendantNotInTabOrder(vNode, nearbyElm); + }); + } + function filterByElmsOverlap(vNode, nearbyElms) { + var fullyObscuringElms = []; + var partialObscuringElms = []; + var _iterator9 = _createForOfIteratorHelper(nearbyElms), _step9; + try { + for (_iterator9.s(); !(_step9 = _iterator9.n()).done; ) { + var vNeighbor = _step9.value; + if (!isDescendantNotInTabOrder(vNode, vNeighbor) && _hasVisualOverlap(vNode, vNeighbor) && getCssPointerEvents(vNeighbor) !== 'none') { + if (isEnclosedRect(vNode, vNeighbor)) { + fullyObscuringElms.push(vNeighbor); + } else { + partialObscuringElms.push(vNeighbor); + } + } } - do { - _i21++; - innerText = elm.children[_i21].textContent.trim(); - } while (innerText === '' && _i21 + 1 < elm.children.length); - nextNode = elm.children[_i21]; + } catch (err) { + _iterator9.e(err); + } finally { + _iterator9.f(); } - return elm; + return { + fullyObscuringElms: fullyObscuringElms, + partialObscuringElms: partialObscuringElms + }; } - function getStyleValues(node) { - var style = window.getComputedStyle(getTextContainer(node)); + function getLargestUnobscuredArea(vNode, obscuredNodes) { + var nodeRect = vNode.boundingClientRect; + if (obscuredNodes.length === 0) { + return null; + } + var obscuringRects = obscuredNodes.map(function(_ref94) { + var rect = _ref94.boundingClientRect; + return rect; + }); + var unobscuredRects = _splitRects(nodeRect, obscuringRects); + return getLargestRect(unobscuredRects); + } + function getLargestRect(rects, minSize) { + return rects.reduce(function(rectA, rectB) { + var rectAisMinimum = rectHasMinimumSize(minSize, rectA); + var rectBisMinimum = rectHasMinimumSize(minSize, rectB); + if (rectAisMinimum !== rectBisMinimum) { + return rectAisMinimum ? rectA : rectB; + } + var areaA = rectA.width * rectA.height; + var areaB = rectB.width * rectB.height; + return areaA > areaB ? rectA : rectB; + }); + } + function filterFocusableWidgets(vNodes) { + return vNodes.filter(function(vNode) { + return get_role_type_default(vNode) === 'widget' && _isFocusable(vNode); + }); + } + function isEnclosedRect(vNodeA, vNodeB) { + var rectA = vNodeA.boundingClientRect; + var rectB = vNodeB.boundingClientRect; + return rectA.top >= rectB.top && rectA.left >= rectB.left && rectA.bottom <= rectB.bottom && rectA.right <= rectB.right; + } + function getCssPointerEvents(vNode) { + return vNode.getComputedStylePropertyValue('pointer-events'); + } + function toDecimalSize(rect) { return { - fontWeight: normalizeFontWeight(style.getPropertyValue('font-weight')), - fontSize: parseInt(style.getPropertyValue('font-size')), - isItalic: style.getPropertyValue('font-style') === 'italic' + width: Math.round(rect.width * 10) / 10, + height: Math.round(rect.height * 10) / 10 }; } - function isHeaderStyle(styleA, styleB, margins) { - return margins.reduce(function(out, margin) { - return out || (!margin.size || styleA.fontSize / margin.size > styleB.fontSize) && (!margin.weight || styleA.fontWeight - margin.weight > styleB.fontWeight) && (!margin.italic || styleA.isItalic && !styleB.isItalic); - }, false); + function isDescendantNotInTabOrder(vAncestor, vNode) { + return vAncestor.actualNode.contains(vNode.actualNode) && !_isInTabOrder(vNode); } - function pAsHeadingEvaluate(node, options, virtualNode) { - var siblings = Array.from(node.parentNode.children); - var currentIndex = siblings.indexOf(node); - options = options || {}; - var margins = options.margins || []; - var nextSibling = siblings.slice(currentIndex + 1).find(function(elm) { - return elm.nodeName.toUpperCase() === 'P'; + function rectHasMinimumSize(minSize, _ref95) { + var width = _ref95.width, height = _ref95.height; + return width + roundingMargin2 >= minSize && height + roundingMargin2 >= minSize; + } + function mapActualNodes(vNodes) { + return vNodes.map(function(_ref96) { + var actualNode = _ref96.actualNode; + return actualNode; }); - var prevSibling = siblings.slice(0, currentIndex).reverse().find(function(elm) { - return elm.nodeName.toUpperCase() === 'P'; + } + function headingOrderAfter(results) { + var headingOrder = getHeadingOrder(results); + results.forEach(function(result) { + result.result = getHeadingOrderOutcome(result, headingOrder); }); - var currStyle = getStyleValues(node); - var nextStyle = nextSibling ? getStyleValues(nextSibling) : null; - var prevStyle = prevSibling ? getStyleValues(prevSibling) : null; - var optionsPassLength = options.passLength; - var optionsFailLength = options.failLength; - var headingLength = node.textContent.trim().length; - var paragraphLength = nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.textContent.trim().length; - if (headingLength > paragraphLength * optionsPassLength) { - return true; - } - if (!nextStyle || !isHeaderStyle(currStyle, nextStyle, margins)) { + return results; + } + function getHeadingOrderOutcome(result, headingOrder) { + var _headingOrder$index$l, _headingOrder$index, _headingOrder$level, _headingOrder; + var index = findHeadingOrderIndex(headingOrder, result.node.ancestry); + var currLevel = (_headingOrder$index$l = (_headingOrder$index = headingOrder[index]) === null || _headingOrder$index === void 0 ? void 0 : _headingOrder$index.level) !== null && _headingOrder$index$l !== void 0 ? _headingOrder$index$l : -1; + var prevLevel = (_headingOrder$level = (_headingOrder = headingOrder[index - 1]) === null || _headingOrder === void 0 ? void 0 : _headingOrder.level) !== null && _headingOrder$level !== void 0 ? _headingOrder$level : -1; + if (index === 0) { return true; } - var blockquote = find_up_virtual_default(virtualNode, 'blockquote'); - if (blockquote && blockquote.nodeName.toUpperCase() === 'BLOCKQUOTE') { + if (currLevel === -1) { return void 0; } - if (prevStyle && !isHeaderStyle(currStyle, prevStyle, margins)) { - return void 0; + return currLevel - prevLevel <= 1; + } + function getHeadingOrder(results) { + results = _toConsumableArray(results); + results.sort(function(_ref97, _ref98) { + var nodeA = _ref97.node; + var nodeB = _ref98.node; + return nodeA.ancestry.length - nodeB.ancestry.length; + }); + var headingOrder = results.reduce(mergeHeadingOrder, []); + return headingOrder.filter(function(_ref99) { + var level = _ref99.level; + return level !== -1; + }); + } + function mergeHeadingOrder(mergedHeadingOrder, result) { + var _result$data; + var frameHeadingOrder = (_result$data = result.data) === null || _result$data === void 0 ? void 0 : _result$data.headingOrder; + var frameAncestry = shortenArray(result.node.ancestry, 1); + if (!frameHeadingOrder) { + return mergedHeadingOrder; } - if (headingLength > paragraphLength * optionsFailLength) { - return void 0; + var normalizedHeadingOrder = frameHeadingOrder.map(function(heading) { + return addFrameToHeadingAncestry(heading, frameAncestry); + }); + var index = getFrameIndex(mergedHeadingOrder, frameAncestry); + if (index === -1) { + mergedHeadingOrder.push.apply(mergedHeadingOrder, _toConsumableArray(normalizedHeadingOrder)); + } else { + mergedHeadingOrder.splice.apply(mergedHeadingOrder, [ index, 0 ].concat(_toConsumableArray(normalizedHeadingOrder))); } - return false; + return mergedHeadingOrder; } - var p_as_heading_evaluate_default = pAsHeadingEvaluate; - var landmarkRoles2 = get_aria_roles_by_type_default('landmark'); - var implicitAriaLiveRoles = [ 'alert', 'log', 'status' ]; - function isRegion(virtualNode, options) { - var node = virtualNode.actualNode; - var role = get_role_default(virtualNode); - var ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim(); - if ([ 'assertive', 'polite' ].includes(ariaLive) || implicitAriaLiveRoles.includes(role)) { - return true; + function getFrameIndex(headingOrder, frameAncestry) { + while (frameAncestry.length) { + var index = findHeadingOrderIndex(headingOrder, frameAncestry); + if (index !== -1) { + return index; + } + frameAncestry = shortenArray(frameAncestry, 1); } - if (landmarkRoles2.includes(role)) { - return true; + return -1; + } + function findHeadingOrderIndex(headingOrder, ancestry) { + return headingOrder.findIndex(function(heading) { + return match_ancestry_default(heading.ancestry, ancestry); + }); + } + function addFrameToHeadingAncestry(heading, frameAncestry) { + var ancestry = frameAncestry.concat(heading.ancestry); + return _extends({}, heading, { + ancestry: ancestry + }); + } + function shortenArray(arr, spliceLength) { + return arr.slice(0, arr.length - spliceLength); + } + function getLevel(vNode) { + var role = get_role_default(vNode); + var headingRole = role && role.includes('heading'); + var ariaHeadingLevel = vNode.attr('aria-level'); + var ariaLevel = parseInt(ariaHeadingLevel, 10); + var _ref100 = vNode.props.nodeName.match(/h(\d)/) || [], _ref101 = _slicedToArray(_ref100, 2), headingLevel = _ref101[1]; + if (!headingRole) { + return -1; } - if (options.regionMatcher && matches_default3(virtualNode, options.regionMatcher)) { - return true; + if (headingLevel && !ariaHeadingLevel) { + return parseInt(headingLevel, 10); } - return false; - } - function findRegionlessElms(virtualNode, options) { - var node = virtualNode.actualNode; - if (get_role_default(virtualNode) === 'button' || isRegion(virtualNode, options) || [ 'iframe', 'frame' ].includes(virtualNode.props.nodeName) || _isSkipLink(virtualNode.actualNode) && get_element_by_reference_default(virtualNode.actualNode, 'href') || !is_visible_default(node, true)) { - var vNode = virtualNode; - while (vNode) { - vNode._hasRegionDescendant = true; - vNode = vNode.parent; - } - if ([ 'iframe', 'frame' ].includes(virtualNode.props.nodeName)) { - return [ virtualNode ]; + if (isNaN(ariaLevel) || ariaLevel < 1) { + if (headingLevel) { + return parseInt(headingLevel, 10); } - return []; - } else if (node !== document.body && has_content_default(node, true)) { - return [ virtualNode ]; - } else { - return virtualNode.children.filter(function(_ref70) { - var actualNode = _ref70.actualNode; - return actualNode.nodeType === 1; - }).map(function(vNode) { - return findRegionlessElms(vNode, options); - }).reduce(function(a, b) { - return a.concat(b); - }, []); + return 2; + } + if (ariaLevel) { + return ariaLevel; } + return -1; } - function regionEvaluate(node, options, virtualNode) { - var regionlessNodes = cache_default.get('regionlessNodes'); + function headingOrderEvaluate() { + var headingOrder = cache_default.get('headingOrder'); + if (headingOrder) { + return true; + } + var selector = 'h1, h2, h3, h4, h5, h6, [role=heading], iframe, frame'; + var vNodes = query_selector_all_filter_default(axe._tree[0], selector, _isVisibleToScreenReaders); + headingOrder = vNodes.map(function(vNode) { + return { + ancestry: [ _getAncestry(vNode.actualNode) ], + level: getLevel(vNode) + }; + }); this.data({ - isIframe: [ 'iframe', 'frame' ].includes(virtualNode.props.nodeName) + headingOrder: headingOrder }); - if (regionlessNodes) { - return !regionlessNodes.includes(virtualNode); + cache_default.set('headingOrder', vNodes); + return true; + } + var heading_order_evaluate_default = headingOrderEvaluate; + function isIdenticalObject(a, b) { + if (!a || !b) { + return false; + } + var aProps = Object.getOwnPropertyNames(a); + var bProps = Object.getOwnPropertyNames(b); + if (aProps.length !== bProps.length) { + return false; } - var tree = axe._tree; - regionlessNodes = findRegionlessElms(tree[0], options).map(function(vNode) { - while (vNode.parent && !vNode.parent._hasRegionDescendant && vNode.parent.actualNode !== document.body) { - vNode = vNode.parent; + var result = aProps.every(function(propName) { + var aValue = a[propName]; + var bValue = b[propName]; + if (_typeof(aValue) !== _typeof(bValue)) { + return false; } - return vNode; - }).filter(function(vNode, index, array) { - return array.indexOf(vNode) === index; + if (_typeof(aValue) === 'object' || _typeof(bValue) === 'object') { + return isIdenticalObject(aValue, bValue); + } + return aValue === bValue; }); - cache_default.set('regionlessNodes', regionlessNodes); - return !regionlessNodes.includes(virtualNode); + return result; } - var region_evaluate_default = regionEvaluate; - function regionAfter(results) { - var iframeResults = results.filter(function(r) { - return r.data.isIframe; + function identicalLinksSamePurposeAfter(results) { + if (results.length < 2) { + return results; + } + var incompleteResults = results.filter(function(_ref102) { + var result = _ref102.result; + return result !== void 0; }); - results.forEach(function(r) { - if (r.result || r.node.ancestry.length === 1) { - return; + var uniqueResults = []; + var nameMap = {}; + var _loop8 = function _loop8(index) { + var _currentResult$relate; + var currentResult = incompleteResults[index]; + var _currentResult$data = currentResult.data, name = _currentResult$data.name, urlProps = _currentResult$data.urlProps; + if (nameMap[name]) { + return 'continue'; } - var frameAncestry = r.node.ancestry.slice(0, -1); - var _iterator2 = _createForOfIteratorHelper(iframeResults), _step2; - try { - for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) { - var iframeResult = _step2.value; - if (match_ancestry_default(frameAncestry, iframeResult.node.ancestry)) { - r.result = iframeResult.result; - break; - } - } - } catch (err) { - _iterator2.e(err); - } finally { - _iterator2.f(); + var sameNameResults = incompleteResults.filter(function(_ref103, resultNum) { + var data2 = _ref103.data; + return data2.name === name && resultNum !== index; + }); + var isSameUrl = sameNameResults.every(function(_ref104) { + var data2 = _ref104.data; + return isIdenticalObject(data2.urlProps, urlProps); + }); + if (sameNameResults.length && !isSameUrl) { + currentResult.result = void 0; } - }); - iframeResults.forEach(function(r) { - if (!r.result) { - r.result = true; + currentResult.relatedNodes = []; + (_currentResult$relate = currentResult.relatedNodes).push.apply(_currentResult$relate, _toConsumableArray(sameNameResults.map(function(node) { + return node.relatedNodes[0]; + }))); + nameMap[name] = sameNameResults; + uniqueResults.push(currentResult); + }; + for (var index = 0; index < incompleteResults.length; index++) { + var _ret4 = _loop8(index); + if (_ret4 === 'continue') { + continue; } - }); - return results; - } - var region_after_default = regionAfter; - function skipLinkEvaluate(node) { - var target = get_element_by_reference_default(node, 'href'); - if (target) { - return is_visible_default(target, true) || void 0; } - return false; - } - var skip_link_evaluate_default = skipLinkEvaluate; - function uniqueFrameTitleAfter(results) { - var titles = {}; - results.forEach(function(r) { - titles[r.data] = titles[r.data] !== void 0 ? ++titles[r.data] : 0; - }); - results.forEach(function(r) { - r.result = !!titles[r.data]; - }); - return results; - } - var unique_frame_title_after_default = uniqueFrameTitleAfter; - function uniqueFrameTitleEvaluate(node, options, vNode) { - var title = sanitize_default(vNode.attr('title')).toLowerCase(); - this.data(title); - return true; - } - var unique_frame_title_evaluate_default = uniqueFrameTitleEvaluate; - function ariaLabelEvaluate(node, options, virtualNode) { - return !!sanitize_default(arialabel_text_default(virtualNode)); + return uniqueResults; } - var aria_label_evaluate_default = ariaLabelEvaluate; - function ariaLabelledbyEvaluate(node, options, virtualNode) { - try { - return !!sanitize_default(arialabelledby_text_default(virtualNode)); - } catch (e) { - return void 0; + var identical_links_same_purpose_after_default = identicalLinksSamePurposeAfter; + var commons_exports = {}; + __export(commons_exports, { + aria: function aria() { + return aria_exports; + }, + color: function color() { + return color_exports; + }, + dom: function dom() { + return dom_exports; + }, + forms: function forms() { + return forms_exports; + }, + matches: function matches() { + return matches_default3; + }, + math: function math() { + return math_exports; + }, + standards: function standards() { + return standards_exports; + }, + table: function table() { + return table_exports; + }, + text: function text() { + return text_exports; + }, + utils: function utils() { + return utils_exports; + } + }); + var forms_exports = {}; + __export(forms_exports, { + isAriaCombobox: function isAriaCombobox() { + return is_aria_combobox_default; + }, + isAriaListbox: function isAriaListbox() { + return is_aria_listbox_default; + }, + isAriaRange: function isAriaRange() { + return is_aria_range_default; + }, + isAriaTextbox: function isAriaTextbox() { + return is_aria_textbox_default; + }, + isDisabled: function isDisabled() { + return is_disabled_default; + }, + isNativeSelect: function isNativeSelect() { + return is_native_select_default; + }, + isNativeTextbox: function isNativeTextbox() { + return is_native_textbox_default; + } + }); + var disabledNodeNames = [ 'fieldset', 'button', 'select', 'input', 'textarea' ]; + function isDisabled(virtualNode) { + var disabledState = virtualNode._isDisabled; + if (typeof disabledState === 'boolean') { + return disabledState; + } + var nodeName2 = virtualNode.props.nodeName; + var ariaDisabled = virtualNode.attr('aria-disabled'); + if (disabledNodeNames.includes(nodeName2) && virtualNode.hasAttr('disabled')) { + disabledState = true; + } else if (ariaDisabled) { + disabledState = ariaDisabled.toLowerCase() === 'true'; + } else if (virtualNode.parent) { + disabledState = isDisabled(virtualNode.parent); + } else { + disabledState = false; } + virtualNode._isDisabled = disabledState; + return disabledState; } - var aria_labelledby_evaluate_default = ariaLabelledbyEvaluate; - function avoidInlineSpacingEvaluate(node, options) { - var overriddenProperties = options.cssProperties.filter(function(property) { - if (node.style.getPropertyPriority(property) === 'important') { - return property; + var is_disabled_default = isDisabled; + var table_exports = {}; + __export(table_exports, { + getAllCells: function getAllCells() { + return get_all_cells_default; + }, + getCellPosition: function getCellPosition() { + return get_cell_position_default; + }, + getHeaders: function getHeaders() { + return get_headers_default; + }, + getScope: function getScope() { + return get_scope_default; + }, + isColumnHeader: function isColumnHeader() { + return is_column_header_default; + }, + isDataCell: function isDataCell() { + return is_data_cell_default; + }, + isDataTable: function isDataTable() { + return is_data_table_default; + }, + isHeader: function isHeader() { + return is_header_default; + }, + isRowHeader: function isRowHeader() { + return is_row_header_default; + }, + toArray: function toArray() { + return to_grid_default; + }, + toGrid: function toGrid() { + return to_grid_default; + }, + traverse: function traverse() { + return traverse_default; + } + }); + function getAllCells(tableElm) { + var rowIndex, cellIndex, rowLength, cellLength; + var cells = []; + for (rowIndex = 0, rowLength = tableElm.rows.length; rowIndex < rowLength; rowIndex++) { + for (cellIndex = 0, cellLength = tableElm.rows[rowIndex].cells.length; cellIndex < cellLength; cellIndex++) { + cells.push(tableElm.rows[rowIndex].cells[cellIndex]); } - }); - if (overriddenProperties.length > 0) { - this.data(overriddenProperties); - return false; } - return true; - } - var avoid_inline_spacing_evaluate_default = avoidInlineSpacingEvaluate; - function docHasTitleEvaluate() { - var title = document.title; - return !!sanitize_default(title); - } - var doc_has_title_evaluate_default = docHasTitleEvaluate; - function existsEvaluate() { - return void 0; + return cells; } - var exists_evaluate_default = existsEvaluate; - function hasAltEvaluate(node, options, virtualNode) { - var nodeName2 = virtualNode.props.nodeName; - if (![ 'img', 'input', 'area' ].includes(nodeName2)) { - return false; + var get_all_cells_default = getAllCells; + function traverseForHeaders(headerType, position, tableGrid) { + var property = headerType === 'row' ? '_rowHeaders' : '_colHeaders'; + var predicate = headerType === 'row' ? is_row_header_default : is_column_header_default; + var startCell = tableGrid[position.y][position.x]; + var colspan = startCell.colSpan - 1; + var rowspanAttr = startCell.getAttribute('rowspan'); + var rowspanValue = parseInt(rowspanAttr) === 0 || startCell.rowspan === 0 ? tableGrid.length : startCell.rowSpan; + var rowspan = rowspanValue - 1; + var rowStart = position.y + rowspan; + var colStart = position.x + colspan; + var rowEnd = headerType === 'row' ? position.y : 0; + var colEnd = headerType === 'row' ? 0 : position.x; + var headers; + var cells = []; + for (var row = rowStart; row >= rowEnd && !headers; row--) { + for (var col = colStart; col >= colEnd; col--) { + var cell = tableGrid[row] ? tableGrid[row][col] : void 0; + if (!cell) { + continue; + } + var vNode = axe.utils.getNodeFromTree(cell); + if (vNode[property]) { + headers = vNode[property]; + break; + } + cells.push(cell); + } } - return virtualNode.hasAttr('alt'); - } - var has_alt_evaluate_default = hasAltEvaluate; - function isOnScreenEvaluate(node) { - return is_visible_default(node, false) && !is_offscreen_default(node); + headers = (headers || []).concat(cells.filter(predicate)); + cells.forEach(function(tableCell) { + var vNode = axe.utils.getNodeFromTree(tableCell); + vNode[property] = headers; + }); + return headers; } - var is_on_screen_evaluate_default = isOnScreenEvaluate; - function nonEmptyIfPresentEvaluate(node, options, virtualNode) { - var nodeName2 = virtualNode.props.nodeName; - var type = (virtualNode.attr('type') || '').toLowerCase(); - var label5 = virtualNode.attr('value'); - if (label5) { - this.data({ - messageKey: 'has-label' - }); + function getHeaders(cell, tableGrid) { + if (cell.getAttribute('headers')) { + var headers = idrefs_default(cell, 'headers'); + if (headers.filter(function(header) { + return header; + }).length) { + return headers; + } } - if (nodeName2 === 'input' && [ 'submit', 'reset' ].includes(type)) { - return label5 === null; + if (!tableGrid) { + tableGrid = to_grid_default(find_up_default(cell, 'table')); } - return false; + var position = get_cell_position_default(cell, tableGrid); + var rowHeaders = traverseForHeaders('row', position, tableGrid); + var colHeaders = traverseForHeaders('col', position, tableGrid); + return [].concat(rowHeaders, colHeaders).reverse(); } - var non_empty_if_present_evaluate_default = nonEmptyIfPresentEvaluate; - function presentationalRoleEvaluate(node, options, virtualNode) { - var role = get_role_default(virtualNode); - var explicitRole2 = get_explicit_role_default(virtualNode); - if ([ 'presentation', 'none' ].includes(role)) { - this.data({ - role: role - }); - return true; - } - if (![ 'presentation', 'none' ].includes(explicitRole2)) { + var get_headers_default = getHeaders; + function isDataCell(cell) { + if (!cell.children.length && !cell.textContent.trim()) { return false; } - var hasGlobalAria = get_global_aria_attrs_default().some(function(attr) { - return virtualNode.hasAttr(attr); - }); - var focusable = is_focusable_default(virtualNode); - var messageKey; - if (hasGlobalAria && !focusable) { - messageKey = 'globalAria'; - } else if (!hasGlobalAria && focusable) { - messageKey = 'focusable'; + var role = cell.getAttribute('role'); + if (is_valid_role_default(role)) { + return [ 'cell', 'gridcell' ].includes(role); } else { - messageKey = 'both'; + return cell.nodeName.toUpperCase() === 'TD'; } - this.data({ - messageKey: messageKey, - role: role - }); - return false; } - var presentational_role_evaluate_default = presentationalRoleEvaluate; - function svgNonEmptyTitleEvaluate(node, options, virtualNode) { - if (!virtualNode.children) { - return void 0; - } - var titleNode = virtualNode.children.find(function(_ref71) { - var props = _ref71.props; - return props.nodeName === 'title'; - }); - if (!titleNode) { - this.data({ - messageKey: 'noTitle' - }); + var is_data_cell_default = isDataCell; + function isDataTable(node) { + var role = (node.getAttribute('role') || '').toLowerCase(); + if ((role === 'presentation' || role === 'none') && !_isFocusable(node)) { return false; } - try { - if (visible_virtual_default(titleNode) === '') { - this.data({ - messageKey: 'emptyTitle' - }); - return false; - } - } catch (e) { - return void 0; - } - return true; - } - var svg_non_empty_title_evaluate_default = svgNonEmptyTitleEvaluate; - function cssOrientationLockEvaluate(node, options, virtualNode, context5) { - var _ref72 = context5 || {}, _ref72$cssom = _ref72.cssom, cssom = _ref72$cssom === void 0 ? void 0 : _ref72$cssom; - var _ref73 = options || {}, _ref73$degreeThreshol = _ref73.degreeThreshold, degreeThreshold = _ref73$degreeThreshol === void 0 ? 0 : _ref73$degreeThreshol; - if (!cssom || !cssom.length) { - return void 0; + if (node.getAttribute('contenteditable') === 'true' || find_up_default(node, '[contenteditable="true"]')) { + return true; } - var isLocked = false; - var relatedElements = []; - var rulesGroupByDocumentFragment = groupCssomByDocument(cssom); - var _loop6 = function _loop6() { - var key = _Object$keys2[_i22]; - var _rulesGroupByDocument = rulesGroupByDocumentFragment[key], root = _rulesGroupByDocument.root, rules = _rulesGroupByDocument.rules; - var orientationRules = rules.filter(isMediaRuleWithOrientation); - if (!orientationRules.length) { - return 'continue'; - } - orientationRules.forEach(function(_ref74) { - var cssRules = _ref74.cssRules; - Array.from(cssRules).forEach(function(cssRule) { - var locked = getIsOrientationLocked(cssRule); - if (locked && cssRule.selectorText.toUpperCase() !== 'HTML') { - var elms = Array.from(root.querySelectorAll(cssRule.selectorText)) || []; - relatedElements = relatedElements.concat(elms); - } - isLocked = isLocked || locked; - }); - }); - }; - for (var _i22 = 0, _Object$keys2 = Object.keys(rulesGroupByDocumentFragment); _i22 < _Object$keys2.length; _i22++) { - var _ret3 = _loop6(); - if (_ret3 === 'continue') { - continue; - } + if (role === 'grid' || role === 'treegrid' || role === 'table') { + return true; } - if (!isLocked) { + if (get_role_type_default(role) === 'landmark') { return true; } - if (relatedElements.length) { - this.relatedNodes(relatedElements); + if (node.getAttribute('datatable') === '0') { + return false; } - return false; - function groupCssomByDocument(cssObjectModel) { - return cssObjectModel.reduce(function(out, _ref75) { - var sheet = _ref75.sheet, root = _ref75.root, shadowId = _ref75.shadowId; - var key = shadowId ? shadowId : 'topDocument'; - if (!out[key]) { - out[key] = { - root: root, - rules: [] - }; - } - if (!sheet || !sheet.cssRules) { - return out; - } - var rules = Array.from(sheet.cssRules); - out[key].rules = out[key].rules.concat(rules); - return out; - }, {}); + if (node.getAttribute('summary')) { + return true; } - function isMediaRuleWithOrientation(_ref76) { - var type = _ref76.type, cssText = _ref76.cssText; - if (type !== 4) { - return false; - } - return /orientation:\s*landscape/i.test(cssText) || /orientation:\s*portrait/i.test(cssText); + if (node.tHead || node.tFoot || node.caption) { + return true; } - function getIsOrientationLocked(_ref77) { - var selectorText = _ref77.selectorText, style = _ref77.style; - if (!selectorText || style.length <= 0) { - return false; - } - var transformStyle = style.transform || style.webkitTransform || style.msTransform || false; - if (!transformStyle) { - return false; - } - var matches14 = transformStyle.match(/(rotate|rotateZ|rotate3d|matrix|matrix3d)\(([^)]+)\)(?!.*(rotate|rotateZ|rotate3d|matrix|matrix3d))/); - if (!matches14) { - return false; - } - var _matches = _slicedToArray(matches14, 3), transformFn = _matches[1], transformFnValue = _matches[2]; - var degrees = getRotationInDegrees(transformFn, transformFnValue); - if (!degrees) { - return false; - } - degrees = Math.abs(degrees); - if (Math.abs(degrees - 180) % 180 <= degreeThreshold) { - return false; + for (var childIndex = 0, childLength = node.children.length; childIndex < childLength; childIndex++) { + if (node.children[childIndex].nodeName.toUpperCase() === 'COLGROUP') { + return true; } - return Math.abs(degrees - 90) % 90 <= degreeThreshold; } - function getRotationInDegrees(transformFunction, transformFnValue) { - switch (transformFunction) { - case 'rotate': - case 'rotateZ': - return getAngleInDegrees(transformFnValue); - - case 'rotate3d': - var _transformFnValue$spl = transformFnValue.split(',').map(function(value) { - return value.trim(); - }), _transformFnValue$spl2 = _slicedToArray(_transformFnValue$spl, 4), z = _transformFnValue$spl2[2], angleWithUnit = _transformFnValue$spl2[3]; - if (parseInt(z) === 0) { - return; + var cells = 0; + var rowLength = node.rows.length; + var row, cell; + var hasBorder = false; + for (var rowIndex = 0; rowIndex < rowLength; rowIndex++) { + row = node.rows[rowIndex]; + for (var cellIndex = 0, cellLength = row.cells.length; cellIndex < cellLength; cellIndex++) { + cell = row.cells[cellIndex]; + if (cell.nodeName.toUpperCase() === 'TH') { + return true; } - return getAngleInDegrees(angleWithUnit); - - case 'matrix': - case 'matrix3d': - return getAngleInDegreesFromMatrixTransform(transformFnValue); - - default: - return; - } - } - function getAngleInDegrees(angleWithUnit) { - var _ref78 = angleWithUnit.match(/(deg|grad|rad|turn)/) || [], _ref79 = _slicedToArray(_ref78, 1), unit = _ref79[0]; - if (!unit) { - return; - } - var angle = parseFloat(angleWithUnit.replace(unit, '')); - switch (unit) { - case 'rad': - return convertRadToDeg(angle); - - case 'grad': - return convertGradToDeg(angle); - - case 'turn': - return convertTurnToDeg(angle); - - case 'deg': - default: - return parseInt(angle); - } - } - function getAngleInDegreesFromMatrixTransform(transformFnValue) { - var values = transformFnValue.split(','); - if (values.length <= 6) { - var _values = _slicedToArray(values, 2), a = _values[0], b2 = _values[1]; - var radians = Math.atan2(parseFloat(b2), parseFloat(a)); - return convertRadToDeg(radians); + if (!hasBorder && (cell.offsetWidth !== cell.clientWidth || cell.offsetHeight !== cell.clientHeight)) { + hasBorder = true; + } + if (cell.getAttribute('scope') || cell.getAttribute('headers') || cell.getAttribute('abbr')) { + return true; + } + if ([ 'columnheader', 'rowheader' ].includes((cell.getAttribute('role') || '').toLowerCase())) { + return true; + } + if (cell.children.length === 1 && cell.children[0].nodeName.toUpperCase() === 'ABBR') { + return true; + } + cells++; } - var sinB = parseFloat(values[8]); - var b = Math.asin(sinB); - var cosB = Math.cos(b); - var rotateZRadians = Math.acos(parseFloat(values[0]) / cosB); - return convertRadToDeg(rotateZRadians); } - function convertRadToDeg(radians) { - return Math.round(radians * (180 / Math.PI)); + if (node.getElementsByTagName('table').length) { + return false; } - function convertGradToDeg(grad) { - grad = grad % 400; - if (grad < 0) { - grad += 400; - } - return Math.round(grad / 400 * 360); + if (rowLength < 2) { + return false; } - function convertTurnToDeg(turn) { - return Math.round(360 / (1 / turn)); + var sampleRow = node.rows[Math.ceil(rowLength / 2)]; + if (sampleRow.cells.length === 1 && sampleRow.cells[0].colSpan === 1) { + return false; } - } - var css_orientation_lock_evaluate_default = cssOrientationLockEvaluate; - function metaViewportScaleEvaluate(node, options, virtualNode) { - var _ref80 = options || {}, _ref80$scaleMinimum = _ref80.scaleMinimum, scaleMinimum = _ref80$scaleMinimum === void 0 ? 2 : _ref80$scaleMinimum, _ref80$lowerBound = _ref80.lowerBound, lowerBound = _ref80$lowerBound === void 0 ? false : _ref80$lowerBound; - var content = virtualNode.attr('content') || ''; - if (!content) { + if (sampleRow.cells.length >= 5) { return true; } - var result = content.split(/[;,]/).reduce(function(out, item) { - var contentValue = item.trim(); - if (!contentValue) { - return out; - } - var _contentValue$split = contentValue.split('='), _contentValue$split2 = _slicedToArray(_contentValue$split, 2), key = _contentValue$split2[0], value = _contentValue$split2[1]; - if (!key || !value) { - return out; - } - var curatedKey = key.toLowerCase().trim(); - var curatedValue = value.toLowerCase().trim(); - if (curatedKey === 'maximum-scale' && curatedValue === 'yes') { - curatedValue = 1; + if (hasBorder) { + return true; + } + var bgColor, bgImage; + for (rowIndex = 0; rowIndex < rowLength; rowIndex++) { + row = node.rows[rowIndex]; + if (bgColor && bgColor !== window.getComputedStyle(row).getPropertyValue('background-color')) { + return true; + } else { + bgColor = window.getComputedStyle(row).getPropertyValue('background-color'); } - if (curatedKey === 'maximum-scale' && parseFloat(curatedValue) < 0) { - return out; + if (bgImage && bgImage !== window.getComputedStyle(row).getPropertyValue('background-image')) { + return true; + } else { + bgImage = window.getComputedStyle(row).getPropertyValue('background-image'); } - out[curatedKey] = curatedValue; - return out; - }, {}); - if (lowerBound && result['maximum-scale'] && parseFloat(result['maximum-scale']) < lowerBound) { + } + if (rowLength >= 20) { return true; } - if (!lowerBound && result['user-scalable'] === 'no') { - this.data('user-scalable=no'); + if (get_element_coordinates_default(node).width > get_viewport_size_default(window).width * .95) { return false; } - var userScalableAsFloat = parseFloat(result['user-scalable']); - if (!lowerBound && result['user-scalable'] && (userScalableAsFloat || userScalableAsFloat === 0) && userScalableAsFloat > -1 && userScalableAsFloat < 1) { - this.data('user-scalable'); + if (cells < 10) { return false; } - if (result['maximum-scale'] && parseFloat(result['maximum-scale']) < scaleMinimum) { - this.data('maximum-scale'); + if (node.querySelector('object, embed, iframe, applet')) { return false; } return true; } - var meta_viewport_scale_evaluate_default = metaViewportScaleEvaluate; - function duplicateIdAfter(results) { - var uniqueIds = []; - return results.filter(function(r) { - if (uniqueIds.indexOf(r.data) === -1) { - uniqueIds.push(r.data); - return true; - } - return false; - }); - } - var duplicate_id_after_default = duplicateIdAfter; - function duplicateIdEvaluate(node) { - var id = node.getAttribute('id').trim(); - if (!id) { + var is_data_table_default = isDataTable; + function isHeader(cell) { + if (is_column_header_default(cell) || is_row_header_default(cell)) { return true; } - var root = get_root_node_default2(node); - var matchingNodes = Array.from(root.querySelectorAll('[id="'.concat(escape_selector_default(id), '"]'))).filter(function(foundNode) { - return foundNode !== node; - }); - if (matchingNodes.length) { - this.relatedNodes(matchingNodes); - } - this.data(id); - return matchingNodes.length === 0; - } - var duplicate_id_evaluate_default = duplicateIdEvaluate; - function accesskeysAfter(results) { - var seen = {}; - return results.filter(function(r) { - if (!r.data) { - return false; - } - var key = r.data.toUpperCase(); - if (!seen[key]) { - seen[key] = r; - r.relatedNodes = []; - return true; - } - seen[key].relatedNodes.push(r.relatedNodes[0]); - return false; - }).map(function(r) { - r.result = !!r.relatedNodes.length; - return r; - }); - } - var accesskeys_after_default = accesskeysAfter; - function accesskeysEvaluate(node) { - if (is_visible_default(node, false)) { - this.data(node.getAttribute('accesskey')); - this.relatedNodes([ node ]); - } - return true; - } - var accesskeys_evaluate_default = accesskeysEvaluate; - function focusableContentEvaluate(node, options, virtualNode) { - var tabbableElements = virtualNode.tabbableElements; - if (!tabbableElements) { - return false; + if (cell.getAttribute('id')) { + var id = escape_selector_default(cell.getAttribute('id')); + return !!document.querySelector('[headers~="'.concat(id, '"]')); } - var tabbableContentElements = tabbableElements.filter(function(el) { - return el !== virtualNode; - }); - return tabbableContentElements.length > 0; + return false; } - var focusable_content_evaluate_default = focusableContentEvaluate; - function focusableDisabledEvaluate(node, options, virtualNode) { - var elementsThatCanBeDisabled = [ 'BUTTON', 'FIELDSET', 'INPUT', 'SELECT', 'TEXTAREA' ]; - var tabbableElements = virtualNode.tabbableElements; - if (!tabbableElements || !tabbableElements.length) { - return true; + var is_header_default = isHeader; + function traverseTable(dir, position, tableGrid, callback) { + var result; + var cell = tableGrid[position.y] ? tableGrid[position.y][position.x] : void 0; + if (!cell) { + return []; } - var relatedNodes = tabbableElements.reduce(function(out, _ref81) { - var el = _ref81.actualNode; - var nodeName2 = el.nodeName.toUpperCase(); - if (elementsThatCanBeDisabled.includes(nodeName2)) { - out.push(el); + if (typeof callback === 'function') { + result = callback(cell, position, tableGrid); + if (result === true) { + return [ cell ]; } - return out; - }, []); - this.relatedNodes(relatedNodes); - if (relatedNodes.length && is_modal_open_default()) { - return true; } - return relatedNodes.length === 0; + result = traverseTable(dir, { + x: position.x + dir.x, + y: position.y + dir.y + }, tableGrid, callback); + result.unshift(cell); + return result; } - var focusable_disabled_evaluate_default = focusableDisabledEvaluate; - function focusableElementEvaluate(node, options, virtualNode) { - if (virtualNode.hasAttr('contenteditable') && isContenteditable(virtualNode)) { - return true; + function traverse(dir, startPos, tableGrid, callback) { + if (Array.isArray(startPos)) { + callback = tableGrid; + tableGrid = startPos; + startPos = { + x: 0, + y: 0 + }; } - var isFocusable2 = virtualNode.isFocusable; - var tabIndex = parseInt(virtualNode.attr('tabindex'), 10); - tabIndex = !isNaN(tabIndex) ? tabIndex : null; - return tabIndex ? isFocusable2 && tabIndex >= 0 : isFocusable2; - function isContenteditable(vNode) { - var contenteditable = vNode.attr('contenteditable'); - if (contenteditable === 'true' || contenteditable === '') { - return true; - } - if (contenteditable === 'false') { - return false; - } - var ancestor = closest_default(virtualNode.parent, '[contenteditable]'); - if (!ancestor) { - return false; + if (typeof dir === 'string') { + switch (dir) { + case 'left': + dir = { + x: -1, + y: 0 + }; + break; + + case 'up': + dir = { + x: 0, + y: -1 + }; + break; + + case 'right': + dir = { + x: 1, + y: 0 + }; + break; + + case 'down': + dir = { + x: 0, + y: 1 + }; + break; } - return isContenteditable(ancestor); } + return traverseTable(dir, { + x: startPos.x + dir.x, + y: startPos.y + dir.y + }, tableGrid, callback); } - var focusable_element_evaluate_default = focusableElementEvaluate; - function focusableModalOpenEvaluate(node, options, virtualNode) { - var tabbableElements = virtualNode.tabbableElements.map(function(_ref82) { - var actualNode = _ref82.actualNode; - return actualNode; - }); - if (!tabbableElements || !tabbableElements.length) { - return true; - } - if (is_modal_open_default()) { - this.relatedNodes(tabbableElements); + var traverse_default = traverse; + function identicalLinksSamePurposeEvaluate(node, options, virtualNode) { + var accText = text_exports.accessibleTextVirtual(virtualNode); + var name = text_exports.sanitize(text_exports.removeUnicode(accText, { + emoji: true, + nonBmp: true, + punctuations: true + })).toLowerCase(); + if (!name) { return void 0; } + var afterData = { + name: name, + urlProps: dom_exports.urlPropsFromAttribute(node, 'href') + }; + this.data(afterData); + this.relatedNodes([ node ]); return true; } - var focusable_modal_open_evaluate_default = focusableModalOpenEvaluate; - function focusableNoNameEvaluate(node, options, virtualNode) { - var tabIndex = virtualNode.attr('tabindex'); - var inFocusOrder = is_focusable_default(virtualNode) && tabIndex > -1; - if (!inFocusOrder) { - return false; - } - try { - return !accessible_text_virtual_default(virtualNode); - } catch (e) { - return void 0; + var identical_links_same_purpose_evaluate_default = identicalLinksSamePurposeEvaluate; + function internalLinkPresentEvaluate(node, options, virtualNode) { + var links = query_selector_all_default(virtualNode, 'a[href]'); + return links.some(function(vLink) { + return /^#[^/!]/.test(vLink.attr('href')); + }); + } + var internal_link_present_evaluate_default = internalLinkPresentEvaluate; + var separatorRegex = /[;,\s]/; + var validRedirectNumRegex = /^[0-9.]+$/; + function metaRefreshEvaluate(node, options, virtualNode) { + var _ref105 = options || {}, minDelay = _ref105.minDelay, maxDelay = _ref105.maxDelay; + var content = (virtualNode.attr('content') || '').trim(); + var _content$split = content.split(separatorRegex), _content$split2 = _slicedToArray(_content$split, 1), redirectStr = _content$split2[0]; + if (!redirectStr.match(validRedirectNumRegex)) { + return true; } - } - var focusable_no_name_evaluate_default = focusableNoNameEvaluate; - function focusableNotTabbableEvaluate(node, options, virtualNode) { - var elementsThatCanBeDisabled = [ 'BUTTON', 'FIELDSET', 'INPUT', 'SELECT', 'TEXTAREA' ]; - var tabbableElements = virtualNode.tabbableElements; - if (!tabbableElements || !tabbableElements.length) { + var redirectDelay = parseFloat(redirectStr); + this.data({ + redirectDelay: redirectDelay + }); + if (typeof minDelay === 'number' && redirectDelay <= options.minDelay) { return true; } - var relatedNodes = tabbableElements.reduce(function(out, _ref83) { - var el = _ref83.actualNode; - var nodeName2 = el.nodeName.toUpperCase(); - if (!elementsThatCanBeDisabled.includes(nodeName2)) { - out.push(el); - } - return out; - }, []); - this.relatedNodes(relatedNodes); - if (relatedNodes.length > 0 && is_modal_open_default()) { + if (typeof maxDelay === 'number' && redirectDelay > options.maxDelay) { return true; } - return relatedNodes.length === 0; + return false; } - var focusable_not_tabbable_evaluate_default = focusableNotTabbableEvaluate; - function landmarkIsTopLevelEvaluate(node) { - var landmarks = get_aria_roles_by_type_default('landmark'); - var parent = get_composed_parent_default(node); - var nodeRole = get_role_default(node); - this.data({ - role: nodeRole - }); - while (parent) { - var role = parent.getAttribute('role'); - if (!role && parent.nodeName.toUpperCase() !== 'FORM') { - role = implicit_role_default(parent); - } - if (role && landmarks.includes(role) && !(role === 'main' && nodeRole === 'complementary')) { - return false; - } - parent = get_composed_parent_default(parent); + function normalizeFontWeight(weight) { + switch (weight) { + case 'lighter': + return 100; + + case 'normal': + return 400; + + case 'bold': + return 700; + + case 'bolder': + return 900; } - return true; + weight = parseInt(weight); + return !isNaN(weight) ? weight : 400; } - var landmark_is_top_level_evaluate_default = landmarkIsTopLevelEvaluate; - function focusableDescendants(vNode) { - if (is_focusable_default(vNode)) { - return true; - } - if (!vNode.children) { - if (vNode.props.nodeType === 1) { - throw new Error('Cannot determine children'); + function getTextContainer(elm) { + var nextNode = elm; + var outerText = elm.textContent.trim(); + var innerText = outerText; + while (innerText === outerText && nextNode !== void 0) { + var _i25 = -1; + elm = nextNode; + if (elm.children.length === 0) { + return elm; } - return false; + do { + _i25++; + innerText = elm.children[_i25].textContent.trim(); + } while (innerText === '' && _i25 + 1 < elm.children.length); + nextNode = elm.children[_i25]; } - return vNode.children.some(function(child) { - return focusableDescendants(child); - }); + return elm; } - function frameFocusableContentEvaluate(node, options, virtualNode) { - if (!virtualNode.children) { - return void 0; + function getStyleValues(node) { + var style = window.getComputedStyle(getTextContainer(node)); + return { + fontWeight: normalizeFontWeight(style.getPropertyValue('font-weight')), + fontSize: parseInt(style.getPropertyValue('font-size')), + isItalic: style.getPropertyValue('font-style') === 'italic' + }; + } + function isHeaderStyle(styleA, styleB, margins) { + return margins.reduce(function(out, margin) { + return out || (!margin.size || styleA.fontSize / margin.size > styleB.fontSize) && (!margin.weight || styleA.fontWeight - margin.weight > styleB.fontWeight) && (!margin.italic || styleA.isItalic && !styleB.isItalic); + }, false); + } + function pAsHeadingEvaluate(node, options, virtualNode) { + var siblings = Array.from(node.parentNode.children); + var currentIndex = siblings.indexOf(node); + options = options || {}; + var margins = options.margins || []; + var nextSibling = siblings.slice(currentIndex + 1).find(function(elm) { + return elm.nodeName.toUpperCase() === 'P'; + }); + var prevSibling = siblings.slice(0, currentIndex).reverse().find(function(elm) { + return elm.nodeName.toUpperCase() === 'P'; + }); + var currStyle = getStyleValues(node); + var nextStyle = nextSibling ? getStyleValues(nextSibling) : null; + var prevStyle = prevSibling ? getStyleValues(prevSibling) : null; + var optionsPassLength = options.passLength; + var optionsFailLength = options.failLength; + var headingLength = node.textContent.trim().length; + var paragraphLength = nextSibling === null || nextSibling === void 0 ? void 0 : nextSibling.textContent.trim().length; + if (headingLength > paragraphLength * optionsPassLength) { + return true; } - try { - return !virtualNode.children.some(function(child) { - return focusableDescendants(child); - }); - } catch (e) { + if (!nextStyle || !isHeaderStyle(currStyle, nextStyle, margins)) { + return true; + } + var blockquote = find_up_virtual_default(virtualNode, 'blockquote'); + if (blockquote && blockquote.nodeName.toUpperCase() === 'BLOCKQUOTE') { return void 0; } - } - var frame_focusable_content_evaluate_default = frameFocusableContentEvaluate; - function noFocusableContentEvaluate(node, options, virtualNode) { - if (!virtualNode.children) { + if (prevStyle && !isHeaderStyle(currStyle, prevStyle, margins)) { return void 0; } - try { - var focusableDescendants2 = getFocusableDescendants(virtualNode); - if (!focusableDescendants2.length) { - return true; - } - var notHiddenElements = focusableDescendants2.filter(usesUnreliableHidingStrategy); - if (notHiddenElements.length > 0) { - this.data({ - messageKey: 'notHidden' - }); - this.relatedNodes(notHiddenElements); - } else { - this.relatedNodes(focusableDescendants2); - } - return false; - } catch (e) { + if (headingLength > paragraphLength * optionsFailLength) { return void 0; } + return false; } - function getFocusableDescendants(vNode) { - if (!vNode.children) { - if (vNode.props.nodeType === 1) { - throw new Error('Cannot determine children'); + var p_as_heading_evaluate_default = pAsHeadingEvaluate; + function regionAfter(results) { + var iframeResults = results.filter(function(r) { + return r.data.isIframe; + }); + results.forEach(function(r) { + if (r.result || r.node.ancestry.length === 1) { + return; } - return []; - } - var retVal = []; - vNode.children.forEach(function(child) { - var role = get_role_default(child); - if (get_role_type_default(role) === 'widget' && is_focusable_default(child)) { - retVal.push(child); - } else { - retVal.push.apply(retVal, _toConsumableArray(getFocusableDescendants(child))); + var frameAncestry = r.node.ancestry.slice(0, -1); + var _iterator10 = _createForOfIteratorHelper(iframeResults), _step10; + try { + for (_iterator10.s(); !(_step10 = _iterator10.n()).done; ) { + var iframeResult = _step10.value; + if (match_ancestry_default(frameAncestry, iframeResult.node.ancestry)) { + r.result = iframeResult.result; + break; + } + } + } catch (err) { + _iterator10.e(err); + } finally { + _iterator10.f(); } }); - return retVal; - } - function usesUnreliableHidingStrategy(vNode) { - var tabIndex = parseInt(vNode.attr('tabindex'), 10); - return !isNaN(tabIndex) && tabIndex < 0; - } - function tabindexEvaluate(node, options, virtualNode) { - var tabIndex = parseInt(virtualNode.attr('tabindex'), 10); - return isNaN(tabIndex) ? true : tabIndex <= 0; + iframeResults.forEach(function(r) { + if (!r.result) { + r.result = true; + } + }); + return results; } - var tabindex_evaluate_default = tabindexEvaluate; - function altSpaceValueEvaluate(node, options, virtualNode) { - var alt = virtualNode.attr('alt'); - var isOnlySpace = /^\s+$/; - return typeof alt === 'string' && isOnlySpace.test(alt); + var region_after_default = regionAfter; + var landmarkRoles2 = get_aria_roles_by_type_default('landmark'); + var implicitAriaLiveRoles = [ 'alert', 'log', 'status' ]; + function regionEvaluate(node, options, virtualNode) { + this.data({ + isIframe: [ 'iframe', 'frame' ].includes(virtualNode.props.nodeName) + }); + var regionlessNodes = cache_default.get('regionlessNodes', function() { + return getRegionlessNodes(options); + }); + return !regionlessNodes.includes(virtualNode); } - var alt_space_value_evaluate_default = altSpaceValueEvaluate; - function duplicateImgLabelEvaluate(node, options, virtualNode) { - if ([ 'none', 'presentation' ].includes(get_role_default(virtualNode))) { - return false; - } - var parentVNode = closest_default(virtualNode, options.parentSelector); - if (!parentVNode) { - return false; - } - var visibleText = visible_virtual_default(parentVNode, true).toLowerCase(); - if (visibleText === '') { - return false; - } - return visibleText === accessible_text_virtual_default(virtualNode).toLowerCase(); + function getRegionlessNodes(options) { + var regionlessNodes = findRegionlessElms(axe._tree[0], options).map(function(vNode) { + while (vNode.parent && !vNode.parent._hasRegionDescendant && vNode.parent.actualNode !== document.body) { + vNode = vNode.parent; + } + return vNode; + }).filter(function(vNode, index, array) { + return array.indexOf(vNode) === index; + }); + return regionlessNodes; } - var duplicate_img_label_evaluate_default = duplicateImgLabelEvaluate; - function explicitEvaluate(node, options, virtualNode) { - if (virtualNode.attr('id')) { - if (!virtualNode.actualNode) { - return void 0; + function findRegionlessElms(virtualNode, options) { + var node = virtualNode.actualNode; + if (get_role_default(virtualNode) === 'button' || isRegion(virtualNode, options) || [ 'iframe', 'frame' ].includes(virtualNode.props.nodeName) || _isSkipLink(virtualNode.actualNode) && get_element_by_reference_default(virtualNode.actualNode, 'href') || !_isVisibleToScreenReaders(node)) { + var vNode = virtualNode; + while (vNode) { + vNode._hasRegionDescendant = true; + vNode = vNode.parent; } - var root = get_root_node_default2(virtualNode.actualNode); - var id = escape_selector_default(virtualNode.attr('id')); - var labels = Array.from(root.querySelectorAll('label[for="'.concat(id, '"]'))); - if (labels.length) { - try { - return labels.some(function(label5) { - if (!is_visible_default(label5)) { - return true; - } else { - return !!accessible_text_default(label5); - } - }); - } catch (e) { - return void 0; - } + if ([ 'iframe', 'frame' ].includes(virtualNode.props.nodeName)) { + return [ virtualNode ]; } + return []; + } else if (node !== document.body && has_content_default(node, true)) { + return [ virtualNode ]; + } else { + return virtualNode.children.filter(function(_ref106) { + var actualNode = _ref106.actualNode; + return actualNode.nodeType === 1; + }).map(function(vNode) { + return findRegionlessElms(vNode, options); + }).reduce(function(a, b) { + return a.concat(b); + }, []); } - return false; } - var explicit_evaluate_default = explicitEvaluate; - function helpSameAsLabelEvaluate(node, options, virtualNode) { - var labelText2 = label_virtual_default2(virtualNode), check4 = node.getAttribute('title'); - if (!labelText2) { - return false; + function isRegion(virtualNode, options) { + var node = virtualNode.actualNode; + var role = get_role_default(virtualNode); + var ariaLive = (node.getAttribute('aria-live') || '').toLowerCase().trim(); + if ([ 'assertive', 'polite' ].includes(ariaLive) || implicitAriaLiveRoles.includes(role)) { + return true; } - if (!check4) { - check4 = ''; - if (node.getAttribute('aria-describedby')) { - var ref = idrefs_default(node, 'aria-describedby'); - check4 = ref.map(function(thing) { - return thing ? accessible_text_default(thing) : ''; - }).join(''); - } + if (landmarkRoles2.includes(role)) { + return true; + } + if (options.regionMatcher && matches_default3(virtualNode, options.regionMatcher)) { + return true; } - return sanitize_default(check4) === sanitize_default(labelText2); + return false; } - var help_same_as_label_evaluate_default = helpSameAsLabelEvaluate; - function hiddenExplicitLabelEvaluate(node, options, virtualNode) { - if (virtualNode.hasAttr('id')) { - if (!virtualNode.actualNode) { - return void 0; - } - var root = get_root_node_default2(node); - var id = escape_selector_default(node.getAttribute('id')); - var label5 = root.querySelector('label[for="'.concat(id, '"]')); - if (label5 && !is_visible_default(label5, true)) { - var name; - try { - name = accessible_text_virtual_default(virtualNode).trim(); - } catch (e) { - return void 0; - } - var isNameEmpty = name === ''; - return isNameEmpty; - } + function skipLinkEvaluate(node) { + var target = get_element_by_reference_default(node, 'href'); + if (target) { + return _isVisibleToScreenReaders(target) || void 0; } return false; } - var hidden_explicit_label_evaluate_default = hiddenExplicitLabelEvaluate; - function implicitEvaluate(node, options, virtualNode) { - try { - var label5 = closest_default(virtualNode, 'label'); - if (label5) { - return !!accessible_text_virtual_default(label5, { - inControlContext: true - }); + var skip_link_evaluate_default = skipLinkEvaluate; + function uniqueFrameTitleAfter(results) { + var titles = {}; + results.forEach(function(r) { + titles[r.data] = titles[r.data] !== void 0 ? ++titles[r.data] : 0; + }); + results.forEach(function(r) { + r.result = !!titles[r.data]; + }); + return results; + } + var unique_frame_title_after_default = uniqueFrameTitleAfter; + function uniqueFrameTitleEvaluate(node, options, vNode) { + var title = sanitize_default(vNode.attr('title')).toLowerCase(); + this.data(title); + return true; + } + var unique_frame_title_evaluate_default = uniqueFrameTitleEvaluate; + function duplicateIdAfter(results) { + var uniqueIds = []; + return results.filter(function(r) { + if (uniqueIds.indexOf(r.data) === -1) { + uniqueIds.push(r.data); + return true; } return false; + }); + } + var duplicate_id_after_default = duplicateIdAfter; + function duplicateIdEvaluate(node) { + var id = node.getAttribute('id').trim(); + if (!id) { + return true; + } + var root = get_root_node_default2(node); + var matchingNodes = Array.from(root.querySelectorAll('[id="'.concat(escape_selector_default(id), '"]'))).filter(function(foundNode) { + return foundNode !== node; + }); + if (matchingNodes.length) { + this.relatedNodes(matchingNodes); + } + this.data(id); + return matchingNodes.length === 0; + } + var duplicate_id_evaluate_default = duplicateIdEvaluate; + function ariaLabelEvaluate(node, options, virtualNode) { + return !!sanitize_default(arialabel_text_default(virtualNode)); + } + var aria_label_evaluate_default = ariaLabelEvaluate; + function ariaLabelledbyEvaluate(node, options, virtualNode) { + try { + return !!sanitize_default(arialabelledby_text_default(virtualNode)); } catch (e) { return void 0; } } - var implicit_evaluate_default = implicitEvaluate; - function isStringContained(compare, compareWith) { - var curatedCompareWith = curateString(compareWith); - var curatedCompare = curateString(compare); - if (!curatedCompareWith || !curatedCompare) { + var aria_labelledby_evaluate_default = ariaLabelledbyEvaluate; + function avoidInlineSpacingEvaluate(node, options) { + var overriddenProperties = options.cssProperties.filter(function(property) { + if (node.style.getPropertyPriority(property) === 'important') { + return property; + } + }); + if (overriddenProperties.length > 0) { + this.data(overriddenProperties); return false; } - return curatedCompareWith.includes(curatedCompare); + return true; } - function curateString(str) { - var noUnicodeStr = remove_unicode_default(str, { - emoji: true, - nonBmp: true, - punctuations: true - }); - return sanitize_default(noUnicodeStr); + var avoid_inline_spacing_evaluate_default = avoidInlineSpacingEvaluate; + function docHasTitleEvaluate() { + var title = document.title; + return !!sanitize_default(title); } - function labelContentNameMismatchEvaluate(node, options, virtualNode) { - var _ref84 = options || {}, pixelThreshold = _ref84.pixelThreshold, occuranceThreshold = _ref84.occuranceThreshold; - var accText = accessible_text_default(node).toLowerCase(); - if (is_human_interpretable_default(accText) < 1) { - return void 0; + var doc_has_title_evaluate_default = docHasTitleEvaluate; + function existsEvaluate() { + return void 0; + } + var exists_evaluate_default = existsEvaluate; + function hasAltEvaluate(node, options, virtualNode) { + var nodeName2 = virtualNode.props.nodeName; + if (![ 'img', 'input', 'area' ].includes(nodeName2)) { + return false; } - var visibleText = sanitize_default(subtree_text_default(virtualNode, { - subtreeDescendant: true, - ignoreIconLigature: true, - pixelThreshold: pixelThreshold, - occuranceThreshold: occuranceThreshold - })).toLowerCase(); - if (!visibleText) { + return virtualNode.hasAttr('alt'); + } + var has_alt_evaluate_default = hasAltEvaluate; + function inlineStyleProperty(node, options) { + var cssProperty = options.cssProperty, absoluteValues = options.absoluteValues, minValue = options.minValue, maxValue = options.maxValue, _options$normalValue = options.normalValue, normalValue = _options$normalValue === void 0 ? 0 : _options$normalValue, noImportant = options.noImportant, multiLineOnly = options.multiLineOnly; + if (!noImportant && node.style.getPropertyPriority(cssProperty) !== 'important' || multiLineOnly && !_isMultiline(node)) { return true; } - if (is_human_interpretable_default(visibleText) < 1) { - if (isStringContained(visibleText, accText)) { - return true; - } + var data2 = {}; + if (typeof minValue === 'number') { + data2.minValue = minValue; + } + if (typeof maxValue === 'number') { + data2.maxValue = maxValue; + } + var declaredPropValue = node.style.getPropertyValue(cssProperty); + if ([ 'inherit', 'unset', 'revert', 'revert-layer' ].includes(declaredPropValue)) { + this.data(_extends({ + value: declaredPropValue + }, data2)); + return true; + } + var value = getNumberValue(node, { + absoluteValues: absoluteValues, + cssProperty: cssProperty, + normalValue: normalValue + }); + this.data(_extends({ + value: value + }, data2)); + if (typeof value !== 'number') { return void 0; } - return isStringContained(visibleText, accText); + if ((typeof minValue !== 'number' || value >= minValue) && (typeof maxValue !== 'number' || value <= maxValue)) { + return true; + } + return false; } - var label_content_name_mismatch_evaluate_default = labelContentNameMismatchEvaluate; - function multipleLabelEvaluate(node) { - var id = escape_selector_default(node.getAttribute('id')); - var parent = node.parentNode; - var root = get_root_node_default2(node); - root = root.documentElement || root; - var labels = Array.from(root.querySelectorAll('label[for="'.concat(id, '"]'))); - if (labels.length) { - labels = labels.filter(function(label5) { - return is_visible_default(label5); - }); + function getNumberValue(domNode, _ref107) { + var cssProperty = _ref107.cssProperty, absoluteValues = _ref107.absoluteValues, normalValue = _ref107.normalValue; + var computedStyle = window.getComputedStyle(domNode); + var cssPropValue = computedStyle.getPropertyValue(cssProperty); + if (cssPropValue === 'normal') { + return normalValue; } - while (parent) { - if (parent.nodeName.toUpperCase() === 'LABEL' && labels.indexOf(parent) === -1) { - labels.push(parent); - } - parent = parent.parentNode; + var parsedValue = parseFloat(cssPropValue); + if (absoluteValues) { + return parsedValue; } - this.relatedNodes(labels); - if (labels.length > 1) { - var ATVisibleLabels = labels.filter(function(label5) { - return is_visible_default(label5, true); + var fontSize = parseFloat(computedStyle.getPropertyValue('font-size')); + var value = Math.round(parsedValue / fontSize * 100) / 100; + if (isNaN(value)) { + return cssPropValue; + } + return value; + } + function isOnScreenEvaluate(node) { + return _isVisibleOnScreen(node); + } + var is_on_screen_evaluate_default = isOnScreenEvaluate; + function nonEmptyIfPresentEvaluate(node, options, virtualNode) { + var nodeName2 = virtualNode.props.nodeName; + var type = (virtualNode.attr('type') || '').toLowerCase(); + var label3 = virtualNode.attr('value'); + if (label3) { + this.data({ + messageKey: 'has-label' }); - if (ATVisibleLabels.length > 1) { - return void 0; - } - var labelledby = idrefs_default(node, 'aria-labelledby'); - return !labelledby.includes(ATVisibleLabels[0]) ? void 0 : false; + } + if (nodeName2 === 'input' && [ 'submit', 'reset' ].includes(type)) { + return label3 === null; } return false; } - var multiple_label_evaluate_default = multipleLabelEvaluate; - function titleOnlyEvaluate(node, options, virtualNode) { - var labelText2 = label_virtual_default2(virtualNode); - var title = title_text_default(virtualNode); - var ariaDescribedBy = virtualNode.attr('aria-describedby'); - return !labelText2 && !!(title || ariaDescribedBy); - } - var title_only_evaluate_default = titleOnlyEvaluate; - function landmarkIsUniqueAfter(results) { - var uniqueLandmarks = []; - return results.filter(function(currentResult) { - var findMatch = function findMatch(someResult) { - return currentResult.data.role === someResult.data.role && currentResult.data.accessibleText === someResult.data.accessibleText; - }; - var matchedResult = uniqueLandmarks.find(findMatch); - if (matchedResult) { - matchedResult.result = false; - matchedResult.relatedNodes.push(currentResult.relatedNodes[0]); - return false; - } - uniqueLandmarks.push(currentResult); - currentResult.relatedNodes = []; + var non_empty_if_present_evaluate_default = nonEmptyIfPresentEvaluate; + function presentationalRoleEvaluate(node, options, virtualNode) { + var explicitRole2 = get_explicit_role_default(virtualNode); + if ([ 'presentation', 'none' ].includes(explicitRole2) && [ 'iframe', 'frame' ].includes(virtualNode.props.nodeName) && virtualNode.hasAttr('title')) { + this.data({ + messageKey: 'iframe', + nodeName: virtualNode.props.nodeName + }); + return false; + } + var role = get_role_default(virtualNode); + if ([ 'presentation', 'none' ].includes(role)) { + this.data({ + role: role + }); return true; + } + if (![ 'presentation', 'none' ].includes(explicitRole2)) { + return false; + } + var hasGlobalAria = get_global_aria_attrs_default().some(function(attr) { + return virtualNode.hasAttr(attr); }); + var focusable = _isFocusable(virtualNode); + var messageKey; + if (hasGlobalAria && !focusable) { + messageKey = 'globalAria'; + } else if (!hasGlobalAria && focusable) { + messageKey = 'focusable'; + } else { + messageKey = 'both'; + } + this.data({ + messageKey: messageKey, + role: role + }); + return false; } - var landmark_is_unique_after_default = landmarkIsUniqueAfter; - function landmarkIsUniqueEvaluate(node, options, virtualNode) { - var role = get_role_default(node); - var accessibleText2 = accessible_text_virtual_default(virtualNode); - accessibleText2 = accessibleText2 ? accessibleText2.toLowerCase() : null; - this.data({ - role: role, - accessibleText: accessibleText2 - }); - this.relatedNodes([ node ]); - return true; - } - var landmark_is_unique_evaluate_default = landmarkIsUniqueEvaluate; - function hasValue(value) { - return (value || '').trim() !== ''; - } - function hasLangEvaluate(node, options, virtualNode) { - var xhtml2 = typeof document !== 'undefined' ? is_xhtml_default(document) : false; - if (options.attributes.includes('xml:lang') && options.attributes.includes('lang') && hasValue(virtualNode.attr('xml:lang')) && !hasValue(virtualNode.attr('lang')) && !xhtml2) { - this.data({ - messageKey: 'noXHTML' - }); - return false; + function svgNonEmptyTitleEvaluate(node, options, virtualNode) { + if (!virtualNode.children) { + return void 0; } - var hasLang = options.attributes.some(function(name) { - return hasValue(virtualNode.attr(name)); + var titleNode = virtualNode.children.find(function(_ref108) { + var props = _ref108.props; + return props.nodeName === 'title'; }); - if (!hasLang) { + if (!titleNode) { this.data({ - messageKey: 'noLang' + messageKey: 'noTitle' }); return false; } + try { + var titleText2 = subtree_text_default(titleNode, { + includeHidden: true + }).trim(); + if (titleText2 === '') { + this.data({ + messageKey: 'emptyTitle' + }); + return false; + } + } catch (e) { + return void 0; + } return true; } - var has_lang_evaluate_default = hasLangEvaluate; - function validLangEvaluate(node, options, virtualNode) { - var invalid = []; - options.attributes.forEach(function(langAttr) { - var langVal = virtualNode.attr(langAttr); - if (typeof langVal !== 'string') { - return; - } - var baselangVal = get_base_lang_default(langVal); - var invalidLang = options.value ? !options.value.map(get_base_lang_default).includes(baselangVal) : !valid_langs_default(baselangVal); - if (baselangVal !== '' && invalidLang || langVal !== '' && !sanitize_default(langVal)) { - invalid.push(langAttr + '="' + virtualNode.attr(langAttr) + '"'); - } - }); - if (invalid.length) { - this.data(invalid); + var svg_non_empty_title_evaluate_default = svgNonEmptyTitleEvaluate; + function captionFakedEvaluate(node) { + var table = to_grid_default(node); + var firstRow = table[0]; + if (table.length <= 1 || firstRow.length <= 1 || node.rows.length <= 1) { return true; } - return false; - } - var valid_lang_evaluate_default = validLangEvaluate; - function xmlLangMismatchEvaluate(node, options, vNode) { - var primaryLangValue = get_base_lang_default(vNode.attr('lang')); - var primaryXmlLangValue = get_base_lang_default(vNode.attr('xml:lang')); - return primaryLangValue === primaryXmlLangValue; + return firstRow.reduce(function(out, curr, i) { + return out || curr !== firstRow[i + 1] && firstRow[i + 1] !== void 0; + }, false); } - var xml_lang_mismatch_evaluate_default = xmlLangMismatchEvaluate; - function dlitemEvaluate(node) { - var parent = get_composed_parent_default(node); - var parentTagName = parent.nodeName.toUpperCase(); - var parentRole = get_explicit_role_default(parent); - if (parentTagName === 'DIV' && [ 'presentation', 'none', null ].includes(parentRole)) { - parent = get_composed_parent_default(parent); - parentTagName = parent.nodeName.toUpperCase(); - parentRole = get_explicit_role_default(parent); - } - if (parentTagName !== 'DL') { - return false; - } - if (!parentRole || [ 'presentation', 'none', 'list' ].includes(parentRole)) { + var caption_faked_evaluate_default = captionFakedEvaluate; + function html5ScopeEvaluate(node) { + if (!is_html5_default(document)) { return true; } - return false; + return node.nodeName.toUpperCase() === 'TH'; } - var dlitem_evaluate_default = dlitemEvaluate; - function listitemEvaluate(node, options, virtualNode) { - var parent = virtualNode.parent; - if (!parent) { + var html5_scope_evaluate_default = html5ScopeEvaluate; + var same_caption_summary_evaluate_default = sameCaptionSummaryEvaluate; + function sameCaptionSummaryEvaluate(node, options, virtualNode) { + if (virtualNode.children === void 0) { return void 0; } - var parentNodeName = parent.props.nodeName; - var parentRole = get_explicit_role_default(parent); - if ([ 'presentation', 'none', 'list' ].includes(parentRole)) { - return true; - } - if (parentRole && is_valid_role_default(parentRole)) { - this.data({ - messageKey: 'roleNotValid' - }); + var summary = virtualNode.attr('summary'); + var captionNode = virtualNode.children.find(isCaptionNode); + var caption = captionNode ? sanitize_default(subtree_text_default(captionNode)) : false; + if (!caption || !summary) { return false; } - return [ 'ul', 'ol', 'menu' ].includes(parentNodeName); + return sanitize_default(summary).toLowerCase() === sanitize_default(caption).toLowerCase(); } - function onlyDlitemsEvaluate(node, options, virtualNode) { - var ALLOWED_ROLES = [ 'definition', 'term', 'list' ]; - var base = { - badNodes: [], - hasNonEmptyTextNode: false - }; - var content = virtualNode.children.reduce(function(content2, child) { - var actualNode = child.actualNode; - if (actualNode.nodeName.toUpperCase() === 'DIV' && get_role_default(actualNode) === null) { - return content2.concat(child.children); - } - return content2.concat(child); - }, []); - var result = content.reduce(function(out, childNode) { - var actualNode = childNode.actualNode; - var tagName = actualNode.nodeName.toUpperCase(); - if (actualNode.nodeType === 1 && is_visible_default(actualNode, true, false)) { - var explicitRole2 = get_explicit_role_default(actualNode); - if (tagName !== 'DT' && tagName !== 'DD' || explicitRole2) { - if (!ALLOWED_ROLES.includes(explicitRole2)) { - out.badNodes.push(actualNode); - } - } - } else if (actualNode.nodeType === 3 && actualNode.nodeValue.trim() !== '') { - out.hasNonEmptyTextNode = true; - } - return out; - }, base); - if (result.badNodes.length) { - this.relatedNodes(result.badNodes); - } - return !!result.badNodes.length || result.hasNonEmptyTextNode; + function isCaptionNode(virtualNode) { + return virtualNode.props.nodeName === 'caption'; } - var only_dlitems_evaluate_default = onlyDlitemsEvaluate; - function onlyListitemsEvaluate(node, options, virtualNode) { - var hasNonEmptyTextNode = false; - var atLeastOneListitem = false; - var isEmpty = true; - var badNodes = []; - var badRoleNodes = []; - var badRoles = []; - virtualNode.children.forEach(function(vNode) { - var actualNode = vNode.actualNode; - if (actualNode.nodeType === 3 && actualNode.nodeValue.trim() !== '') { - hasNonEmptyTextNode = true; - return; - } - if (actualNode.nodeType !== 1 || !is_visible_default(actualNode, true, false)) { - return; - } - isEmpty = false; - var isLi = actualNode.nodeName.toUpperCase() === 'LI'; - var role = get_role_default(vNode); - var isListItemRole = role === 'listitem'; - if (!isLi && !isListItemRole) { - badNodes.push(actualNode); - } - if (isLi && !isListItemRole) { - badRoleNodes.push(actualNode); - if (!badRoles.includes(role)) { - badRoles.push(role); + function scopeValueEvaluate(node, options) { + var value = node.getAttribute('scope').toLowerCase(); + return options.values.indexOf(value) !== -1; + } + var scope_value_evaluate_default = scopeValueEvaluate; + function tdHasHeaderEvaluate(node) { + var badCells = []; + var cells = get_all_cells_default(node); + var tableGrid = to_grid_default(node); + cells.forEach(function(cell) { + if (has_content_default(cell) && is_data_cell_default(cell) && !label_default2(cell)) { + var hasHeaders = get_headers_default(cell, tableGrid).some(function(header) { + return header !== null && !!has_content_default(header); + }); + if (!hasHeaders) { + badCells.push(cell); } } - if (isListItemRole) { - atLeastOneListitem = true; - } }); - if (hasNonEmptyTextNode || badNodes.length) { - this.relatedNodes(badNodes); - return true; - } - if (isEmpty || atLeastOneListitem) { + if (badCells.length) { + this.relatedNodes(badCells); return false; } - this.relatedNodes(badRoleNodes); - this.data({ - messageKey: 'roleNotValid', - roles: badRoles.join(', ') - }); return true; } - var only_listitems_evaluate_default = onlyListitemsEvaluate; - function structuredDlitemsEvaluate(node, options, virtualNode) { - var children = virtualNode.children; - if (!children || !children.length) { - return false; - } - var hasDt = false, hasDd = false, nodeName2; - for (var i = 0; i < children.length; i++) { - nodeName2 = children[i].props.nodeName.toUpperCase(); - if (nodeName2 === 'DT') { - hasDt = true; + var td_has_header_evaluate_default = tdHasHeaderEvaluate; + function tdHeadersAttrEvaluate(node) { + var cells = []; + var reviewCells = []; + var badCells = []; + for (var rowIndex = 0; rowIndex < node.rows.length; rowIndex++) { + var row = node.rows[rowIndex]; + for (var cellIndex = 0; cellIndex < row.cells.length; cellIndex++) { + cells.push(row.cells[cellIndex]); } - if (hasDt && nodeName2 === 'DD') { - return false; + } + var ids = cells.reduce(function(ids2, cell) { + if (cell.getAttribute('id')) { + ids2.push(cell.getAttribute('id')); } - if (nodeName2 === 'DD') { - hasDd = true; + return ids2; + }, []); + cells.forEach(function(cell) { + var isSelf = false; + var notOfTable = false; + if (!cell.hasAttribute('headers') || !_isVisibleToScreenReaders(cell)) { + return; } - } - return hasDt || hasDd; - } - var structured_dlitems_evaluate_default = structuredDlitemsEvaluate; - function captionEvaluate(node, options, virtualNode) { - var tracks = query_selector_all_default(virtualNode, 'track'); - var hasCaptions = tracks.some(function(vNode) { - return (vNode.attr('kind') || '').toLowerCase() === 'captions'; - }); - return hasCaptions ? false : void 0; - } - var caption_evaluate_default = captionEvaluate; - function frameTestedEvaluate(node, options) { - return options.isViolation ? false : void 0; - } - var frame_tested_evaluate_default = frameTestedEvaluate; - var joinStr = ' > '; - function frameTestedAfter(results) { - var iframes = {}; - return results.filter(function(result) { - var frameResult = result.node.ancestry[result.node.ancestry.length - 1] !== 'html'; - if (frameResult) { - var ancestry2 = result.node.ancestry.flat(Infinity).join(joinStr); - iframes[ancestry2] = result; - return true; + var headersAttr = cell.getAttribute('headers').trim(); + if (!headersAttr) { + return reviewCells.push(cell); } - var ancestry = result.node.ancestry.slice(0, result.node.ancestry.length - 1).flat(Infinity).join(joinStr); - if (iframes[ancestry]) { - iframes[ancestry].result = true; + var headers = token_list_default(headersAttr); + if (headers.length !== 0) { + if (cell.getAttribute('id')) { + isSelf = headers.indexOf(cell.getAttribute('id').trim()) !== -1; + } + notOfTable = headers.some(function(header) { + return !ids.includes(header); + }); + if (isSelf || notOfTable) { + badCells.push(cell); + } } - return false; }); - } - var frame_tested_after_default = frameTestedAfter; - function noAutoplayAudioEvaluate(node, options) { - if (!node.duration) { - console.warn('axe.utils.preloadMedia did not load metadata'); - return void 0; - } - var _options$allowedDurat = options.allowedDuration, allowedDuration = _options$allowedDurat === void 0 ? 3 : _options$allowedDurat; - var playableDuration = getPlayableDuration(node); - if (playableDuration <= allowedDuration && !node.hasAttribute('loop')) { - return true; - } - if (!node.hasAttribute('controls')) { + if (badCells.length > 0) { + this.relatedNodes(badCells); return false; } + if (reviewCells.length) { + this.relatedNodes(reviewCells); + return void 0; + } return true; - function getPlayableDuration(elm) { - if (!elm.currentSrc) { - return 0; + } + var td_headers_attr_evaluate_default = tdHeadersAttrEvaluate; + function thHasDataCellsEvaluate(node) { + var cells = get_all_cells_default(node); + var checkResult = this; + var reffedHeaders = []; + cells.forEach(function(cell) { + var headers2 = cell.getAttribute('headers'); + if (headers2) { + reffedHeaders = reffedHeaders.concat(headers2.split(/\s+/)); } - var playbackRange = getPlaybackRange(elm.currentSrc); - if (!playbackRange) { - return Math.abs(elm.duration - (elm.currentTime || 0)); + var ariaLabel = cell.getAttribute('aria-labelledby'); + if (ariaLabel) { + reffedHeaders = reffedHeaders.concat(ariaLabel.split(/\s+/)); } - if (playbackRange.length === 1) { - return Math.abs(elm.duration - playbackRange[0]); + }); + var headers = cells.filter(function(cell) { + if (sanitize_default(cell.textContent) === '') { + return false; } - return Math.abs(playbackRange[1] - playbackRange[0]); - } - function getPlaybackRange(src) { - var match = src.match(/#t=(.*)/); - if (!match) { + return cell.nodeName.toUpperCase() === 'TH' || [ 'rowheader', 'columnheader' ].indexOf(cell.getAttribute('role')) !== -1; + }); + var tableGrid = to_grid_default(node); + var out = true; + headers.forEach(function(header) { + if (header.getAttribute('id') && reffedHeaders.includes(header.getAttribute('id'))) { return; } - var _match = _slicedToArray(match, 2), value = _match[1]; - var ranges = value.split(','); - return ranges.map(function(range) { - if (/:/.test(range)) { - return convertHourMinSecToSeconds(range); + var pos = get_cell_position_default(header, tableGrid); + var hasCell = false; + if (is_column_header_default(header)) { + hasCell = traverse_default('down', pos, tableGrid).find(function(cell) { + return !is_column_header_default(cell) && get_headers_default(cell, tableGrid).includes(header); + }); + } + if (!hasCell && is_row_header_default(header)) { + hasCell = traverse_default('right', pos, tableGrid).find(function(cell) { + return !is_row_header_default(cell) && get_headers_default(cell, tableGrid).includes(header); + }); + } + if (!hasCell) { + checkResult.relatedNodes(header); + } + out = out && hasCell; + }); + return out ? true : void 0; + } + var th_has_data_cells_evaluate_default = thHasDataCellsEvaluate; + function hiddenContentEvaluate(node, options, virtualNode) { + var allowlist = [ 'SCRIPT', 'HEAD', 'TITLE', 'NOSCRIPT', 'STYLE', 'TEMPLATE' ]; + if (!allowlist.includes(node.nodeName.toUpperCase()) && has_content_virtual_default(virtualNode)) { + var styles = window.getComputedStyle(node); + if (styles.getPropertyValue('display') === 'none') { + return void 0; + } else if (styles.getPropertyValue('visibility') === 'hidden') { + var parent = get_composed_parent_default(node); + var parentStyle = parent && window.getComputedStyle(parent); + if (!parentStyle || parentStyle.getPropertyValue('visibility') !== 'hidden') { + return void 0; } - return parseFloat(range); - }); - } - function convertHourMinSecToSeconds(hhMmSs) { - var parts = hhMmSs.split(':'); - var secs = 0; - var mins = 1; - while (parts.length > 0) { - secs += mins * parseInt(parts.pop(), 10); - mins *= 60; } - return parseFloat(secs); } + return true; } - var no_autoplay_audio_evaluate_default = noAutoplayAudioEvaluate; + var hidden_content_evaluate_default = hiddenContentEvaluate; function ariaAllowedAttrMatches(node, virtualNode) { - var aria48 = /^aria-/; + var aria = /^aria-/; var attrs = virtualNode.attrNames; if (attrs.length) { - for (var _i23 = 0, l = attrs.length; _i23 < l; _i23++) { - if (aria48.test(attrs[_i23])) { + for (var _i26 = 0, l = attrs.length; _i26 < l; _i26++) { + if (aria.test(attrs[_i26])) { return true; } } @@ -19388,9 +21092,9 @@ } var aria_allowed_role_matches_default = ariaAllowedRoleMatches; function ariaHasAttrMatches(node, virtualNode) { - var aria48 = /^aria-/; + var aria = /^aria-/; return virtualNode.attrNames.some(function(attr) { - return aria48.test(attr); + return aria.test(attr); }); } var aria_has_attr_matches_default = ariaHasAttrMatches; @@ -19444,18 +21148,18 @@ return false; } } - if (tabIndex === '-1' && virtualNode.actualNode && !is_visible_default(virtualNode.actualNode, false) && !is_visible_default(virtualNode.actualNode, true)) { + if (tabIndex === '-1' && virtualNode.actualNode && !_isVisibleOnScreen(virtualNode) && !_isVisibleToScreenReaders(virtualNode)) { return false; } return true; } var autocomplete_matches_default = autocompleteMatches; - function isInitiatorMatches(node, virtualNode, context5) { - return context5.initiator; + function isInitiatorMatches(node, virtualNode, context) { + return context.initiator; } var is_initiator_matches_default = isInitiatorMatches; - function bypassMatches(node, virtualNode, context5) { - if (is_initiator_matches_default(node, virtualNode, context5)) { + function bypassMatches(node, virtualNode, context) { + if (is_initiator_matches_default(node, virtualNode, context)) { return !!node.querySelector('a[href]'); } return true; @@ -19528,13 +21232,7 @@ if (ariaLabelledbyControls.length > 0 && ariaLabelledbyControls.every(is_disabled_default)) { return false; } - var visibleText = visible_virtual_default(virtualNode, false, true); - var removeUnicodeOptions = { - emoji: true, - nonBmp: false, - punctuations: true - }; - if (!visibleText || !remove_unicode_default(visibleText, removeUnicodeOptions)) { + if (!hasRealTextChildren(virtualNode)) { return false; } var range = document.createRange(); @@ -19546,14 +21244,28 @@ } } var rects = range.getClientRects(); - for (var _index = 0; _index < rects.length; _index++) { - if (visually_overlaps_default(rects[_index], node)) { + for (var _index2 = 0; _index2 < rects.length; _index2++) { + if (visually_overlaps_default(rects[_index2], node)) { return true; } } return false; } var color_contrast_matches_default = colorContrastMatches; + var removeUnicodeOptions = { + emoji: true, + nonBmp: false, + punctuations: true + }; + function hasRealTextChildren(virtualNode) { + var visibleText = visible_virtual_default(virtualNode, false, true); + if (visibleText === '' || remove_unicode_default(visibleText, removeUnicodeOptions) === '') { + return false; + } + return virtualNode.children.some(function(vChild) { + return vChild.props.nodeName === '#text' && !is_icon_ligature_default(vChild); + }); + } function dataTableLargeMatches(node) { if (is_data_table_default(node)) { var tableArray = to_grid_default(node); @@ -19570,7 +21282,7 @@ var id = node.getAttribute('id').trim(); var idSelector = '*[id="'.concat(escape_selector_default(id), '"]'); var idMatchingElms = Array.from(get_root_node_default2(node).querySelectorAll(idSelector)); - return !is_accessible_ref_default(node) && idMatchingElms.some(is_focusable_default); + return !is_accessible_ref_default(node) && idMatchingElms.some(_isFocusable); } var duplicate_id_active_matches_default = duplicateIdActiveMatches; function duplicateIdAriaMatches(node) { @@ -19582,13 +21294,13 @@ var idSelector = '*[id="'.concat(escape_selector_default(id), '"]'); var idMatchingElms = Array.from(get_root_node_default2(node).querySelectorAll(idSelector)); return !is_accessible_ref_default(node) && idMatchingElms.every(function(elm) { - return !is_focusable_default(elm); + return !_isFocusable(elm); }); } var duplicate_id_misc_matches_default = duplicateIdMiscMatches; - function frameFocusableContentMatches(node, virtualNode, context5) { - var _context5$size, _context5$size2; - return !context5.initiator && !context5.focusable && ((_context5$size = context5.size) === null || _context5$size === void 0 ? void 0 : _context5$size.width) * ((_context5$size2 = context5.size) === null || _context5$size2 === void 0 ? void 0 : _context5$size2.height) > 1; + function frameFocusableContentMatches(node, virtualNode, context) { + var _context$size, _context$size2; + return !context.initiator && !context.focusable && ((_context$size = context.size) === null || _context$size === void 0 ? void 0 : _context$size.width) * ((_context$size2 = context.size) === null || _context$size2 === void 0 ? void 0 : _context$size2.height) > 1; } var frame_focusable_content_matches_default = frameFocusableContentMatches; function frameTitleHasTextMatches(node) { @@ -19596,18 +21308,15 @@ return !!sanitize_default(title); } var frame_title_has_text_matches_default = frameTitleHasTextMatches; - function headingMatches(node) { - var explicitRoles; - if (node.hasAttribute('role')) { - explicitRoles = node.getAttribute('role').split(/\s+/i).filter(axe.commons.aria.isValidRole); - } - if (explicitRoles && explicitRoles.length > 0) { - return explicitRoles.includes('heading'); - } else { - return axe.commons.aria.implicitRole(node) === 'heading'; - } + function hasImplicitChromiumRoleMatches(node, virtualNode) { + return implicit_role_default(virtualNode, { + chromium: true + }) !== null; + } + var has_implicit_chromium_role_matches_default = hasImplicitChromiumRoleMatches; + function headingMatches(node, virtualNode) { + return get_role_default(virtualNode) === 'heading'; } - var heading_matches_default = headingMatches; function svgNamespaceMatches(node, virtualNode) { try { var nodeName2 = virtualNode.props.nodeName; @@ -19640,14 +21349,20 @@ return inserted_into_focus_order_default(node); } var inserted_into_focus_order_matches_default = insertedIntoFocusOrderMatches; + function hasVisibleTextMatches(node) { + return _isVisibleOnScreen(node); + } + function isVisibleOnScreenMatches(node, virtualNode) { + return _isVisibleOnScreen(virtualNode); + } function labelContentNameMismatchMatches(node, virtualNode) { var role = get_role_default(node); if (!role) { return false; } var widgetRoles = get_aria_roles_by_type_default('widget'); - var isWidgetType = widgetRoles.includes(role); - if (!isWidgetType) { + var isWidgetType2 = widgetRoles.includes(role); + if (!isWidgetType2) { return false; } var rolesWithNameFromContents = get_aria_roles_supporting_name_from_content_default(); @@ -19679,7 +21394,7 @@ function landmarkUniqueMatches(node, virtualNode) { var excludedParentsForHeaderFooterLandmarks = [ 'article', 'aside', 'main', 'nav', 'section' ].join(','); function isHeaderFooterLandmark(headerFooterElement) { - return !find_up_virtual_default(headerFooterElement, excludedParentsForHeaderFooterLandmarks); + return !closest_default(headerFooterElement, excludedParentsForHeaderFooterLandmarks); } function isLandmarkVirtual(virtualNode2) { var actualNode = virtualNode2.actualNode; @@ -19698,23 +21413,23 @@ } return landmarkRoles3.indexOf(role) >= 0 || role === 'region'; } - return isLandmarkVirtual(virtualNode) && is_visible_default(node, true); + return isLandmarkVirtual(virtualNode) && _isVisibleToScreenReaders(node); } var landmark_unique_matches_default = landmarkUniqueMatches; function dataTableMatches2(node) { - return !is_data_table_default(node) && !is_focusable_default(node); + return !is_data_table_default(node) && !_isFocusable(node); } var layout_table_matches_default = dataTableMatches2; function linkInTextBlockMatches(node) { - var text32 = sanitize_default(node.textContent); + var text = sanitize_default(node.innerText); var role = node.getAttribute('role'); if (role && role !== 'link') { return false; } - if (!text32) { + if (!text) { return false; } - if (!is_visible_default(node, false)) { + if (!_isVisibleOnScreen(node)) { return false; } return is_in_text_block_default(node); @@ -19753,8 +21468,8 @@ if (!role || [ 'none', 'presentation' ].includes(role)) { return true; } - var _ref85 = aria_roles_default[role] || {}, accessibleNameRequired = _ref85.accessibleNameRequired; - if (accessibleNameRequired || is_focusable_default(virtualNode)) { + var _ref109 = aria_roles_default[role] || {}, accessibleNameRequired = _ref109.accessibleNameRequired; + if (accessibleNameRequired || _isFocusable(virtualNode)) { return true; } return false; @@ -19771,14 +21486,34 @@ return true; } var no_naming_method_matches_default = noNamingMethodMatches; - function noRoleMatches(node) { - return !node.getAttribute('role'); + function noNegativeTabindexMatches(node, virtualNode) { + var tabindex = parseInt(virtualNode.attr('tabindex'), 10); + return isNaN(tabindex) || tabindex >= 0; + } + var no_negative_tabindex_matches_default = noNegativeTabindexMatches; + function noRoleMatches(node, vNode) { + return !vNode.attr('role'); } var no_role_matches_default = noRoleMatches; function notHtmlMatches(node, virtualNode) { return virtualNode.props.nodeName !== 'html'; } var not_html_matches_default = notHtmlMatches; + var object_is_loaded_matches_default = function object_is_loaded_matches_default(node, vNode) { + return [ no_explicit_name_required_matches_default, objectHasLoaded ].every(function(fn) { + return fn(node, vNode); + }); + }; + function objectHasLoaded(node) { + var _node$ownerDocument; + if (!(node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.createRange)) { + return true; + } + var range = node.ownerDocument.createRange(); + range.setStart(node, 0); + range.setEnd(node, node.childNodes.length); + return range.getClientRects().length === 0; + } function pAsHeadingMatches(node) { var children = Array.from(node.parentNode.childNodes); var nodeText = node.textContent.trim(); @@ -19792,6 +21527,12 @@ return siblingsAfter.length !== 0; } var p_as_heading_matches_default = pAsHeadingMatches; + function presentationRoleConflictMatches(node, virtualNode) { + return implicit_role_default(virtualNode, { + chromiumRoles: true + }) !== null; + } + var presentation_role_conflict_matches_default = presentationRoleConflictMatches; function scrollableRegionFocusableMatches(node, virtualNode) { if (!!_getScroll(node, 13) === false) { return false; @@ -19828,166 +21569,217 @@ return _isSkipLink(node) && is_offscreen_default(node); } var skip_link_matches_default = skipLinkMatches; - function windowIsTopMatches(node) { - return node.ownerDocument.defaultView.self === node.ownerDocument.defaultView.top; + function tableOrGridRoleMatches(_, vNode) { + var role = get_role_default(vNode); + return [ 'treegrid', 'grid', 'table' ].includes(role); } - var window_is_top_matches_default = windowIsTopMatches; - function xmlLangMismatchMatches(node) { - var primaryLangValue = get_base_lang_default(node.getAttribute('lang')); - var primaryXmlLangValue = get_base_lang_default(node.getAttribute('xml:lang')); - return valid_langs_default(primaryLangValue) && valid_langs_default(primaryXmlLangValue); + function widgetNotInline(node, vNode) { + return matchesFns.every(function(fn) { + return fn(node, vNode); + }); } - var xml_lang_mismatch_matches_default = xmlLangMismatchMatches; - var metadataFunctionMap = { - 'abstractrole-evaluate': abstractrole_evaluate_default, - 'aria-allowed-attr-evaluate': aria_allowed_attr_evaluate_default, - 'aria-allowed-role-evaluate': aria_allowed_role_evaluate_default, - 'aria-errormessage-evaluate': aria_errormessage_evaluate_default, - 'aria-hidden-body-evaluate': aria_hidden_body_evaluate_default, - 'aria-level-evaluate': aria_level_evaluate_default, - 'aria-prohibited-attr-evaluate': ariaProhibitedAttrEvaluate, - 'aria-required-attr-evaluate': aria_required_attr_evaluate_default, - 'aria-required-children-evaluate': aria_required_children_evaluate_default, - 'aria-required-parent-evaluate': aria_required_parent_evaluate_default, - 'aria-roledescription-evaluate': aria_roledescription_evaluate_default, - 'aria-unsupported-attr-evaluate': aria_unsupported_attr_evaluate_default, - 'aria-valid-attr-evaluate': aria_valid_attr_evaluate_default, - 'aria-valid-attr-value-evaluate': aria_valid_attr_value_evaluate_default, - 'deprecatedrole-evaluate': deprecatedroleEvaluate, - 'fallbackrole-evaluate': fallbackrole_evaluate_default, - 'has-global-aria-attribute-evaluate': has_global_aria_attribute_evaluate_default, - 'has-implicit-chromium-role-matches': has_implicit_chromium_role_matches_default, - 'has-widget-role-evaluate': has_widget_role_evaluate_default, - 'invalidrole-evaluate': invalidrole_evaluate_default, - 'is-element-focusable-evaluate': is_element_focusable_evaluate_default, - 'no-implicit-explicit-label-evaluate': no_implicit_explicit_label_evaluate_default, - 'unsupportedrole-evaluate': unsupportedrole_evaluate_default, - 'valid-scrollable-semantics-evaluate': valid_scrollable_semantics_evaluate_default, - 'caption-faked-evaluate': caption_faked_evaluate_default, - 'html5-scope-evaluate': html5_scope_evaluate_default, - 'same-caption-summary-evaluate': same_caption_summary_evaluate_default, - 'scope-value-evaluate': scope_value_evaluate_default, - 'td-has-header-evaluate': td_has_header_evaluate_default, - 'td-headers-attr-evaluate': td_headers_attr_evaluate_default, - 'th-has-data-cells-evaluate': th_has_data_cells_evaluate_default, - 'hidden-content-evaluate': hidden_content_evaluate_default, - 'color-contrast-evaluate': colorContrastEvaluate, - 'link-in-text-block-evaluate': link_in_text_block_evaluate_default, - 'autocomplete-appropriate-evaluate': autocomplete_appropriate_evaluate_default, - 'autocomplete-valid-evaluate': autocomplete_valid_evaluate_default, - 'attr-non-space-content-evaluate': attr_non_space_content_evaluate_default, - 'has-descendant-after': has_descendant_after_default, - 'has-descendant-evaluate': has_descendant_evaluate_default, - 'has-text-content-evaluate': has_text_content_evaluate_default, - 'matches-definition-evaluate': matches_definition_evaluate_default, - 'page-no-duplicate-after': page_no_duplicate_after_default, - 'page-no-duplicate-evaluate': page_no_duplicate_evaluate_default, - 'heading-order-after': headingOrderAfter, - 'heading-order-evaluate': heading_order_evaluate_default, - 'identical-links-same-purpose-after': identical_links_same_purpose_after_default, - 'identical-links-same-purpose-evaluate': identical_links_same_purpose_evaluate_default, - 'internal-link-present-evaluate': internal_link_present_evaluate_default, - 'meta-refresh-evaluate': meta_refresh_evaluate_default, - 'p-as-heading-evaluate': p_as_heading_evaluate_default, - 'region-evaluate': region_evaluate_default, - 'region-after': region_after_default, - 'skip-link-evaluate': skip_link_evaluate_default, - 'unique-frame-title-after': unique_frame_title_after_default, - 'unique-frame-title-evaluate': unique_frame_title_evaluate_default, - 'aria-label-evaluate': aria_label_evaluate_default, - 'aria-labelledby-evaluate': aria_labelledby_evaluate_default, - 'avoid-inline-spacing-evaluate': avoid_inline_spacing_evaluate_default, - 'doc-has-title-evaluate': doc_has_title_evaluate_default, - 'exists-evaluate': exists_evaluate_default, - 'has-alt-evaluate': has_alt_evaluate_default, - 'is-on-screen-evaluate': is_on_screen_evaluate_default, - 'non-empty-if-present-evaluate': non_empty_if_present_evaluate_default, - 'presentational-role-evaluate': presentational_role_evaluate_default, - 'svg-non-empty-title-evaluate': svg_non_empty_title_evaluate_default, - 'css-orientation-lock-evaluate': css_orientation_lock_evaluate_default, - 'meta-viewport-scale-evaluate': meta_viewport_scale_evaluate_default, - 'duplicate-id-after': duplicate_id_after_default, - 'duplicate-id-evaluate': duplicate_id_evaluate_default, - 'accesskeys-after': accesskeys_after_default, - 'accesskeys-evaluate': accesskeys_evaluate_default, - 'focusable-content-evaluate': focusable_content_evaluate_default, - 'focusable-disabled-evaluate': focusable_disabled_evaluate_default, - 'focusable-element-evaluate': focusable_element_evaluate_default, - 'focusable-modal-open-evaluate': focusable_modal_open_evaluate_default, - 'focusable-no-name-evaluate': focusable_no_name_evaluate_default, - 'focusable-not-tabbable-evaluate': focusable_not_tabbable_evaluate_default, - 'landmark-is-top-level-evaluate': landmark_is_top_level_evaluate_default, - 'frame-focusable-content-evaluate': frame_focusable_content_evaluate_default, - 'no-focusable-content-evaluate': noFocusableContentEvaluate, - 'tabindex-evaluate': tabindex_evaluate_default, - 'alt-space-value-evaluate': alt_space_value_evaluate_default, - 'duplicate-img-label-evaluate': duplicate_img_label_evaluate_default, - 'explicit-evaluate': explicit_evaluate_default, - 'help-same-as-label-evaluate': help_same_as_label_evaluate_default, - 'hidden-explicit-label-evaluate': hidden_explicit_label_evaluate_default, - 'implicit-evaluate': implicit_evaluate_default, - 'label-content-name-mismatch-evaluate': label_content_name_mismatch_evaluate_default, - 'multiple-label-evaluate': multiple_label_evaluate_default, - 'title-only-evaluate': title_only_evaluate_default, - 'landmark-is-unique-after': landmark_is_unique_after_default, - 'landmark-is-unique-evaluate': landmark_is_unique_evaluate_default, - 'has-lang-evaluate': has_lang_evaluate_default, - 'valid-lang-evaluate': valid_lang_evaluate_default, - 'xml-lang-mismatch-evaluate': xml_lang_mismatch_evaluate_default, - 'dlitem-evaluate': dlitem_evaluate_default, - 'listitem-evaluate': listitemEvaluate, - 'only-dlitems-evaluate': only_dlitems_evaluate_default, - 'only-listitems-evaluate': only_listitems_evaluate_default, - 'structured-dlitems-evaluate': structured_dlitems_evaluate_default, - 'caption-evaluate': caption_evaluate_default, - 'frame-tested-evaluate': frame_tested_evaluate_default, - 'frame-tested-after': frame_tested_after_default, - 'no-autoplay-audio-evaluate': no_autoplay_audio_evaluate_default, + var matchesFns = [ function(node, vNode) { + return isWidgetType(vNode); + }, function(node, vNode) { + return isNotAreaElement(vNode); + }, function(node, vNode) { + return !svg_namespace_matches_default(node, vNode); + }, function(node, vNode) { + return _isFocusable(vNode); + }, function(node, vNode) { + return _isInTabOrder(vNode) || !hasWidgetAncestorInTabOrder(vNode); + }, function(node) { + return !is_in_text_block_default(node, { + noLengthCompare: true + }); + } ]; + function isWidgetType(vNode) { + return get_role_type_default(vNode) === 'widget'; + } + function isNotAreaElement(vNode) { + return vNode.props.nodeName !== 'area'; + } + var hasWidgetAncestorInTabOrder = memoize_default(function hasWidgetAncestorInTabOrderMemoized(vNode) { + if (!(vNode !== null && vNode !== void 0 && vNode.parent)) { + return false; + } + if (isWidgetType(vNode.parent) && _isInTabOrder(vNode.parent)) { + return true; + } + return hasWidgetAncestorInTabOrderMemoized(vNode.parent); + }); + function windowIsTopMatches(node) { + return node.ownerDocument.defaultView.self === node.ownerDocument.defaultView.top; + } + var window_is_top_matches_default = windowIsTopMatches; + function xmlLangMismatchMatches(node) { + var primaryLangValue = get_base_lang_default(node.getAttribute('lang')); + var primaryXmlLangValue = get_base_lang_default(node.getAttribute('xml:lang')); + return valid_langs_default(primaryLangValue) && valid_langs_default(primaryXmlLangValue); + } + var xml_lang_mismatch_matches_default = xmlLangMismatchMatches; + var metadataFunctionMap = { + 'abstractrole-evaluate': abstractrole_evaluate_default, + 'accesskeys-after': accesskeys_after_default, + 'accesskeys-evaluate': accesskeys_evaluate_default, + 'alt-space-value-evaluate': alt_space_value_evaluate_default, + 'aria-allowed-attr-evaluate': ariaAllowedAttrEvaluate, 'aria-allowed-attr-matches': aria_allowed_attr_matches_default, + 'aria-allowed-role-evaluate': aria_allowed_role_evaluate_default, 'aria-allowed-role-matches': aria_allowed_role_matches_default, - 'aria-form-field-name-matches': no_naming_method_matches_default, + 'aria-busy-evaluate': ariaBusyEvaluate, + 'aria-errormessage-evaluate': aria_errormessage_evaluate_default, 'aria-has-attr-matches': aria_has_attr_matches_default, + 'aria-hidden-body-evaluate': aria_hidden_body_evaluate_default, 'aria-hidden-focus-matches': aria_hidden_focus_matches_default, + 'aria-label-evaluate': aria_label_evaluate_default, + 'aria-labelledby-evaluate': aria_labelledby_evaluate_default, + 'aria-level-evaluate': aria_level_evaluate_default, + 'aria-prohibited-attr-evaluate': ariaProhibitedAttrEvaluate, + 'aria-required-attr-evaluate': ariaRequiredAttrEvaluate, + 'aria-required-children-evaluate': aria_required_children_evaluate_default, 'aria-required-children-matches': aria_required_children_matches_default, + 'aria-required-parent-evaluate': aria_required_parent_evaluate_default, 'aria-required-parent-matches': aria_required_parent_matches_default, + 'aria-roledescription-evaluate': aria_roledescription_evaluate_default, + 'aria-unsupported-attr-evaluate': aria_unsupported_attr_evaluate_default, + 'aria-valid-attr-evaluate': aria_valid_attr_evaluate_default, + 'aria-valid-attr-value-evaluate': ariaValidAttrValueEvaluate, + 'attr-non-space-content-evaluate': attr_non_space_content_evaluate_default, + 'autocomplete-appropriate-evaluate': autocomplete_appropriate_evaluate_default, 'autocomplete-matches': autocomplete_matches_default, + 'autocomplete-valid-evaluate': autocomplete_valid_evaluate_default, + 'avoid-inline-spacing-evaluate': avoid_inline_spacing_evaluate_default, 'bypass-matches': bypass_matches_default, + 'caption-evaluate': caption_evaluate_default, + 'caption-faked-evaluate': caption_faked_evaluate_default, + 'color-contrast-evaluate': colorContrastEvaluate, 'color-contrast-matches': color_contrast_matches_default, + 'css-orientation-lock-evaluate': css_orientation_lock_evaluate_default, 'data-table-large-matches': data_table_large_matches_default, 'data-table-matches': data_table_matches_default, + 'deprecatedrole-evaluate': deprecatedroleEvaluate, + 'dlitem-evaluate': dlitem_evaluate_default, + 'doc-has-title-evaluate': doc_has_title_evaluate_default, 'duplicate-id-active-matches': duplicate_id_active_matches_default, + 'duplicate-id-after': duplicate_id_after_default, 'duplicate-id-aria-matches': duplicate_id_aria_matches_default, + 'duplicate-id-evaluate': duplicate_id_evaluate_default, 'duplicate-id-misc-matches': duplicate_id_misc_matches_default, + 'duplicate-img-label-evaluate': duplicate_img_label_evaluate_default, + 'exists-evaluate': exists_evaluate_default, + 'explicit-evaluate': explicit_evaluate_default, + 'fallbackrole-evaluate': fallbackrole_evaluate_default, + 'focusable-content-evaluate': focusable_content_evaluate_default, + 'focusable-disabled-evaluate': focusable_disabled_evaluate_default, + 'focusable-element-evaluate': focusable_element_evaluate_default, + 'focusable-modal-open-evaluate': focusable_modal_open_evaluate_default, + 'focusable-no-name-evaluate': focusable_no_name_evaluate_default, + 'focusable-not-tabbable-evaluate': focusable_not_tabbable_evaluate_default, + 'frame-focusable-content-evaluate': frameFocusableContentEvaluate, 'frame-focusable-content-matches': frame_focusable_content_matches_default, + 'frame-tested-after': frame_tested_after_default, + 'frame-tested-evaluate': frame_tested_evaluate_default, 'frame-title-has-text-matches': frame_title_has_text_matches_default, - 'heading-matches': heading_matches_default, + 'has-alt-evaluate': has_alt_evaluate_default, + 'has-descendant-after': has_descendant_after_default, + 'has-descendant-evaluate': has_descendant_evaluate_default, + 'has-global-aria-attribute-evaluate': has_global_aria_attribute_evaluate_default, + 'has-implicit-chromium-role-matches': has_implicit_chromium_role_matches_default, + 'has-lang-evaluate': has_lang_evaluate_default, + 'has-text-content-evaluate': hasTextContentEvaluate, + 'has-widget-role-evaluate': has_widget_role_evaluate_default, + 'heading-matches': headingMatches, + 'heading-order-after': headingOrderAfter, + 'heading-order-evaluate': heading_order_evaluate_default, + 'help-same-as-label-evaluate': help_same_as_label_evaluate_default, + 'hidden-content-evaluate': hidden_content_evaluate_default, + 'hidden-explicit-label-evaluate': hidden_explicit_label_evaluate_default, 'html-namespace-matches': html_namespace_matches_default, + 'html5-scope-evaluate': html5_scope_evaluate_default, + 'identical-links-same-purpose-after': identical_links_same_purpose_after_default, + 'identical-links-same-purpose-evaluate': identical_links_same_purpose_evaluate_default, 'identical-links-same-purpose-matches': identical_links_same_purpose_matches_default, + 'implicit-evaluate': implicit_evaluate_default, + 'inline-style-property-evaluate': inlineStyleProperty, 'inserted-into-focus-order-matches': inserted_into_focus_order_matches_default, + 'internal-link-present-evaluate': internal_link_present_evaluate_default, + 'invalid-children-evaluate': invalidChildrenEvaluate, + 'invalidrole-evaluate': invalidrole_evaluate_default, + 'is-element-focusable-evaluate': is_element_focusable_evaluate_default, 'is-initiator-matches': is_initiator_matches_default, + 'is-on-screen-evaluate': is_on_screen_evaluate_default, + 'is-visible-matches': hasVisibleTextMatches, + 'is-visible-on-screen-matches': isVisibleOnScreenMatches, + 'label-content-name-mismatch-evaluate': label_content_name_mismatch_evaluate_default, 'label-content-name-mismatch-matches': label_content_name_mismatch_matches_default, 'label-matches': label_matches_default, 'landmark-has-body-context-matches': landmark_has_body_context_matches_default, + 'landmark-is-top-level-evaluate': landmark_is_top_level_evaluate_default, + 'landmark-is-unique-after': landmark_is_unique_after_default, + 'landmark-is-unique-evaluate': landmark_is_unique_evaluate_default, 'landmark-unique-matches': landmark_unique_matches_default, 'layout-table-matches': layout_table_matches_default, + 'link-in-text-block-evaluate': link_in_text_block_evaluate_default, 'link-in-text-block-matches': link_in_text_block_matches_default, + 'link-in-text-block-style-evaluate': link_in_text_block_style_evaluate_default, + 'listitem-evaluate': listitemEvaluate, + 'matches-definition-evaluate': matches_definition_evaluate_default, + 'meta-refresh-evaluate': metaRefreshEvaluate, + 'meta-viewport-scale-evaluate': meta_viewport_scale_evaluate_default, + 'multiple-label-evaluate': multiple_label_evaluate_default, 'nested-interactive-matches': nested_interactive_matches_default, + 'no-autoplay-audio-evaluate': no_autoplay_audio_evaluate_default, 'no-autoplay-audio-matches': no_autoplay_audio_matches_default, 'no-empty-role-matches': no_empty_role_matches_default, 'no-explicit-name-required-matches': no_explicit_name_required_matches_default, + 'no-focusable-content-evaluate': noFocusableContentEvaluate, + 'no-implicit-explicit-label-evaluate': no_implicit_explicit_label_evaluate_default, 'no-naming-method-matches': no_naming_method_matches_default, + 'no-negative-tabindex-matches': no_negative_tabindex_matches_default, 'no-role-matches': no_role_matches_default, + 'non-empty-if-present-evaluate': non_empty_if_present_evaluate_default, 'not-html-matches': not_html_matches_default, + 'object-is-loaded-matches': object_is_loaded_matches_default, + 'only-dlitems-evaluate': only_dlitems_evaluate_default, + 'only-listitems-evaluate': only_listitems_evaluate_default, + 'p-as-heading-evaluate': p_as_heading_evaluate_default, 'p-as-heading-matches': p_as_heading_matches_default, + 'page-no-duplicate-after': page_no_duplicate_after_default, + 'page-no-duplicate-evaluate': page_no_duplicate_evaluate_default, + 'presentation-role-conflict-matches': presentation_role_conflict_matches_default, + 'presentational-role-evaluate': presentationalRoleEvaluate, + 'region-after': region_after_default, + 'region-evaluate': regionEvaluate, + 'same-caption-summary-evaluate': same_caption_summary_evaluate_default, + 'scope-value-evaluate': scope_value_evaluate_default, 'scrollable-region-focusable-matches': scrollable_region_focusable_matches_default, + 'skip-link-evaluate': skip_link_evaluate_default, 'skip-link-matches': skip_link_matches_default, + 'structured-dlitems-evaluate': structured_dlitems_evaluate_default, 'svg-namespace-matches': svg_namespace_matches_default, + 'svg-non-empty-title-evaluate': svg_non_empty_title_evaluate_default, + 'tabindex-evaluate': tabindex_evaluate_default, + 'table-or-grid-role-matches': tableOrGridRoleMatches, + 'target-offset-evaluate': targetOffsetEvaluate, + 'target-size-evaluate': targetSize, + 'td-has-header-evaluate': td_has_header_evaluate_default, + 'td-headers-attr-evaluate': td_headers_attr_evaluate_default, + 'th-has-data-cells-evaluate': th_has_data_cells_evaluate_default, + 'title-only-evaluate': title_only_evaluate_default, + 'unique-frame-title-after': unique_frame_title_after_default, + 'unique-frame-title-evaluate': unique_frame_title_evaluate_default, + 'unsupportedrole-evaluate': unsupportedrole_evaluate_default, + 'valid-lang-evaluate': valid_lang_evaluate_default, + 'valid-scrollable-semantics-evaluate': valid_scrollable_semantics_evaluate_default, + 'widget-not-inline-matches': widgetNotInline, 'window-is-top-matches': window_is_top_matches_default, + 'xml-lang-mismatch-evaluate': xml_lang_mismatch_evaluate_default, 'xml-lang-mismatch-matches': xml_lang_mismatch_matches_default }; var metadata_function_map_default = metadataFunctionMap; - function CheckResult(check4) { - this.id = check4.id; + function CheckResult(check) { + this.id = check.id; this.data = null; this.relatedNodes = []; this.result = null; @@ -20021,7 +21813,7 @@ } } Check.prototype.enabled = true; - Check.prototype.run = function run(node, options, context5, resolve, reject) { + Check.prototype.run = function run(node, options, context, resolve, reject) { options = options || {}; var enabled = options.hasOwnProperty('enabled') ? options.enabled : this.enabled; var checkOptions = this.getOptions(options.options); @@ -20030,7 +21822,7 @@ var helper = check_helper_default(checkResult, options, resolve, reject); var result; try { - result = this.evaluate.call(helper, node.actualNode, checkOptions, node, context5); + result = this.evaluate.call(helper, node.actualNode, checkOptions, node, context); } catch (e) { if (node && node.actualNode) { e.errorNode = new dq_element_default(node).toJSON(); @@ -20046,7 +21838,7 @@ resolve(null); } }; - Check.prototype.runSync = function runSync(node, options, context5) { + Check.prototype.runSync = function runSync(node, options, context) { options = options || {}; var _options = options, _options$enabled = _options.enabled, enabled = _options$enabled === void 0 ? this.enabled : _options$enabled; if (!enabled) { @@ -20060,7 +21852,7 @@ }; var result; try { - result = this.evaluate.call(helper, node.actualNode, checkOptions, node, context5); + result = this.evaluate.call(helper, node.actualNode, checkOptions, node, context); } catch (e) { if (node && node.actualNode) { e.errorNode = new dq_element_default(node).toJSON(); @@ -20070,8 +21862,8 @@ checkResult.result = result; return checkResult; }; - Check.prototype.configure = function configure(spec) { - var _this4 = this; + Check.prototype.configure = function configure2(spec) { + var _this5 = this; if (!spec.evaluate || metadata_function_map_default[spec.evaluate]) { this._internalCheck = true; } @@ -20088,7 +21880,7 @@ [ 'evaluate', 'after' ].filter(function(prop) { return spec.hasOwnProperty(prop); }).forEach(function(prop) { - return _this4[prop] = createExecutionContext(spec[prop]); + return _this5[prop] = createExecutionContext(spec[prop]); }); }; Check.prototype.getOptions = function getOptions(options) { @@ -20099,10 +21891,10 @@ } }; var check_default = Check; - function RuleResult(rule3) { - this.id = rule3.id; + function RuleResult(rule) { + this.id = rule.id; this.result = constants_default.NA; - this.pageLevel = rule3.pageLevel; + this.pageLevel = rule.pageLevel; this.impact = null; this.nodes = []; } @@ -20124,33 +21916,34 @@ this.none = spec.none || []; this.tags = spec.tags || []; this.preload = spec.preload ? true : false; + this.actIds = spec.actIds; if (spec.matches) { this.matches = createExecutionContext(spec.matches); } } - Rule.prototype.matches = function matches13() { + Rule.prototype.matches = function matches3() { return true; }; - Rule.prototype.gather = function gather(context5) { + Rule.prototype.gather = function gather(context) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var markStart = 'mark_gather_start_' + this.id; var markEnd = 'mark_gather_end_' + this.id; - var markHiddenStart = 'mark_isHidden_start_' + this.id; - var markHiddenEnd = 'mark_isHidden_end_' + this.id; + var markHiddenStart = 'mark_isVisibleToScreenReaders_start_' + this.id; + var markHiddenEnd = 'mark_isVisibleToScreenReaders_end_' + this.id; if (options.performanceTimer) { performance_timer_default.mark(markStart); } - var elements = select_default(this.selector, context5); + var elements = _select(this.selector, context); if (this.excludeHidden) { if (options.performanceTimer) { performance_timer_default.mark(markHiddenStart); } elements = elements.filter(function(element) { - return !is_hidden_default(element.actualNode); + return _isVisibleToScreenReaders(element); }); if (options.performanceTimer) { performance_timer_default.mark(markHiddenEnd); - performance_timer_default.measure('rule_' + this.id + '#gather_axe.utils.isHidden', markHiddenStart, markHiddenEnd); + performance_timer_default.measure('rule_' + this.id + '#gather_axe.utils.isVisibleToScreenReaders', markHiddenStart, markHiddenEnd); } } if (options.performanceTimer) { @@ -20159,19 +21952,19 @@ } return elements; }; - Rule.prototype.runChecks = function runChecks(type, node, options, context5, resolve, reject) { + Rule.prototype.runChecks = function runChecks(type, node, options, context, resolve, reject) { var self2 = this; var checkQueue = queue_default(); this[type].forEach(function(c) { - var check4 = self2._audit.checks[c.id || c]; - var option = get_check_option_default(check4, self2.id, options); + var check = self2._audit.checks[c.id || c]; + var option = get_check_option_default(check, self2.id, options); checkQueue.defer(function(res, rej) { - check4.run(node, option, context5, res, rej); + check.run(node, option, context, res, rej); }); }); checkQueue.then(function(results) { - results = results.filter(function(check4) { - return check4; + results = results.filter(function(check) { + return check; }); resolve({ type: type, @@ -20179,24 +21972,24 @@ }); })['catch'](reject); }; - Rule.prototype.runChecksSync = function runChecksSync(type, node, options, context5) { + Rule.prototype.runChecksSync = function runChecksSync(type, node, options, context) { var self2 = this; var results = []; this[type].forEach(function(c) { - var check4 = self2._audit.checks[c.id || c]; - var option = get_check_option_default(check4, self2.id, options); - results.push(check4.runSync(node, option, context5)); + var check = self2._audit.checks[c.id || c]; + var option = get_check_option_default(check, self2.id, options); + results.push(check.runSync(node, option, context)); }); - results = results.filter(function(check4) { - return check4; + results = results.filter(function(check) { + return check; }); return { type: type, results: results }; }; - Rule.prototype.run = function run2(context5) { - var _this5 = this; + Rule.prototype.run = function run2(context) { + var _this6 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var resolve = arguments.length > 2 ? arguments[2] : undefined; var reject = arguments.length > 3 ? arguments[3] : undefined; @@ -20207,7 +22000,7 @@ var ruleResult = new rule_result_default(this); var nodes; try { - nodes = this.gatherAndMatchNodes(context5, options); + nodes = this.gatherAndMatchNodes(context, options); } catch (error) { reject(new SupportError({ cause: error, @@ -20223,7 +22016,7 @@ var checkQueue = queue_default(); [ 'any', 'all', 'none' ].forEach(function(type) { checkQueue.defer(function(res, rej) { - _this5.runChecks(type, node, options, context5, res, rej); + _this6.runChecks(type, node, options, context, res, rej); }); }); checkQueue.then(function(results) { @@ -20231,7 +22024,7 @@ if (result) { result.node = new dq_element_default(node, options); ruleResult.nodes.push(result); - if (_this5.reviewOnFail) { + if (_this6.reviewOnFail) { [ 'any', 'all' ].forEach(function(type) { result[type].forEach(function(checkResult) { if (checkResult.result === false) { @@ -20264,8 +22057,8 @@ return reject(error); }); }; - Rule.prototype.runSync = function runSync2(context5) { - var _this6 = this; + Rule.prototype.runSync = function runSync2(context) { + var _this7 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (options.performanceTimer) { this._trackPerformance(); @@ -20273,7 +22066,7 @@ var ruleResult = new rule_result_default(this); var nodes; try { - nodes = this.gatherAndMatchNodes(context5, options); + nodes = this.gatherAndMatchNodes(context, options); } catch (error) { throw new SupportError({ cause: error, @@ -20286,13 +22079,13 @@ nodes.forEach(function(node) { var results = []; [ 'any', 'all', 'none' ].forEach(function(type) { - results.push(_this6.runChecksSync(type, node, options, context5)); + results.push(_this7.runChecksSync(type, node, options, context)); }); var result = getResult(results); if (result) { result.node = node.actualNode ? new dq_element_default(node, options) : null; ruleResult.nodes.push(result); - if (_this6.reviewOnFail) { + if (_this7.reviewOnFail) { [ 'any', 'all' ].forEach(function(type) { result[type].forEach(function(checkResult) { if (checkResult.result === false) { @@ -20348,16 +22141,16 @@ return null; } } - Rule.prototype.gatherAndMatchNodes = function gatherAndMatchNodes(context5, options) { - var _this7 = this; + Rule.prototype.gatherAndMatchNodes = function gatherAndMatchNodes(context, options) { + var _this8 = this; var markMatchesStart = 'mark_matches_start_' + this.id; var markMatchesEnd = 'mark_matches_end_' + this.id; - var nodes = this.gather(context5, options); + var nodes = this.gather(context, options); if (options.performanceTimer) { performance_timer_default.mark(markMatchesStart); } nodes = nodes.filter(function(node) { - return _this7.matches(node.actualNode, node, context5); + return _this8.matches(node.actualNode, node, context); }); if (options.performanceTimer) { performance_timer_default.mark(markMatchesEnd); @@ -20365,10 +22158,10 @@ } return nodes; }; - function findAfterChecks(rule3) { - return get_all_checks_default(rule3).map(function(c) { - var check4 = rule3._audit.checks[c.id || c]; - return check4 && typeof check4.after === 'function' ? check4 : null; + function findAfterChecks(rule) { + return get_all_checks_default(rule).map(function(c) { + var check = rule._audit.checks[c.id || c]; + return check && typeof check.after === 'function' ? check : null; }).filter(Boolean); } function findCheckResults(nodes, checkID) { @@ -20385,8 +22178,8 @@ return checkResults; } function filterChecks(checks) { - return checks.filter(function(check4) { - return check4.filtered !== true; + return checks.filter(function(check) { + return check.filtered !== true; }); } function sanitizeNodes(result) { @@ -20412,12 +22205,22 @@ return nodes; } Rule.prototype.after = function after(result, options) { + var _this9 = this; var afterChecks = findAfterChecks(this); var ruleID = this.id; - afterChecks.forEach(function(check4) { - var beforeResults = findCheckResults(result.nodes, check4.id); - var option = get_check_option_default(check4, ruleID, options); - var afterResults = check4.after(beforeResults, option); + afterChecks.forEach(function(check) { + var beforeResults = findCheckResults(result.nodes, check.id); + var option = get_check_option_default(check, ruleID, options); + var afterResults = check.after(beforeResults, option); + if (_this9.reviewOnFail) { + afterResults.forEach(function(checkResult) { + var changeAnyAllResults = (_this9.any.includes(checkResult.id) || _this9.all.includes(checkResult.id)) && checkResult.result === false; + var changeNoneResult = _this9.none.includes(checkResult.id) && checkResult.result === true; + if (changeAnyAllResults || changeNoneResult) { + checkResult.result = void 0; + } + }); + } beforeResults.forEach(function(item) { delete item.node; if (afterResults.indexOf(item) === -1) { @@ -20428,7 +22231,7 @@ result.nodes = sanitizeNodes(result); return result; }; - Rule.prototype.configure = function configure2(spec) { + Rule.prototype.configure = function configure3(spec) { if (spec.hasOwnProperty('selector')) { this.selector = spec.selector; } @@ -20456,6 +22259,9 @@ if (spec.hasOwnProperty('tags')) { this.tags = spec.tags; } + if (spec.hasOwnProperty('actIds')) { + this.actIds = spec.actIds; + } if (spec.hasOwnProperty('matches')) { this.matches = createExecutionContext(spec.matches); } @@ -20465,7 +22271,7 @@ } }; var rule_default = Rule; - var dot = __toModule(require_doT()); + var import_dot2 = __toModule(require_doT()); var dotRegex = /\{\{.+?\}\}/g; function getDefaultOrigin() { if (window.origin) { @@ -20475,11 +22281,11 @@ return window.location.origin; } } - function getDefaultConfiguration(audit3) { + function getDefaultConfiguration(audit) { var config; - if (audit3) { - config = clone_default(audit3); - config.commons = audit3.commons; + if (audit) { + config = clone_default(audit); + config.commons = audit.commons; } else { config = {}; } @@ -20497,19 +22303,19 @@ }, config.data); return config; } - function unpackToObject(collection, audit3, method) { + function unpackToObject(collection, audit, method) { var i, l; for (i = 0, l = collection.length; i < l; i++) { - audit3[method](collection[i]); + audit[method](collection[i]); } } var mergeCheckLocale = function mergeCheckLocale(a, b) { var pass = b.pass, fail = b.fail; if (typeof pass === 'string' && dotRegex.test(pass)) { - pass = dot['default'].compile(pass); + pass = import_dot2['default'].compile(pass); } if (typeof fail === 'string' && dotRegex.test(fail)) { - fail = dot['default'].compile(fail); + fail = import_dot2['default'].compile(fail); } return _extends({}, a, { messages: { @@ -20522,10 +22328,10 @@ var mergeRuleLocale = function mergeRuleLocale(a, b) { var help = b.help, description = b.description; if (typeof help === 'string' && dotRegex.test(help)) { - help = dot['default'].compile(help); + help = import_dot2['default'].compile(help); } if (typeof description === 'string' && dotRegex.test(description)) { - description = dot['default'].compile(description); + description = import_dot2['default'].compile(description); } return _extends({}, a, { help: help || a.help, @@ -20535,7 +22341,7 @@ var mergeFailureMessage = function mergeFailureMessage(a, b) { var failureMessage = b.failureMessage; if (typeof failureMessage === 'string' && dotRegex.test(failureMessage)) { - failureMessage = dot['default'].compile(failureMessage); + failureMessage = import_dot2['default'].compile(failureMessage); } return _extends({}, a, { failureMessage: failureMessage || a.failureMessage @@ -20543,15 +22349,15 @@ }; var mergeFallbackMessage = function mergeFallbackMessage(a, b) { if (typeof b === 'string' && dotRegex.test(b)) { - b = dot['default'].compile(b); + b = import_dot2['default'].compile(b); } return b || a; }; var Audit = function() { - function Audit(audit3) { + function Audit(audit) { _classCallCheck(this, Audit); this.lang = 'en'; - this.defaultConfig = audit3; + this.defaultConfig = audit; this.standards = standards_default; this._init(); this._defaultLocale = null; @@ -20570,10 +22376,10 @@ lang: this.lang }; var checkIDs = Object.keys(this.data.checks); - for (var _i24 = 0; _i24 < checkIDs.length; _i24++) { - var id = checkIDs[_i24]; - var check4 = this.data.checks[id]; - var _check4$messages = check4.messages, pass = _check4$messages.pass, fail = _check4$messages.fail, incomplete = _check4$messages.incomplete; + for (var _i27 = 0; _i27 < checkIDs.length; _i27++) { + var id = checkIDs[_i27]; + var check = this.data.checks[id]; + var _check$messages = check.messages, pass = _check$messages.pass, fail = _check$messages.fail, incomplete = _check$messages.incomplete; locale.checks[id] = { pass: pass, fail: fail, @@ -20581,18 +22387,18 @@ }; } var ruleIDs = Object.keys(this.data.rules); - for (var _i25 = 0; _i25 < ruleIDs.length; _i25++) { - var _id = ruleIDs[_i25]; - var rule3 = this.data.rules[_id]; - var description = rule3.description, help = rule3.help; + for (var _i28 = 0; _i28 < ruleIDs.length; _i28++) { + var _id = ruleIDs[_i28]; + var rule = this.data.rules[_id]; + var description = rule.description, help = rule.help; locale.rules[_id] = { description: description, help: help }; } var failureSummaries = Object.keys(this.data.failureSummaries); - for (var _i26 = 0; _i26 < failureSummaries.length; _i26++) { - var type = failureSummaries[_i26]; + for (var _i29 = 0; _i29 < failureSummaries.length; _i29++) { + var type = failureSummaries[_i29]; var failureSummary2 = this.data.failureSummaries[type]; var failureMessage = failureSummary2.failureMessage; locale.failureSummaries[type] = { @@ -20615,8 +22421,8 @@ key: '_applyCheckLocale', value: function _applyCheckLocale(checks) { var keys = Object.keys(checks); - for (var _i27 = 0; _i27 < keys.length; _i27++) { - var id = keys[_i27]; + for (var _i30 = 0; _i30 < keys.length; _i30++) { + var id = keys[_i30]; if (!this.data.checks[id]) { throw new Error('Locale provided for unknown check: "'.concat(id, '"')); } @@ -20627,8 +22433,8 @@ key: '_applyRuleLocale', value: function _applyRuleLocale(rules) { var keys = Object.keys(rules); - for (var _i28 = 0; _i28 < keys.length; _i28++) { - var id = keys[_i28]; + for (var _i31 = 0; _i31 < keys.length; _i31++) { + var id = keys[_i31]; if (!this.data.rules[id]) { throw new Error('Locale provided for unknown rule: "'.concat(id, '"')); } @@ -20639,8 +22445,8 @@ key: '_applyFailureSummaries', value: function _applyFailureSummaries(messages) { var keys = Object.keys(messages); - for (var _i29 = 0; _i29 < keys.length; _i29++) { - var key = keys[_i29]; + for (var _i32 = 0; _i32 < keys.length; _i32++) { + var key = keys[_i32]; if (!this.data.failureSummaries[key]) { throw new Error('Locale provided for unknown failureMessage: "'.concat(key, '"')); } @@ -20672,10 +22478,10 @@ value: function setAllowedOrigins(allowedOrigins) { var defaultOrigin = getDefaultOrigin(); this.allowedOrigins = []; - var _iterator3 = _createForOfIteratorHelper(allowedOrigins), _step3; + var _iterator11 = _createForOfIteratorHelper(allowedOrigins), _step11; try { - for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) { - var origin = _step3.value; + for (_iterator11.s(); !(_step11 = _iterator11.n()).done; ) { + var origin = _step11.value; if (origin === constants_default.allOrigins) { this.allowedOrigins = [ '*' ]; return; @@ -20686,32 +22492,32 @@ } } } catch (err) { - _iterator3.e(err); + _iterator11.e(err); } finally { - _iterator3.f(); + _iterator11.f(); } } }, { key: '_init', value: function _init() { - var audit3 = getDefaultConfiguration(this.defaultConfig); - this.lang = audit3.lang || 'en'; - this.reporter = audit3.reporter; + var audit = getDefaultConfiguration(this.defaultConfig); + this.lang = audit.lang || 'en'; + this.reporter = audit.reporter; this.commands = {}; this.rules = []; this.checks = {}; this.brand = 'axe'; this.application = 'axeAPI'; this.tagExclude = [ 'experimental' ]; - this.noHtml = audit3.noHtml; - this.allowedOrigins = audit3.allowedOrigins; - unpackToObject(audit3.rules, this, 'addRule'); - unpackToObject(audit3.checks, this, 'addCheck'); + this.noHtml = audit.noHtml; + this.allowedOrigins = audit.allowedOrigins; + unpackToObject(audit.rules, this, 'addRule'); + unpackToObject(audit.checks, this, 'addCheck'); this.data = {}; - this.data.checks = audit3.data && audit3.data.checks || {}; - this.data.rules = audit3.data && audit3.data.rules || {}; - this.data.failureSummaries = audit3.data && audit3.data.failureSummaries || {}; - this.data.incompleteFallbackMessage = audit3.data && audit3.data.incompleteFallbackMessage || ''; + this.data.checks = audit.data && audit.data.checks || {}; + this.data.rules = audit.data && audit.data.rules || {}; + this.data.failureSummaries = audit.data && audit.data.failureSummaries || {}; + this.data.incompleteFallbackMessage = audit.data && audit.data.incompleteFallbackMessage || ''; this._constructHelpUrls(); } }, { @@ -20725,9 +22531,9 @@ if (spec.metadata) { this.data.rules[spec.id] = spec.metadata; } - var rule3 = this.getRule(spec.id); - if (rule3) { - rule3.configure(spec); + var rule = this.getRule(spec.id); + if (rule) { + rule.configure(spec); } else { this.rules.push(new rule_default(spec, this)); } @@ -20756,15 +22562,15 @@ } }, { key: 'run', - value: function run(context5, options, resolve, reject) { + value: function run(context, options, resolve, reject) { this.normalizeOptions(options); axe._selectCache = []; - var allRulesToRun = getRulesToRun(this.rules, context5, options); + var allRulesToRun = getRulesToRun(this.rules, context, options); var runNowRules = allRulesToRun.now; var runLaterRules = allRulesToRun.later; var nowRulesQueue = queue_default(); - runNowRules.forEach(function(rule3) { - nowRulesQueue.defer(getDefferedRule(rule3, context5, options)); + runNowRules.forEach(function(rule) { + nowRulesQueue.defer(getDefferedRule(rule, context, options)); }); var preloaderQueue = queue_default(); if (runLaterRules.length) { @@ -20785,7 +22591,7 @@ if (assetsFromQueue && assetsFromQueue.length) { var assets = assetsFromQueue[0]; if (assets) { - context5 = _extends({}, context5, assets); + context = _extends({}, context, assets); } } var nowRulesResults = nowRulesAndPreloaderResults[0]; @@ -20797,8 +22603,8 @@ return; } var laterRulesQueue = queue_default(); - runLaterRules.forEach(function(rule3) { - var deferredRule = getDefferedRule(rule3, context5, options); + runLaterRules.forEach(function(rule) { + var deferredRule = getDefferedRule(rule, context, options); laterRulesQueue.defer(deferredRule); }); laterRulesQueue.then(function(laterRuleResults) { @@ -20814,29 +22620,29 @@ value: function after(results, options) { var rules = this.rules; return results.map(function(ruleResult) { - var rule3 = find_by_default(rules, 'id', ruleResult.id); - if (!rule3) { + var rule = find_by_default(rules, 'id', ruleResult.id); + if (!rule) { throw new Error('Result for unknown rule. You may be running mismatch axe-core versions'); } - return rule3.after(ruleResult, options); + return rule.after(ruleResult, options); }); } }, { key: 'getRule', value: function getRule(ruleId) { - return this.rules.find(function(rule3) { - return rule3.id === ruleId; + return this.rules.find(function(rule) { + return rule.id === ruleId; }); } }, { key: 'normalizeOptions', value: function normalizeOptions(options) { - var audit3 = this; + var audit = this; var tags = []; var ruleIds = []; - audit3.rules.forEach(function(rule3) { - ruleIds.push(rule3.id); - rule3.tags.forEach(function(tag) { + audit.rules.forEach(function(rule) { + ruleIds.push(rule.id); + rule.tags.forEach(function(tag) { if (!tags.includes(tag)) { tags.push(tag); } @@ -20925,16 +22731,16 @@ }, { key: '_constructHelpUrls', value: function _constructHelpUrls() { - var _this8 = this; + var _this10 = this; var previous = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var version = (axe.version.match(/^[1-9][0-9]*\.[0-9]+/) || [ 'x.y' ])[0]; - this.rules.forEach(function(rule3) { - if (!_this8.data.rules[rule3.id]) { - _this8.data.rules[rule3.id] = {}; + this.rules.forEach(function(rule) { + if (!_this10.data.rules[rule.id]) { + _this10.data.rules[rule.id] = {}; } - var metaData = _this8.data.rules[rule3.id]; - if (typeof metaData.helpUrl !== 'string' || previous && metaData.helpUrl === getHelpUrl(previous, rule3.id, version)) { - metaData.helpUrl = getHelpUrl(_this8, rule3.id, version); + var metaData = _this10.data.rules[rule.id]; + if (typeof metaData.helpUrl !== 'string' || previous && metaData.helpUrl === getHelpUrl(previous, rule.id, version)) { + metaData.helpUrl = getHelpUrl(_this10, rule.id, version); } }); } @@ -20944,271 +22750,68 @@ this._init(); this._resetLocale(); } - } ]); - return Audit; - }(); - function getRulesToRun(rules, context5, options) { - var base = { - now: [], - later: [] - }; - var splitRules = rules.reduce(function(out, rule3) { - if (!rule_should_run_default(rule3, context5, options)) { - return out; - } - if (rule3.preload) { - out.later.push(rule3); - return out; - } - out.now.push(rule3); - return out; - }, base); - return splitRules; - } - function getDefferedRule(rule3, context5, options) { - if (options.performanceTimer) { - performance_timer_default.mark('mark_rule_start_' + rule3.id); - } - return function(resolve, reject) { - rule3.run(context5, options, function(ruleResult) { - resolve(ruleResult); - }, function(err2) { - if (!options.debug) { - var errResult = Object.assign(new rule_result_default(rule3), { - result: constants_default.CANTTELL, - description: 'An error occured while running this rule', - message: err2.message, - stack: err2.stack, - error: err2, - errorNode: err2.errorNode - }); - resolve(errResult); - } else { - reject(err2); - } - }); - }; - } - function getHelpUrl(_ref86, ruleId, version) { - var brand = _ref86.brand, application = _ref86.application, lang = _ref86.lang; - return constants_default.helpUrlBase + brand + '/' + (version || axe.version.substring(0, axe.version.lastIndexOf('.'))) + '/' + ruleId + '?application=' + encodeURIComponent(application) + (lang && lang !== 'en' ? '&lang=' + encodeURIComponent(lang) : ''); - } - var audit_default = Audit; - var imports_exports = {}; - __export(imports_exports, { - CssSelectorParser: function CssSelectorParser() { - return css_selector_parser2.CssSelectorParser; - }, - doT: function doT() { - return dot2['default']; - }, - emojiRegexText: function emojiRegexText() { - return emoji_regex3['default']; - }, - memoize: function memoize() { - return memoizee2['default']; - } - }); - var css_selector_parser2 = __toModule(require_lib()); - var dot2 = __toModule(require_doT()); - var emoji_regex3 = __toModule(require_emoji_regex()); - var memoizee2 = __toModule(require_memoizee()); - var es6_promise = __toModule(require_es6_promise()); - var typedarray = __toModule(require_typedarray()); - var weakmap_polyfill = __toModule(require_weakmap_polyfill()); - dot2['default'].templateSettings.strip = false; - if (!('Promise' in window)) { - es6_promise['default'].polyfill(); - } - if (!('Uint32Array' in window)) { - window.Uint32Array = typedarray.Uint32Array; - } - if (window.Uint32Array) { - if (!('some' in window.Uint32Array.prototype)) { - Object.defineProperty(window.Uint32Array.prototype, 'some', { - value: Array.prototype.some - }); - } - if (!('reduce' in window.Uint32Array.prototype)) { - Object.defineProperty(window.Uint32Array.prototype, 'reduce', { - value: Array.prototype.reduce - }); - } - } - function cleanup(resolve, reject) { - resolve = resolve || function res() {}; - reject = reject || axe.log; - if (!axe._audit) { - throw new Error('No audit configured'); - } - var q = axe.utils.queue(); - var cleanupErrors = []; - Object.keys(axe.plugins).forEach(function(key) { - q.defer(function(res) { - var rej = function rej2(err2) { - cleanupErrors.push(err2); - res(); - }; - try { - axe.plugins[key].cleanup(res, rej); - } catch (err2) { - rej(err2); - } - }); - }); - var flattenedTree = axe.utils.getFlattenedTree(document.body); - axe.utils.querySelectorAll(flattenedTree, 'iframe, frame').forEach(function(node) { - q.defer(function(res, rej) { - return axe.utils.sendCommandToFrame(node.actualNode, { - command: 'cleanup-plugin' - }, res, rej); - }); - }); - q.then(function(results) { - if (cleanupErrors.length === 0) { - resolve(results); - } else { - reject(cleanupErrors); - } - })['catch'](reject); - } - var cleanup_default = cleanup; - var reporters = {}; - var defaultReporter; - function hasReporter(reporterName) { - return reporters.hasOwnProperty(reporterName); - } - function getReporter(reporter5) { - if (typeof reporter5 === 'string' && reporters[reporter5]) { - return reporters[reporter5]; - } - if (typeof reporter5 === 'function') { - return reporter5; - } - return defaultReporter; - } - function addReporter(name, cb, isDefault) { - reporters[name] = cb; - if (isDefault) { - defaultReporter = cb; - } - } - function configure3(spec) { - var audit3; - audit3 = axe._audit; - if (!audit3) { - throw new Error('No audit configured'); - } - if (spec.axeVersion || spec.ver) { - var specVersion = spec.axeVersion || spec.ver; - if (!/^\d+\.\d+\.\d+(-canary)?/.test(specVersion)) { - throw new Error('Invalid configured version '.concat(specVersion)); - } - var _specVersion$split = specVersion.split('-'), _specVersion$split2 = _slicedToArray(_specVersion$split, 2), version = _specVersion$split2[0], canary = _specVersion$split2[1]; - var _version$split$map = version.split('.').map(Number), _version$split$map2 = _slicedToArray(_version$split$map, 3), major = _version$split$map2[0], minor = _version$split$map2[1], patch = _version$split$map2[2]; - var _axe$version$split = axe.version.split('-'), _axe$version$split2 = _slicedToArray(_axe$version$split, 2), axeVersion = _axe$version$split2[0], axeCanary = _axe$version$split2[1]; - var _axeVersion$split$map = axeVersion.split('.').map(Number), _axeVersion$split$map2 = _slicedToArray(_axeVersion$split$map, 3), axeMajor = _axeVersion$split$map2[0], axeMinor = _axeVersion$split$map2[1], axePatch = _axeVersion$split$map2[2]; - if (major !== axeMajor || axeMinor < minor || axeMinor === minor && axePatch < patch || major === axeMajor && minor === axeMinor && patch === axePatch && canary && canary !== axeCanary) { - throw new Error('Configured version '.concat(specVersion, ' is not compatible with current axe version ').concat(axe.version)); - } - } - if (spec.reporter && (typeof spec.reporter === 'function' || hasReporter(spec.reporter))) { - audit3.reporter = spec.reporter; - } - if (spec.checks) { - if (!Array.isArray(spec.checks)) { - throw new TypeError('Checks property must be an array'); - } - spec.checks.forEach(function(check4) { - if (!check4.id) { - throw new TypeError('Configured check '.concat(JSON.stringify(check4), ' is invalid. Checks must be an object with at least an id property')); - } - audit3.addCheck(check4); - }); - } - var modifiedRules = []; - if (spec.rules) { - if (!Array.isArray(spec.rules)) { - throw new TypeError('Rules property must be an array'); + } ]); + return Audit; + }(); + function getRulesToRun(rules, context, options) { + var base = { + now: [], + later: [] + }; + var splitRules = rules.reduce(function(out, rule) { + if (!rule_should_run_default(rule, context, options)) { + return out; } - spec.rules.forEach(function(rule3) { - if (!rule3.id) { - throw new TypeError('Configured rule '.concat(JSON.stringify(rule3), ' is invalid. Rules must be an object with at least an id property')); - } - modifiedRules.push(rule3.id); - audit3.addRule(rule3); - }); + if (rule.preload) { + out.later.push(rule); + return out; + } + out.now.push(rule); + return out; + }, base); + return splitRules; + } + function getDefferedRule(rule, context, options) { + if (options.performanceTimer) { + performance_timer_default.mark('mark_rule_start_' + rule.id); } - if (spec.disableOtherRules) { - audit3.rules.forEach(function(rule3) { - if (modifiedRules.includes(rule3.id) === false) { - rule3.enabled = false; + return function(resolve, reject) { + rule.run(context, options, function(ruleResult) { + resolve(ruleResult); + }, function(err2) { + if (!options.debug) { + var errResult = Object.assign(new rule_result_default(rule), { + result: constants_default.CANTTELL, + description: 'An error occured while running this rule', + message: err2.message, + stack: err2.stack, + error: err2, + errorNode: err2.errorNode + }); + resolve(errResult); + } else { + reject(err2); } }); - } - if (typeof spec.branding !== 'undefined') { - audit3.setBranding(spec.branding); - } else { - audit3._constructHelpUrls(); - } - if (spec.tagExclude) { - audit3.tagExclude = spec.tagExclude; - } - if (spec.locale) { - audit3.applyLocale(spec.locale); - } - if (spec.standards) { - configureStandards(spec.standards); - } - if (spec.noHtml) { - audit3.noHtml = true; - } - if (spec.allowedOrigins) { - if (!Array.isArray(spec.allowedOrigins)) { - throw new TypeError('Allowed origins property must be an array'); - } - if (spec.allowedOrigins.includes('*')) { - throw new Error('"*" is not allowed. Use "'.concat(constants_default.allOrigins, '" instead')); - } - audit3.setAllowedOrigins(spec.allowedOrigins); - } - } - var configure_default = configure3; - function frameMessenger2(frameHandler) { - _respondable.updateMessenger(frameHandler); + }; } - function getRules(tags) { - tags = tags || []; - var matchingRules = !tags.length ? axe._audit.rules : axe._audit.rules.filter(function(item) { - return !!tags.filter(function(tag) { - return item.tags.indexOf(tag) !== -1; - }).length; - }); - var ruleData = axe._audit.data.rules || {}; - return matchingRules.map(function(matchingRule) { - var rd = ruleData[matchingRule.id] || {}; - return { - ruleId: matchingRule.id, - description: rd.description, - help: rd.help, - helpUrl: rd.helpUrl, - tags: matchingRule.tags - }; - }); + function getHelpUrl(_ref110, ruleId, version) { + var brand = _ref110.brand, application = _ref110.application, lang = _ref110.lang; + return constants_default.helpUrlBase + brand + '/' + (version || axe.version.substring(0, axe.version.lastIndexOf('.'))) + '/' + ruleId + '?application=' + encodeURIComponent(application) + (lang && lang !== 'en' ? '&lang=' + encodeURIComponent(lang) : ''); } - var get_rules_default = getRules; - function setupGlobals(context5) { + var audit_default = Audit; + function setupGlobals(context) { var hasWindow = window && 'Node' in window && 'NodeList' in window; var hasDoc = !!document; if (hasWindow && hasDoc) { return; } - if (!context5 || !context5.ownerDocument) { + if (!context || !context.ownerDocument) { throw new Error('Required "window" or "document" globals not defined and cannot be deduced from the context. Either set the globals before running or pass in a valid Element.'); } if (!hasDoc) { cache_default.set('globalDocumentSet', true); - document = context5.ownerDocument; + document = context.ownerDocument; } if (!hasWindow) { cache_default.set('globalWindowSet', true); @@ -21236,27 +22839,27 @@ axe._selectCache = void 0; } var teardown_default = teardown; - function runRules(context5, options, resolve, reject) { + function runRules(context, options, resolve, reject) { try { - context5 = new Context(context5); - axe._tree = context5.flatTree; - axe._selectorData = _getSelectorData(context5.flatTree); + context = new Context(context); + axe._tree = context.flatTree; + axe._selectorData = _getSelectorData(context.flatTree); } catch (e) { teardown_default(); return reject(e); } var q = queue_default(); - var audit3 = axe._audit; + var audit = axe._audit; if (options.performanceTimer) { performance_timer_default.auditStart(); } - if (context5.frames.length && options.iframes !== false) { + if (context.frames.length && options.iframes !== false) { q.defer(function(res, rej) { - _collectResultsFromFrames(context5, options, 'rules', null, res, rej); + _collectResultsFromFrames(context, options, 'rules', null, res, rej); }); } q.defer(function(res, rej) { - audit3.run(context5, options, res, rej); + audit.run(context, options, res, rej); }); q.then(function(data2) { try { @@ -21268,8 +22871,8 @@ results: results2 }; })); - if (context5.initiator) { - results = audit3.after(results, options); + if (context.initiator) { + results = audit.after(results, options); results.forEach(publish_metadata_default); results = results.map(finalize_result_default); } @@ -21297,16 +22900,16 @@ } callback(err2); }; - var context5 = data2 && data2.context || {}; - if (context5.hasOwnProperty('include') && !context5.include.length) { - context5.include = [ document ]; + var context = data2 && data2.context || {}; + if (context.hasOwnProperty('include') && !context.include.length) { + context.include = [ document ]; } var options = data2 && data2.options || {}; switch (data2.command) { case 'rules': - return run_rules_default(context5, options, function(results, cleanup5) { + return run_rules_default(context, options, function(results, cleanup3) { resolve(results); - cleanup5(); + cleanup3(); }, reject); case 'cleanup-plugin': @@ -21326,8 +22929,8 @@ }); }); } - function load(audit3) { - axe._audit = new audit_default(audit3); + function load(audit) { + axe._audit = new audit_default(audit); } var load_default = load; function Plugin(spec) { @@ -21344,7 +22947,7 @@ Plugin.prototype.collect = function collect() { return this._collect.apply(this, arguments); }; - Plugin.prototype.cleanup = function cleanup3(done) { + Plugin.prototype.cleanup = function cleanup2(done) { var q = axe.utils.queue(); var that = this; Object.keys(this._registry).forEach(function(key) { @@ -21362,11 +22965,11 @@ } var plugins_default = registerPlugin; function reset() { - var audit3 = axe._audit; - if (!audit3) { + var audit = axe._audit; + if (!audit) { throw new Error('No audit configured'); } - audit3.resetRulesAndChecks(); + audit.resetRulesAndChecks(); resetStandards(); } var reset_default = reset; @@ -21377,20 +22980,26 @@ if (!(vNode instanceof abstract_virtual_node_default)) { vNode = new serial_virtual_node_default(vNode); } - var rule3 = get_rule_default(ruleId); - if (!rule3) { + var rule = get_rule_default(ruleId); + if (!rule) { throw new Error('unknown rule `' + ruleId + '`'); } - rule3 = Object.create(rule3, { + rule = Object.create(rule, { excludeHidden: { value: false } }); - var context5 = { + var context = { initiator: true, - include: [ vNode ] + include: [ vNode ], + exclude: [], + frames: [], + page: false, + focusable: true, + size: {}, + flatTree: [] }; - var rawResults = rule3.runSync(context5, options); + var rawResults = rule.runSync(context, options); publish_metadata_default(rawResults); finalize_result_default(rawResults); var results = aggregate_result_default([ rawResults ]); @@ -21403,18 +23012,17 @@ toolOptions: options }); } - var run_virtual_rule_default = runVirtualRule; - function normalizeRunParams(_ref87) { - var _ref89, _options$reporter, _axe$_audit; - var _ref88 = _slicedToArray(_ref87, 3), context5 = _ref88[0], options = _ref88[1], callback = _ref88[2]; + function normalizeRunParams(_ref111) { + var _ref113, _options$reporter, _axe$_audit; + var _ref112 = _slicedToArray(_ref111, 3), context = _ref112[0], options = _ref112[1], callback = _ref112[2]; var typeErr = new TypeError('axe.run arguments are invalid'); - if (!isContext(context5)) { + if (!isContextSpec(context)) { if (callback !== void 0) { throw typeErr; } callback = options; - options = context5; - context5 = document; + options = context; + context = document; } if (_typeof(options) !== 'object') { if (callback !== void 0) { @@ -21427,40 +23035,20 @@ throw typeErr; } options = clone_default(options); - options.reporter = (_ref89 = (_options$reporter = options.reporter) !== null && _options$reporter !== void 0 ? _options$reporter : (_axe$_audit = axe._audit) === null || _axe$_audit === void 0 ? void 0 : _axe$_audit.reporter) !== null && _ref89 !== void 0 ? _ref89 : 'v1'; + options.reporter = (_ref113 = (_options$reporter = options.reporter) !== null && _options$reporter !== void 0 ? _options$reporter : (_axe$_audit = axe._audit) === null || _axe$_audit === void 0 ? void 0 : _axe$_audit.reporter) !== null && _ref113 !== void 0 ? _ref113 : 'v1'; return { - context: context5, + context: context, options: options, callback: callback }; } - function isContext(potential) { - switch (true) { - case typeof potential === 'string': - case Array.isArray(potential): - case window.Node && potential instanceof window.Node: - case window.NodeList && potential instanceof window.NodeList: - return true; - - case _typeof(potential) !== 'object': - return false; - - case potential.include !== void 0: - case potential.exclude !== void 0: - case typeof potential.length === 'number': - return true; - - default: - return false; - } - } var noop2 = function noop2() {}; function run4() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } setupGlobals(args[0]); - var _normalizeRunParams = normalizeRunParams(args), context5 = _normalizeRunParams.context, options = _normalizeRunParams.options, _normalizeRunParams$c = _normalizeRunParams.callback, callback = _normalizeRunParams$c === void 0 ? noop2 : _normalizeRunParams$c; + var _normalizeRunParams = normalizeRunParams(args), context = _normalizeRunParams.context, options = _normalizeRunParams.options, _normalizeRunParams$c = _normalizeRunParams.callback, callback = _normalizeRunParams$c === void 0 ? noop2 : _normalizeRunParams$c; var _getPromiseHandlers = getPromiseHandlers(callback), thenable = _getPromiseHandlers.thenable, resolve = _getPromiseHandlers.resolve, reject = _getPromiseHandlers.reject; try { assert_default(axe._audit, 'No audit configured'); @@ -21472,10 +23060,10 @@ if (options.performanceTimer) { axe.utils.performanceTimer.start(); } - function handleRunRules(rawResults, cleanup5) { + function handleRunRules(rawResults, cleanup3) { var respond = function respond(results) { axe._running = false; - cleanup5(); + cleanup3(); try { callback(null, results); } catch (e) { @@ -21490,7 +23078,7 @@ createReport(rawResults, options, respond); } catch (err2) { axe._running = false; - cleanup5(); + cleanup3(); callback(err2); reject(err2); } @@ -21504,7 +23092,7 @@ callback(err2); reject(err2); } - axe._runRules(context5, options, handleRunRules, errorRunRules); + axe._runRules(context, options, handleRunRules, errorRunRules); return thenable; } function getPromiseHandlers(callback) { @@ -21524,8 +23112,8 @@ }; } function createReport(rawResults, options, respond) { - var reporter5 = getReporter(options.reporter); - var results = reporter5(rawResults, options, respond); + var reporter = getReporter(options.reporter); + var results = reporter(rawResults, options, respond); if (results !== void 0) { respond(results); } @@ -21542,47 +23130,50 @@ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) { args[_key3] = arguments[_key3]; } - var _normalizeRunParams2 = normalizeRunParams(args), options = _normalizeRunParams2.options, context5 = _normalizeRunParams2.context; + var _normalizeRunParams2 = normalizeRunParams(args), options = _normalizeRunParams2.options, context = _normalizeRunParams2.context; assert_default(axe._audit, 'Axe is not configured. Audit is missing.'); assert_default(!axe._running, 'Axe is already running. Use `await axe.run()` to wait for the previous run to finish before starting a new run.'); - var contextObj = new Context(context5, axe._tree); + var contextObj = new Context(context, axe._tree); axe._tree = contextObj.flatTree; axe._selectorData = _getSelectorData(contextObj.flatTree); axe._running = true; return new Promise(function(res, rej) { axe._audit.run(contextObj, options, res, rej); }).then(function(results) { - results = results.map(function(_ref90) { - var nodes = _ref90.nodes, result = _objectWithoutProperties(_ref90, _excluded8); + results = results.map(function(_ref114) { + var nodes = _ref114.nodes, result = _objectWithoutProperties(_ref114, _excluded8); return _extends({ nodes: nodes.map(serializeNode) }, result); }); - var frames = contextObj.frames.map(function(_ref91) { - var node = _ref91.node; + var frames = contextObj.frames.map(function(_ref115) { + var node = _ref115.node; return new dq_element_default(node, options).toJSON(); }); var environmentData; if (contextObj.initiator) { environmentData = _getEnvironmentData(); } + axe._running = false; + teardown_default(); return { results: results, frames: frames, environmentData: environmentData }; - })['finally'](function() { + })['catch'](function(err2) { axe._running = false; teardown_default(); + return Promise.reject(err2); }); } - function serializeNode(_ref92) { - var node = _ref92.node, nodeResult = _objectWithoutProperties(_ref92, _excluded9); + function serializeNode(_ref116) { + var node = _ref116.node, nodeResult = _objectWithoutProperties(_ref116, _excluded9); nodeResult.node = node.toJSON(); - for (var _i30 = 0, _arr2 = [ 'any', 'all', 'none' ]; _i30 < _arr2.length; _i30++) { - var type = _arr2[_i30]; - nodeResult[type] = nodeResult[type].map(function(_ref93) { - var relatedNodes = _ref93.relatedNodes, checkResult = _objectWithoutProperties(_ref93, _excluded10); + for (var _i33 = 0, _arr2 = [ 'any', 'all', 'none' ]; _i33 < _arr2.length; _i33++) { + var type = _arr2[_i33]; + nodeResult[type] = nodeResult[type].map(function(_ref117) { + var relatedNodes = _ref117.relatedNodes, checkResult = _objectWithoutProperties(_ref117, _excluded10); return _extends({}, checkResult, { relatedNodes: relatedNodes.map(function(node2) { return node2.toJSON(); @@ -21593,14 +23184,14 @@ return nodeResult; } function finishRun(partialResults) { - var _ref95, _options$reporter2, _axe$_audit2; + var _ref119, _options$reporter2, _axe$_audit2; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; options = clone_default(options); - var _ref94 = partialResults.find(function(r) { + var _ref118 = partialResults.find(function(r) { return r.environmentData; - }) || {}, environmentData = _ref94.environmentData; + }) || {}, environmentData = _ref118.environmentData; axe._audit.normalizeOptions(options); - options.reporter = (_ref95 = (_options$reporter2 = options.reporter) !== null && _options$reporter2 !== void 0 ? _options$reporter2 : (_axe$_audit2 = axe._audit) === null || _axe$_audit2 === void 0 ? void 0 : _axe$_audit2.reporter) !== null && _ref95 !== void 0 ? _ref95 : 'v1'; + options.reporter = (_ref119 = (_options$reporter2 = options.reporter) !== null && _options$reporter2 !== void 0 ? _options$reporter2 : (_axe$_audit2 = axe._audit) === null || _axe$_audit2 === void 0 ? void 0 : _axe$_audit2.reporter) !== null && _ref119 !== void 0 ? _ref119 : 'v1'; setFrameSpec(partialResults); var results = merge_results_default(partialResults); results = axe._audit.after(results, options); @@ -21612,10 +23203,10 @@ } function setFrameSpec(partialResults) { var frameStack = []; - var _iterator4 = _createForOfIteratorHelper(partialResults), _step4; + var _iterator12 = _createForOfIteratorHelper(partialResults), _step12; try { - for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) { - var partialResult = _step4.value; + for (_iterator12.s(); !(_step12 = _iterator12.n()).done; ) { + var partialResult = _step12.value; var frameSpec = frameStack.shift(); if (!partialResult) { continue; @@ -21625,13 +23216,13 @@ frameStack.unshift.apply(frameStack, _toConsumableArray(frameSpecs)); } } catch (err) { - _iterator4.e(err); + _iterator12.e(err); } finally { - _iterator4.f(); + _iterator12.f(); } } - function getMergedFrameSpecs(_ref96) { - var childFrameSpecs = _ref96.frames, parentFrameSpec = _ref96.frameSpec; + function getMergedFrameSpecs(_ref120) { + var childFrameSpecs = _ref120.frames, parentFrameSpec = _ref120.frameSpec; if (!parentFrameSpec) { return childFrameSpecs; } @@ -21641,8 +23232,8 @@ } function createReport2(results, options) { return new Promise(function(resolve) { - var reporter5 = getReporter(options.reporter); - reporter5(results, options, resolve); + var reporter = getReporter(options.reporter); + reporter(results, options, resolve); }); } function setup(node) { @@ -21691,12 +23282,12 @@ var transformedResults = results.map(function(result) { var transformedResult = _extends({}, result); var types = [ 'passes', 'violations', 'incomplete', 'inapplicable' ]; - for (var _i31 = 0, _types = types; _i31 < _types.length; _i31++) { - var type = _types[_i31]; + for (var _i34 = 0, _types = types; _i34 < _types.length; _i34++) { + var type = _types[_i34]; if (transformedResult[type] && Array.isArray(transformedResult[type])) { - transformedResult[type] = transformedResult[type].map(function(_ref97) { + transformedResult[type] = transformedResult[type].map(function(_ref121) { var _node; - var node = _ref97.node, typeResult = _objectWithoutProperties(_ref97, _excluded13); + var node = _ref121.node, typeResult = _objectWithoutProperties(_ref121, _excluded13); node = typeof ((_node = node) === null || _node === void 0 ? void 0 : _node.toJSON) === 'function' ? node.toJSON() : node; return _extends({ node: node @@ -21715,10 +23306,10 @@ options = {}; } var _options4 = options, environmentData = _options4.environmentData, toolOptions = _objectWithoutProperties(_options4, _excluded14); - raw_default(results, toolOptions, function(raw3) { + raw_default(results, toolOptions, function(raw) { var env = _getEnvironmentData(environmentData); callback({ - raw: raw3, + raw: raw, env: env }); }); @@ -21755,25 +23346,54 @@ }, out)); }; var v2_default = v2Reporter; + var _thisWillBeDeletedDoNotUse = { + base: { + Audit: audit_default, + CheckResult: check_result_default, + Check: check_default, + Context: Context, + RuleResult: rule_result_default, + Rule: rule_default, + metadataFunctionMap: metadata_function_map_default + }, + public: { + reporters: reporters + }, + helpers: { + failureSummary: failure_summary_default, + incompleteFallbackMessage: incompleteFallbackMessage, + processAggregate: process_aggregate_default + }, + utils: { + setDefaultFrameMessenger: setDefaultFrameMessenger, + cacheNodeSelectors: cacheNodeSelectors, + getNodesMatchingExpression: getNodesMatchingExpression, + convertSelector: _convertSelector + }, + commons: { + dom: { + nativelyHidden: nativelyHidden, + displayHidden: displayHidden, + visibilityHidden: visibilityHidden, + contentVisibiltyHidden: contentVisibiltyHidden, + ariaHidden: ariaHidden, + opacityHidden: opacityHidden, + scrollHidden: scrollHidden, + overflowHidden: overflowHidden, + clipHidden: clipHidden, + areaHidden: areaHidden, + detailsHidden: detailsHidden + } + } + }; + var exposed_for_testing_default = _thisWillBeDeletedDoNotUse; + axe._thisWillBeDeletedDoNotUse = exposed_for_testing_default; axe.constants = constants_default; axe.log = log_default; axe.AbstractVirtualNode = abstract_virtual_node_default; axe.SerialVirtualNode = serial_virtual_node_default; axe.VirtualNode = virtual_node_default; axe._cache = cache_default; - axe._thisWillBeDeletedDoNotUse = axe._thisWillBeDeletedDoNotUse || {}; - axe._thisWillBeDeletedDoNotUse.base = { - Audit: audit_default, - CheckResult: check_result_default, - Check: check_default, - Context: Context, - RuleResult: rule_result_default, - Rule: rule_default, - metadataFunctionMap: metadata_function_map_default - }; - axe._thisWillBeDeletedDoNotUse['public'] = { - reporters: reporters - }; axe.imports = imports_exports; axe.cleanup = cleanup_default; axe.configure = configure_default; @@ -21787,7 +23407,7 @@ axe.addReporter = addReporter; axe.reset = reset_default; axe._runRules = run_rules_default; - axe.runVirtualRule = run_virtual_rule_default; + axe.runVirtualRule = runVirtualRule; axe.run = run4; axe.setup = setup_default; axe.teardown = teardown_default; @@ -21836,8 +23456,8 @@ help: 'aria-hidden=\'true\' must not be present on the document body' }, 'aria-hidden-focus': { - description: 'Ensures aria-hidden elements do not contain focusable elements', - help: 'ARIA hidden element must not contain focusable elements' + description: 'Ensures aria-hidden elements are not focusable nor contain focusable elements', + help: 'ARIA hidden element must not be focusable or contain focusable elements' }, 'aria-input-field-name': { description: 'Ensures every ARIA input field has an accessible name', @@ -21961,7 +23581,7 @@ }, 'empty-table-header': { description: 'Ensures table headers have discernible text', - help: 'Table header text must not be empty' + help: 'Table header text should not be empty' }, 'focus-order-semantics': { description: 'Ensures elements in the focus order have a role appropriate for interactive content', @@ -21981,7 +23601,7 @@ }, 'frame-title-unique': { description: 'Ensures