From c32511c3abb69001e73715859b70ba23a350dfab Mon Sep 17 00:00:00 2001 From: babayaga Date: Sat, 13 Sep 2025 12:11:36 +0200 Subject: [PATCH] transcribe 1/2 --- .../kbot/dist-in/commands/transcribe.d.ts | 3 + packages/kbot/dist-in/commands/transcribe.js | 124 + packages/kbot/dist-in/lib/transcribe.d.ts | 2 + packages/kbot/dist-in/lib/transcribe.js | 55 + packages/kbot/dist-in/main.js | 4 +- .../dist-in/models/cache/openai-models.d.ts | 12 +- .../dist-in/models/cache/openai-models.js | 14 +- .../models/cache/openrouter-models-free.d.ts | 10 +- .../models/cache/openrouter-models-free.js | 12 +- .../models/cache/openrouter-models.d.ts | 72 +- .../dist-in/models/cache/openrouter-models.js | 74 +- packages/kbot/dist-in/source.js | 6 +- packages/kbot/dist-in/zod_types.d.ts | 56 +- packages/kbot/dist/main_node.cjs | 230470 +++++++++++++++ packages/kbot/dist/main_node.js | 16342 +- packages/kbot/dist/package-lock.json | 4 +- packages/kbot/dist/package.json | 2 +- packages/kbot/package-lock.json | 3112 +- packages/kbot/package.json | 2 + packages/kbot/salamand.json | 6 + packages/kbot/scripts/nexe.js | 94 + packages/kbot/scripts/nexe.sh | 5 + packages/kbot/src/commands/transcribe.ts | 137 + packages/kbot/src/lib/query.ts | 242 + packages/kbot/src/lib/transcribe.ts | 64 + packages/kbot/src/main.ts | 10 +- packages/kbot/src/source.ts | 8 +- packages/kbot/tests/output/transcription.json | 38 + packages/kbot/tests/unit/transcribe/test.md | 1 + packages/kbot/tests/unit/transcribe/test.mp3 | Bin 0 -> 83473 bytes .../tests/unit/transcribe/transcribe.test.ts | 43 + .../tests/unit/transcribe/transcription.json | 35 + 32 files changed, 242891 insertions(+), 8168 deletions(-) create mode 100644 packages/kbot/dist-in/commands/transcribe.d.ts create mode 100644 packages/kbot/dist-in/commands/transcribe.js create mode 100644 packages/kbot/dist-in/lib/transcribe.d.ts create mode 100644 packages/kbot/dist-in/lib/transcribe.js create mode 100644 packages/kbot/dist/main_node.cjs create mode 100644 packages/kbot/scripts/nexe.js create mode 100644 packages/kbot/scripts/nexe.sh create mode 100644 packages/kbot/src/commands/transcribe.ts create mode 100644 packages/kbot/src/lib/query.ts create mode 100644 packages/kbot/src/lib/transcribe.ts create mode 100644 packages/kbot/tests/output/transcription.json create mode 100644 packages/kbot/tests/unit/transcribe/test.md create mode 100644 packages/kbot/tests/unit/transcribe/test.mp3 create mode 100644 packages/kbot/tests/unit/transcribe/transcribe.test.ts create mode 100644 packages/kbot/tests/unit/transcribe/transcription.json diff --git a/packages/kbot/dist-in/commands/transcribe.d.ts b/packages/kbot/dist-in/commands/transcribe.d.ts new file mode 100644 index 00000000..3d47eef7 --- /dev/null +++ b/packages/kbot/dist-in/commands/transcribe.d.ts @@ -0,0 +1,3 @@ +import { IKBotTask } from '@polymech/ai-tools'; +export declare const TranscribeOptionsSchema: () => any; +export declare const transcribeCommand: (opts: IKBotTask) => Promise; diff --git a/packages/kbot/dist-in/commands/transcribe.js b/packages/kbot/dist-in/commands/transcribe.js new file mode 100644 index 00000000..728e0bc1 --- /dev/null +++ b/packages/kbot/dist-in/commands/transcribe.js @@ -0,0 +1,124 @@ +import * as path from 'node:path'; +import { isString, isArray } from '@polymech/core/primitives'; +import { hasMagic } from 'glob'; +import { sync as exists } from '@polymech/fs/exists'; +import { forward_slash, resolve, pathInfoEx } from '@polymech/commons'; +import { OptionsSchema } from '../zod_schema.js'; +import { transcribe } from '../lib/transcribe.js'; +import { isWebUrl } from '../glob.js'; +import { default_sort } from './run.js'; +import { getLogger } from '../index.js'; +import { variables } from '../variables.js'; +export const TranscribeOptionsSchema = () => { + return OptionsSchema().pick({ + include: true, + dst: true, + api_key: true, + model: true, + router: true, + logLevel: true, + config: true, + baseURL: true, + alt: true, + variables: true, + profile: true, + env: true, + }).passthrough(); +}; +function extractPaths(input) { + if (isWebUrl(input)) { + return [input]; + } + if (exists(path.resolve(resolve(input)))) { + return [input]; + } + if (hasMagic(input)) { + return [input]; + } + const pathStartRegex = /([A-Za-z]:\\)|\/|(https?:\/\/)/g; + const matchIndices = []; + let match; + while ((match = pathStartRegex.exec(input)) !== null) { + matchIndices.push(match.index); + } + if (!matchIndices.length) { + return []; + } + const paths = []; + for (let i = 0; i < matchIndices.length; i++) { + const start = matchIndices[i]; + const end = i < matchIndices.length - 1 ? matchIndices[i + 1] : input.length; + const pathStr = input.substring(start, end).trim(); + if (pathStr) { + paths.push(pathStr); + } + } + return paths; +} +function flattenArrays(arrays) { + return arrays.reduce((accumulator, current) => { + return accumulator.concat(current); + }, []); +} +export const transcribeCommand = async (opts) => { + opts.logger = getLogger(opts); + if (opts.include) { + if (isString(opts.include)) { + opts.include = [opts.include]; + } + if (isArray(opts.include)) { + const specialPatterns = opts.include.filter((p) => hasMagic(p) || isWebUrl(p)); + const normalPaths = opts.include.filter((p) => !hasMagic(p) && !isWebUrl(p)); + const processedPaths = flattenArrays(normalPaths.map(extractPaths)); + opts.include = [...specialPatterns, ...processedPaths]; + } + } + else { + opts.include = []; + } + let files = []; + for (const includePath of opts.include) { + if (hasMagic(includePath)) { + const info = pathInfoEx(forward_slash(path.resolve(resolve(includePath))), false, { + absolute: true, + }); + files.push(...default_sort(info.FILES)); + } + else if (exists(includePath)) { + files.push(includePath); + } + } + if (files.length === 0) { + opts.logger.warn(`No files found for --include patterns: ${opts.include.join(', ')}`); + return; + } + opts.logger.info(`Found ${files.length} files to transcribe.`); + for (const file of files) { + const fileInfo = path.parse(file); + const CWD = process.cwd(); + const current_variables = { + ...variables(opts), + ...opts.variables, + SRC_PATH: file, + SRC_NAME: fileInfo.name, + SRC_EXT: fileInfo.ext, + SRC_DIR: fileInfo.dir, + CWD: CWD + }; + const itemOpts = { + ...opts, + include: [file], + variables: current_variables + }; + if (!itemOpts.dst) { + itemOpts.dst = '${SRC_DIR}/${SRC_NAME}.md'; + } + itemOpts.dst = path.resolve(resolve(itemOpts.dst, itemOpts.alt, itemOpts.variables)); + opts.logger.info(`Transcribing ${file}...`); + if (itemOpts.dst) { + opts.logger.info(`Output will be saved to ${itemOpts.dst}`); + } + await transcribe(itemOpts); + } +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNjcmliZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9jb21tYW5kcy90cmFuc2NyaWJlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxJQUFJLE1BQU0sV0FBVyxDQUFBO0FBQ2pDLE9BQU8sRUFBRSxRQUFRLEVBQUUsT0FBTyxFQUFFLE1BQU0sMkJBQTJCLENBQUE7QUFDN0QsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLE1BQU0sQ0FBQTtBQUMvQixPQUFPLEVBQUUsSUFBSSxJQUFJLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFBO0FBQ3BELE9BQU8sRUFBRSxhQUFhLEVBQUUsT0FBTyxFQUFFLFVBQVUsRUFBRSxNQUFNLG1CQUFtQixDQUFBO0FBR3RFLE9BQU8sRUFBRSxhQUFhLEVBQUUsTUFBTSxrQkFBa0IsQ0FBQTtBQUNoRCxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sc0JBQXNCLENBQUE7QUFDakQsT0FBTyxFQUFFLFFBQVEsRUFBRSxNQUFNLFlBQVksQ0FBQTtBQUNyQyxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sVUFBVSxDQUFBO0FBQ3ZDLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSxhQUFhLENBQUE7QUFDdkMsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGlCQUFpQixDQUFBO0FBRTNDLE1BQU0sQ0FBQyxNQUFNLHVCQUF1QixHQUFHLEdBQUcsRUFBRTtJQUN4QyxPQUFPLGFBQWEsRUFBRSxDQUFDLElBQUksQ0FBQztRQUN4QixPQUFPLEVBQUUsSUFBSTtRQUNiLEdBQUcsRUFBRSxJQUFJO1FBQ1QsT0FBTyxFQUFFLElBQUk7UUFDYixLQUFLLEVBQUUsSUFBSTtRQUNYLE1BQU0sRUFBRSxJQUFJO1FBQ1osUUFBUSxFQUFFLElBQUk7UUFDZCxNQUFNLEVBQUUsSUFBSTtRQUNaLE9BQU8sRUFBRSxJQUFJO1FBQ2IsR0FBRyxFQUFFLElBQUk7UUFDVCxTQUFTLEVBQUUsSUFBSTtRQUNmLE9BQU8sRUFBRSxJQUFJO1FBQ2IsR0FBRyxFQUFFLElBQUk7S0FDWixDQUFDLENBQUMsV0FBVyxFQUFFLENBQUE7QUFDcEIsQ0FBQyxDQUFBO0FBRUQsU0FBUyxZQUFZLENBQUMsS0FBYTtJQUMvQixJQUFJLFFBQVEsQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDO1FBQ2xCLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQTtJQUNsQixDQUFDO0lBQ0QsSUFBSSxNQUFNLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxFQUFFLENBQUM7UUFDdkMsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFBO0lBQ2xCLENBQUM7SUFDRCxJQUFJLFFBQVEsQ0FBQyxLQUFLLENBQUMsRUFBRSxDQUFDO1FBQ2xCLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQTtJQUNsQixDQUFDO0lBQ0QsTUFBTSxjQUFjLEdBQUcsaUNBQWlDLENBQUM7SUFDekQsTUFBTSxZQUFZLEdBQWEsRUFBRSxDQUFDO0lBQ2xDLElBQUksS0FBNkIsQ0FBQztJQUNsQyxPQUFPLENBQUMsS0FBSyxHQUFHLGNBQWMsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLENBQUMsS0FBSyxJQUFJLEVBQUUsQ0FBQztRQUNuRCxZQUFZLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUNuQyxDQUFDO0lBQ0QsSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLEVBQUUsQ0FBQztRQUN2QixPQUFPLEVBQUUsQ0FBQztJQUNkLENBQUM7SUFDRCxNQUFNLEtBQUssR0FBYSxFQUFFLENBQUM7SUFDM0IsS0FBSyxJQUFJLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxHQUFHLFlBQVksQ0FBQyxNQUFNLEVBQUUsQ0FBQyxFQUFFLEVBQUUsQ0FBQztRQUMzQyxNQUFNLEtBQUssR0FBRyxZQUFZLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDOUIsTUFBTSxHQUFHLEdBQUcsQ0FBQyxHQUFHLFlBQVksQ0FBQyxNQUFNLEdBQUcsQ0FBQyxDQUFDLENBQUMsQ0FBQyxZQUFZLENBQUMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxDQUFDLENBQUMsQ0FBQyxLQUFLLENBQUMsTUFBTSxDQUFDO1FBQzdFLE1BQU0sT0FBTyxHQUFHLEtBQUssQ0FBQyxTQUFTLENBQUMsS0FBSyxFQUFFLEdBQUcsQ0FBQyxDQUFDLElBQUksRUFBRSxDQUFDO1FBQ25ELElBQUksT0FBTyxFQUFFLENBQUM7WUFDVixLQUFLLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDO1FBQ3hCLENBQUM7SUFDTCxDQUFDO0lBQ0QsT0FBTyxLQUFLLENBQUM7QUFDakIsQ0FBQztBQUVELFNBQVMsYUFBYSxDQUFJLE1BQWE7SUFDbkMsT0FBTyxNQUFNLENBQUMsTUFBTSxDQUFDLENBQUMsV0FBVyxFQUFFLE9BQU8sRUFBRSxFQUFFO1FBQzFDLE9BQU8sV0FBVyxDQUFDLE1BQU0sQ0FBQyxPQUFPLENBQUMsQ0FBQztJQUN2QyxDQUFDLEVBQUUsRUFBUyxDQUFDLENBQUM7QUFDbEIsQ0FBQztBQUVELE1BQU0sQ0FBQyxNQUFNLGlCQUFpQixHQUFHLEtBQUssRUFBRSxJQUFlLEVBQUUsRUFBRTtJQUN2RCxJQUFJLENBQUMsTUFBTSxHQUFHLFNBQVMsQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUU3QixJQUFJLElBQUksQ0FBQyxPQUFPLEVBQUUsQ0FBQztRQUNmLElBQUksUUFBUSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ3pCLElBQUksQ0FBQyxPQUFPLEdBQUcsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7UUFDakMsQ0FBQztRQUNELElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ3hCLE1BQU0sZUFBZSxHQUFHLElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBUyxFQUFFLEVBQUUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxDQUFDLElBQUksUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7WUFDdEYsTUFBTSxXQUFXLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFTLEVBQUUsRUFBRSxDQUFDLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUE7WUFDcEYsTUFBTSxjQUFjLEdBQUcsYUFBYSxDQUFDLFdBQVcsQ0FBQyxHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMsQ0FBQTtZQUNuRSxJQUFJLENBQUMsT0FBTyxHQUFHLENBQUMsR0FBRyxlQUFlLEVBQUUsR0FBRyxjQUFjLENBQUMsQ0FBQTtRQUMxRCxDQUFDO0lBQ0wsQ0FBQztTQUFNLENBQUM7UUFDSixJQUFJLENBQUMsT0FBTyxHQUFHLEVBQUUsQ0FBQTtJQUNyQixDQUFDO0lBRUQsSUFBSSxLQUFLLEdBQWEsRUFBRSxDQUFBO0lBQ3hCLEtBQUssTUFBTSxXQUFXLElBQUksSUFBSSxDQUFDLE9BQU8sRUFBRSxDQUFDO1FBQ3JDLElBQUksUUFBUSxDQUFDLFdBQVcsQ0FBQyxFQUFFLENBQUM7WUFDeEIsTUFBTSxJQUFJLEdBQUcsVUFBVSxDQUFDLGFBQWEsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQyxDQUFDLEVBQUUsS0FBSyxFQUFFO2dCQUM5RSxRQUFRLEVBQUUsSUFBSTthQUNqQixDQUFDLENBQUE7WUFDRixLQUFLLENBQUMsSUFBSSxDQUFDLEdBQUcsWUFBWSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFBO1FBQzNDLENBQUM7YUFBTSxJQUFJLE1BQU0sQ0FBQyxXQUFXLENBQUMsRUFBRSxDQUFDO1lBQzdCLEtBQUssQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUE7UUFDM0IsQ0FBQztJQUNMLENBQUM7SUFFRCxJQUFJLEtBQUssQ0FBQyxNQUFNLEtBQUssQ0FBQyxFQUFFLENBQUM7UUFDckIsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsMENBQTBDLElBQUksQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQTtRQUNyRixPQUFNO0lBQ1YsQ0FBQztJQUVELElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLFNBQVMsS0FBSyxDQUFDLE1BQU0sdUJBQXVCLENBQUMsQ0FBQTtJQUU5RCxLQUFLLE1BQU0sSUFBSSxJQUFJLEtBQUssRUFBRSxDQUFDO1FBQ3ZCLE1BQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxLQUFLLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDakMsTUFBTSxHQUFHLEdBQUcsT0FBTyxDQUFDLEdBQUcsRUFBRSxDQUFBO1FBQ3pCLE1BQU0saUJBQWlCLEdBQUc7WUFDdEIsR0FBRyxTQUFTLENBQUMsSUFBSSxDQUFDO1lBQ2xCLEdBQUcsSUFBSSxDQUFDLFNBQVM7WUFDakIsUUFBUSxFQUFFLElBQUk7WUFDZCxRQUFRLEVBQUUsUUFBUSxDQUFDLElBQUk7WUFDdkIsT0FBTyxFQUFFLFFBQVEsQ0FBQyxHQUFHO1lBQ3JCLE9BQU8sRUFBRSxRQUFRLENBQUMsR0FBRztZQUNyQixHQUFHLEVBQUUsR0FBRztTQUNYLENBQUE7UUFFRCxNQUFNLFFBQVEsR0FBYztZQUN4QixHQUFHLElBQUk7WUFDUCxPQUFPLEVBQUUsQ0FBQyxJQUFJLENBQUM7WUFDZixTQUFTLEVBQUUsaUJBQWlCO1NBQy9CLENBQUM7UUFFRixJQUFJLENBQUMsUUFBUSxDQUFDLEdBQUcsRUFBRSxDQUFDO1lBQ2hCLFFBQVEsQ0FBQyxHQUFHLEdBQUcsMkJBQTJCLENBQUM7UUFDL0MsQ0FBQztRQUNELFFBQVEsQ0FBQyxHQUFHLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsUUFBUSxDQUFDLEdBQUcsRUFBRSxRQUFRLENBQUMsR0FBRyxFQUFFLFFBQVEsQ0FBQyxTQUFTLENBQUMsQ0FBQyxDQUFBO1FBR3BGLElBQUksQ0FBQyxNQUFNLENBQUMsSUFBSSxDQUFDLGdCQUFnQixJQUFJLEtBQUssQ0FBQyxDQUFBO1FBQzNDLElBQUcsUUFBUSxDQUFDLEdBQUcsRUFBRSxDQUFDO1lBQ2QsSUFBSSxDQUFDLE1BQU0sQ0FBQyxJQUFJLENBQUMsMkJBQTJCLFFBQVEsQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFBO1FBQy9ELENBQUM7UUFFRCxNQUFNLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQTtJQUM5QixDQUFDO0FBQ0wsQ0FBQyxDQUFBIn0= \ No newline at end of file diff --git a/packages/kbot/dist-in/lib/transcribe.d.ts b/packages/kbot/dist-in/lib/transcribe.d.ts new file mode 100644 index 00000000..219cbf4a --- /dev/null +++ b/packages/kbot/dist-in/lib/transcribe.d.ts @@ -0,0 +1,2 @@ +import { IKBotTask } from '@polymech/ai-tools'; +export declare const transcribe: (options: IKBotTask) => Promise; diff --git a/packages/kbot/dist-in/lib/transcribe.js b/packages/kbot/dist-in/lib/transcribe.js new file mode 100644 index 00000000..2be42c22 --- /dev/null +++ b/packages/kbot/dist-in/lib/transcribe.js @@ -0,0 +1,55 @@ +import * as fs from 'fs'; +import { toFile } from "openai"; +import { sync as exists } from '@polymech/fs/exists'; +import { sync as write } from '@polymech/fs/write'; +import { createClient } from '../client.js'; +const createBuffer = (path) => { + try { + const buffer = fs.readFileSync(path); + return buffer; + } + catch (error) { + console.error('Error creating buffer:', error); + return null; + } +}; +export const transcribe = async (options) => { + const client = createClient(options); + if (!client) { + options.logger.error('Failed to create client'); + return; + } + if (!options.include || options.include.length === 0) { + options.logger.error('No source file provided via --include'); + return; + } + const sourceFile = options.include[0]; + if (!exists(sourceFile)) { + options.logger.error('Source file does not exist', sourceFile); + return; + } + const file = await toFile(createBuffer(sourceFile), 'audio.mp3', { type: 'audio/mpeg' }); + if (!file) { + options.logger.error('Error converting source to file'); + return; + } + const completion = await client.audio.transcriptions.create({ + model: 'whisper-1', + file: file, + response_format: options.response_format || "verbose_json", + }); + if (!completion) { + options.logger.error('OpenAI response is empty'); + return; + } + const text_content = completion.text || ''; + if (options.dst) { + write(options.dst, text_content); + } + else { + process.stdout.write(text_content); + } + // options.logger.debug('OpenAI Transcribe response:', completion) + return completion; +}; +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNjcmliZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9saWIvdHJhbnNjcmliZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssRUFBRSxNQUFNLElBQUksQ0FBQTtBQUN4QixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sUUFBUSxDQUFBO0FBQy9CLE9BQU8sRUFBRSxJQUFJLElBQUksTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFDcEQsT0FBTyxFQUFFLElBQUksSUFBSSxLQUFLLEVBQUUsTUFBTSxvQkFBb0IsQ0FBQTtBQUVsRCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sY0FBYyxDQUFBO0FBRTNDLE1BQU0sWUFBWSxHQUFHLENBQUMsSUFBWSxFQUFpQixFQUFFO0lBQ2pELElBQUksQ0FBQztRQUNELE1BQU0sTUFBTSxHQUFHLEVBQUUsQ0FBQyxZQUFZLENBQUMsSUFBSSxDQUFDLENBQUE7UUFDcEMsT0FBTyxNQUFNLENBQUM7SUFDbEIsQ0FBQztJQUFDLE9BQU8sS0FBSyxFQUFFLENBQUM7UUFDYixPQUFPLENBQUMsS0FBSyxDQUFDLHdCQUF3QixFQUFFLEtBQUssQ0FBQyxDQUFDO1FBQy9DLE9BQU8sSUFBSSxDQUFDO0lBQ2hCLENBQUM7QUFDTCxDQUFDLENBQUE7QUFFRCxNQUFNLENBQUMsTUFBTSxVQUFVLEdBQUcsS0FBSyxFQUFFLE9BQWtCLEVBQUUsRUFBRTtJQUNuRCxNQUFNLE1BQU0sR0FBRyxZQUFZLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDcEMsSUFBSSxDQUFDLE1BQU0sRUFBRSxDQUFDO1FBQ1YsT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMseUJBQXlCLENBQUMsQ0FBQTtRQUMvQyxPQUFNO0lBQ1YsQ0FBQztJQUVELElBQUksQ0FBQyxPQUFPLENBQUMsT0FBTyxJQUFJLE9BQU8sQ0FBQyxPQUFPLENBQUMsTUFBTSxLQUFLLENBQUMsRUFBRSxDQUFDO1FBQ25ELE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLHVDQUF1QyxDQUFDLENBQUE7UUFDN0QsT0FBTztJQUNYLENBQUM7SUFFRCxNQUFNLFVBQVUsR0FBRyxPQUFPLENBQUMsT0FBTyxDQUFDLENBQUMsQ0FBQyxDQUFDO0lBRXRDLElBQUksQ0FBQyxNQUFNLENBQUMsVUFBVSxDQUFDLEVBQUUsQ0FBQztRQUN0QixPQUFPLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyw0QkFBNEIsRUFBRSxVQUFVLENBQUMsQ0FBQTtRQUM5RCxPQUFPO0lBQ1gsQ0FBQztJQUVELE1BQU0sSUFBSSxHQUFHLE1BQU0sTUFBTSxDQUFDLFlBQVksQ0FBQyxVQUFVLENBQUMsRUFBRSxXQUFXLEVBQUUsRUFBRSxJQUFJLEVBQUUsWUFBWSxFQUFFLENBQUMsQ0FBQztJQUN6RixJQUFJLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDUixPQUFPLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxpQ0FBaUMsQ0FBQyxDQUFBO1FBQ3ZELE9BQU87SUFDWCxDQUFDO0lBRUQsTUFBTSxVQUFVLEdBQVEsTUFBTSxNQUFNLENBQUMsS0FBSyxDQUFDLGNBQWMsQ0FBQyxNQUFNLENBQUM7UUFDN0QsS0FBSyxFQUFFLFdBQVc7UUFDbEIsSUFBSSxFQUFFLElBQUk7UUFDVixlQUFlLEVBQUcsT0FBZSxDQUFDLGVBQWUsSUFBSSxjQUFjO0tBQ3RFLENBQUMsQ0FBQTtJQUVGLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQztRQUNkLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxDQUFDLDBCQUEwQixDQUFDLENBQUE7UUFDaEQsT0FBTztJQUNYLENBQUM7SUFFRCxNQUFNLFlBQVksR0FBRyxVQUFVLENBQUMsSUFBSSxJQUFJLEVBQUUsQ0FBQztJQUUzQyxJQUFJLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQztRQUNkLEtBQUssQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLFlBQVksQ0FBQyxDQUFBO0lBQ3BDLENBQUM7U0FBTSxDQUFDO1FBQ0osT0FBTyxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsWUFBWSxDQUFDLENBQUE7SUFDdEMsQ0FBQztJQUVELGtFQUFrRTtJQUNsRSxPQUFPLFVBQVUsQ0FBQTtBQUNyQixDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/packages/kbot/dist-in/main.js b/packages/kbot/dist-in/main.js index 7b1b1de2..d29489ac 100644 --- a/packages/kbot/dist-in/main.js +++ b/packages/kbot/dist-in/main.js @@ -10,6 +10,7 @@ import { init } from './commands/init.js'; import { build } from './commands/build.js'; import { fetch } from './commands/fetch.js'; import { run } from './commands/run.js'; +import { transcribeCommand, TranscribeOptionsSchema } from './commands/transcribe.js'; export const logger = createLogger('llm-tools'); const modify = async (argv) => await run(argv); const yargOptions = { @@ -29,6 +30,7 @@ const yargOptions = { yargs(hideBin(process.argv)) .command('init', 'Initialize KBot configuration', (yargs) => toYargs(yargs, OptionsSchema(), yargOptions), init) .command('modify [prompt]', 'Modify an existing project', (yargs) => toYargs(yargs, OptionsSchema(), yargOptions), modify) + .command('transcribe', 'Transcribe audio files', (yargs) => toYargs(yargs, TranscribeOptionsSchema(), yargOptions), transcribeCommand) .command('types', 'Generate types', (yargs) => { }, (argv) => types()) .command('schemas', 'Generate schemas', (yargs) => { }, (argv) => schemas()) .command('build', 'Build kbot essentials', (yargs) => { }, (argv) => build()) @@ -39,4 +41,4 @@ yargs(hideBin(process.argv)) .help() //.wrap(yargs.terminalWidth() - 20) .parse(); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEtBQUssTUFBTSxPQUFPLENBQUE7QUFDekIsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUN2QyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sbUJBQW1CLENBQUE7QUFDM0MsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUM1QyxPQUFPLEVBQUUsYUFBYSxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUkvRCxPQUFPLFdBQVcsTUFBTSxvQkFBb0IsQ0FBQTtBQUM1QyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sd0JBQXdCLENBQUE7QUFDakQsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG9CQUFvQixDQUFBO0FBQ3pDLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQTtBQUMzQyxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFDM0MsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLG1CQUFtQixDQUFBO0FBRXZDLE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBUSxZQUFZLENBQUMsV0FBVyxDQUFDLENBQUE7QUFFcEQsTUFBTSxNQUFNLEdBQUcsS0FBSyxFQUFFLElBQWUsRUFBRSxFQUFFLENBQUUsTUFBTSxHQUFHLENBQUMsSUFBaUIsQ0FBQyxDQUFBO0FBRXZFLE1BQU0sV0FBVyxHQUFRO0lBQ3ZCLEtBQUssRUFBRSxDQUFDLENBQUMsTUFBTSxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsRUFBRTtRQUMvQixRQUFRLEdBQUcsRUFBRSxDQUFDO1lBQ1osS0FBSyxRQUFRO2dCQUNYLENBQUM7b0JBQ0MsT0FBTyxNQUFNLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQTtnQkFDeEMsQ0FBQztZQUNILEtBQUssU0FBUztnQkFDWixDQUFDO29CQUNDLE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLEVBQUUsRUFBQyxHQUFHLE9BQU8sRUFBRSxLQUFLLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsRUFBRSxFQUFDLENBQUMsQ0FBQTtnQkFDdEUsQ0FBQztRQUNMLENBQUM7SUFDSCxDQUFDLENBQUM7Q0FDSCxDQUFBO0FBRUQsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7S0FDekIsT0FBTyxDQUNOLE1BQU0sRUFDTiwrQkFBK0IsRUFDL0IsQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFLEVBQUUsV0FBVyxDQUFDLEVBQ3ZELElBQUksQ0FDTDtLQUNBLE9BQU8sQ0FDTixpQkFBaUIsRUFDakIsNEJBQTRCLEVBQzVCLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxFQUFFLFdBQVcsQ0FBQyxFQUN2RCxNQUFNLENBQ1A7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLGdCQUFnQixFQUNoQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sU0FBUyxFQUNULGtCQUFrQixFQUNsQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FDcEI7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLHVCQUF1QixFQUN2QixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLCtCQUErQixFQUMvQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sU0FBUyxFQUNULHdCQUF3QixFQUN4QixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLFdBQVcsQ0FDWjtLQUNBLE9BQU8sQ0FDTixVQUFVLEVBQ1YsZUFBZSxFQUNmLENBQUMsS0FBSyxFQUFFLEVBQUUsR0FBRyxDQUFDLEVBQ2QsUUFBUSxDQUNUO0tBQ0EsT0FBTyxDQUFDLENBQUMsaUJBQWlCLEVBQUUsSUFBSSxDQUFDLEVBQUUsd0JBQXdCLEVBQzFELENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxFQUFFLFdBQVcsQ0FBQyxFQUFFLE1BQU0sQ0FBQztLQUNqRSxJQUFJLEVBQUU7SUFDUCxtQ0FBbUM7S0FDbEMsS0FBSyxFQUFFLENBQUEifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3NyYy9tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFDQSxPQUFPLEtBQUssTUFBTSxPQUFPLENBQUE7QUFDekIsT0FBTyxFQUFFLE9BQU8sRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUN2QyxPQUFPLEVBQUUsT0FBTyxFQUFFLE1BQU0sbUJBQW1CLENBQUE7QUFDM0MsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLGVBQWUsQ0FBQTtBQUU1QyxPQUFPLEVBQUUsYUFBYSxFQUFFLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQTtBQUcvRCxPQUFPLFdBQVcsTUFBTSxvQkFBb0IsQ0FBQTtBQUM1QyxPQUFPLEVBQUUsUUFBUSxFQUFFLE1BQU0sd0JBQXdCLENBQUE7QUFDakQsT0FBTyxFQUFFLElBQUksRUFBRSxNQUFNLG9CQUFvQixDQUFBO0FBQ3pDLE9BQU8sRUFBRSxLQUFLLEVBQUUsTUFBTSxxQkFBcUIsQ0FBQTtBQUMzQyxPQUFPLEVBQUUsS0FBSyxFQUFFLE1BQU0scUJBQXFCLENBQUE7QUFDM0MsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLG1CQUFtQixDQUFBO0FBRXZDLE9BQU8sRUFBRSxpQkFBaUIsRUFBRSx1QkFBdUIsRUFBRSxNQUFNLDBCQUEwQixDQUFBO0FBRXJGLE1BQU0sQ0FBQyxNQUFNLE1BQU0sR0FBUSxZQUFZLENBQUMsV0FBVyxDQUFDLENBQUE7QUFFcEQsTUFBTSxNQUFNLEdBQUcsS0FBSyxFQUFFLElBQWUsRUFBRSxFQUFFLENBQUUsTUFBTSxHQUFHLENBQUMsSUFBaUIsQ0FBQyxDQUFBO0FBRXZFLE1BQU0sV0FBVyxHQUFRO0lBQ3ZCLEtBQUssRUFBRSxDQUFDLENBQUMsTUFBTSxFQUFFLEdBQUcsRUFBRSxPQUFPLEVBQUUsRUFBRTtRQUMvQixRQUFRLEdBQUcsRUFBRSxDQUFDO1lBQ1osS0FBSyxRQUFRO2dCQUNYLENBQUM7b0JBQ0MsT0FBTyxNQUFNLENBQUMsVUFBVSxDQUFDLEdBQUcsRUFBRSxPQUFPLENBQUMsQ0FBQTtnQkFDeEMsQ0FBQztZQUNILEtBQUssU0FBUztnQkFDWixDQUFDO29CQUNDLE9BQU8sTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLEVBQUUsRUFBQyxHQUFHLE9BQU8sRUFBRSxLQUFLLEVBQUUsR0FBRyxDQUFDLENBQUMsQ0FBQyxDQUFDLFdBQVcsRUFBRSxFQUFDLENBQUMsQ0FBQTtnQkFDdEUsQ0FBQztRQUNMLENBQUM7SUFDSCxDQUFDLENBQUM7Q0FDSCxDQUFBO0FBRUQsS0FBSyxDQUFDLE9BQU8sQ0FBQyxPQUFPLENBQUMsSUFBSSxDQUFDLENBQUM7S0FDekIsT0FBTyxDQUNOLE1BQU0sRUFDTiwrQkFBK0IsRUFDL0IsQ0FBQyxLQUFLLEVBQUUsRUFBRSxDQUFDLE9BQU8sQ0FBQyxLQUFLLEVBQUUsYUFBYSxFQUFFLEVBQUUsV0FBVyxDQUFDLEVBQ3ZELElBQUksQ0FDTDtLQUNBLE9BQU8sQ0FDTixpQkFBaUIsRUFDakIsNEJBQTRCLEVBQzVCLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxFQUFFLFdBQVcsQ0FBQyxFQUN2RCxNQUFNLENBQ1A7S0FDQSxPQUFPLENBQ04sWUFBWSxFQUNaLHdCQUF3QixFQUN4QixDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsT0FBTyxDQUFDLEtBQUssRUFBRSx1QkFBdUIsRUFBRSxFQUFFLFdBQVcsQ0FBQyxFQUNqRSxpQkFBaUIsQ0FDbEI7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLGdCQUFnQixFQUNoQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sU0FBUyxFQUNULGtCQUFrQixFQUNsQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxPQUFPLEVBQUUsQ0FDcEI7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLHVCQUF1QixFQUN2QixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sT0FBTyxFQUNQLCtCQUErQixFQUMvQixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLENBQUMsSUFBSSxFQUFFLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FDbEI7S0FDQSxPQUFPLENBQ04sU0FBUyxFQUNULHdCQUF3QixFQUN4QixDQUFDLEtBQUssRUFBRSxFQUFFLEdBQUcsQ0FBQyxFQUNkLFdBQVcsQ0FDWjtLQUNBLE9BQU8sQ0FDTixVQUFVLEVBQ1YsZUFBZSxFQUNmLENBQUMsS0FBSyxFQUFFLEVBQUUsR0FBRyxDQUFDLEVBQ2QsUUFBUSxDQUNUO0tBQ0EsT0FBTyxDQUFDLENBQUMsaUJBQWlCLEVBQUUsSUFBSSxDQUFDLEVBQUUsd0JBQXdCLEVBQzFELENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLGFBQWEsRUFBRSxFQUFFLFdBQVcsQ0FBQyxFQUFFLE1BQU0sQ0FBQztLQUNqRSxJQUFJLEVBQUU7SUFDUCxtQ0FBbUM7S0FDbEMsS0FBSyxFQUFFLENBQUEifQ== \ No newline at end of file diff --git a/packages/kbot/dist-in/models/cache/openai-models.d.ts b/packages/kbot/dist-in/models/cache/openai-models.d.ts index 792097ea..eb82796b 100644 --- a/packages/kbot/dist-in/models/cache/openai-models.d.ts +++ b/packages/kbot/dist-in/models/cache/openai-models.d.ts @@ -2,11 +2,11 @@ export declare enum E_OPENAI_MODEL { MODEL_GPT_4_0613 = "gpt-4-0613", MODEL_GPT_4 = "gpt-4", MODEL_GPT_3_5_TURBO = "gpt-3.5-turbo", + MODEL_GPT_AUDIO = "gpt-audio", MODEL_GPT_5_NANO = "gpt-5-nano", - MODEL_GPT_5 = "gpt-5", - MODEL_GPT_5_MINI_2025_08_07 = "gpt-5-mini-2025-08-07", - MODEL_GPT_5_MINI = "gpt-5-mini", - MODEL_GPT_5_NANO_2025_08_07 = "gpt-5-nano-2025-08-07", + MODEL_GPT_AUDIO_2025_08_28 = "gpt-audio-2025-08-28", + MODEL_GPT_REALTIME = "gpt-realtime", + MODEL_GPT_REALTIME_2025_08_28 = "gpt-realtime-2025-08-28", MODEL_DAVINCI_002 = "davinci-002", MODEL_BABBAGE_002 = "babbage-002", MODEL_GPT_3_5_TURBO_INSTRUCT = "gpt-3.5-turbo-instruct", @@ -77,6 +77,10 @@ export declare enum E_OPENAI_MODEL { MODEL_O4_MINI_DEEP_RESEARCH_2025_06_26 = "o4-mini-deep-research-2025-06-26", MODEL_GPT_5_CHAT_LATEST = "gpt-5-chat-latest", MODEL_GPT_5_2025_08_07 = "gpt-5-2025-08-07", + MODEL_GPT_5 = "gpt-5", + MODEL_GPT_5_MINI_2025_08_07 = "gpt-5-mini-2025-08-07", + MODEL_GPT_5_MINI = "gpt-5-mini", + MODEL_GPT_5_NANO_2025_08_07 = "gpt-5-nano-2025-08-07", MODEL_GPT_3_5_TURBO_16K = "gpt-3.5-turbo-16k", MODEL_TTS_1 = "tts-1", MODEL_WHISPER_1 = "whisper-1", diff --git a/packages/kbot/dist-in/models/cache/openai-models.js b/packages/kbot/dist-in/models/cache/openai-models.js index efee1eb8..378972b2 100644 --- a/packages/kbot/dist-in/models/cache/openai-models.js +++ b/packages/kbot/dist-in/models/cache/openai-models.js @@ -3,11 +3,11 @@ export var E_OPENAI_MODEL; E_OPENAI_MODEL["MODEL_GPT_4_0613"] = "gpt-4-0613"; E_OPENAI_MODEL["MODEL_GPT_4"] = "gpt-4"; E_OPENAI_MODEL["MODEL_GPT_3_5_TURBO"] = "gpt-3.5-turbo"; + E_OPENAI_MODEL["MODEL_GPT_AUDIO"] = "gpt-audio"; E_OPENAI_MODEL["MODEL_GPT_5_NANO"] = "gpt-5-nano"; - E_OPENAI_MODEL["MODEL_GPT_5"] = "gpt-5"; - E_OPENAI_MODEL["MODEL_GPT_5_MINI_2025_08_07"] = "gpt-5-mini-2025-08-07"; - E_OPENAI_MODEL["MODEL_GPT_5_MINI"] = "gpt-5-mini"; - E_OPENAI_MODEL["MODEL_GPT_5_NANO_2025_08_07"] = "gpt-5-nano-2025-08-07"; + E_OPENAI_MODEL["MODEL_GPT_AUDIO_2025_08_28"] = "gpt-audio-2025-08-28"; + E_OPENAI_MODEL["MODEL_GPT_REALTIME"] = "gpt-realtime"; + E_OPENAI_MODEL["MODEL_GPT_REALTIME_2025_08_28"] = "gpt-realtime-2025-08-28"; E_OPENAI_MODEL["MODEL_DAVINCI_002"] = "davinci-002"; E_OPENAI_MODEL["MODEL_BABBAGE_002"] = "babbage-002"; E_OPENAI_MODEL["MODEL_GPT_3_5_TURBO_INSTRUCT"] = "gpt-3.5-turbo-instruct"; @@ -78,9 +78,13 @@ export var E_OPENAI_MODEL; E_OPENAI_MODEL["MODEL_O4_MINI_DEEP_RESEARCH_2025_06_26"] = "o4-mini-deep-research-2025-06-26"; E_OPENAI_MODEL["MODEL_GPT_5_CHAT_LATEST"] = "gpt-5-chat-latest"; E_OPENAI_MODEL["MODEL_GPT_5_2025_08_07"] = "gpt-5-2025-08-07"; + E_OPENAI_MODEL["MODEL_GPT_5"] = "gpt-5"; + E_OPENAI_MODEL["MODEL_GPT_5_MINI_2025_08_07"] = "gpt-5-mini-2025-08-07"; + E_OPENAI_MODEL["MODEL_GPT_5_MINI"] = "gpt-5-mini"; + E_OPENAI_MODEL["MODEL_GPT_5_NANO_2025_08_07"] = "gpt-5-nano-2025-08-07"; E_OPENAI_MODEL["MODEL_GPT_3_5_TURBO_16K"] = "gpt-3.5-turbo-16k"; E_OPENAI_MODEL["MODEL_TTS_1"] = "tts-1"; E_OPENAI_MODEL["MODEL_WHISPER_1"] = "whisper-1"; E_OPENAI_MODEL["MODEL_TEXT_EMBEDDING_ADA_002"] = "text-embedding-ada-002"; })(E_OPENAI_MODEL || (E_OPENAI_MODEL = {})); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbmFpLW1vZGVscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9tb2RlbHMvY2FjaGUvb3BlbmFpLW1vZGVscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxjQW1GWDtBQW5GRCxXQUFZLGNBQWM7SUFDeEIsaURBQStCLENBQUE7SUFDL0IsdUNBQXFCLENBQUE7SUFDckIsdURBQXFDLENBQUE7SUFDckMsaURBQStCLENBQUE7SUFDL0IsdUNBQXFCLENBQUE7SUFDckIsdUVBQXFELENBQUE7SUFDckQsaURBQStCLENBQUE7SUFDL0IsdUVBQXFELENBQUE7SUFDckQsbURBQWlDLENBQUE7SUFDakMsbURBQWlDLENBQUE7SUFDakMseUVBQXVELENBQUE7SUFDdkQsbUZBQWlFLENBQUE7SUFDakUsNkNBQTJCLENBQUE7SUFDM0IsNkNBQTJCLENBQUE7SUFDM0IsaUVBQStDLENBQUE7SUFDL0MsaUVBQStDLENBQUE7SUFDL0MsNkNBQTJCLENBQUE7SUFDM0IsaURBQStCLENBQUE7SUFDL0IsdURBQXFDLENBQUE7SUFDckMseUVBQXVELENBQUE7SUFDdkQseUVBQXVELENBQUE7SUFDdkQsaUVBQStDLENBQUE7SUFDL0MsbUVBQWlELENBQUE7SUFDakQsaUVBQStDLENBQUE7SUFDL0MsbURBQWlDLENBQUE7SUFDakMseUVBQXVELENBQUE7SUFDdkQseUNBQXVCLENBQUE7SUFDdkIsK0RBQTZDLENBQUE7SUFDN0MseUVBQXVELENBQUE7SUFDdkQsbURBQWlDLENBQUE7SUFDakMsK0RBQTZDLENBQUE7SUFDN0MsK0RBQTZDLENBQUE7SUFDN0MsaUVBQStDLENBQUE7SUFDL0MsMkNBQXlCLENBQUE7SUFDekIsaUdBQStFLENBQUE7SUFDL0UsMkZBQXlFLENBQUE7SUFDekUscUVBQW1ELENBQUE7SUFDbkQsMkVBQXlELENBQUE7SUFDekQseUVBQXVELENBQUE7SUFDdkQsaUZBQStELENBQUE7SUFDL0QsaUdBQStFLENBQUE7SUFDL0UsMkZBQXlFLENBQUE7SUFDekUsMkdBQXlGLENBQUE7SUFDekYscUdBQW1GLENBQUE7SUFDbkYsdURBQXFDLENBQUE7SUFDckMsaUNBQWUsQ0FBQTtJQUNmLHFGQUFtRSxDQUFBO0lBQ25FLCtFQUE2RCxDQUFBO0lBQzdELDJDQUF5QixDQUFBO0lBQ3pCLGlFQUErQyxDQUFBO0lBQy9DLCtEQUE2QyxDQUFBO0lBQzdDLDZGQUEyRSxDQUFBO0lBQzNFLHVFQUFxRCxDQUFBO0lBQ3JELHVHQUFxRixDQUFBO0lBQ3JGLGlGQUErRCxDQUFBO0lBQy9ELCtEQUE2QyxDQUFBO0lBQzdDLHlFQUF1RCxDQUFBO0lBQ3ZELCtEQUE2QyxDQUFBO0lBQzdDLHlDQUF1QixDQUFBO0lBQ3ZCLDJEQUF5QyxDQUFBO0lBQ3pDLHVEQUFxQyxDQUFBO0lBQ3JDLGlFQUErQyxDQUFBO0lBQy9DLGlDQUFlLENBQUE7SUFDZiwyQ0FBeUIsQ0FBQTtJQUN6QixpRUFBK0MsQ0FBQTtJQUMvQywyQ0FBeUIsQ0FBQTtJQUN6QiwyRUFBeUQsQ0FBQTtJQUN6RCxxREFBbUMsQ0FBQTtJQUNuQywyRUFBeUQsQ0FBQTtJQUN6RCxxREFBbUMsQ0FBQTtJQUNuQyxtREFBaUMsQ0FBQTtJQUNqQywrREFBNkMsQ0FBQTtJQUM3QyxpR0FBK0UsQ0FBQTtJQUMvRSwyRkFBeUUsQ0FBQTtJQUN6RSx1RUFBcUQsQ0FBQTtJQUNyRCw2RkFBMkUsQ0FBQTtJQUMzRSwrREFBNkMsQ0FBQTtJQUM3Qyw2REFBMkMsQ0FBQTtJQUMzQywrREFBNkMsQ0FBQTtJQUM3Qyx1Q0FBcUIsQ0FBQTtJQUNyQiwrQ0FBNkIsQ0FBQTtJQUM3Qix5RUFBdUQsQ0FBQTtBQUN6RCxDQUFDLEVBbkZXLGNBQWMsS0FBZCxjQUFjLFFBbUZ6QiJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbmFpLW1vZGVscy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9tb2RlbHMvY2FjaGUvb3BlbmFpLW1vZGVscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSxjQXVGWDtBQXZGRCxXQUFZLGNBQWM7SUFDeEIsaURBQStCLENBQUE7SUFDL0IsdUNBQXFCLENBQUE7SUFDckIsdURBQXFDLENBQUE7SUFDckMsK0NBQTZCLENBQUE7SUFDN0IsaURBQStCLENBQUE7SUFDL0IscUVBQW1ELENBQUE7SUFDbkQscURBQW1DLENBQUE7SUFDbkMsMkVBQXlELENBQUE7SUFDekQsbURBQWlDLENBQUE7SUFDakMsbURBQWlDLENBQUE7SUFDakMseUVBQXVELENBQUE7SUFDdkQsbUZBQWlFLENBQUE7SUFDakUsNkNBQTJCLENBQUE7SUFDM0IsNkNBQTJCLENBQUE7SUFDM0IsaUVBQStDLENBQUE7SUFDL0MsaUVBQStDLENBQUE7SUFDL0MsNkNBQTJCLENBQUE7SUFDM0IsaURBQStCLENBQUE7SUFDL0IsdURBQXFDLENBQUE7SUFDckMseUVBQXVELENBQUE7SUFDdkQseUVBQXVELENBQUE7SUFDdkQsaUVBQStDLENBQUE7SUFDL0MsbUVBQWlELENBQUE7SUFDakQsaUVBQStDLENBQUE7SUFDL0MsbURBQWlDLENBQUE7SUFDakMseUVBQXVELENBQUE7SUFDdkQseUNBQXVCLENBQUE7SUFDdkIsK0RBQTZDLENBQUE7SUFDN0MseUVBQXVELENBQUE7SUFDdkQsbURBQWlDLENBQUE7SUFDakMsK0RBQTZDLENBQUE7SUFDN0MsK0RBQTZDLENBQUE7SUFDN0MsaUVBQStDLENBQUE7SUFDL0MsMkNBQXlCLENBQUE7SUFDekIsaUdBQStFLENBQUE7SUFDL0UsMkZBQXlFLENBQUE7SUFDekUscUVBQW1ELENBQUE7SUFDbkQsMkVBQXlELENBQUE7SUFDekQseUVBQXVELENBQUE7SUFDdkQsaUZBQStELENBQUE7SUFDL0QsaUdBQStFLENBQUE7SUFDL0UsMkZBQXlFLENBQUE7SUFDekUsMkdBQXlGLENBQUE7SUFDekYscUdBQW1GLENBQUE7SUFDbkYsdURBQXFDLENBQUE7SUFDckMsaUNBQWUsQ0FBQTtJQUNmLHFGQUFtRSxDQUFBO0lBQ25FLCtFQUE2RCxDQUFBO0lBQzdELDJDQUF5QixDQUFBO0lBQ3pCLGlFQUErQyxDQUFBO0lBQy9DLCtEQUE2QyxDQUFBO0lBQzdDLDZGQUEyRSxDQUFBO0lBQzNFLHVFQUFxRCxDQUFBO0lBQ3JELHVHQUFxRixDQUFBO0lBQ3JGLGlGQUErRCxDQUFBO0lBQy9ELCtEQUE2QyxDQUFBO0lBQzdDLHlFQUF1RCxDQUFBO0lBQ3ZELCtEQUE2QyxDQUFBO0lBQzdDLHlDQUF1QixDQUFBO0lBQ3ZCLDJEQUF5QyxDQUFBO0lBQ3pDLHVEQUFxQyxDQUFBO0lBQ3JDLGlFQUErQyxDQUFBO0lBQy9DLGlDQUFlLENBQUE7SUFDZiwyQ0FBeUIsQ0FBQTtJQUN6QixpRUFBK0MsQ0FBQTtJQUMvQywyQ0FBeUIsQ0FBQTtJQUN6QiwyRUFBeUQsQ0FBQTtJQUN6RCxxREFBbUMsQ0FBQTtJQUNuQywyRUFBeUQsQ0FBQTtJQUN6RCxxREFBbUMsQ0FBQTtJQUNuQyxtREFBaUMsQ0FBQTtJQUNqQywrREFBNkMsQ0FBQTtJQUM3QyxpR0FBK0UsQ0FBQTtJQUMvRSwyRkFBeUUsQ0FBQTtJQUN6RSx1RUFBcUQsQ0FBQTtJQUNyRCw2RkFBMkUsQ0FBQTtJQUMzRSwrREFBNkMsQ0FBQTtJQUM3Qyw2REFBMkMsQ0FBQTtJQUMzQyx1Q0FBcUIsQ0FBQTtJQUNyQix1RUFBcUQsQ0FBQTtJQUNyRCxpREFBK0IsQ0FBQTtJQUMvQix1RUFBcUQsQ0FBQTtJQUNyRCwrREFBNkMsQ0FBQTtJQUM3Qyx1Q0FBcUIsQ0FBQTtJQUNyQiwrQ0FBNkIsQ0FBQTtJQUM3Qix5RUFBdUQsQ0FBQTtBQUN6RCxDQUFDLEVBdkZXLGNBQWMsS0FBZCxjQUFjLFFBdUZ6QiJ9 \ No newline at end of file diff --git a/packages/kbot/dist-in/models/cache/openrouter-models-free.d.ts b/packages/kbot/dist-in/models/cache/openrouter-models-free.d.ts index c241db07..d2a234ea 100644 --- a/packages/kbot/dist-in/models/cache/openrouter-models-free.d.ts +++ b/packages/kbot/dist-in/models/cache/openrouter-models-free.d.ts @@ -1,6 +1,9 @@ export declare enum E_OPENROUTER_MODEL_FREE { + MODEL_FREE_DEEPSEEK_DEEPSEEK_CHAT_V3_1_FREE = "deepseek/deepseek-chat-v3.1:free", + MODEL_FREE_OPENAI_GPT_OSS_120B_FREE = "openai/gpt-oss-120b:free", MODEL_FREE_OPENAI_GPT_OSS_20B_FREE = "openai/gpt-oss-20b:free", MODEL_FREE_Z_AI_GLM_4_5_AIR_FREE = "z-ai/glm-4.5-air:free", + MODEL_FREE_QWEN_QWEN3_CODER_FREE = "qwen/qwen3-coder:free", MODEL_FREE_MOONSHOTAI_KIMI_K2_FREE = "moonshotai/kimi-k2:free", MODEL_FREE_COGNITIVECOMPUTATIONS_DOLPHIN_MISTRAL_24B_VENICE_EDITION_FREE = "cognitivecomputations/dolphin-mistral-24b-venice-edition:free", MODEL_FREE_GOOGLE_GEMMA_3N_E2B_IT_FREE = "google/gemma-3n-e2b-it:free", @@ -10,9 +13,9 @@ export declare enum E_OPENROUTER_MODEL_FREE { MODEL_FREE_MOONSHOTAI_KIMI_DEV_72B_FREE = "moonshotai/kimi-dev-72b:free", MODEL_FREE_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B_FREE = "deepseek/deepseek-r1-0528-qwen3-8b:free", MODEL_FREE_DEEPSEEK_DEEPSEEK_R1_0528_FREE = "deepseek/deepseek-r1-0528:free", - MODEL_FREE_SARVAMAI_SARVAM_M_FREE = "sarvamai/sarvam-m:free", MODEL_FREE_MISTRALAI_DEVSTRAL_SMALL_2505_FREE = "mistralai/devstral-small-2505:free", MODEL_FREE_GOOGLE_GEMMA_3N_E4B_IT_FREE = "google/gemma-3n-e4b-it:free", + MODEL_FREE_META_LLAMA_LLAMA_3_3_8B_INSTRUCT_FREE = "meta-llama/llama-3.3-8b-instruct:free", MODEL_FREE_QWEN_QWEN3_4B_FREE = "qwen/qwen3-4b:free", MODEL_FREE_QWEN_QWEN3_30B_A3B_FREE = "qwen/qwen3-30b-a3b:free", MODEL_FREE_QWEN_QWEN3_8B_FREE = "qwen/qwen3-8b:free", @@ -20,16 +23,16 @@ export declare enum E_OPENROUTER_MODEL_FREE { MODEL_FREE_QWEN_QWEN3_235B_A22B_FREE = "qwen/qwen3-235b-a22b:free", MODEL_FREE_TNGTECH_DEEPSEEK_R1T_CHIMERA_FREE = "tngtech/deepseek-r1t-chimera:free", MODEL_FREE_MICROSOFT_MAI_DS_R1_FREE = "microsoft/mai-ds-r1:free", - MODEL_FREE_THUDM_GLM_Z1_32B_FREE = "thudm/glm-z1-32b:free", MODEL_FREE_SHISA_AI_SHISA_V2_LLAMA3_3_70B_FREE = "shisa-ai/shisa-v2-llama3.3-70b:free", MODEL_FREE_ARLIAI_QWQ_32B_ARLIAI_RPR_V1_FREE = "arliai/qwq-32b-arliai-rpr-v1:free", MODEL_FREE_AGENTICA_ORG_DEEPCODER_14B_PREVIEW_FREE = "agentica-org/deepcoder-14b-preview:free", MODEL_FREE_MOONSHOTAI_KIMI_VL_A3B_THINKING_FREE = "moonshotai/kimi-vl-a3b-thinking:free", MODEL_FREE_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1_FREE = "nvidia/llama-3.1-nemotron-ultra-253b-v1:free", + MODEL_FREE_META_LLAMA_LLAMA_4_MAVERICK_FREE = "meta-llama/llama-4-maverick:free", + MODEL_FREE_META_LLAMA_LLAMA_4_SCOUT_FREE = "meta-llama/llama-4-scout:free", MODEL_FREE_GOOGLE_GEMINI_2_5_PRO_EXP_03_25 = "google/gemini-2.5-pro-exp-03-25", MODEL_FREE_QWEN_QWEN2_5_VL_32B_INSTRUCT_FREE = "qwen/qwen2.5-vl-32b-instruct:free", MODEL_FREE_DEEPSEEK_DEEPSEEK_CHAT_V3_0324_FREE = "deepseek/deepseek-chat-v3-0324:free", - MODEL_FREE_FEATHERLESS_QWERKY_72B_FREE = "featherless/qwerky-72b:free", MODEL_FREE_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT_FREE = "mistralai/mistral-small-3.1-24b-instruct:free", MODEL_FREE_GOOGLE_GEMMA_3_4B_IT_FREE = "google/gemma-3-4b-it:free", MODEL_FREE_GOOGLE_GEMMA_3_12B_IT_FREE = "google/gemma-3-12b-it:free", @@ -48,7 +51,6 @@ export declare enum E_OPENROUTER_MODEL_FREE { MODEL_FREE_META_LLAMA_LLAMA_3_3_70B_INSTRUCT_FREE = "meta-llama/llama-3.3-70b-instruct:free", MODEL_FREE_QWEN_QWEN_2_5_CODER_32B_INSTRUCT_FREE = "qwen/qwen-2.5-coder-32b-instruct:free", MODEL_FREE_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE = "meta-llama/llama-3.2-3b-instruct:free", - MODEL_FREE_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT_FREE = "meta-llama/llama-3.2-11b-vision-instruct:free", MODEL_FREE_QWEN_QWEN_2_5_72B_INSTRUCT_FREE = "qwen/qwen-2.5-72b-instruct:free", MODEL_FREE_META_LLAMA_LLAMA_3_1_405B_INSTRUCT_FREE = "meta-llama/llama-3.1-405b-instruct:free", MODEL_FREE_MISTRALAI_MISTRAL_NEMO_FREE = "mistralai/mistral-nemo:free", diff --git a/packages/kbot/dist-in/models/cache/openrouter-models-free.js b/packages/kbot/dist-in/models/cache/openrouter-models-free.js index 83a8ca90..e48745be 100644 --- a/packages/kbot/dist-in/models/cache/openrouter-models-free.js +++ b/packages/kbot/dist-in/models/cache/openrouter-models-free.js @@ -1,7 +1,10 @@ export var E_OPENROUTER_MODEL_FREE; (function (E_OPENROUTER_MODEL_FREE) { + E_OPENROUTER_MODEL_FREE["MODEL_FREE_DEEPSEEK_DEEPSEEK_CHAT_V3_1_FREE"] = "deepseek/deepseek-chat-v3.1:free"; + E_OPENROUTER_MODEL_FREE["MODEL_FREE_OPENAI_GPT_OSS_120B_FREE"] = "openai/gpt-oss-120b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_OPENAI_GPT_OSS_20B_FREE"] = "openai/gpt-oss-20b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_Z_AI_GLM_4_5_AIR_FREE"] = "z-ai/glm-4.5-air:free"; + E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN3_CODER_FREE"] = "qwen/qwen3-coder:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MOONSHOTAI_KIMI_K2_FREE"] = "moonshotai/kimi-k2:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_COGNITIVECOMPUTATIONS_DOLPHIN_MISTRAL_24B_VENICE_EDITION_FREE"] = "cognitivecomputations/dolphin-mistral-24b-venice-edition:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMMA_3N_E2B_IT_FREE"] = "google/gemma-3n-e2b-it:free"; @@ -11,9 +14,9 @@ export var E_OPENROUTER_MODEL_FREE; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MOONSHOTAI_KIMI_DEV_72B_FREE"] = "moonshotai/kimi-dev-72b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B_FREE"] = "deepseek/deepseek-r1-0528-qwen3-8b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_DEEPSEEK_DEEPSEEK_R1_0528_FREE"] = "deepseek/deepseek-r1-0528:free"; - E_OPENROUTER_MODEL_FREE["MODEL_FREE_SARVAMAI_SARVAM_M_FREE"] = "sarvamai/sarvam-m:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MISTRALAI_DEVSTRAL_SMALL_2505_FREE"] = "mistralai/devstral-small-2505:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMMA_3N_E4B_IT_FREE"] = "google/gemma-3n-e4b-it:free"; + E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_3_3_8B_INSTRUCT_FREE"] = "meta-llama/llama-3.3-8b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN3_4B_FREE"] = "qwen/qwen3-4b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN3_30B_A3B_FREE"] = "qwen/qwen3-30b-a3b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN3_8B_FREE"] = "qwen/qwen3-8b:free"; @@ -21,16 +24,16 @@ export var E_OPENROUTER_MODEL_FREE; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN3_235B_A22B_FREE"] = "qwen/qwen3-235b-a22b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_TNGTECH_DEEPSEEK_R1T_CHIMERA_FREE"] = "tngtech/deepseek-r1t-chimera:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MICROSOFT_MAI_DS_R1_FREE"] = "microsoft/mai-ds-r1:free"; - E_OPENROUTER_MODEL_FREE["MODEL_FREE_THUDM_GLM_Z1_32B_FREE"] = "thudm/glm-z1-32b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_SHISA_AI_SHISA_V2_LLAMA3_3_70B_FREE"] = "shisa-ai/shisa-v2-llama3.3-70b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_ARLIAI_QWQ_32B_ARLIAI_RPR_V1_FREE"] = "arliai/qwq-32b-arliai-rpr-v1:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_AGENTICA_ORG_DEEPCODER_14B_PREVIEW_FREE"] = "agentica-org/deepcoder-14b-preview:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MOONSHOTAI_KIMI_VL_A3B_THINKING_FREE"] = "moonshotai/kimi-vl-a3b-thinking:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1_FREE"] = "nvidia/llama-3.1-nemotron-ultra-253b-v1:free"; + E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_4_MAVERICK_FREE"] = "meta-llama/llama-4-maverick:free"; + E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_4_SCOUT_FREE"] = "meta-llama/llama-4-scout:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMINI_2_5_PRO_EXP_03_25"] = "google/gemini-2.5-pro-exp-03-25"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN2_5_VL_32B_INSTRUCT_FREE"] = "qwen/qwen2.5-vl-32b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_DEEPSEEK_DEEPSEEK_CHAT_V3_0324_FREE"] = "deepseek/deepseek-chat-v3-0324:free"; - E_OPENROUTER_MODEL_FREE["MODEL_FREE_FEATHERLESS_QWERKY_72B_FREE"] = "featherless/qwerky-72b:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT_FREE"] = "mistralai/mistral-small-3.1-24b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMMA_3_4B_IT_FREE"] = "google/gemma-3-4b-it:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMMA_3_12B_IT_FREE"] = "google/gemma-3-12b-it:free"; @@ -49,11 +52,10 @@ export var E_OPENROUTER_MODEL_FREE; E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_3_3_70B_INSTRUCT_FREE"] = "meta-llama/llama-3.3-70b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN_2_5_CODER_32B_INSTRUCT_FREE"] = "qwen/qwen-2.5-coder-32b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE"] = "meta-llama/llama-3.2-3b-instruct:free"; - E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT_FREE"] = "meta-llama/llama-3.2-11b-vision-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_QWEN_QWEN_2_5_72B_INSTRUCT_FREE"] = "qwen/qwen-2.5-72b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_META_LLAMA_LLAMA_3_1_405B_INSTRUCT_FREE"] = "meta-llama/llama-3.1-405b-instruct:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MISTRALAI_MISTRAL_NEMO_FREE"] = "mistralai/mistral-nemo:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_GOOGLE_GEMMA_2_9B_IT_FREE"] = "google/gemma-2-9b-it:free"; E_OPENROUTER_MODEL_FREE["MODEL_FREE_MISTRALAI_MISTRAL_7B_INSTRUCT_FREE"] = "mistralai/mistral-7b-instruct:free"; })(E_OPENROUTER_MODEL_FREE || (E_OPENROUTER_MODEL_FREE = {})); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbnJvdXRlci1tb2RlbHMtZnJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9tb2RlbHMvY2FjaGUvb3BlbnJvdXRlci1tb2RlbHMtZnJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSx1QkF3RFg7QUF4REQsV0FBWSx1QkFBdUI7SUFDakMseUZBQThELENBQUE7SUFDOUQscUZBQTBELENBQUE7SUFDMUQseUZBQThELENBQUE7SUFDOUQscUtBQTBJLENBQUE7SUFDMUksaUdBQXNFLENBQUE7SUFDdEUsK0dBQW9GLENBQUE7SUFDcEYsK0dBQW9GLENBQUE7SUFDcEYscUlBQTBHLENBQUE7SUFDMUcsbUdBQXdFLENBQUE7SUFDeEUseUhBQThGLENBQUE7SUFDOUYsdUdBQTRFLENBQUE7SUFDNUUsdUZBQTRELENBQUE7SUFDNUQsK0dBQW9GLENBQUE7SUFDcEYsaUdBQXNFLENBQUE7SUFDdEUsK0VBQW9ELENBQUE7SUFDcEQseUZBQThELENBQUE7SUFDOUQsK0VBQW9ELENBQUE7SUFDcEQsaUZBQXNELENBQUE7SUFDdEQsNkZBQWtFLENBQUE7SUFDbEUsNkdBQWtGLENBQUE7SUFDbEYsMkZBQWdFLENBQUE7SUFDaEUscUZBQTBELENBQUE7SUFDMUQsaUhBQXNGLENBQUE7SUFDdEYsNkdBQWtGLENBQUE7SUFDbEYseUhBQThGLENBQUE7SUFDOUYsbUhBQXdGLENBQUE7SUFDeEYsbUlBQXdHLENBQUE7SUFDeEcseUdBQThFLENBQUE7SUFDOUUsNkdBQWtGLENBQUE7SUFDbEYsaUhBQXNGLENBQUE7SUFDdEYsaUdBQXNFLENBQUE7SUFDdEUscUlBQTBHLENBQUE7SUFDMUcsNkZBQWtFLENBQUE7SUFDbEUsK0ZBQW9FLENBQUE7SUFDcEUsMkZBQWdFLENBQUE7SUFDaEUsK0ZBQW9FLENBQUE7SUFDcEUsNkVBQWtELENBQUE7SUFDbEQsNklBQWtILENBQUE7SUFDbEgsbUpBQXdILENBQUE7SUFDeEgsNklBQWtILENBQUE7SUFDbEgsNkdBQWtGLENBQUE7SUFDbEYsdUlBQTRHLENBQUE7SUFDNUcsK0hBQW9HLENBQUE7SUFDcEcsaUlBQXNHLENBQUE7SUFDdEcsNkZBQWtFLENBQUE7SUFDbEUsMkdBQWdGLENBQUE7SUFDaEYsdUhBQTRGLENBQUE7SUFDNUYscUhBQTBGLENBQUE7SUFDMUYscUhBQTBGLENBQUE7SUFDMUYscUlBQTBHLENBQUE7SUFDMUcseUdBQThFLENBQUE7SUFDOUUseUhBQThGLENBQUE7SUFDOUYsaUdBQXNFLENBQUE7SUFDdEUsNkZBQWtFLENBQUE7SUFDbEUsK0dBQW9GLENBQUE7QUFDdEYsQ0FBQyxFQXhEVyx1QkFBdUIsS0FBdkIsdUJBQXVCLFFBd0RsQyJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbnJvdXRlci1tb2RlbHMtZnJlZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9tb2RlbHMvY2FjaGUvb3BlbnJvdXRlci1tb2RlbHMtZnJlZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxNQUFNLENBQU4sSUFBWSx1QkEwRFg7QUExREQsV0FBWSx1QkFBdUI7SUFDakMsMkdBQWdGLENBQUE7SUFDaEYsMkZBQWdFLENBQUE7SUFDaEUseUZBQThELENBQUE7SUFDOUQscUZBQTBELENBQUE7SUFDMUQscUZBQTBELENBQUE7SUFDMUQseUZBQThELENBQUE7SUFDOUQscUtBQTBJLENBQUE7SUFDMUksaUdBQXNFLENBQUE7SUFDdEUsK0dBQW9GLENBQUE7SUFDcEYsK0dBQW9GLENBQUE7SUFDcEYscUlBQTBHLENBQUE7SUFDMUcsbUdBQXdFLENBQUE7SUFDeEUseUhBQThGLENBQUE7SUFDOUYsdUdBQTRFLENBQUE7SUFDNUUsK0dBQW9GLENBQUE7SUFDcEYsaUdBQXNFLENBQUE7SUFDdEUscUhBQTBGLENBQUE7SUFDMUYsK0VBQW9ELENBQUE7SUFDcEQseUZBQThELENBQUE7SUFDOUQsK0VBQW9ELENBQUE7SUFDcEQsaUZBQXNELENBQUE7SUFDdEQsNkZBQWtFLENBQUE7SUFDbEUsNkdBQWtGLENBQUE7SUFDbEYsMkZBQWdFLENBQUE7SUFDaEUsaUhBQXNGLENBQUE7SUFDdEYsNkdBQWtGLENBQUE7SUFDbEYseUhBQThGLENBQUE7SUFDOUYsbUhBQXdGLENBQUE7SUFDeEYsbUlBQXdHLENBQUE7SUFDeEcsMkdBQWdGLENBQUE7SUFDaEYscUdBQTBFLENBQUE7SUFDMUUseUdBQThFLENBQUE7SUFDOUUsNkdBQWtGLENBQUE7SUFDbEYsaUhBQXNGLENBQUE7SUFDdEYscUlBQTBHLENBQUE7SUFDMUcsNkZBQWtFLENBQUE7SUFDbEUsK0ZBQW9FLENBQUE7SUFDcEUsMkZBQWdFLENBQUE7SUFDaEUsK0ZBQW9FLENBQUE7SUFDcEUsNkVBQWtELENBQUE7SUFDbEQsNklBQWtILENBQUE7SUFDbEgsbUpBQXdILENBQUE7SUFDeEgsNklBQWtILENBQUE7SUFDbEgsNkdBQWtGLENBQUE7SUFDbEYsdUlBQTRHLENBQUE7SUFDNUcsK0hBQW9HLENBQUE7SUFDcEcsaUlBQXNHLENBQUE7SUFDdEcsNkZBQWtFLENBQUE7SUFDbEUsMkdBQWdGLENBQUE7SUFDaEYsdUhBQTRGLENBQUE7SUFDNUYscUhBQTBGLENBQUE7SUFDMUYscUhBQTBGLENBQUE7SUFDMUYseUdBQThFLENBQUE7SUFDOUUseUhBQThGLENBQUE7SUFDOUYsaUdBQXNFLENBQUE7SUFDdEUsNkZBQWtFLENBQUE7SUFDbEUsK0dBQW9GLENBQUE7QUFDdEYsQ0FBQyxFQTFEVyx1QkFBdUIsS0FBdkIsdUJBQXVCLFFBMERsQyJ9 \ No newline at end of file diff --git a/packages/kbot/dist-in/models/cache/openrouter-models.d.ts b/packages/kbot/dist-in/models/cache/openrouter-models.d.ts index ad3956ce..6ceeef57 100644 --- a/packages/kbot/dist-in/models/cache/openrouter-models.d.ts +++ b/packages/kbot/dist-in/models/cache/openrouter-models.d.ts @@ -1,19 +1,39 @@ export declare enum E_OPENROUTER_MODEL { + MODEL_DEEPCOGITO_COGITO_V2_PREVIEW_LLAMA_109B_MOE = "deepcogito/cogito-v2-preview-llama-109b-moe", + MODEL_DEEPCOGITO_COGITO_V2_PREVIEW_DEEPSEEK_671B = "deepcogito/cogito-v2-preview-deepseek-671b", + MODEL_QWEN_QWEN3_30B_A3B_THINKING_2507 = "qwen/qwen3-30b-a3b-thinking-2507", + MODEL_X_AI_GROK_CODE_FAST_1 = "x-ai/grok-code-fast-1", + MODEL_NOUSRESEARCH_HERMES_4_70B = "nousresearch/hermes-4-70b", + MODEL_NOUSRESEARCH_HERMES_4_405B = "nousresearch/hermes-4-405b", + MODEL_GOOGLE_GEMINI_2_5_FLASH_IMAGE_PREVIEW = "google/gemini-2.5-flash-image-preview", + MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_1_FREE = "deepseek/deepseek-chat-v3.1:free", + MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_1 = "deepseek/deepseek-chat-v3.1", + MODEL_DEEPSEEK_DEEPSEEK_V3_1_BASE = "deepseek/deepseek-v3.1-base", + MODEL_OPENAI_GPT_4O_AUDIO_PREVIEW = "openai/gpt-4o-audio-preview", + MODEL_MISTRALAI_MISTRAL_MEDIUM_3_1 = "mistralai/mistral-medium-3.1", + MODEL_BAIDU_ERNIE_4_5_21B_A3B = "baidu/ernie-4.5-21b-a3b", + MODEL_BAIDU_ERNIE_4_5_VL_28B_A3B = "baidu/ernie-4.5-vl-28b-a3b", + MODEL_Z_AI_GLM_4_5V = "z-ai/glm-4.5v", + MODEL_AI21_JAMBA_MINI_1_7 = "ai21/jamba-mini-1.7", + MODEL_AI21_JAMBA_LARGE_1_7 = "ai21/jamba-large-1.7", MODEL_OPENAI_GPT_5_CHAT = "openai/gpt-5-chat", MODEL_OPENAI_GPT_5 = "openai/gpt-5", MODEL_OPENAI_GPT_5_MINI = "openai/gpt-5-mini", MODEL_OPENAI_GPT_5_NANO = "openai/gpt-5-nano", + MODEL_OPENAI_GPT_OSS_120B_FREE = "openai/gpt-oss-120b:free", MODEL_OPENAI_GPT_OSS_120B = "openai/gpt-oss-120b", MODEL_OPENAI_GPT_OSS_20B_FREE = "openai/gpt-oss-20b:free", MODEL_OPENAI_GPT_OSS_20B = "openai/gpt-oss-20b", MODEL_ANTHROPIC_CLAUDE_OPUS_4_1 = "anthropic/claude-opus-4.1", MODEL_MISTRALAI_CODESTRAL_2508 = "mistralai/codestral-2508", + MODEL_QWEN_QWEN3_CODER_30B_A3B_INSTRUCT = "qwen/qwen3-coder-30b-a3b-instruct", MODEL_QWEN_QWEN3_30B_A3B_INSTRUCT_2507 = "qwen/qwen3-30b-a3b-instruct-2507", MODEL_Z_AI_GLM_4_5 = "z-ai/glm-4.5", MODEL_Z_AI_GLM_4_5_AIR_FREE = "z-ai/glm-4.5-air:free", MODEL_Z_AI_GLM_4_5_AIR = "z-ai/glm-4.5-air", MODEL_QWEN_QWEN3_235B_A22B_THINKING_2507 = "qwen/qwen3-235b-a22b-thinking-2507", MODEL_Z_AI_GLM_4_32B = "z-ai/glm-4-32b", + MODEL_QWEN_QWEN3_CODER_FREE = "qwen/qwen3-coder:free", MODEL_QWEN_QWEN3_CODER = "qwen/qwen3-coder", MODEL_BYTEDANCE_UI_TARS_1_5_7B = "bytedance/ui-tars-1.5-7b", MODEL_GOOGLE_GEMINI_2_5_FLASH_LITE = "google/gemini-2.5-flash-lite", @@ -32,6 +52,7 @@ export declare enum E_OPENROUTER_MODEL { MODEL_TNGTECH_DEEPSEEK_R1T2_CHIMERA_FREE = "tngtech/deepseek-r1t2-chimera:free", MODEL_MORPH_MORPH_V3_LARGE = "morph/morph-v3-large", MODEL_MORPH_MORPH_V3_FAST = "morph/morph-v3-fast", + MODEL_BAIDU_ERNIE_4_5_VL_424B_A47B = "baidu/ernie-4.5-vl-424b-a47b", MODEL_BAIDU_ERNIE_4_5_300B_A47B = "baidu/ernie-4.5-300b-a47b", MODEL_THEDRUMMER_ANUBIS_70B_V1_1 = "thedrummer/anubis-70b-v1.1", MODEL_INCEPTION_MERCURY = "inception/mercury", @@ -42,6 +63,7 @@ export declare enum E_OPENROUTER_MODEL { MODEL_GOOGLE_GEMINI_2_5_FLASH = "google/gemini-2.5-flash", MODEL_GOOGLE_GEMINI_2_5_PRO = "google/gemini-2.5-pro", MODEL_MOONSHOTAI_KIMI_DEV_72B_FREE = "moonshotai/kimi-dev-72b:free", + MODEL_MOONSHOTAI_KIMI_DEV_72B = "moonshotai/kimi-dev-72b", MODEL_OPENAI_O3_PRO = "openai/o3-pro", MODEL_X_AI_GROK_3_MINI = "x-ai/grok-3-mini", MODEL_X_AI_GROK_3 = "x-ai/grok-3", @@ -49,13 +71,10 @@ export declare enum E_OPENROUTER_MODEL { MODEL_MISTRALAI_MAGISTRAL_MEDIUM_2506 = "mistralai/magistral-medium-2506", MODEL_MISTRALAI_MAGISTRAL_MEDIUM_2506_THINKING = "mistralai/magistral-medium-2506:thinking", MODEL_GOOGLE_GEMINI_2_5_PRO_PREVIEW = "google/gemini-2.5-pro-preview", - MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_7B = "deepseek/deepseek-r1-distill-qwen-7b", MODEL_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B_FREE = "deepseek/deepseek-r1-0528-qwen3-8b:free", MODEL_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B = "deepseek/deepseek-r1-0528-qwen3-8b", MODEL_DEEPSEEK_DEEPSEEK_R1_0528_FREE = "deepseek/deepseek-r1-0528:free", MODEL_DEEPSEEK_DEEPSEEK_R1_0528 = "deepseek/deepseek-r1-0528", - MODEL_SARVAMAI_SARVAM_M_FREE = "sarvamai/sarvam-m:free", - MODEL_THEDRUMMER_VALKYRIE_49B_V1 = "thedrummer/valkyrie-49b-v1", MODEL_ANTHROPIC_CLAUDE_OPUS_4 = "anthropic/claude-opus-4", MODEL_ANTHROPIC_CLAUDE_SONNET_4 = "anthropic/claude-sonnet-4", MODEL_MISTRALAI_DEVSTRAL_SMALL_2505_FREE = "mistralai/devstral-small-2505:free", @@ -63,6 +82,7 @@ export declare enum E_OPENROUTER_MODEL { MODEL_GOOGLE_GEMMA_3N_E4B_IT_FREE = "google/gemma-3n-e4b-it:free", MODEL_GOOGLE_GEMMA_3N_E4B_IT = "google/gemma-3n-e4b-it", MODEL_OPENAI_CODEX_MINI = "openai/codex-mini", + MODEL_META_LLAMA_LLAMA_3_3_8B_INSTRUCT_FREE = "meta-llama/llama-3.3-8b-instruct:free", MODEL_NOUSRESEARCH_DEEPHERMES_3_MISTRAL_24B_PREVIEW = "nousresearch/deephermes-3-mistral-24b-preview", MODEL_MISTRALAI_MISTRAL_MEDIUM_3 = "mistralai/mistral-medium-3", MODEL_GOOGLE_GEMINI_2_5_PRO_PREVIEW_05_06 = "google/gemini-2.5-pro-preview-05-06", @@ -73,7 +93,6 @@ export declare enum E_OPENROUTER_MODEL { MODEL_MICROSOFT_PHI_4_REASONING_PLUS = "microsoft/phi-4-reasoning-plus", MODEL_INCEPTION_MERCURY_CODER = "inception/mercury-coder", MODEL_QWEN_QWEN3_4B_FREE = "qwen/qwen3-4b:free", - MODEL_OPENGVLAB_INTERNVL3_14B = "opengvlab/internvl3-14b", MODEL_DEEPSEEK_DEEPSEEK_PROVER_V2 = "deepseek/deepseek-prover-v2", MODEL_META_LLAMA_LLAMA_GUARD_4_12B = "meta-llama/llama-guard-4-12b", MODEL_QWEN_QWEN3_30B_A3B_FREE = "qwen/qwen3-30b-a3b:free", @@ -89,7 +108,7 @@ export declare enum E_OPENROUTER_MODEL { MODEL_TNGTECH_DEEPSEEK_R1T_CHIMERA = "tngtech/deepseek-r1t-chimera", MODEL_MICROSOFT_MAI_DS_R1_FREE = "microsoft/mai-ds-r1:free", MODEL_MICROSOFT_MAI_DS_R1 = "microsoft/mai-ds-r1", - MODEL_THUDM_GLM_Z1_32B_FREE = "thudm/glm-z1-32b:free", + MODEL_THUDM_GLM_Z1_32B = "thudm/glm-z1-32b", MODEL_THUDM_GLM_4_32B = "thudm/glm-4-32b", MODEL_OPENAI_O4_MINI_HIGH = "openai/o4-mini-high", MODEL_OPENAI_O3 = "openai/o3", @@ -112,16 +131,15 @@ export declare enum E_OPENROUTER_MODEL { MODEL_NVIDIA_LLAMA_3_3_NEMOTRON_SUPER_49B_V1 = "nvidia/llama-3.3-nemotron-super-49b-v1", MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1_FREE = "nvidia/llama-3.1-nemotron-ultra-253b-v1:free", MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1 = "nvidia/llama-3.1-nemotron-ultra-253b-v1", + MODEL_META_LLAMA_LLAMA_4_MAVERICK_FREE = "meta-llama/llama-4-maverick:free", MODEL_META_LLAMA_LLAMA_4_MAVERICK = "meta-llama/llama-4-maverick", + MODEL_META_LLAMA_LLAMA_4_SCOUT_FREE = "meta-llama/llama-4-scout:free", MODEL_META_LLAMA_LLAMA_4_SCOUT = "meta-llama/llama-4-scout", - MODEL_DEEPSEEK_DEEPSEEK_V3_BASE = "deepseek/deepseek-v3-base", - MODEL_SCB10X_LLAMA3_1_TYPHOON2_70B_INSTRUCT = "scb10x/llama3.1-typhoon2-70b-instruct", MODEL_GOOGLE_GEMINI_2_5_PRO_EXP_03_25 = "google/gemini-2.5-pro-exp-03-25", MODEL_QWEN_QWEN2_5_VL_32B_INSTRUCT_FREE = "qwen/qwen2.5-vl-32b-instruct:free", MODEL_QWEN_QWEN2_5_VL_32B_INSTRUCT = "qwen/qwen2.5-vl-32b-instruct", MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_0324_FREE = "deepseek/deepseek-chat-v3-0324:free", MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_0324 = "deepseek/deepseek-chat-v3-0324", - MODEL_FEATHERLESS_QWERKY_72B_FREE = "featherless/qwerky-72b:free", MODEL_OPENAI_O1_PRO = "openai/o1-pro", MODEL_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT_FREE = "mistralai/mistral-small-3.1-24b-instruct:free", MODEL_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT = "mistralai/mistral-small-3.1-24b-instruct", @@ -147,7 +165,6 @@ export declare enum E_OPENROUTER_MODEL { MODEL_GOOGLE_GEMINI_2_0_FLASH_LITE_001 = "google/gemini-2.0-flash-lite-001", MODEL_ANTHROPIC_CLAUDE_3_7_SONNET = "anthropic/claude-3.7-sonnet", MODEL_ANTHROPIC_CLAUDE_3_7_SONNET_THINKING = "anthropic/claude-3.7-sonnet:thinking", - MODEL_ANTHROPIC_CLAUDE_3_7_SONNET_BETA = "anthropic/claude-3.7-sonnet:beta", MODEL_PERPLEXITY_R1_1776 = "perplexity/r1-1776", MODEL_MISTRALAI_MISTRAL_SABA = "mistralai/mistral-saba", MODEL_COGNITIVECOMPUTATIONS_DOLPHIN3_0_R1_MISTRAL_24B_FREE = "cognitivecomputations/dolphin3.0-r1-mistral-24b:free", @@ -169,7 +186,6 @@ export declare enum E_OPENROUTER_MODEL { MODEL_QWEN_QWEN_PLUS = "qwen/qwen-plus", MODEL_QWEN_QWEN_MAX = "qwen/qwen-max", MODEL_OPENAI_O3_MINI = "openai/o3-mini", - MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_1_5B = "deepseek/deepseek-r1-distill-qwen-1.5b", MODEL_MISTRALAI_MISTRAL_SMALL_24B_INSTRUCT_2501_FREE = "mistralai/mistral-small-24b-instruct-2501:free", MODEL_MISTRALAI_MISTRAL_SMALL_24B_INSTRUCT_2501 = "mistralai/mistral-small-24b-instruct-2501", MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_32B = "deepseek/deepseek-r1-distill-qwen-32b", @@ -210,35 +226,31 @@ export declare enum E_OPENROUTER_MODEL { MODEL_RAIFLE_SORCERERLM_8X22B = "raifle/sorcererlm-8x22b", MODEL_THEDRUMMER_UNSLOPNEMO_12B = "thedrummer/unslopnemo-12b", MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU_20241022 = "anthropic/claude-3.5-haiku-20241022", - MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU_BETA = "anthropic/claude-3.5-haiku:beta", MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU = "anthropic/claude-3.5-haiku", MODEL_ANTHRACITE_ORG_MAGNUM_V4_72B = "anthracite-org/magnum-v4-72b", - MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_BETA = "anthropic/claude-3.5-sonnet:beta", MODEL_ANTHROPIC_CLAUDE_3_5_SONNET = "anthropic/claude-3.5-sonnet", - MODEL_MISTRALAI_MINISTRAL_8B = "mistralai/ministral-8b", MODEL_MISTRALAI_MINISTRAL_3B = "mistralai/ministral-3b", + MODEL_MISTRALAI_MINISTRAL_8B = "mistralai/ministral-8b", MODEL_QWEN_QWEN_2_5_7B_INSTRUCT = "qwen/qwen-2.5-7b-instruct", MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_70B_INSTRUCT = "nvidia/llama-3.1-nemotron-70b-instruct", MODEL_INFLECTION_INFLECTION_3_PRODUCTIVITY = "inflection/inflection-3-productivity", MODEL_INFLECTION_INFLECTION_3_PI = "inflection/inflection-3-pi", MODEL_GOOGLE_GEMINI_FLASH_1_5_8B = "google/gemini-flash-1.5-8b", - MODEL_THEDRUMMER_ROCINANTE_12B = "thedrummer/rocinante-12b", - MODEL_LIQUID_LFM_40B = "liquid/lfm-40b", MODEL_ANTHRACITE_ORG_MAGNUM_V2_72B = "anthracite-org/magnum-v2-72b", - MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE = "meta-llama/llama-3.2-3b-instruct:free", - MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT = "meta-llama/llama-3.2-3b-instruct", - MODEL_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT_FREE = "meta-llama/llama-3.2-11b-vision-instruct:free", + MODEL_THEDRUMMER_ROCINANTE_12B = "thedrummer/rocinante-12b", MODEL_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT = "meta-llama/llama-3.2-11b-vision-instruct", MODEL_META_LLAMA_LLAMA_3_2_90B_VISION_INSTRUCT = "meta-llama/llama-3.2-90b-vision-instruct", MODEL_META_LLAMA_LLAMA_3_2_1B_INSTRUCT = "meta-llama/llama-3.2-1b-instruct", + MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE = "meta-llama/llama-3.2-3b-instruct:free", + MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT = "meta-llama/llama-3.2-3b-instruct", MODEL_QWEN_QWEN_2_5_72B_INSTRUCT_FREE = "qwen/qwen-2.5-72b-instruct:free", MODEL_QWEN_QWEN_2_5_72B_INSTRUCT = "qwen/qwen-2.5-72b-instruct", MODEL_NEVERSLEEP_LLAMA_3_1_LUMIMAID_8B = "neversleep/llama-3.1-lumimaid-8b", - MODEL_OPENAI_O1_MINI = "openai/o1-mini", MODEL_OPENAI_O1_MINI_2024_09_12 = "openai/o1-mini-2024-09-12", + MODEL_OPENAI_O1_MINI = "openai/o1-mini", MODEL_MISTRALAI_PIXTRAL_12B = "mistralai/pixtral-12b", - MODEL_COHERE_COMMAND_R_PLUS_08_2024 = "cohere/command-r-plus-08-2024", MODEL_COHERE_COMMAND_R_08_2024 = "cohere/command-r-08-2024", + MODEL_COHERE_COMMAND_R_PLUS_08_2024 = "cohere/command-r-plus-08-2024", MODEL_SAO10K_L3_1_EURYALE_70B = "sao10k/l3.1-euryale-70b", MODEL_QWEN_QWEN_2_5_VL_7B_INSTRUCT = "qwen/qwen-2.5-vl-7b-instruct", MODEL_MICROSOFT_PHI_3_5_MINI_128K_INSTRUCT = "microsoft/phi-3.5-mini-128k-instruct", @@ -254,20 +266,18 @@ export declare enum E_OPENROUTER_MODEL { MODEL_META_LLAMA_LLAMA_3_1_70B_INSTRUCT = "meta-llama/llama-3.1-70b-instruct", MODEL_MISTRALAI_MISTRAL_NEMO_FREE = "mistralai/mistral-nemo:free", MODEL_MISTRALAI_MISTRAL_NEMO = "mistralai/mistral-nemo", - MODEL_OPENAI_GPT_4O_MINI = "openai/gpt-4o-mini", MODEL_OPENAI_GPT_4O_MINI_2024_07_18 = "openai/gpt-4o-mini-2024-07-18", + MODEL_OPENAI_GPT_4O_MINI = "openai/gpt-4o-mini", MODEL_GOOGLE_GEMMA_2_27B_IT = "google/gemma-2-27b-it", MODEL_GOOGLE_GEMMA_2_9B_IT_FREE = "google/gemma-2-9b-it:free", MODEL_GOOGLE_GEMMA_2_9B_IT = "google/gemma-2-9b-it", - MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_20240620_BETA = "anthropic/claude-3.5-sonnet-20240620:beta", MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_20240620 = "anthropic/claude-3.5-sonnet-20240620", MODEL_SAO10K_L3_EURYALE_70B = "sao10k/l3-euryale-70b", MODEL_COGNITIVECOMPUTATIONS_DOLPHIN_MIXTRAL_8X22B = "cognitivecomputations/dolphin-mixtral-8x22b", - MODEL_QWEN_QWEN_2_72B_INSTRUCT = "qwen/qwen-2-72b-instruct", - MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_3 = "mistralai/mistral-7b-instruct-v0.3", + MODEL_NOUSRESEARCH_HERMES_2_PRO_LLAMA_3_8B = "nousresearch/hermes-2-pro-llama-3-8b", MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_FREE = "mistralai/mistral-7b-instruct:free", MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT = "mistralai/mistral-7b-instruct", - MODEL_NOUSRESEARCH_HERMES_2_PRO_LLAMA_3_8B = "nousresearch/hermes-2-pro-llama-3-8b", + MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_3 = "mistralai/mistral-7b-instruct-v0.3", MODEL_MICROSOFT_PHI_3_MINI_128K_INSTRUCT = "microsoft/phi-3-mini-128k-instruct", MODEL_MICROSOFT_PHI_3_MEDIUM_128K_INSTRUCT = "microsoft/phi-3-medium-128k-instruct", MODEL_NEVERSLEEP_LLAMA_3_LUMIMAID_70B = "neversleep/llama-3-lumimaid-70b", @@ -280,38 +290,34 @@ export declare enum E_OPENROUTER_MODEL { MODEL_META_LLAMA_LLAMA_3_8B_INSTRUCT = "meta-llama/llama-3-8b-instruct", MODEL_MISTRALAI_MIXTRAL_8X22B_INSTRUCT = "mistralai/mixtral-8x22b-instruct", MODEL_MICROSOFT_WIZARDLM_2_8X22B = "microsoft/wizardlm-2-8x22b", - MODEL_OPENAI_GPT_4_TURBO = "openai/gpt-4-turbo", MODEL_GOOGLE_GEMINI_PRO_1_5 = "google/gemini-pro-1.5", + MODEL_OPENAI_GPT_4_TURBO = "openai/gpt-4-turbo", MODEL_COHERE_COMMAND_R_PLUS = "cohere/command-r-plus", MODEL_COHERE_COMMAND_R_PLUS_04_2024 = "cohere/command-r-plus-04-2024", MODEL_SOPHOSYMPATHEIA_MIDNIGHT_ROSE_70B = "sophosympatheia/midnight-rose-70b", MODEL_COHERE_COMMAND_R = "cohere/command-r", MODEL_COHERE_COMMAND = "cohere/command", - MODEL_ANTHROPIC_CLAUDE_3_HAIKU_BETA = "anthropic/claude-3-haiku:beta", MODEL_ANTHROPIC_CLAUDE_3_HAIKU = "anthropic/claude-3-haiku", - MODEL_ANTHROPIC_CLAUDE_3_OPUS_BETA = "anthropic/claude-3-opus:beta", MODEL_ANTHROPIC_CLAUDE_3_OPUS = "anthropic/claude-3-opus", MODEL_COHERE_COMMAND_R_03_2024 = "cohere/command-r-03-2024", MODEL_MISTRALAI_MISTRAL_LARGE = "mistralai/mistral-large", - MODEL_OPENAI_GPT_3_5_TURBO_0613 = "openai/gpt-3.5-turbo-0613", MODEL_OPENAI_GPT_4_TURBO_PREVIEW = "openai/gpt-4-turbo-preview", - MODEL_NOUSRESEARCH_NOUS_HERMES_2_MIXTRAL_8X7B_DPO = "nousresearch/nous-hermes-2-mixtral-8x7b-dpo", + MODEL_OPENAI_GPT_3_5_TURBO_0613 = "openai/gpt-3.5-turbo-0613", MODEL_MISTRALAI_MISTRAL_SMALL = "mistralai/mistral-small", MODEL_MISTRALAI_MISTRAL_TINY = "mistralai/mistral-tiny", - MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_2 = "mistralai/mistral-7b-instruct-v0.2", MODEL_MISTRALAI_MIXTRAL_8X7B_INSTRUCT = "mistralai/mixtral-8x7b-instruct", MODEL_NEVERSLEEP_NOROMAID_20B = "neversleep/noromaid-20b", MODEL_ALPINDALE_GOLIATH_120B = "alpindale/goliath-120b", MODEL_OPENROUTER_AUTO = "openrouter/auto", MODEL_OPENAI_GPT_4_1106_PREVIEW = "openai/gpt-4-1106-preview", - MODEL_OPENAI_GPT_3_5_TURBO_INSTRUCT = "openai/gpt-3.5-turbo-instruct", MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_1 = "mistralai/mistral-7b-instruct-v0.1", + MODEL_OPENAI_GPT_3_5_TURBO_INSTRUCT = "openai/gpt-3.5-turbo-instruct", MODEL_PYGMALIONAI_MYTHALION_13B = "pygmalionai/mythalion-13b", MODEL_OPENAI_GPT_3_5_TURBO_16K = "openai/gpt-3.5-turbo-16k", MODEL_MANCER_WEAVER = "mancer/weaver", MODEL_UNDI95_REMM_SLERP_L2_13B = "undi95/remm-slerp-l2-13b", MODEL_GRYPHE_MYTHOMAX_L2_13B = "gryphe/mythomax-l2-13b", - MODEL_OPENAI_GPT_3_5_TURBO = "openai/gpt-3.5-turbo", MODEL_OPENAI_GPT_4_0314 = "openai/gpt-4-0314", + MODEL_OPENAI_GPT_3_5_TURBO = "openai/gpt-3.5-turbo", MODEL_OPENAI_GPT_4 = "openai/gpt-4" } diff --git a/packages/kbot/dist-in/models/cache/openrouter-models.js b/packages/kbot/dist-in/models/cache/openrouter-models.js index 4680bc8a..22090836 100644 --- a/packages/kbot/dist-in/models/cache/openrouter-models.js +++ b/packages/kbot/dist-in/models/cache/openrouter-models.js @@ -1,20 +1,40 @@ export var E_OPENROUTER_MODEL; (function (E_OPENROUTER_MODEL) { + E_OPENROUTER_MODEL["MODEL_DEEPCOGITO_COGITO_V2_PREVIEW_LLAMA_109B_MOE"] = "deepcogito/cogito-v2-preview-llama-109b-moe"; + E_OPENROUTER_MODEL["MODEL_DEEPCOGITO_COGITO_V2_PREVIEW_DEEPSEEK_671B"] = "deepcogito/cogito-v2-preview-deepseek-671b"; + E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_30B_A3B_THINKING_2507"] = "qwen/qwen3-30b-a3b-thinking-2507"; + E_OPENROUTER_MODEL["MODEL_X_AI_GROK_CODE_FAST_1"] = "x-ai/grok-code-fast-1"; + E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_HERMES_4_70B"] = "nousresearch/hermes-4-70b"; + E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_HERMES_4_405B"] = "nousresearch/hermes-4-405b"; + E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_FLASH_IMAGE_PREVIEW"] = "google/gemini-2.5-flash-image-preview"; + E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_1_FREE"] = "deepseek/deepseek-chat-v3.1:free"; + E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_1"] = "deepseek/deepseek-chat-v3.1"; + E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_V3_1_BASE"] = "deepseek/deepseek-v3.1-base"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4O_AUDIO_PREVIEW"] = "openai/gpt-4o-audio-preview"; + E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_MEDIUM_3_1"] = "mistralai/mistral-medium-3.1"; + E_OPENROUTER_MODEL["MODEL_BAIDU_ERNIE_4_5_21B_A3B"] = "baidu/ernie-4.5-21b-a3b"; + E_OPENROUTER_MODEL["MODEL_BAIDU_ERNIE_4_5_VL_28B_A3B"] = "baidu/ernie-4.5-vl-28b-a3b"; + E_OPENROUTER_MODEL["MODEL_Z_AI_GLM_4_5V"] = "z-ai/glm-4.5v"; + E_OPENROUTER_MODEL["MODEL_AI21_JAMBA_MINI_1_7"] = "ai21/jamba-mini-1.7"; + E_OPENROUTER_MODEL["MODEL_AI21_JAMBA_LARGE_1_7"] = "ai21/jamba-large-1.7"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_5_CHAT"] = "openai/gpt-5-chat"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_5"] = "openai/gpt-5"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_5_MINI"] = "openai/gpt-5-mini"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_5_NANO"] = "openai/gpt-5-nano"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_OSS_120B_FREE"] = "openai/gpt-oss-120b:free"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_OSS_120B"] = "openai/gpt-oss-120b"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_OSS_20B_FREE"] = "openai/gpt-oss-20b:free"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_OSS_20B"] = "openai/gpt-oss-20b"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_OPUS_4_1"] = "anthropic/claude-opus-4.1"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_CODESTRAL_2508"] = "mistralai/codestral-2508"; + E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_CODER_30B_A3B_INSTRUCT"] = "qwen/qwen3-coder-30b-a3b-instruct"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_30B_A3B_INSTRUCT_2507"] = "qwen/qwen3-30b-a3b-instruct-2507"; E_OPENROUTER_MODEL["MODEL_Z_AI_GLM_4_5"] = "z-ai/glm-4.5"; E_OPENROUTER_MODEL["MODEL_Z_AI_GLM_4_5_AIR_FREE"] = "z-ai/glm-4.5-air:free"; E_OPENROUTER_MODEL["MODEL_Z_AI_GLM_4_5_AIR"] = "z-ai/glm-4.5-air"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_235B_A22B_THINKING_2507"] = "qwen/qwen3-235b-a22b-thinking-2507"; E_OPENROUTER_MODEL["MODEL_Z_AI_GLM_4_32B"] = "z-ai/glm-4-32b"; + E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_CODER_FREE"] = "qwen/qwen3-coder:free"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_CODER"] = "qwen/qwen3-coder"; E_OPENROUTER_MODEL["MODEL_BYTEDANCE_UI_TARS_1_5_7B"] = "bytedance/ui-tars-1.5-7b"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_FLASH_LITE"] = "google/gemini-2.5-flash-lite"; @@ -33,6 +53,7 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_TNGTECH_DEEPSEEK_R1T2_CHIMERA_FREE"] = "tngtech/deepseek-r1t2-chimera:free"; E_OPENROUTER_MODEL["MODEL_MORPH_MORPH_V3_LARGE"] = "morph/morph-v3-large"; E_OPENROUTER_MODEL["MODEL_MORPH_MORPH_V3_FAST"] = "morph/morph-v3-fast"; + E_OPENROUTER_MODEL["MODEL_BAIDU_ERNIE_4_5_VL_424B_A47B"] = "baidu/ernie-4.5-vl-424b-a47b"; E_OPENROUTER_MODEL["MODEL_BAIDU_ERNIE_4_5_300B_A47B"] = "baidu/ernie-4.5-300b-a47b"; E_OPENROUTER_MODEL["MODEL_THEDRUMMER_ANUBIS_70B_V1_1"] = "thedrummer/anubis-70b-v1.1"; E_OPENROUTER_MODEL["MODEL_INCEPTION_MERCURY"] = "inception/mercury"; @@ -43,6 +64,7 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_FLASH"] = "google/gemini-2.5-flash"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_PRO"] = "google/gemini-2.5-pro"; E_OPENROUTER_MODEL["MODEL_MOONSHOTAI_KIMI_DEV_72B_FREE"] = "moonshotai/kimi-dev-72b:free"; + E_OPENROUTER_MODEL["MODEL_MOONSHOTAI_KIMI_DEV_72B"] = "moonshotai/kimi-dev-72b"; E_OPENROUTER_MODEL["MODEL_OPENAI_O3_PRO"] = "openai/o3-pro"; E_OPENROUTER_MODEL["MODEL_X_AI_GROK_3_MINI"] = "x-ai/grok-3-mini"; E_OPENROUTER_MODEL["MODEL_X_AI_GROK_3"] = "x-ai/grok-3"; @@ -50,13 +72,10 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MAGISTRAL_MEDIUM_2506"] = "mistralai/magistral-medium-2506"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MAGISTRAL_MEDIUM_2506_THINKING"] = "mistralai/magistral-medium-2506:thinking"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_PRO_PREVIEW"] = "google/gemini-2.5-pro-preview"; - E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_7B"] = "deepseek/deepseek-r1-distill-qwen-7b"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B_FREE"] = "deepseek/deepseek-r1-0528-qwen3-8b:free"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_0528_QWEN3_8B"] = "deepseek/deepseek-r1-0528-qwen3-8b"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_0528_FREE"] = "deepseek/deepseek-r1-0528:free"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_0528"] = "deepseek/deepseek-r1-0528"; - E_OPENROUTER_MODEL["MODEL_SARVAMAI_SARVAM_M_FREE"] = "sarvamai/sarvam-m:free"; - E_OPENROUTER_MODEL["MODEL_THEDRUMMER_VALKYRIE_49B_V1"] = "thedrummer/valkyrie-49b-v1"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_OPUS_4"] = "anthropic/claude-opus-4"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_SONNET_4"] = "anthropic/claude-sonnet-4"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_DEVSTRAL_SMALL_2505_FREE"] = "mistralai/devstral-small-2505:free"; @@ -64,6 +83,7 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMMA_3N_E4B_IT_FREE"] = "google/gemma-3n-e4b-it:free"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMMA_3N_E4B_IT"] = "google/gemma-3n-e4b-it"; E_OPENROUTER_MODEL["MODEL_OPENAI_CODEX_MINI"] = "openai/codex-mini"; + E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_3_8B_INSTRUCT_FREE"] = "meta-llama/llama-3.3-8b-instruct:free"; E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_DEEPHERMES_3_MISTRAL_24B_PREVIEW"] = "nousresearch/deephermes-3-mistral-24b-preview"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_MEDIUM_3"] = "mistralai/mistral-medium-3"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_PRO_PREVIEW_05_06"] = "google/gemini-2.5-pro-preview-05-06"; @@ -74,7 +94,6 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_MICROSOFT_PHI_4_REASONING_PLUS"] = "microsoft/phi-4-reasoning-plus"; E_OPENROUTER_MODEL["MODEL_INCEPTION_MERCURY_CODER"] = "inception/mercury-coder"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_4B_FREE"] = "qwen/qwen3-4b:free"; - E_OPENROUTER_MODEL["MODEL_OPENGVLAB_INTERNVL3_14B"] = "opengvlab/internvl3-14b"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_PROVER_V2"] = "deepseek/deepseek-prover-v2"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_GUARD_4_12B"] = "meta-llama/llama-guard-4-12b"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN3_30B_A3B_FREE"] = "qwen/qwen3-30b-a3b:free"; @@ -90,7 +109,7 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_TNGTECH_DEEPSEEK_R1T_CHIMERA"] = "tngtech/deepseek-r1t-chimera"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_MAI_DS_R1_FREE"] = "microsoft/mai-ds-r1:free"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_MAI_DS_R1"] = "microsoft/mai-ds-r1"; - E_OPENROUTER_MODEL["MODEL_THUDM_GLM_Z1_32B_FREE"] = "thudm/glm-z1-32b:free"; + E_OPENROUTER_MODEL["MODEL_THUDM_GLM_Z1_32B"] = "thudm/glm-z1-32b"; E_OPENROUTER_MODEL["MODEL_THUDM_GLM_4_32B"] = "thudm/glm-4-32b"; E_OPENROUTER_MODEL["MODEL_OPENAI_O4_MINI_HIGH"] = "openai/o4-mini-high"; E_OPENROUTER_MODEL["MODEL_OPENAI_O3"] = "openai/o3"; @@ -113,16 +132,15 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_NVIDIA_LLAMA_3_3_NEMOTRON_SUPER_49B_V1"] = "nvidia/llama-3.3-nemotron-super-49b-v1"; E_OPENROUTER_MODEL["MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1_FREE"] = "nvidia/llama-3.1-nemotron-ultra-253b-v1:free"; E_OPENROUTER_MODEL["MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_ULTRA_253B_V1"] = "nvidia/llama-3.1-nemotron-ultra-253b-v1"; + E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_4_MAVERICK_FREE"] = "meta-llama/llama-4-maverick:free"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_4_MAVERICK"] = "meta-llama/llama-4-maverick"; + E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_4_SCOUT_FREE"] = "meta-llama/llama-4-scout:free"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_4_SCOUT"] = "meta-llama/llama-4-scout"; - E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_V3_BASE"] = "deepseek/deepseek-v3-base"; - E_OPENROUTER_MODEL["MODEL_SCB10X_LLAMA3_1_TYPHOON2_70B_INSTRUCT"] = "scb10x/llama3.1-typhoon2-70b-instruct"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_5_PRO_EXP_03_25"] = "google/gemini-2.5-pro-exp-03-25"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN2_5_VL_32B_INSTRUCT_FREE"] = "qwen/qwen2.5-vl-32b-instruct:free"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN2_5_VL_32B_INSTRUCT"] = "qwen/qwen2.5-vl-32b-instruct"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_0324_FREE"] = "deepseek/deepseek-chat-v3-0324:free"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_CHAT_V3_0324"] = "deepseek/deepseek-chat-v3-0324"; - E_OPENROUTER_MODEL["MODEL_FEATHERLESS_QWERKY_72B_FREE"] = "featherless/qwerky-72b:free"; E_OPENROUTER_MODEL["MODEL_OPENAI_O1_PRO"] = "openai/o1-pro"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT_FREE"] = "mistralai/mistral-small-3.1-24b-instruct:free"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SMALL_3_1_24B_INSTRUCT"] = "mistralai/mistral-small-3.1-24b-instruct"; @@ -148,7 +166,6 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_2_0_FLASH_LITE_001"] = "google/gemini-2.0-flash-lite-001"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_7_SONNET"] = "anthropic/claude-3.7-sonnet"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_7_SONNET_THINKING"] = "anthropic/claude-3.7-sonnet:thinking"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_7_SONNET_BETA"] = "anthropic/claude-3.7-sonnet:beta"; E_OPENROUTER_MODEL["MODEL_PERPLEXITY_R1_1776"] = "perplexity/r1-1776"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SABA"] = "mistralai/mistral-saba"; E_OPENROUTER_MODEL["MODEL_COGNITIVECOMPUTATIONS_DOLPHIN3_0_R1_MISTRAL_24B_FREE"] = "cognitivecomputations/dolphin3.0-r1-mistral-24b:free"; @@ -170,7 +187,6 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_PLUS"] = "qwen/qwen-plus"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_MAX"] = "qwen/qwen-max"; E_OPENROUTER_MODEL["MODEL_OPENAI_O3_MINI"] = "openai/o3-mini"; - E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_1_5B"] = "deepseek/deepseek-r1-distill-qwen-1.5b"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SMALL_24B_INSTRUCT_2501_FREE"] = "mistralai/mistral-small-24b-instruct-2501:free"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SMALL_24B_INSTRUCT_2501"] = "mistralai/mistral-small-24b-instruct-2501"; E_OPENROUTER_MODEL["MODEL_DEEPSEEK_DEEPSEEK_R1_DISTILL_QWEN_32B"] = "deepseek/deepseek-r1-distill-qwen-32b"; @@ -211,35 +227,31 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_RAIFLE_SORCERERLM_8X22B"] = "raifle/sorcererlm-8x22b"; E_OPENROUTER_MODEL["MODEL_THEDRUMMER_UNSLOPNEMO_12B"] = "thedrummer/unslopnemo-12b"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU_20241022"] = "anthropic/claude-3.5-haiku-20241022"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU_BETA"] = "anthropic/claude-3.5-haiku:beta"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_HAIKU"] = "anthropic/claude-3.5-haiku"; E_OPENROUTER_MODEL["MODEL_ANTHRACITE_ORG_MAGNUM_V4_72B"] = "anthracite-org/magnum-v4-72b"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_BETA"] = "anthropic/claude-3.5-sonnet:beta"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_SONNET"] = "anthropic/claude-3.5-sonnet"; - E_OPENROUTER_MODEL["MODEL_MISTRALAI_MINISTRAL_8B"] = "mistralai/ministral-8b"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MINISTRAL_3B"] = "mistralai/ministral-3b"; + E_OPENROUTER_MODEL["MODEL_MISTRALAI_MINISTRAL_8B"] = "mistralai/ministral-8b"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_2_5_7B_INSTRUCT"] = "qwen/qwen-2.5-7b-instruct"; E_OPENROUTER_MODEL["MODEL_NVIDIA_LLAMA_3_1_NEMOTRON_70B_INSTRUCT"] = "nvidia/llama-3.1-nemotron-70b-instruct"; E_OPENROUTER_MODEL["MODEL_INFLECTION_INFLECTION_3_PRODUCTIVITY"] = "inflection/inflection-3-productivity"; E_OPENROUTER_MODEL["MODEL_INFLECTION_INFLECTION_3_PI"] = "inflection/inflection-3-pi"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_FLASH_1_5_8B"] = "google/gemini-flash-1.5-8b"; - E_OPENROUTER_MODEL["MODEL_THEDRUMMER_ROCINANTE_12B"] = "thedrummer/rocinante-12b"; - E_OPENROUTER_MODEL["MODEL_LIQUID_LFM_40B"] = "liquid/lfm-40b"; E_OPENROUTER_MODEL["MODEL_ANTHRACITE_ORG_MAGNUM_V2_72B"] = "anthracite-org/magnum-v2-72b"; - E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE"] = "meta-llama/llama-3.2-3b-instruct:free"; - E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT"] = "meta-llama/llama-3.2-3b-instruct"; - E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT_FREE"] = "meta-llama/llama-3.2-11b-vision-instruct:free"; + E_OPENROUTER_MODEL["MODEL_THEDRUMMER_ROCINANTE_12B"] = "thedrummer/rocinante-12b"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_11B_VISION_INSTRUCT"] = "meta-llama/llama-3.2-11b-vision-instruct"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_90B_VISION_INSTRUCT"] = "meta-llama/llama-3.2-90b-vision-instruct"; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_1B_INSTRUCT"] = "meta-llama/llama-3.2-1b-instruct"; + E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT_FREE"] = "meta-llama/llama-3.2-3b-instruct:free"; + E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_2_3B_INSTRUCT"] = "meta-llama/llama-3.2-3b-instruct"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_2_5_72B_INSTRUCT_FREE"] = "qwen/qwen-2.5-72b-instruct:free"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_2_5_72B_INSTRUCT"] = "qwen/qwen-2.5-72b-instruct"; E_OPENROUTER_MODEL["MODEL_NEVERSLEEP_LLAMA_3_1_LUMIMAID_8B"] = "neversleep/llama-3.1-lumimaid-8b"; - E_OPENROUTER_MODEL["MODEL_OPENAI_O1_MINI"] = "openai/o1-mini"; E_OPENROUTER_MODEL["MODEL_OPENAI_O1_MINI_2024_09_12"] = "openai/o1-mini-2024-09-12"; + E_OPENROUTER_MODEL["MODEL_OPENAI_O1_MINI"] = "openai/o1-mini"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_PIXTRAL_12B"] = "mistralai/pixtral-12b"; - E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_PLUS_08_2024"] = "cohere/command-r-plus-08-2024"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_08_2024"] = "cohere/command-r-08-2024"; + E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_PLUS_08_2024"] = "cohere/command-r-plus-08-2024"; E_OPENROUTER_MODEL["MODEL_SAO10K_L3_1_EURYALE_70B"] = "sao10k/l3.1-euryale-70b"; E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_2_5_VL_7B_INSTRUCT"] = "qwen/qwen-2.5-vl-7b-instruct"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_PHI_3_5_MINI_128K_INSTRUCT"] = "microsoft/phi-3.5-mini-128k-instruct"; @@ -255,20 +267,18 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_1_70B_INSTRUCT"] = "meta-llama/llama-3.1-70b-instruct"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_NEMO_FREE"] = "mistralai/mistral-nemo:free"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_NEMO"] = "mistralai/mistral-nemo"; - E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4O_MINI"] = "openai/gpt-4o-mini"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4O_MINI_2024_07_18"] = "openai/gpt-4o-mini-2024-07-18"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4O_MINI"] = "openai/gpt-4o-mini"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMMA_2_27B_IT"] = "google/gemma-2-27b-it"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMMA_2_9B_IT_FREE"] = "google/gemma-2-9b-it:free"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMMA_2_9B_IT"] = "google/gemma-2-9b-it"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_20240620_BETA"] = "anthropic/claude-3.5-sonnet-20240620:beta"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_5_SONNET_20240620"] = "anthropic/claude-3.5-sonnet-20240620"; E_OPENROUTER_MODEL["MODEL_SAO10K_L3_EURYALE_70B"] = "sao10k/l3-euryale-70b"; E_OPENROUTER_MODEL["MODEL_COGNITIVECOMPUTATIONS_DOLPHIN_MIXTRAL_8X22B"] = "cognitivecomputations/dolphin-mixtral-8x22b"; - E_OPENROUTER_MODEL["MODEL_QWEN_QWEN_2_72B_INSTRUCT"] = "qwen/qwen-2-72b-instruct"; - E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_3"] = "mistralai/mistral-7b-instruct-v0.3"; + E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_HERMES_2_PRO_LLAMA_3_8B"] = "nousresearch/hermes-2-pro-llama-3-8b"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_FREE"] = "mistralai/mistral-7b-instruct:free"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT"] = "mistralai/mistral-7b-instruct"; - E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_HERMES_2_PRO_LLAMA_3_8B"] = "nousresearch/hermes-2-pro-llama-3-8b"; + E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_3"] = "mistralai/mistral-7b-instruct-v0.3"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_PHI_3_MINI_128K_INSTRUCT"] = "microsoft/phi-3-mini-128k-instruct"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_PHI_3_MEDIUM_128K_INSTRUCT"] = "microsoft/phi-3-medium-128k-instruct"; E_OPENROUTER_MODEL["MODEL_NEVERSLEEP_LLAMA_3_LUMIMAID_70B"] = "neversleep/llama-3-lumimaid-70b"; @@ -281,39 +291,35 @@ export var E_OPENROUTER_MODEL; E_OPENROUTER_MODEL["MODEL_META_LLAMA_LLAMA_3_8B_INSTRUCT"] = "meta-llama/llama-3-8b-instruct"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MIXTRAL_8X22B_INSTRUCT"] = "mistralai/mixtral-8x22b-instruct"; E_OPENROUTER_MODEL["MODEL_MICROSOFT_WIZARDLM_2_8X22B"] = "microsoft/wizardlm-2-8x22b"; - E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4_TURBO"] = "openai/gpt-4-turbo"; E_OPENROUTER_MODEL["MODEL_GOOGLE_GEMINI_PRO_1_5"] = "google/gemini-pro-1.5"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4_TURBO"] = "openai/gpt-4-turbo"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_PLUS"] = "cohere/command-r-plus"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_PLUS_04_2024"] = "cohere/command-r-plus-04-2024"; E_OPENROUTER_MODEL["MODEL_SOPHOSYMPATHEIA_MIDNIGHT_ROSE_70B"] = "sophosympatheia/midnight-rose-70b"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R"] = "cohere/command-r"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND"] = "cohere/command"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_HAIKU_BETA"] = "anthropic/claude-3-haiku:beta"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_HAIKU"] = "anthropic/claude-3-haiku"; - E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_OPUS_BETA"] = "anthropic/claude-3-opus:beta"; E_OPENROUTER_MODEL["MODEL_ANTHROPIC_CLAUDE_3_OPUS"] = "anthropic/claude-3-opus"; E_OPENROUTER_MODEL["MODEL_COHERE_COMMAND_R_03_2024"] = "cohere/command-r-03-2024"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_LARGE"] = "mistralai/mistral-large"; - E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO_0613"] = "openai/gpt-3.5-turbo-0613"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4_TURBO_PREVIEW"] = "openai/gpt-4-turbo-preview"; - E_OPENROUTER_MODEL["MODEL_NOUSRESEARCH_NOUS_HERMES_2_MIXTRAL_8X7B_DPO"] = "nousresearch/nous-hermes-2-mixtral-8x7b-dpo"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO_0613"] = "openai/gpt-3.5-turbo-0613"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_SMALL"] = "mistralai/mistral-small"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_TINY"] = "mistralai/mistral-tiny"; - E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_2"] = "mistralai/mistral-7b-instruct-v0.2"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MIXTRAL_8X7B_INSTRUCT"] = "mistralai/mixtral-8x7b-instruct"; E_OPENROUTER_MODEL["MODEL_NEVERSLEEP_NOROMAID_20B"] = "neversleep/noromaid-20b"; E_OPENROUTER_MODEL["MODEL_ALPINDALE_GOLIATH_120B"] = "alpindale/goliath-120b"; E_OPENROUTER_MODEL["MODEL_OPENROUTER_AUTO"] = "openrouter/auto"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4_1106_PREVIEW"] = "openai/gpt-4-1106-preview"; - E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO_INSTRUCT"] = "openai/gpt-3.5-turbo-instruct"; E_OPENROUTER_MODEL["MODEL_MISTRALAI_MISTRAL_7B_INSTRUCT_V0_1"] = "mistralai/mistral-7b-instruct-v0.1"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO_INSTRUCT"] = "openai/gpt-3.5-turbo-instruct"; E_OPENROUTER_MODEL["MODEL_PYGMALIONAI_MYTHALION_13B"] = "pygmalionai/mythalion-13b"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO_16K"] = "openai/gpt-3.5-turbo-16k"; E_OPENROUTER_MODEL["MODEL_MANCER_WEAVER"] = "mancer/weaver"; E_OPENROUTER_MODEL["MODEL_UNDI95_REMM_SLERP_L2_13B"] = "undi95/remm-slerp-l2-13b"; E_OPENROUTER_MODEL["MODEL_GRYPHE_MYTHOMAX_L2_13B"] = "gryphe/mythomax-l2-13b"; - E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO"] = "openai/gpt-3.5-turbo"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4_0314"] = "openai/gpt-4-0314"; + E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_3_5_TURBO"] = "openai/gpt-3.5-turbo"; E_OPENROUTER_MODEL["MODEL_OPENAI_GPT_4"] = "openai/gpt-4"; })(E_OPENROUTER_MODEL || (E_OPENROUTER_MODEL = {})); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbnJvdXRlci1tb2RlbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbW9kZWxzL2NhY2hlL29wZW5yb3V0ZXItbW9kZWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBTixJQUFZLGtCQTRUWDtBQTVURCxXQUFZLGtCQUFrQjtJQUM1QixtRUFBNkMsQ0FBQTtJQUM3Qyx5REFBbUMsQ0FBQTtJQUNuQyxtRUFBNkMsQ0FBQTtJQUM3QyxtRUFBNkMsQ0FBQTtJQUM3Qyx1RUFBaUQsQ0FBQTtJQUNqRCwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCxpR0FBMkUsQ0FBQTtJQUMzRSx5REFBbUMsQ0FBQTtJQUNuQywyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyxxR0FBK0UsQ0FBQTtJQUMvRSw2REFBdUMsQ0FBQTtJQUN2QyxpRUFBMkMsQ0FBQTtJQUMzQyxpRkFBMkQsQ0FBQTtJQUMzRCx5RkFBbUUsQ0FBQTtJQUNuRSxtRkFBNkQsQ0FBQTtJQUM3RCxxRUFBK0MsQ0FBQTtJQUMvQywrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxxRkFBK0QsQ0FBQTtJQUMvRCxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCwySkFBcUksQ0FBQTtJQUNySSx1REFBaUMsQ0FBQTtJQUNqQyx1RkFBaUUsQ0FBQTtJQUNqRSxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSxxR0FBK0UsQ0FBQTtJQUMvRSx5RUFBbUQsQ0FBQTtJQUNuRCx1RUFBaUQsQ0FBQTtJQUNqRCxtRkFBNkQsQ0FBQTtJQUM3RCxxRkFBK0QsQ0FBQTtJQUMvRCxtRUFBNkMsQ0FBQTtJQUM3QywySEFBcUcsQ0FBQTtJQUNyRyxpSEFBMkYsQ0FBQTtJQUMzRixxRUFBK0MsQ0FBQTtJQUMvQyxxSEFBK0YsQ0FBQTtJQUMvRiwrRUFBeUQsQ0FBQTtJQUN6RCwyRUFBcUQsQ0FBQTtJQUNyRCx5RkFBbUUsQ0FBQTtJQUNuRSwyREFBcUMsQ0FBQTtJQUNyQyxpRUFBMkMsQ0FBQTtJQUMzQyx1REFBaUMsQ0FBQTtJQUNqQyw2RkFBdUUsQ0FBQTtJQUN2RSwrRkFBeUUsQ0FBQTtJQUN6RSxpSEFBMkYsQ0FBQTtJQUMzRiwyRkFBcUUsQ0FBQTtJQUNyRSx5R0FBbUYsQ0FBQTtJQUNuRiwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSw2RkFBdUUsQ0FBQTtJQUN2RSxtRkFBNkQsQ0FBQTtJQUM3RCw2RUFBdUQsQ0FBQTtJQUN2RCxxRkFBK0QsQ0FBQTtJQUMvRCwrRUFBeUQsQ0FBQTtJQUN6RCxtRkFBNkQsQ0FBQTtJQUM3RCxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCxtRUFBNkMsQ0FBQTtJQUM3QywySEFBcUcsQ0FBQTtJQUNyRyxxRkFBK0QsQ0FBQTtJQUMvRCx1R0FBaUYsQ0FBQTtJQUNqRixxRUFBK0MsQ0FBQTtJQUMvQyxxRkFBK0QsQ0FBQTtJQUMvRCwrRUFBeUQsQ0FBQTtJQUN6RCx5RUFBbUQsQ0FBQTtJQUNuRCw2RkFBdUUsQ0FBQTtJQUN2RSwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQywrRUFBeUQsQ0FBQTtJQUN6RCx1RkFBaUUsQ0FBQTtJQUNqRSx5RkFBbUUsQ0FBQTtJQUNuRSwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxxRUFBK0MsQ0FBQTtJQUMvQywyREFBcUMsQ0FBQTtJQUNyQyx1RUFBaUQsQ0FBQTtJQUNqRCw2REFBdUMsQ0FBQTtJQUN2Qyw2REFBdUMsQ0FBQTtJQUN2QyxtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSxpRkFBMkQsQ0FBQTtJQUMzRCx1RUFBaUQsQ0FBQTtJQUNqRCwyRUFBcUQsQ0FBQTtJQUNyRCwrREFBeUMsQ0FBQTtJQUN6Qyx1RUFBaUQsQ0FBQTtJQUNqRCxtREFBNkIsQ0FBQTtJQUM3Qiw2REFBdUMsQ0FBQTtJQUN2Qyx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSw2REFBdUMsQ0FBQTtJQUN2Qyx1RUFBaUQsQ0FBQTtJQUNqRCx1RUFBaUQsQ0FBQTtJQUNqRCx5RUFBbUQsQ0FBQTtJQUNuRCxtSEFBNkYsQ0FBQTtJQUM3RixtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSx5R0FBbUYsQ0FBQTtJQUNuRiwrRkFBeUUsQ0FBQTtJQUN6RSwyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyw2R0FBdUYsQ0FBQTtJQUN2Rix5SEFBbUcsQ0FBQTtJQUNuRywrR0FBeUYsQ0FBQTtJQUN6Rix1RkFBaUUsQ0FBQTtJQUNqRSxpRkFBMkQsQ0FBQTtJQUMzRCxtRkFBNkQsQ0FBQTtJQUM3RCwyR0FBcUYsQ0FBQTtJQUNyRiwrRkFBeUUsQ0FBQTtJQUN6RSxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSx1RkFBaUUsQ0FBQTtJQUNqRSwyREFBcUMsQ0FBQTtJQUNyQywySEFBcUcsQ0FBQTtJQUNyRyxpSEFBMkYsQ0FBQTtJQUMzRixtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxxRkFBK0QsQ0FBQTtJQUMvRCwyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSxpRkFBMkQsQ0FBQTtJQUMzRCxxRkFBK0QsQ0FBQTtJQUMvRCwyRUFBcUQsQ0FBQTtJQUNyRCwyRkFBcUUsQ0FBQTtJQUNyRSxtRkFBNkQsQ0FBQTtJQUM3RCx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSx5RUFBbUQsQ0FBQTtJQUNuRCw2RkFBdUUsQ0FBQTtJQUN2RSxtRUFBNkMsQ0FBQTtJQUM3Qyx5REFBbUMsQ0FBQTtJQUNuQyxtSUFBNkcsQ0FBQTtJQUM3RyxpR0FBMkUsQ0FBQTtJQUMzRSx1RkFBaUUsQ0FBQTtJQUNqRSx5R0FBbUYsQ0FBQTtJQUNuRixpR0FBMkUsQ0FBQTtJQUMzRSxxRUFBK0MsQ0FBQTtJQUMvQyw2RUFBdUQsQ0FBQTtJQUN2RCx5SUFBbUgsQ0FBQTtJQUNuSCwrSEFBeUcsQ0FBQTtJQUN6RyxtSUFBNkcsQ0FBQTtJQUM3Ryx5SEFBbUcsQ0FBQTtJQUNuRyx1RkFBaUUsQ0FBQTtJQUNqRSx1RUFBaUQsQ0FBQTtJQUNqRCwyR0FBcUYsQ0FBQTtJQUNyRix1RkFBaUUsQ0FBQTtJQUNqRSxtRUFBNkMsQ0FBQTtJQUM3QyxxRUFBK0MsQ0FBQTtJQUMvQywrRUFBeUQsQ0FBQTtJQUN6RCw2RkFBdUUsQ0FBQTtJQUN2RSxpRUFBMkMsQ0FBQTtJQUMzQywrREFBeUMsQ0FBQTtJQUN6QyxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSw2REFBdUMsQ0FBQTtJQUN2QywyREFBcUMsQ0FBQTtJQUNyQyw2REFBdUMsQ0FBQTtJQUN2Qyw2R0FBdUYsQ0FBQTtJQUN2Riw2SEFBdUcsQ0FBQTtJQUN2RyxtSEFBNkYsQ0FBQTtJQUM3RiwyR0FBcUYsQ0FBQTtJQUNyRixxSEFBK0YsQ0FBQTtJQUMvRiwyR0FBcUYsQ0FBQTtJQUNyRixxRkFBK0QsQ0FBQTtJQUMvRCxpRUFBMkMsQ0FBQTtJQUMzQywyREFBcUMsQ0FBQTtJQUNyQywyREFBcUMsQ0FBQTtJQUNyQyx1SEFBaUcsQ0FBQTtJQUNqRyw2R0FBdUYsQ0FBQTtJQUN2RixtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxxRUFBK0MsQ0FBQTtJQUMvQyxpRkFBMkQsQ0FBQTtJQUMzRCwrREFBeUMsQ0FBQTtJQUN6Qyw2RUFBdUQsQ0FBQTtJQUN2RCwrRUFBeUQsQ0FBQTtJQUN6RCxtREFBNkIsQ0FBQTtJQUM3QiwrRUFBeUQsQ0FBQTtJQUN6RCxpRUFBMkMsQ0FBQTtJQUMzQyxxRkFBK0QsQ0FBQTtJQUMvRCxpR0FBMkUsQ0FBQTtJQUMzRSw2R0FBdUYsQ0FBQTtJQUN2RixtR0FBNkUsQ0FBQTtJQUM3RSx1RUFBaUQsQ0FBQTtJQUNqRCx5RUFBbUQsQ0FBQTtJQUNuRCxxRUFBK0MsQ0FBQTtJQUMvQyx5RUFBbUQsQ0FBQTtJQUNuRCxpRkFBMkQsQ0FBQTtJQUMzRCx5RkFBbUUsQ0FBQTtJQUNuRSx5RkFBbUUsQ0FBQTtJQUNuRSx5RkFBbUUsQ0FBQTtJQUNuRSwyRUFBcUQsQ0FBQTtJQUNyRCxtRkFBNkQsQ0FBQTtJQUM3RCwyR0FBcUYsQ0FBQTtJQUNyRixpR0FBMkUsQ0FBQTtJQUMzRSwrRUFBeUQsQ0FBQTtJQUN6RCxtRkFBNkQsQ0FBQTtJQUM3RCx1R0FBaUYsQ0FBQTtJQUNqRiwrRkFBeUUsQ0FBQTtJQUN6RSxxRkFBK0QsQ0FBQTtJQUMvRCx5RkFBbUUsQ0FBQTtJQUNuRSxpR0FBMkUsQ0FBQTtJQUMzRSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCw2RUFBdUQsQ0FBQTtJQUN2RCxtRkFBNkQsQ0FBQTtJQUM3RCw2R0FBdUYsQ0FBQTtJQUN2Rix5R0FBbUYsQ0FBQTtJQUNuRixxRkFBK0QsQ0FBQTtJQUMvRCxxRkFBK0QsQ0FBQTtJQUMvRCxpRkFBMkQsQ0FBQTtJQUMzRCw2REFBdUMsQ0FBQTtJQUN2Qyx5RkFBbUUsQ0FBQTtJQUNuRSwyR0FBcUYsQ0FBQTtJQUNyRixpR0FBMkUsQ0FBQTtJQUMzRSwySEFBcUcsQ0FBQTtJQUNyRyxpSEFBMkYsQ0FBQTtJQUMzRixpSEFBMkYsQ0FBQTtJQUMzRixpR0FBMkUsQ0FBQTtJQUMzRSwrRkFBeUUsQ0FBQTtJQUN6RSxxRkFBK0QsQ0FBQTtJQUMvRCxpR0FBMkUsQ0FBQTtJQUMzRSw2REFBdUMsQ0FBQTtJQUN2QyxtRkFBNkQsQ0FBQTtJQUM3RCwyRUFBcUQsQ0FBQTtJQUNyRCwyRkFBcUUsQ0FBQTtJQUNyRSxpRkFBMkQsQ0FBQTtJQUMzRCwrRUFBeUQsQ0FBQTtJQUN6RCx5RkFBbUUsQ0FBQTtJQUNuRSx5R0FBbUYsQ0FBQTtJQUNuRix1R0FBaUYsQ0FBQTtJQUNqRix5R0FBbUYsQ0FBQTtJQUNuRixpRkFBMkQsQ0FBQTtJQUMzRCx5RUFBbUQsQ0FBQTtJQUNuRCxpRkFBMkQsQ0FBQTtJQUMzRCxtRkFBNkQsQ0FBQTtJQUM3RCwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSxpR0FBMkUsQ0FBQTtJQUMzRSxtR0FBNkUsQ0FBQTtJQUM3RSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCxxRUFBK0MsQ0FBQTtJQUMvQywyRkFBcUUsQ0FBQTtJQUNyRSwyRUFBcUQsQ0FBQTtJQUNyRCxtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxtSEFBNkYsQ0FBQTtJQUM3Rix5R0FBbUYsQ0FBQTtJQUNuRiwyRUFBcUQsQ0FBQTtJQUNyRCx1SEFBaUcsQ0FBQTtJQUNqRyxpRkFBMkQsQ0FBQTtJQUMzRCxxR0FBK0UsQ0FBQTtJQUMvRSxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSx5R0FBbUYsQ0FBQTtJQUNuRixxR0FBK0UsQ0FBQTtJQUMvRSx5R0FBbUYsQ0FBQTtJQUNuRiwrRkFBeUUsQ0FBQTtJQUN6RSwrRUFBeUQsQ0FBQTtJQUN6RCxpRkFBMkQsQ0FBQTtJQUMzRCwyREFBcUMsQ0FBQTtJQUNyQyw2RUFBdUQsQ0FBQTtJQUN2RCx1RkFBaUUsQ0FBQTtJQUNqRSwrRkFBeUUsQ0FBQTtJQUN6RSw2RkFBdUUsQ0FBQTtJQUN2RSxpR0FBMkUsQ0FBQTtJQUMzRSxxRkFBK0QsQ0FBQTtJQUMvRCxxRUFBK0MsQ0FBQTtJQUMvQywyRUFBcUQsQ0FBQTtJQUNyRCwyRUFBcUQsQ0FBQTtJQUNyRCwyRkFBcUUsQ0FBQTtJQUNyRSxtR0FBNkUsQ0FBQTtJQUM3RSxpRUFBMkMsQ0FBQTtJQUMzQyw2REFBdUMsQ0FBQTtJQUN2QywyRkFBcUUsQ0FBQTtJQUNyRSxpRkFBMkQsQ0FBQTtJQUMzRCx5RkFBbUUsQ0FBQTtJQUNuRSwrRUFBeUQsQ0FBQTtJQUN6RCxpRkFBMkQsQ0FBQTtJQUMzRCwrRUFBeUQsQ0FBQTtJQUN6RCxtRkFBNkQsQ0FBQTtJQUM3RCxxRkFBK0QsQ0FBQTtJQUMvRCx1SEFBaUcsQ0FBQTtJQUNqRywrRUFBeUQsQ0FBQTtJQUN6RCw2RUFBdUQsQ0FBQTtJQUN2RCxxR0FBK0UsQ0FBQTtJQUMvRSwrRkFBeUUsQ0FBQTtJQUN6RSwrRUFBeUQsQ0FBQTtJQUN6RCw2RUFBdUQsQ0FBQTtJQUN2RCwrREFBeUMsQ0FBQTtJQUN6QyxtRkFBNkQsQ0FBQTtJQUM3RCwyRkFBcUUsQ0FBQTtJQUNyRSxxR0FBK0UsQ0FBQTtJQUMvRSxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCwyREFBcUMsQ0FBQTtJQUNyQyxpRkFBMkQsQ0FBQTtJQUMzRCw2RUFBdUQsQ0FBQTtJQUN2RCx5RUFBbUQsQ0FBQTtJQUNuRCxtRUFBNkMsQ0FBQTtJQUM3Qyx5REFBbUMsQ0FBQTtBQUNyQyxDQUFDLEVBNVRXLGtCQUFrQixLQUFsQixrQkFBa0IsUUE0VDdCIn0= \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3BlbnJvdXRlci1tb2RlbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvbW9kZWxzL2NhY2hlL29wZW5yb3V0ZXItbW9kZWxzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE1BQU0sQ0FBTixJQUFZLGtCQWtVWDtBQWxVRCxXQUFZLGtCQUFrQjtJQUM1Qix1SEFBaUcsQ0FBQTtJQUNqRyxxSEFBK0YsQ0FBQTtJQUMvRixpR0FBMkUsQ0FBQTtJQUMzRSwyRUFBcUQsQ0FBQTtJQUNyRCxtRkFBNkQsQ0FBQTtJQUM3RCxxRkFBK0QsQ0FBQTtJQUMvRCwyR0FBcUYsQ0FBQTtJQUNyRixpR0FBMkUsQ0FBQTtJQUMzRSx1RkFBaUUsQ0FBQTtJQUNqRSx1RkFBaUUsQ0FBQTtJQUNqRSx1RkFBaUUsQ0FBQTtJQUNqRSx5RkFBbUUsQ0FBQTtJQUNuRSwrRUFBeUQsQ0FBQTtJQUN6RCxxRkFBK0QsQ0FBQTtJQUMvRCwyREFBcUMsQ0FBQTtJQUNyQyx1RUFBaUQsQ0FBQTtJQUNqRCx5RUFBbUQsQ0FBQTtJQUNuRCxtRUFBNkMsQ0FBQTtJQUM3Qyx5REFBbUMsQ0FBQTtJQUNuQyxtRUFBNkMsQ0FBQTtJQUM3QyxtRUFBNkMsQ0FBQTtJQUM3QyxpRkFBMkQsQ0FBQTtJQUMzRCx1RUFBaUQsQ0FBQTtJQUNqRCwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCxtR0FBNkUsQ0FBQTtJQUM3RSxpR0FBMkUsQ0FBQTtJQUMzRSx5REFBbUMsQ0FBQTtJQUNuQywyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyxxR0FBK0UsQ0FBQTtJQUMvRSw2REFBdUMsQ0FBQTtJQUN2QywyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyxpRkFBMkQsQ0FBQTtJQUMzRCx5RkFBbUUsQ0FBQTtJQUNuRSxtRkFBNkQsQ0FBQTtJQUM3RCxxRUFBK0MsQ0FBQTtJQUMvQywrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxxRkFBK0QsQ0FBQTtJQUMvRCxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCwySkFBcUksQ0FBQTtJQUNySSx1REFBaUMsQ0FBQTtJQUNqQyx1RkFBaUUsQ0FBQTtJQUNqRSxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSxxR0FBK0UsQ0FBQTtJQUMvRSx5RUFBbUQsQ0FBQTtJQUNuRCx1RUFBaUQsQ0FBQTtJQUNqRCx5RkFBbUUsQ0FBQTtJQUNuRSxtRkFBNkQsQ0FBQTtJQUM3RCxxRkFBK0QsQ0FBQTtJQUMvRCxtRUFBNkMsQ0FBQTtJQUM3QywySEFBcUcsQ0FBQTtJQUNyRyxpSEFBMkYsQ0FBQTtJQUMzRixxRUFBK0MsQ0FBQTtJQUMvQyxxSEFBK0YsQ0FBQTtJQUMvRiwrRUFBeUQsQ0FBQTtJQUN6RCwyRUFBcUQsQ0FBQTtJQUNyRCx5RkFBbUUsQ0FBQTtJQUNuRSwrRUFBeUQsQ0FBQTtJQUN6RCwyREFBcUMsQ0FBQTtJQUNyQyxpRUFBMkMsQ0FBQTtJQUMzQyx1REFBaUMsQ0FBQTtJQUNqQyw2RkFBdUUsQ0FBQTtJQUN2RSwrRkFBeUUsQ0FBQTtJQUN6RSxpSEFBMkYsQ0FBQTtJQUMzRiwyRkFBcUUsQ0FBQTtJQUNyRSwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSw2RkFBdUUsQ0FBQTtJQUN2RSxtRkFBNkQsQ0FBQTtJQUM3RCwrRUFBeUQsQ0FBQTtJQUN6RCxtRkFBNkQsQ0FBQTtJQUM3RCxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCxtRUFBNkMsQ0FBQTtJQUM3QywyR0FBcUYsQ0FBQTtJQUNyRiwySEFBcUcsQ0FBQTtJQUNyRyxxRkFBK0QsQ0FBQTtJQUMvRCx1R0FBaUYsQ0FBQTtJQUNqRixxRUFBK0MsQ0FBQTtJQUMvQyxxRkFBK0QsQ0FBQTtJQUMvRCwrRUFBeUQsQ0FBQTtJQUN6RCx5RUFBbUQsQ0FBQTtJQUNuRCw2RkFBdUUsQ0FBQTtJQUN2RSwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyx1RkFBaUUsQ0FBQTtJQUNqRSx5RkFBbUUsQ0FBQTtJQUNuRSwrRUFBeUQsQ0FBQTtJQUN6RCxxRUFBK0MsQ0FBQTtJQUMvQyxxRUFBK0MsQ0FBQTtJQUMvQywyREFBcUMsQ0FBQTtJQUNyQyx1RUFBaUQsQ0FBQTtJQUNqRCw2REFBdUMsQ0FBQTtJQUN2Qyw2REFBdUMsQ0FBQTtJQUN2QyxtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSxpRkFBMkQsQ0FBQTtJQUMzRCx1RUFBaUQsQ0FBQTtJQUNqRCxpRUFBMkMsQ0FBQTtJQUMzQywrREFBeUMsQ0FBQTtJQUN6Qyx1RUFBaUQsQ0FBQTtJQUNqRCxtREFBNkIsQ0FBQTtJQUM3Qiw2REFBdUMsQ0FBQTtJQUN2Qyx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSw2REFBdUMsQ0FBQTtJQUN2Qyx1RUFBaUQsQ0FBQTtJQUNqRCx1RUFBaUQsQ0FBQTtJQUNqRCx5RUFBbUQsQ0FBQTtJQUNuRCxtSEFBNkYsQ0FBQTtJQUM3RixtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSx5R0FBbUYsQ0FBQTtJQUNuRiwrRkFBeUUsQ0FBQTtJQUN6RSwyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyw2R0FBdUYsQ0FBQTtJQUN2Rix5SEFBbUcsQ0FBQTtJQUNuRywrR0FBeUYsQ0FBQTtJQUN6RixpR0FBMkUsQ0FBQTtJQUMzRSx1RkFBaUUsQ0FBQTtJQUNqRSwyRkFBcUUsQ0FBQTtJQUNyRSxpRkFBMkQsQ0FBQTtJQUMzRCwrRkFBeUUsQ0FBQTtJQUN6RSxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSwyREFBcUMsQ0FBQTtJQUNyQywySEFBcUcsQ0FBQTtJQUNyRyxpSEFBMkYsQ0FBQTtJQUMzRixtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxxRkFBK0QsQ0FBQTtJQUMvRCwyRUFBcUQsQ0FBQTtJQUNyRCxpRUFBMkMsQ0FBQTtJQUMzQyxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSxpRkFBMkQsQ0FBQTtJQUMzRCxxRkFBK0QsQ0FBQTtJQUMvRCwyRUFBcUQsQ0FBQTtJQUNyRCwyRkFBcUUsQ0FBQTtJQUNyRSxtRkFBNkQsQ0FBQTtJQUM3RCx1R0FBaUYsQ0FBQTtJQUNqRiw2RkFBdUUsQ0FBQTtJQUN2RSx5RUFBbUQsQ0FBQTtJQUNuRCw2RkFBdUUsQ0FBQTtJQUN2RSxtRUFBNkMsQ0FBQTtJQUM3Qyx5REFBbUMsQ0FBQTtJQUNuQyxtSUFBNkcsQ0FBQTtJQUM3RyxpR0FBMkUsQ0FBQTtJQUMzRSx1RkFBaUUsQ0FBQTtJQUNqRSx5R0FBbUYsQ0FBQTtJQUNuRixxRUFBK0MsQ0FBQTtJQUMvQyw2RUFBdUQsQ0FBQTtJQUN2RCx5SUFBbUgsQ0FBQTtJQUNuSCwrSEFBeUcsQ0FBQTtJQUN6RyxtSUFBNkcsQ0FBQTtJQUM3Ryx5SEFBbUcsQ0FBQTtJQUNuRyx1RkFBaUUsQ0FBQTtJQUNqRSx1RUFBaUQsQ0FBQTtJQUNqRCwyR0FBcUYsQ0FBQTtJQUNyRix1RkFBaUUsQ0FBQTtJQUNqRSxtRUFBNkMsQ0FBQTtJQUM3QyxxRUFBK0MsQ0FBQTtJQUMvQywrRUFBeUQsQ0FBQTtJQUN6RCw2RkFBdUUsQ0FBQTtJQUN2RSxpRUFBMkMsQ0FBQTtJQUMzQywrREFBeUMsQ0FBQTtJQUN6QyxtR0FBNkUsQ0FBQTtJQUM3RSx5RkFBbUUsQ0FBQTtJQUNuRSw2REFBdUMsQ0FBQTtJQUN2QywyREFBcUMsQ0FBQTtJQUNyQyw2REFBdUMsQ0FBQTtJQUN2Qyw2SEFBdUcsQ0FBQTtJQUN2RyxtSEFBNkYsQ0FBQTtJQUM3RiwyR0FBcUYsQ0FBQTtJQUNyRixxSEFBK0YsQ0FBQTtJQUMvRiwyR0FBcUYsQ0FBQTtJQUNyRixxRkFBK0QsQ0FBQTtJQUMvRCxpRUFBMkMsQ0FBQTtJQUMzQywyREFBcUMsQ0FBQTtJQUNyQywyREFBcUMsQ0FBQTtJQUNyQyx1SEFBaUcsQ0FBQTtJQUNqRyw2R0FBdUYsQ0FBQTtJQUN2RixtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCxxRUFBK0MsQ0FBQTtJQUMvQyxpRkFBMkQsQ0FBQTtJQUMzRCwrREFBeUMsQ0FBQTtJQUN6Qyw2RUFBdUQsQ0FBQTtJQUN2RCwrRUFBeUQsQ0FBQTtJQUN6RCxtREFBNkIsQ0FBQTtJQUM3QiwrRUFBeUQsQ0FBQTtJQUN6RCxpRUFBMkMsQ0FBQTtJQUMzQyxxRkFBK0QsQ0FBQTtJQUMvRCxpR0FBMkUsQ0FBQTtJQUMzRSw2R0FBdUYsQ0FBQTtJQUN2RixtR0FBNkUsQ0FBQTtJQUM3RSx1RUFBaUQsQ0FBQTtJQUNqRCx5RUFBbUQsQ0FBQTtJQUNuRCxxRUFBK0MsQ0FBQTtJQUMvQyx5RUFBbUQsQ0FBQTtJQUNuRCxpRkFBMkQsQ0FBQTtJQUMzRCx5RkFBbUUsQ0FBQTtJQUNuRSx5RkFBbUUsQ0FBQTtJQUNuRSx5RkFBbUUsQ0FBQTtJQUNuRSwyRUFBcUQsQ0FBQTtJQUNyRCxtRkFBNkQsQ0FBQTtJQUM3RCwyR0FBcUYsQ0FBQTtJQUNyRixpR0FBMkUsQ0FBQTtJQUMzRSwrRUFBeUQsQ0FBQTtJQUN6RCxtRkFBNkQsQ0FBQTtJQUM3RCx1R0FBaUYsQ0FBQTtJQUNqRixxRkFBK0QsQ0FBQTtJQUMvRCx5RkFBbUUsQ0FBQTtJQUNuRSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCw2RUFBdUQsQ0FBQTtJQUN2RCxtRkFBNkQsQ0FBQTtJQUM3RCw2R0FBdUYsQ0FBQTtJQUN2Rix5R0FBbUYsQ0FBQTtJQUNuRixxRkFBK0QsQ0FBQTtJQUMvRCxxRkFBK0QsQ0FBQTtJQUMvRCx5RkFBbUUsQ0FBQTtJQUNuRSxpRkFBMkQsQ0FBQTtJQUMzRCxpSEFBMkYsQ0FBQTtJQUMzRixpSEFBMkYsQ0FBQTtJQUMzRixpR0FBMkUsQ0FBQTtJQUMzRSwyR0FBcUYsQ0FBQTtJQUNyRixpR0FBMkUsQ0FBQTtJQUMzRSwrRkFBeUUsQ0FBQTtJQUN6RSxxRkFBK0QsQ0FBQTtJQUMvRCxpR0FBMkUsQ0FBQTtJQUMzRSxtRkFBNkQsQ0FBQTtJQUM3RCw2REFBdUMsQ0FBQTtJQUN2QywyRUFBcUQsQ0FBQTtJQUNyRCxpRkFBMkQsQ0FBQTtJQUMzRCwyRkFBcUUsQ0FBQTtJQUNyRSwrRUFBeUQsQ0FBQTtJQUN6RCx5RkFBbUUsQ0FBQTtJQUNuRSx5R0FBbUYsQ0FBQTtJQUNuRix1R0FBaUYsQ0FBQTtJQUNqRix5R0FBbUYsQ0FBQTtJQUNuRixpRkFBMkQsQ0FBQTtJQUMzRCx5RUFBbUQsQ0FBQTtJQUNuRCxpRkFBMkQsQ0FBQTtJQUMzRCxtRkFBNkQsQ0FBQTtJQUM3RCwrR0FBeUYsQ0FBQTtJQUN6RixxR0FBK0UsQ0FBQTtJQUMvRSxpR0FBMkUsQ0FBQTtJQUMzRSxtR0FBNkUsQ0FBQTtJQUM3RSx1RkFBaUUsQ0FBQTtJQUNqRSw2RUFBdUQsQ0FBQTtJQUN2RCwyRkFBcUUsQ0FBQTtJQUNyRSxxRUFBK0MsQ0FBQTtJQUMvQywyRUFBcUQsQ0FBQTtJQUNyRCxtRkFBNkQsQ0FBQTtJQUM3RCx5RUFBbUQsQ0FBQTtJQUNuRCx5R0FBbUYsQ0FBQTtJQUNuRiwyRUFBcUQsQ0FBQTtJQUNyRCx1SEFBaUcsQ0FBQTtJQUNqRyx5R0FBbUYsQ0FBQTtJQUNuRixxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSxxR0FBK0UsQ0FBQTtJQUMvRSxxR0FBK0UsQ0FBQTtJQUMvRSx5R0FBbUYsQ0FBQTtJQUNuRiwrRkFBeUUsQ0FBQTtJQUN6RSwrRUFBeUQsQ0FBQTtJQUN6RCxpRkFBMkQsQ0FBQTtJQUMzRCwyREFBcUMsQ0FBQTtJQUNyQyw2RUFBdUQsQ0FBQTtJQUN2RCx1RkFBaUUsQ0FBQTtJQUNqRSwrRkFBeUUsQ0FBQTtJQUN6RSw2RkFBdUUsQ0FBQTtJQUN2RSxpR0FBMkUsQ0FBQTtJQUMzRSxxRkFBK0QsQ0FBQTtJQUMvRCwyRUFBcUQsQ0FBQTtJQUNyRCxxRUFBK0MsQ0FBQTtJQUMvQywyRUFBcUQsQ0FBQTtJQUNyRCwyRkFBcUUsQ0FBQTtJQUNyRSxtR0FBNkUsQ0FBQTtJQUM3RSxpRUFBMkMsQ0FBQTtJQUMzQyw2REFBdUMsQ0FBQTtJQUN2QyxpRkFBMkQsQ0FBQTtJQUMzRCwrRUFBeUQsQ0FBQTtJQUN6RCxpRkFBMkQsQ0FBQTtJQUMzRCwrRUFBeUQsQ0FBQTtJQUN6RCxxRkFBK0QsQ0FBQTtJQUMvRCxtRkFBNkQsQ0FBQTtJQUM3RCwrRUFBeUQsQ0FBQTtJQUN6RCw2RUFBdUQsQ0FBQTtJQUN2RCwrRkFBeUUsQ0FBQTtJQUN6RSwrRUFBeUQsQ0FBQTtJQUN6RCw2RUFBdUQsQ0FBQTtJQUN2RCwrREFBeUMsQ0FBQTtJQUN6QyxtRkFBNkQsQ0FBQTtJQUM3RCxxR0FBK0UsQ0FBQTtJQUMvRSwyRkFBcUUsQ0FBQTtJQUNyRSxtRkFBNkQsQ0FBQTtJQUM3RCxpRkFBMkQsQ0FBQTtJQUMzRCwyREFBcUMsQ0FBQTtJQUNyQyxpRkFBMkQsQ0FBQTtJQUMzRCw2RUFBdUQsQ0FBQTtJQUN2RCxtRUFBNkMsQ0FBQTtJQUM3Qyx5RUFBbUQsQ0FBQTtJQUNuRCx5REFBbUMsQ0FBQTtBQUNyQyxDQUFDLEVBbFVXLGtCQUFrQixLQUFsQixrQkFBa0IsUUFrVTdCIn0= \ No newline at end of file diff --git a/packages/kbot/dist-in/source.js b/packages/kbot/dist-in/source.js index 4d9c1592..c6ae3111 100644 --- a/packages/kbot/dist-in/source.js +++ b/packages/kbot/dist-in/source.js @@ -1,13 +1,9 @@ import * as path from 'node:path'; import * as fs from 'node:fs'; -// import { sync as dir } from '@polymech/fs/dir' // Moved to glob.ts if only used there -// import { createItem as toNode } from '@polymech/fs/inspect' // Moved to glob.ts import { sync as exists } from '@polymech/fs/exists'; // Still needed for vectorize import { isFile, forward_slash, resolve as resolvePath } from '@polymech/commons'; // Renamed resolve to resolvePath to avoid conflict import { logger } from './index.js'; import { lookup } from 'mime-types'; -// import { globSync } from 'glob' // Moved to glob.ts -// import { EXCLUDE_GLOB, MAX_FILE_SIZE } from './constants.js' // Moved to glob.ts import { defaultMimeRegistry } from './mime-handlers.js'; import { supported } from './commands/run-assistant.js'; import { handleWebUrl } from './http.js'; @@ -151,4 +147,4 @@ export async function vectorize(file, options) { throw error; } } -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3NvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssSUFBSSxNQUFNLFdBQVcsQ0FBQTtBQUNqQyxPQUFPLEtBQUssRUFBRSxNQUFNLFNBQVMsQ0FBQTtBQUU3Qix3RkFBd0Y7QUFFeEYsa0ZBQWtGO0FBQ2xGLE9BQU8sRUFBRSxJQUFJLElBQUksTUFBTSxFQUFFLE1BQU0scUJBQXFCLENBQUEsQ0FBQyw2QkFBNkI7QUFDbEYsT0FBTyxFQUFFLE1BQU0sRUFBRSxhQUFhLEVBQUUsT0FBTyxJQUFJLFdBQVcsRUFBRSxNQUFNLG1CQUFtQixDQUFBLENBQUMsbURBQW1EO0FBQ3JJLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxZQUFZLENBQUE7QUFDbkMsT0FBTyxFQUFFLE1BQU0sRUFBRSxNQUFNLFlBQVksQ0FBQTtBQUNuQyxzREFBc0Q7QUFDdEQsbUZBQW1GO0FBQ25GLE9BQU8sRUFBRSxtQkFBbUIsRUFBa0IsTUFBTSxvQkFBb0IsQ0FBQTtBQUd4RSxPQUFPLEVBQUUsU0FBUyxFQUFFLE1BQU0sNkJBQTZCLENBQUE7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxNQUFNLFdBQVcsQ0FBQTtBQUN4QyxPQUFPLEVBQUUsSUFBSSxFQUFFLE1BQU0sV0FBVyxDQUFBLENBQUMsMkJBQTJCO0FBQzVELE9BQU8sRUFBRSxlQUFlLEVBQUUsTUFBTSxnQkFBZ0IsQ0FBQSxDQUFDLCtCQUErQjtBQUNoRixPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0saUJBQWlCLENBQUEsQ0FBQyw4QkFBOEI7QUFFdkU7OztHQUdHO0FBRUgsbUNBQW1DO0FBQ25DLGdDQUFnQztBQUNoQyxrRUFBa0U7QUFFbEUsTUFBTSxDQUFDLE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxLQUFhLEVBQUUsS0FBYSxFQUFXLEVBQUU7SUFDekUsTUFBTSxLQUFLLEdBQUcsRUFBRSxDQUFDLFlBQVksQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUNyQyxNQUFNLEtBQUssR0FBRyxFQUFFLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ3JDLHNHQUFzRztJQUN0RyxnRUFBZ0U7SUFDaEUseUZBQXlGO0lBQ3pGLE1BQU0sUUFBUSxHQUFHLElBQUksQ0FBQyxRQUFRLENBQUMsS0FBSyxFQUFFLEtBQUssQ0FBQyxDQUFDLENBQUMsb0NBQW9DO0lBQ2xGLE9BQU8sT0FBTyxDQUNaLFFBQVE7UUFDUixDQUFDLFFBQVEsQ0FBQyxVQUFVLENBQUMsSUFBSSxDQUFDO1FBQzFCLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxJQUFJLEdBQUcsSUFBSSxDQUFDLEdBQUcsQ0FBQyxDQUN0QyxDQUFDO0FBQ0osQ0FBQyxDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHLENBQUMsUUFBZ0IsRUFBaUIsRUFBRTtJQUN4RCxJQUFJLENBQUM7UUFDSCxNQUFNLFVBQVUsR0FBRyxFQUFFLENBQUMsWUFBWSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQzdDLE1BQU0sUUFBUSxHQUFHLE1BQU0sQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUNsQyxJQUFJLENBQUMsUUFBUSxFQUFFLENBQUM7WUFDZCxNQUFNLElBQUksS0FBSyxDQUFDLGdDQUFnQyxDQUFDLENBQUM7UUFDcEQsQ0FBQztRQUNELE1BQU0sVUFBVSxHQUFHLFVBQVUsQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDakQsT0FBTyxRQUFRLFFBQVEsV0FBVyxVQUFVLEVBQUUsQ0FBQztJQUNqRCxDQUFDO0lBQUMsT0FBTyxLQUFLLEVBQUUsQ0FBQztRQUNmLE1BQU0sQ0FBQyxLQUFLLENBQUMsb0NBQW9DLEVBQUUsS0FBSyxDQUFDLENBQUM7UUFDMUQsT0FBTyxJQUFJLENBQUM7SUFDZCxDQUFDO0FBQ0gsQ0FBQyxDQUFDO0FBRUYsTUFBTSxDQUFDLE1BQU0sTUFBTSxHQUFHLENBQUMsS0FBZSxFQUFvQyxFQUFFO0lBQzFFLE9BQU8sS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsQ0FBQztRQUN2QixJQUFJLEVBQUUsV0FBVztRQUNqQixTQUFTLEVBQUUsRUFBRSxHQUFHLEVBQUUsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFO0tBQzlCLENBQUMsQ0FBQyxDQUFBO0FBQ0wsQ0FBQyxDQUFBO0FBRUQsNkNBQTZDO0FBRTdDLE1BQU0sQ0FBQyxLQUFLLFVBQVUsR0FBRyxDQUN2QixXQUFtQixFQUFFLHFFQUFxRTtBQUMxRixVQUFvQixFQUFFLEVBQ3RCLE9BQWtCO0lBRWxCLE1BQU0sRUFBRSxLQUFLLEVBQUUsd0JBQXdCLEVBQUUsT0FBTyxFQUFFLEdBQUcsSUFBSSxDQUFDLFdBQVcsRUFBRSxPQUFPLEVBQUUsT0FBTyxDQUFDLE9BQU8sRUFBRSxPQUFPLENBQUMsQ0FBQTtJQUV6RyxJQUFJLGNBQWMsR0FBRyx3QkFBd0IsQ0FBQztJQUU5QywyRUFBMkU7SUFDM0UsSUFBSSxPQUFPLENBQUMsR0FBRyxJQUFJLE9BQU8sQ0FBQyxJQUFJLEtBQUssTUFBTSxDQUFDLFVBQVUsSUFBSSxjQUFjLENBQUMsTUFBTSxHQUFHLENBQUMsRUFBRSxDQUFDO1FBQ25GLE1BQU0sd0JBQXdCLEdBQUcsRUFBRSxDQUFDO1FBQ3BDLEtBQUssTUFBTSxtQkFBbUIsSUFBSSxjQUFjLEVBQUUsQ0FBQztZQUNqRCw0RUFBNEU7WUFDNUUsTUFBTSxnQkFBZ0IsR0FBRyxlQUFlLENBQUMsbUJBQW1CLEVBQUUsV0FBVyxDQUFDLENBQUE7WUFDMUUsTUFBTSxjQUFjLEdBQUc7Z0JBQ3JCLEdBQUcsT0FBTyxDQUFDLFNBQVMsRUFBRSx5Q0FBeUM7Z0JBQy9ELEdBQUcsZ0JBQWdCLEVBQUcsMEJBQTBCO2dCQUNoRCxLQUFLLEVBQUUsT0FBTyxDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsSUFBSSxDQUFDLENBQUMsQ0FBQyxlQUFlO2dCQUN2RSxNQUFNLEVBQUUsT0FBTyxDQUFDLE1BQU0sSUFBSSxnQkFBZ0I7YUFDM0MsQ0FBQTtZQUNELE1BQU0sZ0JBQWdCLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLEdBQUcsRUFBRSxLQUFLLEVBQUUsY0FBYyxDQUFDLENBQUMsQ0FBQztZQUN2RixJQUFJLE1BQU0sQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLE9BQU8sQ0FBQyxNQUFNLEtBQUssU0FBUyxFQUFFLENBQUM7Z0JBQzdELE9BQU8sQ0FBQyxNQUFNLEVBQUUsSUFBSSxDQUFDLHdCQUF3QixJQUFJLENBQUMsUUFBUSxDQUFDLFdBQVcsRUFBRSxtQkFBbUIsQ0FBQyxjQUFjLGdCQUFnQixrQkFBa0IsQ0FBQyxDQUFDO1lBQ2hKLENBQUM7aUJBQU0sQ0FBQztnQkFDTix3QkFBd0IsQ0FBQyxJQUFJLENBQUMsbUJBQW1CLENBQUMsQ0FBQztZQUNyRCxDQUFDO1FBQ0gsQ0FBQztRQUNELGNBQWMsR0FBRyx3QkFBd0IsQ0FBQztJQUM1QyxDQUFDO0lBQ0QsZ0NBQWdDO0lBRWhDLHFEQUFxRDtJQUNyRCxNQUFNLFdBQVcsR0FBRyxjQUFjLENBQUMsR0FBRyxDQUFDLENBQUMsUUFBUSxFQUFFLEVBQUU7UUFDbEQsSUFBSSxDQUFDO1lBQ0gsTUFBTSxZQUFZLEdBQUcsYUFBYSxDQUFDLElBQUksQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLFFBQVEsQ0FBQyxDQUFDLENBQUEsQ0FBQyw2REFBNkQ7WUFDdEksSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLElBQUksTUFBTSxDQUFDLFFBQVEsQ0FBQyxFQUFFLENBQUM7Z0JBQ3pDLE1BQU0sUUFBUSxHQUFHLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxZQUFZLENBQUEsQ0FBQywwQkFBMEI7Z0JBQzVFLE1BQU0sT0FBTyxHQUFHLG1CQUFtQixDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQTtnQkFDeEQsSUFBSSxPQUFPLEVBQUUsQ0FBQztvQkFDWixPQUFPLE9BQU8sQ0FBQyxNQUFNLENBQUMsUUFBUSxFQUFFLFlBQVksQ0FBQyxDQUFBLENBQUMsOENBQThDO2dCQUM5RixDQUFDO2dCQUNELG9EQUFvRDtnQkFDcEQsT0FBTyxtQkFBbUIsQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLEVBQUUsTUFBTSxDQUFDLFFBQVEsRUFBRSxZQUFZLENBQUMsSUFBSSxJQUFJLENBQUE7WUFDekYsQ0FBQztZQUNELE9BQU8sSUFBSSxDQUFBO1FBQ2IsQ0FBQztRQUFDLE9BQU8sS0FBSyxFQUFFLENBQUM7WUFDZixNQUFNLENBQUMsS0FBSyxDQUFDLHNCQUFzQixRQUFRLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQTtZQUN0RCxPQUFPLElBQUksQ0FBQTtRQUNiLENBQUM7SUFDSCxDQUFDLENBQUMsQ0FBQTtJQUVGLG1DQUFtQztJQUNuQyxNQUFNLGNBQWMsR0FBRyxLQUFLLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsR0FBVyxFQUFFLEVBQUU7UUFDbkUsSUFBSSxDQUFDO1lBQ0gsT0FBTyxNQUFNLFlBQVksQ0FBQyxHQUFHLENBQUMsQ0FBQztRQUNqQyxDQUFDO1FBQUMsT0FBTyxLQUFLLEVBQUUsQ0FBQztZQUNmLE1BQU0sQ0FBQyxLQUFLLENBQUMsNEJBQTRCLEdBQUcsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFDO1lBQ3hELE9BQU8sSUFBSSxDQUFDO1FBQ2QsQ0FBQztJQUNILENBQUMsQ0FBQyxDQUFDO0lBRUgsTUFBTSxVQUFVLEdBQUcsTUFBTSxPQUFPLENBQUMsR0FBRyxDQUFDLGNBQWMsQ0FBQyxDQUFDO0lBRXJELDZCQUE2QjtJQUM3QixNQUFNLE9BQU8sR0FBRyxDQUFDLEdBQUcsV0FBVyxFQUFFLEdBQUcsVUFBVSxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDLEtBQUssSUFBSSxDQUFDLENBQUM7SUFDMUUsT0FBTyxPQUFPLENBQUM7QUFDakIsQ0FBQztBQUVELE1BQU0sQ0FBQyxLQUFLLFVBQVUsU0FBUyxDQUFDLElBQVksRUFBRSxPQUFrQjtJQUM5RCxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sRUFBRSxDQUFDO1FBQ3BCLE1BQU0sSUFBSSxLQUFLLENBQUMsNkNBQTZDLENBQUMsQ0FBQTtJQUNoRSxDQUFDO0lBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsQ0FBQyxXQUFXLEVBQUUsQ0FBQTtJQUM1QyxJQUFJLENBQUMsQ0FBQyxHQUFHLElBQUksU0FBUyxDQUFDLEVBQUUsQ0FBQztRQUN4QixNQUFNLElBQUksS0FBSyxDQUFDLDRCQUE0QixHQUFHLHdCQUF3QixNQUFNLENBQUMsSUFBSSxDQUFDLFNBQVMsQ0FBQyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsRUFBRSxDQUFDLENBQUE7SUFDN0csQ0FBQztJQUVELElBQUksQ0FBQztRQUNILHdCQUF3QjtRQUN4QixNQUFNLFdBQVcsR0FBRyxNQUFNLE9BQU8sQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLE1BQU0sQ0FBQztZQUMzRCxJQUFJLEVBQUUsSUFBSSxDQUFDLFFBQVEsQ0FBQyxJQUFJLENBQUM7U0FDMUIsQ0FBQyxDQUFBO1FBRUYsOEJBQThCO1FBQzlCLE1BQU0sVUFBVSxHQUFHLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUM1QyxNQUFNLE9BQU8sQ0FBQyxNQUFNLENBQUMsWUFBWSxDQUFDLFdBQVcsQ0FBQyxhQUFhLENBQUMsV0FBVyxDQUFDLEVBQUUsRUFBRTtZQUMxRSxLQUFLLEVBQUUsQ0FBQyxVQUFVLENBQUM7U0FDcEIsQ0FBQyxDQUFBO1FBRUYsMEVBQTBFO1FBQzFFLE1BQU0sUUFBUSxHQUFHLEdBQUcsSUFBSSxZQUFZLENBQUE7UUFDcEMsTUFBTSxRQUFRLEdBQUc7WUFDZixhQUFhLEVBQUUsV0FBVyxDQUFDLEVBQUU7WUFDN0IsWUFBWSxFQUFFLElBQUksSUFBSSxFQUFFLENBQUMsV0FBVyxFQUFFO1lBQ3RDLFlBQVksRUFBRSxJQUFJO1lBQ2xCLFFBQVEsRUFBRSxTQUFTLENBQUMsR0FBRyxDQUFDO1NBQ3pCLENBQUE7UUFFRCwwQkFBMEI7UUFDMUIsRUFBRSxDQUFDLGFBQWEsQ0FBQyxRQUFRLEVBQUUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxRQUFRLEVBQUUsSUFBSSxFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUE7UUFFN0QsT0FBTyxXQUFXLENBQUMsRUFBRSxDQUFBO0lBQ3ZCLENBQUM7SUFBQyxPQUFPLEtBQUssRUFBRSxDQUFDO1FBQ2YsTUFBTSxDQUFDLEtBQUssQ0FBQyw0QkFBNEIsSUFBSSxHQUFHLEVBQUUsS0FBSyxDQUFDLENBQUE7UUFDeEQsTUFBTSxLQUFLLENBQUE7SUFDYixDQUFDO0FBQ0gsQ0FBQyJ9 \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic291cmNlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vc3JjL3NvdXJjZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEtBQUssSUFBSSxNQUFNLFdBQVcsQ0FBQTtBQUNqQyxPQUFPLEtBQUssRUFBRSxNQUFNLFNBQVMsQ0FBQTtBQUM3QixPQUFPLEVBQUUsSUFBSSxJQUFJLE1BQU0sRUFBRSxNQUFNLHFCQUFxQixDQUFBLENBQUMsNkJBQTZCO0FBQ2xGLE9BQU8sRUFBRSxNQUFNLEVBQUUsYUFBYSxFQUFFLE9BQU8sSUFBSSxXQUFXLEVBQUUsTUFBTSxtQkFBbUIsQ0FBQSxDQUFDLG1EQUFtRDtBQUNySSxPQUFPLEVBQUUsTUFBTSxFQUFFLE1BQU0sWUFBWSxDQUFBO0FBQ25DLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxZQUFZLENBQUE7QUFDbkMsT0FBTyxFQUFFLG1CQUFtQixFQUFrQixNQUFNLG9CQUFvQixDQUFBO0FBR3hFLE9BQU8sRUFBRSxTQUFTLEVBQUUsTUFBTSw2QkFBNkIsQ0FBQTtBQUN2RCxPQUFPLEVBQUUsWUFBWSxFQUFFLE1BQU0sV0FBVyxDQUFBO0FBQ3hDLE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSxXQUFXLENBQUEsQ0FBQywyQkFBMkI7QUFDNUQsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLGdCQUFnQixDQUFBLENBQUMsK0JBQStCO0FBQ2hGLE9BQU8sRUFBRSxNQUFNLEVBQUUsTUFBTSxpQkFBaUIsQ0FBQSxDQUFDLDhCQUE4QjtBQUV2RTs7O0dBR0c7QUFFSCxtQ0FBbUM7QUFDbkMsZ0NBQWdDO0FBQ2hDLGtFQUFrRTtBQUVsRSxNQUFNLENBQUMsTUFBTSxpQkFBaUIsR0FBRyxDQUFDLEtBQWEsRUFBRSxLQUFhLEVBQVcsRUFBRTtJQUN6RSxNQUFNLEtBQUssR0FBRyxFQUFFLENBQUMsWUFBWSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ3JDLE1BQU0sS0FBSyxHQUFHLEVBQUUsQ0FBQyxZQUFZLENBQUMsS0FBSyxDQUFDLENBQUM7SUFDckMsc0dBQXNHO0lBQ3RHLGdFQUFnRTtJQUNoRSx5RkFBeUY7SUFDekYsTUFBTSxRQUFRLEdBQUcsSUFBSSxDQUFDLFFBQVEsQ0FBQyxLQUFLLEVBQUUsS0FBSyxDQUFDLENBQUMsQ0FBQyxvQ0FBb0M7SUFDbEYsT0FBTyxPQUFPLENBQ1osUUFBUTtRQUNSLENBQUMsUUFBUSxDQUFDLFVBQVUsQ0FBQyxJQUFJLENBQUM7UUFDMUIsQ0FBQyxRQUFRLENBQUMsVUFBVSxDQUFDLElBQUksR0FBRyxJQUFJLENBQUMsR0FBRyxDQUFDLENBQ3RDLENBQUM7QUFDSixDQUFDLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsQ0FBQyxRQUFnQixFQUFpQixFQUFFO0lBQ3hELElBQUksQ0FBQztRQUNILE1BQU0sVUFBVSxHQUFHLEVBQUUsQ0FBQyxZQUFZLENBQUMsUUFBUSxDQUFDLENBQUM7UUFDN0MsTUFBTSxRQUFRLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQyxDQUFDO1FBQ2xDLElBQUksQ0FBQyxRQUFRLEVBQUUsQ0FBQztZQUNkLE1BQU0sSUFBSSxLQUFLLENBQUMsZ0NBQWdDLENBQUMsQ0FBQztRQUNwRCxDQUFDO1FBQ0QsTUFBTSxVQUFVLEdBQUcsVUFBVSxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsQ0FBQztRQUNqRCxPQUFPLFFBQVEsUUFBUSxXQUFXLFVBQVUsRUFBRSxDQUFDO0lBQ2pELENBQUM7SUFBQyxPQUFPLEtBQUssRUFBRSxDQUFDO1FBQ2YsTUFBTSxDQUFDLEtBQUssQ0FBQyxvQ0FBb0MsRUFBRSxLQUFLLENBQUMsQ0FBQztRQUMxRCxPQUFPLElBQUksQ0FBQztJQUNkLENBQUM7QUFDSCxDQUFDLENBQUM7QUFFRixNQUFNLENBQUMsTUFBTSxNQUFNLEdBQUcsQ0FBQyxLQUFlLEVBQW9DLEVBQUU7SUFDMUUsT0FBTyxLQUFLLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQyxFQUFFLEVBQUUsQ0FBQyxDQUFDO1FBQ3ZCLElBQUksRUFBRSxXQUFXO1FBQ2pCLFNBQVMsRUFBRSxFQUFFLEdBQUcsRUFBRSxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUU7S0FDOUIsQ0FBQyxDQUFDLENBQUE7QUFDTCxDQUFDLENBQUE7QUFFRCw2Q0FBNkM7QUFFN0MsTUFBTSxDQUFDLEtBQUssVUFBVSxHQUFHLENBQ3ZCLFdBQW1CLEVBQUUscUVBQXFFO0FBQzFGLFVBQW9CLEVBQUUsRUFDdEIsT0FBa0I7SUFFbEIsTUFBTSxFQUFFLEtBQUssRUFBRSx3QkFBd0IsRUFBRSxPQUFPLEVBQUUsR0FBRyxJQUFJLENBQUMsV0FBVyxFQUFFLE9BQU8sRUFBRSxPQUFPLENBQUMsT0FBTyxFQUFFLE9BQU8sQ0FBQyxDQUFBO0lBRXpHLElBQUksY0FBYyxHQUFHLHdCQUF3QixDQUFDO0lBRTlDLDJFQUEyRTtJQUMzRSxJQUFJLE9BQU8sQ0FBQyxHQUFHLElBQUksT0FBTyxDQUFDLElBQUksS0FBSyxNQUFNLENBQUMsVUFBVSxJQUFJLGNBQWMsQ0FBQyxNQUFNLEdBQUcsQ0FBQyxFQUFFLENBQUM7UUFDbkYsTUFBTSx3QkFBd0IsR0FBRyxFQUFFLENBQUM7UUFDcEMsS0FBSyxNQUFNLG1CQUFtQixJQUFJLGNBQWMsRUFBRSxDQUFDO1lBQ2pELDRFQUE0RTtZQUM1RSxNQUFNLGdCQUFnQixHQUFHLGVBQWUsQ0FBQyxtQkFBbUIsRUFBRSxXQUFXLENBQUMsQ0FBQTtZQUMxRSxNQUFNLGNBQWMsR0FBRztnQkFDckIsR0FBRyxPQUFPLENBQUMsU0FBUyxFQUFFLHlDQUF5QztnQkFDL0QsR0FBRyxnQkFBZ0IsRUFBRywwQkFBMEI7Z0JBQ2hELEtBQUssRUFBRSxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMsQ0FBQyxJQUFJLENBQUMsS0FBSyxDQUFDLE9BQU8sQ0FBQyxLQUFLLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLGVBQWU7Z0JBQ3ZFLE1BQU0sRUFBRSxPQUFPLENBQUMsTUFBTSxJQUFJLGdCQUFnQjthQUMzQyxDQUFBO1lBQ0QsTUFBTSxnQkFBZ0IsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLFdBQVcsQ0FBQyxPQUFPLENBQUMsR0FBRyxFQUFFLEtBQUssRUFBRSxjQUFjLENBQUMsQ0FBQyxDQUFDO1lBQ3ZGLElBQUksTUFBTSxDQUFDLGdCQUFnQixDQUFDLElBQUksT0FBTyxDQUFDLE1BQU0sS0FBSyxTQUFTLEVBQUUsQ0FBQztnQkFDN0QsT0FBTyxDQUFDLE1BQU0sRUFBRSxJQUFJLENBQUMsd0JBQXdCLElBQUksQ0FBQyxRQUFRLENBQUMsV0FBVyxFQUFFLG1CQUFtQixDQUFDLGNBQWMsZ0JBQWdCLGtCQUFrQixDQUFDLENBQUM7WUFDaEosQ0FBQztpQkFBTSxDQUFDO2dCQUNOLHdCQUF3QixDQUFDLElBQUksQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDO1lBQ3JELENBQUM7UUFDSCxDQUFDO1FBQ0QsY0FBYyxHQUFHLHdCQUF3QixDQUFDO0lBQzVDLENBQUM7SUFDRCxnQ0FBZ0M7SUFFaEMscURBQXFEO0lBQ3JELE1BQU0sV0FBVyxHQUFHLGNBQWMsQ0FBQyxHQUFHLENBQUMsQ0FBQyxRQUFRLEVBQUUsRUFBRTtRQUNsRCxJQUFJLENBQUM7WUFDSCxNQUFNLFlBQVksR0FBRyxhQUFhLENBQUMsSUFBSSxDQUFDLFFBQVEsQ0FBQyxXQUFXLEVBQUUsUUFBUSxDQUFDLENBQUMsQ0FBQSxDQUFDLDZEQUE2RDtZQUN0SSxJQUFJLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLEVBQUUsQ0FBQztnQkFDekMsTUFBTSxRQUFRLEdBQUcsTUFBTSxDQUFDLFFBQVEsQ0FBQyxJQUFJLFlBQVksQ0FBQSxDQUFDLDBCQUEwQjtnQkFDNUUsTUFBTSxPQUFPLEdBQUcsbUJBQW1CLENBQUMsVUFBVSxDQUFDLFFBQVEsQ0FBQyxDQUFBO2dCQUN4RCxJQUFJLE9BQU8sRUFBRSxDQUFDO29CQUNaLE9BQU8sT0FBTyxDQUFDLE1BQU0sQ0FBQyxRQUFRLEVBQUUsWUFBWSxDQUFDLENBQUEsQ0FBQyw4Q0FBOEM7Z0JBQzlGLENBQUM7Z0JBQ0Qsb0RBQW9EO2dCQUNwRCxPQUFPLG1CQUFtQixDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsRUFBRSxNQUFNLENBQUMsUUFBUSxFQUFFLFlBQVksQ0FBQyxJQUFJLElBQUksQ0FBQTtZQUN6RixDQUFDO1lBQ0QsT0FBTyxJQUFJLENBQUE7UUFDYixDQUFDO1FBQUMsT0FBTyxLQUFLLEVBQUUsQ0FBQztZQUNmLE1BQU0sQ0FBQyxLQUFLLENBQUMsc0JBQXNCLFFBQVEsR0FBRyxFQUFFLEtBQUssQ0FBQyxDQUFBO1lBQ3RELE9BQU8sSUFBSSxDQUFBO1FBQ2IsQ0FBQztJQUNILENBQUMsQ0FBQyxDQUFBO0lBRUYsbUNBQW1DO0lBQ25DLE1BQU0sY0FBYyxHQUFHLEtBQUssQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUMsR0FBRyxDQUFDLEtBQUssRUFBRSxHQUFXLEVBQUUsRUFBRTtRQUNuRSxJQUFJLENBQUM7WUFDSCxPQUFPLE1BQU0sWUFBWSxDQUFDLEdBQUcsQ0FBQyxDQUFDO1FBQ2pDLENBQUM7UUFBQyxPQUFPLEtBQUssRUFBRSxDQUFDO1lBQ2YsTUFBTSxDQUFDLEtBQUssQ0FBQyw0QkFBNEIsR0FBRyxHQUFHLEVBQUUsS0FBSyxDQUFDLENBQUM7WUFDeEQsT0FBTyxJQUFJLENBQUM7UUFDZCxDQUFDO0lBQ0gsQ0FBQyxDQUFDLENBQUM7SUFFSCxNQUFNLFVBQVUsR0FBRyxNQUFNLE9BQU8sQ0FBQyxHQUFHLENBQUMsY0FBYyxDQUFDLENBQUM7SUFFckQsNkJBQTZCO0lBQzdCLE1BQU0sT0FBTyxHQUFHLENBQUMsR0FBRyxXQUFXLEVBQUUsR0FBRyxVQUFVLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDLEVBQUUsRUFBRSxDQUFDLENBQUMsS0FBSyxJQUFJLENBQUMsQ0FBQztJQUMxRSxPQUFPLE9BQU8sQ0FBQztBQUNqQixDQUFDO0FBRUQsTUFBTSxDQUFDLEtBQUssVUFBVSxTQUFTLENBQUMsSUFBWSxFQUFFLE9BQWtCO0lBQzlELElBQUksQ0FBQyxPQUFPLENBQUMsTUFBTSxFQUFFLENBQUM7UUFDcEIsTUFBTSxJQUFJLEtBQUssQ0FBQyw2Q0FBNkMsQ0FBQyxDQUFBO0lBQ2hFLENBQUM7SUFFRCxNQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsT0FBTyxDQUFDLElBQUksQ0FBQyxDQUFDLFdBQVcsRUFBRSxDQUFBO0lBQzVDLElBQUksQ0FBQyxDQUFDLEdBQUcsSUFBSSxTQUFTLENBQUMsRUFBRSxDQUFDO1FBQ3hCLE1BQU0sSUFBSSxLQUFLLENBQUMsNEJBQTRCLEdBQUcsd0JBQXdCLE1BQU0sQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxFQUFFLENBQUMsQ0FBQTtJQUM3RyxDQUFDO0lBRUQsSUFBSSxDQUFDO1FBQ0gsd0JBQXdCO1FBQ3hCLE1BQU0sV0FBVyxHQUFHLE1BQU0sT0FBTyxDQUFDLE1BQU0sQ0FBQyxZQUFZLENBQUMsTUFBTSxDQUFDO1lBQzNELElBQUksRUFBRSxJQUFJLENBQUMsUUFBUSxDQUFDLElBQUksQ0FBQztTQUMxQixDQUFDLENBQUE7UUFFRiw4QkFBOEI7UUFDOUIsTUFBTSxVQUFVLEdBQUcsRUFBRSxDQUFDLGdCQUFnQixDQUFDLElBQUksQ0FBQyxDQUFBO1FBQzVDLE1BQU0sT0FBTyxDQUFDLE1BQU0sQ0FBQyxZQUFZLENBQUMsV0FBVyxDQUFDLGFBQWEsQ0FBQyxXQUFXLENBQUMsRUFBRSxFQUFFO1lBQzFFLEtBQUssRUFBRSxDQUFDLFVBQVUsQ0FBQztTQUNwQixDQUFDLENBQUE7UUFFRiwwRUFBMEU7UUFDMUUsTUFBTSxRQUFRLEdBQUcsR0FBRyxJQUFJLFlBQVksQ0FBQTtRQUNwQyxNQUFNLFFBQVEsR0FBRztZQUNmLGFBQWEsRUFBRSxXQUFXLENBQUMsRUFBRTtZQUM3QixZQUFZLEVBQUUsSUFBSSxJQUFJLEVBQUUsQ0FBQyxXQUFXLEVBQUU7WUFDdEMsWUFBWSxFQUFFLElBQUk7WUFDbEIsUUFBUSxFQUFFLFNBQVMsQ0FBQyxHQUFHLENBQUM7U0FDekIsQ0FBQTtRQUVELDBCQUEwQjtRQUMxQixFQUFFLENBQUMsYUFBYSxDQUFDLFFBQVEsRUFBRSxJQUFJLENBQUMsU0FBUyxDQUFDLFFBQVEsRUFBRSxJQUFJLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQTtRQUU3RCxPQUFPLFdBQVcsQ0FBQyxFQUFFLENBQUE7SUFDdkIsQ0FBQztJQUFDLE9BQU8sS0FBSyxFQUFFLENBQUM7UUFDZixNQUFNLENBQUMsS0FBSyxDQUFDLDRCQUE0QixJQUFJLEdBQUcsRUFBRSxLQUFLLENBQUMsQ0FBQTtRQUN4RCxNQUFNLEtBQUssQ0FBQTtJQUNiLENBQUM7QUFDSCxDQUFDIn0= \ No newline at end of file diff --git a/packages/kbot/dist-in/zod_types.d.ts b/packages/kbot/dist-in/zod_types.d.ts index 95dc917c..cd7168b2 100644 --- a/packages/kbot/dist-in/zod_types.d.ts +++ b/packages/kbot/dist-in/zod_types.d.ts @@ -33,6 +33,8 @@ export interface IKBotOptions {  agentica-org/deepcoder-14b-preview | paid agentica-org/deepcoder-14b-preview:free | free + ai21/jamba-large-1.7 | paid + ai21/jamba-mini-1.7 | paid aion-labs/aion-1.0 | paid aion-labs/aion-1.0-mini | paid aion-labs/aion-rp-llama-3.1-8b | paid @@ -41,18 +43,12 @@ export interface IKBotOptions { amazon/nova-micro-v1 | paid amazon/nova-pro-v1 | paid anthropic/claude-3-haiku | paid - anthropic/claude-3-haiku:beta | paid anthropic/claude-3-opus | paid - anthropic/claude-3-opus:beta | paid anthropic/claude-3.5-haiku | paid anthropic/claude-3.5-haiku-20241022 | paid - anthropic/claude-3.5-haiku:beta | paid anthropic/claude-3.5-sonnet | paid anthropic/claude-3.5-sonnet-20240620 | paid - anthropic/claude-3.5-sonnet-20240620:beta | paid - anthropic/claude-3.5-sonnet:beta | paid anthropic/claude-3.7-sonnet | paid - anthropic/claude-3.7-sonnet:beta | paid anthropic/claude-3.7-sonnet:thinking | paid anthropic/claude-opus-4 | paid anthropic/claude-opus-4.1 | paid @@ -64,8 +60,12 @@ export interface IKBotOptions { arliai/qwq-32b-arliai-rpr-v1 | paid arliai/qwq-32b-arliai-rpr-v1:free | free openrouter/auto | paid + baidu/ernie-4.5-21b-a3b | paid baidu/ernie-4.5-300b-a47b | paid + baidu/ernie-4.5-vl-28b-a3b | paid + baidu/ernie-4.5-vl-424b-a47b | paid bytedance/ui-tars-1.5-7b | paid + deepcogito/cogito-v2-preview-llama-109b-moe | paid cohere/command | paid cohere/command-a | paid cohere/command-r | paid @@ -75,13 +75,16 @@ export interface IKBotOptions { cohere/command-r-plus-04-2024 | paid cohere/command-r-plus-08-2024 | paid cohere/command-r7b-12-2024 | paid + deepcogito/cogito-v2-preview-deepseek-671b | paid deepseek/deepseek-prover-v2 | paid deepseek/deepseek-r1-0528-qwen3-8b | paid deepseek/deepseek-r1-0528-qwen3-8b:free | free deepseek/deepseek-chat | paid deepseek/deepseek-chat-v3-0324 | paid deepseek/deepseek-chat-v3-0324:free | free - deepseek/deepseek-v3-base | paid + deepseek/deepseek-chat-v3.1 | paid + deepseek/deepseek-chat-v3.1:free | free + deepseek/deepseek-v3.1-base | paid deepseek/deepseek-r1 | paid deepseek/deepseek-r1:free | free deepseek/deepseek-r1-0528 | paid @@ -89,11 +92,9 @@ export interface IKBotOptions { deepseek/deepseek-r1-distill-llama-70b | paid deepseek/deepseek-r1-distill-llama-70b:free | free deepseek/deepseek-r1-distill-llama-8b | paid - deepseek/deepseek-r1-distill-qwen-1.5b | paid deepseek/deepseek-r1-distill-qwen-14b | paid deepseek/deepseek-r1-distill-qwen-14b:free | free deepseek/deepseek-r1-distill-qwen-32b | paid - deepseek/deepseek-r1-distill-qwen-7b | paid cognitivecomputations/dolphin-mixtral-8x22b | paid cognitivecomputations/dolphin3.0-mistral-24b | paid cognitivecomputations/dolphin3.0-mistral-24b:free | free @@ -108,6 +109,7 @@ export interface IKBotOptions { google/gemini-2.0-flash-exp:free | free google/gemini-2.0-flash-lite-001 | paid google/gemini-2.5-flash | paid + google/gemini-2.5-flash-image-preview | paid google/gemini-2.5-flash-lite | paid google/gemini-2.5-flash-lite-preview-06-17 | paid google/gemini-2.5-pro | paid @@ -131,9 +133,7 @@ export interface IKBotOptions { infermatic/mn-inferor-12b | paid inflection/inflection-3-pi | paid inflection/inflection-3-productivity | paid - moonshotai/kimi-dev-72b:free | free liquid/lfm-3b | paid - liquid/lfm-40b | paid liquid/lfm-7b | paid meta-llama/llama-guard-3-8b | paid anthracite-org/magnum-v2-72b | paid @@ -147,15 +147,17 @@ export interface IKBotOptions { meta-llama/llama-3.1-70b-instruct | paid meta-llama/llama-3.1-8b-instruct | paid meta-llama/llama-3.2-11b-vision-instruct | paid - meta-llama/llama-3.2-11b-vision-instruct:free | free meta-llama/llama-3.2-1b-instruct | paid meta-llama/llama-3.2-3b-instruct | paid meta-llama/llama-3.2-3b-instruct:free | free meta-llama/llama-3.2-90b-vision-instruct | paid meta-llama/llama-3.3-70b-instruct | paid meta-llama/llama-3.3-70b-instruct:free | free + meta-llama/llama-3.3-8b-instruct:free | free meta-llama/llama-4-maverick | paid + meta-llama/llama-4-maverick:free | free meta-llama/llama-4-scout | paid + meta-llama/llama-4-scout:free | free meta-llama/llama-guard-4-12b | paid meta-llama/llama-guard-2-8b | paid microsoft/mai-ds-r1 | paid @@ -188,9 +190,9 @@ export interface IKBotOptions { mistralai/mistral-7b-instruct | paid mistralai/mistral-7b-instruct:free | free mistralai/mistral-7b-instruct-v0.1 | paid - mistralai/mistral-7b-instruct-v0.2 | paid mistralai/mistral-7b-instruct-v0.3 | paid mistralai/mistral-medium-3 | paid + mistralai/mistral-medium-3.1 | paid mistralai/mistral-nemo | paid mistralai/mistral-nemo:free | free mistralai/mistral-small-24b-instruct-2501 | paid @@ -204,10 +206,12 @@ export interface IKBotOptions { mistralai/pixtral-12b | paid mistralai/pixtral-large-2411 | paid mistralai/mistral-saba | paid - moonshotai/kimi-vl-a3b-thinking | paid - moonshotai/kimi-vl-a3b-thinking:free | free + moonshotai/kimi-dev-72b | paid + moonshotai/kimi-dev-72b:free | free moonshotai/kimi-k2 | paid moonshotai/kimi-k2:free | free + moonshotai/kimi-vl-a3b-thinking | paid + moonshotai/kimi-vl-a3b-thinking:free | free morph/morph-v3-fast | paid morph/morph-v3-large | paid gryphe/mythomax-l2-13b | paid @@ -216,9 +220,10 @@ export interface IKBotOptions { neversleep/noromaid-20b | paid nousresearch/deephermes-3-llama-3-8b-preview:free | free nousresearch/deephermes-3-mistral-24b-preview | paid - nousresearch/nous-hermes-2-mixtral-8x7b-dpo | paid nousresearch/hermes-3-llama-3.1-405b | paid nousresearch/hermes-3-llama-3.1-70b | paid + nousresearch/hermes-4-405b | paid + nousresearch/hermes-4-70b | paid nousresearch/hermes-2-pro-llama-3-8b | paid nvidia/llama-3.1-nemotron-70b-instruct | paid nvidia/llama-3.1-nemotron-ultra-253b-v1 | paid @@ -243,6 +248,7 @@ export interface IKBotOptions { openai/gpt-4o-2024-08-06 | paid openai/gpt-4o-2024-11-20 | paid openai/gpt-4o:extended | paid + openai/gpt-4o-audio-preview | paid openai/gpt-4o-search-preview | paid openai/gpt-4o-mini | paid openai/gpt-4o-mini-2024-07-18 | paid @@ -252,6 +258,7 @@ export interface IKBotOptions { openai/gpt-5-mini | paid openai/gpt-5-nano | paid openai/gpt-oss-120b | paid + openai/gpt-oss-120b:free | free openai/gpt-oss-20b | paid openai/gpt-oss-20b:free | free openai/o1 | paid @@ -264,7 +271,6 @@ export interface IKBotOptions { openai/o3-pro | paid openai/o4-mini | paid openai/o4-mini-high | paid - opengvlab/internvl3-14b | paid perplexity/r1-1776 | paid perplexity/sonar | paid perplexity/sonar-deep-research | paid @@ -272,8 +278,6 @@ export interface IKBotOptions { perplexity/sonar-reasoning | paid perplexity/sonar-reasoning-pro | paid pygmalionai/mythalion-13b | paid - featherless/qwerky-72b:free | free - qwen/qwen-2-72b-instruct | paid qwen/qwen-vl-max | paid qwen/qwen-vl-plus | paid qwen/qwen-max | paid @@ -293,11 +297,14 @@ export interface IKBotOptions { qwen/qwen3-30b-a3b | paid qwen/qwen3-30b-a3b:free | free qwen/qwen3-30b-a3b-instruct-2507 | paid + qwen/qwen3-30b-a3b-thinking-2507 | paid qwen/qwen3-32b | paid qwen/qwen3-4b:free | free qwen/qwen3-8b | paid qwen/qwen3-8b:free | free + qwen/qwen3-coder-30b-a3b-instruct | paid qwen/qwen3-coder | paid + qwen/qwen3-coder:free | free qwen/qwq-32b | paid qwen/qwq-32b:free | free qwen/qwq-32b-preview | paid @@ -312,7 +319,6 @@ export interface IKBotOptions { sao10k/l3-euryale-70b | paid sao10k/l3.1-euryale-70b | paid sao10k/l3.3-euryale-70b | paid - sarvamai/sarvam-m:free | free shisa-ai/shisa-v2-llama3.3-70b | paid shisa-ai/shisa-v2-llama3.3-70b:free | free raifle/sorcererlm-8x22b | paid @@ -324,14 +330,12 @@ export interface IKBotOptions { thedrummer/rocinante-12b | paid thedrummer/skyfall-36b-v2 | paid thedrummer/unslopnemo-12b | paid - thedrummer/valkyrie-49b-v1 | paid thudm/glm-4-32b | paid thudm/glm-4.1v-9b-thinking | paid - thudm/glm-z1-32b:free | free + thudm/glm-z1-32b | paid tngtech/deepseek-r1t-chimera | paid tngtech/deepseek-r1t-chimera:free | free tngtech/deepseek-r1t2-chimera:free | free - scb10x/llama3.1-typhoon2-70b-instruct | paid cognitivecomputations/dolphin-mistral-24b-venice-edition:free | free microsoft/wizardlm-2-8x22b | paid x-ai/grok-2-1212 | paid @@ -341,11 +345,13 @@ export interface IKBotOptions { x-ai/grok-3-mini | paid x-ai/grok-3-mini-beta | paid x-ai/grok-4 | paid + x-ai/grok-code-fast-1 | paid x-ai/grok-vision-beta | paid z-ai/glm-4-32b | paid z-ai/glm-4.5 | paid z-ai/glm-4.5-air | paid z-ai/glm-4.5-air:free | free + z-ai/glm-4.5v | paid   OpenAI models:  @@ -406,7 +412,11 @@ export interface IKBotOptions { gpt-5-mini-2025-08-07 gpt-5-nano gpt-5-nano-2025-08-07 + gpt-audio + gpt-audio-2025-08-28 gpt-image-1 + gpt-realtime + gpt-realtime-2025-08-28 o1 o1-2024-12-17 o1-mini diff --git a/packages/kbot/dist/main_node.cjs b/packages/kbot/dist/main_node.cjs new file mode 100644 index 00000000..61bf96c1 --- /dev/null +++ b/packages/kbot/dist/main_node.cjs @@ -0,0 +1,230470 @@ +#!/usr/bin/env node +/******/ (() => { // webpackBootstrap +/******/ var __webpack_modules__ = ({ + +/***/ 1667: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* + +The MIT License (MIT) + +Original Library + - Copyright (c) Marak Squires + +Additional functionality + - Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var colors = {}; +module['exports'] = colors; + +colors.themes = {}; + +var util = __webpack_require__(39023); +var ansiStyles = colors.styles = __webpack_require__(81797); +var defineProps = Object.defineProperties; +var newLineRegex = new RegExp(/[\r\n]+/g); + +colors.supportsColor = (__webpack_require__(43998).supportsColor); + +if (typeof colors.enabled === 'undefined') { + colors.enabled = colors.supportsColor() !== false; +} + +colors.enable = function() { + colors.enabled = true; +}; + +colors.disable = function() { + colors.enabled = false; +}; + +colors.stripColors = colors.strip = function(str) { + return ('' + str).replace(/\x1B\[\d+m/g, ''); +}; + +// eslint-disable-next-line no-unused-vars +var stylize = colors.stylize = function stylize(str, style) { + if (!colors.enabled) { + return str+''; + } + + var styleMap = ansiStyles[style]; + + // Stylize should work for non-ANSI styles, too + if (!styleMap && style in colors) { + // Style maps like trap operate as functions on strings; + // they don't have properties like open or close. + return colors[style](str); + } + + return styleMap.open + str + styleMap.close; +}; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +var escapeStringRegexp = function(str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + return str.replace(matchOperatorsRe, '\\$&'); +}; + +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; +} + +var styles = (function() { + var ret = {}; + ansiStyles.grey = ansiStyles.gray; + Object.keys(ansiStyles).forEach(function(key) { + ansiStyles[key].closeRe = + new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + ret[key] = { + get: function() { + return build(this._styles.concat(key)); + }, + }; + }); + return ret; +})(); + +var proto = defineProps(function colors() {}, styles); + +function applyStyle() { + var args = Array.prototype.slice.call(arguments); + + var str = args.map(function(arg) { + // Use weak equality check so we can colorize null/undefined in safe mode + if (arg != null && arg.constructor === String) { + return arg; + } else { + return util.inspect(arg); + } + }).join(' '); + + if (!colors.enabled || !str) { + return str; + } + + var newLinesPresent = str.indexOf('\n') != -1; + + var nestedStyles = this._styles; + + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + str = code.open + str.replace(code.closeRe, code.open) + code.close; + if (newLinesPresent) { + str = str.replace(newLineRegex, function(match) { + return code.close + match + code.open; + }); + } + } + + return str; +} + +colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } + for (var style in theme) { + (function(style) { + colors[style] = function(str) { + if (typeof theme[style] === 'object') { + var out = str; + for (var i in theme[style]) { + out = colors[theme[style][i]](out); + } + return out; + } + return colors[theme[style]](str); + }; + })(style); + } +}; + +function init() { + var ret = {}; + Object.keys(styles).forEach(function(name) { + ret[name] = { + get: function() { + return build([name]); + }, + }; + }); + return ret; +} + +var sequencer = function sequencer(map, str) { + var exploded = str.split(''); + exploded = exploded.map(map); + return exploded.join(''); +}; + +// custom formatter methods +colors.trap = __webpack_require__(76356); +colors.zalgo = __webpack_require__(5614); + +// maps +colors.maps = {}; +colors.maps.america = __webpack_require__(42243)(colors); +colors.maps.zebra = __webpack_require__(71263)(colors); +colors.maps.rainbow = __webpack_require__(83333)(colors); +colors.maps.random = __webpack_require__(88212)(colors); + +for (var map in colors.maps) { + (function(map) { + colors[map] = function(str) { + return sequencer(colors.maps[map], str); + }; + })(map); +} + +defineProps(colors, init()); + + +/***/ }), + +/***/ 76356: +/***/ ((module) => { + +module['exports'] = function runTheTrap(text, options) { + var result = ''; + text = text || 'Run the trap, drop the bass'; + text = text.split(''); + var trap = { + a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], + b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], + c: ['\u00a9', '\u023b', '\u03fe'], + d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], + e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', + '\u0a6c'], + f: ['\u04fa'], + g: ['\u0262'], + h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], + i: ['\u0f0f'], + j: ['\u0134'], + k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], + l: ['\u0139'], + m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], + n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], + o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', + '\u06dd', '\u0e4f'], + p: ['\u01f7', '\u048e'], + q: ['\u09cd'], + r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], + s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], + t: ['\u0141', '\u0166', '\u0373'], + u: ['\u01b1', '\u054d'], + v: ['\u05d8'], + w: ['\u0428', '\u0460', '\u047c', '\u0d70'], + x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], + y: ['\u00a5', '\u04b0', '\u04cb'], + z: ['\u01b5', '\u0240'], + }; + text.forEach(function(c) { + c = c.toLowerCase(); + var chars = trap[c] || [' ']; + var rand = Math.floor(Math.random() * chars.length); + if (typeof trap[c] !== 'undefined') { + result += trap[c][rand]; + } else { + result += c; + } + }); + return result; +}; + + +/***/ }), + +/***/ 5614: +/***/ ((module) => { + +// please no +module['exports'] = function zalgo(text, options) { + text = text || ' he is here '; + var soul = { + 'up': [ + '̍', '̎', '̄', '̅', + '̿', '̑', '̆', '̐', + '͒', '͗', '͑', '̇', + '̈', '̊', '͂', '̓', + '̈', '͊', '͋', '͌', + '̃', '̂', '̌', '͐', + '̀', '́', '̋', '̏', + '̒', '̓', '̔', '̽', + '̉', 'ͣ', 'ͤ', 'ͥ', + 'ͦ', 'ͧ', 'ͨ', 'ͩ', + 'ͪ', 'ͫ', 'ͬ', 'ͭ', + 'ͮ', 'ͯ', '̾', '͛', + '͆', '̚', + ], + 'down': [ + '̖', '̗', '̘', '̙', + '̜', '̝', '̞', '̟', + '̠', '̤', '̥', '̦', + '̩', '̪', '̫', '̬', + '̭', '̮', '̯', '̰', + '̱', '̲', '̳', '̹', + '̺', '̻', '̼', 'ͅ', + '͇', '͈', '͉', '͍', + '͎', '͓', '͔', '͕', + '͖', '͙', '͚', '̣', + ], + 'mid': [ + '̕', '̛', '̀', '́', + '͘', '̡', '̢', '̧', + '̨', '̴', '̵', '̶', + '͜', '͝', '͞', + '͟', '͠', '͢', '̸', + '̷', '͡', ' ҉', + ], + }; + var all = [].concat(soul.up, soul.down, soul.mid); + + function randomNumber(range) { + var r = Math.floor(Math.random() * range); + return r; + } + + function isChar(character) { + var bool = false; + all.filter(function(i) { + bool = (i === character); + }); + return bool; + } + + + function heComes(text, options) { + var result = ''; + var counts; + var l; + options = options || {}; + options['up'] = + typeof options['up'] !== 'undefined' ? options['up'] : true; + options['mid'] = + typeof options['mid'] !== 'undefined' ? options['mid'] : true; + options['down'] = + typeof options['down'] !== 'undefined' ? options['down'] : true; + options['size'] = + typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; + text = text.split(''); + for (l in text) { + if (isChar(l)) { + continue; + } + result = result + text[l]; + counts = {'up': 0, 'down': 0, 'mid': 0}; + switch (options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.mid = randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.mid = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down = randomNumber(8) + 1; + break; + } + + var arr = ['up', 'mid', 'down']; + for (var d in arr) { + var index = arr[d]; + for (var i = 0; i <= counts[index]; i++) { + if (options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + } + // don't summon him + return heComes(text, options); +}; + + + +/***/ }), + +/***/ 42243: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + if (letter === ' ') return letter; + switch (i%3) { + case 0: return colors.red(letter); + case 1: return colors.white(letter); + case 2: return colors.blue(letter); + } + }; +}; + + +/***/ }), + +/***/ 83333: +/***/ ((module) => { + +module['exports'] = function(colors) { + // RoY G BiV + var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; + return function(letter, i, exploded) { + if (letter === ' ') { + return letter; + } else { + return colors[rainbowColors[i++ % rainbowColors.length]](letter); + } + }; +}; + + + +/***/ }), + +/***/ 88212: +/***/ ((module) => { + +module['exports'] = function(colors) { + var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', + 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', + 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; + return function(letter, i, exploded) { + return letter === ' ' ? letter : + colors[ + available[Math.round(Math.random() * (available.length - 2))] + ](letter); + }; +}; + + +/***/ }), + +/***/ 71263: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; +}; + + +/***/ }), + +/***/ 81797: +/***/ ((module) => { + +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var styles = {}; +module['exports'] = styles; + +var codes = { + reset: [0, 0], + + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], + + brightRed: [91, 39], + brightGreen: [92, 39], + brightYellow: [93, 39], + brightBlue: [94, 39], + brightMagenta: [95, 39], + brightCyan: [96, 39], + brightWhite: [97, 39], + + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + bgGray: [100, 49], + bgGrey: [100, 49], + + bgBrightRed: [101, 49], + bgBrightGreen: [102, 49], + bgBrightYellow: [103, 49], + bgBrightBlue: [104, 49], + bgBrightMagenta: [105, 49], + bgBrightCyan: [106, 49], + bgBrightWhite: [107, 49], + + // legacy styles for colors pre v1.0.0 + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49], + +}; + +Object.keys(codes).forEach(function(key) { + var val = codes[key]; + var style = styles[key] = []; + style.open = '\u001b[' + val[0] + 'm'; + style.close = '\u001b[' + val[1] + 'm'; +}); + + +/***/ }), + +/***/ 29020: +/***/ ((module) => { + +"use strict"; +/* +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + + + +module.exports = function(flag, argv) { + argv = argv || process.argv || []; + + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); + + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + + +/***/ }), + +/***/ 43998: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + + + +var os = __webpack_require__(70857); +var hasFlag = __webpack_require__(29020); + +var env = process.env; + +var forceColor = void 0; +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') + || hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 + || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + var min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first + // Windows release that supports 256 colors. Windows 10 build 14931 is the + // first release that supports 16m/TrueColor. + var osRelease = os.release().split('.'); + if (Number(process.versions.node.split('.')[0]) >= 8 + && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { + return sign in env; + }) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 + ); + } + + if ('TERM_PROGRAM' in env) { + var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + var level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr), +}; + + +/***/ }), + +/***/ 96230: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// +// Remark: Requiring this file will use the "safe" colors API, +// which will not touch String.prototype. +// +// var colors = require('colors/safe'); +// colors.red("foo") +// +// +var colors = __webpack_require__(1667); +module['exports'] = colors; + + +/***/ }), + +/***/ 91420: +/***/ ((module) => { + +/** + * Contains all configured adapters for the given environment. + * + * @type {Array} + * @public + */ +var adapters = []; + +/** + * Contains all modifier functions. + * + * @typs {Array} + * @public + */ +var modifiers = []; + +/** + * Our default logger. + * + * @public + */ +var logger = function devnull() {}; + +/** + * Register a new adapter that will used to find environments. + * + * @param {Function} adapter A function that will return the possible env. + * @returns {Boolean} Indication of a successful add. + * @public + */ +function use(adapter) { + if (~adapters.indexOf(adapter)) return false; + + adapters.push(adapter); + return true; +} + +/** + * Assign a new log method. + * + * @param {Function} custom The log method. + * @public + */ +function set(custom) { + logger = custom; +} + +/** + * Check if the namespace is allowed by any of our adapters. + * + * @param {String} namespace The namespace that needs to be enabled + * @returns {Boolean|Promise} Indication if the namespace is enabled by our adapters. + * @public + */ +function enabled(namespace) { + var async = []; + + for (var i = 0; i < adapters.length; i++) { + if (adapters[i].async) { + async.push(adapters[i]); + continue; + } + + if (adapters[i](namespace)) return true; + } + + if (!async.length) return false; + + // + // Now that we know that we Async functions, we know we run in an ES6 + // environment and can use all the API's that they offer, in this case + // we want to return a Promise so that we can `await` in React-Native + // for an async adapter. + // + return new Promise(function pinky(resolve) { + Promise.all( + async.map(function prebind(fn) { + return fn(namespace); + }) + ).then(function resolved(values) { + resolve(values.some(Boolean)); + }); + }); +} + +/** + * Add a new message modifier to the debugger. + * + * @param {Function} fn Modification function. + * @returns {Boolean} Indication of a successful add. + * @public + */ +function modify(fn) { + if (~modifiers.indexOf(fn)) return false; + + modifiers.push(fn); + return true; +} + +/** + * Write data to the supplied logger. + * + * @param {Object} meta Meta information about the log. + * @param {Array} args Arguments for console.log. + * @public + */ +function write() { + logger.apply(logger, arguments); +} + +/** + * Process the message with the modifiers. + * + * @param {Mixed} message The message to be transformed by modifers. + * @returns {String} Transformed message. + * @public + */ +function process(message) { + for (var i = 0; i < modifiers.length; i++) { + message = modifiers[i].apply(modifiers[i], arguments); + } + + return message; +} + +/** + * Introduce options to the logger function. + * + * @param {Function} fn Calback function. + * @param {Object} options Properties to introduce on fn. + * @returns {Function} The passed function + * @public + */ +function introduce(fn, options) { + var has = Object.prototype.hasOwnProperty; + + for (var key in options) { + if (has.call(options, key)) { + fn[key] = options[key]; + } + } + + return fn; +} + +/** + * Nope, we're not allowed to write messages. + * + * @returns {Boolean} false + * @public + */ +function nope(options) { + options.enabled = false; + options.modify = modify; + options.set = set; + options.use = use; + + return introduce(function diagnopes() { + return false; + }, options); +} + +/** + * Yep, we're allowed to write debug messages. + * + * @param {Object} options The options for the process. + * @returns {Function} The function that does the logging. + * @public + */ +function yep(options) { + /** + * The function that receives the actual debug information. + * + * @returns {Boolean} indication that we're logging. + * @public + */ + function diagnostics() { + var args = Array.prototype.slice.call(arguments, 0); + + write.call(write, options, process(args, options)); + return true; + } + + options.enabled = true; + options.modify = modify; + options.set = set; + options.use = use; + + return introduce(diagnostics, options); +} + +/** + * Simple helper function to introduce various of helper methods to our given + * diagnostics function. + * + * @param {Function} diagnostics The diagnostics function. + * @returns {Function} diagnostics + * @public + */ +module.exports = function create(diagnostics) { + diagnostics.introduce = introduce; + diagnostics.enabled = enabled; + diagnostics.process = process; + diagnostics.modify = modify; + diagnostics.write = write; + diagnostics.nope = nope; + diagnostics.yep = yep; + diagnostics.set = set; + diagnostics.use = use; + + return diagnostics; +} + + +/***/ }), + +/***/ 98005: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// +// Select the correct build version depending on the environment. +// +if (true) { + module.exports = __webpack_require__(87950); +} else {} + + +/***/ }), + +/***/ 87950: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var create = __webpack_require__(91420); + +/** + * Create a new diagnostics logger. + * + * @param {String} namespace The namespace it should enable. + * @param {Object} options Additional options. + * @returns {Function} The logger. + * @public + */ +var diagnostics = create(function prod(namespace, options) { + options = options || {}; + options.namespace = namespace; + options.prod = true; + options.dev = false; + + if (!(options.force || prod.force)) return prod.nope(options); + return prod.yep(options); +}); + +// +// Expose the diagnostics logger. +// +module.exports = diagnostics; + + +/***/ }), + +/***/ 2068: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +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 __rest = (this && this.__rest) || function (s, e) { + var t = {}; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) + t[p] = s[p]; + if (s != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { + if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) + t[p[i]] = s[p[i]]; + } + return t; +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SeqTransport = void 0; +const seq = __importStar(__webpack_require__(67017)); +const winston_transport_1 = __importDefault(__webpack_require__(86558)); +class SeqTransport extends winston_transport_1.default { + constructor(opts) { + super(opts); + this.logger = new seq.Logger(opts); + setImmediate(() => this.emit('opened')); + } + log(info, next) { + setImmediate(() => this.emit('logged', info)); + const { level, message, exception, stack } = info, props = __rest(info, ["level", "message", "exception", "stack"]); + this.logger.emit({ + timestamp: props.timestamp || new Date(), + level: level, + messageTemplate: message, + properties: props, + exception: exception || stack + }); + next(); + } + close() { + this.logger.close(); + setImmediate(() => this.emit('closed')); + } + flush() { + return this.logger.flush(); + } +} +exports.SeqTransport = SeqTransport; +if (!String.prototype.startsWith) { + Object.defineProperty(String.prototype, 'startsWith', { + value: function (search, rawPos) { + const pos = rawPos > 0 ? rawPos | 0 : 0; + return this.substring(pos, pos + search.length) === search; + }, + }); +} +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 55591: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", ({ value: true })); +__export(__webpack_require__(84558)); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 84558: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const fs_1 = __webpack_require__(79896); +const debug_1 = __importDefault(__webpack_require__(6496)); +const log = debug_1.default('@kwsites/file-exists'); +function check(path, isFile, isDirectory) { + log(`checking %s`, path); + try { + const stat = fs_1.statSync(path); + if (stat.isFile() && isFile) { + log(`[OK] path represents a file`); + return true; + } + if (stat.isDirectory() && isDirectory) { + log(`[OK] path represents a directory`); + return true; + } + log(`[FAIL] path represents something other than a file or directory`); + return false; + } + catch (e) { + if (e.code === 'ENOENT') { + log(`[FAIL] path is not accessible: %o`, e); + return false; + } + log(`[FATAL] %o`, e); + throw e; + } +} +/** + * Synchronous validation of a path existing either as a file or as a directory. + * + * @param {string} path The path to check + * @param {number} type One or both of the exported numeric constants + */ +function exists(path, type = exports.READABLE) { + return check(path, (type & exports.FILE) > 0, (type & exports.FOLDER) > 0); +} +exports.exists = exists; +/** + * Constant representing a file + */ +exports.FILE = 1; +/** + * Constant representing a folder + */ +exports.FOLDER = 2; +/** + * Constant representing either a file or a folder + */ +exports.READABLE = exports.FILE + exports.FOLDER; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 29495: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +var __webpack_unused_export__; + +__webpack_unused_export__ = ({ value: true }); +exports.ud = exports.yX = void 0; +/** + * Creates a new `DeferredPromise` + * + * ```typescript + import {deferred} from '@kwsites/promise-deferred`; + ``` + */ +function deferred() { + let done; + let fail; + let status = 'pending'; + const promise = new Promise((_done, _fail) => { + done = _done; + fail = _fail; + }); + return { + promise, + done(result) { + if (status === 'pending') { + status = 'resolved'; + done(result); + } + }, + fail(error) { + if (status === 'pending') { + status = 'rejected'; + fail(error); + } + }, + get fulfilled() { + return status !== 'pending'; + }, + get status() { + return status; + }, + }; +} +exports.yX = deferred; +/** + * Alias of the exported `deferred` function, to help consumers wanting to use `deferred` as the + * local variable name rather than the factory import name, without needing to rename on import. + * + * ```typescript + import {createDeferred} from '@kwsites/promise-deferred`; + ``` + */ +exports.ud = deferred; +/** + * Default export allows use as: + * + * ```typescript + import deferred from '@kwsites/promise-deferred`; + ``` + */ +__webpack_unused_export__ = deferred; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 53141: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { parse } = __webpack_require__(72636); + +module.exports = function (elt) { + const style = new CSSStyleDeclaration(elt) + const handler = { + get: function(target, property) { + return property in target ? target[property] : target.getPropertyValue(dasherizeProperty(property)); + }, + has: function(target, key) { + return true; + }, + set: function(target, property, value) { + if (property in target) { + target[property] = value; + } else { + target.setProperty(dasherizeProperty(property), value ?? undefined); + } + + return true; + } + }; + + return new Proxy(style, handler); +}; + +function dasherizeProperty(property) { + return property.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); +} + + +function CSSStyleDeclaration(elt) { + this._element = elt; +} + +const IMPORTANT_BANG = '!important'; + +// Utility function for parsing style declarations +// Pass in a string like "margin-left: 5px; border-style: solid" +// and this function returns an object like +// {"margin-left":"5px", "border-style":"solid"} +function parseStyles(value) { + const result = { + property: {}, + priority: {}, + } + + if (!value) { + return result; + } + + const styleValues = parse(value); + if (styleValues.length < 2) { + return result; + } + + for (let i = 0; i < styleValues.length; i += 2) { + const name = styleValues[i]; + let value = styleValues[i+1]; + + if (value.endsWith(IMPORTANT_BANG)) { + result.priority[name] = 'important'; + value = value.slice(0, -IMPORTANT_BANG.length).trim(); + } + + result.property[name] = value; + } + + return result; +} + +var NO_CHANGE = {}; // Private marker object + +CSSStyleDeclaration.prototype = Object.create(Object.prototype, { + + // Return the parsed form of the element's style attribute. + // If the element's style attribute has never been parsed + // or if it has changed since the last parse, then reparse it + // Note that the styles don't get parsed until they're actually needed + _parsed: { get: function() { + if (!this._parsedStyles || this.cssText !== this._lastParsedText) { + var text = this.cssText; + this._parsedStyles = parseStyles(text); + this._lastParsedText = text; + delete this._names; + } + return this._parsedStyles; + }}, + + // Call this method any time the parsed representation of the + // style changes. It converts the style properties to a string and + // sets cssText and the element's style attribute + _serialize: { value: function() { + var styles = this._parsed; + var s = ""; + + for(var name in styles.property) { + if (s) s += " "; + s += name + ": " + styles.property[name]; + if (styles.priority[name]) { + s += " !" + styles.priority[name]; + } + s += ";"; + } + + this.cssText = s; // also sets the style attribute + this._lastParsedText = s; // so we don't reparse + delete this._names; + }}, + + cssText: { + get: function() { + // XXX: this is a CSSStyleDeclaration for an element. + // A different impl might be necessary for a set of styles + // associated returned by getComputedStyle(), e.g. + return this._element.getAttribute("style"); + }, + set: function(value) { + // XXX: I should parse and serialize the value to + // normalize it and remove errors. FF and chrome do that. + this._element.setAttribute("style", value); + } + }, + + length: { get: function() { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names.length; + }}, + + item: { value: function(n) { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names[n]; + }}, + + getPropertyValue: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.property[property] || ""; + }}, + + getPropertyPriority: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.priority[property] || ""; + }}, + + setProperty: { value: function(property, value, priority) { + property = property.toLowerCase(); + if (value === null || value === undefined) { + value = ""; + } + if (priority === null || priority === undefined) { + priority = ""; + } + + // String coercion + if (value !== NO_CHANGE) { + value = "" + value; + } + + value = value.trim(); + if (value === "") { + this.removeProperty(property); + return; + } + + if (priority !== "" && priority !== NO_CHANGE && + !/^important$/i.test(priority)) { + return; + } + + var styles = this._parsed; + if (value === NO_CHANGE) { + if (!styles.property[property]) { + return; // Not a valid property name. + } + if (priority !== "") { + styles.priority[property] = "important"; + } else { + delete styles.priority[property]; + } + } else { + // We don't just accept the property value. Instead + // we parse it to ensure that it is something valid. + // If it contains a semicolon it is invalid + if (value.indexOf(";") !== -1) return; + + var newprops = parseStyles(property + ":" + value); + if (Object.getOwnPropertyNames(newprops.property).length === 0) { + return; // no valid property found + } + if (Object.getOwnPropertyNames(newprops.priority).length !== 0) { + return; // if the value included '!important' it wasn't valid. + } + + // XXX handle shorthand properties + + for (var p in newprops.property) { + styles.property[p] = newprops.property[p]; + if (priority === NO_CHANGE) { + continue; + } else if (priority !== "") { + styles.priority[p] = "important"; + } else if (styles.priority[p]) { + delete styles.priority[p]; + } + } + } + + // Serialize and update cssText and element.style! + this._serialize(); + }}, + + setPropertyValue: { value: function(property, value) { + return this.setProperty(property, value, NO_CHANGE); + }}, + + setPropertyPriority: { value: function(property, priority) { + return this.setProperty(property, NO_CHANGE, priority); + }}, + + removeProperty: { value: function(property) { + property = property.toLowerCase(); + var styles = this._parsed; + if (property in styles.property) { + delete styles.property[property]; + delete styles.priority[property]; + + // Serialize and update cssText and element.style! + this._serialize(); + } + }}, +}); + + +/***/ }), + +/***/ 90086: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* jshint bitwise: false */ + +module.exports = CharacterData; + +var Leaf = __webpack_require__(8161); +var utils = __webpack_require__(89076); +var ChildNode = __webpack_require__(52091); +var NonDocumentTypeChildNode = __webpack_require__(32001); + +function CharacterData() { + Leaf.call(this); +} + +CharacterData.prototype = Object.create(Leaf.prototype, { + // DOMString substringData(unsigned long offset, + // unsigned long count); + // The substringData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length, return a DOMString whose value is + // the UTF-16 code units from the offsetth UTF-16 code + // unit to the end of data. + // + // Return a DOMString whose value is the UTF-16 code + // units from the offsetth UTF-16 code unit to the + // offset+countth UTF-16 code unit in data. + substringData: { value: function substringData(offset, count) { + if (arguments.length < 2) { throw new TypeError("Not enough arguments"); } + // Convert arguments to WebIDL "unsigned long" + offset = offset >>> 0; + count = count >>> 0; + if (offset > this.data.length || offset < 0 || count < 0) { + utils.IndexSizeError(); + } + return this.data.substring(offset, offset+count); + }}, + + // void appendData(DOMString data); + // The appendData(data) method must append data to the context + // object's data. + appendData: { value: function appendData(data) { + if (arguments.length < 1) { throw new TypeError("Not enough arguments"); } + this.data += String(data); + }}, + + // void insertData(unsigned long offset, DOMString data); + // The insertData(offset, data) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // Insert data into the context object's data after + // offset UTF-16 code units. + // + insertData: { value: function insertData(offset, data) { + return this.replaceData(offset, 0, data); + }}, + + + // void deleteData(unsigned long offset, unsigned long count); + // The deleteData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length var count be length-offset. + // + // Starting from offset UTF-16 code units remove count + // UTF-16 code units from the context object's data. + deleteData: { value: function deleteData(offset, count) { + return this.replaceData(offset, count, ''); + }}, + + + // void replaceData(unsigned long offset, unsigned long count, + // DOMString data); + // + // The replaceData(offset, count, data) method must act as + // if the deleteData() method is invoked with offset and + // count as arguments followed by the insertData() method + // with offset and data as arguments and re-throw any + // exceptions these methods might have thrown. + replaceData: { value: function replaceData(offset, count, data) { + var curtext = this.data, len = curtext.length; + // Convert arguments to correct WebIDL type + offset = offset >>> 0; + count = count >>> 0; + data = String(data); + + if (offset > len || offset < 0) utils.IndexSizeError(); + + if (offset+count > len) + count = len - offset; + + var prefix = curtext.substring(0, offset), + suffix = curtext.substring(offset+count); + + this.data = prefix + data + suffix; + }}, + + // Utility method that Node.isEqualNode() calls to test Text and + // Comment nodes for equality. It is okay to put it here, since + // Node will have already verified that nodeType is equal + isEqual: { value: function isEqual(n) { + return this._data === n._data; + }}, + + length: { get: function() { return this.data.length; }} + +}); + +Object.defineProperties(CharacterData.prototype, ChildNode); +Object.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode); + + +/***/ }), + +/***/ 52091: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Node = __webpack_require__(97537); +var LinkedList = __webpack_require__(41360); + +var createDocumentFragmentFromArguments = function(document, args) { + var docFrag = document.createDocumentFragment(); + + for (var i=0; i { + +"use strict"; + +module.exports = Comment; + +var Node = __webpack_require__(97537); +var CharacterData = __webpack_require__(90086); + +function Comment(doc, data) { + CharacterData.call(this); + this.nodeType = Node.COMMENT_NODE; + this.ownerDocument = doc; + this._data = data; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + } +}; + +Comment.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: '#comment' }, + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + // Utility methods + clone: { value: function clone() { + return new Comment(this.ownerDocument, this._data); + }}, +}); + + +/***/ }), + +/***/ 38554: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = ContainerNode; + +var Node = __webpack_require__(97537); +var NodeList = __webpack_require__(64965); + +// This class defines common functionality for node subtypes that +// can have children + +function ContainerNode() { + Node.call(this); + this._firstChild = this._childNodes = null; +} + +// Primary representation is a circular linked list of siblings +ContainerNode.prototype = Object.create(Node.prototype, { + + hasChildNodes: { value: function() { + if (this._childNodes) { + return this._childNodes.length > 0; + } + return this._firstChild !== null; + }}, + + childNodes: { get: function() { + this._ensureChildNodes(); + return this._childNodes; + }}, + + firstChild: { get: function() { + if (this._childNodes) { + return this._childNodes.length === 0 ? null : this._childNodes[0]; + } + return this._firstChild; + }}, + + lastChild: { get: function() { + var kids = this._childNodes, first; + if (kids) { + return kids.length === 0 ? null: kids[kids.length-1]; + } + first = this._firstChild; + if (first === null) { return null; } + return first._previousSibling; // circular linked list + }}, + + _ensureChildNodes: { value: function() { + if (this._childNodes) { return; } + var first = this._firstChild, + kid = first, + childNodes = this._childNodes = new NodeList(); + if (first) do { + childNodes.push(kid); + kid = kid._nextSibling; + } while (kid !== first); // circular linked list + this._firstChild = null; // free memory + }}, + + // Remove all of this node's children. This is a minor + // optimization that only calls modify() once. + removeChildren: { value: function removeChildren() { + var root = this.rooted ? this.ownerDocument : null, + next = this.firstChild, + kid; + while (next !== null) { + kid = next; + next = kid.nextSibling; + + if (root) root.mutateRemove(kid); + kid.parentNode = null; + } + if (this._childNodes) { + this._childNodes.length = 0; + } else { + this._firstChild = null; + } + this.modify(); // Update last modified type once only + }}, + +}); + + +/***/ }), + +/***/ 22112: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = CustomEvent; + +var Event = __webpack_require__(13441); + +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); + + +/***/ }), + +/***/ 46364: +/***/ ((module) => { + +"use strict"; + +module.exports = DOMException; + +var INDEX_SIZE_ERR = 1; +var HIERARCHY_REQUEST_ERR = 3; +var WRONG_DOCUMENT_ERR = 4; +var INVALID_CHARACTER_ERR = 5; +var NO_MODIFICATION_ALLOWED_ERR = 7; +var NOT_FOUND_ERR = 8; +var NOT_SUPPORTED_ERR = 9; +var INVALID_STATE_ERR = 11; +var SYNTAX_ERR = 12; +var INVALID_MODIFICATION_ERR = 13; +var NAMESPACE_ERR = 14; +var INVALID_ACCESS_ERR = 15; +var TYPE_MISMATCH_ERR = 17; +var SECURITY_ERR = 18; +var NETWORK_ERR = 19; +var ABORT_ERR = 20; +var URL_MISMATCH_ERR = 21; +var QUOTA_EXCEEDED_ERR = 22; +var TIMEOUT_ERR = 23; +var INVALID_NODE_TYPE_ERR = 24; +var DATA_CLONE_ERR = 25; + +// Code to name +var names = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR', + null, // historical + 'HIERARCHY_REQUEST_ERR', + 'WRONG_DOCUMENT_ERR', + 'INVALID_CHARACTER_ERR', + null, // historical + 'NO_MODIFICATION_ALLOWED_ERR', + 'NOT_FOUND_ERR', + 'NOT_SUPPORTED_ERR', + 'INUSE_ATTRIBUTE_ERR', // historical + 'INVALID_STATE_ERR', + 'SYNTAX_ERR', + 'INVALID_MODIFICATION_ERR', + 'NAMESPACE_ERR', + 'INVALID_ACCESS_ERR', + null, // historical + 'TYPE_MISMATCH_ERR', + 'SECURITY_ERR', + 'NETWORK_ERR', + 'ABORT_ERR', + 'URL_MISMATCH_ERR', + 'QUOTA_EXCEEDED_ERR', + 'TIMEOUT_ERR', + 'INVALID_NODE_TYPE_ERR', + 'DATA_CLONE_ERR', +]; + +// Code to message +// These strings are from the 13 May 2011 Editor's Draft of DOM Core. +// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html +// Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved. +// Used under the terms of the W3C Document License: +// http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231 +var messages = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR (1): the index is not in the allowed range', + null, + 'HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model', + 'WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required', + 'INVALID_CHARACTER_ERR (5): the string contains invalid characters', + null, + 'NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified', + 'NOT_FOUND_ERR (8): the object can not be found here', + 'NOT_SUPPORTED_ERR (9): this operation is not supported', + 'INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute', + 'INVALID_STATE_ERR (11): the object is in an invalid state', + 'SYNTAX_ERR (12): the string did not match the expected pattern', + 'INVALID_MODIFICATION_ERR (13): the object can not be modified in this way', + 'NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML', + 'INVALID_ACCESS_ERR (15): the object does not support the operation or argument', + null, + 'TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type', + 'SECURITY_ERR (18): the operation is insecure', + 'NETWORK_ERR (19): a network error occurred', + 'ABORT_ERR (20): the user aborted an operation', + 'URL_MISMATCH_ERR (21): the given URL does not match another URL', + 'QUOTA_EXCEEDED_ERR (22): the quota has been exceeded', + 'TIMEOUT_ERR (23): a timeout occurred', + 'INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation', + 'DATA_CLONE_ERR (25): the object can not be cloned.' +]; + +// Name to code +var constants = { + INDEX_SIZE_ERR: INDEX_SIZE_ERR, + DOMSTRING_SIZE_ERR: 2, // historical + HIERARCHY_REQUEST_ERR: HIERARCHY_REQUEST_ERR, + WRONG_DOCUMENT_ERR: WRONG_DOCUMENT_ERR, + INVALID_CHARACTER_ERR: INVALID_CHARACTER_ERR, + NO_DATA_ALLOWED_ERR: 6, // historical + NO_MODIFICATION_ALLOWED_ERR: NO_MODIFICATION_ALLOWED_ERR, + NOT_FOUND_ERR: NOT_FOUND_ERR, + NOT_SUPPORTED_ERR: NOT_SUPPORTED_ERR, + INUSE_ATTRIBUTE_ERR: 10, // historical + INVALID_STATE_ERR: INVALID_STATE_ERR, + SYNTAX_ERR: SYNTAX_ERR, + INVALID_MODIFICATION_ERR: INVALID_MODIFICATION_ERR, + NAMESPACE_ERR: NAMESPACE_ERR, + INVALID_ACCESS_ERR: INVALID_ACCESS_ERR, + VALIDATION_ERR: 16, // historical + TYPE_MISMATCH_ERR: TYPE_MISMATCH_ERR, + SECURITY_ERR: SECURITY_ERR, + NETWORK_ERR: NETWORK_ERR, + ABORT_ERR: ABORT_ERR, + URL_MISMATCH_ERR: URL_MISMATCH_ERR, + QUOTA_EXCEEDED_ERR: QUOTA_EXCEEDED_ERR, + TIMEOUT_ERR: TIMEOUT_ERR, + INVALID_NODE_TYPE_ERR: INVALID_NODE_TYPE_ERR, + DATA_CLONE_ERR: DATA_CLONE_ERR +}; + +function DOMException(code) { + Error.call(this); + Error.captureStackTrace(this, this.constructor); + this.code = code; + this.message = messages[code]; + this.name = names[code]; +} +DOMException.prototype.__proto__ = Error.prototype; + +// Initialize the constants on DOMException and DOMException.prototype +for(var c in constants) { + var v = { value: constants[c] }; + Object.defineProperty(DOMException, c, v); + Object.defineProperty(DOMException.prototype, c, v); +} + + +/***/ }), + +/***/ 80931: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DOMImplementation; + +var Document = __webpack_require__(35452); +var DocumentType = __webpack_require__(73092); +var HTMLParser = __webpack_require__(91895); +var utils = __webpack_require__(89076); +var xml = __webpack_require__(66798); + +// Each document must have its own instance of the domimplementation object +function DOMImplementation(contextObject) { + this.contextObject = contextObject; +} + + +// Feature/version pairs that DOMImplementation.hasFeature() returns +// true for. It returns false for anything else. +var supportedFeatures = { + 'xml': { '': true, '1.0': true, '2.0': true }, // DOM Core + 'core': { '': true, '2.0': true }, // DOM Core + 'html': { '': true, '1.0': true, '2.0': true} , // HTML + 'xhtml': { '': true, '1.0': true, '2.0': true} , // HTML +}; + +DOMImplementation.prototype = { + hasFeature: function hasFeature(feature, version) { + var f = supportedFeatures[(feature || '').toLowerCase()]; + return (f && f[version || '']) || false; + }, + + createDocumentType: function createDocumentType(qualifiedName, publicId, systemId) { + if (!xml.isValidQName(qualifiedName)) utils.InvalidCharacterError(); + + return new DocumentType(this.contextObject, qualifiedName, publicId, systemId); + }, + + createDocument: function createDocument(namespace, qualifiedName, doctype) { + // + // Note that the current DOMCore spec makes it impossible to + // create an HTML document with this function, even if the + // namespace and doctype are propertly set. See this thread: + // http://lists.w3.org/Archives/Public/www-dom/2011AprJun/0132.html + // + var d = new Document(false, null); + var e; + + if (qualifiedName) + e = d.createElementNS(namespace, qualifiedName); + else + e = null; + + if (doctype) { + d.appendChild(doctype); + } + + if (e) d.appendChild(e); + if (namespace === utils.NAMESPACE.HTML) { + d._contentType = 'application/xhtml+xml'; + } else if (namespace === utils.NAMESPACE.SVG) { + d._contentType = 'image/svg+xml'; + } else { + d._contentType = 'application/xml'; + } + + return d; + }, + + createHTMLDocument: function createHTMLDocument(titleText) { + var d = new Document(true, null); + d.appendChild(new DocumentType(d, 'html')); + var html = d.createElement('html'); + d.appendChild(html); + var head = d.createElement('head'); + html.appendChild(head); + if (titleText !== undefined) { + var title = d.createElement('title'); + head.appendChild(title); + title.appendChild(d.createTextNode(titleText)); + } + html.appendChild(d.createElement('body')); + d.modclock = 1; // Start tracking modifications + return d; + }, + + mozSetOutputMutationHandler: function(doc, handler) { + doc.mutationHandler = handler; + }, + + mozGetInputMutationHandler: function(doc) { + utils.nyi(); + }, + + mozHTMLParser: HTMLParser, +}; + + +/***/ }), + +/***/ 82840: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// DOMTokenList implementation based on https://github.com/Raynos/DOM-shim +var utils = __webpack_require__(89076); + +module.exports = DOMTokenList; + +function DOMTokenList(getter, setter) { + this._getString = getter; + this._setString = setter; + this._length = 0; + this._lastStringValue = ''; + this._update(); +} + +Object.defineProperties(DOMTokenList.prototype, { + length: { get: function() { return this._length; } }, + item: { value: function(index) { + var list = getList(this); + if (index < 0 || index >= list.length) { + return null; + } + return list[index]; + }}, + + contains: { value: function(token) { + token = String(token); // no error checking for contains() + var list = getList(this); + return list.indexOf(token) > -1; + }}, + + add: { value: function() { + var list = getList(this); + for (var i = 0, len = arguments.length; i < len; i++) { + var token = handleErrors(arguments[i]); + if (list.indexOf(token) < 0) { + list.push(token); + } + } + // Note: as per spec, if handleErrors() throws any errors, we never + // make it here and none of the changes take effect. + // Also per spec: we run the "update steps" even if no change was + // made (ie, if the token already existed) + this._update(list); + }}, + + remove: { value: function() { + var list = getList(this); + for (var i = 0, len = arguments.length; i < len; i++) { + var token = handleErrors(arguments[i]); + var index = list.indexOf(token); + if (index > -1) { + list.splice(index, 1); + } + } + // Note: as per spec, if handleErrors() throws any errors, we never + // make it here and none of the changes take effect. + // Also per spec: we run the "update steps" even if no change was + // made (ie, if the token wasn't previously present) + this._update(list); + }}, + + toggle: { value: function toggle(token, force) { + token = handleErrors(token); + if (this.contains(token)) { + if (force === undefined || force === false) { + this.remove(token); + return false; + } + return true; + } else { + if (force === undefined || force === true) { + this.add(token); + return true; + } + return false; + } + }}, + + replace: { value: function replace(token, newToken) { + // weird corner case of spec: if `token` contains whitespace, but + // `newToken` is the empty string, we must throw SyntaxError not + // InvalidCharacterError (sigh) + if (String(newToken)==='') { utils.SyntaxError(); } + token = handleErrors(token); + newToken = handleErrors(newToken); + var list = getList(this); + var idx = list.indexOf(token); + if (idx < 0) { + // Note that, per spec, we do not run the update steps on this path. + return false; + } + var idx2 = list.indexOf(newToken); + if (idx2 < 0) { + list[idx] = newToken; + } else { + // "replace the first instance of either `token` or `newToken` with + // `newToken` and remove all other instances" + if (idx < idx2) { + list[idx] = newToken; + list.splice(idx2, 1); + } else { + // idx2 is already `newToken` + list.splice(idx, 1); + } + } + this._update(list); + return true; + }}, + + toString: { value: function() { + return this._getString(); + }}, + + value: { + get: function() { + return this._getString(); + }, + set: function(v) { + this._setString(v); + this._update(); + } + }, + + // Called when the setter is called from outside this interface. + _update: { value: function(list) { + if (list) { + fixIndex(this, list); + this._setString(list.join(" ").trim()); + } else { + fixIndex(this, getList(this)); + } + this._lastStringValue = this._getString(); + } }, +}); + +function fixIndex(clist, list) { + var oldLength = clist._length; + var i; + clist._length = list.length; + for (i = 0; i < list.length; i++) { + clist[i] = list[i]; + } + // Clear/free old entries. + for (; i < oldLength; i++) { + clist[i] = undefined; + } +} + +function handleErrors(token) { + token = String(token); + if (token === "") { + utils.SyntaxError(); + } + if (/[ \t\r\n\f]/.test(token)) { + utils.InvalidCharacterError(); + } + return token; +} + +function toArray(clist) { + var length = clist._length; + var arr = Array(length); + for (var i = 0; i < length; i++) { + arr[i] = clist[i]; + } + return arr; +} + +function getList(clist) { + var strProp = clist._getString(); + if (strProp === clist._lastStringValue) { + return toArray(clist); + } + var str = strProp.replace(/(^[ \t\r\n\f]+)|([ \t\r\n\f]+$)/g, ''); + if (str === "") { + return []; + } else { + var seen = Object.create(null); + return str.split(/[ \t\r\n\f]+/g).filter(function(n) { + var key = '$' + n; + if (seen[key]) { return false; } + seen[key] = true; + return true; + }); + } +} + + +/***/ }), + +/***/ 35452: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Document; + +var Node = __webpack_require__(97537); +var NodeList = __webpack_require__(64965); +var ContainerNode = __webpack_require__(38554); +var Element = __webpack_require__(77301); +var Text = __webpack_require__(58210); +var Comment = __webpack_require__(17548); +var Event = __webpack_require__(13441); +var DocumentFragment = __webpack_require__(17948); +var ProcessingInstruction = __webpack_require__(81248); +var DOMImplementation = __webpack_require__(80931); +var TreeWalker = __webpack_require__(44507); +var NodeIterator = __webpack_require__(30419); +var NodeFilter = __webpack_require__(383); +var URL = __webpack_require__(85184); +var select = __webpack_require__(23509); +var events = __webpack_require__(18196); +var xml = __webpack_require__(66798); +var html = __webpack_require__(96324); +var svg = __webpack_require__(967); +var utils = __webpack_require__(89076); +var MUTATE = __webpack_require__(40993); +var NAMESPACE = utils.NAMESPACE; +var isApiWritable = (__webpack_require__(66139)/* .isApiWritable */ .h); + +function Document(isHTML, address) { + ContainerNode.call(this); + this.nodeType = Node.DOCUMENT_NODE; + this.isHTML = isHTML; + this._address = address || 'about:blank'; + this.readyState = 'loading'; + this.implementation = new DOMImplementation(this); + + // DOMCore says that documents are always associated with themselves + this.ownerDocument = null; // ... but W3C tests expect null + this._contentType = isHTML ? 'text/html' : 'application/xml'; + + // These will be initialized by our custom versions of + // appendChild and insertBefore that override the inherited + // Node methods. + // XXX: override those methods! + this.doctype = null; + this.documentElement = null; + + // "Associated inert template document" + this._templateDocCache = null; + // List of active NodeIterators, see NodeIterator#_preremove() + this._nodeIterators = null; + + // Documents are always rooted, by definition + this._nid = 1; + this._nextnid = 2; // For numbering children of the document + this._nodes = [null, this]; // nid to node map + + // This maintains the mapping from element ids to element nodes. + // We may need to update this mapping every time a node is rooted + // or uprooted, and any time an attribute is added, removed or changed + // on a rooted element. + this.byId = Object.create(null); + + // This property holds a monotonically increasing value akin to + // a timestamp used to record the last modification time of nodes + // and their subtrees. See the lastModTime attribute and modify() + // method of the Node class. And see FilteredElementList for an example + // of the use of lastModTime + this.modclock = 0; +} + +// Map from lowercase event category names (used as arguments to +// createEvent()) to the property name in the impl object of the +// event constructor. +var supportedEvents = { + event: 'Event', + customevent: 'CustomEvent', + uievent: 'UIEvent', + mouseevent: 'MouseEvent' +}; + +// Certain arguments to document.createEvent() must be treated specially +var replacementEvent = { + events: 'event', + htmlevents: 'event', + mouseevents: 'mouseevent', + mutationevents: 'mutationevent', + uievents: 'uievent' +}; + +var mirrorAttr = function(f, name, defaultValue) { + return { + get: function() { + var o = f.call(this); + if (o) { return o[name]; } + return defaultValue; + }, + set: function(value) { + var o = f.call(this); + if (o) { o[name] = value; } + }, + }; +}; + +/** @spec https://dom.spec.whatwg.org/#validate-and-extract */ +function validateAndExtract(namespace, qualifiedName) { + var prefix, localName, pos; + if (namespace==='') { namespace = null; } + // See https://github.com/whatwg/dom/issues/671 + // and https://github.com/whatwg/dom/issues/319 + if (!xml.isValidQName(qualifiedName)) { + utils.InvalidCharacterError(); + } + prefix = null; + localName = qualifiedName; + + pos = qualifiedName.indexOf(':'); + if (pos >= 0) { + prefix = qualifiedName.substring(0, pos); + localName = qualifiedName.substring(pos+1); + } + if (prefix !== null && namespace === null) { + utils.NamespaceError(); + } + if (prefix === 'xml' && namespace !== NAMESPACE.XML) { + utils.NamespaceError(); + } + if ((prefix === 'xmlns' || qualifiedName === 'xmlns') && + namespace !== NAMESPACE.XMLNS) { + utils.NamespaceError(); + } + if (namespace === NAMESPACE.XMLNS && !(prefix==='xmlns' || qualifiedName==='xmlns')) { + utils.NamespaceError(); + } + return { namespace: namespace, prefix: prefix, localName: localName }; +} + +Document.prototype = Object.create(ContainerNode.prototype, { + // This method allows dom.js to communicate with a renderer + // that displays the document in some way + // XXX: I should probably move this to the window object + _setMutationHandler: { value: function(handler) { + this.mutationHandler = handler; + }}, + + // This method allows dom.js to receive event notifications + // from the renderer. + // XXX: I should probably move this to the window object + _dispatchRendererEvent: { value: function(targetNid, type, details) { + var target = this._nodes[targetNid]; + if (!target) return; + target._dispatchEvent(new Event(type, details), true); + }}, + + nodeName: { value: '#document'}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + + // XXX: DOMCore may remove documentURI, so it is NYI for now + documentURI: { get: function() { return this._address; }, set: utils.nyi }, + compatMode: { get: function() { + // The _quirks property is set by the HTML parser + return this._quirks ? 'BackCompat' : 'CSS1Compat'; + }}, + + createTextNode: { value: function(data) { + return new Text(this, String(data)); + }}, + createComment: { value: function(data) { + return new Comment(this, data); + }}, + createDocumentFragment: { value: function() { + return new DocumentFragment(this); + }}, + createProcessingInstruction: { value: function(target, data) { + if (!xml.isValidName(target) || data.indexOf('?>') !== -1) + utils.InvalidCharacterError(); + return new ProcessingInstruction(this, target, data); + }}, + + createAttribute: { value: function(localName) { + localName = String(localName); + if (!xml.isValidName(localName)) utils.InvalidCharacterError(); + if (this.isHTML) { + localName = utils.toASCIILowerCase(localName); + } + return new Element._Attr(null, localName, null, null, ''); + }}, + createAttributeNS: { value: function(namespace, qualifiedName) { + // Convert parameter types according to WebIDL + namespace = + (namespace === null || namespace === undefined || namespace === '') ? null : + String(namespace); + qualifiedName = String(qualifiedName); + var ve = validateAndExtract(namespace, qualifiedName); + return new Element._Attr(null, ve.localName, ve.prefix, ve.namespace, ''); + }}, + + createElement: { value: function(localName) { + localName = String(localName); + if (!xml.isValidName(localName)) utils.InvalidCharacterError(); + // Per spec, namespace should be HTML namespace if "context object is + // an HTML document or context object's content type is + // "application/xhtml+xml", and null otherwise. + if (this.isHTML) { + if (/[A-Z]/.test(localName)) + localName = utils.toASCIILowerCase(localName); + return html.createElement(this, localName, null); + } else if (this.contentType === 'application/xhtml+xml') { + return html.createElement(this, localName, null); + } else { + return new Element(this, localName, null, null); + } + }, writable: isApiWritable }, + + createElementNS: { value: function(namespace, qualifiedName) { + // Convert parameter types according to WebIDL + namespace = + (namespace === null || namespace === undefined || namespace === '') ? null : + String(namespace); + qualifiedName = String(qualifiedName); + var ve = validateAndExtract(namespace, qualifiedName); + return this._createElementNS(ve.localName, ve.namespace, ve.prefix); + }, writable: isApiWritable }, + + // This is used directly by HTML parser, which allows it to create + // elements with localNames containing ':' and non-default namespaces + _createElementNS: { value: function(localName, namespace, prefix) { + if (namespace === NAMESPACE.HTML) { + return html.createElement(this, localName, prefix); + } + else if (namespace === NAMESPACE.SVG) { + return svg.createElement(this, localName, prefix); + } + + return new Element(this, localName, namespace, prefix); + }}, + + createEvent: { value: function createEvent(interfaceName) { + interfaceName = interfaceName.toLowerCase(); + var name = replacementEvent[interfaceName] || interfaceName; + var constructor = events[supportedEvents[name]]; + + if (constructor) { + var e = new constructor(); + e._initialized = false; + return e; + } + else { + utils.NotSupportedError(); + } + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createtreewalker + createTreeWalker: {value: function (root, whatToShow, filter) { + if (!root) { throw new TypeError("root argument is required"); } + if (!(root instanceof Node)) { throw new TypeError("root not a node"); } + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow); + filter = filter === undefined ? null : filter; + + return new TreeWalker(root, whatToShow, filter); + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createnodeiterator + createNodeIterator: {value: function (root, whatToShow, filter) { + if (!root) { throw new TypeError("root argument is required"); } + if (!(root instanceof Node)) { throw new TypeError("root not a node"); } + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow); + filter = filter === undefined ? null : filter; + + return new NodeIterator(root, whatToShow, filter); + }}, + + _attachNodeIterator: { value: function(ni) { + // XXX ideally this should be a weak reference from Document to NodeIterator + if (!this._nodeIterators) { this._nodeIterators = []; } + this._nodeIterators.push(ni); + }}, + + _detachNodeIterator: { value: function(ni) { + // ni should always be in list of node iterators + var idx = this._nodeIterators.indexOf(ni); + this._nodeIterators.splice(idx, 1); + }}, + + _preremoveNodeIterators: { value: function(toBeRemoved) { + if (this._nodeIterators) { + this._nodeIterators.forEach(function(ni) { ni._preremove(toBeRemoved); }); + } + }}, + + // Maintain the documentElement and + // doctype properties of the document. Each of the following + // methods chains to the Node implementation of the method + // to do the actual inserting, removal or replacement. + + _updateDocTypeElement: { value: function _updateDocTypeElement() { + this.doctype = this.documentElement = null; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.DOCUMENT_TYPE_NODE) + this.doctype = kid; + else if (kid.nodeType === Node.ELEMENT_NODE) + this.documentElement = kid; + } + }}, + + insertBefore: { value: function insertBefore(child, refChild) { + Node.prototype.insertBefore.call(this, child, refChild); + this._updateDocTypeElement(); + return child; + }}, + + replaceChild: { value: function replaceChild(node, child) { + Node.prototype.replaceChild.call(this, node, child); + this._updateDocTypeElement(); + return child; + }}, + + removeChild: { value: function removeChild(child) { + Node.prototype.removeChild.call(this, child); + this._updateDocTypeElement(); + return child; + }}, + + getElementById: { value: function(id) { + var n = this.byId[id]; + if (!n) return null; + if (n instanceof MultiId) { // there was more than one element with this id + return n.getFirst(); + } + return n; + }}, + + _hasMultipleElementsWithId: { value: function(id) { + // Used internally by querySelectorAll optimization + return (this.byId[id] instanceof MultiId); + }}, + + // Just copy this method from the Element prototype + getElementsByName: { value: Element.prototype.getElementsByName }, + getElementsByTagName: { value: Element.prototype.getElementsByTagName }, + getElementsByTagNameNS: { value: Element.prototype.getElementsByTagNameNS }, + getElementsByClassName: { value: Element.prototype.getElementsByClassName }, + + adoptNode: { value: function adoptNode(node) { + if (node.nodeType === Node.DOCUMENT_NODE) utils.NotSupportedError(); + if (node.nodeType === Node.ATTRIBUTE_NODE) { return node; } + + if (node.parentNode) node.parentNode.removeChild(node); + + if (node.ownerDocument !== this) + recursivelySetOwner(node, this); + + return node; + }}, + + importNode: { value: function importNode(node, deep) { + return this.adoptNode(node.cloneNode(deep)); + }, writable: isApiWritable }, + + // The following attributes and methods are from the HTML spec + origin: { get: function origin() { return null; } }, + characterSet: { get: function characterSet() { return "UTF-8"; } }, + contentType: { get: function contentType() { return this._contentType; } }, + URL: { get: function URL() { return this._address; } }, + domain: { get: utils.nyi, set: utils.nyi }, + referrer: { get: utils.nyi }, + cookie: { get: utils.nyi, set: utils.nyi }, + lastModified: { get: utils.nyi }, + location: { + get: function() { + return this.defaultView ? this.defaultView.location : null; // gh #75 + }, + set: utils.nyi + }, + _titleElement: { + get: function() { + // The title element of a document is the first title element in the + // document in tree order, if there is one, or null otherwise. + return this.getElementsByTagName('title').item(0) || null; + } + }, + title: { + get: function() { + var elt = this._titleElement; + // The child text content of the title element, or '' if null. + var value = elt ? elt.textContent : ''; + // Strip and collapse whitespace in value + return value.replace(/[ \t\n\r\f]+/g, ' ').replace(/(^ )|( $)/g, ''); + }, + set: function(value) { + var elt = this._titleElement; + var head = this.head; + if (!elt && !head) { return; /* according to spec */ } + if (!elt) { + elt = this.createElement('title'); + head.appendChild(elt); + } + elt.textContent = value; + } + }, + dir: mirrorAttr(function() { + var htmlElement = this.documentElement; + if (htmlElement && htmlElement.tagName === 'HTML') { return htmlElement; } + }, 'dir', ''), + fgColor: mirrorAttr(function() { return this.body; }, 'text', ''), + linkColor: mirrorAttr(function() { return this.body; }, 'link', ''), + vlinkColor: mirrorAttr(function() { return this.body; }, 'vLink', ''), + alinkColor: mirrorAttr(function() { return this.body; }, 'aLink', ''), + bgColor: mirrorAttr(function() { return this.body; }, 'bgColor', ''), + + // Historical aliases of Document#characterSet + charset: { get: function() { return this.characterSet; } }, + inputEncoding: { get: function() { return this.characterSet; } }, + + scrollingElement: { + get: function() { + return this._quirks ? this.body : this.documentElement; + } + }, + + // Return the first child of the document element. + // XXX For now, setting this attribute is not implemented. + body: { + get: function() { + return namedHTMLChild(this.documentElement, 'body'); + }, + set: utils.nyi + }, + // Return the first child of the document element. + head: { get: function() { + return namedHTMLChild(this.documentElement, 'head'); + }}, + images: { get: utils.nyi }, + embeds: { get: utils.nyi }, + plugins: { get: utils.nyi }, + links: { get: utils.nyi }, + forms: { get: utils.nyi }, + scripts: { get: utils.nyi }, + applets: { get: function() { return []; } }, + activeElement: { get: function() { return null; } }, + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + + write: { value: function(args) { + if (!this.isHTML) utils.InvalidStateError(); + + // XXX: still have to implement the ignore part + if (!this._parser /* && this._ignore_destructive_writes > 0 */ ) + return; + + if (!this._parser) { + // XXX call document.open, etc. + } + + var s = arguments.join(''); + + // If the Document object's reload override flag is set, then + // append the string consisting of the concatenation of all the + // arguments to the method to the Document's reload override + // buffer. + // XXX: don't know what this is about. Still have to do it + + // If there is no pending parsing-blocking script, have the + // tokenizer process the characters that were inserted, one at a + // time, processing resulting tokens as they are emitted, and + // stopping when the tokenizer reaches the insertion point or when + // the processing of the tokenizer is aborted by the tree + // construction stage (this can happen if a script end tag token is + // emitted by the tokenizer). + + // XXX: still have to do the above. Sounds as if we don't + // always call parse() here. If we're blocked, then we just + // insert the text into the stream but don't parse it reentrantly... + + // Invoke the parser reentrantly + this._parser.parse(s); + }}, + + writeln: { value: function writeln(args) { + this.write(Array.prototype.join.call(arguments, '') + '\n'); + }}, + + open: { value: function() { + this.documentElement = null; + }}, + + close: { value: function() { + this.readyState = 'interactive'; + this._dispatchEvent(new Event('readystatechange'), true); + this._dispatchEvent(new Event('DOMContentLoaded'), true); + this.readyState = 'complete'; + this._dispatchEvent(new Event('readystatechange'), true); + if (this.defaultView) { + this.defaultView._dispatchEvent(new Event('load'), true); + } + }}, + + // Utility methods + clone: { value: function clone() { + var d = new Document(this.isHTML, this._address); + d._quirks = this._quirks; + d._contentType = this._contentType; + return d; + }}, + + // We need to adopt the nodes if we do a deep clone + cloneNode: { value: function cloneNode(deep) { + var clone = Node.prototype.cloneNode.call(this, false); + if (deep) { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + clone._appendChild(clone.importNode(kid, true)); + } + } + clone._updateDocTypeElement(); + return clone; + }}, + + isEqual: { value: function isEqual(n) { + // Any two documents are shallowly equal. + // Node.isEqualNode will also test the children + return true; + }}, + + // Implementation-specific function. Called when a text, comment, + // or pi value changes. + mutateValue: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.VALUE, + target: node, + data: node.data + }); + } + }}, + + // Invoked when an attribute's value changes. Attr holds the new + // value. oldval is the old value. Attribute mutations can also + // involve changes to the prefix (and therefore the qualified name) + mutateAttr: { value: function(attr, oldval) { + // Manage id->element mapping for getElementsById() + // XXX: this special case id handling should not go here, + // but in the attribute declaration for the id attribute + /* + if (attr.localName === 'id' && attr.namespaceURI === null) { + if (oldval) delId(oldval, attr.ownerElement); + addId(attr.value, attr.ownerElement); + } + */ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.ATTR, + target: attr.ownerElement, + attr: attr + }); + } + }}, + + // Used by removeAttribute and removeAttributeNS for attributes. + mutateRemoveAttr: { value: function(attr) { +/* +* This is now handled in Attributes.js + // Manage id to element mapping + if (attr.localName === 'id' && attr.namespaceURI === null) { + this.delId(attr.value, attr.ownerElement); + } +*/ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE_ATTR, + target: attr.ownerElement, + attr: attr + }); + } + }}, + + // Called by Node.removeChild, etc. to remove a rooted element from + // the tree. Only needs to generate a single mutation event when a + // node is removed, but must recursively mark all descendants as not + // rooted. + mutateRemove: { value: function(node) { + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE, + target: node.parentNode, + node: node + }); + } + + // Mark this and all descendants as not rooted + recursivelyUproot(node); + }}, + + // Called when a new element becomes rooted. It must recursively + // generate mutation events for each of the children, and mark them all + // as rooted. + mutateInsert: { value: function(node) { + // Mark node and its descendants as rooted + recursivelyRoot(node); + + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.INSERT, + target: node.parentNode, + node: node + }); + } + }}, + + // Called when a rooted element is moved within the document + mutateMove: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.MOVE, + target: node + }); + } + }}, + + + // Add a mapping from id to n for n.ownerDocument + addId: { value: function addId(id, n) { + var val = this.byId[id]; + if (!val) { + this.byId[id] = n; + } + else { + // TODO: Add a way to opt-out console warnings + //console.warn('Duplicate element id ' + id); + if (!(val instanceof MultiId)) { + val = new MultiId(val); + this.byId[id] = val; + } + val.add(n); + } + }}, + + // Delete the mapping from id to n for n.ownerDocument + delId: { value: function delId(id, n) { + var val = this.byId[id]; + utils.assert(val); + + if (val instanceof MultiId) { + val.del(n); + if (val.length === 1) { // convert back to a single node + this.byId[id] = val.downgrade(); + } + } + else { + this.byId[id] = undefined; + } + }}, + + _resolve: { value: function(href) { + //XXX: Cache the URL + return new URL(this._documentBaseURL).resolve(href); + }}, + + _documentBaseURL: { get: function() { + // XXX: This is not implemented correctly yet + var url = this._address; + if (url === 'about:blank') url = '/'; + + var base = this.querySelector('base[href]'); + if (base) { + return new URL(url).resolve(base.getAttribute('href')); + } + return url; + + // The document base URL of a Document object is the + // absolute URL obtained by running these substeps: + + // Let fallback base url be the document's address. + + // If fallback base url is about:blank, and the + // Document's browsing context has a creator browsing + // context, then let fallback base url be the document + // base URL of the creator Document instead. + + // If the Document is an iframe srcdoc document, then + // let fallback base url be the document base URL of + // the Document's browsing context's browsing context + // container's Document instead. + + // If there is no base element that has an href + // attribute, then the document base URL is fallback + // base url; abort these steps. Otherwise, let url be + // the value of the href attribute of the first such + // element. + + // Resolve url relative to fallback base url (thus, + // the base href attribute isn't affected by xml:base + // attributes). + + // The document base URL is the result of the previous + // step if it was successful; otherwise it is fallback + // base url. + }}, + + _templateDoc: { get: function() { + if (!this._templateDocCache) { + // "associated inert template document" + var newDoc = new Document(this.isHTML, this._address); + this._templateDocCache = newDoc._templateDocCache = newDoc; + } + return this._templateDocCache; + }}, + + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, + + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} + +}); + + +var eventHandlerTypes = [ + 'abort', 'canplay', 'canplaythrough', 'change', 'click', 'contextmenu', + 'cuechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave', + 'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended', + 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'loadeddata', + 'loadedmetadata', 'loadstart', 'mousedown', 'mousemove', 'mouseout', + 'mouseover', 'mouseup', 'mousewheel', 'pause', 'play', 'playing', + 'progress', 'ratechange', 'readystatechange', 'reset', 'seeked', + 'seeking', 'select', 'show', 'stalled', 'submit', 'suspend', + 'timeupdate', 'volumechange', 'waiting', + + 'blur', 'error', 'focus', 'load', 'scroll' +]; + +// Add event handler idl attribute getters and setters to Document +eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(Document.prototype, 'on' + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); + } + }); +}); + +function namedHTMLChild(parent, name) { + if (parent && parent.isHTML) { + for (var kid = parent.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE && + kid.localName === name && + kid.namespaceURI === NAMESPACE.HTML) { + return kid; + } + } + } + return null; +} + +function root(n) { + n._nid = n.ownerDocument._nextnid++; + n.ownerDocument._nodes[n._nid] = n; + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.addId(id, n); + + // Script elements need to know when they're inserted + // into the document + if (n._roothook) n._roothook(); + } +} + +function uproot(n) { + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.delId(id, n); + } + n.ownerDocument._nodes[n._nid] = undefined; + n._nid = undefined; +} + +function recursivelyRoot(node) { + root(node); + // XXX: + // accessing childNodes on a leaf node creates a new array the + // first time, so be careful to write this loop so that it + // doesn't do that. node is polymorphic, so maybe this is hard to + // optimize? Try switching on nodeType? +/* + if (node.hasChildNodes()) { + var kids = node.childNodes; + for(var i = 0, n = kids.length; i < n; i++) + recursivelyRoot(kids[i]); + } +*/ + if (node.nodeType === Node.ELEMENT_NODE) { + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelyRoot(kid); + } +} + +function recursivelyUproot(node) { + uproot(node); + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelyUproot(kid); +} + +function recursivelySetOwner(node, owner) { + node.ownerDocument = owner; + node._lastModTime = undefined; // mod times are document-based + if (Object.prototype.hasOwnProperty.call(node, '_tagName')) { + node._tagName = undefined; // Element subclasses might need to change case + } + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelySetOwner(kid, owner); +} + +// A class for storing multiple nodes with the same ID +function MultiId(node) { + this.nodes = Object.create(null); + this.nodes[node._nid] = node; + this.length = 1; + this.firstNode = undefined; +} + +// Add a node to the list, with O(1) time +MultiId.prototype.add = function(node) { + if (!this.nodes[node._nid]) { + this.nodes[node._nid] = node; + this.length++; + this.firstNode = undefined; + } +}; + +// Remove a node from the list, with O(1) time +MultiId.prototype.del = function(node) { + if (this.nodes[node._nid]) { + delete this.nodes[node._nid]; + this.length--; + this.firstNode = undefined; + } +}; + +// Get the first node from the list, in the document order +// Takes O(N) time in the size of the list, with a cache that is invalidated +// when the list is modified. +MultiId.prototype.getFirst = function() { + /* jshint bitwise: false */ + if (!this.firstNode) { + var nid; + for (nid in this.nodes) { + if (this.firstNode === undefined || + this.firstNode.compareDocumentPosition(this.nodes[nid]) & Node.DOCUMENT_POSITION_PRECEDING) { + this.firstNode = this.nodes[nid]; + } + } + } + return this.firstNode; +}; + +// If there is only one node left, return it. Otherwise return "this". +MultiId.prototype.downgrade = function() { + if (this.length === 1) { + var nid; + for (nid in this.nodes) { + return this.nodes[nid]; + } + } + return this; +}; + + +/***/ }), + +/***/ 17948: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DocumentFragment; + +var Node = __webpack_require__(97537); +var NodeList = __webpack_require__(64965); +var ContainerNode = __webpack_require__(38554); +var Element = __webpack_require__(77301); +var select = __webpack_require__(23509); +var utils = __webpack_require__(89076); + +function DocumentFragment(doc) { + ContainerNode.call(this); + this.nodeType = Node.DOCUMENT_FRAGMENT_NODE; + this.ownerDocument = doc; +} + +DocumentFragment.prototype = Object.create(ContainerNode.prototype, { + nodeName: { value: '#document-fragment' }, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + // Copy the text content getter/setter from Element + textContent: Object.getOwnPropertyDescriptor(Element.prototype, 'textContent'), + + // Copy the text content getter/setter from Element + innerText: Object.getOwnPropertyDescriptor(Element.prototype, 'innerText'), + + querySelector: { value: function(selector) { + // implement in terms of querySelectorAll + var nodes = this.querySelectorAll(selector); + return nodes.length ? nodes[0] : null; + }}, + querySelectorAll: { value: function(selector) { + // create a context + var context = Object.create(this); + // add some methods to the context for zest implementation, without + // adding them to the public DocumentFragment API + context.isHTML = true; // in HTML namespace (case-insensitive match) + context.getElementsByTagName = Element.prototype.getElementsByTagName; + context.nextElement = + Object.getOwnPropertyDescriptor(Element.prototype, 'firstElementChild'). + get; + // invoke zest + var nodes = select(selector, context); + return nodes.item ? nodes : new NodeList(nodes); + }}, + + // Utility methods + clone: { value: function clone() { + return new DocumentFragment(this.ownerDocument); + }}, + isEqual: { value: function isEqual(n) { + // Any two document fragments are shallowly equal. + // Node.isEqualNode() will test their children for equality + return true; + }}, + + // Non-standard, but useful (github issue #73) + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + +}); + + +/***/ }), + +/***/ 73092: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DocumentType; + +var Node = __webpack_require__(97537); +var Leaf = __webpack_require__(8161); +var ChildNode = __webpack_require__(52091); + +function DocumentType(ownerDocument, name, publicId, systemId) { + Leaf.call(this); + this.nodeType = Node.DOCUMENT_TYPE_NODE; + this.ownerDocument = ownerDocument || null; + this.name = name; + this.publicId = publicId || ""; + this.systemId = systemId || ""; +} + +DocumentType.prototype = Object.create(Leaf.prototype, { + nodeName: { get: function() { return this.name; }}, + nodeValue: { + get: function() { return null; }, + set: function() {} + }, + + // Utility methods + clone: { value: function clone() { + return new DocumentType(this.ownerDocument, this.name, this.publicId, this.systemId); + }}, + + isEqual: { value: function isEqual(n) { + return this.name === n.name && + this.publicId === n.publicId && + this.systemId === n.systemId; + }} +}); + +Object.defineProperties(DocumentType.prototype, ChildNode); + + +/***/ }), + +/***/ 77301: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Element; + +var xml = __webpack_require__(66798); +var utils = __webpack_require__(89076); +var NAMESPACE = utils.NAMESPACE; +var attributes = __webpack_require__(6548); +var Node = __webpack_require__(97537); +var NodeList = __webpack_require__(64965); +var NodeUtils = __webpack_require__(41608); +var FilteredElementList = __webpack_require__(61676); +var DOMException = __webpack_require__(46364); +var DOMTokenList = __webpack_require__(82840); +var select = __webpack_require__(23509); +var ContainerNode = __webpack_require__(38554); +var ChildNode = __webpack_require__(52091); +var NonDocumentTypeChildNode = __webpack_require__(32001); +var NamedNodeMap = __webpack_require__(49492); + +var uppercaseCache = Object.create(null); + +function Element(doc, localName, namespaceURI, prefix) { + ContainerNode.call(this); + this.nodeType = Node.ELEMENT_NODE; + this.ownerDocument = doc; + this.localName = localName; + this.namespaceURI = namespaceURI; + this.prefix = prefix; + this._tagName = undefined; + + // These properties maintain the set of attributes + this._attrsByQName = Object.create(null); // The qname->Attr map + this._attrsByLName = Object.create(null); // The ns|lname->Attr map + this._attrKeys = []; // attr index -> ns|lname +} + +function recursiveGetText(node, a) { + if (node.nodeType === Node.TEXT_NODE) { + a.push(node._data); + } + else { + for(var i = 0, n = node.childNodes.length; i < n; i++) + recursiveGetText(node.childNodes[i], a); + } +} + +Element.prototype = Object.create(ContainerNode.prototype, { + isHTML: { get: function isHTML() { + return this.namespaceURI === NAMESPACE.HTML && this.ownerDocument.isHTML; + }}, + tagName: { get: function tagName() { + if (this._tagName === undefined) { + var tn; + if (this.prefix === null) { + tn = this.localName; + } else { + tn = this.prefix + ':' + this.localName; + } + if (this.isHTML) { + var up = uppercaseCache[tn]; + if (!up) { + // Converting to uppercase can be slow, so cache the conversion. + uppercaseCache[tn] = up = utils.toASCIIUpperCase(tn); + } + tn = up; + } + this._tagName = tn; + } + return this._tagName; + }}, + nodeName: { get: function() { return this.tagName; }}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + textContent: { + get: function() { + var strings = []; + recursiveGetText(this, strings); + return strings.join(''); + }, + set: function(newtext) { + this.removeChildren(); + if (newtext !== null && newtext !== undefined && newtext !== '') { + this._appendChild(this.ownerDocument.createTextNode(newtext)); + } + } + }, + innerText: { + get: function() { + var strings = []; + recursiveGetText(this, strings); + // Strip and collapse whitespace + // This doesn't 100% match the browser behavior, + // but should cover most of the cases. This is also similar to + // how Angular's renderer used to work: the `textContent` and `innerText` + // were almost equivalent from the renderer perspective. + // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext + return strings.join('').replace(/[ \t\n\f\r]+/g, ' ').trim(); + }, + set: function(newtext) { + this.removeChildren(); + if (newtext !== null && newtext !== undefined && newtext !== '') { + this._appendChild(this.ownerDocument.createTextNode(newtext)); + } + } + }, + innerHTML: { + get: function() { + return this.serialize(); + }, + set: utils.nyi + }, + outerHTML: { + get: function() { + // "the attribute must return the result of running the HTML fragment + // serialization algorithm on a fictional node whose only child is + // the context object" + // + // The serialization logic is intentionally implemented in a separate + // `NodeUtils` helper instead of the more obvious choice of a private + // `_serializeOne()` method on the `Node.prototype` in order to avoid + // the megamorphic `this._serializeOne` property access, which reduces + // performance unnecessarily. If you need specialized behavior for a + // certain subclass, you'll need to implement that in `NodeUtils`. + // See https://github.com/fgnass/domino/pull/142 for more information. + return NodeUtils.serializeOne(this, { nodeType: 0 }); + }, + set: function(v) { + var document = this.ownerDocument; + var parent = this.parentNode; + if (parent === null) { return; } + if (parent.nodeType === Node.DOCUMENT_NODE) { + utils.NoModificationAllowedError(); + } + if (parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + parent = parent.ownerDocument.createElement("body"); + } + var parser = document.implementation.mozHTMLParser( + document._address, + parent + ); + parser.parse(v===null?'':String(v), true); + this.replaceWith(parser._asDocumentFragment()); + }, + }, + + _insertAdjacent: { value: function _insertAdjacent(position, node) { + var first = false; + switch(position) { + case 'beforebegin': + first = true; + /* falls through */ + case 'afterend': + var parent = this.parentNode; + if (parent === null) { return null; } + return parent.insertBefore(node, first ? this : this.nextSibling); + case 'afterbegin': + first = true; + /* falls through */ + case 'beforeend': + return this.insertBefore(node, first ? this.firstChild : null); + default: + return utils.SyntaxError(); + } + }}, + + insertAdjacentElement: { value: function insertAdjacentElement(position, element) { + if (element.nodeType !== Node.ELEMENT_NODE) { + throw new TypeError('not an element'); + } + position = utils.toASCIILowerCase(String(position)); + return this._insertAdjacent(position, element); + }}, + + insertAdjacentText: { value: function insertAdjacentText(position, data) { + var textNode = this.ownerDocument.createTextNode(data); + position = utils.toASCIILowerCase(String(position)); + this._insertAdjacent(position, textNode); + // "This method returns nothing because it existed before we had a chance + // to design it." + }}, + + insertAdjacentHTML: { value: function insertAdjacentHTML(position, text) { + position = utils.toASCIILowerCase(String(position)); + text = String(text); + var context; + switch(position) { + case 'beforebegin': + case 'afterend': + context = this.parentNode; + if (context === null || context.nodeType === Node.DOCUMENT_NODE) { + utils.NoModificationAllowedError(); + } + break; + case 'afterbegin': + case 'beforeend': + context = this; + break; + default: + utils.SyntaxError(); + } + if ( (!(context instanceof Element)) || ( + context.ownerDocument.isHTML && + context.localName === 'html' && + context.namespaceURI === NAMESPACE.HTML + ) ) { + context = context.ownerDocument.createElementNS(NAMESPACE.HTML, 'body'); + } + var parser = this.ownerDocument.implementation.mozHTMLParser( + this.ownerDocument._address, context + ); + parser.parse(text, true); + this._insertAdjacent(position, parser._asDocumentFragment()); + }}, + + children: { get: function() { + if (!this._children) { + this._children = new ChildrenCollection(this); + } + return this._children; + }}, + + attributes: { get: function() { + if (!this._attributes) { + this._attributes = new AttributesArray(this); + } + return this._attributes; + }}, + + + firstElementChild: { get: function() { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + return null; + }}, + + lastElementChild: { get: function() { + for (var kid = this.lastChild; kid !== null; kid = kid.previousSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + return null; + }}, + + childElementCount: { get: function() { + return this.children.length; + }}, + + + // Return the next element, in source order, after this one or + // null if there are no more. If root element is specified, + // then don't traverse beyond its subtree. + // + // This is not a DOM method, but is convenient for + // lazy traversals of the tree. + nextElement: { value: function(root) { + if (!root) root = this.ownerDocument.documentElement; + var next = this.firstElementChild; + if (!next) { + // don't use sibling if we're at root + if (this===root) return null; + next = this.nextElementSibling; + } + if (next) return next; + + // If we can't go down or across, then we have to go up + // and across to the parent sibling or another ancestor's + // sibling. Be careful, though: if we reach the root + // element, or if we reach the documentElement, then + // the traversal ends. + for(var parent = this.parentElement; + parent && parent !== root; + parent = parent.parentElement) { + + next = parent.nextElementSibling; + if (next) return next; + } + + return null; + }}, + + // XXX: + // Tests are currently failing for this function. + // Awaiting resolution of: + // http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0016.html + getElementsByTagName: { value: function getElementsByTagName(lname) { + var filter; + if (!lname) return new NodeList(); + if (lname === '*') + filter = function() { return true; }; + else if (this.isHTML) + filter = htmlLocalNameElementFilter(lname); + else + filter = localNameElementFilter(lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByTagNameNS: { value: function getElementsByTagNameNS(ns, lname){ + var filter; + if (ns === '*' && lname === '*') + filter = function() { return true; }; + else if (ns === '*') + filter = localNameElementFilter(lname); + else if (lname === '*') + filter = namespaceElementFilter(ns); + else + filter = namespaceLocalNameElementFilter(ns, lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByClassName: { value: function getElementsByClassName(names){ + names = String(names).trim(); + if (names === '') { + var result = new NodeList(); // Empty node list + return result; + } + names = names.split(/[ \t\r\n\f]+/); // Split on ASCII whitespace + return new FilteredElementList(this, classNamesElementFilter(names)); + }}, + + getElementsByName: { value: function getElementsByName(name) { + return new FilteredElementList(this, elementNameFilter(String(name))); + }}, + + // Utility methods used by the public API methods above + clone: { value: function clone() { + var e; + + // XXX: + // Modify this to use the constructor directly or + // avoid error checking in some other way. In case we try + // to clone an invalid node that the parser inserted. + // + if (this.namespaceURI !== NAMESPACE.HTML || this.prefix || !this.ownerDocument.isHTML) { + e = this.ownerDocument.createElementNS( + this.namespaceURI, (this.prefix !== null) ? + (this.prefix + ':' + this.localName) : this.localName + ); + } else { + e = this.ownerDocument.createElement(this.localName); + } + + for(var i = 0, n = this._attrKeys.length; i < n; i++) { + var lname = this._attrKeys[i]; + var a = this._attrsByLName[lname]; + var b = a.cloneNode(); + b._setOwnerElement(e); + e._attrsByLName[lname] = b; + e._addQName(b); + } + e._attrKeys = this._attrKeys.concat(); + + return e; + }}, + + isEqual: { value: function isEqual(that) { + if (this.localName !== that.localName || + this.namespaceURI !== that.namespaceURI || + this.prefix !== that.prefix || + this._numattrs !== that._numattrs) + return false; + + // Compare the sets of attributes, ignoring order + // and ignoring attribute prefixes. + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (!that.hasAttributeNS(a.namespaceURI, a.localName)) + return false; + if (that.getAttributeNS(a.namespaceURI,a.localName) !== a.value) + return false; + } + + return true; + }}, + + // This is the 'locate a namespace prefix' algorithm from the + // DOM specification. It is used by Node.lookupPrefix() + // (Be sure to compare DOM3 and DOM4 versions of spec.) + _lookupNamespacePrefix: { value: function _lookupNamespacePrefix(ns, originalElement) { + if ( + this.namespaceURI && + this.namespaceURI === ns && + this.prefix !== null && + originalElement.lookupNamespaceURI(this.prefix) === ns + ) { + return this.prefix; + } + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if ( + a.prefix === 'xmlns' && + a.value === ns && + originalElement.lookupNamespaceURI(a.localName) === ns + ) { + return a.localName; + } + } + + var parent = this.parentElement; + return parent ? parent._lookupNamespacePrefix(ns, originalElement) : null; + }}, + + // This is the 'locate a namespace' algorithm for Element nodes + // from the DOM Core spec. It is used by Node#lookupNamespaceURI() + lookupNamespaceURI: { value: function lookupNamespaceURI(prefix) { + if (prefix === '' || prefix === undefined) { prefix = null; } + if (this.namespaceURI !== null && this.prefix === prefix) + return this.namespaceURI; + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (a.namespaceURI === NAMESPACE.XMLNS) { + if ( + (a.prefix === 'xmlns' && a.localName === prefix) || + (prefix === null && a.prefix === null && a.localName === 'xmlns') + ) { + return a.value || null; + } + } + } + + var parent = this.parentElement; + return parent ? parent.lookupNamespaceURI(prefix) : null; + }}, + + // + // Attribute handling methods and utilities + // + + /* + * Attributes in the DOM are tricky: + * + * - there are the 8 basic get/set/has/removeAttribute{NS} methods + * + * - but many HTML attributes are also 'reflected' through IDL + * attributes which means that they can be queried and set through + * regular properties of the element. There is just one attribute + * value, but two ways to get and set it. + * + * - Different HTML element types have different sets of reflected + attributes. + * + * - attributes can also be queried and set through the .attributes + * property of an element. This property behaves like an array of + * Attr objects. The value property of each Attr is writeable, so + * this is a third way to read and write attributes. + * + * - for efficiency, we really want to store attributes in some kind + * of name->attr map. But the attributes[] array is an array, not a + * map, which is kind of unnatural. + * + * - When using namespaces and prefixes, and mixing the NS methods + * with the non-NS methods, it is apparently actually possible for + * an attributes[] array to have more than one attribute with the + * same qualified name. And certain methods must operate on only + * the first attribute with such a name. So for these methods, an + * inefficient array-like data structure would be easier to + * implement. + * + * - The attributes[] array is live, not a snapshot, so changes to the + * attributes must be immediately visible through existing arrays. + * + * - When attributes are queried and set through IDL properties + * (instead of the get/setAttributes() method or the attributes[] + * array) they may be subject to type conversions, URL + * normalization, etc., so some extra processing is required in that + * case. + * + * - But access through IDL properties is probably the most common + * case, so we'd like that to be as fast as possible. + * + * - We can't just store attribute values in their parsed idl form, + * because setAttribute() has to return whatever string is passed to + * getAttribute even if it is not a legal, parseable value. So + * attribute values must be stored in unparsed string form. + * + * - We need to be able to send change notifications or mutation + * events of some sort to the renderer whenever an attribute value + * changes, regardless of the way in which it changes. + * + * - Some attributes, such as id and class affect other parts of the + * DOM API, like getElementById and getElementsByClassName and so + * for efficiency, we need to specially track changes to these + * special attributes. + * + * - Some attributes like class have different names (className) when + * reflected. + * + * - Attributes whose names begin with the string 'data-' are treated + specially. + * + * - Reflected attributes that have a boolean type in IDL have special + * behavior: setting them to false (in IDL) is the same as removing + * them with removeAttribute() + * + * - numeric attributes (like HTMLElement.tabIndex) can have default + * values that must be returned by the idl getter even if the + * content attribute does not exist. (The default tabIndex value + * actually varies based on the type of the element, so that is a + * tricky one). + * + * See + * http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflect + * for rules on how attributes are reflected. + * + */ + + getAttribute: { value: function getAttribute(qname) { + var attr = this.getAttributeNode(qname); + return attr ? attr.value : null; + }}, + + getAttributeNS: { value: function getAttributeNS(ns, lname) { + var attr = this.getAttributeNodeNS(ns, lname); + return attr ? attr.value : null; + }}, + + getAttributeNode: { value: function getAttributeNode(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + var attr = this._attrsByQName[qname]; + if (!attr) return null; + + if (Array.isArray(attr)) // If there is more than one + attr = attr[0]; // use the first + + return attr; + }}, + + getAttributeNodeNS: { value: function getAttributeNodeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var attr = this._attrsByLName[ns + '|' + lname]; + return attr ? attr : null; + }}, + + hasAttribute: { value: function hasAttribute(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + return this._attrsByQName[qname] !== undefined; + }}, + + hasAttributeNS: { value: function hasAttributeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var key = ns + '|' + lname; + return this._attrsByLName[key] !== undefined; + }}, + + hasAttributes: { value: function hasAttributes() { + return this._numattrs > 0; + }}, + + toggleAttribute: { value: function toggleAttribute(qname, force) { + qname = String(qname); + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + var a = this._attrsByQName[qname]; + if (a === undefined) { + if (force === undefined || force === true) { + this._setAttribute(qname, ''); + return true; + } + return false; + } else { + if (force === undefined || force === false) { + this.removeAttribute(qname); + return false; + } + return true; + } + }}, + + // Set the attribute without error checking. The parser uses this. + _setAttribute: { value: function _setAttribute(qname, value) { + // XXX: the spec says that this next search should be done + // on the local name, but I think that is an error. + // email pending on www-dom about it. + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + else { + if (Array.isArray(attr)) attr = attr[0]; + } + + // Now set the attribute value on the new or existing Attr object. + // The Attr.value setter method handles mutation events, etc. + attr.value = value; + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Check for errors, and then set the attribute + setAttribute: { value: function setAttribute(qname, value) { + qname = String(qname); + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + this._setAttribute(qname, String(value)); + }}, + + + // The version with no error checking used by the parser + _setAttributeNS: { value: function _setAttributeNS(ns, qname, value) { + var pos = qname.indexOf(':'), prefix, lname; + if (pos < 0) { + prefix = null; + lname = qname; + } + else { + prefix = qname.substring(0, pos); + lname = qname.substring(pos+1); + } + + if (ns === '' || ns === undefined) ns = null; + var key = (ns === null ? '' : ns) + '|' + lname; + + var attr = this._attrsByLName[key]; + var isnew; + if (!attr) { + attr = new Attr(this, lname, prefix, ns); + isnew = true; + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + + // We also have to make the attr searchable by qname. + // But we have to be careful because there may already + // be an attr with this qname. + this._addQName(attr); + } + else if (false /* changed in DOM 4 */) {} + attr.value = value; // Automatically sends mutation event + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Do error checking then call _setAttributeNS + setAttributeNS: { value: function setAttributeNS(ns, qname, value) { + // Convert parameter types according to WebIDL + ns = (ns === null || ns === undefined || ns === '') ? null : String(ns); + qname = String(qname); + if (!xml.isValidQName(qname)) utils.InvalidCharacterError(); + + var pos = qname.indexOf(':'); + var prefix = (pos < 0) ? null : qname.substring(0, pos); + + if ((prefix !== null && ns === null) || + (prefix === 'xml' && ns !== NAMESPACE.XML) || + ((qname === 'xmlns' || prefix === 'xmlns') && + (ns !== NAMESPACE.XMLNS)) || + (ns === NAMESPACE.XMLNS && + !(qname === 'xmlns' || prefix === 'xmlns'))) + utils.NamespaceError(); + + this._setAttributeNS(ns, qname, String(value)); + }}, + + setAttributeNode: { value: function setAttributeNode(attr) { + if (attr.ownerElement !== null && attr.ownerElement !== this) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + var result = null; + var oldAttrs = this._attrsByQName[attr.name]; + if (oldAttrs) { + if (!Array.isArray(oldAttrs)) { oldAttrs = [ oldAttrs ]; } + if (oldAttrs.some(function(a) { return a===attr; })) { + return attr; + } else if (attr.ownerElement !== null) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + oldAttrs.forEach(function(a) { this.removeAttributeNode(a); }, this); + result = oldAttrs[0]; + } + this.setAttributeNodeNS(attr); + return result; + }}, + + setAttributeNodeNS: { value: function setAttributeNodeNS(attr) { + if (attr.ownerElement !== null) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + var ns = attr.namespaceURI; + var key = (ns === null ? '' : ns) + '|' + attr.localName; + var oldAttr = this._attrsByLName[key]; + if (oldAttr) { this.removeAttributeNode(oldAttr); } + attr._setOwnerElement(this); + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + this._addQName(attr); + if (this._newattrhook) this._newattrhook(attr.name, attr.value); + return oldAttr || null; + }}, + + removeAttribute: { value: function removeAttribute(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + + var attr = this._attrsByQName[qname]; + if (!attr) return; + + // If there is more than one match for this qname + // so don't delete the qname mapping, just remove the first + // element from it. + if (Array.isArray(attr)) { + if (attr.length > 2) { + attr = attr.shift(); // remove it from the array + } + else { + this._attrsByQName[qname] = attr[1]; + attr = attr[0]; + } + } + else { + // only a single match, so remove the qname mapping + this._attrsByQName[qname] = undefined; + } + + var ns = attr.namespaceURI; + // Now attr is the removed attribute. Figure out its + // ns+lname key and remove it from the other mapping as well. + var key = (ns === null ? '' : ns) + '|' + attr.localName; + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + if (this._attributes) { + Array.prototype.splice.call(this._attributes, i, 1); + this._attributes[qname] = undefined; + } + this._attrKeys.splice(i, 1); + + // Onchange handler for the attribute + var onchange = attr.onchange; + attr._setOwnerElement(null); + if (onchange) { + onchange.call(attr, this, attr.localName, attr.value, null); + } + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + removeAttributeNS: { value: function removeAttributeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var key = ns + '|' + lname; + var attr = this._attrsByLName[key]; + if (!attr) return; + + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + if (this._attributes) { + Array.prototype.splice.call(this._attributes, i, 1); + } + this._attrKeys.splice(i, 1); + + // Now find the same Attr object in the qname mapping and remove it + // But be careful because there may be more than one match. + this._removeQName(attr); + + // Onchange handler for the attribute + var onchange = attr.onchange; + attr._setOwnerElement(null); + if (onchange) { + onchange.call(attr, this, attr.localName, attr.value, null); + } + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + removeAttributeNode: { value: function removeAttributeNode(attr) { + var ns = attr.namespaceURI; + var key = (ns === null ? '' : ns) + '|' + attr.localName; + if (this._attrsByLName[key] !== attr) { + utils.NotFoundError(); + } + this.removeAttributeNS(ns, attr.localName); + return attr; + }}, + + getAttributeNames: { value: function getAttributeNames() { + var elt = this; + return this._attrKeys.map(function(key) { + return elt._attrsByLName[key].name; + }); + }}, + + // This 'raw' version of getAttribute is used by the getter functions + // of reflected attributes. It skips some error checking and + // namespace steps + _getattr: { value: function _getattr(qname) { + // Assume that qname is already lowercased, so don't do it here. + // Also don't check whether attr is an array: a qname with no + // prefix will never have two matching Attr objects (because + // setAttributeNS doesn't allow a non-null namespace with a + // null prefix. + var attr = this._attrsByQName[qname]; + return attr ? attr.value : null; + }}, + + // The raw version of setAttribute for reflected idl attributes. + _setattr: { value: function _setattr(qname, value) { + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + attr.value = String(value); + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Create a new Attr object, insert it, and return it. + // Used by setAttribute() and by set() + _newattr: { value: function _newattr(qname) { + var attr = new Attr(this, qname, null, null); + var key = '|' + qname; + this._attrsByQName[qname] = attr; + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + return attr; + }}, + + // Add a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _addQName: { value: function(attr) { + var qname = attr.name; + var existing = this._attrsByQName[qname]; + if (!existing) { + this._attrsByQName[qname] = attr; + } + else if (Array.isArray(existing)) { + existing.push(attr); + } + else { + this._attrsByQName[qname] = [existing, attr]; + } + if (this._attributes) this._attributes[qname] = attr; + }}, + + // Remove a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _removeQName: { value: function(attr) { + var qname = attr.name; + var target = this._attrsByQName[qname]; + + if (Array.isArray(target)) { + var idx = target.indexOf(attr); + utils.assert(idx !== -1); // It must be here somewhere + if (target.length === 2) { + this._attrsByQName[qname] = target[1-idx]; + if (this._attributes) { + this._attributes[qname] = this._attrsByQName[qname]; + } + } else { + target.splice(idx, 1); + if (this._attributes && this._attributes[qname] === attr) { + this._attributes[qname] = target[0]; + } + } + } + else { + utils.assert(target === attr); // If only one, it must match + this._attrsByQName[qname] = undefined; + if (this._attributes) { + this._attributes[qname] = undefined; + } + } + }}, + + // Return the number of attributes + _numattrs: { get: function() { return this._attrKeys.length; }}, + // Return the nth Attr object + _attr: { value: function(n) { + return this._attrsByLName[this._attrKeys[n]]; + }}, + + // Define getters and setters for an 'id' property that reflects + // the content attribute 'id'. + id: attributes.property({name: 'id'}), + + // Define getters and setters for a 'className' property that reflects + // the content attribute 'class'. + className: attributes.property({name: 'class'}), + + classList: { get: function() { + var self = this; + if (this._classList) { + return this._classList; + } + var dtlist = new DOMTokenList( + function() { + return self.className || ""; + }, + function(v) { + self.className = v; + } + ); + this._classList = dtlist; + return dtlist; + }, set: function(v) { this.className = v; }}, + + matches: { value: function(selector) { + return select.matches(this, selector); + }}, + + closest: { value: function(selector) { + var el = this; + do { + if (el.matches && el.matches(selector)) { return el; } + el = el.parentElement || el.parentNode; + } while (el !== null && el.nodeType === Node.ELEMENT_NODE); + return null; + }}, + + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, + + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} + +}); + +Object.defineProperties(Element.prototype, ChildNode); +Object.defineProperties(Element.prototype, NonDocumentTypeChildNode); + +// Register special handling for the id attribute +attributes.registerChangeHandler(Element, 'id', + function(element, lname, oldval, newval) { + if (element.rooted) { + if (oldval) { + element.ownerDocument.delId(oldval, element); + } + if (newval) { + element.ownerDocument.addId(newval, element); + } + } + } +); +attributes.registerChangeHandler(Element, 'class', + function(element, lname, oldval, newval) { + if (element._classList) { element._classList._update(); } + } +); + +// The Attr class represents a single attribute. The values in +// _attrsByQName and _attrsByLName are instances of this class. +function Attr(elt, lname, prefix, namespace, value) { + // localName and namespace are constant for any attr object. + // But value may change. And so can prefix, and so, therefore can name. + this.localName = lname; + this.prefix = (prefix===null || prefix==='') ? null : ('' + prefix); + this.namespaceURI = (namespace===null || namespace==='') ? null : ('' + namespace); + this.data = value; + // Set ownerElement last to ensure it is hooked up to onchange handler + this._setOwnerElement(elt); +} + +// In DOM 3 Attr was supposed to extend Node; in DOM 4 that was abandoned. +Attr.prototype = Object.create(Object.prototype, { + ownerElement: { + get: function() { return this._ownerElement; }, + }, + _setOwnerElement: { value: function _setOwnerElement(elt) { + this._ownerElement = elt; + if (this.prefix === null && this.namespaceURI === null && elt) { + this.onchange = elt._attributeChangeHandlers[this.localName]; + } else { + this.onchange = null; + } + }}, + + name: { get: function() { + return this.prefix ? this.prefix + ':' + this.localName : this.localName; + }}, + + specified: { get: function() { + // Deprecated + return true; + }}, + + value: { + get: function() { + return this.data; + }, + set: function(value) { + var oldval = this.data; + value = (value === undefined) ? '' : value + ''; + if (value === oldval) return; + + this.data = value; + + // Run the onchange hook for the attribute + // if there is one. + if (this.ownerElement) { + if (this.onchange) + this.onchange(this.ownerElement,this.localName, oldval, value); + + // Generate a mutation event if the element is rooted + if (this.ownerElement.rooted) + this.ownerElement.ownerDocument.mutateAttr(this, oldval); + } + }, + }, + + cloneNode: { value: function cloneNode(deep) { + // Both this method and Document#createAttribute*() create unowned Attrs + return new Attr( + null, this.localName, this.prefix, this.namespaceURI, this.data + ); + }}, + + // Legacy aliases (see gh#70 and https://dom.spec.whatwg.org/#interface-attr) + nodeType: { get: function() { return Node.ATTRIBUTE_NODE; } }, + nodeName: { get: function() { return this.name; } }, + nodeValue: { + get: function() { return this.value; }, + set: function(v) { this.value = v; }, + }, + textContent: { + get: function() { return this.value; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } + this.value = v; + }, + }, + innerText: { + get: function() { return this.value; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } + this.value = v; + }, + }, +}); +// Sneakily export this class for use by Document.createAttribute() +Element._Attr = Attr; + +// The attributes property of an Element will be an instance of this class. +// This class is really just a dummy, though. It only defines a length +// property and an item() method. The AttrArrayProxy that +// defines the public API just uses the Element object itself. +function AttributesArray(elt) { + NamedNodeMap.call(this, elt); + for (var name in elt._attrsByQName) { + this[name] = elt._attrsByQName[name]; + } + for (var i = 0; i < elt._attrKeys.length; i++) { + this[i] = elt._attrsByLName[elt._attrKeys[i]]; + } +} +AttributesArray.prototype = Object.create(NamedNodeMap.prototype, { + length: { get: function() { + return this.element._attrKeys.length; + }, set: function() { /* ignore */ } }, + item: { value: function(n) { + /* jshint bitwise: false */ + n = n >>> 0; + if (n >= this.length) { return null; } + return this.element._attrsByLName[this.element._attrKeys[n]]; + /* jshint bitwise: true */ + } }, +}); + +// We can't make direct array access work (without Proxies, node >=6) +// but we can make `Array.from(node.attributes)` and for-of loops work. +if (globalThis.Symbol?.iterator) { + AttributesArray.prototype[globalThis.Symbol.iterator] = function() { + var i=0, n=this.length, self=this; + return { + next: function() { + if (ielement map. + // It is not part of the HTMLCollection API, but we need it in + // src/HTMLCollectionProxy + namedItems: { get: function() { + this.updateCache(); + return this.childrenByName; + } }, + + updateCache: { value: function updateCache() { + var namedElts = /^(a|applet|area|embed|form|frame|frameset|iframe|img|object)$/; + if (this.lastModTime !== this.element.lastModTime) { + this.lastModTime = this.element.lastModTime; + + var n = this.childrenByNumber && this.childrenByNumber.length || 0; + for(var i = 0; i < n; i++) { + this[i] = undefined; + } + + this.childrenByNumber = []; + this.childrenByName = Object.create(null); + + for (var c = this.element.firstChild; c !== null; c = c.nextSibling) { + if (c.nodeType === Node.ELEMENT_NODE) { + + this[this.childrenByNumber.length] = c; + this.childrenByNumber.push(c); + + // XXX Are there any requirements about the namespace + // of the id property? + var id = c.getAttribute('id'); + + // If there is an id that is not already in use... + if (id && !this.childrenByName[id]) + this.childrenByName[id] = c; + + // For certain HTML elements we check the name attribute + var name = c.getAttribute('name'); + if (name && + this.element.namespaceURI === NAMESPACE.HTML && + namedElts.test(this.element.localName) && + !this.childrenByName[name]) + this.childrenByName[id] = c; + } + } + } + } }, +}); + +// These functions return predicates for filtering elements. +// They're used by the Document and Element classes for methods like +// getElementsByTagName and getElementsByClassName + +function localNameElementFilter(lname) { + return function(e) { return e.localName === lname; }; +} + +function htmlLocalNameElementFilter(lname) { + var lclname = utils.toASCIILowerCase(lname); + if (lclname === lname) + return localNameElementFilter(lname); + + return function(e) { + return e.isHTML ? e.localName === lclname : e.localName === lname; + }; +} + +function namespaceElementFilter(ns) { + return function(e) { return e.namespaceURI === ns; }; +} + +function namespaceLocalNameElementFilter(ns, lname) { + return function(e) { + return e.namespaceURI === ns && e.localName === lname; + }; +} + +function classNamesElementFilter(names) { + return function(e) { + return names.every(function(n) { return e.classList.contains(n); }); + }; +} + +function elementNameFilter(name) { + return function(e) { + // All the *HTML elements* in the document with the given name attribute + if (e.namespaceURI !== NAMESPACE.HTML) { return false; } + return e.getAttribute('name') === name; + }; +} + + +/***/ }), + +/***/ 13441: +/***/ ((module) => { + +"use strict"; + +module.exports = Event; + +Event.CAPTURING_PHASE = 1; +Event.AT_TARGET = 2; +Event.BUBBLING_PHASE = 3; + +function Event(type, dictionary) { + // Initialize basic event properties + this.type = ''; + this.target = null; + this.currentTarget = null; + this.eventPhase = Event.AT_TARGET; + this.bubbles = false; + this.cancelable = false; + this.isTrusted = false; + this.defaultPrevented = false; + this.timeStamp = Date.now(); + + // Initialize internal flags + // XXX: Would it be better to inherit these defaults from the prototype? + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this._initialized = true; + this._dispatching = false; + + // Now initialize based on the constructor arguments (if any) + if (type) this.type = type; + if (dictionary) { + for(var p in dictionary) { + this[p] = dictionary[p]; + } + } +} + +Event.prototype = Object.create(Object.prototype, { + constructor: { value: Event }, + stopPropagation: { value: function stopPropagation() { + this._propagationStopped = true; + }}, + + stopImmediatePropagation: { value: function stopImmediatePropagation() { + this._propagationStopped = true; + this._immediatePropagationStopped = true; + }}, + + preventDefault: { value: function preventDefault() { + if (this.cancelable) this.defaultPrevented = true; + }}, + + initEvent: { value: function initEvent(type, bubbles, cancelable) { + this._initialized = true; + if (this._dispatching) return; + + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this.defaultPrevented = false; + this.isTrusted = false; + + this.target = null; + this.type = type; + this.bubbles = bubbles; + this.cancelable = cancelable; + }}, + +}); + + +/***/ }), + +/***/ 22356: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Event = __webpack_require__(13441); +var MouseEvent = __webpack_require__(21440); +var utils = __webpack_require__(89076); + +module.exports = EventTarget; + +function EventTarget() {} + +EventTarget.prototype = { + // XXX + // See WebIDL §4.8 for details on object event handlers + // and how they should behave. We actually have to accept + // any object to addEventListener... Can't type check it. + // on registration. + + // XXX: + // Capturing event listeners are sort of rare. I think I can optimize + // them so that dispatchEvent can skip the capturing phase (or much of + // it). Each time a capturing listener is added, increment a flag on + // the target node and each of its ancestors. Decrement when removed. + // And update the counter when nodes are added and removed from the + // tree as well. Then, in dispatch event, the capturing phase can + // abort if it sees any node with a zero count. + addEventListener: function addEventListener(type, listener, capture) { + if (!listener) return; + if (capture === undefined) capture = false; + if (!this._listeners) this._listeners = Object.create(null); + if (!this._listeners[type]) this._listeners[type] = []; + var list = this._listeners[type]; + + // If this listener has already been registered, just return + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) + return; + } + + // Add an object to the list of listeners + var obj = { listener: listener, capture: capture }; + if (typeof listener === 'function') obj.f = listener; + list.push(obj); + }, + + removeEventListener: function removeEventListener(type, + listener, + capture) { + if (capture === undefined) capture = false; + if (this._listeners) { + var list = this._listeners[type]; + if (list) { + // Find the listener in the list and remove it + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) { + if (list.length === 1) { + this._listeners[type] = undefined; + } + else { + list.splice(i, 1); + } + return; + } + } + } + } + }, + + // This is the public API for dispatching untrusted public events. + // See _dispatchEvent for the implementation + dispatchEvent: function dispatchEvent(event) { + // Dispatch an untrusted event + return this._dispatchEvent(event, false); + }, + + // + // See DOMCore §4.4 + // XXX: I'll probably need another version of this method for + // internal use, one that does not set isTrusted to false. + // XXX: see Document._dispatchEvent: perhaps that and this could + // call a common internal function with different settings of + // a trusted boolean argument + // + // XXX: + // The spec has changed in how to deal with handlers registered + // on idl or content attributes rather than with addEventListener. + // Used to say that they always ran first. That's how webkit does it + // Spec now says that they run in a position determined by + // when they were first set. FF does it that way. See: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-handlers + // + _dispatchEvent: function _dispatchEvent(event, trusted) { + if (typeof trusted !== 'boolean') trusted = false; + function invoke(target, event) { + var type = event.type, phase = event.eventPhase; + event.currentTarget = target; + + // If there was an individual handler defined, invoke it first + // XXX: see comment above: this shouldn't always be first. + if (phase !== Event.CAPTURING_PHASE && + target._handlers && target._handlers[type]) + { + var handler = target._handlers[type]; + var rv; + if (typeof handler === 'function') { + rv=handler.call(event.currentTarget, event); + } + else { + var f = handler.handleEvent; + if (typeof f !== 'function') + throw new TypeError('handleEvent property of ' + + 'event handler object is' + + 'not a function.'); + rv=f.call(handler, event); + } + + switch(event.type) { + case 'mouseover': + if (rv === true) // Historical baggage + event.preventDefault(); + break; + case 'beforeunload': + // XXX: eventually we need a special case here + /* falls through */ + default: + if (rv === false) + event.preventDefault(); + break; + } + } + + // Now invoke list list of listeners for this target and type + var list = target._listeners && target._listeners[type]; + if (!list) return; + list = list.slice(); + for(var i = 0, n = list.length; i < n; i++) { + if (event._immediatePropagationStopped) return; + var l = list[i]; + if ((phase === Event.CAPTURING_PHASE && !l.capture) || + (phase === Event.BUBBLING_PHASE && l.capture)) + continue; + if (l.f) { + l.f.call(event.currentTarget, event); + } + else { + var fn = l.listener.handleEvent; + if (typeof fn !== 'function') + throw new TypeError('handleEvent property of event listener object is not a function.'); + fn.call(l.listener, event); + } + } + } + + if (!event._initialized || event._dispatching) utils.InvalidStateError(); + event.isTrusted = trusted; + + // Begin dispatching the event now + event._dispatching = true; + event.target = this; + + // Build the list of targets for the capturing and bubbling phases + // XXX: we'll eventually have to add Window to this list. + var ancestors = []; + for(var n = this.parentNode; n; n = n.parentNode) + ancestors.push(n); + + // Capturing phase + event.eventPhase = Event.CAPTURING_PHASE; + for(var i = ancestors.length-1; i >= 0; i--) { + invoke(ancestors[i], event); + if (event._propagationStopped) break; + } + + // At target phase + if (!event._propagationStopped) { + event.eventPhase = Event.AT_TARGET; + invoke(this, event); + } + + // Bubbling phase + if (event.bubbles && !event._propagationStopped) { + event.eventPhase = Event.BUBBLING_PHASE; + for(var ii = 0, nn = ancestors.length; ii < nn; ii++) { + invoke(ancestors[ii], event); + if (event._propagationStopped) break; + } + } + + event._dispatching = false; + event.eventPhase = Event.AT_TARGET; + event.currentTarget = null; + + // Deal with mouse events and figure out when + // a click has happened + if (trusted && !event.defaultPrevented && event instanceof MouseEvent) { + switch(event.type) { + case 'mousedown': + this._armed = { + x: event.clientX, + y: event.clientY, + t: event.timeStamp + }; + break; + case 'mouseout': + case 'mouseover': + this._armed = null; + break; + case 'mouseup': + if (this._isClick(event)) this._doClick(event); + this._armed = null; + break; + } + } + + + + return !event.defaultPrevented; + }, + + // Determine whether a click occurred + // XXX We don't support double clicks for now + _isClick: function(event) { + return (this._armed !== null && + event.type === 'mouseup' && + event.isTrusted && + event.button === 0 && + event.timeStamp - this._armed.t < 1000 && + Math.abs(event.clientX - this._armed.x) < 10 && + Math.abs(event.clientY - this._armed.Y) < 10); + }, + + // Clicks are handled like this: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content-0 + // + // Note that this method is similar to the HTMLElement.click() method + // The event argument must be the trusted mouseup event + _doClick: function(event) { + if (this._click_in_progress) return; + this._click_in_progress = true; + + // Find the nearest enclosing element that is activatable + // An element is activatable if it has a + // _post_click_activation_steps hook + var activated = this; + while(activated && !activated._post_click_activation_steps) + activated = activated.parentNode; + + if (activated && activated._pre_click_activation_steps) { + activated._pre_click_activation_steps(); + } + + var click = this.ownerDocument.createEvent('MouseEvent'); + click.initMouseEvent('click', true, true, + this.ownerDocument.defaultView, 1, + event.screenX, event.screenY, + event.clientX, event.clientY, + event.ctrlKey, event.altKey, + event.shiftKey, event.metaKey, + event.button, null); + + var result = this._dispatchEvent(click, true); + + if (activated) { + if (result) { + // This is where hyperlinks get followed, for example. + if (activated._post_click_activation_steps) + activated._post_click_activation_steps(click); + } + else { + if (activated._cancelled_activation_steps) + activated._cancelled_activation_steps(); + } + } + }, + + // + // An event handler is like an event listener, but it registered + // by setting an IDL or content attribute like onload or onclick. + // There can only be one of these at a time for any event type. + // This is an internal method for the attribute accessors and + // content attribute handlers that need to register events handlers. + // The type argument is the same as in addEventListener(). + // The handler argument is the same as listeners in addEventListener: + // it can be a function or an object. Pass null to remove any existing + // handler. Handlers are always invoked before any listeners of + // the same type. They are not invoked during the capturing phase + // of event dispatch. + // + _setEventHandler: function _setEventHandler(type, handler) { + if (!this._handlers) this._handlers = Object.create(null); + this._handlers[type] = handler; + }, + + _getEventHandler: function _getEventHandler(type) { + return (this._handlers && this._handlers[type]) || null; + } + +}; + + +/***/ }), + +/***/ 61676: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = FilteredElementList; + +var Node = __webpack_require__(97537); + +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// +// XXX this should inherit from NodeList + +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} + +FilteredElementList.prototype = Object.create(Object.prototype, { + length: { get: function() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + } }, + + item: { value: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) { + // This can lead to O(N^2) behavior if we stop when we get to n + // and the caller is iterating through the items in order; so + // be sure to do the full traverse here. + this.traverse(/*n*/); + } + return this.cache[n]; + } }, + + checkcache: { value: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + } }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: { value: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + } }, + + // Return the next element under root that matches filter + next: { value: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); + + while(elt) { + if (this.filter(elt)) { + return elt; + } + + elt = elt.nextElement(this.root); + } + return null; + } }, +}); + + +/***/ }), + +/***/ 91895: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = HTMLParser; + +var Document = __webpack_require__(35452); +var DocumentType = __webpack_require__(73092); +var Node = __webpack_require__(97537); +var NAMESPACE = (__webpack_require__(89076).NAMESPACE); +var html = __webpack_require__(96324); +var impl = html.elements; + +var pushAll = Function.prototype.apply.bind(Array.prototype.push); + +/* + * This file contains an implementation of the HTML parsing algorithm. + * The algorithm and the implementation are complex because HTML + * explicitly defines how the parser should behave for all possible + * valid and invalid inputs. + * + * Usage: + * + * The file defines a single HTMLParser() function, which dom.js exposes + * publicly as document.implementation.mozHTMLParser(). This is a + * factory function, not a constructor. + * + * When you call document.implementation.mozHTMLParser(), it returns + * an object that has parse() and document() methods. To parse HTML text, + * pass the text (in one or more chunks) to the parse() method. When + * you've passed all the text (on the last chunk, or afterward) pass + * true as the second argument to parse() to tell the parser that there + * is no more coming. Call document() to get the document object that + * the parser is parsing into. You can call this at any time, before + * or after calling parse(). + * + * The first argument to mozHTMLParser is the absolute URL of the document. + * + * The second argument is optional and is for internal use only. Pass an + * element as the fragmentContext to do innerHTML parsing for the + * element. To do innerHTML parsing on a document, pass null. Otherwise, + * omit the 2nd argument. See HTMLElement.innerHTML for an example. Note + * that if you pass a context element, the end() method will return an + * unwrapped document instead of a wrapped one. + * + * Implementation details: + * + * This is a long file of almost 7000 lines. It is structured as one + * big function nested within another big function. The outer + * function defines a bunch of constant data, utility functions + * that use that data, and a couple of classes used by the parser. + * The outer function also defines and returns the + * inner function. This inner function is the HTMLParser factory + * function that implements the parser and holds all the parser state + * as local variables. The HTMLParser function is quite big because + * it defines many nested functions that use those local variables. + * + * There are three tightly coupled parser stages: a scanner, a + * tokenizer and a tree builder. In a (possibly misguided) attempt at + * efficiency, the stages are not implemented as separate classes: + * everything shares state and is (mostly) implemented in imperative + * (rather than OO) style. + * + * The stages of the parser work like this: When the client code calls + * the parser's parse() method, the specified string is passed to + * scanChars(). The scanner loops through that string and passes characters + * (sometimes one at a time, sometimes in chunks) to the tokenizer stage. + * The tokenizer groups the characters into tokens: tags, endtags, runs + * of text, comments, doctype declarations, and the end-of-file (EOF) + * token. These tokens are then passed to the tree building stage via + * the insertToken() function. The tree building stage builds up the + * document tree. + * + * The tokenizer stage is a finite state machine. Each state is + * implemented as a function with a name that ends in "_state". The + * initial state is data_state(). The current tokenizer state is stored + * in the variable 'tokenizer'. Most state functions expect a single + * integer argument which represents a single UTF-16 codepoint. Some + * states want more characters and set a lookahead property on + * themselves. The scanChars() function in the scanner checks for this + * lookahead property. If it doesn't exist, then scanChars() just passes + * the next input character to the current tokenizer state function. + * Otherwise, scanChars() looks ahead (a given # of characters, or for a + * matching string, or for a matching regexp) and passes a string of + * characters to the current tokenizer state function. + * + * As a shortcut, certain states of the tokenizer use regular expressions + * to look ahead in the scanner's input buffer for runs of text, simple + * tags and attributes. For well-formed input, these shortcuts skip a + * lot of state transitions and speed things up a bit. + * + * When a tokenizer state function has consumed a complete token, it + * emits that token, by calling insertToken(), or by calling a utility + * function that itself calls insertToken(). These tokens are passed to + * the tree building stage, which is also a state machine. Like the + * tokenizer, the tree building states are implemented as functions, and + * these functions have names that end with _mode (because the HTML spec + * refers to them as insertion modes). The current insertion mode is held + * by the 'parser' variable. Each insertion mode function takes up to 4 + * arguments. The first is a token type, represented by the constants + * TAG, ENDTAG, TEXT, COMMENT, DOCTYPE and EOF. The second argument is + * the value of the token: the text or comment data, or tagname or + * doctype. For tags, the 3rd argument is an array of attributes. For + * DOCTYPES it is the optional public id. For tags, the 4th argument is + * true if the tag is self-closing. For doctypes, the 4th argument is the + * optional system id. + * + * Search for "***" to find the major sub-divisions in the code. + */ + + +/*** + * Data prolog. Lots of constants declared here, including some + * very large objects. They're used throughout the code that follows + */ +// Token types for the tree builder. +var EOF = -1; +var TEXT = 1; +var TAG = 2; +var ENDTAG = 3; +var COMMENT = 4; +var DOCTYPE = 5; + +// A re-usable empty array +var NOATTRS = []; + +// These DTD public ids put the browser in quirks mode +var quirkyPublicIds = /^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i; + +var quirkySystemId = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"; + +var conditionallyQuirkyPublicIds = /^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i; + +// These DTD public ids put the browser in limited quirks mode +var limitedQuirkyPublicIds = /^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i; + + +// Element sets below. See the isA() function for a way to test +// whether an element is a member of a set +var specialSet = Object.create(null); +specialSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "applet":true, "area":true, "article":true, + "aside":true, "base":true, "basefont":true, "bgsound":true, + "blockquote":true, "body":true, "br":true, "button":true, + "caption":true, "center":true, "col":true, "colgroup":true, + "dd":true, "details":true, "dir":true, + "div":true, "dl":true, "dt":true, "embed":true, + "fieldset":true, "figcaption":true, "figure":true, "footer":true, + "form":true, "frame":true, "frameset":true, "h1":true, + "h2":true, "h3":true, "h4":true, "h5":true, + "h6":true, "head":true, "header":true, "hgroup":true, + "hr":true, "html":true, "iframe":true, "img":true, + "input":true, "li":true, "link":true, + "listing":true, "main":true, "marquee":true, "menu":true, "meta":true, + "nav":true, "noembed":true, "noframes":true, "noscript":true, + "object":true, "ol":true, "p":true, "param":true, + "plaintext":true, "pre":true, "script":true, "section":true, + "select":true, "source":true, "style":true, "summary":true, "table":true, + "tbody":true, "td":true, "template":true, "textarea":true, "tfoot":true, + "th":true, "thead":true, "title":true, "tr":true, "track":true, + // Note that "xmp" was removed from the "special" set in the latest + // spec, apparently by accident; see + // https://github.com/whatwg/html/pull/1919 + "ul":true, "wbr":true, "xmp":true +}; +specialSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject": true, "desc": true, "title": true +}; +specialSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; + +// The set of address, div, and p HTML tags +var addressdivpSet = Object.create(null); +addressdivpSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "div":true, "p":true +}; + +var dddtSet = Object.create(null); +dddtSet[NAMESPACE.HTML] = { + __proto__: null, + "dd":true, "dt":true +}; + +var tablesectionrowSet = Object.create(null); +tablesectionrowSet[NAMESPACE.HTML] = { + __proto__: null, + "table":true, "thead":true, "tbody":true, "tfoot":true, "tr":true +}; + +var impliedEndTagsSet = Object.create(null); +impliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "dd": true, "dt": true, "li": true, "menuitem": true, "optgroup": true, + "option": true, "p": true, "rb": true, "rp": true, "rt": true, "rtc": true +}; + +var thoroughImpliedEndTagsSet = Object.create(null); +thoroughImpliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "caption": true, "colgroup": true, "dd": true, "dt": true, "li": true, + "optgroup": true, "option": true, "p": true, "rb": true, "rp": true, + "rt": true, "rtc": true, "tbody": true, "td": true, "tfoot": true, + "th": true, "thead": true, "tr": true +}; + +var tableContextSet = Object.create(null); +tableContextSet[NAMESPACE.HTML] = { + __proto__: null, + "table": true, "template": true, "html": true +}; + +var tableBodyContextSet = Object.create(null); +tableBodyContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tbody": true, "tfoot": true, "thead": true, "template": true, "html": true +}; + +var tableRowContextSet = Object.create(null); +tableRowContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tr": true, "template": true, "html": true +}; + +// See http://www.w3.org/TR/html5/forms.html#form-associated-element +var formassociatedSet = Object.create(null); +formassociatedSet[NAMESPACE.HTML] = { + __proto__: null, + "button": true, "fieldset": true, "input": true, "keygen": true, + "object": true, "output": true, "select": true, "textarea": true, + "img": true +}; + +var inScopeSet = Object.create(null); +inScopeSet[NAMESPACE.HTML]= { + __proto__: null, + "applet":true, "caption":true, "html":true, "table":true, + "td":true, "th":true, "marquee":true, "object":true, + "template":true +}; +inScopeSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; +inScopeSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject":true, "desc":true, "title":true +}; + +var inListItemScopeSet = Object.create(inScopeSet); +inListItemScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inListItemScopeSet[NAMESPACE.HTML].ol = true; +inListItemScopeSet[NAMESPACE.HTML].ul = true; + +var inButtonScopeSet = Object.create(inScopeSet); +inButtonScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inButtonScopeSet[NAMESPACE.HTML].button = true; + +var inTableScopeSet = Object.create(null); +inTableScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "html":true, "table":true, "template":true +}; + +// The set of elements for select scope is the everything *except* these +var invertedSelectScopeSet = Object.create(null); +invertedSelectScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "optgroup":true, "option":true +}; + +var mathmlTextIntegrationPointSet = Object.create(null); +mathmlTextIntegrationPointSet[NAMESPACE.MATHML] = { + __proto__: null, + mi: true, + mo: true, + mn: true, + ms: true, + mtext: true +}; + +var htmlIntegrationPointSet = Object.create(null); +htmlIntegrationPointSet[NAMESPACE.SVG] = { + __proto__: null, + foreignObject: true, + desc: true, + title: true +}; + +var foreignAttributes = { + __proto__: null, + "xlink:actuate": NAMESPACE.XLINK, "xlink:arcrole": NAMESPACE.XLINK, + "xlink:href": NAMESPACE.XLINK, "xlink:role": NAMESPACE.XLINK, + "xlink:show": NAMESPACE.XLINK, "xlink:title": NAMESPACE.XLINK, + "xlink:type": NAMESPACE.XLINK, "xml:base": NAMESPACE.XML, + "xml:lang": NAMESPACE.XML, "xml:space": NAMESPACE.XML, + "xmlns": NAMESPACE.XMLNS, "xmlns:xlink": NAMESPACE.XMLNS +}; + + +// Lowercase to mixed case mapping for SVG attributes and tagnames +var svgAttrAdjustments = { + __proto__: null, + attributename: "attributeName", attributetype: "attributeType", + basefrequency: "baseFrequency", baseprofile: "baseProfile", + calcmode: "calcMode", clippathunits: "clipPathUnits", + diffuseconstant: "diffuseConstant", + edgemode: "edgeMode", + filterunits: "filterUnits", + glyphref: "glyphRef", gradienttransform: "gradientTransform", + gradientunits: "gradientUnits", kernelmatrix: "kernelMatrix", + kernelunitlength: "kernelUnitLength", keypoints: "keyPoints", + keysplines: "keySplines", keytimes: "keyTimes", + lengthadjust: "lengthAdjust", limitingconeangle: "limitingConeAngle", + markerheight: "markerHeight", markerunits: "markerUnits", + markerwidth: "markerWidth", maskcontentunits: "maskContentUnits", + maskunits: "maskUnits", numoctaves: "numOctaves", + pathlength: "pathLength", patterncontentunits: "patternContentUnits", + patterntransform: "patternTransform", patternunits: "patternUnits", + pointsatx: "pointsAtX", pointsaty: "pointsAtY", + pointsatz: "pointsAtZ", preservealpha: "preserveAlpha", + preserveaspectratio: "preserveAspectRatio", + primitiveunits: "primitiveUnits", refx: "refX", + refy: "refY", repeatcount: "repeatCount", + repeatdur: "repeatDur", requiredextensions: "requiredExtensions", + requiredfeatures: "requiredFeatures", + specularconstant: "specularConstant", + specularexponent: "specularExponent", spreadmethod: "spreadMethod", + startoffset: "startOffset", stddeviation: "stdDeviation", + stitchtiles: "stitchTiles", surfacescale: "surfaceScale", + systemlanguage: "systemLanguage", tablevalues: "tableValues", + targetx: "targetX", targety: "targetY", + textlength: "textLength", viewbox: "viewBox", + viewtarget: "viewTarget", xchannelselector: "xChannelSelector", + ychannelselector: "yChannelSelector", zoomandpan: "zoomAndPan" +}; + +var svgTagNameAdjustments = { + __proto__: null, + altglyph: "altGlyph", altglyphdef: "altGlyphDef", + altglyphitem: "altGlyphItem", animatecolor: "animateColor", + animatemotion: "animateMotion", animatetransform: "animateTransform", + clippath: "clipPath", feblend: "feBlend", + fecolormatrix: "feColorMatrix", + fecomponenttransfer: "feComponentTransfer", fecomposite: "feComposite", + feconvolvematrix: "feConvolveMatrix", + fediffuselighting: "feDiffuseLighting", + fedisplacementmap: "feDisplacementMap", + fedistantlight: "feDistantLight", feflood: "feFlood", + fefunca: "feFuncA", fefuncb: "feFuncB", + fefuncg: "feFuncG", fefuncr: "feFuncR", + fegaussianblur: "feGaussianBlur", feimage: "feImage", + femerge: "feMerge", femergenode: "feMergeNode", + femorphology: "feMorphology", feoffset: "feOffset", + fepointlight: "fePointLight", fespecularlighting: "feSpecularLighting", + fespotlight: "feSpotLight", fetile: "feTile", + feturbulence: "feTurbulence", foreignobject: "foreignObject", + glyphref: "glyphRef", lineargradient: "linearGradient", + radialgradient: "radialGradient", textpath: "textPath" +}; + + +// Data for parsing numeric and named character references +// These next 3 objects are direct translations of tables +// in the HTML spec into JavaScript object format +var numericCharRefReplacements = { + __proto__: null, + 0x00:0xFFFD, 0x80:0x20AC, 0x82:0x201A, 0x83:0x0192, 0x84:0x201E, + 0x85:0x2026, 0x86:0x2020, 0x87:0x2021, 0x88:0x02C6, 0x89:0x2030, + 0x8A:0x0160, 0x8B:0x2039, 0x8C:0x0152, 0x8E:0x017D, 0x91:0x2018, + 0x92:0x2019, 0x93:0x201C, 0x94:0x201D, 0x95:0x2022, 0x96:0x2013, + 0x97:0x2014, 0x98:0x02DC, 0x99:0x2122, 0x9A:0x0161, 0x9B:0x203A, + 0x9C:0x0153, 0x9E:0x017E, 0x9F:0x0178 +}; + +/* + * This table is generated with test/tools/update-entities.js + */ +var namedCharRefs = { + __proto__: null, + "AElig":0xc6, "AElig;":0xc6, + "AMP":0x26, "AMP;":0x26, + "Aacute":0xc1, "Aacute;":0xc1, + "Abreve;":0x102, "Acirc":0xc2, + "Acirc;":0xc2, "Acy;":0x410, + "Afr;":[0xd835,0xdd04], "Agrave":0xc0, + "Agrave;":0xc0, "Alpha;":0x391, + "Amacr;":0x100, "And;":0x2a53, + "Aogon;":0x104, "Aopf;":[0xd835,0xdd38], + "ApplyFunction;":0x2061, "Aring":0xc5, + "Aring;":0xc5, "Ascr;":[0xd835,0xdc9c], + "Assign;":0x2254, "Atilde":0xc3, + "Atilde;":0xc3, "Auml":0xc4, + "Auml;":0xc4, "Backslash;":0x2216, + "Barv;":0x2ae7, "Barwed;":0x2306, + "Bcy;":0x411, "Because;":0x2235, + "Bernoullis;":0x212c, "Beta;":0x392, + "Bfr;":[0xd835,0xdd05], "Bopf;":[0xd835,0xdd39], + "Breve;":0x2d8, "Bscr;":0x212c, + "Bumpeq;":0x224e, "CHcy;":0x427, + "COPY":0xa9, "COPY;":0xa9, + "Cacute;":0x106, "Cap;":0x22d2, + "CapitalDifferentialD;":0x2145, "Cayleys;":0x212d, + "Ccaron;":0x10c, "Ccedil":0xc7, + "Ccedil;":0xc7, "Ccirc;":0x108, + "Cconint;":0x2230, "Cdot;":0x10a, + "Cedilla;":0xb8, "CenterDot;":0xb7, + "Cfr;":0x212d, "Chi;":0x3a7, + "CircleDot;":0x2299, "CircleMinus;":0x2296, + "CirclePlus;":0x2295, "CircleTimes;":0x2297, + "ClockwiseContourIntegral;":0x2232, "CloseCurlyDoubleQuote;":0x201d, + "CloseCurlyQuote;":0x2019, "Colon;":0x2237, + "Colone;":0x2a74, "Congruent;":0x2261, + "Conint;":0x222f, "ContourIntegral;":0x222e, + "Copf;":0x2102, "Coproduct;":0x2210, + "CounterClockwiseContourIntegral;":0x2233, "Cross;":0x2a2f, + "Cscr;":[0xd835,0xdc9e], "Cup;":0x22d3, + "CupCap;":0x224d, "DD;":0x2145, + "DDotrahd;":0x2911, "DJcy;":0x402, + "DScy;":0x405, "DZcy;":0x40f, + "Dagger;":0x2021, "Darr;":0x21a1, + "Dashv;":0x2ae4, "Dcaron;":0x10e, + "Dcy;":0x414, "Del;":0x2207, + "Delta;":0x394, "Dfr;":[0xd835,0xdd07], + "DiacriticalAcute;":0xb4, "DiacriticalDot;":0x2d9, + "DiacriticalDoubleAcute;":0x2dd, "DiacriticalGrave;":0x60, + "DiacriticalTilde;":0x2dc, "Diamond;":0x22c4, + "DifferentialD;":0x2146, "Dopf;":[0xd835,0xdd3b], + "Dot;":0xa8, "DotDot;":0x20dc, + "DotEqual;":0x2250, "DoubleContourIntegral;":0x222f, + "DoubleDot;":0xa8, "DoubleDownArrow;":0x21d3, + "DoubleLeftArrow;":0x21d0, "DoubleLeftRightArrow;":0x21d4, + "DoubleLeftTee;":0x2ae4, "DoubleLongLeftArrow;":0x27f8, + "DoubleLongLeftRightArrow;":0x27fa, "DoubleLongRightArrow;":0x27f9, + "DoubleRightArrow;":0x21d2, "DoubleRightTee;":0x22a8, + "DoubleUpArrow;":0x21d1, "DoubleUpDownArrow;":0x21d5, + "DoubleVerticalBar;":0x2225, "DownArrow;":0x2193, + "DownArrowBar;":0x2913, "DownArrowUpArrow;":0x21f5, + "DownBreve;":0x311, "DownLeftRightVector;":0x2950, + "DownLeftTeeVector;":0x295e, "DownLeftVector;":0x21bd, + "DownLeftVectorBar;":0x2956, "DownRightTeeVector;":0x295f, + "DownRightVector;":0x21c1, "DownRightVectorBar;":0x2957, + "DownTee;":0x22a4, "DownTeeArrow;":0x21a7, + "Downarrow;":0x21d3, "Dscr;":[0xd835,0xdc9f], + "Dstrok;":0x110, "ENG;":0x14a, + "ETH":0xd0, "ETH;":0xd0, + "Eacute":0xc9, "Eacute;":0xc9, + "Ecaron;":0x11a, "Ecirc":0xca, + "Ecirc;":0xca, "Ecy;":0x42d, + "Edot;":0x116, "Efr;":[0xd835,0xdd08], + "Egrave":0xc8, "Egrave;":0xc8, + "Element;":0x2208, "Emacr;":0x112, + "EmptySmallSquare;":0x25fb, "EmptyVerySmallSquare;":0x25ab, + "Eogon;":0x118, "Eopf;":[0xd835,0xdd3c], + "Epsilon;":0x395, "Equal;":0x2a75, + "EqualTilde;":0x2242, "Equilibrium;":0x21cc, + "Escr;":0x2130, "Esim;":0x2a73, + "Eta;":0x397, "Euml":0xcb, + "Euml;":0xcb, "Exists;":0x2203, + "ExponentialE;":0x2147, "Fcy;":0x424, + "Ffr;":[0xd835,0xdd09], "FilledSmallSquare;":0x25fc, + "FilledVerySmallSquare;":0x25aa, "Fopf;":[0xd835,0xdd3d], + "ForAll;":0x2200, "Fouriertrf;":0x2131, + "Fscr;":0x2131, "GJcy;":0x403, + "GT":0x3e, "GT;":0x3e, + "Gamma;":0x393, "Gammad;":0x3dc, + "Gbreve;":0x11e, "Gcedil;":0x122, + "Gcirc;":0x11c, "Gcy;":0x413, + "Gdot;":0x120, "Gfr;":[0xd835,0xdd0a], + "Gg;":0x22d9, "Gopf;":[0xd835,0xdd3e], + "GreaterEqual;":0x2265, "GreaterEqualLess;":0x22db, + "GreaterFullEqual;":0x2267, "GreaterGreater;":0x2aa2, + "GreaterLess;":0x2277, "GreaterSlantEqual;":0x2a7e, + "GreaterTilde;":0x2273, "Gscr;":[0xd835,0xdca2], + "Gt;":0x226b, "HARDcy;":0x42a, + "Hacek;":0x2c7, "Hat;":0x5e, + "Hcirc;":0x124, "Hfr;":0x210c, + "HilbertSpace;":0x210b, "Hopf;":0x210d, + "HorizontalLine;":0x2500, "Hscr;":0x210b, + "Hstrok;":0x126, "HumpDownHump;":0x224e, + "HumpEqual;":0x224f, "IEcy;":0x415, + "IJlig;":0x132, "IOcy;":0x401, + "Iacute":0xcd, "Iacute;":0xcd, + "Icirc":0xce, "Icirc;":0xce, + "Icy;":0x418, "Idot;":0x130, + "Ifr;":0x2111, "Igrave":0xcc, + "Igrave;":0xcc, "Im;":0x2111, + "Imacr;":0x12a, "ImaginaryI;":0x2148, + "Implies;":0x21d2, "Int;":0x222c, + "Integral;":0x222b, "Intersection;":0x22c2, + "InvisibleComma;":0x2063, "InvisibleTimes;":0x2062, + "Iogon;":0x12e, "Iopf;":[0xd835,0xdd40], + "Iota;":0x399, "Iscr;":0x2110, + "Itilde;":0x128, "Iukcy;":0x406, + "Iuml":0xcf, "Iuml;":0xcf, + "Jcirc;":0x134, "Jcy;":0x419, + "Jfr;":[0xd835,0xdd0d], "Jopf;":[0xd835,0xdd41], + "Jscr;":[0xd835,0xdca5], "Jsercy;":0x408, + "Jukcy;":0x404, "KHcy;":0x425, + "KJcy;":0x40c, "Kappa;":0x39a, + "Kcedil;":0x136, "Kcy;":0x41a, + "Kfr;":[0xd835,0xdd0e], "Kopf;":[0xd835,0xdd42], + "Kscr;":[0xd835,0xdca6], "LJcy;":0x409, + "LT":0x3c, "LT;":0x3c, + "Lacute;":0x139, "Lambda;":0x39b, + "Lang;":0x27ea, "Laplacetrf;":0x2112, + "Larr;":0x219e, "Lcaron;":0x13d, + "Lcedil;":0x13b, "Lcy;":0x41b, + "LeftAngleBracket;":0x27e8, "LeftArrow;":0x2190, + "LeftArrowBar;":0x21e4, "LeftArrowRightArrow;":0x21c6, + "LeftCeiling;":0x2308, "LeftDoubleBracket;":0x27e6, + "LeftDownTeeVector;":0x2961, "LeftDownVector;":0x21c3, + "LeftDownVectorBar;":0x2959, "LeftFloor;":0x230a, + "LeftRightArrow;":0x2194, "LeftRightVector;":0x294e, + "LeftTee;":0x22a3, "LeftTeeArrow;":0x21a4, + "LeftTeeVector;":0x295a, "LeftTriangle;":0x22b2, + "LeftTriangleBar;":0x29cf, "LeftTriangleEqual;":0x22b4, + "LeftUpDownVector;":0x2951, "LeftUpTeeVector;":0x2960, + "LeftUpVector;":0x21bf, "LeftUpVectorBar;":0x2958, + "LeftVector;":0x21bc, "LeftVectorBar;":0x2952, + "Leftarrow;":0x21d0, "Leftrightarrow;":0x21d4, + "LessEqualGreater;":0x22da, "LessFullEqual;":0x2266, + "LessGreater;":0x2276, "LessLess;":0x2aa1, + "LessSlantEqual;":0x2a7d, "LessTilde;":0x2272, + "Lfr;":[0xd835,0xdd0f], "Ll;":0x22d8, + "Lleftarrow;":0x21da, "Lmidot;":0x13f, + "LongLeftArrow;":0x27f5, "LongLeftRightArrow;":0x27f7, + "LongRightArrow;":0x27f6, "Longleftarrow;":0x27f8, + "Longleftrightarrow;":0x27fa, "Longrightarrow;":0x27f9, + "Lopf;":[0xd835,0xdd43], "LowerLeftArrow;":0x2199, + "LowerRightArrow;":0x2198, "Lscr;":0x2112, + "Lsh;":0x21b0, "Lstrok;":0x141, + "Lt;":0x226a, "Map;":0x2905, + "Mcy;":0x41c, "MediumSpace;":0x205f, + "Mellintrf;":0x2133, "Mfr;":[0xd835,0xdd10], + "MinusPlus;":0x2213, "Mopf;":[0xd835,0xdd44], + "Mscr;":0x2133, "Mu;":0x39c, + "NJcy;":0x40a, "Nacute;":0x143, + "Ncaron;":0x147, "Ncedil;":0x145, + "Ncy;":0x41d, "NegativeMediumSpace;":0x200b, + "NegativeThickSpace;":0x200b, "NegativeThinSpace;":0x200b, + "NegativeVeryThinSpace;":0x200b, "NestedGreaterGreater;":0x226b, + "NestedLessLess;":0x226a, "NewLine;":0xa, + "Nfr;":[0xd835,0xdd11], "NoBreak;":0x2060, + "NonBreakingSpace;":0xa0, "Nopf;":0x2115, + "Not;":0x2aec, "NotCongruent;":0x2262, + "NotCupCap;":0x226d, "NotDoubleVerticalBar;":0x2226, + "NotElement;":0x2209, "NotEqual;":0x2260, + "NotEqualTilde;":[0x2242,0x338], "NotExists;":0x2204, + "NotGreater;":0x226f, "NotGreaterEqual;":0x2271, + "NotGreaterFullEqual;":[0x2267,0x338], "NotGreaterGreater;":[0x226b,0x338], + "NotGreaterLess;":0x2279, "NotGreaterSlantEqual;":[0x2a7e,0x338], + "NotGreaterTilde;":0x2275, "NotHumpDownHump;":[0x224e,0x338], + "NotHumpEqual;":[0x224f,0x338], "NotLeftTriangle;":0x22ea, + "NotLeftTriangleBar;":[0x29cf,0x338], "NotLeftTriangleEqual;":0x22ec, + "NotLess;":0x226e, "NotLessEqual;":0x2270, + "NotLessGreater;":0x2278, "NotLessLess;":[0x226a,0x338], + "NotLessSlantEqual;":[0x2a7d,0x338], "NotLessTilde;":0x2274, + "NotNestedGreaterGreater;":[0x2aa2,0x338], "NotNestedLessLess;":[0x2aa1,0x338], + "NotPrecedes;":0x2280, "NotPrecedesEqual;":[0x2aaf,0x338], + "NotPrecedesSlantEqual;":0x22e0, "NotReverseElement;":0x220c, + "NotRightTriangle;":0x22eb, "NotRightTriangleBar;":[0x29d0,0x338], + "NotRightTriangleEqual;":0x22ed, "NotSquareSubset;":[0x228f,0x338], + "NotSquareSubsetEqual;":0x22e2, "NotSquareSuperset;":[0x2290,0x338], + "NotSquareSupersetEqual;":0x22e3, "NotSubset;":[0x2282,0x20d2], + "NotSubsetEqual;":0x2288, "NotSucceeds;":0x2281, + "NotSucceedsEqual;":[0x2ab0,0x338], "NotSucceedsSlantEqual;":0x22e1, + "NotSucceedsTilde;":[0x227f,0x338], "NotSuperset;":[0x2283,0x20d2], + "NotSupersetEqual;":0x2289, "NotTilde;":0x2241, + "NotTildeEqual;":0x2244, "NotTildeFullEqual;":0x2247, + "NotTildeTilde;":0x2249, "NotVerticalBar;":0x2224, + "Nscr;":[0xd835,0xdca9], "Ntilde":0xd1, + "Ntilde;":0xd1, "Nu;":0x39d, + "OElig;":0x152, "Oacute":0xd3, + "Oacute;":0xd3, "Ocirc":0xd4, + "Ocirc;":0xd4, "Ocy;":0x41e, + "Odblac;":0x150, "Ofr;":[0xd835,0xdd12], + "Ograve":0xd2, "Ograve;":0xd2, + "Omacr;":0x14c, "Omega;":0x3a9, + "Omicron;":0x39f, "Oopf;":[0xd835,0xdd46], + "OpenCurlyDoubleQuote;":0x201c, "OpenCurlyQuote;":0x2018, + "Or;":0x2a54, "Oscr;":[0xd835,0xdcaa], + "Oslash":0xd8, "Oslash;":0xd8, + "Otilde":0xd5, "Otilde;":0xd5, + "Otimes;":0x2a37, "Ouml":0xd6, + "Ouml;":0xd6, "OverBar;":0x203e, + "OverBrace;":0x23de, "OverBracket;":0x23b4, + "OverParenthesis;":0x23dc, "PartialD;":0x2202, + "Pcy;":0x41f, "Pfr;":[0xd835,0xdd13], + "Phi;":0x3a6, "Pi;":0x3a0, + "PlusMinus;":0xb1, "Poincareplane;":0x210c, + "Popf;":0x2119, "Pr;":0x2abb, + "Precedes;":0x227a, "PrecedesEqual;":0x2aaf, + "PrecedesSlantEqual;":0x227c, "PrecedesTilde;":0x227e, + "Prime;":0x2033, "Product;":0x220f, + "Proportion;":0x2237, "Proportional;":0x221d, + "Pscr;":[0xd835,0xdcab], "Psi;":0x3a8, + "QUOT":0x22, "QUOT;":0x22, + "Qfr;":[0xd835,0xdd14], "Qopf;":0x211a, + "Qscr;":[0xd835,0xdcac], "RBarr;":0x2910, + "REG":0xae, "REG;":0xae, + "Racute;":0x154, "Rang;":0x27eb, + "Rarr;":0x21a0, "Rarrtl;":0x2916, + "Rcaron;":0x158, "Rcedil;":0x156, + "Rcy;":0x420, "Re;":0x211c, + "ReverseElement;":0x220b, "ReverseEquilibrium;":0x21cb, + "ReverseUpEquilibrium;":0x296f, "Rfr;":0x211c, + "Rho;":0x3a1, "RightAngleBracket;":0x27e9, + "RightArrow;":0x2192, "RightArrowBar;":0x21e5, + "RightArrowLeftArrow;":0x21c4, "RightCeiling;":0x2309, + "RightDoubleBracket;":0x27e7, "RightDownTeeVector;":0x295d, + "RightDownVector;":0x21c2, "RightDownVectorBar;":0x2955, + "RightFloor;":0x230b, "RightTee;":0x22a2, + "RightTeeArrow;":0x21a6, "RightTeeVector;":0x295b, + "RightTriangle;":0x22b3, "RightTriangleBar;":0x29d0, + "RightTriangleEqual;":0x22b5, "RightUpDownVector;":0x294f, + "RightUpTeeVector;":0x295c, "RightUpVector;":0x21be, + "RightUpVectorBar;":0x2954, "RightVector;":0x21c0, + "RightVectorBar;":0x2953, "Rightarrow;":0x21d2, + "Ropf;":0x211d, "RoundImplies;":0x2970, + "Rrightarrow;":0x21db, "Rscr;":0x211b, + "Rsh;":0x21b1, "RuleDelayed;":0x29f4, + "SHCHcy;":0x429, "SHcy;":0x428, + "SOFTcy;":0x42c, "Sacute;":0x15a, + "Sc;":0x2abc, "Scaron;":0x160, + "Scedil;":0x15e, "Scirc;":0x15c, + "Scy;":0x421, "Sfr;":[0xd835,0xdd16], + "ShortDownArrow;":0x2193, "ShortLeftArrow;":0x2190, + "ShortRightArrow;":0x2192, "ShortUpArrow;":0x2191, + "Sigma;":0x3a3, "SmallCircle;":0x2218, + "Sopf;":[0xd835,0xdd4a], "Sqrt;":0x221a, + "Square;":0x25a1, "SquareIntersection;":0x2293, + "SquareSubset;":0x228f, "SquareSubsetEqual;":0x2291, + "SquareSuperset;":0x2290, "SquareSupersetEqual;":0x2292, + "SquareUnion;":0x2294, "Sscr;":[0xd835,0xdcae], + "Star;":0x22c6, "Sub;":0x22d0, + "Subset;":0x22d0, "SubsetEqual;":0x2286, + "Succeeds;":0x227b, "SucceedsEqual;":0x2ab0, + "SucceedsSlantEqual;":0x227d, "SucceedsTilde;":0x227f, + "SuchThat;":0x220b, "Sum;":0x2211, + "Sup;":0x22d1, "Superset;":0x2283, + "SupersetEqual;":0x2287, "Supset;":0x22d1, + "THORN":0xde, "THORN;":0xde, + "TRADE;":0x2122, "TSHcy;":0x40b, + "TScy;":0x426, "Tab;":0x9, + "Tau;":0x3a4, "Tcaron;":0x164, + "Tcedil;":0x162, "Tcy;":0x422, + "Tfr;":[0xd835,0xdd17], "Therefore;":0x2234, + "Theta;":0x398, "ThickSpace;":[0x205f,0x200a], + "ThinSpace;":0x2009, "Tilde;":0x223c, + "TildeEqual;":0x2243, "TildeFullEqual;":0x2245, + "TildeTilde;":0x2248, "Topf;":[0xd835,0xdd4b], + "TripleDot;":0x20db, "Tscr;":[0xd835,0xdcaf], + "Tstrok;":0x166, "Uacute":0xda, + "Uacute;":0xda, "Uarr;":0x219f, + "Uarrocir;":0x2949, "Ubrcy;":0x40e, + "Ubreve;":0x16c, "Ucirc":0xdb, + "Ucirc;":0xdb, "Ucy;":0x423, + "Udblac;":0x170, "Ufr;":[0xd835,0xdd18], + "Ugrave":0xd9, "Ugrave;":0xd9, + "Umacr;":0x16a, "UnderBar;":0x5f, + "UnderBrace;":0x23df, "UnderBracket;":0x23b5, + "UnderParenthesis;":0x23dd, "Union;":0x22c3, + "UnionPlus;":0x228e, "Uogon;":0x172, + "Uopf;":[0xd835,0xdd4c], "UpArrow;":0x2191, + "UpArrowBar;":0x2912, "UpArrowDownArrow;":0x21c5, + "UpDownArrow;":0x2195, "UpEquilibrium;":0x296e, + "UpTee;":0x22a5, "UpTeeArrow;":0x21a5, + "Uparrow;":0x21d1, "Updownarrow;":0x21d5, + "UpperLeftArrow;":0x2196, "UpperRightArrow;":0x2197, + "Upsi;":0x3d2, "Upsilon;":0x3a5, + "Uring;":0x16e, "Uscr;":[0xd835,0xdcb0], + "Utilde;":0x168, "Uuml":0xdc, + "Uuml;":0xdc, "VDash;":0x22ab, + "Vbar;":0x2aeb, "Vcy;":0x412, + "Vdash;":0x22a9, "Vdashl;":0x2ae6, + "Vee;":0x22c1, "Verbar;":0x2016, + "Vert;":0x2016, "VerticalBar;":0x2223, + "VerticalLine;":0x7c, "VerticalSeparator;":0x2758, + "VerticalTilde;":0x2240, "VeryThinSpace;":0x200a, + "Vfr;":[0xd835,0xdd19], "Vopf;":[0xd835,0xdd4d], + "Vscr;":[0xd835,0xdcb1], "Vvdash;":0x22aa, + "Wcirc;":0x174, "Wedge;":0x22c0, + "Wfr;":[0xd835,0xdd1a], "Wopf;":[0xd835,0xdd4e], + "Wscr;":[0xd835,0xdcb2], "Xfr;":[0xd835,0xdd1b], + "Xi;":0x39e, "Xopf;":[0xd835,0xdd4f], + "Xscr;":[0xd835,0xdcb3], "YAcy;":0x42f, + "YIcy;":0x407, "YUcy;":0x42e, + "Yacute":0xdd, "Yacute;":0xdd, + "Ycirc;":0x176, "Ycy;":0x42b, + "Yfr;":[0xd835,0xdd1c], "Yopf;":[0xd835,0xdd50], + "Yscr;":[0xd835,0xdcb4], "Yuml;":0x178, + "ZHcy;":0x416, "Zacute;":0x179, + "Zcaron;":0x17d, "Zcy;":0x417, + "Zdot;":0x17b, "ZeroWidthSpace;":0x200b, + "Zeta;":0x396, "Zfr;":0x2128, + "Zopf;":0x2124, "Zscr;":[0xd835,0xdcb5], + "aacute":0xe1, "aacute;":0xe1, + "abreve;":0x103, "ac;":0x223e, + "acE;":[0x223e,0x333], "acd;":0x223f, + "acirc":0xe2, "acirc;":0xe2, + "acute":0xb4, "acute;":0xb4, + "acy;":0x430, "aelig":0xe6, + "aelig;":0xe6, "af;":0x2061, + "afr;":[0xd835,0xdd1e], "agrave":0xe0, + "agrave;":0xe0, "alefsym;":0x2135, + "aleph;":0x2135, "alpha;":0x3b1, + "amacr;":0x101, "amalg;":0x2a3f, + "amp":0x26, "amp;":0x26, + "and;":0x2227, "andand;":0x2a55, + "andd;":0x2a5c, "andslope;":0x2a58, + "andv;":0x2a5a, "ang;":0x2220, + "ange;":0x29a4, "angle;":0x2220, + "angmsd;":0x2221, "angmsdaa;":0x29a8, + "angmsdab;":0x29a9, "angmsdac;":0x29aa, + "angmsdad;":0x29ab, "angmsdae;":0x29ac, + "angmsdaf;":0x29ad, "angmsdag;":0x29ae, + "angmsdah;":0x29af, "angrt;":0x221f, + "angrtvb;":0x22be, "angrtvbd;":0x299d, + "angsph;":0x2222, "angst;":0xc5, + "angzarr;":0x237c, "aogon;":0x105, + "aopf;":[0xd835,0xdd52], "ap;":0x2248, + "apE;":0x2a70, "apacir;":0x2a6f, + "ape;":0x224a, "apid;":0x224b, + "apos;":0x27, "approx;":0x2248, + "approxeq;":0x224a, "aring":0xe5, + "aring;":0xe5, "ascr;":[0xd835,0xdcb6], + "ast;":0x2a, "asymp;":0x2248, + "asympeq;":0x224d, "atilde":0xe3, + "atilde;":0xe3, "auml":0xe4, + "auml;":0xe4, "awconint;":0x2233, + "awint;":0x2a11, "bNot;":0x2aed, + "backcong;":0x224c, "backepsilon;":0x3f6, + "backprime;":0x2035, "backsim;":0x223d, + "backsimeq;":0x22cd, "barvee;":0x22bd, + "barwed;":0x2305, "barwedge;":0x2305, + "bbrk;":0x23b5, "bbrktbrk;":0x23b6, + "bcong;":0x224c, "bcy;":0x431, + "bdquo;":0x201e, "becaus;":0x2235, + "because;":0x2235, "bemptyv;":0x29b0, + "bepsi;":0x3f6, "bernou;":0x212c, + "beta;":0x3b2, "beth;":0x2136, + "between;":0x226c, "bfr;":[0xd835,0xdd1f], + "bigcap;":0x22c2, "bigcirc;":0x25ef, + "bigcup;":0x22c3, "bigodot;":0x2a00, + "bigoplus;":0x2a01, "bigotimes;":0x2a02, + "bigsqcup;":0x2a06, "bigstar;":0x2605, + "bigtriangledown;":0x25bd, "bigtriangleup;":0x25b3, + "biguplus;":0x2a04, "bigvee;":0x22c1, + "bigwedge;":0x22c0, "bkarow;":0x290d, + "blacklozenge;":0x29eb, "blacksquare;":0x25aa, + "blacktriangle;":0x25b4, "blacktriangledown;":0x25be, + "blacktriangleleft;":0x25c2, "blacktriangleright;":0x25b8, + "blank;":0x2423, "blk12;":0x2592, + "blk14;":0x2591, "blk34;":0x2593, + "block;":0x2588, "bne;":[0x3d,0x20e5], + "bnequiv;":[0x2261,0x20e5], "bnot;":0x2310, + "bopf;":[0xd835,0xdd53], "bot;":0x22a5, + "bottom;":0x22a5, "bowtie;":0x22c8, + "boxDL;":0x2557, "boxDR;":0x2554, + "boxDl;":0x2556, "boxDr;":0x2553, + "boxH;":0x2550, "boxHD;":0x2566, + "boxHU;":0x2569, "boxHd;":0x2564, + "boxHu;":0x2567, "boxUL;":0x255d, + "boxUR;":0x255a, "boxUl;":0x255c, + "boxUr;":0x2559, "boxV;":0x2551, + "boxVH;":0x256c, "boxVL;":0x2563, + "boxVR;":0x2560, "boxVh;":0x256b, + "boxVl;":0x2562, "boxVr;":0x255f, + "boxbox;":0x29c9, "boxdL;":0x2555, + "boxdR;":0x2552, "boxdl;":0x2510, + "boxdr;":0x250c, "boxh;":0x2500, + "boxhD;":0x2565, "boxhU;":0x2568, + "boxhd;":0x252c, "boxhu;":0x2534, + "boxminus;":0x229f, "boxplus;":0x229e, + "boxtimes;":0x22a0, "boxuL;":0x255b, + "boxuR;":0x2558, "boxul;":0x2518, + "boxur;":0x2514, "boxv;":0x2502, + "boxvH;":0x256a, "boxvL;":0x2561, + "boxvR;":0x255e, "boxvh;":0x253c, + "boxvl;":0x2524, "boxvr;":0x251c, + "bprime;":0x2035, "breve;":0x2d8, + "brvbar":0xa6, "brvbar;":0xa6, + "bscr;":[0xd835,0xdcb7], "bsemi;":0x204f, + "bsim;":0x223d, "bsime;":0x22cd, + "bsol;":0x5c, "bsolb;":0x29c5, + "bsolhsub;":0x27c8, "bull;":0x2022, + "bullet;":0x2022, "bump;":0x224e, + "bumpE;":0x2aae, "bumpe;":0x224f, + "bumpeq;":0x224f, "cacute;":0x107, + "cap;":0x2229, "capand;":0x2a44, + "capbrcup;":0x2a49, "capcap;":0x2a4b, + "capcup;":0x2a47, "capdot;":0x2a40, + "caps;":[0x2229,0xfe00], "caret;":0x2041, + "caron;":0x2c7, "ccaps;":0x2a4d, + "ccaron;":0x10d, "ccedil":0xe7, + "ccedil;":0xe7, "ccirc;":0x109, + "ccups;":0x2a4c, "ccupssm;":0x2a50, + "cdot;":0x10b, "cedil":0xb8, + "cedil;":0xb8, "cemptyv;":0x29b2, + "cent":0xa2, "cent;":0xa2, + "centerdot;":0xb7, "cfr;":[0xd835,0xdd20], + "chcy;":0x447, "check;":0x2713, + "checkmark;":0x2713, "chi;":0x3c7, + "cir;":0x25cb, "cirE;":0x29c3, + "circ;":0x2c6, "circeq;":0x2257, + "circlearrowleft;":0x21ba, "circlearrowright;":0x21bb, + "circledR;":0xae, "circledS;":0x24c8, + "circledast;":0x229b, "circledcirc;":0x229a, + "circleddash;":0x229d, "cire;":0x2257, + "cirfnint;":0x2a10, "cirmid;":0x2aef, + "cirscir;":0x29c2, "clubs;":0x2663, + "clubsuit;":0x2663, "colon;":0x3a, + "colone;":0x2254, "coloneq;":0x2254, + "comma;":0x2c, "commat;":0x40, + "comp;":0x2201, "compfn;":0x2218, + "complement;":0x2201, "complexes;":0x2102, + "cong;":0x2245, "congdot;":0x2a6d, + "conint;":0x222e, "copf;":[0xd835,0xdd54], + "coprod;":0x2210, "copy":0xa9, + "copy;":0xa9, "copysr;":0x2117, + "crarr;":0x21b5, "cross;":0x2717, + "cscr;":[0xd835,0xdcb8], "csub;":0x2acf, + "csube;":0x2ad1, "csup;":0x2ad0, + "csupe;":0x2ad2, "ctdot;":0x22ef, + "cudarrl;":0x2938, "cudarrr;":0x2935, + "cuepr;":0x22de, "cuesc;":0x22df, + "cularr;":0x21b6, "cularrp;":0x293d, + "cup;":0x222a, "cupbrcap;":0x2a48, + "cupcap;":0x2a46, "cupcup;":0x2a4a, + "cupdot;":0x228d, "cupor;":0x2a45, + "cups;":[0x222a,0xfe00], "curarr;":0x21b7, + "curarrm;":0x293c, "curlyeqprec;":0x22de, + "curlyeqsucc;":0x22df, "curlyvee;":0x22ce, + "curlywedge;":0x22cf, "curren":0xa4, + "curren;":0xa4, "curvearrowleft;":0x21b6, + "curvearrowright;":0x21b7, "cuvee;":0x22ce, + "cuwed;":0x22cf, "cwconint;":0x2232, + "cwint;":0x2231, "cylcty;":0x232d, + "dArr;":0x21d3, "dHar;":0x2965, + "dagger;":0x2020, "daleth;":0x2138, + "darr;":0x2193, "dash;":0x2010, + "dashv;":0x22a3, "dbkarow;":0x290f, + "dblac;":0x2dd, "dcaron;":0x10f, + "dcy;":0x434, "dd;":0x2146, + "ddagger;":0x2021, "ddarr;":0x21ca, + "ddotseq;":0x2a77, "deg":0xb0, + "deg;":0xb0, "delta;":0x3b4, + "demptyv;":0x29b1, "dfisht;":0x297f, + "dfr;":[0xd835,0xdd21], "dharl;":0x21c3, + "dharr;":0x21c2, "diam;":0x22c4, + "diamond;":0x22c4, "diamondsuit;":0x2666, + "diams;":0x2666, "die;":0xa8, + "digamma;":0x3dd, "disin;":0x22f2, + "div;":0xf7, "divide":0xf7, + "divide;":0xf7, "divideontimes;":0x22c7, + "divonx;":0x22c7, "djcy;":0x452, + "dlcorn;":0x231e, "dlcrop;":0x230d, + "dollar;":0x24, "dopf;":[0xd835,0xdd55], + "dot;":0x2d9, "doteq;":0x2250, + "doteqdot;":0x2251, "dotminus;":0x2238, + "dotplus;":0x2214, "dotsquare;":0x22a1, + "doublebarwedge;":0x2306, "downarrow;":0x2193, + "downdownarrows;":0x21ca, "downharpoonleft;":0x21c3, + "downharpoonright;":0x21c2, "drbkarow;":0x2910, + "drcorn;":0x231f, "drcrop;":0x230c, + "dscr;":[0xd835,0xdcb9], "dscy;":0x455, + "dsol;":0x29f6, "dstrok;":0x111, + "dtdot;":0x22f1, "dtri;":0x25bf, + "dtrif;":0x25be, "duarr;":0x21f5, + "duhar;":0x296f, "dwangle;":0x29a6, + "dzcy;":0x45f, "dzigrarr;":0x27ff, + "eDDot;":0x2a77, "eDot;":0x2251, + "eacute":0xe9, "eacute;":0xe9, + "easter;":0x2a6e, "ecaron;":0x11b, + "ecir;":0x2256, "ecirc":0xea, + "ecirc;":0xea, "ecolon;":0x2255, + "ecy;":0x44d, "edot;":0x117, + "ee;":0x2147, "efDot;":0x2252, + "efr;":[0xd835,0xdd22], "eg;":0x2a9a, + "egrave":0xe8, "egrave;":0xe8, + "egs;":0x2a96, "egsdot;":0x2a98, + "el;":0x2a99, "elinters;":0x23e7, + "ell;":0x2113, "els;":0x2a95, + "elsdot;":0x2a97, "emacr;":0x113, + "empty;":0x2205, "emptyset;":0x2205, + "emptyv;":0x2205, "emsp13;":0x2004, + "emsp14;":0x2005, "emsp;":0x2003, + "eng;":0x14b, "ensp;":0x2002, + "eogon;":0x119, "eopf;":[0xd835,0xdd56], + "epar;":0x22d5, "eparsl;":0x29e3, + "eplus;":0x2a71, "epsi;":0x3b5, + "epsilon;":0x3b5, "epsiv;":0x3f5, + "eqcirc;":0x2256, "eqcolon;":0x2255, + "eqsim;":0x2242, "eqslantgtr;":0x2a96, + "eqslantless;":0x2a95, "equals;":0x3d, + "equest;":0x225f, "equiv;":0x2261, + "equivDD;":0x2a78, "eqvparsl;":0x29e5, + "erDot;":0x2253, "erarr;":0x2971, + "escr;":0x212f, "esdot;":0x2250, + "esim;":0x2242, "eta;":0x3b7, + "eth":0xf0, "eth;":0xf0, + "euml":0xeb, "euml;":0xeb, + "euro;":0x20ac, "excl;":0x21, + "exist;":0x2203, "expectation;":0x2130, + "exponentiale;":0x2147, "fallingdotseq;":0x2252, + "fcy;":0x444, "female;":0x2640, + "ffilig;":0xfb03, "fflig;":0xfb00, + "ffllig;":0xfb04, "ffr;":[0xd835,0xdd23], + "filig;":0xfb01, "fjlig;":[0x66,0x6a], + "flat;":0x266d, "fllig;":0xfb02, + "fltns;":0x25b1, "fnof;":0x192, + "fopf;":[0xd835,0xdd57], "forall;":0x2200, + "fork;":0x22d4, "forkv;":0x2ad9, + "fpartint;":0x2a0d, "frac12":0xbd, + "frac12;":0xbd, "frac13;":0x2153, + "frac14":0xbc, "frac14;":0xbc, + "frac15;":0x2155, "frac16;":0x2159, + "frac18;":0x215b, "frac23;":0x2154, + "frac25;":0x2156, "frac34":0xbe, + "frac34;":0xbe, "frac35;":0x2157, + "frac38;":0x215c, "frac45;":0x2158, + "frac56;":0x215a, "frac58;":0x215d, + "frac78;":0x215e, "frasl;":0x2044, + "frown;":0x2322, "fscr;":[0xd835,0xdcbb], + "gE;":0x2267, "gEl;":0x2a8c, + "gacute;":0x1f5, "gamma;":0x3b3, + "gammad;":0x3dd, "gap;":0x2a86, + "gbreve;":0x11f, "gcirc;":0x11d, + "gcy;":0x433, "gdot;":0x121, + "ge;":0x2265, "gel;":0x22db, + "geq;":0x2265, "geqq;":0x2267, + "geqslant;":0x2a7e, "ges;":0x2a7e, + "gescc;":0x2aa9, "gesdot;":0x2a80, + "gesdoto;":0x2a82, "gesdotol;":0x2a84, + "gesl;":[0x22db,0xfe00], "gesles;":0x2a94, + "gfr;":[0xd835,0xdd24], "gg;":0x226b, + "ggg;":0x22d9, "gimel;":0x2137, + "gjcy;":0x453, "gl;":0x2277, + "glE;":0x2a92, "gla;":0x2aa5, + "glj;":0x2aa4, "gnE;":0x2269, + "gnap;":0x2a8a, "gnapprox;":0x2a8a, + "gne;":0x2a88, "gneq;":0x2a88, + "gneqq;":0x2269, "gnsim;":0x22e7, + "gopf;":[0xd835,0xdd58], "grave;":0x60, + "gscr;":0x210a, "gsim;":0x2273, + "gsime;":0x2a8e, "gsiml;":0x2a90, + "gt":0x3e, "gt;":0x3e, + "gtcc;":0x2aa7, "gtcir;":0x2a7a, + "gtdot;":0x22d7, "gtlPar;":0x2995, + "gtquest;":0x2a7c, "gtrapprox;":0x2a86, + "gtrarr;":0x2978, "gtrdot;":0x22d7, + "gtreqless;":0x22db, "gtreqqless;":0x2a8c, + "gtrless;":0x2277, "gtrsim;":0x2273, + "gvertneqq;":[0x2269,0xfe00], "gvnE;":[0x2269,0xfe00], + "hArr;":0x21d4, "hairsp;":0x200a, + "half;":0xbd, "hamilt;":0x210b, + "hardcy;":0x44a, "harr;":0x2194, + "harrcir;":0x2948, "harrw;":0x21ad, + "hbar;":0x210f, "hcirc;":0x125, + "hearts;":0x2665, "heartsuit;":0x2665, + "hellip;":0x2026, "hercon;":0x22b9, + "hfr;":[0xd835,0xdd25], "hksearow;":0x2925, + "hkswarow;":0x2926, "hoarr;":0x21ff, + "homtht;":0x223b, "hookleftarrow;":0x21a9, + "hookrightarrow;":0x21aa, "hopf;":[0xd835,0xdd59], + "horbar;":0x2015, "hscr;":[0xd835,0xdcbd], + "hslash;":0x210f, "hstrok;":0x127, + "hybull;":0x2043, "hyphen;":0x2010, + "iacute":0xed, "iacute;":0xed, + "ic;":0x2063, "icirc":0xee, + "icirc;":0xee, "icy;":0x438, + "iecy;":0x435, "iexcl":0xa1, + "iexcl;":0xa1, "iff;":0x21d4, + "ifr;":[0xd835,0xdd26], "igrave":0xec, + "igrave;":0xec, "ii;":0x2148, + "iiiint;":0x2a0c, "iiint;":0x222d, + "iinfin;":0x29dc, "iiota;":0x2129, + "ijlig;":0x133, "imacr;":0x12b, + "image;":0x2111, "imagline;":0x2110, + "imagpart;":0x2111, "imath;":0x131, + "imof;":0x22b7, "imped;":0x1b5, + "in;":0x2208, "incare;":0x2105, + "infin;":0x221e, "infintie;":0x29dd, + "inodot;":0x131, "int;":0x222b, + "intcal;":0x22ba, "integers;":0x2124, + "intercal;":0x22ba, "intlarhk;":0x2a17, + "intprod;":0x2a3c, "iocy;":0x451, + "iogon;":0x12f, "iopf;":[0xd835,0xdd5a], + "iota;":0x3b9, "iprod;":0x2a3c, + "iquest":0xbf, "iquest;":0xbf, + "iscr;":[0xd835,0xdcbe], "isin;":0x2208, + "isinE;":0x22f9, "isindot;":0x22f5, + "isins;":0x22f4, "isinsv;":0x22f3, + "isinv;":0x2208, "it;":0x2062, + "itilde;":0x129, "iukcy;":0x456, + "iuml":0xef, "iuml;":0xef, + "jcirc;":0x135, "jcy;":0x439, + "jfr;":[0xd835,0xdd27], "jmath;":0x237, + "jopf;":[0xd835,0xdd5b], "jscr;":[0xd835,0xdcbf], + "jsercy;":0x458, "jukcy;":0x454, + "kappa;":0x3ba, "kappav;":0x3f0, + "kcedil;":0x137, "kcy;":0x43a, + "kfr;":[0xd835,0xdd28], "kgreen;":0x138, + "khcy;":0x445, "kjcy;":0x45c, + "kopf;":[0xd835,0xdd5c], "kscr;":[0xd835,0xdcc0], + "lAarr;":0x21da, "lArr;":0x21d0, + "lAtail;":0x291b, "lBarr;":0x290e, + "lE;":0x2266, "lEg;":0x2a8b, + "lHar;":0x2962, "lacute;":0x13a, + "laemptyv;":0x29b4, "lagran;":0x2112, + "lambda;":0x3bb, "lang;":0x27e8, + "langd;":0x2991, "langle;":0x27e8, + "lap;":0x2a85, "laquo":0xab, + "laquo;":0xab, "larr;":0x2190, + "larrb;":0x21e4, "larrbfs;":0x291f, + "larrfs;":0x291d, "larrhk;":0x21a9, + "larrlp;":0x21ab, "larrpl;":0x2939, + "larrsim;":0x2973, "larrtl;":0x21a2, + "lat;":0x2aab, "latail;":0x2919, + "late;":0x2aad, "lates;":[0x2aad,0xfe00], + "lbarr;":0x290c, "lbbrk;":0x2772, + "lbrace;":0x7b, "lbrack;":0x5b, + "lbrke;":0x298b, "lbrksld;":0x298f, + "lbrkslu;":0x298d, "lcaron;":0x13e, + "lcedil;":0x13c, "lceil;":0x2308, + "lcub;":0x7b, "lcy;":0x43b, + "ldca;":0x2936, "ldquo;":0x201c, + "ldquor;":0x201e, "ldrdhar;":0x2967, + "ldrushar;":0x294b, "ldsh;":0x21b2, + "le;":0x2264, "leftarrow;":0x2190, + "leftarrowtail;":0x21a2, "leftharpoondown;":0x21bd, + "leftharpoonup;":0x21bc, "leftleftarrows;":0x21c7, + "leftrightarrow;":0x2194, "leftrightarrows;":0x21c6, + "leftrightharpoons;":0x21cb, "leftrightsquigarrow;":0x21ad, + "leftthreetimes;":0x22cb, "leg;":0x22da, + "leq;":0x2264, "leqq;":0x2266, + "leqslant;":0x2a7d, "les;":0x2a7d, + "lescc;":0x2aa8, "lesdot;":0x2a7f, + "lesdoto;":0x2a81, "lesdotor;":0x2a83, + "lesg;":[0x22da,0xfe00], "lesges;":0x2a93, + "lessapprox;":0x2a85, "lessdot;":0x22d6, + "lesseqgtr;":0x22da, "lesseqqgtr;":0x2a8b, + "lessgtr;":0x2276, "lesssim;":0x2272, + "lfisht;":0x297c, "lfloor;":0x230a, + "lfr;":[0xd835,0xdd29], "lg;":0x2276, + "lgE;":0x2a91, "lhard;":0x21bd, + "lharu;":0x21bc, "lharul;":0x296a, + "lhblk;":0x2584, "ljcy;":0x459, + "ll;":0x226a, "llarr;":0x21c7, + "llcorner;":0x231e, "llhard;":0x296b, + "lltri;":0x25fa, "lmidot;":0x140, + "lmoust;":0x23b0, "lmoustache;":0x23b0, + "lnE;":0x2268, "lnap;":0x2a89, + "lnapprox;":0x2a89, "lne;":0x2a87, + "lneq;":0x2a87, "lneqq;":0x2268, + "lnsim;":0x22e6, "loang;":0x27ec, + "loarr;":0x21fd, "lobrk;":0x27e6, + "longleftarrow;":0x27f5, "longleftrightarrow;":0x27f7, + "longmapsto;":0x27fc, "longrightarrow;":0x27f6, + "looparrowleft;":0x21ab, "looparrowright;":0x21ac, + "lopar;":0x2985, "lopf;":[0xd835,0xdd5d], + "loplus;":0x2a2d, "lotimes;":0x2a34, + "lowast;":0x2217, "lowbar;":0x5f, + "loz;":0x25ca, "lozenge;":0x25ca, + "lozf;":0x29eb, "lpar;":0x28, + "lparlt;":0x2993, "lrarr;":0x21c6, + "lrcorner;":0x231f, "lrhar;":0x21cb, + "lrhard;":0x296d, "lrm;":0x200e, + "lrtri;":0x22bf, "lsaquo;":0x2039, + "lscr;":[0xd835,0xdcc1], "lsh;":0x21b0, + "lsim;":0x2272, "lsime;":0x2a8d, + "lsimg;":0x2a8f, "lsqb;":0x5b, + "lsquo;":0x2018, "lsquor;":0x201a, + "lstrok;":0x142, "lt":0x3c, + "lt;":0x3c, "ltcc;":0x2aa6, + "ltcir;":0x2a79, "ltdot;":0x22d6, + "lthree;":0x22cb, "ltimes;":0x22c9, + "ltlarr;":0x2976, "ltquest;":0x2a7b, + "ltrPar;":0x2996, "ltri;":0x25c3, + "ltrie;":0x22b4, "ltrif;":0x25c2, + "lurdshar;":0x294a, "luruhar;":0x2966, + "lvertneqq;":[0x2268,0xfe00], "lvnE;":[0x2268,0xfe00], + "mDDot;":0x223a, "macr":0xaf, + "macr;":0xaf, "male;":0x2642, + "malt;":0x2720, "maltese;":0x2720, + "map;":0x21a6, "mapsto;":0x21a6, + "mapstodown;":0x21a7, "mapstoleft;":0x21a4, + "mapstoup;":0x21a5, "marker;":0x25ae, + "mcomma;":0x2a29, "mcy;":0x43c, + "mdash;":0x2014, "measuredangle;":0x2221, + "mfr;":[0xd835,0xdd2a], "mho;":0x2127, + "micro":0xb5, "micro;":0xb5, + "mid;":0x2223, "midast;":0x2a, + "midcir;":0x2af0, "middot":0xb7, + "middot;":0xb7, "minus;":0x2212, + "minusb;":0x229f, "minusd;":0x2238, + "minusdu;":0x2a2a, "mlcp;":0x2adb, + "mldr;":0x2026, "mnplus;":0x2213, + "models;":0x22a7, "mopf;":[0xd835,0xdd5e], + "mp;":0x2213, "mscr;":[0xd835,0xdcc2], + "mstpos;":0x223e, "mu;":0x3bc, + "multimap;":0x22b8, "mumap;":0x22b8, + "nGg;":[0x22d9,0x338], "nGt;":[0x226b,0x20d2], + "nGtv;":[0x226b,0x338], "nLeftarrow;":0x21cd, + "nLeftrightarrow;":0x21ce, "nLl;":[0x22d8,0x338], + "nLt;":[0x226a,0x20d2], "nLtv;":[0x226a,0x338], + "nRightarrow;":0x21cf, "nVDash;":0x22af, + "nVdash;":0x22ae, "nabla;":0x2207, + "nacute;":0x144, "nang;":[0x2220,0x20d2], + "nap;":0x2249, "napE;":[0x2a70,0x338], + "napid;":[0x224b,0x338], "napos;":0x149, + "napprox;":0x2249, "natur;":0x266e, + "natural;":0x266e, "naturals;":0x2115, + "nbsp":0xa0, "nbsp;":0xa0, + "nbump;":[0x224e,0x338], "nbumpe;":[0x224f,0x338], + "ncap;":0x2a43, "ncaron;":0x148, + "ncedil;":0x146, "ncong;":0x2247, + "ncongdot;":[0x2a6d,0x338], "ncup;":0x2a42, + "ncy;":0x43d, "ndash;":0x2013, + "ne;":0x2260, "neArr;":0x21d7, + "nearhk;":0x2924, "nearr;":0x2197, + "nearrow;":0x2197, "nedot;":[0x2250,0x338], + "nequiv;":0x2262, "nesear;":0x2928, + "nesim;":[0x2242,0x338], "nexist;":0x2204, + "nexists;":0x2204, "nfr;":[0xd835,0xdd2b], + "ngE;":[0x2267,0x338], "nge;":0x2271, + "ngeq;":0x2271, "ngeqq;":[0x2267,0x338], + "ngeqslant;":[0x2a7e,0x338], "nges;":[0x2a7e,0x338], + "ngsim;":0x2275, "ngt;":0x226f, + "ngtr;":0x226f, "nhArr;":0x21ce, + "nharr;":0x21ae, "nhpar;":0x2af2, + "ni;":0x220b, "nis;":0x22fc, + "nisd;":0x22fa, "niv;":0x220b, + "njcy;":0x45a, "nlArr;":0x21cd, + "nlE;":[0x2266,0x338], "nlarr;":0x219a, + "nldr;":0x2025, "nle;":0x2270, + "nleftarrow;":0x219a, "nleftrightarrow;":0x21ae, + "nleq;":0x2270, "nleqq;":[0x2266,0x338], + "nleqslant;":[0x2a7d,0x338], "nles;":[0x2a7d,0x338], + "nless;":0x226e, "nlsim;":0x2274, + "nlt;":0x226e, "nltri;":0x22ea, + "nltrie;":0x22ec, "nmid;":0x2224, + "nopf;":[0xd835,0xdd5f], "not":0xac, + "not;":0xac, "notin;":0x2209, + "notinE;":[0x22f9,0x338], "notindot;":[0x22f5,0x338], + "notinva;":0x2209, "notinvb;":0x22f7, + "notinvc;":0x22f6, "notni;":0x220c, + "notniva;":0x220c, "notnivb;":0x22fe, + "notnivc;":0x22fd, "npar;":0x2226, + "nparallel;":0x2226, "nparsl;":[0x2afd,0x20e5], + "npart;":[0x2202,0x338], "npolint;":0x2a14, + "npr;":0x2280, "nprcue;":0x22e0, + "npre;":[0x2aaf,0x338], "nprec;":0x2280, + "npreceq;":[0x2aaf,0x338], "nrArr;":0x21cf, + "nrarr;":0x219b, "nrarrc;":[0x2933,0x338], + "nrarrw;":[0x219d,0x338], "nrightarrow;":0x219b, + "nrtri;":0x22eb, "nrtrie;":0x22ed, + "nsc;":0x2281, "nsccue;":0x22e1, + "nsce;":[0x2ab0,0x338], "nscr;":[0xd835,0xdcc3], + "nshortmid;":0x2224, "nshortparallel;":0x2226, + "nsim;":0x2241, "nsime;":0x2244, + "nsimeq;":0x2244, "nsmid;":0x2224, + "nspar;":0x2226, "nsqsube;":0x22e2, + "nsqsupe;":0x22e3, "nsub;":0x2284, + "nsubE;":[0x2ac5,0x338], "nsube;":0x2288, + "nsubset;":[0x2282,0x20d2], "nsubseteq;":0x2288, + "nsubseteqq;":[0x2ac5,0x338], "nsucc;":0x2281, + "nsucceq;":[0x2ab0,0x338], "nsup;":0x2285, + "nsupE;":[0x2ac6,0x338], "nsupe;":0x2289, + "nsupset;":[0x2283,0x20d2], "nsupseteq;":0x2289, + "nsupseteqq;":[0x2ac6,0x338], "ntgl;":0x2279, + "ntilde":0xf1, "ntilde;":0xf1, + "ntlg;":0x2278, "ntriangleleft;":0x22ea, + "ntrianglelefteq;":0x22ec, "ntriangleright;":0x22eb, + "ntrianglerighteq;":0x22ed, "nu;":0x3bd, + "num;":0x23, "numero;":0x2116, + "numsp;":0x2007, "nvDash;":0x22ad, + "nvHarr;":0x2904, "nvap;":[0x224d,0x20d2], + "nvdash;":0x22ac, "nvge;":[0x2265,0x20d2], + "nvgt;":[0x3e,0x20d2], "nvinfin;":0x29de, + "nvlArr;":0x2902, "nvle;":[0x2264,0x20d2], + "nvlt;":[0x3c,0x20d2], "nvltrie;":[0x22b4,0x20d2], + "nvrArr;":0x2903, "nvrtrie;":[0x22b5,0x20d2], + "nvsim;":[0x223c,0x20d2], "nwArr;":0x21d6, + "nwarhk;":0x2923, "nwarr;":0x2196, + "nwarrow;":0x2196, "nwnear;":0x2927, + "oS;":0x24c8, "oacute":0xf3, + "oacute;":0xf3, "oast;":0x229b, + "ocir;":0x229a, "ocirc":0xf4, + "ocirc;":0xf4, "ocy;":0x43e, + "odash;":0x229d, "odblac;":0x151, + "odiv;":0x2a38, "odot;":0x2299, + "odsold;":0x29bc, "oelig;":0x153, + "ofcir;":0x29bf, "ofr;":[0xd835,0xdd2c], + "ogon;":0x2db, "ograve":0xf2, + "ograve;":0xf2, "ogt;":0x29c1, + "ohbar;":0x29b5, "ohm;":0x3a9, + "oint;":0x222e, "olarr;":0x21ba, + "olcir;":0x29be, "olcross;":0x29bb, + "oline;":0x203e, "olt;":0x29c0, + "omacr;":0x14d, "omega;":0x3c9, + "omicron;":0x3bf, "omid;":0x29b6, + "ominus;":0x2296, "oopf;":[0xd835,0xdd60], + "opar;":0x29b7, "operp;":0x29b9, + "oplus;":0x2295, "or;":0x2228, + "orarr;":0x21bb, "ord;":0x2a5d, + "order;":0x2134, "orderof;":0x2134, + "ordf":0xaa, "ordf;":0xaa, + "ordm":0xba, "ordm;":0xba, + "origof;":0x22b6, "oror;":0x2a56, + "orslope;":0x2a57, "orv;":0x2a5b, + "oscr;":0x2134, "oslash":0xf8, + "oslash;":0xf8, "osol;":0x2298, + "otilde":0xf5, "otilde;":0xf5, + "otimes;":0x2297, "otimesas;":0x2a36, + "ouml":0xf6, "ouml;":0xf6, + "ovbar;":0x233d, "par;":0x2225, + "para":0xb6, "para;":0xb6, + "parallel;":0x2225, "parsim;":0x2af3, + "parsl;":0x2afd, "part;":0x2202, + "pcy;":0x43f, "percnt;":0x25, + "period;":0x2e, "permil;":0x2030, + "perp;":0x22a5, "pertenk;":0x2031, + "pfr;":[0xd835,0xdd2d], "phi;":0x3c6, + "phiv;":0x3d5, "phmmat;":0x2133, + "phone;":0x260e, "pi;":0x3c0, + "pitchfork;":0x22d4, "piv;":0x3d6, + "planck;":0x210f, "planckh;":0x210e, + "plankv;":0x210f, "plus;":0x2b, + "plusacir;":0x2a23, "plusb;":0x229e, + "pluscir;":0x2a22, "plusdo;":0x2214, + "plusdu;":0x2a25, "pluse;":0x2a72, + "plusmn":0xb1, "plusmn;":0xb1, + "plussim;":0x2a26, "plustwo;":0x2a27, + "pm;":0xb1, "pointint;":0x2a15, + "popf;":[0xd835,0xdd61], "pound":0xa3, + "pound;":0xa3, "pr;":0x227a, + "prE;":0x2ab3, "prap;":0x2ab7, + "prcue;":0x227c, "pre;":0x2aaf, + "prec;":0x227a, "precapprox;":0x2ab7, + "preccurlyeq;":0x227c, "preceq;":0x2aaf, + "precnapprox;":0x2ab9, "precneqq;":0x2ab5, + "precnsim;":0x22e8, "precsim;":0x227e, + "prime;":0x2032, "primes;":0x2119, + "prnE;":0x2ab5, "prnap;":0x2ab9, + "prnsim;":0x22e8, "prod;":0x220f, + "profalar;":0x232e, "profline;":0x2312, + "profsurf;":0x2313, "prop;":0x221d, + "propto;":0x221d, "prsim;":0x227e, + "prurel;":0x22b0, "pscr;":[0xd835,0xdcc5], + "psi;":0x3c8, "puncsp;":0x2008, + "qfr;":[0xd835,0xdd2e], "qint;":0x2a0c, + "qopf;":[0xd835,0xdd62], "qprime;":0x2057, + "qscr;":[0xd835,0xdcc6], "quaternions;":0x210d, + "quatint;":0x2a16, "quest;":0x3f, + "questeq;":0x225f, "quot":0x22, + "quot;":0x22, "rAarr;":0x21db, + "rArr;":0x21d2, "rAtail;":0x291c, + "rBarr;":0x290f, "rHar;":0x2964, + "race;":[0x223d,0x331], "racute;":0x155, + "radic;":0x221a, "raemptyv;":0x29b3, + "rang;":0x27e9, "rangd;":0x2992, + "range;":0x29a5, "rangle;":0x27e9, + "raquo":0xbb, "raquo;":0xbb, + "rarr;":0x2192, "rarrap;":0x2975, + "rarrb;":0x21e5, "rarrbfs;":0x2920, + "rarrc;":0x2933, "rarrfs;":0x291e, + "rarrhk;":0x21aa, "rarrlp;":0x21ac, + "rarrpl;":0x2945, "rarrsim;":0x2974, + "rarrtl;":0x21a3, "rarrw;":0x219d, + "ratail;":0x291a, "ratio;":0x2236, + "rationals;":0x211a, "rbarr;":0x290d, + "rbbrk;":0x2773, "rbrace;":0x7d, + "rbrack;":0x5d, "rbrke;":0x298c, + "rbrksld;":0x298e, "rbrkslu;":0x2990, + "rcaron;":0x159, "rcedil;":0x157, + "rceil;":0x2309, "rcub;":0x7d, + "rcy;":0x440, "rdca;":0x2937, + "rdldhar;":0x2969, "rdquo;":0x201d, + "rdquor;":0x201d, "rdsh;":0x21b3, + "real;":0x211c, "realine;":0x211b, + "realpart;":0x211c, "reals;":0x211d, + "rect;":0x25ad, "reg":0xae, + "reg;":0xae, "rfisht;":0x297d, + "rfloor;":0x230b, "rfr;":[0xd835,0xdd2f], + "rhard;":0x21c1, "rharu;":0x21c0, + "rharul;":0x296c, "rho;":0x3c1, + "rhov;":0x3f1, "rightarrow;":0x2192, + "rightarrowtail;":0x21a3, "rightharpoondown;":0x21c1, + "rightharpoonup;":0x21c0, "rightleftarrows;":0x21c4, + "rightleftharpoons;":0x21cc, "rightrightarrows;":0x21c9, + "rightsquigarrow;":0x219d, "rightthreetimes;":0x22cc, + "ring;":0x2da, "risingdotseq;":0x2253, + "rlarr;":0x21c4, "rlhar;":0x21cc, + "rlm;":0x200f, "rmoust;":0x23b1, + "rmoustache;":0x23b1, "rnmid;":0x2aee, + "roang;":0x27ed, "roarr;":0x21fe, + "robrk;":0x27e7, "ropar;":0x2986, + "ropf;":[0xd835,0xdd63], "roplus;":0x2a2e, + "rotimes;":0x2a35, "rpar;":0x29, + "rpargt;":0x2994, "rppolint;":0x2a12, + "rrarr;":0x21c9, "rsaquo;":0x203a, + "rscr;":[0xd835,0xdcc7], "rsh;":0x21b1, + "rsqb;":0x5d, "rsquo;":0x2019, + "rsquor;":0x2019, "rthree;":0x22cc, + "rtimes;":0x22ca, "rtri;":0x25b9, + "rtrie;":0x22b5, "rtrif;":0x25b8, + "rtriltri;":0x29ce, "ruluhar;":0x2968, + "rx;":0x211e, "sacute;":0x15b, + "sbquo;":0x201a, "sc;":0x227b, + "scE;":0x2ab4, "scap;":0x2ab8, + "scaron;":0x161, "sccue;":0x227d, + "sce;":0x2ab0, "scedil;":0x15f, + "scirc;":0x15d, "scnE;":0x2ab6, + "scnap;":0x2aba, "scnsim;":0x22e9, + "scpolint;":0x2a13, "scsim;":0x227f, + "scy;":0x441, "sdot;":0x22c5, + "sdotb;":0x22a1, "sdote;":0x2a66, + "seArr;":0x21d8, "searhk;":0x2925, + "searr;":0x2198, "searrow;":0x2198, + "sect":0xa7, "sect;":0xa7, + "semi;":0x3b, "seswar;":0x2929, + "setminus;":0x2216, "setmn;":0x2216, + "sext;":0x2736, "sfr;":[0xd835,0xdd30], + "sfrown;":0x2322, "sharp;":0x266f, + "shchcy;":0x449, "shcy;":0x448, + "shortmid;":0x2223, "shortparallel;":0x2225, + "shy":0xad, "shy;":0xad, + "sigma;":0x3c3, "sigmaf;":0x3c2, + "sigmav;":0x3c2, "sim;":0x223c, + "simdot;":0x2a6a, "sime;":0x2243, + "simeq;":0x2243, "simg;":0x2a9e, + "simgE;":0x2aa0, "siml;":0x2a9d, + "simlE;":0x2a9f, "simne;":0x2246, + "simplus;":0x2a24, "simrarr;":0x2972, + "slarr;":0x2190, "smallsetminus;":0x2216, + "smashp;":0x2a33, "smeparsl;":0x29e4, + "smid;":0x2223, "smile;":0x2323, + "smt;":0x2aaa, "smte;":0x2aac, + "smtes;":[0x2aac,0xfe00], "softcy;":0x44c, + "sol;":0x2f, "solb;":0x29c4, + "solbar;":0x233f, "sopf;":[0xd835,0xdd64], + "spades;":0x2660, "spadesuit;":0x2660, + "spar;":0x2225, "sqcap;":0x2293, + "sqcaps;":[0x2293,0xfe00], "sqcup;":0x2294, + "sqcups;":[0x2294,0xfe00], "sqsub;":0x228f, + "sqsube;":0x2291, "sqsubset;":0x228f, + "sqsubseteq;":0x2291, "sqsup;":0x2290, + "sqsupe;":0x2292, "sqsupset;":0x2290, + "sqsupseteq;":0x2292, "squ;":0x25a1, + "square;":0x25a1, "squarf;":0x25aa, + "squf;":0x25aa, "srarr;":0x2192, + "sscr;":[0xd835,0xdcc8], "ssetmn;":0x2216, + "ssmile;":0x2323, "sstarf;":0x22c6, + "star;":0x2606, "starf;":0x2605, + "straightepsilon;":0x3f5, "straightphi;":0x3d5, + "strns;":0xaf, "sub;":0x2282, + "subE;":0x2ac5, "subdot;":0x2abd, + "sube;":0x2286, "subedot;":0x2ac3, + "submult;":0x2ac1, "subnE;":0x2acb, + "subne;":0x228a, "subplus;":0x2abf, + "subrarr;":0x2979, "subset;":0x2282, + "subseteq;":0x2286, "subseteqq;":0x2ac5, + "subsetneq;":0x228a, "subsetneqq;":0x2acb, + "subsim;":0x2ac7, "subsub;":0x2ad5, + "subsup;":0x2ad3, "succ;":0x227b, + "succapprox;":0x2ab8, "succcurlyeq;":0x227d, + "succeq;":0x2ab0, "succnapprox;":0x2aba, + "succneqq;":0x2ab6, "succnsim;":0x22e9, + "succsim;":0x227f, "sum;":0x2211, + "sung;":0x266a, "sup1":0xb9, + "sup1;":0xb9, "sup2":0xb2, + "sup2;":0xb2, "sup3":0xb3, + "sup3;":0xb3, "sup;":0x2283, + "supE;":0x2ac6, "supdot;":0x2abe, + "supdsub;":0x2ad8, "supe;":0x2287, + "supedot;":0x2ac4, "suphsol;":0x27c9, + "suphsub;":0x2ad7, "suplarr;":0x297b, + "supmult;":0x2ac2, "supnE;":0x2acc, + "supne;":0x228b, "supplus;":0x2ac0, + "supset;":0x2283, "supseteq;":0x2287, + "supseteqq;":0x2ac6, "supsetneq;":0x228b, + "supsetneqq;":0x2acc, "supsim;":0x2ac8, + "supsub;":0x2ad4, "supsup;":0x2ad6, + "swArr;":0x21d9, "swarhk;":0x2926, + "swarr;":0x2199, "swarrow;":0x2199, + "swnwar;":0x292a, "szlig":0xdf, + "szlig;":0xdf, "target;":0x2316, + "tau;":0x3c4, "tbrk;":0x23b4, + "tcaron;":0x165, "tcedil;":0x163, + "tcy;":0x442, "tdot;":0x20db, + "telrec;":0x2315, "tfr;":[0xd835,0xdd31], + "there4;":0x2234, "therefore;":0x2234, + "theta;":0x3b8, "thetasym;":0x3d1, + "thetav;":0x3d1, "thickapprox;":0x2248, + "thicksim;":0x223c, "thinsp;":0x2009, + "thkap;":0x2248, "thksim;":0x223c, + "thorn":0xfe, "thorn;":0xfe, + "tilde;":0x2dc, "times":0xd7, + "times;":0xd7, "timesb;":0x22a0, + "timesbar;":0x2a31, "timesd;":0x2a30, + "tint;":0x222d, "toea;":0x2928, + "top;":0x22a4, "topbot;":0x2336, + "topcir;":0x2af1, "topf;":[0xd835,0xdd65], + "topfork;":0x2ada, "tosa;":0x2929, + "tprime;":0x2034, "trade;":0x2122, + "triangle;":0x25b5, "triangledown;":0x25bf, + "triangleleft;":0x25c3, "trianglelefteq;":0x22b4, + "triangleq;":0x225c, "triangleright;":0x25b9, + "trianglerighteq;":0x22b5, "tridot;":0x25ec, + "trie;":0x225c, "triminus;":0x2a3a, + "triplus;":0x2a39, "trisb;":0x29cd, + "tritime;":0x2a3b, "trpezium;":0x23e2, + "tscr;":[0xd835,0xdcc9], "tscy;":0x446, + "tshcy;":0x45b, "tstrok;":0x167, + "twixt;":0x226c, "twoheadleftarrow;":0x219e, + "twoheadrightarrow;":0x21a0, "uArr;":0x21d1, + "uHar;":0x2963, "uacute":0xfa, + "uacute;":0xfa, "uarr;":0x2191, + "ubrcy;":0x45e, "ubreve;":0x16d, + "ucirc":0xfb, "ucirc;":0xfb, + "ucy;":0x443, "udarr;":0x21c5, + "udblac;":0x171, "udhar;":0x296e, + "ufisht;":0x297e, "ufr;":[0xd835,0xdd32], + "ugrave":0xf9, "ugrave;":0xf9, + "uharl;":0x21bf, "uharr;":0x21be, + "uhblk;":0x2580, "ulcorn;":0x231c, + "ulcorner;":0x231c, "ulcrop;":0x230f, + "ultri;":0x25f8, "umacr;":0x16b, + "uml":0xa8, "uml;":0xa8, + "uogon;":0x173, "uopf;":[0xd835,0xdd66], + "uparrow;":0x2191, "updownarrow;":0x2195, + "upharpoonleft;":0x21bf, "upharpoonright;":0x21be, + "uplus;":0x228e, "upsi;":0x3c5, + "upsih;":0x3d2, "upsilon;":0x3c5, + "upuparrows;":0x21c8, "urcorn;":0x231d, + "urcorner;":0x231d, "urcrop;":0x230e, + "uring;":0x16f, "urtri;":0x25f9, + "uscr;":[0xd835,0xdcca], "utdot;":0x22f0, + "utilde;":0x169, "utri;":0x25b5, + "utrif;":0x25b4, "uuarr;":0x21c8, + "uuml":0xfc, "uuml;":0xfc, + "uwangle;":0x29a7, "vArr;":0x21d5, + "vBar;":0x2ae8, "vBarv;":0x2ae9, + "vDash;":0x22a8, "vangrt;":0x299c, + "varepsilon;":0x3f5, "varkappa;":0x3f0, + "varnothing;":0x2205, "varphi;":0x3d5, + "varpi;":0x3d6, "varpropto;":0x221d, + "varr;":0x2195, "varrho;":0x3f1, + "varsigma;":0x3c2, "varsubsetneq;":[0x228a,0xfe00], + "varsubsetneqq;":[0x2acb,0xfe00], "varsupsetneq;":[0x228b,0xfe00], + "varsupsetneqq;":[0x2acc,0xfe00], "vartheta;":0x3d1, + "vartriangleleft;":0x22b2, "vartriangleright;":0x22b3, + "vcy;":0x432, "vdash;":0x22a2, + "vee;":0x2228, "veebar;":0x22bb, + "veeeq;":0x225a, "vellip;":0x22ee, + "verbar;":0x7c, "vert;":0x7c, + "vfr;":[0xd835,0xdd33], "vltri;":0x22b2, + "vnsub;":[0x2282,0x20d2], "vnsup;":[0x2283,0x20d2], + "vopf;":[0xd835,0xdd67], "vprop;":0x221d, + "vrtri;":0x22b3, "vscr;":[0xd835,0xdccb], + "vsubnE;":[0x2acb,0xfe00], "vsubne;":[0x228a,0xfe00], + "vsupnE;":[0x2acc,0xfe00], "vsupne;":[0x228b,0xfe00], + "vzigzag;":0x299a, "wcirc;":0x175, + "wedbar;":0x2a5f, "wedge;":0x2227, + "wedgeq;":0x2259, "weierp;":0x2118, + "wfr;":[0xd835,0xdd34], "wopf;":[0xd835,0xdd68], + "wp;":0x2118, "wr;":0x2240, + "wreath;":0x2240, "wscr;":[0xd835,0xdccc], + "xcap;":0x22c2, "xcirc;":0x25ef, + "xcup;":0x22c3, "xdtri;":0x25bd, + "xfr;":[0xd835,0xdd35], "xhArr;":0x27fa, + "xharr;":0x27f7, "xi;":0x3be, + "xlArr;":0x27f8, "xlarr;":0x27f5, + "xmap;":0x27fc, "xnis;":0x22fb, + "xodot;":0x2a00, "xopf;":[0xd835,0xdd69], + "xoplus;":0x2a01, "xotime;":0x2a02, + "xrArr;":0x27f9, "xrarr;":0x27f6, + "xscr;":[0xd835,0xdccd], "xsqcup;":0x2a06, + "xuplus;":0x2a04, "xutri;":0x25b3, + "xvee;":0x22c1, "xwedge;":0x22c0, + "yacute":0xfd, "yacute;":0xfd, + "yacy;":0x44f, "ycirc;":0x177, + "ycy;":0x44b, "yen":0xa5, + "yen;":0xa5, "yfr;":[0xd835,0xdd36], + "yicy;":0x457, "yopf;":[0xd835,0xdd6a], + "yscr;":[0xd835,0xdcce], "yucy;":0x44e, + "yuml":0xff, "yuml;":0xff, + "zacute;":0x17a, "zcaron;":0x17e, + "zcy;":0x437, "zdot;":0x17c, + "zeetrf;":0x2128, "zeta;":0x3b6, + "zfr;":[0xd835,0xdd37], "zhcy;":0x436, + "zigrarr;":0x21dd, "zopf;":[0xd835,0xdd6b], + "zscr;":[0xd835,0xdccf], "zwj;":0x200d, + "zwnj;":0x200c, +}; +/* + * This regexp is generated with test/tools/update-entities.js + * It will always match at least one character -- but note that there + * are no entities whose names are a single character long. + */ +var NAMEDCHARREF = /(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g; + +var NAMEDCHARREF_MAXLEN = 32; + +// Regular expression constants used by the tokenizer and parser + +// Note that \r is included in all of these regexps because it will need +// to be converted to LF by the scanChars() function. +var DBLQUOTEATTRVAL = /[^\r"&\u0000]+/g; +var SINGLEQUOTEATTRVAL = /[^\r'&\u0000]+/g; +var UNQUOTEDATTRVAL = /[^\r\t\n\f &>\u0000]+/g; +var TAGNAME = /[^\r\t\n\f \/>A-Z\u0000]+/g; +var ATTRNAME = /[^\r\t\n\f \/=>A-Z\u0000]+/g; + +var CDATATEXT = /[^\]\r\u0000\uffff]*/g; +var DATATEXT = /[^&<\r\u0000\uffff]*/g; +var RAWTEXT = /[^<\r\u0000\uffff]*/g; +var PLAINTEXT = /[^\r\u0000\uffff]*/g; +// Since we don't have the 'sticky tag', add '|.' to the end of SIMPLETAG +// and SIMPLEATTR so that we are guaranteed to always match. This prevents +// us from scanning past the lastIndex set. (Note that the desired matches +// are always greater than 1 char long, so longest-match will ensure that . +// is not matched unless the desired match fails.) +var SIMPLETAG = /(?:(\/)?([a-z]+)>)|[\s\S]/g; +var SIMPLEATTR = /(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g; + +var NONWS = /[^\x09\x0A\x0C\x0D\x20]/; +var ALLNONWS = /[^\x09\x0A\x0C\x0D\x20]/g; // like above, with g flag +var NONWSNONNUL = /[^\x00\x09\x0A\x0C\x0D\x20]/; // don't allow NUL either +var LEADINGWS = /^[\x09\x0A\x0C\x0D\x20]+/; +var NULCHARS = /\x00/g; + +/*** + * These are utility functions that don't use any of the parser's + * internal state. + */ +function buf2str(buf) { + var CHUNKSIZE=16384; + if (buf.length < CHUNKSIZE) { + return String.fromCharCode.apply(String, buf); + } + // special case for large strings, to avoid busting the stack. + var result = ''; + for (var i = 0; i < buf.length; i += CHUNKSIZE) { + result += String.fromCharCode.apply(String, buf.slice(i, i+CHUNKSIZE)); + } + return result; +} + +function str2buf(s) { + var result = []; + for (var i=0; i 0; i--) { + var e = this.elements[i]; + if (isA(e, tag)) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Pop elements off the stack up to and including the first +// element that is an instance of the specified type +HTMLParser.ElementStack.prototype.popElementType = function(type) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] instanceof type) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Pop elements off the stack up to and including the element e. +// Note that this is very different from removeElement() +// This requires that e is on the stack. +HTMLParser.ElementStack.prototype.popElement = function(e) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] === e) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Remove a specific element from the stack. +// Do nothing if the element is not on the stack +HTMLParser.ElementStack.prototype.removeElement = function(e) { + if (this.top === e) this.pop(); + else { + var idx = this.elements.lastIndexOf(e); + if (idx !== -1) + this.elements.splice(idx, 1); + } +}; + +HTMLParser.ElementStack.prototype.clearToContext = function(set) { + // Note that we don't loop to 0. Never pop the elt off. + for(var i = this.elements.length-1; i > 0; i--) { + if (isA(this.elements[i], set)) break; + } + this.elements.length = i+1; + this.top = this.elements[i]; +}; + +HTMLParser.ElementStack.prototype.contains = function(tag) { + return this.inSpecificScope(tag, Object.create(null)); +}; + +HTMLParser.ElementStack.prototype.inSpecificScope = function(tag, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (isA(elt, tag)) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +// Like the above, but for a specific element, not a tagname +HTMLParser.ElementStack.prototype.elementInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt === target) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +// Like the above, but for an element interface, not a tagname +HTMLParser.ElementStack.prototype.elementTypeInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt instanceof target) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +HTMLParser.ElementStack.prototype.inScope = function(tag) { + return this.inSpecificScope(tag, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.elementInScope = function(e) { + return this.elementInSpecificScope(e, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.elementTypeInScope = function(type) { + return this.elementTypeInSpecificScope(type, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.inButtonScope = function(tag) { + return this.inSpecificScope(tag, inButtonScopeSet); +}; + +HTMLParser.ElementStack.prototype.inListItemScope = function(tag) { + return this.inSpecificScope(tag, inListItemScopeSet); +}; + +HTMLParser.ElementStack.prototype.inTableScope = function(tag) { + return this.inSpecificScope(tag, inTableScopeSet); +}; + +HTMLParser.ElementStack.prototype.inSelectScope = function(tag) { + // Can't implement this one with inSpecificScope, since it involves + // a set defined by inverting another set. So implement manually. + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt.namespaceURI !== NAMESPACE.HTML) return false; + var localname = elt.localName; + if (localname === tag) return true; + if (localname !== "optgroup" && localname !== "option") + return false; + } + return false; +}; + +HTMLParser.ElementStack.prototype.generateImpliedEndTags = function(butnot, thorough) { + var endTagSet = thorough ? thoroughImpliedEndTagsSet : impliedEndTagsSet; + for(var i = this.elements.length-1; i >= 0; i--) { + var e = this.elements[i]; + if (butnot && isA(e, butnot)) break; + if (!isA(this.elements[i], endTagSet)) break; + } + + this.elements.length = i+1; + this.top = this.elements[i]; +}; + +/*** + * The ActiveFormattingElements class + */ +HTMLParser.ActiveFormattingElements = function AFE() { + this.list = []; // elements + this.attrs = []; // attribute tokens for cloning +}; + +HTMLParser.ActiveFormattingElements.prototype.MARKER = { localName: "|" }; + +/* +// For debugging +HTMLParser.ActiveFormattingElements.prototype.toString = function() { + return "AFE: " + + this.list.map(function(e) { return e.localName; }).join("-"); +} +*/ + +HTMLParser.ActiveFormattingElements.prototype.insertMarker = function() { + this.list.push(this.MARKER); + this.attrs.push(this.MARKER); +}; + +HTMLParser.ActiveFormattingElements.prototype.push = function(elt, attrs) { + // Scan backwards: if there are already 3 copies of this element + // before we encounter a marker, then drop the last one + var count = 0; + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + // equal() is defined below + if (equal(elt, this.list[i], this.attrs[i])) { + count++; + if (count === 3) { + this.list.splice(i, 1); + this.attrs.splice(i, 1); + break; + } + } + } + + + // Now push the element onto the list + this.list.push(elt); + + // Copy the attributes and push those on, too + var attrcopy = []; + for(var ii = 0; ii < attrs.length; ii++) { + attrcopy[ii] = attrs[ii]; + } + + this.attrs.push(attrcopy); + + // This function defines equality of two elements for the purposes + // of the AFE list. Note that it compares the new elements + // attributes to the saved array of attributes associated with + // the old element because a script could have changed the + // old element's set of attributes + function equal(newelt, oldelt, oldattrs) { + if (newelt.localName !== oldelt.localName) return false; + if (newelt._numattrs !== oldattrs.length) return false; + for(var i = 0, n = oldattrs.length; i < n; i++) { + var oldname = oldattrs[i][0]; + var oldval = oldattrs[i][1]; + if (!newelt.hasAttribute(oldname)) return false; + if (newelt.getAttribute(oldname) !== oldval) return false; + } + return true; + } +}; + +HTMLParser.ActiveFormattingElements.prototype.clearToMarker = function() { + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + } + if (i < 0) i = 0; + this.list.length = i; + this.attrs.length = i; +}; + +// Find and return the last element with the specified tag between the +// end of the list and the last marker on the list. +// Used when parsing in_body_mode() +HTMLParser.ActiveFormattingElements.prototype.findElementByTag = function(tag) { + for(var i = this.list.length-1; i >= 0; i--) { + var elt = this.list[i]; + if (elt === this.MARKER) break; + if (elt.localName === tag) return elt; + } + return null; +}; + +HTMLParser.ActiveFormattingElements.prototype.indexOf = function(e) { + return this.list.lastIndexOf(e); +}; + +// Find the element e in the list and remove it +// Used when parsing in_body() +HTMLParser.ActiveFormattingElements.prototype.remove = function(e) { + var idx = this.list.lastIndexOf(e); + if (idx !== -1) { + this.list.splice(idx, 1); + this.attrs.splice(idx, 1); + } +}; + +// Find element a in the list and replace it with element b +// XXX: Do I need to handle attributes here? +HTMLParser.ActiveFormattingElements.prototype.replace = function(a, b, attrs) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list[idx] = b; + this.attrs[idx] = attrs; + } +}; + +// Find a in the list and insert b after it +// This is only used for insert a bookmark object, so the +// attrs array doesn't really matter +HTMLParser.ActiveFormattingElements.prototype.insertAfter = function(a,b) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list.splice(idx, 0, b); + this.attrs.splice(idx, 0, b); + } +}; + + + + +/*** + * This is the parser factory function. It is the return value of + * the outer closure that it is defined within. Most of the parser + * implementation details are inside this function. + */ +function HTMLParser(address, fragmentContext, options) { + /*** + * These are the parser's state variables + */ + // Scanner state + var chars = null; + var numchars = 0; // Length of chars + var nextchar = 0; // Index of next char + var input_complete = false; // Becomes true when end() called. + var scanner_skip_newline = false; // If previous char was CR + var reentrant_invocations = 0; + var saved_scanner_state = []; + var leftovers = ""; + var first_batch = true; + var paused = 0; // Becomes non-zero while loading scripts + + + // Tokenizer state + var tokenizer = data_state; // Current tokenizer state + var return_state; + var character_reference_code; + var tagnamebuf = ""; + var lasttagname = ""; // holds the target end tag for text states + var tempbuf = []; + var attrnamebuf = ""; + var attrvaluebuf = ""; + var commentbuf = []; + var doctypenamebuf = []; + var doctypepublicbuf = []; + var doctypesystembuf = []; + var attributes = []; + var is_end_tag = false; + + // Tree builder state + var parser = initial_mode; // Current insertion mode + var originalInsertionMode = null; // A saved insertion mode + var templateInsertionModes = []; // Stack of template insertion modes. + var stack = new HTMLParser.ElementStack(); // Stack of open elements + var afe = new HTMLParser.ActiveFormattingElements(); // mis-nested tags + var fragment = (fragmentContext!==undefined); // For innerHTML, etc. + var head_element_pointer = null; + var form_element_pointer = null; + var scripting_enabled = true; + if (fragmentContext) { + scripting_enabled = fragmentContext.ownerDocument._scripting_enabled; + } + if (options && options.scripting_enabled === false) + scripting_enabled = false; + var frameset_ok = true; + var force_quirks = false; + var pending_table_text; + var text_integration_mode; // XXX a spec bug workaround? + + // A single run of characters, buffered up to be sent to + // the parser as a single string. + var textrun = []; + var textIncludesNUL = false; + var ignore_linefeed = false; + + /*** + * This is the parser object that will be the return value of this + * factory function, which is some 5000 lines below. + * Note that the variable "parser" is the current state of the + * parser's state machine. This variable "htmlparser" is the + * return value and defines the public API of the parser + */ + var htmlparser = { + document: function() { + return doc; + }, + + // Convenience function for internal use. Can only be called once, + // as it removes the nodes from `doc` to add them to fragment. + _asDocumentFragment: function() { + var frag = doc.createDocumentFragment(); + var root = doc.firstChild; + while(root.hasChildNodes()) { + frag.appendChild(root.firstChild); + } + return frag; + }, + + // Internal function used from HTMLScriptElement to pause the + // parser while a script is being loaded from the network + pause: function() { + // print("pausing parser"); + paused++; + }, + + // Called when a script finishes loading + resume: function() { + // print("resuming parser"); + paused--; + // XXX: added this to force a resumption. + // Is this the right thing to do? + this.parse(""); + }, + + // Parse the HTML text s. + // The second argument should be true if there is no more + // text to be parsed, and should be false or omitted otherwise. + // The second argument must not be set for recursive invocations + // from document.write() + parse: function(s, end, shouldPauseFunc) { + var moreToDo; + + // If we're paused, remember the text to parse, but + // don't parse it now. + // (Don't invoke shouldPauseFunc because we haven't handled 'end' yet.) + if (paused > 0) { + leftovers += s; + return true; // more to do + } + + + if (reentrant_invocations === 0) { + // A normal, top-level invocation + if (leftovers) { + s = leftovers + s; + leftovers = ""; + } + + // Add a special marker character to the end of + // the buffer. If the scanner is at the end of + // the buffer and input_complete is set, then this + // character will transform into an EOF token. + // Having an actual character that represents EOF + // in the character buffer makes lookahead regexp + // matching work more easily, and this is + // important for character references. + if (end) { + s += "\uFFFF"; + input_complete = true; // Makes scanChars() send EOF + } + + chars = s; + numchars = s.length; + nextchar = 0; + + if (first_batch) { + // We skip a leading Byte Order Mark (\uFEFF) + // on first batch of text we're given + first_batch = false; + if (chars.charCodeAt(0) === 0xFEFF) nextchar = 1; + } + + reentrant_invocations++; + moreToDo = scanChars(shouldPauseFunc); + leftovers = chars.substring(nextchar, numchars); + reentrant_invocations--; + } + else { + // This is the re-entrant case, which we have to + // handle a little differently. + reentrant_invocations++; + + // Save current scanner state + saved_scanner_state.push(chars, numchars, nextchar); + + // Set new scanner state + chars = s; + numchars = s.length; + nextchar = 0; + + // Now scan as many of these new chars as we can + scanChars(); + moreToDo = false; + + leftovers = chars.substring(nextchar, numchars); + + // restore old scanner state + nextchar = saved_scanner_state.pop(); + numchars = saved_scanner_state.pop(); + chars = saved_scanner_state.pop(); + + // If there were leftover chars from this invocation + // insert them into the pending invocation's buffer + // and trim already processed chars at the same time + if (leftovers) { + chars = leftovers + chars.substring(nextchar); + numchars = chars.length; + nextchar = 0; + leftovers = ""; + } + + // Decrement the counter + reentrant_invocations--; + } + return moreToDo; + } + }; + + + // This is the document we'll be building up + var doc = new Document(true, address); + + // The document needs to know about the parser, for document.write(). + // This _parser property will be deleted when we're done parsing. + doc._parser = htmlparser; + + // XXX I think that any document we use this parser on should support + // scripts. But I may need to configure that through a parser parameter + // Only documents with windows ("browsing contexts" to be precise) + // allow scripting. + doc._scripting_enabled = scripting_enabled; + + + /*** + * The actual code of the HTMLParser() factory function begins here. + */ + + if (fragmentContext) { // for innerHTML parsing + if (fragmentContext.ownerDocument._quirks) + doc._quirks = true; + if (fragmentContext.ownerDocument._limitedQuirks) + doc._limitedQuirks = true; + + // Set the initial tokenizer state + if (fragmentContext.namespaceURI === NAMESPACE.HTML) { + switch(fragmentContext.localName) { + case "title": + case "textarea": + tokenizer = rcdata_state; + break; + case "style": + case "xmp": + case "iframe": + case "noembed": + case "noframes": + case "script": + case "plaintext": + tokenizer = plaintext_state; + break; + } + } + + var root = doc.createElement("html"); + doc._appendChild(root); + stack.push(root); + if (fragmentContext instanceof impl.HTMLTemplateElement) { + templateInsertionModes.push(in_template_mode); + } + resetInsertionMode(); + + for(var e = fragmentContext; e !== null; e = e.parentElement) { + if (e instanceof impl.HTMLFormElement) { + form_element_pointer = e; + break; + } + } + } + + /*** + * Scanner functions + */ + // Loop through the characters in chars, and pass them one at a time + // to the tokenizer FSM. Return when no more characters can be processed + // (This may leave 1 or more characters in the buffer: like a CR + // waiting to see if the next char is LF, or for states that require + // lookahead...) + function scanChars(shouldPauseFunc) { + var codepoint, s, pattern, eof; + + while(nextchar < numchars) { + + // If we just tokenized a tag, then the paused flag + // may have been set to tell us to stop tokenizing while + // the script is loading + if (paused > 0 || (shouldPauseFunc && shouldPauseFunc())) { + return true; + } + + + switch(typeof tokenizer.lookahead) { + case 'undefined': + codepoint = chars.charCodeAt(nextchar++); + if (scanner_skip_newline) { + scanner_skip_newline = false; + if (codepoint === 0x000A) { + nextchar++; + continue; + } + } + switch(codepoint) { + case 0x000D: + // CR always turns into LF, but if the next character + // is LF, then that second LF is skipped. + if (nextchar < numchars) { + if (chars.charCodeAt(nextchar) === 0x000A) + nextchar++; + } + else { + // We don't know the next char right now, so we + // can't check if it is a LF. So set a flag + scanner_skip_newline = true; + } + + // In either case, emit a LF + tokenizer(0x000A); + + break; + case 0xFFFF: + if (input_complete && nextchar === numchars) { + tokenizer(EOF); // codepoint will be 0xFFFF here + break; + } + /* falls through */ + default: + tokenizer(codepoint); + break; + } + break; + + case 'number': + codepoint = chars.charCodeAt(nextchar); + + // The only tokenizer states that require fixed lookahead + // only consume alphanum characters, so we don't have + // to worry about CR and LF in this case + + // tokenizer wants n chars of lookahead + var n = tokenizer.lookahead; + var needsString = true; + if (n < 0) { + needsString = false; + n = -n; + } + + if (n < numchars - nextchar) { + // If we can look ahead that far + s = needsString ? chars.substring(nextchar, nextchar+n) : null; + eof = false; + } + else { // if we don't have that many characters + if (input_complete) { // If no more are coming + // Just return what we have + s = needsString ? chars.substring(nextchar, numchars) : null; + eof = true; + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + } + else { + // Return now and wait for more chars later + return true; + } + } + tokenizer(codepoint, s, eof); + break; + case 'string': + codepoint = chars.charCodeAt(nextchar); + + // tokenizer wants characters up to a matching string + pattern = tokenizer.lookahead; + var pos = chars.indexOf(pattern, nextchar); + if (pos !== -1) { + s = chars.substring(nextchar, pos + pattern.length); + eof = false; + } + else { // No match + // If more characters coming, wait for them + if (!input_complete) return true; + + // Otherwise, we've got to return what we've got + s = chars.substring(nextchar, numchars); + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + eof = true; + } + + // The tokenizer states that require this kind of + // lookahead have to be careful to handle CR characters + // correctly + tokenizer(codepoint, s, eof); + break; + } + } + return false; // no more characters to scan! + } + + + /*** + * Tokenizer utility functions + */ + function addAttribute(name,value) { + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return; + } + + if (value !== undefined) { + attributes.push([name, value]); + } + else { + attributes.push([name]); + } + } + + // Shortcut for simple attributes + function handleSimpleAttribute() { + SIMPLEATTR.lastIndex = nextchar-1; + var matched = SIMPLEATTR.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) return false; + var value = matched[2]; + var len = value.length; + switch(value[0]) { + case '"': + case "'": + value = value.substring(1, len-1); + nextchar += (matched[0].length-1); + tokenizer = after_attribute_value_quoted_state; + break; + default: + tokenizer = before_attribute_name_state; + nextchar += (matched[0].length-1); + value = value.substring(0, len-1); + break; + } + + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return true; + } + + attributes.push([name, value]); + return true; + } + + function beginTagName() { + is_end_tag = false; + tagnamebuf = ""; + attributes.length = 0; + } + function beginEndTagName() { + is_end_tag = true; + tagnamebuf = ""; + attributes.length = 0; + } + + function beginTempBuf() { tempbuf.length = 0; } + function beginAttrName() { attrnamebuf = ""; } + function beginAttrValue() { attrvaluebuf = ""; } + function beginComment() { commentbuf.length = 0; } + function beginDoctype() { + doctypenamebuf.length = 0; + doctypepublicbuf = null; + doctypesystembuf = null; + } + function beginDoctypePublicId() { doctypepublicbuf = []; } + function beginDoctypeSystemId() { doctypesystembuf = []; } + function forcequirks() { force_quirks = true; } + function cdataAllowed() { + return stack.top && + stack.top.namespaceURI !== "http://www.w3.org/1999/xhtml"; + } + + // Return true if the codepoints in the specified buffer match the + // characters of lasttagname + function appropriateEndTag(buf) { + return lasttagname === buf; + } + + function flushText() { + if (textrun.length > 0) { + var s = buf2str(textrun); + textrun.length = 0; + + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; + } + + insertToken(TEXT, s); + textIncludesNUL = false; + } + ignore_linefeed = false; + } + + // Consume chars matched by the pattern and return them as a string. Starts + // matching at the current position, so users should drop the current char + // otherwise. + function getMatchingChars(pattern) { + pattern.lastIndex = nextchar - 1; + var match = pattern.exec(chars); + if (match && match.index === nextchar - 1) { + match = match[0]; + nextchar += match.length - 1; + /* Careful! Make sure we haven't matched the EOF character! */ + if (input_complete && nextchar === numchars) { + // Oops, backup one. + match = match.slice(0, -1); + nextchar--; + } + return match; + } else { + throw new Error("should never happen"); + } + } + + // emit a string of chars that match a regexp + // Returns false if no chars matched. + function emitCharsWhile(pattern) { + pattern.lastIndex = nextchar-1; + var match = pattern.exec(chars)[0]; + if (!match) return false; + emitCharString(match); + nextchar += match.length - 1; + return true; + } + + // This is used by CDATA sections + function emitCharString(s) { + if (textrun.length > 0) flushText(); + + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; + } + + insertToken(TEXT, s); + } + + function emitTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf); + else { + // Remember the last open tag we emitted + var tagname = tagnamebuf; + tagnamebuf = ""; + lasttagname = tagname; + insertToken(TAG, tagname, attributes); + } + } + + + // A shortcut: look ahead and if this is a open or close tag + // in lowercase with no spaces and no attributes, just emit it now. + function emitSimpleTag() { + if (nextchar === numchars) { return false; /* not even 1 char left */ } + SIMPLETAG.lastIndex = nextchar; + var matched = SIMPLETAG.exec(chars); + if (!matched) throw new Error("should never happen"); + var tagname = matched[2]; + if (!tagname) return false; + var endtag = matched[1]; + if (endtag) { + nextchar += (tagname.length+2); + insertToken(ENDTAG, tagname); + } + else { + nextchar += (tagname.length+1); + lasttagname = tagname; + insertToken(TAG, tagname, NOATTRS); + } + return true; + } + + function emitSelfClosingTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf, null, true); + else { + insertToken(TAG, tagnamebuf, attributes, true); + } + } + + function emitDoctype() { + insertToken(DOCTYPE, + buf2str(doctypenamebuf), + doctypepublicbuf ? buf2str(doctypepublicbuf) : undefined, + doctypesystembuf ? buf2str(doctypesystembuf) : undefined); + } + + function emitEOF() { + flushText(); + parser(EOF); // EOF never goes to insertForeignContent() + doc.modclock = 1; // Start tracking modifications + } + + // Insert a token, either using the current parser insertion mode + // (for HTML stuff) or using the insertForeignToken() method. + var insertToken = htmlparser.insertToken = function insertToken(t, value, arg3, arg4) { + flushText(); + var current = stack.top; + + if (!current || current.namespaceURI === NAMESPACE.HTML) { + // This is the common case + parser(t, value, arg3, arg4); + } + else { + // Otherwise we may need to insert this token as foreign content + if (t !== TAG && t !== TEXT) { + insertForeignToken(t, value, arg3, arg4); + } + else { + // But in some cases we treat it as regular content + if ((isMathmlTextIntegrationPoint(current) && + (t === TEXT || + (t === TAG && + value !== "mglyph" && value !== "malignmark"))) || + (t === TAG && + value === "svg" && + current.namespaceURI === NAMESPACE.MATHML && + current.localName === "annotation-xml") || + isHTMLIntegrationPoint(current)) { + + // XXX: the text_integration_mode stuff is an + // attempted bug workaround of mine + text_integration_mode = true; + parser(t, value, arg3, arg4); + text_integration_mode = false; + } + // Otherwise it is foreign content + else { + insertForeignToken(t, value, arg3, arg4); + } + } + } + }; + + + /*** + * Tree building utility functions + */ + function insertComment(data) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createComment(data); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + parent._appendChild(parent.ownerDocument.createComment(data)); + } + } + + function insertText(s) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createTextNode(s); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + // "If there is a Text node immediately before the adjusted insertion + // location, then append data to that Text node's data." + var lastChild = parent.lastChild; + if (lastChild && lastChild.nodeType === Node.TEXT_NODE) { + lastChild.appendData(s); + } else { + parent._appendChild(parent.ownerDocument.createTextNode(s)); + } + } + } + + function createHTMLElt(doc, name, attrs) { + // Create the element this way, rather than with + // doc.createElement because createElement() does error + // checking on the element name that we need to avoid here. + var elt = html.createElement(doc, name, null); + + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + // Use the _ version to avoid testing the validity + // of the attribute name + elt._setAttribute(attrs[i][0], attrs[i][1]); + } + } + // XXX + // If the element is a resettable form element, + // run its reset algorithm now + // XXX + // handle case where form-element-pointer is not null + return elt; + } + + // The in_table insertion mode turns on this flag, and that makes + // insertHTMLElement use the foster parenting algorithm for elements + // tags inside a table + var foster_parent_mode = false; + + function insertHTMLElement(name, attrs) { + var elt = insertElement(function(doc) { + return createHTMLElt(doc, name, attrs); + }); + + // XXX + // If this is a form element, set its form attribute property here + if (isA(elt, formassociatedSet)) { + elt._form = form_element_pointer; + } + + return elt; + } + + // Insert the element into the open element or foster parent it + function insertElement(eltFunc) { + var elt; + if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) { + elt = fosterParent(eltFunc); + } + else if (stack.top instanceof impl.HTMLTemplateElement) { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + elt = eltFunc(stack.top.content.ownerDocument); + stack.top.content._appendChild(elt); + } else { + elt = eltFunc(stack.top.ownerDocument); + stack.top._appendChild(elt); + } + + stack.push(elt); + return elt; + } + + function insertForeignElement(name, attrs, ns) { + return insertElement(function(doc) { + // We need to prevent createElementNS from trying to parse `name` as a + // `qname`, so use an internal Document#_createElementNS() interface. + var elt = doc._createElementNS(name, ns, null); + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + var attr = attrs[i]; + if (attr.length === 2) + elt._setAttribute(attr[0], attr[1]); + else { + elt._setAttributeNS(attr[2], attr[0], attr[1]); + } + } + } + return elt; + }); + } + + function lastElementOfType(type) { + for(var i = stack.elements.length-1; i >= 0; i--) { + if (stack.elements[i] instanceof type) { + return i; + } + } + return -1; + } + + function fosterParent(eltFunc) { + var parent, before, lastTable = -1, lastTemplate = -1, elt; + + lastTable = lastElementOfType(impl.HTMLTableElement); + lastTemplate = lastElementOfType(impl.HTMLTemplateElement); + + if (lastTemplate >= 0 && (lastTable < 0 || lastTemplate > lastTable)) { + parent = stack.elements[lastTemplate]; + } else if (lastTable >= 0) { + parent = stack.elements[lastTable].parentNode; + if (parent) { + before = stack.elements[lastTable]; + } else { + parent = stack.elements[lastTable - 1]; + } + } + if (!parent) parent = stack.elements[0]; // the `html` element. + + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + // Create element in the appropriate document. + elt = eltFunc(parent.ownerDocument); + + if (elt.nodeType === Node.TEXT_NODE) { + var prev; + if (before) prev = before.previousSibling; + else prev = parent.lastChild; + if (prev && prev.nodeType === Node.TEXT_NODE) { + prev.appendData(elt.data); + return elt; + } + } + if (before) + parent.insertBefore(elt, before); + else + parent._appendChild(elt); + return elt; + } + + + function resetInsertionMode() { + var last = false; + for(var i = stack.elements.length-1; i >= 0; i--) { + var node = stack.elements[i]; + if (i === 0) { + last = true; + if (fragment) { + node = fragmentContext; + } + } + if (node.namespaceURI === NAMESPACE.HTML) { + var tag = node.localName; + switch(tag) { + case "select": + for(var j = i; j > 0; ) { + var ancestor = stack.elements[--j]; + if (ancestor instanceof impl.HTMLTemplateElement) { + break; + } else if (ancestor instanceof impl.HTMLTableElement) { + parser = in_select_in_table_mode; + return; + } + } + parser = in_select_mode; + return; + case "tr": + parser = in_row_mode; + return; + case "tbody": + case "tfoot": + case "thead": + parser = in_table_body_mode; + return; + case "caption": + parser = in_caption_mode; + return; + case "colgroup": + parser = in_column_group_mode; + return; + case "table": + parser = in_table_mode; + return; + case "template": + parser = templateInsertionModes[templateInsertionModes.length-1]; + return; + case "body": + parser = in_body_mode; + return; + case "frameset": + parser = in_frameset_mode; + return; + case "html": + if (head_element_pointer === null) { + parser = before_head_mode; + } else { + parser = after_head_mode; + } + return; + default: + if (!last) { + if (tag === "head") { + parser = in_head_mode; + return; + } + if (tag === "td" || tag === "th") { + parser = in_cell_mode; + return; + } + } + } + } + if (last) { + parser = in_body_mode; + return; + } + } + } + + + function parseRawText(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rawtext_state; + originalInsertionMode = parser; + parser = text_mode; + } + + function parseRCDATA(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + } + + // Make a copy of element i on the list of active formatting + // elements, using its original attributes, not current + // attributes (which may have been modified by a script) + function afeclone(doc, i) { + return { + elt: createHTMLElt(doc, afe.list[i].localName, afe.attrs[i]), + attrs: afe.attrs[i], + }; + } + + + function afereconstruct() { + if (afe.list.length === 0) return; + var entry = afe.list[afe.list.length-1]; + // If the last is a marker , do nothing + if (entry === afe.MARKER) return; + // Or if it is an open element, do nothing + if (stack.elements.lastIndexOf(entry) !== -1) return; + + // Loop backward through the list until we find a marker or an + // open element, and then move forward one from there. + for(var i = afe.list.length-2; i >= 0; i--) { + entry = afe.list[i]; + if (entry === afe.MARKER) break; + if (stack.elements.lastIndexOf(entry) !== -1) break; + } + + // Now loop forward, starting from the element after the current + // one, recreating formatting elements and pushing them back onto + // the list of open elements + for(i = i+1; i < afe.list.length; i++) { + var newelt = insertElement(function(doc) { return afeclone(doc, i).elt; }); + afe.list[i] = newelt; + } + } + + // Used by the adoptionAgency() function + var BOOKMARK = {localName:"BM"}; + + function adoptionAgency(tag) { + // If the current node is an HTML element whose tag name is subject, + // and the current node is not in the list of active formatting + // elements, then pop the current node off the stack of open + // elements and abort these steps. + if (isA(stack.top, tag) && afe.indexOf(stack.top) === -1) { + stack.pop(); + return true; // no more handling required + } + + // Let outer loop counter be zero. + var outer = 0; + + // Outer loop: If outer loop counter is greater than or + // equal to eight, then abort these steps. + while(outer < 8) { + // Increment outer loop counter by one. + outer++; + + // Let the formatting element be the last element in the list + // of active formatting elements that: is between the end of + // the list and the last scope marker in the list, if any, or + // the start of the list otherwise, and has the same tag name + // as the token. + var fmtelt = afe.findElementByTag(tag); + + // If there is no such node, then abort these steps and instead + // act as described in the "any other end tag" entry below. + if (!fmtelt) { + return false; // false means handle by the default case + } + + // Otherwise, if there is such a node, but that node is not in + // the stack of open elements, then this is a parse error; + // remove the element from the list, and abort these steps. + var index = stack.elements.lastIndexOf(fmtelt); + if (index === -1) { + afe.remove(fmtelt); + return true; // true means no more handling required + } + + // Otherwise, if there is such a node, and that node is also in + // the stack of open elements, but the element is not in scope, + // then this is a parse error; ignore the token, and abort + // these steps. + if (!stack.elementInScope(fmtelt)) { + return true; + } + + // Let the furthest block be the topmost node in the stack of + // open elements that is lower in the stack than the formatting + // element, and is an element in the special category. There + // might not be one. + var furthestblock = null, furthestblockindex; + for(var i = index+1; i < stack.elements.length; i++) { + if (isA(stack.elements[i], specialSet)) { + furthestblock = stack.elements[i]; + furthestblockindex = i; + break; + } + } + + // If there is no furthest block, then the UA must skip the + // subsequent steps and instead just pop all the nodes from the + // bottom of the stack of open elements, from the current node + // up to and including the formatting element, and remove the + // formatting element from the list of active formatting + // elements. + if (!furthestblock) { + stack.popElement(fmtelt); + afe.remove(fmtelt); + return true; + } + else { + // Let the common ancestor be the element immediately above + // the formatting element in the stack of open elements. + var ancestor = stack.elements[index-1]; + + // Let a bookmark note the position of the formatting + // element in the list of active formatting elements + // relative to the elements on either side of it in the + // list. + afe.insertAfter(fmtelt, BOOKMARK); + + // Let node and last node be the furthest block. + var node = furthestblock; + var lastnode = furthestblock; + var nodeindex = furthestblockindex; + var nodeafeindex; + + // Let inner loop counter be zero. + var inner = 0; + + while (true) { + + // Increment inner loop counter by one. + inner++; + + // Let node be the element immediately above node in + // the stack of open elements, or if node is no longer + // in the stack of open elements (e.g. because it got + // removed by this algorithm), the element that was + // immediately above node in the stack of open elements + // before node was removed. + node = stack.elements[--nodeindex]; + + // If node is the formatting element, then go + // to the next step in the overall algorithm. + if (node === fmtelt) break; + + // If the inner loop counter is greater than three and node + // is in the list of active formatting elements, then remove + // node from the list of active formatting elements. + nodeafeindex = afe.indexOf(node); + if (inner > 3 && nodeafeindex !== -1) { + afe.remove(node); + nodeafeindex = -1; + } + + // If node is not in the list of active formatting + // elements, then remove node from the stack of open + // elements and then go back to the step labeled inner + // loop. + if (nodeafeindex === -1) { + stack.removeElement(node); + continue; + } + + // Create an element for the token for which the + // element node was created with common ancestor as + // the intended parent, replace the entry for node + // in the list of active formatting elements with an + // entry for the new element, replace the entry for + // node in the stack of open elements with an entry for + // the new element, and let node be the new element. + var newelt = afeclone(ancestor.ownerDocument, nodeafeindex); + afe.replace(node, newelt.elt, newelt.attrs); + stack.elements[nodeindex] = newelt.elt; + node = newelt.elt; + + // If last node is the furthest block, then move the + // aforementioned bookmark to be immediately after the + // new node in the list of active formatting elements. + if (lastnode === furthestblock) { + afe.remove(BOOKMARK); + afe.insertAfter(newelt.elt, BOOKMARK); + } + + // Insert last node into node, first removing it from + // its previous parent node if any. + node._appendChild(lastnode); + + // Let last node be node. + lastnode = node; + } + + // If the common ancestor node is a table, tbody, tfoot, + // thead, or tr element, then, foster parent whatever last + // node ended up being in the previous step, first removing + // it from its previous parent node if any. + if (foster_parent_mode && isA(ancestor, tablesectionrowSet)) { + fosterParent(function() { return lastnode; }); + } + // Otherwise, append whatever last node ended up being in + // the previous step to the common ancestor node, first + // removing it from its previous parent node if any. + else if (ancestor instanceof impl.HTMLTemplateElement) { + ancestor.content._appendChild(lastnode); + } else { + ancestor._appendChild(lastnode); + } + + // Create an element for the token for which the + // formatting element was created, with furthest block + // as the intended parent. + var newelt2 = afeclone(furthestblock.ownerDocument, afe.indexOf(fmtelt)); + + // Take all of the child nodes of the furthest block and + // append them to the element created in the last step. + while(furthestblock.hasChildNodes()) { + newelt2.elt._appendChild(furthestblock.firstChild); + } + + // Append that new element to the furthest block. + furthestblock._appendChild(newelt2.elt); + + // Remove the formatting element from the list of active + // formatting elements, and insert the new element into the + // list of active formatting elements at the position of + // the aforementioned bookmark. + afe.remove(fmtelt); + afe.replace(BOOKMARK, newelt2.elt, newelt2.attrs); + + // Remove the formatting element from the stack of open + // elements, and insert the new element into the stack of + // open elements immediately below the position of the + // furthest block in that stack. + stack.removeElement(fmtelt); + var pos = stack.elements.lastIndexOf(furthestblock); + stack.elements.splice(pos+1, 0, newelt2.elt); + } + } + + return true; + } + + // We do this when we get /script in in_text_mode + function handleScriptEnd() { + // XXX: + // This is just a stub implementation right now and doesn't run scripts. + // Getting this method right involves the event loop, URL resolution + // script fetching etc. For now I just want to be able to parse + // documents and test the parser. + + //var script = stack.top; + stack.pop(); + parser = originalInsertionMode; + //script._prepare(); + return; + + // XXX: here is what this method is supposed to do + + // Provide a stable state. + + // Let script be the current node (which will be a script + // element). + + // Pop the current node off the stack of open elements. + + // Switch the insertion mode to the original insertion mode. + + // Let the old insertion point have the same value as the current + // insertion point. Let the insertion point be just before the + // next input character. + + // Increment the parser's script nesting level by one. + + // Prepare the script. This might cause some script to execute, + // which might cause new characters to be inserted into the + // tokenizer, and might cause the tokenizer to output more tokens, + // resulting in a reentrant invocation of the parser. + + // Decrement the parser's script nesting level by one. If the + // parser's script nesting level is zero, then set the parser + // pause flag to false. + + // Let the insertion point have the value of the old insertion + // point. (In other words, restore the insertion point to its + // previous value. This value might be the "undefined" value.) + + // At this stage, if there is a pending parsing-blocking script, + // then: + + // If the script nesting level is not zero: + + // Set the parser pause flag to true, and abort the processing + // of any nested invocations of the tokenizer, yielding + // control back to the caller. (Tokenization will resume when + // the caller returns to the "outer" tree construction stage.) + + // The tree construction stage of this particular parser is + // being called reentrantly, say from a call to + // document.write(). + + // Otherwise: + + // Run these steps: + + // Let the script be the pending parsing-blocking + // script. There is no longer a pending + // parsing-blocking script. + + // Block the tokenizer for this instance of the HTML + // parser, such that the event loop will not run tasks + // that invoke the tokenizer. + + // If the parser's Document has a style sheet that is + // blocking scripts or the script's "ready to be + // parser-executed" flag is not set: spin the event + // loop until the parser's Document has no style sheet + // that is blocking scripts and the script's "ready to + // be parser-executed" flag is set. + + // Unblock the tokenizer for this instance of the HTML + // parser, such that tasks that invoke the tokenizer + // can again be run. + + // Let the insertion point be just before the next + // input character. + + // Increment the parser's script nesting level by one + // (it should be zero before this step, so this sets + // it to one). + + // Execute the script. + + // Decrement the parser's script nesting level by + // one. If the parser's script nesting level is zero + // (which it always should be at this point), then set + // the parser pause flag to false. + + // Let the insertion point be undefined again. + + // If there is once again a pending parsing-blocking + // script, then repeat these steps from step 1. + + + } + + function stopParsing() { + // XXX This is just a temporary implementation to get the parser working. + // A full implementation involves scripts and events and the event loop. + + // Remove the link from document to parser. + // This is instead of "set the insertion point to undefined". + // It means that document.write() can't write into the doc anymore. + delete doc._parser; + + stack.elements.length = 0; // pop everything off + + // If there is a window object associated with the document + // then trigger an load event on it + if (doc.defaultView) { + doc.defaultView.dispatchEvent(new impl.Event("load",{})); + } + + } + + /**** + * Tokenizer states + */ + + /** + * This file was partially mechanically generated from + * http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html + * + * After mechanical conversion, it was further converted from + * prose to JS by hand, but the intent is that it is a very + * faithful rendering of the HTML tokenization spec in + * JavaScript. + * + * It is not a goal of this tokenizer to detect or report + * parse errors. + * + * XXX The tokenizer is supposed to work with straight UTF32 + * codepoints. But I don't think it has any dependencies on + * any character outside of the BMP so I think it is safe to + * pass it UTF16 characters. I don't think it will ever change + * state in the middle of a surrogate pair. + */ + + /* + * Each state is represented by a function. For most states, the + * scanner simply passes the next character (as an integer + * codepoint) to the current state function and automatically + * consumes the character. If the state function can't process + * the character it can call pushback() to push it back to the + * scanner. + * + * Some states require lookahead, though. If a state function has + * a lookahead property, then it is invoked differently. In this + * case, the scanner invokes the function with 3 arguments: 1) the + * next codepoint 2) a string of lookahead text 3) a boolean that + * is true if the lookahead goes all the way to the EOF. (XXX + * actually maybe this third is not necessary... the lookahead + * could just include \uFFFF?) + * + * If the lookahead property of a state function is an integer, it + * specifies the number of characters required. If it is a string, + * then the scanner will scan for that string and return all + * characters up to and including that sequence, or up to EOF. If + * the lookahead property is a regexp, then the scanner will match + * the regexp at the current point and return the matching string. + * + * States that require lookahead are responsible for explicitly + * consuming the characters they process. They do this by + * incrementing nextchar by the number of processed characters. + */ + function reconsume(c, new_state) { + tokenizer = new_state; + nextchar--; // pushback + } + + function data_state(c) { + switch(c) { + case 0x0026: // AMPERSAND + return_state = data_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + if (emitSimpleTag()) // Shortcut for

,

, etc. + break; + tokenizer = tag_open_state; + break; + case 0x0000: // NULL + // Usually null characters emitted by the tokenizer will be + // ignored by the tree builder, but sometimes they'll be + // converted to \uFFFD. I don't want to have the search every + // string emitted to replace NULs, so I'll set a flag + // if I've emitted a NUL. + textrun.push(c); + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(DATATEXT) || textrun.push(c); + break; + } + } + + function rcdata_state(c) { + // Save the open tag so we can find a matching close tag + switch(c) { + case 0x0026: // AMPERSAND + return_state = rcdata_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = rcdata_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function rawtext_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = rawtext_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function script_data_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function plaintext_state(c) { + switch(c) { + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(PLAINTEXT) || textrun.push(c); + break; + } + } + + function tag_open_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + tokenizer = markup_declaration_open_state; + break; + case 0x002F: // SOLIDUS + tokenizer = end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTagName(); + reconsume(c, tag_name_state); + break; + case 0x003F: // QUESTION MARK + reconsume(c, bogus_comment_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, data_state); + break; + } + } + + function end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, tag_name_state); + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + break; + case -1: // EOF + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + emitEOF(); + break; + default: + reconsume(c, bogus_comment_state); + break; + } + } + + function tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + tagnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + default: + tagnamebuf += getMatchingChars(TAGNAME); + break; + } + } + + function rcdata_less_than_sign_state(c) { + /* identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rcdata_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rcdata_state); + } + } + + function rcdata_end_tag_open_state(c) { + /* identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rcdata_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rcdata_state); + break; + } + } + + function rcdata_end_tag_name_state(c) { + /* identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun, tempbuf); + reconsume(c, rcdata_state); + } + + function rawtext_less_than_sign_state(c) { + /* identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g + */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rawtext_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rawtext_state); + } + } + + function rawtext_end_tag_open_state(c) { + /* identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rawtext_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rawtext_state); + break; + } + } + + function rawtext_end_tag_name_state(c) { + /* identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, rawtext_state); + } + + function script_data_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_end_tag_open_state; + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = script_data_escape_start_state; + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x0021); // EXCLAMATION MARK + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_open_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_name_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_state); + } + + function script_data_escape_start_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escape_start_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + } + else { + reconsume(c, script_data_state); + } + } + + function script_data_escape_start_dash_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + } + else { + reconsume(c, script_data_state); + } + } + + function script_data_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_escaped_end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTempBuf(); + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_double_escape_start_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_escaped_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // We get here in the default case, and if the closing tagname + // is not an appropriate tagname. + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_escaped_state); + } + + function script_data_double_escape_start_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_double_escaped_state; + } + else { + tokenizer = script_data_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_double_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_less_than_sign_state(c) { + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = script_data_double_escape_end_state; + textrun.push(0x002F); // SOLIDUS + } + else { + reconsume(c, script_data_double_escaped_state); + } + } + + function script_data_double_escape_end_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_escaped_state; + } + else { + tokenizer = script_data_double_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_double_escaped_state); + break; + } + } + + function before_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + // For SOLIDUS, GREATER-THAN SIGN, and EOF, spec says "reconsume in + // the after attribute name state", but in our implementation that + // state always has an active attribute in attrnamebuf. Just clone + // the rules here, without the addAttribute business. + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + case 0x003D: // EQUALS SIGN + beginAttrName(); + attrnamebuf += String.fromCharCode(c); + tokenizer = attribute_name_state; + break; + default: + if (handleSimpleAttribute()) break; + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + // beginAttrName() must have been called before this point + // There is an active attribute in attrnamebuf (but not attrvaluebuf) + function attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, after_attribute_name_state); + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + attrnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + attrnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + /* falls through */ + default: + attrnamebuf += getMatchingChars(ATTRNAME); + break; + } + } + + // There is an active attribute in attrnamebuf, but not yet in attrvaluebuf. + function after_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x002F: // SOLIDUS + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + tokenizer = self_closing_start_tag_state; + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x003E: // GREATER-THAN SIGN + // Keep in sync with before_attribute_name_state. + tokenizer = data_state; + addAttribute(attrnamebuf); + emitTag(); + break; + case -1: // EOF + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + emitEOF(); + break; + default: + addAttribute(attrnamebuf); + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + function before_attribute_value_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginAttrValue(); + tokenizer = attribute_value_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginAttrValue(); + tokenizer = attribute_value_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + /* falls through */ + default: + beginAttrValue(); + reconsume(c, attribute_value_unquoted_state); + break; + } + } + + function attribute_value_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_double_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(DBLQUOTEATTRVAL); + break; + } + } + + function attribute_value_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_single_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(SINGLEQUOTEATTRVAL); + break; + } + } + + function attribute_value_unquoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = before_attribute_name_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_unquoted_state; + tokenizer = character_reference_state; + break; + case 0x003E: // GREATER-THAN SIGN + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = data_state; + emitTag(); + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + nextchar--; // pushback + tokenizer = data_state; + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + case 0x003D: // EQUALS SIGN + case 0x0060: // GRAVE ACCENT + /* falls through */ + default: + attrvaluebuf += getMatchingChars(UNQUOTEDATTRVAL); + break; + } + } + + function after_attribute_value_quoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function self_closing_start_tag_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + // Set the self-closing flag of the current tag token. + tokenizer = data_state; + emitSelfClosingTag(true); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function bogus_comment_state(c, lookahead, eof) { + var len = lookahead.length; + + if (eof) { + nextchar += len-1; // don't consume the eof + } + else { + nextchar += len; + } + + var comment = lookahead.substring(0, len-1); + + comment = comment.replace(/\u0000/g,"\uFFFD"); + comment = comment.replace(/\u000D\u000A/g,"\u000A"); + comment = comment.replace(/\u000D/g,"\u000A"); + + insertToken(COMMENT, comment); + tokenizer = data_state; + } + bogus_comment_state.lookahead = ">"; + + function markup_declaration_open_state(c, lookahead, eof) { + if (lookahead[0] === "-" && lookahead[1] === "-") { + nextchar += 2; + beginComment(); + tokenizer = comment_start_state; + return; + } + + if (lookahead.toUpperCase() === "DOCTYPE") { + nextchar += 7; + tokenizer = doctype_state; + } + else if (lookahead === "[CDATA[" && cdataAllowed()) { + nextchar += 7; + tokenizer = cdata_section_state; + } + else { + tokenizer = bogus_comment_state; + } + } + markup_declaration_open_state.lookahead = 7; + + function comment_start_state(c) { + beginComment(); + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_start_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; /* see comment in comment end state */ + default: + reconsume(c, comment_state); + break; + } + } + + function comment_start_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + tokenizer = comment_less_than_sign_state; + break; + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_dash_state; + break; + case 0x0000: // NULL + commentbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(c); + break; + } + } + + function comment_less_than_sign_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + commentbuf.push(c); + tokenizer = comment_less_than_sign_bang_state; + break; + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_state; + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_dash_state; + break; + default: + reconsume(c, comment_end_dash_state); + break; + } + } + + function comment_less_than_sign_bang_dash_dash_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, comment_end_state); + break; + default: + // parse error + reconsume(c, comment_end_state); + break; + } + } + + function comment_end_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_end_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = comment_end_bang_state; + break; + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* For security reasons: otherwise, hostile user could put a script in a comment e.g. in a blog comment and then DOS the server so that the end tag isn't read, and then the commented script tag would be treated as live code */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + reconsume(c, comment_state); + break; + } + } + + function comment_end_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + tokenizer = comment_end_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + reconsume(c, comment_state); + break; + } + } + + function doctype_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_name_state; + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + reconsume(c, before_doctype_name_state); + break; + } + } + + function before_doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + beginDoctype(); + doctypenamebuf.push(c + 0x0020); + tokenizer = doctype_name_state; + break; + case 0x0000: // NULL + beginDoctype(); + doctypenamebuf.push(0xFFFD); + tokenizer = doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + beginDoctype(); + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + beginDoctype(); + doctypenamebuf.push(c); + tokenizer = doctype_name_state; + break; + } + } + + function doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = after_doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + doctypenamebuf.push(c + 0x0020); + break; + case 0x0000: // NULL + doctypenamebuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypenamebuf.push(c); + break; + } + } + + function after_doctype_name_state(c, lookahead, eof) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + nextchar += 1; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + nextchar += 1; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + lookahead = lookahead.toUpperCase(); + if (lookahead === "PUBLIC") { + nextchar += 6; + tokenizer = after_doctype_public_keyword_state; + } + else if (lookahead === "SYSTEM") { + nextchar += 6; + tokenizer = after_doctype_system_keyword_state; + } + else { + forcequirks(); + tokenizer = bogus_doctype_state; + } + break; + } + } + after_doctype_name_state.lookahead = 6; + + function after_doctype_public_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_public_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_public_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function doctype_public_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function after_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = between_doctype_public_and_system_identifiers_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function between_doctype_public_and_system_identifiers_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function after_doctype_system_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_system_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_system_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function doctype_system_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function after_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + tokenizer = bogus_doctype_state; + /* This does *not* set the DOCTYPE token's force-quirks flag. */ + break; + } + } + + function bogus_doctype_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + emitDoctype(); + emitEOF(); + break; + default: + /* Ignore the character. */ + break; + } + } + + function cdata_section_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_bracket_state; + break; + case -1: // EOF + emitEOF(); + break; + case 0x0000: // NULL + textIncludesNUL = true; + /* fall through */ + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(CDATATEXT) || textrun.push(c); + break; + } + } + + function cdata_section_bracket_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_end_state; + break; + default: + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function cdata_section_end_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + textrun.push(0x005D); + break; + case 0x003E: // GREATER-THAN SIGN + flushText(); + tokenizer = data_state; + break; + default: + textrun.push(0x005D); + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function character_reference_state(c) { + beginTempBuf(); + tempbuf.push(0x0026); + switch(c) { + case 0x0009: // TAB + case 0x000A: // LINE FEED + case 0x000C: // FORM FEED + case 0x0020: // SPACE + case 0x003C: // LESS-THAN SIGN + case 0x0026: // AMPERSAND + case -1: // EOF + reconsume(c, character_reference_end_state); + break; + case 0x0023: // NUMBER SIGN + tempbuf.push(c); + tokenizer = numeric_character_reference_state; + break; + default: + reconsume(c, named_character_reference_state); + break; + } + } + + function named_character_reference_state(c) { + NAMEDCHARREF.lastIndex = nextchar; // w/ lookahead no char has been consumed + var matched = NAMEDCHARREF.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) { + // If no match can be made, switch to the character reference end state + tokenizer = character_reference_end_state; + return; + } + + // Consume the matched characters and append them to temporary buffer + nextchar += name.length; + pushAll(tempbuf, str2buf(name)); + + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // If the character reference was consumed as part of an attribute... + if (name[name.length-1] !== ';') { // ...and the last char is not ; + if (/[=A-Za-z0-9]/.test(chars[nextchar])) { + tokenizer = character_reference_end_state; + return; + } + } + break; + default: + break; + } + + beginTempBuf(); + var rv = namedCharRefs[name]; + if (typeof rv === 'number') { + tempbuf.push(rv); + } else { + pushAll(tempbuf, rv); + } + tokenizer = character_reference_end_state; + } + // We might need to pause tokenization until we have enough characters + // in the buffer for longest possible character reference. + named_character_reference_state.lookahead = -NAMEDCHARREF_MAXLEN; + + function numeric_character_reference_state(c) { + character_reference_code = 0; + switch(c) { + case 0x0078: // x + case 0x0058: // X + tempbuf.push(c); + tokenizer = hexadecimal_character_reference_start_state; + break; + default: + reconsume(c, decimal_character_reference_start_state); + break; + } + } + + function hexadecimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + reconsume(c, hexadecimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function decimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + reconsume(c, decimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function hexadecimal_character_reference_state(c) { + switch(c) { + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + character_reference_code *= 16; + character_reference_code += (c - 0x0037); + break; + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + character_reference_code *= 16; + character_reference_code += (c - 0x0057); + break; + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 16; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function decimal_character_reference_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 10; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function numeric_character_reference_end_state(c) { + if (character_reference_code in numericCharRefReplacements) { + character_reference_code = numericCharRefReplacements[character_reference_code]; + } else if (character_reference_code > 0x10FFFF || (character_reference_code >= 0xD800 && character_reference_code < 0xE000)) { + character_reference_code = 0xFFFD; + } + + beginTempBuf(); + if (character_reference_code <= 0xFFFF) { + tempbuf.push(character_reference_code); + } else { + character_reference_code = character_reference_code - 0x10000; + /* jshint bitwise: false */ + tempbuf.push(0xD800 + (character_reference_code >> 10)); + tempbuf.push(0xDC00 + (character_reference_code & 0x03FF)); + } + reconsume(c, character_reference_end_state); + } + + function character_reference_end_state(c) { + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // append each character to the current attribute's value + attrvaluebuf += buf2str(tempbuf); + break; + default: + pushAll(textrun, tempbuf); + break; + } + reconsume(c, return_state); + } + + /*** + * The tree builder insertion modes + */ + + // 11.2.5.4.1 The "initial" insertion mode + function initial_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + var name = value; + var publicid = arg3; + var systemid = arg4; + // Use the constructor directly instead of + // implementation.createDocumentType because the create + // function throws errors on invalid characters, and + // we don't want the parser to throw them. + doc.appendChild(new DocumentType(doc, name, publicid, systemid)); + + // Note that there is no public API for setting quirks mode We can + // do this here because we have access to implementation details + if (force_quirks || + name.toLowerCase() !== "html" || + quirkyPublicIds.test(publicid) || + (systemid && systemid.toLowerCase() === quirkySystemId) || + (systemid === undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._quirks = true; + else if (limitedQuirkyPublicIds.test(publicid) || + (systemid !== undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._limitedQuirks = true; + parser = before_html_mode; + return; + } + + // tags or non-whitespace text + doc._quirks = true; + parser = before_html_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.2 The "before html" insertion mode + function before_html_mode(t,value,arg3,arg4) { + var elt; + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 2: // TAG + if (value === "html") { + elt = createHTMLElt(doc, value, arg3); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; // fall through on these + default: + return; // ignore most end tags + } + } + + // Anything that didn't get handled above is handled like this: + elt = createHTMLElt(doc, "html", null); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.3 The "before head" insertion mode + function before_head_mode(t,value,arg3,arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + insertComment(value); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t,value,arg3,arg4); + return; + case "head": + var elt = insertHTMLElement(value, arg3); + head_element_pointer = elt; + parser = in_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; + default: + return; // ignore most end tags + } + } + + // If not handled explicitly above + before_head_mode(TAG, "head", null); // create a head tag + parser(t, value, arg3, arg4); // then try again with this token + } + + function in_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "meta": + // XXX: + // May need to change the encoding based on this tag + /* falls through */ + case "base": + case "basefont": + case "bgsound": + case "link": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "title": + parseRCDATA(value, arg3); + return; + case "noscript": + if (!scripting_enabled) { + insertHTMLElement(value, arg3); + parser = in_head_noscript_mode; + return; + } + // Otherwise, if scripting is enabled... + /* falls through */ + case "noframes": + case "style": + parseRawText(value,arg3); + return; + case "script": + insertElement(function(doc) { + var elt = createHTMLElt(doc, value, arg3); + elt._parser_inserted = true; + elt._force_async = false; + if (fragment) elt._already_started = true; + flushText(); + return elt; + }); + tokenizer = script_data_state; + originalInsertionMode = parser; + parser = text_mode; + return; + case "template": + insertHTMLElement(value, arg3); + afe.insertMarker(); + frameset_ok = false; + parser = in_template_mode; + templateInsertionModes.push(parser); + return; + case "head": + return; // ignore it + } + break; + case 3: // ENDTAG + switch(value) { + case "head": + stack.pop(); + parser = after_head_mode; + return; + case "body": + case "html": + case "br": + break; // handle these at the bottom of the function + case "template": + if (!stack.contains("template")) { + return; + } + stack.generateImpliedEndTags(null, "thorough"); + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + return; + default: + // ignore any other end tag + return; + } + break; + } + + // If not handled above + in_head_mode(ENDTAG, "head", null); // synthetic + parser(t, value, arg3, arg4); // Then redo this one + } + + // 13.2.5.4.5 The "in head noscript" insertion mode + function in_head_noscript_mode(t, value, arg3, arg4) { + switch(t) { + case 5: // DOCTYPE + return; + case 4: // COMMENT + in_head_mode(t, value); + return; + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + in_head_mode(t, ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; // no more text + break; // Handle non-whitespace below + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "style": + in_head_mode(t, value, arg3); + return; + case "head": + case "noscript": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "noscript": + stack.pop(); + parser = in_head_mode; + return; + case "br": + break; // goes to the outer default + default: + return; // ignore other end tags + } + break; + } + + // If not handled above + in_head_noscript_mode(ENDTAG, "noscript", null); + parser(t, value, arg3, arg4); + } + + function after_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "body": + insertHTMLElement(value, arg3); + frameset_ok = false; + parser = in_body_mode; + return; + case "frameset": + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + stack.push(head_element_pointer); + in_head_mode(TAG, value, arg3); + stack.removeElement(head_element_pointer); + return; + case "head": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "template": + return in_head_mode(t, value, arg3, arg4); + case "body": + case "html": + case "br": + break; + default: + return; // ignore any other end tag + } + break; + } + + after_head_mode(TAG, "body", null); + frameset_ok = true; + parser(t, value, arg3, arg4); + } + + // 13.2.5.4.7 The "in body" insertion mode + function in_body_mode(t,value,arg3,arg4) { + var body, i, node, elt; + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + // If any non-space characters + if (frameset_ok && NONWS.test(value)) + frameset_ok = false; + afereconstruct(); + insertText(value); + return; + case 5: // DOCTYPE + return; + case 4: // COMMENT + insertComment(value); + return; + case -1: // EOF + if (templateInsertionModes.length) { + return in_template_mode(t); + } + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + if (stack.contains("template")) { + return; + } + transferAttributes(arg3, stack.elements[0]); + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(TAG, value, arg3); + return; + case "body": + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement) || + stack.contains("template")) + return; + frameset_ok = false; + transferAttributes(arg3, body); + return; + case "frameset": + if (!frameset_ok) return; + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement)) + return; + if (body.parentNode) body.parentNode.removeChild(body); + while(!(stack.top instanceof impl.HTMLHtmlElement)) + stack.pop(); + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; + + case "address": + case "article": + case "aside": + case "blockquote": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "main": + case "nav": + case "ol": + case "p": + case "section": + case "summary": + case "ul": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "menu": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + insertHTMLElement(value, arg3); + return; + + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (stack.top instanceof impl.HTMLHeadingElement) + stack.pop(); + insertHTMLElement(value, arg3); + return; + + case "pre": + case "listing": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + ignore_linefeed = true; + frameset_ok = false; + return; + + case "form": + if (form_element_pointer && !stack.contains("template")) return; + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + elt = insertHTMLElement(value, arg3); + if (!stack.contains("template")) + form_element_pointer = elt; + return; + + case "li": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (node instanceof impl.HTMLLIElement) { + in_body_mode(ENDTAG, "li"); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "dd": + case "dt": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, dddtSet)) { + in_body_mode(ENDTAG, node.localName); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "plaintext": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + tokenizer = plaintext_state; + return; + + case "button": + if (stack.inScope("button")) { + in_body_mode(ENDTAG, "button"); + parser(t, value, arg3, arg4); + } + else { + afereconstruct(); + insertHTMLElement(value, arg3); + frameset_ok = false; + } + return; + + case "a": + var activeElement = afe.findElementByTag("a"); + if (activeElement) { + in_body_mode(ENDTAG, value); + afe.remove(activeElement); + stack.removeElement(activeElement); + } + /* falls through */ + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + afereconstruct(); + afe.push(insertHTMLElement(value,arg3), arg3); + return; + + case "nobr": + afereconstruct(); + + if (stack.inScope(value)) { + in_body_mode(ENDTAG, value); + afereconstruct(); + } + afe.push(insertHTMLElement(value,arg3), arg3); + return; + + case "applet": + case "marquee": + case "object": + afereconstruct(); + insertHTMLElement(value,arg3); + afe.insertMarker(); + frameset_ok = false; + return; + + case "table": + if (!doc._quirks && stack.inButtonScope("p")) { + in_body_mode(ENDTAG, "p"); + } + insertHTMLElement(value,arg3); + frameset_ok = false; + parser = in_table_mode; + return; + + case "area": + case "br": + case "embed": + case "img": + case "keygen": + case "wbr": + afereconstruct(); + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; + + case "input": + afereconstruct(); + elt = insertHTMLElement(value,arg3); + stack.pop(); + var type = elt.getAttribute("type"); + if (!type || type.toLowerCase() !== "hidden") + frameset_ok = false; + return; + + case "param": + case "source": + case "track": + insertHTMLElement(value,arg3); + stack.pop(); + return; + + case "hr": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; + + case "image": + in_body_mode(TAG, "img", arg3, arg4); + return; + + case "textarea": + insertHTMLElement(value,arg3); + ignore_linefeed = true; + frameset_ok = false; + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + return; + + case "xmp": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + afereconstruct(); + frameset_ok = false; + parseRawText(value, arg3); + return; + + case "iframe": + frameset_ok = false; + parseRawText(value, arg3); + return; + + case "noembed": + parseRawText(value,arg3); + return; + + case "select": + afereconstruct(); + insertHTMLElement(value,arg3); + frameset_ok = false; + if (parser === in_table_mode || + parser === in_caption_mode || + parser === in_table_body_mode || + parser === in_row_mode || + parser === in_cell_mode) + parser = in_select_in_table_mode; + else + parser = in_select_mode; + return; + + case "optgroup": + case "option": + if (stack.top instanceof impl.HTMLOptionElement) { + in_body_mode(ENDTAG, "option"); + } + afereconstruct(); + insertHTMLElement(value,arg3); + return; + + case "menuitem": + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + afereconstruct(); + insertHTMLElement(value, arg3); + return; + + case "rb": + case "rtc": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags(); + } + insertHTMLElement(value,arg3); + return; + + case "rp": + case "rt": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags("rtc"); + } + insertHTMLElement(value,arg3); + return; + + case "math": + afereconstruct(); + adjustMathMLAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.MATHML); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "svg": + afereconstruct(); + adjustSVGAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.SVG); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "caption": + case "col": + case "colgroup": + case "frame": + case "head": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + // Ignore table tags if we're not in_table mode + return; + } + + // Handle any other start tag here + // (and also noscript tags when scripting is disabled) + afereconstruct(); + insertHTMLElement(value,arg3); + return; + + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(ENDTAG, value, arg3); + return; + case "body": + if (!stack.inScope("body")) return; + parser = after_body_mode; + return; + case "html": + if (!stack.inScope("body")) return; + parser = after_body_mode; + parser(t, value, arg3); + return; + + case "address": + case "article": + case "aside": + case "blockquote": + case "button": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "listing": + case "main": + case "menu": + case "nav": + case "ol": + case "pre": + case "section": + case "summary": + case "ul": + // Ignore if there is not a matching open tag + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + return; + + case "form": + if (!stack.contains("template")) { + var openform = form_element_pointer; + form_element_pointer = null; + if (!openform || !stack.elementInScope(openform)) return; + stack.generateImpliedEndTags(); + stack.removeElement(openform); + } else { + if (!stack.inScope("form")) return; + stack.generateImpliedEndTags(); + stack.popTag("form"); + } + return; + + case "p": + if (!stack.inButtonScope(value)) { + in_body_mode(TAG, value, null); + parser(t, value, arg3, arg4); + } + else { + stack.generateImpliedEndTags(value); + stack.popTag(value); + } + return; + + case "li": + if (!stack.inListItemScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; + + case "dd": + case "dt": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; + + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (!stack.elementTypeInScope(impl.HTMLHeadingElement)) return; + stack.generateImpliedEndTags(); + stack.popElementType(impl.HTMLHeadingElement); + return; + + case "sarcasm": + // Take a deep breath, and then: + break; + + case "a": + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "nobr": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + var result = adoptionAgency(value); + if (result) return; // If we did something we're done + break; // Go to the "any other end tag" case + + case "applet": + case "marquee": + case "object": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + return; + + case "br": + in_body_mode(TAG, value, null); // Turn
into
+ return; + } + + // Any other end tag goes here + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, value)) { + stack.generateImpliedEndTags(value); + stack.popElement(node); + break; + } + else if (isA(node, specialSet)) { + return; + } + } + + return; + } + } + + function text_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + insertText(value); + return; + case -1: // EOF + if (stack.top instanceof impl.HTMLScriptElement) + stack.top._already_started = true; + stack.pop(); + parser = originalInsertionMode; + parser(t); + return; + case 3: // ENDTAG + if (value === "script") { + handleScriptEnd(); + } + else { + stack.pop(); + parser = originalInsertionMode; + } + return; + default: + // We should never get any other token types + return; + } + } + + function in_table_mode(t, value, arg3, arg4) { + function getTypeAttr(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + if (attrs[i][0] === "type") + return attrs[i][1].toLowerCase(); + } + return null; + } + + switch(t) { + case 1: // TEXT + // XXX the text_integration_mode stuff is + // just a hack I made up + if (text_integration_mode) { + in_body_mode(t, value, arg3, arg4); + return; + } + else if (isA(stack.top, tablesectionrowSet)) { + pending_table_text = []; + originalInsertionMode = parser; + parser = in_table_text_mode; + parser(t, value, arg3, arg4); + return; + } + break; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "caption": + stack.clearToContext(tableContextSet); + afe.insertMarker(); + insertHTMLElement(value,arg3); + parser = in_caption_mode; + return; + case "colgroup": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_column_group_mode; + return; + case "col": + in_table_mode(TAG, "colgroup", null); + parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_table_body_mode; + return; + case "td": + case "th": + case "tr": + in_table_mode(TAG, "tbody", null); + parser(t, value, arg3, arg4); + return; + + case "table": + if (!stack.inTableScope(value)) { + return; // Ignore the token + } + in_table_mode(ENDTAG, value); + parser(t, value, arg3, arg4); + return; + + case "style": + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; + + case "input": + var type = getTypeAttr(arg3); + if (type !== "hidden") break; // to the anything else case + insertHTMLElement(value,arg3); + stack.pop(); + return; + + case "form": + if (form_element_pointer || stack.contains("template")) return; + form_element_pointer = insertHTMLElement(value, arg3); + stack.popElement(form_element_pointer); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + if (!stack.inTableScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + } + + // This is the anything else case + foster_parent_mode = true; + in_body_mode(t, value, arg3, arg4); + foster_parent_mode = false; + } + + function in_table_text_mode(t, value, arg3, arg4) { + if (t === TEXT) { + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + pending_table_text.push(value); + } + else { + var s = pending_table_text.join(""); + pending_table_text.length = 0; + if (NONWS.test(s)) { // If any non-whitespace characters + // This must be the same code as the "anything else" + // case of the in_table mode above. + foster_parent_mode = true; + in_body_mode(TEXT, s); + foster_parent_mode = false; + } + else { + insertText(s); + } + parser = originalInsertionMode; + parser(t, value, arg3, arg4); + } + } + + + function in_caption_mode(t, value, arg3, arg4) { + function end_caption() { + if (!stack.inTableScope("caption")) return false; + stack.generateImpliedEndTags(); + stack.popTag("caption"); + afe.clearToMarker(); + parser = in_table_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (end_caption()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "caption": + end_caption(); + return; + case "table": + if (end_caption()) parser(t, value, arg3, arg4); + return; + case "body": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + } + break; + } + + // The Anything Else case + in_body_mode(t, value, arg3, arg4); + } + + function in_column_group_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "col": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "colgroup": + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + stack.pop(); + parser = in_table_mode; + return; + case "col": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + } + + // Anything else + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + in_column_group_mode(ENDTAG, "colgroup"); + parser(t, value, arg3, arg4); + } + + function in_table_body_mode(t, value, arg3, arg4) { + function endsect() { + if (!stack.inTableScope("tbody") && + !stack.inTableScope("thead") && + !stack.inTableScope("tfoot")) + return; + stack.clearToContext(tableBodyContextSet); + in_table_body_mode(ENDTAG, stack.top.localName, null); + parser(t, value, arg3, arg4); + } + + switch(t) { + case 2: // TAG + switch(value) { + case "tr": + stack.clearToContext(tableBodyContextSet); + insertHTMLElement(value, arg3); + parser = in_row_mode; + return; + case "th": + case "td": + in_table_body_mode(TAG, "tr", null); + parser(t, value, arg3, arg4); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + endsect(); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + endsect(); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + stack.clearToContext(tableBodyContextSet); + stack.pop(); + parser = in_table_mode; + } + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + case "tr": + return; + } + break; + } + + // Anything else: + in_table_mode(t, value, arg3, arg4); + } + + function in_row_mode(t, value, arg3, arg4) { + function endrow() { + if (!stack.inTableScope("tr")) return false; + stack.clearToContext(tableRowContextSet); + stack.pop(); + parser = in_table_body_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "th": + case "td": + stack.clearToContext(tableRowContextSet); + insertHTMLElement(value, arg3); + parser = in_cell_mode; + afe.insertMarker(); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (endrow()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "tr": + endrow(); + return; + case "table": + if (endrow()) parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + if (endrow()) parser(t, value, arg3, arg4); + } + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + return; + } + break; + } + + // anything else + in_table_mode(t, value, arg3, arg4); + } + + function in_cell_mode(t, value, arg3, arg4) { + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (stack.inTableScope("td")) { + in_cell_mode(ENDTAG, "td"); + parser(t, value, arg3, arg4); + } + else if (stack.inTableScope("th")) { + in_cell_mode(ENDTAG, "th"); + parser(t, value, arg3, arg4); + } + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "td": + case "th": + if (!stack.inTableScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + parser = in_row_mode; + return; + + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + return; + + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (!stack.inTableScope(value)) return; + in_cell_mode(ENDTAG, stack.inTableScope("td") ? "td" : "th"); + parser(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + in_body_mode(t, value, arg3, arg4); + } + + function in_select_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, "option"); + if (stack.top instanceof impl.HTMLOptGroupElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "select": + in_select_mode(ENDTAG, value); // treat it as a close tag + return; + + case "input": + case "keygen": + case "textarea": + if (!stack.inSelectScope("select")) return; + in_select_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement && + stack.elements[stack.elements.length-2] instanceof + impl.HTMLOptGroupElement) { + in_select_mode(ENDTAG, "option"); + } + if (stack.top instanceof impl.HTMLOptGroupElement) + stack.pop(); + + return; + + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + stack.pop(); + return; + + case "select": + if (!stack.inSelectScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + + break; + } + + // anything else: just ignore the token + } + + function in_select_in_table_mode(t, value, arg3, arg4) { + switch(value) { + case "caption": + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + case "td": + case "th": + switch(t) { + case 2: // TAG + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + case 3: // ENDTAG + if (stack.inTableScope(value)) { + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + } + return; + } + } + + // anything else + in_select_mode(t, value, arg3, arg4); + } + + function in_template_mode(t, value, arg3, arg4) { + function switchModeAndReprocess(mode) { + parser = mode; + templateInsertionModes[templateInsertionModes.length-1] = parser; + parser(t, value, arg3, arg4); + } + switch(t) { + case 1: // TEXT + case 4: // COMMENT + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + if (!stack.contains("template")) { + stopParsing(); + } else { + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + parser(t, value, arg3, arg4); + } + return; + case 2: // TAG + switch(value) { + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(t, value, arg3, arg4); + return; + case "caption": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + switchModeAndReprocess(in_table_mode); + return; + case "col": + switchModeAndReprocess(in_column_group_mode); + return; + case "tr": + switchModeAndReprocess(in_table_body_mode); + return; + case "td": + case "th": + switchModeAndReprocess(in_row_mode); + return; + } + switchModeAndReprocess(in_body_mode); + return; + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(t, value, arg3, arg4); + return; + default: + return; + } + } + } + + function after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value); + return; + case 4: // COMMENT + // Append it to the element + stack.elements[0]._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; // for any other tags + case 3: // ENDTAG + if (value === "html") { + if (fragment) return; + parser = after_after_body_mode; + return; + } + break; // for any other tags + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function in_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "frameset": + insertHTMLElement(value, arg3); + return; + case "frame": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "frameset") { + if (fragment && stack.top instanceof impl.HTMLHtmlElement) + return; + stack.pop(); + if (!fragment && + !(stack.top instanceof impl.HTMLFrameSetElement)) + parser = after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "html") { + parser = after_after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function after_after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + } + + // ignore anything else + } + + + // 13.2.5.5 The rules for parsing tokens in foreign content + // + // This is like one of the insertion modes above, but is + // invoked somewhat differently when the current token is not HTML. + // See the insertToken() function. + function insertForeignToken(t, value, arg3, arg4) { + // A tag is an HTML font tag if it has a color, font, or size + // attribute. Otherwise we assume it is foreign content + function isHTMLFont(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + switch(attrs[i][0]) { + case "color": + case "face": + case "size": + return true; + } + } + return false; + } + + var current; + + switch(t) { + case 1: // TEXT + // If any non-space, non-nul characters + if (frameset_ok && NONWSNONNUL.test(value)) + frameset_ok = false; + if (textIncludesNUL) { + value = value.replace(NULCHARS, "\uFFFD"); + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + // ignore it + return; + case 2: // TAG + switch(value) { + case "font": + if (!isHTMLFont(arg3)) break; + /* falls through */ + case "b": + case "big": + case "blockquote": + case "body": + case "br": + case "center": + case "code": + case "dd": + case "div": + case "dl": + case "dt": + case "em": + case "embed": + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + case "head": + case "hr": + case "i": + case "img": + case "li": + case "listing": + case "menu": + case "meta": + case "nobr": + case "ol": + case "p": + case "pre": + case "ruby": + case "s": + case "small": + case "span": + case "strong": + case "strike": + case "sub": + case "sup": + case "table": + case "tt": + case "u": + case "ul": + case "var": + if (fragment) { + break; + } + do { + stack.pop(); + current = stack.top; + } while(current.namespaceURI !== NAMESPACE.HTML && + !isMathmlTextIntegrationPoint(current) && + !isHTMLIntegrationPoint(current)); + + insertToken(t, value, arg3, arg4); // reprocess + return; + } + + // Any other start tag case goes here + current = (stack.elements.length===1 && fragment) ? fragmentContext : + stack.top; + if (current.namespaceURI === NAMESPACE.MATHML) { + adjustMathMLAttributes(arg3); + } + else if (current.namespaceURI === NAMESPACE.SVG) { + value = adjustSVGTagName(value); + adjustSVGAttributes(arg3); + } + adjustForeignAttributes(arg3); + + insertForeignElement(value, arg3, current.namespaceURI); + if (arg4) { // the self-closing flag + if (value === 'script' && current.namespaceURI === NAMESPACE.SVG) { + // XXX deal with SVG scripts here + } + stack.pop(); + } + return; + + case 3: // ENDTAG + current = stack.top; + if (value === "script" && + current.namespaceURI === NAMESPACE.SVG && + current.localName === "script") { + + stack.pop(); + + // XXX + // Deal with SVG scripts here + } + else { + // The any other end tag case + var i = stack.elements.length-1; + var node = stack.elements[i]; + for(;;) { + if (node.localName.toLowerCase() === value) { + stack.popElement(node); + break; + } + node = stack.elements[--i]; + // If non-html, keep looping + if (node.namespaceURI !== NAMESPACE.HTML) + continue; + // Otherwise process the end tag as html + parser(t, value, arg3, arg4); + break; + } + } + return; + } + } + + /*** + * Finally, this is the end of the HTMLParser() factory function. + * It returns the htmlparser object with the append() and end() methods. + */ + + // Sneak another method into the htmlparser object to allow us to run + // tokenizer tests. This can be commented out in production code. + // This is a hook for testing the tokenizer. It has to be here + // because the tokenizer details are all hidden away within the closure. + // It should return an array of tokens generated while parsing the + // input string. + htmlparser.testTokenizer = function(input, initialState, lastStartTag, charbychar) { + var tokens = []; + + switch(initialState) { + case "PCDATA state": + tokenizer = data_state; + break; + case "RCDATA state": + tokenizer = rcdata_state; + break; + case "RAWTEXT state": + tokenizer = rawtext_state; + break; + case "PLAINTEXT state": + tokenizer = plaintext_state; + break; + } + + if (lastStartTag) { + lasttagname = lastStartTag; + } + + insertToken = function(t, value, arg3, arg4) { + flushText(); + switch(t) { + case 1: // TEXT + if (tokens.length > 0 && + tokens[tokens.length-1][0] === "Character") { + tokens[tokens.length-1][1] += value; + } + else tokens.push(["Character", value]); + break; + case 4: // COMMENT + tokens.push(["Comment", value]); + break; + case 5: // DOCTYPE + tokens.push(["DOCTYPE", value, + arg3 === undefined ? null : arg3, + arg4 === undefined ? null : arg4, + !force_quirks]); + break; + case 2: // TAG + var attrs = Object.create(null); + for(var i = 0; i < arg3.length; i++) { + // XXX: does attribute order matter? + var a = arg3[i]; + if (a.length === 1) { + attrs[a[0]] = ""; + } + else { + attrs[a[0]] = a[1]; + } + } + var token = ["StartTag", value, attrs]; + if (arg4) token.push(true); + tokens.push(token); + break; + case 3: // ENDTAG + tokens.push(["EndTag", value]); + break; + case -1: // EOF + break; + } + }; + + if (!charbychar) { + this.parse(input, true); + } + else { + for(var i = 0; i < input.length; i++) { + this.parse(input[i]); + } + this.parse("", true); + } + return tokens; + }; + + // Return the parser object from the HTMLParser() factory function + return htmlparser; +} + + +/***/ }), + +/***/ 8161: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Leaf; + +var Node = __webpack_require__(97537); +var NodeList = __webpack_require__(64965); +var utils = __webpack_require__(89076); +var HierarchyRequestError = utils.HierarchyRequestError; +var NotFoundError = utils.NotFoundError; + +// This class defines common functionality for node subtypes that +// can never have children +function Leaf() { + Node.call(this); +} + +Leaf.prototype = Object.create(Node.prototype, { + hasChildNodes: { value: function() { return false; }}, + firstChild: { value: null }, + lastChild: { value: null }, + insertBefore: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + replaceChild: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + removeChild: { value: function(node) { + if (!node.nodeType) throw new TypeError('not a node'); + NotFoundError(); + }}, + removeChildren: { value: function() { /* no op */ }}, + childNodes: { get: function() { + if (!this._childNodes) this._childNodes = new NodeList(); + return this._childNodes; + }} +}); + + +/***/ }), + +/***/ 41360: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(89076); + +var LinkedList = module.exports = { + // basic validity tests on a circular linked list a + valid: function(a) { + utils.assert(a, "list falsy"); + utils.assert(a._previousSibling, "previous falsy"); + utils.assert(a._nextSibling, "next falsy"); + // xxx check that list is actually circular + return true; + }, + // insert a before b + insertBefore: function(a, b) { + utils.assert(LinkedList.valid(a) && LinkedList.valid(b)); + var a_first = a, a_last = a._previousSibling; + var b_first = b, b_last = b._previousSibling; + a_first._previousSibling = b_last; + a_last._nextSibling = b_first; + b_last._nextSibling = a_first; + b_first._previousSibling = a_last; + utils.assert(LinkedList.valid(a) && LinkedList.valid(b)); + }, + // replace a single node a with a list b (which could be null) + replace: function(a, b) { + utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b))); + if (b!==null) { + LinkedList.insertBefore(b, a); + } + LinkedList.remove(a); + utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b))); + }, + // remove single node a from its list + remove: function(a) { + utils.assert(LinkedList.valid(a)); + var prev = a._previousSibling; + if (prev === a) { return; } + var next = a._nextSibling; + prev._nextSibling = next; + next._previousSibling = prev; + a._previousSibling = a._nextSibling = a; + utils.assert(LinkedList.valid(a)); + } +}; + + +/***/ }), + +/***/ 63738: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var URL = __webpack_require__(85184); +var URLUtils = __webpack_require__(65531); + +module.exports = Location; + +function Location(window, href) { + this._window = window; + this._href = href; +} + +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, + + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, + + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); + + // Save the new url + this._href = newurl; + + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, + + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, + + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, + + toString: { value: function() { + return this.href; + }} + +}); + + +/***/ }), + +/***/ 21440: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var UIEvent = __webpack_require__(64259); + +module.exports = MouseEvent; + +function MouseEvent() { + // Just use the superclass constructor to initialize + UIEvent.call(this); + + this.screenX = this.screenY = this.clientX = this.clientY = 0; + this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false; + this.button = 0; + this.buttons = 1; + this.relatedTarget = null; +} +MouseEvent.prototype = Object.create(UIEvent.prototype, { + constructor: { value: MouseEvent }, + initMouseEvent: { value: function(type, bubbles, cancelable, + view, detail, + screenX, screenY, clientX, clientY, + ctrlKey, altKey, shiftKey, metaKey, + button, relatedTarget) { + + this.initEvent(type, bubbles, cancelable, view, detail); + this.screenX = screenX; + this.screenY = screenY; + this.clientX = clientX; + this.clientY = clientY; + this.ctrlKey = ctrlKey; + this.altKey = altKey; + this.shiftKey = shiftKey; + this.metaKey = metaKey; + this.button = button; + switch(button) { + case 0: this.buttons = 1; break; + case 1: this.buttons = 4; break; + case 2: this.buttons = 2; break; + default: this.buttons = 0; break; + } + this.relatedTarget = relatedTarget; + }}, + + getModifierState: { value: function(key) { + switch(key) { + case "Alt": return this.altKey; + case "Control": return this.ctrlKey; + case "Shift": return this.shiftKey; + case "Meta": return this.metaKey; + default: return false; + } + }} +}); + + +/***/ }), + +/***/ 40993: +/***/ ((module) => { + +"use strict"; + +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; + +/***/ }), + +/***/ 49492: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = NamedNodeMap; + +var utils = __webpack_require__(89076); + +/* This is a hacky implementation of NamedNodeMap, intended primarily to + * satisfy clients (like dompurify and the web-platform-tests) which check + * to ensure that Node#attributes instanceof NamedNodeMap. */ + +function NamedNodeMap(element) { + this.element = element; +} +Object.defineProperties(NamedNodeMap.prototype, { + length: { get: utils.shouldOverride }, + item: { value: utils.shouldOverride }, + + getNamedItem: { value: function getNamedItem(qualifiedName) { + return this.element.getAttributeNode(qualifiedName); + } }, + getNamedItemNS: { value: function getNamedItemNS(namespace, localName) { + return this.element.getAttributeNodeNS(namespace, localName); + } }, + setNamedItem: { value: utils.nyi }, + setNamedItemNS: { value: utils.nyi }, + removeNamedItem: { value: function removeNamedItem(qualifiedName) { + var attr = this.element.getAttributeNode(qualifiedName); + if (attr) { + this.element.removeAttribute(qualifiedName); + return attr; + } + utils.NotFoundError(); + } }, + removeNamedItemNS: { value: function removeNamedItemNS(ns, lname) { + var attr = this.element.getAttributeNodeNS(ns, lname); + if (attr) { + this.element.removeAttributeNS(ns, lname); + return attr; + } + utils.NotFoundError(); + } }, +}); + + +/***/ }), + +/***/ 94993: +/***/ ((module) => { + +"use strict"; + + +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); + +module.exports = NavigatorID; + + +/***/ }), + +/***/ 97537: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Node; + +var EventTarget = __webpack_require__(22356); +var LinkedList = __webpack_require__(41360); +var NodeUtils = __webpack_require__(41608); +var utils = __webpack_require__(89076); + +// All nodes have a nodeType and an ownerDocument. +// Once inserted, they also have a parentNode. +// This is an abstract class; all nodes in a document are instances +// of a subtype, so all the properties are defined by more specific +// constructors. +function Node() { + EventTarget.call(this); + this.parentNode = null; + this._nextSibling = this._previousSibling = this; + this._index = undefined; +} + +var ELEMENT_NODE = Node.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2; +var TEXT_NODE = Node.TEXT_NODE = 3; +var CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = Node.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = Node.COMMENT_NODE = 8; +var DOCUMENT_NODE = Node.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = Node.NOTATION_NODE = 12; + +var DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 0x01; +var DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 0x02; +var DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 0x04; +var DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 0x08; +var DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10; +var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + +Node.prototype = Object.create(EventTarget.prototype, { + + // Node that are not inserted into the tree inherit a null parent + + // XXX: the baseURI attribute is defined by dom core, but + // a correct implementation of it requires HTML features, so + // we'll come back to this later. + baseURI: { get: utils.nyi }, + + parentElement: { get: function() { + return (this.parentNode && this.parentNode.nodeType===ELEMENT_NODE) ? this.parentNode : null; + }}, + + hasChildNodes: { value: utils.shouldOverride }, + + firstChild: { get: utils.shouldOverride }, + + lastChild: { get: utils.shouldOverride }, + + isConnected: { + get: function () { + let node = this; + while (node != null) { + if (node.nodeType === Node.DOCUMENT_NODE) { + return true; + } + + node = node.parentNode; + if (node != null && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + node = node.host; + } + } + return false; + }, + }, + + previousSibling: { get: function() { + var parent = this.parentNode; + if (!parent) return null; + if (this === parent.firstChild) return null; + return this._previousSibling; + }}, + + nextSibling: { get: function() { + var parent = this.parentNode, next = this._nextSibling; + if (!parent) return null; + if (next === parent.firstChild) return null; + return next; + }}, + + textContent: { + // Should override for DocumentFragment/Element/Attr/Text/PI/Comment + get: function() { return null; }, + set: function(v) { /* do nothing */ }, + }, + + innerText: { + // Should override for DocumentFragment/Element/Attr/Text/PI/Comment + get: function() { return null; }, + set: function(v) { /* do nothing */ }, + }, + + _countChildrenOfType: { value: function(type) { + var sum = 0; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === type) sum++; + } + return sum; + }}, + + _ensureInsertValid: { value: function _ensureInsertValid(node, child, isPreinsert) { + var parent = this, i, kid; + if (!node.nodeType) throw new TypeError('not a node'); + // 1. If parent is not a Document, DocumentFragment, or Element + // node, throw a HierarchyRequestError. + switch (parent.nodeType) { + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + case ELEMENT_NODE: + break; + default: utils.HierarchyRequestError(); + } + // 2. If node is a host-including inclusive ancestor of parent, + // throw a HierarchyRequestError. + if (node.isAncestor(parent)) utils.HierarchyRequestError(); + // 3. If child is not null and its parent is not parent, then + // throw a NotFoundError. (replaceChild omits the 'child is not null' + // and throws a TypeError here if child is null.) + if (child !== null || !isPreinsert) { + if (child.parentNode !== parent) utils.NotFoundError(); + } + // 4. If node is not a DocumentFragment, DocumentType, Element, + // Text, ProcessingInstruction, or Comment node, throw a + // HierarchyRequestError. + switch (node.nodeType) { + case DOCUMENT_FRAGMENT_NODE: + case DOCUMENT_TYPE_NODE: + case ELEMENT_NODE: + case TEXT_NODE: + case PROCESSING_INSTRUCTION_NODE: + case COMMENT_NODE: + break; + default: utils.HierarchyRequestError(); + } + // 5. If either node is a Text node and parent is a document, or + // node is a doctype and parent is not a document, throw a + // HierarchyRequestError. + // 6. If parent is a document, and any of the statements below, switched + // on node, are true, throw a HierarchyRequestError. + if (parent.nodeType === DOCUMENT_NODE) { + switch (node.nodeType) { + case TEXT_NODE: + utils.HierarchyRequestError(); + break; + case DOCUMENT_FRAGMENT_NODE: + // 6a1. If node has more than one element child or has a Text + // node child. + if (node._countChildrenOfType(TEXT_NODE) > 0) + utils.HierarchyRequestError(); + switch (node._countChildrenOfType(ELEMENT_NODE)) { + case 0: + break; + case 1: + // 6a2. Otherwise, if node has one element child and either + // parent has an element child, child is a doctype, or child + // is not null and a doctype is following child. [preinsert] + // 6a2. Otherwise, if node has one element child and either + // parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + default: // 6a1, continued. (more than one Element child) + utils.HierarchyRequestError(); + } + break; + case ELEMENT_NODE: + // 6b. parent has an element child, child is a doctype, or + // child is not null and a doctype is following child. [preinsert] + // 6b. parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + case DOCUMENT_TYPE_NODE: + // 6c. parent has a doctype child, child is non-null and an + // element is preceding child, or child is null and parent has + // an element child. [preinsert] + // 6c. parent has a doctype child that is not child, or an + // element is preceding child. [replaceWith] + if (child === null) { + if (parent._countChildrenOfType(ELEMENT_NODE)) + utils.HierarchyRequestError(); + } else { + // child is always non-null for [replaceWith] case + for (kid = parent.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid === child) break; + if (kid.nodeType === ELEMENT_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(DOCUMENT_TYPE_NODE); + if (isPreinsert) { + // "parent has an doctype child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an doctype child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE)) + utils.HierarchyRequestError(); + } + break; + } + } else { + // 5, continued: (parent is not a document) + if (node.nodeType === DOCUMENT_TYPE_NODE) utils.HierarchyRequestError(); + } + }}, + + insertBefore: { value: function insertBefore(node, child) { + var parent = this; + // 1. Ensure pre-insertion validity + parent._ensureInsertValid(node, child, true); + // 2. Let reference child be child. + var refChild = child; + // 3. If reference child is node, set it to node's next sibling + if (refChild === node) { refChild = node.nextSibling; } + // 4. Adopt node into parent's node document. + parent.doc.adoptNode(node); + // 5. Insert node into parent before reference child. + node._insertOrReplace(parent, refChild, false); + // 6. Return node + return node; + }}, + + + appendChild: { value: function(child) { + // This invokes _appendChild after doing validity checks. + return this.insertBefore(child, null); + }}, + + _appendChild: { value: function(child) { + child._insertOrReplace(this, null, false); + }}, + + removeChild: { value: function removeChild(child) { + var parent = this; + if (!child.nodeType) throw new TypeError('not a node'); + if (child.parentNode !== parent) utils.NotFoundError(); + child.remove(); + return child; + }}, + + // To replace a `child` with `node` within a `parent` (this) + replaceChild: { value: function replaceChild(node, child) { + var parent = this; + // Ensure validity (slight differences from pre-insertion check) + parent._ensureInsertValid(node, child, false); + // Adopt node into parent's node document. + if (node.doc !== parent.doc) { + // XXX adoptNode has side-effect of removing node from its parent + // and generating a mutation event, thus causing the _insertOrReplace + // to generate two deletes and an insert instead of a 'move' + // event. It looks like the new MutationObserver stuff avoids + // this problem, but for now let's only adopt (ie, remove `node` + // from its parent) here if we need to. + parent.doc.adoptNode(node); + } + // Do the replace. + node._insertOrReplace(parent, child, true); + return child; + }}, + + // See: http://ejohn.org/blog/comparing-document-position/ + contains: { value: function contains(node) { + if (node === null) { return false; } + if (this === node) { return true; /* inclusive descendant */ } + /* jshint bitwise: false */ + return (this.compareDocumentPosition(node) & + DOCUMENT_POSITION_CONTAINED_BY) !== 0; + }}, + + compareDocumentPosition: { value: function compareDocumentPosition(that){ + // Basic algorithm for finding the relative position of two nodes. + // Make a list the ancestors of each node, starting with the + // document element and proceeding down to the nodes themselves. + // Then, loop through the lists, looking for the first element + // that differs. The order of those two elements give the + // order of their descendant nodes. Or, if one list is a prefix + // of the other one, then that node contains the other. + + if (this === that) return 0; + + // If they're not owned by the same document or if one is rooted + // and one is not, then they're disconnected. + if (this.doc !== that.doc || + this.rooted !== that.rooted) + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + // Get arrays of ancestors for this and that + var these = [], those = []; + for(var n = this; n !== null; n = n.parentNode) these.push(n); + for(n = that; n !== null; n = n.parentNode) those.push(n); + these.reverse(); // So we start with the outermost + those.reverse(); + + if (these[0] !== those[0]) // No common ancestor + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + n = Math.min(these.length, those.length); + for(var i = 1; i < n; i++) { + if (these[i] !== those[i]) { + // We found two different ancestors, so compare + // their positions + if (these[i].index < those[i].index) + return DOCUMENT_POSITION_FOLLOWING; + else + return DOCUMENT_POSITION_PRECEDING; + } + } + + // If we get to here, then one of the nodes (the one with the + // shorter list of ancestors) contains the other one. + if (these.length < those.length) + return (DOCUMENT_POSITION_FOLLOWING + + DOCUMENT_POSITION_CONTAINED_BY); + else + return (DOCUMENT_POSITION_PRECEDING + + DOCUMENT_POSITION_CONTAINS); + }}, + + isSameNode: {value : function isSameNode(node) { + return this === node; + }}, + + + // This method implements the generic parts of node equality testing + // and defers to the (non-recursive) type-specific isEqual() method + // defined by subclasses + isEqualNode: { value: function isEqualNode(node) { + if (!node) return false; + if (node.nodeType !== this.nodeType) return false; + + // Check type-specific properties for equality + if (!this.isEqual(node)) return false; + + // Now check children for number and equality + for (var c1 = this.firstChild, c2 = node.firstChild; + c1 && c2; + c1 = c1.nextSibling, c2 = c2.nextSibling) { + if (!c1.isEqualNode(c2)) return false; + } + return c1 === null && c2 === null; + }}, + + // This method delegates shallow cloning to a clone() method + // that each concrete subclass must implement + cloneNode: { value: function(deep) { + // Clone this node + var clone = this.clone(); + + // Handle the recursive case if necessary + if (deep) { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + clone._appendChild(kid.cloneNode(true)); + } + } + + return clone; + }}, + + lookupPrefix: { value: function lookupPrefix(ns) { + var e; + if (ns === '' || ns === null || ns === undefined) return null; + switch(this.nodeType) { + case ELEMENT_NODE: + return this._lookupNamespacePrefix(ns, this); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.lookupPrefix(ns) : null; + case ENTITY_NODE: + case NOTATION_NODE: + case DOCUMENT_FRAGMENT_NODE: + case DOCUMENT_TYPE_NODE: + return null; + case ATTRIBUTE_NODE: + e = this.ownerElement; + return e ? e.lookupPrefix(ns) : null; + default: + e = this.parentElement; + return e ? e.lookupPrefix(ns) : null; + } + }}, + + + lookupNamespaceURI: {value: function lookupNamespaceURI(prefix) { + if (prefix === '' || prefix === undefined) { prefix = null; } + var e; + switch(this.nodeType) { + case ELEMENT_NODE: + return utils.shouldOverride(); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.lookupNamespaceURI(prefix) : null; + case ENTITY_NODE: + case NOTATION_NODE: + case DOCUMENT_TYPE_NODE: + case DOCUMENT_FRAGMENT_NODE: + return null; + case ATTRIBUTE_NODE: + e = this.ownerElement; + return e ? e.lookupNamespaceURI(prefix) : null; + default: + e = this.parentElement; + return e ? e.lookupNamespaceURI(prefix) : null; + } + }}, + + isDefaultNamespace: { value: function isDefaultNamespace(ns) { + if (ns === '' || ns === undefined) { ns = null; } + var defaultNamespace = this.lookupNamespaceURI(null); + return (defaultNamespace === ns); + }}, + + // Utility methods for nodes. Not part of the DOM + + // Return the index of this node in its parent. + // Throw if no parent, or if this node is not a child of its parent + index: { get: function() { + var parent = this.parentNode; + if (this === parent.firstChild) return 0; // fast case + var kids = parent.childNodes; + if (this._index === undefined || kids[this._index] !== this) { + // Ensure that we don't have an O(N^2) blowup if none of the + // kids have defined indices yet and we're traversing via + // nextSibling or previousSibling + for (var i=0; i 2 ? spliceArgs[2] : null); + } else if (len > 2 && n !== null) { + LinkedList.insertBefore(spliceArgs[2], n); + } + if (parent._childNodes) { + spliceArgs[0] = (before === null) ? + parent._childNodes.length : before._index; + parent._childNodes.splice.apply(parent._childNodes, spliceArgs); + for (i=2; i 2) { + parent._firstChild = spliceArgs[2]; + } else if (isReplace) { + parent._firstChild = null; + } + } + // Remove all nodes from the document fragment + if (child._childNodes) { + child._childNodes.length = 0; + } else { + child._firstChild = null; + } + // Call the mutation handlers + // Use spliceArgs since the original array has been destroyed. The + // liveness guarantee requires us to clone the array so that + // references to the childNodes of the DocumentFragment will be empty + // when the insertion handlers are called. + if (parent.rooted) { + parent.modify(); + for (i = 2; i < len; i++) { + parent.doc.mutateInsert(spliceArgs[i]); + } + } + } else { + if (before === child) { return; } + if (bothRooted) { + // Remove the child from its current position in the tree + // without calling remove(), since we don't want to uproot it. + child._remove(); + } else if (child.parentNode) { + child.remove(); + } + + // Insert it as a child of its new parent + child.parentNode = parent; + if (isReplace) { + LinkedList.replace(n, child); + if (parent._childNodes) { + child._index = before_index; + parent._childNodes[before_index] = child; + } else if (parent._firstChild === before) { + parent._firstChild = child; + } + } else { + if (n !== null) { + LinkedList.insertBefore(child, n); + } + if (parent._childNodes) { + child._index = before_index; + parent._childNodes.splice(before_index, 0, child); + } else if (parent._firstChild === before) { + parent._firstChild = child; + } + } + if (bothRooted) { + parent.modify(); + // Generate a move mutation event + parent.doc.mutateMove(child); + } else if (parent.rooted) { + parent.modify(); + parent.doc.mutateInsert(child); + } + } + }}, + + + // Return the lastModTime value for this node. (For use as a + // cache invalidation mechanism. If the node does not already + // have one, initialize it from the owner document's modclock + // property. (Note that modclock does not return the actual + // time; it is simply a counter incremented on each document + // modification) + lastModTime: { get: function() { + if (!this._lastModTime) { + this._lastModTime = this.doc.modclock; + } + return this._lastModTime; + }}, + + // Increment the owner document's modclock and use the new + // value to update the lastModTime value for this node and + // all of its ancestors. Nodes that have never had their + // lastModTime value queried do not need to have a + // lastModTime property set on them since there is no + // previously queried value to ever compare the new value + // against, so only update nodes that already have a + // _lastModTime property. + modify: { value: function() { + if (this.doc.modclock) { // Skip while doc.modclock == 0 + var time = ++this.doc.modclock; + for(var n = this; n; n = n.parentElement) { + if (n._lastModTime) { + n._lastModTime = time; + } + } + } + }}, + + // This attribute is not part of the DOM but is quite helpful. + // It returns the document with which a node is associated. Usually + // this is the ownerDocument. But ownerDocument is null for the + // document object itself, so this is a handy way to get the document + // regardless of the node type + doc: { get: function() { + return this.ownerDocument || this; + }}, + + + // If the node has a nid (node id), then it is rooted in a document + rooted: { get: function() { + return !!this._nid; + }}, + + normalize: { value: function() { + var next; + for (var child=this.firstChild; child !== null; child=next) { + next = child.nextSibling; + + if (child.normalize) { + child.normalize(); + } + + if (child.nodeType !== Node.TEXT_NODE) { + continue; + } + + if (child.nodeValue === "") { + this.removeChild(child); + continue; + } + + var prevChild = child.previousSibling; + if (prevChild === null) { + continue; + } else if (prevChild.nodeType === Node.TEXT_NODE) { + // merge this with previous and remove the child + prevChild.appendData(child.nodeValue); + this.removeChild(child); + } + } + }}, + + // Convert the children of a node to an HTML string. + // This is used by the innerHTML getter + // The serialization spec is at: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments + // + // The serialization logic is intentionally implemented in a separate + // `NodeUtils` helper instead of the more obvious choice of a private + // `_serializeOne()` method on the `Node.prototype` in order to avoid + // the megamorphic `this._serializeOne` property access, which reduces + // performance unnecessarily. If you need specialized behavior for a + // certain subclass, you'll need to implement that in `NodeUtils`. + // See https://github.com/fgnass/domino/pull/142 for more information. + serialize: { value: function() { + if (this._innerHTML) { + return this._innerHTML; + } + var s = ''; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + s += NodeUtils.serializeOne(kid, this); + } + return s; + }}, + + // Non-standard, but often useful for debugging. + outerHTML: { + get: function() { + return NodeUtils.serializeOne(this, { nodeType: 0 }); + }, + set: utils.nyi, + }, + + // mirror node type properties in the prototype, so they are present + // in instances of Node (and subclasses) + ELEMENT_NODE: { value: ELEMENT_NODE }, + ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE }, + TEXT_NODE: { value: TEXT_NODE }, + CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE }, + ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE }, + ENTITY_NODE: { value: ENTITY_NODE }, + PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE }, + COMMENT_NODE: { value: COMMENT_NODE }, + DOCUMENT_NODE: { value: DOCUMENT_NODE }, + DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE }, + DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE }, + NOTATION_NODE: { value: NOTATION_NODE }, + + DOCUMENT_POSITION_DISCONNECTED: { value: DOCUMENT_POSITION_DISCONNECTED }, + DOCUMENT_POSITION_PRECEDING: { value: DOCUMENT_POSITION_PRECEDING }, + DOCUMENT_POSITION_FOLLOWING: { value: DOCUMENT_POSITION_FOLLOWING }, + DOCUMENT_POSITION_CONTAINS: { value: DOCUMENT_POSITION_CONTAINS }, + DOCUMENT_POSITION_CONTAINED_BY: { value: DOCUMENT_POSITION_CONTAINED_BY }, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC }, +}); + + +/***/ }), + +/***/ 383: +/***/ ((module) => { + +"use strict"; + +var NodeFilter = { + // Constants for acceptNode() + FILTER_ACCEPT: 1, + FILTER_REJECT: 2, + FILTER_SKIP: 3, + + // Constants for whatToShow + SHOW_ALL: 0xFFFFFFFF, + SHOW_ELEMENT: 0x1, + SHOW_ATTRIBUTE: 0x2, // historical + SHOW_TEXT: 0x4, + SHOW_CDATA_SECTION: 0x8, // historical + SHOW_ENTITY_REFERENCE: 0x10, // historical + SHOW_ENTITY: 0x20, // historical + SHOW_PROCESSING_INSTRUCTION: 0x40, + SHOW_COMMENT: 0x80, + SHOW_DOCUMENT: 0x100, + SHOW_DOCUMENT_TYPE: 0x200, + SHOW_DOCUMENT_FRAGMENT: 0x400, + SHOW_NOTATION: 0x800 // historical +}; + +module.exports = (NodeFilter.constructor = NodeFilter.prototype = NodeFilter); + + +/***/ }), + +/***/ 30419: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = NodeIterator; + +var NodeFilter = __webpack_require__(383); +var NodeTraversal = __webpack_require__(72059); +var utils = __webpack_require__(89076); + +/* Private methods and helpers */ + +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} + +function isInclusiveAncestor(node, possibleChild) { + for ( ; possibleChild; possibleChild = possibleChild.parentNode) { + if (node === possibleChild) { return true; } + } + return false; +} + +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni._referenceNode; + beforeNode = ni._pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni._root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni._referenceNode = node; + ni._pointerBeforeReferenceNode = beforeNode; + return node; +} + +/* Public API */ + +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + if (!root || !root.nodeType) { + utils.NotSupportedError(); + } + + // Read-only properties + this._root = root; + this._referenceNode = root; + this._pointerBeforeReferenceNode = true; + this._whatToShow = Number(whatToShow) || 0; + this._filter = filter || null; + this._active = false; + // Record active node iterators in the document, in order to perform + // "node iterator pre-removal steps". + root.doc._attachNodeIterator(this); +} + +Object.defineProperties(NodeIterator.prototype, { + root: { get: function root() { + return this._root; + } }, + referenceNode: { get: function referenceNode() { + return this._referenceNode; + } }, + pointerBeforeReferenceNode: { get: function pointerBeforeReferenceNode() { + return this._pointerBeforeReferenceNode; + } }, + whatToShow: { get: function whatToShow() { + return this._whatToShow; + } }, + filter: { get: function filter() { + return this._filter; + } }, + + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + _internalFilter: { value: function _internalFilter(node) { + /* jshint bitwise: false */ + var result, filter; + if (this._active) { + utils.InvalidStateError(); + } + + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) { + return NodeFilter.FILTER_SKIP; + } + + filter = this._filter; + if (filter === null) { + result = NodeFilter.FILTER_ACCEPT; + } else { + this._active = true; + try { + if (typeof filter === 'function') { + result = filter(node); + } else { + result = filter.acceptNode(node); + } + } finally { + this._active = false; + } + } + + // Note that coercing to a number means that + // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT) + // `false` becomes `0` (neither accept, reject, or skip) + return (+result); + } }, + + /** + * @spec https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps + * @method + * @return void + */ + _preremove: { value: function _preremove(toBeRemovedNode) { + if (isInclusiveAncestor(toBeRemovedNode, this._root)) { return; } + if (!isInclusiveAncestor(toBeRemovedNode, this._referenceNode)) { return; } + if (this._pointerBeforeReferenceNode) { + var next = toBeRemovedNode; + while (next.lastChild) { + next = next.lastChild; + } + next = NodeTraversal.next(next, this.root); + if (next) { + this._referenceNode = next; + return; + } + this._pointerBeforeReferenceNode = false; + // fall through + } + if (toBeRemovedNode.previousSibling === null) { + this._referenceNode = toBeRemovedNode.parentNode; + } else { + this._referenceNode = toBeRemovedNode.previousSibling; + var lastChild; + for (lastChild = this._referenceNode.lastChild; + lastChild; + lastChild = this._referenceNode.lastChild) { + this._referenceNode = lastChild; + } + } + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: { value: function nextNode() { + return traverse(this, true); + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: { value: function previousNode() { + return traverse(this, false); + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: { value: function detach() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } }, + + /** For compatibility with web-platform-tests. */ + toString: { value: function toString() { + return "[object NodeIterator]"; + } }, +}); + + +/***/ }), + +/***/ 52516: +/***/ ((module) => { + +"use strict"; + + +// No support for subclassing array, return an actual Array object. +function item(i) { + /* jshint validthis: true */ + return this[i] || null; +} + +function NodeList(a) { + if (!a) a = []; + a.item = item; + return a; +} + +module.exports = NodeList; + + +/***/ }), + +/***/ 77101: +/***/ ((module) => { + +"use strict"; +/* jshint esversion: 6 */ + + +module.exports = class NodeList extends Array { + constructor(a) { + super((a && a.length) || 0); + if (a) { + for (var idx in a) { this[idx] = a[idx]; } + } + } + item(i) { return this[i] || null; } +}; + + +/***/ }), + +/***/ 64965: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var NodeList; + +try { + // Attempt to use ES6-style Array subclass if possible. + NodeList = __webpack_require__(77101); +} catch (e) { + // No support for subclassing array, return an actual Array object. + NodeList = __webpack_require__(52516); +} + +module.exports = NodeList; + + +/***/ }), + +/***/ 72059: +/***/ ((module) => { + +"use strict"; + +/* exported NodeTraversal */ +var NodeTraversal = module.exports = { + nextSkippingChildren: nextSkippingChildren, + nextAncestorSibling: nextAncestorSibling, + next: next, + previous: previous, + deepLastChild: deepLastChild +}; + +/** + * @based on WebKit's NodeTraversal::nextSkippingChildren + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L109 + */ +function nextSkippingChildren(node, stayWithin) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + return nextAncestorSibling(node, stayWithin); +} + +/** + * @based on WebKit's NodeTraversal::nextAncestorSibling + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L93 + */ +function nextAncestorSibling(node, stayWithin) { + for (node = node.parentNode; node !== null; node = node.parentNode) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + } + return null; +} + +/** + * @based on WebKit's NodeTraversal::next + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L99 + */ +function next(node, stayWithin) { + var n; + n = node.firstChild; + if (n !== null) { + return n; + } + if (node === stayWithin) { + return null; + } + n = node.nextSibling; + if (n !== null) { + return n; + } + return nextAncestorSibling(node, stayWithin); +} + +/** + * @based on WebKit's NodeTraversal::deepLastChild + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L116 + */ +function deepLastChild(node) { + while (node.lastChild) { + node = node.lastChild; + } + return node; +} + +/** + * @based on WebKit's NodeTraversal::previous + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L121 + */ +function previous(node, stayWithin) { + var p; + p = node.previousSibling; + if (p !== null) { + return deepLastChild(p); + } + p = node.parentNode; + if (p === stayWithin) { + return null; + } + return p; +} + + +/***/ }), + +/***/ 41608: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = { + // NOTE: The `serializeOne()` function used to live on the `Node.prototype` + // as a private method `Node#_serializeOne(child)`, however that requires + // a megamorphic property access `this._serializeOne` just to get to the + // method, and this is being done on lots of different `Node` subclasses, + // which puts a lot of pressure on V8's megamorphic stub cache. So by + // moving the helper off of the `Node.prototype` and into a separate + // function in this helper module, we get a monomorphic property access + // `NodeUtils.serializeOne` to get to the function and reduce pressure + // on the megamorphic stub cache. + // See https://github.com/fgnass/domino/pull/142 for more information. + serializeOne: serializeOne, + + // Export util functions so that we can run extra test for them. + // Note: we prefix function names with `ɵ`, similar to what we do + // with internal functions in Angular packages. + ɵescapeMatchingClosingTag: escapeMatchingClosingTag, + ɵescapeClosingCommentTag: escapeClosingCommentTag, + ɵescapeProcessingInstructionContent: escapeProcessingInstructionContent +}; + +var utils = __webpack_require__(89076); +var NAMESPACE = utils.NAMESPACE; + +var hasRawContent = { + STYLE: true, + SCRIPT: true, + XMP: true, + IFRAME: true, + NOEMBED: true, + NOFRAMES: true, + PLAINTEXT: true +}; + +var emptyElements = { + area: true, + base: true, + basefont: true, + bgsound: true, + br: true, + col: true, + embed: true, + frame: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true +}; + +var extraNewLine = { + /* Removed in https://github.com/whatwg/html/issues/944 + pre: true, + textarea: true, + listing: true + */ +}; + +const ESCAPE_REGEXP = /[&<>\u00A0]/g; +const ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g; + +function escape(s) { + if (!ESCAPE_REGEXP.test(s)) { + // nothing to do, fast path + return s; + } + + return s.replace(ESCAPE_REGEXP, (c) => { + switch (c) { + case "&": + return "&"; + case "<": + return "<"; + case ">": + return ">"; + case "\u00A0": + return " "; + } + }); +} + +function escapeAttr(s) { + if (!ESCAPE_ATTR_REGEXP.test(s)) { + // nothing to do, fast path + return s; + } + + return s.replace(ESCAPE_ATTR_REGEXP, (c) => { + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case '"': + return """; + case "\u00A0": + return " "; + } + }); +} + +function attrname(a) { + var ns = a.namespaceURI; + if (!ns) + return a.localName; + if (ns === NAMESPACE.XML) + return 'xml:' + a.localName; + if (ns === NAMESPACE.XLINK) + return 'xlink:' + a.localName; + + if (ns === NAMESPACE.XMLNS) { + if (a.localName === 'xmlns') return 'xmlns'; + else return 'xmlns:' + a.localName; + } + return a.name; +} + +/** + * Escapes matching closing tag in a raw text. + * + * For example, given `)`, + * the parent tag would by "style" and the raw text is + * "". If we come across a matching closing tag + * (in out case ``) - replace `<` with `<` to avoid unexpected + * and unsafe behavior after de-serialization. + */ +function escapeMatchingClosingTag(rawText, parentTag) { + const parentClosingTag = '/; + +/** + * Escapes closing comment tag in a comment content. + * + * For example, given `#comment('-->')`, the content of a comment would be + * updated to `-->` to avoid unexpected and unsafe behavior after + * de-serialization. + */ +function escapeClosingCommentTag(rawContent) { + if (!CLOSING_COMMENT_REGEXP.test(rawContent)) { + return rawContent; // fast path + } + return rawContent.replace(/(--\!?)>/g, '$1>'); +} + +/** + * Escapes processing instruction content by replacing `>` with `>`. + */ +function escapeProcessingInstructionContent(rawContent) { + return rawContent.includes('>') + ? rawContent.replaceAll('>', '>') + : rawContent; +} + +function serializeOne(kid, parent) { + var s = ''; + switch(kid.nodeType) { + case 1: //ELEMENT_NODE + var ns = kid.namespaceURI; + var html = ns === NAMESPACE.HTML; + var tagname = (html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML) ? kid.localName : kid.tagName; + + s += '<' + tagname; + + for(var j = 0, k = kid._numattrs; j < k; j++) { + var a = kid._attr(j); + s += ' ' + attrname(a); + if (a.value !== undefined) s += '="' + escapeAttr(a.value) + '"'; + } + s += '>'; + + if (!(html && emptyElements[tagname])) { + var ss = kid.serialize(); + // If an element can have raw content, this content may + // potentially require escaping to avoid XSS. + if (hasRawContent[tagname.toUpperCase()]) { + ss = escapeMatchingClosingTag(ss, tagname); + } + if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n'; + // Serialize children and add end tag for all others + s += ss; + s += ''; + } + break; + case 3: //TEXT_NODE + case 4: //CDATA_SECTION_NODE + var parenttag; + if (parent.nodeType === 1 /*ELEMENT_NODE*/ && + parent.namespaceURI === NAMESPACE.HTML) + parenttag = parent.tagName; + else + parenttag = ''; + + if (hasRawContent[parenttag] || + (parenttag==='NOSCRIPT' && parent.ownerDocument._scripting_enabled)) { + s += kid.data; + } else { + s += escape(kid.data); + } + break; + case 8: //COMMENT_NODE + s += ''; + break; + case 7: //PROCESSING_INSTRUCTION_NODE + const content = escapeProcessingInstructionContent(kid.data); + s += ''; + break; + case 10: //DOCUMENT_TYPE_NODE + s += ''; + break; + default: + utils.InvalidStateError(); + } + return s; +} + + +/***/ }), + +/***/ 32001: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Node = __webpack_require__(97537); + +var NonDocumentTypeChildNode = { + + nextElementSibling: { get: function() { + if (this.parentNode) { + for (var kid = this.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + } + return null; + }}, + + previousElementSibling: { get: function() { + if (this.parentNode) { + for (var kid = this.previousSibling; kid !== null; kid = kid.previousSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + } + return null; + }} + +}; + +module.exports = NonDocumentTypeChildNode; + + +/***/ }), + +/***/ 81248: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = ProcessingInstruction; + +var Node = __webpack_require__(97537); +var CharacterData = __webpack_require__(90086); + +function ProcessingInstruction(doc, target, data) { + CharacterData.call(this); + this.nodeType = Node.PROCESSING_INSTRUCTION_NODE; + this.ownerDocument = doc; + this.target = target; + this._data = data; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + this._data = v; + if (this.rooted) this.ownerDocument.mutateValue(this); + } +}; + +ProcessingInstruction.prototype = Object.create(CharacterData.prototype, { + nodeName: { get: function() { return this.target; }}, + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + // Utility methods + clone: { value: function clone() { + return new ProcessingInstruction(this.ownerDocument, this.target, this._data); + }}, + isEqual: { value: function isEqual(n) { + return this.target === n.target && this._data === n._data; + }} + +}); + + +/***/ }), + +/***/ 58210: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Text; + +var utils = __webpack_require__(89076); +var Node = __webpack_require__(97537); +var CharacterData = __webpack_require__(90086); + +function Text(doc, data) { + CharacterData.call(this); + this.nodeType = Node.TEXT_NODE; + this.ownerDocument = doc; + this._data = data; + this._index = undefined; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + if (v === this._data) return; + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + if (this.parentNode && + this.parentNode._textchangehook) + this.parentNode._textchangehook(this); + } +}; + +Text.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: "#text" }, + // These three attributes are all the same. + // The data attribute has a [TreatNullAs=EmptyString] but we'll + // implement that at the interface level + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + splitText: { value: function splitText(offset) { + if (offset > this._data.length || offset < 0) utils.IndexSizeError(); + + var newdata = this._data.substring(offset), + newnode = this.ownerDocument.createTextNode(newdata); + this.data = this.data.substring(0, offset); + + var parent = this.parentNode; + if (parent !== null) + parent.insertBefore(newnode, this.nextSibling); + + return newnode; + }}, + + wholeText: { get: function wholeText() { + var result = this.textContent; + for (var next = this.nextSibling; next; next = next.nextSibling) { + if (next.nodeType !== Node.TEXT_NODE) { break; } + result += next.textContent; + } + return result; + }}, + // Obsolete, removed from spec. + replaceWholeText: { value: utils.nyi }, + + // Utility methods + clone: { value: function clone() { + return new Text(this.ownerDocument, this._data); + }}, + +}); + + +/***/ }), + +/***/ 44507: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = TreeWalker; + +var Node = __webpack_require__(97537); +var NodeFilter = __webpack_require__(383); +var NodeTraversal = __webpack_require__(72059); +var utils = __webpack_require__(89076); + +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; + +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; + +/* Private methods and helpers */ + +/** + * @spec https://dom.spec.whatwg.org/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw._currentNode[mapChild[type]]; + while (node !== null) { + result = tw._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw._currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw._currentNode) { + return null; + } else { + node = parent; + } + } + } + return null; +} + +/** + * @spec https://dom.spec.whatwg.org/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw._currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw._currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} + + +/* Public API */ + +/** + * Latest version: https://dom.spec.whatwg.org/#treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + if (!root || !root.nodeType) { + utils.NotSupportedError(); + } + + // Read-only properties + this._root = root; + this._whatToShow = Number(whatToShow) || 0; + this._filter = filter || null; + this._active = false; + // Read-write property + this._currentNode = root; +} + +Object.defineProperties(TreeWalker.prototype, { + root: { get: function() { return this._root; } }, + whatToShow: { get: function() { return this._whatToShow; } }, + filter: { get: function() { return this._filter; } }, + + currentNode: { + get: function currentNode() { + return this._currentNode; + }, + set: function setCurrentNode(v) { + if (!(v instanceof Node)) { + throw new TypeError("Not a Node"); // `null` is also not a node + } + this._currentNode = v; + }, + }, + + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + _internalFilter: { value: function _internalFilter(node) { + /* jshint bitwise: false */ + var result, filter; + if (this._active) { + utils.InvalidStateError(); + } + + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) { + return NodeFilter.FILTER_SKIP; + } + + filter = this._filter; + if (filter === null) { + result = NodeFilter.FILTER_ACCEPT; + } else { + this._active = true; + try { + if (typeof filter === 'function') { + result = filter(node); + } else { + result = filter.acceptNode(node); + } + } finally { + this._active = false; + } + } + + // Note that coercing to a number means that + // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT) + // `false` becomes `0` (neither accept, reject, or skip) + return (+result); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-parentnode + * @based on WebKit's TreeWalker::parentNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L50 + * @method + * @return {Node|null} + */ + parentNode: { value: function parentNode() { + var node = this._currentNode; + while (node !== this.root) { + node = node.parentNode; + if (node === null) { + return null; + } + if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + return null; + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: { value: function firstChild() { + return traverseChildren(this, 'first'); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: { value: function lastChild() { + return traverseChildren(this, 'last'); + }}, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: { value: function previousSibling() { + return traverseSiblings(this, 'previous'); + }}, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: { value: function nextSibling() { + return traverseSiblings(this, 'next'); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-previousnode + * @based on WebKit's TreeWalker::previousNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L181 + * @method + * @return {Node|null} + */ + previousNode: { value: function previousNode() { + var node, result, previousSibling, lastChild; + node = this._currentNode; + while (node !== this._root) { + for (previousSibling = node.previousSibling; + previousSibling; + previousSibling = node.previousSibling) { + node = previousSibling; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_REJECT) { + continue; + } + for (lastChild = node.lastChild; + lastChild; + lastChild = node.lastChild) { + node = lastChild; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_REJECT) { + break; + } + } + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + return null; + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L228 + * @method + * @return {Node|null} + */ + nextNode: { value: function nextNode() { + var node, result, firstChild, nextSibling; + node = this._currentNode; + result = NodeFilter.FILTER_ACCEPT; + + CHILDREN: + while (true) { + for (firstChild = node.firstChild; + firstChild; + firstChild = node.firstChild) { + node = firstChild; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } else if (result === NodeFilter.FILTER_REJECT) { + break; + } + } + for (nextSibling = NodeTraversal.nextSkippingChildren(node, this.root); + nextSibling; + nextSibling = NodeTraversal.nextSkippingChildren(node, this.root)) { + node = nextSibling; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } else if (result === NodeFilter.FILTER_SKIP) { + continue CHILDREN; + } + } + return null; + } + }}, + + /** For compatibility with web-platform-tests. */ + toString: { value: function toString() { + return "[object TreeWalker]"; + }}, +}); + + +/***/ }), + +/***/ 64259: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Event = __webpack_require__(13441); + +module.exports = UIEvent; + +function UIEvent() { + // Just use the superclass constructor to initialize + Event.call(this); + this.view = null; // FF uses the current window + this.detail = 0; +} +UIEvent.prototype = Object.create(Event.prototype, { + constructor: { value: UIEvent }, + initUIEvent: { value: function(type, bubbles, cancelable, view, detail) { + this.initEvent(type, bubbles, cancelable); + this.view = view; + this.detail = detail; + }} +}); + + +/***/ }), + +/***/ 85184: +/***/ ((module) => { + +"use strict"; + +module.exports = URL; + +function URL(url) { + if (!url) return Object.create(URL.prototype); + // Can't use String.trim() since it defines whitespace differently than HTML + this.url = url.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, ""); + + // See http://tools.ietf.org/html/rfc3986#appendix-B + // and https://url.spec.whatwg.org/#parsing + var match = URL.pattern.exec(this.url); + if (match) { + if (match[2]) this.scheme = match[2]; + if (match[4]) { + // parse username/password + var userinfo = match[4].match(URL.userinfoPattern); + if (userinfo) { + this.username = userinfo[1]; + this.password = userinfo[3]; + match[4] = match[4].substring(userinfo[0].length); + } + if (match[4].match(URL.portPattern)) { + var pos = match[4].lastIndexOf(':'); + this.host = match[4].substring(0, pos); + this.port = match[4].substring(pos+1); + } + else { + this.host = match[4]; + } + } + if (match[5]) this.path = match[5]; + if (match[6]) this.query = match[7]; + if (match[8]) this.fragment = match[9]; + } +} + +URL.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; +URL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/; +URL.portPattern = /:\d+$/; +URL.authorityPattern = /^[^:\/?#]+:\/\//; +URL.hierarchyPattern = /^[^:\/?#]+:\//; + +// Return a percentEncoded version of s. +// S should be a single-character string +// XXX: needs to do utf-8 encoding? +URL.percentEncode = function percentEncode(s) { + var c = s.charCodeAt(0); + if (c < 256) return "%" + c.toString(16); + else throw Error("can't percent-encode codepoints > 255 yet"); +}; + +URL.prototype = { + constructor: URL, + + // XXX: not sure if this is the precise definition of absolute + isAbsolute: function() { return !!this.scheme; }, + isAuthorityBased: function() { + return URL.authorityPattern.test(this.url); + }, + isHierarchical: function() { + return URL.hierarchyPattern.test(this.url); + }, + + toString: function() { + var s = ""; + if (this.scheme !== undefined) s += this.scheme + ":"; + if (this.isAbsolute()) { + s += '//'; + if (this.username || this.password) { + s += this.username || ''; + if (this.password) { + s += ':' + this.password; + } + s += '@'; + } + if (this.host) { + s += this.host; + } + } + if (this.port !== undefined) s += ":" + this.port; + if (this.path !== undefined) s += this.path; + if (this.query !== undefined) s += "?" + this.query; + if (this.fragment !== undefined) s += "#" + this.fragment; + return s; + }, + + // See: http://tools.ietf.org/html/rfc3986#section-5.2 + // and https://url.spec.whatwg.org/#constructors + resolve: function(relative) { + var base = this; // The base url we're resolving against + var r = new URL(relative); // The relative reference url to resolve + var t = new URL(); // The absolute target url we will return + + if (r.scheme !== undefined) { + t.scheme = r.scheme; + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.scheme = base.scheme; + if (r.host !== undefined) { + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.username = base.username; + t.password = base.password; + t.host = base.host; + t.port = base.port; + if (!r.path) { // undefined or empty + t.path = base.path; + if (r.query !== undefined) + t.query = r.query; + else + t.query = base.query; + } + else { + if (r.path.charAt(0) === "/") { + t.path = remove_dot_segments(r.path); + } + else { + t.path = merge(base.path, r.path); + t.path = remove_dot_segments(t.path); + } + t.query = r.query; + } + } + } + t.fragment = r.fragment; + + return t.toString(); + + + function merge(basepath, refpath) { + if (base.host !== undefined && !base.path) + return "/" + refpath; + + var lastslash = basepath.lastIndexOf("/"); + if (lastslash === -1) + return refpath; + else + return basepath.substring(0, lastslash+1) + refpath; + } + + function remove_dot_segments(path) { + if (!path) return path; // For "" or undefined + + var output = ""; + while(path.length > 0) { + if (path === "." || path === "..") { + path = ""; + break; + } + + var twochars = path.substring(0,2); + var threechars = path.substring(0,3); + var fourchars = path.substring(0,4); + if (threechars === "../") { + path = path.substring(3); + } + else if (twochars === "./") { + path = path.substring(2); + } + else if (threechars === "/./") { + path = "/" + path.substring(3); + } + else if (twochars === "/." && path.length === 2) { + path = "/"; + } + else if (fourchars === "/../" || + (threechars === "/.." && path.length === 3)) { + path = "/" + path.substring(4); + + output = output.replace(/\/?[^\/]*$/, ""); + } + else { + var segment = path.match(/(\/?([^\/]*))/)[0]; + output += segment; + path = path.substring(segment.length); + } + } + + return output; + } + }, +}; + + +/***/ }), + +/***/ 65531: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var URL = __webpack_require__(85184); + +module.exports = URLUtils; + +// Allow the `x == null` pattern. This is eslint's "null: 'ignore'" option, +// but jshint doesn't support this. +/* jshint eqeqeq: false */ + +// This is an abstract superclass for Location, HTMLAnchorElement and +// other types that have the standard complement of "URL decomposition +// IDL attributes". This is now standardized as URLUtils, see: +// https://url.spec.whatwg.org/#urlutils +// Subclasses must define a getter/setter on href. +// The getter and setter methods parse and rebuild the URL on each +// invocation; there is no attempt to cache the value and be more efficient +function URLUtils() {} +URLUtils.prototype = Object.create(Object.prototype, { + + _url: { get: function() { + // XXX: this should do the "Reinitialize url" steps, and "null" should + // be a valid return value. + return new URL(this.href); + } }, + + protocol: { + get: function() { + var url = this._url; + if (url && url.scheme) return url.scheme + ":"; + else return ":"; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/:+$/, ""); + v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.scheme = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + host: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host + (url.port ? (":" + url.port) : ""); + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + delete url.port; + output = url.toString(); + } + } + this.href = output; + }, + }, + + hostname: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/^\/+/, ""); + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + port: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased() && url.port!==undefined) + return url.port; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = '' + v; + v = v.replace(/[^0-9].*$/, ""); + v = v.replace(/^0+/, ""); + if (v.length === 0) v = "0"; + if (parseInt(v, 10) <= 65535) { + url.port = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + pathname: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isHierarchical()) + return url.path; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) !== "/") + v = "/" + v; + v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL.percentEncode); + url.path = v; + output = url.toString(); + } + this.href = output; + }, + }, + + search: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isHierarchical() && url.query!==undefined) + return "?" + url.query; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) === "?") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.query = v; + output = url.toString(); + } + this.href = output; + }, + }, + + hash: { + get: function() { + var url = this._url; + if (url == null || url.fragment == null || url.fragment === '') { + return ""; + } else { + return "#" + url.fragment; + } + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + + if (v.charAt(0) === "#") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.fragment = v; + output = url.toString(); + + this.href = output; + }, + }, + + username: { + get: function() { + var url = this._url; + return url.username || ''; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL.percentEncode); + url.username = v; + output = url.toString(); + } + this.href = output; + }, + }, + + password: { + get: function() { + var url = this._url; + return url.password || ''; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + if (v==='') { + url.password = null; + } else { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL.percentEncode); + url.password = v; + } + output = url.toString(); + } + this.href = output; + }, + }, + + origin: { get: function() { + var url = this._url; + if (url == null) { return ''; } + var originForPort = function(defaultPort) { + var origin = [url.scheme, url.host, +url.port || defaultPort]; + // XXX should be "unicode serialization" + return origin[0] + '://' + origin[1] + + (origin[2] === defaultPort ? '' : (':' + origin[2])); + }; + switch (url.scheme) { + case 'ftp': + return originForPort(21); + case 'gopher': + return originForPort(70); + case 'http': + case 'ws': + return originForPort(80); + case 'https': + case 'wss': + return originForPort(443); + default: + // this is what chrome does + return url.scheme + '://'; + } + } }, + + /* + searchParams: { + get: function() { + var url = this._url; + // XXX + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + // XXX + this.href = output; + }, + }, + */ +}); + +URLUtils._inherit = function(proto) { + // copy getters/setters from URLUtils to o. + Object.getOwnPropertyNames(URLUtils.prototype).forEach(function(p) { + if (p==='constructor' || p==='href') { return; } + var desc = Object.getOwnPropertyDescriptor(URLUtils.prototype, p); + Object.defineProperty(proto, p, desc); + }); +}; + + +/***/ }), + +/***/ 21865: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var DOMImplementation = __webpack_require__(80931); +var EventTarget = __webpack_require__(22356); +var Location = __webpack_require__(63738); +var utils = __webpack_require__(89076); + +module.exports = Window; + +function Window(document) { + this.document = document || new DOMImplementation(null).createHTMLDocument(""); + this.document._scripting_enabled = true; + this.document.defaultView = this; + this.location = new Location(this, this.document._address || 'about:blank'); +} + +Window.prototype = Object.create(EventTarget.prototype, { + console: { value: console }, + history: { value: { + back: utils.nyi, + forward: utils.nyi, + go: utils.nyi + }}, + navigator: { value: __webpack_require__(94993) }, + + // Self-referential properties + window: { get: function() { return this; }}, + self: { get: function() { return this; }}, + frames: { get: function() { return this; }}, + + // Self-referential properties for a top-level window + parent: { get: function() { return this; }}, + top: { get: function() { return this; }}, + + // We don't support any other windows for now + length: { value: 0 }, // no frames + frameElement: { value: null }, // not part of a frame + opener: { value: null }, // not opened by another window + + // The onload event handler. + // XXX: need to support a bunch of other event types, too, + // and have them interoperate with document.body. + + onload: { + get: function() { + return this._getEventHandler("load"); + }, + set: function(v) { + this._setEventHandler("load", v); + } + }, + + // XXX This is a completely broken implementation + getComputedStyle: { value: function getComputedStyle(elt) { + return elt.style; + }} + +}); + +utils.expose(__webpack_require__(23811), Window); +utils.expose(__webpack_require__(31575), Window); + + +/***/ }), + +/***/ 23811: +/***/ ((module) => { + +"use strict"; + + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval +}; + +module.exports = WindowTimers; + + +/***/ }), + +/***/ 6548: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(89076); + +exports.property = function(attr) { + if (Array.isArray(attr.type)) { + var valid = Object.create(null); + attr.type.forEach(function(val) { + valid[val.value || val] = val.alias || val; + }); + var missingValueDefault = attr.missing; + if (missingValueDefault===undefined) { missingValueDefault = null; } + var invalidValueDefault = attr.invalid; + if (invalidValueDefault===undefined) { invalidValueDefault = missingValueDefault; } + return { + get: function() { + var v = this._getattr(attr.name); + if (v === null) return missingValueDefault; + + v = valid[v.toLowerCase()]; + if (v !== undefined) return v; + if (invalidValueDefault !== null) return invalidValueDefault; + return v; + }, + set: function(v) { + this._setattr(attr.name, v); + } + }; + } + else if (attr.type === Boolean) { + return { + get: function() { + return this.hasAttribute(attr.name); + }, + set: function(v) { + if (v) { + this._setattr(attr.name, ''); + } + else { + this.removeAttribute(attr.name); + } + } + }; + } + else if (attr.type === Number || + attr.type === "long" || + attr.type === "unsigned long" || + attr.type === "limited unsigned long with fallback") { + return numberPropDesc(attr); + } + else if (!attr.type || attr.type === String) { + return { + get: function() { return this._getattr(attr.name) || ''; }, + set: function(v) { + if (attr.treatNullAsEmptyString && v === null) { v = ''; } + this._setattr(attr.name, v); + } + }; + } + else if (typeof attr.type === 'function') { + return attr.type(attr.name, attr); + } + throw new Error('Invalid attribute definition'); +}; + +// See http://www.whatwg.org/specs/web-apps/current-work/#reflect +// +// defval is the default value. If it is a function, then that function +// will be invoked as a method of the element to obtain the default. +// If no default is specified for a given attribute, then the default +// depends on the type of the attribute, but since this function handles +// 4 integer cases, you must specify the default value in each call +// +// min and max define a valid range for getting the attribute. +// +// setmin defines a minimum value when setting. If the value is less +// than that, then throw INDEX_SIZE_ERR. +// +// Conveniently, JavaScript's parseInt function appears to be +// compatible with HTML's 'rules for parsing integers' +function numberPropDesc(a) { + var def; + if(typeof a.default === 'function') { + def = a.default; + } + else if(typeof a.default === 'number') { + def = function() { return a.default; }; + } + else { + def = function() { utils.assert(false, typeof a.default); }; + } + var unsigned_long = (a.type === 'unsigned long'); + var signed_long = (a.type === 'long'); + var unsigned_fallback = (a.type === 'limited unsigned long with fallback'); + var min = a.min, max = a.max, setmin = a.setmin; + if (min === undefined) { + if (unsigned_long) min = 0; + if (signed_long) min = -0x80000000; + if (unsigned_fallback) min = 1; + } + if (max === undefined) { + if (unsigned_long || signed_long || unsigned_fallback) max = 0x7FFFFFFF; + } + + return { + get: function() { + var v = this._getattr(a.name); + var n = a.float ? parseFloat(v) : parseInt(v, 10); + if (v === null || !isFinite(n) || (min !== undefined && n < min) || (max !== undefined && n > max)) { + return def.call(this); + } + if (unsigned_long || signed_long || unsigned_fallback) { + if (!/^[ \t\n\f\r]*[-+]?[0-9]/.test(v)) { return def.call(this); } + n = n|0; // jshint ignore:line + } + return n; + }, + set: function(v) { + if (!a.float) { v = Math.floor(v); } + if (setmin !== undefined && v < setmin) { + utils.IndexSizeError(a.name + ' set to ' + v); + } + if (unsigned_long) { + v = (v < 0 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (unsigned_fallback) { + v = (v < 1 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (signed_long) { + v = (v < -0x80000000 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } + this._setattr(a.name, String(v)); + } + }; +} + +// This is a utility function for setting up change handler functions +// for attributes like 'id' that require special handling when they change. +exports.registerChangeHandler = function(c, name, handler) { + var p = c.prototype; + + // If p does not already have its own _attributeChangeHandlers + // then create one for it, inheriting from the inherited + // _attributeChangeHandlers. At the top (for the Element class) the + // _attributeChangeHandlers object will be created with a null prototype. + if (!Object.prototype.hasOwnProperty.call(p, '_attributeChangeHandlers')) { + p._attributeChangeHandlers = + Object.create(p._attributeChangeHandlers || null); + } + + p._attributeChangeHandlers[name] = handler; +}; + + +/***/ }), + +/***/ 66139: +/***/ ((__unused_webpack_module, exports) => { + +/* + * This file defines Domino behaviour that can be externally configured. + * To change these settings, set the relevant global property *before* + * you call `require("domino")`. + */ + +exports.h = !globalThis.__domino_frozen__; + + +/***/ }), + +/***/ 5244: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var attributes = __webpack_require__(6548); +var isApiWritable = (__webpack_require__(66139)/* .isApiWritable */ .h); + +module.exports = function(spec, defaultConstructor, tagList, tagNameToImpl) { + var c = spec.ctor; + if (c) { + var props = spec.props || {}; + + if (spec.attributes) { + for (var n in spec.attributes) { + var attr = spec.attributes[n]; + if (typeof attr !== 'object' || Array.isArray(attr)) attr = {type: attr}; + if (!attr.name) attr.name = n.toLowerCase(); + props[n] = attributes.property(attr); + } + } + + props.constructor = { value : c, writable: isApiWritable }; + c.prototype = Object.create((spec.superclass || defaultConstructor).prototype, props); + if (spec.events) { + addEventHandlers(c, spec.events); + } + tagList[spec.name] = c; + } + else { + c = defaultConstructor; + } + + (spec.tags || spec.tag && [spec.tag] || []).forEach(function(tag) { + tagNameToImpl[tag] = c; + }); + + return c; +}; + +function EventHandlerBuilder(body, document, form, element) { + this.body = body; + this.document = document; + this.form = form; + this.element = element; +} + +EventHandlerBuilder.prototype.build = function () { + return () => {}; +}; + +function EventHandlerChangeHandler(elt, name, oldval, newval) { + var doc = elt.ownerDocument || Object.create(null); + var form = elt.form || Object.create(null); + elt[name] = new EventHandlerBuilder(newval, doc, form, elt).build(); +} + +function addEventHandlers(c, eventHandlerTypes) { + var p = c.prototype; + eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(p, "on" + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); + }, + }); + + // Define special behavior for the content attribute as well + attributes.registerChangeHandler(c, "on" + type, EventHandlerChangeHandler); + }); +} + + +/***/ }), + +/***/ 18196: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = { + Event: __webpack_require__(13441), + UIEvent: __webpack_require__(64259), + MouseEvent: __webpack_require__(21440), + CustomEvent: __webpack_require__(22112) +}; + + +/***/ }), + +/***/ 96324: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Node = __webpack_require__(97537); +var Element = __webpack_require__(77301); +var CSSStyleDeclaration = __webpack_require__(53141); +var utils = __webpack_require__(89076); +var URLUtils = __webpack_require__(65531); +var defineElement = __webpack_require__(5244); + +var htmlElements = exports.elements = {}; +var htmlNameToImpl = Object.create(null); + +exports.createElement = function(doc, localName, prefix) { + var impl = htmlNameToImpl[localName] || HTMLUnknownElement; + return new impl(doc, localName, prefix); +}; + +function define(spec) { + return defineElement(spec, HTMLElement, htmlElements, htmlNameToImpl); +} + +function URL(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return ''; } + var url = this.doc._resolve(v); + return (url === null) ? v : url; + }, + set: function(value) { + this._setattr(attr, value); + } + }; +} + +function CORS(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return null; } + if (v.toLowerCase() === 'use-credentials') { return 'use-credentials'; } + return 'anonymous'; + }, + set: function(value) { + if (value===null || value===undefined) { + this.removeAttribute(attr); + } else { + this._setattr(attr, value); + } + } + }; +} + +const REFERRER = { + type: ["", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"], + missing: '', +}; + + +// XXX: the default value for tabIndex should be 0 if the element is +// focusable and -1 if it is not. But the full definition of focusable +// is actually hard to compute, so for now, I'll follow Firefox and +// just base the default value on the type of the element. +var focusableElements = { + "A":true, "LINK":true, "BUTTON":true, "INPUT":true, + "SELECT":true, "TEXTAREA":true, "COMMAND":true +}; + +var HTMLFormElement = function(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._form = null; // Prevent later deoptimization +}; + +var HTMLElement = exports.HTMLElement = define({ + superclass: Element, + name: 'HTMLElement', + ctor: function HTMLElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.HTML, prefix); + }, + props: { + dangerouslySetInnerHTML: { + set: function (v) { + this._innerHTML = v; + }, + }, + innerHTML: { + get: function() { + return this.serialize(); + }, + set: function(v) { + var parser = this.ownerDocument.implementation.mozHTMLParser( + this.ownerDocument._address, + this); + parser.parse(v===null ? '' : String(v), true); + + // Remove any existing children of this node + var target = (this instanceof htmlNameToImpl.template) ? + this.content : this; + while(target.hasChildNodes()) + target.removeChild(target.firstChild); + + // Now copy newly parsed children to this node + target.appendChild(parser._asDocumentFragment()); + } + }, + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }, set: function(v) { + if (v===null||v===undefined) { v = ''; } + this._setattr('style', String(v)); + }}, + + // These can't really be implemented server-side in a reasonable way. + blur: { value: function() {}}, + focus: { value: function() {}}, + forceSpellCheck: { value: function() {}}, + + click: { value: function() { + if (this._click_in_progress) return; + this._click_in_progress = true; + try { + if (this._pre_click_activation_steps) + this._pre_click_activation_steps(); + + var event = this.ownerDocument.createEvent("MouseEvent"); + event.initMouseEvent("click", true, true, + this.ownerDocument.defaultView, 1, + 0, 0, 0, 0, + // These 4 should be initialized with + // the actually current keyboard state + // somehow... + false, false, false, false, + 0, null + ); + + // Dispatch this as an untrusted event since it is synthetic + var success = this.dispatchEvent(event); + + if (success) { + if (this._post_click_activation_steps) + this._post_click_activation_steps(event); + } + else { + if (this._cancelled_activation_steps) + this._cancelled_activation_steps(); + } + } + finally { + this._click_in_progress = false; + } + }}, + submit: { value: utils.nyi }, + }, + attributes: { + title: String, + lang: String, + dir: {type: ["ltr", "rtl", "auto"], missing: ''}, + draggable: {type: ["true", "false"], treatNullAsEmptyString: true }, + spellcheck: {type: ["true", "false"], missing: ''}, + enterKeyHint: {type: ["enter", "done", "go", "next", "previous", "search", "send"], missing: ''}, + autoCapitalize: {type: ["off", "on", "none", "sentences", "words", "characters"], missing: '' }, + autoFocus: Boolean, + accessKey: String, + nonce: String, + hidden: Boolean, + translate: {type: ["no", "yes"], missing: '' }, + tabIndex: {type: "long", default: function() { + if (this.tagName in focusableElements || + this.contentEditable) + return 0; + else + return -1; + }} + }, + events: [ + "abort", "canplay", "canplaythrough", "change", "click", "contextmenu", + "cuechange", "dblclick", "drag", "dragend", "dragenter", "dragleave", + "dragover", "dragstart", "drop", "durationchange", "emptied", "ended", + "input", "invalid", "keydown", "keypress", "keyup", "loadeddata", + "loadedmetadata", "loadstart", "mousedown", "mousemove", "mouseout", + "mouseover", "mouseup", "mousewheel", "pause", "play", "playing", + "progress", "ratechange", "readystatechange", "reset", "seeked", + "seeking", "select", "show", "stalled", "submit", "suspend", + "timeupdate", "volumechange", "waiting", + + // These last 5 event types will be overriden by HTMLBodyElement + "blur", "error", "focus", "load", "scroll" + ] +}); + + +// XXX: reflect contextmenu as contextMenu, with element type + + +// style: the spec doesn't call this a reflected attribute. +// may want to handle it manually. + +// contentEditable: enumerated, not clear if it is actually +// reflected or requires custom getter/setter. Not listed as +// "limited to known values". Raises syntax_err on bad setting, +// so I think this is custom. + +// contextmenu: content is element id, idl type is an element +// draggable: boolean, but not a reflected attribute +// dropzone: reflected SettableTokenList, experimental, so don't +// implement it right away. + +// data-* attributes: need special handling in setAttribute? +// Or maybe that isn't necessary. Can I just scan the attribute list +// when building the dataset? Liveness and caching issues? + +// microdata attributes: many are simple reflected attributes, but +// I'm not going to implement this now. + + +var HTMLUnknownElement = define({ + name: 'HTMLUnknownElement', + ctor: function HTMLUnknownElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + + +var formAssociatedProps = { + // See http://www.w3.org/TR/html5/association-of-controls-and-forms.html#form-owner + form: { get: function() { + return this._form; + }} +}; + +define({ + tag: 'a', + name: 'HTMLAnchorElement', + ctor: function HTMLAnchorElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + _post_click_activation_steps: { value: function(e) { + if (this.href) { + // Follow the link + // XXX: this is just a quick hack + // XXX: the HTML spec probably requires more than this + this.ownerDocument.defaultView.location = this.href; + } + }}, + }, + attributes: { + href: URL, + ping: String, + download: String, + target: String, + rel: String, + media: String, + hreflang: String, + type: String, + referrerPolicy: REFERRER, + // Obsolete + coords: String, + charset: String, + name: String, + rev: String, + shape: String, + } +}); +// Latest WhatWG spec says these methods come via HTMLHyperlinkElementUtils +URLUtils._inherit(htmlNameToImpl.a.prototype); + +define({ + tag: 'area', + name: 'HTMLAreaElement', + ctor: function HTMLAreaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + target: String, + download: String, + rel: String, + media: String, + href: URL, + hreflang: String, + type: String, + shape: String, + coords: String, + ping: String, + // XXX: also reflect relList + referrerPolicy: REFERRER, + // Obsolete + noHref: Boolean, + } +}); +// Latest WhatWG spec says these methods come via HTMLHyperlinkElementUtils +URLUtils._inherit(htmlNameToImpl.area.prototype); + +define({ + tag: 'br', + name: 'HTMLBRElement', + ctor: function HTMLBRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + clear: String + }, +}); + +define({ + tag: 'base', + name: 'HTMLBaseElement', + ctor: function HTMLBaseElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "target": String + } +}); + + +define({ + tag: 'body', + name: 'HTMLBodyElement', + ctor: function HTMLBodyElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + // Certain event handler attributes on a tag actually set + // handlers for the window rather than just that element. Define + // getters and setters for those here. Note that some of these override + // properties on HTMLElement.prototype. + // XXX: If I add support for , these have to go there, too + // XXX + // When the Window object is implemented, these attribute will have + // to work with the same-named attributes on the Window. + events: [ + "afterprint", "beforeprint", "beforeunload", "blur", "error", + "focus","hashchange", "load", "message", "offline", "online", + "pagehide", "pageshow","popstate","resize","scroll","storage","unload", + ], + attributes: { + // Obsolete + text: { type: String, treatNullAsEmptyString: true }, + link: { type: String, treatNullAsEmptyString: true }, + vLink: { type: String, treatNullAsEmptyString: true }, + aLink: { type: String, treatNullAsEmptyString: true }, + bgColor: { type: String, treatNullAsEmptyString: true }, + background: String, + } +}); + +define({ + tag: 'button', + name: 'HTMLButtonElement', + ctor: function HTMLButtonElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + value: String, + disabled: Boolean, + autofocus: Boolean, + type: { type:["submit", "reset", "button", "menu"], missing: 'submit' }, + formTarget: String, + formAction: URL, + formNoValidate: Boolean, + formMethod: { type: ["get", "post", "dialog"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + } +}); + +define({ + tag: 'dl', + name: 'HTMLDListElement', + ctor: function HTMLDListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'data', + name: 'HTMLDataElement', + ctor: function HTMLDataElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: String, + } +}); + +define({ + tag: 'datalist', + name: 'HTMLDataListElement', + ctor: function HTMLDataListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'details', + name: 'HTMLDetailsElement', + ctor: function HTMLDetailsElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "open": Boolean + } +}); + +define({ + tag: 'div', + name: 'HTMLDivElement', + ctor: function HTMLDivElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); + +define({ + tag: 'embed', + name: 'HTMLEmbedElement', + ctor: function HTMLEmbedElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + type: String, + width: String, + height: String, + // Obsolete + align: String, + name: String, + } +}); + +define({ + tag: 'fieldset', + name: 'HTMLFieldSetElement', + ctor: function HTMLFieldSetElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + disabled: Boolean, + name: String + } +}); + +define({ + tag: 'form', + name: 'HTMLFormElement', + ctor: function HTMLFormElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + action: String, + autocomplete: {type:['on', 'off'], missing: 'on'}, + name: String, + acceptCharset: {name: "accept-charset"}, + target: String, + noValidate: Boolean, + method: { type: ["get", "post", "dialog"], invalid: 'get', missing: 'get' }, + // Both enctype and encoding reflect the enctype content attribute + enctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + encoding: {name: 'enctype', type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + } +}); + +define({ + tag: 'hr', + name: 'HTMLHRElement', + ctor: function HTMLHRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + color: String, + noShade: Boolean, + size: String, + width: String, + }, +}); + +define({ + tag: 'head', + name: 'HTMLHeadElement', + ctor: function HTMLHeadElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tags: ['h1','h2','h3','h4','h5','h6'], + name: 'HTMLHeadingElement', + ctor: function HTMLHeadingElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + }, +}); + +define({ + tag: 'html', + name: 'HTMLHtmlElement', + ctor: function HTMLHtmlElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + xmlns: URL, + // Obsolete + version: String + } +}); + +define({ + tag: 'iframe', + name: 'HTMLIFrameElement', + ctor: function HTMLIFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + srcdoc: String, + name: String, + width: String, + height: String, + // XXX: sandbox is a reflected settable token list + seamless: Boolean, + allow: Boolean, + allowFullscreen: Boolean, + allowUserMedia: Boolean, + allowPaymentRequest: Boolean, + referrerPolicy: REFERRER, + loading: { type:['eager','lazy'], treatNullAsEmptyString: true }, + // Obsolete + align: String, + scrolling: String, + frameBorder: String, + longDesc: URL, + marginHeight: { type: String, treatNullAsEmptyString: true }, + marginWidth: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'img', + name: 'HTMLImageElement', + ctor: function HTMLImageElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + src: URL, + srcset: String, + crossOrigin: CORS, + useMap: String, + isMap: Boolean, + sizes: String, + height: { type: "unsigned long", default: 0 }, + width: { type: "unsigned long", default: 0 }, + referrerPolicy: REFERRER, + loading: { type:['eager','lazy'], missing: '' }, + // Obsolete: + name: String, + lowsrc: URL, + align: String, + hspace: { type: "unsigned long", default: 0 }, + vspace: { type: "unsigned long", default: 0 }, + longDesc: URL, + border: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'input', + name: 'HTMLInputElement', + ctor: function HTMLInputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + _post_click_activation_steps: { value: function(e) { + if (this.type === 'checkbox') { + this.checked = !this.checked; + } + else if (this.type === 'radio') { + var group = this.form.getElementsByName(this.name); + for (var i=group.length-1; i >= 0; i--) { + var el = group[i]; + el.checked = (el === this); + } + } + }}, + }, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + accept: String, + alt: String, + max: String, + min: String, + pattern: String, + placeholder: String, + step: String, + dirName: String, + defaultValue: {name: 'value'}, + multiple: Boolean, + required: Boolean, + readOnly: Boolean, + checked: Boolean, + value: String, + src: URL, + defaultChecked: {name: 'checked', type: Boolean}, + size: {type: 'unsigned long', default: 20, min: 1, setmin: 1}, + width: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, + height: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, + minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + autocomplete: String, // It's complicated + type: { type: + ["text", "hidden", "search", "tel", "url", "email", "password", + "datetime", "date", "month", "week", "time", "datetime-local", + "number", "range", "color", "checkbox", "radio", "file", "submit", + "image", "reset", "button"], + missing: 'text' }, + formTarget: String, + formNoValidate: Boolean, + formMethod: { type: ["get", "post"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + // Obsolete + align: String, + useMap: String, + } +}); + +define({ + tag: 'keygen', + name: 'HTMLKeygenElement', + ctor: function HTMLKeygenElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + challenge: String, + keytype: { type:["rsa"], missing: '' }, + } +}); + +define({ + tag: 'li', + name: 'HTMLLIElement', + ctor: function HTMLLIElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: {type: "long", default: 0}, + // Obsolete + type: String, + } +}); + +define({ + tag: 'label', + name: 'HTMLLabelElement', + ctor: function HTMLLabelElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + htmlFor: {name: 'for', type: String} + } +}); + +define({ + tag: 'legend', + name: 'HTMLLegendElement', + ctor: function HTMLLegendElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + }, +}); + +define({ + tag: 'link', + name: 'HTMLLinkElement', + ctor: function HTMLLinkElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX Reflect DOMSettableTokenList sizes also DOMTokenList relList + href: URL, + rel: String, + media: String, + hreflang: String, + type: String, + crossOrigin: CORS, + nonce: String, + integrity: String, + referrerPolicy: REFERRER, + imageSizes: String, + imageSrcset: String, + // Obsolete + charset: String, + rev: String, + target: String, + } +}); + +define({ + tag: 'map', + name: 'HTMLMapElement', + ctor: function HTMLMapElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String + } +}); + +define({ + tag: 'menu', + name: 'HTMLMenuElement', + ctor: function HTMLMenuElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX: not quite right, default should be popup if parent element is + // popup. + type: { type: [ 'context', 'popup', 'toolbar' ], missing: 'toolbar' }, + label: String, + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'meta', + name: 'HTMLMetaElement', + ctor: function HTMLMetaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + content: String, + httpEquiv: {name: 'http-equiv', type: String}, + // Obsolete + scheme: String, + } +}); + +define({ + tag: 'meter', + name: 'HTMLMeterElement', + ctor: function HTMLMeterElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps +}); + +define({ + tags: ['ins', 'del'], + name: 'HTMLModElement', + ctor: function HTMLModElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL, + dateTime: String + } +}); + +define({ + tag: 'ol', + name: 'HTMLOListElement', + ctor: function HTMLOListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // Utility function (see the start attribute default value). Returns + // the number of
  • children of this element + _numitems: { get: function() { + var items = 0; + this.childNodes.forEach(function(n) { + if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "LI") + items++; + }); + return items; + }} + }, + attributes: { + type: String, + reversed: Boolean, + start: { + type: "long", + default: function() { + // The default value of the start attribute is 1 unless the list is + // reversed. Then it is the # of li children + if (this.reversed) + return this._numitems; + else + return 1; + } + }, + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'object', + name: 'HTMLObjectElement', + ctor: function HTMLObjectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + data: URL, + type: String, + name: String, + useMap: String, + typeMustMatch: Boolean, + width: String, + height: String, + // Obsolete + align: String, + archive: String, + code: String, + declare: Boolean, + hspace: { type: "unsigned long", default: 0 }, + standby: String, + vspace: { type: "unsigned long", default: 0 }, + codeBase: URL, + codeType: String, + border: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'optgroup', + name: 'HTMLOptGroupElement', + ctor: function HTMLOptGroupElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + disabled: Boolean, + label: String + } +}); + +define({ + tag: 'option', + name: 'HTMLOptionElement', + ctor: function HTMLOptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + form: { get: function() { + var p = this.parentNode; + while (p && p.nodeType === Node.ELEMENT_NODE) { + if (p.localName === 'select') return p.form; + p = p.parentNode; + } + }}, + value: { + get: function() { return this._getattr('value') || this.text; }, + set: function(v) { this._setattr('value', v); }, + }, + text: { + get: function() { + // Strip and collapse whitespace + return this.textContent.replace(/[ \t\n\f\r]+/g, ' ').trim(); + }, + set: function(v) { this.textContent = v; }, + }, + // missing: index + }, + attributes: { + disabled: Boolean, + defaultSelected: {name: 'selected', type: Boolean}, + label: String, + } +}); + +define({ + tag: 'output', + name: 'HTMLOutputElement', + ctor: function HTMLOutputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + // XXX Reflect for/htmlFor as a settable token list + name: String + } +}); + +define({ + tag: 'p', + name: 'HTMLParagraphElement', + ctor: function HTMLParagraphElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); + +define({ + tag: 'param', + name: 'HTMLParamElement', + ctor: function HTMLParamElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + value: String, + // Obsolete + type: String, + valueType: String, + } +}); + +define({ + tags: ['pre',/*legacy elements:*/'listing','xmp'], + name: 'HTMLPreElement', + ctor: function HTMLPreElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + width: { type: "long", default: 0 }, + } +}); + +define({ + tag: 'progress', + name: 'HTMLProgressElement', + ctor: function HTMLProgressElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + max: {type: Number, float: true, default: 1.0, min: 0} + } +}); + +define({ + tags: ['q', 'blockquote'], + name: 'HTMLQuoteElement', + ctor: function HTMLQuoteElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL + } +}); + +define({ + tag: 'script', + name: 'HTMLScriptElement', + ctor: function HTMLScriptElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { + get: function() { + var s = ""; + for(var i = 0, n = this.childNodes.length; i < n; i++) { + var child = this.childNodes[i]; + if (child.nodeType === Node.TEXT_NODE) + s += child._data; + } + return s; + }, + set: function(value) { + this.removeChildren(); + if (value !== null && value !== "") { + this.appendChild(this.ownerDocument.createTextNode(value)); + } + } + } + }, + attributes: { + src: URL, + type: String, + charset: String, + referrerPolicy: REFERRER, + defer: Boolean, + async: Boolean, + nomodule: Boolean, + crossOrigin: CORS, + nonce: String, + integrity: String, + } +}); + +define({ + tag: 'select', + name: 'HTMLSelectElement', + ctor: function HTMLSelectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + options: { get: function() { + return this.getElementsByTagName('option'); + }} + }, + attributes: { + autocomplete: String, // It's complicated + name: String, + disabled: Boolean, + autofocus: Boolean, + multiple: Boolean, + required: Boolean, + size: {type: "unsigned long", default: 0} + } +}); + +define({ + tag: 'span', + name: 'HTMLSpanElement', + ctor: function HTMLSpanElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'style', + name: 'HTMLStyleElement', + ctor: function HTMLStyleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + media: String, + type: String, + scoped: Boolean + } +}); + +define({ + tag: 'caption', + name: 'HTMLTableCaptionElement', + ctor: function HTMLTableCaptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + } +}); + + +define({ + name: 'HTMLTableCellElement', + ctor: function HTMLTableCellElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + colSpan: {type: "unsigned long", default: 1}, + rowSpan: {type: "unsigned long", default: 1}, + //XXX Also reflect settable token list headers + scope: { type: ['row','col','rowgroup','colgroup'], missing: '' }, + abbr: String, + // Obsolete + align: String, + axis: String, + height: String, + width: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + noWrap: Boolean, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tags: ['col', 'colgroup'], + name: 'HTMLTableColElement', + ctor: function HTMLTableColElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + span: {type: 'limited unsigned long with fallback', default: 1, min: 1}, + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + width: String, + } +}); + +define({ + tag: 'table', + name: 'HTMLTableElement', + ctor: function HTMLTableElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + border: String, + frame: String, + rules: String, + summary: String, + width: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + cellPadding: { type: String, treatNullAsEmptyString: true }, + cellSpacing: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'template', + name: 'HTMLTemplateElement', + ctor: function HTMLTemplateElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._contentFragment = doc._templateDoc.createDocumentFragment(); + }, + props: { + content: { get: function() { return this._contentFragment; } }, + serialize: { value: function() { return this.content.serialize(); } } + } +}); + +define({ + tag: 'tr', + name: 'HTMLTableRowElement', + ctor: function HTMLTableRowElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + cells: { get: function() { + return this.querySelectorAll('td,th'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + }, +}); + +define({ + tags: ['thead', 'tfoot', 'tbody'], + name: 'HTMLTableSectionElement', + ctor: function HTMLTableSectionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + } +}); + +define({ + tag: 'textarea', + name: 'HTMLTextAreaElement', + ctor: function HTMLTextAreaElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + type: { get: function() { return 'textarea'; } }, + defaultValue: { + get: function() { return this.textContent; }, + set: function(v) { this.textContent = v; }, + }, + value: { + get: function() { return this.defaultValue; /* never dirty */ }, + set: function(v) { + // This isn't completely correct: according to the spec, this + // should "dirty" the API value, and result in + // `this.value !== this.defaultValue`. But for most of what + // folks want to do, this implementation should be fine: + this.defaultValue = v; + }, + }, + textLength: { get: function() { return this.value.length; } }, + }, + attributes: { + autocomplete: String, // It's complicated + name: String, + disabled: Boolean, + autofocus: Boolean, + placeholder: String, + wrap: String, + dirName: String, + required: Boolean, + readOnly: Boolean, + rows: {type: 'limited unsigned long with fallback', default: 2 }, + cols: {type: 'limited unsigned long with fallback', default: 20 }, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + } +}); + +define({ + tag: 'time', + name: 'HTMLTimeElement', + ctor: function HTMLTimeElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + dateTime: String, + pubDate: Boolean + } +}); + +define({ + tag: 'title', + name: 'HTMLTitleElement', + ctor: function HTMLTitleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { get: function() { + return this.textContent; + }} + } +}); + +define({ + tag: 'ul', + name: 'HTMLUListElement', + ctor: function HTMLUListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + type: String, + // Obsolete + compact: Boolean, + } +}); + +define({ + name: 'HTMLMediaElement', + ctor: function HTMLMediaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + crossOrigin: CORS, + preload: { type:["metadata", "none", "auto", {value: "", alias: "auto"}], missing: 'auto' }, + loop: Boolean, + autoplay: Boolean, + mediaGroup: String, + controls: Boolean, + defaultMuted: {name: "muted", type: Boolean} + } +}); + +define({ + name: 'HTMLAudioElement', + tag: 'audio', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLAudioElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + } +}); + +define({ + name: 'HTMLVideoElement', + tag: 'video', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLVideoElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + }, + attributes: { + poster: URL, + width: {type: "unsigned long", min: 0, default: 0 }, + height: {type: "unsigned long", min: 0, default: 0 } + } +}); + +define({ + tag: 'td', + name: 'HTMLTableDataCellElement', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableDataCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'th', + name: 'HTMLTableHeaderCellElement', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableHeaderCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + }, +}); + +define({ + tag: 'frameset', + name: 'HTMLFrameSetElement', + ctor: function HTMLFrameSetElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'frame', + name: 'HTMLFrameElement', + ctor: function HTMLFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'canvas', + name: 'HTMLCanvasElement', + ctor: function HTMLCanvasElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + getContext: { value: utils.nyi }, + probablySupportsContext: { value: utils.nyi }, + setContext: { value: utils.nyi }, + transferControlToProxy: { value: utils.nyi }, + toDataURL: { value: utils.nyi }, + toBlob: { value: utils.nyi } + }, + attributes: { + width: { type: "unsigned long", default: 300}, + height: { type: "unsigned long", default: 150} + } +}); + +define({ + tag: 'dialog', + name: 'HTMLDialogElement', + ctor: function HTMLDialogElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + show: { value: utils.nyi }, + showModal: { value: utils.nyi }, + close: { value: utils.nyi } + }, + attributes: { + open: Boolean, + returnValue: String + } +}); + +define({ + tag: 'menuitem', + name: 'HTMLMenuItemElement', + ctor: function HTMLMenuItemElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // The menuitem's label + _label: { + get: function() { + var val = this._getattr('label'); + if (val !== null && val !== '') { return val; } + val = this.textContent; + // Strip and collapse whitespace + return val.replace(/[ \t\n\f\r]+/g, ' ').trim(); + } + }, + // The menuitem label IDL attribute + label: { + get: function() { + var val = this._getattr('label'); + if (val !== null) { return val; } + return this._label; + }, + set: function(v) { + this._setattr('label', v); + }, + } + }, + attributes: { + type: { type: ["command","checkbox","radio"], missing: 'command' }, + icon: URL, + disabled: Boolean, + checked: Boolean, + radiogroup: String, + default: Boolean + } +}); + +define({ + tag: 'source', + name: 'HTMLSourceElement', + ctor: function HTMLSourceElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + srcset: String, + sizes: String, + media: String, + src: URL, + type: String, + width: String, + height: String, + } +}); + +define({ + tag: 'track', + name: 'HTMLTrackElement', + ctor: function HTMLTrackElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + srclang: String, + label: String, + default: Boolean, + kind: { type: ["subtitles", "captions", "descriptions", "chapters", "metadata"], missing: 'subtitles', invalid: 'metadata' }, + }, + props: { + NONE: { get: function() { return 0; } }, + LOADING: { get: function() { return 1; } }, + LOADED: { get: function() { return 2; } }, + ERROR: { get: function() { return 3; } }, + readyState: { get: utils.nyi }, + track: { get: utils.nyi } + } +}); + +define({ + // obsolete + tag: 'font', + name: 'HTMLFontElement', + ctor: function HTMLFontElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + color: { type: String, treatNullAsEmptyString: true }, + face: { type: String }, + size: { type: String }, + }, +}); + +define({ + // obsolete + tag: 'dir', + name: 'HTMLDirectoryElement', + ctor: function HTMLDirectoryElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + compact: Boolean, + }, +}); + +define({ + tags: [ + "abbr", "address", "article", "aside", "b", "bdi", "bdo", "cite", "content", "code", + "dd", "dfn", "dt", "em", "figcaption", "figure", "footer", "header", "hgroup", "i", "kbd", + "main", "mark", "nav", "noscript", "rb", "rp", "rt", "rtc", + "ruby", "s", "samp", "section", "small", "strong", "sub", "summary", "sup", "u", "var", "wbr", + // Legacy elements + "acronym", "basefont", "big", "center", "nobr", "noembed", "noframes", + "plaintext", "strike", "tt" + ] +}); + + +/***/ }), + +/***/ 31575: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(89076); + +exports = module.exports = { + CSSStyleDeclaration: __webpack_require__(53141), + CharacterData: __webpack_require__(90086), + Comment: __webpack_require__(17548), + DOMException: __webpack_require__(46364), + DOMImplementation: __webpack_require__(80931), + DOMTokenList: __webpack_require__(82840), + Document: __webpack_require__(35452), + DocumentFragment: __webpack_require__(17948), + DocumentType: __webpack_require__(73092), + Element: __webpack_require__(77301), + HTMLParser: __webpack_require__(91895), + NamedNodeMap: __webpack_require__(49492), + Node: __webpack_require__(97537), + NodeList: __webpack_require__(64965), + NodeFilter: __webpack_require__(383), + ProcessingInstruction: __webpack_require__(81248), + Text: __webpack_require__(58210), + Window: __webpack_require__(21865) +}; + +utils.merge(exports, __webpack_require__(18196)); +utils.merge(exports, (__webpack_require__(96324).elements)); +utils.merge(exports, (__webpack_require__(967).elements)); + + +/***/ }), + +/***/ 31993: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var DOMImplementation = __webpack_require__(80931); +var HTMLParser = __webpack_require__(91895); +var Window = __webpack_require__(21865); +var impl = __webpack_require__(31575); + +exports.createDOMImplementation = function() { + return new DOMImplementation(null); +}; + +exports.createDocument = function(html, force) { + // Previous API couldn't let you pass '' as a document, and that + // yields a slightly different document than createHTMLDocument('') + // does. The new `force` parameter lets you pass '' if you want to. + if (html || force) { + var parser = new HTMLParser(); + parser.parse(html || '', true); + return parser.document(); + } + return new DOMImplementation(null).createHTMLDocument(""); +}; + +exports.createIncrementalHTMLParser = function() { + var parser = new HTMLParser(); + /** API for incremental parser. */ + return { + /** Provide an additional chunk of text to be parsed. */ + write: function(s) { + if (s.length > 0) { + parser.parse(s, false, function() { return true; }); + } + }, + /** + * Signal that we are done providing input text, optionally + * providing one last chunk as a parameter. + */ + end: function(s) { + parser.parse(s || '', true, function() { return true; }); + }, + /** + * Performs a chunk of parsing work, returning at the end of + * the next token as soon as shouldPauseFunc() returns true. + * Returns true iff there is more work to do. + * + * For example: + * ``` + * var incrParser = domino.createIncrementalHTMLParser(); + * incrParser.end('...long html document...'); + * while (true) { + * // Pause every 10ms + * var start = Date.now(); + * var pauseIn10 = function() { return (Date.now() - start) >= 10; }; + * if (!incrParser.process(pauseIn10)) { + * break; + * } + * ...yield to other tasks, do other housekeeping, etc... + * } + * ``` + */ + process: function(shouldPauseFunc) { + return parser.parse('', false, shouldPauseFunc); + }, + /** + * Returns the result of the incremental parse. Valid after + * `this.end()` has been called and `this.process()` has returned + * false. + */ + document: function() { + return parser.document(); + }, + }; +}; + +exports.createWindow = function(html, address) { + var document = exports.createDocument(html); + if (address !== undefined) { document._address = address; } + return new impl.Window(document); +}; + +exports.impl = impl; + +/***/ }), + +/***/ 23509: +/***/ ((module, exports) => { + +"use strict"; + +/* jshint eqnull: true */ +/** + * Zest (https://github.com/chjj/zest) + * A css selector engine. + * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) + * Domino version based on Zest v0.1.3 with bugfixes applied. + */ + +/** + * Helpers + */ + +var window = Object.create(null, { + location: { get: function() { + throw new Error('window.location is not supported.'); + } } +}); + +var compareDocumentPosition = function(a, b) { + return a.compareDocumentPosition(b); +}; + +var order = function(a, b) { + /* jshint bitwise: false */ + return compareDocumentPosition(a, b) & 2 ? 1 : -1; +}; + +var next = function(el) { + while ((el = el.nextSibling) + && el.nodeType !== 1); + return el; +}; + +var prev = function(el) { + while ((el = el.previousSibling) + && el.nodeType !== 1); + return el; +}; + +var child = function(el) { + /*jshint -W084 */ + if (el = el.firstChild) { + while (el.nodeType !== 1 + && (el = el.nextSibling)); + } + return el; +}; + +var lastChild = function(el) { + /*jshint -W084 */ + if (el = el.lastChild) { + while (el.nodeType !== 1 + && (el = el.previousSibling)); + } + return el; +}; + +var parentIsElement = function(n) { + if (!n.parentNode) { return false; } + var nodeType = n.parentNode.nodeType; + // The root `html` element can be a first- or last-child, too. + return nodeType === 1 || nodeType === 9; +}; + +var unquote = function(str) { + if (!str) return str; + var ch = str[0]; + if (ch === '"' || ch === '\'') { + if (str[str.length-1] === ch) { + str = str.slice(1, -1); + } else { + // bad string. + str = str.slice(1); + } + return str.replace(rules.str_escape, function(s) { + var m = /^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(s); + if (!m) { return s.slice(1); } + if (m[2]) { return ''; /* escaped newlines are ignored in strings. */ } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); + } else if (rules.ident.test(str)) { + return decodeid(str); + } else { + // NUMBER, PERCENTAGE, DIMENSION, etc + return str; + } +}; + +var decodeid = function(str) { + return str.replace(rules.escape, function(s) { + var m = /^\\([0-9A-Fa-f]+)/.exec(s); + if (!m) { return s[1]; } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); +}; + +var indexOf = (function() { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf; + } + return function(obj, item) { + var i = this.length; + while (i--) { + if (this[i] === item) return i; + } + return -1; + }; +})(); + +var makeInside = function(start, end) { + var regex = rules.inside.source + .replace(//g, end); + + return new RegExp(regex); +}; + +var replace = function(regex, name, val) { + regex = regex.source; + regex = regex.replace(name, val.source || val); + return new RegExp(regex); +}; + +var truncateUrl = function(url, num) { + return url + .replace(/^(?:\w+:\/\/|\/+)/, '') + .replace(/(?:\/+|\/*#.*?)$/, '') + .split('/', num) + .join('/'); +}; + +/** + * Handle `nth` Selectors + */ + +var parseNth = function(param_, test) { + var param = param_.replace(/\s+/g, '') + , cap; + + if (param === 'even') { + param = '2n+0'; + } else if (param === 'odd') { + param = '2n+1'; + } else if (param.indexOf('n') === -1) { + param = '0n' + param; + } + + cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param); + + return { + group: cap[1] === '-' + ? -(cap[2] || 1) + : +(cap[2] || 1), + offset: cap[4] + ? (cap[3] === '-' ? -cap[4] : +cap[4]) + : 0 + }; +}; + +var nth = function(param_, test, last) { + var param = parseNth(param_) + , group = param.group + , offset = param.offset + , find = !last ? child : lastChild + , advance = !last ? next : prev; + + return function(el) { + if (!parentIsElement(el)) return; + + var rel = find(el.parentNode) + , pos = 0; + + while (rel) { + if (test(rel, el)) pos++; + if (rel === el) { + pos -= offset; + return group && pos + ? (pos % group) === 0 && (pos < 0 === group < 0) + : !pos; + } + rel = advance(rel); + } + }; +}; + +/** + * Simple Selectors + */ + +var selectors = { + '*': (function() { + if (false/*function() { + var el = document.createElement('div'); + el.appendChild(document.createComment('')); + return !!el.getElementsByTagName('*')[0]; + }()*/) {} + return function() { + return true; + }; + })(), + 'type': function(type) { + type = type.toLowerCase(); + return function(el) { + return el.nodeName.toLowerCase() === type; + }; + }, + 'attr': function(key, op, val, i) { + op = operators[op]; + return function(el) { + var attr; + switch (key) { + case 'for': + attr = el.htmlFor; + break; + case 'class': + // className is '' when non-existent + // getAttribute('class') is null + attr = el.className; + if (attr === '' && el.getAttribute('class') == null) { + attr = null; + } + break; + case 'href': + case 'src': + attr = el.getAttribute(key, 2); + break; + case 'title': + // getAttribute('title') can be '' when non-existent sometimes? + attr = el.getAttribute('title') || null; + break; + // careful with attributes with special getter functions + case 'id': + case 'lang': + case 'dir': + case 'accessKey': + case 'hidden': + case 'tabIndex': + case 'style': + if (el.getAttribute) { + attr = el.getAttribute(key); + break; + } + /* falls through */ + default: + if (el.hasAttribute && !el.hasAttribute(key)) { + break; + } + attr = el[key] != null + ? el[key] + : el.getAttribute && el.getAttribute(key); + break; + } + if (attr == null) return; + attr = attr + ''; + if (i) { + attr = attr.toLowerCase(); + val = val.toLowerCase(); + } + return op(attr, val); + }; + }, + ':first-child': function(el) { + return !prev(el) && parentIsElement(el); + }, + ':last-child': function(el) { + return !next(el) && parentIsElement(el); + }, + ':only-child': function(el) { + return !prev(el) && !next(el) && parentIsElement(el); + }, + ':nth-child': function(param, last) { + return nth(param, function() { + return true; + }, last); + }, + ':nth-last-child': function(param) { + return selectors[':nth-child'](param, true); + }, + ':root': function(el) { + return el.ownerDocument.documentElement === el; + }, + ':empty': function(el) { + return !el.firstChild; + }, + ':not': function(sel) { + var test = compileGroup(sel); + return function(el) { + return !test(el); + }; + }, + ':first-of-type': function(el) { + if (!parentIsElement(el)) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = prev(el)) { + if (el.nodeName === type) return; + } + return true; + }, + ':last-of-type': function(el) { + if (!parentIsElement(el)) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = next(el)) { + if (el.nodeName === type) return; + } + return true; + }, + ':only-of-type': function(el) { + return selectors[':first-of-type'](el) + && selectors[':last-of-type'](el); + }, + ':nth-of-type': function(param, last) { + return nth(param, function(rel, el) { + return rel.nodeName === el.nodeName; + }, last); + }, + ':nth-last-of-type': function(param) { + return selectors[':nth-of-type'](param, true); + }, + ':checked': function(el) { + return !!(el.checked || el.selected); + }, + ':indeterminate': function(el) { + return !selectors[':checked'](el); + }, + ':enabled': function(el) { + return !el.disabled && el.type !== 'hidden'; + }, + ':disabled': function(el) { + return !!el.disabled; + }, + ':target': function(el) { + return el.id === window.location.hash.substring(1); + }, + ':focus': function(el) { + return el === el.ownerDocument.activeElement; + }, + ':is': function(sel) { + return compileGroup(sel); + }, + // :matches is an older name for :is; see + // https://github.com/w3c/csswg-drafts/issues/3258 + ':matches': function(sel) { + return selectors[':is'](sel); + }, + ':nth-match': function(param, last) { + var args = param.split(/\s*,\s*/) + , arg = args.shift() + , test = compileGroup(args.join(',')); + + return nth(arg, test, last); + }, + ':nth-last-match': function(param) { + return selectors[':nth-match'](param, true); + }, + ':links-here': function(el) { + return el + '' === window.location + ''; + }, + ':lang': function(param) { + return function(el) { + while (el) { + if (el.lang) return el.lang.indexOf(param) === 0; + el = el.parentNode; + } + }; + }, + ':dir': function(param) { + return function(el) { + while (el) { + if (el.dir) return el.dir === param; + el = el.parentNode; + } + }; + }, + ':scope': function(el, con) { + var context = con || el.ownerDocument; + if (context.nodeType === 9) { + return el === context.documentElement; + } + return el === context; + }, + ':any-link': function(el) { + return typeof el.href === 'string'; + }, + ':local-link': function(el) { + if (el.nodeName) { + return el.href && el.host === window.location.host; + } + var param = +el + 1; + return function(el) { + if (!el.href) return; + + var url = window.location + '' + , href = el + ''; + + return truncateUrl(url, param) === truncateUrl(href, param); + }; + }, + ':default': function(el) { + return !!el.defaultSelected; + }, + ':valid': function(el) { + return el.willValidate || (el.validity && el.validity.valid); + }, + ':invalid': function(el) { + return !selectors[':valid'](el); + }, + ':in-range': function(el) { + return el.value > el.min && el.value <= el.max; + }, + ':out-of-range': function(el) { + return !selectors[':in-range'](el); + }, + ':required': function(el) { + return !!el.required; + }, + ':optional': function(el) { + return !el.required; + }, + ':read-only': function(el) { + if (el.readOnly) return true; + + var attr = el.getAttribute('contenteditable') + , prop = el.contentEditable + , name = el.nodeName.toLowerCase(); + + name = name !== 'input' && name !== 'textarea'; + + return (name || el.disabled) && attr == null && prop !== 'true'; + }, + ':read-write': function(el) { + return !selectors[':read-only'](el); + }, + ':hover': function() { + throw new Error(':hover is not supported.'); + }, + ':active': function() { + throw new Error(':active is not supported.'); + }, + ':link': function() { + throw new Error(':link is not supported.'); + }, + ':visited': function() { + throw new Error(':visited is not supported.'); + }, + ':column': function() { + throw new Error(':column is not supported.'); + }, + ':nth-column': function() { + throw new Error(':nth-column is not supported.'); + }, + ':nth-last-column': function() { + throw new Error(':nth-last-column is not supported.'); + }, + ':current': function() { + throw new Error(':current is not supported.'); + }, + ':past': function() { + throw new Error(':past is not supported.'); + }, + ':future': function() { + throw new Error(':future is not supported.'); + }, + // Non-standard, for compatibility purposes. + ':contains': function(param) { + return function(el) { + var text = el.innerText || el.textContent || el.value || ''; + return text.indexOf(param) !== -1; + }; + }, + ':has': function(param) { + return function(el) { + return find(param, el).length > 0; + }; + } + // Potentially add more pseudo selectors for + // compatibility with sizzle and most other + // selector engines (?). +}; + +/** + * Attribute Operators + */ + +var operators = { + '-': function() { + return true; + }, + '=': function(attr, val) { + return attr === val; + }, + '*=': function(attr, val) { + return attr.indexOf(val) !== -1; + }, + '~=': function(attr, val) { + var i + , s + , f + , l; + + for (s = 0; true; s = i + 1) { + i = attr.indexOf(val, s); + if (i === -1) return false; + f = attr[i - 1]; + l = attr[i + val.length]; + if ((!f || f === ' ') && (!l || l === ' ')) return true; + } + }, + '|=': function(attr, val) { + var i = attr.indexOf(val) + , l; + + if (i !== 0) return; + l = attr[i + val.length]; + + return l === '-' || !l; + }, + '^=': function(attr, val) { + return attr.indexOf(val) === 0; + }, + '$=': function(attr, val) { + var i = attr.lastIndexOf(val); + return i !== -1 && i + val.length === attr.length; + }, + // non-standard + '!=': function(attr, val) { + return attr !== val; + } +}; + +/** + * Combinator Logic + */ + +var combinators = { + ' ': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = el.parentNode) { + if (test(el)) return el; + } + }; + }, + '>': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = el.parentNode) { + return test(el) && el; + } + }; + }, + '+': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = prev(el)) { + return test(el) && el; + } + }; + }, + '~': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = prev(el)) { + if (test(el)) return el; + } + }; + }, + 'noop': function(test) { + return function(el) { + return test(el) && el; + }; + }, + 'ref': function(test, name) { + var node; + + function ref(el) { + var doc = el.ownerDocument + , nodes = doc.getElementsByTagName('*') + , i = nodes.length; + + while (i--) { + node = nodes[i]; + if (ref.test(el)) { + node = null; + return true; + } + } + + node = null; + } + + ref.combinator = function(el) { + if (!node || !node.getAttribute) return; + + var attr = node.getAttribute(name) || ''; + if (attr[0] === '#') attr = attr.substring(1); + + if (attr === el.id && test(node)) { + return node; + } + }; + + return ref; + } +}; + +/** + * Grammar + */ + +var rules = { + escape: /\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g, + str_escape: /(escape)|\\(\n|\r\n?|\f)/g, + nonascii: /[\u00A0-\uFFFF]/, + cssid: /(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/, + qname: /^ *(cssid|\*)/, + simple: /^(?:([.#]cssid)|pseudo|attr)/, + ref: /^ *\/(cssid)\/ */, + combinator: /^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/, + attr: /^\[(cssid)(?:([^\w]?=)(inside))?\]/, + pseudo: /^(:cssid)(?:\((inside)\))?/, + inside: /(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/, + ident: /^(cssid)$/ +}; + +rules.cssid = replace(rules.cssid, 'nonascii', rules.nonascii); +rules.cssid = replace(rules.cssid, 'escape', rules.escape); +rules.qname = replace(rules.qname, 'cssid', rules.cssid); +rules.simple = replace(rules.simple, 'cssid', rules.cssid); +rules.ref = replace(rules.ref, 'cssid', rules.cssid); +rules.attr = replace(rules.attr, 'cssid', rules.cssid); +rules.pseudo = replace(rules.pseudo, 'cssid', rules.cssid); +rules.inside = replace(rules.inside, '[^"\'>]*', rules.inside); +rules.attr = replace(rules.attr, 'inside', makeInside('\\[', '\\]')); +rules.pseudo = replace(rules.pseudo, 'inside', makeInside('\\(', '\\)')); +rules.simple = replace(rules.simple, 'pseudo', rules.pseudo); +rules.simple = replace(rules.simple, 'attr', rules.attr); +rules.ident = replace(rules.ident, 'cssid', rules.cssid); +rules.str_escape = replace(rules.str_escape, 'escape', rules.escape); + +/** + * Compiling + */ + +var compile = function(sel_) { + var sel = sel_.replace(/^\s+|\s+$/g, '') + , test + , filter = [] + , buff = [] + , subject + , qname + , cap + , op + , ref; + + /*jshint -W084 */ + while (sel) { + if (cap = rules.qname.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = decodeid(cap[1]); + buff.push(tok(qname, true)); + } else if (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = '*'; + buff.push(tok(qname, true)); + buff.push(tok(cap)); + } else { + throw new SyntaxError('Invalid selector.'); + } + + while (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + buff.push(tok(cap)); + } + + if (sel[0] === '!') { + sel = sel.substring(1); + subject = makeSubject(); + subject.qname = qname; + buff.push(subject.simple); + } + + if (cap = rules.ref.exec(sel)) { + sel = sel.substring(cap[0].length); + ref = combinators.ref(makeSimple(buff), decodeid(cap[1])); + filter.push(ref.combinator); + buff = []; + continue; + } + + if (cap = rules.combinator.exec(sel)) { + sel = sel.substring(cap[0].length); + op = cap[1] || cap[2] || cap[3]; + if (op === ',') { + filter.push(combinators.noop(makeSimple(buff))); + break; + } + } else { + op = 'noop'; + } + + if (!combinators[op]) { throw new SyntaxError('Bad combinator.'); } + filter.push(combinators[op](makeSimple(buff))); + buff = []; + } + + test = makeTest(filter); + test.qname = qname; + test.sel = sel; + + if (subject) { + subject.lname = test.qname; + + subject.test = test; + subject.qname = subject.qname; + subject.sel = test.sel; + test = subject; + } + + if (ref) { + ref.test = test; + ref.qname = test.qname; + ref.sel = test.sel; + test = ref; + } + + return test; +}; + +var tok = function(cap, qname) { + // qname + if (qname) { + return cap === '*' + ? selectors['*'] + : selectors.type(cap); + } + + // class/id + if (cap[1]) { + return cap[1][0] === '.' + // XXX unescape here? or in attr? + ? selectors.attr('class', '~=', decodeid(cap[1].substring(1)), false) + : selectors.attr('id', '=', decodeid(cap[1].substring(1)), false); + } + + // pseudo-name + // inside-pseudo + if (cap[2]) { + return cap[3] + ? selectors[decodeid(cap[2])](unquote(cap[3])) + : selectors[decodeid(cap[2])]; + } + + // attr name + // attr op + // attr value + if (cap[4]) { + var value = cap[6]; + var i = /["'\s]\s*I$/i.test(value); + if (i) { + value = value.replace(/\s*I$/i, ''); + } + return selectors.attr(decodeid(cap[4]), cap[5] || '-', unquote(value), i); + } + + throw new SyntaxError('Unknown Selector.'); +}; + +var makeSimple = function(func) { + var l = func.length + , i; + + // Potentially make sure + // `el` is truthy. + if (l < 2) return func[0]; + + return function(el) { + if (!el) return; + for (i = 0; i < l; i++) { + if (!func[i](el)) return; + } + return true; + }; +}; + +var makeTest = function(func) { + if (func.length < 2) { + return function(el) { + return !!func[0](el); + }; + } + return function(el) { + var i = func.length; + while (i--) { + if (!(el = func[i](el))) return; + } + return true; + }; +}; + +var makeSubject = function() { + var target; + + function subject(el) { + var node = el.ownerDocument + , scope = node.getElementsByTagName(subject.lname) + , i = scope.length; + + while (i--) { + if (subject.test(scope[i]) && target === el) { + target = null; + return true; + } + } + + target = null; + } + + subject.simple = function(el) { + target = el; + return true; + }; + + return subject; +}; + +var compileGroup = function(sel) { + var test = compile(sel) + , tests = [ test ]; + + while (test.sel) { + test = compile(test.sel); + tests.push(test); + } + + if (tests.length < 2) return test; + + return function(el) { + var l = tests.length + , i = 0; + + for (; i < l; i++) { + if (tests[i](el)) return true; + } + }; +}; + +/** + * Selection + */ + +var find = function(sel, node) { + var results = [] + , test = compile(sel) + , scope = node.getElementsByTagName(test.qname) + , i = 0 + , el; + + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el)) results.push(el); + } + + if (test.sel) { + while (test.sel) { + test = compile(test.sel); + scope = node.getElementsByTagName(test.qname); + i = 0; + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el) && indexOf.call(results, el) === -1) { + results.push(el); + } + } + } + results.sort(order); + } + + return results; +}; + +/** + * Expose + */ + +module.exports = exports = function(sel, context) { + /* when context isn't a DocumentFragment and the selector is simple: */ + var id, r; + if (context.nodeType !== 11 && sel.indexOf(' ') === -1) { + if (sel[0] === '#' && context.rooted && /^#[A-Z_][-A-Z0-9_]*$/i.test(sel)) { + if (context.doc._hasMultipleElementsWithId) { + id = sel.substring(1); + if (!context.doc._hasMultipleElementsWithId(id)) { + r = context.doc.getElementById(id); + return r ? [r] : []; + } + } + } + if (sel[0] === '.' && /^\.\w+$/.test(sel)) { + return context.getElementsByClassName(sel.substring(1)); + } + if (/^\w+$/.test(sel)) { + return context.getElementsByTagName(sel); + } + } + /* do things the hard/slow way */ + return find(sel, context); +}; + +exports.selectors = selectors; +exports.operators = operators; +exports.combinators = combinators; + +exports.matches = function(el, sel) { + var test = { sel: sel }; + do { + test = compile(test.sel); + if (test(el)) { return true; } + } while (test.sel); + return false; +}; + + +/***/ }), + +/***/ 72636: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// The below is a compiled copy of https://github.com/angular/angular/blob/92e41e9cb417223d9888a4c23b4c0e73188f87d0/packages/compiler/src/render3/view/style_parser.ts + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hyphenate = exports.parse = void 0; +/** + * Parses string representation of a style and converts it into object literal. + * + * @param value string representation of style as used in the `style` attribute in HTML. + * Example: `color: red; height: auto`. + * @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height', + * 'auto']` + */ +function parse(value) { + // we use a string array here instead of a string map + // because a string-map is not guaranteed to retain the + // order of the entries whereas a string array can be + // constructed in a [key, value, key, value] format. + const styles = []; + let i = 0; + let parenDepth = 0; + let quote = 0; /* Char.QuoteNone */ + let valueStart = 0; + let propStart = 0; + let currentProp = null; + while (i < value.length) { + const token = value.charCodeAt(i++); + switch (token) { + case 40 /* Char.OpenParen */: + parenDepth++; + break; + case 41 /* Char.CloseParen */: + parenDepth--; + break; + case 39 /* Char.QuoteSingle */: + // valueStart needs to be there since prop values don't + // have quotes in CSS + if (quote === 0 /* Char.QuoteNone */) { + quote = 39 /* Char.QuoteSingle */; + } else if ( + quote === 39 /* Char.QuoteSingle */ && + value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */ + ) { + quote = 0 /* Char.QuoteNone */; + } + break; + case 34 /* Char.QuoteDouble */: + // same logic as above + if (quote === 0 /* Char.QuoteNone */) { + quote = 34 /* Char.QuoteDouble */; + } else if ( + quote === 34 /* Char.QuoteDouble */ && + value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */ + ) { + quote = 0 /* Char.QuoteNone */; + } + break; + case 58 /* Char.Colon */: + if ( + !currentProp && + parenDepth === 0 && + quote === 0 /* Char.QuoteNone */ + ) { + currentProp = hyphenate(value.substring(propStart, i - 1).trim()); + valueStart = i; + } + break; + case 59 /* Char.Semicolon */: + if ( + currentProp && + valueStart > 0 && + parenDepth === 0 && + quote === 0 /* Char.QuoteNone */ + ) { + const styleVal = value.substring(valueStart, i - 1).trim(); + styles.push(currentProp, styleVal); + propStart = i; + valueStart = 0; + currentProp = null; + } + break; + } + } + if (currentProp && valueStart) { + const styleVal = value.slice(valueStart).trim(); + styles.push(currentProp, styleVal); + } + return styles; +} +exports.parse = parse; +function hyphenate(value) { + return value + .replace(/[a-z][A-Z]/g, (v) => { + return v.charAt(0) + "-" + v.charAt(1); + }) + .toLowerCase(); +} +exports.hyphenate = hyphenate; + + +/***/ }), + +/***/ 967: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Element = __webpack_require__(77301); +var defineElement = __webpack_require__(5244); +var utils = __webpack_require__(89076); +var CSSStyleDeclaration = __webpack_require__(53141); + +var svgElements = exports.elements = {}; +var svgNameToImpl = Object.create(null); + +exports.createElement = function(doc, localName, prefix) { + var impl = svgNameToImpl[localName] || SVGElement; + return new impl(doc, localName, prefix); +}; + +function define(spec) { + return defineElement(spec, SVGElement, svgElements, svgNameToImpl); +} + +var SVGElement = define({ + superclass: Element, + name: 'SVGElement', + ctor: function SVGElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.SVG, prefix); + }, + props: { + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }} + } +}); + +define({ + name: 'SVGSVGElement', + ctor: function SVGSVGElement(doc, localName, prefix) { + SVGElement.call(this, doc, localName, prefix); + }, + tag: 'svg', + props: { + createSVGRect: { value: function () { + return exports.createElement(this.ownerDocument, 'rect', null); + } } + } +}); + +define({ + tags: [ + 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', + 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', + 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', + 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', + 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', + 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignObject', 'g', + 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph', + 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', + 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern' + ] +}); + + +/***/ }), + +/***/ 89076: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var DOMException = __webpack_require__(46364); +var ERR = DOMException; +var isApiWritable = (__webpack_require__(66139)/* .isApiWritable */ .h); + +exports.NAMESPACE = { + HTML: 'http://www.w3.org/1999/xhtml', + XML: 'http://www.w3.org/XML/1998/namespace', + XMLNS: 'http://www.w3.org/2000/xmlns/', + MATHML: 'http://www.w3.org/1998/Math/MathML', + SVG: 'http://www.w3.org/2000/svg', + XLINK: 'http://www.w3.org/1999/xlink' +}; + +// +// Shortcut functions for throwing errors of various types. +// +exports.IndexSizeError = function() { throw new DOMException(ERR.INDEX_SIZE_ERR); }; +exports.HierarchyRequestError = function() { throw new DOMException(ERR.HIERARCHY_REQUEST_ERR); }; +exports.WrongDocumentError = function() { throw new DOMException(ERR.WRONG_DOCUMENT_ERR); }; +exports.InvalidCharacterError = function() { throw new DOMException(ERR.INVALID_CHARACTER_ERR); }; +exports.NoModificationAllowedError = function() { throw new DOMException(ERR.NO_MODIFICATION_ALLOWED_ERR); }; +exports.NotFoundError = function() { throw new DOMException(ERR.NOT_FOUND_ERR); }; +exports.NotSupportedError = function() { throw new DOMException(ERR.NOT_SUPPORTED_ERR); }; +exports.InvalidStateError = function() { throw new DOMException(ERR.INVALID_STATE_ERR); }; +exports.SyntaxError = function() { throw new DOMException(ERR.SYNTAX_ERR); }; +exports.InvalidModificationError = function() { throw new DOMException(ERR.INVALID_MODIFICATION_ERR); }; +exports.NamespaceError = function() { throw new DOMException(ERR.NAMESPACE_ERR); }; +exports.InvalidAccessError = function() { throw new DOMException(ERR.INVALID_ACCESS_ERR); }; +exports.TypeMismatchError = function() { throw new DOMException(ERR.TYPE_MISMATCH_ERR); }; +exports.SecurityError = function() { throw new DOMException(ERR.SECURITY_ERR); }; +exports.NetworkError = function() { throw new DOMException(ERR.NETWORK_ERR); }; +exports.AbortError = function() { throw new DOMException(ERR.ABORT_ERR); }; +exports.UrlMismatchError = function() { throw new DOMException(ERR.URL_MISMATCH_ERR); }; +exports.QuotaExceededError = function() { throw new DOMException(ERR.QUOTA_EXCEEDED_ERR); }; +exports.TimeoutError = function() { throw new DOMException(ERR.TIMEOUT_ERR); }; +exports.InvalidNodeTypeError = function() { throw new DOMException(ERR.INVALID_NODE_TYPE_ERR); }; +exports.DataCloneError = function() { throw new DOMException(ERR.DATA_CLONE_ERR); }; + +exports.nyi = function() { + throw new Error("NotYetImplemented"); +}; + +exports.shouldOverride = function() { + throw new Error("Abstract function; should be overriding in subclass."); +}; + +exports.assert = function(expr, msg) { + if (!expr) { + throw new Error("Assertion failed: " + (msg || "") + "\n" + new Error().stack); + } +}; + +exports.expose = function(src, c) { + for (var n in src) { + Object.defineProperty(c.prototype, n, { value: src[n], writable: isApiWritable }); + } +}; + +exports.merge = function(a, b) { + for (var n in b) { + a[n] = b[n]; + } +}; + +// Compare two nodes based on their document order. This function is intended +// to be passed to sort(). Assumes that the array being sorted does not +// contain duplicates. And that all nodes are connected and comparable. +// Clever code by ppk via jeresig. +exports.documentOrder = function(n,m) { + /* jshint bitwise: false */ + return 3 - (n.compareDocumentPosition(m) & 6); +}; + +exports.toASCIILowerCase = function(s) { + return s.replace(/[A-Z]+/g, function(c) { + return c.toLowerCase(); + }); +}; + +exports.toASCIIUpperCase = function(s) { + return s.replace(/[a-z]+/g, function(c) { + return c.toUpperCase(); + }); +}; + + +/***/ }), + +/***/ 66798: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// This grammar is from the XML and XML Namespace specs. It specifies whether +// a string (such as an element or attribute name) is a valid Name or QName. +// +// Name ::= NameStartChar (NameChar)* +// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | +// [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | +// [#x370-#x37D] | [#x37F-#x1FFF] | +// [#x200C-#x200D] | [#x2070-#x218F] | +// [#x2C00-#x2FEF] | [#x3001-#xD7FF] | +// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | +// [#x10000-#xEFFFF] +// +// NameChar ::= NameStartChar | "-" | "." | [0-9] | +// #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +// +// QName ::= PrefixedName| UnprefixedName +// PrefixedName ::= Prefix ':' LocalPart +// UnprefixedName ::= LocalPart +// Prefix ::= NCName +// LocalPart ::= NCName +// NCName ::= Name - (Char* ':' Char*) +// # An XML Name, minus the ":" +// + +exports.isValidName = isValidName; +exports.isValidQName = isValidQName; + +// Most names will be ASCII only. Try matching against simple regexps first +var simplename = /^[_:A-Za-z][-.:\w]+$/; +var simpleqname = /^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/; + +// If the regular expressions above fail, try more complex ones that work +// for any identifiers using codepoints from the Unicode BMP +var ncnamestartchars = "_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; +var ncnamechars = "-._A-Za-z0-9\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203f\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; + +var ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +var namestartchars = ncnamestartchars + ":"; +var namechars = ncnamechars + ":"; +var name = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var qname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +// XML says that these characters are also legal: +// [#x10000-#xEFFFF]. So if the patterns above fail, and the +// target string includes surrogates, then try the following +// patterns that allow surrogates and then run an extra validation +// step to make sure that the surrogates are in valid pairs and in +// the right range. Note that since the characters \uf0000 to \u1f0000 +// are not allowed, it means that the high surrogate can only go up to +// \uDB7f instead of \uDBFF. +var hassurrogates = /[\uD800-\uDB7F\uDC00-\uDFFF]/; +var surrogatechars = /[\uD800-\uDB7F\uDC00-\uDFFF]/g; +var surrogatepairs = /[\uD800-\uDB7F][\uDC00-\uDFFF]/g; + +// Modify the variables above to allow surrogates +ncnamestartchars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncnamechars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +namestartchars = ncnamestartchars + ":"; +namechars = ncnamechars + ":"; + +// Build another set of regexps that include surrogates +var surrogatename = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var surrogateqname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +function isValidName(s) { + if (simplename.test(s)) return true; // Plain ASCII + if (name.test(s)) return true; // Unicode BMP + + // Maybe the tests above failed because s includes surrogate pairs + // Most likely, though, they failed for some more basic syntax problem + if (!hassurrogates.test(s)) return false; + + // Is the string a valid name if we allow surrogates? + if (!surrogatename.test(s)) return false; + + // Finally, are the surrogates all correctly paired up? + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + +function isValidQName(s) { + if (simpleqname.test(s)) return true; // Plain ASCII + if (qname.test(s)) return true; // Unicode BMP + + if (!hassurrogates.test(s)) return false; + if (!surrogateqname.test(s)) return false; + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + + +/***/ }), + +/***/ 43295: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var eventTargetShim = __webpack_require__(99211); + +/** + * The signal class. + * @see https://dom.spec.whatwg.org/#abortsignal + */ +class AbortSignal extends eventTargetShim.EventTarget { + /** + * AbortSignal cannot be constructed directly. + */ + constructor() { + super(); + throw new TypeError("AbortSignal cannot be constructed directly"); + } + /** + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. + */ + get aborted() { + const aborted = abortedFlags.get(this); + if (typeof aborted !== "boolean") { + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); + } + return aborted; + } +} +eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort"); +/** + * Create an AbortSignal object. + */ +function createAbortSignal() { + const signal = Object.create(AbortSignal.prototype); + eventTargetShim.EventTarget.call(signal); + abortedFlags.set(signal, false); + return signal; +} +/** + * Abort a given signal. + */ +function abortSignal(signal) { + if (abortedFlags.get(signal) !== false) { + return; + } + abortedFlags.set(signal, true); + signal.dispatchEvent({ type: "abort" }); +} +/** + * Aborted flag for each instances. + */ +const abortedFlags = new WeakMap(); +// Properties should be enumerable. +Object.defineProperties(AbortSignal.prototype, { + aborted: { enumerable: true }, +}); +// `toString()` should return `"[object AbortSignal]"` +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortSignal", + }); +} + +/** + * The AbortController. + * @see https://dom.spec.whatwg.org/#abortcontroller + */ +class AbortController { + /** + * Initialize this controller. + */ + constructor() { + signals.set(this, createAbortSignal()); + } + /** + * Returns the `AbortSignal` object associated with this object. + */ + get signal() { + return getSignal(this); + } + /** + * Abort and signal to any observers that the associated activity is to be aborted. + */ + abort() { + abortSignal(getSignal(this)); + } +} +/** + * Associated signals. + */ +const signals = new WeakMap(); +/** + * Get the associated signal of a given controller. + */ +function getSignal(controller) { + const signal = signals.get(controller); + if (signal == null) { + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); + } + return signal; +} +// Properties should be enumerable. +Object.defineProperties(AbortController.prototype, { + signal: { enumerable: true }, + abort: { enumerable: true }, +}); +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortController", + }); +} + +exports.AbortController = AbortController; +exports.AbortSignal = AbortSignal; +exports["default"] = AbortController; + +module.exports = AbortController +module.exports.AbortController = module.exports["default"] = AbortController +module.exports.AbortSignal = AbortSignal +//# sourceMappingURL=abort-controller.js.map + + +/***/ }), + +/***/ 82712: +/***/ ((module) => { + +"use strict"; + +const ansiEscapes = module.exports; +// TODO: remove this in the next major version +module.exports["default"] = ansiEscapes; + +const ESC = '\u001B['; +const OSC = '\u001B]'; +const BEL = '\u0007'; +const SEP = ';'; +const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal'; + +ansiEscapes.cursorTo = (x, y) => { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } + + if (typeof y !== 'number') { + return ESC + (x + 1) + 'G'; + } + + return ESC + (y + 1) + ';' + (x + 1) + 'H'; +}; + +ansiEscapes.cursorMove = (x, y) => { + if (typeof x !== 'number') { + throw new TypeError('The `x` argument is required'); + } + + let ret = ''; + + if (x < 0) { + ret += ESC + (-x) + 'D'; + } else if (x > 0) { + ret += ESC + x + 'C'; + } + + if (y < 0) { + ret += ESC + (-y) + 'A'; + } else if (y > 0) { + ret += ESC + y + 'B'; + } + + return ret; +}; + +ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A'; +ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B'; +ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C'; +ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D'; + +ansiEscapes.cursorLeft = ESC + 'G'; +ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's'; +ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u'; +ansiEscapes.cursorGetPosition = ESC + '6n'; +ansiEscapes.cursorNextLine = ESC + 'E'; +ansiEscapes.cursorPrevLine = ESC + 'F'; +ansiEscapes.cursorHide = ESC + '?25l'; +ansiEscapes.cursorShow = ESC + '?25h'; + +ansiEscapes.eraseLines = count => { + let clear = ''; + + for (let i = 0; i < count; i++) { + clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : ''); + } + + if (count) { + clear += ansiEscapes.cursorLeft; + } + + return clear; +}; + +ansiEscapes.eraseEndLine = ESC + 'K'; +ansiEscapes.eraseStartLine = ESC + '1K'; +ansiEscapes.eraseLine = ESC + '2K'; +ansiEscapes.eraseDown = ESC + 'J'; +ansiEscapes.eraseUp = ESC + '1J'; +ansiEscapes.eraseScreen = ESC + '2J'; +ansiEscapes.scrollUp = ESC + 'S'; +ansiEscapes.scrollDown = ESC + 'T'; + +ansiEscapes.clearScreen = '\u001Bc'; + +ansiEscapes.clearTerminal = process.platform === 'win32' ? + `${ansiEscapes.eraseScreen}${ESC}0f` : + // 1. Erases the screen (Only done in case `2` is not supported) + // 2. Erases the whole screen including scrollback buffer + // 3. Moves cursor to the top-left position + // More info: https://www.real-world-systems.com/docs/ANSIcode.html + `${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`; + +ansiEscapes.beep = BEL; + +ansiEscapes.link = (text, url) => { + return [ + OSC, + '8', + SEP, + SEP, + url, + BEL, + text, + OSC, + '8', + SEP, + SEP, + BEL + ].join(''); +}; + +ansiEscapes.image = (buffer, options = {}) => { + let ret = `${OSC}1337;File=inline=1`; + + if (options.width) { + ret += `;width=${options.width}`; + } + + if (options.height) { + ret += `;height=${options.height}`; + } + + if (options.preserveAspectRatio === false) { + ret += ';preserveAspectRatio=0'; + } + + return ret + ':' + buffer.toString('base64') + BEL; +}; + +ansiEscapes.iTerm = { + setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`, + + annotation: (message, options = {}) => { + let ret = `${OSC}1337;`; + + const hasX = typeof options.x !== 'undefined'; + const hasY = typeof options.y !== 'undefined'; + if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) { + throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined'); + } + + message = message.replace(/\|/g, ''); + + ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation='; + + if (options.length > 0) { + ret += + (hasX ? + [message, options.length, options.x, options.y] : + [options.length, message]).join('|'); + } else { + ret += message; + } + + return ret + BEL; + } +}; + + +/***/ }), + +/***/ 1806: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); + + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(79427); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); + + +/***/ }), + +/***/ 50258: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* MIT license */ +/* eslint-disable no-mixed-operators */ +const cssKeywords = __webpack_require__(36791); + +// NOTE: conversions should only return primitive values (i.e. arrays, or +// values that give correct `typeof` results). +// do not use box values types (i.e. Number(), String(), etc.) + +const reverseKeywords = {}; +for (const key of Object.keys(cssKeywords)) { + reverseKeywords[cssKeywords[key]] = key; +} + +const convert = { + rgb: {channels: 3, labels: 'rgb'}, + hsl: {channels: 3, labels: 'hsl'}, + hsv: {channels: 3, labels: 'hsv'}, + hwb: {channels: 3, labels: 'hwb'}, + cmyk: {channels: 4, labels: 'cmyk'}, + xyz: {channels: 3, labels: 'xyz'}, + lab: {channels: 3, labels: 'lab'}, + lch: {channels: 3, labels: 'lch'}, + hex: {channels: 1, labels: ['hex']}, + keyword: {channels: 1, labels: ['keyword']}, + ansi16: {channels: 1, labels: ['ansi16']}, + ansi256: {channels: 1, labels: ['ansi256']}, + hcg: {channels: 3, labels: ['h', 'c', 'g']}, + apple: {channels: 3, labels: ['r16', 'g16', 'b16']}, + gray: {channels: 1, labels: ['gray']} +}; + +module.exports = convert; + +// Hide .channels and .labels properties +for (const model of Object.keys(convert)) { + if (!('channels' in convert[model])) { + throw new Error('missing channels property: ' + model); + } + + if (!('labels' in convert[model])) { + throw new Error('missing channel labels property: ' + model); + } + + if (convert[model].labels.length !== convert[model].channels) { + throw new Error('channel and label counts mismatch: ' + model); + } + + const {channels, labels} = convert[model]; + delete convert[model].channels; + delete convert[model].labels; + Object.defineProperty(convert[model], 'channels', {value: channels}); + Object.defineProperty(convert[model], 'labels', {value: labels}); +} + +convert.rgb.hsl = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const min = Math.min(r, g, b); + const max = Math.max(r, g, b); + const delta = max - min; + let h; + let s; + + if (max === min) { + h = 0; + } else if (r === max) { + h = (g - b) / delta; + } else if (g === max) { + h = 2 + (b - r) / delta; + } else if (b === max) { + h = 4 + (r - g) / delta; + } + + h = Math.min(h * 60, 360); + + if (h < 0) { + h += 360; + } + + const l = (min + max) / 2; + + if (max === min) { + s = 0; + } else if (l <= 0.5) { + s = delta / (max + min); + } else { + s = delta / (2 - max - min); + } + + return [h, s * 100, l * 100]; +}; + +convert.rgb.hsv = function (rgb) { + let rdif; + let gdif; + let bdif; + let h; + let s; + + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const v = Math.max(r, g, b); + const diff = v - Math.min(r, g, b); + const diffc = function (c) { + return (v - c) / 6 / diff + 1 / 2; + }; + + if (diff === 0) { + h = 0; + s = 0; + } else { + s = diff / v; + rdif = diffc(r); + gdif = diffc(g); + bdif = diffc(b); + + if (r === v) { + h = bdif - gdif; + } else if (g === v) { + h = (1 / 3) + rdif - bdif; + } else if (b === v) { + h = (2 / 3) + gdif - rdif; + } + + if (h < 0) { + h += 1; + } else if (h > 1) { + h -= 1; + } + } + + return [ + h * 360, + s * 100, + v * 100 + ]; +}; + +convert.rgb.hwb = function (rgb) { + const r = rgb[0]; + const g = rgb[1]; + let b = rgb[2]; + const h = convert.rgb.hsl(rgb)[0]; + const w = 1 / 255 * Math.min(r, Math.min(g, b)); + + b = 1 - 1 / 255 * Math.max(r, Math.max(g, b)); + + return [h, w * 100, b * 100]; +}; + +convert.rgb.cmyk = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + + const k = Math.min(1 - r, 1 - g, 1 - b); + const c = (1 - r - k) / (1 - k) || 0; + const m = (1 - g - k) / (1 - k) || 0; + const y = (1 - b - k) / (1 - k) || 0; + + return [c * 100, m * 100, y * 100, k * 100]; +}; + +function comparativeDistance(x, y) { + /* + See https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance + */ + return ( + ((x[0] - y[0]) ** 2) + + ((x[1] - y[1]) ** 2) + + ((x[2] - y[2]) ** 2) + ); +} + +convert.rgb.keyword = function (rgb) { + const reversed = reverseKeywords[rgb]; + if (reversed) { + return reversed; + } + + let currentClosestDistance = Infinity; + let currentClosestKeyword; + + for (const keyword of Object.keys(cssKeywords)) { + const value = cssKeywords[keyword]; + + // Compute comparative distance + const distance = comparativeDistance(rgb, value); + + // Check if its less, if so set as closest + if (distance < currentClosestDistance) { + currentClosestDistance = distance; + currentClosestKeyword = keyword; + } + } + + return currentClosestKeyword; +}; + +convert.keyword.rgb = function (keyword) { + return cssKeywords[keyword]; +}; + +convert.rgb.xyz = function (rgb) { + let r = rgb[0] / 255; + let g = rgb[1] / 255; + let b = rgb[2] / 255; + + // Assume sRGB + r = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92); + g = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92); + b = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92); + + const x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805); + const y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722); + const z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505); + + return [x * 100, y * 100, z * 100]; +}; + +convert.rgb.lab = function (rgb) { + const xyz = convert.rgb.xyz(rgb); + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.hsl.rgb = function (hsl) { + const h = hsl[0] / 360; + const s = hsl[1] / 100; + const l = hsl[2] / 100; + let t2; + let t3; + let val; + + if (s === 0) { + val = l * 255; + return [val, val, val]; + } + + if (l < 0.5) { + t2 = l * (1 + s); + } else { + t2 = l + s - l * s; + } + + const t1 = 2 * l - t2; + + const rgb = [0, 0, 0]; + for (let i = 0; i < 3; i++) { + t3 = h + 1 / 3 * -(i - 1); + if (t3 < 0) { + t3++; + } + + if (t3 > 1) { + t3--; + } + + if (6 * t3 < 1) { + val = t1 + (t2 - t1) * 6 * t3; + } else if (2 * t3 < 1) { + val = t2; + } else if (3 * t3 < 2) { + val = t1 + (t2 - t1) * (2 / 3 - t3) * 6; + } else { + val = t1; + } + + rgb[i] = val * 255; + } + + return rgb; +}; + +convert.hsl.hsv = function (hsl) { + const h = hsl[0]; + let s = hsl[1] / 100; + let l = hsl[2] / 100; + let smin = s; + const lmin = Math.max(l, 0.01); + + l *= 2; + s *= (l <= 1) ? l : 2 - l; + smin *= lmin <= 1 ? lmin : 2 - lmin; + const v = (l + s) / 2; + const sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s); + + return [h, sv * 100, v * 100]; +}; + +convert.hsv.rgb = function (hsv) { + const h = hsv[0] / 60; + const s = hsv[1] / 100; + let v = hsv[2] / 100; + const hi = Math.floor(h) % 6; + + const f = h - Math.floor(h); + const p = 255 * v * (1 - s); + const q = 255 * v * (1 - (s * f)); + const t = 255 * v * (1 - (s * (1 - f))); + v *= 255; + + switch (hi) { + case 0: + return [v, t, p]; + case 1: + return [q, v, p]; + case 2: + return [p, v, t]; + case 3: + return [p, q, v]; + case 4: + return [t, p, v]; + case 5: + return [v, p, q]; + } +}; + +convert.hsv.hsl = function (hsv) { + const h = hsv[0]; + const s = hsv[1] / 100; + const v = hsv[2] / 100; + const vmin = Math.max(v, 0.01); + let sl; + let l; + + l = (2 - s) * v; + const lmin = (2 - s) * vmin; + sl = s * vmin; + sl /= (lmin <= 1) ? lmin : 2 - lmin; + sl = sl || 0; + l /= 2; + + return [h, sl * 100, l * 100]; +}; + +// http://dev.w3.org/csswg/css-color/#hwb-to-rgb +convert.hwb.rgb = function (hwb) { + const h = hwb[0] / 360; + let wh = hwb[1] / 100; + let bl = hwb[2] / 100; + const ratio = wh + bl; + let f; + + // Wh + bl cant be > 1 + if (ratio > 1) { + wh /= ratio; + bl /= ratio; + } + + const i = Math.floor(6 * h); + const v = 1 - bl; + f = 6 * h - i; + + if ((i & 0x01) !== 0) { + f = 1 - f; + } + + const n = wh + f * (v - wh); // Linear interpolation + + let r; + let g; + let b; + /* eslint-disable max-statements-per-line,no-multi-spaces */ + switch (i) { + default: + case 6: + case 0: r = v; g = n; b = wh; break; + case 1: r = n; g = v; b = wh; break; + case 2: r = wh; g = v; b = n; break; + case 3: r = wh; g = n; b = v; break; + case 4: r = n; g = wh; b = v; break; + case 5: r = v; g = wh; b = n; break; + } + /* eslint-enable max-statements-per-line,no-multi-spaces */ + + return [r * 255, g * 255, b * 255]; +}; + +convert.cmyk.rgb = function (cmyk) { + const c = cmyk[0] / 100; + const m = cmyk[1] / 100; + const y = cmyk[2] / 100; + const k = cmyk[3] / 100; + + const r = 1 - Math.min(1, c * (1 - k) + k); + const g = 1 - Math.min(1, m * (1 - k) + k); + const b = 1 - Math.min(1, y * (1 - k) + k); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.rgb = function (xyz) { + const x = xyz[0] / 100; + const y = xyz[1] / 100; + const z = xyz[2] / 100; + let r; + let g; + let b; + + r = (x * 3.2406) + (y * -1.5372) + (z * -0.4986); + g = (x * -0.9689) + (y * 1.8758) + (z * 0.0415); + b = (x * 0.0557) + (y * -0.2040) + (z * 1.0570); + + // Assume sRGB + r = r > 0.0031308 + ? ((1.055 * (r ** (1.0 / 2.4))) - 0.055) + : r * 12.92; + + g = g > 0.0031308 + ? ((1.055 * (g ** (1.0 / 2.4))) - 0.055) + : g * 12.92; + + b = b > 0.0031308 + ? ((1.055 * (b ** (1.0 / 2.4))) - 0.055) + : b * 12.92; + + r = Math.min(Math.max(0, r), 1); + g = Math.min(Math.max(0, g), 1); + b = Math.min(Math.max(0, b), 1); + + return [r * 255, g * 255, b * 255]; +}; + +convert.xyz.lab = function (xyz) { + let x = xyz[0]; + let y = xyz[1]; + let z = xyz[2]; + + x /= 95.047; + y /= 100; + z /= 108.883; + + x = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116); + y = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116); + z = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116); + + const l = (116 * y) - 16; + const a = 500 * (x - y); + const b = 200 * (y - z); + + return [l, a, b]; +}; + +convert.lab.xyz = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let x; + let y; + let z; + + y = (l + 16) / 116; + x = a / 500 + y; + z = y - b / 200; + + const y2 = y ** 3; + const x2 = x ** 3; + const z2 = z ** 3; + y = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787; + x = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787; + z = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787; + + x *= 95.047; + y *= 100; + z *= 108.883; + + return [x, y, z]; +}; + +convert.lab.lch = function (lab) { + const l = lab[0]; + const a = lab[1]; + const b = lab[2]; + let h; + + const hr = Math.atan2(b, a); + h = hr * 360 / 2 / Math.PI; + + if (h < 0) { + h += 360; + } + + const c = Math.sqrt(a * a + b * b); + + return [l, c, h]; +}; + +convert.lch.lab = function (lch) { + const l = lch[0]; + const c = lch[1]; + const h = lch[2]; + + const hr = h / 360 * 2 * Math.PI; + const a = c * Math.cos(hr); + const b = c * Math.sin(hr); + + return [l, a, b]; +}; + +convert.rgb.ansi16 = function (args, saturation = null) { + const [r, g, b] = args; + let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization + + value = Math.round(value / 50); + + if (value === 0) { + return 30; + } + + let ansi = 30 + + ((Math.round(b / 255) << 2) + | (Math.round(g / 255) << 1) + | Math.round(r / 255)); + + if (value === 2) { + ansi += 60; + } + + return ansi; +}; + +convert.hsv.ansi16 = function (args) { + // Optimization here; we already know the value and don't need to get + // it converted for us. + return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]); +}; + +convert.rgb.ansi256 = function (args) { + const r = args[0]; + const g = args[1]; + const b = args[2]; + + // We use the extended greyscale palette here, with the exception of + // black and white. normal palette only has 4 greyscale shades. + if (r === g && g === b) { + if (r < 8) { + return 16; + } + + if (r > 248) { + return 231; + } + + return Math.round(((r - 8) / 247) * 24) + 232; + } + + const ansi = 16 + + (36 * Math.round(r / 255 * 5)) + + (6 * Math.round(g / 255 * 5)) + + Math.round(b / 255 * 5); + + return ansi; +}; + +convert.ansi16.rgb = function (args) { + let color = args % 10; + + // Handle greyscale + if (color === 0 || color === 7) { + if (args > 50) { + color += 3.5; + } + + color = color / 10.5 * 255; + + return [color, color, color]; + } + + const mult = (~~(args > 50) + 1) * 0.5; + const r = ((color & 1) * mult) * 255; + const g = (((color >> 1) & 1) * mult) * 255; + const b = (((color >> 2) & 1) * mult) * 255; + + return [r, g, b]; +}; + +convert.ansi256.rgb = function (args) { + // Handle greyscale + if (args >= 232) { + const c = (args - 232) * 10 + 8; + return [c, c, c]; + } + + args -= 16; + + let rem; + const r = Math.floor(args / 36) / 5 * 255; + const g = Math.floor((rem = args % 36) / 6) / 5 * 255; + const b = (rem % 6) / 5 * 255; + + return [r, g, b]; +}; + +convert.rgb.hex = function (args) { + const integer = ((Math.round(args[0]) & 0xFF) << 16) + + ((Math.round(args[1]) & 0xFF) << 8) + + (Math.round(args[2]) & 0xFF); + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.hex.rgb = function (args) { + const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i); + if (!match) { + return [0, 0, 0]; + } + + let colorString = match[0]; + + if (match[0].length === 3) { + colorString = colorString.split('').map(char => { + return char + char; + }).join(''); + } + + const integer = parseInt(colorString, 16); + const r = (integer >> 16) & 0xFF; + const g = (integer >> 8) & 0xFF; + const b = integer & 0xFF; + + return [r, g, b]; +}; + +convert.rgb.hcg = function (rgb) { + const r = rgb[0] / 255; + const g = rgb[1] / 255; + const b = rgb[2] / 255; + const max = Math.max(Math.max(r, g), b); + const min = Math.min(Math.min(r, g), b); + const chroma = (max - min); + let grayscale; + let hue; + + if (chroma < 1) { + grayscale = min / (1 - chroma); + } else { + grayscale = 0; + } + + if (chroma <= 0) { + hue = 0; + } else + if (max === r) { + hue = ((g - b) / chroma) % 6; + } else + if (max === g) { + hue = 2 + (b - r) / chroma; + } else { + hue = 4 + (r - g) / chroma; + } + + hue /= 6; + hue %= 1; + + return [hue * 360, chroma * 100, grayscale * 100]; +}; + +convert.hsl.hcg = function (hsl) { + const s = hsl[1] / 100; + const l = hsl[2] / 100; + + const c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l)); + + let f = 0; + if (c < 1.0) { + f = (l - 0.5 * c) / (1.0 - c); + } + + return [hsl[0], c * 100, f * 100]; +}; + +convert.hsv.hcg = function (hsv) { + const s = hsv[1] / 100; + const v = hsv[2] / 100; + + const c = s * v; + let f = 0; + + if (c < 1.0) { + f = (v - c) / (1 - c); + } + + return [hsv[0], c * 100, f * 100]; +}; + +convert.hcg.rgb = function (hcg) { + const h = hcg[0] / 360; + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + if (c === 0.0) { + return [g * 255, g * 255, g * 255]; + } + + const pure = [0, 0, 0]; + const hi = (h % 1) * 6; + const v = hi % 1; + const w = 1 - v; + let mg = 0; + + /* eslint-disable max-statements-per-line */ + switch (Math.floor(hi)) { + case 0: + pure[0] = 1; pure[1] = v; pure[2] = 0; break; + case 1: + pure[0] = w; pure[1] = 1; pure[2] = 0; break; + case 2: + pure[0] = 0; pure[1] = 1; pure[2] = v; break; + case 3: + pure[0] = 0; pure[1] = w; pure[2] = 1; break; + case 4: + pure[0] = v; pure[1] = 0; pure[2] = 1; break; + default: + pure[0] = 1; pure[1] = 0; pure[2] = w; + } + /* eslint-enable max-statements-per-line */ + + mg = (1.0 - c) * g; + + return [ + (c * pure[0] + mg) * 255, + (c * pure[1] + mg) * 255, + (c * pure[2] + mg) * 255 + ]; +}; + +convert.hcg.hsv = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const v = c + g * (1.0 - c); + let f = 0; + + if (v > 0.0) { + f = c / v; + } + + return [hcg[0], f * 100, v * 100]; +}; + +convert.hcg.hsl = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + + const l = g * (1.0 - c) + 0.5 * c; + let s = 0; + + if (l > 0.0 && l < 0.5) { + s = c / (2 * l); + } else + if (l >= 0.5 && l < 1.0) { + s = c / (2 * (1 - l)); + } + + return [hcg[0], s * 100, l * 100]; +}; + +convert.hcg.hwb = function (hcg) { + const c = hcg[1] / 100; + const g = hcg[2] / 100; + const v = c + g * (1.0 - c); + return [hcg[0], (v - c) * 100, (1 - v) * 100]; +}; + +convert.hwb.hcg = function (hwb) { + const w = hwb[1] / 100; + const b = hwb[2] / 100; + const v = 1 - b; + const c = v - w; + let g = 0; + + if (c < 1) { + g = (v - c) / (1 - c); + } + + return [hwb[0], c * 100, g * 100]; +}; + +convert.apple.rgb = function (apple) { + return [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255]; +}; + +convert.rgb.apple = function (rgb) { + return [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535]; +}; + +convert.gray.rgb = function (args) { + return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255]; +}; + +convert.gray.hsl = function (args) { + return [0, 0, args[0]]; +}; + +convert.gray.hsv = convert.gray.hsl; + +convert.gray.hwb = function (gray) { + return [0, 100, gray[0]]; +}; + +convert.gray.cmyk = function (gray) { + return [0, 0, 0, gray[0]]; +}; + +convert.gray.lab = function (gray) { + return [gray[0], 0, 0]; +}; + +convert.gray.hex = function (gray) { + const val = Math.round(gray[0] / 100 * 255) & 0xFF; + const integer = (val << 16) + (val << 8) + val; + + const string = integer.toString(16).toUpperCase(); + return '000000'.substring(string.length) + string; +}; + +convert.rgb.gray = function (rgb) { + const val = (rgb[0] + rgb[1] + rgb[2]) / 3; + return [val / 255 * 100]; +}; + + +/***/ }), + +/***/ 79427: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const conversions = __webpack_require__(50258); +const route = __webpack_require__(99830); + +const convert = {}; + +const models = Object.keys(conversions); + +function wrapRaw(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + return fn(args); + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +function wrapRounded(fn) { + const wrappedFn = function (...args) { + const arg0 = args[0]; + + if (arg0 === undefined || arg0 === null) { + return arg0; + } + + if (arg0.length > 1) { + args = arg0; + } + + const result = fn(args); + + // We're assuming the result is an array here. + // see notice in conversions.js; don't use box types + // in conversion functions. + if (typeof result === 'object') { + for (let len = result.length, i = 0; i < len; i++) { + result[i] = Math.round(result[i]); + } + } + + return result; + }; + + // Preserve .conversion property if there is one + if ('conversion' in fn) { + wrappedFn.conversion = fn.conversion; + } + + return wrappedFn; +} + +models.forEach(fromModel => { + convert[fromModel] = {}; + + Object.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels}); + Object.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels}); + + const routes = route(fromModel); + const routeModels = Object.keys(routes); + + routeModels.forEach(toModel => { + const fn = routes[toModel]; + + convert[fromModel][toModel] = wrapRounded(fn); + convert[fromModel][toModel].raw = wrapRaw(fn); + }); +}); + +module.exports = convert; + + +/***/ }), + +/***/ 99830: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const conversions = __webpack_require__(50258); + +/* + This function routes a model to all other models. + + all functions that are routed have a property `.conversion` attached + to the returned synthetic function. This property is an array + of strings, each with the steps in between the 'from' and 'to' + color models (inclusive). + + conversions that are not possible simply are not included. +*/ + +function buildGraph() { + const graph = {}; + // https://jsperf.com/object-keys-vs-for-in-with-closure/3 + const models = Object.keys(conversions); + + for (let len = models.length, i = 0; i < len; i++) { + graph[models[i]] = { + // http://jsperf.com/1-vs-infinity + // micro-opt, but this is simple. + distance: -1, + parent: null + }; + } + + return graph; +} + +// https://en.wikipedia.org/wiki/Breadth-first_search +function deriveBFS(fromModel) { + const graph = buildGraph(); + const queue = [fromModel]; // Unshift -> queue -> pop + + graph[fromModel].distance = 0; + + while (queue.length) { + const current = queue.pop(); + const adjacents = Object.keys(conversions[current]); + + for (let len = adjacents.length, i = 0; i < len; i++) { + const adjacent = adjacents[i]; + const node = graph[adjacent]; + + if (node.distance === -1) { + node.distance = graph[current].distance + 1; + node.parent = current; + queue.unshift(adjacent); + } + } + } + + return graph; +} + +function link(from, to) { + return function (args) { + return to(from(args)); + }; +} + +function wrapConversion(toModel, graph) { + const path = [graph[toModel].parent, toModel]; + let fn = conversions[graph[toModel].parent][toModel]; + + let cur = graph[toModel].parent; + while (graph[cur].parent) { + path.unshift(graph[cur].parent); + fn = link(conversions[graph[cur].parent][cur], fn); + cur = graph[cur].parent; + } + + fn.conversion = path; + return fn; +} + +module.exports = function (fromModel) { + const graph = deriveBFS(fromModel); + const conversion = {}; + + const models = Object.keys(graph); + for (let len = models.length, i = 0; i < len; i++) { + const toModel = models[i]; + const node = graph[toModel]; + + if (node.parent === null) { + // No possible conversion, or this node is the source model. + continue; + } + + conversion[toModel] = wrapConversion(toModel, graph); + } + + return conversion; +}; + + + +/***/ }), + +/***/ 36791: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + "aliceblue": [240, 248, 255], + "antiquewhite": [250, 235, 215], + "aqua": [0, 255, 255], + "aquamarine": [127, 255, 212], + "azure": [240, 255, 255], + "beige": [245, 245, 220], + "bisque": [255, 228, 196], + "black": [0, 0, 0], + "blanchedalmond": [255, 235, 205], + "blue": [0, 0, 255], + "blueviolet": [138, 43, 226], + "brown": [165, 42, 42], + "burlywood": [222, 184, 135], + "cadetblue": [95, 158, 160], + "chartreuse": [127, 255, 0], + "chocolate": [210, 105, 30], + "coral": [255, 127, 80], + "cornflowerblue": [100, 149, 237], + "cornsilk": [255, 248, 220], + "crimson": [220, 20, 60], + "cyan": [0, 255, 255], + "darkblue": [0, 0, 139], + "darkcyan": [0, 139, 139], + "darkgoldenrod": [184, 134, 11], + "darkgray": [169, 169, 169], + "darkgreen": [0, 100, 0], + "darkgrey": [169, 169, 169], + "darkkhaki": [189, 183, 107], + "darkmagenta": [139, 0, 139], + "darkolivegreen": [85, 107, 47], + "darkorange": [255, 140, 0], + "darkorchid": [153, 50, 204], + "darkred": [139, 0, 0], + "darksalmon": [233, 150, 122], + "darkseagreen": [143, 188, 143], + "darkslateblue": [72, 61, 139], + "darkslategray": [47, 79, 79], + "darkslategrey": [47, 79, 79], + "darkturquoise": [0, 206, 209], + "darkviolet": [148, 0, 211], + "deeppink": [255, 20, 147], + "deepskyblue": [0, 191, 255], + "dimgray": [105, 105, 105], + "dimgrey": [105, 105, 105], + "dodgerblue": [30, 144, 255], + "firebrick": [178, 34, 34], + "floralwhite": [255, 250, 240], + "forestgreen": [34, 139, 34], + "fuchsia": [255, 0, 255], + "gainsboro": [220, 220, 220], + "ghostwhite": [248, 248, 255], + "gold": [255, 215, 0], + "goldenrod": [218, 165, 32], + "gray": [128, 128, 128], + "green": [0, 128, 0], + "greenyellow": [173, 255, 47], + "grey": [128, 128, 128], + "honeydew": [240, 255, 240], + "hotpink": [255, 105, 180], + "indianred": [205, 92, 92], + "indigo": [75, 0, 130], + "ivory": [255, 255, 240], + "khaki": [240, 230, 140], + "lavender": [230, 230, 250], + "lavenderblush": [255, 240, 245], + "lawngreen": [124, 252, 0], + "lemonchiffon": [255, 250, 205], + "lightblue": [173, 216, 230], + "lightcoral": [240, 128, 128], + "lightcyan": [224, 255, 255], + "lightgoldenrodyellow": [250, 250, 210], + "lightgray": [211, 211, 211], + "lightgreen": [144, 238, 144], + "lightgrey": [211, 211, 211], + "lightpink": [255, 182, 193], + "lightsalmon": [255, 160, 122], + "lightseagreen": [32, 178, 170], + "lightskyblue": [135, 206, 250], + "lightslategray": [119, 136, 153], + "lightslategrey": [119, 136, 153], + "lightsteelblue": [176, 196, 222], + "lightyellow": [255, 255, 224], + "lime": [0, 255, 0], + "limegreen": [50, 205, 50], + "linen": [250, 240, 230], + "magenta": [255, 0, 255], + "maroon": [128, 0, 0], + "mediumaquamarine": [102, 205, 170], + "mediumblue": [0, 0, 205], + "mediumorchid": [186, 85, 211], + "mediumpurple": [147, 112, 219], + "mediumseagreen": [60, 179, 113], + "mediumslateblue": [123, 104, 238], + "mediumspringgreen": [0, 250, 154], + "mediumturquoise": [72, 209, 204], + "mediumvioletred": [199, 21, 133], + "midnightblue": [25, 25, 112], + "mintcream": [245, 255, 250], + "mistyrose": [255, 228, 225], + "moccasin": [255, 228, 181], + "navajowhite": [255, 222, 173], + "navy": [0, 0, 128], + "oldlace": [253, 245, 230], + "olive": [128, 128, 0], + "olivedrab": [107, 142, 35], + "orange": [255, 165, 0], + "orangered": [255, 69, 0], + "orchid": [218, 112, 214], + "palegoldenrod": [238, 232, 170], + "palegreen": [152, 251, 152], + "paleturquoise": [175, 238, 238], + "palevioletred": [219, 112, 147], + "papayawhip": [255, 239, 213], + "peachpuff": [255, 218, 185], + "peru": [205, 133, 63], + "pink": [255, 192, 203], + "plum": [221, 160, 221], + "powderblue": [176, 224, 230], + "purple": [128, 0, 128], + "rebeccapurple": [102, 51, 153], + "red": [255, 0, 0], + "rosybrown": [188, 143, 143], + "royalblue": [65, 105, 225], + "saddlebrown": [139, 69, 19], + "salmon": [250, 128, 114], + "sandybrown": [244, 164, 96], + "seagreen": [46, 139, 87], + "seashell": [255, 245, 238], + "sienna": [160, 82, 45], + "silver": [192, 192, 192], + "skyblue": [135, 206, 235], + "slateblue": [106, 90, 205], + "slategray": [112, 128, 144], + "slategrey": [112, 128, 144], + "snow": [255, 250, 250], + "springgreen": [0, 255, 127], + "steelblue": [70, 130, 180], + "tan": [210, 180, 140], + "teal": [0, 128, 128], + "thistle": [216, 191, 216], + "tomato": [255, 99, 71], + "turquoise": [64, 224, 208], + "violet": [238, 130, 238], + "wheat": [245, 222, 179], + "white": [255, 255, 255], + "whitesmoke": [245, 245, 245], + "yellow": [255, 255, 0], + "yellowgreen": [154, 205, 50] +}; + + +/***/ }), + +/***/ 53138: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = asyncify; + +var _initialParams = __webpack_require__(37564); + +var _initialParams2 = _interopRequireDefault(_initialParams); + +var _setImmediate = __webpack_require__(6793); + +var _setImmediate2 = _interopRequireDefault(_setImmediate); + +var _wrapAsync = __webpack_require__(86190); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Take a sync function and make it async, passing its return value to a + * callback. This is useful for plugging sync functions into a waterfall, + * series, or other async functions. Any arguments passed to the generated + * function will be passed to the wrapped function (except for the final + * callback argument). Errors thrown will be passed to the callback. + * + * If the function passed to `asyncify` returns a Promise, that promises's + * resolved/rejected state will be used to call the callback, rather than simply + * the synchronous return value. + * + * This also means you can asyncify ES2017 `async` functions. + * + * @name asyncify + * @static + * @memberOf module:Utils + * @method + * @alias wrapSync + * @category Util + * @param {Function} func - The synchronous function, or Promise-returning + * function to convert to an {@link AsyncFunction}. + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be + * invoked with `(args..., callback)`. + * @example + * + * // passing a regular synchronous function + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(JSON.parse), + * function (data, next) { + * // data is the result of parsing the text. + * // If there was a parsing error, it would have been caught. + * } + * ], callback); + * + * // passing a function returning a promise + * async.waterfall([ + * async.apply(fs.readFile, filename, "utf8"), + * async.asyncify(function (contents) { + * return db.model.create(contents); + * }), + * function (model, next) { + * // `model` is the instantiated model object. + * // If there was an error, this function would be skipped. + * } + * ], callback); + * + * // es2017 example, though `asyncify` is not needed if your JS environment + * // supports async functions out of the box + * var q = async.queue(async.asyncify(async function(file) { + * var intermediateStep = await processFile(file); + * return await somePromise(intermediateStep) + * })); + * + * q.push(files); + */ +function asyncify(func) { + if ((0, _wrapAsync.isAsync)(func)) { + return function (...args /*, callback*/) { + const callback = args.pop(); + const promise = func.apply(this, args); + return handlePromise(promise, callback); + }; + } + + return (0, _initialParams2.default)(function (args, callback) { + var result; + try { + result = func.apply(this, args); + } catch (e) { + return callback(e); + } + // if result is Promise object + if (result && typeof result.then === 'function') { + return handlePromise(result, callback); + } else { + callback(null, result); + } + }); +} + +function handlePromise(promise, callback) { + return promise.then(value => { + invokeCallback(callback, null, value); + }, err => { + invokeCallback(callback, err && (err instanceof Error || err.message) ? err : new Error(err)); + }); +} + +function invokeCallback(callback, error, value) { + try { + callback(error, value); + } catch (err) { + (0, _setImmediate2.default)(e => { + throw e; + }, err); + } +} +module.exports = exports.default; + +/***/ }), + +/***/ 89724: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _isArrayLike = __webpack_require__(88684); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _breakLoop = __webpack_require__(6347); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +var _eachOfLimit = __webpack_require__(92829); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _once = __webpack_require__(67721); + +var _once2 = _interopRequireDefault(_once); + +var _onlyOnce = __webpack_require__(24611); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = __webpack_require__(86190); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _awaitify = __webpack_require__(54808); + +var _awaitify2 = _interopRequireDefault(_awaitify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// eachOf implementation optimized for array-likes +function eachOfArrayLike(coll, iteratee, callback) { + callback = (0, _once2.default)(callback); + var index = 0, + completed = 0, + { length } = coll, + canceled = false; + if (length === 0) { + callback(null); + } + + function iteratorCallback(err, value) { + if (err === false) { + canceled = true; + } + if (canceled === true) return; + if (err) { + callback(err); + } else if (++completed === length || value === _breakLoop2.default) { + callback(null); + } + } + + for (; index < length; index++) { + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); + } +} + +// a generic version of eachOf which can handle array, object, and iterator cases. +function eachOfGeneric(coll, iteratee, callback) { + return (0, _eachOfLimit2.default)(coll, Infinity, iteratee, callback); +} + +/** + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument + * to the iteratee. + * + * @name eachOf + * @static + * @memberOf module:Collections + * @method + * @alias forEachOf + * @category Collection + * @see [async.each]{@link module:Collections.each} + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - A function to apply to each + * item in `coll`. + * The `key` is the item's key, or index in the case of an array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @returns {Promise} a promise, if a callback is omitted + * @example + * + * // dev.json is a file containing a valid json object config for dev environment + * // dev.json is a file containing a valid json object config for test environment + * // prod.json is a file containing a valid json object config for prod environment + * // invalid.json is a file with a malformed json object + * + * let configs = {}; //global variable + * let validConfigFileMap = {dev: 'dev.json', test: 'test.json', prod: 'prod.json'}; + * let invalidConfigFileMap = {dev: 'dev.json', test: 'test.json', invalid: 'invalid.json'}; + * + * // asynchronous function that reads a json file and parses the contents as json object + * function parseFile(file, key, callback) { + * fs.readFile(file, "utf8", function(err, data) { + * if (err) return calback(err); + * try { + * configs[key] = JSON.parse(data); + * } catch (e) { + * return callback(e); + * } + * callback(); + * }); + * } + * + * // Using callbacks + * async.forEachOf(validConfigFileMap, parseFile, function (err) { + * if (err) { + * console.error(err); + * } else { + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * } + * }); + * + * //Error handing + * async.forEachOf(invalidConfigFileMap, parseFile, function (err) { + * if (err) { + * console.error(err); + * // JSON parse error exception + * } else { + * console.log(configs); + * } + * }); + * + * // Using Promises + * async.forEachOf(validConfigFileMap, parseFile) + * .then( () => { + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * }).catch( err => { + * console.error(err); + * }); + * + * //Error handing + * async.forEachOf(invalidConfigFileMap, parseFile) + * .then( () => { + * console.log(configs); + * }).catch( err => { + * console.error(err); + * // JSON parse error exception + * }); + * + * // Using async/await + * async () => { + * try { + * let result = await async.forEachOf(validConfigFileMap, parseFile); + * console.log(configs); + * // configs is now a map of JSON data, e.g. + * // { dev: //parsed dev.json, test: //parsed test.json, prod: //parsed prod.json} + * } + * catch (err) { + * console.log(err); + * } + * } + * + * //Error handing + * async () => { + * try { + * let result = await async.forEachOf(invalidConfigFileMap, parseFile); + * console.log(configs); + * } + * catch (err) { + * console.log(err); + * // JSON parse error exception + * } + * } + * + */ +function eachOf(coll, iteratee, callback) { + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; + return eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); +} + +exports["default"] = (0, _awaitify2.default)(eachOf, 3); +module.exports = exports.default; + +/***/ }), + +/***/ 92829: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _eachOfLimit2 = __webpack_require__(73745); + +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); + +var _wrapAsync = __webpack_require__(86190); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _awaitify = __webpack_require__(54808); + +var _awaitify2 = _interopRequireDefault(_awaitify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a + * time. + * + * @name eachOfLimit + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfLimit + * @category Collection + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. + * @param {number} limit - The maximum number of async operations at a time. + * @param {AsyncFunction} iteratee - An async function to apply to each + * item in `coll`. The `key` is the item's key, or index in the case of an + * array. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @returns {Promise} a promise, if a callback is omitted + */ +function eachOfLimit(coll, limit, iteratee, callback) { + return (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); +} + +exports["default"] = (0, _awaitify2.default)(eachOfLimit, 4); +module.exports = exports.default; + +/***/ }), + +/***/ 17249: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _eachOfLimit = __webpack_require__(92829); + +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); + +var _awaitify = __webpack_require__(54808); + +var _awaitify2 = _interopRequireDefault(_awaitify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. + * + * @name eachOfSeries + * @static + * @memberOf module:Collections + * @method + * @see [async.eachOf]{@link module:Collections.eachOf} + * @alias forEachOfSeries + * @category Collection + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to each item in + * `coll`. + * Invoked with (item, key, callback). + * @param {Function} [callback] - A callback which is called when all `iteratee` + * functions have finished, or an error occurs. Invoked with (err). + * @returns {Promise} a promise, if a callback is omitted + */ +function eachOfSeries(coll, iteratee, callback) { + return (0, _eachOfLimit2.default)(coll, 1, iteratee, callback); +} +exports["default"] = (0, _awaitify2.default)(eachOfSeries, 3); +module.exports = exports.default; + +/***/ }), + +/***/ 22436: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _eachOf = __webpack_require__(89724); + +var _eachOf2 = _interopRequireDefault(_eachOf); + +var _withoutIndex = __webpack_require__(632); + +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); + +var _wrapAsync = __webpack_require__(86190); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _awaitify = __webpack_require__(54808); + +var _awaitify2 = _interopRequireDefault(_awaitify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Applies the function `iteratee` to each item in `coll`, in parallel. + * The `iteratee` is called with an item from the list, and a callback for when + * it has finished. If the `iteratee` passes an error to its `callback`, the + * main `callback` (for the `each` function) is immediately called with the + * error. + * + * Note, that since this function applies `iteratee` to each item in parallel, + * there is no guarantee that the iteratee functions will complete in order. + * + * @name each + * @static + * @memberOf module:Collections + * @method + * @alias forEach + * @category Collection + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. + * @param {AsyncFunction} iteratee - An async function to apply to + * each item in `coll`. Invoked with (item, callback). + * The array index is not passed to the iteratee. + * If you need the index, use `eachOf`. + * @param {Function} [callback] - A callback which is called when all + * `iteratee` functions have finished, or an error occurs. Invoked with (err). + * @returns {Promise} a promise, if a callback is omitted + * @example + * + * // dir1 is a directory that contains file1.txt, file2.txt + * // dir2 is a directory that contains file3.txt, file4.txt + * // dir3 is a directory that contains file5.txt + * // dir4 does not exist + * + * const fileList = [ 'dir1/file2.txt', 'dir2/file3.txt', 'dir/file5.txt']; + * const withMissingFileList = ['dir1/file1.txt', 'dir4/file2.txt']; + * + * // asynchronous function that deletes a file + * const deleteFile = function(file, callback) { + * fs.unlink(file, callback); + * }; + * + * // Using callbacks + * async.each(fileList, deleteFile, function(err) { + * if( err ) { + * console.log(err); + * } else { + * console.log('All files have been deleted successfully'); + * } + * }); + * + * // Error Handling + * async.each(withMissingFileList, deleteFile, function(err){ + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * }); + * + * // Using Promises + * async.each(fileList, deleteFile) + * .then( () => { + * console.log('All files have been deleted successfully'); + * }).catch( err => { + * console.log(err); + * }); + * + * // Error Handling + * async.each(fileList, deleteFile) + * .then( () => { + * console.log('All files have been deleted successfully'); + * }).catch( err => { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * }); + * + * // Using async/await + * async () => { + * try { + * await async.each(files, deleteFile); + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // Error Handling + * async () => { + * try { + * await async.each(withMissingFileList, deleteFile); + * } + * catch (err) { + * console.log(err); + * // [ Error: ENOENT: no such file or directory ] + * // since dir4/file2.txt does not exist + * // dir1/file1.txt could have been deleted + * } + * } + * + */ +function eachLimit(coll, iteratee, callback) { + return (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); +} + +exports["default"] = (0, _awaitify2.default)(eachLimit, 3); +module.exports = exports.default; + +/***/ }), + +/***/ 95775: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = asyncEachOfLimit; + +var _breakLoop = __webpack_require__(6347); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// for async generators +function asyncEachOfLimit(generator, limit, iteratee, callback) { + let done = false; + let canceled = false; + let awaiting = false; + let running = 0; + let idx = 0; + + function replenish() { + //console.log('replenish') + if (running >= limit || awaiting || done) return; + //console.log('replenish awaiting') + awaiting = true; + generator.next().then(({ value, done: iterDone }) => { + //console.log('got value', value) + if (canceled || done) return; + awaiting = false; + if (iterDone) { + done = true; + if (running <= 0) { + //console.log('done nextCb') + callback(null); + } + return; + } + running++; + iteratee(value, idx, iterateeCallback); + idx++; + replenish(); + }).catch(handleError); + } + + function iterateeCallback(err, result) { + //console.log('iterateeCallback') + running -= 1; + if (canceled) return; + if (err) return handleError(err); + + if (err === false) { + done = true; + canceled = true; + return; + } + + if (result === _breakLoop2.default || done && running <= 0) { + done = true; + //console.log('done iterCb') + return callback(null); + } + replenish(); + } + + function handleError(err) { + if (canceled) return; + awaiting = false; + done = true; + callback(err); + } + + replenish(); +} +module.exports = exports.default; + +/***/ }), + +/***/ 54808: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = awaitify; +// conditionally promisify a function. +// only return a promise if a callback is omitted +function awaitify(asyncFn, arity) { + if (!arity) arity = asyncFn.length; + if (!arity) throw new Error('arity is undefined'); + function awaitable(...args) { + if (typeof args[arity - 1] === 'function') { + return asyncFn.apply(this, args); + } + + return new Promise((resolve, reject) => { + args[arity - 1] = (err, ...cbArgs) => { + if (err) return reject(err); + resolve(cbArgs.length > 1 ? cbArgs : cbArgs[0]); + }; + asyncFn.apply(this, args); + }); + } + + return awaitable; +} +module.exports = exports.default; + +/***/ }), + +/***/ 6347: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +// A temporary value used to identify if the loop should be broken. +// See #1064, #1293 +const breakLoop = {}; +exports["default"] = breakLoop; +module.exports = exports.default; + +/***/ }), + +/***/ 73745: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _once = __webpack_require__(67721); + +var _once2 = _interopRequireDefault(_once); + +var _iterator = __webpack_require__(63762); + +var _iterator2 = _interopRequireDefault(_iterator); + +var _onlyOnce = __webpack_require__(24611); + +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); + +var _wrapAsync = __webpack_require__(86190); + +var _asyncEachOfLimit = __webpack_require__(95775); + +var _asyncEachOfLimit2 = _interopRequireDefault(_asyncEachOfLimit); + +var _breakLoop = __webpack_require__(6347); + +var _breakLoop2 = _interopRequireDefault(_breakLoop); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports["default"] = limit => { + return (obj, iteratee, callback) => { + callback = (0, _once2.default)(callback); + if (limit <= 0) { + throw new RangeError('concurrency limit cannot be less than 1'); + } + if (!obj) { + return callback(null); + } + if ((0, _wrapAsync.isAsyncGenerator)(obj)) { + return (0, _asyncEachOfLimit2.default)(obj, limit, iteratee, callback); + } + if ((0, _wrapAsync.isAsyncIterable)(obj)) { + return (0, _asyncEachOfLimit2.default)(obj[Symbol.asyncIterator](), limit, iteratee, callback); + } + var nextElem = (0, _iterator2.default)(obj); + var done = false; + var canceled = false; + var running = 0; + var looping = false; + + function iterateeCallback(err, value) { + if (canceled) return; + running -= 1; + if (err) { + done = true; + callback(err); + } else if (err === false) { + done = true; + canceled = true; + } else if (value === _breakLoop2.default || done && running <= 0) { + done = true; + return callback(null); + } else if (!looping) { + replenish(); + } + } + + function replenish() { + looping = true; + while (running < limit && !done) { + var elem = nextElem(); + if (elem === null) { + done = true; + if (running <= 0) { + callback(null); + } + return; + } + running += 1; + iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback)); + } + looping = false; + } + + replenish(); + }; +}; + +module.exports = exports.default; + +/***/ }), + +/***/ 20404: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +exports["default"] = function (coll) { + return coll[Symbol.iterator] && coll[Symbol.iterator](); +}; + +module.exports = exports.default; + +/***/ }), + +/***/ 37564: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +exports["default"] = function (fn) { + return function (...args /*, callback*/) { + var callback = args.pop(); + return fn.call(this, args, callback); + }; +}; + +module.exports = exports.default; + +/***/ }), + +/***/ 88684: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = isArrayLike; +function isArrayLike(value) { + return value && typeof value.length === 'number' && value.length >= 0 && value.length % 1 === 0; +} +module.exports = exports.default; + +/***/ }), + +/***/ 63762: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = createIterator; + +var _isArrayLike = __webpack_require__(88684); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _getIterator = __webpack_require__(20404); + +var _getIterator2 = _interopRequireDefault(_getIterator); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function createArrayIterator(coll) { + var i = -1; + var len = coll.length; + return function next() { + return ++i < len ? { value: coll[i], key: i } : null; + }; +} + +function createES2015Iterator(iterator) { + var i = -1; + return function next() { + var item = iterator.next(); + if (item.done) return null; + i++; + return { value: item.value, key: i }; + }; +} + +function createObjectIterator(obj) { + var okeys = obj ? Object.keys(obj) : []; + var i = -1; + var len = okeys.length; + return function next() { + var key = okeys[++i]; + if (key === '__proto__') { + return next(); + } + return i < len ? { value: obj[key], key } : null; + }; +} + +function createIterator(coll) { + if ((0, _isArrayLike2.default)(coll)) { + return createArrayIterator(coll); + } + + var iterator = (0, _getIterator2.default)(coll); + return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); +} +module.exports = exports.default; + +/***/ }), + +/***/ 67721: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = once; +function once(fn) { + function wrapper(...args) { + if (fn === null) return; + var callFn = fn; + fn = null; + callFn.apply(this, args); + } + Object.assign(wrapper, fn); + return wrapper; +} +module.exports = exports.default; + +/***/ }), + +/***/ 24611: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = onlyOnce; +function onlyOnce(fn) { + return function (...args) { + if (fn === null) throw new Error("Callback was already called."); + var callFn = fn; + fn = null; + callFn.apply(this, args); + }; +} +module.exports = exports.default; + +/***/ }), + +/***/ 95603: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); + +var _isArrayLike = __webpack_require__(88684); + +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); + +var _wrapAsync = __webpack_require__(86190); + +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); + +var _awaitify = __webpack_require__(54808); + +var _awaitify2 = _interopRequireDefault(_awaitify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +exports["default"] = (0, _awaitify2.default)((eachfn, tasks, callback) => { + var results = (0, _isArrayLike2.default)(tasks) ? [] : {}; + + eachfn(tasks, (task, key, taskCb) => { + (0, _wrapAsync2.default)(task)((err, ...result) => { + if (result.length < 2) { + [result] = result; + } + results[key] = result; + taskCb(err); + }); + }, err => callback(err, results)); +}, 3); +module.exports = exports.default; + +/***/ }), + +/***/ 6793: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.fallback = fallback; +exports.wrap = wrap; +/* istanbul ignore file */ + +var hasQueueMicrotask = exports.hasQueueMicrotask = typeof queueMicrotask === 'function' && queueMicrotask; +var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate; +var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; + +function fallback(fn) { + setTimeout(fn, 0); +} + +function wrap(defer) { + return (fn, ...args) => defer(() => fn(...args)); +} + +var _defer; + +if (hasQueueMicrotask) { + _defer = queueMicrotask; +} else if (hasSetImmediate) { + _defer = setImmediate; +} else if (hasNextTick) { + _defer = process.nextTick; +} else { + _defer = fallback; +} + +exports["default"] = wrap(_defer); + +/***/ }), + +/***/ 632: +/***/ ((module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = _withoutIndex; +function _withoutIndex(iteratee) { + return (value, index, callback) => iteratee(value, callback); +} +module.exports = exports.default; + +/***/ }), + +/***/ 86190: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports.isAsyncIterable = exports.isAsyncGenerator = exports.isAsync = undefined; + +var _asyncify = __webpack_require__(53138); + +var _asyncify2 = _interopRequireDefault(_asyncify); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function isAsync(fn) { + return fn[Symbol.toStringTag] === 'AsyncFunction'; +} + +function isAsyncGenerator(fn) { + return fn[Symbol.toStringTag] === 'AsyncGenerator'; +} + +function isAsyncIterable(obj) { + return typeof obj[Symbol.asyncIterator] === 'function'; +} + +function wrapAsync(asyncFn) { + if (typeof asyncFn !== 'function') throw new Error('expected a function'); + return isAsync(asyncFn) ? (0, _asyncify2.default)(asyncFn) : asyncFn; +} + +exports["default"] = wrapAsync; +exports.isAsync = isAsync; +exports.isAsyncGenerator = isAsyncGenerator; +exports.isAsyncIterable = isAsyncIterable; + +/***/ }), + +/***/ 43745: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = series; + +var _parallel2 = __webpack_require__(95603); + +var _parallel3 = _interopRequireDefault(_parallel2); + +var _eachOfSeries = __webpack_require__(17249); + +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Run the functions in the `tasks` collection in series, each one running once + * the previous function has completed. If any functions in the series pass an + * error to its callback, no more functions are run, and `callback` is + * immediately called with the value of the error. Otherwise, `callback` + * receives an array of results when `tasks` have completed. + * + * It is also possible to use an object instead of an array. Each property will + * be run as a function, and the results will be passed to the final `callback` + * as an object instead of an array. This can be a more readable way of handling + * results from {@link async.series}. + * + * **Note** that while many implementations preserve the order of object + * properties, the [ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) + * explicitly states that + * + * > The mechanics and order of enumerating the properties is not specified. + * + * So if you rely on the order in which your series of functions are executed, + * and want this to work on all platforms, consider using an array. + * + * @name series + * @static + * @memberOf module:ControlFlow + * @method + * @category Control Flow + * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing + * [async functions]{@link AsyncFunction} to run in series. + * Each function can complete with any number of optional `result` values. + * @param {Function} [callback] - An optional callback to run once all the + * functions have completed. This function gets a results array (or object) + * containing all the result arguments passed to the `task` callbacks. Invoked + * with (err, result). + * @return {Promise} a promise, if no callback is passed + * @example + * + * //Using Callbacks + * async.series([ + * function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 'two'); + * }, 100); + * } + * ], function(err, results) { + * console.log(results); + * // results is equal to ['one','two'] + * }); + * + * // an example using objects instead of arrays + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 2); + * }, 100); + * } + * }, function(err, results) { + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }); + * + * //Using Promises + * async.series([ + * function(callback) { + * setTimeout(function() { + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * callback(null, 'two'); + * }, 100); + * } + * ]).then(results => { + * console.log(results); + * // results is equal to ['one','two'] + * }).catch(err => { + * console.log(err); + * }); + * + * // an example using an object instead of an array + * async.series({ + * one: function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 2); + * }, 100); + * } + * }).then(results => { + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * }).catch(err => { + * console.log(err); + * }); + * + * //Using async/await + * async () => { + * try { + * let results = await async.series([ + * function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 'one'); + * }, 200); + * }, + * function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 'two'); + * }, 100); + * } + * ]); + * console.log(results); + * // results is equal to ['one','two'] + * } + * catch (err) { + * console.log(err); + * } + * } + * + * // an example using an object instead of an array + * async () => { + * try { + * let results = await async.parallel({ + * one: function(callback) { + * setTimeout(function() { + * // do some async task + * callback(null, 1); + * }, 200); + * }, + * two: function(callback) { + * setTimeout(function() { + * // then do another async task + * callback(null, 2); + * }, 100); + * } + * }); + * console.log(results); + * // results is equal to: { one: 1, two: 2 } + * } + * catch (err) { + * console.log(err); + * } + * } + * + */ +function series(tasks, callback) { + return (0, _parallel3.default)(_eachOfSeries2.default, tasks, callback); +} +module.exports = exports.default; + +/***/ }), + +/***/ 16722: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 79272: +/***/ ((module, exports, __webpack_require__) => { + +/** + * Module dependencies. + */ + +var fs = __webpack_require__(79896), + path = __webpack_require__(16928), + fileURLToPath = __webpack_require__(25241), + join = path.join, + dirname = path.dirname, + exists = + (fs.accessSync && + function(path) { + try { + fs.accessSync(path); + } catch (e) { + return false; + } + return true; + }) || + fs.existsSync || + path.existsSync, + defaults = { + arrow: process.env.NODE_BINDINGS_ARROW || ' → ', + compiled: process.env.NODE_BINDINGS_COMPILED_DIR || 'compiled', + platform: process.platform, + arch: process.arch, + nodePreGyp: + 'node-v' + + process.versions.modules + + '-' + + process.platform + + '-' + + process.arch, + version: process.versions.node, + bindings: 'bindings.node', + try: [ + // node-gyp's linked version in the "build" dir + ['module_root', 'build', 'bindings'], + // node-waf and gyp_addon (a.k.a node-gyp) + ['module_root', 'build', 'Debug', 'bindings'], + ['module_root', 'build', 'Release', 'bindings'], + // Debug files, for development (legacy behavior, remove for node v0.9) + ['module_root', 'out', 'Debug', 'bindings'], + ['module_root', 'Debug', 'bindings'], + // Release files, but manually compiled (legacy behavior, remove for node v0.9) + ['module_root', 'out', 'Release', 'bindings'], + ['module_root', 'Release', 'bindings'], + // Legacy from node-waf, node <= 0.4.x + ['module_root', 'build', 'default', 'bindings'], + // Production "Release" buildtype binary (meh...) + ['module_root', 'compiled', 'version', 'platform', 'arch', 'bindings'], + // node-qbs builds + ['module_root', 'addon-build', 'release', 'install-root', 'bindings'], + ['module_root', 'addon-build', 'debug', 'install-root', 'bindings'], + ['module_root', 'addon-build', 'default', 'install-root', 'bindings'], + // node-pre-gyp path ./lib/binding/{node_abi}-{platform}-{arch} + ['module_root', 'lib', 'binding', 'nodePreGyp', 'bindings'] + ] + }; + +/** + * The main `bindings()` function loads the compiled bindings for a given module. + * It uses V8's Error API to determine the parent filename that this function is + * being invoked from, which is then used to find the root directory. + */ + +function bindings(opts) { + // Argument surgery + if (typeof opts == 'string') { + opts = { bindings: opts }; + } else if (!opts) { + opts = {}; + } + + // maps `defaults` onto `opts` object + Object.keys(defaults).map(function(i) { + if (!(i in opts)) opts[i] = defaults[i]; + }); + + // Get the module root + if (!opts.module_root) { + opts.module_root = exports.getRoot(exports.getFileName()); + } + + // Ensure the given bindings name ends with .node + if (path.extname(opts.bindings) != '.node') { + opts.bindings += '.node'; + } + + // https://github.com/webpack/webpack/issues/4175#issuecomment-342931035 + var requireFunc = + true + ? require + : 0; + + var tries = [], + i = 0, + l = opts.try.length, + n, + b, + err; + + for (; i < l; i++) { + n = join.apply( + null, + opts.try[i].map(function(p) { + return opts[p] || p; + }) + ); + tries.push(n); + try { + b = opts.path ? requireFunc.resolve(n) : requireFunc(n); + if (!opts.path) { + b.path = n; + } + return b; + } catch (e) { + if (e.code !== 'MODULE_NOT_FOUND' && + e.code !== 'QUALIFIED_PATH_RESOLUTION_FAILED' && + !/not find/i.test(e.message)) { + throw e; + } + } + } + + err = new Error( + 'Could not locate the bindings file. Tried:\n' + + tries + .map(function(a) { + return opts.arrow + a; + }) + .join('\n') + ); + err.tries = tries; + throw err; +} +module.exports = exports = bindings; + +/** + * Gets the filename of the JavaScript file that invokes this function. + * Used to help find the root directory of a module. + * Optionally accepts an filename argument to skip when searching for the invoking filename + */ + +exports.getFileName = function getFileName(calling_file) { + var origPST = Error.prepareStackTrace, + origSTL = Error.stackTraceLimit, + dummy = {}, + fileName; + + Error.stackTraceLimit = 10; + + Error.prepareStackTrace = function(e, st) { + for (var i = 0, l = st.length; i < l; i++) { + fileName = st[i].getFileName(); + if (fileName !== __filename) { + if (calling_file) { + if (fileName !== calling_file) { + return; + } + } else { + return; + } + } + } + }; + + // run the 'prepareStackTrace' function above + Error.captureStackTrace(dummy); + dummy.stack; + + // cleanup + Error.prepareStackTrace = origPST; + Error.stackTraceLimit = origSTL; + + // handle filename that starts with "file://" + var fileSchema = 'file://'; + if (fileName.indexOf(fileSchema) === 0) { + fileName = fileURLToPath(fileName); + } + + return fileName; +}; + +/** + * Gets the root directory of a module, given an arbitrary filename + * somewhere in the module tree. The "root directory" is the directory + * containing the `package.json` file. + * + * In: /home/nate/node-native-module/lib/index.js + * Out: /home/nate/node-native-module + */ + +exports.getRoot = function getRoot(file) { + var dir = dirname(file), + prev; + while (true) { + if (dir === '.') { + // Avoids an infinite loop in rare cases, like the REPL + dir = process.cwd(); + } + if ( + exists(join(dir, 'package.json')) || + exists(join(dir, 'node_modules')) + ) { + // Found the 'package.json' file or 'node_modules' dir; we're done + return dir; + } + if (prev === dir) { + // Got to the top + throw new Error( + 'Could not find module root given file: "' + + file + + '". Do you have a `package.json` file? ' + ); + } + // Try the parent dir next + prev = dir; + dir = join(dir, '..'); + } +}; + + +/***/ }), + +/***/ 96586: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var util = __webpack_require__(39023), + Match = __webpack_require__ (19630); + + +/** + * This is a superclass for the individual detectors for + * each of the detectable members of the ISO 2022 family + * of encodings. + */ + +function ISO_2022() {} + +ISO_2022.prototype.match = function(det) { + + /** + * Matching function shared among the 2022 detectors JP, CN and KR + * Counts up the number of legal an unrecognized escape sequences in + * the sample of text, and computes a score based on the total number & + * the proportion that fit the encoding. + * + * + * @param text the byte buffer containing text to analyse + * @param textLen the size of the text in the byte. + * @param escapeSequences the byte escape sequences to test for. + * @return match quality, in the range of 0-100. + */ + + var i, j; + var escN; + var hits = 0; + var misses = 0; + var shifts = 0; + var quality; + + // TODO: refactor me + var text = det.fInputBytes; + var textLen = det.fInputLen; + + scanInput: + for (i = 0; i < textLen; i++) { + if (text[i] == 0x1b) { + checkEscapes: + for (escN = 0; escN < this.escapeSequences.length; escN++) { + var seq = this.escapeSequences[escN]; + + if ((textLen - i) < seq.length) + continue checkEscapes; + + for (j = 1; j < seq.length; j++) + if (seq[j] != text[i + j]) + continue checkEscapes; + + + hits++; + i += seq.length - 1; + continue scanInput; + } + + misses++; + } + + // Shift in/out + if (text[i] == 0x0e || text[i] == 0x0f) + shifts++; + + } + + if (hits == 0) + return null; + + // + // Initial quality is based on relative proportion of recongized vs. + // unrecognized escape sequences. + // All good: quality = 100; + // half or less good: quality = 0; + // linear inbetween. + quality = (100 * hits - 100 * misses) / (hits + misses); + + // Back off quality if there were too few escape sequences seen. + // Include shifts in this computation, so that KR does not get penalized + // for having only a single Escape sequence, but many shifts. + if (hits + shifts < 5) + quality -= (5 - (hits + shifts)) * 10; + + return quality <= 0 ? null : new Match(det, this, quality); +}; + +module.exports.ISO_2022_JP = function() { + this.name = function() { + return 'ISO-2022-JP'; + }; + this.escapeSequences = [ + [ 0x1b, 0x24, 0x28, 0x43 ], // KS X 1001:1992 + [ 0x1b, 0x24, 0x28, 0x44 ], // JIS X 212-1990 + [ 0x1b, 0x24, 0x40 ], // JIS C 6226-1978 + [ 0x1b, 0x24, 0x41 ], // GB 2312-80 + [ 0x1b, 0x24, 0x42 ], // JIS X 208-1983 + [ 0x1b, 0x26, 0x40 ], // JIS X 208 1990, 1997 + [ 0x1b, 0x28, 0x42 ], // ASCII + [ 0x1b, 0x28, 0x48 ], // JIS-Roman + [ 0x1b, 0x28, 0x49 ], // Half-width katakana + [ 0x1b, 0x28, 0x4a ], // JIS-Roman + [ 0x1b, 0x2e, 0x41 ], // ISO 8859-1 + [ 0x1b, 0x2e, 0x46 ] // ISO 8859-7 + ]; +}; +util.inherits(module.exports.ISO_2022_JP, ISO_2022); + + + +module.exports.ISO_2022_KR = function() { + this.name = function() { + return 'ISO-2022-KR'; + }; + this.escapeSequences = [ + [ 0x1b, 0x24, 0x29, 0x43 ] + ]; +}; +util.inherits(module.exports.ISO_2022_KR, ISO_2022); + + + +module.exports.ISO_2022_CN = function() { + this.name = function() { + return 'ISO-2022-CN'; + }; + this.escapeSequences = [ + [ 0x1b, 0x24, 0x29, 0x41 ], // GB 2312-80 + [ 0x1b, 0x24, 0x29, 0x47 ], // CNS 11643-1992 Plane 1 + [ 0x1b, 0x24, 0x2A, 0x48 ], // CNS 11643-1992 Plane 2 + [ 0x1b, 0x24, 0x29, 0x45 ], // ISO-IR-165 + [ 0x1b, 0x24, 0x2B, 0x49 ], // CNS 11643-1992 Plane 3 + [ 0x1b, 0x24, 0x2B, 0x4A ], // CNS 11643-1992 Plane 4 + [ 0x1b, 0x24, 0x2B, 0x4B ], // CNS 11643-1992 Plane 5 + [ 0x1b, 0x24, 0x2B, 0x4C ], // CNS 11643-1992 Plane 6 + [ 0x1b, 0x24, 0x2B, 0x4D ], // CNS 11643-1992 Plane 7 + [ 0x1b, 0x4e ], // SS2 + [ 0x1b, 0x4f ] // SS3 + ]; +}; +util.inherits(module.exports.ISO_2022_CN, ISO_2022); + + +/***/ }), + +/***/ 31256: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var util = __webpack_require__(39023), + Match = __webpack_require__ (19630); + +/** + * Binary search implementation (recursive) + */ +function binarySearch(arr, searchValue) { + function find(arr, searchValue, left, right) { + if (right < left) + return -1; + + /* + int mid = mid = (left + right) / 2; + There is a bug in the above line; + Joshua Bloch suggests the following replacement: + */ + var mid = Math.floor((left + right) >>> 1); + if (searchValue > arr[mid]) + return find(arr, searchValue, mid + 1, right); + + if (searchValue < arr[mid]) + return find(arr, searchValue, left, mid - 1); + + return mid; + }; + + return find(arr, searchValue, 0, arr.length - 1); +}; + +// 'Character' iterated character class. +// Recognizers for specific mbcs encodings make their 'characters' available +// by providing a nextChar() function that fills in an instance of iteratedChar +// with the next char from the input. +// The returned characters are not converted to Unicode, but remain as the raw +// bytes (concatenated into an int) from the codepage data. +// +// For Asian charsets, use the raw input rather than the input that has been +// stripped of markup. Detection only considers multi-byte chars, effectively +// stripping markup anyway, and double byte chars do occur in markup too. +// +function IteratedChar() { + + this.charValue = 0; // 1-4 bytes from the raw input data + this.index = 0; + this.nextIndex = 0; + this.error = false; + this.done = false; + + this.reset = function() { + this.charValue = 0; + this.index = -1; + this.nextIndex = 0; + this.error = false; + this.done = false; + }; + + this.nextByte = function(det) { + if (this.nextIndex >= det.fRawLength) { + this.done = true; + return -1; + } + var byteValue = det.fRawInput[this.nextIndex++] & 0x00ff; + return byteValue; + }; +}; + + + +/** + * Asian double or multi-byte - charsets. + * Match is determined mostly by the input data adhering to the + * encoding scheme for the charset, and, optionally, + * frequency-of-occurence of characters. + */ + +function mbcs() {}; + +/** + * Test the match of this charset with the input text data + * which is obtained via the CharsetDetector object. + * + * @param det The CharsetDetector, which contains the input text + * to be checked for being in this charset. + * @return Two values packed into one int (Damn java, anyhow) + * bits 0-7: the match confidence, ranging from 0-100 + * bits 8-15: The match reason, an enum-like value. + */ +mbcs.prototype.match = function(det) { + + var singleByteCharCount = 0, //TODO Do we really need this? + doubleByteCharCount = 0, + commonCharCount = 0, + badCharCount = 0, + totalCharCount = 0, + confidence = 0; + + var iter = new IteratedChar(); + + detectBlock: { + for (iter.reset(); this.nextChar(iter, det);) { + totalCharCount++; + if (iter.error) { + badCharCount++; + } else { + var cv = iter.charValue & 0xFFFFFFFF; + + if (cv <= 0xff) { + singleByteCharCount++; + } else { + doubleByteCharCount++; + if (this.commonChars != null) { + // NOTE: This assumes that there are no 4-byte common chars. + if (binarySearch(this.commonChars, cv) >= 0) { + commonCharCount++; + } + } + } + } + if (badCharCount >= 2 && badCharCount * 5 >= doubleByteCharCount) { + // console.log('its here!') + // Bail out early if the byte data is not matching the encoding scheme. + break detectBlock; + } + } + + if (doubleByteCharCount <= 10 && badCharCount== 0) { + // Not many multi-byte chars. + if (doubleByteCharCount == 0 && totalCharCount < 10) { + // There weren't any multibyte sequences, and there was a low density of non-ASCII single bytes. + // We don't have enough data to have any confidence. + // Statistical analysis of single byte non-ASCII charcters would probably help here. + confidence = 0; + } + else { + // ASCII or ISO file? It's probably not our encoding, + // but is not incompatible with our encoding, so don't give it a zero. + confidence = 10; + } + break detectBlock; + } + + // + // No match if there are too many characters that don't fit the encoding scheme. + // (should we have zero tolerance for these?) + // + if (doubleByteCharCount < 20 * badCharCount) { + confidence = 0; + break detectBlock; + } + + if (this.commonChars == null) { + // We have no statistics on frequently occuring characters. + // Assess confidence purely on having a reasonable number of + // multi-byte characters (the more the better + confidence = 30 + doubleByteCharCount - 20 * badCharCount; + if (confidence > 100) { + confidence = 100; + } + } else { + // + // Frequency of occurence statistics exist. + // + var maxVal = Math.log(parseFloat(doubleByteCharCount) / 4); + var scaleFactor = 90.0 / maxVal; + confidence = Math.floor(Math.log(commonCharCount + 1) * scaleFactor + 10); + confidence = Math.min(confidence, 100); + } + } // end of detectBlock: + + return confidence == 0 ? null : new Match(det, this, confidence); +}; + +/** + * Get the next character (however many bytes it is) from the input data + * Subclasses for specific charset encodings must implement this function + * to get characters according to the rules of their encoding scheme. + * + * This function is not a method of class iteratedChar only because + * that would require a lot of extra derived classes, which is awkward. + * @param it The iteratedChar 'struct' into which the returned char is placed. + * @param det The charset detector, which is needed to get at the input byte data + * being iterated over. + * @return True if a character was returned, false at end of input. + */ + +mbcs.prototype.nextChar = function(iter, det) {}; + + + +/** + * Shift-JIS charset recognizer. + */ +module.exports.sjis = function() { + this.name = function() { + return 'Shift-JIS'; + }; + this.language = function() { + return 'ja'; + }; + + // TODO: This set of data comes from the character frequency- + // of-occurence analysis tool. The data needs to be moved + // into a resource and loaded from there. + this.commonChars = [ + 0x8140, 0x8141, 0x8142, 0x8145, 0x815b, 0x8169, 0x816a, 0x8175, 0x8176, 0x82a0, + 0x82a2, 0x82a4, 0x82a9, 0x82aa, 0x82ab, 0x82ad, 0x82af, 0x82b1, 0x82b3, 0x82b5, + 0x82b7, 0x82bd, 0x82be, 0x82c1, 0x82c4, 0x82c5, 0x82c6, 0x82c8, 0x82c9, 0x82cc, + 0x82cd, 0x82dc, 0x82e0, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82f0, 0x82f1, 0x8341, + 0x8343, 0x834e, 0x834f, 0x8358, 0x835e, 0x8362, 0x8367, 0x8375, 0x8376, 0x8389, + 0x838a, 0x838b, 0x838d, 0x8393, 0x8e96, 0x93fa, 0x95aa + ]; + + this.nextChar = function(iter, det) { + iter.index = iter.nextIndex; + iter.error = false; + + var firstByte; + firstByte = iter.charValue = iter.nextByte(det); + if (firstByte < 0) + return false; + + if (firstByte <= 0x7f || (firstByte > 0xa0 && firstByte <= 0xdf)) + return true; + + var secondByte = iter.nextByte(det); + if (secondByte < 0) + return false; + + iter.charValue = (firstByte << 8) | secondByte; + if (! ((secondByte >= 0x40 && secondByte <= 0x7f) || (secondByte >= 0x80 && secondByte <= 0xff))) { + // Illegal second byte value. + iter.error = true; + } + return true; + }; +}; +util.inherits(module.exports.sjis, mbcs); + + + +/** + * Big5 charset recognizer. + */ +module.exports.big5 = function() { + this.name = function() { + return 'Big5'; + }; + this.language = function() { + return 'zh'; + }; + // TODO: This set of data comes from the character frequency- + // of-occurence analysis tool. The data needs to be moved + // into a resource and loaded from there. + this.commonChars = [ + 0xa140, 0xa141, 0xa142, 0xa143, 0xa147, 0xa149, 0xa175, 0xa176, 0xa440, 0xa446, + 0xa447, 0xa448, 0xa451, 0xa454, 0xa457, 0xa464, 0xa46a, 0xa46c, 0xa477, 0xa4a3, + 0xa4a4, 0xa4a7, 0xa4c1, 0xa4ce, 0xa4d1, 0xa4df, 0xa4e8, 0xa4fd, 0xa540, 0xa548, + 0xa558, 0xa569, 0xa5cd, 0xa5e7, 0xa657, 0xa661, 0xa662, 0xa668, 0xa670, 0xa6a8, + 0xa6b3, 0xa6b9, 0xa6d3, 0xa6db, 0xa6e6, 0xa6f2, 0xa740, 0xa751, 0xa759, 0xa7da, + 0xa8a3, 0xa8a5, 0xa8ad, 0xa8d1, 0xa8d3, 0xa8e4, 0xa8fc, 0xa9c0, 0xa9d2, 0xa9f3, + 0xaa6b, 0xaaba, 0xaabe, 0xaacc, 0xaafc, 0xac47, 0xac4f, 0xacb0, 0xacd2, 0xad59, + 0xaec9, 0xafe0, 0xb0ea, 0xb16f, 0xb2b3, 0xb2c4, 0xb36f, 0xb44c, 0xb44e, 0xb54c, + 0xb5a5, 0xb5bd, 0xb5d0, 0xb5d8, 0xb671, 0xb7ed, 0xb867, 0xb944, 0xbad8, 0xbb44, + 0xbba1, 0xbdd1, 0xc2c4, 0xc3b9, 0xc440, 0xc45f + ]; + this.nextChar = function(iter, det) { + iter.index = iter.nextIndex; + iter.error = false; + + var firstByte = iter.charValue = iter.nextByte(det); + + if (firstByte < 0) + return false; + + // single byte character. + if (firstByte <= 0x7f || firstByte == 0xff) + return true; + + var secondByte = iter.nextByte(det); + + if (secondByte < 0) + return false; + + iter.charValue = (iter.charValue << 8) | secondByte; + + if (secondByte < 0x40 || secondByte == 0x7f || secondByte == 0xff) + iter.error = true; + + return true; + }; +}; +util.inherits(module.exports.big5, mbcs); + + + +/** + * EUC charset recognizers. One abstract class that provides the common function + * for getting the next character according to the EUC encoding scheme, + * and nested derived classes for EUC_KR, EUC_JP, EUC_CN. + * + * Get the next character value for EUC based encodings. + * Character 'value' is simply the raw bytes that make up the character + * packed into an int. + */ +function eucNextChar(iter, det) { + iter.index = iter.nextIndex; + iter.error = false; + var firstByte = 0; + var secondByte = 0; + var thirdByte = 0; + //int fourthByte = 0; + buildChar: { + firstByte = iter.charValue = iter.nextByte(det); + if (firstByte < 0) { + // Ran off the end of the input data + iter.done = true; + break buildChar; + } + if (firstByte <= 0x8d) { + // single byte char + break buildChar; + } + secondByte = iter.nextByte(det); + iter.charValue = (iter.charValue << 8) | secondByte; + if (firstByte >= 0xA1 && firstByte <= 0xfe) { + // Two byte Char + if (secondByte < 0xa1) { + iter.error = true; + } + break buildChar; + } + if (firstByte == 0x8e) { + // Code Set 2. + // In EUC-JP, total char size is 2 bytes, only one byte of actual char value. + // In EUC-TW, total char size is 4 bytes, three bytes contribute to char value. + // We don't know which we've got. + // Treat it like EUC-JP. If the data really was EUC-TW, the following two + // bytes will look like a well formed 2 byte char. + if (secondByte < 0xa1) { + iter.error = true; + } + break buildChar; + } + if (firstByte == 0x8f) { + // Code set 3. + // Three byte total char size, two bytes of actual char value. + thirdByte = iter.nextByte(det); + iter.charValue = (iter.charValue << 8) | thirdByte; + if (thirdByte < 0xa1) { + iter.error = true; + } + } + } + return iter.done == false; +}; + + + +/** + * The charset recognize for EUC-JP. A singleton instance of this class + * is created and kept by the public CharsetDetector class + */ +module.exports.euc_jp = function() { + this.name = function() { + return 'EUC-JP'; + }; + this.language = function() { + return 'ja'; + }; + + // TODO: This set of data comes from the character frequency- + // of-occurence analysis tool. The data needs to be moved + // into a resource and loaded from there. + this.commonChars = [ + 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a6, 0xa1bc, 0xa1ca, 0xa1cb, 0xa1d6, 0xa1d7, 0xa4a2, + 0xa4a4, 0xa4a6, 0xa4a8, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4af, 0xa4b1, 0xa4b3, + 0xa4b5, 0xa4b7, 0xa4b9, 0xa4bb, 0xa4bd, 0xa4bf, 0xa4c0, 0xa4c1, 0xa4c3, 0xa4c4, + 0xa4c6, 0xa4c7, 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb, 0xa4ce, 0xa4cf, 0xa4d0, 0xa4de, + 0xa4df, 0xa4e1, 0xa4e2, 0xa4e4, 0xa4e8, 0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ef, + 0xa4f2, 0xa4f3, 0xa5a2, 0xa5a3, 0xa5a4, 0xa5a6, 0xa5a7, 0xa5aa, 0xa5ad, 0xa5af, + 0xa5b0, 0xa5b3, 0xa5b5, 0xa5b7, 0xa5b8, 0xa5b9, 0xa5bf, 0xa5c3, 0xa5c6, 0xa5c7, + 0xa5c8, 0xa5c9, 0xa5cb, 0xa5d0, 0xa5d5, 0xa5d6, 0xa5d7, 0xa5de, 0xa5e0, 0xa5e1, + 0xa5e5, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5f3, 0xb8a9, 0xb9d4, 0xbaee, + 0xbbc8, 0xbef0, 0xbfb7, 0xc4ea, 0xc6fc, 0xc7bd, 0xcab8, 0xcaf3, 0xcbdc, 0xcdd1 + ]; + + this.nextChar = eucNextChar; +}; +util.inherits(module.exports.euc_jp, mbcs); + + + +/** + * The charset recognize for EUC-KR. A singleton instance of this class + * is created and kept by the public CharsetDetector class + */ +module.exports.euc_kr = function() { + this.name = function() { + return 'EUC-KR'; + }; + this.language = function() { + return 'ko'; + }; + + // TODO: This set of data comes from the character frequency- + // of-occurence analysis tool. The data needs to be moved + // into a resource and loaded from there. + this.commonChars = [ + 0xb0a1, 0xb0b3, 0xb0c5, 0xb0cd, 0xb0d4, 0xb0e6, 0xb0ed, 0xb0f8, 0xb0fa, 0xb0fc, + 0xb1b8, 0xb1b9, 0xb1c7, 0xb1d7, 0xb1e2, 0xb3aa, 0xb3bb, 0xb4c2, 0xb4cf, 0xb4d9, + 0xb4eb, 0xb5a5, 0xb5b5, 0xb5bf, 0xb5c7, 0xb5e9, 0xb6f3, 0xb7af, 0xb7c2, 0xb7ce, + 0xb8a6, 0xb8ae, 0xb8b6, 0xb8b8, 0xb8bb, 0xb8e9, 0xb9ab, 0xb9ae, 0xb9cc, 0xb9ce, + 0xb9fd, 0xbab8, 0xbace, 0xbad0, 0xbaf1, 0xbbe7, 0xbbf3, 0xbbfd, 0xbcad, 0xbcba, + 0xbcd2, 0xbcf6, 0xbdba, 0xbdc0, 0xbdc3, 0xbdc5, 0xbec6, 0xbec8, 0xbedf, 0xbeee, + 0xbef8, 0xbefa, 0xbfa1, 0xbfa9, 0xbfc0, 0xbfe4, 0xbfeb, 0xbfec, 0xbff8, 0xc0a7, + 0xc0af, 0xc0b8, 0xc0ba, 0xc0bb, 0xc0bd, 0xc0c7, 0xc0cc, 0xc0ce, 0xc0cf, 0xc0d6, + 0xc0da, 0xc0e5, 0xc0fb, 0xc0fc, 0xc1a4, 0xc1a6, 0xc1b6, 0xc1d6, 0xc1df, 0xc1f6, + 0xc1f8, 0xc4a1, 0xc5cd, 0xc6ae, 0xc7cf, 0xc7d1, 0xc7d2, 0xc7d8, 0xc7e5, 0xc8ad + ]; + + this.nextChar = eucNextChar; +}; +util.inherits(module.exports.euc_kr, mbcs); + + + +/** + * GB-18030 recognizer. Uses simplified Chinese statistics. + */ +module.exports.gb_18030 = function() { + this.name = function() { + return 'GB18030'; + }; + this.language = function() { + return 'zh'; + }; + + /* + * Get the next character value for EUC based encodings. + * Character 'value' is simply the raw bytes that make up the character + * packed into an int. + */ + this.nextChar = function(iter, det) { + iter.index = iter.nextIndex; + iter.error = false; + var firstByte = 0; + var secondByte = 0; + var thirdByte = 0; + var fourthByte = 0; + buildChar: { + firstByte = iter.charValue = iter.nextByte(det); + if (firstByte < 0) { + // Ran off the end of the input data + iter.done = true; + break buildChar; + } + if (firstByte <= 0x80) { + // single byte char + break buildChar; + } + secondByte = iter.nextByte(det); + iter.charValue = (iter.charValue << 8) | secondByte; + if (firstByte >= 0x81 && firstByte <= 0xFE) { + // Two byte Char + if ((secondByte >= 0x40 && secondByte <= 0x7E) || (secondByte >=80 && secondByte <= 0xFE)) { + break buildChar; + } + // Four byte char + if (secondByte >= 0x30 && secondByte <= 0x39) { + thirdByte = iter.nextByte(det); + if (thirdByte >= 0x81 && thirdByte <= 0xFE) { + fourthByte = iter.nextByte(det); + if (fourthByte >= 0x30 && fourthByte <= 0x39) { + iter.charValue = (iter.charValue << 16) | (thirdByte << 8) | fourthByte; + break buildChar; + } + } + } + iter.error = true; + break buildChar; + } + } + return iter.done == false; + }; + + // TODO: This set of data comes from the character frequency- + // of-occurence analysis tool. The data needs to be moved + // into a resource and loaded from there. + this.commonChars = [ + 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1b0, 0xa1b1, 0xa1f1, 0xa1f3, 0xa3a1, 0xa3ac, + 0xa3ba, 0xb1a8, 0xb1b8, 0xb1be, 0xb2bb, 0xb3c9, 0xb3f6, 0xb4f3, 0xb5bd, 0xb5c4, + 0xb5e3, 0xb6af, 0xb6d4, 0xb6e0, 0xb7a2, 0xb7a8, 0xb7bd, 0xb7d6, 0xb7dd, 0xb8b4, + 0xb8df, 0xb8f6, 0xb9ab, 0xb9c9, 0xb9d8, 0xb9fa, 0xb9fd, 0xbacd, 0xbba7, 0xbbd6, + 0xbbe1, 0xbbfa, 0xbcbc, 0xbcdb, 0xbcfe, 0xbdcc, 0xbecd, 0xbedd, 0xbfb4, 0xbfc6, + 0xbfc9, 0xc0b4, 0xc0ed, 0xc1cb, 0xc2db, 0xc3c7, 0xc4dc, 0xc4ea, 0xc5cc, 0xc6f7, + 0xc7f8, 0xc8ab, 0xc8cb, 0xc8d5, 0xc8e7, 0xc9cf, 0xc9fa, 0xcab1, 0xcab5, 0xcac7, + 0xcad0, 0xcad6, 0xcaf5, 0xcafd, 0xccec, 0xcdf8, 0xceaa, 0xcec4, 0xced2, 0xcee5, + 0xcfb5, 0xcfc2, 0xcfd6, 0xd0c2, 0xd0c5, 0xd0d0, 0xd0d4, 0xd1a7, 0xd2aa, 0xd2b2, + 0xd2b5, 0xd2bb, 0xd2d4, 0xd3c3, 0xd3d0, 0xd3fd, 0xd4c2, 0xd4da, 0xd5e2, 0xd6d0 + ]; +}; +util.inherits(module.exports.gb_18030, mbcs); + + +/***/ }), + +/***/ 47730: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var util = __webpack_require__(39023), + Match = __webpack_require__ (19630); + +/** + * This class recognizes single-byte encodings. Because the encoding scheme is so + * simple, language statistics are used to do the matching. + */ + +function NGramParser(theNgramList, theByteMap) { + var N_GRAM_MASK = 0xFFFFFF; + + this.byteIndex = 0; + this.ngram = 0; + + this.ngramList = theNgramList; + this.byteMap = theByteMap; + + this.ngramCount = 0; + this.hitCount = 0; + + this.spaceChar; + + /* + * Binary search for value in table, which must have exactly 64 entries. + */ + this.search = function(table, value) { + var index = 0; + + if (table[index + 32] <= value) index += 32; + if (table[index + 16] <= value) index += 16; + if (table[index + 8] <= value) index += 8; + if (table[index + 4] <= value) index += 4; + if (table[index + 2] <= value) index += 2; + if (table[index + 1] <= value) index += 1; + if (table[index] > value) index -= 1; + + if (index < 0 || table[index] != value) + return -1; + + return index; + }; + + this.lookup = function(thisNgram) { + this.ngramCount += 1; + if (this.search(this.ngramList, thisNgram) >= 0) { + this.hitCount += 1; + } + }; + + this.addByte = function(b) { + this.ngram = ((this.ngram << 8) + (b & 0xFF)) & N_GRAM_MASK; + this.lookup(this.ngram); + } + + this.nextByte = function(det) { + if (this.byteIndex >= det.fInputLen) + return -1; + + return det.fInputBytes[this.byteIndex++] & 0xFF; + } + + this.parse = function(det, spaceCh) { + var b, ignoreSpace = false; + this.spaceChar = spaceCh; + + while ((b = this.nextByte(det)) >= 0) { + var mb = this.byteMap[b]; + + // TODO: 0x20 might not be a space in all character sets... + if (mb != 0) { + if (!(mb == this.spaceChar && ignoreSpace)) { + this.addByte(mb); + } + + ignoreSpace = (mb == this.spaceChar); + } + } + + // TODO: Is this OK? The buffer could have ended in the middle of a word... + this.addByte(this.spaceChar); + + var rawPercent = this.hitCount / this.ngramCount; + + // TODO - This is a bit of a hack to take care of a case + // were we were getting a confidence of 135... + if (rawPercent > 0.33) + return 98; + + return Math.floor(rawPercent * 300.0); + }; +}; + +function NGramsPlusLang(la, ng) { + this.fLang = la; + this.fNGrams = ng; +}; + +function sbcs() {}; +sbcs.prototype.spaceChar = 0x20; +sbcs.prototype.ngrams = function() {}; +sbcs.prototype.byteMap = function() {}; +sbcs.prototype.match = function(det) { + + var ngrams = this.ngrams(); + var multiple = (Array.isArray(ngrams) && ngrams[0] instanceof NGramsPlusLang); + + if (!multiple) { + var parser = new NGramParser(ngrams, this.byteMap()); + var confidence = parser.parse(det, this.spaceChar); + return confidence <= 0 ? null : new Match(det, this, confidence); + } + + var bestConfidenceSoFar = -1; + var lang = null; + + for (var i = ngrams.length - 1; i >= 0; i--) { + var ngl = ngrams[i]; + + var parser = new NGramParser(ngl.fNGrams, this.byteMap()); + var confidence = parser.parse(det, this.spaceChar); + if (confidence > bestConfidenceSoFar) { + bestConfidenceSoFar = confidence; + lang = ngl.fLang; + } + } + + var name = this.name(det); + return bestConfidenceSoFar <= 0 ? null : new Match(det, this, bestConfidenceSoFar, name, lang); +}; + + +module.exports.ISO_8859_1 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20, + 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + ]; + }; + + this.ngrams = function() { + return [ + new NGramsPlusLang('da', [ + 0x206166, 0x206174, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920, + 0x206D65, 0x206F67, 0x2070E5, 0x207369, 0x207374, 0x207469, 0x207669, 0x616620, + 0x616E20, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646572, 0x646574, + 0x652073, 0x656420, 0x656465, 0x656E20, 0x656E64, 0x657220, 0x657265, 0x657320, + 0x657420, 0x666F72, 0x676520, 0x67656E, 0x676572, 0x696765, 0x696C20, 0x696E67, + 0x6B6520, 0x6B6B65, 0x6C6572, 0x6C6967, 0x6C6C65, 0x6D6564, 0x6E6465, 0x6E6520, + 0x6E6720, 0x6E6765, 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722064, 0x722065, + 0x722073, 0x726520, 0x737465, 0x742073, 0x746520, 0x746572, 0x74696C, 0x766572 + ]), + new NGramsPlusLang('de', [ + 0x20616E, 0x206175, 0x206265, 0x206461, 0x206465, 0x206469, 0x206569, 0x206765, + 0x206861, 0x20696E, 0x206D69, 0x207363, 0x207365, 0x20756E, 0x207665, 0x20766F, + 0x207765, 0x207A75, 0x626572, 0x636820, 0x636865, 0x636874, 0x646173, 0x64656E, + 0x646572, 0x646965, 0x652064, 0x652073, 0x65696E, 0x656974, 0x656E20, 0x657220, + 0x657320, 0x67656E, 0x68656E, 0x687420, 0x696368, 0x696520, 0x696E20, 0x696E65, + 0x697420, 0x6C6963, 0x6C6C65, 0x6E2061, 0x6E2064, 0x6E2073, 0x6E6420, 0x6E6465, + 0x6E6520, 0x6E6720, 0x6E6765, 0x6E7465, 0x722064, 0x726465, 0x726569, 0x736368, + 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x756E64, 0x756E67, 0x766572 + ]), + new NGramsPlusLang('en', [ + 0x206120, 0x20616E, 0x206265, 0x20636F, 0x20666F, 0x206861, 0x206865, 0x20696E, + 0x206D61, 0x206F66, 0x207072, 0x207265, 0x207361, 0x207374, 0x207468, 0x20746F, + 0x207768, 0x616964, 0x616C20, 0x616E20, 0x616E64, 0x617320, 0x617420, 0x617465, + 0x617469, 0x642061, 0x642074, 0x652061, 0x652073, 0x652074, 0x656420, 0x656E74, + 0x657220, 0x657320, 0x666F72, 0x686174, 0x686520, 0x686572, 0x696420, 0x696E20, + 0x696E67, 0x696F6E, 0x697320, 0x6E2061, 0x6E2074, 0x6E6420, 0x6E6720, 0x6E7420, + 0x6F6620, 0x6F6E20, 0x6F7220, 0x726520, 0x727320, 0x732061, 0x732074, 0x736169, + 0x737420, 0x742074, 0x746572, 0x746861, 0x746865, 0x74696F, 0x746F20, 0x747320 + ]), + new NGramsPlusLang('es', [ + 0x206120, 0x206361, 0x20636F, 0x206465, 0x20656C, 0x20656E, 0x206573, 0x20696E, + 0x206C61, 0x206C6F, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365, + 0x20756E, 0x207920, 0x612063, 0x612064, 0x612065, 0x61206C, 0x612070, 0x616369, + 0x61646F, 0x616C20, 0x617220, 0x617320, 0x6369F3, 0x636F6E, 0x646520, 0x64656C, + 0x646F20, 0x652064, 0x652065, 0x65206C, 0x656C20, 0x656E20, 0x656E74, 0x657320, + 0x657374, 0x69656E, 0x69F36E, 0x6C6120, 0x6C6F73, 0x6E2065, 0x6E7465, 0x6F2064, + 0x6F2065, 0x6F6E20, 0x6F7220, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573, + 0x732064, 0x732065, 0x732070, 0x736520, 0x746520, 0x746F20, 0x756520, 0xF36E20 + ]), + new NGramsPlusLang('fr', [ + 0x206175, 0x20636F, 0x206461, 0x206465, 0x206475, 0x20656E, 0x206574, 0x206C61, + 0x206C65, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207365, 0x20736F, 0x20756E, + 0x20E020, 0x616E74, 0x617469, 0x636520, 0x636F6E, 0x646520, 0x646573, 0x647520, + 0x652061, 0x652063, 0x652064, 0x652065, 0x65206C, 0x652070, 0x652073, 0x656E20, + 0x656E74, 0x657220, 0x657320, 0x657420, 0x657572, 0x696F6E, 0x697320, 0x697420, + 0x6C6120, 0x6C6520, 0x6C6573, 0x6D656E, 0x6E2064, 0x6E6520, 0x6E7320, 0x6E7420, + 0x6F6E20, 0x6F6E74, 0x6F7572, 0x717565, 0x72206C, 0x726520, 0x732061, 0x732064, + 0x732065, 0x73206C, 0x732070, 0x742064, 0x746520, 0x74696F, 0x756520, 0x757220 + ]), + new NGramsPlusLang('it', [ + 0x20616C, 0x206368, 0x20636F, 0x206465, 0x206469, 0x206520, 0x20696C, 0x20696E, + 0x206C61, 0x207065, 0x207072, 0x20756E, 0x612063, 0x612064, 0x612070, 0x612073, + 0x61746F, 0x636865, 0x636F6E, 0x64656C, 0x646920, 0x652061, 0x652063, 0x652064, + 0x652069, 0x65206C, 0x652070, 0x652073, 0x656C20, 0x656C6C, 0x656E74, 0x657220, + 0x686520, 0x692061, 0x692063, 0x692064, 0x692073, 0x696120, 0x696C20, 0x696E20, + 0x696F6E, 0x6C6120, 0x6C6520, 0x6C6920, 0x6C6C61, 0x6E6520, 0x6E6920, 0x6E6F20, + 0x6E7465, 0x6F2061, 0x6F2064, 0x6F2069, 0x6F2073, 0x6F6E20, 0x6F6E65, 0x706572, + 0x726120, 0x726520, 0x736920, 0x746120, 0x746520, 0x746920, 0x746F20, 0x7A696F + ]), + new NGramsPlusLang('nl', [ + 0x20616C, 0x206265, 0x206461, 0x206465, 0x206469, 0x206565, 0x20656E, 0x206765, + 0x206865, 0x20696E, 0x206D61, 0x206D65, 0x206F70, 0x207465, 0x207661, 0x207665, + 0x20766F, 0x207765, 0x207A69, 0x61616E, 0x616172, 0x616E20, 0x616E64, 0x617220, + 0x617420, 0x636874, 0x646520, 0x64656E, 0x646572, 0x652062, 0x652076, 0x65656E, + 0x656572, 0x656E20, 0x657220, 0x657273, 0x657420, 0x67656E, 0x686574, 0x696520, + 0x696E20, 0x696E67, 0x697320, 0x6E2062, 0x6E2064, 0x6E2065, 0x6E2068, 0x6E206F, + 0x6E2076, 0x6E6465, 0x6E6720, 0x6F6E64, 0x6F6F72, 0x6F7020, 0x6F7220, 0x736368, + 0x737465, 0x742064, 0x746520, 0x74656E, 0x746572, 0x76616E, 0x766572, 0x766F6F + ]), + new NGramsPlusLang('no', [ + 0x206174, 0x206176, 0x206465, 0x20656E, 0x206572, 0x20666F, 0x206861, 0x206920, + 0x206D65, 0x206F67, 0x2070E5, 0x207365, 0x20736B, 0x20736F, 0x207374, 0x207469, + 0x207669, 0x20E520, 0x616E64, 0x617220, 0x617420, 0x646520, 0x64656E, 0x646574, + 0x652073, 0x656420, 0x656E20, 0x656E65, 0x657220, 0x657265, 0x657420, 0x657474, + 0x666F72, 0x67656E, 0x696B6B, 0x696C20, 0x696E67, 0x6B6520, 0x6B6B65, 0x6C6520, + 0x6C6C65, 0x6D6564, 0x6D656E, 0x6E2073, 0x6E6520, 0x6E6720, 0x6E6765, 0x6E6E65, + 0x6F6720, 0x6F6D20, 0x6F7220, 0x70E520, 0x722073, 0x726520, 0x736F6D, 0x737465, + 0x742073, 0x746520, 0x74656E, 0x746572, 0x74696C, 0x747420, 0x747465, 0x766572 + ]), + new NGramsPlusLang('pt', [ + 0x206120, 0x20636F, 0x206461, 0x206465, 0x20646F, 0x206520, 0x206573, 0x206D61, + 0x206E6F, 0x206F20, 0x207061, 0x20706F, 0x207072, 0x207175, 0x207265, 0x207365, + 0x20756D, 0x612061, 0x612063, 0x612064, 0x612070, 0x616465, 0x61646F, 0x616C20, + 0x617220, 0x617261, 0x617320, 0x636F6D, 0x636F6E, 0x646120, 0x646520, 0x646F20, + 0x646F73, 0x652061, 0x652064, 0x656D20, 0x656E74, 0x657320, 0x657374, 0x696120, + 0x696361, 0x6D656E, 0x6E7465, 0x6E746F, 0x6F2061, 0x6F2063, 0x6F2064, 0x6F2065, + 0x6F2070, 0x6F7320, 0x706172, 0x717565, 0x726120, 0x726573, 0x732061, 0x732064, + 0x732065, 0x732070, 0x737461, 0x746520, 0x746F20, 0x756520, 0xE36F20, 0xE7E36F + ]), + new NGramsPlusLang('sv', [ + 0x206174, 0x206176, 0x206465, 0x20656E, 0x2066F6, 0x206861, 0x206920, 0x20696E, + 0x206B6F, 0x206D65, 0x206F63, 0x2070E5, 0x20736B, 0x20736F, 0x207374, 0x207469, + 0x207661, 0x207669, 0x20E472, 0x616465, 0x616E20, 0x616E64, 0x617220, 0x617474, + 0x636820, 0x646520, 0x64656E, 0x646572, 0x646574, 0x656420, 0x656E20, 0x657220, + 0x657420, 0x66F672, 0x67656E, 0x696C6C, 0x696E67, 0x6B6120, 0x6C6C20, 0x6D6564, + 0x6E2073, 0x6E6120, 0x6E6465, 0x6E6720, 0x6E6765, 0x6E696E, 0x6F6368, 0x6F6D20, + 0x6F6E20, 0x70E520, 0x722061, 0x722073, 0x726120, 0x736B61, 0x736F6D, 0x742073, + 0x746120, 0x746520, 0x746572, 0x74696C, 0x747420, 0x766172, 0xE47220, 0xF67220, + ]) + ]; + }; + + this.name = function(det) { + return (det && det.fC1Bytes) ? 'windows-1252' : 'ISO-8859-1'; + }; +}; +util.inherits(module.exports.ISO_8859_1, sbcs); + + +module.exports.ISO_8859_2 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0x20, + 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF, + 0x20, 0xB1, 0x20, 0xB3, 0x20, 0xB5, 0xB6, 0xB7, + 0x20, 0xB9, 0xBA, 0xBB, 0xBC, 0x20, 0xBE, 0xBF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20 + ]; + } + + this.ngrams = function() { + return [ + new NGramsPlusLang('cs', [ + 0x206120, 0x206279, 0x20646F, 0x206A65, 0x206E61, 0x206E65, 0x206F20, 0x206F64, + 0x20706F, 0x207072, 0x2070F8, 0x20726F, 0x207365, 0x20736F, 0x207374, 0x20746F, + 0x207620, 0x207679, 0x207A61, 0x612070, 0x636520, 0x636820, 0x652070, 0x652073, + 0x652076, 0x656D20, 0x656EED, 0x686F20, 0x686F64, 0x697374, 0x6A6520, 0x6B7465, + 0x6C6520, 0x6C6920, 0x6E6120, 0x6EE920, 0x6EEC20, 0x6EED20, 0x6F2070, 0x6F646E, + 0x6F6A69, 0x6F7374, 0x6F7520, 0x6F7661, 0x706F64, 0x706F6A, 0x70726F, 0x70F865, + 0x736520, 0x736F75, 0x737461, 0x737469, 0x73746E, 0x746572, 0x746EED, 0x746F20, + 0x752070, 0xBE6520, 0xE16EED, 0xE9686F, 0xED2070, 0xED2073, 0xED6D20, 0xF86564, + ]), + new NGramsPlusLang('hu', [ + 0x206120, 0x20617A, 0x206265, 0x206567, 0x20656C, 0x206665, 0x206861, 0x20686F, + 0x206973, 0x206B65, 0x206B69, 0x206BF6, 0x206C65, 0x206D61, 0x206D65, 0x206D69, + 0x206E65, 0x20737A, 0x207465, 0x20E973, 0x612061, 0x61206B, 0x61206D, 0x612073, + 0x616B20, 0x616E20, 0x617A20, 0x62616E, 0x62656E, 0x656779, 0x656B20, 0x656C20, + 0x656C65, 0x656D20, 0x656E20, 0x657265, 0x657420, 0x657465, 0x657474, 0x677920, + 0x686F67, 0x696E74, 0x697320, 0x6B2061, 0x6BF67A, 0x6D6567, 0x6D696E, 0x6E2061, + 0x6E616B, 0x6E656B, 0x6E656D, 0x6E7420, 0x6F6779, 0x732061, 0x737A65, 0x737A74, + 0x737AE1, 0x73E967, 0x742061, 0x747420, 0x74E173, 0x7A6572, 0xE16E20, 0xE97320, + ]), + new NGramsPlusLang('pl', [ + 0x20637A, 0x20646F, 0x206920, 0x206A65, 0x206B6F, 0x206D61, 0x206D69, 0x206E61, + 0x206E69, 0x206F64, 0x20706F, 0x207072, 0x207369, 0x207720, 0x207769, 0x207779, + 0x207A20, 0x207A61, 0x612070, 0x612077, 0x616E69, 0x636820, 0x637A65, 0x637A79, + 0x646F20, 0x647A69, 0x652070, 0x652073, 0x652077, 0x65207A, 0x65676F, 0x656A20, + 0x656D20, 0x656E69, 0x676F20, 0x696120, 0x696520, 0x69656A, 0x6B6120, 0x6B6920, + 0x6B6965, 0x6D6965, 0x6E6120, 0x6E6961, 0x6E6965, 0x6F2070, 0x6F7761, 0x6F7769, + 0x706F6C, 0x707261, 0x70726F, 0x70727A, 0x727A65, 0x727A79, 0x7369EA, 0x736B69, + 0x737461, 0x776965, 0x796368, 0x796D20, 0x7A6520, 0x7A6965, 0x7A7920, 0xF37720, + ]), + new NGramsPlusLang('ro', [ + 0x206120, 0x206163, 0x206361, 0x206365, 0x20636F, 0x206375, 0x206465, 0x206469, + 0x206C61, 0x206D61, 0x207065, 0x207072, 0x207365, 0x2073E3, 0x20756E, 0x20BA69, + 0x20EE6E, 0x612063, 0x612064, 0x617265, 0x617420, 0x617465, 0x617520, 0x636172, + 0x636F6E, 0x637520, 0x63E320, 0x646520, 0x652061, 0x652063, 0x652064, 0x652070, + 0x652073, 0x656120, 0x656920, 0x656C65, 0x656E74, 0x657374, 0x692061, 0x692063, + 0x692064, 0x692070, 0x696520, 0x696920, 0x696E20, 0x6C6120, 0x6C6520, 0x6C6F72, + 0x6C7569, 0x6E6520, 0x6E7472, 0x6F7220, 0x70656E, 0x726520, 0x726561, 0x727520, + 0x73E320, 0x746520, 0x747275, 0x74E320, 0x756920, 0x756C20, 0xBA6920, 0xEE6E20, + ]) + ]; + }; + + this.name = function(det) { + return (det && det.fC1Bytes) ? 'windows-1250' : 'ISO-8859-2'; + }; +}; +util.inherits(module.exports.ISO_8859_2, sbcs); + + +module.exports.ISO_8859_5 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0x20, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x20, 0xFE, 0xFF + ]; + }; + + this.ngrams = function() { + return [ + 0x20D220, 0x20D2DE, 0x20D4DE, 0x20D7D0, 0x20D820, 0x20DAD0, 0x20DADE, 0x20DDD0, + 0x20DDD5, 0x20DED1, 0x20DFDE, 0x20DFE0, 0x20E0D0, 0x20E1DE, 0x20E1E2, 0x20E2DE, + 0x20E7E2, 0x20EDE2, 0xD0DDD8, 0xD0E2EC, 0xD3DE20, 0xD5DBEC, 0xD5DDD8, 0xD5E1E2, + 0xD5E220, 0xD820DF, 0xD8D520, 0xD8D820, 0xD8EF20, 0xDBD5DD, 0xDBD820, 0xDBECDD, + 0xDDD020, 0xDDD520, 0xDDD8D5, 0xDDD8EF, 0xDDDE20, 0xDDDED2, 0xDE20D2, 0xDE20DF, + 0xDE20E1, 0xDED220, 0xDED2D0, 0xDED3DE, 0xDED920, 0xDEDBEC, 0xDEDC20, 0xDEE1E2, + 0xDFDEDB, 0xDFE0D5, 0xDFE0D8, 0xDFE0DE, 0xE0D0D2, 0xE0D5D4, 0xE1E2D0, 0xE1E2D2, + 0xE1E2D8, 0xE1EF20, 0xE2D5DB, 0xE2DE20, 0xE2DEE0, 0xE2EC20, 0xE7E2DE, 0xEBE520 + ]; + }; + + this.name = function(det) { + return 'ISO-8859-5'; + }; + + this.language = function() { + return 'ru'; + }; +}; +util.inherits(module.exports.ISO_8859_5, sbcs); + + +module.exports.ISO_8859_6 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 + ]; + }; + + this.ngrams = function() { + return [ + 0x20C7E4, 0x20C7E6, 0x20C8C7, 0x20D9E4, 0x20E1EA, 0x20E4E4, 0x20E5E6, 0x20E8C7, + 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E420, 0xC7E4C3, 0xC7E4C7, 0xC7E4C8, + 0xC7E4CA, 0xC7E4CC, 0xC7E4CD, 0xC7E4CF, 0xC7E4D3, 0xC7E4D9, 0xC7E4E2, 0xC7E4E5, + 0xC7E4E8, 0xC7E4EA, 0xC7E520, 0xC7E620, 0xC7E6CA, 0xC820C7, 0xC920C7, 0xC920E1, + 0xC920E4, 0xC920E5, 0xC920E8, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920, + 0xD320C7, 0xD920C7, 0xD9E4E9, 0xE1EA20, 0xE420C7, 0xE4C920, 0xE4E920, 0xE4EA20, + 0xE520C7, 0xE5C720, 0xE5C920, 0xE5E620, 0xE620C7, 0xE720C7, 0xE7C720, 0xE8C7E4, + 0xE8E620, 0xE920C7, 0xEA20C7, 0xEA20E5, 0xEA20E8, 0xEAC920, 0xEAD120, 0xEAE620 + ]; + }; + + this.name = function(det) { + return 'ISO-8859-6'; + }; + + this.language = function() { + return 'ar'; + }; +}; +util.inherits(module.exports.ISO_8859_6, sbcs); + + +module.exports.ISO_8859_7 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0xA1, 0xA2, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xDC, 0x20, + 0xDD, 0xDE, 0xDF, 0x20, 0xFC, 0x20, 0xFD, 0xFE, + 0xC0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0x20, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0x20 + ]; + }; + + this.ngrams = function() { + return [ + 0x20E1ED, 0x20E1F0, 0x20E3E9, 0x20E4E9, 0x20E5F0, 0x20E720, 0x20EAE1, 0x20ECE5, + 0x20EDE1, 0x20EF20, 0x20F0E1, 0x20F0EF, 0x20F0F1, 0x20F3F4, 0x20F3F5, 0x20F4E7, + 0x20F4EF, 0xDFE120, 0xE120E1, 0xE120F4, 0xE1E920, 0xE1ED20, 0xE1F0FC, 0xE1F220, + 0xE3E9E1, 0xE5E920, 0xE5F220, 0xE720F4, 0xE7ED20, 0xE7F220, 0xE920F4, 0xE9E120, + 0xE9EADE, 0xE9F220, 0xEAE1E9, 0xEAE1F4, 0xECE520, 0xED20E1, 0xED20E5, 0xED20F0, + 0xEDE120, 0xEFF220, 0xEFF520, 0xF0EFF5, 0xF0F1EF, 0xF0FC20, 0xF220E1, 0xF220E5, + 0xF220EA, 0xF220F0, 0xF220F4, 0xF3E520, 0xF3E720, 0xF3F4EF, 0xF4E120, 0xF4E1E9, + 0xF4E7ED, 0xF4E7F2, 0xF4E9EA, 0xF4EF20, 0xF4EFF5, 0xF4F9ED, 0xF9ED20, 0xFEED20 + ]; + }; + + this.name = function(det) { + return (det && det.fC1Bytes) ? 'windows-1253' : 'ISO-8859-7'; + }; + + this.language = function() { + return 'el'; + }; +}; +util.inherits(module.exports.ISO_8859_7, sbcs); + +module.exports.ISO_8859_8 = function() { + + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0x20, 0x20, 0x20, 0x20, 0x20 + ]; + }; + + this.ngrams = function() { + return [ + new NGramsPlusLang('he', [ + 0x20E0E5, 0x20E0E7, 0x20E0E9, 0x20E0FA, 0x20E1E9, 0x20E1EE, 0x20E4E0, 0x20E4E5, + 0x20E4E9, 0x20E4EE, 0x20E4F2, 0x20E4F9, 0x20E4FA, 0x20ECE0, 0x20ECE4, 0x20EEE0, + 0x20F2EC, 0x20F9EC, 0xE0FA20, 0xE420E0, 0xE420E1, 0xE420E4, 0xE420EC, 0xE420EE, + 0xE420F9, 0xE4E5E0, 0xE5E020, 0xE5ED20, 0xE5EF20, 0xE5F820, 0xE5FA20, 0xE920E4, + 0xE9E420, 0xE9E5FA, 0xE9E9ED, 0xE9ED20, 0xE9EF20, 0xE9F820, 0xE9FA20, 0xEC20E0, + 0xEC20E4, 0xECE020, 0xECE420, 0xED20E0, 0xED20E1, 0xED20E4, 0xED20EC, 0xED20EE, + 0xED20F9, 0xEEE420, 0xEF20E4, 0xF0E420, 0xF0E920, 0xF0E9ED, 0xF2EC20, 0xF820E4, + 0xF8E9ED, 0xF9EC20, 0xFA20E0, 0xFA20E1, 0xFA20E4, 0xFA20EC, 0xFA20EE, 0xFA20F9, + ]), + new NGramsPlusLang('he', [ + 0x20E0E5, 0x20E0EC, 0x20E4E9, 0x20E4EC, 0x20E4EE, 0x20E4F0, 0x20E9F0, 0x20ECF2, + 0x20ECF9, 0x20EDE5, 0x20EDE9, 0x20EFE5, 0x20EFE9, 0x20F8E5, 0x20F8E9, 0x20FAE0, + 0x20FAE5, 0x20FAE9, 0xE020E4, 0xE020EC, 0xE020ED, 0xE020FA, 0xE0E420, 0xE0E5E4, + 0xE0EC20, 0xE0EE20, 0xE120E4, 0xE120ED, 0xE120FA, 0xE420E4, 0xE420E9, 0xE420EC, + 0xE420ED, 0xE420EF, 0xE420F8, 0xE420FA, 0xE4EC20, 0xE5E020, 0xE5E420, 0xE7E020, + 0xE9E020, 0xE9E120, 0xE9E420, 0xEC20E4, 0xEC20ED, 0xEC20FA, 0xECF220, 0xECF920, + 0xEDE9E9, 0xEDE9F0, 0xEDE9F8, 0xEE20E4, 0xEE20ED, 0xEE20FA, 0xEEE120, 0xEEE420, + 0xF2E420, 0xF920E4, 0xF920ED, 0xF920FA, 0xF9E420, 0xFAE020, 0xFAE420, 0xFAE5E9, + ]) + ]; + }; + + this.name = function(det) { + return (det && det.fC1Bytes) ? 'windows-1255' : 'ISO-8859-8'; + }; + + this.language = function() { + return 'he'; + }; + +}; +util.inherits(module.exports.ISO_8859_8, sbcs); + + +module.exports.ISO_8859_9 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20, + 0x20, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0x69, 0xFE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0x20, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + ]; + }; + + this.ngrams = function() { + return [ + 0x206261, 0x206269, 0x206275, 0x206461, 0x206465, 0x206765, 0x206861, 0x20696C, + 0x206B61, 0x206B6F, 0x206D61, 0x206F6C, 0x207361, 0x207461, 0x207665, 0x207961, + 0x612062, 0x616B20, 0x616C61, 0x616D61, 0x616E20, 0x616EFD, 0x617220, 0x617261, + 0x6172FD, 0x6173FD, 0x617961, 0x626972, 0x646120, 0x646520, 0x646920, 0x652062, + 0x65206B, 0x656469, 0x656E20, 0x657220, 0x657269, 0x657369, 0x696C65, 0x696E20, + 0x696E69, 0x697220, 0x6C616E, 0x6C6172, 0x6C6520, 0x6C6572, 0x6E2061, 0x6E2062, + 0x6E206B, 0x6E6461, 0x6E6465, 0x6E6520, 0x6E6920, 0x6E696E, 0x6EFD20, 0x72696E, + 0x72FD6E, 0x766520, 0x796120, 0x796F72, 0xFD6E20, 0xFD6E64, 0xFD6EFD, 0xFDF0FD + ]; + }; + + this.name = function(det) { + return (det && det.fC1Bytes) ? 'windows-1254' : 'ISO-8859-9'; + }; + + this.language = function() { + return 'tr'; + }; +}; +util.inherits(module.exports.ISO_8859_9, sbcs); + + +module.exports.windows_1251 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x90, 0x83, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F, + 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x9A, 0x20, 0x9C, 0x9D, 0x9E, 0x9F, + 0x20, 0xA2, 0xA2, 0xBC, 0x20, 0xB4, 0x20, 0x20, + 0xB8, 0x20, 0xBA, 0x20, 0x20, 0x20, 0x20, 0xBF, + 0x20, 0x20, 0xB3, 0xB3, 0xB4, 0xB5, 0x20, 0x20, + 0xB8, 0x20, 0xBA, 0x20, 0xBC, 0xBE, 0xBE, 0xBF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0xF0, 0xF1, 0xF2, 0xF3, 0xF4, 0xF5, 0xF6, 0xF7, + 0xF8, 0xF9, 0xFA, 0xFB, 0xFC, 0xFD, 0xFE, 0xFF + ]; + }; + + this.ngrams = function() { + return [ + 0x20E220, 0x20E2EE, 0x20E4EE, 0x20E7E0, 0x20E820, 0x20EAE0, 0x20EAEE, 0x20EDE0, + 0x20EDE5, 0x20EEE1, 0x20EFEE, 0x20EFF0, 0x20F0E0, 0x20F1EE, 0x20F1F2, 0x20F2EE, + 0x20F7F2, 0x20FDF2, 0xE0EDE8, 0xE0F2FC, 0xE3EE20, 0xE5EBFC, 0xE5EDE8, 0xE5F1F2, + 0xE5F220, 0xE820EF, 0xE8E520, 0xE8E820, 0xE8FF20, 0xEBE5ED, 0xEBE820, 0xEBFCED, + 0xEDE020, 0xEDE520, 0xEDE8E5, 0xEDE8FF, 0xEDEE20, 0xEDEEE2, 0xEE20E2, 0xEE20EF, + 0xEE20F1, 0xEEE220, 0xEEE2E0, 0xEEE3EE, 0xEEE920, 0xEEEBFC, 0xEEEC20, 0xEEF1F2, + 0xEFEEEB, 0xEFF0E5, 0xEFF0E8, 0xEFF0EE, 0xF0E0E2, 0xF0E5E4, 0xF1F2E0, 0xF1F2E2, + 0xF1F2E8, 0xF1FF20, 0xF2E5EB, 0xF2EE20, 0xF2EEF0, 0xF2FC20, 0xF7F2EE, 0xFBF520 + ]; + }; + + this.name = function(det) { + return 'windows-1251'; + }; + + this.language = function() { + return 'ru'; + }; +}; +util.inherits(module.exports.windows_1251, sbcs); + + +module.exports.windows_1256 = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x81, 0x20, 0x83, 0x20, 0x20, 0x20, 0x20, + 0x88, 0x20, 0x8A, 0x20, 0x9C, 0x8D, 0x8E, 0x8F, + 0x90, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x98, 0x20, 0x9A, 0x20, 0x9C, 0x20, 0x20, 0x9F, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0xAA, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0xB5, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0x20, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xE0, 0xE1, 0xE2, 0xE3, 0xE4, 0xE5, 0xE6, 0xE7, + 0xE8, 0xE9, 0xEA, 0xEB, 0xEC, 0xED, 0xEE, 0xEF, + 0x20, 0x20, 0x20, 0x20, 0xF4, 0x20, 0x20, 0x20, + 0x20, 0xF9, 0x20, 0xFB, 0xFC, 0x20, 0x20, 0xFF + ]; + }; + + this.ngrams = function() { + return [ + 0x20C7E1, 0x20C7E4, 0x20C8C7, 0x20DAE1, 0x20DDED, 0x20E1E1, 0x20E3E4, 0x20E6C7, + 0xC720C7, 0xC7C120, 0xC7CA20, 0xC7D120, 0xC7E120, 0xC7E1C3, 0xC7E1C7, 0xC7E1C8, + 0xC7E1CA, 0xC7E1CC, 0xC7E1CD, 0xC7E1CF, 0xC7E1D3, 0xC7E1DA, 0xC7E1DE, 0xC7E1E3, + 0xC7E1E6, 0xC7E1ED, 0xC7E320, 0xC7E420, 0xC7E4CA, 0xC820C7, 0xC920C7, 0xC920DD, + 0xC920E1, 0xC920E3, 0xC920E6, 0xCA20C7, 0xCF20C7, 0xCFC920, 0xD120C7, 0xD1C920, + 0xD320C7, 0xDA20C7, 0xDAE1EC, 0xDDED20, 0xE120C7, 0xE1C920, 0xE1EC20, 0xE1ED20, + 0xE320C7, 0xE3C720, 0xE3C920, 0xE3E420, 0xE420C7, 0xE520C7, 0xE5C720, 0xE6C7E1, + 0xE6E420, 0xEC20C7, 0xED20C7, 0xED20E3, 0xED20E6, 0xEDC920, 0xEDD120, 0xEDE420 + ]; + }; + + this.name = function(det) { + return 'windows-1256'; + }; + + this.language = function() { + return 'ar'; + }; +}; +util.inherits(module.exports.windows_1256, sbcs); + + +module.exports.KOI8_R = function() { + this.byteMap = function() { + return [ + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, + 0x68, 0x69, 0x6A, 0x6B, 0x6C, 0x6D, 0x6E, 0x6F, + 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, + 0x78, 0x79, 0x7A, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0xA3, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF, + 0xC0, 0xC1, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, + 0xC8, 0xC9, 0xCA, 0xCB, 0xCC, 0xCD, 0xCE, 0xCF, + 0xD0, 0xD1, 0xD2, 0xD3, 0xD4, 0xD5, 0xD6, 0xD7, + 0xD8, 0xD9, 0xDA, 0xDB, 0xDC, 0xDD, 0xDE, 0xDF + ]; + }; + + this.ngrams = function() { + return [ + 0x20C4CF, 0x20C920, 0x20CBC1, 0x20CBCF, 0x20CEC1, 0x20CEC5, 0x20CFC2, 0x20D0CF, + 0x20D0D2, 0x20D2C1, 0x20D3CF, 0x20D3D4, 0x20D4CF, 0x20D720, 0x20D7CF, 0x20DAC1, + 0x20DCD4, 0x20DED4, 0xC1CEC9, 0xC1D4D8, 0xC5CCD8, 0xC5CEC9, 0xC5D3D4, 0xC5D420, + 0xC7CF20, 0xC920D0, 0xC9C520, 0xC9C920, 0xC9D120, 0xCCC5CE, 0xCCC920, 0xCCD8CE, + 0xCEC120, 0xCEC520, 0xCEC9C5, 0xCEC9D1, 0xCECF20, 0xCECFD7, 0xCF20D0, 0xCF20D3, + 0xCF20D7, 0xCFC7CF, 0xCFCA20, 0xCFCCD8, 0xCFCD20, 0xCFD3D4, 0xCFD720, 0xCFD7C1, + 0xD0CFCC, 0xD0D2C5, 0xD0D2C9, 0xD0D2CF, 0xD2C1D7, 0xD2C5C4, 0xD3D120, 0xD3D4C1, + 0xD3D4C9, 0xD3D4D7, 0xD4C5CC, 0xD4CF20, 0xD4CFD2, 0xD4D820, 0xD9C820, 0xDED4CF + ]; + }; + + this.name = function(det) { + return 'KOI8-R'; + }; + + this.language = function() { + return 'ru'; + }; +}; +util.inherits(module.exports.KOI8_R, sbcs); + + +/* +module.exports.ISO_8859_7 = function() { + this.byteMap = function() { + return [ + + ]; + }; + + this.ngrams = function() { + return [ + + ]; + }; + + this.name = function(det) { + if (typeof det == 'undefined') + return 'ISO-8859-7'; + return det.fC1Bytes ? 'windows-1253' : 'ISO-8859-7'; + }; + + this.language = function() { + return 'el'; + }; +}; +util.inherits(module.exports.ISO_8859_7, sbcs); +*/ + + + +/***/ }), + +/***/ 93374: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var util = __webpack_require__(39023), + Match = __webpack_require__ (19630); + +/** + * This class matches UTF-16 and UTF-32, both big- and little-endian. The + * BOM will be used if it is present. + */ +module.exports.UTF_16BE = function() { + this.name = function() { + return 'UTF-16BE'; + }; + this.match = function(det) { + var input = det.fRawInput; + + if (input.length >= 2 && ((input[0] & 0xff) == 0xfe && (input[1] & 0xff) == 0xff)) { + return new Match(det, this, 100); // confidence = 100 + } + + // TODO: Do some statistics to check for unsigned UTF-16BE + return null; + }; +}; + +module.exports.UTF_16LE = function() { + this.name = function() { + return 'UTF-16LE'; + }; + this.match = function(det) { + var input = det.fRawInput; + + if (input.length >= 2 && ((input[0] & 0xff) == 0xff && (input[1] & 0xff) == 0xfe)) { + // LE BOM is present. + if (input.length >= 4 && input[2] == 0x00 && input[3] == 0x00) { + // It is probably UTF-32 LE, not UTF-16 + return null; + } + return new Match(det, this, 100); // confidence = 100 + } + + // TODO: Do some statistics to check for unsigned UTF-16LE + return null; + } +}; + +function UTF_32() {}; +UTF_32.prototype.match = function(det) { + var input = det.fRawInput, + limit = (det.fRawLength / 4) * 4, + numValid = 0, + numInvalid = 0, + hasBOM = false, + confidence = 0; + + if (limit == 0) { + return null; + } + + if (this.getChar(input, 0) == 0x0000FEFF) { + hasBOM = true; + } + + for (var i = 0; i < limit; i += 4) { + var ch = this.getChar(input, i); + + if (ch < 0 || ch >= 0x10FFFF || (ch >= 0xD800 && ch <= 0xDFFF)) { + numInvalid += 1; + } else { + numValid += 1; + } + } + + // Cook up some sort of confidence score, based on presence of a BOM + // and the existence of valid and/or invalid multi-byte sequences. + if (hasBOM && numInvalid == 0) { + confidence = 100; + } else if (hasBOM && numValid > numInvalid * 10) { + confidence = 80; + } else if (numValid > 3 && numInvalid == 0) { + confidence = 100; + } else if (numValid > 0 && numInvalid == 0) { + confidence = 80; + } else if (numValid > numInvalid * 10) { + // Probably corrupt UTF-32BE data. Valid sequences aren't likely by chance. + confidence = 25; + } + + // return confidence == 0 ? null : new CharsetMatch(det, this, confidence); + return confidence == 0 ? null : new Match(det, this, confidence); +}; + +module.exports.UTF_32BE = function() { + this.name = function() { + return 'UTF-32BE'; + }; + this.getChar = function(input, index) { + return (input[index + 0] & 0xff) << 24 | (input[index + 1] & 0xff) << 16 | + (input[index + 2] & 0xff) << 8 | (input[index + 3] & 0xff); + }; +}; +util.inherits(module.exports.UTF_32BE, UTF_32); + +module.exports.UTF_32LE = function() { + this.name = function() { + return 'UTF-32LE'; + }; + this.getChar = function(input, index) { + return (input[index + 3] & 0xff) << 24 | (input[index + 2] & 0xff) << 16 | + (input[index + 1] & 0xff) << 8 | (input[index + 0] & 0xff); + }; +}; +util.inherits(module.exports.UTF_32LE, UTF_32); + + +/***/ }), + +/***/ 92686: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +var Match = __webpack_require__ (19630); + +/** + * Charset recognizer for UTF-8 + */ +module.exports = function() { + this.name = function() { + return 'UTF-8'; + }; + this.match = function(det) { + + var hasBOM = false, + numValid = 0, + numInvalid = 0, + input = det.fRawInput, + trailBytes = 0, + confidence; + + if (det.fRawLength >= 3 && + (input[0] & 0xff) == 0xef && (input[1] & 0xff) == 0xbb && (input[2] & 0xff) == 0xbf) { + hasBOM = true; + } + + // Scan for multi-byte sequences + for (var i = 0; i < det.fRawLength; i++) { + var b = input[i]; + if ((b & 0x80) == 0) + continue; // ASCII + + // Hi bit on char found. Figure out how long the sequence should be + if ((b & 0x0e0) == 0x0c0) { + trailBytes = 1; + } else if ((b & 0x0f0) == 0x0e0) { + trailBytes = 2; + } else if ((b & 0x0f8) == 0xf0) { + trailBytes = 3; + } else { + numInvalid++; + if (numInvalid > 5) + break; + trailBytes = 0; + } + + // Verify that we've got the right number of trail bytes in the sequence + for (;;) { + i++; + if (i >= det.fRawLength) + break; + + if ((input[i] & 0xc0) != 0x080) { + numInvalid++; + break; + } + if (--trailBytes == 0) { + numValid++; + break; + } + } + } + + // Cook up some sort of confidence score, based on presense of a BOM + // and the existence of valid and/or invalid multi-byte sequences. + confidence = 0; + if (hasBOM && numInvalid == 0) + confidence = 100; + else if (hasBOM && numValid > numInvalid * 10) + confidence = 80; + else if (numValid > 3 && numInvalid == 0) + confidence = 100; + else if (numValid > 0 && numInvalid == 0) + confidence = 80; + else if (numValid == 0 && numInvalid == 0) + // Plain ASCII. + confidence = 10; + else if (numValid > numInvalid * 10) + // Probably corruput utf-8 data. Valid sequences aren't likely by chance. + confidence = 25; + else + return null + + return new Match(det, this, confidence); + }; +}; + + +/***/ }), + +/***/ 1703: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + + +var fs = __webpack_require__(79896); + +var utf8 = __webpack_require__(92686), + unicode = __webpack_require__(93374), + mbcs = __webpack_require__(31256), + sbcs = __webpack_require__(47730), + iso2022 = __webpack_require__(96586); + +var self = this; + +var recognisers = [ + new utf8, + new unicode.UTF_16BE, + new unicode.UTF_16LE, + new unicode.UTF_32BE, + new unicode.UTF_32LE, + new mbcs.sjis, + new mbcs.big5, + new mbcs.euc_jp, + new mbcs.euc_kr, + new mbcs.gb_18030, + new iso2022.ISO_2022_JP, + new iso2022.ISO_2022_KR, + new iso2022.ISO_2022_CN, + new sbcs.ISO_8859_1, + new sbcs.ISO_8859_2, + new sbcs.ISO_8859_5, + new sbcs.ISO_8859_6, + new sbcs.ISO_8859_7, + new sbcs.ISO_8859_8, + new sbcs.ISO_8859_9, + new sbcs.windows_1251, + new sbcs.windows_1256, + new sbcs.KOI8_R +]; + +module.exports.detect = function(buffer, opts) { + + // Tally up the byte occurence statistics. + var fByteStats = []; + for (var i = 0; i < 256; i++) + fByteStats[i] = 0; + + for (var i = buffer.length - 1; i >= 0; i--) + fByteStats[buffer[i] & 0x00ff]++; + + var fC1Bytes = false; + for (var i = 0x80; i <= 0x9F; i += 1) { + if (fByteStats[i] != 0) { + fC1Bytes = true; + break; + } + } + + var context = { + fByteStats: fByteStats, + fC1Bytes: fC1Bytes, + fRawInput: buffer, + fRawLength: buffer.length, + fInputBytes: buffer, + fInputLen: buffer.length + }; + + var matches = recognisers.map(function(rec) { + return rec.match(context); + }).filter(function(match) { + return !!match; + }).sort(function(a, b) { + return b.confidence - a.confidence; + }); + + if (opts && opts.returnAllMatches === true) { + return matches; + } + else { + return matches.length > 0 ? matches[0].name : null; + } +}; + +module.exports.detectFile = function(filepath, opts, cb) { + if (typeof opts === 'function') { + cb = opts; + opts = undefined; + } + + var fd; + + var handler = function(err, buffer) { + if (fd) { + fs.closeSync(fd); + } + + if (err) return cb(err, null); + cb(null, self.detect(buffer, opts)); + }; + + if (opts && opts.sampleSize) { + fd = fs.openSync(filepath, 'r'), + sample = Buffer.allocUnsafe(opts.sampleSize); + + fs.read(fd, sample, 0, opts.sampleSize, null, function(err) { + handler(err, sample); + }); + return; + } + + fs.readFile(filepath, handler); +}; + +module.exports.detectFileSync = function(filepath, opts) { + if (opts && opts.sampleSize) { + var fd = fs.openSync(filepath, 'r'), + sample = Buffer.allocUnsafe(opts.sampleSize); + + fs.readSync(fd, sample, 0, opts.sampleSize); + fs.closeSync(fd); + return self.detect(sample, opts); + } + + return self.detect(fs.readFileSync(filepath), opts); +}; + +// Wrappers for the previous functions to return all encodings +module.exports.detectAll = function(buffer, opts) { + if (typeof opts !== 'object') { + opts = {}; + } + opts.returnAllMatches = true; + return self.detect(buffer, opts); +} + +module.exports.detectFileAll = function(filepath, opts, cb) { + if (typeof opts === 'function') { + cb = opts; + opts = undefined; + } + if (typeof opts !== 'object') { + opts = {}; + } + opts.returnAllMatches = true; + self.detectFile(filepath, opts, cb); +} + +module.exports.detectFileAllSync = function(filepath, opts) { + if (typeof opts !== 'object') { + opts = {}; + } + opts.returnAllMatches = true; + return self.detectFileSync(filepath, opts); +} + + +/***/ }), + +/***/ 19630: +/***/ ((module) => { + + +module.exports = function(det, rec, confidence, name, lang) { + this.confidence = confidence; + this.name = name || rec.name(det); + this.lang = lang; +}; + + +/***/ }), + +/***/ 50609: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +module.exports = cliWidth; + +function normalizeOpts(options) { + const defaultOpts = { + defaultWidth: 0, + output: process.stdout, + tty: __webpack_require__(52018), + }; + + if (!options) { + return defaultOpts; + } + + Object.keys(defaultOpts).forEach(function (key) { + if (!options[key]) { + options[key] = defaultOpts[key]; + } + }); + + return options; +} + +function cliWidth(options) { + const opts = normalizeOpts(options); + + if (opts.output.getWindowSize) { + return opts.output.getWindowSize()[0] || opts.defaultWidth; + } + + if (opts.tty.getWindowSize) { + return opts.tty.getWindowSize()[1] || opts.defaultWidth; + } + + if (opts.output.columns) { + return opts.output.columns; + } + + if (process.env.CLI_WIDTH) { + const width = parseInt(process.env.CLI_WIDTH, 10); + + if (!isNaN(width) && width !== 0) { + return width; + } + } + + return opts.defaultWidth; +} + + +/***/ }), + +/***/ 61820: +/***/ ((module, exports, __webpack_require__) => { + +/* 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; + } + + let m; + + // Is webkit? http://stackoverflow.com/a/16459606/376773 + // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 + // eslint-disable-next-line no-return-assign + 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 && (m = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m[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 = __webpack_require__(47059)(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; + } +}; + + +/***/ }), + +/***/ 47059: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +/** + * 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 = __webpack_require__(72146); + 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 = []; + + const split = (typeof namespaces === 'string' ? namespaces : '') + .trim() + .replace(' ', ',') + .split(',') + .filter(Boolean); + + for (const ns of split) { + if (ns[0] === '-') { + createDebug.skips.push(ns.slice(1)); + } else { + createDebug.names.push(ns); + } + } + } + + /** + * Checks if the given string matches a namespace template, honoring + * asterisks as wildcards. + * + * @param {String} search + * @param {String} template + * @return {Boolean} + */ + function matchesTemplate(search, template) { + let searchIndex = 0; + let templateIndex = 0; + let starIndex = -1; + let matchIndex = 0; + + while (searchIndex < search.length) { + if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) { + // Match character or proceed with wildcard + if (template[templateIndex] === '*') { + starIndex = templateIndex; + matchIndex = searchIndex; + templateIndex++; // Skip the '*' + } else { + searchIndex++; + templateIndex++; + } + } else if (starIndex !== -1) { // eslint-disable-line no-negated-condition + // Backtrack to the last '*' and try to match more characters + templateIndex = starIndex + 1; + matchIndex++; + searchIndex = matchIndex; + } else { + return false; // No match + } + } + + // Handle trailing '*' in template + while (templateIndex < template.length && template[templateIndex] === '*') { + templateIndex++; + } + + return templateIndex === template.length; + } + + /** + * Disable debug output. + * + * @return {String} namespaces + * @api public + */ + function disable() { + const namespaces = [ + ...createDebug.names, + ...createDebug.skips.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) { + for (const skip of createDebug.skips) { + if (matchesTemplate(name, skip)) { + return false; + } + } + + for (const ns of createDebug.names) { + if (matchesTemplate(name, ns)) { + return true; + } + } + + return false; + } + + /** + * 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; + + +/***/ }), + +/***/ 6496: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/** + * 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 = __webpack_require__(61820); +} else { + module.exports = __webpack_require__(1998); +} + + +/***/ }), + +/***/ 1998: +/***/ ((module, exports, __webpack_require__) => { + +/** + * Module dependencies. + */ + +const tty = __webpack_require__(52018); +const util = __webpack_require__(39023); + +/** + * 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 = __webpack_require__(40021); + + 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.formatWithOptions()` with the specified arguments and writes to stderr. + */ + +function log(...args) { + return process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...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 = __webpack_require__(47059)(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); +}; + + +/***/ }), + +/***/ 99211: +/***/ ((module, exports) => { + +"use strict"; +/** + * @author Toru Nagashima + * @copyright 2015 Toru Nagashima. All rights reserved. + * See LICENSE file in root directory for full license. + */ + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +/** + * @typedef {object} PrivateData + * @property {EventTarget} eventTarget The event target. + * @property {{type:string}} event The original event object. + * @property {number} eventPhase The current event phase. + * @property {EventTarget|null} currentTarget The current event target. + * @property {boolean} canceled The flag to prevent default. + * @property {boolean} stopped The flag to stop propagation. + * @property {boolean} immediateStopped The flag to stop propagation immediately. + * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null. + * @property {number} timeStamp The unix time. + * @private + */ + +/** + * Private data for event wrappers. + * @type {WeakMap} + * @private + */ +const privateData = new WeakMap(); + +/** + * Cache for wrapper classes. + * @type {WeakMap} + * @private + */ +const wrappers = new WeakMap(); + +/** + * Get private data. + * @param {Event} event The event object to get private data. + * @returns {PrivateData} The private data of the event. + * @private + */ +function pd(event) { + const retv = privateData.get(event); + console.assert( + retv != null, + "'this' is expected an Event object, but got", + event + ); + return retv +} + +/** + * https://dom.spec.whatwg.org/#set-the-canceled-flag + * @param data {PrivateData} private data. + */ +function setCancelFlag(data) { + if (data.passiveListener != null) { + if ( + typeof console !== "undefined" && + typeof console.error === "function" + ) { + console.error( + "Unable to preventDefault inside passive event listener invocation.", + data.passiveListener + ); + } + return + } + if (!data.event.cancelable) { + return + } + + data.canceled = true; + if (typeof data.event.preventDefault === "function") { + data.event.preventDefault(); + } +} + +/** + * @see https://dom.spec.whatwg.org/#interface-event + * @private + */ +/** + * The event wrapper. + * @constructor + * @param {EventTarget} eventTarget The event target of this dispatching. + * @param {Event|{type:string}} event The original event to wrap. + */ +function Event(eventTarget, event) { + privateData.set(this, { + eventTarget, + event, + eventPhase: 2, + currentTarget: eventTarget, + canceled: false, + stopped: false, + immediateStopped: false, + passiveListener: null, + timeStamp: event.timeStamp || Date.now(), + }); + + // https://heycam.github.io/webidl/#Unforgeable + Object.defineProperty(this, "isTrusted", { value: false, enumerable: true }); + + // Define accessors + const keys = Object.keys(event); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in this)) { + Object.defineProperty(this, key, defineRedirectDescriptor(key)); + } + } +} + +// Should be enumerable, but class methods are not enumerable. +Event.prototype = { + /** + * The type of this event. + * @type {string} + */ + get type() { + return pd(this).event.type + }, + + /** + * The target of this event. + * @type {EventTarget} + */ + get target() { + return pd(this).eventTarget + }, + + /** + * The target of this event. + * @type {EventTarget} + */ + get currentTarget() { + return pd(this).currentTarget + }, + + /** + * @returns {EventTarget[]} The composed path of this event. + */ + composedPath() { + const currentTarget = pd(this).currentTarget; + if (currentTarget == null) { + return [] + } + return [currentTarget] + }, + + /** + * Constant of NONE. + * @type {number} + */ + get NONE() { + return 0 + }, + + /** + * Constant of CAPTURING_PHASE. + * @type {number} + */ + get CAPTURING_PHASE() { + return 1 + }, + + /** + * Constant of AT_TARGET. + * @type {number} + */ + get AT_TARGET() { + return 2 + }, + + /** + * Constant of BUBBLING_PHASE. + * @type {number} + */ + get BUBBLING_PHASE() { + return 3 + }, + + /** + * The target of this event. + * @type {number} + */ + get eventPhase() { + return pd(this).eventPhase + }, + + /** + * Stop event bubbling. + * @returns {void} + */ + stopPropagation() { + const data = pd(this); + + data.stopped = true; + if (typeof data.event.stopPropagation === "function") { + data.event.stopPropagation(); + } + }, + + /** + * Stop event bubbling. + * @returns {void} + */ + stopImmediatePropagation() { + const data = pd(this); + + data.stopped = true; + data.immediateStopped = true; + if (typeof data.event.stopImmediatePropagation === "function") { + data.event.stopImmediatePropagation(); + } + }, + + /** + * The flag to be bubbling. + * @type {boolean} + */ + get bubbles() { + return Boolean(pd(this).event.bubbles) + }, + + /** + * The flag to be cancelable. + * @type {boolean} + */ + get cancelable() { + return Boolean(pd(this).event.cancelable) + }, + + /** + * Cancel this event. + * @returns {void} + */ + preventDefault() { + setCancelFlag(pd(this)); + }, + + /** + * The flag to indicate cancellation state. + * @type {boolean} + */ + get defaultPrevented() { + return pd(this).canceled + }, + + /** + * The flag to be composed. + * @type {boolean} + */ + get composed() { + return Boolean(pd(this).event.composed) + }, + + /** + * The unix time of this event. + * @type {number} + */ + get timeStamp() { + return pd(this).timeStamp + }, + + /** + * The target of this event. + * @type {EventTarget} + * @deprecated + */ + get srcElement() { + return pd(this).eventTarget + }, + + /** + * The flag to stop event bubbling. + * @type {boolean} + * @deprecated + */ + get cancelBubble() { + return pd(this).stopped + }, + set cancelBubble(value) { + if (!value) { + return + } + const data = pd(this); + + data.stopped = true; + if (typeof data.event.cancelBubble === "boolean") { + data.event.cancelBubble = true; + } + }, + + /** + * The flag to indicate cancellation state. + * @type {boolean} + * @deprecated + */ + get returnValue() { + return !pd(this).canceled + }, + set returnValue(value) { + if (!value) { + setCancelFlag(pd(this)); + } + }, + + /** + * Initialize this event object. But do nothing under event dispatching. + * @param {string} type The event type. + * @param {boolean} [bubbles=false] The flag to be possible to bubble up. + * @param {boolean} [cancelable=false] The flag to be possible to cancel. + * @deprecated + */ + initEvent() { + // Do nothing. + }, +}; + +// `constructor` is not enumerable. +Object.defineProperty(Event.prototype, "constructor", { + value: Event, + configurable: true, + writable: true, +}); + +// Ensure `event instanceof window.Event` is `true`. +if (typeof window !== "undefined" && typeof window.Event !== "undefined") { + Object.setPrototypeOf(Event.prototype, window.Event.prototype); + + // Make association for wrappers. + wrappers.set(window.Event.prototype, Event); +} + +/** + * Get the property descriptor to redirect a given property. + * @param {string} key Property name to define property descriptor. + * @returns {PropertyDescriptor} The property descriptor to redirect the property. + * @private + */ +function defineRedirectDescriptor(key) { + return { + get() { + return pd(this).event[key] + }, + set(value) { + pd(this).event[key] = value; + }, + configurable: true, + enumerable: true, + } +} + +/** + * Get the property descriptor to call a given method property. + * @param {string} key Property name to define property descriptor. + * @returns {PropertyDescriptor} The property descriptor to call the method property. + * @private + */ +function defineCallDescriptor(key) { + return { + value() { + const event = pd(this).event; + return event[key].apply(event, arguments) + }, + configurable: true, + enumerable: true, + } +} + +/** + * Define new wrapper class. + * @param {Function} BaseEvent The base wrapper class. + * @param {Object} proto The prototype of the original event. + * @returns {Function} The defined wrapper class. + * @private + */ +function defineWrapper(BaseEvent, proto) { + const keys = Object.keys(proto); + if (keys.length === 0) { + return BaseEvent + } + + /** CustomEvent */ + function CustomEvent(eventTarget, event) { + BaseEvent.call(this, eventTarget, event); + } + + CustomEvent.prototype = Object.create(BaseEvent.prototype, { + constructor: { value: CustomEvent, configurable: true, writable: true }, + }); + + // Define accessors. + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in BaseEvent.prototype)) { + const descriptor = Object.getOwnPropertyDescriptor(proto, key); + const isFunc = typeof descriptor.value === "function"; + Object.defineProperty( + CustomEvent.prototype, + key, + isFunc + ? defineCallDescriptor(key) + : defineRedirectDescriptor(key) + ); + } + } + + return CustomEvent +} + +/** + * Get the wrapper class of a given prototype. + * @param {Object} proto The prototype of the original event to get its wrapper. + * @returns {Function} The wrapper class. + * @private + */ +function getWrapper(proto) { + if (proto == null || proto === Object.prototype) { + return Event + } + + let wrapper = wrappers.get(proto); + if (wrapper == null) { + wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto); + wrappers.set(proto, wrapper); + } + return wrapper +} + +/** + * Wrap a given event to management a dispatching. + * @param {EventTarget} eventTarget The event target of this dispatching. + * @param {Object} event The event to wrap. + * @returns {Event} The wrapper instance. + * @private + */ +function wrapEvent(eventTarget, event) { + const Wrapper = getWrapper(Object.getPrototypeOf(event)); + return new Wrapper(eventTarget, event) +} + +/** + * Get the immediateStopped flag of a given event. + * @param {Event} event The event to get. + * @returns {boolean} The flag to stop propagation immediately. + * @private + */ +function isStopped(event) { + return pd(event).immediateStopped +} + +/** + * Set the current event phase of a given event. + * @param {Event} event The event to set current target. + * @param {number} eventPhase New event phase. + * @returns {void} + * @private + */ +function setEventPhase(event, eventPhase) { + pd(event).eventPhase = eventPhase; +} + +/** + * Set the current target of a given event. + * @param {Event} event The event to set current target. + * @param {EventTarget|null} currentTarget New current target. + * @returns {void} + * @private + */ +function setCurrentTarget(event, currentTarget) { + pd(event).currentTarget = currentTarget; +} + +/** + * Set a passive listener of a given event. + * @param {Event} event The event to set current target. + * @param {Function|null} passiveListener New passive listener. + * @returns {void} + * @private + */ +function setPassiveListener(event, passiveListener) { + pd(event).passiveListener = passiveListener; +} + +/** + * @typedef {object} ListenerNode + * @property {Function} listener + * @property {1|2|3} listenerType + * @property {boolean} passive + * @property {boolean} once + * @property {ListenerNode|null} next + * @private + */ + +/** + * @type {WeakMap>} + * @private + */ +const listenersMap = new WeakMap(); + +// Listener types +const CAPTURE = 1; +const BUBBLE = 2; +const ATTRIBUTE = 3; + +/** + * Check whether a given value is an object or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an object. + */ +function isObject(x) { + return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax +} + +/** + * Get listeners. + * @param {EventTarget} eventTarget The event target to get. + * @returns {Map} The listeners. + * @private + */ +function getListeners(eventTarget) { + const listeners = listenersMap.get(eventTarget); + if (listeners == null) { + throw new TypeError( + "'this' is expected an EventTarget object, but got another value." + ) + } + return listeners +} + +/** + * Get the property descriptor for the event attribute of a given event. + * @param {string} eventName The event name to get property descriptor. + * @returns {PropertyDescriptor} The property descriptor. + * @private + */ +function defineEventAttributeDescriptor(eventName) { + return { + get() { + const listeners = getListeners(this); + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + return node.listener + } + node = node.next; + } + return null + }, + + set(listener) { + if (typeof listener !== "function" && !isObject(listener)) { + listener = null; // eslint-disable-line no-param-reassign + } + const listeners = getListeners(this); + + // Traverse to the tail while removing old value. + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + // Remove old value. + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + + node = node.next; + } + + // Add new value. + if (listener !== null) { + const newNode = { + listener, + listenerType: ATTRIBUTE, + passive: false, + once: false, + next: null, + }; + if (prev === null) { + listeners.set(eventName, newNode); + } else { + prev.next = newNode; + } + } + }, + configurable: true, + enumerable: true, + } +} + +/** + * Define an event attribute (e.g. `eventTarget.onclick`). + * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite. + * @param {string} eventName The event name to define. + * @returns {void} + */ +function defineEventAttribute(eventTargetPrototype, eventName) { + Object.defineProperty( + eventTargetPrototype, + `on${eventName}`, + defineEventAttributeDescriptor(eventName) + ); +} + +/** + * Define a custom EventTarget with event attributes. + * @param {string[]} eventNames Event names for event attributes. + * @returns {EventTarget} The custom EventTarget. + * @private + */ +function defineCustomEventTarget(eventNames) { + /** CustomEventTarget */ + function CustomEventTarget() { + EventTarget.call(this); + } + + CustomEventTarget.prototype = Object.create(EventTarget.prototype, { + constructor: { + value: CustomEventTarget, + configurable: true, + writable: true, + }, + }); + + for (let i = 0; i < eventNames.length; ++i) { + defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); + } + + return CustomEventTarget +} + +/** + * EventTarget. + * + * - This is constructor if no arguments. + * - This is a function which returns a CustomEventTarget constructor if there are arguments. + * + * For example: + * + * class A extends EventTarget {} + * class B extends EventTarget("message") {} + * class C extends EventTarget("message", "error") {} + * class D extends EventTarget(["message", "error"]) {} + */ +function EventTarget() { + /*eslint-disable consistent-return */ + if (this instanceof EventTarget) { + listenersMap.set(this, new Map()); + return + } + if (arguments.length === 1 && Array.isArray(arguments[0])) { + return defineCustomEventTarget(arguments[0]) + } + if (arguments.length > 0) { + const types = new Array(arguments.length); + for (let i = 0; i < arguments.length; ++i) { + types[i] = arguments[i]; + } + return defineCustomEventTarget(types) + } + throw new TypeError("Cannot call a class as a function") + /*eslint-enable consistent-return */ +} + +// Should be enumerable, but class methods are not enumerable. +EventTarget.prototype = { + /** + * Add a given listener to this event target. + * @param {string} eventName The event name to add. + * @param {Function} listener The listener to add. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {void} + */ + addEventListener(eventName, listener, options) { + if (listener == null) { + return + } + if (typeof listener !== "function" && !isObject(listener)) { + throw new TypeError("'listener' should be a function or an object.") + } + + const listeners = getListeners(this); + const optionsIsObj = isObject(options); + const capture = optionsIsObj + ? Boolean(options.capture) + : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + const newNode = { + listener, + listenerType, + passive: optionsIsObj && Boolean(options.passive), + once: optionsIsObj && Boolean(options.once), + next: null, + }; + + // Set it as the first node if the first node is null. + let node = listeners.get(eventName); + if (node === undefined) { + listeners.set(eventName, newNode); + return + } + + // Traverse to the tail while checking duplication.. + let prev = null; + while (node != null) { + if ( + node.listener === listener && + node.listenerType === listenerType + ) { + // Should ignore duplication. + return + } + prev = node; + node = node.next; + } + + // Add it. + prev.next = newNode; + }, + + /** + * Remove a given listener from this event target. + * @param {string} eventName The event name to remove. + * @param {Function} listener The listener to remove. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {void} + */ + removeEventListener(eventName, listener, options) { + if (listener == null) { + return + } + + const listeners = getListeners(this); + const capture = isObject(options) + ? Boolean(options.capture) + : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if ( + node.listener === listener && + node.listenerType === listenerType + ) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + return + } + + prev = node; + node = node.next; + } + }, + + /** + * Dispatch a given event. + * @param {Event|{type:string}} event The event to dispatch. + * @returns {boolean} `false` if canceled. + */ + dispatchEvent(event) { + if (event == null || typeof event.type !== "string") { + throw new TypeError('"event.type" should be a string.') + } + + // If listeners aren't registered, terminate. + const listeners = getListeners(this); + const eventName = event.type; + let node = listeners.get(eventName); + if (node == null) { + return true + } + + // Since we cannot rewrite several properties, so wrap object. + const wrappedEvent = wrapEvent(this, event); + + // This doesn't process capturing phase and bubbling phase. + // This isn't participating in a tree. + let prev = null; + while (node != null) { + // Remove this listener if it's once + if (node.once) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + + // Call this listener + setPassiveListener( + wrappedEvent, + node.passive ? node.listener : null + ); + if (typeof node.listener === "function") { + try { + node.listener.call(this, wrappedEvent); + } catch (err) { + if ( + typeof console !== "undefined" && + typeof console.error === "function" + ) { + console.error(err); + } + } + } else if ( + node.listenerType !== ATTRIBUTE && + typeof node.listener.handleEvent === "function" + ) { + node.listener.handleEvent(wrappedEvent); + } + + // Break if `event.stopImmediatePropagation` was called. + if (isStopped(wrappedEvent)) { + break + } + + node = node.next; + } + setPassiveListener(wrappedEvent, null); + setEventPhase(wrappedEvent, 0); + setCurrentTarget(wrappedEvent, null); + + return !wrappedEvent.defaultPrevented + }, +}; + +// `constructor` is not enumerable. +Object.defineProperty(EventTarget.prototype, "constructor", { + value: EventTarget, + configurable: true, + writable: true, +}); + +// Ensure `eventTarget instanceof window.EventTarget` is `true`. +if ( + typeof window !== "undefined" && + typeof window.EventTarget !== "undefined" +) { + Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype); +} + +exports.defineEventAttribute = defineEventAttribute; +exports.EventTarget = EventTarget; +exports["default"] = EventTarget; + +module.exports = EventTarget +module.exports.EventTarget = module.exports["default"] = EventTarget +module.exports.defineEventAttribute = defineEventAttribute +//# sourceMappingURL=event-target-shim.js.map + + +/***/ }), + +/***/ 91583: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/*** + * Node External Editor + * + * Kevin Gravier + * MIT 2018 + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var CreateFileError = /** @class */ (function (_super) { + __extends(CreateFileError, _super); + function CreateFileError(originalError) { + var _newTarget = this.constructor; + var _this = _super.call(this, "Failed to create temporary file for editor") || this; + _this.originalError = originalError; + var proto = _newTarget.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(_this, proto); + } + else { + _this.__proto__ = _newTarget.prototype; + } + return _this; + } + return CreateFileError; +}(Error)); +exports.CreateFileError = CreateFileError; + + +/***/ }), + +/***/ 611: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/*** + * Node External Editor + * + * Kevin Gravier + * MIT 2018 + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var LaunchEditorError = /** @class */ (function (_super) { + __extends(LaunchEditorError, _super); + function LaunchEditorError(originalError) { + var _newTarget = this.constructor; + var _this = _super.call(this, "Failed launch editor") || this; + _this.originalError = originalError; + var proto = _newTarget.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(_this, proto); + } + else { + _this.__proto__ = _newTarget.prototype; + } + return _this; + } + return LaunchEditorError; +}(Error)); +exports.LaunchEditorError = LaunchEditorError; + + +/***/ }), + +/***/ 97743: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/*** + * Node External Editor + * + * Kevin Gravier + * MIT 2018 + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var ReadFileError = /** @class */ (function (_super) { + __extends(ReadFileError, _super); + function ReadFileError(originalError) { + var _newTarget = this.constructor; + var _this = _super.call(this, "Failed to read temporary file") || this; + _this.originalError = originalError; + var proto = _newTarget.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(_this, proto); + } + else { + _this.__proto__ = _newTarget.prototype; + } + return _this; + } + return ReadFileError; +}(Error)); +exports.ReadFileError = ReadFileError; + + +/***/ }), + +/***/ 53179: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +/*** + * Node External Editor + * + * Kevin Gravier + * MIT 2018 + */ +var __extends = (this && this.__extends) || (function () { + var extendStatics = function (d, b) { + extendStatics = Object.setPrototypeOf || + ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || + function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; + return extendStatics(d, b); + }; + return function (d, b) { + extendStatics(d, b); + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); + }; +})(); +Object.defineProperty(exports, "__esModule", ({ value: true })); +var RemoveFileError = /** @class */ (function (_super) { + __extends(RemoveFileError, _super); + function RemoveFileError(originalError) { + var _newTarget = this.constructor; + var _this = _super.call(this, "Failed to cleanup temporary file") || this; + _this.originalError = originalError; + var proto = _newTarget.prototype; + if (Object.setPrototypeOf) { + Object.setPrototypeOf(_this, proto); + } + else { + _this.__proto__ = _newTarget.prototype; + } + return _this; + } + return RemoveFileError; +}(Error)); +exports.RemoveFileError = RemoveFileError; + + +/***/ }), + +/***/ 38167: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +var __webpack_unused_export__; + +/*** + * Node External Editor + * + * Kevin Gravier + * MIT 2019 + */ +__webpack_unused_export__ = ({ value: true }); +var chardet_1 = __webpack_require__(1703); +var child_process_1 = __webpack_require__(35317); +var fs_1 = __webpack_require__(79896); +var iconv_lite_1 = __webpack_require__(17453); +var tmp_1 = __webpack_require__(94662); +var CreateFileError_1 = __webpack_require__(91583); +__webpack_unused_export__ = CreateFileError_1.CreateFileError; +var LaunchEditorError_1 = __webpack_require__(611); +__webpack_unused_export__ = LaunchEditorError_1.LaunchEditorError; +var ReadFileError_1 = __webpack_require__(97743); +__webpack_unused_export__ = ReadFileError_1.ReadFileError; +var RemoveFileError_1 = __webpack_require__(53179); +__webpack_unused_export__ = RemoveFileError_1.RemoveFileError; +function edit(text, fileOptions) { + if (text === void 0) { text = ""; } + var editor = new ExternalEditor(text, fileOptions); + editor.run(); + editor.cleanup(); + return editor.text; +} +__webpack_unused_export__ = edit; +function editAsync(text, callback, fileOptions) { + if (text === void 0) { text = ""; } + var editor = new ExternalEditor(text, fileOptions); + editor.runAsync(function (err, result) { + if (err) { + setImmediate(callback, err, null); + } + else { + try { + editor.cleanup(); + setImmediate(callback, null, result); + } + catch (cleanupError) { + setImmediate(callback, cleanupError, null); + } + } + }); +} +exports.xV = editAsync; +var ExternalEditor = /** @class */ (function () { + function ExternalEditor(text, fileOptions) { + if (text === void 0) { text = ""; } + this.text = ""; + this.fileOptions = {}; + this.text = text; + if (fileOptions) { + this.fileOptions = fileOptions; + } + this.determineEditor(); + this.createTemporaryFile(); + } + ExternalEditor.splitStringBySpace = function (str) { + var pieces = []; + var currentString = ""; + for (var strIndex = 0; strIndex < str.length; strIndex++) { + var currentLetter = str[strIndex]; + if (strIndex > 0 && currentLetter === " " && str[strIndex - 1] !== "\\" && currentString.length > 0) { + pieces.push(currentString); + currentString = ""; + } + else { + currentString += currentLetter; + } + } + if (currentString.length > 0) { + pieces.push(currentString); + } + return pieces; + }; + Object.defineProperty(ExternalEditor.prototype, "temp_file", { + get: function () { + console.log("DEPRECATED: temp_file. Use tempFile moving forward."); + return this.tempFile; + }, + enumerable: true, + configurable: true + }); + Object.defineProperty(ExternalEditor.prototype, "last_exit_status", { + get: function () { + console.log("DEPRECATED: last_exit_status. Use lastExitStatus moving forward."); + return this.lastExitStatus; + }, + enumerable: true, + configurable: true + }); + ExternalEditor.prototype.run = function () { + this.launchEditor(); + this.readTemporaryFile(); + return this.text; + }; + ExternalEditor.prototype.runAsync = function (callback) { + var _this = this; + try { + this.launchEditorAsync(function () { + try { + _this.readTemporaryFile(); + setImmediate(callback, null, _this.text); + } + catch (readError) { + setImmediate(callback, readError, null); + } + }); + } + catch (launchError) { + setImmediate(callback, launchError, null); + } + }; + ExternalEditor.prototype.cleanup = function () { + this.removeTemporaryFile(); + }; + ExternalEditor.prototype.determineEditor = function () { + var editor = process.env.VISUAL ? process.env.VISUAL : + process.env.EDITOR ? process.env.EDITOR : + /^win/.test(process.platform) ? "notepad" : + "vim"; + var editorOpts = ExternalEditor.splitStringBySpace(editor).map(function (piece) { return piece.replace("\\ ", " "); }); + var bin = editorOpts.shift(); + this.editor = { args: editorOpts, bin: bin }; + }; + ExternalEditor.prototype.createTemporaryFile = function () { + try { + this.tempFile = tmp_1.tmpNameSync(this.fileOptions); + var opt = { encoding: "utf8" }; + if (this.fileOptions.hasOwnProperty("mode")) { + opt.mode = this.fileOptions.mode; + } + fs_1.writeFileSync(this.tempFile, this.text, opt); + } + catch (createFileError) { + throw new CreateFileError_1.CreateFileError(createFileError); + } + }; + ExternalEditor.prototype.readTemporaryFile = function () { + try { + var tempFileBuffer = fs_1.readFileSync(this.tempFile); + if (tempFileBuffer.length === 0) { + this.text = ""; + } + else { + var encoding = chardet_1.detect(tempFileBuffer).toString(); + if (!iconv_lite_1.encodingExists(encoding)) { + // Probably a bad idea, but will at least prevent crashing + encoding = "utf8"; + } + this.text = iconv_lite_1.decode(tempFileBuffer, encoding); + } + } + catch (readFileError) { + throw new ReadFileError_1.ReadFileError(readFileError); + } + }; + ExternalEditor.prototype.removeTemporaryFile = function () { + try { + fs_1.unlinkSync(this.tempFile); + } + catch (removeFileError) { + throw new RemoveFileError_1.RemoveFileError(removeFileError); + } + }; + ExternalEditor.prototype.launchEditor = function () { + try { + var editorProcess = child_process_1.spawnSync(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" }); + this.lastExitStatus = editorProcess.status; + } + catch (launchError) { + throw new LaunchEditorError_1.LaunchEditorError(launchError); + } + }; + ExternalEditor.prototype.launchEditorAsync = function (callback) { + var _this = this; + try { + var editorProcess = child_process_1.spawn(this.editor.bin, this.editor.args.concat([this.tempFile]), { stdio: "inherit" }); + editorProcess.on("exit", function (code) { + _this.lastExitStatus = code; + setImmediate(callback); + }); + } + catch (launchError) { + throw new LaunchEditorError_1.LaunchEditorError(launchError); + } + }; + return ExternalEditor; +}()); +__webpack_unused_export__ = ExternalEditor; + + +/***/ }), + +/***/ 69861: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(71781).Buffer); + +// Multibyte codec. In this scheme, a character is represented by 1 or more bytes. +// Our codec supports UTF-16 surrogates, extensions for GB18030 and unicode sequences. +// To save memory and loading time, we read table files only when requested. + +exports._dbcs = DBCSCodec; + +var UNASSIGNED = -1, + GB18030_CODE = -2, + SEQ_START = -10, + NODE_START = -1000, + UNASSIGNED_NODE = new Array(0x100), + DEF_CHAR = -1; + +for (var i = 0; i < 0x100; i++) + UNASSIGNED_NODE[i] = UNASSIGNED; + + +// Class DBCSCodec reads and initializes mapping tables. +function DBCSCodec(codecOptions, iconv) { + this.encodingName = codecOptions.encodingName; + if (!codecOptions) + throw new Error("DBCS codec is called without the data.") + if (!codecOptions.table) + throw new Error("Encoding '" + this.encodingName + "' has no data."); + + // Load tables. + var mappingTable = codecOptions.table(); + + + // Decode tables: MBCS -> Unicode. + + // decodeTables is a trie, encoded as an array of arrays of integers. Internal arrays are trie nodes and all have len = 256. + // Trie root is decodeTables[0]. + // Values: >= 0 -> unicode character code. can be > 0xFFFF + // == UNASSIGNED -> unknown/unassigned sequence. + // == GB18030_CODE -> this is the end of a GB18030 4-byte sequence. + // <= NODE_START -> index of the next node in our trie to process next byte. + // <= SEQ_START -> index of the start of a character code sequence, in decodeTableSeq. + this.decodeTables = []; + this.decodeTables[0] = UNASSIGNED_NODE.slice(0); // Create root node. + + // Sometimes a MBCS char corresponds to a sequence of unicode chars. We store them as arrays of integers here. + this.decodeTableSeq = []; + + // Actual mapping tables consist of chunks. Use them to fill up decode tables. + for (var i = 0; i < mappingTable.length; i++) + this._addDecodeChunk(mappingTable[i]); + + this.defaultCharUnicode = iconv.defaultCharUnicode; + + + // Encode tables: Unicode -> DBCS. + + // `encodeTable` is array mapping from unicode char to encoded char. All its values are integers for performance. + // Because it can be sparse, it is represented as array of buckets by 256 chars each. Bucket can be null. + // Values: >= 0 -> it is a normal char. Write the value (if <=256 then 1 byte, if <=65536 then 2 bytes, etc.). + // == UNASSIGNED -> no conversion found. Output a default char. + // <= SEQ_START -> it's an index in encodeTableSeq, see below. The character starts a sequence. + this.encodeTable = []; + + // `encodeTableSeq` is used when a sequence of unicode characters is encoded as a single code. We use a tree of + // objects where keys correspond to characters in sequence and leafs are the encoded dbcs values. A special DEF_CHAR key + // means end of sequence (needed when one sequence is a strict subsequence of another). + // Objects are kept separately from encodeTable to increase performance. + this.encodeTableSeq = []; + + // Some chars can be decoded, but need not be encoded. + var skipEncodeChars = {}; + if (codecOptions.encodeSkipVals) + for (var i = 0; i < codecOptions.encodeSkipVals.length; i++) { + var val = codecOptions.encodeSkipVals[i]; + if (typeof val === 'number') + skipEncodeChars[val] = true; + else + for (var j = val.from; j <= val.to; j++) + skipEncodeChars[j] = true; + } + + // Use decode trie to recursively fill out encode tables. + this._fillEncodeTable(0, 0, skipEncodeChars); + + // Add more encoding pairs when needed. + if (codecOptions.encodeAdd) { + for (var uChar in codecOptions.encodeAdd) + if (Object.prototype.hasOwnProperty.call(codecOptions.encodeAdd, uChar)) + this._setEncodeChar(uChar.charCodeAt(0), codecOptions.encodeAdd[uChar]); + } + + this.defCharSB = this.encodeTable[0][iconv.defaultCharSingleByte.charCodeAt(0)]; + if (this.defCharSB === UNASSIGNED) this.defCharSB = this.encodeTable[0]['?']; + if (this.defCharSB === UNASSIGNED) this.defCharSB = "?".charCodeAt(0); + + + // Load & create GB18030 tables when needed. + if (typeof codecOptions.gb18030 === 'function') { + this.gb18030 = codecOptions.gb18030(); // Load GB18030 ranges. + + // Add GB18030 decode tables. + var thirdByteNodeIdx = this.decodeTables.length; + var thirdByteNode = this.decodeTables[thirdByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + var fourthByteNodeIdx = this.decodeTables.length; + var fourthByteNode = this.decodeTables[fourthByteNodeIdx] = UNASSIGNED_NODE.slice(0); + + for (var i = 0x81; i <= 0xFE; i++) { + var secondByteNodeIdx = NODE_START - this.decodeTables[0][i]; + var secondByteNode = this.decodeTables[secondByteNodeIdx]; + for (var j = 0x30; j <= 0x39; j++) + secondByteNode[j] = NODE_START - thirdByteNodeIdx; + } + for (var i = 0x81; i <= 0xFE; i++) + thirdByteNode[i] = NODE_START - fourthByteNodeIdx; + for (var i = 0x30; i <= 0x39; i++) + fourthByteNode[i] = GB18030_CODE + } +} + +DBCSCodec.prototype.encoder = DBCSEncoder; +DBCSCodec.prototype.decoder = DBCSDecoder; + +// Decoder helpers +DBCSCodec.prototype._getDecodeTrieNode = function(addr) { + var bytes = []; + for (; addr > 0; addr >>= 8) + bytes.push(addr & 0xFF); + if (bytes.length == 0) + bytes.push(0); + + var node = this.decodeTables[0]; + for (var i = bytes.length-1; i > 0; i--) { // Traverse nodes deeper into the trie. + var val = node[bytes[i]]; + + if (val == UNASSIGNED) { // Create new node. + node[bytes[i]] = NODE_START - this.decodeTables.length; + this.decodeTables.push(node = UNASSIGNED_NODE.slice(0)); + } + else if (val <= NODE_START) { // Existing node. + node = this.decodeTables[NODE_START - val]; + } + else + throw new Error("Overwrite byte in " + this.encodingName + ", addr: " + addr.toString(16)); + } + return node; +} + + +DBCSCodec.prototype._addDecodeChunk = function(chunk) { + // First element of chunk is the hex mbcs code where we start. + var curAddr = parseInt(chunk[0], 16); + + // Choose the decoding node where we'll write our chars. + var writeTable = this._getDecodeTrieNode(curAddr); + curAddr = curAddr & 0xFF; + + // Write all other elements of the chunk to the table. + for (var k = 1; k < chunk.length; k++) { + var part = chunk[k]; + if (typeof part === "string") { // String, write as-is. + for (var l = 0; l < part.length;) { + var code = part.charCodeAt(l++); + if (0xD800 <= code && code < 0xDC00) { // Decode surrogate + var codeTrail = part.charCodeAt(l++); + if (0xDC00 <= codeTrail && codeTrail < 0xE000) + writeTable[curAddr++] = 0x10000 + (code - 0xD800) * 0x400 + (codeTrail - 0xDC00); + else + throw new Error("Incorrect surrogate pair in " + this.encodingName + " at chunk " + chunk[0]); + } + else if (0x0FF0 < code && code <= 0x0FFF) { // Character sequence (our own encoding used) + var len = 0xFFF - code + 2; + var seq = []; + for (var m = 0; m < len; m++) + seq.push(part.charCodeAt(l++)); // Simple variation: don't support surrogates or subsequences in seq. + + writeTable[curAddr++] = SEQ_START - this.decodeTableSeq.length; + this.decodeTableSeq.push(seq); + } + else + writeTable[curAddr++] = code; // Basic char + } + } + else if (typeof part === "number") { // Integer, meaning increasing sequence starting with prev character. + var charCode = writeTable[curAddr - 1] + 1; + for (var l = 0; l < part; l++) + writeTable[curAddr++] = charCode++; + } + else + throw new Error("Incorrect type '" + typeof part + "' given in " + this.encodingName + " at chunk " + chunk[0]); + } + if (curAddr > 0xFF) + throw new Error("Incorrect chunk in " + this.encodingName + " at addr " + chunk[0] + ": too long" + curAddr); +} + +// Encoder helpers +DBCSCodec.prototype._getEncodeBucket = function(uCode) { + var high = uCode >> 8; // This could be > 0xFF because of astral characters. + if (this.encodeTable[high] === undefined) + this.encodeTable[high] = UNASSIGNED_NODE.slice(0); // Create bucket on demand. + return this.encodeTable[high]; +} + +DBCSCodec.prototype._setEncodeChar = function(uCode, dbcsCode) { + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + if (bucket[low] <= SEQ_START) + this.encodeTableSeq[SEQ_START-bucket[low]][DEF_CHAR] = dbcsCode; // There's already a sequence, set a single-char subsequence of it. + else if (bucket[low] == UNASSIGNED) + bucket[low] = dbcsCode; +} + +DBCSCodec.prototype._setEncodeSequence = function(seq, dbcsCode) { + + // Get the root of character tree according to first character of the sequence. + var uCode = seq[0]; + var bucket = this._getEncodeBucket(uCode); + var low = uCode & 0xFF; + + var node; + if (bucket[low] <= SEQ_START) { + // There's already a sequence with - use it. + node = this.encodeTableSeq[SEQ_START-bucket[low]]; + } + else { + // There was no sequence object - allocate a new one. + node = {}; + if (bucket[low] !== UNASSIGNED) node[DEF_CHAR] = bucket[low]; // If a char was set before - make it a single-char subsequence. + bucket[low] = SEQ_START - this.encodeTableSeq.length; + this.encodeTableSeq.push(node); + } + + // Traverse the character tree, allocating new nodes as needed. + for (var j = 1; j < seq.length-1; j++) { + var oldVal = node[uCode]; + if (typeof oldVal === 'object') + node = oldVal; + else { + node = node[uCode] = {} + if (oldVal !== undefined) + node[DEF_CHAR] = oldVal + } + } + + // Set the leaf to given dbcsCode. + uCode = seq[seq.length-1]; + node[uCode] = dbcsCode; +} + +DBCSCodec.prototype._fillEncodeTable = function(nodeIdx, prefix, skipEncodeChars) { + var node = this.decodeTables[nodeIdx]; + for (var i = 0; i < 0x100; i++) { + var uCode = node[i]; + var mbCode = prefix + i; + if (skipEncodeChars[mbCode]) + continue; + + if (uCode >= 0) + this._setEncodeChar(uCode, mbCode); + else if (uCode <= NODE_START) + this._fillEncodeTable(NODE_START - uCode, mbCode << 8, skipEncodeChars); + else if (uCode <= SEQ_START) + this._setEncodeSequence(this.decodeTableSeq[SEQ_START - uCode], mbCode); + } +} + + + +// == Encoder ================================================================== + +function DBCSEncoder(options, codec) { + // Encoder state + this.leadSurrogate = -1; + this.seqObj = undefined; + + // Static data + this.encodeTable = codec.encodeTable; + this.encodeTableSeq = codec.encodeTableSeq; + this.defaultCharSingleByte = codec.defCharSB; + this.gb18030 = codec.gb18030; +} + +DBCSEncoder.prototype.write = function(str) { + var newBuf = Buffer.alloc(str.length * (this.gb18030 ? 4 : 3)), + leadSurrogate = this.leadSurrogate, + seqObj = this.seqObj, nextChar = -1, + i = 0, j = 0; + + while (true) { + // 0. Get next character. + if (nextChar === -1) { + if (i == str.length) break; + var uCode = str.charCodeAt(i++); + } + else { + var uCode = nextChar; + nextChar = -1; + } + + // 1. Handle surrogates. + if (0xD800 <= uCode && uCode < 0xE000) { // Char is one of surrogates. + if (uCode < 0xDC00) { // We've got lead surrogate. + if (leadSurrogate === -1) { + leadSurrogate = uCode; + continue; + } else { + leadSurrogate = uCode; + // Double lead surrogate found. + uCode = UNASSIGNED; + } + } else { // We've got trail surrogate. + if (leadSurrogate !== -1) { + uCode = 0x10000 + (leadSurrogate - 0xD800) * 0x400 + (uCode - 0xDC00); + leadSurrogate = -1; + } else { + // Incomplete surrogate pair - only trail surrogate found. + uCode = UNASSIGNED; + } + + } + } + else if (leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + nextChar = uCode; uCode = UNASSIGNED; // Write an error, then current char. + leadSurrogate = -1; + } + + // 2. Convert uCode character. + var dbcsCode = UNASSIGNED; + if (seqObj !== undefined && uCode != UNASSIGNED) { // We are in the middle of the sequence + var resCode = seqObj[uCode]; + if (typeof resCode === 'object') { // Sequence continues. + seqObj = resCode; + continue; + + } else if (typeof resCode == 'number') { // Sequence finished. Write it. + dbcsCode = resCode; + + } else if (resCode == undefined) { // Current character is not part of the sequence. + + // Try default character for this sequence + resCode = seqObj[DEF_CHAR]; + if (resCode !== undefined) { + dbcsCode = resCode; // Found. Write it. + nextChar = uCode; // Current character will be written too in the next iteration. + + } else { + // TODO: What if we have no default? (resCode == undefined) + // Then, we should write first char of the sequence as-is and try the rest recursively. + // Didn't do it for now because no encoding has this situation yet. + // Currently, just skip the sequence and write current char. + } + } + seqObj = undefined; + } + else if (uCode >= 0) { // Regular character + var subtable = this.encodeTable[uCode >> 8]; + if (subtable !== undefined) + dbcsCode = subtable[uCode & 0xFF]; + + if (dbcsCode <= SEQ_START) { // Sequence start + seqObj = this.encodeTableSeq[SEQ_START-dbcsCode]; + continue; + } + + if (dbcsCode == UNASSIGNED && this.gb18030) { + // Use GB18030 algorithm to find character(s) to write. + var idx = findIdx(this.gb18030.uChars, uCode); + if (idx != -1) { + var dbcsCode = this.gb18030.gbChars[idx] + (uCode - this.gb18030.uChars[idx]); + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 12600); dbcsCode = dbcsCode % 12600; + newBuf[j++] = 0x30 + Math.floor(dbcsCode / 1260); dbcsCode = dbcsCode % 1260; + newBuf[j++] = 0x81 + Math.floor(dbcsCode / 10); dbcsCode = dbcsCode % 10; + newBuf[j++] = 0x30 + dbcsCode; + continue; + } + } + } + + // 3. Write dbcsCode character. + if (dbcsCode === UNASSIGNED) + dbcsCode = this.defaultCharSingleByte; + + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else if (dbcsCode < 0x10000) { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + else { + newBuf[j++] = dbcsCode >> 16; + newBuf[j++] = (dbcsCode >> 8) & 0xFF; + newBuf[j++] = dbcsCode & 0xFF; + } + } + + this.seqObj = seqObj; + this.leadSurrogate = leadSurrogate; + return newBuf.slice(0, j); +} + +DBCSEncoder.prototype.end = function() { + if (this.leadSurrogate === -1 && this.seqObj === undefined) + return; // All clean. Most often case. + + var newBuf = Buffer.alloc(10), j = 0; + + if (this.seqObj) { // We're in the sequence. + var dbcsCode = this.seqObj[DEF_CHAR]; + if (dbcsCode !== undefined) { // Write beginning of the sequence. + if (dbcsCode < 0x100) { + newBuf[j++] = dbcsCode; + } + else { + newBuf[j++] = dbcsCode >> 8; // high byte + newBuf[j++] = dbcsCode & 0xFF; // low byte + } + } else { + // See todo above. + } + this.seqObj = undefined; + } + + if (this.leadSurrogate !== -1) { + // Incomplete surrogate pair - only lead surrogate found. + newBuf[j++] = this.defaultCharSingleByte; + this.leadSurrogate = -1; + } + + return newBuf.slice(0, j); +} + +// Export for testing +DBCSEncoder.prototype.findIdx = findIdx; + + +// == Decoder ================================================================== + +function DBCSDecoder(options, codec) { + // Decoder state + this.nodeIdx = 0; + this.prevBuf = Buffer.alloc(0); + + // Static data + this.decodeTables = codec.decodeTables; + this.decodeTableSeq = codec.decodeTableSeq; + this.defaultCharUnicode = codec.defaultCharUnicode; + this.gb18030 = codec.gb18030; +} + +DBCSDecoder.prototype.write = function(buf) { + var newBuf = Buffer.alloc(buf.length*2), + nodeIdx = this.nodeIdx, + prevBuf = this.prevBuf, prevBufOffset = this.prevBuf.length, + seqStart = -this.prevBuf.length, // idx of the start of current parsed sequence. + uCode; + + if (prevBufOffset > 0) // Make prev buf overlap a little to make it easier to slice later. + prevBuf = Buffer.concat([prevBuf, buf.slice(0, 10)]); + + for (var i = 0, j = 0; i < buf.length; i++) { + var curByte = (i >= 0) ? buf[i] : prevBuf[i + prevBufOffset]; + + // Lookup in current trie node. + var uCode = this.decodeTables[nodeIdx][curByte]; + + if (uCode >= 0) { + // Normal character, just use it. + } + else if (uCode === UNASSIGNED) { // Unknown char. + // TODO: Callback with seq. + //var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + i = seqStart; // Try to parse again, after skipping first byte of the sequence ('i' will be incremented by 'for' cycle). + uCode = this.defaultCharUnicode.charCodeAt(0); + } + else if (uCode === GB18030_CODE) { + var curSeq = (seqStart >= 0) ? buf.slice(seqStart, i+1) : prevBuf.slice(seqStart + prevBufOffset, i+1 + prevBufOffset); + var ptr = (curSeq[0]-0x81)*12600 + (curSeq[1]-0x30)*1260 + (curSeq[2]-0x81)*10 + (curSeq[3]-0x30); + var idx = findIdx(this.gb18030.gbChars, ptr); + uCode = this.gb18030.uChars[idx] + ptr - this.gb18030.gbChars[idx]; + } + else if (uCode <= NODE_START) { // Go to next trie node. + nodeIdx = NODE_START - uCode; + continue; + } + else if (uCode <= SEQ_START) { // Output a sequence of chars. + var seq = this.decodeTableSeq[SEQ_START - uCode]; + for (var k = 0; k < seq.length - 1; k++) { + uCode = seq[k]; + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + } + uCode = seq[seq.length-1]; + } + else + throw new Error("iconv-lite internal error: invalid decoding table value " + uCode + " at " + nodeIdx + "/" + curByte); + + // Write the character to buffer, handling higher planes using surrogate pair. + if (uCode > 0xFFFF) { + uCode -= 0x10000; + var uCodeLead = 0xD800 + Math.floor(uCode / 0x400); + newBuf[j++] = uCodeLead & 0xFF; + newBuf[j++] = uCodeLead >> 8; + + uCode = 0xDC00 + uCode % 0x400; + } + newBuf[j++] = uCode & 0xFF; + newBuf[j++] = uCode >> 8; + + // Reset trie node. + nodeIdx = 0; seqStart = i+1; + } + + this.nodeIdx = nodeIdx; + this.prevBuf = (seqStart >= 0) ? buf.slice(seqStart) : prevBuf.slice(seqStart + prevBufOffset); + return newBuf.slice(0, j).toString('ucs2'); +} + +DBCSDecoder.prototype.end = function() { + var ret = ''; + + // Try to parse all remaining chars. + while (this.prevBuf.length > 0) { + // Skip 1 character in the buffer. + ret += this.defaultCharUnicode; + var buf = this.prevBuf.slice(1); + + // Parse remaining as usual. + this.prevBuf = Buffer.alloc(0); + this.nodeIdx = 0; + if (buf.length > 0) + ret += this.write(buf); + } + + this.nodeIdx = 0; + return ret; +} + +// Binary search for GB18030. Returns largest i such that table[i] <= val. +function findIdx(table, val) { + if (table[0] > val) + return -1; + + var l = 0, r = table.length; + while (l < r-1) { // always table[l] <= val < table[r] + var mid = l + Math.floor((r-l+1)/2); + if (table[mid] <= val) + l = mid; + else + r = mid; + } + return l; +} + + + +/***/ }), + +/***/ 6903: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// Description of supported double byte encodings and aliases. +// Tables are not require()-d until they are needed to speed up library load. +// require()-s are direct to support Browserify. + +module.exports = { + + // == Japanese/ShiftJIS ==================================================== + // All japanese encodings are based on JIS X set of standards: + // JIS X 0201 - Single-byte encoding of ASCII + ¥ + Kana chars at 0xA1-0xDF. + // JIS X 0208 - Main set of 6879 characters, placed in 94x94 plane, to be encoded by 2 bytes. + // Has several variations in 1978, 1983, 1990 and 1997. + // JIS X 0212 - Supplementary plane of 6067 chars in 94x94 plane. 1990. Effectively dead. + // JIS X 0213 - Extension and modern replacement of 0208 and 0212. Total chars: 11233. + // 2 planes, first is superset of 0208, second - revised 0212. + // Introduced in 2000, revised 2004. Some characters are in Unicode Plane 2 (0x2xxxx) + + // Byte encodings are: + // * Shift_JIS: Compatible with 0201, uses not defined chars in top half as lead bytes for double-byte + // encoding of 0208. Lead byte ranges: 0x81-0x9F, 0xE0-0xEF; Trail byte ranges: 0x40-0x7E, 0x80-0x9E, 0x9F-0xFC. + // Windows CP932 is a superset of Shift_JIS. Some companies added more chars, notably KDDI. + // * EUC-JP: Up to 3 bytes per character. Used mostly on *nixes. + // 0x00-0x7F - lower part of 0201 + // 0x8E, 0xA1-0xDF - upper part of 0201 + // (0xA1-0xFE)x2 - 0208 plane (94x94). + // 0x8F, (0xA1-0xFE)x2 - 0212 plane (94x94). + // * JIS X 208: 7-bit, direct encoding of 0208. Byte ranges: 0x21-0x7E (94 values). Uncommon. + // Used as-is in ISO2022 family. + // * ISO2022-JP: Stateful encoding, with escape sequences to switch between ASCII, + // 0201-1976 Roman, 0208-1978, 0208-1983. + // * ISO2022-JP-1: Adds esc seq for 0212-1990. + // * ISO2022-JP-2: Adds esc seq for GB2313-1980, KSX1001-1992, ISO8859-1, ISO8859-7. + // * ISO2022-JP-3: Adds esc seq for 0201-1976 Kana set, 0213-2000 Planes 1, 2. + // * ISO2022-JP-2004: Adds 0213-2004 Plane 1. + // + // After JIS X 0213 appeared, Shift_JIS-2004, EUC-JISX0213 and ISO2022-JP-2004 followed, with just changing the planes. + // + // Overall, it seems that it's a mess :( http://www8.plala.or.jp/tkubota1/unicode-symbols-map2.html + + 'shiftjis': { + type: '_dbcs', + table: function() { return __webpack_require__(12003) }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + encodeSkipVals: [{from: 0xED40, to: 0xF940}], + }, + 'csshiftjis': 'shiftjis', + 'mskanji': 'shiftjis', + 'sjis': 'shiftjis', + 'windows31j': 'shiftjis', + 'ms31j': 'shiftjis', + 'xsjis': 'shiftjis', + 'windows932': 'shiftjis', + 'ms932': 'shiftjis', + '932': 'shiftjis', + 'cp932': 'shiftjis', + + 'eucjp': { + type: '_dbcs', + table: function() { return __webpack_require__(9082) }, + encodeAdd: {'\u00a5': 0x5C, '\u203E': 0x7E}, + }, + + // TODO: KDDI extension to Shift_JIS + // TODO: IBM CCSID 942 = CP932, but F0-F9 custom chars and other char changes. + // TODO: IBM CCSID 943 = Shift_JIS = CP932 with original Shift_JIS lower 128 chars. + + + // == Chinese/GBK ========================================================== + // http://en.wikipedia.org/wiki/GBK + // We mostly implement W3C recommendation: https://www.w3.org/TR/encoding/#gbk-encoder + + // Oldest GB2312 (1981, ~7600 chars) is a subset of CP936 + 'gb2312': 'cp936', + 'gb231280': 'cp936', + 'gb23121980': 'cp936', + 'csgb2312': 'cp936', + 'csiso58gb231280': 'cp936', + 'euccn': 'cp936', + + // Microsoft's CP936 is a subset and approximation of GBK. + 'windows936': 'cp936', + 'ms936': 'cp936', + '936': 'cp936', + 'cp936': { + type: '_dbcs', + table: function() { return __webpack_require__(33940) }, + }, + + // GBK (~22000 chars) is an extension of CP936 that added user-mapped chars and some other. + 'gbk': { + type: '_dbcs', + table: function() { return (__webpack_require__(33940).concat)(__webpack_require__(23630)) }, + }, + 'xgbk': 'gbk', + 'isoir58': 'gbk', + + // GB18030 is an algorithmic extension of GBK. + // Main source: https://www.w3.org/TR/encoding/#gbk-encoder + // http://icu-project.org/docs/papers/gb18030.html + // http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/gb-18030-2000.xml + // http://www.khngai.com/chinese/charmap/tblgbk.php?page=0 + 'gb18030': { + type: '_dbcs', + table: function() { return (__webpack_require__(33940).concat)(__webpack_require__(23630)) }, + gb18030: function() { return __webpack_require__(99997) }, + encodeSkipVals: [0x80], + encodeAdd: {'€': 0xA2E3}, + }, + + 'chinese': 'gb18030', + + + // == Korean =============================================================== + // EUC-KR, KS_C_5601 and KS X 1001 are exactly the same. + 'windows949': 'cp949', + 'ms949': 'cp949', + '949': 'cp949', + 'cp949': { + type: '_dbcs', + table: function() { return __webpack_require__(4810) }, + }, + + 'cseuckr': 'cp949', + 'csksc56011987': 'cp949', + 'euckr': 'cp949', + 'isoir149': 'cp949', + 'korean': 'cp949', + 'ksc56011987': 'cp949', + 'ksc56011989': 'cp949', + 'ksc5601': 'cp949', + + + // == Big5/Taiwan/Hong Kong ================================================ + // There are lots of tables for Big5 and cp950. Please see the following links for history: + // http://moztw.org/docs/big5/ http://www.haible.de/bruno/charsets/conversion-tables/Big5.html + // Variations, in roughly number of defined chars: + // * Windows CP 950: Microsoft variant of Big5. Canonical: http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP950.TXT + // * Windows CP 951: Microsoft variant of Big5-HKSCS-2001. Seems to be never public. http://me.abelcheung.org/articles/research/what-is-cp951/ + // * Big5-2003 (Taiwan standard) almost superset of cp950. + // * Unicode-at-on (UAO) / Mozilla 1.8. Falling out of use on the Web. Not supported by other browsers. + // * Big5-HKSCS (-2001, -2004, -2008). Hong Kong standard. + // many unicode code points moved from PUA to Supplementary plane (U+2XXXX) over the years. + // Plus, it has 4 combining sequences. + // Seems that Mozilla refused to support it for 10 yrs. https://bugzilla.mozilla.org/show_bug.cgi?id=162431 https://bugzilla.mozilla.org/show_bug.cgi?id=310299 + // because big5-hkscs is the only encoding to include astral characters in non-algorithmic way. + // Implementations are not consistent within browsers; sometimes labeled as just big5. + // MS Internet Explorer switches from big5 to big5-hkscs when a patch applied. + // Great discussion & recap of what's going on https://bugzilla.mozilla.org/show_bug.cgi?id=912470#c31 + // In the encoder, it might make sense to support encoding old PUA mappings to Big5 bytes seq-s. + // Official spec: http://www.ogcio.gov.hk/en/business/tech_promotion/ccli/terms/doc/2003cmp_2008.txt + // http://www.ogcio.gov.hk/tc/business/tech_promotion/ccli/terms/doc/hkscs-2008-big5-iso.txt + // + // Current understanding of how to deal with Big5(-HKSCS) is in the Encoding Standard, http://encoding.spec.whatwg.org/#big5-encoder + // Unicode mapping (http://www.unicode.org/Public/MAPPINGS/OBSOLETE/EASTASIA/OTHER/BIG5.TXT) is said to be wrong. + + 'windows950': 'cp950', + 'ms950': 'cp950', + '950': 'cp950', + 'cp950': { + type: '_dbcs', + table: function() { return __webpack_require__(94800) }, + }, + + // Big5 has many variations and is an extension of cp950. We use Encoding Standard's as a consensus. + 'big5': 'big5hkscs', + 'big5hkscs': { + type: '_dbcs', + table: function() { return (__webpack_require__(94800).concat)(__webpack_require__(679)) }, + encodeSkipVals: [0xa2cc], + }, + + 'cnbig5': 'big5hkscs', + 'csbig5': 'big5hkscs', + 'xxbig5': 'big5hkscs', +}; + + +/***/ }), + +/***/ 56860: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +// Update this array if you add/rename/remove files in this directory. +// We support Browserify by skipping automatic module discovery and requiring modules directly. +var modules = [ + __webpack_require__(50539), + __webpack_require__(2918), + __webpack_require__(87996), + __webpack_require__(12846), + __webpack_require__(76654), + __webpack_require__(29338), + __webpack_require__(69861), + __webpack_require__(6903), +]; + +// Put all encoding/alias/codec definitions to single object and export it. +for (var i = 0; i < modules.length; i++) { + var module = modules[i]; + for (var enc in module) + if (Object.prototype.hasOwnProperty.call(module, enc)) + exports[enc] = module[enc]; +} + + +/***/ }), + +/***/ 50539: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(71781).Buffer); + +// Export Node.js internal encodings. + +module.exports = { + // Encodings + utf8: { type: "_internal", bomAware: true}, + cesu8: { type: "_internal", bomAware: true}, + unicode11utf8: "utf8", + + ucs2: { type: "_internal", bomAware: true}, + utf16le: "ucs2", + + binary: { type: "_internal" }, + base64: { type: "_internal" }, + hex: { type: "_internal" }, + + // Codec. + _internal: InternalCodec, +}; + +//------------------------------------------------------------------------------ + +function InternalCodec(codecOptions, iconv) { + this.enc = codecOptions.encodingName; + this.bomAware = codecOptions.bomAware; + + if (this.enc === "base64") + this.encoder = InternalEncoderBase64; + else if (this.enc === "cesu8") { + this.enc = "utf8"; // Use utf8 for decoding. + this.encoder = InternalEncoderCesu8; + + // Add decoder for versions of Node not supporting CESU-8 + if (Buffer.from('eda0bdedb2a9', 'hex').toString() !== '💩') { + this.decoder = InternalDecoderCesu8; + this.defaultCharUnicode = iconv.defaultCharUnicode; + } + } +} + +InternalCodec.prototype.encoder = InternalEncoder; +InternalCodec.prototype.decoder = InternalDecoder; + +//------------------------------------------------------------------------------ + +// We use node.js internal decoder. Its signature is the same as ours. +var StringDecoder = (__webpack_require__(13193).StringDecoder); + +if (!StringDecoder.prototype.end) // Node v0.8 doesn't have this method. + StringDecoder.prototype.end = function() {}; + + +function InternalDecoder(options, codec) { + StringDecoder.call(this, codec.enc); +} + +InternalDecoder.prototype = StringDecoder.prototype; + + +//------------------------------------------------------------------------------ +// Encoder is mostly trivial + +function InternalEncoder(options, codec) { + this.enc = codec.enc; +} + +InternalEncoder.prototype.write = function(str) { + return Buffer.from(str, this.enc); +} + +InternalEncoder.prototype.end = function() { +} + + +//------------------------------------------------------------------------------ +// Except base64 encoder, which must keep its state. + +function InternalEncoderBase64(options, codec) { + this.prevStr = ''; +} + +InternalEncoderBase64.prototype.write = function(str) { + str = this.prevStr + str; + var completeQuads = str.length - (str.length % 4); + this.prevStr = str.slice(completeQuads); + str = str.slice(0, completeQuads); + + return Buffer.from(str, "base64"); +} + +InternalEncoderBase64.prototype.end = function() { + return Buffer.from(this.prevStr, "base64"); +} + + +//------------------------------------------------------------------------------ +// CESU-8 encoder is also special. + +function InternalEncoderCesu8(options, codec) { +} + +InternalEncoderCesu8.prototype.write = function(str) { + var buf = Buffer.alloc(str.length * 3), bufIdx = 0; + for (var i = 0; i < str.length; i++) { + var charCode = str.charCodeAt(i); + // Naive implementation, but it works because CESU-8 is especially easy + // to convert from UTF-16 (which all JS strings are encoded in). + if (charCode < 0x80) + buf[bufIdx++] = charCode; + else if (charCode < 0x800) { + buf[bufIdx++] = 0xC0 + (charCode >>> 6); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + else { // charCode will always be < 0x10000 in javascript. + buf[bufIdx++] = 0xE0 + (charCode >>> 12); + buf[bufIdx++] = 0x80 + ((charCode >>> 6) & 0x3f); + buf[bufIdx++] = 0x80 + (charCode & 0x3f); + } + } + return buf.slice(0, bufIdx); +} + +InternalEncoderCesu8.prototype.end = function() { +} + +//------------------------------------------------------------------------------ +// CESU-8 decoder is not implemented in Node v4.0+ + +function InternalDecoderCesu8(options, codec) { + this.acc = 0; + this.contBytes = 0; + this.accBytes = 0; + this.defaultCharUnicode = codec.defaultCharUnicode; +} + +InternalDecoderCesu8.prototype.write = function(buf) { + var acc = this.acc, contBytes = this.contBytes, accBytes = this.accBytes, + res = ''; + for (var i = 0; i < buf.length; i++) { + var curByte = buf[i]; + if ((curByte & 0xC0) !== 0x80) { // Leading byte + if (contBytes > 0) { // Previous code is invalid + res += this.defaultCharUnicode; + contBytes = 0; + } + + if (curByte < 0x80) { // Single-byte code + res += String.fromCharCode(curByte); + } else if (curByte < 0xE0) { // Two-byte code + acc = curByte & 0x1F; + contBytes = 1; accBytes = 1; + } else if (curByte < 0xF0) { // Three-byte code + acc = curByte & 0x0F; + contBytes = 2; accBytes = 1; + } else { // Four or more are not supported for CESU-8. + res += this.defaultCharUnicode; + } + } else { // Continuation byte + if (contBytes > 0) { // We're waiting for it. + acc = (acc << 6) | (curByte & 0x3f); + contBytes--; accBytes++; + if (contBytes === 0) { + // Check for overlong encoding, but support Modified UTF-8 (encoding NULL as C0 80) + if (accBytes === 2 && acc < 0x80 && acc > 0) + res += this.defaultCharUnicode; + else if (accBytes === 3 && acc < 0x800) + res += this.defaultCharUnicode; + else + // Actually add character. + res += String.fromCharCode(acc); + } + } else { // Unexpected continuation byte + res += this.defaultCharUnicode; + } + } + } + this.acc = acc; this.contBytes = contBytes; this.accBytes = accBytes; + return res; +} + +InternalDecoderCesu8.prototype.end = function() { + var res = 0; + if (this.contBytes > 0) + res += this.defaultCharUnicode; + return res; +} + + +/***/ }), + +/***/ 12846: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(71781).Buffer); + +// Single-byte codec. Needs a 'chars' string parameter that contains 256 or 128 chars that +// correspond to encoded bytes (if 128 - then lower half is ASCII). + +exports._sbcs = SBCSCodec; +function SBCSCodec(codecOptions, iconv) { + if (!codecOptions) + throw new Error("SBCS codec is called without the data.") + + // Prepare char buffer for decoding. + if (!codecOptions.chars || (codecOptions.chars.length !== 128 && codecOptions.chars.length !== 256)) + throw new Error("Encoding '"+codecOptions.type+"' has incorrect 'chars' (must be of len 128 or 256)"); + + if (codecOptions.chars.length === 128) { + var asciiString = ""; + for (var i = 0; i < 128; i++) + asciiString += String.fromCharCode(i); + codecOptions.chars = asciiString + codecOptions.chars; + } + + this.decodeBuf = Buffer.from(codecOptions.chars, 'ucs2'); + + // Encoding buffer. + var encodeBuf = Buffer.alloc(65536, iconv.defaultCharSingleByte.charCodeAt(0)); + + for (var i = 0; i < codecOptions.chars.length; i++) + encodeBuf[codecOptions.chars.charCodeAt(i)] = i; + + this.encodeBuf = encodeBuf; +} + +SBCSCodec.prototype.encoder = SBCSEncoder; +SBCSCodec.prototype.decoder = SBCSDecoder; + + +function SBCSEncoder(options, codec) { + this.encodeBuf = codec.encodeBuf; +} + +SBCSEncoder.prototype.write = function(str) { + var buf = Buffer.alloc(str.length); + for (var i = 0; i < str.length; i++) + buf[i] = this.encodeBuf[str.charCodeAt(i)]; + + return buf; +} + +SBCSEncoder.prototype.end = function() { +} + + +function SBCSDecoder(options, codec) { + this.decodeBuf = codec.decodeBuf; +} + +SBCSDecoder.prototype.write = function(buf) { + // Strings are immutable in JS -> we use ucs2 buffer to speed up computations. + var decodeBuf = this.decodeBuf; + var newBuf = Buffer.alloc(buf.length*2); + var idx1 = 0, idx2 = 0; + for (var i = 0; i < buf.length; i++) { + idx1 = buf[i]*2; idx2 = i*2; + newBuf[idx2] = decodeBuf[idx1]; + newBuf[idx2+1] = decodeBuf[idx1+1]; + } + return newBuf.toString('ucs2'); +} + +SBCSDecoder.prototype.end = function() { +} + + +/***/ }), + +/***/ 29338: +/***/ ((module) => { + +"use strict"; + + +// Generated data for sbcs codec. Don't edit manually. Regenerate using generation/gen-sbcs.js script. +module.exports = { + "437": "cp437", + "737": "cp737", + "775": "cp775", + "850": "cp850", + "852": "cp852", + "855": "cp855", + "856": "cp856", + "857": "cp857", + "858": "cp858", + "860": "cp860", + "861": "cp861", + "862": "cp862", + "863": "cp863", + "864": "cp864", + "865": "cp865", + "866": "cp866", + "869": "cp869", + "874": "windows874", + "922": "cp922", + "1046": "cp1046", + "1124": "cp1124", + "1125": "cp1125", + "1129": "cp1129", + "1133": "cp1133", + "1161": "cp1161", + "1162": "cp1162", + "1163": "cp1163", + "1250": "windows1250", + "1251": "windows1251", + "1252": "windows1252", + "1253": "windows1253", + "1254": "windows1254", + "1255": "windows1255", + "1256": "windows1256", + "1257": "windows1257", + "1258": "windows1258", + "28591": "iso88591", + "28592": "iso88592", + "28593": "iso88593", + "28594": "iso88594", + "28595": "iso88595", + "28596": "iso88596", + "28597": "iso88597", + "28598": "iso88598", + "28599": "iso88599", + "28600": "iso885910", + "28601": "iso885911", + "28603": "iso885913", + "28604": "iso885914", + "28605": "iso885915", + "28606": "iso885916", + "windows874": { + "type": "_sbcs", + "chars": "€����…�����������‘’“”•–—�������� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "win874": "windows874", + "cp874": "windows874", + "windows1250": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰Š‹ŚŤŽŹ�‘’“”•–—�™š›śťžź ˇ˘Ł¤Ą¦§¨©Ş«¬­®Ż°±˛ł´µ¶·¸ąş»Ľ˝ľżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "win1250": "windows1250", + "cp1250": "windows1250", + "windows1251": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊЌЋЏђ‘’“”•–—�™љ›њќћџ ЎўЈ¤Ґ¦§Ё©Є«¬­®Ї°±Ііґµ¶·ё№є»јЅѕїАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "win1251": "windows1251", + "cp1251": "windows1251", + "windows1252": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ�Ž��‘’“”•–—˜™š›œ�žŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "win1252": "windows1252", + "cp1252": "windows1252", + "windows1253": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡�‰�‹�����‘’“”•–—�™�›���� ΅Ά£¤¥¦§¨©�«¬­®―°±²³΄µ¶·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "win1253": "windows1253", + "cp1253": "windows1253", + "windows1254": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰Š‹Œ����‘’“”•–—˜™š›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "win1254": "windows1254", + "cp1254": "windows1254", + "windows1255": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹�����‘’“”•–—˜™�›���� ¡¢£₪¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾¿ְֱֲֳִֵֶַָֹֺֻּֽ־ֿ׀ׁׂ׃װױײ׳״�������אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "win1255": "windows1255", + "cp1255": "windows1255", + "windows1256": { + "type": "_sbcs", + "chars": "€پ‚ƒ„…†‡ˆ‰ٹ‹Œچژڈگ‘’“”•–—ک™ڑ›œ‌‍ں ،¢£¤¥¦§¨©ھ«¬­®¯°±²³´µ¶·¸¹؛»¼½¾؟ہءآأؤإئابةتثجحخدذرزسشصض×طظعغـفقكàلâمنهوçèéêëىيîïًٌٍَôُِ÷ّùْûü‎‏ے" + }, + "win1256": "windows1256", + "cp1256": "windows1256", + "windows1257": { + "type": "_sbcs", + "chars": "€�‚�„…†‡�‰�‹�¨ˇ¸�‘’“”•–—�™�›�¯˛� �¢£¤�¦§Ø©Ŗ«¬­®Æ°±²³´µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž˙" + }, + "win1257": "windows1257", + "cp1257": "windows1257", + "windows1258": { + "type": "_sbcs", + "chars": "€�‚ƒ„…†‡ˆ‰�‹Œ����‘’“”•–—˜™�›œ��Ÿ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "win1258": "windows1258", + "cp1258": "windows1258", + "iso88591": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28591": "iso88591", + "iso88592": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ą˘Ł¤ĽŚ§¨ŠŞŤŹ­ŽŻ°ą˛ł´ľśˇ¸šşťź˝žżŔÁÂĂÄĹĆÇČÉĘËĚÍÎĎĐŃŇÓÔŐÖ×ŘŮÚŰÜÝŢßŕáâăäĺćçčéęëěíîďđńňóôőö÷řůúűüýţ˙" + }, + "cp28592": "iso88592", + "iso88593": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ħ˘£¤�Ĥ§¨İŞĞĴ­�ݰħ²³´µĥ·¸ışğĵ½�żÀÁÂ�ÄĊĈÇÈÉÊËÌÍÎÏ�ÑÒÓÔĠÖ×ĜÙÚÛÜŬŜßàáâ�äċĉçèéêëìíîï�ñòóôġö÷ĝùúûüŭŝ˙" + }, + "cp28593": "iso88593", + "iso88594": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĸŖ¤Ĩϧ¨ŠĒĢŦ­Ž¯°ą˛ŗ´ĩšēģŧŊžŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎĪĐŅŌĶÔÕÖרŲÚÛÜŨŪßāáâãäåæįčéęëėíîīđņōķôõö÷øųúûüũū˙" + }, + "cp28594": "iso88594", + "iso88595": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂЃЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђѓєѕіїјљњћќ§ўџ" + }, + "cp28595": "iso88595", + "iso88596": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ���¤�������،­�������������؛���؟�ءآأؤإئابةتثجحخدذرزسشصضطظعغ�����ـفقكلمنهوىيًٌٍَُِّْ�������������" + }, + "cp28596": "iso88596", + "iso88597": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ‘’£€₯¦§¨©ͺ«¬­�―°±²³΄΅Ά·ΈΉΊ»Ό½ΎΏΐΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡ�ΣΤΥΦΧΨΩΪΫάέήίΰαβγδεζηθικλμνξοπρςστυφχψωϊϋόύώ�" + }, + "cp28597": "iso88597", + "iso88598": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �¢£¤¥¦§¨©×«¬­®¯°±²³´µ¶·¸¹÷»¼½¾��������������������������������‗אבגדהוזחטיךכלםמןנסעףפץצקרשת��‎‏�" + }, + "cp28598": "iso88598", + "iso88599": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏĞÑÒÓÔÕÖרÙÚÛÜİŞßàáâãäåæçèéêëìíîïğñòóôõö÷øùúûüışÿ" + }, + "cp28599": "iso88599", + "iso885910": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄĒĢĪĨͧĻĐŠŦŽ­ŪŊ°ąēģīĩķ·ļđšŧž―ūŋĀÁÂÃÄÅÆĮČÉĘËĖÍÎÏÐŅŌÓÔÕÖŨØŲÚÛÜÝÞßāáâãäåæįčéęëėíîïðņōóôõöũøųúûüýþĸ" + }, + "cp28600": "iso885910", + "iso885911": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "cp28601": "iso885911", + "iso885913": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ”¢£¤„¦§Ø©Ŗ«¬­®Æ°±²³“µ¶·ø¹ŗ»¼½¾æĄĮĀĆÄÅĘĒČÉŹĖĢĶĪĻŠŃŅÓŌÕÖ×ŲŁŚŪÜŻŽßąįāćäåęēčéźėģķīļšńņóōõö÷ųłśūüżž’" + }, + "cp28603": "iso885913", + "iso885914": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ Ḃḃ£ĊċḊ§Ẁ©ẂḋỲ­®ŸḞḟĠġṀṁ¶ṖẁṗẃṠỳẄẅṡÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŴÑÒÓÔÕÖṪØÙÚÛÜÝŶßàáâãäåæçèéêëìíîïŵñòóôõöṫøùúûüýŷÿ" + }, + "cp28604": "iso885914", + "iso885915": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥Š§š©ª«¬­®¯°±²³Žµ¶·ž¹º»ŒœŸ¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "cp28605": "iso885915", + "iso885916": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ĄąŁ€„Чš©Ș«Ź­źŻ°±ČłŽ”¶·žčș»ŒœŸżÀÁÂĂÄĆÆÇÈÉÊËÌÍÎÏĐŃÒÓÔŐÖŚŰÙÚÛÜĘȚßàáâăäćæçèéêëìíîïđńòóôőöśűùúûüęțÿ" + }, + "cp28606": "iso885916", + "cp437": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm437": "cp437", + "csibm437": "cp437", + "cp737": { + "type": "_sbcs", + "chars": "ΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρσςτυφχψ░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀ωάέήϊίόύϋώΆΈΉΊΌΎΏ±≥≤ΪΫ÷≈°∙·√ⁿ²■ " + }, + "ibm737": "cp737", + "csibm737": "cp737", + "cp775": { + "type": "_sbcs", + "chars": "ĆüéāäģåćłēŖŗīŹÄÅÉæÆōöĢ¢ŚśÖÜø£Ø×¤ĀĪóŻżź”¦©®¬½¼Ł«»░▒▓│┤ĄČĘĖ╣║╗╝ĮŠ┐└┴┬├─┼ŲŪ╚╔╩╦╠═╬Žąčęėįšųūž┘┌█▄▌▐▀ÓßŌŃõÕµńĶķĻļņĒŅ’­±“¾¶§÷„°∙·¹³²■ " + }, + "ibm775": "cp775", + "csibm775": "cp775", + "cp850": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈıÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm850": "cp850", + "csibm850": "cp850", + "cp852": { + "type": "_sbcs", + "chars": "ÇüéâäůćçłëŐőîŹÄĆÉĹĺôöĽľŚśÖÜŤťŁ×čáíóúĄąŽžĘ꬟Ⱥ«»░▒▓│┤ÁÂĚŞ╣║╗╝Żż┐└┴┬├─┼Ăă╚╔╩╦╠═╬¤đĐĎËďŇÍÎě┘┌█▄ŢŮ▀ÓßÔŃńňŠšŔÚŕŰýÝţ´­˝˛ˇ˘§÷¸°¨˙űŘř■ " + }, + "ibm852": "cp852", + "csibm852": "cp852", + "cp855": { + "type": "_sbcs", + "chars": "ђЂѓЃёЁєЄѕЅіІїЇјЈљЉњЊћЋќЌўЎџЏюЮъЪаАбБцЦдДеЕфФгГ«»░▒▓│┤хХиИ╣║╗╝йЙ┐└┴┬├─┼кК╚╔╩╦╠═╬¤лЛмМнНоОп┘┌█▄Пя▀ЯрРсСтТуУжЖвВьЬ№­ыЫзЗшШэЭщЩчЧ§■ " + }, + "ibm855": "cp855", + "csibm855": "cp855", + "cp856": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת�£�×����������®¬½¼�«»░▒▓│┤���©╣║╗╝¢¥┐└┴┬├─┼��╚╔╩╦╠═╬¤���������┘┌█▄¦�▀������µ�������¯´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm856": "cp856", + "csibm856": "cp856", + "cp857": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîıÄÅÉæÆôöòûùİÖÜø£ØŞşáíóúñÑĞ𿮬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ºªÊËÈ�ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµ�×ÚÛÙìÿ¯´­±�¾¶§÷¸°¨·¹³²■ " + }, + "ibm857": "cp857", + "csibm857": "cp857", + "cp858": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø×ƒáíóúñѪº¿®¬½¼¡«»░▒▓│┤ÁÂÀ©╣║╗╝¢¥┐└┴┬├─┼ãÃ╚╔╩╦╠═╬¤ðÐÊËÈ€ÍÎÏ┘┌█▄¦Ì▀ÓßÔÒõÕµþÞÚÛÙýݯ´­±‗¾¶§÷¸°¨·¹³²■ " + }, + "ibm858": "cp858", + "csibm858": "cp858", + "cp860": { + "type": "_sbcs", + "chars": "ÇüéâãàÁçêÊèÍÔìÃÂÉÀÈôõòÚùÌÕÜ¢£Ù₧ÓáíóúñѪº¿Ò¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm860": "cp860", + "csibm860": "cp860", + "cp861": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèÐðÞÄÅÉæÆôöþûÝýÖÜø£Ø₧ƒáíóúÁÍÓÚ¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm861": "cp861", + "csibm861": "cp861", + "cp862": { + "type": "_sbcs", + "chars": "אבגדהוזחטיךכלםמןנסעףפץצקרשת¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm862": "cp862", + "csibm862": "cp862", + "cp863": { + "type": "_sbcs", + "chars": "ÇüéâÂà¶çêëèïî‗À§ÉÈÊôËÏûù¤ÔÜ¢£ÙÛƒ¦´óú¨¸³¯Î⌐¬½¼¾«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm863": "cp863", + "csibm863": "cp863", + "cp864": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$٪&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~°·∙√▒─│┼┤┬├┴┐┌└┘β∞φ±½¼≈«»ﻷﻸ��ﻻﻼ� ­ﺂ£¤ﺄ��ﺎﺏﺕﺙ،ﺝﺡﺥ٠١٢٣٤٥٦٧٨٩ﻑ؛ﺱﺵﺹ؟¢ﺀﺁﺃﺅﻊﺋﺍﺑﺓﺗﺛﺟﺣﺧﺩﺫﺭﺯﺳﺷﺻﺿﻁﻅﻋﻏ¦¬÷×ﻉـﻓﻗﻛﻟﻣﻧﻫﻭﻯﻳﺽﻌﻎﻍﻡﹽّﻥﻩﻬﻰﻲﻐﻕﻵﻶﻝﻙﻱ■�" + }, + "ibm864": "cp864", + "csibm864": "cp864", + "cp865": { + "type": "_sbcs", + "chars": "ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜø£Ø₧ƒáíóúñѪº¿⌐¬½¼¡«¤░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + "ibm865": "cp865", + "csibm865": "cp865", + "cp866": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№¤■ " + }, + "ibm866": "cp866", + "csibm866": "cp866", + "cp869": { + "type": "_sbcs", + "chars": "������Ά�·¬¦‘’Έ―ΉΊΪΌ��ΎΫ©Ώ²³ά£έήίϊΐόύΑΒΓΔΕΖΗ½ΘΙ«»░▒▓│┤ΚΛΜΝ╣║╗╝ΞΟ┐└┴┬├─┼ΠΡ╚╔╩╦╠═╬ΣΤΥΦΧΨΩαβγ┘┌█▄δε▀ζηθικλμνξοπρσςτ΄­±υφχ§ψ΅°¨ωϋΰώ■ " + }, + "ibm869": "cp869", + "csibm869": "cp869", + "cp922": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®‾°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏŠÑÒÓÔÕÖרÙÚÛÜÝŽßàáâãäåæçèéêëìíîïšñòóôõö÷øùúûüýžÿ" + }, + "ibm922": "cp922", + "csibm922": "cp922", + "cp1046": { + "type": "_sbcs", + "chars": "ﺈ×÷ﹱˆ■│─┐┌└┘ﹹﹻﹽﹿﹷﺊﻰﻳﻲﻎﻏﻐﻶﻸﻺﻼ ¤ﺋﺑﺗﺛﺟﺣ،­ﺧﺳ٠١٢٣٤٥٦٧٨٩ﺷ؛ﺻﺿﻊ؟ﻋءآأؤإئابةتثجحخدذرزسشصضطﻇعغﻌﺂﺄﺎﻓـفقكلمنهوىيًٌٍَُِّْﻗﻛﻟﻵﻷﻹﻻﻣﻧﻬﻩ�" + }, + "ibm1046": "cp1046", + "csibm1046": "cp1046", + "cp1124": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ЁЂҐЄЅІЇЈЉЊЋЌ­ЎЏАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя№ёђґєѕіїјљњћќ§ўџ" + }, + "ibm1124": "cp1124", + "csibm1124": "cp1124", + "cp1125": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёҐґЄєІіЇї·√№¤■ " + }, + "ibm1125": "cp1125", + "csibm1125": "cp1125", + "cp1129": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1129": "cp1129", + "csibm1129": "cp1129", + "cp1133": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ກຂຄງຈສຊຍດຕຖທນບປຜຝພຟມຢຣລວຫອຮ���ຯະາຳິີຶືຸູຼັົຽ���ເແໂໃໄ່້໊໋໌ໍໆ�ໜໝ₭����������������໐໑໒໓໔໕໖໗໘໙��¢¬¦�" + }, + "ibm1133": "cp1133", + "csibm1133": "cp1133", + "cp1161": { + "type": "_sbcs", + "chars": "��������������������������������่กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู้๊๋€฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛¢¬¦ " + }, + "ibm1161": "cp1161", + "csibm1161": "cp1161", + "cp1162": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + }, + "ibm1162": "cp1162", + "csibm1162": "cp1162", + "cp1163": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£€¥¦§œ©ª«¬­®¯°±²³Ÿµ¶·Œ¹º»¼½¾¿ÀÁÂĂÄÅÆÇÈÉÊË̀ÍÎÏĐÑ̉ÓÔƠÖרÙÚÛÜỮßàáâăäåæçèéêë́íîïđṇ̃óôơö÷øùúûüư₫ÿ" + }, + "ibm1163": "cp1163", + "csibm1163": "cp1163", + "maccroatian": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊�©⁄¤‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ" + }, + "maccyrillic": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°¢£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµ∂ЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "macgreek": { + "type": "_sbcs", + "chars": "Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦­ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ�" + }, + "maciceland": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macroman": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macromania": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂŞ∞±≤≥¥µ∂∑∏π∫ªºΩăş¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›Ţţ‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macthai": { + "type": "_sbcs", + "chars": "«»…“”�•‘’� กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู​–—฿เแโใไๅๆ็่้๊๋์ํ™๏๐๑๒๓๔๕๖๗๘๙®©����" + }, + "macturkish": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙ�ˆ˜¯˘˙˚¸˝˛ˇ" + }, + "macukraine": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю¤" + }, + "koi8r": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ё╓╔╕╖╗╘╙╚╛╜╝╞╟╠╡Ё╢╣╤╥╦╧╨╩╪╫╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8u": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґ╝╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪Ґ╬©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8ru": { + "type": "_sbcs", + "chars": "─│┌┐└┘├┤┬┴┼▀▄█▌▐░▒▓⌠■∙√≈≤≥ ⌡°²·÷═║╒ёє╔ії╗╘╙╚╛ґў╞╟╠╡ЁЄ╣ІЇ╦╧╨╩╪ҐЎ©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "koi8t": { + "type": "_sbcs", + "chars": "қғ‚Ғ„…†‡�‰ҳ‹ҲҷҶ�Қ‘’“”•–—�™�›�����ӯӮё¤ӣ¦§���«¬­®�°±²Ё�Ӣ¶·�№�»���©юабцдефгхийклмнопярстужвьызшэщчъЮАБЦДЕФГХИЙКЛМНОПЯРСТУЖВЬЫЗШЭЩЧЪ" + }, + "armscii8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ �և։)(»«—.՝,-֊…՜՛՞ԱաԲբԳգԴդԵեԶզԷէԸըԹթԺժԻիԼլԽխԾծԿկՀհՁձՂղՃճՄմՅյՆնՇշՈոՉչՊպՋջՌռՍսՎվՏտՐրՑցՒւՓփՔքՕօՖֆ՚�" + }, + "rk1048": { + "type": "_sbcs", + "chars": "ЂЃ‚ѓ„…†‡€‰Љ‹ЊҚҺЏђ‘’“”•–—�™љ›њқһџ ҰұӘ¤Ө¦§Ё©Ғ«¬­®Ү°±Ііөµ¶·ё№ғ»әҢңүАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "tcvn": { + "type": "_sbcs", + "chars": "\u0000ÚỤ\u0003ỪỬỮ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010ỨỰỲỶỸÝỴ\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ÀẢÃÁẠẶẬÈẺẼÉẸỆÌỈĨÍỊÒỎÕÓỌỘỜỞỠỚỢÙỦŨ ĂÂÊÔƠƯĐăâêôơưđẶ̀̀̉̃́àảãáạẲằẳẵắẴẮẦẨẪẤỀặầẩẫấậèỂẻẽéẹềểễếệìỉỄẾỒĩíịòỔỏõóọồổỗốộờởỡớợùỖủũúụừửữứựỳỷỹýỵỐ" + }, + "georgianacademy": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზთიკლმნოპჟრსტუფქღყშჩცძწჭხჯჰჱჲჳჴჵჶçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "georgianps": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿აბგდევზჱთიკლმნჲოპჟრსტჳუფქღყშჩცძწჭხჴჯჰჵæçèéêëìíîïðñòóôõö÷øùúûüýþÿ" + }, + "pt154": { + "type": "_sbcs", + "chars": "ҖҒӮғ„…ҶҮҲүҠӢҢҚҺҸҗ‘’“”•–—ҳҷҡӣңқһҹ ЎўЈӨҘҰ§Ё©Ә«¬ӯ®Ҝ°ұІіҙө¶·ё№ә»јҪҫҝАБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя" + }, + "viscii": { + "type": "_sbcs", + "chars": "\u0000\u0001Ẳ\u0003\u0004ẴẪ\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013Ỷ\u0015\u0016\u0017\u0018Ỹ\u001a\u001b\u001c\u001dỴ\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~ẠẮẰẶẤẦẨẬẼẸẾỀỂỄỆỐỒỔỖỘỢỚỜỞỊỎỌỈỦŨỤỲÕắằặấầẩậẽẹếềểễệốồổỗỠƠộờởịỰỨỪỬơớƯÀÁÂÃẢĂẳẵÈÉÊẺÌÍĨỳĐứÒÓÔạỷừửÙÚỹỵÝỡưàáâãảăữẫèéêẻìíĩỉđựòóôõỏọụùúũủýợỮ" + }, + "iso646cn": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#¥%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "iso646jp": { + "type": "_sbcs", + "chars": "\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007\b\t\n\u000b\f\r\u000e\u000f\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017\u0018\u0019\u001a\u001b\u001c\u001d\u001e\u001f !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[¥]^_`abcdefghijklmnopqrstuvwxyz{|}‾��������������������������������������������������������������������������������������������������������������������������������" + }, + "hproman8": { + "type": "_sbcs", + "chars": "€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ ÀÂÈÊËÎÏ´ˋˆ¨˜ÙÛ₤¯Ýý°ÇçÑñ¡¿¤£¥§ƒ¢âêôûáéóúàèòùäëöüÅîØÆåíøæÄìÖÜÉïßÔÁÃãÐðÍÌÓÒÕõŠšÚŸÿÞþ·µ¶¾—¼½ªº«■»±�" + }, + "macintosh": { + "type": "_sbcs", + "chars": "ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄¤‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔ�ÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ" + }, + "ascii": { + "type": "_sbcs", + "chars": "��������������������������������������������������������������������������������������������������������������������������������" + }, + "tis620": { + "type": "_sbcs", + "chars": "���������������������������������กขฃคฅฆงจฉชซฌญฎฏฐฑฒณดตถทธนบปผฝพฟภมยรฤลฦวศษสหฬอฮฯะัาำิีึืฺุู����฿เแโใไๅๆ็่้๊๋์ํ๎๏๐๑๒๓๔๕๖๗๘๙๚๛����" + } +} + +/***/ }), + +/***/ 76654: +/***/ ((module) => { + +"use strict"; + + +// Manually added data to be used by sbcs codec in addition to generated one. + +module.exports = { + // Not supported by iconv, not sure why. + "10029": "maccenteuro", + "maccenteuro": { + "type": "_sbcs", + "chars": "ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ" + }, + + "808": "cp808", + "ibm808": "cp808", + "cp808": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмноп░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀рстуфхцчшщъыьэюяЁёЄєЇїЎў°∙·√№€■ " + }, + + "mik": { + "type": "_sbcs", + "chars": "АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдежзийклмнопрстуфхцчшщъыьэюя└┴┬├─┼╣║╚╔╩╦╠═╬┐░▒▓│┤№§╗╝┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ " + }, + + // Aliases of generated encodings. + "ascii8bit": "ascii", + "usascii": "ascii", + "ansix34": "ascii", + "ansix341968": "ascii", + "ansix341986": "ascii", + "csascii": "ascii", + "cp367": "ascii", + "ibm367": "ascii", + "isoir6": "ascii", + "iso646us": "ascii", + "iso646irv": "ascii", + "us": "ascii", + + "latin1": "iso88591", + "latin2": "iso88592", + "latin3": "iso88593", + "latin4": "iso88594", + "latin5": "iso88599", + "latin6": "iso885910", + "latin7": "iso885913", + "latin8": "iso885914", + "latin9": "iso885915", + "latin10": "iso885916", + + "csisolatin1": "iso88591", + "csisolatin2": "iso88592", + "csisolatin3": "iso88593", + "csisolatin4": "iso88594", + "csisolatincyrillic": "iso88595", + "csisolatinarabic": "iso88596", + "csisolatingreek" : "iso88597", + "csisolatinhebrew": "iso88598", + "csisolatin5": "iso88599", + "csisolatin6": "iso885910", + + "l1": "iso88591", + "l2": "iso88592", + "l3": "iso88593", + "l4": "iso88594", + "l5": "iso88599", + "l6": "iso885910", + "l7": "iso885913", + "l8": "iso885914", + "l9": "iso885915", + "l10": "iso885916", + + "isoir14": "iso646jp", + "isoir57": "iso646cn", + "isoir100": "iso88591", + "isoir101": "iso88592", + "isoir109": "iso88593", + "isoir110": "iso88594", + "isoir144": "iso88595", + "isoir127": "iso88596", + "isoir126": "iso88597", + "isoir138": "iso88598", + "isoir148": "iso88599", + "isoir157": "iso885910", + "isoir166": "tis620", + "isoir179": "iso885913", + "isoir199": "iso885914", + "isoir203": "iso885915", + "isoir226": "iso885916", + + "cp819": "iso88591", + "ibm819": "iso88591", + + "cyrillic": "iso88595", + + "arabic": "iso88596", + "arabic8": "iso88596", + "ecma114": "iso88596", + "asmo708": "iso88596", + + "greek" : "iso88597", + "greek8" : "iso88597", + "ecma118" : "iso88597", + "elot928" : "iso88597", + + "hebrew": "iso88598", + "hebrew8": "iso88598", + + "turkish": "iso88599", + "turkish8": "iso88599", + + "thai": "iso885911", + "thai8": "iso885911", + + "celtic": "iso885914", + "celtic8": "iso885914", + "isoceltic": "iso885914", + + "tis6200": "tis620", + "tis62025291": "tis620", + "tis62025330": "tis620", + + "10000": "macroman", + "10006": "macgreek", + "10007": "maccyrillic", + "10079": "maciceland", + "10081": "macturkish", + + "cspc8codepage437": "cp437", + "cspc775baltic": "cp775", + "cspc850multilingual": "cp850", + "cspcp852": "cp852", + "cspc862latinhebrew": "cp862", + "cpgr": "cp869", + + "msee": "cp1250", + "mscyrl": "cp1251", + "msansi": "cp1252", + "msgreek": "cp1253", + "msturk": "cp1254", + "mshebr": "cp1255", + "msarab": "cp1256", + "winbaltrim": "cp1257", + + "cp20866": "koi8r", + "20866": "koi8r", + "ibm878": "koi8r", + "cskoi8r": "koi8r", + + "cp21866": "koi8u", + "21866": "koi8u", + "ibm1168": "koi8u", + + "strk10482002": "rk1048", + + "tcvn5712": "tcvn", + "tcvn57121": "tcvn", + + "gb198880": "iso646cn", + "cn": "iso646cn", + + "csiso14jisc6220ro": "iso646jp", + "jisc62201969ro": "iso646jp", + "jp": "iso646jp", + + "cshproman8": "hproman8", + "r8": "hproman8", + "roman8": "hproman8", + "xroman8": "hproman8", + "ibm1051": "hproman8", + + "mac": "macintosh", + "csmacintosh": "macintosh", +}; + + + +/***/ }), + +/***/ 2918: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(71781).Buffer); + +// Note: UTF16-LE (or UCS2) codec is Node.js native. See encodings/internal.js + +// == UTF16-BE codec. ========================================================== + +exports.utf16be = Utf16BECodec; +function Utf16BECodec() { +} + +Utf16BECodec.prototype.encoder = Utf16BEEncoder; +Utf16BECodec.prototype.decoder = Utf16BEDecoder; +Utf16BECodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf16BEEncoder() { +} + +Utf16BEEncoder.prototype.write = function(str) { + var buf = Buffer.from(str, 'ucs2'); + for (var i = 0; i < buf.length; i += 2) { + var tmp = buf[i]; buf[i] = buf[i+1]; buf[i+1] = tmp; + } + return buf; +} + +Utf16BEEncoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf16BEDecoder() { + this.overflowByte = -1; +} + +Utf16BEDecoder.prototype.write = function(buf) { + if (buf.length == 0) + return ''; + + var buf2 = Buffer.alloc(buf.length + 1), + i = 0, j = 0; + + if (this.overflowByte !== -1) { + buf2[0] = buf[0]; + buf2[1] = this.overflowByte; + i = 1; j = 2; + } + + for (; i < buf.length-1; i += 2, j+= 2) { + buf2[j] = buf[i+1]; + buf2[j+1] = buf[i]; + } + + this.overflowByte = (i == buf.length-1) ? buf[buf.length-1] : -1; + + return buf2.slice(0, j).toString('ucs2'); +} + +Utf16BEDecoder.prototype.end = function() { +} + + +// == UTF-16 codec ============================================================= +// Decoder chooses automatically from UTF-16LE and UTF-16BE using BOM and space-based heuristic. +// Defaults to UTF-16LE, as it's prevalent and default in Node. +// http://en.wikipedia.org/wiki/UTF-16 and http://encoding.spec.whatwg.org/#utf-16le +// Decoder default can be changed: iconv.decode(buf, 'utf16', {defaultEncoding: 'utf-16be'}); + +// Encoder uses UTF-16LE and prepends BOM (which can be overridden with addBOM: false). + +exports.utf16 = Utf16Codec; +function Utf16Codec(codecOptions, iconv) { + this.iconv = iconv; +} + +Utf16Codec.prototype.encoder = Utf16Encoder; +Utf16Codec.prototype.decoder = Utf16Decoder; + + +// -- Encoding (pass-through) + +function Utf16Encoder(options, codec) { + options = options || {}; + if (options.addBOM === undefined) + options.addBOM = true; + this.encoder = codec.iconv.getEncoder('utf-16le', options); +} + +Utf16Encoder.prototype.write = function(str) { + return this.encoder.write(str); +} + +Utf16Encoder.prototype.end = function() { + return this.encoder.end(); +} + + +// -- Decoding + +function Utf16Decoder(options, codec) { + this.decoder = null; + this.initialBytes = []; + this.initialBytesLen = 0; + + this.options = options || {}; + this.iconv = codec.iconv; +} + +Utf16Decoder.prototype.write = function(buf) { + if (!this.decoder) { + // Codec is not chosen yet. Accumulate initial bytes. + this.initialBytes.push(buf); + this.initialBytesLen += buf.length; + + if (this.initialBytesLen < 16) // We need more bytes to use space heuristic (see below) + return ''; + + // We have enough bytes -> detect endianness. + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + this.initialBytes.length = this.initialBytesLen = 0; + } + + return this.decoder.write(buf); +} + +Utf16Decoder.prototype.end = function() { + if (!this.decoder) { + var buf = Buffer.concat(this.initialBytes), + encoding = detectEncoding(buf, this.options.defaultEncoding); + this.decoder = this.iconv.getDecoder(encoding, this.options); + + var res = this.decoder.write(buf), + trail = this.decoder.end(); + + return trail ? (res + trail) : res; + } + return this.decoder.end(); +} + +function detectEncoding(buf, defaultEncoding) { + var enc = defaultEncoding || 'utf-16le'; + + if (buf.length >= 2) { + // Check BOM. + if (buf[0] == 0xFE && buf[1] == 0xFF) // UTF-16BE BOM + enc = 'utf-16be'; + else if (buf[0] == 0xFF && buf[1] == 0xFE) // UTF-16LE BOM + enc = 'utf-16le'; + else { + // No BOM found. Try to deduce encoding from initial content. + // Most of the time, the content has ASCII chars (U+00**), but the opposite (U+**00) is uncommon. + // So, we count ASCII as if it was LE or BE, and decide from that. + var asciiCharsLE = 0, asciiCharsBE = 0, // Counts of chars in both positions + _len = Math.min(buf.length - (buf.length % 2), 64); // Len is always even. + + for (var i = 0; i < _len; i += 2) { + if (buf[i] === 0 && buf[i+1] !== 0) asciiCharsBE++; + if (buf[i] !== 0 && buf[i+1] === 0) asciiCharsLE++; + } + + if (asciiCharsBE > asciiCharsLE) + enc = 'utf-16be'; + else if (asciiCharsBE < asciiCharsLE) + enc = 'utf-16le'; + } + } + + return enc; +} + + + + +/***/ }), + +/***/ 87996: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(71781).Buffer); + +// UTF-7 codec, according to https://tools.ietf.org/html/rfc2152 +// See also below a UTF-7-IMAP codec, according to http://tools.ietf.org/html/rfc3501#section-5.1.3 + +exports.utf7 = Utf7Codec; +exports.unicode11utf7 = 'utf7'; // Alias UNICODE-1-1-UTF-7 +function Utf7Codec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7Codec.prototype.encoder = Utf7Encoder; +Utf7Codec.prototype.decoder = Utf7Decoder; +Utf7Codec.prototype.bomAware = true; + + +// -- Encoding + +var nonDirectChars = /[^A-Za-z0-9'\(\),-\.\/:\? \n\r\t]+/g; + +function Utf7Encoder(options, codec) { + this.iconv = codec.iconv; +} + +Utf7Encoder.prototype.write = function(str) { + // Naive implementation. + // Non-direct chars are encoded as "+-"; single "+" char is encoded as "+-". + return Buffer.from(str.replace(nonDirectChars, function(chunk) { + return "+" + (chunk === '+' ? '' : + this.iconv.encode(chunk, 'utf16-be').toString('base64').replace(/=+$/, '')) + + "-"; + }.bind(this))); +} + +Utf7Encoder.prototype.end = function() { +} + + +// -- Decoding + +function Utf7Decoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64Regex = /[A-Za-z0-9\/+]/; +var base64Chars = []; +for (var i = 0; i < 256; i++) + base64Chars[i] = base64Regex.test(String.fromCharCode(i)); + +var plusChar = '+'.charCodeAt(0), + minusChar = '-'.charCodeAt(0), + andChar = '&'.charCodeAt(0); + +Utf7Decoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '+' + if (buf[i] == plusChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64Chars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) {// "+-" -> "+" + res += "+"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString(); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus is absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString(); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7Decoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + +// UTF-7-IMAP codec. +// RFC3501 Sec. 5.1.3 Modified UTF-7 (http://tools.ietf.org/html/rfc3501#section-5.1.3) +// Differences: +// * Base64 part is started by "&" instead of "+" +// * Direct characters are 0x20-0x7E, except "&" (0x26) +// * In Base64, "," is used instead of "/" +// * Base64 must not be used to represent direct characters. +// * No implicit shift back from Base64 (should always end with '-') +// * String must end in non-shifted position. +// * "-&" while in base64 is not allowed. + + +exports.utf7imap = Utf7IMAPCodec; +function Utf7IMAPCodec(codecOptions, iconv) { + this.iconv = iconv; +}; + +Utf7IMAPCodec.prototype.encoder = Utf7IMAPEncoder; +Utf7IMAPCodec.prototype.decoder = Utf7IMAPDecoder; +Utf7IMAPCodec.prototype.bomAware = true; + + +// -- Encoding + +function Utf7IMAPEncoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = Buffer.alloc(6); + this.base64AccumIdx = 0; +} + +Utf7IMAPEncoder.prototype.write = function(str) { + var inBase64 = this.inBase64, + base64Accum = this.base64Accum, + base64AccumIdx = this.base64AccumIdx, + buf = Buffer.alloc(str.length*5 + 10), bufIdx = 0; + + for (var i = 0; i < str.length; i++) { + var uChar = str.charCodeAt(i); + if (0x20 <= uChar && uChar <= 0x7E) { // Direct character or '&'. + if (inBase64) { + if (base64AccumIdx > 0) { + bufIdx += buf.write(base64Accum.slice(0, base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + inBase64 = false; + } + + if (!inBase64) { + buf[bufIdx++] = uChar; // Write direct character + + if (uChar === andChar) // Ampersand -> '&-' + buf[bufIdx++] = minusChar; + } + + } else { // Non-direct character + if (!inBase64) { + buf[bufIdx++] = andChar; // Write '&', then go to base64 mode. + inBase64 = true; + } + if (inBase64) { + base64Accum[base64AccumIdx++] = uChar >> 8; + base64Accum[base64AccumIdx++] = uChar & 0xFF; + + if (base64AccumIdx == base64Accum.length) { + bufIdx += buf.write(base64Accum.toString('base64').replace(/\//g, ','), bufIdx); + base64AccumIdx = 0; + } + } + } + } + + this.inBase64 = inBase64; + this.base64AccumIdx = base64AccumIdx; + + return buf.slice(0, bufIdx); +} + +Utf7IMAPEncoder.prototype.end = function() { + var buf = Buffer.alloc(10), bufIdx = 0; + if (this.inBase64) { + if (this.base64AccumIdx > 0) { + bufIdx += buf.write(this.base64Accum.slice(0, this.base64AccumIdx).toString('base64').replace(/\//g, ',').replace(/=+$/, ''), bufIdx); + this.base64AccumIdx = 0; + } + + buf[bufIdx++] = minusChar; // Write '-', then go to direct mode. + this.inBase64 = false; + } + + return buf.slice(0, bufIdx); +} + + +// -- Decoding + +function Utf7IMAPDecoder(options, codec) { + this.iconv = codec.iconv; + this.inBase64 = false; + this.base64Accum = ''; +} + +var base64IMAPChars = base64Chars.slice(); +base64IMAPChars[','.charCodeAt(0)] = true; + +Utf7IMAPDecoder.prototype.write = function(buf) { + var res = "", lastI = 0, + inBase64 = this.inBase64, + base64Accum = this.base64Accum; + + // The decoder is more involved as we must handle chunks in stream. + // It is forgiving, closer to standard UTF-7 (for example, '-' is optional at the end). + + for (var i = 0; i < buf.length; i++) { + if (!inBase64) { // We're in direct mode. + // Write direct chars until '&' + if (buf[i] == andChar) { + res += this.iconv.decode(buf.slice(lastI, i), "ascii"); // Write direct chars. + lastI = i+1; + inBase64 = true; + } + } else { // We decode base64. + if (!base64IMAPChars[buf[i]]) { // Base64 ended. + if (i == lastI && buf[i] == minusChar) { // "&-" -> "&" + res += "&"; + } else { + var b64str = base64Accum + buf.slice(lastI, i).toString().replace(/,/g, '/'); + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + if (buf[i] != minusChar) // Minus may be absorbed after base64. + i--; + + lastI = i+1; + inBase64 = false; + base64Accum = ''; + } + } + } + + if (!inBase64) { + res += this.iconv.decode(buf.slice(lastI), "ascii"); // Write direct chars. + } else { + var b64str = base64Accum + buf.slice(lastI).toString().replace(/,/g, '/'); + + var canBeDecoded = b64str.length - (b64str.length % 8); // Minimal chunk: 2 quads -> 2x3 bytes -> 3 chars. + base64Accum = b64str.slice(canBeDecoded); // The rest will be decoded in future. + b64str = b64str.slice(0, canBeDecoded); + + res += this.iconv.decode(Buffer.from(b64str, 'base64'), "utf16-be"); + } + + this.inBase64 = inBase64; + this.base64Accum = base64Accum; + + return res; +} + +Utf7IMAPDecoder.prototype.end = function() { + var res = ""; + if (this.inBase64 && this.base64Accum.length > 0) + res = this.iconv.decode(Buffer.from(this.base64Accum, 'base64'), "utf16-be"); + + this.inBase64 = false; + this.base64Accum = ''; + return res; +} + + + + +/***/ }), + +/***/ 13993: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +var BOMChar = '\uFEFF'; + +exports.PrependBOM = PrependBOMWrapper +function PrependBOMWrapper(encoder, options) { + this.encoder = encoder; + this.addBOM = true; +} + +PrependBOMWrapper.prototype.write = function(str) { + if (this.addBOM) { + str = BOMChar + str; + this.addBOM = false; + } + + return this.encoder.write(str); +} + +PrependBOMWrapper.prototype.end = function() { + return this.encoder.end(); +} + + +//------------------------------------------------------------------------------ + +exports.StripBOM = StripBOMWrapper; +function StripBOMWrapper(decoder, options) { + this.decoder = decoder; + this.pass = false; + this.options = options || {}; +} + +StripBOMWrapper.prototype.write = function(buf) { + var res = this.decoder.write(buf); + if (this.pass || !res) + return res; + + if (res[0] === BOMChar) { + res = res.slice(1); + if (typeof this.options.stripBOM === 'function') + this.options.stripBOM(); + } + + this.pass = true; + return res; +} + +StripBOMWrapper.prototype.end = function() { + return this.decoder.end(); +} + + + +/***/ }), + +/***/ 46950: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Buffer = (__webpack_require__(20181).Buffer); +// Note: not polyfilled with safer-buffer on a purpose, as overrides Buffer + +// == Extend Node primitives to use iconv-lite ================================= + +module.exports = function (iconv) { + var original = undefined; // Place to keep original methods. + + // Node authors rewrote Buffer internals to make it compatible with + // Uint8Array and we cannot patch key functions since then. + // Note: this does use older Buffer API on a purpose + iconv.supportsNodeEncodingsExtension = !(Buffer.from || new Buffer(0) instanceof Uint8Array); + + iconv.extendNodeEncodings = function extendNodeEncodings() { + if (original) return; + original = {}; + + if (!iconv.supportsNodeEncodingsExtension) { + console.error("ACTION NEEDED: require('iconv-lite').extendNodeEncodings() is not supported in your version of Node"); + console.error("See more info at https://github.com/ashtuchkin/iconv-lite/wiki/Node-v4-compatibility"); + return; + } + + var nodeNativeEncodings = { + 'hex': true, 'utf8': true, 'utf-8': true, 'ascii': true, 'binary': true, + 'base64': true, 'ucs2': true, 'ucs-2': true, 'utf16le': true, 'utf-16le': true, + }; + + Buffer.isNativeEncoding = function(enc) { + return enc && nodeNativeEncodings[enc.toLowerCase()]; + } + + // -- SlowBuffer ----------------------------------------------------------- + var SlowBuffer = (__webpack_require__(20181).SlowBuffer); + + original.SlowBufferToString = SlowBuffer.prototype.toString; + SlowBuffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.SlowBufferWrite = SlowBuffer.prototype.write; + SlowBuffer.prototype.write = function(string, offset, length, encoding) { + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.SlowBufferWrite.call(this, string, offset, length, encoding); + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + } + + // -- Buffer --------------------------------------------------------------- + + original.BufferIsEncoding = Buffer.isEncoding; + Buffer.isEncoding = function(encoding) { + return Buffer.isNativeEncoding(encoding) || iconv.encodingExists(encoding); + } + + original.BufferByteLength = Buffer.byteLength; + Buffer.byteLength = SlowBuffer.byteLength = function(str, encoding) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferByteLength.call(this, str, encoding); + + // Slow, I know, but we don't have a better way yet. + return iconv.encode(str, encoding).length; + } + + original.BufferToString = Buffer.prototype.toString; + Buffer.prototype.toString = function(encoding, start, end) { + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferToString.call(this, encoding, start, end); + + // Otherwise, use our decoding method. + if (typeof start == 'undefined') start = 0; + if (typeof end == 'undefined') end = this.length; + return iconv.decode(this.slice(start, end), encoding); + } + + original.BufferWrite = Buffer.prototype.write; + Buffer.prototype.write = function(string, offset, length, encoding) { + var _offset = offset, _length = length, _encoding = encoding; + // Support both (string, offset, length, encoding) + // and the legacy (string, encoding, offset, length) + if (isFinite(offset)) { + if (!isFinite(length)) { + encoding = length; + length = undefined; + } + } else { // legacy + var swap = encoding; + encoding = offset; + offset = length; + length = swap; + } + + encoding = String(encoding || 'utf8').toLowerCase(); + + // Use native conversion when possible + if (Buffer.isNativeEncoding(encoding)) + return original.BufferWrite.call(this, string, _offset, _length, _encoding); + + offset = +offset || 0; + var remaining = this.length - offset; + if (!length) { + length = remaining; + } else { + length = +length; + if (length > remaining) { + length = remaining; + } + } + + if (string.length > 0 && (length < 0 || offset < 0)) + throw new RangeError('attempt to write beyond buffer bounds'); + + // Otherwise, use our encoding method. + var buf = iconv.encode(string, encoding); + if (buf.length < length) length = buf.length; + buf.copy(this, offset, 0, length); + return length; + + // TODO: Set _charsWritten. + } + + + // -- Readable ------------------------------------------------------------- + if (iconv.supportsStreams) { + var Readable = (__webpack_require__(2203).Readable); + + original.ReadableSetEncoding = Readable.prototype.setEncoding; + Readable.prototype.setEncoding = function setEncoding(enc, options) { + // Use our own decoder, it has the same interface. + // We cannot use original function as it doesn't handle BOM-s. + this._readableState.decoder = iconv.getDecoder(enc, options); + this._readableState.encoding = enc; + } + + Readable.prototype.collect = iconv._collect; + } + } + + // Remove iconv-lite Node primitive extensions. + iconv.undoExtendNodeEncodings = function undoExtendNodeEncodings() { + if (!iconv.supportsNodeEncodingsExtension) + return; + if (!original) + throw new Error("require('iconv-lite').undoExtendNodeEncodings(): Nothing to undo; extendNodeEncodings() is not called.") + + delete Buffer.isNativeEncoding; + + var SlowBuffer = (__webpack_require__(20181).SlowBuffer); + + SlowBuffer.prototype.toString = original.SlowBufferToString; + SlowBuffer.prototype.write = original.SlowBufferWrite; + + Buffer.isEncoding = original.BufferIsEncoding; + Buffer.byteLength = original.BufferByteLength; + Buffer.prototype.toString = original.BufferToString; + Buffer.prototype.write = original.BufferWrite; + + if (iconv.supportsStreams) { + var Readable = (__webpack_require__(2203).Readable); + + Readable.prototype.setEncoding = original.ReadableSetEncoding; + delete Readable.prototype.collect; + } + + original = undefined; + } +} + + +/***/ }), + +/***/ 17453: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// Some environments don't have global Buffer (e.g. React Native). +// Solution would be installing npm modules "buffer" and "stream" explicitly. +var Buffer = (__webpack_require__(71781).Buffer); + +var bomHandling = __webpack_require__(13993), + iconv = module.exports; + +// All codecs and aliases are kept here, keyed by encoding name/alias. +// They are lazy loaded in `iconv.getCodec` from `encodings/index.js`. +iconv.encodings = null; + +// Characters emitted in case of error. +iconv.defaultCharUnicode = '�'; +iconv.defaultCharSingleByte = '?'; + +// Public API. +iconv.encode = function encode(str, encoding, options) { + str = "" + (str || ""); // Ensure string. + + var encoder = iconv.getEncoder(encoding, options); + + var res = encoder.write(str); + var trail = encoder.end(); + + return (trail && trail.length > 0) ? Buffer.concat([res, trail]) : res; +} + +iconv.decode = function decode(buf, encoding, options) { + if (typeof buf === 'string') { + if (!iconv.skipDecodeWarning) { + console.error('Iconv-lite warning: decode()-ing strings is deprecated. Refer to https://github.com/ashtuchkin/iconv-lite/wiki/Use-Buffers-when-decoding'); + iconv.skipDecodeWarning = true; + } + + buf = Buffer.from("" + (buf || ""), "binary"); // Ensure buffer. + } + + var decoder = iconv.getDecoder(encoding, options); + + var res = decoder.write(buf); + var trail = decoder.end(); + + return trail ? (res + trail) : res; +} + +iconv.encodingExists = function encodingExists(enc) { + try { + iconv.getCodec(enc); + return true; + } catch (e) { + return false; + } +} + +// Legacy aliases to convert functions +iconv.toEncoding = iconv.encode; +iconv.fromEncoding = iconv.decode; + +// Search for a codec in iconv.encodings. Cache codec data in iconv._codecDataCache. +iconv._codecDataCache = {}; +iconv.getCodec = function getCodec(encoding) { + if (!iconv.encodings) + iconv.encodings = __webpack_require__(56860); // Lazy load all encoding definitions. + + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + var enc = iconv._canonicalizeEncoding(encoding); + + // Traverse iconv.encodings to find actual codec. + var codecOptions = {}; + while (true) { + var codec = iconv._codecDataCache[enc]; + if (codec) + return codec; + + var codecDef = iconv.encodings[enc]; + + switch (typeof codecDef) { + case "string": // Direct alias to other encoding. + enc = codecDef; + break; + + case "object": // Alias with options. Can be layered. + for (var key in codecDef) + codecOptions[key] = codecDef[key]; + + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + enc = codecDef.type; + break; + + case "function": // Codec itself. + if (!codecOptions.encodingName) + codecOptions.encodingName = enc; + + // The codec function must load all tables and return object with .encoder and .decoder methods. + // It'll be called only once (for each different options object). + codec = new codecDef(codecOptions, iconv); + + iconv._codecDataCache[codecOptions.encodingName] = codec; // Save it to be reused later. + return codec; + + default: + throw new Error("Encoding not recognized: '" + encoding + "' (searched as: '"+enc+"')"); + } + } +} + +iconv._canonicalizeEncoding = function(encoding) { + // Canonicalize encoding name: strip all non-alphanumeric chars and appended year. + return (''+encoding).toLowerCase().replace(/:\d{4}$|[^0-9a-z]/g, ""); +} + +iconv.getEncoder = function getEncoder(encoding, options) { + var codec = iconv.getCodec(encoding), + encoder = new codec.encoder(options, codec); + + if (codec.bomAware && options && options.addBOM) + encoder = new bomHandling.PrependBOM(encoder, options); + + return encoder; +} + +iconv.getDecoder = function getDecoder(encoding, options) { + var codec = iconv.getCodec(encoding), + decoder = new codec.decoder(options, codec); + + if (codec.bomAware && !(options && options.stripBOM === false)) + decoder = new bomHandling.StripBOM(decoder, options); + + return decoder; +} + + +// Load extensions in Node. All of them are omitted in Browserify build via 'browser' field in package.json. +var nodeVer = typeof process !== 'undefined' && process.versions && process.versions.node; +if (nodeVer) { + + // Load streaming support in Node v0.10+ + var nodeVerArr = nodeVer.split(".").map(Number); + if (nodeVerArr[0] > 0 || nodeVerArr[1] >= 10) { + __webpack_require__(76076)(iconv); + } + + // Load Node primitive extensions. + __webpack_require__(46950)(iconv); +} + +if (false) {} + + +/***/ }), + +/***/ 76076: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Buffer = (__webpack_require__(20181).Buffer), + Transform = (__webpack_require__(2203).Transform); + + +// == Exports ================================================================== +module.exports = function(iconv) { + + // Additional Public API. + iconv.encodeStream = function encodeStream(encoding, options) { + return new IconvLiteEncoderStream(iconv.getEncoder(encoding, options), options); + } + + iconv.decodeStream = function decodeStream(encoding, options) { + return new IconvLiteDecoderStream(iconv.getDecoder(encoding, options), options); + } + + iconv.supportsStreams = true; + + + // Not published yet. + iconv.IconvLiteEncoderStream = IconvLiteEncoderStream; + iconv.IconvLiteDecoderStream = IconvLiteDecoderStream; + iconv._collect = IconvLiteDecoderStream.prototype.collect; +}; + + +// == Encoder stream ======================================================= +function IconvLiteEncoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.decodeStrings = false; // We accept only strings, so we don't need to decode them. + Transform.call(this, options); +} + +IconvLiteEncoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteEncoderStream } +}); + +IconvLiteEncoderStream.prototype._transform = function(chunk, encoding, done) { + if (typeof chunk != 'string') + return done(new Error("Iconv encoding stream needs strings as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteEncoderStream.prototype.collect = function(cb) { + var chunks = []; + this.on('error', cb); + this.on('data', function(chunk) { chunks.push(chunk); }); + this.on('end', function() { + cb(null, Buffer.concat(chunks)); + }); + return this; +} + + +// == Decoder stream ======================================================= +function IconvLiteDecoderStream(conv, options) { + this.conv = conv; + options = options || {}; + options.encoding = this.encoding = 'utf8'; // We output strings. + Transform.call(this, options); +} + +IconvLiteDecoderStream.prototype = Object.create(Transform.prototype, { + constructor: { value: IconvLiteDecoderStream } +}); + +IconvLiteDecoderStream.prototype._transform = function(chunk, encoding, done) { + if (!Buffer.isBuffer(chunk)) + return done(new Error("Iconv decoding stream needs buffers as its input.")); + try { + var res = this.conv.write(chunk); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype._flush = function(done) { + try { + var res = this.conv.end(); + if (res && res.length) this.push(res, this.encoding); + done(); + } + catch (e) { + done(e); + } +} + +IconvLiteDecoderStream.prototype.collect = function(cb) { + var res = ''; + this.on('error', cb); + this.on('data', function(chunk) { res += chunk; }); + this.on('end', function() { + cb(null, res); + }); + return this; +} + + + +/***/ }), + +/***/ 87614: +/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { + +"use strict"; +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ assign: () => (/* binding */ assign), +/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__), +/* harmony export */ defaultI18n: () => (/* binding */ defaultI18n), +/* harmony export */ format: () => (/* binding */ format), +/* harmony export */ parse: () => (/* binding */ parse), +/* harmony export */ setGlobalDateI18n: () => (/* binding */ setGlobalDateI18n), +/* harmony export */ setGlobalDateMasks: () => (/* binding */ setGlobalDateMasks) +/* harmony export */ }); +var token = /d{1,4}|M{1,4}|YY(?:YY)?|S{1,3}|Do|ZZ|Z|([HhMsDm])\1?|[aA]|"[^"]*"|'[^']*'/g; +var twoDigitsOptional = "\\d\\d?"; +var twoDigits = "\\d\\d"; +var threeDigits = "\\d{3}"; +var fourDigits = "\\d{4}"; +var word = "[^\\s]+"; +var literal = /\[([^]*?)\]/gm; +function shorten(arr, sLen) { + var newArr = []; + for (var i = 0, len = arr.length; i < len; i++) { + newArr.push(arr[i].substr(0, sLen)); + } + return newArr; +} +var monthUpdate = function (arrName) { return function (v, i18n) { + var lowerCaseArr = i18n[arrName].map(function (v) { return v.toLowerCase(); }); + var index = lowerCaseArr.indexOf(v.toLowerCase()); + if (index > -1) { + return index; + } + return null; +}; }; +function assign(origObj) { + var args = []; + for (var _i = 1; _i < arguments.length; _i++) { + args[_i - 1] = arguments[_i]; + } + for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { + var obj = args_1[_a]; + for (var key in obj) { + // @ts-ignore ex + origObj[key] = obj[key]; + } + } + return origObj; +} +var dayNames = [ + "Sunday", + "Monday", + "Tuesday", + "Wednesday", + "Thursday", + "Friday", + "Saturday" +]; +var monthNames = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" +]; +var monthNamesShort = shorten(monthNames, 3); +var dayNamesShort = shorten(dayNames, 3); +var defaultI18n = { + dayNamesShort: dayNamesShort, + dayNames: dayNames, + monthNamesShort: monthNamesShort, + monthNames: monthNames, + amPm: ["am", "pm"], + DoFn: function (dayOfMonth) { + return (dayOfMonth + + ["th", "st", "nd", "rd"][dayOfMonth % 10 > 3 + ? 0 + : ((dayOfMonth - (dayOfMonth % 10) !== 10 ? 1 : 0) * dayOfMonth) % 10]); + } +}; +var globalI18n = assign({}, defaultI18n); +var setGlobalDateI18n = function (i18n) { + return (globalI18n = assign(globalI18n, i18n)); +}; +var regexEscape = function (str) { + return str.replace(/[|\\{()[^$+*?.-]/g, "\\$&"); +}; +var pad = function (val, len) { + if (len === void 0) { len = 2; } + val = String(val); + while (val.length < len) { + val = "0" + val; + } + return val; +}; +var formatFlags = { + D: function (dateObj) { return String(dateObj.getDate()); }, + DD: function (dateObj) { return pad(dateObj.getDate()); }, + Do: function (dateObj, i18n) { + return i18n.DoFn(dateObj.getDate()); + }, + d: function (dateObj) { return String(dateObj.getDay()); }, + dd: function (dateObj) { return pad(dateObj.getDay()); }, + ddd: function (dateObj, i18n) { + return i18n.dayNamesShort[dateObj.getDay()]; + }, + dddd: function (dateObj, i18n) { + return i18n.dayNames[dateObj.getDay()]; + }, + M: function (dateObj) { return String(dateObj.getMonth() + 1); }, + MM: function (dateObj) { return pad(dateObj.getMonth() + 1); }, + MMM: function (dateObj, i18n) { + return i18n.monthNamesShort[dateObj.getMonth()]; + }, + MMMM: function (dateObj, i18n) { + return i18n.monthNames[dateObj.getMonth()]; + }, + YY: function (dateObj) { + return pad(String(dateObj.getFullYear()), 4).substr(2); + }, + YYYY: function (dateObj) { return pad(dateObj.getFullYear(), 4); }, + h: function (dateObj) { return String(dateObj.getHours() % 12 || 12); }, + hh: function (dateObj) { return pad(dateObj.getHours() % 12 || 12); }, + H: function (dateObj) { return String(dateObj.getHours()); }, + HH: function (dateObj) { return pad(dateObj.getHours()); }, + m: function (dateObj) { return String(dateObj.getMinutes()); }, + mm: function (dateObj) { return pad(dateObj.getMinutes()); }, + s: function (dateObj) { return String(dateObj.getSeconds()); }, + ss: function (dateObj) { return pad(dateObj.getSeconds()); }, + S: function (dateObj) { + return String(Math.round(dateObj.getMilliseconds() / 100)); + }, + SS: function (dateObj) { + return pad(Math.round(dateObj.getMilliseconds() / 10), 2); + }, + SSS: function (dateObj) { return pad(dateObj.getMilliseconds(), 3); }, + a: function (dateObj, i18n) { + return dateObj.getHours() < 12 ? i18n.amPm[0] : i18n.amPm[1]; + }, + A: function (dateObj, i18n) { + return dateObj.getHours() < 12 + ? i18n.amPm[0].toUpperCase() + : i18n.amPm[1].toUpperCase(); + }, + ZZ: function (dateObj) { + var offset = dateObj.getTimezoneOffset(); + return ((offset > 0 ? "-" : "+") + + pad(Math.floor(Math.abs(offset) / 60) * 100 + (Math.abs(offset) % 60), 4)); + }, + Z: function (dateObj) { + var offset = dateObj.getTimezoneOffset(); + return ((offset > 0 ? "-" : "+") + + pad(Math.floor(Math.abs(offset) / 60), 2) + + ":" + + pad(Math.abs(offset) % 60, 2)); + } +}; +var monthParse = function (v) { return +v - 1; }; +var emptyDigits = [null, twoDigitsOptional]; +var emptyWord = [null, word]; +var amPm = [ + "isPm", + word, + function (v, i18n) { + var val = v.toLowerCase(); + if (val === i18n.amPm[0]) { + return 0; + } + else if (val === i18n.amPm[1]) { + return 1; + } + return null; + } +]; +var timezoneOffset = [ + "timezoneOffset", + "[^\\s]*?[\\+\\-]\\d\\d:?\\d\\d|[^\\s]*?Z?", + function (v) { + var parts = (v + "").match(/([+-]|\d\d)/gi); + if (parts) { + var minutes = +parts[1] * 60 + parseInt(parts[2], 10); + return parts[0] === "+" ? minutes : -minutes; + } + return 0; + } +]; +var parseFlags = { + D: ["day", twoDigitsOptional], + DD: ["day", twoDigits], + Do: ["day", twoDigitsOptional + word, function (v) { return parseInt(v, 10); }], + M: ["month", twoDigitsOptional, monthParse], + MM: ["month", twoDigits, monthParse], + YY: [ + "year", + twoDigits, + function (v) { + var now = new Date(); + var cent = +("" + now.getFullYear()).substr(0, 2); + return +("" + (+v > 68 ? cent - 1 : cent) + v); + } + ], + h: ["hour", twoDigitsOptional, undefined, "isPm"], + hh: ["hour", twoDigits, undefined, "isPm"], + H: ["hour", twoDigitsOptional], + HH: ["hour", twoDigits], + m: ["minute", twoDigitsOptional], + mm: ["minute", twoDigits], + s: ["second", twoDigitsOptional], + ss: ["second", twoDigits], + YYYY: ["year", fourDigits], + S: ["millisecond", "\\d", function (v) { return +v * 100; }], + SS: ["millisecond", twoDigits, function (v) { return +v * 10; }], + SSS: ["millisecond", threeDigits], + d: emptyDigits, + dd: emptyDigits, + ddd: emptyWord, + dddd: emptyWord, + MMM: ["month", word, monthUpdate("monthNamesShort")], + MMMM: ["month", word, monthUpdate("monthNames")], + a: amPm, + A: amPm, + ZZ: timezoneOffset, + Z: timezoneOffset +}; +// Some common format strings +var globalMasks = { + default: "ddd MMM DD YYYY HH:mm:ss", + shortDate: "M/D/YY", + mediumDate: "MMM D, YYYY", + longDate: "MMMM D, YYYY", + fullDate: "dddd, MMMM D, YYYY", + isoDate: "YYYY-MM-DD", + isoDateTime: "YYYY-MM-DDTHH:mm:ssZ", + shortTime: "HH:mm", + mediumTime: "HH:mm:ss", + longTime: "HH:mm:ss.SSS" +}; +var setGlobalDateMasks = function (masks) { return assign(globalMasks, masks); }; +/*** + * Format a date + * @method format + * @param {Date|number} dateObj + * @param {string} mask Format of the date, i.e. 'mm-dd-yy' or 'shortDate' + * @returns {string} Formatted date string + */ +var format = function (dateObj, mask, i18n) { + if (mask === void 0) { mask = globalMasks["default"]; } + if (i18n === void 0) { i18n = {}; } + if (typeof dateObj === "number") { + dateObj = new Date(dateObj); + } + if (Object.prototype.toString.call(dateObj) !== "[object Date]" || + isNaN(dateObj.getTime())) { + throw new Error("Invalid Date pass to format"); + } + mask = globalMasks[mask] || mask; + var literals = []; + // Make literals inactive by replacing them with @@@ + mask = mask.replace(literal, function ($0, $1) { + literals.push($1); + return "@@@"; + }); + var combinedI18nSettings = assign(assign({}, globalI18n), i18n); + // Apply formatting rules + mask = mask.replace(token, function ($0) { + return formatFlags[$0](dateObj, combinedI18nSettings); + }); + // Inline literal values back into the formatted value + return mask.replace(/@@@/g, function () { return literals.shift(); }); +}; +/** + * Parse a date string into a Javascript Date object / + * @method parse + * @param {string} dateStr Date string + * @param {string} format Date parse format + * @param {i18n} I18nSettingsOptional Full or subset of I18N settings + * @returns {Date|null} Returns Date object. Returns null what date string is invalid or doesn't match format + */ +function parse(dateStr, format, i18n) { + if (i18n === void 0) { i18n = {}; } + if (typeof format !== "string") { + throw new Error("Invalid format in fecha parse"); + } + // Check to see if the format is actually a mask + format = globalMasks[format] || format; + // Avoid regular expression denial of service, fail early for really long strings + // https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS + if (dateStr.length > 1000) { + return null; + } + // Default to the beginning of the year. + var today = new Date(); + var dateInfo = { + year: today.getFullYear(), + month: 0, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0, + isPm: null, + timezoneOffset: null + }; + var parseInfo = []; + var literals = []; + // Replace all the literals with @@@. Hopefully a string that won't exist in the format + var newFormat = format.replace(literal, function ($0, $1) { + literals.push(regexEscape($1)); + return "@@@"; + }); + var specifiedFields = {}; + var requiredFields = {}; + // Change every token that we find into the correct regex + newFormat = regexEscape(newFormat).replace(token, function ($0) { + var info = parseFlags[$0]; + var field = info[0], regex = info[1], requiredField = info[3]; + // Check if the person has specified the same field twice. This will lead to confusing results. + if (specifiedFields[field]) { + throw new Error("Invalid format. " + field + " specified twice in format"); + } + specifiedFields[field] = true; + // Check if there are any required fields. For instance, 12 hour time requires AM/PM specified + if (requiredField) { + requiredFields[requiredField] = true; + } + parseInfo.push(info); + return "(" + regex + ")"; + }); + // Check all the required fields are present + Object.keys(requiredFields).forEach(function (field) { + if (!specifiedFields[field]) { + throw new Error("Invalid format. " + field + " is required in specified format"); + } + }); + // Add back all the literals after + newFormat = newFormat.replace(/@@@/g, function () { return literals.shift(); }); + // Check if the date string matches the format. If it doesn't return null + var matches = dateStr.match(new RegExp(newFormat, "i")); + if (!matches) { + return null; + } + var combinedI18nSettings = assign(assign({}, globalI18n), i18n); + // For each match, call the parser function for that date part + for (var i = 1; i < matches.length; i++) { + var _a = parseInfo[i - 1], field = _a[0], parser = _a[2]; + var value = parser + ? parser(matches[i], combinedI18nSettings) + : +matches[i]; + // If the parser can't make sense of the value, return null + if (value == null) { + return null; + } + dateInfo[field] = value; + } + if (dateInfo.isPm === 1 && dateInfo.hour != null && +dateInfo.hour !== 12) { + dateInfo.hour = +dateInfo.hour + 12; + } + else if (dateInfo.isPm === 0 && +dateInfo.hour === 12) { + dateInfo.hour = 0; + } + var dateTZ; + if (dateInfo.timezoneOffset == null) { + dateTZ = new Date(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute, dateInfo.second, dateInfo.millisecond); + var validateFields = [ + ["month", "getMonth"], + ["day", "getDate"], + ["hour", "getHours"], + ["minute", "getMinutes"], + ["second", "getSeconds"] + ]; + for (var i = 0, len = validateFields.length; i < len; i++) { + // Check to make sure the date field is within the allowed range. Javascript dates allows values + // outside the allowed range. If the values don't match the value was invalid + if (specifiedFields[validateFields[i][0]] && + dateInfo[validateFields[i][0]] !== dateTZ[validateFields[i][1]]()) { + return null; + } + } + } + else { + dateTZ = new Date(Date.UTC(dateInfo.year, dateInfo.month, dateInfo.day, dateInfo.hour, dateInfo.minute - dateInfo.timezoneOffset, dateInfo.second, dateInfo.millisecond)); + // We can't validate dates in another timezone unfortunately. Do a basic check instead + if (dateInfo.month > 11 || + dateInfo.month < 0 || + dateInfo.day > 31 || + dateInfo.day < 1 || + dateInfo.hour > 23 || + dateInfo.hour < 0 || + dateInfo.minute > 59 || + dateInfo.minute < 0 || + dateInfo.second > 59 || + dateInfo.second < 0) { + return null; + } + } + // Don't allow invalid dates + return dateTZ; +} +var fecha = { + format: format, + parse: parse, + defaultI18n: defaultI18n, + setGlobalDateI18n: setGlobalDateI18n, + setGlobalDateMasks: setGlobalDateMasks +}; + +/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (fecha); + +//# sourceMappingURL=fecha.js.map + + +/***/ }), + +/***/ 25241: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +/** + * Module dependencies. + */ + +var sep = (__webpack_require__(16928).sep) || '/'; + +/** + * Module exports. + */ + +module.exports = fileUriToPath; + +/** + * File URI to Path function. + * + * @param {String} uri + * @return {String} path + * @api public + */ + +function fileUriToPath (uri) { + if ('string' != typeof uri || + uri.length <= 7 || + 'file://' != uri.substring(0, 7)) { + throw new TypeError('must pass in a file:// URI to convert to a file path'); + } + + var rest = decodeURI(uri.substring(7)); + var firstSlash = rest.indexOf('/'); + var host = rest.substring(0, firstSlash); + var path = rest.substring(firstSlash + 1); + + // 2. Scheme Definition + // As a special case, can be the string "localhost" or the empty + // string; this is interpreted as "the machine from which the URL is + // being interpreted". + if ('localhost' == host) host = ''; + + if (host) { + host = sep + sep + host; + } + + // 3.2 Drives, drive letters, mount points, file system root + // Drive letters are mapped into the top of a file URI in various ways, + // depending on the implementation; some applications substitute + // vertical bar ("|") for the colon after the drive letter, yielding + // "file:///c|/tmp/test.txt". In some cases, the colon is left + // unchanged, as in "file:///c:/tmp/test.txt". In other cases, the + // colon is simply omitted, as in "file:///c/tmp/test.txt". + path = path.replace(/^(.+)\|/, '$1:'); + + // for Windows, we need to invert the path separators from what a URI uses + if (sep == '\\') { + path = path.replace(/\//g, '\\'); + } + + if (/^.+\:/.test(path)) { + // has Windows drive at beginning of path + } else { + // unix path… + path = sep + path; + } + + return host + path; +} + + +/***/ }), + +/***/ 67027: +/***/ ((module) => { + +"use strict"; + + +var toString = Object.prototype.toString; + +/** + * Extract names from functions. + * + * @param {Function} fn The function who's name we need to extract. + * @returns {String} The name of the function. + * @public + */ +module.exports = function name(fn) { + if ('string' === typeof fn.displayName && fn.constructor.name) { + return fn.displayName; + } else if ('string' === typeof fn.name && fn.name) { + return fn.name; + } + + // + // Check to see if the constructor has a name. + // + if ( + 'object' === typeof fn + && fn.constructor + && 'string' === typeof fn.constructor.name + ) return fn.constructor.name; + + // + // toString the given function and attempt to parse it out of it, or determine + // the class. + // + var named = fn.toString() + , type = toString.call(fn).slice(8, -1); + + if ('Function' === type) { + named = named.substring(named.indexOf('(') + 1, named.indexOf(')')); + } else { + named = type; + } + + return named || 'anonymous'; +}; + + +/***/ }), + +/***/ 63423: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var balanced = __webpack_require__(16722); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + } + + return expansions; +} + + + +/***/ }), + +/***/ 53972: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +try { + var util = __webpack_require__(39023); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __webpack_require__(91807); +} + + +/***/ }), + +/***/ 91807: +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 49245: +/***/ ((module) => { + +"use strict"; +/* eslint-disable yoda */ + + +const isFullwidthCodePoint = codePoint => { + if (Number.isNaN(codePoint)) { + return false; + } + + // Code points are derived from: + // http://www.unix.org/Public/UNIDATA/EastAsianWidth.txt + if ( + codePoint >= 0x1100 && ( + codePoint <= 0x115F || // Hangul Jamo + codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET + codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET + // CJK Radicals Supplement .. Enclosed CJK Letters and Months + (0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) || + // Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A + (0x3250 <= codePoint && codePoint <= 0x4DBF) || + // CJK Unified Ideographs .. Yi Radicals + (0x4E00 <= codePoint && codePoint <= 0xA4C6) || + // Hangul Jamo Extended-A + (0xA960 <= codePoint && codePoint <= 0xA97C) || + // Hangul Syllables + (0xAC00 <= codePoint && codePoint <= 0xD7A3) || + // CJK Compatibility Ideographs + (0xF900 <= codePoint && codePoint <= 0xFAFF) || + // Vertical Forms + (0xFE10 <= codePoint && codePoint <= 0xFE19) || + // CJK Compatibility Forms .. Small Form Variants + (0xFE30 <= codePoint && codePoint <= 0xFE6B) || + // Halfwidth and Fullwidth Forms + (0xFF01 <= codePoint && codePoint <= 0xFF60) || + (0xFFE0 <= codePoint && codePoint <= 0xFFE6) || + // Kana Supplement + (0x1B000 <= codePoint && codePoint <= 0x1B001) || + // Enclosed Ideographic Supplement + (0x1F200 <= codePoint && codePoint <= 0x1F251) || + // CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane + (0x20000 <= codePoint && codePoint <= 0x3FFFD) + ) + ) { + return true; + } + + return false; +}; + +module.exports = isFullwidthCodePoint; +module.exports["default"] = isFullwidthCodePoint; + + +/***/ }), + +/***/ 79421: +/***/ ((module) => { + +"use strict"; + + +const isStream = stream => + stream !== null && + typeof stream === 'object' && + typeof stream.pipe === 'function'; + +isStream.writable = stream => + isStream(stream) && + stream.writable !== false && + typeof stream._write === 'function' && + typeof stream._writableState === 'object'; + +isStream.readable = stream => + isStream(stream) && + stream.readable !== false && + typeof stream._read === 'function' && + typeof stream._readableState === 'object'; + +isStream.duplex = stream => + isStream.writable(stream) && + isStream.readable(stream); + +isStream.transform = stream => + isStream.duplex(stream) && + typeof stream._transform === 'function'; + +module.exports = isStream; + + +/***/ }), + +/***/ 61747: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); + +/* + * function align (info) + * Returns a new instance of the align Format which adds a `\t` + * delimiter before the message to properly align it in the same place. + * It was previously { align: true } in winston < 3.0.0 + */ +module.exports = format(info => { + info.message = `\t${info.message}`; + return info; +}); + + +/***/ }), + +/***/ 62736: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { Colorizer } = __webpack_require__(38559); +const { Padder } = __webpack_require__(75107); +const { configs, MESSAGE } = __webpack_require__(80310); + + +/** + * Cli format class that handles initial state for a a separate + * Colorizer and Padder instance. + */ +class CliFormat { + constructor(opts = {}) { + if (!opts.levels) { + opts.levels = configs.cli.levels; + } + + this.colorizer = new Colorizer(opts); + this.padder = new Padder(opts); + this.options = opts; + } + + /* + * function transform (info, opts) + * Attempts to both: + * 1. Pad the { level } + * 2. Colorize the { level, message } + * of the given `logform` info object depending on the `opts`. + */ + transform(info, opts) { + this.colorizer.transform( + this.padder.transform(info, opts), + opts + ); + + info[MESSAGE] = `${info.level}:${info.message}`; + return info; + } +} + +/* + * function cli (opts) + * Returns a new instance of the CLI format that turns a log + * `info` object into the same format previously available + * in `winston.cli()` in `winston < 3.0.0`. + */ +module.exports = opts => new CliFormat(opts); + +// +// Attach the CliFormat for registration purposes +// +module.exports.Format = CliFormat; + + +/***/ }), + +/***/ 38559: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const colors = __webpack_require__(96230); +const { LEVEL, MESSAGE } = __webpack_require__(80310); + +// +// Fix colors not appearing in non-tty environments +// +colors.enabled = true; + +/** + * @property {RegExp} hasSpace + * Simple regex to check for presence of spaces. + */ +const hasSpace = /\s+/; + +/* + * Colorizer format. Wraps the `level` and/or `message` properties + * of the `info` objects with ANSI color codes based on a few options. + */ +class Colorizer { + constructor(opts = {}) { + if (opts.colors) { + this.addColors(opts.colors); + } + + this.options = opts; + } + + /* + * Adds the colors Object to the set of allColors + * known by the Colorizer + * + * @param {Object} colors Set of color mappings to add. + */ + static addColors(clrs) { + const nextColors = Object.keys(clrs).reduce((acc, level) => { + acc[level] = hasSpace.test(clrs[level]) + ? clrs[level].split(hasSpace) + : clrs[level]; + + return acc; + }, {}); + + Colorizer.allColors = Object.assign({}, Colorizer.allColors || {}, nextColors); + return Colorizer.allColors; + } + + /* + * Adds the colors Object to the set of allColors + * known by the Colorizer + * + * @param {Object} colors Set of color mappings to add. + */ + addColors(clrs) { + return Colorizer.addColors(clrs); + } + + /* + * function colorize (lookup, level, message) + * Performs multi-step colorization using @colors/colors/safe + */ + colorize(lookup, level, message) { + if (typeof message === 'undefined') { + message = level; + } + + // + // If the color for the level is just a string + // then attempt to colorize the message with it. + // + if (!Array.isArray(Colorizer.allColors[lookup])) { + return colors[Colorizer.allColors[lookup]](message); + } + + // + // If it is an Array then iterate over that Array, applying + // the colors function for each item. + // + for (let i = 0, len = Colorizer.allColors[lookup].length; i < len; i++) { + message = colors[Colorizer.allColors[lookup][i]](message); + } + + return message; + } + + /* + * function transform (info, opts) + * Attempts to colorize the { level, message } of the given + * `logform` info object. + */ + transform(info, opts) { + if (opts.all && typeof info[MESSAGE] === 'string') { + info[MESSAGE] = this.colorize(info[LEVEL], info.level, info[MESSAGE]); + } + + if (opts.level || opts.all || !opts.message) { + info.level = this.colorize(info[LEVEL], info.level); + } + + if (opts.all || opts.message) { + info.message = this.colorize(info[LEVEL], info.level, info.message); + } + + return info; + } +} + +/* + * function colorize (info) + * Returns a new instance of the colorize Format that applies + * level colors to `info` objects. This was previously exposed + * as { colorize: true } to transports in `winston < 3.0.0`. + */ +module.exports = opts => new Colorizer(opts); + +// +// Attach the Colorizer for registration purposes +// +module.exports.Colorizer + = module.exports.Format + = Colorizer; + + +/***/ }), + +/***/ 76695: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); + +/* + * function cascade(formats) + * Returns a function that invokes the `._format` function in-order + * for the specified set of `formats`. In this manner we say that Formats + * are "pipe-like", but not a pure pumpify implementation. Since there is no back + * pressure we can remove all of the "readable" plumbing in Node streams. + */ +function cascade(formats) { + if (!formats.every(isValidFormat)) { + return; + } + + return info => { + let obj = info; + for (let i = 0; i < formats.length; i++) { + obj = formats[i].transform(obj, formats[i].options); + if (!obj) { + return false; + } + } + + return obj; + }; +} + +/* + * function isValidFormat(format) + * If the format does not define a `transform` function throw an error + * with more detailed usage. + */ +function isValidFormat(fmt) { + if (typeof fmt.transform !== 'function') { + throw new Error([ + 'No transform function found on format. Did you create a format instance?', + 'const myFormat = format(formatFn);', + 'const instance = myFormat();' + ].join('\n')); + } + + return true; +} + +/* + * function combine (info) + * Returns a new instance of the combine Format which combines the specified + * formats into a new format. This is similar to a pipe-chain in transform streams. + * We choose to combine the prototypes this way because there is no back pressure in + * an in-memory transform chain. + */ +module.exports = (...formats) => { + const combinedFormat = format(cascade(formats)); + const instance = combinedFormat(); + instance.Format = combinedFormat.Format; + return instance; +}; + +// +// Export the cascade method for use in cli and other +// combined formats that should not be assumed to be +// singletons. +// +module.exports.cascade = cascade; + + +/***/ }), + +/***/ 28915: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint no-undefined: 0 */ + + +const format = __webpack_require__(86287); +const { LEVEL, MESSAGE } = __webpack_require__(80310); + +/* + * function errors (info) + * If the `message` property of the `info` object is an instance of `Error`, + * replace the `Error` object its own `message` property. + * + * Optionally, the Error's `stack` and/or `cause` properties can also be appended to the `info` object. + */ +module.exports = format((einfo, { stack, cause }) => { + if (einfo instanceof Error) { + const info = Object.assign({}, einfo, { + level: einfo.level, + [LEVEL]: einfo[LEVEL] || einfo.level, + message: einfo.message, + [MESSAGE]: einfo[MESSAGE] || einfo.message + }); + + if (stack) info.stack = einfo.stack; + if (cause) info.cause = einfo.cause; + return info; + } + + if (!(einfo.message instanceof Error)) return einfo; + + // Assign all enumerable properties and the + // message property from the error provided. + const err = einfo.message; + Object.assign(einfo, err); + einfo.message = err.message; + einfo[MESSAGE] = err.message; + + // Assign the stack and/or cause if requested. + if (stack) einfo.stack = err.stack; + if (cause) einfo.cause = err.cause; + return einfo; +}); + + +/***/ }), + +/***/ 86287: +/***/ ((module) => { + +"use strict"; + + +/* + * Displays a helpful message and the source of + * the format when it is invalid. + */ +class InvalidFormatError extends Error { + constructor(formatFn) { + super(`Format functions must be synchronous taking a two arguments: (info, opts) +Found: ${formatFn.toString().split('\n')[0]}\n`); + + Error.captureStackTrace(this, InvalidFormatError); + } +} + +/* + * function format (formatFn) + * Returns a create function for the `formatFn`. + */ +module.exports = formatFn => { + if (formatFn.length > 2) { + throw new InvalidFormatError(formatFn); + } + + /* + * function Format (options) + * Base prototype which calls a `_format` + * function and pushes the result. + */ + function Format(options = {}) { + this.options = options; + } + + Format.prototype.transform = formatFn; + + // + // Create a function which returns new instances of + // FormatWrap for simple syntax like: + // + // require('winston').formats.json(); + // + function createFormatWrap(opts) { + return new Format(opts); + } + + // + // Expose the FormatWrap through the create function + // for testability. + // + createFormatWrap.Format = Format; + return createFormatWrap; +}; + + +/***/ }), + +/***/ 72110: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +/* + * @api public + * @property {function} format + * Both the construction method and set of exposed + * formats. + */ +const format = exports.format = __webpack_require__(86287); + +/* + * @api public + * @method {function} levels + * Registers the specified levels with logform. + */ +exports.levels = __webpack_require__(32203); + +/* + * @api private + * method {function} exposeFormat + * Exposes a sub-format on the main format object + * as a lazy-loaded getter. + */ +function exposeFormat(name, requireFormat) { + Object.defineProperty(format, name, { + get() { + return requireFormat(); + }, + configurable: true + }); +} + +// +// Setup all transports as lazy-loaded getters. +// +exposeFormat('align', function () { return __webpack_require__(61747); }); +exposeFormat('errors', function () { return __webpack_require__(28915); }); +exposeFormat('cli', function () { return __webpack_require__(62736); }); +exposeFormat('combine', function () { return __webpack_require__(76695); }); +exposeFormat('colorize', function () { return __webpack_require__(38559); }); +exposeFormat('json', function () { return __webpack_require__(62214); }); +exposeFormat('label', function () { return __webpack_require__(84188); }); +exposeFormat('logstash', function () { return __webpack_require__(12783); }); +exposeFormat('metadata', function () { return __webpack_require__(93989); }); +exposeFormat('ms', function () { return __webpack_require__(42572); }); +exposeFormat('padLevels', function () { return __webpack_require__(75107); }); +exposeFormat('prettyPrint', function () { return __webpack_require__(63310); }); +exposeFormat('printf', function () { return __webpack_require__(12207); }); +exposeFormat('simple', function () { return __webpack_require__(18982); }); +exposeFormat('splat', function () { return __webpack_require__(6822); }); +exposeFormat('timestamp', function () { return __webpack_require__(54070); }); +exposeFormat('uncolorize', function () { return __webpack_require__(40852); }); + + +/***/ }), + +/***/ 62214: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); +const { MESSAGE } = __webpack_require__(80310); +const stringify = __webpack_require__(27433); + +/* + * function replacer (key, value) + * Handles proper stringification of Buffer and bigint output. + */ +function replacer(key, value) { + // safe-stable-stringify does support BigInt, however, it doesn't wrap the value in quotes. + // Leading to a loss in fidelity if the resulting string is parsed. + // It would also be a breaking change for logform. + if (typeof value === 'bigint') + return value.toString(); + return value; +} + +/* + * function json (info) + * Returns a new instance of the JSON format that turns a log `info` + * object into pure JSON. This was previously exposed as { json: true } + * to transports in `winston < 3.0.0`. + */ +module.exports = format((info, opts) => { + const jsonStringify = stringify.configure(opts); + info[MESSAGE] = jsonStringify(info, opts.replacer || replacer, opts.space); + return info; +}); + + +/***/ }), + +/***/ 84188: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); + +/* + * function label (info) + * Returns a new instance of the label Format which adds the specified + * `opts.label` before the message. This was previously exposed as + * { label: 'my label' } to transports in `winston < 3.0.0`. + */ +module.exports = format((info, opts) => { + if (opts.message) { + info.message = `[${opts.label}] ${info.message}`; + return info; + } + + info.label = opts.label; + return info; +}); + + +/***/ }), + +/***/ 32203: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { Colorizer } = __webpack_require__(38559); + +/* + * Simple method to register colors with a simpler require + * path within the module. + */ +module.exports = config => { + Colorizer.addColors(config.colors || config); + return config; +}; + + +/***/ }), + +/***/ 12783: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); +const { MESSAGE } = __webpack_require__(80310); +const jsonStringify = __webpack_require__(27433); + +/* + * function logstash (info) + * Returns a new instance of the LogStash Format that turns a + * log `info` object into pure JSON with the appropriate logstash + * options. This was previously exposed as { logstash: true } + * to transports in `winston < 3.0.0`. + */ +module.exports = format(info => { + const logstash = {}; + if (info.message) { + logstash['@message'] = info.message; + delete info.message; + } + + if (info.timestamp) { + logstash['@timestamp'] = info.timestamp; + delete info.timestamp; + } + + logstash['@fields'] = info; + info[MESSAGE] = jsonStringify(logstash); + return info; +}); + + +/***/ }), + +/***/ 93989: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const format = __webpack_require__(86287); + +function fillExcept(info, fillExceptKeys, metadataKey) { + const savedKeys = fillExceptKeys.reduce((acc, key) => { + acc[key] = info[key]; + delete info[key]; + return acc; + }, {}); + const metadata = Object.keys(info).reduce((acc, key) => { + acc[key] = info[key]; + delete info[key]; + return acc; + }, {}); + + Object.assign(info, savedKeys, { + [metadataKey]: metadata + }); + return info; +} + +function fillWith(info, fillWithKeys, metadataKey) { + info[metadataKey] = fillWithKeys.reduce((acc, key) => { + acc[key] = info[key]; + delete info[key]; + return acc; + }, {}); + return info; +} + +/** + * Adds in a "metadata" object to collect extraneous data, similar to the metadata + * object in winston 2.x. + */ +module.exports = format((info, opts = {}) => { + let metadataKey = 'metadata'; + if (opts.key) { + metadataKey = opts.key; + } + + let fillExceptKeys = []; + if (!opts.fillExcept && !opts.fillWith) { + fillExceptKeys.push('level'); + fillExceptKeys.push('message'); + } + + if (opts.fillExcept) { + fillExceptKeys = opts.fillExcept; + } + + if (fillExceptKeys.length > 0) { + return fillExcept(info, fillExceptKeys, metadataKey); + } + + if (opts.fillWith) { + return fillWith(info, opts.fillWith, metadataKey); + } + + return info; +}); + + +/***/ }), + +/***/ 42572: +/***/ (function(module, __unused_webpack_exports, __webpack_require__) { + +"use strict"; + + +const format = __webpack_require__(86287); +const ms = __webpack_require__(72146); + +/* + * function ms (info) + * Returns an `info` with a `ms` property. The `ms` property holds the Value + * of the time difference between two calls in milliseconds. + */ +module.exports = format(info => { + const curr = +new Date(); + this.diff = curr - (this.prevTime || curr); + this.prevTime = curr; + info.ms = `+${ms(this.diff)}`; + + return info; +}); + + +/***/ }), + +/***/ 75107: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint no-unused-vars: 0 */ + + +const { configs, LEVEL, MESSAGE } = __webpack_require__(80310); + +class Padder { + constructor(opts = { levels: configs.npm.levels }) { + this.paddings = Padder.paddingForLevels(opts.levels, opts.filler); + this.options = opts; + } + + /** + * Returns the maximum length of keys in the specified `levels` Object. + * @param {Object} levels Set of all levels to calculate longest level against. + * @returns {Number} Maximum length of the longest level string. + */ + static getLongestLevel(levels) { + const lvls = Object.keys(levels).map(level => level.length); + return Math.max(...lvls); + } + + /** + * Returns the padding for the specified `level` assuming that the + * maximum length of all levels it's associated with is `maxLength`. + * @param {String} level Level to calculate padding for. + * @param {String} filler Repeatable text to use for padding. + * @param {Number} maxLength Length of the longest level + * @returns {String} Padding string for the `level` + */ + static paddingForLevel(level, filler, maxLength) { + const targetLen = maxLength + 1 - level.length; + const rep = Math.floor(targetLen / filler.length); + const padding = `${filler}${filler.repeat(rep)}`; + return padding.slice(0, targetLen); + } + + /** + * Returns an object with the string paddings for the given `levels` + * using the specified `filler`. + * @param {Object} levels Set of all levels to calculate padding for. + * @param {String} filler Repeatable text to use for padding. + * @returns {Object} Mapping of level to desired padding. + */ + static paddingForLevels(levels, filler = ' ') { + const maxLength = Padder.getLongestLevel(levels); + return Object.keys(levels).reduce((acc, level) => { + acc[level] = Padder.paddingForLevel(level, filler, maxLength); + return acc; + }, {}); + } + + /** + * Prepends the padding onto the `message` based on the `LEVEL` of + * the `info`. This is based on the behavior of `winston@2` which also + * prepended the level onto the message. + * + * See: https://github.com/winstonjs/winston/blob/2.x/lib/winston/logger.js#L198-L201 + * + * @param {Info} info Logform info object + * @param {Object} opts Options passed along to this instance. + * @returns {Info} Modified logform info object. + */ + transform(info, opts) { + info.message = `${this.paddings[info[LEVEL]]}${info.message}`; + if (info[MESSAGE]) { + info[MESSAGE] = `${this.paddings[info[LEVEL]]}${info[MESSAGE]}`; + } + + return info; + } +} + +/* + * function padLevels (info) + * Returns a new instance of the padLevels Format which pads + * levels to be the same length. This was previously exposed as + * { padLevels: true } to transports in `winston < 3.0.0`. + */ +module.exports = opts => new Padder(opts); + +module.exports.Padder + = module.exports.Format + = Padder; + + +/***/ }), + +/***/ 63310: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const inspect = (__webpack_require__(39023).inspect); +const format = __webpack_require__(86287); +const { LEVEL, MESSAGE, SPLAT } = __webpack_require__(80310); + +/* + * function prettyPrint (info) + * Returns a new instance of the prettyPrint Format that "prettyPrint" + * serializes `info` objects. This was previously exposed as + * { prettyPrint: true } to transports in `winston < 3.0.0`. + */ +module.exports = format((info, opts = {}) => { + // + // info[{LEVEL, MESSAGE, SPLAT}] are enumerable here. Since they + // are internal, we remove them before util.inspect so they + // are not printed. + // + const stripped = Object.assign({}, info); + + // Remark (indexzero): update this technique in April 2019 + // when node@6 is EOL + delete stripped[LEVEL]; + delete stripped[MESSAGE]; + delete stripped[SPLAT]; + + info[MESSAGE] = inspect(stripped, false, opts.depth || null, opts.colorize); + return info; +}); + + +/***/ }), + +/***/ 12207: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { MESSAGE } = __webpack_require__(80310); + +class Printf { + constructor(templateFn) { + this.template = templateFn; + } + + transform(info) { + info[MESSAGE] = this.template(info); + return info; + } +} + +/* + * function printf (templateFn) + * Returns a new instance of the printf Format that creates an + * intermediate prototype to store the template string-based formatter + * function. + */ +module.exports = opts => new Printf(opts); + +module.exports.Printf + = module.exports.Format + = Printf; + + +/***/ }), + +/***/ 18982: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint no-undefined: 0 */ + + +const format = __webpack_require__(86287); +const { MESSAGE } = __webpack_require__(80310); +const jsonStringify = __webpack_require__(27433); + +/* + * function simple (info) + * Returns a new instance of the simple format TransformStream + * which writes a simple representation of logs. + * + * const { level, message, splat, ...rest } = info; + * + * ${level}: ${message} if rest is empty + * ${level}: ${message} ${JSON.stringify(rest)} otherwise + */ +module.exports = format(info => { + const stringifiedRest = jsonStringify(Object.assign({}, info, { + level: undefined, + message: undefined, + splat: undefined + })); + + const padding = info.padding && info.padding[info.level] || ''; + if (stringifiedRest !== '{}') { + info[MESSAGE] = `${info.level}:${padding} ${info.message} ${stringifiedRest}`; + } else { + info[MESSAGE] = `${info.level}:${padding} ${info.message}`; + } + + return info; +}); + + +/***/ }), + +/***/ 6822: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const util = __webpack_require__(39023); +const { SPLAT } = __webpack_require__(80310); + +/** + * Captures the number of format (i.e. %s strings) in a given string. + * Based on `util.format`, see Node.js source: + * https://github.com/nodejs/node/blob/b1c8f15c5f169e021f7c46eb7b219de95fe97603/lib/util.js#L201-L230 + * @type {RegExp} + */ +const formatRegExp = /%[scdjifoO%]/g; + +/** + * Captures the number of escaped % signs in a format string (i.e. %s strings). + * @type {RegExp} + */ +const escapedPercent = /%%/g; + +class Splatter { + constructor(opts) { + this.options = opts; + } + + /** + * Check to see if tokens <= splat.length, assign { splat, meta } into the + * `info` accordingly, and write to this instance. + * + * @param {Info} info Logform info message. + * @param {String[]} tokens Set of string interpolation tokens. + * @returns {Info} Modified info message + * @private + */ + _splat(info, tokens) { + const msg = info.message; + const splat = info[SPLAT] || info.splat || []; + const percents = msg.match(escapedPercent); + const escapes = percents && percents.length || 0; + + // The expected splat is the number of tokens minus the number of escapes + // e.g. + // - { expectedSplat: 3 } '%d %s %j' + // - { expectedSplat: 5 } '[%s] %d%% %d%% %s %j' + // + // Any "meta" will be arugments in addition to the expected splat size + // regardless of type. e.g. + // + // logger.log('info', '%d%% %s %j', 100, 'wow', { such: 'js' }, { thisIsMeta: true }); + // would result in splat of four (4), but only three (3) are expected. Therefore: + // + // extraSplat = 3 - 4 = -1 + // metas = [100, 'wow', { such: 'js' }, { thisIsMeta: true }].splice(-1, -1 * -1); + // splat = [100, 'wow', { such: 'js' }] + const expectedSplat = tokens.length - escapes; + const extraSplat = expectedSplat - splat.length; + const metas = extraSplat < 0 + ? splat.splice(extraSplat, -1 * extraSplat) + : []; + + // Now that { splat } has been separated from any potential { meta }. we + // can assign this to the `info` object and write it to our format stream. + // If the additional metas are **NOT** objects or **LACK** enumerable properties + // you are going to have a bad time. + const metalen = metas.length; + if (metalen) { + for (let i = 0; i < metalen; i++) { + Object.assign(info, metas[i]); + } + } + + info.message = util.format(msg, ...splat); + return info; + } + + /** + * Transforms the `info` message by using `util.format` to complete + * any `info.message` provided it has string interpolation tokens. + * If no tokens exist then `info` is immutable. + * + * @param {Info} info Logform info message. + * @param {Object} opts Options for this instance. + * @returns {Info} Modified info message + */ + transform(info) { + const msg = info.message; + const splat = info[SPLAT] || info.splat; + + // No need to process anything if splat is undefined + if (!splat || !splat.length) { + return info; + } + + // Extract tokens, if none available default to empty array to + // ensure consistancy in expected results + const tokens = msg && msg.match && msg.match(formatRegExp); + + // This condition will take care of inputs with info[SPLAT] + // but no tokens present + if (!tokens && (splat || splat.length)) { + const metas = splat.length > 1 + ? splat.splice(0) + : splat; + + // Now that { splat } has been separated from any potential { meta }. we + // can assign this to the `info` object and write it to our format stream. + // If the additional metas are **NOT** objects or **LACK** enumerable properties + // you are going to have a bad time. + const metalen = metas.length; + if (metalen) { + for (let i = 0; i < metalen; i++) { + Object.assign(info, metas[i]); + } + } + + return info; + } + + if (tokens) { + return this._splat(info, tokens); + } + + return info; + } +} + +/* + * function splat (info) + * Returns a new instance of the splat format TransformStream + * which performs string interpolation from `info` objects. This was + * previously exposed implicitly in `winston < 3.0.0`. + */ +module.exports = opts => new Splatter(opts); + + +/***/ }), + +/***/ 54070: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const fecha = __webpack_require__(87614); +const format = __webpack_require__(86287); + +/* + * function timestamp (info) + * Returns a new instance of the timestamp Format which adds a timestamp + * to the info. It was previously available in winston < 3.0.0 as: + * + * - { timestamp: true } // `new Date.toISOString()` + * - { timestamp: function:String } // Value returned by `timestamp()` + */ +module.exports = format((info, opts = {}) => { + if (opts.format) { + info.timestamp = typeof opts.format === 'function' + ? opts.format() + : fecha.format(new Date(), opts.format); + } + + if (!info.timestamp) { + info.timestamp = new Date().toISOString(); + } + + if (opts.alias) { + info[opts.alias] = info.timestamp; + } + + return info; +}); + + +/***/ }), + +/***/ 40852: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const colors = __webpack_require__(96230); +const format = __webpack_require__(86287); +const { MESSAGE } = __webpack_require__(80310); + +/* + * function uncolorize (info) + * Returns a new instance of the uncolorize Format that strips colors + * from `info` objects. This was previously exposed as { stripColors: true } + * to transports in `winston < 3.0.0`. + */ +module.exports = format((info, opts) => { + if (opts.level !== false) { + info.level = colors.strip(info.level); + } + + if (opts.message !== false) { + info.message = colors.strip(String(info.message)); + } + + if (opts.raw !== false && info[MESSAGE]) { + info[MESSAGE] = colors.strip(String(info[MESSAGE])); + } + + return info; +}); + + +/***/ }), + +/***/ 78755: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/*! + * mime-db + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015-2022 Douglas Christopher Wilson + * MIT Licensed + */ + +/** + * Module exports. + */ + +module.exports = __webpack_require__(32750) + + +/***/ }), + +/***/ 5258: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/*! + * mime-types + * Copyright(c) 2014 Jonathan Ong + * Copyright(c) 2015 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module dependencies. + * @private + */ + +var db = __webpack_require__(78755) +var extname = (__webpack_require__(16928).extname) + +/** + * Module variables. + * @private + */ + +var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/ +var TEXT_TYPE_REGEXP = /^text\//i + +/** + * Module exports. + * @public + */ + +exports.charset = charset +exports.charsets = { lookup: charset } +exports.contentType = contentType +exports.extension = extension +exports.extensions = Object.create(null) +exports.lookup = lookup +exports.types = Object.create(null) + +// Populate the extensions/types maps +populateMaps(exports.extensions, exports.types) + +/** + * Get the default charset for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function charset (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + var mime = match && db[match[1].toLowerCase()] + + if (mime && mime.charset) { + return mime.charset + } + + // default text/* to utf-8 + if (match && TEXT_TYPE_REGEXP.test(match[1])) { + return 'UTF-8' + } + + return false +} + +/** + * Create a full Content-Type header given a MIME type or extension. + * + * @param {string} str + * @return {boolean|string} + */ + +function contentType (str) { + // TODO: should this even be in this module? + if (!str || typeof str !== 'string') { + return false + } + + var mime = str.indexOf('/') === -1 + ? exports.lookup(str) + : str + + if (!mime) { + return false + } + + // TODO: use content-type or other module + if (mime.indexOf('charset') === -1) { + var charset = exports.charset(mime) + if (charset) mime += '; charset=' + charset.toLowerCase() + } + + return mime +} + +/** + * Get the default extension for a MIME type. + * + * @param {string} type + * @return {boolean|string} + */ + +function extension (type) { + if (!type || typeof type !== 'string') { + return false + } + + // TODO: use media-typer + var match = EXTRACT_TYPE_REGEXP.exec(type) + + // get extensions + var exts = match && exports.extensions[match[1].toLowerCase()] + + if (!exts || !exts.length) { + return false + } + + return exts[0] +} + +/** + * Lookup the MIME type for a file path/extension. + * + * @param {string} path + * @return {boolean|string} + */ + +function lookup (path) { + if (!path || typeof path !== 'string') { + return false + } + + // get the extension ("ext" or ".ext" or full path) + var extension = extname('x.' + path) + .toLowerCase() + .substr(1) + + if (!extension) { + return false + } + + return exports.types[extension] || false +} + +/** + * Populate the extensions and types maps. + * @private + */ + +function populateMaps (extensions, types) { + // source preference (least -> most) + var preference = ['nginx', 'apache', undefined, 'iana'] + + Object.keys(db).forEach(function forEachMimeType (type) { + var mime = db[type] + var exts = mime.extensions + + if (!exts || !exts.length) { + return + } + + // mime -> extensions + extensions[type] = exts + + // extension -> mime + for (var i = 0; i < exts.length; i++) { + var extension = exts[i] + + if (types[extension]) { + var from = preference.indexOf(db[types[extension]].source) + var to = preference.indexOf(mime.source) + + if (types[extension] !== 'application/octet-stream' && + (from > to || (from === to && types[extension].substr(0, 12) === 'application/'))) { + // skip the remapping + continue + } + } + + // set the extension -> mime + types[extension] = type + } + }) +} + + +/***/ }), + +/***/ 72146: +/***/ ((module) => { + +/** + * 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' : ''); +} + + +/***/ }), + +/***/ 27918: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +const Stream = __webpack_require__(2203) + +class MuteStream extends Stream { + #isTTY = null + + constructor (opts = {}) { + super(opts) + this.writable = this.readable = true + this.muted = false + this.on('pipe', this._onpipe) + this.replace = opts.replace + + // For readline-type situations + // This much at the start of a line being redrawn after a ctrl char + // is seen (such as backspace) won't be redrawn as the replacement + this._prompt = opts.prompt || null + this._hadControl = false + } + + #destSrc (key, def) { + if (this._dest) { + return this._dest[key] + } + if (this._src) { + return this._src[key] + } + return def + } + + #proxy (method, ...args) { + if (typeof this._dest?.[method] === 'function') { + this._dest[method](...args) + } + if (typeof this._src?.[method] === 'function') { + this._src[method](...args) + } + } + + get isTTY () { + if (this.#isTTY !== null) { + return this.#isTTY + } + return this.#destSrc('isTTY', false) + } + + // basically just get replace the getter/setter with a regular value + set isTTY (val) { + this.#isTTY = val + } + + get rows () { + return this.#destSrc('rows') + } + + get columns () { + return this.#destSrc('columns') + } + + mute () { + this.muted = true + } + + unmute () { + this.muted = false + } + + _onpipe (src) { + this._src = src + } + + pipe (dest, options) { + this._dest = dest + return super.pipe(dest, options) + } + + pause () { + if (this._src) { + return this._src.pause() + } + } + + resume () { + if (this._src) { + return this._src.resume() + } + } + + write (c) { + if (this.muted) { + if (!this.replace) { + return true + } + // eslint-disable-next-line no-control-regex + if (c.match(/^\u001b/)) { + if (c.indexOf(this._prompt) === 0) { + c = c.slice(this._prompt.length) + c = c.replace(/./g, this.replace) + c = this._prompt + c + } + this._hadControl = true + return this.emit('data', c) + } else { + if (this._prompt && this._hadControl && + c.indexOf(this._prompt) === 0) { + this._hadControl = false + this.emit('data', this._prompt) + c = c.slice(this._prompt.length) + } + c = c.toString().replace(/./g, this.replace) + } + } + this.emit('data', c) + } + + end (c) { + if (this.muted) { + if (c && this.replace) { + c = c.toString().replace(/./g, this.replace) + } else { + c = null + } + } + if (c) { + this.emit('data', c) + } + this.emit('end') + } + + destroy (...args) { + return this.#proxy('destroy', ...args) + } + + destroySoon (...args) { + return this.#proxy('destroySoon', ...args) + } + + close (...args) { + return this.#proxy('close', ...args) + } +} + +module.exports = MuteStream + + +/***/ }), + +/***/ 5615: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var punycode = __webpack_require__(24876); +var mappingTable = __webpack_require__(76250); + +var PROCESSING_OPTIONS = { + TRANSITIONAL: 0, + NONTRANSITIONAL: 1 +}; + +function normalize(str) { // fix bug in v8 + return str.split('\u0000').map(function (s) { return s.normalize('NFC'); }).join('\u0000'); +} + +function findStatus(val) { + var start = 0; + var end = mappingTable.length - 1; + + while (start <= end) { + var mid = Math.floor((start + end) / 2); + + var target = mappingTable[mid]; + if (target[0][0] <= val && target[0][1] >= val) { + return target; + } else if (target[0][0] > val) { + end = mid - 1; + } else { + start = mid + 1; + } + } + + return null; +} + +var regexAstralSymbols = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; + +function countSymbols(string) { + return string + // replace every surrogate pair with a BMP symbol + .replace(regexAstralSymbols, '_') + // then get the length + .length; +} + +function mapChars(domain_name, useSTD3, processing_option) { + var hasError = false; + var processed = ""; + + var len = countSymbols(domain_name); + for (var i = 0; i < len; ++i) { + var codePoint = domain_name.codePointAt(i); + var status = findStatus(codePoint); + + switch (status[1]) { + case "disallowed": + hasError = true; + processed += String.fromCodePoint(codePoint); + break; + case "ignored": + break; + case "mapped": + processed += String.fromCodePoint.apply(String, status[2]); + break; + case "deviation": + if (processing_option === PROCESSING_OPTIONS.TRANSITIONAL) { + processed += String.fromCodePoint.apply(String, status[2]); + } else { + processed += String.fromCodePoint(codePoint); + } + break; + case "valid": + processed += String.fromCodePoint(codePoint); + break; + case "disallowed_STD3_mapped": + if (useSTD3) { + hasError = true; + processed += String.fromCodePoint(codePoint); + } else { + processed += String.fromCodePoint.apply(String, status[2]); + } + break; + case "disallowed_STD3_valid": + if (useSTD3) { + hasError = true; + } + + processed += String.fromCodePoint(codePoint); + break; + } + } + + return { + string: processed, + error: hasError + }; +} + +var combiningMarksRegex = /[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08E4-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C03\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D01-\u0D03\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u18A9\u1920-\u192B\u1930-\u193B\u19B0-\u19C0\u19C8\u19C9\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF8\u1CF9\u1DC0-\u1DF5\u1DFC-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C4\uA8E0-\uA8F1\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2D]|\uD800[\uDDFD\uDEE0\uDF76-\uDF7A]|\uD802[\uDE01-\uDE03\uDE05\uDE06\uDE0C-\uDE0F\uDE38-\uDE3A\uDE3F\uDEE5\uDEE6]|\uD804[\uDC00-\uDC02\uDC38-\uDC46\uDC7F-\uDC82\uDCB0-\uDCBA\uDD00-\uDD02\uDD27-\uDD34\uDD73\uDD80-\uDD82\uDDB3-\uDDC0\uDE2C-\uDE37\uDEDF-\uDEEA\uDF01-\uDF03\uDF3C\uDF3E-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF57\uDF62\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDCB0-\uDCC3\uDDAF-\uDDB5\uDDB8-\uDDC0\uDE30-\uDE40\uDEAB-\uDEB7]|\uD81A[\uDEF0-\uDEF4\uDF30-\uDF36]|\uD81B[\uDF51-\uDF7E\uDF8F-\uDF92]|\uD82F[\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD83A[\uDCD0-\uDCD6]|\uDB40[\uDD00-\uDDEF]/; + +function validateLabel(label, processing_option) { + if (label.substr(0, 4) === "xn--") { + label = punycode.toUnicode(label); + processing_option = PROCESSING_OPTIONS.NONTRANSITIONAL; + } + + var error = false; + + if (normalize(label) !== label || + (label[3] === "-" && label[4] === "-") || + label[0] === "-" || label[label.length - 1] === "-" || + label.indexOf(".") !== -1 || + label.search(combiningMarksRegex) === 0) { + error = true; + } + + var len = countSymbols(label); + for (var i = 0; i < len; ++i) { + var status = findStatus(label.codePointAt(i)); + if ((processing === PROCESSING_OPTIONS.TRANSITIONAL && status[1] !== "valid") || + (processing === PROCESSING_OPTIONS.NONTRANSITIONAL && + status[1] !== "valid" && status[1] !== "deviation")) { + error = true; + break; + } + } + + return { + label: label, + error: error + }; +} + +function processing(domain_name, useSTD3, processing_option) { + var result = mapChars(domain_name, useSTD3, processing_option); + result.string = normalize(result.string); + + var labels = result.string.split("."); + for (var i = 0; i < labels.length; ++i) { + try { + var validation = validateLabel(labels[i]); + labels[i] = validation.label; + result.error = result.error || validation.error; + } catch(e) { + result.error = true; + } + } + + return { + string: labels.join("."), + error: result.error + }; +} + +module.exports.toASCII = function(domain_name, useSTD3, processing_option, verifyDnsLength) { + var result = processing(domain_name, useSTD3, processing_option); + var labels = result.string.split("."); + labels = labels.map(function(l) { + try { + return punycode.toASCII(l); + } catch(e) { + result.error = true; + return l; + } + }); + + if (verifyDnsLength) { + var total = labels.slice(0, labels.length - 1).join(".").length; + if (total.length > 253 || total.length === 0) { + result.error = true; + } + + for (var i=0; i < labels.length; ++i) { + if (labels.length > 63 || labels.length === 0) { + result.error = true; + break; + } + } + } + + if (result.error) return null; + return labels.join("."); +}; + +module.exports.toUnicode = function(domain_name, useSTD3) { + var result = processing(domain_name, useSTD3, PROCESSING_OPTIONS.NONTRANSITIONAL); + + return { + domain: result.string, + error: result.error + }; +}; + +module.exports.PROCESSING_OPTIONS = PROCESSING_OPTIONS; + + +/***/ }), + +/***/ 40274: +/***/ ((module) => { + +"use strict"; + + +var conversions = {}; +module.exports = conversions; + +function sign(x) { + return x < 0 ? -1 : 1; +} + +function evenRound(x) { + // Round x to the nearest integer, choosing the even integer if it lies halfway between two. + if ((x % 1) === 0.5 && (x & 1) === 0) { // [even number].5; round down (i.e. floor) + return Math.floor(x); + } else { + return Math.round(x); + } +} + +function createNumberConversion(bitLength, typeOpts) { + if (!typeOpts.unsigned) { + --bitLength; + } + const lowerBound = typeOpts.unsigned ? 0 : -Math.pow(2, bitLength); + const upperBound = Math.pow(2, bitLength) - 1; + + const moduloVal = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength) : Math.pow(2, bitLength); + const moduloBound = typeOpts.moduloBitLength ? Math.pow(2, typeOpts.moduloBitLength - 1) : Math.pow(2, bitLength - 1); + + return function(V, opts) { + if (!opts) opts = {}; + + let x = +V; + + if (opts.enforceRange) { + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite number"); + } + + x = sign(x) * Math.floor(Math.abs(x)); + if (x < lowerBound || x > upperBound) { + throw new TypeError("Argument is not in byte range"); + } + + return x; + } + + if (!isNaN(x) && opts.clamp) { + x = evenRound(x); + + if (x < lowerBound) x = lowerBound; + if (x > upperBound) x = upperBound; + return x; + } + + if (!Number.isFinite(x) || x === 0) { + return 0; + } + + x = sign(x) * Math.floor(Math.abs(x)); + x = x % moduloVal; + + if (!typeOpts.unsigned && x >= moduloBound) { + return x - moduloVal; + } else if (typeOpts.unsigned) { + if (x < 0) { + x += moduloVal; + } else if (x === -0) { // don't return negative zero + return 0; + } + } + + return x; + } +} + +conversions["void"] = function () { + return undefined; +}; + +conversions["boolean"] = function (val) { + return !!val; +}; + +conversions["byte"] = createNumberConversion(8, { unsigned: false }); +conversions["octet"] = createNumberConversion(8, { unsigned: true }); + +conversions["short"] = createNumberConversion(16, { unsigned: false }); +conversions["unsigned short"] = createNumberConversion(16, { unsigned: true }); + +conversions["long"] = createNumberConversion(32, { unsigned: false }); +conversions["unsigned long"] = createNumberConversion(32, { unsigned: true }); + +conversions["long long"] = createNumberConversion(32, { unsigned: false, moduloBitLength: 64 }); +conversions["unsigned long long"] = createNumberConversion(32, { unsigned: true, moduloBitLength: 64 }); + +conversions["double"] = function (V) { + const x = +V; + + if (!Number.isFinite(x)) { + throw new TypeError("Argument is not a finite floating-point value"); + } + + return x; +}; + +conversions["unrestricted double"] = function (V) { + const x = +V; + + if (isNaN(x)) { + throw new TypeError("Argument is NaN"); + } + + return x; +}; + +// not quite valid, but good enough for JS +conversions["float"] = conversions["double"]; +conversions["unrestricted float"] = conversions["unrestricted double"]; + +conversions["DOMString"] = function (V, opts) { + if (!opts) opts = {}; + + if (opts.treatNullAsEmptyString && V === null) { + return ""; + } + + return String(V); +}; + +conversions["ByteString"] = function (V, opts) { + const x = String(V); + let c = undefined; + for (let i = 0; (c = x.codePointAt(i)) !== undefined; ++i) { + if (c > 255) { + throw new TypeError("Argument is not a valid bytestring"); + } + } + + return x; +}; + +conversions["USVString"] = function (V) { + const S = String(V); + const n = S.length; + const U = []; + for (let i = 0; i < n; ++i) { + const c = S.charCodeAt(i); + if (c < 0xD800 || c > 0xDFFF) { + U.push(String.fromCodePoint(c)); + } else if (0xDC00 <= c && c <= 0xDFFF) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + if (i === n - 1) { + U.push(String.fromCodePoint(0xFFFD)); + } else { + const d = S.charCodeAt(i + 1); + if (0xDC00 <= d && d <= 0xDFFF) { + const a = c & 0x3FF; + const b = d & 0x3FF; + U.push(String.fromCodePoint((2 << 15) + (2 << 9) * a + b)); + ++i; + } else { + U.push(String.fromCodePoint(0xFFFD)); + } + } + } + } + + return U.join(''); +}; + +conversions["Date"] = function (V, opts) { + if (!(V instanceof Date)) { + throw new TypeError("Argument is not a Date object"); + } + if (isNaN(V)) { + return undefined; + } + + return V; +}; + +conversions["RegExp"] = function (V, opts) { + if (!(V instanceof RegExp)) { + V = new RegExp(V); + } + + return V; +}; + + +/***/ }), + +/***/ 66113: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +const usm = __webpack_require__(27750); + +exports.implementation = class URLImpl { + constructor(constructorArgs) { + const url = constructorArgs[0]; + const base = constructorArgs[1]; + + let parsedBase = null; + if (base !== undefined) { + parsedBase = usm.basicURLParse(base); + if (parsedBase === "failure") { + throw new TypeError("Invalid base URL"); + } + } + + const parsedURL = usm.basicURLParse(url, { baseURL: parsedBase }); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + + // TODO: query stuff + } + + get href() { + return usm.serializeURL(this._url); + } + + set href(v) { + const parsedURL = usm.basicURLParse(v); + if (parsedURL === "failure") { + throw new TypeError("Invalid URL"); + } + + this._url = parsedURL; + } + + get origin() { + return usm.serializeURLOrigin(this._url); + } + + get protocol() { + return this._url.scheme + ":"; + } + + set protocol(v) { + usm.basicURLParse(v + ":", { url: this._url, stateOverride: "scheme start" }); + } + + get username() { + return this._url.username; + } + + set username(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setTheUsername(this._url, v); + } + + get password() { + return this._url.password; + } + + set password(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + usm.setThePassword(this._url, v); + } + + get host() { + const url = this._url; + + if (url.host === null) { + return ""; + } + + if (url.port === null) { + return usm.serializeHost(url.host); + } + + return usm.serializeHost(url.host) + ":" + usm.serializeInteger(url.port); + } + + set host(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "host" }); + } + + get hostname() { + if (this._url.host === null) { + return ""; + } + + return usm.serializeHost(this._url.host); + } + + set hostname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + usm.basicURLParse(v, { url: this._url, stateOverride: "hostname" }); + } + + get port() { + if (this._url.port === null) { + return ""; + } + + return usm.serializeInteger(this._url.port); + } + + set port(v) { + if (usm.cannotHaveAUsernamePasswordPort(this._url)) { + return; + } + + if (v === "") { + this._url.port = null; + } else { + usm.basicURLParse(v, { url: this._url, stateOverride: "port" }); + } + } + + get pathname() { + if (this._url.cannotBeABaseURL) { + return this._url.path[0]; + } + + if (this._url.path.length === 0) { + return ""; + } + + return "/" + this._url.path.join("/"); + } + + set pathname(v) { + if (this._url.cannotBeABaseURL) { + return; + } + + this._url.path = []; + usm.basicURLParse(v, { url: this._url, stateOverride: "path start" }); + } + + get search() { + if (this._url.query === null || this._url.query === "") { + return ""; + } + + return "?" + this._url.query; + } + + set search(v) { + // TODO: query stuff + + const url = this._url; + + if (v === "") { + url.query = null; + return; + } + + const input = v[0] === "?" ? v.substring(1) : v; + url.query = ""; + usm.basicURLParse(input, { url, stateOverride: "query" }); + } + + get hash() { + if (this._url.fragment === null || this._url.fragment === "") { + return ""; + } + + return "#" + this._url.fragment; + } + + set hash(v) { + if (v === "") { + this._url.fragment = null; + return; + } + + const input = v[0] === "#" ? v.substring(1) : v; + this._url.fragment = ""; + usm.basicURLParse(input, { url: this._url, stateOverride: "fragment" }); + } + + toJSON() { + return this.href; + } +}; + + +/***/ }), + +/***/ 21462: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const conversions = __webpack_require__(40274); +const utils = __webpack_require__(6218); +const Impl = __webpack_require__(66113); + +const impl = utils.implSymbol; + +function URL(url) { + if (!this || this[impl] || !(this instanceof URL)) { + throw new TypeError("Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function."); + } + if (arguments.length < 1) { + throw new TypeError("Failed to construct 'URL': 1 argument required, but only " + arguments.length + " present."); + } + const args = []; + for (let i = 0; i < arguments.length && i < 2; ++i) { + args[i] = arguments[i]; + } + args[0] = conversions["USVString"](args[0]); + if (args[1] !== undefined) { + args[1] = conversions["USVString"](args[1]); + } + + module.exports.setup(this, args); +} + +URL.prototype.toJSON = function toJSON() { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + const args = []; + for (let i = 0; i < arguments.length && i < 0; ++i) { + args[i] = arguments[i]; + } + return this[impl].toJSON.apply(this[impl], args); +}; +Object.defineProperty(URL.prototype, "href", { + get() { + return this[impl].href; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].href = V; + }, + enumerable: true, + configurable: true +}); + +URL.prototype.toString = function () { + if (!this || !module.exports.is(this)) { + throw new TypeError("Illegal invocation"); + } + return this.href; +}; + +Object.defineProperty(URL.prototype, "origin", { + get() { + return this[impl].origin; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "protocol", { + get() { + return this[impl].protocol; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].protocol = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "username", { + get() { + return this[impl].username; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].username = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "password", { + get() { + return this[impl].password; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].password = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "host", { + get() { + return this[impl].host; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].host = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hostname", { + get() { + return this[impl].hostname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hostname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "port", { + get() { + return this[impl].port; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].port = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "pathname", { + get() { + return this[impl].pathname; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].pathname = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "search", { + get() { + return this[impl].search; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].search = V; + }, + enumerable: true, + configurable: true +}); + +Object.defineProperty(URL.prototype, "hash", { + get() { + return this[impl].hash; + }, + set(V) { + V = conversions["USVString"](V); + this[impl].hash = V; + }, + enumerable: true, + configurable: true +}); + + +module.exports = { + is(obj) { + return !!obj && obj[impl] instanceof Impl.implementation; + }, + create(constructorArgs, privateData) { + let obj = Object.create(URL.prototype); + this.setup(obj, constructorArgs, privateData); + return obj; + }, + setup(obj, constructorArgs, privateData) { + if (!privateData) privateData = {}; + privateData.wrapper = obj; + + obj[impl] = new Impl.implementation(constructorArgs, privateData); + obj[impl][utils.wrapperSymbol] = obj; + }, + interface: URL, + expose: { + Window: { URL: URL }, + Worker: { URL: URL } + } +}; + + + +/***/ }), + +/***/ 61599: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +exports.URL = __webpack_require__(21462)["interface"]; +/* unused reexport */ __webpack_require__(27750).serializeURL; +/* unused reexport */ __webpack_require__(27750).serializeURLOrigin; +/* unused reexport */ __webpack_require__(27750).basicURLParse; +/* unused reexport */ __webpack_require__(27750).setTheUsername; +/* unused reexport */ __webpack_require__(27750).setThePassword; +/* unused reexport */ __webpack_require__(27750).serializeHost; +/* unused reexport */ __webpack_require__(27750).serializeInteger; +/* unused reexport */ __webpack_require__(27750).parseURL; + + +/***/ }), + +/***/ 27750: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const punycode = __webpack_require__(24876); +const tr46 = __webpack_require__(5615); + +const specialSchemes = { + ftp: 21, + file: null, + gopher: 70, + http: 80, + https: 443, + ws: 80, + wss: 443 +}; + +const failure = Symbol("failure"); + +function countSymbols(str) { + return punycode.ucs2.decode(str).length; +} + +function at(input, idx) { + const c = input[idx]; + return isNaN(c) ? undefined : String.fromCodePoint(c); +} + +function isASCIIDigit(c) { + return c >= 0x30 && c <= 0x39; +} + +function isASCIIAlpha(c) { + return (c >= 0x41 && c <= 0x5A) || (c >= 0x61 && c <= 0x7A); +} + +function isASCIIAlphanumeric(c) { + return isASCIIAlpha(c) || isASCIIDigit(c); +} + +function isASCIIHex(c) { + return isASCIIDigit(c) || (c >= 0x41 && c <= 0x46) || (c >= 0x61 && c <= 0x66); +} + +function isSingleDot(buffer) { + return buffer === "." || buffer.toLowerCase() === "%2e"; +} + +function isDoubleDot(buffer) { + buffer = buffer.toLowerCase(); + return buffer === ".." || buffer === "%2e." || buffer === ".%2e" || buffer === "%2e%2e"; +} + +function isWindowsDriveLetterCodePoints(cp1, cp2) { + return isASCIIAlpha(cp1) && (cp2 === 58 || cp2 === 124); +} + +function isWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && (string[1] === ":" || string[1] === "|"); +} + +function isNormalizedWindowsDriveLetterString(string) { + return string.length === 2 && isASCIIAlpha(string.codePointAt(0)) && string[1] === ":"; +} + +function containsForbiddenHostCodePoint(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|%|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function containsForbiddenHostCodePointExcludingPercent(string) { + return string.search(/\u0000|\u0009|\u000A|\u000D|\u0020|#|\/|:|\?|@|\[|\\|\]/) !== -1; +} + +function isSpecialScheme(scheme) { + return specialSchemes[scheme] !== undefined; +} + +function isSpecial(url) { + return isSpecialScheme(url.scheme); +} + +function defaultPort(scheme) { + return specialSchemes[scheme]; +} + +function percentEncode(c) { + let hex = c.toString(16).toUpperCase(); + if (hex.length === 1) { + hex = "0" + hex; + } + + return "%" + hex; +} + +function utf8PercentEncode(c) { + const buf = new Buffer(c); + + let str = ""; + + for (let i = 0; i < buf.length; ++i) { + str += percentEncode(buf[i]); + } + + return str; +} + +function utf8PercentDecode(str) { + const input = new Buffer(str); + const output = []; + for (let i = 0; i < input.length; ++i) { + if (input[i] !== 37) { + output.push(input[i]); + } else if (input[i] === 37 && isASCIIHex(input[i + 1]) && isASCIIHex(input[i + 2])) { + output.push(parseInt(input.slice(i + 1, i + 3).toString(), 16)); + i += 2; + } else { + output.push(input[i]); + } + } + return new Buffer(output).toString(); +} + +function isC0ControlPercentEncode(c) { + return c <= 0x1F || c > 0x7E; +} + +const extraPathPercentEncodeSet = new Set([32, 34, 35, 60, 62, 63, 96, 123, 125]); +function isPathPercentEncode(c) { + return isC0ControlPercentEncode(c) || extraPathPercentEncodeSet.has(c); +} + +const extraUserinfoPercentEncodeSet = + new Set([47, 58, 59, 61, 64, 91, 92, 93, 94, 124]); +function isUserinfoPercentEncode(c) { + return isPathPercentEncode(c) || extraUserinfoPercentEncodeSet.has(c); +} + +function percentEncodeChar(c, encodeSetPredicate) { + const cStr = String.fromCodePoint(c); + + if (encodeSetPredicate(c)) { + return utf8PercentEncode(cStr); + } + + return cStr; +} + +function parseIPv4Number(input) { + let R = 10; + + if (input.length >= 2 && input.charAt(0) === "0" && input.charAt(1).toLowerCase() === "x") { + input = input.substring(2); + R = 16; + } else if (input.length >= 2 && input.charAt(0) === "0") { + input = input.substring(1); + R = 8; + } + + if (input === "") { + return 0; + } + + const regex = R === 10 ? /[^0-9]/ : (R === 16 ? /[^0-9A-Fa-f]/ : /[^0-7]/); + if (regex.test(input)) { + return failure; + } + + return parseInt(input, R); +} + +function parseIPv4(input) { + const parts = input.split("."); + if (parts[parts.length - 1] === "") { + if (parts.length > 1) { + parts.pop(); + } + } + + if (parts.length > 4) { + return input; + } + + const numbers = []; + for (const part of parts) { + if (part === "") { + return input; + } + const n = parseIPv4Number(part); + if (n === failure) { + return input; + } + + numbers.push(n); + } + + for (let i = 0; i < numbers.length - 1; ++i) { + if (numbers[i] > 255) { + return failure; + } + } + if (numbers[numbers.length - 1] >= Math.pow(256, 5 - numbers.length)) { + return failure; + } + + let ipv4 = numbers.pop(); + let counter = 0; + + for (const n of numbers) { + ipv4 += n * Math.pow(256, 3 - counter); + ++counter; + } + + return ipv4; +} + +function serializeIPv4(address) { + let output = ""; + let n = address; + + for (let i = 1; i <= 4; ++i) { + output = String(n % 256) + output; + if (i !== 4) { + output = "." + output; + } + n = Math.floor(n / 256); + } + + return output; +} + +function parseIPv6(input) { + const address = [0, 0, 0, 0, 0, 0, 0, 0]; + let pieceIndex = 0; + let compress = null; + let pointer = 0; + + input = punycode.ucs2.decode(input); + + if (input[pointer] === 58) { + if (input[pointer + 1] !== 58) { + return failure; + } + + pointer += 2; + ++pieceIndex; + compress = pieceIndex; + } + + while (pointer < input.length) { + if (pieceIndex === 8) { + return failure; + } + + if (input[pointer] === 58) { + if (compress !== null) { + return failure; + } + ++pointer; + ++pieceIndex; + compress = pieceIndex; + continue; + } + + let value = 0; + let length = 0; + + while (length < 4 && isASCIIHex(input[pointer])) { + value = value * 0x10 + parseInt(at(input, pointer), 16); + ++pointer; + ++length; + } + + if (input[pointer] === 46) { + if (length === 0) { + return failure; + } + + pointer -= length; + + if (pieceIndex > 6) { + return failure; + } + + let numbersSeen = 0; + + while (input[pointer] !== undefined) { + let ipv4Piece = null; + + if (numbersSeen > 0) { + if (input[pointer] === 46 && numbersSeen < 4) { + ++pointer; + } else { + return failure; + } + } + + if (!isASCIIDigit(input[pointer])) { + return failure; + } + + while (isASCIIDigit(input[pointer])) { + const number = parseInt(at(input, pointer)); + if (ipv4Piece === null) { + ipv4Piece = number; + } else if (ipv4Piece === 0) { + return failure; + } else { + ipv4Piece = ipv4Piece * 10 + number; + } + if (ipv4Piece > 255) { + return failure; + } + ++pointer; + } + + address[pieceIndex] = address[pieceIndex] * 0x100 + ipv4Piece; + + ++numbersSeen; + + if (numbersSeen === 2 || numbersSeen === 4) { + ++pieceIndex; + } + } + + if (numbersSeen !== 4) { + return failure; + } + + break; + } else if (input[pointer] === 58) { + ++pointer; + if (input[pointer] === undefined) { + return failure; + } + } else if (input[pointer] !== undefined) { + return failure; + } + + address[pieceIndex] = value; + ++pieceIndex; + } + + if (compress !== null) { + let swaps = pieceIndex - compress; + pieceIndex = 7; + while (pieceIndex !== 0 && swaps > 0) { + const temp = address[compress + swaps - 1]; + address[compress + swaps - 1] = address[pieceIndex]; + address[pieceIndex] = temp; + --pieceIndex; + --swaps; + } + } else if (compress === null && pieceIndex !== 8) { + return failure; + } + + return address; +} + +function serializeIPv6(address) { + let output = ""; + const seqResult = findLongestZeroSequence(address); + const compress = seqResult.idx; + let ignore0 = false; + + for (let pieceIndex = 0; pieceIndex <= 7; ++pieceIndex) { + if (ignore0 && address[pieceIndex] === 0) { + continue; + } else if (ignore0) { + ignore0 = false; + } + + if (compress === pieceIndex) { + const separator = pieceIndex === 0 ? "::" : ":"; + output += separator; + ignore0 = true; + continue; + } + + output += address[pieceIndex].toString(16); + + if (pieceIndex !== 7) { + output += ":"; + } + } + + return output; +} + +function parseHost(input, isSpecialArg) { + if (input[0] === "[") { + if (input[input.length - 1] !== "]") { + return failure; + } + + return parseIPv6(input.substring(1, input.length - 1)); + } + + if (!isSpecialArg) { + return parseOpaqueHost(input); + } + + const domain = utf8PercentDecode(input); + const asciiDomain = tr46.toASCII(domain, false, tr46.PROCESSING_OPTIONS.NONTRANSITIONAL, false); + if (asciiDomain === null) { + return failure; + } + + if (containsForbiddenHostCodePoint(asciiDomain)) { + return failure; + } + + const ipv4Host = parseIPv4(asciiDomain); + if (typeof ipv4Host === "number" || ipv4Host === failure) { + return ipv4Host; + } + + return asciiDomain; +} + +function parseOpaqueHost(input) { + if (containsForbiddenHostCodePointExcludingPercent(input)) { + return failure; + } + + let output = ""; + const decoded = punycode.ucs2.decode(input); + for (let i = 0; i < decoded.length; ++i) { + output += percentEncodeChar(decoded[i], isC0ControlPercentEncode); + } + return output; +} + +function findLongestZeroSequence(arr) { + let maxIdx = null; + let maxLen = 1; // only find elements > 1 + let currStart = null; + let currLen = 0; + + for (let i = 0; i < arr.length; ++i) { + if (arr[i] !== 0) { + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + currStart = null; + currLen = 0; + } else { + if (currStart === null) { + currStart = i; + } + ++currLen; + } + } + + // if trailing zeros + if (currLen > maxLen) { + maxIdx = currStart; + maxLen = currLen; + } + + return { + idx: maxIdx, + len: maxLen + }; +} + +function serializeHost(host) { + if (typeof host === "number") { + return serializeIPv4(host); + } + + // IPv6 serializer + if (host instanceof Array) { + return "[" + serializeIPv6(host) + "]"; + } + + return host; +} + +function trimControlChars(url) { + return url.replace(/^[\u0000-\u001F\u0020]+|[\u0000-\u001F\u0020]+$/g, ""); +} + +function trimTabAndNewline(url) { + return url.replace(/\u0009|\u000A|\u000D/g, ""); +} + +function shortenPath(url) { + const path = url.path; + if (path.length === 0) { + return; + } + if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { + return; + } + + path.pop(); +} + +function includesCredentials(url) { + return url.username !== "" || url.password !== ""; +} + +function cannotHaveAUsernamePasswordPort(url) { + return url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file"; +} + +function isNormalizedWindowsDriveLetter(string) { + return /^[A-Za-z]:$/.test(string); +} + +function URLStateMachine(input, base, encodingOverride, url, stateOverride) { + this.pointer = 0; + this.input = input; + this.base = base || null; + this.encodingOverride = encodingOverride || "utf-8"; + this.stateOverride = stateOverride; + this.url = url; + this.failure = false; + this.parseError = false; + + if (!this.url) { + this.url = { + scheme: "", + username: "", + password: "", + host: null, + port: null, + path: [], + query: null, + fragment: null, + + cannotBeABaseURL: false + }; + + const res = trimControlChars(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + } + + const res = trimTabAndNewline(this.input); + if (res !== this.input) { + this.parseError = true; + } + this.input = res; + + this.state = stateOverride || "scheme start"; + + this.buffer = ""; + this.atFlag = false; + this.arrFlag = false; + this.passwordTokenSeenFlag = false; + + this.input = punycode.ucs2.decode(this.input); + + for (; this.pointer <= this.input.length; ++this.pointer) { + const c = this.input[this.pointer]; + const cStr = isNaN(c) ? undefined : String.fromCodePoint(c); + + // exec state machine + const ret = this["parse " + this.state](c, cStr); + if (!ret) { + break; // terminate algorithm + } else if (ret === failure) { + this.failure = true; + break; + } + } +} + +URLStateMachine.prototype["parse scheme start"] = function parseSchemeStart(c, cStr) { + if (isASCIIAlpha(c)) { + this.buffer += cStr.toLowerCase(); + this.state = "scheme"; + } else if (!this.stateOverride) { + this.state = "no scheme"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse scheme"] = function parseScheme(c, cStr) { + if (isASCIIAlphanumeric(c) || c === 43 || c === 45 || c === 46) { + this.buffer += cStr.toLowerCase(); + } else if (c === 58) { + if (this.stateOverride) { + if (isSpecial(this.url) && !isSpecialScheme(this.buffer)) { + return false; + } + + if (!isSpecial(this.url) && isSpecialScheme(this.buffer)) { + return false; + } + + if ((includesCredentials(this.url) || this.url.port !== null) && this.buffer === "file") { + return false; + } + + if (this.url.scheme === "file" && (this.url.host === "" || this.url.host === null)) { + return false; + } + } + this.url.scheme = this.buffer; + this.buffer = ""; + if (this.stateOverride) { + return false; + } + if (this.url.scheme === "file") { + if (this.input[this.pointer + 1] !== 47 || this.input[this.pointer + 2] !== 47) { + this.parseError = true; + } + this.state = "file"; + } else if (isSpecial(this.url) && this.base !== null && this.base.scheme === this.url.scheme) { + this.state = "special relative or authority"; + } else if (isSpecial(this.url)) { + this.state = "special authority slashes"; + } else if (this.input[this.pointer + 1] === 47) { + this.state = "path or authority"; + ++this.pointer; + } else { + this.url.cannotBeABaseURL = true; + this.url.path.push(""); + this.state = "cannot-be-a-base-URL path"; + } + } else if (!this.stateOverride) { + this.buffer = ""; + this.state = "no scheme"; + this.pointer = -1; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +URLStateMachine.prototype["parse no scheme"] = function parseNoScheme(c) { + if (this.base === null || (this.base.cannotBeABaseURL && c !== 35)) { + return failure; + } else if (this.base.cannotBeABaseURL && c === 35) { + this.url.scheme = this.base.scheme; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.url.cannotBeABaseURL = true; + this.state = "fragment"; + } else if (this.base.scheme === "file") { + this.state = "file"; + --this.pointer; + } else { + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special relative or authority"] = function parseSpecialRelativeOrAuthority(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "relative"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse path or authority"] = function parsePathOrAuthority(c) { + if (c === 47) { + this.state = "authority"; + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative"] = function parseRelative(c) { + this.url.scheme = this.base.scheme; + if (isNaN(c)) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 47) { + this.state = "relative slash"; + } else if (c === 63) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else if (isSpecial(this.url) && c === 92) { + this.parseError = true; + this.state = "relative slash"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.url.path = this.base.path.slice(0, this.base.path.length - 1); + + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse relative slash"] = function parseRelativeSlash(c) { + if (isSpecial(this.url) && (c === 47 || c === 92)) { + if (c === 92) { + this.parseError = true; + } + this.state = "special authority ignore slashes"; + } else if (c === 47) { + this.state = "authority"; + } else { + this.url.username = this.base.username; + this.url.password = this.base.password; + this.url.host = this.base.host; + this.url.port = this.base.port; + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority slashes"] = function parseSpecialAuthoritySlashes(c) { + if (c === 47 && this.input[this.pointer + 1] === 47) { + this.state = "special authority ignore slashes"; + ++this.pointer; + } else { + this.parseError = true; + this.state = "special authority ignore slashes"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse special authority ignore slashes"] = function parseSpecialAuthorityIgnoreSlashes(c) { + if (c !== 47 && c !== 92) { + this.state = "authority"; + --this.pointer; + } else { + this.parseError = true; + } + + return true; +}; + +URLStateMachine.prototype["parse authority"] = function parseAuthority(c, cStr) { + if (c === 64) { + this.parseError = true; + if (this.atFlag) { + this.buffer = "%40" + this.buffer; + } + this.atFlag = true; + + // careful, this is based on buffer and has its own pointer (this.pointer != pointer) and inner chars + const len = countSymbols(this.buffer); + for (let pointer = 0; pointer < len; ++pointer) { + const codePoint = this.buffer.codePointAt(pointer); + + if (codePoint === 58 && !this.passwordTokenSeenFlag) { + this.passwordTokenSeenFlag = true; + continue; + } + const encodedCodePoints = percentEncodeChar(codePoint, isUserinfoPercentEncode); + if (this.passwordTokenSeenFlag) { + this.url.password += encodedCodePoints; + } else { + this.url.username += encodedCodePoints; + } + } + this.buffer = ""; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + if (this.atFlag && this.buffer === "") { + this.parseError = true; + return failure; + } + this.pointer -= countSymbols(this.buffer) + 1; + this.buffer = ""; + this.state = "host"; + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse hostname"] = +URLStateMachine.prototype["parse host"] = function parseHostName(c, cStr) { + if (this.stateOverride && this.url.scheme === "file") { + --this.pointer; + this.state = "file host"; + } else if (c === 58 && !this.arrFlag) { + if (this.buffer === "") { + this.parseError = true; + return failure; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "port"; + if (this.stateOverride === "hostname") { + return false; + } + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92)) { + --this.pointer; + if (isSpecial(this.url) && this.buffer === "") { + this.parseError = true; + return failure; + } else if (this.stateOverride && this.buffer === "" && + (includesCredentials(this.url) || this.url.port !== null)) { + this.parseError = true; + return false; + } + + const host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + + this.url.host = host; + this.buffer = ""; + this.state = "path start"; + if (this.stateOverride) { + return false; + } + } else { + if (c === 91) { + this.arrFlag = true; + } else if (c === 93) { + this.arrFlag = false; + } + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse port"] = function parsePort(c, cStr) { + if (isASCIIDigit(c)) { + this.buffer += cStr; + } else if (isNaN(c) || c === 47 || c === 63 || c === 35 || + (isSpecial(this.url) && c === 92) || + this.stateOverride) { + if (this.buffer !== "") { + const port = parseInt(this.buffer); + if (port > Math.pow(2, 16) - 1) { + this.parseError = true; + return failure; + } + this.url.port = port === defaultPort(this.url.scheme) ? null : port; + this.buffer = ""; + } + if (this.stateOverride) { + return false; + } + this.state = "path start"; + --this.pointer; + } else { + this.parseError = true; + return failure; + } + + return true; +}; + +const fileOtherwiseCodePoints = new Set([47, 92, 63, 35]); + +URLStateMachine.prototype["parse file"] = function parseFile(c) { + this.url.scheme = "file"; + + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file slash"; + } else if (this.base !== null && this.base.scheme === "file") { + if (isNaN(c)) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + } else if (c === 63) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + this.url.query = this.base.query; + this.url.fragment = ""; + this.state = "fragment"; + } else { + if (this.input.length - this.pointer - 1 === 0 || // remaining consists of 0 code points + !isWindowsDriveLetterCodePoints(c, this.input[this.pointer + 1]) || + (this.input.length - this.pointer - 1 >= 2 && // remaining has at least 2 code points + !fileOtherwiseCodePoints.has(this.input[this.pointer + 2]))) { + this.url.host = this.base.host; + this.url.path = this.base.path.slice(); + shortenPath(this.url); + } else { + this.parseError = true; + } + + this.state = "path"; + --this.pointer; + } + } else { + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file slash"] = function parseFileSlash(c) { + if (c === 47 || c === 92) { + if (c === 92) { + this.parseError = true; + } + this.state = "file host"; + } else { + if (this.base !== null && this.base.scheme === "file") { + if (isNormalizedWindowsDriveLetterString(this.base.path[0])) { + this.url.path.push(this.base.path[0]); + } else { + this.url.host = this.base.host; + } + } + this.state = "path"; + --this.pointer; + } + + return true; +}; + +URLStateMachine.prototype["parse file host"] = function parseFileHost(c, cStr) { + if (isNaN(c) || c === 47 || c === 92 || c === 63 || c === 35) { + --this.pointer; + if (!this.stateOverride && isWindowsDriveLetterString(this.buffer)) { + this.parseError = true; + this.state = "path"; + } else if (this.buffer === "") { + this.url.host = ""; + if (this.stateOverride) { + return false; + } + this.state = "path start"; + } else { + let host = parseHost(this.buffer, isSpecial(this.url)); + if (host === failure) { + return failure; + } + if (host === "localhost") { + host = ""; + } + this.url.host = host; + + if (this.stateOverride) { + return false; + } + + this.buffer = ""; + this.state = "path start"; + } + } else { + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse path start"] = function parsePathStart(c) { + if (isSpecial(this.url)) { + if (c === 92) { + this.parseError = true; + } + this.state = "path"; + + if (c !== 47 && c !== 92) { + --this.pointer; + } + } else if (!this.stateOverride && c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (!this.stateOverride && c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else if (c !== undefined) { + this.state = "path"; + if (c !== 47) { + --this.pointer; + } + } + + return true; +}; + +URLStateMachine.prototype["parse path"] = function parsePath(c) { + if (isNaN(c) || c === 47 || (isSpecial(this.url) && c === 92) || + (!this.stateOverride && (c === 63 || c === 35))) { + if (isSpecial(this.url) && c === 92) { + this.parseError = true; + } + + if (isDoubleDot(this.buffer)) { + shortenPath(this.url); + if (c !== 47 && !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } + } else if (isSingleDot(this.buffer) && c !== 47 && + !(isSpecial(this.url) && c === 92)) { + this.url.path.push(""); + } else if (!isSingleDot(this.buffer)) { + if (this.url.scheme === "file" && this.url.path.length === 0 && isWindowsDriveLetterString(this.buffer)) { + if (this.url.host !== "" && this.url.host !== null) { + this.parseError = true; + this.url.host = ""; + } + this.buffer = this.buffer[0] + ":"; + } + this.url.path.push(this.buffer); + } + this.buffer = ""; + if (this.url.scheme === "file" && (c === undefined || c === 63 || c === 35)) { + while (this.url.path.length > 1 && this.url.path[0] === "") { + this.parseError = true; + this.url.path.shift(); + } + } + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += percentEncodeChar(c, isPathPercentEncode); + } + + return true; +}; + +URLStateMachine.prototype["parse cannot-be-a-base-URL path"] = function parseCannotBeABaseURLPath(c) { + if (c === 63) { + this.url.query = ""; + this.state = "query"; + } else if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } else { + // TODO: Add: not a URL code point + if (!isNaN(c) && c !== 37) { + this.parseError = true; + } + + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + if (!isNaN(c)) { + this.url.path[0] = this.url.path[0] + percentEncodeChar(c, isC0ControlPercentEncode); + } + } + + return true; +}; + +URLStateMachine.prototype["parse query"] = function parseQuery(c, cStr) { + if (isNaN(c) || (!this.stateOverride && c === 35)) { + if (!isSpecial(this.url) || this.url.scheme === "ws" || this.url.scheme === "wss") { + this.encodingOverride = "utf-8"; + } + + const buffer = new Buffer(this.buffer); // TODO: Use encoding override instead + for (let i = 0; i < buffer.length; ++i) { + if (buffer[i] < 0x21 || buffer[i] > 0x7E || buffer[i] === 0x22 || buffer[i] === 0x23 || + buffer[i] === 0x3C || buffer[i] === 0x3E) { + this.url.query += percentEncode(buffer[i]); + } else { + this.url.query += String.fromCodePoint(buffer[i]); + } + } + + this.buffer = ""; + if (c === 35) { + this.url.fragment = ""; + this.state = "fragment"; + } + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.buffer += cStr; + } + + return true; +}; + +URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { + if (isNaN(c)) { // do nothing + } else if (c === 0x0) { + this.parseError = true; + } else { + // TODO: If c is not a URL code point and not "%", parse error. + if (c === 37 && + (!isASCIIHex(this.input[this.pointer + 1]) || + !isASCIIHex(this.input[this.pointer + 2]))) { + this.parseError = true; + } + + this.url.fragment += percentEncodeChar(c, isC0ControlPercentEncode); + } + + return true; +}; + +function serializeURL(url, excludeFragment) { + let output = url.scheme + ":"; + if (url.host !== null) { + output += "//"; + + if (url.username !== "" || url.password !== "") { + output += url.username; + if (url.password !== "") { + output += ":" + url.password; + } + output += "@"; + } + + output += serializeHost(url.host); + + if (url.port !== null) { + output += ":" + url.port; + } + } else if (url.host === null && url.scheme === "file") { + output += "//"; + } + + if (url.cannotBeABaseURL) { + output += url.path[0]; + } else { + for (const string of url.path) { + output += "/" + string; + } + } + + if (url.query !== null) { + output += "?" + url.query; + } + + if (!excludeFragment && url.fragment !== null) { + output += "#" + url.fragment; + } + + return output; +} + +function serializeOrigin(tuple) { + let result = tuple.scheme + "://"; + result += serializeHost(tuple.host); + + if (tuple.port !== null) { + result += ":" + tuple.port; + } + + return result; +} + +module.exports.serializeURL = serializeURL; + +module.exports.serializeURLOrigin = function (url) { + // https://url.spec.whatwg.org/#concept-url-origin + switch (url.scheme) { + case "blob": + try { + return module.exports.serializeURLOrigin(module.exports.parseURL(url.path[0])); + } catch (e) { + // serializing an opaque origin returns "null" + return "null"; + } + case "ftp": + case "gopher": + case "http": + case "https": + case "ws": + case "wss": + return serializeOrigin({ + scheme: url.scheme, + host: url.host, + port: url.port + }); + case "file": + // spec says "exercise to the reader", chrome says "file://" + return "file://"; + default: + // serializing an opaque origin returns "null" + return "null"; + } +}; + +module.exports.basicURLParse = function (input, options) { + if (options === undefined) { + options = {}; + } + + const usm = new URLStateMachine(input, options.baseURL, options.encodingOverride, options.url, options.stateOverride); + if (usm.failure) { + return "failure"; + } + + return usm.url; +}; + +module.exports.setTheUsername = function (url, username) { + url.username = ""; + const decoded = punycode.ucs2.decode(username); + for (let i = 0; i < decoded.length; ++i) { + url.username += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.setThePassword = function (url, password) { + url.password = ""; + const decoded = punycode.ucs2.decode(password); + for (let i = 0; i < decoded.length; ++i) { + url.password += percentEncodeChar(decoded[i], isUserinfoPercentEncode); + } +}; + +module.exports.serializeHost = serializeHost; + +module.exports.cannotHaveAUsernamePasswordPort = cannotHaveAUsernamePasswordPort; + +module.exports.serializeInteger = function (integer) { + return String(integer); +}; + +module.exports.parseURL = function (input, options) { + if (options === undefined) { + options = {}; + } + + // We don't handle blobs, so this just delegates: + return module.exports.basicURLParse(input, { baseURL: options.baseURL, encodingOverride: options.encodingOverride }); +}; + + +/***/ }), + +/***/ 6218: +/***/ ((module) => { + +"use strict"; + + +module.exports.mixin = function mixin(target, source) { + const keys = Object.getOwnPropertyNames(source); + for (let i = 0; i < keys.length; ++i) { + Object.defineProperty(target, keys[i], Object.getOwnPropertyDescriptor(source, keys[i])); + } +}; + +module.exports.wrapperSymbol = Symbol("wrapper"); +module.exports.implSymbol = Symbol("impl"); + +module.exports.wrapperForImpl = function (impl) { + return impl[module.exports.wrapperSymbol]; +}; + +module.exports.implForWrapper = function (wrapper) { + return wrapper[module.exports.implSymbol]; +}; + + + +/***/ }), + +/***/ 77920: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var name = __webpack_require__(67027); + +/** + * Wrap callbacks to prevent double execution. + * + * @param {Function} fn Function that should only be called once. + * @returns {Function} A wrapped callback which prevents multiple executions. + * @public + */ +module.exports = function one(fn) { + var called = 0 + , value; + + /** + * The function that prevents double execution. + * + * @private + */ + function onetime() { + if (called) return value; + + called = 1; + value = fn.apply(this, arguments); + fn = null; + + return value; + } + + // + // To make debugging more easy we want to use the name of the supplied + // function. So when you look at the functions that are assigned to event + // listeners you don't see a load of `onetime` functions but actually the + // names of the functions that this module will call. + // + // NOTE: We cannot override the `name` property, as that is `readOnly` + // property, so displayName will have to do. + // + onetime.displayName = name(fn); + return onetime; +}; + + +/***/ }), + +/***/ 69711: +/***/ ((module) => { + +"use strict"; + +var isWindows = process.platform === 'win32'; +var trailingSlashRe = isWindows ? /[^:]\\$/ : /.\/$/; + +// https://github.com/nodejs/node/blob/3e7a14381497a3b73dda68d05b5130563cdab420/lib/os.js#L25-L43 +module.exports = function () { + var path; + + if (isWindows) { + path = process.env.TEMP || + process.env.TMP || + (process.env.SystemRoot || process.env.windir) + '\\temp'; + } else { + path = process.env.TMPDIR || + process.env.TMP || + process.env.TEMP || + '/tmp'; + } + + if (trailingSlashRe.test(path)) { + path = path.slice(0, -1); + } + + return path; +}; + + +/***/ }), + +/***/ 10298: +/***/ ((module) => { + +"use strict"; + + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.F = codes; + + +/***/ }), + +/***/ 60161: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __webpack_require__(56935); +var Writable = __webpack_require__(34027); +__webpack_require__(53972)(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ 54965: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __webpack_require__(39191); +__webpack_require__(53972)(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ 56935: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__webpack_require__(24434).EventEmitter); +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __webpack_require__(51129); +/**/ + +var Buffer = (__webpack_require__(20181).Buffer); +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = __webpack_require__(39023); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = __webpack_require__(21586); +var destroyImpl = __webpack_require__(55951); +var _require = __webpack_require__(83392), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(10298)/* .codes */ .F), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +__webpack_require__(53972)(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(60161); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__webpack_require__(58184)/* .StringDecoder */ .I); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || __webpack_require__(60161); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__webpack_require__(58184)/* .StringDecoder */ .I); + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __webpack_require__(46550); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __webpack_require__(91789); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ 39191: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; +var _require$codes = (__webpack_require__(10298)/* .codes */ .F), + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = __webpack_require__(60161); +__webpack_require__(53972)(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} + +/***/ }), + +/***/ 34027: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __webpack_require__(32926) +}; +/**/ + +/**/ +var Stream = __webpack_require__(51129); +/**/ + +var Buffer = (__webpack_require__(20181).Buffer); +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __webpack_require__(55951); +var _require = __webpack_require__(83392), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__webpack_require__(10298)/* .codes */ .F), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__webpack_require__(53972)(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __webpack_require__(60161); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __webpack_require__(60161); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ 46550: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +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); } +var finished = __webpack_require__(17749); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; + +/***/ }), + +/***/ 21586: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); 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); } +var _require = __webpack_require__(20181), + Buffer = _require.Buffer; +var _require2 = __webpack_require__(39023), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); + +/***/ }), + +/***/ 55951: +/***/ ((module) => { + +"use strict"; + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ 17749: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__webpack_require__(10298)/* .codes */ .F).ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ 91789: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +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); } +var ERR_INVALID_ARG_TYPE = (__webpack_require__(10298)/* .codes */ .F).ERR_INVALID_ARG_TYPE; +function from(Readable, iterable, opts) { + var iterator; + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); + // Reading boolean to protect against _read + // being called before last iteration completion. + var reading = false; + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + function next() { + return _next2.apply(this, arguments); + } + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _yield$iterator$next = yield iterator.next(), + value = _yield$iterator$next.value, + done = _yield$iterator$next.done; + if (done) { + readable.push(null); + } else if (readable.push(yield value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + return readable; +} +module.exports = from; + + +/***/ }), + +/***/ 19791: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__webpack_require__(10298)/* .codes */ .F), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __webpack_require__(17749); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ 83392: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__webpack_require__(10298)/* .codes */ .F).ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ 51129: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = __webpack_require__(2203); + + +/***/ }), + +/***/ 72093: +/***/ ((module, exports, __webpack_require__) => { + +var Stream = __webpack_require__(2203); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = __webpack_require__(56935); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = __webpack_require__(34027); + exports.Duplex = __webpack_require__(60161); + exports.Transform = __webpack_require__(39191); + exports.PassThrough = __webpack_require__(54965); + exports.finished = __webpack_require__(17749); + exports.pipeline = __webpack_require__(19791); +} + + +/***/ }), + +/***/ 50980: +/***/ ((module, exports, __webpack_require__) => { + +/*! safe-buffer. MIT License. Feross Aboukhadijeh */ +/* eslint-disable node/no-deprecated-api */ +var buffer = __webpack_require__(20181) +var Buffer = buffer.Buffer + +// alternative to using Object.keys for old browsers +function copyProps (src, dst) { + for (var key in src) { + dst[key] = src[key] + } +} +if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) { + module.exports = buffer +} else { + // Copy properties from require('buffer') + copyProps(buffer, exports) + exports.Buffer = SafeBuffer +} + +function SafeBuffer (arg, encodingOrOffset, length) { + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.prototype = Object.create(Buffer.prototype) + +// Copy static methods from Buffer +copyProps(Buffer, SafeBuffer) + +SafeBuffer.from = function (arg, encodingOrOffset, length) { + if (typeof arg === 'number') { + throw new TypeError('Argument must not be a number') + } + return Buffer(arg, encodingOrOffset, length) +} + +SafeBuffer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + var buf = Buffer(size) + if (fill !== undefined) { + if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + } else { + buf.fill(0) + } + return buf +} + +SafeBuffer.allocUnsafe = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return Buffer(size) +} + +SafeBuffer.allocUnsafeSlow = function (size) { + if (typeof size !== 'number') { + throw new TypeError('Argument must be a number') + } + return buffer.SlowBuffer(size) +} + + +/***/ }), + +/***/ 27433: +/***/ ((module, exports) => { + +"use strict"; + + +const { hasOwnProperty } = Object.prototype + +const stringify = configure() + +// @ts-expect-error +stringify.configure = configure +// @ts-expect-error +stringify.stringify = stringify + +// @ts-expect-error +stringify.default = stringify + +// @ts-expect-error used for named export +exports.stringify = stringify +// @ts-expect-error used for named export +exports.configure = configure + +module.exports = stringify + +// eslint-disable-next-line no-control-regex +const strEscapeSequencesRegExp = /[\u0000-\u001f\u0022\u005c\ud800-\udfff]/ + +// Escape C0 control characters, double quotes, the backslash and every code +// unit with a numeric value in the inclusive range 0xD800 to 0xDFFF. +function strEscape (str) { + // Some magic numbers that worked out fine while benchmarking with v8 8.0 + if (str.length < 5000 && !strEscapeSequencesRegExp.test(str)) { + return `"${str}"` + } + return JSON.stringify(str) +} + +function sort (array, comparator) { + // Insertion sort is very efficient for small input sizes, but it has a bad + // worst case complexity. Thus, use native array sort for bigger values. + if (array.length > 2e2 || comparator) { + return array.sort(comparator) + } + for (let i = 1; i < array.length; i++) { + const currentValue = array[i] + let position = i + while (position !== 0 && array[position - 1] > currentValue) { + array[position] = array[position - 1] + position-- + } + array[position] = currentValue + } + return array +} + +const typedArrayPrototypeGetSymbolToStringTag = + Object.getOwnPropertyDescriptor( + Object.getPrototypeOf( + Object.getPrototypeOf( + new Int8Array() + ) + ), + Symbol.toStringTag + ).get + +function isTypedArrayWithEntries (value) { + return typedArrayPrototypeGetSymbolToStringTag.call(value) !== undefined && value.length !== 0 +} + +function stringifyTypedArray (array, separator, maximumBreadth) { + if (array.length < maximumBreadth) { + maximumBreadth = array.length + } + const whitespace = separator === ',' ? '' : ' ' + let res = `"0":${whitespace}${array[0]}` + for (let i = 1; i < maximumBreadth; i++) { + res += `${separator}"${i}":${whitespace}${array[i]}` + } + return res +} + +function getCircularValueOption (options) { + if (hasOwnProperty.call(options, 'circularValue')) { + const circularValue = options.circularValue + if (typeof circularValue === 'string') { + return `"${circularValue}"` + } + if (circularValue == null) { + return circularValue + } + if (circularValue === Error || circularValue === TypeError) { + return { + toString () { + throw new TypeError('Converting circular structure to JSON') + } + } + } + throw new TypeError('The "circularValue" argument must be of type string or the value null or undefined') + } + return '"[Circular]"' +} + +function getDeterministicOption (options) { + let value + if (hasOwnProperty.call(options, 'deterministic')) { + value = options.deterministic + if (typeof value !== 'boolean' && typeof value !== 'function') { + throw new TypeError('The "deterministic" argument must be of type boolean or comparator function') + } + } + return value === undefined ? true : value +} + +function getBooleanOption (options, key) { + let value + if (hasOwnProperty.call(options, key)) { + value = options[key] + if (typeof value !== 'boolean') { + throw new TypeError(`The "${key}" argument must be of type boolean`) + } + } + return value === undefined ? true : value +} + +function getPositiveIntegerOption (options, key) { + let value + if (hasOwnProperty.call(options, key)) { + value = options[key] + if (typeof value !== 'number') { + throw new TypeError(`The "${key}" argument must be of type number`) + } + if (!Number.isInteger(value)) { + throw new TypeError(`The "${key}" argument must be an integer`) + } + if (value < 1) { + throw new RangeError(`The "${key}" argument must be >= 1`) + } + } + return value === undefined ? Infinity : value +} + +function getItemCount (number) { + if (number === 1) { + return '1 item' + } + return `${number} items` +} + +function getUniqueReplacerSet (replacerArray) { + const replacerSet = new Set() + for (const value of replacerArray) { + if (typeof value === 'string' || typeof value === 'number') { + replacerSet.add(String(value)) + } + } + return replacerSet +} + +function getStrictOption (options) { + if (hasOwnProperty.call(options, 'strict')) { + const value = options.strict + if (typeof value !== 'boolean') { + throw new TypeError('The "strict" argument must be of type boolean') + } + if (value) { + return (value) => { + let message = `Object can not safely be stringified. Received type ${typeof value}` + if (typeof value !== 'function') message += ` (${value.toString()})` + throw new Error(message) + } + } + } +} + +function configure (options) { + options = { ...options } + const fail = getStrictOption(options) + if (fail) { + if (options.bigint === undefined) { + options.bigint = false + } + if (!('circularValue' in options)) { + options.circularValue = Error + } + } + const circularValue = getCircularValueOption(options) + const bigint = getBooleanOption(options, 'bigint') + const deterministic = getDeterministicOption(options) + const comparator = typeof deterministic === 'function' ? deterministic : undefined + const maximumDepth = getPositiveIntegerOption(options, 'maximumDepth') + const maximumBreadth = getPositiveIntegerOption(options, 'maximumBreadth') + + function stringifyFnReplacer (key, parent, stack, replacer, spacer, indentation) { + let value = parent[key] + + if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') { + value = value.toJSON(key) + } + value = replacer.call(parent, key, value) + + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + let res = '' + let join = ',' + const originalIndentation = indentation + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + if (spacer !== '') { + indentation += spacer + res += `\n${indentation}` + join = `,\n${indentation}` + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyFnReplacer(String(i), value, stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + if (spacer !== '') { + res += `\n${originalIndentation}` + } + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + let whitespace = '' + let separator = '' + if (spacer !== '') { + indentation += spacer + join = `,\n${indentation}` + whitespace = ' ' + } + const maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (deterministic && !isTypedArrayWithEntries(value)) { + keys = sort(keys, comparator) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifyFnReplacer(key, value, stack, replacer, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${whitespace}${tmp}` + separator = join + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...":${whitespace}"${getItemCount(removedKeys)} not stringified"` + separator = join + } + if (spacer !== '' && separator.length > 1) { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifyArrayReplacer (key, value, stack, replacer, spacer, indentation) { + if (typeof value === 'object' && value !== null && typeof value.toJSON === 'function') { + value = value.toJSON(key) + } + + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + const originalIndentation = indentation + let res = '' + let join = ',' + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + if (spacer !== '') { + indentation += spacer + res += `\n${indentation}` + join = `,\n${indentation}` + } + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyArrayReplacer(String(i), value[i], stack, replacer, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + if (spacer !== '') { + res += `\n${originalIndentation}` + } + stack.pop() + return `[${res}]` + } + stack.push(value) + let whitespace = '' + if (spacer !== '') { + indentation += spacer + join = `,\n${indentation}` + whitespace = ' ' + } + let separator = '' + for (const key of replacer) { + const tmp = stringifyArrayReplacer(key, value[key], stack, replacer, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${whitespace}${tmp}` + separator = join + } + } + if (spacer !== '' && separator.length > 1) { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifyIndent (key, value, stack, spacer, indentation) { + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (typeof value.toJSON === 'function') { + value = value.toJSON(key) + // Prevent calling `toJSON` again. + if (typeof value !== 'object') { + return stringifyIndent(key, value, stack, spacer, indentation) + } + if (value === null) { + return 'null' + } + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + const originalIndentation = indentation + + if (Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + indentation += spacer + let res = `\n${indentation}` + const join = `,\n${indentation}` + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + res += join + } + const tmp = stringifyIndent(String(i), value[i], stack, spacer, indentation) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `${join}"... ${getItemCount(removedKeys)} not stringified"` + } + res += `\n${originalIndentation}` + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + indentation += spacer + const join = `,\n${indentation}` + let res = '' + let separator = '' + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, join, maximumBreadth) + keys = keys.slice(value.length) + maximumPropertiesToStringify -= value.length + separator = join + } + if (deterministic) { + keys = sort(keys, comparator) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifyIndent(key, value[key], stack, spacer, indentation) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}: ${tmp}` + separator = join + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...": "${getItemCount(removedKeys)} not stringified"` + separator = join + } + if (separator !== '') { + res = `\n${indentation}${res}\n${originalIndentation}` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringifySimple (key, value, stack) { + switch (typeof value) { + case 'string': + return strEscape(value) + case 'object': { + if (value === null) { + return 'null' + } + if (typeof value.toJSON === 'function') { + value = value.toJSON(key) + // Prevent calling `toJSON` again + if (typeof value !== 'object') { + return stringifySimple(key, value, stack) + } + if (value === null) { + return 'null' + } + } + if (stack.indexOf(value) !== -1) { + return circularValue + } + + let res = '' + + const hasLength = value.length !== undefined + if (hasLength && Array.isArray(value)) { + if (value.length === 0) { + return '[]' + } + if (maximumDepth < stack.length + 1) { + return '"[Array]"' + } + stack.push(value) + const maximumValuesToStringify = Math.min(value.length, maximumBreadth) + let i = 0 + for (; i < maximumValuesToStringify - 1; i++) { + const tmp = stringifySimple(String(i), value[i], stack) + res += tmp !== undefined ? tmp : 'null' + res += ',' + } + const tmp = stringifySimple(String(i), value[i], stack) + res += tmp !== undefined ? tmp : 'null' + if (value.length - 1 > maximumBreadth) { + const removedKeys = value.length - maximumBreadth - 1 + res += `,"... ${getItemCount(removedKeys)} not stringified"` + } + stack.pop() + return `[${res}]` + } + + let keys = Object.keys(value) + const keyLength = keys.length + if (keyLength === 0) { + return '{}' + } + if (maximumDepth < stack.length + 1) { + return '"[Object]"' + } + let separator = '' + let maximumPropertiesToStringify = Math.min(keyLength, maximumBreadth) + if (hasLength && isTypedArrayWithEntries(value)) { + res += stringifyTypedArray(value, ',', maximumBreadth) + keys = keys.slice(value.length) + maximumPropertiesToStringify -= value.length + separator = ',' + } + if (deterministic) { + keys = sort(keys, comparator) + } + stack.push(value) + for (let i = 0; i < maximumPropertiesToStringify; i++) { + const key = keys[i] + const tmp = stringifySimple(key, value[key], stack) + if (tmp !== undefined) { + res += `${separator}${strEscape(key)}:${tmp}` + separator = ',' + } + } + if (keyLength > maximumBreadth) { + const removedKeys = keyLength - maximumBreadth + res += `${separator}"...":"${getItemCount(removedKeys)} not stringified"` + } + stack.pop() + return `{${res}}` + } + case 'number': + return isFinite(value) ? String(value) : fail ? fail(value) : 'null' + case 'boolean': + return value === true ? 'true' : 'false' + case 'undefined': + return undefined + case 'bigint': + if (bigint) { + return String(value) + } + // fallthrough + default: + return fail ? fail(value) : undefined + } + } + + function stringify (value, replacer, space) { + if (arguments.length > 1) { + let spacer = '' + if (typeof space === 'number') { + spacer = ' '.repeat(Math.min(space, 10)) + } else if (typeof space === 'string') { + spacer = space.slice(0, 10) + } + if (replacer != null) { + if (typeof replacer === 'function') { + return stringifyFnReplacer('', { '': value }, [], replacer, spacer, '') + } + if (Array.isArray(replacer)) { + return stringifyArrayReplacer('', value, [], getUniqueReplacerSet(replacer), spacer, '') + } + } + if (spacer.length !== 0) { + return stringifyIndent('', value, [], spacer, '') + } + } + return stringifySimple('', value, []) + } + + return stringify +} + + +/***/ }), + +/***/ 71781: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint-disable node/no-deprecated-api */ + + + +var buffer = __webpack_require__(20181) +var Buffer = buffer.Buffer + +var safer = {} + +var key + +for (key in buffer) { + if (!buffer.hasOwnProperty(key)) continue + if (key === 'SlowBuffer' || key === 'Buffer') continue + safer[key] = buffer[key] +} + +var Safer = safer.Buffer = {} +for (key in Buffer) { + if (!Buffer.hasOwnProperty(key)) continue + if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue + Safer[key] = Buffer[key] +} + +safer.Buffer.prototype = Buffer.prototype + +if (!Safer.from || Safer.from === Uint8Array.from) { + Safer.from = function (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) + } + if (value && typeof value.length === 'undefined') { + throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) + } + return Buffer(value, encodingOrOffset, length) + } +} + +if (!Safer.alloc) { + Safer.alloc = function (size, fill, encoding) { + if (typeof size !== 'number') { + throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) + } + if (size < 0 || size >= 2 * (1 << 30)) { + throw new RangeError('The value "' + size + '" is invalid for option "size"') + } + var buf = Buffer(size) + if (!fill || fill.length === 0) { + buf.fill(0) + } else if (typeof encoding === 'string') { + buf.fill(fill, encoding) + } else { + buf.fill(fill) + } + return buf + } +} + +if (!safer.kStringMaxLength) { + try { + safer.kStringMaxLength = process.binding('buffer').kStringMaxLength + } catch (e) { + // we can't determine kStringMaxLength in environments where process.binding + // is unsupported, so let's not set it + } +} + +if (!safer.constants) { + safer.constants = { + MAX_LENGTH: safer.kMaxLength + } + if (safer.kStringMaxLength) { + safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength + } +} + +module.exports = safer + + +/***/ }), + +/***/ 67017: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +let Logger = __webpack_require__(77897)( + typeof Blob !== 'undefined' ? Blob : (__webpack_require__(20181).Blob), + typeof fetch !== 'undefined' ? fetch : __webpack_require__(43345), + typeof AbortController !== 'undefined' ? AbortController : __webpack_require__(43295) +); + +module.exports = {Logger}; + + +/***/ }), + +/***/ 77897: +/***/ ((module) => { + +"use strict"; + + +module.exports = function (safeGlobalBlob, safeGlobalFetch, safeGlobalAbortController) { + const HEADER = '{"Events":['; + const FOOTER = "]}"; + const HEADER_FOOTER_BYTES = (new safeGlobalBlob([HEADER])).size + (new safeGlobalBlob([FOOTER])).size; + + class SeqLogger { + constructor(config) { + let dflt = { + serverUrl: 'http://localhost:5341', + apiKey: null, + maxBatchingTime: 2000, + eventSizeLimit: 256 * 1024, + batchSizeLimit: 1024 * 1024, + requestTimeout: 30000, + maxRetries: 5, + retryDelay: 5000, + onError: e => { + console.error("[seq]", e); + } + }; + let cfg = config || dflt; + var serverUrl = cfg.serverUrl || dflt.serverUrl; + if (!serverUrl.endsWith('/')) { + serverUrl += '/'; + } + this._endpoint = serverUrl + 'api/events/raw'; + this._apiKey = cfg.apiKey || dflt.apiKey; + this._maxBatchingTime = cfg.maxBatchingTime || dflt.maxBatchingTime; + this._eventSizeLimit = cfg.eventSizeLimit || dflt.eventSizeLimit; + this._batchSizeLimit = cfg.batchSizeLimit || dflt.batchSizeLimit; + this._requestTimeout = cfg.requestTimeout || dflt.requestTimeout; + this._onError = cfg.onError || dflt.onError; + this._maxRetries = cfg.maxRetries || dflt.maxRetries; + this._retryDelay = cfg.retryDelay || dflt.retryDelay; + + this._queue = []; + this._timer = null; + this._closed = false; + this._activeShipper = null; + } + + /** + * Flush events queued at the time of the call, and wait for pending writes to complete regardless of configured batching/timers. + * @returns {Promise} + */ + flush() { + return this._ship(); + } + + /** + * Flush then destroy connections, close the logger, destroying timers and other resources. + * @returns {Promise} + */ + close() { + if (this._closed) { + throw new Error('The logger has already been closed.'); + } + + this._closed = true; + this._clearTimer(); + return this.flush(); + } + + /** + * Enqueue an event in Seq format. + * @param {*} event + * @returns {void} + */ + emit(event) { + if (!event) { + throw new Error('An event must be provided'); + } + if (this._closed) { + return; + } + let norm = this._toWireFormat(event); + this._queue.push(norm); + if (!this._activeShipper) { + this._setTimer(); + } + } + + _setTimer() { + if (this._timer !== null) { + return; + } + + this._timer = setTimeout(() => { + this._timer = null; + this._onTimer(); + }, this._maxBatchingTime); + } + + _clearTimer() { + if (this._timer !== null) { + clearTimeout(this._timer); + this._timer = null; + } + } + + _onTimer() { + if (!this._activeShipper) { + this._ship(); + } + } + + _toWireFormat(event) { + const level = typeof event.level === 'string' ? event.level : undefined; + const timestamp = event.timestamp instanceof Date ? event.timestamp : new Date(); + const messageTemplate = typeof event.messageTemplate === 'string' ? event.messageTemplate : + event.messageTemplate !== null && event.messageTemplate !== undefined ? event.messageTemplate.toString() : "(No message provided)"; + const exception = typeof event.exception === 'string' ? event.exception : + event.exception !== null && event.exception !== undefined ? event.exception.toString() : undefined; + const properties = typeof event.properties === 'object' ? event.properties : undefined; + return { + Timestamp: timestamp, + Level: level, + TraceId: event.traceId?.toString(), + SpanId: event.spanId?.toString(), + MessageTemplate: messageTemplate, + Exception: exception, + Properties: properties + }; + } + + _eventTooLargeErrorEvent(event) { + return { + Timestamp: event.Timestamp, + Level: event.Level, + MessageTemplate: "(Event too large) {initial}...", + Properties: { + initial: event.MessageTemplate.substring(0, 12), + sourceContext: "Seq Javascript Client", + eventSizeLimit: this._eventSizeLimit + } + }; + } + + _reset(shipper) { + if (this._activeShipper === shipper) { + this._activeShipper = null; + if (this._queue.length !== 0) { + this._setTimer(); + } + } + } + + /** + * + * @returns {Promise} + */ + _ship() { + if (this._queue.length === 0) { + return Promise.resolve(false); + } + + let wait = this._activeShipper || Promise.resolve(false); + let shipper = this._activeShipper = wait + .then(() => { + let more = drained => { + if (drained) { + // If the queue was drained, let the timer + // push us forwards. + return true; + } + return this._sendBatch().then(d => more(d)); + } + return this._sendBatch().then(drained => more(drained)); + }) + .then(() => this._reset(shipper), e => { + this._onError(e); + this._reset(shipper); + }); + + return shipper; + } + + _sendBatch() { + if (this._queue.length === 0) { + return Promise.resolve(true); + } + + let dequeued = this._dequeBatch(); + let drained = this._queue.length === 0; + return this._post(dequeued.batch, dequeued.bytes).then(() => drained); + } + + _dequeBatch() { + var bytes = HEADER_FOOTER_BYTES; + let batch = []; + var i = 0; + var delimSize = 0; + while (i < this._queue.length) { + let next = this._queue[i]; + let json; + try { + json = JSON.stringify(next); + } catch (e) { + const cleaned = removeCirculars(next); + json = JSON.stringify(cleaned); + // Log that this event to be able to detect circular structures + // using same timestamp as cleaned event to make finding it easier + this.emit({ + timestamp: cleaned.Timestamp, + level: "Error", + messageTemplate: "[seq] Circular structure found" + }); + } + var jsonLen = new safeGlobalBlob([json]).size; + if (jsonLen > this._eventSizeLimit) { + this._onError("[seq] Event body is larger than " + this._eventSizeLimit + " bytes: " + json); + this._queue[i] = next = this._eventTooLargeErrorEvent(next); + json = JSON.stringify(next); + jsonLen = new safeGlobalBlob([json]).size; + } + + // Always try to send a batch of at least one event, even if the batch size is + // tiny. + if (i !== 0 && bytes + jsonLen + delimSize > this._batchSizeLimit) { + break; + } + + i = i + 1; + bytes += jsonLen + delimSize; + delimSize = 1; // "," + batch.push(json); + } + + this._queue.splice(0, i); + return {batch, bytes}; + } + + _httpOrNetworkError(res) { + const networkErrors = ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN', 'EBUSY']; + return networkErrors.includes(res) || 500 <= res.status && res.status < 600; + } + + _post(batch, bytes) { + let attempts = 0; + + return new Promise((resolve, reject) => { + const sendRequest = (batch, bytes) => { + const controller = new safeGlobalAbortController(); + attempts++; + const timerId = setTimeout(() => { + controller.abort(); + if (attempts > this._maxRetries) { + reject('HTTP log shipping failed, reached timeout (' + this._requestTimeout + ' ms)'); + } else { + setTimeout(() => sendRequest(batch, bytes), this._retryDelay); + } + }, this._requestTimeout); + + safeGlobalFetch(this._endpoint, { + keepalive: true, + method: "POST", + headers: { + "Content-Type": "application/json", + "X-Seq-ApiKey": this._apiKey ? this._apiKey : null, + "Content-Length": bytes, + }, + body: `${HEADER}${batch.join(',')}${FOOTER}`, + signal: controller.signal, + }) + .then((res) => { + clearTimeout(timerId); + let httpErr = null; + if (res.status !== 200 && res.status !== 201) { + httpErr = 'HTTP log shipping failed: ' + res.status; + if (this._httpOrNetworkError(res) && attempts < this._maxRetries) { + return setTimeout(() => sendRequest(batch, bytes), this._retryDelay); + } + return reject(httpErr); + } + return resolve(true); + }) + .catch((err) => { + clearTimeout(timerId); + reject(err); + }) + } + + return sendRequest(batch, bytes); + }); + } + } + + + return SeqLogger; +}; + +const isValue = (obj) => { + if (!obj) return true; + if (typeof obj !== "object") return true; + return false; +}; + +const removeCirculars = (obj, branch = new Map(), path = "root") => { + if (isValue(obj)) return obj; + if (branch.has(obj)) { + // In seq it is more clear if we remove the root.Properties object path + const circularPath = branch.get(obj).replace("root.Properties.", ""); + return "== Circular structure: '" + circularPath + "' =="; + } else { + branch.set(obj, path); + } + + if (obj instanceof Array) { + return obj.map((value, i) => + isValue(value) ? value : removeCirculars(value, new Map(branch), path + `[${i}]`) + ); + } + const keys = Object.keys(obj); + // Will rescue Date and other classes. + if (keys.length === 0) { + return obj; + } + const replaced = {}; + keys.forEach((key) => { + const value = obj[key]; + if (isValue(value)) { + replaced[key] = value; + return; + } + replaced[key] = removeCirculars(value, new Map(branch), path + "." + key); + }); + return replaced; +}; + + +/***/ }), + +/***/ 67322: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = __webpack_require__(79272)('node_sqlite3.node'); + + +/***/ }), + +/***/ 45430: +/***/ ((module, exports, __webpack_require__) => { + +const path = __webpack_require__(16928); +const sqlite3 = __webpack_require__(67322); +const EventEmitter = (__webpack_require__(24434).EventEmitter); +module.exports = exports = sqlite3; + +function normalizeMethod (fn) { + return function (sql) { + let errBack; + const args = Array.prototype.slice.call(arguments, 1); + + if (typeof args[args.length - 1] === 'function') { + const callback = args[args.length - 1]; + errBack = function(err) { + if (err) { + callback(err); + } + }; + } + const statement = new Statement(this, sql, errBack); + return fn.call(this, statement, args); + }; +} + +function inherits(target, source) { + for (const k in source.prototype) + target.prototype[k] = source.prototype[k]; +} + +sqlite3.cached = { + Database: function(file, a, b) { + if (file === '' || file === ':memory:') { + // Don't cache special databases. + return new Database(file, a, b); + } + + let db; + file = path.resolve(file); + + if (!sqlite3.cached.objects[file]) { + db = sqlite3.cached.objects[file] = new Database(file, a, b); + } + else { + // Make sure the callback is called. + db = sqlite3.cached.objects[file]; + const callback = (typeof a === 'number') ? b : a; + if (typeof callback === 'function') { + function cb() { callback.call(db, null); } + if (db.open) process.nextTick(cb); + else db.once('open', cb); + } + } + + return db; + }, + objects: {} +}; + + +const Database = sqlite3.Database; +const Statement = sqlite3.Statement; +const Backup = sqlite3.Backup; + +inherits(Database, EventEmitter); +inherits(Statement, EventEmitter); +inherits(Backup, EventEmitter); + +// Database#prepare(sql, [bind1, bind2, ...], [callback]) +Database.prototype.prepare = normalizeMethod(function(statement, params) { + return params.length + ? statement.bind.apply(statement, params) + : statement; +}); + +// Database#run(sql, [bind1, bind2, ...], [callback]) +Database.prototype.run = normalizeMethod(function(statement, params) { + statement.run.apply(statement, params).finalize(); + return this; +}); + +// Database#get(sql, [bind1, bind2, ...], [callback]) +Database.prototype.get = normalizeMethod(function(statement, params) { + statement.get.apply(statement, params).finalize(); + return this; +}); + +// Database#all(sql, [bind1, bind2, ...], [callback]) +Database.prototype.all = normalizeMethod(function(statement, params) { + statement.all.apply(statement, params).finalize(); + return this; +}); + +// Database#each(sql, [bind1, bind2, ...], [callback], [complete]) +Database.prototype.each = normalizeMethod(function(statement, params) { + statement.each.apply(statement, params).finalize(); + return this; +}); + +Database.prototype.map = normalizeMethod(function(statement, params) { + statement.map.apply(statement, params).finalize(); + return this; +}); + +// Database#backup(filename, [callback]) +// Database#backup(filename, destName, sourceName, filenameIsDest, [callback]) +Database.prototype.backup = function() { + let backup; + if (arguments.length <= 2) { + // By default, we write the main database out to the main database of the named file. + // This is the most likely use of the backup api. + backup = new Backup(this, arguments[0], 'main', 'main', true, arguments[1]); + } else { + // Otherwise, give the user full control over the sqlite3_backup_init arguments. + backup = new Backup(this, arguments[0], arguments[1], arguments[2], arguments[3], arguments[4]); + } + // Per the sqlite docs, exclude the following errors as non-fatal by default. + backup.retryErrors = [sqlite3.BUSY, sqlite3.LOCKED]; + return backup; +}; + +Statement.prototype.map = function() { + const params = Array.prototype.slice.call(arguments); + const callback = params.pop(); + params.push(function(err, rows) { + if (err) return callback(err); + const result = {}; + if (rows.length) { + const keys = Object.keys(rows[0]); + const key = keys[0]; + if (keys.length > 2) { + // Value is an object + for (let i = 0; i < rows.length; i++) { + result[rows[i][key]] = rows[i]; + } + } else { + const value = keys[1]; + // Value is a plain value + for (let i = 0; i < rows.length; i++) { + result[rows[i][key]] = rows[i][value]; + } + } + } + callback(err, result); + }); + return this.all.apply(this, params); +}; + +let isVerbose = false; + +const supportedEvents = [ 'trace', 'profile', 'change' ]; + +Database.prototype.addListener = Database.prototype.on = function(type) { + const val = EventEmitter.prototype.addListener.apply(this, arguments); + if (supportedEvents.indexOf(type) >= 0) { + this.configure(type, true); + } + return val; +}; + +Database.prototype.removeListener = function(type) { + const val = EventEmitter.prototype.removeListener.apply(this, arguments); + if (supportedEvents.indexOf(type) >= 0 && !this._events[type]) { + this.configure(type, false); + } + return val; +}; + +Database.prototype.removeAllListeners = function(type) { + const val = EventEmitter.prototype.removeAllListeners.apply(this, arguments); + if (supportedEvents.indexOf(type) >= 0) { + this.configure(type, false); + } + return val; +}; + +// Save the stack trace over EIO callbacks. +sqlite3.verbose = function() { + if (!isVerbose) { + const trace = __webpack_require__(60738); + [ + 'prepare', + 'get', + 'run', + 'all', + 'each', + 'map', + 'close', + 'exec' + ].forEach(function (name) { + trace.extendTrace(Database.prototype, name); + }); + [ + 'bind', + 'get', + 'run', + 'all', + 'each', + 'map', + 'reset', + 'finalize', + ].forEach(function (name) { + trace.extendTrace(Statement.prototype, name); + }); + isVerbose = true; + } + + return sqlite3; +}; + + +/***/ }), + +/***/ 60738: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +// Inspired by https://github.com/tlrobinson/long-stack-traces +const util = __webpack_require__(39023); + +function extendTrace(object, property, pos) { + const old = object[property]; + object[property] = function() { + const error = new Error(); + const name = object.constructor.name + '#' + property + '(' + + Array.prototype.slice.call(arguments).map(function(el) { + return util.inspect(el, false, 0); + }).join(', ') + ')'; + + if (typeof pos === 'undefined') pos = -1; + if (pos < 0) pos += arguments.length; + const cb = arguments[pos]; + if (typeof arguments[pos] === 'function') { + arguments[pos] = function replacement() { + const err = arguments[0]; + if (err && err.stack && !err.__augmented) { + err.stack = filter(err).join('\n'); + err.stack += '\n--> in ' + name; + err.stack += '\n' + filter(error).slice(1).join('\n'); + err.__augmented = true; + } + return cb.apply(this, arguments); + }; + } + return old.apply(this, arguments); + }; +} +exports.extendTrace = extendTrace; + + +function filter(error) { + return error.stack.split('\n').filter(function(line) { + return line.indexOf(__filename) < 0; + }); +} + + +/***/ }), + +/***/ 91370: +/***/ ((__unused_webpack_module, exports) => { + +exports.get = function(belowFn) { + var oldLimit = Error.stackTraceLimit; + Error.stackTraceLimit = Infinity; + + var dummyObject = {}; + + var v8Handler = Error.prepareStackTrace; + Error.prepareStackTrace = function(dummyObject, v8StackTrace) { + return v8StackTrace; + }; + Error.captureStackTrace(dummyObject, belowFn || exports.get); + + var v8StackTrace = dummyObject.stack; + Error.prepareStackTrace = v8Handler; + Error.stackTraceLimit = oldLimit; + + return v8StackTrace; +}; + +exports.parse = function(err) { + if (!err.stack) { + return []; + } + + var self = this; + var lines = err.stack.split('\n').slice(1); + + return lines + .map(function(line) { + if (line.match(/^\s*[-]{4,}$/)) { + return self._createParsedCallSite({ + fileName: line, + lineNumber: null, + functionName: null, + typeName: null, + methodName: null, + columnNumber: null, + 'native': null, + }); + } + + var lineMatch = line.match(/at (?:(.+)\s+\()?(?:(.+?):(\d+)(?::(\d+))?|([^)]+))\)?/); + if (!lineMatch) { + return; + } + + var object = null; + var method = null; + var functionName = null; + var typeName = null; + var methodName = null; + var isNative = (lineMatch[5] === 'native'); + + if (lineMatch[1]) { + functionName = lineMatch[1]; + var methodStart = functionName.lastIndexOf('.'); + if (functionName[methodStart-1] == '.') + methodStart--; + if (methodStart > 0) { + object = functionName.substr(0, methodStart); + method = functionName.substr(methodStart + 1); + var objectEnd = object.indexOf('.Module'); + if (objectEnd > 0) { + functionName = functionName.substr(objectEnd + 1); + object = object.substr(0, objectEnd); + } + } + typeName = null; + } + + if (method) { + typeName = object; + methodName = method; + } + + if (method === '') { + methodName = null; + functionName = null; + } + + var properties = { + fileName: lineMatch[2] || null, + lineNumber: parseInt(lineMatch[3], 10) || null, + functionName: functionName, + typeName: typeName, + methodName: methodName, + columnNumber: parseInt(lineMatch[4], 10) || null, + 'native': isNative, + }; + + return self._createParsedCallSite(properties); + }) + .filter(function(callSite) { + return !!callSite; + }); +}; + +function CallSite(properties) { + for (var property in properties) { + this[property] = properties[property]; + } +} + +var strProperties = [ + 'this', + 'typeName', + 'functionName', + 'methodName', + 'fileName', + 'lineNumber', + 'columnNumber', + 'function', + 'evalOrigin' +]; +var boolProperties = [ + 'topLevel', + 'eval', + 'native', + 'constructor' +]; +strProperties.forEach(function (property) { + CallSite.prototype[property] = null; + CallSite.prototype['get' + property[0].toUpperCase() + property.substr(1)] = function () { + return this[property]; + } +}); +boolProperties.forEach(function (property) { + CallSite.prototype[property] = false; + CallSite.prototype['is' + property[0].toUpperCase() + property.substr(1)] = function () { + return this[property]; + } +}); + +exports._createParsedCallSite = function(properties) { + return new CallSite(properties); +}; + + +/***/ }), + +/***/ 58184: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = (__webpack_require__(50980).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.I = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 94662: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/*! + * Tmp + * + * Copyright (c) 2011-2017 KARASZI Istvan + * + * MIT Licensed + */ + +/* + * Module dependencies. + */ +const fs = __webpack_require__(79896); +const path = __webpack_require__(16928); +const crypto = __webpack_require__(76982); +const osTmpDir = __webpack_require__(69711); +const _c = process.binding('constants'); + +/* + * The working inner variables. + */ +const + /** + * The temporary directory. + * @type {string} + */ + tmpDir = osTmpDir(), + + // the random characters to choose from + RANDOM_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz', + + TEMPLATE_PATTERN = /XXXXXX/, + + DEFAULT_TRIES = 3, + + CREATE_FLAGS = (_c.O_CREAT || _c.fs.O_CREAT) | (_c.O_EXCL || _c.fs.O_EXCL) | (_c.O_RDWR || _c.fs.O_RDWR), + + EBADF = _c.EBADF || _c.os.errno.EBADF, + ENOENT = _c.ENOENT || _c.os.errno.ENOENT, + + DIR_MODE = 448 /* 0o700 */, + FILE_MODE = 384 /* 0o600 */, + + // this will hold the objects need to be removed on exit + _removeObjects = []; + +var + _gracefulCleanup = false, + _uncaughtException = false; + +/** + * Random name generator based on crypto. + * Adapted from http://blog.tompawlak.org/how-to-generate-random-values-nodejs-javascript + * + * @param {number} howMany + * @returns {string} the generated random name + * @private + */ +function _randomChars(howMany) { + var + value = [], + rnd = null; + + // make sure that we do not fail because we ran out of entropy + try { + rnd = crypto.randomBytes(howMany); + } catch (e) { + rnd = crypto.pseudoRandomBytes(howMany); + } + + for (var i = 0; i < howMany; i++) { + value.push(RANDOM_CHARS[rnd[i] % RANDOM_CHARS.length]); + } + + return value.join(''); +} + +/** + * Checks whether the `obj` parameter is defined or not. + * + * @param {Object} obj + * @returns {boolean} true if the object is undefined + * @private + */ +function _isUndefined(obj) { + return typeof obj === 'undefined'; +} + +/** + * Parses the function arguments. + * + * This function helps to have optional arguments. + * + * @param {(Options|Function)} options + * @param {Function} callback + * @returns {Array} parsed arguments + * @private + */ +function _parseArguments(options, callback) { + if (typeof options == 'function') { + return [callback || {}, options]; + } + + if (_isUndefined(options)) { + return [{}, callback]; + } + + return [options, callback]; +} + +/** + * Generates a new temporary name. + * + * @param {Object} opts + * @returns {string} the new random name according to opts + * @private + */ +function _generateTmpName(opts) { + if (opts.name) { + return path.join(opts.dir || tmpDir, opts.name); + } + + // mkstemps like template + if (opts.template) { + return opts.template.replace(TEMPLATE_PATTERN, _randomChars(6)); + } + + // prefix and postfix + const name = [ + opts.prefix || 'tmp-', + process.pid, + _randomChars(12), + opts.postfix || '' + ].join(''); + + return path.join(opts.dir || tmpDir, name); +} + +/** + * Gets a temporary file name. + * + * @param {(Options|tmpNameCallback)} options options or callback + * @param {?tmpNameCallback} callback the callback function + */ +function tmpName(options, callback) { + var + args = _parseArguments(options, callback), + opts = args[0], + cb = args[1], + tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES; + + if (isNaN(tries) || tries < 0) + return cb(new Error('Invalid tries')); + + if (opts.template && !opts.template.match(TEMPLATE_PATTERN)) + return cb(new Error('Invalid template provided')); + + (function _getUniqueName() { + const name = _generateTmpName(opts); + + // check whether the path exists then retry if needed + fs.stat(name, function (err) { + if (!err) { + if (tries-- > 0) return _getUniqueName(); + + return cb(new Error('Could not get a unique tmp filename, max tries reached ' + name)); + } + + cb(null, name); + }); + }()); +} + +/** + * Synchronous version of tmpName. + * + * @param {Object} options + * @returns {string} the generated random name + * @throws {Error} if the options are invalid or could not generate a filename + */ +function tmpNameSync(options) { + var + args = _parseArguments(options), + opts = args[0], + tries = opts.name ? 1 : opts.tries || DEFAULT_TRIES; + + if (isNaN(tries) || tries < 0) + throw new Error('Invalid tries'); + + if (opts.template && !opts.template.match(TEMPLATE_PATTERN)) + throw new Error('Invalid template provided'); + + do { + const name = _generateTmpName(opts); + try { + fs.statSync(name); + } catch (e) { + return name; + } + } while (tries-- > 0); + + throw new Error('Could not get a unique tmp filename, max tries reached'); +} + +/** + * Creates and opens a temporary file. + * + * @param {(Options|fileCallback)} options the config options or the callback function + * @param {?fileCallback} callback + */ +function file(options, callback) { + var + args = _parseArguments(options, callback), + opts = args[0], + cb = args[1]; + + opts.postfix = (_isUndefined(opts.postfix)) ? '.tmp' : opts.postfix; + + // gets a temporary filename + tmpName(opts, function _tmpNameCreated(err, name) { + if (err) return cb(err); + + // create and open the file + fs.open(name, CREATE_FLAGS, opts.mode || FILE_MODE, function _fileCreated(err, fd) { + if (err) return cb(err); + + if (opts.discardDescriptor) { + return fs.close(fd, function _discardCallback(err) { + if (err) { + // Low probability, and the file exists, so this could be + // ignored. If it isn't we certainly need to unlink the + // file, and if that fails too its error is more + // important. + try { + fs.unlinkSync(name); + } catch (e) { + if (!isENOENT(e)) { + err = e; + } + } + return cb(err); + } + cb(null, name, undefined, _prepareTmpFileRemoveCallback(name, -1, opts)); + }); + } + if (opts.detachDescriptor) { + return cb(null, name, fd, _prepareTmpFileRemoveCallback(name, -1, opts)); + } + cb(null, name, fd, _prepareTmpFileRemoveCallback(name, fd, opts)); + }); + }); +} + +/** + * Synchronous version of file. + * + * @param {Options} options + * @returns {FileSyncObject} object consists of name, fd and removeCallback + * @throws {Error} if cannot create a file + */ +function fileSync(options) { + var + args = _parseArguments(options), + opts = args[0]; + + opts.postfix = opts.postfix || '.tmp'; + + const discardOrDetachDescriptor = opts.discardDescriptor || opts.detachDescriptor; + const name = tmpNameSync(opts); + var fd = fs.openSync(name, CREATE_FLAGS, opts.mode || FILE_MODE); + if (opts.discardDescriptor) { + fs.closeSync(fd); + fd = undefined; + } + + return { + name: name, + fd: fd, + removeCallback: _prepareTmpFileRemoveCallback(name, discardOrDetachDescriptor ? -1 : fd, opts) + }; +} + +/** + * Removes files and folders in a directory recursively. + * + * @param {string} root + * @private + */ +function _rmdirRecursiveSync(root) { + const dirs = [root]; + + do { + var + dir = dirs.pop(), + deferred = false, + files = fs.readdirSync(dir); + + for (var i = 0, length = files.length; i < length; i++) { + var + file = path.join(dir, files[i]), + stat = fs.lstatSync(file); // lstat so we don't recurse into symlinked directories + + if (stat.isDirectory()) { + if (!deferred) { + deferred = true; + dirs.push(dir); + } + dirs.push(file); + } else { + fs.unlinkSync(file); + } + } + + if (!deferred) { + fs.rmdirSync(dir); + } + } while (dirs.length !== 0); +} + +/** + * Creates a temporary directory. + * + * @param {(Options|dirCallback)} options the options or the callback function + * @param {?dirCallback} callback + */ +function dir(options, callback) { + var + args = _parseArguments(options, callback), + opts = args[0], + cb = args[1]; + + // gets a temporary filename + tmpName(opts, function _tmpNameCreated(err, name) { + if (err) return cb(err); + + // create the directory + fs.mkdir(name, opts.mode || DIR_MODE, function _dirCreated(err) { + if (err) return cb(err); + + cb(null, name, _prepareTmpDirRemoveCallback(name, opts)); + }); + }); +} + +/** + * Synchronous version of dir. + * + * @param {Options} options + * @returns {DirSyncObject} object consists of name and removeCallback + * @throws {Error} if it cannot create a directory + */ +function dirSync(options) { + var + args = _parseArguments(options), + opts = args[0]; + + const name = tmpNameSync(opts); + fs.mkdirSync(name, opts.mode || DIR_MODE); + + return { + name: name, + removeCallback: _prepareTmpDirRemoveCallback(name, opts) + }; +} + +/** + * Prepares the callback for removal of the temporary file. + * + * @param {string} name the path of the file + * @param {number} fd file descriptor + * @param {Object} opts + * @returns {fileCallback} + * @private + */ +function _prepareTmpFileRemoveCallback(name, fd, opts) { + const removeCallback = _prepareRemoveCallback(function _removeCallback(fdPath) { + try { + if (0 <= fdPath[0]) { + fs.closeSync(fdPath[0]); + } + } + catch (e) { + // under some node/windows related circumstances, a temporary file + // may have not be created as expected or the file was already closed + // by the user, in which case we will simply ignore the error + if (!isEBADF(e) && !isENOENT(e)) { + // reraise any unanticipated error + throw e; + } + } + try { + fs.unlinkSync(fdPath[1]); + } + catch (e) { + if (!isENOENT(e)) { + // reraise any unanticipated error + throw e; + } + } + }, [fd, name]); + + if (!opts.keep) { + _removeObjects.unshift(removeCallback); + } + + return removeCallback; +} + +/** + * Prepares the callback for removal of the temporary directory. + * + * @param {string} name + * @param {Object} opts + * @returns {Function} the callback + * @private + */ +function _prepareTmpDirRemoveCallback(name, opts) { + const removeFunction = opts.unsafeCleanup ? _rmdirRecursiveSync : fs.rmdirSync.bind(fs); + const removeCallback = _prepareRemoveCallback(removeFunction, name); + + if (!opts.keep) { + _removeObjects.unshift(removeCallback); + } + + return removeCallback; +} + +/** + * Creates a guarded function wrapping the removeFunction call. + * + * @param {Function} removeFunction + * @param {Object} arg + * @returns {Function} + * @private + */ +function _prepareRemoveCallback(removeFunction, arg) { + var called = false; + + return function _cleanupCallback(next) { + if (!called) { + const index = _removeObjects.indexOf(_cleanupCallback); + if (index >= 0) { + _removeObjects.splice(index, 1); + } + + called = true; + removeFunction(arg); + } + + if (next) next(null); + }; +} + +/** + * The garbage collector. + * + * @private + */ +function _garbageCollector() { + if (_uncaughtException && !_gracefulCleanup) { + return; + } + + // the function being called removes itself from _removeObjects, + // loop until _removeObjects is empty + while (_removeObjects.length) { + try { + _removeObjects[0].call(null); + } catch (e) { + // already removed? + } + } +} + +/** + * Helper for testing against EBADF to compensate changes made to Node 7.x under Windows. + */ +function isEBADF(error) { + return isExpectedError(error, -EBADF, 'EBADF'); +} + +/** + * Helper for testing against ENOENT to compensate changes made to Node 7.x under Windows. + */ +function isENOENT(error) { + return isExpectedError(error, -ENOENT, 'ENOENT'); +} + +/** + * Helper to determine whether the expected error code matches the actual code and errno, + * which will differ between the supported node versions. + * + * - Node >= 7.0: + * error.code {String} + * error.errno {String|Number} any numerical value will be negated + * + * - Node >= 6.0 < 7.0: + * error.code {String} + * error.errno {Number} negated + * + * - Node >= 4.0 < 6.0: introduces SystemError + * error.code {String} + * error.errno {Number} negated + * + * - Node >= 0.10 < 4.0: + * error.code {Number} negated + * error.errno n/a + */ +function isExpectedError(error, code, errno) { + return error.code == code || error.code == errno; +} + +/** + * Sets the graceful cleanup. + * + * Also removes the created files and directories when an uncaught exception occurs. + */ +function setGracefulCleanup() { + _gracefulCleanup = true; +} + +const version = process.versions.node.split('.').map(function (value) { + return parseInt(value, 10); +}); + +if (version[0] === 0 && (version[1] < 9 || version[1] === 9 && version[2] < 5)) { + process.addListener('uncaughtException', function _uncaughtExceptionThrown(err) { + _uncaughtException = true; + _garbageCollector(); + + throw err; + }); +} + +process.addListener('exit', function _exit(code) { + if (code) _uncaughtException = true; + _garbageCollector(); +}); + +/** + * Configuration options. + * + * @typedef {Object} Options + * @property {?number} tries the number of tries before give up the name generation + * @property {?string} template the "mkstemp" like filename template + * @property {?string} name fix name + * @property {?string} dir the tmp directory to use + * @property {?string} prefix prefix for the generated name + * @property {?string} postfix postfix for the generated name + */ + +/** + * @typedef {Object} FileSyncObject + * @property {string} name the name of the file + * @property {string} fd the file descriptor + * @property {fileCallback} removeCallback the callback function to remove the file + */ + +/** + * @typedef {Object} DirSyncObject + * @property {string} name the name of the directory + * @property {fileCallback} removeCallback the callback function to remove the directory + */ + +/** + * @callback tmpNameCallback + * @param {?Error} err the error object if anything goes wrong + * @param {string} name the temporary file name + */ + +/** + * @callback fileCallback + * @param {?Error} err the error object if anything goes wrong + * @param {string} name the temporary file name + * @param {number} fd the file descriptor + * @param {cleanupCallback} fn the cleanup callback function + */ + +/** + * @callback dirCallback + * @param {?Error} err the error object if anything goes wrong + * @param {string} name the temporary file name + * @param {cleanupCallback} fn the cleanup callback function + */ + +/** + * Removes the temporary created file or directory. + * + * @callback cleanupCallback + * @param {simpleCallback} [next] function to call after entry was removed + */ + +/** + * Callback function for function composition. + * @see {@link https://github.com/raszi/node-tmp/issues/57|raszi/node-tmp#57} + * + * @callback simpleCallback + */ + +// exporting all the needed methods +module.exports.tmpdir = tmpDir; + +module.exports.dir = dir; +module.exports.dirSync = dirSync; + +module.exports.file = file; +module.exports.fileSync = fileSync; + +module.exports.tmpName = tmpName; +module.exports.tmpNameSync = tmpNameSync; + +module.exports.setGracefulCleanup = setGracefulCleanup; + + +/***/ }), + +/***/ 69423: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/** + * cli.js: Config that conform to commonly used CLI logging levels. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +/** + * Default levels for the CLI configuration. + * @type {Object} + */ +exports.levels = { + error: 0, + warn: 1, + help: 2, + data: 3, + info: 4, + debug: 5, + prompt: 6, + verbose: 7, + input: 8, + silly: 9 +}; + +/** + * Default colors for the CLI configuration. + * @type {Object} + */ +exports.colors = { + error: 'red', + warn: 'yellow', + help: 'cyan', + data: 'grey', + info: 'green', + debug: 'blue', + prompt: 'grey', + verbose: 'cyan', + input: 'grey', + silly: 'magenta' +}; + + +/***/ }), + +/***/ 27773: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/** + * index.js: Default settings for all levels that winston knows about. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +/** + * Export config set for the CLI. + * @type {Object} + */ +Object.defineProperty(exports, "cli", ({ + value: __webpack_require__(69423) +})); + +/** + * Export config set for npm. + * @type {Object} + */ +Object.defineProperty(exports, "npm", ({ + value: __webpack_require__(6228) +})); + +/** + * Export config set for the syslog. + * @type {Object} + */ +Object.defineProperty(exports, "syslog", ({ + value: __webpack_require__(13600) +})); + + +/***/ }), + +/***/ 6228: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/** + * npm.js: Config that conform to npm logging levels. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +/** + * Default levels for the npm configuration. + * @type {Object} + */ +exports.levels = { + error: 0, + warn: 1, + info: 2, + http: 3, + verbose: 4, + debug: 5, + silly: 6 +}; + +/** + * Default levels for the npm configuration. + * @type {Object} + */ +exports.colors = { + error: 'red', + warn: 'yellow', + info: 'green', + http: 'green', + verbose: 'cyan', + debug: 'blue', + silly: 'magenta' +}; + + +/***/ }), + +/***/ 13600: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; +/** + * syslog.js: Config that conform to syslog logging levels. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +/** + * Default levels for the syslog configuration. + * @type {Object} + */ +exports.levels = { + emerg: 0, + alert: 1, + crit: 2, + error: 3, + warning: 4, + notice: 5, + info: 6, + debug: 7 +}; + +/** + * Default levels for the syslog configuration. + * @type {Object} + */ +exports.colors = { + emerg: 'red', + alert: 'yellow', + crit: 'red', + error: 'red', + warning: 'red', + notice: 'yellow', + info: 'green', + debug: 'blue' +}; + + +/***/ }), + +/***/ 80310: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +/** + * A shareable symbol constant that can be used + * as a non-enumerable / semi-hidden level identifier + * to allow the readable level property to be mutable for + * operations like colorization + * + * @type {Symbol} + */ +Object.defineProperty(exports, "LEVEL", ({ + value: Symbol.for('level') +})); + +/** + * A shareable symbol constant that can be used + * as a non-enumerable / semi-hidden message identifier + * to allow the final message property to not have + * side effects on another. + * + * @type {Symbol} + */ +Object.defineProperty(exports, "MESSAGE", ({ + value: Symbol.for('message') +})); + +/** + * A shareable symbol constant that can be used + * as a non-enumerable / semi-hidden message identifier + * to allow the extracted splat property be hidden + * + * @type {Symbol} + */ +Object.defineProperty(exports, "SPLAT", ({ + value: Symbol.for('splat') +})); + +/** + * A shareable object constant that can be used + * as a standard configuration for winston@3. + * + * @type {Object} + */ +Object.defineProperty(exports, "configs", ({ + value: __webpack_require__(27773) +})); + + +/***/ }), + +/***/ 32926: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = __webpack_require__(39023).deprecate; + + +/***/ }), + +/***/ 86558: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +// Expose modern transport directly as the export +module.exports = __webpack_require__(29903); + +// Expose legacy stream +module.exports.LegacyTransportStream = __webpack_require__(26103); + + +/***/ }), + +/***/ 26103: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const util = __webpack_require__(39023); +const { LEVEL } = __webpack_require__(80310); +const TransportStream = __webpack_require__(29903); + +/** + * Constructor function for the LegacyTransportStream. This is an internal + * wrapper `winston >= 3` uses to wrap older transports implementing + * log(level, message, meta). + * @param {Object} options - Options for this TransportStream instance. + * @param {Transpot} options.transport - winston@2 or older Transport to wrap. + */ + +const LegacyTransportStream = module.exports = function LegacyTransportStream(options = {}) { + TransportStream.call(this, options); + if (!options.transport || typeof options.transport.log !== 'function') { + throw new Error('Invalid transport, must be an object with a log method.'); + } + + this.transport = options.transport; + this.level = this.level || options.transport.level; + this.handleExceptions = this.handleExceptions || options.transport.handleExceptions; + + // Display our deprecation notice. + this._deprecated(); + + // Properly bubble up errors from the transport to the + // LegacyTransportStream instance, but only once no matter how many times + // this transport is shared. + function transportError(err) { + this.emit('error', err, this.transport); + } + + if (!this.transport.__winstonError) { + this.transport.__winstonError = transportError.bind(this); + this.transport.on('error', this.transport.__winstonError); + } +}; + +/* + * Inherit from TransportStream using Node.js built-ins + */ +util.inherits(LegacyTransportStream, TransportStream); + +/** + * Writes the info object to our transport instance. + * @param {mixed} info - TODO: add param description. + * @param {mixed} enc - TODO: add param description. + * @param {function} callback - TODO: add param description. + * @returns {undefined} + * @private + */ +LegacyTransportStream.prototype._write = function _write(info, enc, callback) { + if (this.silent || (info.exception === true && !this.handleExceptions)) { + return callback(null); + } + + // Remark: This has to be handled in the base transport now because we + // cannot conditionally write to our pipe targets as stream. + if (!this.level || this.levels[this.level] >= this.levels[info[LEVEL]]) { + this.transport.log(info[LEVEL], info.message, info, this._nop); + } + + callback(null); +}; + +/** + * Writes the batch of info objects (i.e. "object chunks") to our transport + * instance after performing any necessary filtering. + * @param {mixed} chunks - TODO: add params description. + * @param {function} callback - TODO: add params description. + * @returns {mixed} - TODO: add returns description. + * @private + */ +LegacyTransportStream.prototype._writev = function _writev(chunks, callback) { + for (let i = 0; i < chunks.length; i++) { + if (this._accept(chunks[i])) { + this.transport.log( + chunks[i].chunk[LEVEL], + chunks[i].chunk.message, + chunks[i].chunk, + this._nop + ); + chunks[i].callback(); + } + } + + return callback(null); +}; + +/** + * Displays a deprecation notice. Defined as a function so it can be + * overriden in tests. + * @returns {undefined} + */ +LegacyTransportStream.prototype._deprecated = function _deprecated() { + // eslint-disable-next-line no-console + console.error([ + `${this.transport.name} is a legacy winston transport. Consider upgrading: `, + '- Upgrade docs: https://github.com/winstonjs/winston/blob/master/UPGRADE-3.0.md' + ].join('\n')); +}; + +/** + * Clean up error handling state on the legacy transport associated + * with this instance. + * @returns {undefined} + */ +LegacyTransportStream.prototype.close = function close() { + if (this.transport.close) { + this.transport.close(); + } + + if (this.transport.__winstonError) { + this.transport.removeListener('error', this.transport.__winstonError); + this.transport.__winstonError = null; + } +}; + + +/***/ }), + +/***/ 29903: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const util = __webpack_require__(39023); +const Writable = __webpack_require__(34027); +const { LEVEL } = __webpack_require__(80310); + +/** + * Constructor function for the TransportStream. This is the base prototype + * that all `winston >= 3` transports should inherit from. + * @param {Object} options - Options for this TransportStream instance + * @param {String} options.level - Highest level according to RFC5424. + * @param {Boolean} options.handleExceptions - If true, info with + * { exception: true } will be written. + * @param {Function} options.log - Custom log function for simple Transport + * creation + * @param {Function} options.close - Called on "unpipe" from parent. + */ +const TransportStream = module.exports = function TransportStream(options = {}) { + Writable.call(this, { objectMode: true, highWaterMark: options.highWaterMark }); + + this.format = options.format; + this.level = options.level; + this.handleExceptions = options.handleExceptions; + this.handleRejections = options.handleRejections; + this.silent = options.silent; + + if (options.log) this.log = options.log; + if (options.logv) this.logv = options.logv; + if (options.close) this.close = options.close; + + // Get the levels from the source we are piped from. + this.once('pipe', logger => { + // Remark (indexzero): this bookkeeping can only support multiple + // Logger parents with the same `levels`. This comes into play in + // the `winston.Container` code in which `container.add` takes + // a fully realized set of options with pre-constructed TransportStreams. + this.levels = logger.levels; + this.parent = logger; + }); + + // If and/or when the transport is removed from this instance + this.once('unpipe', src => { + // Remark (indexzero): this bookkeeping can only support multiple + // Logger parents with the same `levels`. This comes into play in + // the `winston.Container` code in which `container.add` takes + // a fully realized set of options with pre-constructed TransportStreams. + if (src === this.parent) { + this.parent = null; + if (this.close) { + this.close(); + } + } + }); +}; + +/* + * Inherit from Writeable using Node.js built-ins + */ +util.inherits(TransportStream, Writable); + +/** + * Writes the info object to our transport instance. + * @param {mixed} info - TODO: add param description. + * @param {mixed} enc - TODO: add param description. + * @param {function} callback - TODO: add param description. + * @returns {undefined} + * @private + */ +TransportStream.prototype._write = function _write(info, enc, callback) { + if (this.silent || (info.exception === true && !this.handleExceptions)) { + return callback(null); + } + + // Remark: This has to be handled in the base transport now because we + // cannot conditionally write to our pipe targets as stream. We always + // prefer any explicit level set on the Transport itself falling back to + // any level set on the parent. + const level = this.level || (this.parent && this.parent.level); + + if (!level || this.levels[level] >= this.levels[info[LEVEL]]) { + if (info && !this.format) { + return this.log(info, callback); + } + + let errState; + let transformed; + + // We trap(and re-throw) any errors generated by the user-provided format, but also + // guarantee that the streams callback is invoked so that we can continue flowing. + try { + transformed = this.format.transform(Object.assign({}, info), this.format.options); + } catch (err) { + errState = err; + } + + if (errState || !transformed) { + // eslint-disable-next-line callback-return + callback(); + if (errState) throw errState; + return; + } + + return this.log(transformed, callback); + } + this._writableState.sync = false; + return callback(null); +}; + +/** + * Writes the batch of info objects (i.e. "object chunks") to our transport + * instance after performing any necessary filtering. + * @param {mixed} chunks - TODO: add params description. + * @param {function} callback - TODO: add params description. + * @returns {mixed} - TODO: add returns description. + * @private + */ +TransportStream.prototype._writev = function _writev(chunks, callback) { + if (this.logv) { + const infos = chunks.filter(this._accept, this); + if (!infos.length) { + return callback(null); + } + + // Remark (indexzero): from a performance perspective if Transport + // implementers do choose to implement logv should we make it their + // responsibility to invoke their format? + return this.logv(infos, callback); + } + + for (let i = 0; i < chunks.length; i++) { + if (!this._accept(chunks[i])) continue; + + if (chunks[i].chunk && !this.format) { + this.log(chunks[i].chunk, chunks[i].callback); + continue; + } + + let errState; + let transformed; + + // We trap(and re-throw) any errors generated by the user-provided format, but also + // guarantee that the streams callback is invoked so that we can continue flowing. + try { + transformed = this.format.transform( + Object.assign({}, chunks[i].chunk), + this.format.options + ); + } catch (err) { + errState = err; + } + + if (errState || !transformed) { + // eslint-disable-next-line callback-return + chunks[i].callback(); + if (errState) { + // eslint-disable-next-line callback-return + callback(null); + throw errState; + } + } else { + this.log(transformed, chunks[i].callback); + } + } + + return callback(null); +}; + +/** + * Predicate function that returns true if the specfied `info` on the + * WriteReq, `write`, should be passed down into the derived + * TransportStream's I/O via `.log(info, callback)`. + * @param {WriteReq} write - winston@3 Node.js WriteReq for the `info` object + * representing the log message. + * @returns {Boolean} - Value indicating if the `write` should be accepted & + * logged. + */ +TransportStream.prototype._accept = function _accept(write) { + const info = write.chunk; + if (this.silent) { + return false; + } + + // We always prefer any explicit level set on the Transport itself + // falling back to any level set on the parent. + const level = this.level || (this.parent && this.parent.level); + + // Immediately check the average case: log level filtering. + if ( + info.exception === true || + !level || + this.levels[level] >= this.levels[info[LEVEL]] + ) { + // Ensure the info object is valid based on `{ exception }`: + // 1. { handleExceptions: true }: all `info` objects are valid + // 2. { exception: false }: accepted by all transports. + if (this.handleExceptions || info.exception !== true) { + return true; + } + } + + return false; +}; + +/** + * _nop is short for "No operation" + * @returns {Boolean} Intentionally false. + */ +TransportStream.prototype._nop = function _nop() { + // eslint-disable-next-line no-undefined + return void undefined; +}; + + +/***/ }), + +/***/ 23878: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/** + * winston.js: Top-level include defining Winston. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const logform = __webpack_require__(72110); +const { warn } = __webpack_require__(6484); + +/** + * Expose version. Use `require` method for `webpack` support. + * @type {string} + */ +exports.version = __webpack_require__(94985).version; +/** + * Include transports defined by default by winston + * @type {Array} + */ +exports.transports = __webpack_require__(16176); +/** + * Expose utility methods + * @type {Object} + */ +exports.config = __webpack_require__(26704); +/** + * Hoist format-related functionality from logform. + * @type {Object} + */ +exports.addColors = logform.levels; +/** + * Hoist format-related functionality from logform. + * @type {Object} + */ +exports.format = logform.format; +/** + * Expose core Logging-related prototypes. + * @type {function} + */ +exports.createLogger = __webpack_require__(55110); +/** + * Expose core Logging-related prototypes. + * @type {function} + */ +exports.Logger = __webpack_require__(58509); +/** + * Expose core Logging-related prototypes. + * @type {Object} + */ +exports.ExceptionHandler = __webpack_require__(93185); +/** + * Expose core Logging-related prototypes. + * @type {Object} + */ +exports.RejectionHandler = __webpack_require__(20563); +/** + * Expose core Logging-related prototypes. + * @type {Container} + */ +exports.Container = __webpack_require__(32094); +/** + * Expose core Logging-related prototypes. + * @type {Object} + */ +exports.Transport = __webpack_require__(86558); +/** + * We create and expose a default `Container` to `winston.loggers` so that the + * programmer may manage multiple `winston.Logger` instances without any + * additional overhead. + * @example + * // some-file1.js + * const logger = require('winston').loggers.get('something'); + * + * // some-file2.js + * const logger = require('winston').loggers.get('something'); + */ +exports.loggers = new exports.Container(); + +/** + * We create and expose a 'defaultLogger' so that the programmer may do the + * following without the need to create an instance of winston.Logger directly: + * @example + * const winston = require('winston'); + * winston.log('info', 'some message'); + * winston.error('some error'); + */ +const defaultLogger = exports.createLogger(); + +// Pass through the target methods onto `winston. +Object.keys(exports.config.npm.levels) + .concat([ + 'log', + 'query', + 'stream', + 'add', + 'remove', + 'clear', + 'profile', + 'startTimer', + 'handleExceptions', + 'unhandleExceptions', + 'handleRejections', + 'unhandleRejections', + 'configure', + 'child' + ]) + .forEach( + method => (exports[method] = (...args) => defaultLogger[method](...args)) + ); + +/** + * Define getter / setter for the default logger level which need to be exposed + * by winston. + * @type {string} + */ +Object.defineProperty(exports, "level", ({ + get() { + return defaultLogger.level; + }, + set(val) { + defaultLogger.level = val; + } +})); + +/** + * Define getter for `exceptions` which replaces `handleExceptions` and + * `unhandleExceptions`. + * @type {Object} + */ +Object.defineProperty(exports, "exceptions", ({ + get() { + return defaultLogger.exceptions; + } +})); + +/** + * Define getter for `rejections` which replaces `handleRejections` and + * `unhandleRejections`. + * @type {Object} + */ +Object.defineProperty(exports, "rejections", ({ + get() { + return defaultLogger.rejections; + } +})); + +/** + * Define getters / setters for appropriate properties of the default logger + * which need to be exposed by winston. + * @type {Logger} + */ +['exitOnError'].forEach(prop => { + Object.defineProperty(exports, prop, { + get() { + return defaultLogger[prop]; + }, + set(val) { + defaultLogger[prop] = val; + } + }); +}); + +/** + * The default transports and exceptionHandlers for the default winston logger. + * @type {Object} + */ +Object.defineProperty(exports, "default", ({ + get() { + return { + exceptionHandlers: defaultLogger.exceptionHandlers, + rejectionHandlers: defaultLogger.rejectionHandlers, + transports: defaultLogger.transports + }; + } +})); + +// Have friendlier breakage notices for properties that were exposed by default +// on winston < 3.0. +warn.deprecated(exports, 'setLevels'); +warn.forFunctions(exports, 'useFormat', ['cli']); +warn.forProperties(exports, 'useFormat', ['padLevels', 'stripColors']); +warn.forFunctions(exports, 'deprecated', [ + 'addRewriter', + 'addFilter', + 'clone', + 'extend' +]); +warn.forProperties(exports, 'deprecated', ['emitErrs', 'levelLength']); + + + +/***/ }), + +/***/ 6484: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/** + * common.js: Internal helper and utility functions for winston. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const { format } = __webpack_require__(39023); + +/** + * Set of simple deprecation notices and a way to expose them for a set of + * properties. + * @type {Object} + * @private + */ +exports.warn = { + deprecated(prop) { + return () => { + throw new Error(format('{ %s } was removed in winston@3.0.0.', prop)); + }; + }, + useFormat(prop) { + return () => { + throw new Error([ + format('{ %s } was removed in winston@3.0.0.', prop), + 'Use a custom winston.format = winston.format(function) instead.' + ].join('\n')); + }; + }, + forFunctions(obj, type, props) { + props.forEach(prop => { + obj[prop] = exports.warn[type](prop); + }); + }, + forProperties(obj, type, props) { + props.forEach(prop => { + const notice = exports.warn[type](prop); + Object.defineProperty(obj, prop, { + get: notice, + set: notice + }); + }); + } +}; + + +/***/ }), + +/***/ 26704: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/** + * index.js: Default settings for all levels that winston knows about. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const logform = __webpack_require__(72110); +const { configs } = __webpack_require__(80310); + +/** + * Export config set for the CLI. + * @type {Object} + */ +exports.cli = logform.levels(configs.cli); + +/** + * Export config set for npm. + * @type {Object} + */ +exports.npm = logform.levels(configs.npm); + +/** + * Export config set for the syslog. + * @type {Object} + */ +exports.syslog = logform.levels(configs.syslog); + +/** + * Hoist addColors from logform where it was refactored into in winston@3. + * @type {Object} + */ +exports.addColors = logform.levels; + + +/***/ }), + +/***/ 32094: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * container.js: Inversion of control container for winston logger instances. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const createLogger = __webpack_require__(55110); + +/** + * Inversion of control container for winston logger instances. + * @type {Container} + */ +module.exports = class Container { + /** + * Constructor function for the Container object responsible for managing a + * set of `winston.Logger` instances based on string ids. + * @param {!Object} [options={}] - Default pass-thru options for Loggers. + */ + constructor(options = {}) { + this.loggers = new Map(); + this.options = options; + } + + /** + * Retrieves a `winston.Logger` instance for the specified `id`. If an + * instance does not exist, one is created. + * @param {!string} id - The id of the Logger to get. + * @param {?Object} [options] - Options for the Logger instance. + * @returns {Logger} - A configured Logger instance with a specified id. + */ + add(id, options) { + if (!this.loggers.has(id)) { + // Remark: Simple shallow clone for configuration options in case we pass + // in instantiated protoypal objects + options = Object.assign({}, options || this.options); + const existing = options.transports || this.options.transports; + + // Remark: Make sure if we have an array of transports we slice it to + // make copies of those references. + if (existing) { + options.transports = Array.isArray(existing) ? existing.slice() : [existing]; + } else { + options.transports = []; + } + + const logger = createLogger(options); + logger.on('close', () => this._delete(id)); + this.loggers.set(id, logger); + } + + return this.loggers.get(id); + } + + /** + * Retreives a `winston.Logger` instance for the specified `id`. If + * an instance does not exist, one is created. + * @param {!string} id - The id of the Logger to get. + * @param {?Object} [options] - Options for the Logger instance. + * @returns {Logger} - A configured Logger instance with a specified id. + */ + get(id, options) { + return this.add(id, options); + } + + /** + * Check if the container has a logger with the id. + * @param {?string} id - The id of the Logger instance to find. + * @returns {boolean} - Boolean value indicating if this instance has a + * logger with the specified `id`. + */ + has(id) { + return !!this.loggers.has(id); + } + + /** + * Closes a `Logger` instance with the specified `id` if it exists. + * If no `id` is supplied then all Loggers are closed. + * @param {?string} id - The id of the Logger instance to close. + * @returns {undefined} + */ + close(id) { + if (id) { + return this._removeLogger(id); + } + + this.loggers.forEach((val, key) => this._removeLogger(key)); + } + + /** + * Remove a logger based on the id. + * @param {!string} id - The id of the logger to remove. + * @returns {undefined} + * @private + */ + _removeLogger(id) { + if (!this.loggers.has(id)) { + return; + } + + const logger = this.loggers.get(id); + logger.close(); + this._delete(id); + } + + /** + * Deletes a `Logger` instance with the specified `id`. + * @param {!string} id - The id of the Logger instance to delete from + * container. + * @returns {undefined} + * @private + */ + _delete(id) { + this.loggers.delete(id); + } +}; + + +/***/ }), + +/***/ 55110: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * create-logger.js: Logger factory for winston logger instances. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const { LEVEL } = __webpack_require__(80310); +const config = __webpack_require__(26704); +const Logger = __webpack_require__(58509); +const debug = __webpack_require__(98005)('winston:create-logger'); + +function isLevelEnabledFunctionName(level) { + return 'is' + level.charAt(0).toUpperCase() + level.slice(1) + 'Enabled'; +} + +/** + * Create a new instance of a winston Logger. Creates a new + * prototype for each instance. + * @param {!Object} opts - Options for the created logger. + * @returns {Logger} - A newly created logger instance. + */ +module.exports = function (opts = {}) { + // + // Default levels: npm + // + opts.levels = opts.levels || config.npm.levels; + + /** + * DerivedLogger to attach the logs level methods. + * @type {DerivedLogger} + * @extends {Logger} + */ + class DerivedLogger extends Logger { + /** + * Create a new class derived logger for which the levels can be attached to + * the prototype of. This is a V8 optimization that is well know to increase + * performance of prototype functions. + * @param {!Object} options - Options for the created logger. + */ + constructor(options) { + super(options); + } + } + + const logger = new DerivedLogger(opts); + + // + // Create the log level methods for the derived logger. + // + Object.keys(opts.levels).forEach(function (level) { + debug('Define prototype method for "%s"', level); + if (level === 'log') { + // eslint-disable-next-line no-console + console.warn('Level "log" not defined: conflicts with the method "log". Use a different level name.'); + return; + } + + // + // Define prototype methods for each log level e.g.: + // logger.log('info', msg) implies these methods are defined: + // - logger.info(msg) + // - logger.isInfoEnabled() + // + // Remark: to support logger.child this **MUST** be a function + // so it'll always be called on the instance instead of a fixed + // place in the prototype chain. + // + DerivedLogger.prototype[level] = function (...args) { + // Prefer any instance scope, but default to "root" logger + const self = this || logger; + + // Optimize the hot-path which is the single object. + if (args.length === 1) { + const [msg] = args; + const info = msg && msg.message && msg || { message: msg }; + info.level = info[LEVEL] = level; + self._addDefaultMeta(info); + self.write(info); + return (this || logger); + } + + // When provided nothing assume the empty string + if (args.length === 0) { + self.log(level, ''); + return self; + } + + // Otherwise build argument list which could potentially conform to + // either: + // . v3 API: log(obj) + // 2. v1/v2 API: log(level, msg, ... [string interpolate], [{metadata}], [callback]) + return self.log(level, ...args); + }; + + DerivedLogger.prototype[isLevelEnabledFunctionName(level)] = function () { + return (this || logger).isLevelEnabled(level); + }; + }); + + return logger; +}; + + +/***/ }), + +/***/ 93185: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * exception-handler.js: Object for handling uncaughtException events. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const os = __webpack_require__(70857); +const asyncForEach = __webpack_require__(22436); +const debug = __webpack_require__(98005)('winston:exception'); +const once = __webpack_require__(77920); +const stackTrace = __webpack_require__(91370); +const ExceptionStream = __webpack_require__(83233); + +/** + * Object for handling uncaughtException events. + * @type {ExceptionHandler} + */ +module.exports = class ExceptionHandler { + /** + * TODO: add contructor description + * @param {!Logger} logger - TODO: add param description + */ + constructor(logger) { + if (!logger) { + throw new Error('Logger is required to handle exceptions'); + } + + this.logger = logger; + this.handlers = new Map(); + } + + /** + * Handles `uncaughtException` events for the current process by adding any + * handlers passed in. + * @returns {undefined} + */ + handle(...args) { + args.forEach(arg => { + if (Array.isArray(arg)) { + return arg.forEach(handler => this._addHandler(handler)); + } + + this._addHandler(arg); + }); + + if (!this.catcher) { + this.catcher = this._uncaughtException.bind(this); + process.on('uncaughtException', this.catcher); + } + } + + /** + * Removes any handlers to `uncaughtException` events for the current + * process. This does not modify the state of the `this.handlers` set. + * @returns {undefined} + */ + unhandle() { + if (this.catcher) { + process.removeListener('uncaughtException', this.catcher); + this.catcher = false; + + Array.from(this.handlers.values()) + .forEach(wrapper => this.logger.unpipe(wrapper)); + } + } + + /** + * TODO: add method description + * @param {Error} err - Error to get information about. + * @returns {mixed} - TODO: add return description. + */ + getAllInfo(err) { + let message = null; + if (err) { + message = typeof err === 'string' ? err : err.message; + } + + return { + error: err, + // TODO (indexzero): how do we configure this? + level: 'error', + message: [ + `uncaughtException: ${(message || '(no error message)')}`, + err && err.stack || ' No stack trace' + ].join('\n'), + stack: err && err.stack, + exception: true, + date: new Date().toString(), + process: this.getProcessInfo(), + os: this.getOsInfo(), + trace: this.getTrace(err) + }; + } + + /** + * Gets all relevant process information for the currently running process. + * @returns {mixed} - TODO: add return description. + */ + getProcessInfo() { + return { + pid: process.pid, + uid: process.getuid ? process.getuid() : null, + gid: process.getgid ? process.getgid() : null, + cwd: process.cwd(), + execPath: process.execPath, + version: process.version, + argv: process.argv, + memoryUsage: process.memoryUsage() + }; + } + + /** + * Gets all relevant OS information for the currently running process. + * @returns {mixed} - TODO: add return description. + */ + getOsInfo() { + return { + loadavg: os.loadavg(), + uptime: os.uptime() + }; + } + + /** + * Gets a stack trace for the specified error. + * @param {mixed} err - TODO: add param description. + * @returns {mixed} - TODO: add return description. + */ + getTrace(err) { + const trace = err ? stackTrace.parse(err) : stackTrace.get(); + return trace.map(site => { + return { + column: site.getColumnNumber(), + file: site.getFileName(), + function: site.getFunctionName(), + line: site.getLineNumber(), + method: site.getMethodName(), + native: site.isNative() + }; + }); + } + + /** + * Helper method to add a transport as an exception handler. + * @param {Transport} handler - The transport to add as an exception handler. + * @returns {void} + */ + _addHandler(handler) { + if (!this.handlers.has(handler)) { + handler.handleExceptions = true; + const wrapper = new ExceptionStream(handler); + this.handlers.set(handler, wrapper); + this.logger.pipe(wrapper); + } + } + + /** + * Logs all relevant information around the `err` and exits the current + * process. + * @param {Error} err - Error to handle + * @returns {mixed} - TODO: add return description. + * @private + */ + _uncaughtException(err) { + const info = this.getAllInfo(err); + const handlers = this._getExceptionHandlers(); + // Calculate if we should exit on this error + let doExit = typeof this.logger.exitOnError === 'function' + ? this.logger.exitOnError(err) + : this.logger.exitOnError; + let timeout; + + if (!handlers.length && doExit) { + // eslint-disable-next-line no-console + console.warn('winston: exitOnError cannot be true with no exception handlers.'); + // eslint-disable-next-line no-console + console.warn('winston: not exiting process.'); + doExit = false; + } + + function gracefulExit() { + debug('doExit', doExit); + debug('process._exiting', process._exiting); + + if (doExit && !process._exiting) { + // Remark: Currently ignoring any exceptions from transports when + // catching uncaught exceptions. + if (timeout) { + clearTimeout(timeout); + } + // eslint-disable-next-line no-process-exit + process.exit(1); + } + } + + if (!handlers || handlers.length === 0) { + return process.nextTick(gracefulExit); + } + + // Log to all transports attempting to listen for when they are completed. + asyncForEach(handlers, (handler, next) => { + const done = once(next); + const transport = handler.transport || handler; + + // Debug wrapping so that we can inspect what's going on under the covers. + function onDone(event) { + return () => { + debug(event); + done(); + }; + } + + transport._ending = true; + transport.once('finish', onDone('finished')); + transport.once('error', onDone('error')); + }, () => doExit && gracefulExit()); + + this.logger.log(info); + + // If exitOnError is true, then only allow the logging of exceptions to + // take up to `3000ms`. + if (doExit) { + timeout = setTimeout(gracefulExit, 3000); + } + } + + /** + * Returns the list of transports and exceptionHandlers for this instance. + * @returns {Array} - List of transports and exceptionHandlers for this + * instance. + * @private + */ + _getExceptionHandlers() { + // Remark (indexzero): since `logger.transports` returns all of the pipes + // from the _readableState of the stream we actually get the join of the + // explicit handlers and the implicit transports with + // `handleExceptions: true` + return this.logger.transports.filter(wrap => { + const transport = wrap.transport || wrap; + return transport.handleExceptions; + }); + } +}; + + +/***/ }), + +/***/ 83233: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * exception-stream.js: TODO: add file header handler. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const { Writable } = __webpack_require__(72093); + +/** + * TODO: add class description. + * @type {ExceptionStream} + * @extends {Writable} + */ +module.exports = class ExceptionStream extends Writable { + /** + * Constructor function for the ExceptionStream responsible for wrapping a + * TransportStream; only allowing writes of `info` objects with + * `info.exception` set to true. + * @param {!TransportStream} transport - Stream to filter to exceptions + */ + constructor(transport) { + super({ objectMode: true }); + + if (!transport) { + throw new Error('ExceptionStream requires a TransportStream instance.'); + } + + // Remark (indexzero): we set `handleExceptions` here because it's the + // predicate checked in ExceptionHandler.prototype.__getExceptionHandlers + this.handleExceptions = true; + this.transport = transport; + } + + /** + * Writes the info object to our transport instance if (and only if) the + * `exception` property is set on the info. + * @param {mixed} info - TODO: add param description. + * @param {mixed} enc - TODO: add param description. + * @param {mixed} callback - TODO: add param description. + * @returns {mixed} - TODO: add return description. + * @private + */ + _write(info, enc, callback) { + if (info.exception) { + return this.transport.log(info, callback); + } + + callback(); + return true; + } +}; + + +/***/ }), + +/***/ 58509: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * logger.js: TODO: add file header description. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const { Stream, Transform } = __webpack_require__(72093); +const asyncForEach = __webpack_require__(22436); +const { LEVEL, SPLAT } = __webpack_require__(80310); +const isStream = __webpack_require__(79421); +const ExceptionHandler = __webpack_require__(93185); +const RejectionHandler = __webpack_require__(20563); +const LegacyTransportStream = __webpack_require__(26103); +const Profiler = __webpack_require__(2264); +const { warn } = __webpack_require__(6484); +const config = __webpack_require__(26704); + +/** + * Captures the number of format (i.e. %s strings) in a given string. + * Based on `util.format`, see Node.js source: + * https://github.com/nodejs/node/blob/b1c8f15c5f169e021f7c46eb7b219de95fe97603/lib/util.js#L201-L230 + * @type {RegExp} + */ +const formatRegExp = /%[scdjifoO%]/g; + +/** + * TODO: add class description. + * @type {Logger} + * @extends {Transform} + */ +class Logger extends Transform { + /** + * Constructor function for the Logger object responsible for persisting log + * messages and metadata to one or more transports. + * @param {!Object} options - foo + */ + constructor(options) { + super({ objectMode: true }); + this.configure(options); + } + + child(defaultRequestMetadata) { + const logger = this; + return Object.create(logger, { + write: { + value: function (info) { + const infoClone = Object.assign( + {}, + defaultRequestMetadata, + info + ); + + // Object.assign doesn't copy inherited Error + // properties so we have to do that explicitly + // + // Remark (indexzero): we should remove this + // since the errors format will handle this case. + // + if (info instanceof Error) { + infoClone.stack = info.stack; + infoClone.message = info.message; + } + + logger.write(infoClone); + } + } + }); + } + + /** + * This will wholesale reconfigure this instance by: + * 1. Resetting all transports. Older transports will be removed implicitly. + * 2. Set all other options including levels, colors, rewriters, filters, + * exceptionHandlers, etc. + * @param {!Object} options - TODO: add param description. + * @returns {undefined} + */ + configure({ + silent, + format, + defaultMeta, + levels, + level = 'info', + exitOnError = true, + transports, + colors, + emitErrs, + formatters, + padLevels, + rewriters, + stripColors, + exceptionHandlers, + rejectionHandlers + } = {}) { + // Reset transports if we already have them + if (this.transports.length) { + this.clear(); + } + + this.silent = silent; + this.format = format || this.format || __webpack_require__(62214)(); + + this.defaultMeta = defaultMeta || null; + // Hoist other options onto this instance. + this.levels = levels || this.levels || config.npm.levels; + this.level = level; + if (this.exceptions) { + this.exceptions.unhandle(); + } + if (this.rejections) { + this.rejections.unhandle(); + } + this.exceptions = new ExceptionHandler(this); + this.rejections = new RejectionHandler(this); + this.profilers = {}; + this.exitOnError = exitOnError; + + // Add all transports we have been provided. + if (transports) { + transports = Array.isArray(transports) ? transports : [transports]; + transports.forEach(transport => this.add(transport)); + } + + if ( + colors || + emitErrs || + formatters || + padLevels || + rewriters || + stripColors + ) { + throw new Error( + [ + '{ colors, emitErrs, formatters, padLevels, rewriters, stripColors } were removed in winston@3.0.0.', + 'Use a custom winston.format(function) instead.', + 'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md' + ].join('\n') + ); + } + + if (exceptionHandlers) { + this.exceptions.handle(exceptionHandlers); + } + if (rejectionHandlers) { + this.rejections.handle(rejectionHandlers); + } + } + + isLevelEnabled(level) { + const givenLevelValue = getLevelValue(this.levels, level); + if (givenLevelValue === null) { + return false; + } + + const configuredLevelValue = getLevelValue(this.levels, this.level); + if (configuredLevelValue === null) { + return false; + } + + if (!this.transports || this.transports.length === 0) { + return configuredLevelValue >= givenLevelValue; + } + + const index = this.transports.findIndex(transport => { + let transportLevelValue = getLevelValue(this.levels, transport.level); + if (transportLevelValue === null) { + transportLevelValue = configuredLevelValue; + } + return transportLevelValue >= givenLevelValue; + }); + return index !== -1; + } + + /* eslint-disable valid-jsdoc */ + /** + * Ensure backwards compatibility with a `log` method + * @param {mixed} level - Level the log message is written at. + * @param {mixed} msg - TODO: add param description. + * @param {mixed} meta - TODO: add param description. + * @returns {Logger} - TODO: add return description. + * + * @example + * // Supports the existing API: + * logger.log('info', 'Hello world', { custom: true }); + * logger.log('info', new Error('Yo, it\'s on fire')); + * + * // Requires winston.format.splat() + * logger.log('info', '%s %d%%', 'A string', 50, { thisIsMeta: true }); + * + * // And the new API with a single JSON literal: + * logger.log({ level: 'info', message: 'Hello world', custom: true }); + * logger.log({ level: 'info', message: new Error('Yo, it\'s on fire') }); + * + * // Also requires winston.format.splat() + * logger.log({ + * level: 'info', + * message: '%s %d%%', + * [SPLAT]: ['A string', 50], + * meta: { thisIsMeta: true } + * }); + * + */ + /* eslint-enable valid-jsdoc */ + log(level, msg, ...splat) { + // eslint-disable-line max-params + // Optimize for the hotpath of logging JSON literals + if (arguments.length === 1) { + // Yo dawg, I heard you like levels ... seriously ... + // In this context the LHS `level` here is actually the `info` so read + // this as: info[LEVEL] = info.level; + level[LEVEL] = level.level; + this._addDefaultMeta(level); + this.write(level); + return this; + } + + // Slightly less hotpath, but worth optimizing for. + if (arguments.length === 2) { + if (msg && typeof msg === 'object') { + msg[LEVEL] = msg.level = level; + this._addDefaultMeta(msg); + this.write(msg); + return this; + } + + msg = { [LEVEL]: level, level, message: msg }; + this._addDefaultMeta(msg); + this.write(msg); + return this; + } + + const [meta] = splat; + if (typeof meta === 'object' && meta !== null) { + // Extract tokens, if none available default to empty array to + // ensure consistancy in expected results + const tokens = msg && msg.match && msg.match(formatRegExp); + + if (!tokens) { + const info = Object.assign({}, this.defaultMeta, meta, { + [LEVEL]: level, + [SPLAT]: splat, + level, + message: msg + }); + + if (meta.message) info.message = `${info.message} ${meta.message}`; + if (meta.stack) info.stack = meta.stack; + if (meta.cause) info.cause = meta.cause; + + this.write(info); + return this; + } + } + + this.write(Object.assign({}, this.defaultMeta, { + [LEVEL]: level, + [SPLAT]: splat, + level, + message: msg + })); + + return this; + } + + /** + * Pushes data so that it can be picked up by all of our pipe targets. + * @param {mixed} info - TODO: add param description. + * @param {mixed} enc - TODO: add param description. + * @param {mixed} callback - Continues stream processing. + * @returns {undefined} + * @private + */ + _transform(info, enc, callback) { + if (this.silent) { + return callback(); + } + + // [LEVEL] is only soft guaranteed to be set here since we are a proper + // stream. It is likely that `info` came in through `.log(info)` or + // `.info(info)`. If it is not defined, however, define it. + // This LEVEL symbol is provided by `triple-beam` and also used in: + // - logform + // - winston-transport + // - abstract-winston-transport + if (!info[LEVEL]) { + info[LEVEL] = info.level; + } + + // Remark: really not sure what to do here, but this has been reported as + // very confusing by pre winston@2.0.0 users as quite confusing when using + // custom levels. + if (!this.levels[info[LEVEL]] && this.levels[info[LEVEL]] !== 0) { + // eslint-disable-next-line no-console + console.error('[winston] Unknown logger level: %s', info[LEVEL]); + } + + // Remark: not sure if we should simply error here. + if (!this._readableState.pipes) { + // eslint-disable-next-line no-console + console.error( + '[winston] Attempt to write logs with no transports, which can increase memory usage: %j', + info + ); + } + + // Here we write to the `format` pipe-chain, which on `readable` above will + // push the formatted `info` Object onto the buffer for this instance. We trap + // (and re-throw) any errors generated by the user-provided format, but also + // guarantee that the streams callback is invoked so that we can continue flowing. + try { + this.push(this.format.transform(info, this.format.options)); + } finally { + this._writableState.sync = false; + // eslint-disable-next-line callback-return + callback(); + } + } + + /** + * Delays the 'finish' event until all transport pipe targets have + * also emitted 'finish' or are already finished. + * @param {mixed} callback - Continues stream processing. + */ + _final(callback) { + const transports = this.transports.slice(); + asyncForEach( + transports, + (transport, next) => { + if (!transport || transport.finished) return setImmediate(next); + transport.once('finish', next); + transport.end(); + }, + callback + ); + } + + /** + * Adds the transport to this logger instance by piping to it. + * @param {mixed} transport - TODO: add param description. + * @returns {Logger} - TODO: add return description. + */ + add(transport) { + // Support backwards compatibility with all existing `winston < 3.x.x` + // transports which meet one of two criteria: + // 1. They inherit from winston.Transport in < 3.x.x which is NOT a stream. + // 2. They expose a log method which has a length greater than 2 (i.e. more then + // just `log(info, callback)`. + const target = + !isStream(transport) || transport.log.length > 2 + ? new LegacyTransportStream({ transport }) + : transport; + + if (!target._writableState || !target._writableState.objectMode) { + throw new Error( + 'Transports must WritableStreams in objectMode. Set { objectMode: true }.' + ); + } + + // Listen for the `error` event and the `warn` event on the new Transport. + this._onEvent('error', target); + this._onEvent('warn', target); + this.pipe(target); + + if (transport.handleExceptions) { + this.exceptions.handle(); + } + + if (transport.handleRejections) { + this.rejections.handle(); + } + + return this; + } + + /** + * Removes the transport from this logger instance by unpiping from it. + * @param {mixed} transport - TODO: add param description. + * @returns {Logger} - TODO: add return description. + */ + remove(transport) { + if (!transport) return this; + let target = transport; + if (!isStream(transport) || transport.log.length > 2) { + target = this.transports.filter( + match => match.transport === transport + )[0]; + } + + if (target) { + this.unpipe(target); + } + return this; + } + + /** + * Removes all transports from this logger instance. + * @returns {Logger} - TODO: add return description. + */ + clear() { + this.unpipe(); + return this; + } + + /** + * Cleans up resources (streams, event listeners) for all transports + * associated with this instance (if necessary). + * @returns {Logger} - TODO: add return description. + */ + close() { + this.exceptions.unhandle(); + this.rejections.unhandle(); + this.clear(); + this.emit('close'); + return this; + } + + /** + * Sets the `target` levels specified on this instance. + * @param {Object} Target levels to use on this instance. + */ + setLevels() { + warn.deprecated('setLevels'); + } + + /** + * Queries the all transports for this instance with the specified `options`. + * This will aggregate each transport's results into one object containing + * a property per transport. + * @param {Object} options - Query options for this instance. + * @param {function} callback - Continuation to respond to when complete. + */ + query(options, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } + + options = options || {}; + const results = {}; + const queryObject = Object.assign({}, options.query || {}); + + // Helper function to query a single transport + function queryTransport(transport, next) { + if (options.query && typeof transport.formatQuery === 'function') { + options.query = transport.formatQuery(queryObject); + } + + transport.query(options, (err, res) => { + if (err) { + return next(err); + } + + if (typeof transport.formatResults === 'function') { + res = transport.formatResults(res, options.format); + } + + next(null, res); + }); + } + + // Helper function to accumulate the results from `queryTransport` into + // the `results`. + function addResults(transport, next) { + queryTransport(transport, (err, result) => { + // queryTransport could potentially invoke the callback multiple times + // since Transport code can be unpredictable. + if (next) { + result = err || result; + if (result) { + results[transport.name] = result; + } + + // eslint-disable-next-line callback-return + next(); + } + + next = null; + }); + } + + // Iterate over the transports in parallel setting the appropriate key in + // the `results`. + asyncForEach( + this.transports.filter(transport => !!transport.query), + addResults, + () => callback(null, results) + ); + } + + /** + * Returns a log stream for all transports. Options object is optional. + * @param{Object} options={} - Stream options for this instance. + * @returns {Stream} - TODO: add return description. + */ + stream(options = {}) { + const out = new Stream(); + const streams = []; + + out._streams = streams; + out.destroy = () => { + let i = streams.length; + while (i--) { + streams[i].destroy(); + } + }; + + // Create a list of all transports for this instance. + this.transports + .filter(transport => !!transport.stream) + .forEach(transport => { + const str = transport.stream(options); + if (!str) { + return; + } + + streams.push(str); + + str.on('log', log => { + log.transport = log.transport || []; + log.transport.push(transport.name); + out.emit('log', log); + }); + + str.on('error', err => { + err.transport = err.transport || []; + err.transport.push(transport.name); + out.emit('error', err); + }); + }); + + return out; + } + + /** + * Returns an object corresponding to a specific timing. When done is called + * the timer will finish and log the duration. e.g.: + * @returns {Profile} - TODO: add return description. + * @example + * const timer = winston.startTimer() + * setTimeout(() => { + * timer.done({ + * message: 'Logging message' + * }); + * }, 1000); + */ + startTimer() { + return new Profiler(this); + } + + /** + * Tracks the time inbetween subsequent calls to this method with the same + * `id` parameter. The second call to this method will log the difference in + * milliseconds along with the message. + * @param {string} id Unique id of the profiler + * @returns {Logger} - TODO: add return description. + */ + profile(id, ...args) { + const time = Date.now(); + if (this.profilers[id]) { + const timeEnd = this.profilers[id]; + delete this.profilers[id]; + + // Attempt to be kind to users if they are still using older APIs. + if (typeof args[args.length - 2] === 'function') { + // eslint-disable-next-line no-console + console.warn( + 'Callback function no longer supported as of winston@3.0.0' + ); + args.pop(); + } + + // Set the duration property of the metadata + const info = typeof args[args.length - 1] === 'object' ? args.pop() : {}; + info.level = info.level || 'info'; + info.durationMs = time - timeEnd; + info.message = info.message || id; + return this.write(info); + } + + this.profilers[id] = time; + return this; + } + + /** + * Backwards compatibility to `exceptions.handle` in winston < 3.0.0. + * @returns {undefined} + * @deprecated + */ + handleExceptions(...args) { + // eslint-disable-next-line no-console + console.warn( + 'Deprecated: .handleExceptions() will be removed in winston@4. Use .exceptions.handle()' + ); + this.exceptions.handle(...args); + } + + /** + * Backwards compatibility to `exceptions.handle` in winston < 3.0.0. + * @returns {undefined} + * @deprecated + */ + unhandleExceptions(...args) { + // eslint-disable-next-line no-console + console.warn( + 'Deprecated: .unhandleExceptions() will be removed in winston@4. Use .exceptions.unhandle()' + ); + this.exceptions.unhandle(...args); + } + + /** + * Throw a more meaningful deprecation notice + * @throws {Error} - TODO: add throws description. + */ + cli() { + throw new Error( + [ + 'Logger.cli() was removed in winston@3.0.0', + 'Use a custom winston.formats.cli() instead.', + 'See: https://github.com/winstonjs/winston/tree/master/UPGRADE-3.0.md' + ].join('\n') + ); + } + + /** + * Bubbles the `event` that occured on the specified `transport` up + * from this instance. + * @param {string} event - The event that occured + * @param {Object} transport - Transport on which the event occured + * @private + */ + _onEvent(event, transport) { + function transportEvent(err) { + // https://github.com/winstonjs/winston/issues/1364 + if (event === 'error' && !this.transports.includes(transport)) { + this.add(transport); + } + this.emit(event, err, transport); + } + + if (!transport['__winston' + event]) { + transport['__winston' + event] = transportEvent.bind(this); + transport.on(event, transport['__winston' + event]); + } + } + + _addDefaultMeta(msg) { + if (this.defaultMeta) { + Object.assign(msg, this.defaultMeta); + } + } +} + +function getLevelValue(levels, level) { + const value = levels[level]; + if (!value && value !== 0) { + return null; + } + return value; +} + +/** + * Represents the current readableState pipe targets for this Logger instance. + * @type {Array|Object} + */ +Object.defineProperty(Logger.prototype, 'transports', { + configurable: false, + enumerable: true, + get() { + const { pipes } = this._readableState; + return !Array.isArray(pipes) ? [pipes].filter(Boolean) : pipes; + } +}); + +module.exports = Logger; + + +/***/ }), + +/***/ 2264: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * profiler.js: TODO: add file header description. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + +/** + * TODO: add class description. + * @type {Profiler} + * @private + */ +class Profiler { + /** + * Constructor function for the Profiler instance used by + * `Logger.prototype.startTimer`. When done is called the timer will finish + * and log the duration. + * @param {!Logger} logger - TODO: add param description. + * @private + */ + constructor(logger) { + const Logger = __webpack_require__(58509); + if (typeof logger !== 'object' || Array.isArray(logger) || !(logger instanceof Logger)) { + throw new Error('Logger is required for profiling'); + } else { + this.logger = logger; + this.start = Date.now(); + } + } + + /** + * Ends the current timer (i.e. Profiler) instance and logs the `msg` along + * with the duration since creation. + * @returns {mixed} - TODO: add return description. + * @private + */ + done(...args) { + if (typeof args[args.length - 1] === 'function') { + // eslint-disable-next-line no-console + console.warn('Callback function no longer supported as of winston@3.0.0'); + args.pop(); + } + + const info = typeof args[args.length - 1] === 'object' ? args.pop() : {}; + info.level = info.level || 'info'; + info.durationMs = (Date.now()) - this.start; + + return this.logger.write(info); + } +}; + +module.exports = Profiler; + + +/***/ }), + +/***/ 20563: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * exception-handler.js: Object for handling uncaughtException events. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const os = __webpack_require__(70857); +const asyncForEach = __webpack_require__(22436); +const debug = __webpack_require__(98005)('winston:rejection'); +const once = __webpack_require__(77920); +const stackTrace = __webpack_require__(91370); +const RejectionStream = __webpack_require__(67487); + +/** + * Object for handling unhandledRejection events. + * @type {RejectionHandler} + */ +module.exports = class RejectionHandler { + /** + * TODO: add contructor description + * @param {!Logger} logger - TODO: add param description + */ + constructor(logger) { + if (!logger) { + throw new Error('Logger is required to handle rejections'); + } + + this.logger = logger; + this.handlers = new Map(); + } + + /** + * Handles `unhandledRejection` events for the current process by adding any + * handlers passed in. + * @returns {undefined} + */ + handle(...args) { + args.forEach(arg => { + if (Array.isArray(arg)) { + return arg.forEach(handler => this._addHandler(handler)); + } + + this._addHandler(arg); + }); + + if (!this.catcher) { + this.catcher = this._unhandledRejection.bind(this); + process.on('unhandledRejection', this.catcher); + } + } + + /** + * Removes any handlers to `unhandledRejection` events for the current + * process. This does not modify the state of the `this.handlers` set. + * @returns {undefined} + */ + unhandle() { + if (this.catcher) { + process.removeListener('unhandledRejection', this.catcher); + this.catcher = false; + + Array.from(this.handlers.values()).forEach(wrapper => + this.logger.unpipe(wrapper) + ); + } + } + + /** + * TODO: add method description + * @param {Error} err - Error to get information about. + * @returns {mixed} - TODO: add return description. + */ + getAllInfo(err) { + let message = null; + if (err) { + message = typeof err === 'string' ? err : err.message; + } + + return { + error: err, + // TODO (indexzero): how do we configure this? + level: 'error', + message: [ + `unhandledRejection: ${message || '(no error message)'}`, + err && err.stack || ' No stack trace' + ].join('\n'), + stack: err && err.stack, + rejection: true, + date: new Date().toString(), + process: this.getProcessInfo(), + os: this.getOsInfo(), + trace: this.getTrace(err) + }; + } + + /** + * Gets all relevant process information for the currently running process. + * @returns {mixed} - TODO: add return description. + */ + getProcessInfo() { + return { + pid: process.pid, + uid: process.getuid ? process.getuid() : null, + gid: process.getgid ? process.getgid() : null, + cwd: process.cwd(), + execPath: process.execPath, + version: process.version, + argv: process.argv, + memoryUsage: process.memoryUsage() + }; + } + + /** + * Gets all relevant OS information for the currently running process. + * @returns {mixed} - TODO: add return description. + */ + getOsInfo() { + return { + loadavg: os.loadavg(), + uptime: os.uptime() + }; + } + + /** + * Gets a stack trace for the specified error. + * @param {mixed} err - TODO: add param description. + * @returns {mixed} - TODO: add return description. + */ + getTrace(err) { + const trace = err ? stackTrace.parse(err) : stackTrace.get(); + return trace.map(site => { + return { + column: site.getColumnNumber(), + file: site.getFileName(), + function: site.getFunctionName(), + line: site.getLineNumber(), + method: site.getMethodName(), + native: site.isNative() + }; + }); + } + + /** + * Helper method to add a transport as an exception handler. + * @param {Transport} handler - The transport to add as an exception handler. + * @returns {void} + */ + _addHandler(handler) { + if (!this.handlers.has(handler)) { + handler.handleRejections = true; + const wrapper = new RejectionStream(handler); + this.handlers.set(handler, wrapper); + this.logger.pipe(wrapper); + } + } + + /** + * Logs all relevant information around the `err` and exits the current + * process. + * @param {Error} err - Error to handle + * @returns {mixed} - TODO: add return description. + * @private + */ + _unhandledRejection(err) { + const info = this.getAllInfo(err); + const handlers = this._getRejectionHandlers(); + // Calculate if we should exit on this error + let doExit = + typeof this.logger.exitOnError === 'function' + ? this.logger.exitOnError(err) + : this.logger.exitOnError; + let timeout; + + if (!handlers.length && doExit) { + // eslint-disable-next-line no-console + console.warn('winston: exitOnError cannot be true with no rejection handlers.'); + // eslint-disable-next-line no-console + console.warn('winston: not exiting process.'); + doExit = false; + } + + function gracefulExit() { + debug('doExit', doExit); + debug('process._exiting', process._exiting); + + if (doExit && !process._exiting) { + // Remark: Currently ignoring any rejections from transports when + // catching unhandled rejections. + if (timeout) { + clearTimeout(timeout); + } + // eslint-disable-next-line no-process-exit + process.exit(1); + } + } + + if (!handlers || handlers.length === 0) { + return process.nextTick(gracefulExit); + } + + // Log to all transports attempting to listen for when they are completed. + asyncForEach( + handlers, + (handler, next) => { + const done = once(next); + const transport = handler.transport || handler; + + // Debug wrapping so that we can inspect what's going on under the covers. + function onDone(event) { + return () => { + debug(event); + done(); + }; + } + + transport._ending = true; + transport.once('finish', onDone('finished')); + transport.once('error', onDone('error')); + }, + () => doExit && gracefulExit() + ); + + this.logger.log(info); + + // If exitOnError is true, then only allow the logging of exceptions to + // take up to `3000ms`. + if (doExit) { + timeout = setTimeout(gracefulExit, 3000); + } + } + + /** + * Returns the list of transports and exceptionHandlers for this instance. + * @returns {Array} - List of transports and exceptionHandlers for this + * instance. + * @private + */ + _getRejectionHandlers() { + // Remark (indexzero): since `logger.transports` returns all of the pipes + // from the _readableState of the stream we actually get the join of the + // explicit handlers and the implicit transports with + // `handleRejections: true` + return this.logger.transports.filter(wrap => { + const transport = wrap.transport || wrap; + return transport.handleRejections; + }); + } +}; + + +/***/ }), + +/***/ 67487: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * rejection-stream.js: TODO: add file header handler. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const { Writable } = __webpack_require__(72093); + +/** + * TODO: add class description. + * @type {RejectionStream} + * @extends {Writable} + */ +module.exports = class RejectionStream extends Writable { + /** + * Constructor function for the RejectionStream responsible for wrapping a + * TransportStream; only allowing writes of `info` objects with + * `info.rejection` set to true. + * @param {!TransportStream} transport - Stream to filter to rejections + */ + constructor(transport) { + super({ objectMode: true }); + + if (!transport) { + throw new Error('RejectionStream requires a TransportStream instance.'); + } + + this.handleRejections = true; + this.transport = transport; + } + + /** + * Writes the info object to our transport instance if (and only if) the + * `rejection` property is set on the info. + * @param {mixed} info - TODO: add param description. + * @param {mixed} enc - TODO: add param description. + * @param {mixed} callback - TODO: add param description. + * @returns {mixed} - TODO: add return description. + * @private + */ + _write(info, enc, callback) { + if (info.rejection) { + return this.transport.log(info, callback); + } + + callback(); + return true; + } +}; + + +/***/ }), + +/***/ 52106: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * tail-file.js: TODO: add file header description. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const fs = __webpack_require__(79896); +const { StringDecoder } = __webpack_require__(13193); +const { Stream } = __webpack_require__(72093); + +/** + * Simple no-op function. + * @returns {undefined} + */ +function noop() {} + +/** + * TODO: add function description. + * @param {Object} options - Options for tail. + * @param {function} iter - Iterator function to execute on every line. +* `tail -f` a file. Options must include file. + * @returns {mixed} - TODO: add return description. + */ +module.exports = (options, iter) => { + const buffer = Buffer.alloc(64 * 1024); + const decode = new StringDecoder('utf8'); + const stream = new Stream(); + let buff = ''; + let pos = 0; + let row = 0; + + if (options.start === -1) { + delete options.start; + } + + stream.readable = true; + stream.destroy = () => { + stream.destroyed = true; + stream.emit('end'); + stream.emit('close'); + }; + + fs.open(options.file, 'a+', '0644', (err, fd) => { + if (err) { + if (!iter) { + stream.emit('error', err); + } else { + iter(err); + } + stream.destroy(); + return; + } + + (function read() { + if (stream.destroyed) { + fs.close(fd, noop); + return; + } + + return fs.read(fd, buffer, 0, buffer.length, pos, (error, bytes) => { + if (error) { + if (!iter) { + stream.emit('error', error); + } else { + iter(error); + } + stream.destroy(); + return; + } + + if (!bytes) { + if (buff) { + // eslint-disable-next-line eqeqeq + if (options.start == null || row > options.start) { + if (!iter) { + stream.emit('line', buff); + } else { + iter(null, buff); + } + } + row++; + buff = ''; + } + return setTimeout(read, 1000); + } + + let data = decode.write(buffer.slice(0, bytes)); + if (!iter) { + stream.emit('data', data); + } + + data = (buff + data).split(/\n+/); + + const l = data.length - 1; + let i = 0; + + for (; i < l; i++) { + // eslint-disable-next-line eqeqeq + if (options.start == null || row > options.start) { + if (!iter) { + stream.emit('line', data[i]); + } else { + iter(null, data[i]); + } + } + row++; + } + + buff = data[l]; + pos += bytes; + return read(); + }); + }()); + }); + + if (!iter) { + return stream; + } + + return stream.destroy; +}; + + +/***/ }), + +/***/ 58957: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint-disable no-console */ +/* + * console.js: Transport for outputting to the console. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const os = __webpack_require__(70857); +const { LEVEL, MESSAGE } = __webpack_require__(80310); +const TransportStream = __webpack_require__(86558); + +/** + * Transport for outputting to the console. + * @type {Console} + * @extends {TransportStream} + */ +module.exports = class Console extends TransportStream { + /** + * Constructor function for the Console transport object responsible for + * persisting log messages and metadata to a terminal or TTY. + * @param {!Object} [options={}] - Options for this instance. + */ + constructor(options = {}) { + super(options); + + // Expose the name of this Transport on the prototype + this.name = options.name || 'console'; + this.stderrLevels = this._stringArrayToSet(options.stderrLevels); + this.consoleWarnLevels = this._stringArrayToSet(options.consoleWarnLevels); + this.eol = typeof options.eol === 'string' ? options.eol : os.EOL; + this.forceConsole = options.forceConsole || false; + + // Keep a reference to the log, warn, and error console methods + // in case they get redirected to this transport after the logger is + // instantiated. This prevents a circular reference issue. + this._consoleLog = console.log.bind(console); + this._consoleWarn = console.warn.bind(console); + this._consoleError = console.error.bind(console); + + this.setMaxListeners(30); + } + + /** + * Core logging method exposed to Winston. + * @param {Object} info - TODO: add param description. + * @param {Function} callback - TODO: add param description. + * @returns {undefined} + */ + log(info, callback) { + setImmediate(() => this.emit('logged', info)); + + // Remark: what if there is no raw...? + if (this.stderrLevels[info[LEVEL]]) { + if (console._stderr && !this.forceConsole) { + // Node.js maps `process.stderr` to `console._stderr`. + console._stderr.write(`${info[MESSAGE]}${this.eol}`); + } else { + // console.error adds a newline + this._consoleError(info[MESSAGE]); + } + + if (callback) { + callback(); // eslint-disable-line callback-return + } + return; + } else if (this.consoleWarnLevels[info[LEVEL]]) { + if (console._stderr && !this.forceConsole) { + // Node.js maps `process.stderr` to `console._stderr`. + // in Node.js console.warn is an alias for console.error + console._stderr.write(`${info[MESSAGE]}${this.eol}`); + } else { + // console.warn adds a newline + this._consoleWarn(info[MESSAGE]); + } + + if (callback) { + callback(); // eslint-disable-line callback-return + } + return; + } + + if (console._stdout && !this.forceConsole) { + // Node.js maps `process.stdout` to `console._stdout`. + console._stdout.write(`${info[MESSAGE]}${this.eol}`); + } else { + // console.log adds a newline. + this._consoleLog(info[MESSAGE]); + } + + if (callback) { + callback(); // eslint-disable-line callback-return + } + } + + /** + * Returns a Set-like object with strArray's elements as keys (each with the + * value true). + * @param {Array} strArray - Array of Set-elements as strings. + * @param {?string} [errMsg] - Custom error message thrown on invalid input. + * @returns {Object} - TODO: add return description. + * @private + */ + _stringArrayToSet(strArray, errMsg) { + if (!strArray) return {}; + + errMsg = + errMsg || 'Cannot make set from type other than Array of string elements'; + + if (!Array.isArray(strArray)) { + throw new Error(errMsg); + } + + return strArray.reduce((set, el) => { + if (typeof el !== 'string') { + throw new Error(errMsg); + } + set[el] = true; + + return set; + }, {}); + } +}; + + +/***/ }), + +/***/ 36800: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* eslint-disable complexity,max-statements */ +/** + * file.js: Transport for outputting to a local log file. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const fs = __webpack_require__(79896); +const path = __webpack_require__(16928); +const asyncSeries = __webpack_require__(43745); +const zlib = __webpack_require__(43106); +const { MESSAGE } = __webpack_require__(80310); +const { Stream, PassThrough } = __webpack_require__(72093); +const TransportStream = __webpack_require__(86558); +const debug = __webpack_require__(98005)('winston:file'); +const os = __webpack_require__(70857); +const tailFile = __webpack_require__(52106); + +/** + * Transport for outputting to a local log file. + * @type {File} + * @extends {TransportStream} + */ +module.exports = class File extends TransportStream { + /** + * Constructor function for the File transport object responsible for + * persisting log messages and metadata to one or more files. + * @param {Object} options - Options for this instance. + */ + constructor(options = {}) { + super(options); + + // Expose the name of this Transport on the prototype. + this.name = options.name || 'file'; + + // Helper function which throws an `Error` in the event that any of the + // rest of the arguments is present in `options`. + function throwIf(target, ...args) { + args.slice(1).forEach(name => { + if (options[name]) { + throw new Error(`Cannot set ${name} and ${target} together`); + } + }); + } + + // Setup the base stream that always gets piped to to handle buffering. + this._stream = new PassThrough(); + this._stream.setMaxListeners(30); + + // Bind this context for listener methods. + this._onError = this._onError.bind(this); + + if (options.filename || options.dirname) { + throwIf('filename or dirname', 'stream'); + this._basename = this.filename = options.filename + ? path.basename(options.filename) + : 'winston.log'; + + this.dirname = options.dirname || path.dirname(options.filename); + this.options = options.options || { flags: 'a' }; + } else if (options.stream) { + // eslint-disable-next-line no-console + console.warn('options.stream will be removed in winston@4. Use winston.transports.Stream'); + throwIf('stream', 'filename', 'maxsize'); + this._dest = this._stream.pipe(this._setupStream(options.stream)); + this.dirname = path.dirname(this._dest.path); + // We need to listen for drain events when write() returns false. This + // can make node mad at times. + } else { + throw new Error('Cannot log to file without filename or stream.'); + } + + this.maxsize = options.maxsize || null; + this.rotationFormat = options.rotationFormat || false; + this.zippedArchive = options.zippedArchive || false; + this.maxFiles = options.maxFiles || null; + this.eol = (typeof options.eol === 'string') ? options.eol : os.EOL; + this.tailable = options.tailable || false; + this.lazy = options.lazy || false; + + // Internal state variables representing the number of files this instance + // has created and the current size (in bytes) of the current logfile. + this._size = 0; + this._pendingSize = 0; + this._created = 0; + this._drain = false; + this._opening = false; + this._ending = false; + this._fileExist = false; + + if (this.dirname) this._createLogDirIfNotExist(this.dirname); + if (!this.lazy) this.open(); + } + + finishIfEnding() { + if (this._ending) { + if (this._opening) { + this.once('open', () => { + this._stream.once('finish', () => this.emit('finish')); + setImmediate(() => this._stream.end()); + }); + } else { + this._stream.once('finish', () => this.emit('finish')); + setImmediate(() => this._stream.end()); + } + } + } + + /** + * Core logging method exposed to Winston. Metadata is optional. + * @param {Object} info - TODO: add param description. + * @param {Function} callback - TODO: add param description. + * @returns {undefined} + */ + log(info, callback = () => { }) { + // Remark: (jcrugzz) What is necessary about this callback(null, true) now + // when thinking about 3.x? Should silent be handled in the base + // TransportStream _write method? + if (this.silent) { + callback(); + return true; + } + + + // Output stream buffer is full and has asked us to wait for the drain event + if (this._drain) { + this._stream.once('drain', () => { + this._drain = false; + this.log(info, callback); + }); + return; + } + if (this._rotate) { + this._stream.once('rotate', () => { + this._rotate = false; + this.log(info, callback); + }); + return; + } + if (this.lazy) { + if (!this._fileExist) { + if (!this._opening) { + this.open(); + } + this.once('open', () => { + this._fileExist = true; + this.log(info, callback); + return; + }); + return; + } + if (this._needsNewFile(this._pendingSize)) { + this._dest.once('close', () => { + if (!this._opening) { + this.open(); + } + this.once('open', () => { + this.log(info, callback); + return; + }); + return; + }); + return; + } + } + + // Grab the raw string and append the expected EOL. + const output = `${info[MESSAGE]}${this.eol}`; + const bytes = Buffer.byteLength(output); + + // After we have written to the PassThrough check to see if we need + // to rotate to the next file. + // + // Remark: This gets called too early and does not depict when data + // has been actually flushed to disk. + function logged() { + this._size += bytes; + this._pendingSize -= bytes; + + debug('logged %s %s', this._size, output); + this.emit('logged', info); + + // Do not attempt to rotate files while rotating + if (this._rotate) { + return; + } + + // Do not attempt to rotate files while opening + if (this._opening) { + return; + } + + // Check to see if we need to end the stream and create a new one. + if (!this._needsNewFile()) { + return; + } + if (this.lazy) { + this._endStream(() => {this.emit('fileclosed');}); + return; + } + + // End the current stream, ensure it flushes and create a new one. + // This could potentially be optimized to not run a stat call but its + // the safest way since we are supporting `maxFiles`. + this._rotate = true; + this._endStream(() => this._rotateFile()); + } + + // Keep track of the pending bytes being written while files are opening + // in order to properly rotate the PassThrough this._stream when the file + // eventually does open. + this._pendingSize += bytes; + if (this._opening + && !this.rotatedWhileOpening + && this._needsNewFile(this._size + this._pendingSize)) { + this.rotatedWhileOpening = true; + } + + const written = this._stream.write(output, logged.bind(this)); + if (!written) { + this._drain = true; + this._stream.once('drain', () => { + this._drain = false; + callback(); + }); + } else { + callback(); // eslint-disable-line callback-return + } + + debug('written', written, this._drain); + + this.finishIfEnding(); + + return written; + } + + /** + * Query the transport. Options object is optional. + * @param {Object} options - Loggly-like query options for this instance. + * @param {function} callback - Continuation to respond to when complete. + * TODO: Refactor me. + */ + query(options, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } + + options = normalizeQuery(options); + const file = path.join(this.dirname, this.filename); + let buff = ''; + let results = []; + let row = 0; + + const stream = fs.createReadStream(file, { + encoding: 'utf8' + }); + + stream.on('error', err => { + if (stream.readable) { + stream.destroy(); + } + if (!callback) { + return; + } + + return err.code !== 'ENOENT' ? callback(err) : callback(null, results); + }); + + stream.on('data', data => { + data = (buff + data).split(/\n+/); + const l = data.length - 1; + let i = 0; + + for (; i < l; i++) { + if (!options.start || row >= options.start) { + add(data[i]); + } + row++; + } + + buff = data[l]; + }); + + stream.on('close', () => { + if (buff) { + add(buff, true); + } + if (options.order === 'desc') { + results = results.reverse(); + } + + // eslint-disable-next-line callback-return + if (callback) callback(null, results); + }); + + function add(buff, attempt) { + try { + const log = JSON.parse(buff); + if (check(log)) { + push(log); + } + } catch (e) { + if (!attempt) { + stream.emit('error', e); + } + } + } + + function push(log) { + if ( + options.rows && + results.length >= options.rows && + options.order !== 'desc' + ) { + if (stream.readable) { + stream.destroy(); + } + return; + } + + if (options.fields) { + log = options.fields.reduce((obj, key) => { + obj[key] = log[key]; + return obj; + }, {}); + } + + if (options.order === 'desc') { + if (results.length >= options.rows) { + results.shift(); + } + } + results.push(log); + } + + function check(log) { + if (!log) { + return; + } + + if (typeof log !== 'object') { + return; + } + + const time = new Date(log.timestamp); + if ( + (options.from && time < options.from) || + (options.until && time > options.until) || + (options.level && options.level !== log.level) + ) { + return; + } + + return true; + } + + function normalizeQuery(options) { + options = options || {}; + + // limit + options.rows = options.rows || options.limit || 10; + + // starting row offset + options.start = options.start || 0; + + // now + options.until = options.until || new Date(); + if (typeof options.until !== 'object') { + options.until = new Date(options.until); + } + + // now - 24 + options.from = options.from || (options.until - (24 * 60 * 60 * 1000)); + if (typeof options.from !== 'object') { + options.from = new Date(options.from); + } + + // 'asc' or 'desc' + options.order = options.order || 'desc'; + + return options; + } + } + + /** + * Returns a log stream for this transport. Options object is optional. + * @param {Object} options - Stream options for this instance. + * @returns {Stream} - TODO: add return description. + * TODO: Refactor me. + */ + stream(options = {}) { + const file = path.join(this.dirname, this.filename); + const stream = new Stream(); + const tail = { + file, + start: options.start + }; + + stream.destroy = tailFile(tail, (err, line) => { + if (err) { + return stream.emit('error', err); + } + + try { + stream.emit('data', line); + line = JSON.parse(line); + stream.emit('log', line); + } catch (e) { + stream.emit('error', e); + } + }); + + return stream; + } + + /** + * Checks to see the filesize of. + * @returns {undefined} + */ + open() { + // If we do not have a filename then we were passed a stream and + // don't need to keep track of size. + if (!this.filename) return; + if (this._opening) return; + + this._opening = true; + + // Stat the target file to get the size and create the stream. + this.stat((err, size) => { + if (err) { + return this.emit('error', err); + } + debug('stat done: %s { size: %s }', this.filename, size); + this._size = size; + this._dest = this._createStream(this._stream); + this._opening = false; + this.once('open', () => { + if (!this._stream.emit('rotate')) { + this._rotate = false; + } + }); + }); + } + + /** + * Stat the file and assess information in order to create the proper stream. + * @param {function} callback - TODO: add param description. + * @returns {undefined} + */ + stat(callback) { + const target = this._getFile(); + const fullpath = path.join(this.dirname, target); + + fs.stat(fullpath, (err, stat) => { + if (err && err.code === 'ENOENT') { + debug('ENOENT ok', fullpath); + // Update internally tracked filename with the new target name. + this.filename = target; + return callback(null, 0); + } + + if (err) { + debug(`err ${err.code} ${fullpath}`); + return callback(err); + } + + if (!stat || this._needsNewFile(stat.size)) { + // If `stats.size` is greater than the `maxsize` for this + // instance then try again. + return this._incFile(() => this.stat(callback)); + } + + // Once we have figured out what the filename is, set it + // and return the size. + this.filename = target; + callback(null, stat.size); + }); + } + + /** + * Closes the stream associated with this instance. + * @param {function} cb - TODO: add param description. + * @returns {undefined} + */ + close(cb) { + if (!this._stream) { + return; + } + + this._stream.end(() => { + if (cb) { + cb(); // eslint-disable-line callback-return + } + this.emit('flush'); + this.emit('closed'); + }); + } + + /** + * TODO: add method description. + * @param {number} size - TODO: add param description. + * @returns {undefined} + */ + _needsNewFile(size) { + size = size || this._size; + return this.maxsize && size >= this.maxsize; + } + + /** + * TODO: add method description. + * @param {Error} err - TODO: add param description. + * @returns {undefined} + */ + _onError(err) { + this.emit('error', err); + } + + /** + * TODO: add method description. + * @param {Stream} stream - TODO: add param description. + * @returns {mixed} - TODO: add return description. + */ + _setupStream(stream) { + stream.on('error', this._onError); + + return stream; + } + + /** + * TODO: add method description. + * @param {Stream} stream - TODO: add param description. + * @returns {mixed} - TODO: add return description. + */ + _cleanupStream(stream) { + stream.removeListener('error', this._onError); + stream.destroy(); + return stream; + } + + /** + * TODO: add method description. + */ + _rotateFile() { + this._incFile(() => this.open()); + } + + /** + * Unpipe from the stream that has been marked as full and end it so it + * flushes to disk. + * + * @param {function} callback - Callback for when the current file has closed. + * @private + */ + _endStream(callback = () => { }) { + if (this._dest) { + this._stream.unpipe(this._dest); + this._dest.end(() => { + this._cleanupStream(this._dest); + callback(); + }); + } else { + callback(); // eslint-disable-line callback-return + } + } + + /** + * Returns the WritableStream for the active file on this instance. If we + * should gzip the file then a zlib stream is returned. + * + * @param {ReadableStream} source –PassThrough to pipe to the file when open. + * @returns {WritableStream} Stream that writes to disk for the active file. + */ + _createStream(source) { + const fullpath = path.join(this.dirname, this.filename); + + debug('create stream start', fullpath, this.options); + const dest = fs.createWriteStream(fullpath, this.options) + // TODO: What should we do with errors here? + .on('error', err => debug(err)) + .on('close', () => debug('close', dest.path, dest.bytesWritten)) + .on('open', () => { + debug('file open ok', fullpath); + this.emit('open', fullpath); + source.pipe(dest); + + // If rotation occured during the open operation then we immediately + // start writing to a new PassThrough, begin opening the next file + // and cleanup the previous source and dest once the source has drained. + if (this.rotatedWhileOpening) { + this._stream = new PassThrough(); + this._stream.setMaxListeners(30); + this._rotateFile(); + this.rotatedWhileOpening = false; + this._cleanupStream(dest); + source.end(); + } + }); + + debug('create stream ok', fullpath); + return dest; + } + + /** + * TODO: add method description. + * @param {function} callback - TODO: add param description. + * @returns {undefined} + */ + _incFile(callback) { + debug('_incFile', this.filename); + const ext = path.extname(this._basename); + const basename = path.basename(this._basename, ext); + const tasks = []; + + if (this.zippedArchive) { + tasks.push( + function (cb) { + const num = this._created > 0 && !this.tailable ? this._created : ''; + this._compressFile( + path.join(this.dirname, `${basename}${num}${ext}`), + path.join(this.dirname, `${basename}${num}${ext}.gz`), + cb + ); + }.bind(this) + ); + } + + tasks.push( + function (cb) { + if (!this.tailable) { + this._created += 1; + this._checkMaxFilesIncrementing(ext, basename, cb); + } else { + this._checkMaxFilesTailable(ext, basename, cb); + } + }.bind(this) + ); + + asyncSeries(tasks, callback); + } + + /** + * Gets the next filename to use for this instance in the case that log + * filesizes are being capped. + * @returns {string} - TODO: add return description. + * @private + */ + _getFile() { + const ext = path.extname(this._basename); + const basename = path.basename(this._basename, ext); + const isRotation = this.rotationFormat + ? this.rotationFormat() + : this._created; + + // Caveat emptor (indexzero): rotationFormat() was broken by design When + // combined with max files because the set of files to unlink is never + // stored. + return !this.tailable && this._created + ? `${basename}${isRotation}${ext}` + : `${basename}${ext}`; + } + + /** + * Increment the number of files created or checked by this instance. + * @param {mixed} ext - TODO: add param description. + * @param {mixed} basename - TODO: add param description. + * @param {mixed} callback - TODO: add param description. + * @returns {undefined} + * @private + */ + _checkMaxFilesIncrementing(ext, basename, callback) { + // Check for maxFiles option and delete file. + if (!this.maxFiles || this._created < this.maxFiles) { + return setImmediate(callback); + } + + const oldest = this._created - this.maxFiles; + const isOldest = oldest !== 0 ? oldest : ''; + const isZipped = this.zippedArchive ? '.gz' : ''; + const filePath = `${basename}${isOldest}${ext}${isZipped}`; + const target = path.join(this.dirname, filePath); + + fs.unlink(target, callback); + } + + /** + * Roll files forward based on integer, up to maxFiles. e.g. if base if + * file.log and it becomes oversized, roll to file1.log, and allow file.log + * to be re-used. If file is oversized again, roll file1.log to file2.log, + * roll file.log to file1.log, and so on. + * @param {mixed} ext - TODO: add param description. + * @param {mixed} basename - TODO: add param description. + * @param {mixed} callback - TODO: add param description. + * @returns {undefined} + * @private + */ + _checkMaxFilesTailable(ext, basename, callback) { + const tasks = []; + if (!this.maxFiles) { + return; + } + + // const isZipped = this.zippedArchive ? '.gz' : ''; + const isZipped = this.zippedArchive ? '.gz' : ''; + for (let x = this.maxFiles - 1; x > 1; x--) { + tasks.push(function (i, cb) { + let fileName = `${basename}${(i - 1)}${ext}${isZipped}`; + const tmppath = path.join(this.dirname, fileName); + + fs.exists(tmppath, exists => { + if (!exists) { + return cb(null); + } + + fileName = `${basename}${i}${ext}${isZipped}`; + fs.rename(tmppath, path.join(this.dirname, fileName), cb); + }); + }.bind(this, x)); + } + + asyncSeries(tasks, () => { + fs.rename( + path.join(this.dirname, `${basename}${ext}${isZipped}`), + path.join(this.dirname, `${basename}1${ext}${isZipped}`), + callback + ); + }); + } + + /** + * Compresses src to dest with gzip and unlinks src + * @param {string} src - path to source file. + * @param {string} dest - path to zipped destination file. + * @param {Function} callback - callback called after file has been compressed. + * @returns {undefined} + * @private + */ + _compressFile(src, dest, callback) { + fs.access(src, fs.F_OK, (err) => { + if (err) { + return callback(); + } + var gzip = zlib.createGzip(); + var inp = fs.createReadStream(src); + var out = fs.createWriteStream(dest); + out.on('finish', () => { + fs.unlink(src, callback); + }); + inp.pipe(gzip).pipe(out); + }); + } + + _createLogDirIfNotExist(dirPath) { + /* eslint-disable no-sync */ + if (!fs.existsSync(dirPath)) { + fs.mkdirSync(dirPath, { recursive: true }); + } + /* eslint-enable no-sync */ + } +}; + + +/***/ }), + +/***/ 12326: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * http.js: Transport for outputting to a json-rpcserver. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const http = __webpack_require__(58611); +const https = __webpack_require__(65692); +const { Stream } = __webpack_require__(72093); +const TransportStream = __webpack_require__(86558); +const { configure } = __webpack_require__(27433); + +/** + * Transport for outputting to a json-rpc server. + * @type {Stream} + * @extends {TransportStream} + */ +module.exports = class Http extends TransportStream { + /** + * Constructor function for the Http transport object responsible for + * persisting log messages and metadata to a terminal or TTY. + * @param {!Object} [options={}] - Options for this instance. + */ + // eslint-disable-next-line max-statements + constructor(options = {}) { + super(options); + + this.options = options; + this.name = options.name || 'http'; + this.ssl = !!options.ssl; + this.host = options.host || 'localhost'; + this.port = options.port; + this.auth = options.auth; + this.path = options.path || ''; + this.maximumDepth = options.maximumDepth; + this.agent = options.agent; + this.headers = options.headers || {}; + this.headers['content-type'] = 'application/json'; + this.batch = options.batch || false; + this.batchInterval = options.batchInterval || 5000; + this.batchCount = options.batchCount || 10; + this.batchOptions = []; + this.batchTimeoutID = -1; + this.batchCallback = {}; + + if (!this.port) { + this.port = this.ssl ? 443 : 80; + } + } + + /** + * Core logging method exposed to Winston. + * @param {Object} info - TODO: add param description. + * @param {function} callback - TODO: add param description. + * @returns {undefined} + */ + log(info, callback) { + this._request(info, null, null, (err, res) => { + if (res && res.statusCode !== 200) { + err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`); + } + + if (err) { + this.emit('warn', err); + } else { + this.emit('logged', info); + } + }); + + // Remark: (jcrugzz) Fire and forget here so requests dont cause buffering + // and block more requests from happening? + if (callback) { + setImmediate(callback); + } + } + + /** + * Query the transport. Options object is optional. + * @param {Object} options - Loggly-like query options for this instance. + * @param {function} callback - Continuation to respond to when complete. + * @returns {undefined} + */ + query(options, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } + + options = { + method: 'query', + params: this.normalizeQuery(options) + }; + + const auth = options.params.auth || null; + delete options.params.auth; + + const path = options.params.path || null; + delete options.params.path; + + this._request(options, auth, path, (err, res, body) => { + if (res && res.statusCode !== 200) { + err = new Error(`Invalid HTTP Status Code: ${res.statusCode}`); + } + + if (err) { + return callback(err); + } + + if (typeof body === 'string') { + try { + body = JSON.parse(body); + } catch (e) { + return callback(e); + } + } + + callback(null, body); + }); + } + + /** + * Returns a log stream for this transport. Options object is optional. + * @param {Object} options - Stream options for this instance. + * @returns {Stream} - TODO: add return description + */ + stream(options = {}) { + const stream = new Stream(); + options = { + method: 'stream', + params: options + }; + + const path = options.params.path || null; + delete options.params.path; + + const auth = options.params.auth || null; + delete options.params.auth; + + let buff = ''; + const req = this._request(options, auth, path); + + stream.destroy = () => req.destroy(); + req.on('data', data => { + data = (buff + data).split(/\n+/); + const l = data.length - 1; + + let i = 0; + for (; i < l; i++) { + try { + stream.emit('log', JSON.parse(data[i])); + } catch (e) { + stream.emit('error', e); + } + } + + buff = data[l]; + }); + req.on('error', err => stream.emit('error', err)); + + return stream; + } + + /** + * Make a request to a winstond server or any http server which can + * handle json-rpc. + * @param {function} options - Options to sent the request. + * @param {Object?} auth - authentication options + * @param {string} path - request path + * @param {function} callback - Continuation to respond to when complete. + */ + _request(options, auth, path, callback) { + options = options || {}; + + auth = auth || this.auth; + path = path || this.path || ''; + + if (this.batch) { + this._doBatch(options, callback, auth, path); + } else { + this._doRequest(options, callback, auth, path); + } + } + + /** + * Send or memorize the options according to batch configuration + * @param {function} options - Options to sent the request. + * @param {function} callback - Continuation to respond to when complete. + * @param {Object?} auth - authentication options + * @param {string} path - request path + */ + _doBatch(options, callback, auth, path) { + this.batchOptions.push(options); + if (this.batchOptions.length === 1) { + // First message stored, it's time to start the timeout! + const me = this; + this.batchCallback = callback; + this.batchTimeoutID = setTimeout(function () { + // timeout is reached, send all messages to endpoint + me.batchTimeoutID = -1; + me._doBatchRequest(me.batchCallback, auth, path); + }, this.batchInterval); + } + if (this.batchOptions.length === this.batchCount) { + // max batch count is reached, send all messages to endpoint + this._doBatchRequest(this.batchCallback, auth, path); + } + } + + /** + * Initiate a request with the memorized batch options, stop the batch timeout + * @param {function} callback - Continuation to respond to when complete. + * @param {Object?} auth - authentication options + * @param {string} path - request path + */ + _doBatchRequest(callback, auth, path) { + if (this.batchTimeoutID > 0) { + clearTimeout(this.batchTimeoutID); + this.batchTimeoutID = -1; + } + const batchOptionsCopy = this.batchOptions.slice(); + this.batchOptions = []; + this._doRequest(batchOptionsCopy, callback, auth, path); + } + + /** + * Make a request to a winstond server or any http server which can + * handle json-rpc. + * @param {function} options - Options to sent the request. + * @param {function} callback - Continuation to respond to when complete. + * @param {Object?} auth - authentication options + * @param {string} path - request path + */ + _doRequest(options, callback, auth, path) { + // Prepare options for outgoing HTTP request + const headers = Object.assign({}, this.headers); + if (auth && auth.bearer) { + headers.Authorization = `Bearer ${auth.bearer}`; + } + const req = (this.ssl ? https : http).request({ + ...this.options, + method: 'POST', + host: this.host, + port: this.port, + path: `/${path.replace(/^\//, '')}`, + headers: headers, + auth: (auth && auth.username && auth.password) ? (`${auth.username}:${auth.password}`) : '', + agent: this.agent + }); + + req.on('error', callback); + req.on('response', res => ( + res.on('end', () => callback(null, res)).resume() + )); + const jsonStringify = configure({ + ...(this.maximumDepth && { maximumDepth: this.maximumDepth }) + }); + req.end(Buffer.from(jsonStringify(options, this.options.replacer), 'utf8')); + } +}; + + +/***/ }), + +/***/ 16176: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; +/** + * transports.js: Set of all transports Winston knows about. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +/** + * TODO: add property description. + * @type {Console} + */ +Object.defineProperty(exports, "Console", ({ + configurable: true, + enumerable: true, + get() { + return __webpack_require__(58957); + } +})); + +/** + * TODO: add property description. + * @type {File} + */ +Object.defineProperty(exports, "File", ({ + configurable: true, + enumerable: true, + get() { + return __webpack_require__(36800); + } +})); + +/** + * TODO: add property description. + * @type {Http} + */ +Object.defineProperty(exports, "Http", ({ + configurable: true, + enumerable: true, + get() { + return __webpack_require__(12326); + } +})); + +/** + * TODO: add property description. + * @type {Stream} + */ +Object.defineProperty(exports, "Stream", ({ + configurable: true, + enumerable: true, + get() { + return __webpack_require__(1870); + } +})); + + +/***/ }), + +/***/ 1870: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/** + * stream.js: Transport for outputting to any arbitrary stream. + * + * (C) 2010 Charlie Robbins + * MIT LICENCE + */ + + + +const isStream = __webpack_require__(79421); +const { MESSAGE } = __webpack_require__(80310); +const os = __webpack_require__(70857); +const TransportStream = __webpack_require__(86558); + +/** + * Transport for outputting to any arbitrary stream. + * @type {Stream} + * @extends {TransportStream} + */ +module.exports = class Stream extends TransportStream { + /** + * Constructor function for the Console transport object responsible for + * persisting log messages and metadata to a terminal or TTY. + * @param {!Object} [options={}] - Options for this instance. + */ + constructor(options = {}) { + super(options); + + if (!options.stream || !isStream(options.stream)) { + throw new Error('options.stream is required.'); + } + + // We need to listen for drain events when write() returns false. This can + // make node mad at times. + this._stream = options.stream; + this._stream.setMaxListeners(Infinity); + this.isObjectMode = options.stream._writableState.objectMode; + this.eol = (typeof options.eol === 'string') ? options.eol : os.EOL; + } + + /** + * Core logging method exposed to Winston. + * @param {Object} info - TODO: add param description. + * @param {Function} callback - TODO: add param description. + * @returns {undefined} + */ + log(info, callback) { + setImmediate(() => this.emit('logged', info)); + if (this.isObjectMode) { + this._stream.write(info); + if (callback) { + callback(); // eslint-disable-line callback-return + } + return; + } + + this._stream.write(`${info[MESSAGE]}${this.eol}`); + if (callback) { + callback(); // eslint-disable-line callback-return + } + return; + } +}; + + +/***/ }), + +/***/ 646: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const stringWidth = __webpack_require__(46890); +const stripAnsi = __webpack_require__(96376); +const ansiStyles = __webpack_require__(1806); + +const ESCAPES = new Set([ + '\u001B', + '\u009B' +]); + +const END_CODE = 39; + +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 +const wordLengths = string => string.split(' ').map(character => stringWidth(character)); + +// Wrap a long word across multiple rows +// Ansi escape codes do not count towards length +const wrapWord = (rows, word, columns) => { + const characters = [...word]; + + let isInsideEscape = false; + let visible = stringWidth(stripAnsi(rows[rows.length - 1])); + + for (const [index, character] of characters.entries()) { + const characterLength = stringWidth(character); + + if (visible + characterLength <= columns) { + rows[rows.length - 1] += character; + } else { + rows.push(character); + visible = 0; + } + + if (ESCAPES.has(character)) { + isInsideEscape = true; + } else if (isInsideEscape && character === 'm') { + isInsideEscape = false; + continue; + } + + if (isInsideEscape) { + continue; + } + + visible += characterLength; + + if (visible === columns && index < characters.length - 1) { + rows.push(''); + visible = 0; + } + } + + // It's possible that the last row we copy over is only + // ansi escape characters, handle this edge-case + if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) { + rows[rows.length - 2] += rows.pop(); + } +}; + +// Trims spaces from a string ignoring invisible sequences +const stringVisibleTrimSpacesRight = str => { + const words = str.split(' '); + let last = words.length; + + while (last > 0) { + if (stringWidth(words[last - 1]) > 0) { + break; + } + + last--; + } + + if (last === words.length) { + return str; + } + + return words.slice(0, last).join(' ') + words.slice(last).join(''); +}; + +// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode +// +// 'hard' will never allow a string to take up more than columns characters +// +// 'soft' allows long words to expand past the column length +const exec = (string, columns, options = {}) => { + if (options.trim !== false && string.trim() === '') { + return ''; + } + + let pre = ''; + let ret = ''; + let escapeCode; + + 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].trimLeft(); + } + + let rowLength = stringWidth(rows[rows.length - 1]); + + if (index !== 0) { + if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) { + // If we start with a new word but the current row length equals the length of the columns, add a new row + rows.push(''); + rowLength = 0; + } + + if (rowLength > 0 || options.trim === false) { + rows[rows.length - 1] += ' '; + rowLength++; + } + } + + // In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns' + if (options.hard && lengths[index] > columns) { + const remainingColumns = (columns - rowLength); + const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns); + const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns); + if (breaksStartingNextLine < breaksStartingThisLine) { + rows.push(''); + } + + wrapWord(rows, word, columns); + continue; + } + + if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) { + if (options.wordWrap === false && rowLength < columns) { + wrapWord(rows, word, columns); + continue; + } + + rows.push(''); + } + + if (rowLength + lengths[index] > columns && options.wordWrap === false) { + wrapWord(rows, word, columns); + continue; + } + + rows[rows.length - 1] += word; + } + + if (options.trim !== false) { + rows = rows.map(stringVisibleTrimSpacesRight); + } + + pre = rows.join('\n'); + + for (const [index, character] of [...pre].entries()) { + ret += character; + + if (ESCAPES.has(character)) { + 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 (escapeCode && code) { + if (pre[index + 1] === '\n') { + ret += wrapAnsi(code); + } else if (character === '\n') { + ret += wrapAnsi(escapeCode); + } + } + } + + return ret; +}; + +// For each newline, invoke the method separately +module.exports = (string, columns, options) => { + return String(string) + .normalize() + .replace(/\r\n/g, '\n') + .split('\n') + .map(line => exec(line, columns, options)) + .join('\n'); +}; + + +/***/ }), + +/***/ 89431: +/***/ ((module) => { + +"use strict"; + + +module.exports = ({onlyFirst = false} = {}) => { + const pattern = [ + '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', + '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))' + ].join('|'); + + return new RegExp(pattern, onlyFirst ? undefined : 'g'); +}; + + +/***/ }), + +/***/ 7486: +/***/ ((module) => { + +"use strict"; + + +module.exports = function () { + // https://mths.be/emoji + 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; +}; + + +/***/ }), + +/***/ 46890: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const stripAnsi = __webpack_require__(96376); +const isFullwidthCodePoint = __webpack_require__(49245); +const emojiRegex = __webpack_require__(7486); + +const stringWidth = string => { + if (typeof string !== 'string' || string.length === 0) { + return 0; + } + + string = stripAnsi(string); + + if (string.length === 0) { + return 0; + } + + string = string.replace(emojiRegex(), ' '); + + let width = 0; + + for (let i = 0; i < string.length; i++) { + const code = string.codePointAt(i); + + // Ignore control characters + if (code <= 0x1F || (code >= 0x7F && code <= 0x9F)) { + continue; + } + + // Ignore combining characters + if (code >= 0x300 && code <= 0x36F) { + continue; + } + + // Surrogates + if (code > 0xFFFF) { + i++; + } + + width += isFullwidthCodePoint(code) ? 2 : 1; + } + + return width; +}; + +module.exports = stringWidth; +// TODO: remove this in the next major version +module.exports["default"] = stringWidth; + + +/***/ }), + +/***/ 96376: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const ansiRegex = __webpack_require__(89431); + +module.exports = string => typeof string === 'string' ? string.replace(ansiRegex(), '') : string; + + +/***/ }), + +/***/ 35956: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 13987: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var balanced = __webpack_require__(35956); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + } + + return expansions; +} + + + +/***/ }), + +/***/ 67825: +/***/ ((module) => { + +/* eslint-disable node/no-deprecated-api */ + +var toString = Object.prototype.toString + +var isModern = ( + typeof Buffer !== 'undefined' && + typeof Buffer.alloc === 'function' && + typeof Buffer.allocUnsafe === 'function' && + typeof Buffer.from === 'function' +) + +function isArrayBuffer (input) { + return toString.call(input).slice(8, -1) === 'ArrayBuffer' +} + +function fromArrayBuffer (obj, byteOffset, length) { + byteOffset >>>= 0 + + var maxLength = obj.byteLength - byteOffset + + if (maxLength < 0) { + throw new RangeError("'offset' is out of bounds") + } + + if (length === undefined) { + length = maxLength + } else { + length >>>= 0 + + if (length > maxLength) { + throw new RangeError("'length' is out of bounds") + } + } + + return isModern + ? Buffer.from(obj.slice(byteOffset, byteOffset + length)) + : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length))) +} + +function fromString (string, encoding) { + if (typeof encoding !== 'string' || encoding === '') { + encoding = 'utf8' + } + + if (!Buffer.isEncoding(encoding)) { + throw new TypeError('"encoding" must be a valid string encoding') + } + + return isModern + ? Buffer.from(string, encoding) + : new Buffer(string, encoding) +} + +function bufferFrom (value, encodingOrOffset, length) { + if (typeof value === 'number') { + throw new TypeError('"value" argument must not be a number') + } + + if (isArrayBuffer(value)) { + return fromArrayBuffer(value, encodingOrOffset, length) + } + + if (typeof value === 'string') { + return fromString(value, encodingOrOffset) + } + + return isModern + ? Buffer.from(value) + : new Buffer(value) +} + +module.exports = bufferFrom + + +/***/ }), + +/***/ 14128: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const variable = __webpack_require__(35167) +const EnvVarError = __webpack_require__(86415) + +/** + * Returns an "env-var" instance that reads from the given container of values. + * By default, we export an instance that reads from process.env + * @param {Object} container target container to read values from + * @param {Object} extraAccessors additional accessors to attach to the + * resulting object + * @return {Object} a new module instance + */ +const from = (container, extraAccessors, logger) => { + return { + from: from, + + /** + * This is the Error class used to generate exceptions. Can be used to identify + * exceptions and handle them appropriately. + */ + EnvVarError: __webpack_require__(86415), + + /** + * Returns a variable instance with helper functions, or process.env + * @param {String} variableName Name of the environment variable requested + * @return {Object} + */ + get: function (variableName) { + if (!variableName) { + return container + } + + if (arguments.length > 1) { + throw new EnvVarError('It looks like you passed more than one argument to env.get(). Since env-var@6.0.0 this is no longer supported. To set a default value use env.get(TARGET).default(DEFAULT)') + } + + return variable(container, variableName, extraAccessors || {}, logger || function noopLogger () {}) + }, + + /** + * Provides access to the functions that env-var uses to parse + * process.env strings into valid types requested by the API + */ + accessors: __webpack_require__(55172), + + /** + * Provides a default logger that can be used to print logs. + * This will not print logs in a production environment (checks process.env.NODE_ENV) + */ + logger: __webpack_require__(69291)(console.log, container.NODE_ENV) + } +} + +/** + * Makes a best-effort attempt to load environment variables in + * different environments, e.g create-react-app, vite, Node.js + * @returns Object + */ +function getProcessEnv () { + /* istanbul ignore next */ + try { + return process.env + } catch (e) { + return {} + } +} + +/* istanbul ignore next */ +module.exports = from(getProcessEnv()) + + +/***/ }), + +/***/ 2901: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asString = __webpack_require__(26411) + +module.exports = function asArray (value, delimiter) { + delimiter = delimiter || ',' + + if (!value.length) { + return [] + } else { + return asString(value).split(delimiter).filter(Boolean) + } +} + + +/***/ }), + +/***/ 14314: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asBoolStrict (value) { + const val = value.toLowerCase() + + if ((val !== 'false') && (val !== 'true')) { + throw new Error('should be either "true", "false", "TRUE", or "FALSE"') + } + + return val !== 'false' +} + + +/***/ }), + +/***/ 14450: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asBool (value) { + const val = value.toLowerCase() + + const allowedValues = [ + 'false', + '0', + 'true', + '1' + ] + + if (allowedValues.indexOf(val) === -1) { + throw new Error('should be either "true", "false", "TRUE", "FALSE", 1, or 0') + } + + return !(((val === '0') || (val === 'false'))) +} + + +/***/ }), + +/***/ 30096: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asString = __webpack_require__(26411) + +// eslint-disable-next-line no-control-regex +const EMAIL_REGEX = /^(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\u0001-\u0008\u000b\u000c\u000e-\u001f\u0021\u0023-\u005b\u005d-\u007f]|\\[\u0001-\u0009\u000b\u000c\u000e-\u007f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\u0001-\u0008\u000b\u000c\u000e-\u001f\u0021-\u005a\u0053-\u007f]|\\[\u0001-\u0009\u000b\u000c\u000e-\u007f])+)\])$/ + +module.exports = function asEmailString (value) { + const strValue = asString(value) + + if (!EMAIL_REGEX.test(strValue)) { + throw new Error('should be a valid email address') + } + + return strValue +} + + +/***/ }), + +/***/ 83859: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asString = __webpack_require__(26411) + +module.exports = function asEnum (value, validValues) { + const valueString = asString(value) + + if (validValues.indexOf(valueString) < 0) { + throw new Error(`should be one of [${validValues.join(', ')}]`) + } + + return valueString +} + + +/***/ }), + +/***/ 6680: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asFloat = __webpack_require__(63706) + +module.exports = function asFloatNegative (value) { + const ret = asFloat(value) + + if (ret > 0) { + throw new Error('should be a negative float') + } + + return ret +} + + +/***/ }), + +/***/ 78436: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asFloat = __webpack_require__(63706) + +module.exports = function asFloatPositive (value) { + const ret = asFloat(value) + + if (ret < 0) { + throw new Error('should be a positive float') + } + + return ret +} + + +/***/ }), + +/***/ 63706: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asFloat (value) { + const n = parseFloat(value) + + // Some values are parsed as valid floats despite being obviously invalid, e.g. "1.o" or "192.168.1.1". + // In these cases we would want to throw an error. + if (isNaN(n) || isNaN(value)) { + throw new Error('should be a valid float') + } + + return n +} + + +/***/ }), + +/***/ 55172: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = { + asArray: __webpack_require__(2901), + asSet: __webpack_require__(12076), + + asBoolStrict: __webpack_require__(14314), + asBool: __webpack_require__(14450), + + asPortNumber: __webpack_require__(92901), + asEnum: __webpack_require__(83859), + + asFloatNegative: __webpack_require__(6680), + asFloatPositive: __webpack_require__(78436), + asFloat: __webpack_require__(63706), + + asIntNegative: __webpack_require__(85325), + asIntPositive: __webpack_require__(86477), + asInt: __webpack_require__(24541), + + asJsonArray: __webpack_require__(90036), + asJsonObject: __webpack_require__(2862), + asJson: __webpack_require__(51884), + + asRegExp: __webpack_require__(72315), + + asString: __webpack_require__(26411), + + asUrlObject: __webpack_require__(84693), + asUrlString: __webpack_require__(89455), + + asEmailString: __webpack_require__(30096) +} + + +/***/ }), + +/***/ 85325: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asInt = __webpack_require__(24541) + +module.exports = function asIntNegative (value) { + const ret = asInt(value) + + if (ret > 0) { + throw new Error('should be a negative integer') + } + + return ret +} + + +/***/ }), + +/***/ 86477: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asInt = __webpack_require__(24541) + +module.exports = function asIntPositive (value) { + const ret = asInt(value) + + if (ret < 0) { + throw new Error('should be a positive integer') + } + + return ret +} + + +/***/ }), + +/***/ 24541: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asInt (value) { + const n = parseInt(value, 10) + + if (isNaN(n) || n.toString(10) !== value) { + throw new Error('should be a valid integer') + } + + return n +} + + +/***/ }), + +/***/ 90036: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asJson = __webpack_require__(51884) + +module.exports = function asJsonArray (value) { + var ret = asJson(value) + + if (!Array.isArray(ret)) { + throw new Error('should be a parseable JSON Array') + } + + return ret +} + + +/***/ }), + +/***/ 2862: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asJson = __webpack_require__(51884) + +module.exports = function asJsonObject (value) { + var ret = asJson(value) + + if (Array.isArray(ret)) { + throw new Error('should be a parseable JSON Object') + } + + return ret +} + + +/***/ }), + +/***/ 51884: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asJson (value) { + try { + return JSON.parse(value) + } catch (e) { + throw new Error('should be valid (parseable) JSON') + } +} + + +/***/ }), + +/***/ 92901: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asIntPositive = __webpack_require__(86477) + +module.exports = function asPortNumber (value) { + var ret = asIntPositive(value) + + if (ret > 65535) { + throw new Error('cannot assign a port number greater than 65535') + } + + return ret +} + + +/***/ }), + +/***/ 72315: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asRegExp (value, flags) { + // We have to test the value and flags indivudally if we want to write our + // own error messages,as there is no way to differentiate between the two + // errors except by using string comparisons. + + // Test the flags + try { + RegExp(undefined, flags) + } catch (err) { + throw new Error('invalid regexp flags') + } + + try { + return new RegExp(value, flags) + } catch (err) { + // We know that the regexp is the issue because we tested the flags earlier + throw new Error('should be a valid regexp') + } +} + + +/***/ }), + +/***/ 12076: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asArray = __webpack_require__(2901) + +module.exports = function asSet (value, delimiter) { + if (!value.length) { + return new Set() + } else { + return new Set(asArray(value, delimiter)) + } +} + + +/***/ }), + +/***/ 26411: +/***/ ((module) => { + +"use strict"; + + +module.exports = function asString (value) { + return value +} + + +/***/ }), + +/***/ 84693: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const asString = __webpack_require__(26411) + +module.exports = function asUrlObject (value) { + const ret = asString(value) + + try { + return new URL(ret) + } catch (e) { + throw new Error('should be a valid URL') + } +} + + +/***/ }), + +/***/ 89455: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const urlObject = __webpack_require__(84693) + +module.exports = function asUrlString (value) { + return urlObject(value).toString() +} + + +/***/ }), + +/***/ 86415: +/***/ ((module) => { + +"use strict"; + + +/** + * Custom error class that can be used to identify errors generated + * by the module + * @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} + */ +class EnvVarError extends Error { + constructor (message, ...params) { + super(`env-var: ${message}`, ...params) + /* istanbul ignore else */ + if (Error.captureStackTrace) { + Error.captureStackTrace(this, EnvVarError) + } + + this.name = 'EnvVarError' + } +} + +module.exports = EnvVarError + + +/***/ }), + +/***/ 69291: +/***/ ((module) => { + +"use strict"; + + +/** + * Default logger included with env-var. + * Will not log anything if NODE_ENV is set to production + */ +module.exports = function genLogger (out, prodFlag) { + return function envVarLogger (varname, str) { + if (!prodFlag || !prodFlag.match(/prod|production/)) { + out(`env-var (${varname}): ${str}`) + } + } +} + + +/***/ }), + +/***/ 35167: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const EnvVarError = __webpack_require__(86415) +const base64Regex = /^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/ + +/** + * Returns an Object that contains functions to read and specify the format of + * the variable you wish to have returned + * @param {Object} container Encapsulated container (e.g., `process.env`). + * @param {String} varName Name of the requested property from `container`. + * @param {*} defValue Default value to return if `varName` is invalid. + * @param {Object} extraAccessors Extra accessors to install. + * @return {Object} + */ +module.exports = function getVariableAccessors (container, varName, extraAccessors, logger) { + let isBase64 = false + let isRequired = false + let defValue + let example + + const builtInAccessors = __webpack_require__(55172) + + /** + * Logs the given string using the provided logger + * @param {String} str + * @param {String} str + */ + function log (str) { + logger(varName, str) + } + + /** + * Throw an error with a consistent type/format. + * @param {String} value + */ + function raiseError (value, msg) { + let errMsg = `"${varName}" ${msg}` + + if (value) { + errMsg = `${errMsg}` + } + + if (example) { + errMsg = `${errMsg}. An example of a valid value would be: ${example}` + } + + throw new EnvVarError(errMsg) + } + + /** + * Returns an accessor wrapped by error handling and args passing logic + * @param {Function} accessor + */ + function generateAccessor (accessor) { + return function () { + let value = container[varName] + + log(`will be read from the environment using "${accessor.name}" accessor`) + + if (typeof value === 'undefined') { + if (typeof defValue === 'undefined' && isRequired) { + log('was not found in the environment, but is required to be set') + // Var is not set, nor is a default. Throw an error + raiseError(undefined, 'is a required variable, but it was not set') + } else if (typeof defValue !== 'undefined') { + log(`was not found in the environment, parsing default value "${defValue}" instead`) + value = defValue + } else { + log('was not found in the environment, but is not required. returning undefined') + // return undefined since variable is not required and + // there's no default value provided + return undefined + } + } + + if (isRequired) { + log('verifying variable value is not an empty string') + // Need to verify that required variables aren't just whitespace + if (value.trim().length === 0) { + raiseError(undefined, 'is a required variable, but its value was empty') + } + } + + if (isBase64) { + log('verifying variable is a valid base64 string') + if (!value.match(base64Regex)) { + raiseError(value, 'should be a valid base64 string if using convertFromBase64') + } + log('converting from base64 to utf8 string') + value = Buffer.from(value, 'base64').toString() + } + + const args = [value].concat(Array.prototype.slice.call(arguments)) + + try { + log(`passing value "${value}" to "${accessor.name}" accessor`) + + const result = accessor.apply( + accessor, + args + ) + + log(`parsed successfully, returning ${result}`) + return result + } catch (error) { + raiseError(value, error.message) + } + } + } + + const accessors = { + /** + * Instructs env-var to first convert the value of the variable from base64 + * when reading it using a function such as asString() + */ + convertFromBase64: function () { + log('marking for base64 conversion') + isBase64 = true + + return accessors + }, + + /** + * Set a default value for the variable + * @param {String} value + */ + default: function (value) { + if (typeof value === 'number') { + defValue = value.toString() + } else if (Array.isArray(value) || (typeof value === 'object' && value !== null)) { + defValue = JSON.stringify(value) + } else if (typeof value !== 'string') { + throw new EnvVarError('values passed to default() must be of Number, String, Array, or Object type') + } else { + defValue = value + } + + log(`setting default value to "${defValue}"`) + + return accessors + }, + + /** + * Ensures a variable is set in the given environment container. Throws an + * EnvVarError if the variable is not set or a default is not provided + * @param {Boolean} required + */ + required: function (required) { + if (typeof required === 'undefined') { + log('marked as required') + // If no value is passed assume that developer means "true" + // This is to retain support legacy usage (and intuitive) + isRequired = true + } else { + log(`setting required flag to ${required}`) + isRequired = required + } + + return accessors + }, + + /** + * Set an example value for this variable. If the variable value is not set + * or is set to an invalid value this example will be show in error output. + * @param {String} example + */ + example: function (ex) { + example = ex + + return accessors + } + } + + // Attach accessors, and extra accessors if provided. + Object.entries({ + ...builtInAccessors, + ...extraAccessors + }).forEach(([name, accessor]) => { + accessors[name] = generateAccessor(accessor) + }) + + return accessors +} + + +/***/ }), + +/***/ 16966: +/***/ ((module, exports, __webpack_require__) => { + +/* module decorator */ module = __webpack_require__.nmd(module); +var SourceMapConsumer = (__webpack_require__(81914).SourceMapConsumer); +var path = __webpack_require__(16928); + +var fs; +try { + fs = __webpack_require__(79896); + if (!fs.existsSync || !fs.readFileSync) { + // fs doesn't have all methods we need + fs = null; + } +} catch (err) { + /* nop */ +} + +var bufferFrom = __webpack_require__(67825); + +/** + * Requires a module which is protected against bundler minification. + * + * @param {NodeModule} mod + * @param {string} request + */ +function dynamicRequire(mod, request) { + return mod.require(request); +} + +// Only install once if called multiple times +var errorFormatterInstalled = false; +var uncaughtShimInstalled = false; + +// If true, the caches are reset before a stack trace formatting operation +var emptyCacheBetweenOperations = false; + +// Supports {browser, node, auto} +var environment = "auto"; + +// Maps a file path to a string containing the file contents +var fileContentsCache = {}; + +// Maps a file path to a source map for that file +var sourceMapCache = {}; + +// Regex for detecting source maps +var reSourceMap = /^data:application\/json[^,]+base64,/; + +// Priority list of retrieve handlers +var retrieveFileHandlers = []; +var retrieveMapHandlers = []; + +function isInBrowser() { + if (environment === "browser") + return true; + if (environment === "node") + return false; + return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === "renderer")); +} + +function hasGlobalProcessEventEmitter() { + return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function')); +} + +function globalProcessVersion() { + if ((typeof process === 'object') && (process !== null)) { + return process.version; + } else { + return ''; + } +} + +function globalProcessStderr() { + if ((typeof process === 'object') && (process !== null)) { + return process.stderr; + } +} + +function globalProcessExit(code) { + if ((typeof process === 'object') && (process !== null) && (typeof process.exit === 'function')) { + return process.exit(code); + } +} + +function handlerExec(list) { + return function(arg) { + for (var i = 0; i < list.length; i++) { + var ret = list[i](arg); + if (ret) { + return ret; + } + } + return null; + }; +} + +var retrieveFile = handlerExec(retrieveFileHandlers); + +retrieveFileHandlers.push(function(path) { + // Trim the path to make sure there is no extra whitespace. + path = path.trim(); + if (/^file:/.test(path)) { + // existsSync/readFileSync can't handle file protocol, but once stripped, it works + path = path.replace(/file:\/\/\/(\w:)?/, function(protocol, drive) { + return drive ? + '' : // file:///C:/dir/file -> C:/dir/file + '/'; // file:///root-dir/file -> /root-dir/file + }); + } + if (path in fileContentsCache) { + return fileContentsCache[path]; + } + + var contents = ''; + try { + if (!fs) { + // Use SJAX if we are in the browser + var xhr = new XMLHttpRequest(); + xhr.open('GET', path, /** async */ false); + xhr.send(null); + if (xhr.readyState === 4 && xhr.status === 200) { + contents = xhr.responseText; + } + } else if (fs.existsSync(path)) { + // Otherwise, use the filesystem + contents = fs.readFileSync(path, 'utf8'); + } + } catch (er) { + /* ignore any errors */ + } + + return fileContentsCache[path] = contents; +}); + +// Support URLs relative to a directory, but be careful about a protocol prefix +// in case we are in the browser (i.e. directories may start with "http://" or "file:///") +function supportRelativeURL(file, url) { + if (!file) return url; + var dir = path.dirname(file); + var match = /^\w+:\/\/[^\/]*/.exec(dir); + var protocol = match ? match[0] : ''; + var startPath = dir.slice(protocol.length); + if (protocol && /^\/\w\:/.test(startPath)) { + // handle file:///C:/ paths + protocol += '/'; + return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\/g, '/'); + } + return protocol + path.resolve(dir.slice(protocol.length), url); +} + +function retrieveSourceMapURL(source) { + var fileData; + + if (isInBrowser()) { + try { + var xhr = new XMLHttpRequest(); + xhr.open('GET', source, false); + xhr.send(null); + fileData = xhr.readyState === 4 ? xhr.responseText : null; + + // Support providing a sourceMappingURL via the SourceMap header + var sourceMapHeader = xhr.getResponseHeader("SourceMap") || + xhr.getResponseHeader("X-SourceMap"); + if (sourceMapHeader) { + return sourceMapHeader; + } + } catch (e) { + } + } + + // Get the URL of the source map + fileData = retrieveFile(source); + var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg; + // Keep executing the search to find the *last* sourceMappingURL to avoid + // picking up sourceMappingURLs from comments, strings, etc. + var lastMatch, match; + while (match = re.exec(fileData)) lastMatch = match; + if (!lastMatch) return null; + return lastMatch[1]; +}; + +// Can be overridden by the retrieveSourceMap option to install. Takes a +// generated source filename; returns a {map, optional url} object, or null if +// there is no source map. The map field may be either a string or the parsed +// JSON object (ie, it must be a valid argument to the SourceMapConsumer +// constructor). +var retrieveSourceMap = handlerExec(retrieveMapHandlers); +retrieveMapHandlers.push(function(source) { + var sourceMappingURL = retrieveSourceMapURL(source); + if (!sourceMappingURL) return null; + + // Read the contents of the source map + var sourceMapData; + if (reSourceMap.test(sourceMappingURL)) { + // Support source map URL as a data url + var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1); + sourceMapData = bufferFrom(rawData, "base64").toString(); + sourceMappingURL = source; + } else { + // Support source map URLs relative to the source URL + sourceMappingURL = supportRelativeURL(source, sourceMappingURL); + sourceMapData = retrieveFile(sourceMappingURL); + } + + if (!sourceMapData) { + return null; + } + + return { + url: sourceMappingURL, + map: sourceMapData + }; +}); + +function mapSourcePosition(position) { + var sourceMap = sourceMapCache[position.source]; + if (!sourceMap) { + // Call the (overrideable) retrieveSourceMap function to get the source map. + var urlAndMap = retrieveSourceMap(position.source); + if (urlAndMap) { + sourceMap = sourceMapCache[position.source] = { + url: urlAndMap.url, + map: new SourceMapConsumer(urlAndMap.map) + }; + + // Load all sources stored inline with the source map into the file cache + // to pretend like they are already loaded. They may not exist on disk. + if (sourceMap.map.sourcesContent) { + sourceMap.map.sources.forEach(function(source, i) { + var contents = sourceMap.map.sourcesContent[i]; + if (contents) { + var url = supportRelativeURL(sourceMap.url, source); + fileContentsCache[url] = contents; + } + }); + } + } else { + sourceMap = sourceMapCache[position.source] = { + url: null, + map: null + }; + } + } + + // Resolve the source URL relative to the URL of the source map + if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === 'function') { + var originalPosition = sourceMap.map.originalPositionFor(position); + + // Only return the original position if a matching line was found. If no + // matching line is found then we return position instead, which will cause + // the stack trace to print the path and line for the compiled file. It is + // better to give a precise location in the compiled file than a vague + // location in the original file. + if (originalPosition.source !== null) { + originalPosition.source = supportRelativeURL( + sourceMap.url, originalPosition.source); + return originalPosition; + } + } + + return position; +} + +// Parses code generated by FormatEvalOrigin(), a function inside V8: +// https://code.google.com/p/v8/source/browse/trunk/src/messages.js +function mapEvalOrigin(origin) { + // Most eval() calls are in this format + var match = /^eval at ([^(]+) \((.+):(\d+):(\d+)\)$/.exec(origin); + if (match) { + var position = mapSourcePosition({ + source: match[2], + line: +match[3], + column: match[4] - 1 + }); + return 'eval at ' + match[1] + ' (' + position.source + ':' + + position.line + ':' + (position.column + 1) + ')'; + } + + // Parse nested eval() calls using recursion + match = /^eval at ([^(]+) \((.+)\)$/.exec(origin); + if (match) { + return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')'; + } + + // Make sure we still return useful information if we didn't find anything + return origin; +} + +// This is copied almost verbatim from the V8 source code at +// https://code.google.com/p/v8/source/browse/trunk/src/messages.js. The +// implementation of wrapCallSite() used to just forward to the actual source +// code of CallSite.prototype.toString but unfortunately a new release of V8 +// did something to the prototype chain and broke the shim. The only fix I +// could find was copy/paste. +function CallSiteToString() { + var fileName; + var fileLocation = ""; + if (this.isNative()) { + fileLocation = "native"; + } else { + fileName = this.getScriptNameOrSourceURL(); + if (!fileName && this.isEval()) { + fileLocation = this.getEvalOrigin(); + fileLocation += ", "; // Expecting source position to follow. + } + + if (fileName) { + fileLocation += fileName; + } else { + // Source code does not originate from a file and is not native, but we + // can still get the source position inside the source string, e.g. in + // an eval string. + fileLocation += ""; + } + var lineNumber = this.getLineNumber(); + if (lineNumber != null) { + fileLocation += ":" + lineNumber; + var columnNumber = this.getColumnNumber(); + if (columnNumber) { + fileLocation += ":" + columnNumber; + } + } + } + + var line = ""; + var functionName = this.getFunctionName(); + var addSuffix = true; + var isConstructor = this.isConstructor(); + var isMethodCall = !(this.isToplevel() || isConstructor); + if (isMethodCall) { + var typeName = this.getTypeName(); + // Fixes shim to be backward compatable with Node v0 to v4 + if (typeName === "[object Object]") { + typeName = "null"; + } + var methodName = this.getMethodName(); + if (functionName) { + if (typeName && functionName.indexOf(typeName) != 0) { + line += typeName + "."; + } + line += functionName; + if (methodName && functionName.indexOf("." + methodName) != functionName.length - methodName.length - 1) { + line += " [as " + methodName + "]"; + } + } else { + line += typeName + "." + (methodName || ""); + } + } else if (isConstructor) { + line += "new " + (functionName || ""); + } else if (functionName) { + line += functionName; + } else { + line += fileLocation; + addSuffix = false; + } + if (addSuffix) { + line += " (" + fileLocation + ")"; + } + return line; +} + +function cloneCallSite(frame) { + var object = {}; + Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) { + object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name]; + }); + object.toString = CallSiteToString; + return object; +} + +function wrapCallSite(frame, state) { + // provides interface backward compatibility + if (state === undefined) { + state = { nextPosition: null, curPosition: null } + } + if(frame.isNative()) { + state.curPosition = null; + return frame; + } + + // Most call sites will return the source file from getFileName(), but code + // passed to eval() ending in "//# sourceURL=..." will return the source file + // from getScriptNameOrSourceURL() instead + var source = frame.getFileName() || frame.getScriptNameOrSourceURL(); + if (source) { + var line = frame.getLineNumber(); + var column = frame.getColumnNumber() - 1; + + // Fix position in Node where some (internal) code is prepended. + // See https://github.com/evanw/node-source-map-support/issues/36 + // Header removed in node at ^10.16 || >=11.11.0 + // v11 is not an LTS candidate, we can just test the one version with it. + // Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11 + var noHeader = /^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/; + var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62; + if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) { + column -= headerLength; + } + + var position = mapSourcePosition({ + source: source, + line: line, + column: column + }); + state.curPosition = position; + frame = cloneCallSite(frame); + var originalFunctionName = frame.getFunctionName; + frame.getFunctionName = function() { + if (state.nextPosition == null) { + return originalFunctionName(); + } + return state.nextPosition.name || originalFunctionName(); + }; + frame.getFileName = function() { return position.source; }; + frame.getLineNumber = function() { return position.line; }; + frame.getColumnNumber = function() { return position.column + 1; }; + frame.getScriptNameOrSourceURL = function() { return position.source; }; + return frame; + } + + // Code called using eval() needs special handling + var origin = frame.isEval() && frame.getEvalOrigin(); + if (origin) { + origin = mapEvalOrigin(origin); + frame = cloneCallSite(frame); + frame.getEvalOrigin = function() { return origin; }; + return frame; + } + + // If we get here then we were unable to change the source position + return frame; +} + +// This function is part of the V8 stack trace API, for more info see: +// https://v8.dev/docs/stack-trace-api +function prepareStackTrace(error, stack) { + if (emptyCacheBetweenOperations) { + fileContentsCache = {}; + sourceMapCache = {}; + } + + var name = error.name || 'Error'; + var message = error.message || ''; + var errorString = name + ": " + message; + + var state = { nextPosition: null, curPosition: null }; + var processedStack = []; + for (var i = stack.length - 1; i >= 0; i--) { + processedStack.push('\n at ' + wrapCallSite(stack[i], state)); + state.nextPosition = state.curPosition; + } + state.curPosition = state.nextPosition = null; + return errorString + processedStack.reverse().join(''); +} + +// Generate position and snippet of original source with pointer +function getErrorSource(error) { + var match = /\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(error.stack); + if (match) { + var source = match[1]; + var line = +match[2]; + var column = +match[3]; + + // Support the inline sourceContents inside the source map + var contents = fileContentsCache[source]; + + // Support files on disk + if (!contents && fs && fs.existsSync(source)) { + try { + contents = fs.readFileSync(source, 'utf8'); + } catch (er) { + contents = ''; + } + } + + // Format the line from the original source code like node does + if (contents) { + var code = contents.split(/(?:\r\n|\r|\n)/)[line - 1]; + if (code) { + return source + ':' + line + '\n' + code + '\n' + + new Array(column).join(' ') + '^'; + } + } + } + return null; +} + +function printErrorAndExit (error) { + var source = getErrorSource(error); + + // Ensure error is printed synchronously and not truncated + var stderr = globalProcessStderr(); + if (stderr && stderr._handle && stderr._handle.setBlocking) { + stderr._handle.setBlocking(true); + } + + if (source) { + console.error(); + console.error(source); + } + + console.error(error.stack); + globalProcessExit(1); +} + +function shimEmitUncaughtException () { + var origEmit = process.emit; + + process.emit = function (type) { + if (type === 'uncaughtException') { + var hasStack = (arguments[1] && arguments[1].stack); + var hasListeners = (this.listeners(type).length > 0); + + if (hasStack && !hasListeners) { + return printErrorAndExit(arguments[1]); + } + } + + return origEmit.apply(this, arguments); + }; +} + +var originalRetrieveFileHandlers = retrieveFileHandlers.slice(0); +var originalRetrieveMapHandlers = retrieveMapHandlers.slice(0); + +exports.wrapCallSite = wrapCallSite; +exports.getErrorSource = getErrorSource; +exports.mapSourcePosition = mapSourcePosition; +exports.retrieveSourceMap = retrieveSourceMap; + +exports.install = function(options) { + options = options || {}; + + if (options.environment) { + environment = options.environment; + if (["node", "browser", "auto"].indexOf(environment) === -1) { + throw new Error("environment " + environment + " was unknown. Available options are {auto, browser, node}") + } + } + + // Allow sources to be found by methods other than reading the files + // directly from disk. + if (options.retrieveFile) { + if (options.overrideRetrieveFile) { + retrieveFileHandlers.length = 0; + } + + retrieveFileHandlers.unshift(options.retrieveFile); + } + + // Allow source maps to be found by methods other than reading the files + // directly from disk. + if (options.retrieveSourceMap) { + if (options.overrideRetrieveSourceMap) { + retrieveMapHandlers.length = 0; + } + + retrieveMapHandlers.unshift(options.retrieveSourceMap); + } + + // Support runtime transpilers that include inline source maps + if (options.hookRequire && !isInBrowser()) { + // Use dynamicRequire to avoid including in browser bundles + var Module = dynamicRequire(module, 'module'); + var $compile = Module.prototype._compile; + + if (!$compile.__sourceMapSupport) { + Module.prototype._compile = function(content, filename) { + fileContentsCache[filename] = content; + sourceMapCache[filename] = undefined; + return $compile.call(this, content, filename); + }; + + Module.prototype._compile.__sourceMapSupport = true; + } + } + + // Configure options + if (!emptyCacheBetweenOperations) { + emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ? + options.emptyCacheBetweenOperations : false; + } + + // Install the error reformatter + if (!errorFormatterInstalled) { + errorFormatterInstalled = true; + Error.prepareStackTrace = prepareStackTrace; + } + + if (!uncaughtShimInstalled) { + var installHandler = 'handleUncaughtExceptions' in options ? + options.handleUncaughtExceptions : true; + + // Do not override 'uncaughtException' with our own handler in Node.js + // Worker threads. Workers pass the error to the main thread as an event, + // rather than printing something to stderr and exiting. + try { + // We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify. + var worker_threads = dynamicRequire(module, 'worker_threads'); + if (worker_threads.isMainThread === false) { + installHandler = false; + } + } catch(e) {} + + // Provide the option to not install the uncaught exception handler. This is + // to support other uncaught exception handlers (in test frameworks, for + // example). If this handler is not installed and there are no other uncaught + // exception handlers, uncaught exceptions will be caught by node's built-in + // exception handler and the process will still be terminated. However, the + // generated JavaScript code will be shown above the stack trace instead of + // the original source code. + if (installHandler && hasGlobalProcessEventEmitter()) { + uncaughtShimInstalled = true; + shimEmitUncaughtException(); + } + } +}; + +exports.resetRetrieveHandlers = function() { + retrieveFileHandlers.length = 0; + retrieveMapHandlers.length = 0; + + retrieveFileHandlers = originalRetrieveFileHandlers.slice(0); + retrieveMapHandlers = originalRetrieveMapHandlers.slice(0); + + retrieveSourceMap = handlerExec(retrieveMapHandlers); + retrieveFile = handlerExec(retrieveFileHandlers); +} + + +/***/ }), + +/***/ 38886: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(84540); +var has = Object.prototype.hasOwnProperty; +var hasNativeMap = typeof Map !== "undefined"; + +/** + * A data structure which is a combination of an array and a set. Adding a new + * member is O(1), testing for membership is O(1), and finding the index of an + * element is O(1). Removing elements from the set is not supported. Only + * strings are supported for membership. + */ +function ArraySet() { + this._array = []; + this._set = hasNativeMap ? new Map() : Object.create(null); +} + +/** + * Static method for creating ArraySet instances from an existing array. + */ +ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) { + var set = new ArraySet(); + for (var i = 0, len = aArray.length; i < len; i++) { + set.add(aArray[i], aAllowDuplicates); + } + return set; +}; + +/** + * Return how many unique items are in this ArraySet. If duplicates have been + * added, than those do not count towards the size. + * + * @returns Number + */ +ArraySet.prototype.size = function ArraySet_size() { + return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length; +}; + +/** + * Add the given string to this set. + * + * @param String aStr + */ +ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) { + var sStr = hasNativeMap ? aStr : util.toSetString(aStr); + var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr); + var idx = this._array.length; + if (!isDuplicate || aAllowDuplicates) { + this._array.push(aStr); + } + if (!isDuplicate) { + if (hasNativeMap) { + this._set.set(aStr, idx); + } else { + this._set[sStr] = idx; + } + } +}; + +/** + * Is the given string a member of this set? + * + * @param String aStr + */ +ArraySet.prototype.has = function ArraySet_has(aStr) { + if (hasNativeMap) { + return this._set.has(aStr); + } else { + var sStr = util.toSetString(aStr); + return has.call(this._set, sStr); + } +}; + +/** + * What is the index of the given string in the array? + * + * @param String aStr + */ +ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) { + if (hasNativeMap) { + var idx = this._set.get(aStr); + if (idx >= 0) { + return idx; + } + } else { + var sStr = util.toSetString(aStr); + if (has.call(this._set, sStr)) { + return this._set[sStr]; + } + } + + throw new Error('"' + aStr + '" is not in the set.'); +}; + +/** + * What is the element at the given index? + * + * @param Number aIdx + */ +ArraySet.prototype.at = function ArraySet_at(aIdx) { + if (aIdx >= 0 && aIdx < this._array.length) { + return this._array[aIdx]; + } + throw new Error('No element indexed by ' + aIdx); +}; + +/** + * Returns the array representation of this set (which has the proper indices + * indicated by indexOf). Note that this is a copy of the internal array used + * for storing the members so that no one can mess with internal state. + */ +ArraySet.prototype.toArray = function ArraySet_toArray() { + return this._array.slice(); +}; + +exports.C = ArraySet; + + +/***/ }), + +/***/ 17887: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + * + * Based on the Base 64 VLQ implementation in Closure Compiler: + * https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java + * + * Copyright 2011 The Closure Compiler Authors. All rights reserved. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +var base64 = __webpack_require__(19987); + +// A single base 64 digit can contain 6 bits of data. For the base 64 variable +// length quantities we use in the source map spec, the first bit is the sign, +// the next four bits are the actual value, and the 6th bit is the +// continuation bit. The continuation bit tells us whether there are more +// digits in this value following this digit. +// +// Continuation +// | Sign +// | | +// V V +// 101011 + +var VLQ_BASE_SHIFT = 5; + +// binary: 100000 +var VLQ_BASE = 1 << VLQ_BASE_SHIFT; + +// binary: 011111 +var VLQ_BASE_MASK = VLQ_BASE - 1; + +// binary: 100000 +var VLQ_CONTINUATION_BIT = VLQ_BASE; + +/** + * Converts from a two-complement value to a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 1 becomes 2 (10 binary), -1 becomes 3 (11 binary) + * 2 becomes 4 (100 binary), -2 becomes 5 (101 binary) + */ +function toVLQSigned(aValue) { + return aValue < 0 + ? ((-aValue) << 1) + 1 + : (aValue << 1) + 0; +} + +/** + * Converts to a two-complement value from a value where the sign bit is + * placed in the least significant bit. For example, as decimals: + * 2 (10 binary) becomes 1, 3 (11 binary) becomes -1 + * 4 (100 binary) becomes 2, 5 (101 binary) becomes -2 + */ +function fromVLQSigned(aValue) { + var isNegative = (aValue & 1) === 1; + var shifted = aValue >> 1; + return isNegative + ? -shifted + : shifted; +} + +/** + * Returns the base 64 VLQ encoded value. + */ +exports.encode = function base64VLQ_encode(aValue) { + var encoded = ""; + var digit; + + var vlq = toVLQSigned(aValue); + + do { + digit = vlq & VLQ_BASE_MASK; + vlq >>>= VLQ_BASE_SHIFT; + if (vlq > 0) { + // There are still more digits in this value, so we must make sure the + // continuation bit is marked. + digit |= VLQ_CONTINUATION_BIT; + } + encoded += base64.encode(digit); + } while (vlq > 0); + + return encoded; +}; + +/** + * Decodes the next base 64 VLQ value from the given string and returns the + * value and the rest of the string via the out parameter. + */ +exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) { + var strLen = aStr.length; + var result = 0; + var shift = 0; + var continuation, digit; + + do { + if (aIndex >= strLen) { + throw new Error("Expected more digits in base 64 VLQ value."); + } + + digit = base64.decode(aStr.charCodeAt(aIndex++)); + if (digit === -1) { + throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1)); + } + + continuation = !!(digit & VLQ_CONTINUATION_BIT); + digit &= VLQ_BASE_MASK; + result = result + (digit << shift); + shift += VLQ_BASE_SHIFT; + } while (continuation); + + aOutParam.value = fromVLQSigned(result); + aOutParam.rest = aIndex; +}; + + +/***/ }), + +/***/ 19987: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split(''); + +/** + * Encode an integer in the range of 0 to 63 to a single base 64 digit. + */ +exports.encode = function (number) { + if (0 <= number && number < intToCharMap.length) { + return intToCharMap[number]; + } + throw new TypeError("Must be between 0 and 63: " + number); +}; + +/** + * Decode a single base 64 character code digit to an integer. Returns -1 on + * failure. + */ +exports.decode = function (charCode) { + var bigA = 65; // 'A' + var bigZ = 90; // 'Z' + + var littleA = 97; // 'a' + var littleZ = 122; // 'z' + + var zero = 48; // '0' + var nine = 57; // '9' + + var plus = 43; // '+' + var slash = 47; // '/' + + var littleOffset = 26; + var numberOffset = 52; + + // 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ + if (bigA <= charCode && charCode <= bigZ) { + return (charCode - bigA); + } + + // 26 - 51: abcdefghijklmnopqrstuvwxyz + if (littleA <= charCode && charCode <= littleZ) { + return (charCode - littleA + littleOffset); + } + + // 52 - 61: 0123456789 + if (zero <= charCode && charCode <= nine) { + return (charCode - zero + numberOffset); + } + + // 62: + + if (charCode == plus) { + return 62; + } + + // 63: / + if (charCode == slash) { + return 63; + } + + // Invalid base64 digit. + return -1; +}; + + +/***/ }), + +/***/ 40198: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +exports.GREATEST_LOWER_BOUND = 1; +exports.LEAST_UPPER_BOUND = 2; + +/** + * Recursive implementation of binary search. + * + * @param aLow Indices here and lower do not contain the needle. + * @param aHigh Indices here and higher do not contain the needle. + * @param aNeedle The element being searched for. + * @param aHaystack The non-empty array being searched. + * @param aCompare Function which takes two elements and returns -1, 0, or 1. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + */ +function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) { + // This function terminates when one of the following is true: + // + // 1. We find the exact element we are looking for. + // + // 2. We did not find the exact element, but we can return the index of + // the next-closest element. + // + // 3. We did not find the exact element, and there is no next-closest + // element than the one we are searching for, so we return -1. + var mid = Math.floor((aHigh - aLow) / 2) + aLow; + var cmp = aCompare(aNeedle, aHaystack[mid], true); + if (cmp === 0) { + // Found the element we are looking for. + return mid; + } + else if (cmp > 0) { + // Our needle is greater than aHaystack[mid]. + if (aHigh - mid > 1) { + // The element is in the upper half. + return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias); + } + + // The exact needle element was not found in this haystack. Determine if + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return aHigh < aHaystack.length ? aHigh : -1; + } else { + return mid; + } + } + else { + // Our needle is less than aHaystack[mid]. + if (mid - aLow > 1) { + // The element is in the lower half. + return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias); + } + + // we are in termination case (3) or (2) and return the appropriate thing. + if (aBias == exports.LEAST_UPPER_BOUND) { + return mid; + } else { + return aLow < 0 ? -1 : aLow; + } + } +} + +/** + * This is an implementation of binary search which will always try and return + * the index of the closest element if there is no exact hit. This is because + * mappings between original and generated line/col pairs are single points, + * and there is an implicit region between each of them, so a miss just means + * that you aren't on the very start of a region. + * + * @param aNeedle The element you are looking for. + * @param aHaystack The array that is being searched. + * @param aCompare A function which takes the needle and an element in the + * array and returns -1, 0, or 1 depending on whether the needle is less + * than, equal to, or greater than the element, respectively. + * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or + * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'. + */ +exports.search = function search(aNeedle, aHaystack, aCompare, aBias) { + if (aHaystack.length === 0) { + return -1; + } + + var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack, + aCompare, aBias || exports.GREATEST_LOWER_BOUND); + if (index < 0) { + return -1; + } + + // We have found either the exact element, or the next-closest element than + // the one we are searching for. However, there may be more than one such + // element. Make sure we always return the smallest of these. + while (index - 1 >= 0) { + if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) { + break; + } + --index; + } + + return index; +}; + + +/***/ }), + +/***/ 8285: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2014 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(84540); + +/** + * Determine whether mappingB is after mappingA with respect to generated + * position. + */ +function generatedPositionAfter(mappingA, mappingB) { + // Optimized for most common case + var lineA = mappingA.generatedLine; + var lineB = mappingB.generatedLine; + var columnA = mappingA.generatedColumn; + var columnB = mappingB.generatedColumn; + return lineB > lineA || lineB == lineA && columnB >= columnA || + util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0; +} + +/** + * A data structure to provide a sorted view of accumulated mappings in a + * performance conscious manner. It trades a neglibable overhead in general + * case for a large speedup in case of mappings being added in order. + */ +function MappingList() { + this._array = []; + this._sorted = true; + // Serves as infimum + this._last = {generatedLine: -1, generatedColumn: 0}; +} + +/** + * Iterate through internal items. This method takes the same arguments that + * `Array.prototype.forEach` takes. + * + * NOTE: The order of the mappings is NOT guaranteed. + */ +MappingList.prototype.unsortedForEach = + function MappingList_forEach(aCallback, aThisArg) { + this._array.forEach(aCallback, aThisArg); + }; + +/** + * Add the given source mapping. + * + * @param Object aMapping + */ +MappingList.prototype.add = function MappingList_add(aMapping) { + if (generatedPositionAfter(this._last, aMapping)) { + this._last = aMapping; + this._array.push(aMapping); + } else { + this._sorted = false; + this._array.push(aMapping); + } +}; + +/** + * Returns the flat, sorted array of mappings. The mappings are sorted by + * generated position. + * + * WARNING: This method returns internal data without copying, for + * performance. The return value must NOT be mutated, and should be treated as + * an immutable borrow. If you want to take ownership, you must make your own + * copy. + */ +MappingList.prototype.toArray = function MappingList_toArray() { + if (!this._sorted) { + this._array.sort(util.compareByGeneratedPositionsInflated); + this._sorted = true; + } + return this._array; +}; + +exports.P = MappingList; + + +/***/ }), + +/***/ 99550: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +// It turns out that some (most?) JavaScript engines don't self-host +// `Array.prototype.sort`. This makes sense because C++ will likely remain +// faster than JS when doing raw CPU-intensive sorting. However, when using a +// custom comparator function, calling back and forth between the VM's C++ and +// JIT'd JS is rather slow *and* loses JIT type information, resulting in +// worse generated code for the comparator function than would be optimal. In +// fact, when sorting with a comparator, these costs outweigh the benefits of +// sorting in C++. By using our own JS-implemented Quick Sort (below), we get +// a ~3500ms mean speed-up in `bench/bench.html`. + +/** + * Swap the elements indexed by `x` and `y` in the array `ary`. + * + * @param {Array} ary + * The array. + * @param {Number} x + * The index of the first item. + * @param {Number} y + * The index of the second item. + */ +function swap(ary, x, y) { + var temp = ary[x]; + ary[x] = ary[y]; + ary[y] = temp; +} + +/** + * Returns a random integer within the range `low .. high` inclusive. + * + * @param {Number} low + * The lower bound on the range. + * @param {Number} high + * The upper bound on the range. + */ +function randomIntInRange(low, high) { + return Math.round(low + (Math.random() * (high - low))); +} + +/** + * The Quick Sort algorithm. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + * @param {Number} p + * Start index of the array + * @param {Number} r + * End index of the array + */ +function doQuickSort(ary, comparator, p, r) { + // If our lower bound is less than our upper bound, we (1) partition the + // array into two pieces and (2) recurse on each half. If it is not, this is + // the empty array and our base case. + + if (p < r) { + // (1) Partitioning. + // + // The partitioning chooses a pivot between `p` and `r` and moves all + // elements that are less than or equal to the pivot to the before it, and + // all the elements that are greater than it after it. The effect is that + // once partition is done, the pivot is in the exact place it will be when + // the array is put in sorted order, and it will not need to be moved + // again. This runs in O(n) time. + + // Always choose a random pivot so that an input array which is reverse + // sorted does not cause O(n^2) running time. + var pivotIndex = randomIntInRange(p, r); + var i = p - 1; + + swap(ary, pivotIndex, r); + var pivot = ary[r]; + + // Immediately after `j` is incremented in this loop, the following hold + // true: + // + // * Every element in `ary[p .. i]` is less than or equal to the pivot. + // + // * Every element in `ary[i+1 .. j-1]` is greater than the pivot. + for (var j = p; j < r; j++) { + if (comparator(ary[j], pivot) <= 0) { + i += 1; + swap(ary, i, j); + } + } + + swap(ary, i + 1, j); + var q = i + 1; + + // (2) Recurse on each half. + + doQuickSort(ary, comparator, p, q - 1); + doQuickSort(ary, comparator, q + 1, r); + } +} + +/** + * Sort the given array in-place with the given comparator function. + * + * @param {Array} ary + * An array to sort. + * @param {function} comparator + * Function to use to compare two items. + */ +exports.g = function (ary, comparator) { + doQuickSort(ary, comparator, 0, ary.length - 1); +}; + + +/***/ }), + +/***/ 10339: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var __webpack_unused_export__; +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var util = __webpack_require__(84540); +var binarySearch = __webpack_require__(40198); +var ArraySet = (__webpack_require__(38886)/* .ArraySet */ .C); +var base64VLQ = __webpack_require__(17887); +var quickSort = (__webpack_require__(99550)/* .quickSort */ .g); + +function SourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + return sourceMap.sections != null + ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL) + : new BasicSourceMapConsumer(sourceMap, aSourceMapURL); +} + +SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) { + return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL); +} + +/** + * The version of the source mapping spec that we are consuming. + */ +SourceMapConsumer.prototype._version = 3; + +// `__generatedMappings` and `__originalMappings` are arrays that hold the +// parsed mapping coordinates from the source map's "mappings" attribute. They +// are lazily instantiated, accessed via the `_generatedMappings` and +// `_originalMappings` getters respectively, and we only parse the mappings +// and create these arrays once queried for a source location. We jump through +// these hoops because there can be many thousands of mappings, and parsing +// them is expensive, so we only want to do it if we must. +// +// Each object in the arrays is of the form: +// +// { +// generatedLine: The line number in the generated code, +// generatedColumn: The column number in the generated code, +// source: The path to the original source file that generated this +// chunk of code, +// originalLine: The line number in the original source that +// corresponds to this chunk of generated code, +// originalColumn: The column number in the original source that +// corresponds to this chunk of generated code, +// name: The name of the original symbol which generated this chunk of +// code. +// } +// +// All properties except for `generatedLine` and `generatedColumn` can be +// `null`. +// +// `_generatedMappings` is ordered by the generated positions. +// +// `_originalMappings` is ordered by the original positions. + +SourceMapConsumer.prototype.__generatedMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__generatedMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__generatedMappings; + } +}); + +SourceMapConsumer.prototype.__originalMappings = null; +Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', { + configurable: true, + enumerable: true, + get: function () { + if (!this.__originalMappings) { + this._parseMappings(this._mappings, this.sourceRoot); + } + + return this.__originalMappings; + } +}); + +SourceMapConsumer.prototype._charIsMappingSeparator = + function SourceMapConsumer_charIsMappingSeparator(aStr, index) { + var c = aStr.charAt(index); + return c === ";" || c === ","; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +SourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + throw new Error("Subclasses must implement _parseMappings"); + }; + +SourceMapConsumer.GENERATED_ORDER = 1; +SourceMapConsumer.ORIGINAL_ORDER = 2; + +SourceMapConsumer.GREATEST_LOWER_BOUND = 1; +SourceMapConsumer.LEAST_UPPER_BOUND = 2; + +/** + * Iterate over each mapping between an original source/line/column and a + * generated line/column in this source map. + * + * @param Function aCallback + * The function that is called with each mapping. + * @param Object aContext + * Optional. If specified, this object will be the value of `this` every + * time that `aCallback` is called. + * @param aOrder + * Either `SourceMapConsumer.GENERATED_ORDER` or + * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to + * iterate over the mappings sorted by the generated file's line/column + * order or the original's source/line/column order, respectively. Defaults to + * `SourceMapConsumer.GENERATED_ORDER`. + */ +SourceMapConsumer.prototype.eachMapping = + function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) { + var context = aContext || null; + var order = aOrder || SourceMapConsumer.GENERATED_ORDER; + + var mappings; + switch (order) { + case SourceMapConsumer.GENERATED_ORDER: + mappings = this._generatedMappings; + break; + case SourceMapConsumer.ORIGINAL_ORDER: + mappings = this._originalMappings; + break; + default: + throw new Error("Unknown order of iteration."); + } + + var sourceRoot = this.sourceRoot; + mappings.map(function (mapping) { + var source = mapping.source === null ? null : this._sources.at(mapping.source); + source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL); + return { + source: source, + generatedLine: mapping.generatedLine, + generatedColumn: mapping.generatedColumn, + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: mapping.name === null ? null : this._names.at(mapping.name) + }; + }, this).forEach(aCallback, context); + }; + +/** + * Returns all generated line and column information for the original source, + * line, and column provided. If no column is provided, returns all mappings + * corresponding to a either the line we are searching for or the next + * closest line that has any mappings. Otherwise, returns all mappings + * corresponding to the given line and either the column we are searching for + * or the next closest column that has any offsets. + * + * The only argument is an object with the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number is 1-based. + * - column: Optional. the column number in the original source. + * The column number is 0-based. + * + * and an array of objects is returned, each with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +SourceMapConsumer.prototype.allGeneratedPositionsFor = + function SourceMapConsumer_allGeneratedPositionsFor(aArgs) { + var line = util.getArg(aArgs, 'line'); + + // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping + // returns the index of the closest mapping less than the needle. By + // setting needle.originalColumn to 0, we thus find the last mapping for + // the given line, provided such a mapping exists. + var needle = { + source: util.getArg(aArgs, 'source'), + originalLine: line, + originalColumn: util.getArg(aArgs, 'column', 0) + }; + + needle.source = this._findSourceIndex(needle.source); + if (needle.source < 0) { + return []; + } + + var mappings = []; + + var index = this._findMapping(needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + binarySearch.LEAST_UPPER_BOUND); + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (aArgs.column === undefined) { + var originalLine = mapping.originalLine; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we found. Since + // mappings are sorted, this is guaranteed to find all mappings for + // the line we found. + while (mapping && mapping.originalLine === originalLine) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } else { + var originalColumn = mapping.originalColumn; + + // Iterate until either we run out of mappings, or we run into + // a mapping for a different line than the one we were searching for. + // Since mappings are sorted, this is guaranteed to find all mappings for + // the line we are searching for. + while (mapping && + mapping.originalLine === line && + mapping.originalColumn == originalColumn) { + mappings.push({ + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }); + + mapping = this._originalMappings[++index]; + } + } + } + + return mappings; + }; + +exports.SourceMapConsumer = SourceMapConsumer; + +/** + * A BasicSourceMapConsumer instance represents a parsed source map which we can + * query for information about the original file positions by giving it a file + * position in the generated source. + * + * The first parameter is the raw source map (either as a JSON string, or + * already parsed to an object). According to the spec, source maps have the + * following attributes: + * + * - version: Which version of the source map spec this map is following. + * - sources: An array of URLs to the original source files. + * - names: An array of identifiers which can be referrenced by individual mappings. + * - sourceRoot: Optional. The URL root from which all sources are relative. + * - sourcesContent: Optional. An array of contents of the original source files. + * - mappings: A string of base64 VLQs which contain the actual mappings. + * - file: Optional. The generated file this source map is associated with. + * + * Here is an example source map, taken from the source map spec[0]: + * + * { + * version : 3, + * file: "out.js", + * sourceRoot : "", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AA,AB;;ABCDE;" + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1# + */ +function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sources = util.getArg(sourceMap, 'sources'); + // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which + // requires the array) to play nice here. + var names = util.getArg(sourceMap, 'names', []); + var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null); + var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null); + var mappings = util.getArg(sourceMap, 'mappings'); + var file = util.getArg(sourceMap, 'file', null); + + // Once again, Sass deviates from the spec and supplies the version as a + // string rather than a number, so we use loose equality checking here. + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + if (sourceRoot) { + sourceRoot = util.normalize(sourceRoot); + } + + sources = sources + .map(String) + // Some source maps produce relative source paths like "./foo.js" instead of + // "foo.js". Normalize these first so that future comparisons will succeed. + // See bugzil.la/1090768. + .map(util.normalize) + // Always ensure that absolute sources are internally stored relative to + // the source root, if the source root is absolute. Not doing this would + // be particularly problematic when the source root is a prefix of the + // source (valid, but why??). See github issue #199 and bugzil.la/1188982. + .map(function (source) { + return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source) + ? util.relative(sourceRoot, source) + : source; + }); + + // Pass `true` below to allow duplicate names and sources. While source maps + // are intended to be compressed and deduplicated, the TypeScript compiler + // sometimes generates source maps with duplicates in them. See Github issue + // #72 and bugzil.la/889492. + this._names = ArraySet.fromArray(names.map(String), true); + this._sources = ArraySet.fromArray(sources, true); + + this._absoluteSources = this._sources.toArray().map(function (s) { + return util.computeSourceURL(sourceRoot, s, aSourceMapURL); + }); + + this.sourceRoot = sourceRoot; + this.sourcesContent = sourcesContent; + this._mappings = mappings; + this._sourceMapURL = aSourceMapURL; + this.file = file; +} + +BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer; + +/** + * Utility function to find the index of a source. Returns -1 if not + * found. + */ +BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) { + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + if (this._sources.has(relativeSource)) { + return this._sources.indexOf(relativeSource); + } + + // Maybe aSource is an absolute URL as returned by |sources|. In + // this case we can't simply undo the transform. + var i; + for (i = 0; i < this._absoluteSources.length; ++i) { + if (this._absoluteSources[i] == aSource) { + return i; + } + } + + return -1; +}; + +/** + * Create a BasicSourceMapConsumer from a SourceMapGenerator. + * + * @param SourceMapGenerator aSourceMap + * The source map that will be consumed. + * @param String aSourceMapURL + * The URL at which the source map can be found (optional) + * @returns BasicSourceMapConsumer + */ +BasicSourceMapConsumer.fromSourceMap = + function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) { + var smc = Object.create(BasicSourceMapConsumer.prototype); + + var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true); + var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true); + smc.sourceRoot = aSourceMap._sourceRoot; + smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(), + smc.sourceRoot); + smc.file = aSourceMap._file; + smc._sourceMapURL = aSourceMapURL; + smc._absoluteSources = smc._sources.toArray().map(function (s) { + return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL); + }); + + // Because we are modifying the entries (by converting string sources and + // names to indices into the sources and names ArraySets), we have to make + // a copy of the entry or else bad things happen. Shared mutable state + // strikes again! See github issue #191. + + var generatedMappings = aSourceMap._mappings.toArray().slice(); + var destGeneratedMappings = smc.__generatedMappings = []; + var destOriginalMappings = smc.__originalMappings = []; + + for (var i = 0, length = generatedMappings.length; i < length; i++) { + var srcMapping = generatedMappings[i]; + var destMapping = new Mapping; + destMapping.generatedLine = srcMapping.generatedLine; + destMapping.generatedColumn = srcMapping.generatedColumn; + + if (srcMapping.source) { + destMapping.source = sources.indexOf(srcMapping.source); + destMapping.originalLine = srcMapping.originalLine; + destMapping.originalColumn = srcMapping.originalColumn; + + if (srcMapping.name) { + destMapping.name = names.indexOf(srcMapping.name); + } + + destOriginalMappings.push(destMapping); + } + + destGeneratedMappings.push(destMapping); + } + + quickSort(smc.__originalMappings, util.compareByOriginalPositions); + + return smc; + }; + +/** + * The version of the source mapping spec that we are consuming. + */ +BasicSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', { + get: function () { + return this._absoluteSources.slice(); + } +}); + +/** + * Provide the JIT with a nice shape / hidden class. + */ +function Mapping() { + this.generatedLine = 0; + this.generatedColumn = 0; + this.source = null; + this.originalLine = null; + this.originalColumn = null; + this.name = null; +} + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +BasicSourceMapConsumer.prototype._parseMappings = + function SourceMapConsumer_parseMappings(aStr, aSourceRoot) { + var generatedLine = 1; + var previousGeneratedColumn = 0; + var previousOriginalLine = 0; + var previousOriginalColumn = 0; + var previousSource = 0; + var previousName = 0; + var length = aStr.length; + var index = 0; + var cachedSegments = {}; + var temp = {}; + var originalMappings = []; + var generatedMappings = []; + var mapping, str, segment, end, value; + + while (index < length) { + if (aStr.charAt(index) === ';') { + generatedLine++; + index++; + previousGeneratedColumn = 0; + } + else if (aStr.charAt(index) === ',') { + index++; + } + else { + mapping = new Mapping(); + mapping.generatedLine = generatedLine; + + // Because each offset is encoded relative to the previous one, + // many segments often have the same encoding. We can exploit this + // fact by caching the parsed variable length fields of each segment, + // allowing us to avoid a second parse if we encounter the same + // segment again. + for (end = index; end < length; end++) { + if (this._charIsMappingSeparator(aStr, end)) { + break; + } + } + str = aStr.slice(index, end); + + segment = cachedSegments[str]; + if (segment) { + index += str.length; + } else { + segment = []; + while (index < end) { + base64VLQ.decode(aStr, index, temp); + value = temp.value; + index = temp.rest; + segment.push(value); + } + + if (segment.length === 2) { + throw new Error('Found a source, but no line and column'); + } + + if (segment.length === 3) { + throw new Error('Found a source and line, but no column'); + } + + cachedSegments[str] = segment; + } + + // Generated column. + mapping.generatedColumn = previousGeneratedColumn + segment[0]; + previousGeneratedColumn = mapping.generatedColumn; + + if (segment.length > 1) { + // Original source. + mapping.source = previousSource + segment[1]; + previousSource += segment[1]; + + // Original line. + mapping.originalLine = previousOriginalLine + segment[2]; + previousOriginalLine = mapping.originalLine; + // Lines are stored 0-based + mapping.originalLine += 1; + + // Original column. + mapping.originalColumn = previousOriginalColumn + segment[3]; + previousOriginalColumn = mapping.originalColumn; + + if (segment.length > 4) { + // Original name. + mapping.name = previousName + segment[4]; + previousName += segment[4]; + } + } + + generatedMappings.push(mapping); + if (typeof mapping.originalLine === 'number') { + originalMappings.push(mapping); + } + } + } + + quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated); + this.__generatedMappings = generatedMappings; + + quickSort(originalMappings, util.compareByOriginalPositions); + this.__originalMappings = originalMappings; + }; + +/** + * Find the mapping that best matches the hypothetical "needle" mapping that + * we are searching for in the given "haystack" of mappings. + */ +BasicSourceMapConsumer.prototype._findMapping = + function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName, + aColumnName, aComparator, aBias) { + // To return the position we are searching for, we must first find the + // mapping for the given position and then return the opposite position it + // points to. Because the mappings are sorted, we can use binary search to + // find the best mapping. + + if (aNeedle[aLineName] <= 0) { + throw new TypeError('Line must be greater than or equal to 1, got ' + + aNeedle[aLineName]); + } + if (aNeedle[aColumnName] < 0) { + throw new TypeError('Column must be greater than or equal to 0, got ' + + aNeedle[aColumnName]); + } + + return binarySearch.search(aNeedle, aMappings, aComparator, aBias); + }; + +/** + * Compute the last column for each generated mapping. The last column is + * inclusive. + */ +BasicSourceMapConsumer.prototype.computeColumnSpans = + function SourceMapConsumer_computeColumnSpans() { + for (var index = 0; index < this._generatedMappings.length; ++index) { + var mapping = this._generatedMappings[index]; + + // Mappings do not contain a field for the last generated columnt. We + // can come up with an optimistic estimate, however, by assuming that + // mappings are contiguous (i.e. given two consecutive mappings, the + // first mapping ends where the second one starts). + if (index + 1 < this._generatedMappings.length) { + var nextMapping = this._generatedMappings[index + 1]; + + if (mapping.generatedLine === nextMapping.generatedLine) { + mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1; + continue; + } + } + + // The last mapping for each line spans the entire line. + mapping.lastGeneratedColumn = Infinity; + } + }; + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +BasicSourceMapConsumer.prototype.originalPositionFor = + function SourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._generatedMappings, + "generatedLine", + "generatedColumn", + util.compareByGeneratedPositionsDeflated, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._generatedMappings[index]; + + if (mapping.generatedLine === needle.generatedLine) { + var source = util.getArg(mapping, 'source', null); + if (source !== null) { + source = this._sources.at(source); + source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL); + } + var name = util.getArg(mapping, 'name', null); + if (name !== null) { + name = this._names.at(name); + } + return { + source: source, + line: util.getArg(mapping, 'originalLine', null), + column: util.getArg(mapping, 'originalColumn', null), + name: name + }; + } + } + + return { + source: null, + line: null, + column: null, + name: null + }; + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +BasicSourceMapConsumer.prototype.hasContentsOfAllSources = + function BasicSourceMapConsumer_hasContentsOfAllSources() { + if (!this.sourcesContent) { + return false; + } + return this.sourcesContent.length >= this._sources.size() && + !this.sourcesContent.some(function (sc) { return sc == null; }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +BasicSourceMapConsumer.prototype.sourceContentFor = + function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + if (!this.sourcesContent) { + return null; + } + + var index = this._findSourceIndex(aSource); + if (index >= 0) { + return this.sourcesContent[index]; + } + + var relativeSource = aSource; + if (this.sourceRoot != null) { + relativeSource = util.relative(this.sourceRoot, relativeSource); + } + + var url; + if (this.sourceRoot != null + && (url = util.urlParse(this.sourceRoot))) { + // XXX: file:// URIs and absolute paths lead to unexpected behavior for + // many users. We can help them out when they expect file:// URIs to + // behave like it would if they were running a local HTTP server. See + // https://bugzilla.mozilla.org/show_bug.cgi?id=885597. + var fileUriAbsPath = relativeSource.replace(/^file:\/\//, ""); + if (url.scheme == "file" + && this._sources.has(fileUriAbsPath)) { + return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)] + } + + if ((!url.path || url.path == "/") + && this._sources.has("/" + relativeSource)) { + return this.sourcesContent[this._sources.indexOf("/" + relativeSource)]; + } + } + + // This function is used recursively from + // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we + // don't want to throw if we can't find the source - we just want to + // return null, so we provide a flag to exit gracefully. + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + relativeSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or + * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the + * closest element that is smaller than or greater than the one we are + * searching for, respectively, if the exact element cannot be found. + * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +BasicSourceMapConsumer.prototype.generatedPositionFor = + function SourceMapConsumer_generatedPositionFor(aArgs) { + var source = util.getArg(aArgs, 'source'); + source = this._findSourceIndex(source); + if (source < 0) { + return { + line: null, + column: null, + lastColumn: null + }; + } + + var needle = { + source: source, + originalLine: util.getArg(aArgs, 'line'), + originalColumn: util.getArg(aArgs, 'column') + }; + + var index = this._findMapping( + needle, + this._originalMappings, + "originalLine", + "originalColumn", + util.compareByOriginalPositions, + util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND) + ); + + if (index >= 0) { + var mapping = this._originalMappings[index]; + + if (mapping.source === needle.source) { + return { + line: util.getArg(mapping, 'generatedLine', null), + column: util.getArg(mapping, 'generatedColumn', null), + lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null) + }; + } + } + + return { + line: null, + column: null, + lastColumn: null + }; + }; + +__webpack_unused_export__ = BasicSourceMapConsumer; + +/** + * An IndexedSourceMapConsumer instance represents a parsed source map which + * we can query for information. It differs from BasicSourceMapConsumer in + * that it takes "indexed" source maps (i.e. ones with a "sections" field) as + * input. + * + * The first parameter is a raw source map (either as a JSON string, or already + * parsed to an object). According to the spec for indexed source maps, they + * have the following attributes: + * + * - version: Which version of the source map spec this map is following. + * - file: Optional. The generated file this source map is associated with. + * - sections: A list of section definitions. + * + * Each value under the "sections" field has two fields: + * - offset: The offset into the original specified at which this section + * begins to apply, defined as an object with a "line" and "column" + * field. + * - map: A source map definition. This source map could also be indexed, + * but doesn't have to be. + * + * Instead of the "map" field, it's also possible to have a "url" field + * specifying a URL to retrieve a source map from, but that's currently + * unsupported. + * + * Here's an example source map, taken from the source map spec[0], but + * modified to omit a section which uses the "url" field. + * + * { + * version : 3, + * file: "app.js", + * sections: [{ + * offset: {line:100, column:10}, + * map: { + * version : 3, + * file: "section.js", + * sources: ["foo.js", "bar.js"], + * names: ["src", "maps", "are", "fun"], + * mappings: "AAAA,E;;ABCDE;" + * } + * }], + * } + * + * The second parameter, if given, is a string whose value is the URL + * at which the source map was found. This URL is used to compute the + * sources array. + * + * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt + */ +function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) { + var sourceMap = aSourceMap; + if (typeof aSourceMap === 'string') { + sourceMap = util.parseSourceMapInput(aSourceMap); + } + + var version = util.getArg(sourceMap, 'version'); + var sections = util.getArg(sourceMap, 'sections'); + + if (version != this._version) { + throw new Error('Unsupported version: ' + version); + } + + this._sources = new ArraySet(); + this._names = new ArraySet(); + + var lastOffset = { + line: -1, + column: 0 + }; + this._sections = sections.map(function (s) { + if (s.url) { + // The url field will require support for asynchronicity. + // See https://github.com/mozilla/source-map/issues/16 + throw new Error('Support for url field in sections not implemented.'); + } + var offset = util.getArg(s, 'offset'); + var offsetLine = util.getArg(offset, 'line'); + var offsetColumn = util.getArg(offset, 'column'); + + if (offsetLine < lastOffset.line || + (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) { + throw new Error('Section offsets must be ordered and non-overlapping.'); + } + lastOffset = offset; + + return { + generatedOffset: { + // The offset fields are 0-based, but we use 1-based indices when + // encoding/decoding from VLQ. + generatedLine: offsetLine + 1, + generatedColumn: offsetColumn + 1 + }, + consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL) + } + }); +} + +IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype); +IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer; + +/** + * The version of the source mapping spec that we are consuming. + */ +IndexedSourceMapConsumer.prototype._version = 3; + +/** + * The list of original sources. + */ +Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', { + get: function () { + var sources = []; + for (var i = 0; i < this._sections.length; i++) { + for (var j = 0; j < this._sections[i].consumer.sources.length; j++) { + sources.push(this._sections[i].consumer.sources[j]); + } + } + return sources; + } +}); + +/** + * Returns the original source, line, and column information for the generated + * source's line and column positions provided. The only argument is an object + * with the following properties: + * + * - line: The line number in the generated source. The line number + * is 1-based. + * - column: The column number in the generated source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - source: The original source file, or null. + * - line: The line number in the original source, or null. The + * line number is 1-based. + * - column: The column number in the original source, or null. The + * column number is 0-based. + * - name: The original identifier, or null. + */ +IndexedSourceMapConsumer.prototype.originalPositionFor = + function IndexedSourceMapConsumer_originalPositionFor(aArgs) { + var needle = { + generatedLine: util.getArg(aArgs, 'line'), + generatedColumn: util.getArg(aArgs, 'column') + }; + + // Find the section containing the generated position we're trying to map + // to an original position. + var sectionIndex = binarySearch.search(needle, this._sections, + function(needle, section) { + var cmp = needle.generatedLine - section.generatedOffset.generatedLine; + if (cmp) { + return cmp; + } + + return (needle.generatedColumn - + section.generatedOffset.generatedColumn); + }); + var section = this._sections[sectionIndex]; + + if (!section) { + return { + source: null, + line: null, + column: null, + name: null + }; + } + + return section.consumer.originalPositionFor({ + line: needle.generatedLine - + (section.generatedOffset.generatedLine - 1), + column: needle.generatedColumn - + (section.generatedOffset.generatedLine === needle.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + bias: aArgs.bias + }); + }; + +/** + * Return true if we have the source content for every source in the source + * map, false otherwise. + */ +IndexedSourceMapConsumer.prototype.hasContentsOfAllSources = + function IndexedSourceMapConsumer_hasContentsOfAllSources() { + return this._sections.every(function (s) { + return s.consumer.hasContentsOfAllSources(); + }); + }; + +/** + * Returns the original source content. The only argument is the url of the + * original source file. Returns null if no original source content is + * available. + */ +IndexedSourceMapConsumer.prototype.sourceContentFor = + function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + var content = section.consumer.sourceContentFor(aSource, true); + if (content) { + return content; + } + } + if (nullOnMissing) { + return null; + } + else { + throw new Error('"' + aSource + '" is not in the SourceMap.'); + } + }; + +/** + * Returns the generated line and column information for the original source, + * line, and column positions provided. The only argument is an object with + * the following properties: + * + * - source: The filename of the original source. + * - line: The line number in the original source. The line number + * is 1-based. + * - column: The column number in the original source. The column + * number is 0-based. + * + * and an object is returned with the following properties: + * + * - line: The line number in the generated source, or null. The + * line number is 1-based. + * - column: The column number in the generated source, or null. + * The column number is 0-based. + */ +IndexedSourceMapConsumer.prototype.generatedPositionFor = + function IndexedSourceMapConsumer_generatedPositionFor(aArgs) { + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + + // Only consider this section if the requested source is in the list of + // sources of the consumer. + if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) { + continue; + } + var generatedPosition = section.consumer.generatedPositionFor(aArgs); + if (generatedPosition) { + var ret = { + line: generatedPosition.line + + (section.generatedOffset.generatedLine - 1), + column: generatedPosition.column + + (section.generatedOffset.generatedLine === generatedPosition.line + ? section.generatedOffset.generatedColumn - 1 + : 0) + }; + return ret; + } + } + + return { + line: null, + column: null + }; + }; + +/** + * Parse the mappings in a string in to a data structure which we can easily + * query (the ordered arrays in the `this.__generatedMappings` and + * `this.__originalMappings` properties). + */ +IndexedSourceMapConsumer.prototype._parseMappings = + function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) { + this.__generatedMappings = []; + this.__originalMappings = []; + for (var i = 0; i < this._sections.length; i++) { + var section = this._sections[i]; + var sectionMappings = section.consumer._generatedMappings; + for (var j = 0; j < sectionMappings.length; j++) { + var mapping = sectionMappings[j]; + + var source = section.consumer._sources.at(mapping.source); + source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL); + this._sources.add(source); + source = this._sources.indexOf(source); + + var name = null; + if (mapping.name) { + name = section.consumer._names.at(mapping.name); + this._names.add(name); + name = this._names.indexOf(name); + } + + // The mappings coming from the consumer for the section have + // generated positions relative to the start of the section, so we + // need to offset them to be relative to the start of the concatenated + // generated file. + var adjustedMapping = { + source: source, + generatedLine: mapping.generatedLine + + (section.generatedOffset.generatedLine - 1), + generatedColumn: mapping.generatedColumn + + (section.generatedOffset.generatedLine === mapping.generatedLine + ? section.generatedOffset.generatedColumn - 1 + : 0), + originalLine: mapping.originalLine, + originalColumn: mapping.originalColumn, + name: name + }; + + this.__generatedMappings.push(adjustedMapping); + if (typeof adjustedMapping.originalLine === 'number') { + this.__originalMappings.push(adjustedMapping); + } + } + } + + quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated); + quickSort(this.__originalMappings, util.compareByOriginalPositions); + }; + +__webpack_unused_export__ = IndexedSourceMapConsumer; + + +/***/ }), + +/***/ 90190: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var base64VLQ = __webpack_require__(17887); +var util = __webpack_require__(84540); +var ArraySet = (__webpack_require__(38886)/* .ArraySet */ .C); +var MappingList = (__webpack_require__(8285)/* .MappingList */ .P); + +/** + * An instance of the SourceMapGenerator represents a source map which is + * being built incrementally. You may pass an object with the following + * properties: + * + * - file: The filename of the generated source. + * - sourceRoot: A root for all relative URLs in this source map. + */ +function SourceMapGenerator(aArgs) { + if (!aArgs) { + aArgs = {}; + } + this._file = util.getArg(aArgs, 'file', null); + this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null); + this._skipValidation = util.getArg(aArgs, 'skipValidation', false); + this._sources = new ArraySet(); + this._names = new ArraySet(); + this._mappings = new MappingList(); + this._sourcesContents = null; +} + +SourceMapGenerator.prototype._version = 3; + +/** + * Creates a new SourceMapGenerator based on a SourceMapConsumer + * + * @param aSourceMapConsumer The SourceMap. + */ +SourceMapGenerator.fromSourceMap = + function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) { + var sourceRoot = aSourceMapConsumer.sourceRoot; + var generator = new SourceMapGenerator({ + file: aSourceMapConsumer.file, + sourceRoot: sourceRoot + }); + aSourceMapConsumer.eachMapping(function (mapping) { + var newMapping = { + generated: { + line: mapping.generatedLine, + column: mapping.generatedColumn + } + }; + + if (mapping.source != null) { + newMapping.source = mapping.source; + if (sourceRoot != null) { + newMapping.source = util.relative(sourceRoot, newMapping.source); + } + + newMapping.original = { + line: mapping.originalLine, + column: mapping.originalColumn + }; + + if (mapping.name != null) { + newMapping.name = mapping.name; + } + } + + generator.addMapping(newMapping); + }); + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var sourceRelative = sourceFile; + if (sourceRoot !== null) { + sourceRelative = util.relative(sourceRoot, sourceFile); + } + + if (!generator._sources.has(sourceRelative)) { + generator._sources.add(sourceRelative); + } + + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + generator.setSourceContent(sourceFile, content); + } + }); + return generator; + }; + +/** + * Add a single mapping from original source line and column to the generated + * source's line and column for this source map being created. The mapping + * object should have the following properties: + * + * - generated: An object with the generated line and column positions. + * - original: An object with the original line and column positions. + * - source: The original source file (relative to the sourceRoot). + * - name: An optional original token name for this mapping. + */ +SourceMapGenerator.prototype.addMapping = + function SourceMapGenerator_addMapping(aArgs) { + var generated = util.getArg(aArgs, 'generated'); + var original = util.getArg(aArgs, 'original', null); + var source = util.getArg(aArgs, 'source', null); + var name = util.getArg(aArgs, 'name', null); + + if (!this._skipValidation) { + this._validateMapping(generated, original, source, name); + } + + if (source != null) { + source = String(source); + if (!this._sources.has(source)) { + this._sources.add(source); + } + } + + if (name != null) { + name = String(name); + if (!this._names.has(name)) { + this._names.add(name); + } + } + + this._mappings.add({ + generatedLine: generated.line, + generatedColumn: generated.column, + originalLine: original != null && original.line, + originalColumn: original != null && original.column, + source: source, + name: name + }); + }; + +/** + * Set the source content for a source file. + */ +SourceMapGenerator.prototype.setSourceContent = + function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) { + var source = aSourceFile; + if (this._sourceRoot != null) { + source = util.relative(this._sourceRoot, source); + } + + if (aSourceContent != null) { + // Add the source content to the _sourcesContents map. + // Create a new _sourcesContents map if the property is null. + if (!this._sourcesContents) { + this._sourcesContents = Object.create(null); + } + this._sourcesContents[util.toSetString(source)] = aSourceContent; + } else if (this._sourcesContents) { + // Remove the source file from the _sourcesContents map. + // If the _sourcesContents map is empty, set the property to null. + delete this._sourcesContents[util.toSetString(source)]; + if (Object.keys(this._sourcesContents).length === 0) { + this._sourcesContents = null; + } + } + }; + +/** + * Applies the mappings of a sub-source-map for a specific source file to the + * source map being generated. Each mapping to the supplied source file is + * rewritten using the supplied source map. Note: The resolution for the + * resulting mappings is the minimium of this map and the supplied map. + * + * @param aSourceMapConsumer The source map to be applied. + * @param aSourceFile Optional. The filename of the source file. + * If omitted, SourceMapConsumer's file property will be used. + * @param aSourceMapPath Optional. The dirname of the path to the source map + * to be applied. If relative, it is relative to the SourceMapConsumer. + * This parameter is needed when the two source maps aren't in the same + * directory, and the source map to be applied contains relative source + * paths. If so, those relative source paths need to be rewritten + * relative to the SourceMapGenerator. + */ +SourceMapGenerator.prototype.applySourceMap = + function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) { + var sourceFile = aSourceFile; + // If aSourceFile is omitted, we will use the file property of the SourceMap + if (aSourceFile == null) { + if (aSourceMapConsumer.file == null) { + throw new Error( + 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' + + 'or the source map\'s "file" property. Both were omitted.' + ); + } + sourceFile = aSourceMapConsumer.file; + } + var sourceRoot = this._sourceRoot; + // Make "sourceFile" relative if an absolute Url is passed. + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + // Applying the SourceMap can add and remove items from the sources and + // the names array. + var newSources = new ArraySet(); + var newNames = new ArraySet(); + + // Find mappings for the "sourceFile" + this._mappings.unsortedForEach(function (mapping) { + if (mapping.source === sourceFile && mapping.originalLine != null) { + // Check if it can be mapped by the source map, then update the mapping. + var original = aSourceMapConsumer.originalPositionFor({ + line: mapping.originalLine, + column: mapping.originalColumn + }); + if (original.source != null) { + // Copy mapping + mapping.source = original.source; + if (aSourceMapPath != null) { + mapping.source = util.join(aSourceMapPath, mapping.source) + } + if (sourceRoot != null) { + mapping.source = util.relative(sourceRoot, mapping.source); + } + mapping.originalLine = original.line; + mapping.originalColumn = original.column; + if (original.name != null) { + mapping.name = original.name; + } + } + } + + var source = mapping.source; + if (source != null && !newSources.has(source)) { + newSources.add(source); + } + + var name = mapping.name; + if (name != null && !newNames.has(name)) { + newNames.add(name); + } + + }, this); + this._sources = newSources; + this._names = newNames; + + // Copy sourcesContents of applied map. + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aSourceMapPath != null) { + sourceFile = util.join(aSourceMapPath, sourceFile); + } + if (sourceRoot != null) { + sourceFile = util.relative(sourceRoot, sourceFile); + } + this.setSourceContent(sourceFile, content); + } + }, this); + }; + +/** + * A mapping can have one of the three levels of data: + * + * 1. Just the generated position. + * 2. The Generated position, original position, and original source. + * 3. Generated and original position, original source, as well as a name + * token. + * + * To maintain consistency, we validate that any new mapping being added falls + * in to one of these categories. + */ +SourceMapGenerator.prototype._validateMapping = + function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource, + aName) { + // When aOriginal is truthy but has empty values for .line and .column, + // it is most likely a programmer error. In this case we throw a very + // specific error message to try to guide them the right way. + // For example: https://github.com/Polymer/polymer-bundler/pull/519 + if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') { + throw new Error( + 'original.line and original.column are not numbers -- you probably meant to omit ' + + 'the original mapping entirely and only map the generated position. If so, pass ' + + 'null for the original mapping instead of an object with empty or null values.' + ); + } + + if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aGenerated.line > 0 && aGenerated.column >= 0 + && !aOriginal && !aSource && !aName) { + // Case 1. + return; + } + else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated + && aOriginal && 'line' in aOriginal && 'column' in aOriginal + && aGenerated.line > 0 && aGenerated.column >= 0 + && aOriginal.line > 0 && aOriginal.column >= 0 + && aSource) { + // Cases 2 and 3. + return; + } + else { + throw new Error('Invalid mapping: ' + JSON.stringify({ + generated: aGenerated, + source: aSource, + original: aOriginal, + name: aName + })); + } + }; + +/** + * Serialize the accumulated mappings in to the stream of base 64 VLQs + * specified by the source map format. + */ +SourceMapGenerator.prototype._serializeMappings = + function SourceMapGenerator_serializeMappings() { + var previousGeneratedColumn = 0; + var previousGeneratedLine = 1; + var previousOriginalColumn = 0; + var previousOriginalLine = 0; + var previousName = 0; + var previousSource = 0; + var result = ''; + var next; + var mapping; + var nameIdx; + var sourceIdx; + + var mappings = this._mappings.toArray(); + for (var i = 0, len = mappings.length; i < len; i++) { + mapping = mappings[i]; + next = '' + + if (mapping.generatedLine !== previousGeneratedLine) { + previousGeneratedColumn = 0; + while (mapping.generatedLine !== previousGeneratedLine) { + next += ';'; + previousGeneratedLine++; + } + } + else { + if (i > 0) { + if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) { + continue; + } + next += ','; + } + } + + next += base64VLQ.encode(mapping.generatedColumn + - previousGeneratedColumn); + previousGeneratedColumn = mapping.generatedColumn; + + if (mapping.source != null) { + sourceIdx = this._sources.indexOf(mapping.source); + next += base64VLQ.encode(sourceIdx - previousSource); + previousSource = sourceIdx; + + // lines are stored 0-based in SourceMap spec version 3 + next += base64VLQ.encode(mapping.originalLine - 1 + - previousOriginalLine); + previousOriginalLine = mapping.originalLine - 1; + + next += base64VLQ.encode(mapping.originalColumn + - previousOriginalColumn); + previousOriginalColumn = mapping.originalColumn; + + if (mapping.name != null) { + nameIdx = this._names.indexOf(mapping.name); + next += base64VLQ.encode(nameIdx - previousName); + previousName = nameIdx; + } + } + + result += next; + } + + return result; + }; + +SourceMapGenerator.prototype._generateSourcesContent = + function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) { + return aSources.map(function (source) { + if (!this._sourcesContents) { + return null; + } + if (aSourceRoot != null) { + source = util.relative(aSourceRoot, source); + } + var key = util.toSetString(source); + return Object.prototype.hasOwnProperty.call(this._sourcesContents, key) + ? this._sourcesContents[key] + : null; + }, this); + }; + +/** + * Externalize the source map. + */ +SourceMapGenerator.prototype.toJSON = + function SourceMapGenerator_toJSON() { + var map = { + version: this._version, + sources: this._sources.toArray(), + names: this._names.toArray(), + mappings: this._serializeMappings() + }; + if (this._file != null) { + map.file = this._file; + } + if (this._sourceRoot != null) { + map.sourceRoot = this._sourceRoot; + } + if (this._sourcesContents) { + map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot); + } + + return map; + }; + +/** + * Render the source map being generated to a string. + */ +SourceMapGenerator.prototype.toString = + function SourceMapGenerator_toString() { + return JSON.stringify(this.toJSON()); + }; + +exports.x = SourceMapGenerator; + + +/***/ }), + +/***/ 16714: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +var __webpack_unused_export__; +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +var SourceMapGenerator = (__webpack_require__(90190)/* .SourceMapGenerator */ .x); +var util = __webpack_require__(84540); + +// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other +// operating systems these days (capturing the result). +var REGEX_NEWLINE = /(\r?\n)/; + +// Newline character code for charCodeAt() comparisons +var NEWLINE_CODE = 10; + +// Private symbol for identifying `SourceNode`s when multiple versions of +// the source-map library are loaded. This MUST NOT CHANGE across +// versions! +var isSourceNode = "$$$isSourceNode$$$"; + +/** + * SourceNodes provide a way to abstract over interpolating/concatenating + * snippets of generated JavaScript source code while maintaining the line and + * column information associated with the original source code. + * + * @param aLine The original line number. + * @param aColumn The original column number. + * @param aSource The original source's filename. + * @param aChunks Optional. An array of strings which are snippets of + * generated JS, or other SourceNodes. + * @param aName The original identifier. + */ +function SourceNode(aLine, aColumn, aSource, aChunks, aName) { + this.children = []; + this.sourceContents = {}; + this.line = aLine == null ? null : aLine; + this.column = aColumn == null ? null : aColumn; + this.source = aSource == null ? null : aSource; + this.name = aName == null ? null : aName; + this[isSourceNode] = true; + if (aChunks != null) this.add(aChunks); +} + +/** + * Creates a SourceNode from generated code and a SourceMapConsumer. + * + * @param aGeneratedCode The generated code + * @param aSourceMapConsumer The SourceMap for the generated code + * @param aRelativePath Optional. The path that relative sources in the + * SourceMapConsumer should be relative to. + */ +SourceNode.fromStringWithSourceMap = + function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) { + // The SourceNode we want to fill with the generated code + // and the SourceMap + var node = new SourceNode(); + + // All even indices of this array are one line of the generated code, + // while all odd indices are the newlines between two adjacent lines + // (since `REGEX_NEWLINE` captures its match). + // Processed fragments are accessed by calling `shiftNextLine`. + var remainingLines = aGeneratedCode.split(REGEX_NEWLINE); + var remainingLinesIndex = 0; + var shiftNextLine = function() { + var lineContents = getNextLine(); + // The last line of a file might not have a newline. + var newLine = getNextLine() || ""; + return lineContents + newLine; + + function getNextLine() { + return remainingLinesIndex < remainingLines.length ? + remainingLines[remainingLinesIndex++] : undefined; + } + }; + + // We need to remember the position of "remainingLines" + var lastGeneratedLine = 1, lastGeneratedColumn = 0; + + // The generate SourceNodes we need a code range. + // To extract it current and last mapping is used. + // Here we store the last mapping. + var lastMapping = null; + + aSourceMapConsumer.eachMapping(function (mapping) { + if (lastMapping !== null) { + // We add the code from "lastMapping" to "mapping": + // First check if there is a new line in between. + if (lastGeneratedLine < mapping.generatedLine) { + // Associate first line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + lastGeneratedLine++; + lastGeneratedColumn = 0; + // The remaining code is added without mapping + } else { + // There is no new line in between. + // Associate the code between "lastGeneratedColumn" and + // "mapping.generatedColumn" with "lastMapping" + var nextLine = remainingLines[remainingLinesIndex] || ''; + var code = nextLine.substr(0, mapping.generatedColumn - + lastGeneratedColumn); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn - + lastGeneratedColumn); + lastGeneratedColumn = mapping.generatedColumn; + addMappingWithCode(lastMapping, code); + // No more remaining code, continue + lastMapping = mapping; + return; + } + } + // We add the generated code until the first mapping + // to the SourceNode without any mapping. + // Each line is added as separate string. + while (lastGeneratedLine < mapping.generatedLine) { + node.add(shiftNextLine()); + lastGeneratedLine++; + } + if (lastGeneratedColumn < mapping.generatedColumn) { + var nextLine = remainingLines[remainingLinesIndex] || ''; + node.add(nextLine.substr(0, mapping.generatedColumn)); + remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn); + lastGeneratedColumn = mapping.generatedColumn; + } + lastMapping = mapping; + }, this); + // We have processed all mappings. + if (remainingLinesIndex < remainingLines.length) { + if (lastMapping) { + // Associate the remaining code in the current line with "lastMapping" + addMappingWithCode(lastMapping, shiftNextLine()); + } + // and add the remaining lines without any mapping + node.add(remainingLines.splice(remainingLinesIndex).join("")); + } + + // Copy sourcesContent into SourceNode + aSourceMapConsumer.sources.forEach(function (sourceFile) { + var content = aSourceMapConsumer.sourceContentFor(sourceFile); + if (content != null) { + if (aRelativePath != null) { + sourceFile = util.join(aRelativePath, sourceFile); + } + node.setSourceContent(sourceFile, content); + } + }); + + return node; + + function addMappingWithCode(mapping, code) { + if (mapping === null || mapping.source === undefined) { + node.add(code); + } else { + var source = aRelativePath + ? util.join(aRelativePath, mapping.source) + : mapping.source; + node.add(new SourceNode(mapping.originalLine, + mapping.originalColumn, + source, + code, + mapping.name)); + } + } + }; + +/** + * Add a chunk of generated JS to this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.add = function SourceNode_add(aChunk) { + if (Array.isArray(aChunk)) { + aChunk.forEach(function (chunk) { + this.add(chunk); + }, this); + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + if (aChunk) { + this.children.push(aChunk); + } + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Add a chunk of generated JS to the beginning of this source node. + * + * @param aChunk A string snippet of generated JS code, another instance of + * SourceNode, or an array where each member is one of those things. + */ +SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) { + if (Array.isArray(aChunk)) { + for (var i = aChunk.length-1; i >= 0; i--) { + this.prepend(aChunk[i]); + } + } + else if (aChunk[isSourceNode] || typeof aChunk === "string") { + this.children.unshift(aChunk); + } + else { + throw new TypeError( + "Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk + ); + } + return this; +}; + +/** + * Walk over the tree of JS snippets in this node and its children. The + * walking function is called once for each snippet of JS and is passed that + * snippet and the its original associated source's line/column location. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walk = function SourceNode_walk(aFn) { + var chunk; + for (var i = 0, len = this.children.length; i < len; i++) { + chunk = this.children[i]; + if (chunk[isSourceNode]) { + chunk.walk(aFn); + } + else { + if (chunk !== '') { + aFn(chunk, { source: this.source, + line: this.line, + column: this.column, + name: this.name }); + } + } + } +}; + +/** + * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between + * each of `this.children`. + * + * @param aSep The separator. + */ +SourceNode.prototype.join = function SourceNode_join(aSep) { + var newChildren; + var i; + var len = this.children.length; + if (len > 0) { + newChildren = []; + for (i = 0; i < len-1; i++) { + newChildren.push(this.children[i]); + newChildren.push(aSep); + } + newChildren.push(this.children[i]); + this.children = newChildren; + } + return this; +}; + +/** + * Call String.prototype.replace on the very right-most source snippet. Useful + * for trimming whitespace from the end of a source node, etc. + * + * @param aPattern The pattern to replace. + * @param aReplacement The thing to replace the pattern with. + */ +SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) { + var lastChild = this.children[this.children.length - 1]; + if (lastChild[isSourceNode]) { + lastChild.replaceRight(aPattern, aReplacement); + } + else if (typeof lastChild === 'string') { + this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement); + } + else { + this.children.push(''.replace(aPattern, aReplacement)); + } + return this; +}; + +/** + * Set the source content for a source file. This will be added to the SourceMapGenerator + * in the sourcesContent field. + * + * @param aSourceFile The filename of the source file + * @param aSourceContent The content of the source file + */ +SourceNode.prototype.setSourceContent = + function SourceNode_setSourceContent(aSourceFile, aSourceContent) { + this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent; + }; + +/** + * Walk over the tree of SourceNodes. The walking function is called for each + * source file content and is passed the filename and source content. + * + * @param aFn The traversal function. + */ +SourceNode.prototype.walkSourceContents = + function SourceNode_walkSourceContents(aFn) { + for (var i = 0, len = this.children.length; i < len; i++) { + if (this.children[i][isSourceNode]) { + this.children[i].walkSourceContents(aFn); + } + } + + var sources = Object.keys(this.sourceContents); + for (var i = 0, len = sources.length; i < len; i++) { + aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]); + } + }; + +/** + * Return the string representation of this source node. Walks over the tree + * and concatenates all the various snippets together to one string. + */ +SourceNode.prototype.toString = function SourceNode_toString() { + var str = ""; + this.walk(function (chunk) { + str += chunk; + }); + return str; +}; + +/** + * Returns the string representation of this source node along with a source + * map. + */ +SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) { + var generated = { + code: "", + line: 1, + column: 0 + }; + var map = new SourceMapGenerator(aArgs); + var sourceMappingActive = false; + var lastOriginalSource = null; + var lastOriginalLine = null; + var lastOriginalColumn = null; + var lastOriginalName = null; + this.walk(function (chunk, original) { + generated.code += chunk; + if (original.source !== null + && original.line !== null + && original.column !== null) { + if(lastOriginalSource !== original.source + || lastOriginalLine !== original.line + || lastOriginalColumn !== original.column + || lastOriginalName !== original.name) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + lastOriginalSource = original.source; + lastOriginalLine = original.line; + lastOriginalColumn = original.column; + lastOriginalName = original.name; + sourceMappingActive = true; + } else if (sourceMappingActive) { + map.addMapping({ + generated: { + line: generated.line, + column: generated.column + } + }); + lastOriginalSource = null; + sourceMappingActive = false; + } + for (var idx = 0, length = chunk.length; idx < length; idx++) { + if (chunk.charCodeAt(idx) === NEWLINE_CODE) { + generated.line++; + generated.column = 0; + // Mappings end at eol + if (idx + 1 === length) { + lastOriginalSource = null; + sourceMappingActive = false; + } else if (sourceMappingActive) { + map.addMapping({ + source: original.source, + original: { + line: original.line, + column: original.column + }, + generated: { + line: generated.line, + column: generated.column + }, + name: original.name + }); + } + } else { + generated.column++; + } + } + }); + this.walkSourceContents(function (sourceFile, sourceContent) { + map.setSourceContent(sourceFile, sourceContent); + }); + + return { code: generated.code, map: map }; +}; + +__webpack_unused_export__ = SourceNode; + + +/***/ }), + +/***/ 84540: +/***/ ((__unused_webpack_module, exports) => { + +/* -*- Mode: js; js-indent-level: 2; -*- */ +/* + * Copyright 2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE or: + * http://opensource.org/licenses/BSD-3-Clause + */ + +/** + * This is a helper function for getting values from parameter/options + * objects. + * + * @param args The object we are extracting values from + * @param name The name of the property we are getting. + * @param defaultValue An optional value to return if the property is missing + * from the object. If this is not specified and the property is missing, an + * error will be thrown. + */ +function getArg(aArgs, aName, aDefaultValue) { + if (aName in aArgs) { + return aArgs[aName]; + } else if (arguments.length === 3) { + return aDefaultValue; + } else { + throw new Error('"' + aName + '" is a required argument.'); + } +} +exports.getArg = getArg; + +var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/; +var dataUrlRegexp = /^data:.+\,.+$/; + +function urlParse(aUrl) { + var match = aUrl.match(urlRegexp); + if (!match) { + return null; + } + return { + scheme: match[1], + auth: match[2], + host: match[3], + port: match[4], + path: match[5] + }; +} +exports.urlParse = urlParse; + +function urlGenerate(aParsedUrl) { + var url = ''; + if (aParsedUrl.scheme) { + url += aParsedUrl.scheme + ':'; + } + url += '//'; + if (aParsedUrl.auth) { + url += aParsedUrl.auth + '@'; + } + if (aParsedUrl.host) { + url += aParsedUrl.host; + } + if (aParsedUrl.port) { + url += ":" + aParsedUrl.port + } + if (aParsedUrl.path) { + url += aParsedUrl.path; + } + return url; +} +exports.urlGenerate = urlGenerate; + +/** + * Normalizes a path, or the path portion of a URL: + * + * - Replaces consecutive slashes with one slash. + * - Removes unnecessary '.' parts. + * - Removes unnecessary '/..' parts. + * + * Based on code in the Node.js 'path' core module. + * + * @param aPath The path or url to normalize. + */ +function normalize(aPath) { + var path = aPath; + var url = urlParse(aPath); + if (url) { + if (!url.path) { + return aPath; + } + path = url.path; + } + var isAbsolute = exports.isAbsolute(path); + + var parts = path.split(/\/+/); + for (var part, up = 0, i = parts.length - 1; i >= 0; i--) { + part = parts[i]; + if (part === '.') { + parts.splice(i, 1); + } else if (part === '..') { + up++; + } else if (up > 0) { + if (part === '') { + // The first part is blank if the path is absolute. Trying to go + // above the root is a no-op. Therefore we can remove all '..' parts + // directly after the root. + parts.splice(i + 1, up); + up = 0; + } else { + parts.splice(i, 2); + up--; + } + } + } + path = parts.join('/'); + + if (path === '') { + path = isAbsolute ? '/' : '.'; + } + + if (url) { + url.path = path; + return urlGenerate(url); + } + return path; +} +exports.normalize = normalize; + +/** + * Joins two paths/URLs. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be joined with the root. + * + * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a + * scheme-relative URL: Then the scheme of aRoot, if any, is prepended + * first. + * - Otherwise aPath is a path. If aRoot is a URL, then its path portion + * is updated with the result and aRoot is returned. Otherwise the result + * is returned. + * - If aPath is absolute, the result is aPath. + * - Otherwise the two paths are joined with a slash. + * - Joining for example 'http://' and 'www.example.com' is also supported. + */ +function join(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + if (aPath === "") { + aPath = "."; + } + var aPathUrl = urlParse(aPath); + var aRootUrl = urlParse(aRoot); + if (aRootUrl) { + aRoot = aRootUrl.path || '/'; + } + + // `join(foo, '//www.example.org')` + if (aPathUrl && !aPathUrl.scheme) { + if (aRootUrl) { + aPathUrl.scheme = aRootUrl.scheme; + } + return urlGenerate(aPathUrl); + } + + if (aPathUrl || aPath.match(dataUrlRegexp)) { + return aPath; + } + + // `join('http://', 'www.example.com')` + if (aRootUrl && !aRootUrl.host && !aRootUrl.path) { + aRootUrl.host = aPath; + return urlGenerate(aRootUrl); + } + + var joined = aPath.charAt(0) === '/' + ? aPath + : normalize(aRoot.replace(/\/+$/, '') + '/' + aPath); + + if (aRootUrl) { + aRootUrl.path = joined; + return urlGenerate(aRootUrl); + } + return joined; +} +exports.join = join; + +exports.isAbsolute = function (aPath) { + return aPath.charAt(0) === '/' || urlRegexp.test(aPath); +}; + +/** + * Make a path relative to a URL or another path. + * + * @param aRoot The root path or URL. + * @param aPath The path or URL to be made relative to aRoot. + */ +function relative(aRoot, aPath) { + if (aRoot === "") { + aRoot = "."; + } + + aRoot = aRoot.replace(/\/$/, ''); + + // It is possible for the path to be above the root. In this case, simply + // checking whether the root is a prefix of the path won't work. Instead, we + // need to remove components from the root one by one, until either we find + // a prefix that fits, or we run out of components to remove. + var level = 0; + while (aPath.indexOf(aRoot + '/') !== 0) { + var index = aRoot.lastIndexOf("/"); + if (index < 0) { + return aPath; + } + + // If the only part of the root that is left is the scheme (i.e. http://, + // file:///, etc.), one or more slashes (/), or simply nothing at all, we + // have exhausted all components, so the path is not relative to the root. + aRoot = aRoot.slice(0, index); + if (aRoot.match(/^([^\/]+:\/)?\/*$/)) { + return aPath; + } + + ++level; + } + + // Make sure we add a "../" for each component we removed from the root. + return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1); +} +exports.relative = relative; + +var supportsNullProto = (function () { + var obj = Object.create(null); + return !('__proto__' in obj); +}()); + +function identity (s) { + return s; +} + +/** + * Because behavior goes wacky when you set `__proto__` on objects, we + * have to prefix all the strings in our set with an arbitrary character. + * + * See https://github.com/mozilla/source-map/pull/31 and + * https://github.com/mozilla/source-map/issues/30 + * + * @param String aStr + */ +function toSetString(aStr) { + if (isProtoString(aStr)) { + return '$' + aStr; + } + + return aStr; +} +exports.toSetString = supportsNullProto ? identity : toSetString; + +function fromSetString(aStr) { + if (isProtoString(aStr)) { + return aStr.slice(1); + } + + return aStr; +} +exports.fromSetString = supportsNullProto ? identity : fromSetString; + +function isProtoString(s) { + if (!s) { + return false; + } + + var length = s.length; + + if (length < 9 /* "__proto__".length */) { + return false; + } + + if (s.charCodeAt(length - 1) !== 95 /* '_' */ || + s.charCodeAt(length - 2) !== 95 /* '_' */ || + s.charCodeAt(length - 3) !== 111 /* 'o' */ || + s.charCodeAt(length - 4) !== 116 /* 't' */ || + s.charCodeAt(length - 5) !== 111 /* 'o' */ || + s.charCodeAt(length - 6) !== 114 /* 'r' */ || + s.charCodeAt(length - 7) !== 112 /* 'p' */ || + s.charCodeAt(length - 8) !== 95 /* '_' */ || + s.charCodeAt(length - 9) !== 95 /* '_' */) { + return false; + } + + for (var i = length - 10; i >= 0; i--) { + if (s.charCodeAt(i) !== 36 /* '$' */) { + return false; + } + } + + return true; +} + +/** + * Comparator between two mappings where the original positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same original source/line/column, but different generated + * line and column the same. Useful when searching for a mapping with a + * stubbed out mapping. + */ +function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) { + var cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0 || onlyCompareOriginal) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByOriginalPositions = compareByOriginalPositions; + +/** + * Comparator between two mappings with deflated source and name indices where + * the generated positions are compared. + * + * Optionally pass in `true` as `onlyCompareGenerated` to consider two + * mappings with the same generated line and column, but different + * source/name/original line and column the same. Useful when searching for a + * mapping with a stubbed out mapping. + */ +function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0 || onlyCompareGenerated) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated; + +function strcmp(aStr1, aStr2) { + if (aStr1 === aStr2) { + return 0; + } + + if (aStr1 === null) { + return 1; // aStr2 !== null + } + + if (aStr2 === null) { + return -1; // aStr1 !== null + } + + if (aStr1 > aStr2) { + return 1; + } + + return -1; +} + +/** + * Comparator between two mappings with inflated source and name strings where + * the generated positions are compared. + */ +function compareByGeneratedPositionsInflated(mappingA, mappingB) { + var cmp = mappingA.generatedLine - mappingB.generatedLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.generatedColumn - mappingB.generatedColumn; + if (cmp !== 0) { + return cmp; + } + + cmp = strcmp(mappingA.source, mappingB.source); + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalLine - mappingB.originalLine; + if (cmp !== 0) { + return cmp; + } + + cmp = mappingA.originalColumn - mappingB.originalColumn; + if (cmp !== 0) { + return cmp; + } + + return strcmp(mappingA.name, mappingB.name); +} +exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated; + +/** + * Strip any JSON XSSI avoidance prefix from the string (as documented + * in the source maps specification), and then parse the string as + * JSON. + */ +function parseSourceMapInput(str) { + return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, '')); +} +exports.parseSourceMapInput = parseSourceMapInput; + +/** + * Compute the URL of a source given the the source root, the source's + * URL, and the source map's URL. + */ +function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) { + sourceURL = sourceURL || ''; + + if (sourceRoot) { + // This follows what Chrome does. + if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') { + sourceRoot += '/'; + } + // The spec says: + // Line 4: An optional source root, useful for relocating source + // files on a server or removing repeated values in the + // “sources” entry. This value is prepended to the individual + // entries in the “source” field. + sourceURL = sourceRoot + sourceURL; + } + + // Historically, SourceMapConsumer did not take the sourceMapURL as + // a parameter. This mode is still somewhat supported, which is why + // this code block is conditional. However, it's preferable to pass + // the source map URL to SourceMapConsumer, so that this function + // can implement the source URL resolution algorithm as outlined in + // the spec. This block is basically the equivalent of: + // new URL(sourceURL, sourceMapURL).toString() + // ... except it avoids using URL, which wasn't available in the + // older releases of node still supported by this library. + // + // The spec says: + // If the sources are not absolute URLs after prepending of the + // “sourceRoot”, the sources are resolved relative to the + // SourceMap (like resolving script src in a html document). + if (sourceMapURL) { + var parsed = urlParse(sourceMapURL); + if (!parsed) { + throw new Error("sourceMapURL could not be parsed"); + } + if (parsed.path) { + // Strip the last path component, but keep the "/". + var index = parsed.path.lastIndexOf('/'); + if (index >= 0) { + parsed.path = parsed.path.substring(0, index + 1); + } + } + sourceURL = join(urlGenerate(parsed), sourceURL); + } + + return normalize(sourceURL); +} +exports.computeSourceURL = computeSourceURL; + + +/***/ }), + +/***/ 81914: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +/* + * Copyright 2009-2011 Mozilla Foundation and contributors + * Licensed under the New BSD license. See LICENSE.txt or: + * http://opensource.org/licenses/BSD-3-Clause + */ +/* unused reexport */ __webpack_require__(90190)/* .SourceMapGenerator */ .x; +exports.SourceMapConsumer = __webpack_require__(10339).SourceMapConsumer; +/* unused reexport */ __webpack_require__(16714); + + +/***/ }), + +/***/ 4705: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 59144: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var balanced = __webpack_require__(4705); + +module.exports = expandTop; + +var escSlash = '\0SLASH'+Math.random()+'\0'; +var escOpen = '\0OPEN'+Math.random()+'\0'; +var escClose = '\0CLOSE'+Math.random()+'\0'; +var escComma = '\0COMMA'+Math.random()+'\0'; +var escPeriod = '\0PERIOD'+Math.random()+'\0'; + +function numeric(str) { + return parseInt(str, 10) == str + ? parseInt(str, 10) + : str.charCodeAt(0); +} + +function escapeBraces(str) { + return str.split('\\\\').join(escSlash) + .split('\\{').join(escOpen) + .split('\\}').join(escClose) + .split('\\,').join(escComma) + .split('\\.').join(escPeriod); +} + +function unescapeBraces(str) { + return str.split(escSlash).join('\\') + .split(escOpen).join('{') + .split(escClose).join('}') + .split(escComma).join(',') + .split(escPeriod).join('.'); +} + + +// Basically just str.split(","), but handling cases +// where we have nested braced sections, which should be +// treated as individual members, like {a,{b,c},d} +function parseCommaParts(str) { + if (!str) + return ['']; + + var parts = []; + var m = balanced('{', '}', str); + + if (!m) + return str.split(','); + + var pre = m.pre; + var body = m.body; + var post = m.post; + var p = pre.split(','); + + p[p.length-1] += '{' + body + '}'; + var postParts = parseCommaParts(post); + if (post.length) { + p[p.length-1] += postParts.shift(); + p.push.apply(p, postParts); + } + + parts.push.apply(parts, p); + + return parts; +} + +function expandTop(str) { + if (!str) + return []; + + // I don't know why Bash 4.3 does this, but it does. + // Anything starting with {} will have the first two bytes preserved + // but *only* at the top level, so {},a}b will not expand to anything, + // but a{},b}c will be expanded to [a}c,abc]. + // One could argue that this is a bug in Bash, but since the goal of + // this module is to match Bash's rules, we escape a leading {} + if (str.substr(0, 2) === '{}') { + str = '\\{\\}' + str.substr(2); + } + + return expand(escapeBraces(str), true).map(unescapeBraces); +} + +function embrace(str) { + return '{' + str + '}'; +} +function isPadded(el) { + return /^-?0\d/.test(el); +} + +function lte(i, y) { + return i <= y; +} +function gte(i, y) { + return i >= y; +} + +function expand(str, isTop) { + var expansions = []; + + var m = balanced('{', '}', str); + if (!m) return [str]; + + // no need to expand pre, since it is guaranteed to be free of brace-sets + var pre = m.pre; + var post = m.post.length + ? expand(m.post, false) + : ['']; + + if (/\$$/.test(m.pre)) { + for (var k = 0; k < post.length; k++) { + var expansion = pre+ '{' + m.body + '}' + post[k]; + expansions.push(expansion); + } + } else { + var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body); + var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body); + var isSequence = isNumericSequence || isAlphaSequence; + var isOptions = m.body.indexOf(',') >= 0; + if (!isSequence && !isOptions) { + // {a},b} + if (m.post.match(/,.*\}/)) { + str = m.pre + '{' + m.body + escClose + m.post; + return expand(str); + } + return [str]; + } + + var n; + if (isSequence) { + n = m.body.split(/\.\./); + } else { + n = parseCommaParts(m.body); + if (n.length === 1) { + // x{{a,b}}y ==> x{a}y x{b}y + n = expand(n[0], false).map(embrace); + if (n.length === 1) { + return post.map(function(p) { + return m.pre + n[0] + p; + }); + } + } + } + + // at this point, n is the parts, and we know it's not a comma set + // with a single entry. + var N; + + if (isSequence) { + var x = numeric(n[0]); + var y = numeric(n[1]); + var width = Math.max(n[0].length, n[1].length) + var incr = n.length == 3 + ? Math.abs(numeric(n[2])) + : 1; + var test = lte; + var reverse = y < x; + if (reverse) { + incr *= -1; + test = gte; + } + var pad = n.some(isPadded); + + N = []; + + for (var i = x; test(i, y); i += incr) { + var c; + if (isAlphaSequence) { + c = String.fromCharCode(i); + if (c === '\\') + c = ''; + } else { + c = String(i); + if (pad) { + var need = width - c.length; + if (need > 0) { + var z = new Array(need + 1).join('0'); + if (i < 0) + c = '-' + z + c.slice(1); + else + c = z + c; + } + } + } + N.push(c); + } + } else { + N = []; + + for (var j = 0; j < n.length; j++) { + N.push.apply(N, expand(n[j], false)); + } + } + + for (var j = 0; j < N.length; j++) { + for (var k = 0; k < post.length; k++) { + var expansion = pre + N[j] + post[k]; + if (!isTop || isSequence || expansion) + expansions.push(expansion); + } + } + } + + return expansions; +} + + + +/***/ }), + +/***/ 44119: +/***/ ((module) => { + +/** + * @preserve + * JS Implementation of incremental MurmurHash3 (r150) (as of May 10, 2013) + * + * @author Jens Taylor + * @see http://github.com/homebrewing/brauhaus-diff + * @author Gary Court + * @see http://github.com/garycourt/murmurhash-js + * @author Austin Appleby + * @see http://sites.google.com/site/murmurhash/ + */ +(function(){ + var cache; + + // Call this function without `new` to use the cached object (good for + // single-threaded environments), or with `new` to create a new object. + // + // @param {string} key A UTF-16 or ASCII string + // @param {number} seed An optional positive integer + // @return {object} A MurmurHash3 object for incremental hashing + function MurmurHash3(key, seed) { + var m = this instanceof MurmurHash3 ? this : cache; + m.reset(seed) + if (typeof key === 'string' && key.length > 0) { + m.hash(key); + } + + if (m !== this) { + return m; + } + }; + + // Incrementally add a string to this hash + // + // @param {string} key A UTF-16 or ASCII string + // @return {object} this + MurmurHash3.prototype.hash = function(key) { + var h1, k1, i, top, len; + + len = key.length; + this.len += len; + + k1 = this.k1; + i = 0; + switch (this.rem) { + case 0: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) : 0; + case 1: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 8 : 0; + case 2: k1 ^= len > i ? (key.charCodeAt(i++) & 0xffff) << 16 : 0; + case 3: + k1 ^= len > i ? (key.charCodeAt(i) & 0xff) << 24 : 0; + k1 ^= len > i ? (key.charCodeAt(i++) & 0xff00) >> 8 : 0; + } + + this.rem = (len + this.rem) & 3; // & 3 is same as % 4 + len -= this.rem; + if (len > 0) { + h1 = this.h1; + while (1) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + + h1 ^= k1; + h1 = (h1 << 13) | (h1 >>> 19); + h1 = (h1 * 5 + 0xe6546b64) & 0xffffffff; + + if (i >= len) { + break; + } + + k1 = ((key.charCodeAt(i++) & 0xffff)) ^ + ((key.charCodeAt(i++) & 0xffff) << 8) ^ + ((key.charCodeAt(i++) & 0xffff) << 16); + top = key.charCodeAt(i++); + k1 ^= ((top & 0xff) << 24) ^ + ((top & 0xff00) >> 8); + } + + k1 = 0; + switch (this.rem) { + case 3: k1 ^= (key.charCodeAt(i + 2) & 0xffff) << 16; + case 2: k1 ^= (key.charCodeAt(i + 1) & 0xffff) << 8; + case 1: k1 ^= (key.charCodeAt(i) & 0xffff); + } + + this.h1 = h1; + } + + this.k1 = k1; + return this; + }; + + // Get the result of this hash + // + // @return {number} The 32-bit hash + MurmurHash3.prototype.result = function() { + var k1, h1; + + k1 = this.k1; + h1 = this.h1; + + if (k1 > 0) { + k1 = (k1 * 0x2d51 + (k1 & 0xffff) * 0xcc9e0000) & 0xffffffff; + k1 = (k1 << 15) | (k1 >>> 17); + k1 = (k1 * 0x3593 + (k1 & 0xffff) * 0x1b870000) & 0xffffffff; + h1 ^= k1; + } + + h1 ^= this.len; + + h1 ^= h1 >>> 16; + h1 = (h1 * 0xca6b + (h1 & 0xffff) * 0x85eb0000) & 0xffffffff; + h1 ^= h1 >>> 13; + h1 = (h1 * 0xae35 + (h1 & 0xffff) * 0xc2b20000) & 0xffffffff; + h1 ^= h1 >>> 16; + + return h1 >>> 0; + }; + + // Reset the hash object for reuse + // + // @param {number} seed An optional positive integer + MurmurHash3.prototype.reset = function(seed) { + this.h1 = typeof seed === 'number' ? seed : 0; + this.rem = this.k1 = this.len = 0; + return this; + }; + + // A cached object to use. This can be safely used if you're in a single- + // threaded environment, otherwise you need to create new hashes to use. + cache = new MurmurHash3(); + + if (true) { + module.exports = MurmurHash3; + } else {} +}()); + + +/***/ }), + +/***/ 23145: +/***/ ((module) => { + +"use strict"; + + +/** + * @param typeMap [Object] Map of MIME type -> Array[extensions] + * @param ... + */ +function Mime() { + this._types = Object.create(null); + this._extensions = Object.create(null); + + for (let i = 0; i < arguments.length; i++) { + this.define(arguments[i]); + } + + this.define = this.define.bind(this); + this.getType = this.getType.bind(this); + this.getExtension = this.getExtension.bind(this); +} + +/** + * Define mimetype -> extension mappings. Each key is a mime-type that maps + * to an array of extensions associated with the type. The first extension is + * used as the default extension for the type. + * + * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']}); + * + * If a type declares an extension that has already been defined, an error will + * be thrown. To suppress this error and force the extension to be associated + * with the new type, pass `force`=true. Alternatively, you may prefix the + * extension with "*" to map the type to extension, without mapping the + * extension to the type. + * + * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']}); + * + * + * @param map (Object) type definitions + * @param force (Boolean) if true, force overriding of existing definitions + */ +Mime.prototype.define = function(typeMap, force) { + for (let type in typeMap) { + let extensions = typeMap[type].map(function(t) { + return t.toLowerCase(); + }); + type = type.toLowerCase(); + + for (let i = 0; i < extensions.length; i++) { + const ext = extensions[i]; + + // '*' prefix = not the preferred type for this extension. So fixup the + // extension, and skip it. + if (ext[0] === '*') { + continue; + } + + if (!force && (ext in this._types)) { + throw new Error( + 'Attempt to change mapping for "' + ext + + '" extension from "' + this._types[ext] + '" to "' + type + + '". Pass `force=true` to allow this, otherwise remove "' + ext + + '" from the list of extensions for "' + type + '".' + ); + } + + this._types[ext] = type; + } + + // Use first extension as default + if (force || !this._extensions[type]) { + const ext = extensions[0]; + this._extensions[type] = (ext[0] !== '*') ? ext : ext.substr(1); + } + } +}; + +/** + * Lookup a mime type based on extension + */ +Mime.prototype.getType = function(path) { + path = String(path); + let last = path.replace(/^.*[/\\]/, '').toLowerCase(); + let ext = last.replace(/^.*\./, '').toLowerCase(); + + let hasPath = last.length < path.length; + let hasDot = ext.length < last.length - 1; + + return (hasDot || !hasPath) && this._types[ext] || null; +}; + +/** + * Return file extension associated with a mime type + */ +Mime.prototype.getExtension = function(type) { + type = /^\s*([^;\s]*)/.test(type) && RegExp.$1; + return type && this._extensions[type.toLowerCase()] || null; +}; + +module.exports = Mime; + + +/***/ }), + +/***/ 5797: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +let Mime = __webpack_require__(23145); +module.exports = new Mime(__webpack_require__(22598), __webpack_require__(11477)); + + +/***/ }), + +/***/ 11477: +/***/ ((module) => { + +module.exports = {"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]}; + +/***/ }), + +/***/ 22598: +/***/ ((module) => { + +module.exports = {"application/andrew-inset":["ez"],"application/applixware":["aw"],"application/atom+xml":["atom"],"application/atomcat+xml":["atomcat"],"application/atomdeleted+xml":["atomdeleted"],"application/atomsvc+xml":["atomsvc"],"application/atsc-dwd+xml":["dwd"],"application/atsc-held+xml":["held"],"application/atsc-rsat+xml":["rsat"],"application/bdoc":["bdoc"],"application/calendar+xml":["xcs"],"application/ccxml+xml":["ccxml"],"application/cdfx+xml":["cdfx"],"application/cdmi-capability":["cdmia"],"application/cdmi-container":["cdmic"],"application/cdmi-domain":["cdmid"],"application/cdmi-object":["cdmio"],"application/cdmi-queue":["cdmiq"],"application/cu-seeme":["cu"],"application/dash+xml":["mpd"],"application/davmount+xml":["davmount"],"application/docbook+xml":["dbk"],"application/dssc+der":["dssc"],"application/dssc+xml":["xdssc"],"application/ecmascript":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"application/fdt+xml":["fdt"],"application/font-tdpfr":["pfr"],"application/geo+json":["geojson"],"application/gml+xml":["gml"],"application/gpx+xml":["gpx"],"application/gxf":["gxf"],"application/gzip":["gz"],"application/hjson":["hjson"],"application/hyperstudio":["stk"],"application/inkml+xml":["ink","inkml"],"application/ipfix":["ipfix"],"application/its+xml":["its"],"application/java-archive":["jar","war","ear"],"application/java-serialized-object":["ser"],"application/java-vm":["class"],"application/javascript":["js","mjs"],"application/json":["json","map"],"application/json5":["json5"],"application/jsonml+json":["jsonml"],"application/ld+json":["jsonld"],"application/lgr+xml":["lgr"],"application/lost+xml":["lostxml"],"application/mac-binhex40":["hqx"],"application/mac-compactpro":["cpt"],"application/mads+xml":["mads"],"application/manifest+json":["webmanifest"],"application/marc":["mrc"],"application/marcxml+xml":["mrcx"],"application/mathematica":["ma","nb","mb"],"application/mathml+xml":["mathml"],"application/mbox":["mbox"],"application/mediaservercontrol+xml":["mscml"],"application/metalink+xml":["metalink"],"application/metalink4+xml":["meta4"],"application/mets+xml":["mets"],"application/mmt-aei+xml":["maei"],"application/mmt-usd+xml":["musd"],"application/mods+xml":["mods"],"application/mp21":["m21","mp21"],"application/mp4":["mp4s","m4p"],"application/msword":["doc","dot"],"application/mxf":["mxf"],"application/n-quads":["nq"],"application/n-triples":["nt"],"application/node":["cjs"],"application/octet-stream":["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"],"application/oda":["oda"],"application/oebps-package+xml":["opf"],"application/ogg":["ogx"],"application/omdoc+xml":["omdoc"],"application/onenote":["onetoc","onetoc2","onetmp","onepkg"],"application/oxps":["oxps"],"application/p2p-overlay+xml":["relo"],"application/patch-ops-error+xml":["xer"],"application/pdf":["pdf"],"application/pgp-encrypted":["pgp"],"application/pgp-signature":["asc","sig"],"application/pics-rules":["prf"],"application/pkcs10":["p10"],"application/pkcs7-mime":["p7m","p7c"],"application/pkcs7-signature":["p7s"],"application/pkcs8":["p8"],"application/pkix-attr-cert":["ac"],"application/pkix-cert":["cer"],"application/pkix-crl":["crl"],"application/pkix-pkipath":["pkipath"],"application/pkixcmp":["pki"],"application/pls+xml":["pls"],"application/postscript":["ai","eps","ps"],"application/provenance+xml":["provx"],"application/pskc+xml":["pskcxml"],"application/raml+yaml":["raml"],"application/rdf+xml":["rdf","owl"],"application/reginfo+xml":["rif"],"application/relax-ng-compact-syntax":["rnc"],"application/resource-lists+xml":["rl"],"application/resource-lists-diff+xml":["rld"],"application/rls-services+xml":["rs"],"application/route-apd+xml":["rapd"],"application/route-s-tsid+xml":["sls"],"application/route-usd+xml":["rusd"],"application/rpki-ghostbusters":["gbr"],"application/rpki-manifest":["mft"],"application/rpki-roa":["roa"],"application/rsd+xml":["rsd"],"application/rss+xml":["rss"],"application/rtf":["rtf"],"application/sbml+xml":["sbml"],"application/scvp-cv-request":["scq"],"application/scvp-cv-response":["scs"],"application/scvp-vp-request":["spq"],"application/scvp-vp-response":["spp"],"application/sdp":["sdp"],"application/senml+xml":["senmlx"],"application/sensml+xml":["sensmlx"],"application/set-payment-initiation":["setpay"],"application/set-registration-initiation":["setreg"],"application/shf+xml":["shf"],"application/sieve":["siv","sieve"],"application/smil+xml":["smi","smil"],"application/sparql-query":["rq"],"application/sparql-results+xml":["srx"],"application/srgs":["gram"],"application/srgs+xml":["grxml"],"application/sru+xml":["sru"],"application/ssdl+xml":["ssdl"],"application/ssml+xml":["ssml"],"application/swid+xml":["swidtag"],"application/tei+xml":["tei","teicorpus"],"application/thraud+xml":["tfi"],"application/timestamped-data":["tsd"],"application/toml":["toml"],"application/trig":["trig"],"application/ttml+xml":["ttml"],"application/ubjson":["ubj"],"application/urc-ressheet+xml":["rsheet"],"application/urc-targetdesc+xml":["td"],"application/voicexml+xml":["vxml"],"application/wasm":["wasm"],"application/widget":["wgt"],"application/winhlp":["hlp"],"application/wsdl+xml":["wsdl"],"application/wspolicy+xml":["wspolicy"],"application/xaml+xml":["xaml"],"application/xcap-att+xml":["xav"],"application/xcap-caps+xml":["xca"],"application/xcap-diff+xml":["xdf"],"application/xcap-el+xml":["xel"],"application/xcap-ns+xml":["xns"],"application/xenc+xml":["xenc"],"application/xhtml+xml":["xhtml","xht"],"application/xliff+xml":["xlf"],"application/xml":["xml","xsl","xsd","rng"],"application/xml-dtd":["dtd"],"application/xop+xml":["xop"],"application/xproc+xml":["xpl"],"application/xslt+xml":["*xsl","xslt"],"application/xspf+xml":["xspf"],"application/xv+xml":["mxml","xhvml","xvml","xvm"],"application/yang":["yang"],"application/yin+xml":["yin"],"application/zip":["zip"],"audio/3gpp":["*3gpp"],"audio/adpcm":["adp"],"audio/amr":["amr"],"audio/basic":["au","snd"],"audio/midi":["mid","midi","kar","rmi"],"audio/mobile-xmf":["mxmf"],"audio/mp3":["*mp3"],"audio/mp4":["m4a","mp4a"],"audio/mpeg":["mpga","mp2","mp2a","mp3","m2a","m3a"],"audio/ogg":["oga","ogg","spx","opus"],"audio/s3m":["s3m"],"audio/silk":["sil"],"audio/wav":["wav"],"audio/wave":["*wav"],"audio/webm":["weba"],"audio/xm":["xm"],"font/collection":["ttc"],"font/otf":["otf"],"font/ttf":["ttf"],"font/woff":["woff"],"font/woff2":["woff2"],"image/aces":["exr"],"image/apng":["apng"],"image/avif":["avif"],"image/bmp":["bmp"],"image/cgm":["cgm"],"image/dicom-rle":["drle"],"image/emf":["emf"],"image/fits":["fits"],"image/g3fax":["g3"],"image/gif":["gif"],"image/heic":["heic"],"image/heic-sequence":["heics"],"image/heif":["heif"],"image/heif-sequence":["heifs"],"image/hej2k":["hej2"],"image/hsj2":["hsj2"],"image/ief":["ief"],"image/jls":["jls"],"image/jp2":["jp2","jpg2"],"image/jpeg":["jpeg","jpg","jpe"],"image/jph":["jph"],"image/jphc":["jhc"],"image/jpm":["jpm"],"image/jpx":["jpx","jpf"],"image/jxr":["jxr"],"image/jxra":["jxra"],"image/jxrs":["jxrs"],"image/jxs":["jxs"],"image/jxsc":["jxsc"],"image/jxsi":["jxsi"],"image/jxss":["jxss"],"image/ktx":["ktx"],"image/ktx2":["ktx2"],"image/png":["png"],"image/sgi":["sgi"],"image/svg+xml":["svg","svgz"],"image/t38":["t38"],"image/tiff":["tif","tiff"],"image/tiff-fx":["tfx"],"image/webp":["webp"],"image/wmf":["wmf"],"message/disposition-notification":["disposition-notification"],"message/global":["u8msg"],"message/global-delivery-status":["u8dsn"],"message/global-disposition-notification":["u8mdn"],"message/global-headers":["u8hdr"],"message/rfc822":["eml","mime"],"model/3mf":["3mf"],"model/gltf+json":["gltf"],"model/gltf-binary":["glb"],"model/iges":["igs","iges"],"model/mesh":["msh","mesh","silo"],"model/mtl":["mtl"],"model/obj":["obj"],"model/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"model/stl":["stl"],"model/vrml":["wrl","vrml"],"model/x3d+binary":["*x3db","x3dbz"],"model/x3d+fastinfoset":["x3db"],"model/x3d+vrml":["*x3dv","x3dvz"],"model/x3d+xml":["x3d","x3dz"],"model/x3d-vrml":["x3dv"],"text/cache-manifest":["appcache","manifest"],"text/calendar":["ics","ifb"],"text/coffeescript":["coffee","litcoffee"],"text/css":["css"],"text/csv":["csv"],"text/html":["html","htm","shtml"],"text/jade":["jade"],"text/jsx":["jsx"],"text/less":["less"],"text/markdown":["markdown","md"],"text/mathml":["mml"],"text/mdx":["mdx"],"text/n3":["n3"],"text/plain":["txt","text","conf","def","list","log","in","ini"],"text/richtext":["rtx"],"text/rtf":["*rtf"],"text/sgml":["sgml","sgm"],"text/shex":["shex"],"text/slim":["slim","slm"],"text/spdx":["spdx"],"text/stylus":["stylus","styl"],"text/tab-separated-values":["tsv"],"text/troff":["t","tr","roff","man","me","ms"],"text/turtle":["ttl"],"text/uri-list":["uri","uris","urls"],"text/vcard":["vcard"],"text/vtt":["vtt"],"text/xml":["*xml"],"text/yaml":["yaml","yml"],"video/3gpp":["3gp","3gpp"],"video/3gpp2":["3g2"],"video/h261":["h261"],"video/h263":["h263"],"video/h264":["h264"],"video/iso.segment":["m4s"],"video/jpeg":["jpgv"],"video/jpm":["*jpm","jpgm"],"video/mj2":["mj2","mjp2"],"video/mp2t":["ts"],"video/mp4":["mp4","mp4v","mpg4"],"video/mpeg":["mpeg","mpg","mpe","m1v","m2v"],"video/ogg":["ogv"],"video/quicktime":["qt","mov"],"video/webm":["webm"]}; + +/***/ }), + +/***/ 59177: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = writeFile +module.exports.sync = writeFileSync +module.exports._getTmpname = getTmpname // for testing +module.exports._cleanupOnExit = cleanupOnExit + +const fs = __webpack_require__(79896) +const MurmurHash3 = __webpack_require__(44119) +const { onExit } = __webpack_require__(79747) +const path = __webpack_require__(16928) +const { promisify } = __webpack_require__(39023) +const activeFiles = {} + +// if we run inside of a worker_thread, `process.pid` is not unique +/* istanbul ignore next */ +const threadId = (function getId () { + try { + const workerThreads = __webpack_require__(28167) + + /// if we are in main thread, this is set to `0` + return workerThreads.threadId + } catch (e) { + // worker_threads are not available, fallback to 0 + return 0 + } +})() + +let invocations = 0 +function getTmpname (filename) { + return filename + '.' + + MurmurHash3(__filename) + .hash(String(process.pid)) + .hash(String(threadId)) + .hash(String(++invocations)) + .result() +} + +function cleanupOnExit (tmpfile) { + return () => { + try { + fs.unlinkSync(typeof tmpfile === 'function' ? tmpfile() : tmpfile) + } catch { + // ignore errors + } + } +} + +function serializeActiveFile (absoluteName) { + return new Promise(resolve => { + // make a queue if it doesn't already exist + if (!activeFiles[absoluteName]) { + activeFiles[absoluteName] = [] + } + + activeFiles[absoluteName].push(resolve) // add this job to the queue + if (activeFiles[absoluteName].length === 1) { + resolve() + } // kick off the first one + }) +} + +// https://github.com/isaacs/node-graceful-fs/blob/master/polyfills.js#L315-L342 +function isChownErrOk (err) { + if (err.code === 'ENOSYS') { + return true + } + + const nonroot = !process.getuid || process.getuid() !== 0 + if (nonroot) { + if (err.code === 'EINVAL' || err.code === 'EPERM') { + return true + } + } + + return false +} + +async function writeFileAsync (filename, data, options = {}) { + if (typeof options === 'string') { + options = { encoding: options } + } + + let fd + let tmpfile + /* istanbul ignore next -- The closure only gets called when onExit triggers */ + const removeOnExitHandler = onExit(cleanupOnExit(() => tmpfile)) + const absoluteName = path.resolve(filename) + + try { + await serializeActiveFile(absoluteName) + const truename = await promisify(fs.realpath)(filename).catch(() => filename) + tmpfile = getTmpname(truename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + const stats = await promisify(fs.stat)(truename).catch(() => {}) + if (stats) { + if (options.mode == null) { + options.mode = stats.mode + } + + if (options.chown == null && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } + } + + fd = await promisify(fs.open)(tmpfile, 'w', options.mode) + if (options.tmpfileCreated) { + await options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + await promisify(fs.write)(fd, data, 0, data.length, 0) + } else if (data != null) { + await promisify(fs.write)(fd, String(data), 0, String(options.encoding || 'utf8')) + } + + if (options.fsync !== false) { + await promisify(fs.fsync)(fd) + } + + await promisify(fs.close)(fd) + fd = null + + if (options.chown) { + await promisify(fs.chown)(tmpfile, options.chown.uid, options.chown.gid).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + if (options.mode) { + await promisify(fs.chmod)(tmpfile, options.mode).catch(err => { + if (!isChownErrOk(err)) { + throw err + } + }) + } + + await promisify(fs.rename)(tmpfile, truename) + } finally { + if (fd) { + await promisify(fs.close)(fd).catch( + /* istanbul ignore next */ + () => {} + ) + } + removeOnExitHandler() + await promisify(fs.unlink)(tmpfile).catch(() => {}) + activeFiles[absoluteName].shift() // remove the element added by serializeSameFile + if (activeFiles[absoluteName].length > 0) { + activeFiles[absoluteName][0]() // start next job if one is pending + } else { + delete activeFiles[absoluteName] + } + } +} + +async function writeFile (filename, data, options, callback) { + if (options instanceof Function) { + callback = options + options = {} + } + + const promise = writeFileAsync(filename, data, options) + if (callback) { + try { + const result = await promise + return callback(result) + } catch (err) { + return callback(err) + } + } + + return promise +} + +function writeFileSync (filename, data, options) { + if (typeof options === 'string') { + options = { encoding: options } + } else if (!options) { + options = {} + } + try { + filename = fs.realpathSync(filename) + } catch (ex) { + // it's ok, it'll happen on a not yet existing file + } + const tmpfile = getTmpname(filename) + + if (!options.mode || !options.chown) { + // Either mode or chown is not explicitly set + // Default behavior is to copy it from original file + try { + const stats = fs.statSync(filename) + options = Object.assign({}, options) + if (!options.mode) { + options.mode = stats.mode + } + if (!options.chown && process.getuid) { + options.chown = { uid: stats.uid, gid: stats.gid } + } + } catch (ex) { + // ignore stat errors + } + } + + let fd + const cleanup = cleanupOnExit(tmpfile) + const removeOnExitHandler = onExit(cleanup) + + let threw = true + try { + fd = fs.openSync(tmpfile, 'w', options.mode || 0o666) + if (options.tmpfileCreated) { + options.tmpfileCreated(tmpfile) + } + if (ArrayBuffer.isView(data)) { + fs.writeSync(fd, data, 0, data.length, 0) + } else if (data != null) { + fs.writeSync(fd, String(data), 0, String(options.encoding || 'utf8')) + } + if (options.fsync !== false) { + fs.fsyncSync(fd) + } + + fs.closeSync(fd) + fd = null + + if (options.chown) { + try { + fs.chownSync(tmpfile, options.chown.uid, options.chown.gid) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + if (options.mode) { + try { + fs.chmodSync(tmpfile, options.mode) + } catch (err) { + if (!isChownErrOk(err)) { + throw err + } + } + } + + fs.renameSync(tmpfile, filename) + threw = false + } finally { + if (fd) { + try { + fs.closeSync(fd) + } catch (ex) { + // ignore close errors at this stage, error may have closed fd already. + } + } + removeOnExitHandler() + if (threw) { + cleanup() + } + } +} + + +/***/ }), + +/***/ 14372: +/***/ ((module) => { + +function webpackEmptyAsyncContext(req) { + // Here Promise.resolve().then() is used instead of new Promise() to prevent + // uncaught exception popping up in devtools + return Promise.resolve().then(() => { + var e = new Error("Cannot find module '" + req + "'"); + e.code = 'MODULE_NOT_FOUND'; + throw e; + }); +} +webpackEmptyAsyncContext.keys = () => ([]); +webpackEmptyAsyncContext.resolve = webpackEmptyAsyncContext; +webpackEmptyAsyncContext.id = 14372; +module.exports = webpackEmptyAsyncContext; + +/***/ }), + +/***/ 64466: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/* + +The MIT License (MIT) + +Original Library + - Copyright (c) Marak Squires + +Additional functionality + - Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var colors = {}; +module['exports'] = colors; + +colors.themes = {}; + +var util = __webpack_require__(39023); +var ansiStyles = colors.styles = __webpack_require__(68692); +var defineProps = Object.defineProperties; +var newLineRegex = new RegExp(/[\r\n]+/g); + +colors.supportsColor = (__webpack_require__(17419).supportsColor); + +if (typeof colors.enabled === 'undefined') { + colors.enabled = colors.supportsColor() !== false; +} + +colors.enable = function() { + colors.enabled = true; +}; + +colors.disable = function() { + colors.enabled = false; +}; + +colors.stripColors = colors.strip = function(str) { + return ('' + str).replace(/\x1B\[\d+m/g, ''); +}; + +// eslint-disable-next-line no-unused-vars +var stylize = colors.stylize = function stylize(str, style) { + if (!colors.enabled) { + return str+''; + } + + var styleMap = ansiStyles[style]; + + // Stylize should work for non-ANSI styles, too + if (!styleMap && style in colors) { + // Style maps like trap operate as functions on strings; + // they don't have properties like open or close. + return colors[style](str); + } + + return styleMap.open + str + styleMap.close; +}; + +var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; +var escapeStringRegexp = function(str) { + if (typeof str !== 'string') { + throw new TypeError('Expected a string'); + } + return str.replace(matchOperatorsRe, '\\$&'); +}; + +function build(_styles) { + var builder = function builder() { + return applyStyle.apply(builder, arguments); + }; + builder._styles = _styles; + // __proto__ is used because we must return a function, but there is + // no way to create a function with a different prototype. + builder.__proto__ = proto; + return builder; +} + +var styles = (function() { + var ret = {}; + ansiStyles.grey = ansiStyles.gray; + Object.keys(ansiStyles).forEach(function(key) { + ansiStyles[key].closeRe = + new RegExp(escapeStringRegexp(ansiStyles[key].close), 'g'); + ret[key] = { + get: function() { + return build(this._styles.concat(key)); + }, + }; + }); + return ret; +})(); + +var proto = defineProps(function colors() {}, styles); + +function applyStyle() { + var args = Array.prototype.slice.call(arguments); + + var str = args.map(function(arg) { + // Use weak equality check so we can colorize null/undefined in safe mode + if (arg != null && arg.constructor === String) { + return arg; + } else { + return util.inspect(arg); + } + }).join(' '); + + if (!colors.enabled || !str) { + return str; + } + + var newLinesPresent = str.indexOf('\n') != -1; + + var nestedStyles = this._styles; + + var i = nestedStyles.length; + while (i--) { + var code = ansiStyles[nestedStyles[i]]; + str = code.open + str.replace(code.closeRe, code.open) + code.close; + if (newLinesPresent) { + str = str.replace(newLineRegex, function(match) { + return code.close + match + code.open; + }); + } + } + + return str; +} + +colors.setTheme = function(theme) { + if (typeof theme === 'string') { + console.log('colors.setTheme now only accepts an object, not a string. ' + + 'If you are trying to set a theme from a file, it is now your (the ' + + 'caller\'s) responsibility to require the file. The old syntax ' + + 'looked like colors.setTheme(__dirname + ' + + '\'/../themes/generic-logging.js\'); The new syntax looks like '+ + 'colors.setTheme(require(__dirname + ' + + '\'/../themes/generic-logging.js\'));'); + return; + } + for (var style in theme) { + (function(style) { + colors[style] = function(str) { + if (typeof theme[style] === 'object') { + var out = str; + for (var i in theme[style]) { + out = colors[theme[style][i]](out); + } + return out; + } + return colors[theme[style]](str); + }; + })(style); + } +}; + +function init() { + var ret = {}; + Object.keys(styles).forEach(function(name) { + ret[name] = { + get: function() { + return build([name]); + }, + }; + }); + return ret; +} + +var sequencer = function sequencer(map, str) { + var exploded = str.split(''); + exploded = exploded.map(map); + return exploded.join(''); +}; + +// custom formatter methods +colors.trap = __webpack_require__(57379); +colors.zalgo = __webpack_require__(49387); + +// maps +colors.maps = {}; +colors.maps.america = __webpack_require__(64918)(colors); +colors.maps.zebra = __webpack_require__(49742)(colors); +colors.maps.rainbow = __webpack_require__(91588)(colors); +colors.maps.random = __webpack_require__(10811)(colors); + +for (var map in colors.maps) { + (function(map) { + colors[map] = function(str) { + return sequencer(colors.maps[map], str); + }; + })(map); +} + +defineProps(colors, init()); + + +/***/ }), + +/***/ 57379: +/***/ ((module) => { + +module['exports'] = function runTheTrap(text, options) { + var result = ''; + text = text || 'Run the trap, drop the bass'; + text = text.split(''); + var trap = { + a: ['\u0040', '\u0104', '\u023a', '\u0245', '\u0394', '\u039b', '\u0414'], + b: ['\u00df', '\u0181', '\u0243', '\u026e', '\u03b2', '\u0e3f'], + c: ['\u00a9', '\u023b', '\u03fe'], + d: ['\u00d0', '\u018a', '\u0500', '\u0501', '\u0502', '\u0503'], + e: ['\u00cb', '\u0115', '\u018e', '\u0258', '\u03a3', '\u03be', '\u04bc', + '\u0a6c'], + f: ['\u04fa'], + g: ['\u0262'], + h: ['\u0126', '\u0195', '\u04a2', '\u04ba', '\u04c7', '\u050a'], + i: ['\u0f0f'], + j: ['\u0134'], + k: ['\u0138', '\u04a0', '\u04c3', '\u051e'], + l: ['\u0139'], + m: ['\u028d', '\u04cd', '\u04ce', '\u0520', '\u0521', '\u0d69'], + n: ['\u00d1', '\u014b', '\u019d', '\u0376', '\u03a0', '\u048a'], + o: ['\u00d8', '\u00f5', '\u00f8', '\u01fe', '\u0298', '\u047a', '\u05dd', + '\u06dd', '\u0e4f'], + p: ['\u01f7', '\u048e'], + q: ['\u09cd'], + r: ['\u00ae', '\u01a6', '\u0210', '\u024c', '\u0280', '\u042f'], + s: ['\u00a7', '\u03de', '\u03df', '\u03e8'], + t: ['\u0141', '\u0166', '\u0373'], + u: ['\u01b1', '\u054d'], + v: ['\u05d8'], + w: ['\u0428', '\u0460', '\u047c', '\u0d70'], + x: ['\u04b2', '\u04fe', '\u04fc', '\u04fd'], + y: ['\u00a5', '\u04b0', '\u04cb'], + z: ['\u01b5', '\u0240'], + }; + text.forEach(function(c) { + c = c.toLowerCase(); + var chars = trap[c] || [' ']; + var rand = Math.floor(Math.random() * chars.length); + if (typeof trap[c] !== 'undefined') { + result += trap[c][rand]; + } else { + result += c; + } + }); + return result; +}; + + +/***/ }), + +/***/ 49387: +/***/ ((module) => { + +// please no +module['exports'] = function zalgo(text, options) { + text = text || ' he is here '; + var soul = { + 'up': [ + '̍', '̎', '̄', '̅', + '̿', '̑', '̆', '̐', + '͒', '͗', '͑', '̇', + '̈', '̊', '͂', '̓', + '̈', '͊', '͋', '͌', + '̃', '̂', '̌', '͐', + '̀', '́', '̋', '̏', + '̒', '̓', '̔', '̽', + '̉', 'ͣ', 'ͤ', 'ͥ', + 'ͦ', 'ͧ', 'ͨ', 'ͩ', + 'ͪ', 'ͫ', 'ͬ', 'ͭ', + 'ͮ', 'ͯ', '̾', '͛', + '͆', '̚', + ], + 'down': [ + '̖', '̗', '̘', '̙', + '̜', '̝', '̞', '̟', + '̠', '̤', '̥', '̦', + '̩', '̪', '̫', '̬', + '̭', '̮', '̯', '̰', + '̱', '̲', '̳', '̹', + '̺', '̻', '̼', 'ͅ', + '͇', '͈', '͉', '͍', + '͎', '͓', '͔', '͕', + '͖', '͙', '͚', '̣', + ], + 'mid': [ + '̕', '̛', '̀', '́', + '͘', '̡', '̢', '̧', + '̨', '̴', '̵', '̶', + '͜', '͝', '͞', + '͟', '͠', '͢', '̸', + '̷', '͡', ' ҉', + ], + }; + var all = [].concat(soul.up, soul.down, soul.mid); + + function randomNumber(range) { + var r = Math.floor(Math.random() * range); + return r; + } + + function isChar(character) { + var bool = false; + all.filter(function(i) { + bool = (i === character); + }); + return bool; + } + + + function heComes(text, options) { + var result = ''; + var counts; + var l; + options = options || {}; + options['up'] = + typeof options['up'] !== 'undefined' ? options['up'] : true; + options['mid'] = + typeof options['mid'] !== 'undefined' ? options['mid'] : true; + options['down'] = + typeof options['down'] !== 'undefined' ? options['down'] : true; + options['size'] = + typeof options['size'] !== 'undefined' ? options['size'] : 'maxi'; + text = text.split(''); + for (l in text) { + if (isChar(l)) { + continue; + } + result = result + text[l]; + counts = {'up': 0, 'down': 0, 'mid': 0}; + switch (options.size) { + case 'mini': + counts.up = randomNumber(8); + counts.mid = randomNumber(2); + counts.down = randomNumber(8); + break; + case 'maxi': + counts.up = randomNumber(16) + 3; + counts.mid = randomNumber(4) + 1; + counts.down = randomNumber(64) + 3; + break; + default: + counts.up = randomNumber(8) + 1; + counts.mid = randomNumber(6) / 2; + counts.down = randomNumber(8) + 1; + break; + } + + var arr = ['up', 'mid', 'down']; + for (var d in arr) { + var index = arr[d]; + for (var i = 0; i <= counts[index]; i++) { + if (options[index]) { + result = result + soul[index][randomNumber(soul[index].length)]; + } + } + } + } + return result; + } + // don't summon him + return heComes(text, options); +}; + + + +/***/ }), + +/***/ 64918: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + if (letter === ' ') return letter; + switch (i%3) { + case 0: return colors.red(letter); + case 1: return colors.white(letter); + case 2: return colors.blue(letter); + } + }; +}; + + +/***/ }), + +/***/ 91588: +/***/ ((module) => { + +module['exports'] = function(colors) { + // RoY G BiV + var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta']; + return function(letter, i, exploded) { + if (letter === ' ') { + return letter; + } else { + return colors[rainbowColors[i++ % rainbowColors.length]](letter); + } + }; +}; + + + +/***/ }), + +/***/ 10811: +/***/ ((module) => { + +module['exports'] = function(colors) { + var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green', + 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed', + 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta']; + return function(letter, i, exploded) { + return letter === ' ' ? letter : + colors[ + available[Math.round(Math.random() * (available.length - 2))] + ](letter); + }; +}; + + +/***/ }), + +/***/ 49742: +/***/ ((module) => { + +module['exports'] = function(colors) { + return function(letter, i, exploded) { + return i % 2 === 0 ? letter : colors.inverse(letter); + }; +}; + + +/***/ }), + +/***/ 68692: +/***/ ((module) => { + +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + +var styles = {}; +module['exports'] = styles; + +var codes = { + reset: [0, 0], + + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29], + + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + gray: [90, 39], + grey: [90, 39], + + brightRed: [91, 39], + brightGreen: [92, 39], + brightYellow: [93, 39], + brightBlue: [94, 39], + brightMagenta: [95, 39], + brightCyan: [96, 39], + brightWhite: [97, 39], + + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + bgGray: [100, 49], + bgGrey: [100, 49], + + bgBrightRed: [101, 49], + bgBrightGreen: [102, 49], + bgBrightYellow: [103, 49], + bgBrightBlue: [104, 49], + bgBrightMagenta: [105, 49], + bgBrightCyan: [106, 49], + bgBrightWhite: [107, 49], + + // legacy styles for colors pre v1.0.0 + blackBG: [40, 49], + redBG: [41, 49], + greenBG: [42, 49], + yellowBG: [43, 49], + blueBG: [44, 49], + magentaBG: [45, 49], + cyanBG: [46, 49], + whiteBG: [47, 49], + +}; + +Object.keys(codes).forEach(function(key) { + var val = codes[key]; + var style = styles[key] = []; + style.open = '\u001b[' + val[0] + 'm'; + style.close = '\u001b[' + val[1] + 'm'; +}); + + +/***/ }), + +/***/ 63199: +/***/ ((module) => { + +"use strict"; +/* +MIT License + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +*/ + + + +module.exports = function(flag, argv) { + argv = argv || process.argv; + + var terminatorPos = argv.indexOf('--'); + var prefix = /^-{1,2}/.test(flag) ? '' : '--'; + var pos = argv.indexOf(prefix + flag); + + return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos); +}; + + +/***/ }), + +/***/ 17419: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* +The MIT License (MIT) + +Copyright (c) Sindre Sorhus (sindresorhus.com) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +*/ + + + +var os = __webpack_require__(70857); +var hasFlag = __webpack_require__(63199); + +var env = process.env; + +var forceColor = void 0; +if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) { + forceColor = false; +} else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') + || hasFlag('color=always')) { + forceColor = true; +} +if ('FORCE_COLOR' in env) { + forceColor = env.FORCE_COLOR.length === 0 + || parseInt(env.FORCE_COLOR, 10) !== 0; +} + +function translateLevel(level) { + if (level === 0) { + return false; + } + + return { + level: level, + hasBasic: true, + has256: level >= 2, + has16m: level >= 3, + }; +} + +function supportsColor(stream) { + if (forceColor === false) { + return 0; + } + + if (hasFlag('color=16m') || hasFlag('color=full') + || hasFlag('color=truecolor')) { + return 3; + } + + if (hasFlag('color=256')) { + return 2; + } + + if (stream && !stream.isTTY && forceColor !== true) { + return 0; + } + + var min = forceColor ? 1 : 0; + + if (process.platform === 'win32') { + // Node.js 7.5.0 is the first version of Node.js to include a patch to + // libuv that enables 256 color output on Windows. Anything earlier and it + // won't work. However, here we target Node.js 8 at minimum as it is an LTS + // release, and Node.js 7 is not. Windows 10 build 10586 is the first + // Windows release that supports 256 colors. Windows 10 build 14931 is the + // first release that supports 16m/TrueColor. + var osRelease = os.release().split('.'); + if (Number(process.versions.node.split('.')[0]) >= 8 + && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) { + return Number(osRelease[2]) >= 14931 ? 3 : 2; + } + + return 1; + } + + if ('CI' in env) { + if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) { + return sign in env; + }) || env.CI_NAME === 'codeship') { + return 1; + } + + return min; + } + + if ('TEAMCITY_VERSION' in env) { + return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0 + ); + } + + if ('TERM_PROGRAM' in env) { + var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10); + + switch (env.TERM_PROGRAM) { + case 'iTerm.app': + return version >= 3 ? 3 : 2; + case 'Hyper': + return 3; + case 'Apple_Terminal': + return 2; + // No default + } + } + + if (/-256(color)?$/i.test(env.TERM)) { + return 2; + } + + if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) { + return 1; + } + + if ('COLORTERM' in env) { + return 1; + } + + if (env.TERM === 'dumb') { + return min; + } + + return min; +} + +function getSupportLevel(stream) { + var level = supportsColor(stream); + return translateLevel(level); +} + +module.exports = { + supportsColor: getSupportLevel, + stdout: getSupportLevel(process.stdout), + stderr: getSupportLevel(process.stderr), +}; + + +/***/ }), + +/***/ 37627: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// +// Remark: Requiring this file will use the "safe" colors API, +// which will not touch String.prototype. +// +// var colors = require('colors/safe'); +// colors.red("foo") +// +// +var colors = __webpack_require__(64466); +module['exports'] = colors; + + +/***/ }), + +/***/ 36142: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const { parse } = __webpack_require__(23929); + +module.exports = function (elt) { + const style = new CSSStyleDeclaration(elt) + const handler = { + get: function(target, property) { + return property in target ? target[property] : target.getPropertyValue(dasherizeProperty(property)); + }, + has: function(target, key) { + return true; + }, + set: function(target, property, value) { + if (property in target) { + target[property] = value; + } else { + target.setProperty(dasherizeProperty(property), value ?? undefined); + } + + return true; + } + }; + + return new Proxy(style, handler); +}; + +function dasherizeProperty(property) { + return property.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase(); +} + + +function CSSStyleDeclaration(elt) { + this._element = elt; +} + +const IMPORTANT_BANG = '!important'; + +// Utility function for parsing style declarations +// Pass in a string like "margin-left: 5px; border-style: solid" +// and this function returns an object like +// {"margin-left":"5px", "border-style":"solid"} +function parseStyles(value) { + const result = { + property: {}, + priority: {}, + } + + if (!value) { + return result; + } + + const styleValues = parse(value); + if (styleValues.length < 2) { + return result; + } + + for (let i = 0; i < styleValues.length; i += 2) { + const name = styleValues[i]; + let value = styleValues[i+1]; + + if (value.endsWith(IMPORTANT_BANG)) { + result.priority[name] = 'important'; + value = value.slice(0, -IMPORTANT_BANG.length).trim(); + } + + result.property[name] = value; + } + + return result; +} + +var NO_CHANGE = {}; // Private marker object + +CSSStyleDeclaration.prototype = Object.create(Object.prototype, { + + // Return the parsed form of the element's style attribute. + // If the element's style attribute has never been parsed + // or if it has changed since the last parse, then reparse it + // Note that the styles don't get parsed until they're actually needed + _parsed: { get: function() { + if (!this._parsedStyles || this.cssText !== this._lastParsedText) { + var text = this.cssText; + this._parsedStyles = parseStyles(text); + this._lastParsedText = text; + delete this._names; + } + return this._parsedStyles; + }}, + + // Call this method any time the parsed representation of the + // style changes. It converts the style properties to a string and + // sets cssText and the element's style attribute + _serialize: { value: function() { + var styles = this._parsed; + var s = ""; + + for(var name in styles.property) { + if (s) s += " "; + s += name + ": " + styles.property[name]; + if (styles.priority[name]) { + s += " !" + styles.priority[name]; + } + s += ";"; + } + + this.cssText = s; // also sets the style attribute + this._lastParsedText = s; // so we don't reparse + delete this._names; + }}, + + cssText: { + get: function() { + // XXX: this is a CSSStyleDeclaration for an element. + // A different impl might be necessary for a set of styles + // associated returned by getComputedStyle(), e.g. + return this._element.getAttribute("style"); + }, + set: function(value) { + // XXX: I should parse and serialize the value to + // normalize it and remove errors. FF and chrome do that. + this._element.setAttribute("style", value); + } + }, + + length: { get: function() { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names.length; + }}, + + item: { value: function(n) { + if (!this._names) + this._names = Object.getOwnPropertyNames(this._parsed.property); + return this._names[n]; + }}, + + getPropertyValue: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.property[property] || ""; + }}, + + getPropertyPriority: { value: function(property) { + property = property.toLowerCase(); + return this._parsed.priority[property] || ""; + }}, + + setProperty: { value: function(property, value, priority) { + property = property.toLowerCase(); + if (value === null || value === undefined) { + value = ""; + } + if (priority === null || priority === undefined) { + priority = ""; + } + + // String coercion + if (value !== NO_CHANGE) { + value = "" + value; + } + + value = value.trim(); + if (value === "") { + this.removeProperty(property); + return; + } + + if (priority !== "" && priority !== NO_CHANGE && + !/^important$/i.test(priority)) { + return; + } + + var styles = this._parsed; + if (value === NO_CHANGE) { + if (!styles.property[property]) { + return; // Not a valid property name. + } + if (priority !== "") { + styles.priority[property] = "important"; + } else { + delete styles.priority[property]; + } + } else { + // We don't just accept the property value. Instead + // we parse it to ensure that it is something valid. + // If it contains a semicolon it is invalid + if (value.indexOf(";") !== -1) return; + + var newprops = parseStyles(property + ":" + value); + if (Object.getOwnPropertyNames(newprops.property).length === 0) { + return; // no valid property found + } + if (Object.getOwnPropertyNames(newprops.priority).length !== 0) { + return; // if the value included '!important' it wasn't valid. + } + + // XXX handle shorthand properties + + for (var p in newprops.property) { + styles.property[p] = newprops.property[p]; + if (priority === NO_CHANGE) { + continue; + } else if (priority !== "") { + styles.priority[p] = "important"; + } else if (styles.priority[p]) { + delete styles.priority[p]; + } + } + } + + // Serialize and update cssText and element.style! + this._serialize(); + }}, + + setPropertyValue: { value: function(property, value) { + return this.setProperty(property, value, NO_CHANGE); + }}, + + setPropertyPriority: { value: function(property, priority) { + return this.setProperty(property, NO_CHANGE, priority); + }}, + + removeProperty: { value: function(property) { + property = property.toLowerCase(); + var styles = this._parsed; + if (property in styles.property) { + delete styles.property[property]; + delete styles.priority[property]; + + // Serialize and update cssText and element.style! + this._serialize(); + } + }}, +}); + + +/***/ }), + +/***/ 28277: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* jshint bitwise: false */ + +module.exports = CharacterData; + +var Leaf = __webpack_require__(31204); +var utils = __webpack_require__(91995); +var ChildNode = __webpack_require__(13168); +var NonDocumentTypeChildNode = __webpack_require__(39804); + +function CharacterData() { + Leaf.call(this); +} + +CharacterData.prototype = Object.create(Leaf.prototype, { + // DOMString substringData(unsigned long offset, + // unsigned long count); + // The substringData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length, return a DOMString whose value is + // the UTF-16 code units from the offsetth UTF-16 code + // unit to the end of data. + // + // Return a DOMString whose value is the UTF-16 code + // units from the offsetth UTF-16 code unit to the + // offset+countth UTF-16 code unit in data. + substringData: { value: function substringData(offset, count) { + if (arguments.length < 2) { throw new TypeError("Not enough arguments"); } + // Convert arguments to WebIDL "unsigned long" + offset = offset >>> 0; + count = count >>> 0; + if (offset > this.data.length || offset < 0 || count < 0) { + utils.IndexSizeError(); + } + return this.data.substring(offset, offset+count); + }}, + + // void appendData(DOMString data); + // The appendData(data) method must append data to the context + // object's data. + appendData: { value: function appendData(data) { + if (arguments.length < 1) { throw new TypeError("Not enough arguments"); } + this.data += String(data); + }}, + + // void insertData(unsigned long offset, DOMString data); + // The insertData(offset, data) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // Insert data into the context object's data after + // offset UTF-16 code units. + // + insertData: { value: function insertData(offset, data) { + return this.replaceData(offset, 0, data); + }}, + + + // void deleteData(unsigned long offset, unsigned long count); + // The deleteData(offset, count) method must run these steps: + // + // If offset is greater than the context object's + // length, throw an INDEX_SIZE_ERR exception and + // terminate these steps. + // + // If offset+count is greater than the context + // object's length var count be length-offset. + // + // Starting from offset UTF-16 code units remove count + // UTF-16 code units from the context object's data. + deleteData: { value: function deleteData(offset, count) { + return this.replaceData(offset, count, ''); + }}, + + + // void replaceData(unsigned long offset, unsigned long count, + // DOMString data); + // + // The replaceData(offset, count, data) method must act as + // if the deleteData() method is invoked with offset and + // count as arguments followed by the insertData() method + // with offset and data as arguments and re-throw any + // exceptions these methods might have thrown. + replaceData: { value: function replaceData(offset, count, data) { + var curtext = this.data, len = curtext.length; + // Convert arguments to correct WebIDL type + offset = offset >>> 0; + count = count >>> 0; + data = String(data); + + if (offset > len || offset < 0) utils.IndexSizeError(); + + if (offset+count > len) + count = len - offset; + + var prefix = curtext.substring(0, offset), + suffix = curtext.substring(offset+count); + + this.data = prefix + data + suffix; + }}, + + // Utility method that Node.isEqualNode() calls to test Text and + // Comment nodes for equality. It is okay to put it here, since + // Node will have already verified that nodeType is equal + isEqual: { value: function isEqual(n) { + return this._data === n._data; + }}, + + length: { get: function() { return this.data.length; }} + +}); + +Object.defineProperties(CharacterData.prototype, ChildNode); +Object.defineProperties(CharacterData.prototype, NonDocumentTypeChildNode); + + +/***/ }), + +/***/ 13168: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var Node = __webpack_require__(20576); +var LinkedList = __webpack_require__(81757); + +var createDocumentFragmentFromArguments = function(document, args) { + var docFrag = document.createDocumentFragment(); + + for (var i=0; i { + +"use strict"; + +module.exports = Comment; + +var Node = __webpack_require__(20576); +var CharacterData = __webpack_require__(28277); + +function Comment(doc, data) { + CharacterData.call(this); + this.nodeType = Node.COMMENT_NODE; + this.ownerDocument = doc; + this._data = data; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + } +}; + +Comment.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: '#comment' }, + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + // Utility methods + clone: { value: function clone() { + return new Comment(this.ownerDocument, this._data); + }}, +}); + + +/***/ }), + +/***/ 88277: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = ContainerNode; + +var Node = __webpack_require__(20576); +var NodeList = __webpack_require__(45192); + +// This class defines common functionality for node subtypes that +// can have children + +function ContainerNode() { + Node.call(this); + this._firstChild = this._childNodes = null; +} + +// Primary representation is a circular linked list of siblings +ContainerNode.prototype = Object.create(Node.prototype, { + + hasChildNodes: { value: function() { + if (this._childNodes) { + return this._childNodes.length > 0; + } + return this._firstChild !== null; + }}, + + childNodes: { get: function() { + this._ensureChildNodes(); + return this._childNodes; + }}, + + firstChild: { get: function() { + if (this._childNodes) { + return this._childNodes.length === 0 ? null : this._childNodes[0]; + } + return this._firstChild; + }}, + + lastChild: { get: function() { + var kids = this._childNodes, first; + if (kids) { + return kids.length === 0 ? null: kids[kids.length-1]; + } + first = this._firstChild; + if (first === null) { return null; } + return first._previousSibling; // circular linked list + }}, + + _ensureChildNodes: { value: function() { + if (this._childNodes) { return; } + var first = this._firstChild, + kid = first, + childNodes = this._childNodes = new NodeList(); + if (first) do { + childNodes.push(kid); + kid = kid._nextSibling; + } while (kid !== first); // circular linked list + this._firstChild = null; // free memory + }}, + + // Remove all of this node's children. This is a minor + // optimization that only calls modify() once. + removeChildren: { value: function removeChildren() { + var root = this.rooted ? this.ownerDocument : null, + next = this.firstChild, + kid; + while (next !== null) { + kid = next; + next = kid.nextSibling; + + if (root) root.mutateRemove(kid); + kid.parentNode = null; + } + if (this._childNodes) { + this._childNodes.length = 0; + } else { + this._firstChild = null; + } + this.modify(); // Update last modified type once only + }}, + +}); + + +/***/ }), + +/***/ 58575: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = CustomEvent; + +var Event = __webpack_require__(79778); + +function CustomEvent(type, dictionary) { + // Just use the superclass constructor to initialize + Event.call(this, type, dictionary); +} +CustomEvent.prototype = Object.create(Event.prototype, { + constructor: { value: CustomEvent } +}); + + +/***/ }), + +/***/ 58149: +/***/ ((module) => { + +"use strict"; + +module.exports = DOMException; + +var INDEX_SIZE_ERR = 1; +var HIERARCHY_REQUEST_ERR = 3; +var WRONG_DOCUMENT_ERR = 4; +var INVALID_CHARACTER_ERR = 5; +var NO_MODIFICATION_ALLOWED_ERR = 7; +var NOT_FOUND_ERR = 8; +var NOT_SUPPORTED_ERR = 9; +var INVALID_STATE_ERR = 11; +var SYNTAX_ERR = 12; +var INVALID_MODIFICATION_ERR = 13; +var NAMESPACE_ERR = 14; +var INVALID_ACCESS_ERR = 15; +var TYPE_MISMATCH_ERR = 17; +var SECURITY_ERR = 18; +var NETWORK_ERR = 19; +var ABORT_ERR = 20; +var URL_MISMATCH_ERR = 21; +var QUOTA_EXCEEDED_ERR = 22; +var TIMEOUT_ERR = 23; +var INVALID_NODE_TYPE_ERR = 24; +var DATA_CLONE_ERR = 25; + +// Code to name +var names = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR', + null, // historical + 'HIERARCHY_REQUEST_ERR', + 'WRONG_DOCUMENT_ERR', + 'INVALID_CHARACTER_ERR', + null, // historical + 'NO_MODIFICATION_ALLOWED_ERR', + 'NOT_FOUND_ERR', + 'NOT_SUPPORTED_ERR', + 'INUSE_ATTRIBUTE_ERR', // historical + 'INVALID_STATE_ERR', + 'SYNTAX_ERR', + 'INVALID_MODIFICATION_ERR', + 'NAMESPACE_ERR', + 'INVALID_ACCESS_ERR', + null, // historical + 'TYPE_MISMATCH_ERR', + 'SECURITY_ERR', + 'NETWORK_ERR', + 'ABORT_ERR', + 'URL_MISMATCH_ERR', + 'QUOTA_EXCEEDED_ERR', + 'TIMEOUT_ERR', + 'INVALID_NODE_TYPE_ERR', + 'DATA_CLONE_ERR', +]; + +// Code to message +// These strings are from the 13 May 2011 Editor's Draft of DOM Core. +// http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html +// Copyright © 2011 W3C® (MIT, ERCIM, Keio), All Rights Reserved. +// Used under the terms of the W3C Document License: +// http://www.w3.org/Consortium/Legal/2002/copyright-documents-20021231 +var messages = [ + null, // No error with code 0 + 'INDEX_SIZE_ERR (1): the index is not in the allowed range', + null, + 'HIERARCHY_REQUEST_ERR (3): the operation would yield an incorrect nodes model', + 'WRONG_DOCUMENT_ERR (4): the object is in the wrong Document, a call to importNode is required', + 'INVALID_CHARACTER_ERR (5): the string contains invalid characters', + null, + 'NO_MODIFICATION_ALLOWED_ERR (7): the object can not be modified', + 'NOT_FOUND_ERR (8): the object can not be found here', + 'NOT_SUPPORTED_ERR (9): this operation is not supported', + 'INUSE_ATTRIBUTE_ERR (10): setAttributeNode called on owned Attribute', + 'INVALID_STATE_ERR (11): the object is in an invalid state', + 'SYNTAX_ERR (12): the string did not match the expected pattern', + 'INVALID_MODIFICATION_ERR (13): the object can not be modified in this way', + 'NAMESPACE_ERR (14): the operation is not allowed by Namespaces in XML', + 'INVALID_ACCESS_ERR (15): the object does not support the operation or argument', + null, + 'TYPE_MISMATCH_ERR (17): the type of the object does not match the expected type', + 'SECURITY_ERR (18): the operation is insecure', + 'NETWORK_ERR (19): a network error occurred', + 'ABORT_ERR (20): the user aborted an operation', + 'URL_MISMATCH_ERR (21): the given URL does not match another URL', + 'QUOTA_EXCEEDED_ERR (22): the quota has been exceeded', + 'TIMEOUT_ERR (23): a timeout occurred', + 'INVALID_NODE_TYPE_ERR (24): the supplied node is invalid or has an invalid ancestor for this operation', + 'DATA_CLONE_ERR (25): the object can not be cloned.' +]; + +// Name to code +var constants = { + INDEX_SIZE_ERR: INDEX_SIZE_ERR, + DOMSTRING_SIZE_ERR: 2, // historical + HIERARCHY_REQUEST_ERR: HIERARCHY_REQUEST_ERR, + WRONG_DOCUMENT_ERR: WRONG_DOCUMENT_ERR, + INVALID_CHARACTER_ERR: INVALID_CHARACTER_ERR, + NO_DATA_ALLOWED_ERR: 6, // historical + NO_MODIFICATION_ALLOWED_ERR: NO_MODIFICATION_ALLOWED_ERR, + NOT_FOUND_ERR: NOT_FOUND_ERR, + NOT_SUPPORTED_ERR: NOT_SUPPORTED_ERR, + INUSE_ATTRIBUTE_ERR: 10, // historical + INVALID_STATE_ERR: INVALID_STATE_ERR, + SYNTAX_ERR: SYNTAX_ERR, + INVALID_MODIFICATION_ERR: INVALID_MODIFICATION_ERR, + NAMESPACE_ERR: NAMESPACE_ERR, + INVALID_ACCESS_ERR: INVALID_ACCESS_ERR, + VALIDATION_ERR: 16, // historical + TYPE_MISMATCH_ERR: TYPE_MISMATCH_ERR, + SECURITY_ERR: SECURITY_ERR, + NETWORK_ERR: NETWORK_ERR, + ABORT_ERR: ABORT_ERR, + URL_MISMATCH_ERR: URL_MISMATCH_ERR, + QUOTA_EXCEEDED_ERR: QUOTA_EXCEEDED_ERR, + TIMEOUT_ERR: TIMEOUT_ERR, + INVALID_NODE_TYPE_ERR: INVALID_NODE_TYPE_ERR, + DATA_CLONE_ERR: DATA_CLONE_ERR +}; + +function DOMException(code) { + Error.call(this); + Error.captureStackTrace(this, this.constructor); + this.code = code; + this.message = messages[code]; + this.name = names[code]; +} +DOMException.prototype.__proto__ = Error.prototype; + +// Initialize the constants on DOMException and DOMException.prototype +for(var c in constants) { + var v = { value: constants[c] }; + Object.defineProperty(DOMException, c, v); + Object.defineProperty(DOMException.prototype, c, v); +} + + +/***/ }), + +/***/ 94008: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DOMImplementation; + +var Document = __webpack_require__(88097); +var DocumentType = __webpack_require__(47825); +var HTMLParser = __webpack_require__(24042); +var utils = __webpack_require__(91995); +var xml = __webpack_require__(871); + +// Each document must have its own instance of the domimplementation object +function DOMImplementation(contextObject) { + this.contextObject = contextObject; +} + + +// Feature/version pairs that DOMImplementation.hasFeature() returns +// true for. It returns false for anything else. +var supportedFeatures = { + 'xml': { '': true, '1.0': true, '2.0': true }, // DOM Core + 'core': { '': true, '2.0': true }, // DOM Core + 'html': { '': true, '1.0': true, '2.0': true} , // HTML + 'xhtml': { '': true, '1.0': true, '2.0': true} , // HTML +}; + +DOMImplementation.prototype = { + hasFeature: function hasFeature(feature, version) { + var f = supportedFeatures[(feature || '').toLowerCase()]; + return (f && f[version || '']) || false; + }, + + createDocumentType: function createDocumentType(qualifiedName, publicId, systemId) { + if (!xml.isValidQName(qualifiedName)) utils.InvalidCharacterError(); + + return new DocumentType(this.contextObject, qualifiedName, publicId, systemId); + }, + + createDocument: function createDocument(namespace, qualifiedName, doctype) { + // + // Note that the current DOMCore spec makes it impossible to + // create an HTML document with this function, even if the + // namespace and doctype are propertly set. See this thread: + // http://lists.w3.org/Archives/Public/www-dom/2011AprJun/0132.html + // + var d = new Document(false, null); + var e; + + if (qualifiedName) + e = d.createElementNS(namespace, qualifiedName); + else + e = null; + + if (doctype) { + d.appendChild(doctype); + } + + if (e) d.appendChild(e); + if (namespace === utils.NAMESPACE.HTML) { + d._contentType = 'application/xhtml+xml'; + } else if (namespace === utils.NAMESPACE.SVG) { + d._contentType = 'image/svg+xml'; + } else { + d._contentType = 'application/xml'; + } + + return d; + }, + + createHTMLDocument: function createHTMLDocument(titleText) { + var d = new Document(true, null); + d.appendChild(new DocumentType(d, 'html')); + var html = d.createElement('html'); + d.appendChild(html); + var head = d.createElement('head'); + html.appendChild(head); + if (titleText !== undefined) { + var title = d.createElement('title'); + head.appendChild(title); + title.appendChild(d.createTextNode(titleText)); + } + html.appendChild(d.createElement('body')); + d.modclock = 1; // Start tracking modifications + return d; + }, + + mozSetOutputMutationHandler: function(doc, handler) { + doc.mutationHandler = handler; + }, + + mozGetInputMutationHandler: function(doc) { + utils.nyi(); + }, + + mozHTMLParser: HTMLParser, +}; + + +/***/ }), + +/***/ 64365: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +// DOMTokenList implementation based on https://github.com/Raynos/DOM-shim +var utils = __webpack_require__(91995); + +module.exports = DOMTokenList; + +function DOMTokenList(getter, setter) { + this._getString = getter; + this._setString = setter; + this._length = 0; + this._lastStringValue = ''; + this._update(); +} + +Object.defineProperties(DOMTokenList.prototype, { + length: { get: function() { return this._length; } }, + item: { value: function(index) { + var list = getList(this); + if (index < 0 || index >= list.length) { + return null; + } + return list[index]; + }}, + + contains: { value: function(token) { + token = String(token); // no error checking for contains() + var list = getList(this); + return list.indexOf(token) > -1; + }}, + + add: { value: function() { + var list = getList(this); + for (var i = 0, len = arguments.length; i < len; i++) { + var token = handleErrors(arguments[i]); + if (list.indexOf(token) < 0) { + list.push(token); + } + } + // Note: as per spec, if handleErrors() throws any errors, we never + // make it here and none of the changes take effect. + // Also per spec: we run the "update steps" even if no change was + // made (ie, if the token already existed) + this._update(list); + }}, + + remove: { value: function() { + var list = getList(this); + for (var i = 0, len = arguments.length; i < len; i++) { + var token = handleErrors(arguments[i]); + var index = list.indexOf(token); + if (index > -1) { + list.splice(index, 1); + } + } + // Note: as per spec, if handleErrors() throws any errors, we never + // make it here and none of the changes take effect. + // Also per spec: we run the "update steps" even if no change was + // made (ie, if the token wasn't previously present) + this._update(list); + }}, + + toggle: { value: function toggle(token, force) { + token = handleErrors(token); + if (this.contains(token)) { + if (force === undefined || force === false) { + this.remove(token); + return false; + } + return true; + } else { + if (force === undefined || force === true) { + this.add(token); + return true; + } + return false; + } + }}, + + replace: { value: function replace(token, newToken) { + // weird corner case of spec: if `token` contains whitespace, but + // `newToken` is the empty string, we must throw SyntaxError not + // InvalidCharacterError (sigh) + if (String(newToken)==='') { utils.SyntaxError(); } + token = handleErrors(token); + newToken = handleErrors(newToken); + var list = getList(this); + var idx = list.indexOf(token); + if (idx < 0) { + // Note that, per spec, we do not run the update steps on this path. + return false; + } + var idx2 = list.indexOf(newToken); + if (idx2 < 0) { + list[idx] = newToken; + } else { + // "replace the first instance of either `token` or `newToken` with + // `newToken` and remove all other instances" + if (idx < idx2) { + list[idx] = newToken; + list.splice(idx2, 1); + } else { + // idx2 is already `newToken` + list.splice(idx, 1); + } + } + this._update(list); + return true; + }}, + + toString: { value: function() { + return this._getString(); + }}, + + value: { + get: function() { + return this._getString(); + }, + set: function(v) { + this._setString(v); + this._update(); + } + }, + + // Called when the setter is called from outside this interface. + _update: { value: function(list) { + if (list) { + fixIndex(this, list); + this._setString(list.join(" ").trim()); + } else { + fixIndex(this, getList(this)); + } + this._lastStringValue = this._getString(); + } }, +}); + +function fixIndex(clist, list) { + var oldLength = clist._length; + var i; + clist._length = list.length; + for (i = 0; i < list.length; i++) { + clist[i] = list[i]; + } + // Clear/free old entries. + for (; i < oldLength; i++) { + clist[i] = undefined; + } +} + +function handleErrors(token) { + token = String(token); + if (token === "") { + utils.SyntaxError(); + } + if (/[ \t\r\n\f]/.test(token)) { + utils.InvalidCharacterError(); + } + return token; +} + +function toArray(clist) { + var length = clist._length; + var arr = Array(length); + for (var i = 0; i < length; i++) { + arr[i] = clist[i]; + } + return arr; +} + +function getList(clist) { + var strProp = clist._getString(); + if (strProp === clist._lastStringValue) { + return toArray(clist); + } + var str = strProp.replace(/(^[ \t\r\n\f]+)|([ \t\r\n\f]+$)/g, ''); + if (str === "") { + return []; + } else { + var seen = Object.create(null); + return str.split(/[ \t\r\n\f]+/g).filter(function(n) { + var key = '$' + n; + if (seen[key]) { return false; } + seen[key] = true; + return true; + }); + } +} + + +/***/ }), + +/***/ 88097: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Document; + +var Node = __webpack_require__(20576); +var NodeList = __webpack_require__(45192); +var ContainerNode = __webpack_require__(88277); +var Element = __webpack_require__(67262); +var Text = __webpack_require__(57995); +var Comment = __webpack_require__(21707); +var Event = __webpack_require__(79778); +var DocumentFragment = __webpack_require__(9857); +var ProcessingInstruction = __webpack_require__(68159); +var DOMImplementation = __webpack_require__(94008); +var TreeWalker = __webpack_require__(25718); +var NodeIterator = __webpack_require__(39722); +var NodeFilter = __webpack_require__(46870); +var URL = __webpack_require__(40747); +var select = __webpack_require__(5056); +var events = __webpack_require__(86817); +var xml = __webpack_require__(871); +var html = __webpack_require__(41537); +var svg = __webpack_require__(50380); +var utils = __webpack_require__(91995); +var MUTATE = __webpack_require__(92078); +var NAMESPACE = utils.NAMESPACE; +var isApiWritable = (__webpack_require__(6978)/* .isApiWritable */ .h); + +function Document(isHTML, address) { + ContainerNode.call(this); + this.nodeType = Node.DOCUMENT_NODE; + this.isHTML = isHTML; + this._address = address || 'about:blank'; + this.readyState = 'loading'; + this.implementation = new DOMImplementation(this); + + // DOMCore says that documents are always associated with themselves + this.ownerDocument = null; // ... but W3C tests expect null + this._contentType = isHTML ? 'text/html' : 'application/xml'; + + // These will be initialized by our custom versions of + // appendChild and insertBefore that override the inherited + // Node methods. + // XXX: override those methods! + this.doctype = null; + this.documentElement = null; + + // "Associated inert template document" + this._templateDocCache = null; + // List of active NodeIterators, see NodeIterator#_preremove() + this._nodeIterators = null; + + // Documents are always rooted, by definition + this._nid = 1; + this._nextnid = 2; // For numbering children of the document + this._nodes = [null, this]; // nid to node map + + // This maintains the mapping from element ids to element nodes. + // We may need to update this mapping every time a node is rooted + // or uprooted, and any time an attribute is added, removed or changed + // on a rooted element. + this.byId = Object.create(null); + + // This property holds a monotonically increasing value akin to + // a timestamp used to record the last modification time of nodes + // and their subtrees. See the lastModTime attribute and modify() + // method of the Node class. And see FilteredElementList for an example + // of the use of lastModTime + this.modclock = 0; +} + +// Map from lowercase event category names (used as arguments to +// createEvent()) to the property name in the impl object of the +// event constructor. +var supportedEvents = { + event: 'Event', + customevent: 'CustomEvent', + uievent: 'UIEvent', + mouseevent: 'MouseEvent' +}; + +// Certain arguments to document.createEvent() must be treated specially +var replacementEvent = { + events: 'event', + htmlevents: 'event', + mouseevents: 'mouseevent', + mutationevents: 'mutationevent', + uievents: 'uievent' +}; + +var mirrorAttr = function(f, name, defaultValue) { + return { + get: function() { + var o = f.call(this); + if (o) { return o[name]; } + return defaultValue; + }, + set: function(value) { + var o = f.call(this); + if (o) { o[name] = value; } + }, + }; +}; + +/** @spec https://dom.spec.whatwg.org/#validate-and-extract */ +function validateAndExtract(namespace, qualifiedName) { + var prefix, localName, pos; + if (namespace==='') { namespace = null; } + // See https://github.com/whatwg/dom/issues/671 + // and https://github.com/whatwg/dom/issues/319 + if (!xml.isValidQName(qualifiedName)) { + utils.InvalidCharacterError(); + } + prefix = null; + localName = qualifiedName; + + pos = qualifiedName.indexOf(':'); + if (pos >= 0) { + prefix = qualifiedName.substring(0, pos); + localName = qualifiedName.substring(pos+1); + } + if (prefix !== null && namespace === null) { + utils.NamespaceError(); + } + if (prefix === 'xml' && namespace !== NAMESPACE.XML) { + utils.NamespaceError(); + } + if ((prefix === 'xmlns' || qualifiedName === 'xmlns') && + namespace !== NAMESPACE.XMLNS) { + utils.NamespaceError(); + } + if (namespace === NAMESPACE.XMLNS && !(prefix==='xmlns' || qualifiedName==='xmlns')) { + utils.NamespaceError(); + } + return { namespace: namespace, prefix: prefix, localName: localName }; +} + +Document.prototype = Object.create(ContainerNode.prototype, { + // This method allows dom.js to communicate with a renderer + // that displays the document in some way + // XXX: I should probably move this to the window object + _setMutationHandler: { value: function(handler) { + this.mutationHandler = handler; + }}, + + // This method allows dom.js to receive event notifications + // from the renderer. + // XXX: I should probably move this to the window object + _dispatchRendererEvent: { value: function(targetNid, type, details) { + var target = this._nodes[targetNid]; + if (!target) return; + target._dispatchEvent(new Event(type, details), true); + }}, + + nodeName: { value: '#document'}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + + // XXX: DOMCore may remove documentURI, so it is NYI for now + documentURI: { get: function() { return this._address; }, set: utils.nyi }, + compatMode: { get: function() { + // The _quirks property is set by the HTML parser + return this._quirks ? 'BackCompat' : 'CSS1Compat'; + }}, + + createTextNode: { value: function(data) { + return new Text(this, String(data)); + }}, + createComment: { value: function(data) { + return new Comment(this, data); + }}, + createDocumentFragment: { value: function() { + return new DocumentFragment(this); + }}, + createProcessingInstruction: { value: function(target, data) { + if (!xml.isValidName(target) || data.indexOf('?>') !== -1) + utils.InvalidCharacterError(); + return new ProcessingInstruction(this, target, data); + }}, + + createAttribute: { value: function(localName) { + localName = String(localName); + if (!xml.isValidName(localName)) utils.InvalidCharacterError(); + if (this.isHTML) { + localName = utils.toASCIILowerCase(localName); + } + return new Element._Attr(null, localName, null, null, ''); + }}, + createAttributeNS: { value: function(namespace, qualifiedName) { + // Convert parameter types according to WebIDL + namespace = + (namespace === null || namespace === undefined || namespace === '') ? null : + String(namespace); + qualifiedName = String(qualifiedName); + var ve = validateAndExtract(namespace, qualifiedName); + return new Element._Attr(null, ve.localName, ve.prefix, ve.namespace, ''); + }}, + + createElement: { value: function(localName) { + localName = String(localName); + if (!xml.isValidName(localName)) utils.InvalidCharacterError(); + // Per spec, namespace should be HTML namespace if "context object is + // an HTML document or context object's content type is + // "application/xhtml+xml", and null otherwise. + if (this.isHTML) { + if (/[A-Z]/.test(localName)) + localName = utils.toASCIILowerCase(localName); + return html.createElement(this, localName, null); + } else if (this.contentType === 'application/xhtml+xml') { + return html.createElement(this, localName, null); + } else { + return new Element(this, localName, null, null); + } + }, writable: isApiWritable }, + + createElementNS: { value: function(namespace, qualifiedName) { + // Convert parameter types according to WebIDL + namespace = + (namespace === null || namespace === undefined || namespace === '') ? null : + String(namespace); + qualifiedName = String(qualifiedName); + var ve = validateAndExtract(namespace, qualifiedName); + return this._createElementNS(ve.localName, ve.namespace, ve.prefix); + }, writable: isApiWritable }, + + // This is used directly by HTML parser, which allows it to create + // elements with localNames containing ':' and non-default namespaces + _createElementNS: { value: function(localName, namespace, prefix) { + if (namespace === NAMESPACE.HTML) { + return html.createElement(this, localName, prefix); + } + else if (namespace === NAMESPACE.SVG) { + return svg.createElement(this, localName, prefix); + } + + return new Element(this, localName, namespace, prefix); + }}, + + createEvent: { value: function createEvent(interfaceName) { + interfaceName = interfaceName.toLowerCase(); + var name = replacementEvent[interfaceName] || interfaceName; + var constructor = events[supportedEvents[name]]; + + if (constructor) { + var e = new constructor(); + e._initialized = false; + return e; + } + else { + utils.NotSupportedError(); + } + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createtreewalker + createTreeWalker: {value: function (root, whatToShow, filter) { + if (!root) { throw new TypeError("root argument is required"); } + if (!(root instanceof Node)) { throw new TypeError("root not a node"); } + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow); + filter = filter === undefined ? null : filter; + + return new TreeWalker(root, whatToShow, filter); + }}, + + // See: http://www.w3.org/TR/dom/#dom-document-createnodeiterator + createNodeIterator: {value: function (root, whatToShow, filter) { + if (!root) { throw new TypeError("root argument is required"); } + if (!(root instanceof Node)) { throw new TypeError("root not a node"); } + whatToShow = whatToShow === undefined ? NodeFilter.SHOW_ALL : (+whatToShow); + filter = filter === undefined ? null : filter; + + return new NodeIterator(root, whatToShow, filter); + }}, + + _attachNodeIterator: { value: function(ni) { + // XXX ideally this should be a weak reference from Document to NodeIterator + if (!this._nodeIterators) { this._nodeIterators = []; } + this._nodeIterators.push(ni); + }}, + + _detachNodeIterator: { value: function(ni) { + // ni should always be in list of node iterators + var idx = this._nodeIterators.indexOf(ni); + this._nodeIterators.splice(idx, 1); + }}, + + _preremoveNodeIterators: { value: function(toBeRemoved) { + if (this._nodeIterators) { + this._nodeIterators.forEach(function(ni) { ni._preremove(toBeRemoved); }); + } + }}, + + // Maintain the documentElement and + // doctype properties of the document. Each of the following + // methods chains to the Node implementation of the method + // to do the actual inserting, removal or replacement. + + _updateDocTypeElement: { value: function _updateDocTypeElement() { + this.doctype = this.documentElement = null; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.DOCUMENT_TYPE_NODE) + this.doctype = kid; + else if (kid.nodeType === Node.ELEMENT_NODE) + this.documentElement = kid; + } + }}, + + insertBefore: { value: function insertBefore(child, refChild) { + Node.prototype.insertBefore.call(this, child, refChild); + this._updateDocTypeElement(); + return child; + }}, + + replaceChild: { value: function replaceChild(node, child) { + Node.prototype.replaceChild.call(this, node, child); + this._updateDocTypeElement(); + return child; + }}, + + removeChild: { value: function removeChild(child) { + Node.prototype.removeChild.call(this, child); + this._updateDocTypeElement(); + return child; + }}, + + getElementById: { value: function(id) { + var n = this.byId[id]; + if (!n) return null; + if (n instanceof MultiId) { // there was more than one element with this id + return n.getFirst(); + } + return n; + }}, + + _hasMultipleElementsWithId: { value: function(id) { + // Used internally by querySelectorAll optimization + return (this.byId[id] instanceof MultiId); + }}, + + // Just copy this method from the Element prototype + getElementsByName: { value: Element.prototype.getElementsByName }, + getElementsByTagName: { value: Element.prototype.getElementsByTagName }, + getElementsByTagNameNS: { value: Element.prototype.getElementsByTagNameNS }, + getElementsByClassName: { value: Element.prototype.getElementsByClassName }, + + adoptNode: { value: function adoptNode(node) { + if (node.nodeType === Node.DOCUMENT_NODE) utils.NotSupportedError(); + if (node.nodeType === Node.ATTRIBUTE_NODE) { return node; } + + if (node.parentNode) node.parentNode.removeChild(node); + + if (node.ownerDocument !== this) + recursivelySetOwner(node, this); + + return node; + }}, + + importNode: { value: function importNode(node, deep) { + return this.adoptNode(node.cloneNode(deep)); + }, writable: isApiWritable }, + + // The following attributes and methods are from the HTML spec + origin: { get: function origin() { return null; } }, + characterSet: { get: function characterSet() { return "UTF-8"; } }, + contentType: { get: function contentType() { return this._contentType; } }, + URL: { get: function URL() { return this._address; } }, + domain: { get: utils.nyi, set: utils.nyi }, + referrer: { get: utils.nyi }, + cookie: { get: utils.nyi, set: utils.nyi }, + lastModified: { get: utils.nyi }, + location: { + get: function() { + return this.defaultView ? this.defaultView.location : null; // gh #75 + }, + set: utils.nyi + }, + _titleElement: { + get: function() { + // The title element of a document is the first title element in the + // document in tree order, if there is one, or null otherwise. + return this.getElementsByTagName('title').item(0) || null; + } + }, + title: { + get: function() { + var elt = this._titleElement; + // The child text content of the title element, or '' if null. + var value = elt ? elt.textContent : ''; + // Strip and collapse whitespace in value + return value.replace(/[ \t\n\r\f]+/g, ' ').replace(/(^ )|( $)/g, ''); + }, + set: function(value) { + var elt = this._titleElement; + var head = this.head; + if (!elt && !head) { return; /* according to spec */ } + if (!elt) { + elt = this.createElement('title'); + head.appendChild(elt); + } + elt.textContent = value; + } + }, + dir: mirrorAttr(function() { + var htmlElement = this.documentElement; + if (htmlElement && htmlElement.tagName === 'HTML') { return htmlElement; } + }, 'dir', ''), + fgColor: mirrorAttr(function() { return this.body; }, 'text', ''), + linkColor: mirrorAttr(function() { return this.body; }, 'link', ''), + vlinkColor: mirrorAttr(function() { return this.body; }, 'vLink', ''), + alinkColor: mirrorAttr(function() { return this.body; }, 'aLink', ''), + bgColor: mirrorAttr(function() { return this.body; }, 'bgColor', ''), + + // Historical aliases of Document#characterSet + charset: { get: function() { return this.characterSet; } }, + inputEncoding: { get: function() { return this.characterSet; } }, + + scrollingElement: { + get: function() { + return this._quirks ? this.body : this.documentElement; + } + }, + + // Return the first child of the document element. + // XXX For now, setting this attribute is not implemented. + body: { + get: function() { + return namedHTMLChild(this.documentElement, 'body'); + }, + set: utils.nyi + }, + // Return the first child of the document element. + head: { get: function() { + return namedHTMLChild(this.documentElement, 'head'); + }}, + images: { get: utils.nyi }, + embeds: { get: utils.nyi }, + plugins: { get: utils.nyi }, + links: { get: utils.nyi }, + forms: { get: utils.nyi }, + scripts: { get: utils.nyi }, + applets: { get: function() { return []; } }, + activeElement: { get: function() { return null; } }, + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + + write: { value: function(args) { + if (!this.isHTML) utils.InvalidStateError(); + + // XXX: still have to implement the ignore part + if (!this._parser /* && this._ignore_destructive_writes > 0 */ ) + return; + + if (!this._parser) { + // XXX call document.open, etc. + } + + var s = arguments.join(''); + + // If the Document object's reload override flag is set, then + // append the string consisting of the concatenation of all the + // arguments to the method to the Document's reload override + // buffer. + // XXX: don't know what this is about. Still have to do it + + // If there is no pending parsing-blocking script, have the + // tokenizer process the characters that were inserted, one at a + // time, processing resulting tokens as they are emitted, and + // stopping when the tokenizer reaches the insertion point or when + // the processing of the tokenizer is aborted by the tree + // construction stage (this can happen if a script end tag token is + // emitted by the tokenizer). + + // XXX: still have to do the above. Sounds as if we don't + // always call parse() here. If we're blocked, then we just + // insert the text into the stream but don't parse it reentrantly... + + // Invoke the parser reentrantly + this._parser.parse(s); + }}, + + writeln: { value: function writeln(args) { + this.write(Array.prototype.join.call(arguments, '') + '\n'); + }}, + + open: { value: function() { + this.documentElement = null; + }}, + + close: { value: function() { + this.readyState = 'interactive'; + this._dispatchEvent(new Event('readystatechange'), true); + this._dispatchEvent(new Event('DOMContentLoaded'), true); + this.readyState = 'complete'; + this._dispatchEvent(new Event('readystatechange'), true); + if (this.defaultView) { + this.defaultView._dispatchEvent(new Event('load'), true); + } + }}, + + // Utility methods + clone: { value: function clone() { + var d = new Document(this.isHTML, this._address); + d._quirks = this._quirks; + d._contentType = this._contentType; + return d; + }}, + + // We need to adopt the nodes if we do a deep clone + cloneNode: { value: function cloneNode(deep) { + var clone = Node.prototype.cloneNode.call(this, false); + if (deep) { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + clone._appendChild(clone.importNode(kid, true)); + } + } + clone._updateDocTypeElement(); + return clone; + }}, + + isEqual: { value: function isEqual(n) { + // Any two documents are shallowly equal. + // Node.isEqualNode will also test the children + return true; + }}, + + // Implementation-specific function. Called when a text, comment, + // or pi value changes. + mutateValue: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.VALUE, + target: node, + data: node.data + }); + } + }}, + + // Invoked when an attribute's value changes. Attr holds the new + // value. oldval is the old value. Attribute mutations can also + // involve changes to the prefix (and therefore the qualified name) + mutateAttr: { value: function(attr, oldval) { + // Manage id->element mapping for getElementsById() + // XXX: this special case id handling should not go here, + // but in the attribute declaration for the id attribute + /* + if (attr.localName === 'id' && attr.namespaceURI === null) { + if (oldval) delId(oldval, attr.ownerElement); + addId(attr.value, attr.ownerElement); + } + */ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.ATTR, + target: attr.ownerElement, + attr: attr + }); + } + }}, + + // Used by removeAttribute and removeAttributeNS for attributes. + mutateRemoveAttr: { value: function(attr) { +/* +* This is now handled in Attributes.js + // Manage id to element mapping + if (attr.localName === 'id' && attr.namespaceURI === null) { + this.delId(attr.value, attr.ownerElement); + } +*/ + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE_ATTR, + target: attr.ownerElement, + attr: attr + }); + } + }}, + + // Called by Node.removeChild, etc. to remove a rooted element from + // the tree. Only needs to generate a single mutation event when a + // node is removed, but must recursively mark all descendants as not + // rooted. + mutateRemove: { value: function(node) { + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.REMOVE, + target: node.parentNode, + node: node + }); + } + + // Mark this and all descendants as not rooted + recursivelyUproot(node); + }}, + + // Called when a new element becomes rooted. It must recursively + // generate mutation events for each of the children, and mark them all + // as rooted. + mutateInsert: { value: function(node) { + // Mark node and its descendants as rooted + recursivelyRoot(node); + + // Send a single mutation event + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.INSERT, + target: node.parentNode, + node: node + }); + } + }}, + + // Called when a rooted element is moved within the document + mutateMove: { value: function(node) { + if (this.mutationHandler) { + this.mutationHandler({ + type: MUTATE.MOVE, + target: node + }); + } + }}, + + + // Add a mapping from id to n for n.ownerDocument + addId: { value: function addId(id, n) { + var val = this.byId[id]; + if (!val) { + this.byId[id] = n; + } + else { + // TODO: Add a way to opt-out console warnings + //console.warn('Duplicate element id ' + id); + if (!(val instanceof MultiId)) { + val = new MultiId(val); + this.byId[id] = val; + } + val.add(n); + } + }}, + + // Delete the mapping from id to n for n.ownerDocument + delId: { value: function delId(id, n) { + var val = this.byId[id]; + utils.assert(val); + + if (val instanceof MultiId) { + val.del(n); + if (val.length === 1) { // convert back to a single node + this.byId[id] = val.downgrade(); + } + } + else { + this.byId[id] = undefined; + } + }}, + + _resolve: { value: function(href) { + //XXX: Cache the URL + return new URL(this._documentBaseURL).resolve(href); + }}, + + _documentBaseURL: { get: function() { + // XXX: This is not implemented correctly yet + var url = this._address; + if (url === 'about:blank') url = '/'; + + var base = this.querySelector('base[href]'); + if (base) { + return new URL(url).resolve(base.getAttribute('href')); + } + return url; + + // The document base URL of a Document object is the + // absolute URL obtained by running these substeps: + + // Let fallback base url be the document's address. + + // If fallback base url is about:blank, and the + // Document's browsing context has a creator browsing + // context, then let fallback base url be the document + // base URL of the creator Document instead. + + // If the Document is an iframe srcdoc document, then + // let fallback base url be the document base URL of + // the Document's browsing context's browsing context + // container's Document instead. + + // If there is no base element that has an href + // attribute, then the document base URL is fallback + // base url; abort these steps. Otherwise, let url be + // the value of the href attribute of the first such + // element. + + // Resolve url relative to fallback base url (thus, + // the base href attribute isn't affected by xml:base + // attributes). + + // The document base URL is the result of the previous + // step if it was successful; otherwise it is fallback + // base url. + }}, + + _templateDoc: { get: function() { + if (!this._templateDocCache) { + // "associated inert template document" + var newDoc = new Document(this.isHTML, this._address); + this._templateDocCache = newDoc._templateDocCache = newDoc; + } + return this._templateDocCache; + }}, + + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, + + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} + +}); + + +var eventHandlerTypes = [ + 'abort', 'canplay', 'canplaythrough', 'change', 'click', 'contextmenu', + 'cuechange', 'dblclick', 'drag', 'dragend', 'dragenter', 'dragleave', + 'dragover', 'dragstart', 'drop', 'durationchange', 'emptied', 'ended', + 'input', 'invalid', 'keydown', 'keypress', 'keyup', 'loadeddata', + 'loadedmetadata', 'loadstart', 'mousedown', 'mousemove', 'mouseout', + 'mouseover', 'mouseup', 'mousewheel', 'pause', 'play', 'playing', + 'progress', 'ratechange', 'readystatechange', 'reset', 'seeked', + 'seeking', 'select', 'show', 'stalled', 'submit', 'suspend', + 'timeupdate', 'volumechange', 'waiting', + + 'blur', 'error', 'focus', 'load', 'scroll' +]; + +// Add event handler idl attribute getters and setters to Document +eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(Document.prototype, 'on' + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); + } + }); +}); + +function namedHTMLChild(parent, name) { + if (parent && parent.isHTML) { + for (var kid = parent.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE && + kid.localName === name && + kid.namespaceURI === NAMESPACE.HTML) { + return kid; + } + } + } + return null; +} + +function root(n) { + n._nid = n.ownerDocument._nextnid++; + n.ownerDocument._nodes[n._nid] = n; + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.addId(id, n); + + // Script elements need to know when they're inserted + // into the document + if (n._roothook) n._roothook(); + } +} + +function uproot(n) { + // Manage id to element mapping + if (n.nodeType === Node.ELEMENT_NODE) { + var id = n.getAttribute('id'); + if (id) n.ownerDocument.delId(id, n); + } + n.ownerDocument._nodes[n._nid] = undefined; + n._nid = undefined; +} + +function recursivelyRoot(node) { + root(node); + // XXX: + // accessing childNodes on a leaf node creates a new array the + // first time, so be careful to write this loop so that it + // doesn't do that. node is polymorphic, so maybe this is hard to + // optimize? Try switching on nodeType? +/* + if (node.hasChildNodes()) { + var kids = node.childNodes; + for(var i = 0, n = kids.length; i < n; i++) + recursivelyRoot(kids[i]); + } +*/ + if (node.nodeType === Node.ELEMENT_NODE) { + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelyRoot(kid); + } +} + +function recursivelyUproot(node) { + uproot(node); + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelyUproot(kid); +} + +function recursivelySetOwner(node, owner) { + node.ownerDocument = owner; + node._lastModTime = undefined; // mod times are document-based + if (Object.prototype.hasOwnProperty.call(node, '_tagName')) { + node._tagName = undefined; // Element subclasses might need to change case + } + for (var kid = node.firstChild; kid !== null; kid = kid.nextSibling) + recursivelySetOwner(kid, owner); +} + +// A class for storing multiple nodes with the same ID +function MultiId(node) { + this.nodes = Object.create(null); + this.nodes[node._nid] = node; + this.length = 1; + this.firstNode = undefined; +} + +// Add a node to the list, with O(1) time +MultiId.prototype.add = function(node) { + if (!this.nodes[node._nid]) { + this.nodes[node._nid] = node; + this.length++; + this.firstNode = undefined; + } +}; + +// Remove a node from the list, with O(1) time +MultiId.prototype.del = function(node) { + if (this.nodes[node._nid]) { + delete this.nodes[node._nid]; + this.length--; + this.firstNode = undefined; + } +}; + +// Get the first node from the list, in the document order +// Takes O(N) time in the size of the list, with a cache that is invalidated +// when the list is modified. +MultiId.prototype.getFirst = function() { + /* jshint bitwise: false */ + if (!this.firstNode) { + var nid; + for (nid in this.nodes) { + if (this.firstNode === undefined || + this.firstNode.compareDocumentPosition(this.nodes[nid]) & Node.DOCUMENT_POSITION_PRECEDING) { + this.firstNode = this.nodes[nid]; + } + } + } + return this.firstNode; +}; + +// If there is only one node left, return it. Otherwise return "this". +MultiId.prototype.downgrade = function() { + if (this.length === 1) { + var nid; + for (nid in this.nodes) { + return this.nodes[nid]; + } + } + return this; +}; + + +/***/ }), + +/***/ 9857: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DocumentFragment; + +var Node = __webpack_require__(20576); +var NodeList = __webpack_require__(45192); +var ContainerNode = __webpack_require__(88277); +var Element = __webpack_require__(67262); +var select = __webpack_require__(5056); +var utils = __webpack_require__(91995); + +function DocumentFragment(doc) { + ContainerNode.call(this); + this.nodeType = Node.DOCUMENT_FRAGMENT_NODE; + this.ownerDocument = doc; +} + +DocumentFragment.prototype = Object.create(ContainerNode.prototype, { + nodeName: { value: '#document-fragment' }, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + // Copy the text content getter/setter from Element + textContent: Object.getOwnPropertyDescriptor(Element.prototype, 'textContent'), + + // Copy the text content getter/setter from Element + innerText: Object.getOwnPropertyDescriptor(Element.prototype, 'innerText'), + + querySelector: { value: function(selector) { + // implement in terms of querySelectorAll + var nodes = this.querySelectorAll(selector); + return nodes.length ? nodes[0] : null; + }}, + querySelectorAll: { value: function(selector) { + // create a context + var context = Object.create(this); + // add some methods to the context for zest implementation, without + // adding them to the public DocumentFragment API + context.isHTML = true; // in HTML namespace (case-insensitive match) + context.getElementsByTagName = Element.prototype.getElementsByTagName; + context.nextElement = + Object.getOwnPropertyDescriptor(Element.prototype, 'firstElementChild'). + get; + // invoke zest + var nodes = select(selector, context); + return nodes.item ? nodes : new NodeList(nodes); + }}, + + // Utility methods + clone: { value: function clone() { + return new DocumentFragment(this.ownerDocument); + }}, + isEqual: { value: function isEqual(n) { + // Any two document fragments are shallowly equal. + // Node.isEqualNode() will test their children for equality + return true; + }}, + + // Non-standard, but useful (github issue #73) + innerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + outerHTML: { + get: function() { return this.serialize(); }, + set: utils.nyi + }, + +}); + + +/***/ }), + +/***/ 47825: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = DocumentType; + +var Node = __webpack_require__(20576); +var Leaf = __webpack_require__(31204); +var ChildNode = __webpack_require__(13168); + +function DocumentType(ownerDocument, name, publicId, systemId) { + Leaf.call(this); + this.nodeType = Node.DOCUMENT_TYPE_NODE; + this.ownerDocument = ownerDocument || null; + this.name = name; + this.publicId = publicId || ""; + this.systemId = systemId || ""; +} + +DocumentType.prototype = Object.create(Leaf.prototype, { + nodeName: { get: function() { return this.name; }}, + nodeValue: { + get: function() { return null; }, + set: function() {} + }, + + // Utility methods + clone: { value: function clone() { + return new DocumentType(this.ownerDocument, this.name, this.publicId, this.systemId); + }}, + + isEqual: { value: function isEqual(n) { + return this.name === n.name && + this.publicId === n.publicId && + this.systemId === n.systemId; + }} +}); + +Object.defineProperties(DocumentType.prototype, ChildNode); + + +/***/ }), + +/***/ 67262: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Element; + +var xml = __webpack_require__(871); +var utils = __webpack_require__(91995); +var NAMESPACE = utils.NAMESPACE; +var attributes = __webpack_require__(57673); +var Node = __webpack_require__(20576); +var NodeList = __webpack_require__(45192); +var NodeUtils = __webpack_require__(80859); +var FilteredElementList = __webpack_require__(80339); +var DOMException = __webpack_require__(58149); +var DOMTokenList = __webpack_require__(64365); +var select = __webpack_require__(5056); +var ContainerNode = __webpack_require__(88277); +var ChildNode = __webpack_require__(13168); +var NonDocumentTypeChildNode = __webpack_require__(39804); +var NamedNodeMap = __webpack_require__(49); + +var uppercaseCache = Object.create(null); + +function Element(doc, localName, namespaceURI, prefix) { + ContainerNode.call(this); + this.nodeType = Node.ELEMENT_NODE; + this.ownerDocument = doc; + this.localName = localName; + this.namespaceURI = namespaceURI; + this.prefix = prefix; + this._tagName = undefined; + + // These properties maintain the set of attributes + this._attrsByQName = Object.create(null); // The qname->Attr map + this._attrsByLName = Object.create(null); // The ns|lname->Attr map + this._attrKeys = []; // attr index -> ns|lname +} + +function recursiveGetText(node, a) { + if (node.nodeType === Node.TEXT_NODE) { + a.push(node._data); + } + else { + for(var i = 0, n = node.childNodes.length; i < n; i++) + recursiveGetText(node.childNodes[i], a); + } +} + +Element.prototype = Object.create(ContainerNode.prototype, { + isHTML: { get: function isHTML() { + return this.namespaceURI === NAMESPACE.HTML && this.ownerDocument.isHTML; + }}, + tagName: { get: function tagName() { + if (this._tagName === undefined) { + var tn; + if (this.prefix === null) { + tn = this.localName; + } else { + tn = this.prefix + ':' + this.localName; + } + if (this.isHTML) { + var up = uppercaseCache[tn]; + if (!up) { + // Converting to uppercase can be slow, so cache the conversion. + uppercaseCache[tn] = up = utils.toASCIIUpperCase(tn); + } + tn = up; + } + this._tagName = tn; + } + return this._tagName; + }}, + nodeName: { get: function() { return this.tagName; }}, + nodeValue: { + get: function() { + return null; + }, + set: function() {} + }, + textContent: { + get: function() { + var strings = []; + recursiveGetText(this, strings); + return strings.join(''); + }, + set: function(newtext) { + this.removeChildren(); + if (newtext !== null && newtext !== undefined && newtext !== '') { + this._appendChild(this.ownerDocument.createTextNode(newtext)); + } + } + }, + innerText: { + get: function() { + var strings = []; + recursiveGetText(this, strings); + // Strip and collapse whitespace + // This doesn't 100% match the browser behavior, + // but should cover most of the cases. This is also similar to + // how Angular's renderer used to work: the `textContent` and `innerText` + // were almost equivalent from the renderer perspective. + // See: https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent#differences_from_innertext + return strings.join('').replace(/[ \t\n\f\r]+/g, ' ').trim(); + }, + set: function(newtext) { + this.removeChildren(); + if (newtext !== null && newtext !== undefined && newtext !== '') { + this._appendChild(this.ownerDocument.createTextNode(newtext)); + } + } + }, + innerHTML: { + get: function() { + return this.serialize(); + }, + set: utils.nyi + }, + outerHTML: { + get: function() { + // "the attribute must return the result of running the HTML fragment + // serialization algorithm on a fictional node whose only child is + // the context object" + // + // The serialization logic is intentionally implemented in a separate + // `NodeUtils` helper instead of the more obvious choice of a private + // `_serializeOne()` method on the `Node.prototype` in order to avoid + // the megamorphic `this._serializeOne` property access, which reduces + // performance unnecessarily. If you need specialized behavior for a + // certain subclass, you'll need to implement that in `NodeUtils`. + // See https://github.com/fgnass/domino/pull/142 for more information. + return NodeUtils.serializeOne(this, { nodeType: 0 }); + }, + set: function(v) { + var document = this.ownerDocument; + var parent = this.parentNode; + if (parent === null) { return; } + if (parent.nodeType === Node.DOCUMENT_NODE) { + utils.NoModificationAllowedError(); + } + if (parent.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + parent = parent.ownerDocument.createElement("body"); + } + var parser = document.implementation.mozHTMLParser( + document._address, + parent + ); + parser.parse(v===null?'':String(v), true); + this.replaceWith(parser._asDocumentFragment()); + }, + }, + + _insertAdjacent: { value: function _insertAdjacent(position, node) { + var first = false; + switch(position) { + case 'beforebegin': + first = true; + /* falls through */ + case 'afterend': + var parent = this.parentNode; + if (parent === null) { return null; } + return parent.insertBefore(node, first ? this : this.nextSibling); + case 'afterbegin': + first = true; + /* falls through */ + case 'beforeend': + return this.insertBefore(node, first ? this.firstChild : null); + default: + return utils.SyntaxError(); + } + }}, + + insertAdjacentElement: { value: function insertAdjacentElement(position, element) { + if (element.nodeType !== Node.ELEMENT_NODE) { + throw new TypeError('not an element'); + } + position = utils.toASCIILowerCase(String(position)); + return this._insertAdjacent(position, element); + }}, + + insertAdjacentText: { value: function insertAdjacentText(position, data) { + var textNode = this.ownerDocument.createTextNode(data); + position = utils.toASCIILowerCase(String(position)); + this._insertAdjacent(position, textNode); + // "This method returns nothing because it existed before we had a chance + // to design it." + }}, + + insertAdjacentHTML: { value: function insertAdjacentHTML(position, text) { + position = utils.toASCIILowerCase(String(position)); + text = String(text); + var context; + switch(position) { + case 'beforebegin': + case 'afterend': + context = this.parentNode; + if (context === null || context.nodeType === Node.DOCUMENT_NODE) { + utils.NoModificationAllowedError(); + } + break; + case 'afterbegin': + case 'beforeend': + context = this; + break; + default: + utils.SyntaxError(); + } + if ( (!(context instanceof Element)) || ( + context.ownerDocument.isHTML && + context.localName === 'html' && + context.namespaceURI === NAMESPACE.HTML + ) ) { + context = context.ownerDocument.createElementNS(NAMESPACE.HTML, 'body'); + } + var parser = this.ownerDocument.implementation.mozHTMLParser( + this.ownerDocument._address, context + ); + parser.parse(text, true); + this._insertAdjacent(position, parser._asDocumentFragment()); + }}, + + children: { get: function() { + if (!this._children) { + this._children = new ChildrenCollection(this); + } + return this._children; + }}, + + attributes: { get: function() { + if (!this._attributes) { + this._attributes = new AttributesArray(this); + } + return this._attributes; + }}, + + + firstElementChild: { get: function() { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + return null; + }}, + + lastElementChild: { get: function() { + for (var kid = this.lastChild; kid !== null; kid = kid.previousSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + return null; + }}, + + childElementCount: { get: function() { + return this.children.length; + }}, + + + // Return the next element, in source order, after this one or + // null if there are no more. If root element is specified, + // then don't traverse beyond its subtree. + // + // This is not a DOM method, but is convenient for + // lazy traversals of the tree. + nextElement: { value: function(root) { + if (!root) root = this.ownerDocument.documentElement; + var next = this.firstElementChild; + if (!next) { + // don't use sibling if we're at root + if (this===root) return null; + next = this.nextElementSibling; + } + if (next) return next; + + // If we can't go down or across, then we have to go up + // and across to the parent sibling or another ancestor's + // sibling. Be careful, though: if we reach the root + // element, or if we reach the documentElement, then + // the traversal ends. + for(var parent = this.parentElement; + parent && parent !== root; + parent = parent.parentElement) { + + next = parent.nextElementSibling; + if (next) return next; + } + + return null; + }}, + + // XXX: + // Tests are currently failing for this function. + // Awaiting resolution of: + // http://lists.w3.org/Archives/Public/www-dom/2011JulSep/0016.html + getElementsByTagName: { value: function getElementsByTagName(lname) { + var filter; + if (!lname) return new NodeList(); + if (lname === '*') + filter = function() { return true; }; + else if (this.isHTML) + filter = htmlLocalNameElementFilter(lname); + else + filter = localNameElementFilter(lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByTagNameNS: { value: function getElementsByTagNameNS(ns, lname){ + var filter; + if (ns === '*' && lname === '*') + filter = function() { return true; }; + else if (ns === '*') + filter = localNameElementFilter(lname); + else if (lname === '*') + filter = namespaceElementFilter(ns); + else + filter = namespaceLocalNameElementFilter(ns, lname); + + return new FilteredElementList(this, filter); + }}, + + getElementsByClassName: { value: function getElementsByClassName(names){ + names = String(names).trim(); + if (names === '') { + var result = new NodeList(); // Empty node list + return result; + } + names = names.split(/[ \t\r\n\f]+/); // Split on ASCII whitespace + return new FilteredElementList(this, classNamesElementFilter(names)); + }}, + + getElementsByName: { value: function getElementsByName(name) { + return new FilteredElementList(this, elementNameFilter(String(name))); + }}, + + // Utility methods used by the public API methods above + clone: { value: function clone() { + var e; + + // XXX: + // Modify this to use the constructor directly or + // avoid error checking in some other way. In case we try + // to clone an invalid node that the parser inserted. + // + if (this.namespaceURI !== NAMESPACE.HTML || this.prefix || !this.ownerDocument.isHTML) { + e = this.ownerDocument.createElementNS( + this.namespaceURI, (this.prefix !== null) ? + (this.prefix + ':' + this.localName) : this.localName + ); + } else { + e = this.ownerDocument.createElement(this.localName); + } + + for(var i = 0, n = this._attrKeys.length; i < n; i++) { + var lname = this._attrKeys[i]; + var a = this._attrsByLName[lname]; + var b = a.cloneNode(); + b._setOwnerElement(e); + e._attrsByLName[lname] = b; + e._addQName(b); + } + e._attrKeys = this._attrKeys.concat(); + + return e; + }}, + + isEqual: { value: function isEqual(that) { + if (this.localName !== that.localName || + this.namespaceURI !== that.namespaceURI || + this.prefix !== that.prefix || + this._numattrs !== that._numattrs) + return false; + + // Compare the sets of attributes, ignoring order + // and ignoring attribute prefixes. + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (!that.hasAttributeNS(a.namespaceURI, a.localName)) + return false; + if (that.getAttributeNS(a.namespaceURI,a.localName) !== a.value) + return false; + } + + return true; + }}, + + // This is the 'locate a namespace prefix' algorithm from the + // DOM specification. It is used by Node.lookupPrefix() + // (Be sure to compare DOM3 and DOM4 versions of spec.) + _lookupNamespacePrefix: { value: function _lookupNamespacePrefix(ns, originalElement) { + if ( + this.namespaceURI && + this.namespaceURI === ns && + this.prefix !== null && + originalElement.lookupNamespaceURI(this.prefix) === ns + ) { + return this.prefix; + } + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if ( + a.prefix === 'xmlns' && + a.value === ns && + originalElement.lookupNamespaceURI(a.localName) === ns + ) { + return a.localName; + } + } + + var parent = this.parentElement; + return parent ? parent._lookupNamespacePrefix(ns, originalElement) : null; + }}, + + // This is the 'locate a namespace' algorithm for Element nodes + // from the DOM Core spec. It is used by Node#lookupNamespaceURI() + lookupNamespaceURI: { value: function lookupNamespaceURI(prefix) { + if (prefix === '' || prefix === undefined) { prefix = null; } + if (this.namespaceURI !== null && this.prefix === prefix) + return this.namespaceURI; + + for(var i = 0, n = this._numattrs; i < n; i++) { + var a = this._attr(i); + if (a.namespaceURI === NAMESPACE.XMLNS) { + if ( + (a.prefix === 'xmlns' && a.localName === prefix) || + (prefix === null && a.prefix === null && a.localName === 'xmlns') + ) { + return a.value || null; + } + } + } + + var parent = this.parentElement; + return parent ? parent.lookupNamespaceURI(prefix) : null; + }}, + + // + // Attribute handling methods and utilities + // + + /* + * Attributes in the DOM are tricky: + * + * - there are the 8 basic get/set/has/removeAttribute{NS} methods + * + * - but many HTML attributes are also 'reflected' through IDL + * attributes which means that they can be queried and set through + * regular properties of the element. There is just one attribute + * value, but two ways to get and set it. + * + * - Different HTML element types have different sets of reflected + attributes. + * + * - attributes can also be queried and set through the .attributes + * property of an element. This property behaves like an array of + * Attr objects. The value property of each Attr is writeable, so + * this is a third way to read and write attributes. + * + * - for efficiency, we really want to store attributes in some kind + * of name->attr map. But the attributes[] array is an array, not a + * map, which is kind of unnatural. + * + * - When using namespaces and prefixes, and mixing the NS methods + * with the non-NS methods, it is apparently actually possible for + * an attributes[] array to have more than one attribute with the + * same qualified name. And certain methods must operate on only + * the first attribute with such a name. So for these methods, an + * inefficient array-like data structure would be easier to + * implement. + * + * - The attributes[] array is live, not a snapshot, so changes to the + * attributes must be immediately visible through existing arrays. + * + * - When attributes are queried and set through IDL properties + * (instead of the get/setAttributes() method or the attributes[] + * array) they may be subject to type conversions, URL + * normalization, etc., so some extra processing is required in that + * case. + * + * - But access through IDL properties is probably the most common + * case, so we'd like that to be as fast as possible. + * + * - We can't just store attribute values in their parsed idl form, + * because setAttribute() has to return whatever string is passed to + * getAttribute even if it is not a legal, parseable value. So + * attribute values must be stored in unparsed string form. + * + * - We need to be able to send change notifications or mutation + * events of some sort to the renderer whenever an attribute value + * changes, regardless of the way in which it changes. + * + * - Some attributes, such as id and class affect other parts of the + * DOM API, like getElementById and getElementsByClassName and so + * for efficiency, we need to specially track changes to these + * special attributes. + * + * - Some attributes like class have different names (className) when + * reflected. + * + * - Attributes whose names begin with the string 'data-' are treated + specially. + * + * - Reflected attributes that have a boolean type in IDL have special + * behavior: setting them to false (in IDL) is the same as removing + * them with removeAttribute() + * + * - numeric attributes (like HTMLElement.tabIndex) can have default + * values that must be returned by the idl getter even if the + * content attribute does not exist. (The default tabIndex value + * actually varies based on the type of the element, so that is a + * tricky one). + * + * See + * http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflect + * for rules on how attributes are reflected. + * + */ + + getAttribute: { value: function getAttribute(qname) { + var attr = this.getAttributeNode(qname); + return attr ? attr.value : null; + }}, + + getAttributeNS: { value: function getAttributeNS(ns, lname) { + var attr = this.getAttributeNodeNS(ns, lname); + return attr ? attr.value : null; + }}, + + getAttributeNode: { value: function getAttributeNode(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + var attr = this._attrsByQName[qname]; + if (!attr) return null; + + if (Array.isArray(attr)) // If there is more than one + attr = attr[0]; // use the first + + return attr; + }}, + + getAttributeNodeNS: { value: function getAttributeNodeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var attr = this._attrsByLName[ns + '|' + lname]; + return attr ? attr : null; + }}, + + hasAttribute: { value: function hasAttribute(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + return this._attrsByQName[qname] !== undefined; + }}, + + hasAttributeNS: { value: function hasAttributeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var key = ns + '|' + lname; + return this._attrsByLName[key] !== undefined; + }}, + + hasAttributes: { value: function hasAttributes() { + return this._numattrs > 0; + }}, + + toggleAttribute: { value: function toggleAttribute(qname, force) { + qname = String(qname); + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + var a = this._attrsByQName[qname]; + if (a === undefined) { + if (force === undefined || force === true) { + this._setAttribute(qname, ''); + return true; + } + return false; + } else { + if (force === undefined || force === false) { + this.removeAttribute(qname); + return false; + } + return true; + } + }}, + + // Set the attribute without error checking. The parser uses this. + _setAttribute: { value: function _setAttribute(qname, value) { + // XXX: the spec says that this next search should be done + // on the local name, but I think that is an error. + // email pending on www-dom about it. + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + else { + if (Array.isArray(attr)) attr = attr[0]; + } + + // Now set the attribute value on the new or existing Attr object. + // The Attr.value setter method handles mutation events, etc. + attr.value = value; + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Check for errors, and then set the attribute + setAttribute: { value: function setAttribute(qname, value) { + qname = String(qname); + if (!xml.isValidName(qname)) utils.InvalidCharacterError(); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + this._setAttribute(qname, String(value)); + }}, + + + // The version with no error checking used by the parser + _setAttributeNS: { value: function _setAttributeNS(ns, qname, value) { + var pos = qname.indexOf(':'), prefix, lname; + if (pos < 0) { + prefix = null; + lname = qname; + } + else { + prefix = qname.substring(0, pos); + lname = qname.substring(pos+1); + } + + if (ns === '' || ns === undefined) ns = null; + var key = (ns === null ? '' : ns) + '|' + lname; + + var attr = this._attrsByLName[key]; + var isnew; + if (!attr) { + attr = new Attr(this, lname, prefix, ns); + isnew = true; + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + + // We also have to make the attr searchable by qname. + // But we have to be careful because there may already + // be an attr with this qname. + this._addQName(attr); + } + else if (false /* changed in DOM 4 */) {} + attr.value = value; // Automatically sends mutation event + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Do error checking then call _setAttributeNS + setAttributeNS: { value: function setAttributeNS(ns, qname, value) { + // Convert parameter types according to WebIDL + ns = (ns === null || ns === undefined || ns === '') ? null : String(ns); + qname = String(qname); + if (!xml.isValidQName(qname)) utils.InvalidCharacterError(); + + var pos = qname.indexOf(':'); + var prefix = (pos < 0) ? null : qname.substring(0, pos); + + if ((prefix !== null && ns === null) || + (prefix === 'xml' && ns !== NAMESPACE.XML) || + ((qname === 'xmlns' || prefix === 'xmlns') && + (ns !== NAMESPACE.XMLNS)) || + (ns === NAMESPACE.XMLNS && + !(qname === 'xmlns' || prefix === 'xmlns'))) + utils.NamespaceError(); + + this._setAttributeNS(ns, qname, String(value)); + }}, + + setAttributeNode: { value: function setAttributeNode(attr) { + if (attr.ownerElement !== null && attr.ownerElement !== this) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + var result = null; + var oldAttrs = this._attrsByQName[attr.name]; + if (oldAttrs) { + if (!Array.isArray(oldAttrs)) { oldAttrs = [ oldAttrs ]; } + if (oldAttrs.some(function(a) { return a===attr; })) { + return attr; + } else if (attr.ownerElement !== null) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + oldAttrs.forEach(function(a) { this.removeAttributeNode(a); }, this); + result = oldAttrs[0]; + } + this.setAttributeNodeNS(attr); + return result; + }}, + + setAttributeNodeNS: { value: function setAttributeNodeNS(attr) { + if (attr.ownerElement !== null) { + throw new DOMException(DOMException.INUSE_ATTRIBUTE_ERR); + } + var ns = attr.namespaceURI; + var key = (ns === null ? '' : ns) + '|' + attr.localName; + var oldAttr = this._attrsByLName[key]; + if (oldAttr) { this.removeAttributeNode(oldAttr); } + attr._setOwnerElement(this); + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + this._addQName(attr); + if (this._newattrhook) this._newattrhook(attr.name, attr.value); + return oldAttr || null; + }}, + + removeAttribute: { value: function removeAttribute(qname) { + qname = String(qname); + if (/[A-Z]/.test(qname) && this.isHTML) + qname = utils.toASCIILowerCase(qname); + + var attr = this._attrsByQName[qname]; + if (!attr) return; + + // If there is more than one match for this qname + // so don't delete the qname mapping, just remove the first + // element from it. + if (Array.isArray(attr)) { + if (attr.length > 2) { + attr = attr.shift(); // remove it from the array + } + else { + this._attrsByQName[qname] = attr[1]; + attr = attr[0]; + } + } + else { + // only a single match, so remove the qname mapping + this._attrsByQName[qname] = undefined; + } + + var ns = attr.namespaceURI; + // Now attr is the removed attribute. Figure out its + // ns+lname key and remove it from the other mapping as well. + var key = (ns === null ? '' : ns) + '|' + attr.localName; + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + if (this._attributes) { + Array.prototype.splice.call(this._attributes, i, 1); + this._attributes[qname] = undefined; + } + this._attrKeys.splice(i, 1); + + // Onchange handler for the attribute + var onchange = attr.onchange; + attr._setOwnerElement(null); + if (onchange) { + onchange.call(attr, this, attr.localName, attr.value, null); + } + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + removeAttributeNS: { value: function removeAttributeNS(ns, lname) { + ns = (ns === undefined || ns === null) ? '' : String(ns); + lname = String(lname); + var key = ns + '|' + lname; + var attr = this._attrsByLName[key]; + if (!attr) return; + + this._attrsByLName[key] = undefined; + + var i = this._attrKeys.indexOf(key); + if (this._attributes) { + Array.prototype.splice.call(this._attributes, i, 1); + } + this._attrKeys.splice(i, 1); + + // Now find the same Attr object in the qname mapping and remove it + // But be careful because there may be more than one match. + this._removeQName(attr); + + // Onchange handler for the attribute + var onchange = attr.onchange; + attr._setOwnerElement(null); + if (onchange) { + onchange.call(attr, this, attr.localName, attr.value, null); + } + // Mutation event + if (this.rooted) this.ownerDocument.mutateRemoveAttr(attr); + }}, + + removeAttributeNode: { value: function removeAttributeNode(attr) { + var ns = attr.namespaceURI; + var key = (ns === null ? '' : ns) + '|' + attr.localName; + if (this._attrsByLName[key] !== attr) { + utils.NotFoundError(); + } + this.removeAttributeNS(ns, attr.localName); + return attr; + }}, + + getAttributeNames: { value: function getAttributeNames() { + var elt = this; + return this._attrKeys.map(function(key) { + return elt._attrsByLName[key].name; + }); + }}, + + // This 'raw' version of getAttribute is used by the getter functions + // of reflected attributes. It skips some error checking and + // namespace steps + _getattr: { value: function _getattr(qname) { + // Assume that qname is already lowercased, so don't do it here. + // Also don't check whether attr is an array: a qname with no + // prefix will never have two matching Attr objects (because + // setAttributeNS doesn't allow a non-null namespace with a + // null prefix. + var attr = this._attrsByQName[qname]; + return attr ? attr.value : null; + }}, + + // The raw version of setAttribute for reflected idl attributes. + _setattr: { value: function _setattr(qname, value) { + var attr = this._attrsByQName[qname]; + var isnew; + if (!attr) { + attr = this._newattr(qname); + isnew = true; + } + attr.value = String(value); + if (this._attributes) this._attributes[qname] = attr; + if (isnew && this._newattrhook) this._newattrhook(qname, value); + }}, + + // Create a new Attr object, insert it, and return it. + // Used by setAttribute() and by set() + _newattr: { value: function _newattr(qname) { + var attr = new Attr(this, qname, null, null); + var key = '|' + qname; + this._attrsByQName[qname] = attr; + this._attrsByLName[key] = attr; + if (this._attributes) { + this._attributes[this._attrKeys.length] = attr; + } + this._attrKeys.push(key); + return attr; + }}, + + // Add a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _addQName: { value: function(attr) { + var qname = attr.name; + var existing = this._attrsByQName[qname]; + if (!existing) { + this._attrsByQName[qname] = attr; + } + else if (Array.isArray(existing)) { + existing.push(attr); + } + else { + this._attrsByQName[qname] = [existing, attr]; + } + if (this._attributes) this._attributes[qname] = attr; + }}, + + // Remove a qname->Attr mapping to the _attrsByQName object, taking into + // account that there may be more than one attr object with the + // same qname + _removeQName: { value: function(attr) { + var qname = attr.name; + var target = this._attrsByQName[qname]; + + if (Array.isArray(target)) { + var idx = target.indexOf(attr); + utils.assert(idx !== -1); // It must be here somewhere + if (target.length === 2) { + this._attrsByQName[qname] = target[1-idx]; + if (this._attributes) { + this._attributes[qname] = this._attrsByQName[qname]; + } + } else { + target.splice(idx, 1); + if (this._attributes && this._attributes[qname] === attr) { + this._attributes[qname] = target[0]; + } + } + } + else { + utils.assert(target === attr); // If only one, it must match + this._attrsByQName[qname] = undefined; + if (this._attributes) { + this._attributes[qname] = undefined; + } + } + }}, + + // Return the number of attributes + _numattrs: { get: function() { return this._attrKeys.length; }}, + // Return the nth Attr object + _attr: { value: function(n) { + return this._attrsByLName[this._attrKeys[n]]; + }}, + + // Define getters and setters for an 'id' property that reflects + // the content attribute 'id'. + id: attributes.property({name: 'id'}), + + // Define getters and setters for a 'className' property that reflects + // the content attribute 'class'. + className: attributes.property({name: 'class'}), + + classList: { get: function() { + var self = this; + if (this._classList) { + return this._classList; + } + var dtlist = new DOMTokenList( + function() { + return self.className || ""; + }, + function(v) { + self.className = v; + } + ); + this._classList = dtlist; + return dtlist; + }, set: function(v) { this.className = v; }}, + + matches: { value: function(selector) { + return select.matches(this, selector); + }}, + + closest: { value: function(selector) { + var el = this; + do { + if (el.matches && el.matches(selector)) { return el; } + el = el.parentElement || el.parentNode; + } while (el !== null && el.nodeType === Node.ELEMENT_NODE); + return null; + }}, + + querySelector: { value: function(selector) { + return select(selector, this)[0]; + }}, + + querySelectorAll: { value: function(selector) { + var nodes = select(selector, this); + return nodes.item ? nodes : new NodeList(nodes); + }} + +}); + +Object.defineProperties(Element.prototype, ChildNode); +Object.defineProperties(Element.prototype, NonDocumentTypeChildNode); + +// Register special handling for the id attribute +attributes.registerChangeHandler(Element, 'id', + function(element, lname, oldval, newval) { + if (element.rooted) { + if (oldval) { + element.ownerDocument.delId(oldval, element); + } + if (newval) { + element.ownerDocument.addId(newval, element); + } + } + } +); +attributes.registerChangeHandler(Element, 'class', + function(element, lname, oldval, newval) { + if (element._classList) { element._classList._update(); } + } +); + +// The Attr class represents a single attribute. The values in +// _attrsByQName and _attrsByLName are instances of this class. +function Attr(elt, lname, prefix, namespace, value) { + // localName and namespace are constant for any attr object. + // But value may change. And so can prefix, and so, therefore can name. + this.localName = lname; + this.prefix = (prefix===null || prefix==='') ? null : ('' + prefix); + this.namespaceURI = (namespace===null || namespace==='') ? null : ('' + namespace); + this.data = value; + // Set ownerElement last to ensure it is hooked up to onchange handler + this._setOwnerElement(elt); +} + +// In DOM 3 Attr was supposed to extend Node; in DOM 4 that was abandoned. +Attr.prototype = Object.create(Object.prototype, { + ownerElement: { + get: function() { return this._ownerElement; }, + }, + _setOwnerElement: { value: function _setOwnerElement(elt) { + this._ownerElement = elt; + if (this.prefix === null && this.namespaceURI === null && elt) { + this.onchange = elt._attributeChangeHandlers[this.localName]; + } else { + this.onchange = null; + } + }}, + + name: { get: function() { + return this.prefix ? this.prefix + ':' + this.localName : this.localName; + }}, + + specified: { get: function() { + // Deprecated + return true; + }}, + + value: { + get: function() { + return this.data; + }, + set: function(value) { + var oldval = this.data; + value = (value === undefined) ? '' : value + ''; + if (value === oldval) return; + + this.data = value; + + // Run the onchange hook for the attribute + // if there is one. + if (this.ownerElement) { + if (this.onchange) + this.onchange(this.ownerElement,this.localName, oldval, value); + + // Generate a mutation event if the element is rooted + if (this.ownerElement.rooted) + this.ownerElement.ownerDocument.mutateAttr(this, oldval); + } + }, + }, + + cloneNode: { value: function cloneNode(deep) { + // Both this method and Document#createAttribute*() create unowned Attrs + return new Attr( + null, this.localName, this.prefix, this.namespaceURI, this.data + ); + }}, + + // Legacy aliases (see gh#70 and https://dom.spec.whatwg.org/#interface-attr) + nodeType: { get: function() { return Node.ATTRIBUTE_NODE; } }, + nodeName: { get: function() { return this.name; } }, + nodeValue: { + get: function() { return this.value; }, + set: function(v) { this.value = v; }, + }, + textContent: { + get: function() { return this.value; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } + this.value = v; + }, + }, + innerText: { + get: function() { return this.value; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } + this.value = v; + }, + }, +}); +// Sneakily export this class for use by Document.createAttribute() +Element._Attr = Attr; + +// The attributes property of an Element will be an instance of this class. +// This class is really just a dummy, though. It only defines a length +// property and an item() method. The AttrArrayProxy that +// defines the public API just uses the Element object itself. +function AttributesArray(elt) { + NamedNodeMap.call(this, elt); + for (var name in elt._attrsByQName) { + this[name] = elt._attrsByQName[name]; + } + for (var i = 0; i < elt._attrKeys.length; i++) { + this[i] = elt._attrsByLName[elt._attrKeys[i]]; + } +} +AttributesArray.prototype = Object.create(NamedNodeMap.prototype, { + length: { get: function() { + return this.element._attrKeys.length; + }, set: function() { /* ignore */ } }, + item: { value: function(n) { + /* jshint bitwise: false */ + n = n >>> 0; + if (n >= this.length) { return null; } + return this.element._attrsByLName[this.element._attrKeys[n]]; + /* jshint bitwise: true */ + } }, +}); + +// We can't make direct array access work (without Proxies, node >=6) +// but we can make `Array.from(node.attributes)` and for-of loops work. +if (globalThis.Symbol?.iterator) { + AttributesArray.prototype[globalThis.Symbol.iterator] = function() { + var i=0, n=this.length, self=this; + return { + next: function() { + if (ielement map. + // It is not part of the HTMLCollection API, but we need it in + // src/HTMLCollectionProxy + namedItems: { get: function() { + this.updateCache(); + return this.childrenByName; + } }, + + updateCache: { value: function updateCache() { + var namedElts = /^(a|applet|area|embed|form|frame|frameset|iframe|img|object)$/; + if (this.lastModTime !== this.element.lastModTime) { + this.lastModTime = this.element.lastModTime; + + var n = this.childrenByNumber && this.childrenByNumber.length || 0; + for(var i = 0; i < n; i++) { + this[i] = undefined; + } + + this.childrenByNumber = []; + this.childrenByName = Object.create(null); + + for (var c = this.element.firstChild; c !== null; c = c.nextSibling) { + if (c.nodeType === Node.ELEMENT_NODE) { + + this[this.childrenByNumber.length] = c; + this.childrenByNumber.push(c); + + // XXX Are there any requirements about the namespace + // of the id property? + var id = c.getAttribute('id'); + + // If there is an id that is not already in use... + if (id && !this.childrenByName[id]) + this.childrenByName[id] = c; + + // For certain HTML elements we check the name attribute + var name = c.getAttribute('name'); + if (name && + this.element.namespaceURI === NAMESPACE.HTML && + namedElts.test(this.element.localName) && + !this.childrenByName[name]) + this.childrenByName[id] = c; + } + } + } + } }, +}); + +// These functions return predicates for filtering elements. +// They're used by the Document and Element classes for methods like +// getElementsByTagName and getElementsByClassName + +function localNameElementFilter(lname) { + return function(e) { return e.localName === lname; }; +} + +function htmlLocalNameElementFilter(lname) { + var lclname = utils.toASCIILowerCase(lname); + if (lclname === lname) + return localNameElementFilter(lname); + + return function(e) { + return e.isHTML ? e.localName === lclname : e.localName === lname; + }; +} + +function namespaceElementFilter(ns) { + return function(e) { return e.namespaceURI === ns; }; +} + +function namespaceLocalNameElementFilter(ns, lname) { + return function(e) { + return e.namespaceURI === ns && e.localName === lname; + }; +} + +function classNamesElementFilter(names) { + return function(e) { + return names.every(function(n) { return e.classList.contains(n); }); + }; +} + +function elementNameFilter(name) { + return function(e) { + // All the *HTML elements* in the document with the given name attribute + if (e.namespaceURI !== NAMESPACE.HTML) { return false; } + return e.getAttribute('name') === name; + }; +} + + +/***/ }), + +/***/ 79778: +/***/ ((module) => { + +"use strict"; + +module.exports = Event; + +Event.CAPTURING_PHASE = 1; +Event.AT_TARGET = 2; +Event.BUBBLING_PHASE = 3; + +function Event(type, dictionary) { + // Initialize basic event properties + this.type = ''; + this.target = null; + this.currentTarget = null; + this.eventPhase = Event.AT_TARGET; + this.bubbles = false; + this.cancelable = false; + this.isTrusted = false; + this.defaultPrevented = false; + this.timeStamp = Date.now(); + + // Initialize internal flags + // XXX: Would it be better to inherit these defaults from the prototype? + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this._initialized = true; + this._dispatching = false; + + // Now initialize based on the constructor arguments (if any) + if (type) this.type = type; + if (dictionary) { + for(var p in dictionary) { + this[p] = dictionary[p]; + } + } +} + +Event.prototype = Object.create(Object.prototype, { + constructor: { value: Event }, + stopPropagation: { value: function stopPropagation() { + this._propagationStopped = true; + }}, + + stopImmediatePropagation: { value: function stopImmediatePropagation() { + this._propagationStopped = true; + this._immediatePropagationStopped = true; + }}, + + preventDefault: { value: function preventDefault() { + if (this.cancelable) this.defaultPrevented = true; + }}, + + initEvent: { value: function initEvent(type, bubbles, cancelable) { + this._initialized = true; + if (this._dispatching) return; + + this._propagationStopped = false; + this._immediatePropagationStopped = false; + this.defaultPrevented = false; + this.isTrusted = false; + + this.target = null; + this.type = type; + this.bubbles = bubbles; + this.cancelable = cancelable; + }}, + +}); + + +/***/ }), + +/***/ 91283: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Event = __webpack_require__(79778); +var MouseEvent = __webpack_require__(6421); +var utils = __webpack_require__(91995); + +module.exports = EventTarget; + +function EventTarget() {} + +EventTarget.prototype = { + // XXX + // See WebIDL §4.8 for details on object event handlers + // and how they should behave. We actually have to accept + // any object to addEventListener... Can't type check it. + // on registration. + + // XXX: + // Capturing event listeners are sort of rare. I think I can optimize + // them so that dispatchEvent can skip the capturing phase (or much of + // it). Each time a capturing listener is added, increment a flag on + // the target node and each of its ancestors. Decrement when removed. + // And update the counter when nodes are added and removed from the + // tree as well. Then, in dispatch event, the capturing phase can + // abort if it sees any node with a zero count. + addEventListener: function addEventListener(type, listener, capture) { + if (!listener) return; + if (capture === undefined) capture = false; + if (!this._listeners) this._listeners = Object.create(null); + if (!this._listeners[type]) this._listeners[type] = []; + var list = this._listeners[type]; + + // If this listener has already been registered, just return + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) + return; + } + + // Add an object to the list of listeners + var obj = { listener: listener, capture: capture }; + if (typeof listener === 'function') obj.f = listener; + list.push(obj); + }, + + removeEventListener: function removeEventListener(type, + listener, + capture) { + if (capture === undefined) capture = false; + if (this._listeners) { + var list = this._listeners[type]; + if (list) { + // Find the listener in the list and remove it + for(var i = 0, n = list.length; i < n; i++) { + var l = list[i]; + if (l.listener === listener && l.capture === capture) { + if (list.length === 1) { + this._listeners[type] = undefined; + } + else { + list.splice(i, 1); + } + return; + } + } + } + } + }, + + // This is the public API for dispatching untrusted public events. + // See _dispatchEvent for the implementation + dispatchEvent: function dispatchEvent(event) { + // Dispatch an untrusted event + return this._dispatchEvent(event, false); + }, + + // + // See DOMCore §4.4 + // XXX: I'll probably need another version of this method for + // internal use, one that does not set isTrusted to false. + // XXX: see Document._dispatchEvent: perhaps that and this could + // call a common internal function with different settings of + // a trusted boolean argument + // + // XXX: + // The spec has changed in how to deal with handlers registered + // on idl or content attributes rather than with addEventListener. + // Used to say that they always ran first. That's how webkit does it + // Spec now says that they run in a position determined by + // when they were first set. FF does it that way. See: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/webappapis.html#event-handlers + // + _dispatchEvent: function _dispatchEvent(event, trusted) { + if (typeof trusted !== 'boolean') trusted = false; + function invoke(target, event) { + var type = event.type, phase = event.eventPhase; + event.currentTarget = target; + + // If there was an individual handler defined, invoke it first + // XXX: see comment above: this shouldn't always be first. + if (phase !== Event.CAPTURING_PHASE && + target._handlers && target._handlers[type]) + { + var handler = target._handlers[type]; + var rv; + if (typeof handler === 'function') { + rv=handler.call(event.currentTarget, event); + } + else { + var f = handler.handleEvent; + if (typeof f !== 'function') + throw new TypeError('handleEvent property of ' + + 'event handler object is' + + 'not a function.'); + rv=f.call(handler, event); + } + + switch(event.type) { + case 'mouseover': + if (rv === true) // Historical baggage + event.preventDefault(); + break; + case 'beforeunload': + // XXX: eventually we need a special case here + /* falls through */ + default: + if (rv === false) + event.preventDefault(); + break; + } + } + + // Now invoke list list of listeners for this target and type + var list = target._listeners && target._listeners[type]; + if (!list) return; + list = list.slice(); + for(var i = 0, n = list.length; i < n; i++) { + if (event._immediatePropagationStopped) return; + var l = list[i]; + if ((phase === Event.CAPTURING_PHASE && !l.capture) || + (phase === Event.BUBBLING_PHASE && l.capture)) + continue; + if (l.f) { + l.f.call(event.currentTarget, event); + } + else { + var fn = l.listener.handleEvent; + if (typeof fn !== 'function') + throw new TypeError('handleEvent property of event listener object is not a function.'); + fn.call(l.listener, event); + } + } + } + + if (!event._initialized || event._dispatching) utils.InvalidStateError(); + event.isTrusted = trusted; + + // Begin dispatching the event now + event._dispatching = true; + event.target = this; + + // Build the list of targets for the capturing and bubbling phases + // XXX: we'll eventually have to add Window to this list. + var ancestors = []; + for(var n = this.parentNode; n; n = n.parentNode) + ancestors.push(n); + + // Capturing phase + event.eventPhase = Event.CAPTURING_PHASE; + for(var i = ancestors.length-1; i >= 0; i--) { + invoke(ancestors[i], event); + if (event._propagationStopped) break; + } + + // At target phase + if (!event._propagationStopped) { + event.eventPhase = Event.AT_TARGET; + invoke(this, event); + } + + // Bubbling phase + if (event.bubbles && !event._propagationStopped) { + event.eventPhase = Event.BUBBLING_PHASE; + for(var ii = 0, nn = ancestors.length; ii < nn; ii++) { + invoke(ancestors[ii], event); + if (event._propagationStopped) break; + } + } + + event._dispatching = false; + event.eventPhase = Event.AT_TARGET; + event.currentTarget = null; + + // Deal with mouse events and figure out when + // a click has happened + if (trusted && !event.defaultPrevented && event instanceof MouseEvent) { + switch(event.type) { + case 'mousedown': + this._armed = { + x: event.clientX, + y: event.clientY, + t: event.timeStamp + }; + break; + case 'mouseout': + case 'mouseover': + this._armed = null; + break; + case 'mouseup': + if (this._isClick(event)) this._doClick(event); + this._armed = null; + break; + } + } + + + + return !event.defaultPrevented; + }, + + // Determine whether a click occurred + // XXX We don't support double clicks for now + _isClick: function(event) { + return (this._armed !== null && + event.type === 'mouseup' && + event.isTrusted && + event.button === 0 && + event.timeStamp - this._armed.t < 1000 && + Math.abs(event.clientX - this._armed.x) < 10 && + Math.abs(event.clientY - this._armed.Y) < 10); + }, + + // Clicks are handled like this: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/elements.html#interactive-content-0 + // + // Note that this method is similar to the HTMLElement.click() method + // The event argument must be the trusted mouseup event + _doClick: function(event) { + if (this._click_in_progress) return; + this._click_in_progress = true; + + // Find the nearest enclosing element that is activatable + // An element is activatable if it has a + // _post_click_activation_steps hook + var activated = this; + while(activated && !activated._post_click_activation_steps) + activated = activated.parentNode; + + if (activated && activated._pre_click_activation_steps) { + activated._pre_click_activation_steps(); + } + + var click = this.ownerDocument.createEvent('MouseEvent'); + click.initMouseEvent('click', true, true, + this.ownerDocument.defaultView, 1, + event.screenX, event.screenY, + event.clientX, event.clientY, + event.ctrlKey, event.altKey, + event.shiftKey, event.metaKey, + event.button, null); + + var result = this._dispatchEvent(click, true); + + if (activated) { + if (result) { + // This is where hyperlinks get followed, for example. + if (activated._post_click_activation_steps) + activated._post_click_activation_steps(click); + } + else { + if (activated._cancelled_activation_steps) + activated._cancelled_activation_steps(); + } + } + }, + + // + // An event handler is like an event listener, but it registered + // by setting an IDL or content attribute like onload or onclick. + // There can only be one of these at a time for any event type. + // This is an internal method for the attribute accessors and + // content attribute handlers that need to register events handlers. + // The type argument is the same as in addEventListener(). + // The handler argument is the same as listeners in addEventListener: + // it can be a function or an object. Pass null to remove any existing + // handler. Handlers are always invoked before any listeners of + // the same type. They are not invoked during the capturing phase + // of event dispatch. + // + _setEventHandler: function _setEventHandler(type, handler) { + if (!this._handlers) this._handlers = Object.create(null); + this._handlers[type] = handler; + }, + + _getEventHandler: function _getEventHandler(type) { + return (this._handlers && this._handlers[type]) || null; + } + +}; + + +/***/ }), + +/***/ 80339: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = FilteredElementList; + +var Node = __webpack_require__(20576); + +// +// This file defines node list implementation that lazily traverses +// the document tree (or a subtree rooted at any element) and includes +// only those elements for which a specified filter function returns true. +// It is used to implement the +// {Document,Element}.getElementsBy{TagName,ClassName}{,NS} methods. +// +// XXX this should inherit from NodeList + +function FilteredElementList(root, filter) { + this.root = root; + this.filter = filter; + this.lastModTime = root.lastModTime; + this.done = false; + this.cache = []; + this.traverse(); +} + +FilteredElementList.prototype = Object.create(Object.prototype, { + length: { get: function() { + this.checkcache(); + if (!this.done) this.traverse(); + return this.cache.length; + } }, + + item: { value: function(n) { + this.checkcache(); + if (!this.done && n >= this.cache.length) { + // This can lead to O(N^2) behavior if we stop when we get to n + // and the caller is iterating through the items in order; so + // be sure to do the full traverse here. + this.traverse(/*n*/); + } + return this.cache[n]; + } }, + + checkcache: { value: function() { + if (this.lastModTime !== this.root.lastModTime) { + // subtree has changed, so invalidate cache + for (var i = this.cache.length-1; i>=0; i--) { + this[i] = undefined; + } + this.cache.length = 0; + this.done = false; + this.lastModTime = this.root.lastModTime; + } + } }, + + // If n is specified, then traverse the tree until we've found the nth + // item (or until we've found all items). If n is not specified, + // traverse until we've found all items. + traverse: { value: function(n) { + // increment n so we can compare to length, and so it is never falsy + if (n !== undefined) n++; + + var elt; + while ((elt = this.next()) !== null) { + this[this.cache.length] = elt; //XXX Use proxy instead + this.cache.push(elt); + if (n && this.cache.length === n) return; + } + + // no next element, so we've found everything + this.done = true; + } }, + + // Return the next element under root that matches filter + next: { value: function() { + var start = (this.cache.length === 0) ? this.root // Start at the root or at + : this.cache[this.cache.length-1]; // the last element we found + + var elt; + if (start.nodeType === Node.DOCUMENT_NODE) + elt = start.documentElement; + else + elt = start.nextElement(this.root); + + while(elt) { + if (this.filter(elt)) { + return elt; + } + + elt = elt.nextElement(this.root); + } + return null; + } }, +}); + + +/***/ }), + +/***/ 24042: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = HTMLParser; + +var Document = __webpack_require__(88097); +var DocumentType = __webpack_require__(47825); +var Node = __webpack_require__(20576); +var NAMESPACE = (__webpack_require__(91995).NAMESPACE); +var html = __webpack_require__(41537); +var impl = html.elements; + +var pushAll = Function.prototype.apply.bind(Array.prototype.push); + +/* + * This file contains an implementation of the HTML parsing algorithm. + * The algorithm and the implementation are complex because HTML + * explicitly defines how the parser should behave for all possible + * valid and invalid inputs. + * + * Usage: + * + * The file defines a single HTMLParser() function, which dom.js exposes + * publicly as document.implementation.mozHTMLParser(). This is a + * factory function, not a constructor. + * + * When you call document.implementation.mozHTMLParser(), it returns + * an object that has parse() and document() methods. To parse HTML text, + * pass the text (in one or more chunks) to the parse() method. When + * you've passed all the text (on the last chunk, or afterward) pass + * true as the second argument to parse() to tell the parser that there + * is no more coming. Call document() to get the document object that + * the parser is parsing into. You can call this at any time, before + * or after calling parse(). + * + * The first argument to mozHTMLParser is the absolute URL of the document. + * + * The second argument is optional and is for internal use only. Pass an + * element as the fragmentContext to do innerHTML parsing for the + * element. To do innerHTML parsing on a document, pass null. Otherwise, + * omit the 2nd argument. See HTMLElement.innerHTML for an example. Note + * that if you pass a context element, the end() method will return an + * unwrapped document instead of a wrapped one. + * + * Implementation details: + * + * This is a long file of almost 7000 lines. It is structured as one + * big function nested within another big function. The outer + * function defines a bunch of constant data, utility functions + * that use that data, and a couple of classes used by the parser. + * The outer function also defines and returns the + * inner function. This inner function is the HTMLParser factory + * function that implements the parser and holds all the parser state + * as local variables. The HTMLParser function is quite big because + * it defines many nested functions that use those local variables. + * + * There are three tightly coupled parser stages: a scanner, a + * tokenizer and a tree builder. In a (possibly misguided) attempt at + * efficiency, the stages are not implemented as separate classes: + * everything shares state and is (mostly) implemented in imperative + * (rather than OO) style. + * + * The stages of the parser work like this: When the client code calls + * the parser's parse() method, the specified string is passed to + * scanChars(). The scanner loops through that string and passes characters + * (sometimes one at a time, sometimes in chunks) to the tokenizer stage. + * The tokenizer groups the characters into tokens: tags, endtags, runs + * of text, comments, doctype declarations, and the end-of-file (EOF) + * token. These tokens are then passed to the tree building stage via + * the insertToken() function. The tree building stage builds up the + * document tree. + * + * The tokenizer stage is a finite state machine. Each state is + * implemented as a function with a name that ends in "_state". The + * initial state is data_state(). The current tokenizer state is stored + * in the variable 'tokenizer'. Most state functions expect a single + * integer argument which represents a single UTF-16 codepoint. Some + * states want more characters and set a lookahead property on + * themselves. The scanChars() function in the scanner checks for this + * lookahead property. If it doesn't exist, then scanChars() just passes + * the next input character to the current tokenizer state function. + * Otherwise, scanChars() looks ahead (a given # of characters, or for a + * matching string, or for a matching regexp) and passes a string of + * characters to the current tokenizer state function. + * + * As a shortcut, certain states of the tokenizer use regular expressions + * to look ahead in the scanner's input buffer for runs of text, simple + * tags and attributes. For well-formed input, these shortcuts skip a + * lot of state transitions and speed things up a bit. + * + * When a tokenizer state function has consumed a complete token, it + * emits that token, by calling insertToken(), or by calling a utility + * function that itself calls insertToken(). These tokens are passed to + * the tree building stage, which is also a state machine. Like the + * tokenizer, the tree building states are implemented as functions, and + * these functions have names that end with _mode (because the HTML spec + * refers to them as insertion modes). The current insertion mode is held + * by the 'parser' variable. Each insertion mode function takes up to 4 + * arguments. The first is a token type, represented by the constants + * TAG, ENDTAG, TEXT, COMMENT, DOCTYPE and EOF. The second argument is + * the value of the token: the text or comment data, or tagname or + * doctype. For tags, the 3rd argument is an array of attributes. For + * DOCTYPES it is the optional public id. For tags, the 4th argument is + * true if the tag is self-closing. For doctypes, the 4th argument is the + * optional system id. + * + * Search for "***" to find the major sub-divisions in the code. + */ + + +/*** + * Data prolog. Lots of constants declared here, including some + * very large objects. They're used throughout the code that follows + */ +// Token types for the tree builder. +var EOF = -1; +var TEXT = 1; +var TAG = 2; +var ENDTAG = 3; +var COMMENT = 4; +var DOCTYPE = 5; + +// A re-usable empty array +var NOATTRS = []; + +// These DTD public ids put the browser in quirks mode +var quirkyPublicIds = /^HTML$|^-\/\/W3O\/\/DTD W3 HTML Strict 3\.0\/\/EN\/\/$|^-\/W3C\/DTD HTML 4\.0 Transitional\/EN$|^\+\/\/Silmaril\/\/dtd html Pro v0r11 19970101\/\/|^-\/\/AdvaSoft Ltd\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/AS\/\/DTD HTML 3\.0 asWedit \+ extensions\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML 2\.0 Strict\/\/|^-\/\/IETF\/\/DTD HTML 2\.0\/\/|^-\/\/IETF\/\/DTD HTML 2\.1E\/\/|^-\/\/IETF\/\/DTD HTML 3\.0\/\/|^-\/\/IETF\/\/DTD HTML 3\.2 Final\/\/|^-\/\/IETF\/\/DTD HTML 3\.2\/\/|^-\/\/IETF\/\/DTD HTML 3\/\/|^-\/\/IETF\/\/DTD HTML Level 0\/\/|^-\/\/IETF\/\/DTD HTML Level 1\/\/|^-\/\/IETF\/\/DTD HTML Level 2\/\/|^-\/\/IETF\/\/DTD HTML Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 0\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 1\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 2\/\/|^-\/\/IETF\/\/DTD HTML Strict Level 3\/\/|^-\/\/IETF\/\/DTD HTML Strict\/\/|^-\/\/IETF\/\/DTD HTML\/\/|^-\/\/Metrius\/\/DTD Metrius Presentational\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 2\.0 Tables\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML Strict\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 HTML\/\/|^-\/\/Microsoft\/\/DTD Internet Explorer 3\.0 Tables\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD HTML\/\/|^-\/\/Netscape Comm\. Corp\.\/\/DTD Strict HTML\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML 2\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended 1\.0\/\/|^-\/\/O'Reilly and Associates\/\/DTD HTML Extended Relaxed 1\.0\/\/|^-\/\/SoftQuad Software\/\/DTD HoTMetaL PRO 6\.0::19990601::extensions to HTML 4\.0\/\/|^-\/\/SoftQuad\/\/DTD HoTMetaL PRO 4\.0::19971010::extensions to HTML 4\.0\/\/|^-\/\/Spyglass\/\/DTD HTML 2\.0 Extended\/\/|^-\/\/SQ\/\/DTD HTML 2\.0 HoTMetaL \+ extensions\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava HTML\/\/|^-\/\/Sun Microsystems Corp\.\/\/DTD HotJava Strict HTML\/\/|^-\/\/W3C\/\/DTD HTML 3 1995-03-24\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Draft\/\/|^-\/\/W3C\/\/DTD HTML 3\.2 Final\/\/|^-\/\/W3C\/\/DTD HTML 3\.2\/\/|^-\/\/W3C\/\/DTD HTML 3\.2S Draft\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.0 Transitional\/\/|^-\/\/W3C\/\/DTD HTML Experimental 19960712\/\/|^-\/\/W3C\/\/DTD HTML Experimental 970421\/\/|^-\/\/W3C\/\/DTD W3 HTML\/\/|^-\/\/W3O\/\/DTD W3 HTML 3\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML 2\.0\/\/|^-\/\/WebTechs\/\/DTD Mozilla HTML\/\//i; + +var quirkySystemId = "http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd"; + +var conditionallyQuirkyPublicIds = /^-\/\/W3C\/\/DTD HTML 4\.01 Frameset\/\/|^-\/\/W3C\/\/DTD HTML 4\.01 Transitional\/\//i; + +// These DTD public ids put the browser in limited quirks mode +var limitedQuirkyPublicIds = /^-\/\/W3C\/\/DTD XHTML 1\.0 Frameset\/\/|^-\/\/W3C\/\/DTD XHTML 1\.0 Transitional\/\//i; + + +// Element sets below. See the isA() function for a way to test +// whether an element is a member of a set +var specialSet = Object.create(null); +specialSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "applet":true, "area":true, "article":true, + "aside":true, "base":true, "basefont":true, "bgsound":true, + "blockquote":true, "body":true, "br":true, "button":true, + "caption":true, "center":true, "col":true, "colgroup":true, + "dd":true, "details":true, "dir":true, + "div":true, "dl":true, "dt":true, "embed":true, + "fieldset":true, "figcaption":true, "figure":true, "footer":true, + "form":true, "frame":true, "frameset":true, "h1":true, + "h2":true, "h3":true, "h4":true, "h5":true, + "h6":true, "head":true, "header":true, "hgroup":true, + "hr":true, "html":true, "iframe":true, "img":true, + "input":true, "li":true, "link":true, + "listing":true, "main":true, "marquee":true, "menu":true, "meta":true, + "nav":true, "noembed":true, "noframes":true, "noscript":true, + "object":true, "ol":true, "p":true, "param":true, + "plaintext":true, "pre":true, "script":true, "section":true, + "select":true, "source":true, "style":true, "summary":true, "table":true, + "tbody":true, "td":true, "template":true, "textarea":true, "tfoot":true, + "th":true, "thead":true, "title":true, "tr":true, "track":true, + // Note that "xmp" was removed from the "special" set in the latest + // spec, apparently by accident; see + // https://github.com/whatwg/html/pull/1919 + "ul":true, "wbr":true, "xmp":true +}; +specialSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject": true, "desc": true, "title": true +}; +specialSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; + +// The set of address, div, and p HTML tags +var addressdivpSet = Object.create(null); +addressdivpSet[NAMESPACE.HTML] = { + __proto__: null, + "address":true, "div":true, "p":true +}; + +var dddtSet = Object.create(null); +dddtSet[NAMESPACE.HTML] = { + __proto__: null, + "dd":true, "dt":true +}; + +var tablesectionrowSet = Object.create(null); +tablesectionrowSet[NAMESPACE.HTML] = { + __proto__: null, + "table":true, "thead":true, "tbody":true, "tfoot":true, "tr":true +}; + +var impliedEndTagsSet = Object.create(null); +impliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "dd": true, "dt": true, "li": true, "menuitem": true, "optgroup": true, + "option": true, "p": true, "rb": true, "rp": true, "rt": true, "rtc": true +}; + +var thoroughImpliedEndTagsSet = Object.create(null); +thoroughImpliedEndTagsSet[NAMESPACE.HTML] = { + __proto__: null, + "caption": true, "colgroup": true, "dd": true, "dt": true, "li": true, + "optgroup": true, "option": true, "p": true, "rb": true, "rp": true, + "rt": true, "rtc": true, "tbody": true, "td": true, "tfoot": true, + "th": true, "thead": true, "tr": true +}; + +var tableContextSet = Object.create(null); +tableContextSet[NAMESPACE.HTML] = { + __proto__: null, + "table": true, "template": true, "html": true +}; + +var tableBodyContextSet = Object.create(null); +tableBodyContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tbody": true, "tfoot": true, "thead": true, "template": true, "html": true +}; + +var tableRowContextSet = Object.create(null); +tableRowContextSet[NAMESPACE.HTML] = { + __proto__: null, + "tr": true, "template": true, "html": true +}; + +// See http://www.w3.org/TR/html5/forms.html#form-associated-element +var formassociatedSet = Object.create(null); +formassociatedSet[NAMESPACE.HTML] = { + __proto__: null, + "button": true, "fieldset": true, "input": true, "keygen": true, + "object": true, "output": true, "select": true, "textarea": true, + "img": true +}; + +var inScopeSet = Object.create(null); +inScopeSet[NAMESPACE.HTML]= { + __proto__: null, + "applet":true, "caption":true, "html":true, "table":true, + "td":true, "th":true, "marquee":true, "object":true, + "template":true +}; +inScopeSet[NAMESPACE.MATHML] = { + __proto__: null, + "mi":true, "mo":true, "mn":true, "ms":true, + "mtext":true, "annotation-xml":true +}; +inScopeSet[NAMESPACE.SVG] = { + __proto__: null, + "foreignObject":true, "desc":true, "title":true +}; + +var inListItemScopeSet = Object.create(inScopeSet); +inListItemScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inListItemScopeSet[NAMESPACE.HTML].ol = true; +inListItemScopeSet[NAMESPACE.HTML].ul = true; + +var inButtonScopeSet = Object.create(inScopeSet); +inButtonScopeSet[NAMESPACE.HTML] = + Object.create(inScopeSet[NAMESPACE.HTML]); +inButtonScopeSet[NAMESPACE.HTML].button = true; + +var inTableScopeSet = Object.create(null); +inTableScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "html":true, "table":true, "template":true +}; + +// The set of elements for select scope is the everything *except* these +var invertedSelectScopeSet = Object.create(null); +invertedSelectScopeSet[NAMESPACE.HTML] = { + __proto__: null, + "optgroup":true, "option":true +}; + +var mathmlTextIntegrationPointSet = Object.create(null); +mathmlTextIntegrationPointSet[NAMESPACE.MATHML] = { + __proto__: null, + mi: true, + mo: true, + mn: true, + ms: true, + mtext: true +}; + +var htmlIntegrationPointSet = Object.create(null); +htmlIntegrationPointSet[NAMESPACE.SVG] = { + __proto__: null, + foreignObject: true, + desc: true, + title: true +}; + +var foreignAttributes = { + __proto__: null, + "xlink:actuate": NAMESPACE.XLINK, "xlink:arcrole": NAMESPACE.XLINK, + "xlink:href": NAMESPACE.XLINK, "xlink:role": NAMESPACE.XLINK, + "xlink:show": NAMESPACE.XLINK, "xlink:title": NAMESPACE.XLINK, + "xlink:type": NAMESPACE.XLINK, "xml:base": NAMESPACE.XML, + "xml:lang": NAMESPACE.XML, "xml:space": NAMESPACE.XML, + "xmlns": NAMESPACE.XMLNS, "xmlns:xlink": NAMESPACE.XMLNS +}; + + +// Lowercase to mixed case mapping for SVG attributes and tagnames +var svgAttrAdjustments = { + __proto__: null, + attributename: "attributeName", attributetype: "attributeType", + basefrequency: "baseFrequency", baseprofile: "baseProfile", + calcmode: "calcMode", clippathunits: "clipPathUnits", + diffuseconstant: "diffuseConstant", + edgemode: "edgeMode", + filterunits: "filterUnits", + glyphref: "glyphRef", gradienttransform: "gradientTransform", + gradientunits: "gradientUnits", kernelmatrix: "kernelMatrix", + kernelunitlength: "kernelUnitLength", keypoints: "keyPoints", + keysplines: "keySplines", keytimes: "keyTimes", + lengthadjust: "lengthAdjust", limitingconeangle: "limitingConeAngle", + markerheight: "markerHeight", markerunits: "markerUnits", + markerwidth: "markerWidth", maskcontentunits: "maskContentUnits", + maskunits: "maskUnits", numoctaves: "numOctaves", + pathlength: "pathLength", patterncontentunits: "patternContentUnits", + patterntransform: "patternTransform", patternunits: "patternUnits", + pointsatx: "pointsAtX", pointsaty: "pointsAtY", + pointsatz: "pointsAtZ", preservealpha: "preserveAlpha", + preserveaspectratio: "preserveAspectRatio", + primitiveunits: "primitiveUnits", refx: "refX", + refy: "refY", repeatcount: "repeatCount", + repeatdur: "repeatDur", requiredextensions: "requiredExtensions", + requiredfeatures: "requiredFeatures", + specularconstant: "specularConstant", + specularexponent: "specularExponent", spreadmethod: "spreadMethod", + startoffset: "startOffset", stddeviation: "stdDeviation", + stitchtiles: "stitchTiles", surfacescale: "surfaceScale", + systemlanguage: "systemLanguage", tablevalues: "tableValues", + targetx: "targetX", targety: "targetY", + textlength: "textLength", viewbox: "viewBox", + viewtarget: "viewTarget", xchannelselector: "xChannelSelector", + ychannelselector: "yChannelSelector", zoomandpan: "zoomAndPan" +}; + +var svgTagNameAdjustments = { + __proto__: null, + altglyph: "altGlyph", altglyphdef: "altGlyphDef", + altglyphitem: "altGlyphItem", animatecolor: "animateColor", + animatemotion: "animateMotion", animatetransform: "animateTransform", + clippath: "clipPath", feblend: "feBlend", + fecolormatrix: "feColorMatrix", + fecomponenttransfer: "feComponentTransfer", fecomposite: "feComposite", + feconvolvematrix: "feConvolveMatrix", + fediffuselighting: "feDiffuseLighting", + fedisplacementmap: "feDisplacementMap", + fedistantlight: "feDistantLight", feflood: "feFlood", + fefunca: "feFuncA", fefuncb: "feFuncB", + fefuncg: "feFuncG", fefuncr: "feFuncR", + fegaussianblur: "feGaussianBlur", feimage: "feImage", + femerge: "feMerge", femergenode: "feMergeNode", + femorphology: "feMorphology", feoffset: "feOffset", + fepointlight: "fePointLight", fespecularlighting: "feSpecularLighting", + fespotlight: "feSpotLight", fetile: "feTile", + feturbulence: "feTurbulence", foreignobject: "foreignObject", + glyphref: "glyphRef", lineargradient: "linearGradient", + radialgradient: "radialGradient", textpath: "textPath" +}; + + +// Data for parsing numeric and named character references +// These next 3 objects are direct translations of tables +// in the HTML spec into JavaScript object format +var numericCharRefReplacements = { + __proto__: null, + 0x00:0xFFFD, 0x80:0x20AC, 0x82:0x201A, 0x83:0x0192, 0x84:0x201E, + 0x85:0x2026, 0x86:0x2020, 0x87:0x2021, 0x88:0x02C6, 0x89:0x2030, + 0x8A:0x0160, 0x8B:0x2039, 0x8C:0x0152, 0x8E:0x017D, 0x91:0x2018, + 0x92:0x2019, 0x93:0x201C, 0x94:0x201D, 0x95:0x2022, 0x96:0x2013, + 0x97:0x2014, 0x98:0x02DC, 0x99:0x2122, 0x9A:0x0161, 0x9B:0x203A, + 0x9C:0x0153, 0x9E:0x017E, 0x9F:0x0178 +}; + +/* + * This table is generated with test/tools/update-entities.js + */ +var namedCharRefs = { + __proto__: null, + "AElig":0xc6, "AElig;":0xc6, + "AMP":0x26, "AMP;":0x26, + "Aacute":0xc1, "Aacute;":0xc1, + "Abreve;":0x102, "Acirc":0xc2, + "Acirc;":0xc2, "Acy;":0x410, + "Afr;":[0xd835,0xdd04], "Agrave":0xc0, + "Agrave;":0xc0, "Alpha;":0x391, + "Amacr;":0x100, "And;":0x2a53, + "Aogon;":0x104, "Aopf;":[0xd835,0xdd38], + "ApplyFunction;":0x2061, "Aring":0xc5, + "Aring;":0xc5, "Ascr;":[0xd835,0xdc9c], + "Assign;":0x2254, "Atilde":0xc3, + "Atilde;":0xc3, "Auml":0xc4, + "Auml;":0xc4, "Backslash;":0x2216, + "Barv;":0x2ae7, "Barwed;":0x2306, + "Bcy;":0x411, "Because;":0x2235, + "Bernoullis;":0x212c, "Beta;":0x392, + "Bfr;":[0xd835,0xdd05], "Bopf;":[0xd835,0xdd39], + "Breve;":0x2d8, "Bscr;":0x212c, + "Bumpeq;":0x224e, "CHcy;":0x427, + "COPY":0xa9, "COPY;":0xa9, + "Cacute;":0x106, "Cap;":0x22d2, + "CapitalDifferentialD;":0x2145, "Cayleys;":0x212d, + "Ccaron;":0x10c, "Ccedil":0xc7, + "Ccedil;":0xc7, "Ccirc;":0x108, + "Cconint;":0x2230, "Cdot;":0x10a, + "Cedilla;":0xb8, "CenterDot;":0xb7, + "Cfr;":0x212d, "Chi;":0x3a7, + "CircleDot;":0x2299, "CircleMinus;":0x2296, + "CirclePlus;":0x2295, "CircleTimes;":0x2297, + "ClockwiseContourIntegral;":0x2232, "CloseCurlyDoubleQuote;":0x201d, + "CloseCurlyQuote;":0x2019, "Colon;":0x2237, + "Colone;":0x2a74, "Congruent;":0x2261, + "Conint;":0x222f, "ContourIntegral;":0x222e, + "Copf;":0x2102, "Coproduct;":0x2210, + "CounterClockwiseContourIntegral;":0x2233, "Cross;":0x2a2f, + "Cscr;":[0xd835,0xdc9e], "Cup;":0x22d3, + "CupCap;":0x224d, "DD;":0x2145, + "DDotrahd;":0x2911, "DJcy;":0x402, + "DScy;":0x405, "DZcy;":0x40f, + "Dagger;":0x2021, "Darr;":0x21a1, + "Dashv;":0x2ae4, "Dcaron;":0x10e, + "Dcy;":0x414, "Del;":0x2207, + "Delta;":0x394, "Dfr;":[0xd835,0xdd07], + "DiacriticalAcute;":0xb4, "DiacriticalDot;":0x2d9, + "DiacriticalDoubleAcute;":0x2dd, "DiacriticalGrave;":0x60, + "DiacriticalTilde;":0x2dc, "Diamond;":0x22c4, + "DifferentialD;":0x2146, "Dopf;":[0xd835,0xdd3b], + "Dot;":0xa8, "DotDot;":0x20dc, + "DotEqual;":0x2250, "DoubleContourIntegral;":0x222f, + "DoubleDot;":0xa8, "DoubleDownArrow;":0x21d3, + "DoubleLeftArrow;":0x21d0, "DoubleLeftRightArrow;":0x21d4, + "DoubleLeftTee;":0x2ae4, "DoubleLongLeftArrow;":0x27f8, + "DoubleLongLeftRightArrow;":0x27fa, "DoubleLongRightArrow;":0x27f9, + "DoubleRightArrow;":0x21d2, "DoubleRightTee;":0x22a8, + "DoubleUpArrow;":0x21d1, "DoubleUpDownArrow;":0x21d5, + "DoubleVerticalBar;":0x2225, "DownArrow;":0x2193, + "DownArrowBar;":0x2913, "DownArrowUpArrow;":0x21f5, + "DownBreve;":0x311, "DownLeftRightVector;":0x2950, + "DownLeftTeeVector;":0x295e, "DownLeftVector;":0x21bd, + "DownLeftVectorBar;":0x2956, "DownRightTeeVector;":0x295f, + "DownRightVector;":0x21c1, "DownRightVectorBar;":0x2957, + "DownTee;":0x22a4, "DownTeeArrow;":0x21a7, + "Downarrow;":0x21d3, "Dscr;":[0xd835,0xdc9f], + "Dstrok;":0x110, "ENG;":0x14a, + "ETH":0xd0, "ETH;":0xd0, + "Eacute":0xc9, "Eacute;":0xc9, + "Ecaron;":0x11a, "Ecirc":0xca, + "Ecirc;":0xca, "Ecy;":0x42d, + "Edot;":0x116, "Efr;":[0xd835,0xdd08], + "Egrave":0xc8, "Egrave;":0xc8, + "Element;":0x2208, "Emacr;":0x112, + "EmptySmallSquare;":0x25fb, "EmptyVerySmallSquare;":0x25ab, + "Eogon;":0x118, "Eopf;":[0xd835,0xdd3c], + "Epsilon;":0x395, "Equal;":0x2a75, + "EqualTilde;":0x2242, "Equilibrium;":0x21cc, + "Escr;":0x2130, "Esim;":0x2a73, + "Eta;":0x397, "Euml":0xcb, + "Euml;":0xcb, "Exists;":0x2203, + "ExponentialE;":0x2147, "Fcy;":0x424, + "Ffr;":[0xd835,0xdd09], "FilledSmallSquare;":0x25fc, + "FilledVerySmallSquare;":0x25aa, "Fopf;":[0xd835,0xdd3d], + "ForAll;":0x2200, "Fouriertrf;":0x2131, + "Fscr;":0x2131, "GJcy;":0x403, + "GT":0x3e, "GT;":0x3e, + "Gamma;":0x393, "Gammad;":0x3dc, + "Gbreve;":0x11e, "Gcedil;":0x122, + "Gcirc;":0x11c, "Gcy;":0x413, + "Gdot;":0x120, "Gfr;":[0xd835,0xdd0a], + "Gg;":0x22d9, "Gopf;":[0xd835,0xdd3e], + "GreaterEqual;":0x2265, "GreaterEqualLess;":0x22db, + "GreaterFullEqual;":0x2267, "GreaterGreater;":0x2aa2, + "GreaterLess;":0x2277, "GreaterSlantEqual;":0x2a7e, + "GreaterTilde;":0x2273, "Gscr;":[0xd835,0xdca2], + "Gt;":0x226b, "HARDcy;":0x42a, + "Hacek;":0x2c7, "Hat;":0x5e, + "Hcirc;":0x124, "Hfr;":0x210c, + "HilbertSpace;":0x210b, "Hopf;":0x210d, + "HorizontalLine;":0x2500, "Hscr;":0x210b, + "Hstrok;":0x126, "HumpDownHump;":0x224e, + "HumpEqual;":0x224f, "IEcy;":0x415, + "IJlig;":0x132, "IOcy;":0x401, + "Iacute":0xcd, "Iacute;":0xcd, + "Icirc":0xce, "Icirc;":0xce, + "Icy;":0x418, "Idot;":0x130, + "Ifr;":0x2111, "Igrave":0xcc, + "Igrave;":0xcc, "Im;":0x2111, + "Imacr;":0x12a, "ImaginaryI;":0x2148, + "Implies;":0x21d2, "Int;":0x222c, + "Integral;":0x222b, "Intersection;":0x22c2, + "InvisibleComma;":0x2063, "InvisibleTimes;":0x2062, + "Iogon;":0x12e, "Iopf;":[0xd835,0xdd40], + "Iota;":0x399, "Iscr;":0x2110, + "Itilde;":0x128, "Iukcy;":0x406, + "Iuml":0xcf, "Iuml;":0xcf, + "Jcirc;":0x134, "Jcy;":0x419, + "Jfr;":[0xd835,0xdd0d], "Jopf;":[0xd835,0xdd41], + "Jscr;":[0xd835,0xdca5], "Jsercy;":0x408, + "Jukcy;":0x404, "KHcy;":0x425, + "KJcy;":0x40c, "Kappa;":0x39a, + "Kcedil;":0x136, "Kcy;":0x41a, + "Kfr;":[0xd835,0xdd0e], "Kopf;":[0xd835,0xdd42], + "Kscr;":[0xd835,0xdca6], "LJcy;":0x409, + "LT":0x3c, "LT;":0x3c, + "Lacute;":0x139, "Lambda;":0x39b, + "Lang;":0x27ea, "Laplacetrf;":0x2112, + "Larr;":0x219e, "Lcaron;":0x13d, + "Lcedil;":0x13b, "Lcy;":0x41b, + "LeftAngleBracket;":0x27e8, "LeftArrow;":0x2190, + "LeftArrowBar;":0x21e4, "LeftArrowRightArrow;":0x21c6, + "LeftCeiling;":0x2308, "LeftDoubleBracket;":0x27e6, + "LeftDownTeeVector;":0x2961, "LeftDownVector;":0x21c3, + "LeftDownVectorBar;":0x2959, "LeftFloor;":0x230a, + "LeftRightArrow;":0x2194, "LeftRightVector;":0x294e, + "LeftTee;":0x22a3, "LeftTeeArrow;":0x21a4, + "LeftTeeVector;":0x295a, "LeftTriangle;":0x22b2, + "LeftTriangleBar;":0x29cf, "LeftTriangleEqual;":0x22b4, + "LeftUpDownVector;":0x2951, "LeftUpTeeVector;":0x2960, + "LeftUpVector;":0x21bf, "LeftUpVectorBar;":0x2958, + "LeftVector;":0x21bc, "LeftVectorBar;":0x2952, + "Leftarrow;":0x21d0, "Leftrightarrow;":0x21d4, + "LessEqualGreater;":0x22da, "LessFullEqual;":0x2266, + "LessGreater;":0x2276, "LessLess;":0x2aa1, + "LessSlantEqual;":0x2a7d, "LessTilde;":0x2272, + "Lfr;":[0xd835,0xdd0f], "Ll;":0x22d8, + "Lleftarrow;":0x21da, "Lmidot;":0x13f, + "LongLeftArrow;":0x27f5, "LongLeftRightArrow;":0x27f7, + "LongRightArrow;":0x27f6, "Longleftarrow;":0x27f8, + "Longleftrightarrow;":0x27fa, "Longrightarrow;":0x27f9, + "Lopf;":[0xd835,0xdd43], "LowerLeftArrow;":0x2199, + "LowerRightArrow;":0x2198, "Lscr;":0x2112, + "Lsh;":0x21b0, "Lstrok;":0x141, + "Lt;":0x226a, "Map;":0x2905, + "Mcy;":0x41c, "MediumSpace;":0x205f, + "Mellintrf;":0x2133, "Mfr;":[0xd835,0xdd10], + "MinusPlus;":0x2213, "Mopf;":[0xd835,0xdd44], + "Mscr;":0x2133, "Mu;":0x39c, + "NJcy;":0x40a, "Nacute;":0x143, + "Ncaron;":0x147, "Ncedil;":0x145, + "Ncy;":0x41d, "NegativeMediumSpace;":0x200b, + "NegativeThickSpace;":0x200b, "NegativeThinSpace;":0x200b, + "NegativeVeryThinSpace;":0x200b, "NestedGreaterGreater;":0x226b, + "NestedLessLess;":0x226a, "NewLine;":0xa, + "Nfr;":[0xd835,0xdd11], "NoBreak;":0x2060, + "NonBreakingSpace;":0xa0, "Nopf;":0x2115, + "Not;":0x2aec, "NotCongruent;":0x2262, + "NotCupCap;":0x226d, "NotDoubleVerticalBar;":0x2226, + "NotElement;":0x2209, "NotEqual;":0x2260, + "NotEqualTilde;":[0x2242,0x338], "NotExists;":0x2204, + "NotGreater;":0x226f, "NotGreaterEqual;":0x2271, + "NotGreaterFullEqual;":[0x2267,0x338], "NotGreaterGreater;":[0x226b,0x338], + "NotGreaterLess;":0x2279, "NotGreaterSlantEqual;":[0x2a7e,0x338], + "NotGreaterTilde;":0x2275, "NotHumpDownHump;":[0x224e,0x338], + "NotHumpEqual;":[0x224f,0x338], "NotLeftTriangle;":0x22ea, + "NotLeftTriangleBar;":[0x29cf,0x338], "NotLeftTriangleEqual;":0x22ec, + "NotLess;":0x226e, "NotLessEqual;":0x2270, + "NotLessGreater;":0x2278, "NotLessLess;":[0x226a,0x338], + "NotLessSlantEqual;":[0x2a7d,0x338], "NotLessTilde;":0x2274, + "NotNestedGreaterGreater;":[0x2aa2,0x338], "NotNestedLessLess;":[0x2aa1,0x338], + "NotPrecedes;":0x2280, "NotPrecedesEqual;":[0x2aaf,0x338], + "NotPrecedesSlantEqual;":0x22e0, "NotReverseElement;":0x220c, + "NotRightTriangle;":0x22eb, "NotRightTriangleBar;":[0x29d0,0x338], + "NotRightTriangleEqual;":0x22ed, "NotSquareSubset;":[0x228f,0x338], + "NotSquareSubsetEqual;":0x22e2, "NotSquareSuperset;":[0x2290,0x338], + "NotSquareSupersetEqual;":0x22e3, "NotSubset;":[0x2282,0x20d2], + "NotSubsetEqual;":0x2288, "NotSucceeds;":0x2281, + "NotSucceedsEqual;":[0x2ab0,0x338], "NotSucceedsSlantEqual;":0x22e1, + "NotSucceedsTilde;":[0x227f,0x338], "NotSuperset;":[0x2283,0x20d2], + "NotSupersetEqual;":0x2289, "NotTilde;":0x2241, + "NotTildeEqual;":0x2244, "NotTildeFullEqual;":0x2247, + "NotTildeTilde;":0x2249, "NotVerticalBar;":0x2224, + "Nscr;":[0xd835,0xdca9], "Ntilde":0xd1, + "Ntilde;":0xd1, "Nu;":0x39d, + "OElig;":0x152, "Oacute":0xd3, + "Oacute;":0xd3, "Ocirc":0xd4, + "Ocirc;":0xd4, "Ocy;":0x41e, + "Odblac;":0x150, "Ofr;":[0xd835,0xdd12], + "Ograve":0xd2, "Ograve;":0xd2, + "Omacr;":0x14c, "Omega;":0x3a9, + "Omicron;":0x39f, "Oopf;":[0xd835,0xdd46], + "OpenCurlyDoubleQuote;":0x201c, "OpenCurlyQuote;":0x2018, + "Or;":0x2a54, "Oscr;":[0xd835,0xdcaa], + "Oslash":0xd8, "Oslash;":0xd8, + "Otilde":0xd5, "Otilde;":0xd5, + "Otimes;":0x2a37, "Ouml":0xd6, + "Ouml;":0xd6, "OverBar;":0x203e, + "OverBrace;":0x23de, "OverBracket;":0x23b4, + "OverParenthesis;":0x23dc, "PartialD;":0x2202, + "Pcy;":0x41f, "Pfr;":[0xd835,0xdd13], + "Phi;":0x3a6, "Pi;":0x3a0, + "PlusMinus;":0xb1, "Poincareplane;":0x210c, + "Popf;":0x2119, "Pr;":0x2abb, + "Precedes;":0x227a, "PrecedesEqual;":0x2aaf, + "PrecedesSlantEqual;":0x227c, "PrecedesTilde;":0x227e, + "Prime;":0x2033, "Product;":0x220f, + "Proportion;":0x2237, "Proportional;":0x221d, + "Pscr;":[0xd835,0xdcab], "Psi;":0x3a8, + "QUOT":0x22, "QUOT;":0x22, + "Qfr;":[0xd835,0xdd14], "Qopf;":0x211a, + "Qscr;":[0xd835,0xdcac], "RBarr;":0x2910, + "REG":0xae, "REG;":0xae, + "Racute;":0x154, "Rang;":0x27eb, + "Rarr;":0x21a0, "Rarrtl;":0x2916, + "Rcaron;":0x158, "Rcedil;":0x156, + "Rcy;":0x420, "Re;":0x211c, + "ReverseElement;":0x220b, "ReverseEquilibrium;":0x21cb, + "ReverseUpEquilibrium;":0x296f, "Rfr;":0x211c, + "Rho;":0x3a1, "RightAngleBracket;":0x27e9, + "RightArrow;":0x2192, "RightArrowBar;":0x21e5, + "RightArrowLeftArrow;":0x21c4, "RightCeiling;":0x2309, + "RightDoubleBracket;":0x27e7, "RightDownTeeVector;":0x295d, + "RightDownVector;":0x21c2, "RightDownVectorBar;":0x2955, + "RightFloor;":0x230b, "RightTee;":0x22a2, + "RightTeeArrow;":0x21a6, "RightTeeVector;":0x295b, + "RightTriangle;":0x22b3, "RightTriangleBar;":0x29d0, + "RightTriangleEqual;":0x22b5, "RightUpDownVector;":0x294f, + "RightUpTeeVector;":0x295c, "RightUpVector;":0x21be, + "RightUpVectorBar;":0x2954, "RightVector;":0x21c0, + "RightVectorBar;":0x2953, "Rightarrow;":0x21d2, + "Ropf;":0x211d, "RoundImplies;":0x2970, + "Rrightarrow;":0x21db, "Rscr;":0x211b, + "Rsh;":0x21b1, "RuleDelayed;":0x29f4, + "SHCHcy;":0x429, "SHcy;":0x428, + "SOFTcy;":0x42c, "Sacute;":0x15a, + "Sc;":0x2abc, "Scaron;":0x160, + "Scedil;":0x15e, "Scirc;":0x15c, + "Scy;":0x421, "Sfr;":[0xd835,0xdd16], + "ShortDownArrow;":0x2193, "ShortLeftArrow;":0x2190, + "ShortRightArrow;":0x2192, "ShortUpArrow;":0x2191, + "Sigma;":0x3a3, "SmallCircle;":0x2218, + "Sopf;":[0xd835,0xdd4a], "Sqrt;":0x221a, + "Square;":0x25a1, "SquareIntersection;":0x2293, + "SquareSubset;":0x228f, "SquareSubsetEqual;":0x2291, + "SquareSuperset;":0x2290, "SquareSupersetEqual;":0x2292, + "SquareUnion;":0x2294, "Sscr;":[0xd835,0xdcae], + "Star;":0x22c6, "Sub;":0x22d0, + "Subset;":0x22d0, "SubsetEqual;":0x2286, + "Succeeds;":0x227b, "SucceedsEqual;":0x2ab0, + "SucceedsSlantEqual;":0x227d, "SucceedsTilde;":0x227f, + "SuchThat;":0x220b, "Sum;":0x2211, + "Sup;":0x22d1, "Superset;":0x2283, + "SupersetEqual;":0x2287, "Supset;":0x22d1, + "THORN":0xde, "THORN;":0xde, + "TRADE;":0x2122, "TSHcy;":0x40b, + "TScy;":0x426, "Tab;":0x9, + "Tau;":0x3a4, "Tcaron;":0x164, + "Tcedil;":0x162, "Tcy;":0x422, + "Tfr;":[0xd835,0xdd17], "Therefore;":0x2234, + "Theta;":0x398, "ThickSpace;":[0x205f,0x200a], + "ThinSpace;":0x2009, "Tilde;":0x223c, + "TildeEqual;":0x2243, "TildeFullEqual;":0x2245, + "TildeTilde;":0x2248, "Topf;":[0xd835,0xdd4b], + "TripleDot;":0x20db, "Tscr;":[0xd835,0xdcaf], + "Tstrok;":0x166, "Uacute":0xda, + "Uacute;":0xda, "Uarr;":0x219f, + "Uarrocir;":0x2949, "Ubrcy;":0x40e, + "Ubreve;":0x16c, "Ucirc":0xdb, + "Ucirc;":0xdb, "Ucy;":0x423, + "Udblac;":0x170, "Ufr;":[0xd835,0xdd18], + "Ugrave":0xd9, "Ugrave;":0xd9, + "Umacr;":0x16a, "UnderBar;":0x5f, + "UnderBrace;":0x23df, "UnderBracket;":0x23b5, + "UnderParenthesis;":0x23dd, "Union;":0x22c3, + "UnionPlus;":0x228e, "Uogon;":0x172, + "Uopf;":[0xd835,0xdd4c], "UpArrow;":0x2191, + "UpArrowBar;":0x2912, "UpArrowDownArrow;":0x21c5, + "UpDownArrow;":0x2195, "UpEquilibrium;":0x296e, + "UpTee;":0x22a5, "UpTeeArrow;":0x21a5, + "Uparrow;":0x21d1, "Updownarrow;":0x21d5, + "UpperLeftArrow;":0x2196, "UpperRightArrow;":0x2197, + "Upsi;":0x3d2, "Upsilon;":0x3a5, + "Uring;":0x16e, "Uscr;":[0xd835,0xdcb0], + "Utilde;":0x168, "Uuml":0xdc, + "Uuml;":0xdc, "VDash;":0x22ab, + "Vbar;":0x2aeb, "Vcy;":0x412, + "Vdash;":0x22a9, "Vdashl;":0x2ae6, + "Vee;":0x22c1, "Verbar;":0x2016, + "Vert;":0x2016, "VerticalBar;":0x2223, + "VerticalLine;":0x7c, "VerticalSeparator;":0x2758, + "VerticalTilde;":0x2240, "VeryThinSpace;":0x200a, + "Vfr;":[0xd835,0xdd19], "Vopf;":[0xd835,0xdd4d], + "Vscr;":[0xd835,0xdcb1], "Vvdash;":0x22aa, + "Wcirc;":0x174, "Wedge;":0x22c0, + "Wfr;":[0xd835,0xdd1a], "Wopf;":[0xd835,0xdd4e], + "Wscr;":[0xd835,0xdcb2], "Xfr;":[0xd835,0xdd1b], + "Xi;":0x39e, "Xopf;":[0xd835,0xdd4f], + "Xscr;":[0xd835,0xdcb3], "YAcy;":0x42f, + "YIcy;":0x407, "YUcy;":0x42e, + "Yacute":0xdd, "Yacute;":0xdd, + "Ycirc;":0x176, "Ycy;":0x42b, + "Yfr;":[0xd835,0xdd1c], "Yopf;":[0xd835,0xdd50], + "Yscr;":[0xd835,0xdcb4], "Yuml;":0x178, + "ZHcy;":0x416, "Zacute;":0x179, + "Zcaron;":0x17d, "Zcy;":0x417, + "Zdot;":0x17b, "ZeroWidthSpace;":0x200b, + "Zeta;":0x396, "Zfr;":0x2128, + "Zopf;":0x2124, "Zscr;":[0xd835,0xdcb5], + "aacute":0xe1, "aacute;":0xe1, + "abreve;":0x103, "ac;":0x223e, + "acE;":[0x223e,0x333], "acd;":0x223f, + "acirc":0xe2, "acirc;":0xe2, + "acute":0xb4, "acute;":0xb4, + "acy;":0x430, "aelig":0xe6, + "aelig;":0xe6, "af;":0x2061, + "afr;":[0xd835,0xdd1e], "agrave":0xe0, + "agrave;":0xe0, "alefsym;":0x2135, + "aleph;":0x2135, "alpha;":0x3b1, + "amacr;":0x101, "amalg;":0x2a3f, + "amp":0x26, "amp;":0x26, + "and;":0x2227, "andand;":0x2a55, + "andd;":0x2a5c, "andslope;":0x2a58, + "andv;":0x2a5a, "ang;":0x2220, + "ange;":0x29a4, "angle;":0x2220, + "angmsd;":0x2221, "angmsdaa;":0x29a8, + "angmsdab;":0x29a9, "angmsdac;":0x29aa, + "angmsdad;":0x29ab, "angmsdae;":0x29ac, + "angmsdaf;":0x29ad, "angmsdag;":0x29ae, + "angmsdah;":0x29af, "angrt;":0x221f, + "angrtvb;":0x22be, "angrtvbd;":0x299d, + "angsph;":0x2222, "angst;":0xc5, + "angzarr;":0x237c, "aogon;":0x105, + "aopf;":[0xd835,0xdd52], "ap;":0x2248, + "apE;":0x2a70, "apacir;":0x2a6f, + "ape;":0x224a, "apid;":0x224b, + "apos;":0x27, "approx;":0x2248, + "approxeq;":0x224a, "aring":0xe5, + "aring;":0xe5, "ascr;":[0xd835,0xdcb6], + "ast;":0x2a, "asymp;":0x2248, + "asympeq;":0x224d, "atilde":0xe3, + "atilde;":0xe3, "auml":0xe4, + "auml;":0xe4, "awconint;":0x2233, + "awint;":0x2a11, "bNot;":0x2aed, + "backcong;":0x224c, "backepsilon;":0x3f6, + "backprime;":0x2035, "backsim;":0x223d, + "backsimeq;":0x22cd, "barvee;":0x22bd, + "barwed;":0x2305, "barwedge;":0x2305, + "bbrk;":0x23b5, "bbrktbrk;":0x23b6, + "bcong;":0x224c, "bcy;":0x431, + "bdquo;":0x201e, "becaus;":0x2235, + "because;":0x2235, "bemptyv;":0x29b0, + "bepsi;":0x3f6, "bernou;":0x212c, + "beta;":0x3b2, "beth;":0x2136, + "between;":0x226c, "bfr;":[0xd835,0xdd1f], + "bigcap;":0x22c2, "bigcirc;":0x25ef, + "bigcup;":0x22c3, "bigodot;":0x2a00, + "bigoplus;":0x2a01, "bigotimes;":0x2a02, + "bigsqcup;":0x2a06, "bigstar;":0x2605, + "bigtriangledown;":0x25bd, "bigtriangleup;":0x25b3, + "biguplus;":0x2a04, "bigvee;":0x22c1, + "bigwedge;":0x22c0, "bkarow;":0x290d, + "blacklozenge;":0x29eb, "blacksquare;":0x25aa, + "blacktriangle;":0x25b4, "blacktriangledown;":0x25be, + "blacktriangleleft;":0x25c2, "blacktriangleright;":0x25b8, + "blank;":0x2423, "blk12;":0x2592, + "blk14;":0x2591, "blk34;":0x2593, + "block;":0x2588, "bne;":[0x3d,0x20e5], + "bnequiv;":[0x2261,0x20e5], "bnot;":0x2310, + "bopf;":[0xd835,0xdd53], "bot;":0x22a5, + "bottom;":0x22a5, "bowtie;":0x22c8, + "boxDL;":0x2557, "boxDR;":0x2554, + "boxDl;":0x2556, "boxDr;":0x2553, + "boxH;":0x2550, "boxHD;":0x2566, + "boxHU;":0x2569, "boxHd;":0x2564, + "boxHu;":0x2567, "boxUL;":0x255d, + "boxUR;":0x255a, "boxUl;":0x255c, + "boxUr;":0x2559, "boxV;":0x2551, + "boxVH;":0x256c, "boxVL;":0x2563, + "boxVR;":0x2560, "boxVh;":0x256b, + "boxVl;":0x2562, "boxVr;":0x255f, + "boxbox;":0x29c9, "boxdL;":0x2555, + "boxdR;":0x2552, "boxdl;":0x2510, + "boxdr;":0x250c, "boxh;":0x2500, + "boxhD;":0x2565, "boxhU;":0x2568, + "boxhd;":0x252c, "boxhu;":0x2534, + "boxminus;":0x229f, "boxplus;":0x229e, + "boxtimes;":0x22a0, "boxuL;":0x255b, + "boxuR;":0x2558, "boxul;":0x2518, + "boxur;":0x2514, "boxv;":0x2502, + "boxvH;":0x256a, "boxvL;":0x2561, + "boxvR;":0x255e, "boxvh;":0x253c, + "boxvl;":0x2524, "boxvr;":0x251c, + "bprime;":0x2035, "breve;":0x2d8, + "brvbar":0xa6, "brvbar;":0xa6, + "bscr;":[0xd835,0xdcb7], "bsemi;":0x204f, + "bsim;":0x223d, "bsime;":0x22cd, + "bsol;":0x5c, "bsolb;":0x29c5, + "bsolhsub;":0x27c8, "bull;":0x2022, + "bullet;":0x2022, "bump;":0x224e, + "bumpE;":0x2aae, "bumpe;":0x224f, + "bumpeq;":0x224f, "cacute;":0x107, + "cap;":0x2229, "capand;":0x2a44, + "capbrcup;":0x2a49, "capcap;":0x2a4b, + "capcup;":0x2a47, "capdot;":0x2a40, + "caps;":[0x2229,0xfe00], "caret;":0x2041, + "caron;":0x2c7, "ccaps;":0x2a4d, + "ccaron;":0x10d, "ccedil":0xe7, + "ccedil;":0xe7, "ccirc;":0x109, + "ccups;":0x2a4c, "ccupssm;":0x2a50, + "cdot;":0x10b, "cedil":0xb8, + "cedil;":0xb8, "cemptyv;":0x29b2, + "cent":0xa2, "cent;":0xa2, + "centerdot;":0xb7, "cfr;":[0xd835,0xdd20], + "chcy;":0x447, "check;":0x2713, + "checkmark;":0x2713, "chi;":0x3c7, + "cir;":0x25cb, "cirE;":0x29c3, + "circ;":0x2c6, "circeq;":0x2257, + "circlearrowleft;":0x21ba, "circlearrowright;":0x21bb, + "circledR;":0xae, "circledS;":0x24c8, + "circledast;":0x229b, "circledcirc;":0x229a, + "circleddash;":0x229d, "cire;":0x2257, + "cirfnint;":0x2a10, "cirmid;":0x2aef, + "cirscir;":0x29c2, "clubs;":0x2663, + "clubsuit;":0x2663, "colon;":0x3a, + "colone;":0x2254, "coloneq;":0x2254, + "comma;":0x2c, "commat;":0x40, + "comp;":0x2201, "compfn;":0x2218, + "complement;":0x2201, "complexes;":0x2102, + "cong;":0x2245, "congdot;":0x2a6d, + "conint;":0x222e, "copf;":[0xd835,0xdd54], + "coprod;":0x2210, "copy":0xa9, + "copy;":0xa9, "copysr;":0x2117, + "crarr;":0x21b5, "cross;":0x2717, + "cscr;":[0xd835,0xdcb8], "csub;":0x2acf, + "csube;":0x2ad1, "csup;":0x2ad0, + "csupe;":0x2ad2, "ctdot;":0x22ef, + "cudarrl;":0x2938, "cudarrr;":0x2935, + "cuepr;":0x22de, "cuesc;":0x22df, + "cularr;":0x21b6, "cularrp;":0x293d, + "cup;":0x222a, "cupbrcap;":0x2a48, + "cupcap;":0x2a46, "cupcup;":0x2a4a, + "cupdot;":0x228d, "cupor;":0x2a45, + "cups;":[0x222a,0xfe00], "curarr;":0x21b7, + "curarrm;":0x293c, "curlyeqprec;":0x22de, + "curlyeqsucc;":0x22df, "curlyvee;":0x22ce, + "curlywedge;":0x22cf, "curren":0xa4, + "curren;":0xa4, "curvearrowleft;":0x21b6, + "curvearrowright;":0x21b7, "cuvee;":0x22ce, + "cuwed;":0x22cf, "cwconint;":0x2232, + "cwint;":0x2231, "cylcty;":0x232d, + "dArr;":0x21d3, "dHar;":0x2965, + "dagger;":0x2020, "daleth;":0x2138, + "darr;":0x2193, "dash;":0x2010, + "dashv;":0x22a3, "dbkarow;":0x290f, + "dblac;":0x2dd, "dcaron;":0x10f, + "dcy;":0x434, "dd;":0x2146, + "ddagger;":0x2021, "ddarr;":0x21ca, + "ddotseq;":0x2a77, "deg":0xb0, + "deg;":0xb0, "delta;":0x3b4, + "demptyv;":0x29b1, "dfisht;":0x297f, + "dfr;":[0xd835,0xdd21], "dharl;":0x21c3, + "dharr;":0x21c2, "diam;":0x22c4, + "diamond;":0x22c4, "diamondsuit;":0x2666, + "diams;":0x2666, "die;":0xa8, + "digamma;":0x3dd, "disin;":0x22f2, + "div;":0xf7, "divide":0xf7, + "divide;":0xf7, "divideontimes;":0x22c7, + "divonx;":0x22c7, "djcy;":0x452, + "dlcorn;":0x231e, "dlcrop;":0x230d, + "dollar;":0x24, "dopf;":[0xd835,0xdd55], + "dot;":0x2d9, "doteq;":0x2250, + "doteqdot;":0x2251, "dotminus;":0x2238, + "dotplus;":0x2214, "dotsquare;":0x22a1, + "doublebarwedge;":0x2306, "downarrow;":0x2193, + "downdownarrows;":0x21ca, "downharpoonleft;":0x21c3, + "downharpoonright;":0x21c2, "drbkarow;":0x2910, + "drcorn;":0x231f, "drcrop;":0x230c, + "dscr;":[0xd835,0xdcb9], "dscy;":0x455, + "dsol;":0x29f6, "dstrok;":0x111, + "dtdot;":0x22f1, "dtri;":0x25bf, + "dtrif;":0x25be, "duarr;":0x21f5, + "duhar;":0x296f, "dwangle;":0x29a6, + "dzcy;":0x45f, "dzigrarr;":0x27ff, + "eDDot;":0x2a77, "eDot;":0x2251, + "eacute":0xe9, "eacute;":0xe9, + "easter;":0x2a6e, "ecaron;":0x11b, + "ecir;":0x2256, "ecirc":0xea, + "ecirc;":0xea, "ecolon;":0x2255, + "ecy;":0x44d, "edot;":0x117, + "ee;":0x2147, "efDot;":0x2252, + "efr;":[0xd835,0xdd22], "eg;":0x2a9a, + "egrave":0xe8, "egrave;":0xe8, + "egs;":0x2a96, "egsdot;":0x2a98, + "el;":0x2a99, "elinters;":0x23e7, + "ell;":0x2113, "els;":0x2a95, + "elsdot;":0x2a97, "emacr;":0x113, + "empty;":0x2205, "emptyset;":0x2205, + "emptyv;":0x2205, "emsp13;":0x2004, + "emsp14;":0x2005, "emsp;":0x2003, + "eng;":0x14b, "ensp;":0x2002, + "eogon;":0x119, "eopf;":[0xd835,0xdd56], + "epar;":0x22d5, "eparsl;":0x29e3, + "eplus;":0x2a71, "epsi;":0x3b5, + "epsilon;":0x3b5, "epsiv;":0x3f5, + "eqcirc;":0x2256, "eqcolon;":0x2255, + "eqsim;":0x2242, "eqslantgtr;":0x2a96, + "eqslantless;":0x2a95, "equals;":0x3d, + "equest;":0x225f, "equiv;":0x2261, + "equivDD;":0x2a78, "eqvparsl;":0x29e5, + "erDot;":0x2253, "erarr;":0x2971, + "escr;":0x212f, "esdot;":0x2250, + "esim;":0x2242, "eta;":0x3b7, + "eth":0xf0, "eth;":0xf0, + "euml":0xeb, "euml;":0xeb, + "euro;":0x20ac, "excl;":0x21, + "exist;":0x2203, "expectation;":0x2130, + "exponentiale;":0x2147, "fallingdotseq;":0x2252, + "fcy;":0x444, "female;":0x2640, + "ffilig;":0xfb03, "fflig;":0xfb00, + "ffllig;":0xfb04, "ffr;":[0xd835,0xdd23], + "filig;":0xfb01, "fjlig;":[0x66,0x6a], + "flat;":0x266d, "fllig;":0xfb02, + "fltns;":0x25b1, "fnof;":0x192, + "fopf;":[0xd835,0xdd57], "forall;":0x2200, + "fork;":0x22d4, "forkv;":0x2ad9, + "fpartint;":0x2a0d, "frac12":0xbd, + "frac12;":0xbd, "frac13;":0x2153, + "frac14":0xbc, "frac14;":0xbc, + "frac15;":0x2155, "frac16;":0x2159, + "frac18;":0x215b, "frac23;":0x2154, + "frac25;":0x2156, "frac34":0xbe, + "frac34;":0xbe, "frac35;":0x2157, + "frac38;":0x215c, "frac45;":0x2158, + "frac56;":0x215a, "frac58;":0x215d, + "frac78;":0x215e, "frasl;":0x2044, + "frown;":0x2322, "fscr;":[0xd835,0xdcbb], + "gE;":0x2267, "gEl;":0x2a8c, + "gacute;":0x1f5, "gamma;":0x3b3, + "gammad;":0x3dd, "gap;":0x2a86, + "gbreve;":0x11f, "gcirc;":0x11d, + "gcy;":0x433, "gdot;":0x121, + "ge;":0x2265, "gel;":0x22db, + "geq;":0x2265, "geqq;":0x2267, + "geqslant;":0x2a7e, "ges;":0x2a7e, + "gescc;":0x2aa9, "gesdot;":0x2a80, + "gesdoto;":0x2a82, "gesdotol;":0x2a84, + "gesl;":[0x22db,0xfe00], "gesles;":0x2a94, + "gfr;":[0xd835,0xdd24], "gg;":0x226b, + "ggg;":0x22d9, "gimel;":0x2137, + "gjcy;":0x453, "gl;":0x2277, + "glE;":0x2a92, "gla;":0x2aa5, + "glj;":0x2aa4, "gnE;":0x2269, + "gnap;":0x2a8a, "gnapprox;":0x2a8a, + "gne;":0x2a88, "gneq;":0x2a88, + "gneqq;":0x2269, "gnsim;":0x22e7, + "gopf;":[0xd835,0xdd58], "grave;":0x60, + "gscr;":0x210a, "gsim;":0x2273, + "gsime;":0x2a8e, "gsiml;":0x2a90, + "gt":0x3e, "gt;":0x3e, + "gtcc;":0x2aa7, "gtcir;":0x2a7a, + "gtdot;":0x22d7, "gtlPar;":0x2995, + "gtquest;":0x2a7c, "gtrapprox;":0x2a86, + "gtrarr;":0x2978, "gtrdot;":0x22d7, + "gtreqless;":0x22db, "gtreqqless;":0x2a8c, + "gtrless;":0x2277, "gtrsim;":0x2273, + "gvertneqq;":[0x2269,0xfe00], "gvnE;":[0x2269,0xfe00], + "hArr;":0x21d4, "hairsp;":0x200a, + "half;":0xbd, "hamilt;":0x210b, + "hardcy;":0x44a, "harr;":0x2194, + "harrcir;":0x2948, "harrw;":0x21ad, + "hbar;":0x210f, "hcirc;":0x125, + "hearts;":0x2665, "heartsuit;":0x2665, + "hellip;":0x2026, "hercon;":0x22b9, + "hfr;":[0xd835,0xdd25], "hksearow;":0x2925, + "hkswarow;":0x2926, "hoarr;":0x21ff, + "homtht;":0x223b, "hookleftarrow;":0x21a9, + "hookrightarrow;":0x21aa, "hopf;":[0xd835,0xdd59], + "horbar;":0x2015, "hscr;":[0xd835,0xdcbd], + "hslash;":0x210f, "hstrok;":0x127, + "hybull;":0x2043, "hyphen;":0x2010, + "iacute":0xed, "iacute;":0xed, + "ic;":0x2063, "icirc":0xee, + "icirc;":0xee, "icy;":0x438, + "iecy;":0x435, "iexcl":0xa1, + "iexcl;":0xa1, "iff;":0x21d4, + "ifr;":[0xd835,0xdd26], "igrave":0xec, + "igrave;":0xec, "ii;":0x2148, + "iiiint;":0x2a0c, "iiint;":0x222d, + "iinfin;":0x29dc, "iiota;":0x2129, + "ijlig;":0x133, "imacr;":0x12b, + "image;":0x2111, "imagline;":0x2110, + "imagpart;":0x2111, "imath;":0x131, + "imof;":0x22b7, "imped;":0x1b5, + "in;":0x2208, "incare;":0x2105, + "infin;":0x221e, "infintie;":0x29dd, + "inodot;":0x131, "int;":0x222b, + "intcal;":0x22ba, "integers;":0x2124, + "intercal;":0x22ba, "intlarhk;":0x2a17, + "intprod;":0x2a3c, "iocy;":0x451, + "iogon;":0x12f, "iopf;":[0xd835,0xdd5a], + "iota;":0x3b9, "iprod;":0x2a3c, + "iquest":0xbf, "iquest;":0xbf, + "iscr;":[0xd835,0xdcbe], "isin;":0x2208, + "isinE;":0x22f9, "isindot;":0x22f5, + "isins;":0x22f4, "isinsv;":0x22f3, + "isinv;":0x2208, "it;":0x2062, + "itilde;":0x129, "iukcy;":0x456, + "iuml":0xef, "iuml;":0xef, + "jcirc;":0x135, "jcy;":0x439, + "jfr;":[0xd835,0xdd27], "jmath;":0x237, + "jopf;":[0xd835,0xdd5b], "jscr;":[0xd835,0xdcbf], + "jsercy;":0x458, "jukcy;":0x454, + "kappa;":0x3ba, "kappav;":0x3f0, + "kcedil;":0x137, "kcy;":0x43a, + "kfr;":[0xd835,0xdd28], "kgreen;":0x138, + "khcy;":0x445, "kjcy;":0x45c, + "kopf;":[0xd835,0xdd5c], "kscr;":[0xd835,0xdcc0], + "lAarr;":0x21da, "lArr;":0x21d0, + "lAtail;":0x291b, "lBarr;":0x290e, + "lE;":0x2266, "lEg;":0x2a8b, + "lHar;":0x2962, "lacute;":0x13a, + "laemptyv;":0x29b4, "lagran;":0x2112, + "lambda;":0x3bb, "lang;":0x27e8, + "langd;":0x2991, "langle;":0x27e8, + "lap;":0x2a85, "laquo":0xab, + "laquo;":0xab, "larr;":0x2190, + "larrb;":0x21e4, "larrbfs;":0x291f, + "larrfs;":0x291d, "larrhk;":0x21a9, + "larrlp;":0x21ab, "larrpl;":0x2939, + "larrsim;":0x2973, "larrtl;":0x21a2, + "lat;":0x2aab, "latail;":0x2919, + "late;":0x2aad, "lates;":[0x2aad,0xfe00], + "lbarr;":0x290c, "lbbrk;":0x2772, + "lbrace;":0x7b, "lbrack;":0x5b, + "lbrke;":0x298b, "lbrksld;":0x298f, + "lbrkslu;":0x298d, "lcaron;":0x13e, + "lcedil;":0x13c, "lceil;":0x2308, + "lcub;":0x7b, "lcy;":0x43b, + "ldca;":0x2936, "ldquo;":0x201c, + "ldquor;":0x201e, "ldrdhar;":0x2967, + "ldrushar;":0x294b, "ldsh;":0x21b2, + "le;":0x2264, "leftarrow;":0x2190, + "leftarrowtail;":0x21a2, "leftharpoondown;":0x21bd, + "leftharpoonup;":0x21bc, "leftleftarrows;":0x21c7, + "leftrightarrow;":0x2194, "leftrightarrows;":0x21c6, + "leftrightharpoons;":0x21cb, "leftrightsquigarrow;":0x21ad, + "leftthreetimes;":0x22cb, "leg;":0x22da, + "leq;":0x2264, "leqq;":0x2266, + "leqslant;":0x2a7d, "les;":0x2a7d, + "lescc;":0x2aa8, "lesdot;":0x2a7f, + "lesdoto;":0x2a81, "lesdotor;":0x2a83, + "lesg;":[0x22da,0xfe00], "lesges;":0x2a93, + "lessapprox;":0x2a85, "lessdot;":0x22d6, + "lesseqgtr;":0x22da, "lesseqqgtr;":0x2a8b, + "lessgtr;":0x2276, "lesssim;":0x2272, + "lfisht;":0x297c, "lfloor;":0x230a, + "lfr;":[0xd835,0xdd29], "lg;":0x2276, + "lgE;":0x2a91, "lhard;":0x21bd, + "lharu;":0x21bc, "lharul;":0x296a, + "lhblk;":0x2584, "ljcy;":0x459, + "ll;":0x226a, "llarr;":0x21c7, + "llcorner;":0x231e, "llhard;":0x296b, + "lltri;":0x25fa, "lmidot;":0x140, + "lmoust;":0x23b0, "lmoustache;":0x23b0, + "lnE;":0x2268, "lnap;":0x2a89, + "lnapprox;":0x2a89, "lne;":0x2a87, + "lneq;":0x2a87, "lneqq;":0x2268, + "lnsim;":0x22e6, "loang;":0x27ec, + "loarr;":0x21fd, "lobrk;":0x27e6, + "longleftarrow;":0x27f5, "longleftrightarrow;":0x27f7, + "longmapsto;":0x27fc, "longrightarrow;":0x27f6, + "looparrowleft;":0x21ab, "looparrowright;":0x21ac, + "lopar;":0x2985, "lopf;":[0xd835,0xdd5d], + "loplus;":0x2a2d, "lotimes;":0x2a34, + "lowast;":0x2217, "lowbar;":0x5f, + "loz;":0x25ca, "lozenge;":0x25ca, + "lozf;":0x29eb, "lpar;":0x28, + "lparlt;":0x2993, "lrarr;":0x21c6, + "lrcorner;":0x231f, "lrhar;":0x21cb, + "lrhard;":0x296d, "lrm;":0x200e, + "lrtri;":0x22bf, "lsaquo;":0x2039, + "lscr;":[0xd835,0xdcc1], "lsh;":0x21b0, + "lsim;":0x2272, "lsime;":0x2a8d, + "lsimg;":0x2a8f, "lsqb;":0x5b, + "lsquo;":0x2018, "lsquor;":0x201a, + "lstrok;":0x142, "lt":0x3c, + "lt;":0x3c, "ltcc;":0x2aa6, + "ltcir;":0x2a79, "ltdot;":0x22d6, + "lthree;":0x22cb, "ltimes;":0x22c9, + "ltlarr;":0x2976, "ltquest;":0x2a7b, + "ltrPar;":0x2996, "ltri;":0x25c3, + "ltrie;":0x22b4, "ltrif;":0x25c2, + "lurdshar;":0x294a, "luruhar;":0x2966, + "lvertneqq;":[0x2268,0xfe00], "lvnE;":[0x2268,0xfe00], + "mDDot;":0x223a, "macr":0xaf, + "macr;":0xaf, "male;":0x2642, + "malt;":0x2720, "maltese;":0x2720, + "map;":0x21a6, "mapsto;":0x21a6, + "mapstodown;":0x21a7, "mapstoleft;":0x21a4, + "mapstoup;":0x21a5, "marker;":0x25ae, + "mcomma;":0x2a29, "mcy;":0x43c, + "mdash;":0x2014, "measuredangle;":0x2221, + "mfr;":[0xd835,0xdd2a], "mho;":0x2127, + "micro":0xb5, "micro;":0xb5, + "mid;":0x2223, "midast;":0x2a, + "midcir;":0x2af0, "middot":0xb7, + "middot;":0xb7, "minus;":0x2212, + "minusb;":0x229f, "minusd;":0x2238, + "minusdu;":0x2a2a, "mlcp;":0x2adb, + "mldr;":0x2026, "mnplus;":0x2213, + "models;":0x22a7, "mopf;":[0xd835,0xdd5e], + "mp;":0x2213, "mscr;":[0xd835,0xdcc2], + "mstpos;":0x223e, "mu;":0x3bc, + "multimap;":0x22b8, "mumap;":0x22b8, + "nGg;":[0x22d9,0x338], "nGt;":[0x226b,0x20d2], + "nGtv;":[0x226b,0x338], "nLeftarrow;":0x21cd, + "nLeftrightarrow;":0x21ce, "nLl;":[0x22d8,0x338], + "nLt;":[0x226a,0x20d2], "nLtv;":[0x226a,0x338], + "nRightarrow;":0x21cf, "nVDash;":0x22af, + "nVdash;":0x22ae, "nabla;":0x2207, + "nacute;":0x144, "nang;":[0x2220,0x20d2], + "nap;":0x2249, "napE;":[0x2a70,0x338], + "napid;":[0x224b,0x338], "napos;":0x149, + "napprox;":0x2249, "natur;":0x266e, + "natural;":0x266e, "naturals;":0x2115, + "nbsp":0xa0, "nbsp;":0xa0, + "nbump;":[0x224e,0x338], "nbumpe;":[0x224f,0x338], + "ncap;":0x2a43, "ncaron;":0x148, + "ncedil;":0x146, "ncong;":0x2247, + "ncongdot;":[0x2a6d,0x338], "ncup;":0x2a42, + "ncy;":0x43d, "ndash;":0x2013, + "ne;":0x2260, "neArr;":0x21d7, + "nearhk;":0x2924, "nearr;":0x2197, + "nearrow;":0x2197, "nedot;":[0x2250,0x338], + "nequiv;":0x2262, "nesear;":0x2928, + "nesim;":[0x2242,0x338], "nexist;":0x2204, + "nexists;":0x2204, "nfr;":[0xd835,0xdd2b], + "ngE;":[0x2267,0x338], "nge;":0x2271, + "ngeq;":0x2271, "ngeqq;":[0x2267,0x338], + "ngeqslant;":[0x2a7e,0x338], "nges;":[0x2a7e,0x338], + "ngsim;":0x2275, "ngt;":0x226f, + "ngtr;":0x226f, "nhArr;":0x21ce, + "nharr;":0x21ae, "nhpar;":0x2af2, + "ni;":0x220b, "nis;":0x22fc, + "nisd;":0x22fa, "niv;":0x220b, + "njcy;":0x45a, "nlArr;":0x21cd, + "nlE;":[0x2266,0x338], "nlarr;":0x219a, + "nldr;":0x2025, "nle;":0x2270, + "nleftarrow;":0x219a, "nleftrightarrow;":0x21ae, + "nleq;":0x2270, "nleqq;":[0x2266,0x338], + "nleqslant;":[0x2a7d,0x338], "nles;":[0x2a7d,0x338], + "nless;":0x226e, "nlsim;":0x2274, + "nlt;":0x226e, "nltri;":0x22ea, + "nltrie;":0x22ec, "nmid;":0x2224, + "nopf;":[0xd835,0xdd5f], "not":0xac, + "not;":0xac, "notin;":0x2209, + "notinE;":[0x22f9,0x338], "notindot;":[0x22f5,0x338], + "notinva;":0x2209, "notinvb;":0x22f7, + "notinvc;":0x22f6, "notni;":0x220c, + "notniva;":0x220c, "notnivb;":0x22fe, + "notnivc;":0x22fd, "npar;":0x2226, + "nparallel;":0x2226, "nparsl;":[0x2afd,0x20e5], + "npart;":[0x2202,0x338], "npolint;":0x2a14, + "npr;":0x2280, "nprcue;":0x22e0, + "npre;":[0x2aaf,0x338], "nprec;":0x2280, + "npreceq;":[0x2aaf,0x338], "nrArr;":0x21cf, + "nrarr;":0x219b, "nrarrc;":[0x2933,0x338], + "nrarrw;":[0x219d,0x338], "nrightarrow;":0x219b, + "nrtri;":0x22eb, "nrtrie;":0x22ed, + "nsc;":0x2281, "nsccue;":0x22e1, + "nsce;":[0x2ab0,0x338], "nscr;":[0xd835,0xdcc3], + "nshortmid;":0x2224, "nshortparallel;":0x2226, + "nsim;":0x2241, "nsime;":0x2244, + "nsimeq;":0x2244, "nsmid;":0x2224, + "nspar;":0x2226, "nsqsube;":0x22e2, + "nsqsupe;":0x22e3, "nsub;":0x2284, + "nsubE;":[0x2ac5,0x338], "nsube;":0x2288, + "nsubset;":[0x2282,0x20d2], "nsubseteq;":0x2288, + "nsubseteqq;":[0x2ac5,0x338], "nsucc;":0x2281, + "nsucceq;":[0x2ab0,0x338], "nsup;":0x2285, + "nsupE;":[0x2ac6,0x338], "nsupe;":0x2289, + "nsupset;":[0x2283,0x20d2], "nsupseteq;":0x2289, + "nsupseteqq;":[0x2ac6,0x338], "ntgl;":0x2279, + "ntilde":0xf1, "ntilde;":0xf1, + "ntlg;":0x2278, "ntriangleleft;":0x22ea, + "ntrianglelefteq;":0x22ec, "ntriangleright;":0x22eb, + "ntrianglerighteq;":0x22ed, "nu;":0x3bd, + "num;":0x23, "numero;":0x2116, + "numsp;":0x2007, "nvDash;":0x22ad, + "nvHarr;":0x2904, "nvap;":[0x224d,0x20d2], + "nvdash;":0x22ac, "nvge;":[0x2265,0x20d2], + "nvgt;":[0x3e,0x20d2], "nvinfin;":0x29de, + "nvlArr;":0x2902, "nvle;":[0x2264,0x20d2], + "nvlt;":[0x3c,0x20d2], "nvltrie;":[0x22b4,0x20d2], + "nvrArr;":0x2903, "nvrtrie;":[0x22b5,0x20d2], + "nvsim;":[0x223c,0x20d2], "nwArr;":0x21d6, + "nwarhk;":0x2923, "nwarr;":0x2196, + "nwarrow;":0x2196, "nwnear;":0x2927, + "oS;":0x24c8, "oacute":0xf3, + "oacute;":0xf3, "oast;":0x229b, + "ocir;":0x229a, "ocirc":0xf4, + "ocirc;":0xf4, "ocy;":0x43e, + "odash;":0x229d, "odblac;":0x151, + "odiv;":0x2a38, "odot;":0x2299, + "odsold;":0x29bc, "oelig;":0x153, + "ofcir;":0x29bf, "ofr;":[0xd835,0xdd2c], + "ogon;":0x2db, "ograve":0xf2, + "ograve;":0xf2, "ogt;":0x29c1, + "ohbar;":0x29b5, "ohm;":0x3a9, + "oint;":0x222e, "olarr;":0x21ba, + "olcir;":0x29be, "olcross;":0x29bb, + "oline;":0x203e, "olt;":0x29c0, + "omacr;":0x14d, "omega;":0x3c9, + "omicron;":0x3bf, "omid;":0x29b6, + "ominus;":0x2296, "oopf;":[0xd835,0xdd60], + "opar;":0x29b7, "operp;":0x29b9, + "oplus;":0x2295, "or;":0x2228, + "orarr;":0x21bb, "ord;":0x2a5d, + "order;":0x2134, "orderof;":0x2134, + "ordf":0xaa, "ordf;":0xaa, + "ordm":0xba, "ordm;":0xba, + "origof;":0x22b6, "oror;":0x2a56, + "orslope;":0x2a57, "orv;":0x2a5b, + "oscr;":0x2134, "oslash":0xf8, + "oslash;":0xf8, "osol;":0x2298, + "otilde":0xf5, "otilde;":0xf5, + "otimes;":0x2297, "otimesas;":0x2a36, + "ouml":0xf6, "ouml;":0xf6, + "ovbar;":0x233d, "par;":0x2225, + "para":0xb6, "para;":0xb6, + "parallel;":0x2225, "parsim;":0x2af3, + "parsl;":0x2afd, "part;":0x2202, + "pcy;":0x43f, "percnt;":0x25, + "period;":0x2e, "permil;":0x2030, + "perp;":0x22a5, "pertenk;":0x2031, + "pfr;":[0xd835,0xdd2d], "phi;":0x3c6, + "phiv;":0x3d5, "phmmat;":0x2133, + "phone;":0x260e, "pi;":0x3c0, + "pitchfork;":0x22d4, "piv;":0x3d6, + "planck;":0x210f, "planckh;":0x210e, + "plankv;":0x210f, "plus;":0x2b, + "plusacir;":0x2a23, "plusb;":0x229e, + "pluscir;":0x2a22, "plusdo;":0x2214, + "plusdu;":0x2a25, "pluse;":0x2a72, + "plusmn":0xb1, "plusmn;":0xb1, + "plussim;":0x2a26, "plustwo;":0x2a27, + "pm;":0xb1, "pointint;":0x2a15, + "popf;":[0xd835,0xdd61], "pound":0xa3, + "pound;":0xa3, "pr;":0x227a, + "prE;":0x2ab3, "prap;":0x2ab7, + "prcue;":0x227c, "pre;":0x2aaf, + "prec;":0x227a, "precapprox;":0x2ab7, + "preccurlyeq;":0x227c, "preceq;":0x2aaf, + "precnapprox;":0x2ab9, "precneqq;":0x2ab5, + "precnsim;":0x22e8, "precsim;":0x227e, + "prime;":0x2032, "primes;":0x2119, + "prnE;":0x2ab5, "prnap;":0x2ab9, + "prnsim;":0x22e8, "prod;":0x220f, + "profalar;":0x232e, "profline;":0x2312, + "profsurf;":0x2313, "prop;":0x221d, + "propto;":0x221d, "prsim;":0x227e, + "prurel;":0x22b0, "pscr;":[0xd835,0xdcc5], + "psi;":0x3c8, "puncsp;":0x2008, + "qfr;":[0xd835,0xdd2e], "qint;":0x2a0c, + "qopf;":[0xd835,0xdd62], "qprime;":0x2057, + "qscr;":[0xd835,0xdcc6], "quaternions;":0x210d, + "quatint;":0x2a16, "quest;":0x3f, + "questeq;":0x225f, "quot":0x22, + "quot;":0x22, "rAarr;":0x21db, + "rArr;":0x21d2, "rAtail;":0x291c, + "rBarr;":0x290f, "rHar;":0x2964, + "race;":[0x223d,0x331], "racute;":0x155, + "radic;":0x221a, "raemptyv;":0x29b3, + "rang;":0x27e9, "rangd;":0x2992, + "range;":0x29a5, "rangle;":0x27e9, + "raquo":0xbb, "raquo;":0xbb, + "rarr;":0x2192, "rarrap;":0x2975, + "rarrb;":0x21e5, "rarrbfs;":0x2920, + "rarrc;":0x2933, "rarrfs;":0x291e, + "rarrhk;":0x21aa, "rarrlp;":0x21ac, + "rarrpl;":0x2945, "rarrsim;":0x2974, + "rarrtl;":0x21a3, "rarrw;":0x219d, + "ratail;":0x291a, "ratio;":0x2236, + "rationals;":0x211a, "rbarr;":0x290d, + "rbbrk;":0x2773, "rbrace;":0x7d, + "rbrack;":0x5d, "rbrke;":0x298c, + "rbrksld;":0x298e, "rbrkslu;":0x2990, + "rcaron;":0x159, "rcedil;":0x157, + "rceil;":0x2309, "rcub;":0x7d, + "rcy;":0x440, "rdca;":0x2937, + "rdldhar;":0x2969, "rdquo;":0x201d, + "rdquor;":0x201d, "rdsh;":0x21b3, + "real;":0x211c, "realine;":0x211b, + "realpart;":0x211c, "reals;":0x211d, + "rect;":0x25ad, "reg":0xae, + "reg;":0xae, "rfisht;":0x297d, + "rfloor;":0x230b, "rfr;":[0xd835,0xdd2f], + "rhard;":0x21c1, "rharu;":0x21c0, + "rharul;":0x296c, "rho;":0x3c1, + "rhov;":0x3f1, "rightarrow;":0x2192, + "rightarrowtail;":0x21a3, "rightharpoondown;":0x21c1, + "rightharpoonup;":0x21c0, "rightleftarrows;":0x21c4, + "rightleftharpoons;":0x21cc, "rightrightarrows;":0x21c9, + "rightsquigarrow;":0x219d, "rightthreetimes;":0x22cc, + "ring;":0x2da, "risingdotseq;":0x2253, + "rlarr;":0x21c4, "rlhar;":0x21cc, + "rlm;":0x200f, "rmoust;":0x23b1, + "rmoustache;":0x23b1, "rnmid;":0x2aee, + "roang;":0x27ed, "roarr;":0x21fe, + "robrk;":0x27e7, "ropar;":0x2986, + "ropf;":[0xd835,0xdd63], "roplus;":0x2a2e, + "rotimes;":0x2a35, "rpar;":0x29, + "rpargt;":0x2994, "rppolint;":0x2a12, + "rrarr;":0x21c9, "rsaquo;":0x203a, + "rscr;":[0xd835,0xdcc7], "rsh;":0x21b1, + "rsqb;":0x5d, "rsquo;":0x2019, + "rsquor;":0x2019, "rthree;":0x22cc, + "rtimes;":0x22ca, "rtri;":0x25b9, + "rtrie;":0x22b5, "rtrif;":0x25b8, + "rtriltri;":0x29ce, "ruluhar;":0x2968, + "rx;":0x211e, "sacute;":0x15b, + "sbquo;":0x201a, "sc;":0x227b, + "scE;":0x2ab4, "scap;":0x2ab8, + "scaron;":0x161, "sccue;":0x227d, + "sce;":0x2ab0, "scedil;":0x15f, + "scirc;":0x15d, "scnE;":0x2ab6, + "scnap;":0x2aba, "scnsim;":0x22e9, + "scpolint;":0x2a13, "scsim;":0x227f, + "scy;":0x441, "sdot;":0x22c5, + "sdotb;":0x22a1, "sdote;":0x2a66, + "seArr;":0x21d8, "searhk;":0x2925, + "searr;":0x2198, "searrow;":0x2198, + "sect":0xa7, "sect;":0xa7, + "semi;":0x3b, "seswar;":0x2929, + "setminus;":0x2216, "setmn;":0x2216, + "sext;":0x2736, "sfr;":[0xd835,0xdd30], + "sfrown;":0x2322, "sharp;":0x266f, + "shchcy;":0x449, "shcy;":0x448, + "shortmid;":0x2223, "shortparallel;":0x2225, + "shy":0xad, "shy;":0xad, + "sigma;":0x3c3, "sigmaf;":0x3c2, + "sigmav;":0x3c2, "sim;":0x223c, + "simdot;":0x2a6a, "sime;":0x2243, + "simeq;":0x2243, "simg;":0x2a9e, + "simgE;":0x2aa0, "siml;":0x2a9d, + "simlE;":0x2a9f, "simne;":0x2246, + "simplus;":0x2a24, "simrarr;":0x2972, + "slarr;":0x2190, "smallsetminus;":0x2216, + "smashp;":0x2a33, "smeparsl;":0x29e4, + "smid;":0x2223, "smile;":0x2323, + "smt;":0x2aaa, "smte;":0x2aac, + "smtes;":[0x2aac,0xfe00], "softcy;":0x44c, + "sol;":0x2f, "solb;":0x29c4, + "solbar;":0x233f, "sopf;":[0xd835,0xdd64], + "spades;":0x2660, "spadesuit;":0x2660, + "spar;":0x2225, "sqcap;":0x2293, + "sqcaps;":[0x2293,0xfe00], "sqcup;":0x2294, + "sqcups;":[0x2294,0xfe00], "sqsub;":0x228f, + "sqsube;":0x2291, "sqsubset;":0x228f, + "sqsubseteq;":0x2291, "sqsup;":0x2290, + "sqsupe;":0x2292, "sqsupset;":0x2290, + "sqsupseteq;":0x2292, "squ;":0x25a1, + "square;":0x25a1, "squarf;":0x25aa, + "squf;":0x25aa, "srarr;":0x2192, + "sscr;":[0xd835,0xdcc8], "ssetmn;":0x2216, + "ssmile;":0x2323, "sstarf;":0x22c6, + "star;":0x2606, "starf;":0x2605, + "straightepsilon;":0x3f5, "straightphi;":0x3d5, + "strns;":0xaf, "sub;":0x2282, + "subE;":0x2ac5, "subdot;":0x2abd, + "sube;":0x2286, "subedot;":0x2ac3, + "submult;":0x2ac1, "subnE;":0x2acb, + "subne;":0x228a, "subplus;":0x2abf, + "subrarr;":0x2979, "subset;":0x2282, + "subseteq;":0x2286, "subseteqq;":0x2ac5, + "subsetneq;":0x228a, "subsetneqq;":0x2acb, + "subsim;":0x2ac7, "subsub;":0x2ad5, + "subsup;":0x2ad3, "succ;":0x227b, + "succapprox;":0x2ab8, "succcurlyeq;":0x227d, + "succeq;":0x2ab0, "succnapprox;":0x2aba, + "succneqq;":0x2ab6, "succnsim;":0x22e9, + "succsim;":0x227f, "sum;":0x2211, + "sung;":0x266a, "sup1":0xb9, + "sup1;":0xb9, "sup2":0xb2, + "sup2;":0xb2, "sup3":0xb3, + "sup3;":0xb3, "sup;":0x2283, + "supE;":0x2ac6, "supdot;":0x2abe, + "supdsub;":0x2ad8, "supe;":0x2287, + "supedot;":0x2ac4, "suphsol;":0x27c9, + "suphsub;":0x2ad7, "suplarr;":0x297b, + "supmult;":0x2ac2, "supnE;":0x2acc, + "supne;":0x228b, "supplus;":0x2ac0, + "supset;":0x2283, "supseteq;":0x2287, + "supseteqq;":0x2ac6, "supsetneq;":0x228b, + "supsetneqq;":0x2acc, "supsim;":0x2ac8, + "supsub;":0x2ad4, "supsup;":0x2ad6, + "swArr;":0x21d9, "swarhk;":0x2926, + "swarr;":0x2199, "swarrow;":0x2199, + "swnwar;":0x292a, "szlig":0xdf, + "szlig;":0xdf, "target;":0x2316, + "tau;":0x3c4, "tbrk;":0x23b4, + "tcaron;":0x165, "tcedil;":0x163, + "tcy;":0x442, "tdot;":0x20db, + "telrec;":0x2315, "tfr;":[0xd835,0xdd31], + "there4;":0x2234, "therefore;":0x2234, + "theta;":0x3b8, "thetasym;":0x3d1, + "thetav;":0x3d1, "thickapprox;":0x2248, + "thicksim;":0x223c, "thinsp;":0x2009, + "thkap;":0x2248, "thksim;":0x223c, + "thorn":0xfe, "thorn;":0xfe, + "tilde;":0x2dc, "times":0xd7, + "times;":0xd7, "timesb;":0x22a0, + "timesbar;":0x2a31, "timesd;":0x2a30, + "tint;":0x222d, "toea;":0x2928, + "top;":0x22a4, "topbot;":0x2336, + "topcir;":0x2af1, "topf;":[0xd835,0xdd65], + "topfork;":0x2ada, "tosa;":0x2929, + "tprime;":0x2034, "trade;":0x2122, + "triangle;":0x25b5, "triangledown;":0x25bf, + "triangleleft;":0x25c3, "trianglelefteq;":0x22b4, + "triangleq;":0x225c, "triangleright;":0x25b9, + "trianglerighteq;":0x22b5, "tridot;":0x25ec, + "trie;":0x225c, "triminus;":0x2a3a, + "triplus;":0x2a39, "trisb;":0x29cd, + "tritime;":0x2a3b, "trpezium;":0x23e2, + "tscr;":[0xd835,0xdcc9], "tscy;":0x446, + "tshcy;":0x45b, "tstrok;":0x167, + "twixt;":0x226c, "twoheadleftarrow;":0x219e, + "twoheadrightarrow;":0x21a0, "uArr;":0x21d1, + "uHar;":0x2963, "uacute":0xfa, + "uacute;":0xfa, "uarr;":0x2191, + "ubrcy;":0x45e, "ubreve;":0x16d, + "ucirc":0xfb, "ucirc;":0xfb, + "ucy;":0x443, "udarr;":0x21c5, + "udblac;":0x171, "udhar;":0x296e, + "ufisht;":0x297e, "ufr;":[0xd835,0xdd32], + "ugrave":0xf9, "ugrave;":0xf9, + "uharl;":0x21bf, "uharr;":0x21be, + "uhblk;":0x2580, "ulcorn;":0x231c, + "ulcorner;":0x231c, "ulcrop;":0x230f, + "ultri;":0x25f8, "umacr;":0x16b, + "uml":0xa8, "uml;":0xa8, + "uogon;":0x173, "uopf;":[0xd835,0xdd66], + "uparrow;":0x2191, "updownarrow;":0x2195, + "upharpoonleft;":0x21bf, "upharpoonright;":0x21be, + "uplus;":0x228e, "upsi;":0x3c5, + "upsih;":0x3d2, "upsilon;":0x3c5, + "upuparrows;":0x21c8, "urcorn;":0x231d, + "urcorner;":0x231d, "urcrop;":0x230e, + "uring;":0x16f, "urtri;":0x25f9, + "uscr;":[0xd835,0xdcca], "utdot;":0x22f0, + "utilde;":0x169, "utri;":0x25b5, + "utrif;":0x25b4, "uuarr;":0x21c8, + "uuml":0xfc, "uuml;":0xfc, + "uwangle;":0x29a7, "vArr;":0x21d5, + "vBar;":0x2ae8, "vBarv;":0x2ae9, + "vDash;":0x22a8, "vangrt;":0x299c, + "varepsilon;":0x3f5, "varkappa;":0x3f0, + "varnothing;":0x2205, "varphi;":0x3d5, + "varpi;":0x3d6, "varpropto;":0x221d, + "varr;":0x2195, "varrho;":0x3f1, + "varsigma;":0x3c2, "varsubsetneq;":[0x228a,0xfe00], + "varsubsetneqq;":[0x2acb,0xfe00], "varsupsetneq;":[0x228b,0xfe00], + "varsupsetneqq;":[0x2acc,0xfe00], "vartheta;":0x3d1, + "vartriangleleft;":0x22b2, "vartriangleright;":0x22b3, + "vcy;":0x432, "vdash;":0x22a2, + "vee;":0x2228, "veebar;":0x22bb, + "veeeq;":0x225a, "vellip;":0x22ee, + "verbar;":0x7c, "vert;":0x7c, + "vfr;":[0xd835,0xdd33], "vltri;":0x22b2, + "vnsub;":[0x2282,0x20d2], "vnsup;":[0x2283,0x20d2], + "vopf;":[0xd835,0xdd67], "vprop;":0x221d, + "vrtri;":0x22b3, "vscr;":[0xd835,0xdccb], + "vsubnE;":[0x2acb,0xfe00], "vsubne;":[0x228a,0xfe00], + "vsupnE;":[0x2acc,0xfe00], "vsupne;":[0x228b,0xfe00], + "vzigzag;":0x299a, "wcirc;":0x175, + "wedbar;":0x2a5f, "wedge;":0x2227, + "wedgeq;":0x2259, "weierp;":0x2118, + "wfr;":[0xd835,0xdd34], "wopf;":[0xd835,0xdd68], + "wp;":0x2118, "wr;":0x2240, + "wreath;":0x2240, "wscr;":[0xd835,0xdccc], + "xcap;":0x22c2, "xcirc;":0x25ef, + "xcup;":0x22c3, "xdtri;":0x25bd, + "xfr;":[0xd835,0xdd35], "xhArr;":0x27fa, + "xharr;":0x27f7, "xi;":0x3be, + "xlArr;":0x27f8, "xlarr;":0x27f5, + "xmap;":0x27fc, "xnis;":0x22fb, + "xodot;":0x2a00, "xopf;":[0xd835,0xdd69], + "xoplus;":0x2a01, "xotime;":0x2a02, + "xrArr;":0x27f9, "xrarr;":0x27f6, + "xscr;":[0xd835,0xdccd], "xsqcup;":0x2a06, + "xuplus;":0x2a04, "xutri;":0x25b3, + "xvee;":0x22c1, "xwedge;":0x22c0, + "yacute":0xfd, "yacute;":0xfd, + "yacy;":0x44f, "ycirc;":0x177, + "ycy;":0x44b, "yen":0xa5, + "yen;":0xa5, "yfr;":[0xd835,0xdd36], + "yicy;":0x457, "yopf;":[0xd835,0xdd6a], + "yscr;":[0xd835,0xdcce], "yucy;":0x44e, + "yuml":0xff, "yuml;":0xff, + "zacute;":0x17a, "zcaron;":0x17e, + "zcy;":0x437, "zdot;":0x17c, + "zeetrf;":0x2128, "zeta;":0x3b6, + "zfr;":[0xd835,0xdd37], "zhcy;":0x436, + "zigrarr;":0x21dd, "zopf;":[0xd835,0xdd6b], + "zscr;":[0xd835,0xdccf], "zwj;":0x200d, + "zwnj;":0x200c, +}; +/* + * This regexp is generated with test/tools/update-entities.js + * It will always match at least one character -- but note that there + * are no entities whose names are a single character long. + */ +var NAMEDCHARREF = /(A(?:Elig;?|MP;?|acute;?|breve;|c(?:irc;?|y;)|fr;|grave;?|lpha;|macr;|nd;|o(?:gon;|pf;)|pplyFunction;|ring;?|s(?:cr;|sign;)|tilde;?|uml;?)|B(?:a(?:ckslash;|r(?:v;|wed;))|cy;|e(?:cause;|rnoullis;|ta;)|fr;|opf;|reve;|scr;|umpeq;)|C(?:Hcy;|OPY;?|a(?:cute;|p(?:;|italDifferentialD;)|yleys;)|c(?:aron;|edil;?|irc;|onint;)|dot;|e(?:dilla;|nterDot;)|fr;|hi;|ircle(?:Dot;|Minus;|Plus;|Times;)|lo(?:ckwiseContourIntegral;|seCurly(?:DoubleQuote;|Quote;))|o(?:lon(?:;|e;)|n(?:gruent;|int;|tourIntegral;)|p(?:f;|roduct;)|unterClockwiseContourIntegral;)|ross;|scr;|up(?:;|Cap;))|D(?:D(?:;|otrahd;)|Jcy;|Scy;|Zcy;|a(?:gger;|rr;|shv;)|c(?:aron;|y;)|el(?:;|ta;)|fr;|i(?:a(?:critical(?:Acute;|Do(?:t;|ubleAcute;)|Grave;|Tilde;)|mond;)|fferentialD;)|o(?:pf;|t(?:;|Dot;|Equal;)|uble(?:ContourIntegral;|Do(?:t;|wnArrow;)|L(?:eft(?:Arrow;|RightArrow;|Tee;)|ong(?:Left(?:Arrow;|RightArrow;)|RightArrow;))|Right(?:Arrow;|Tee;)|Up(?:Arrow;|DownArrow;)|VerticalBar;)|wn(?:Arrow(?:;|Bar;|UpArrow;)|Breve;|Left(?:RightVector;|TeeVector;|Vector(?:;|Bar;))|Right(?:TeeVector;|Vector(?:;|Bar;))|Tee(?:;|Arrow;)|arrow;))|s(?:cr;|trok;))|E(?:NG;|TH;?|acute;?|c(?:aron;|irc;?|y;)|dot;|fr;|grave;?|lement;|m(?:acr;|pty(?:SmallSquare;|VerySmallSquare;))|o(?:gon;|pf;)|psilon;|qu(?:al(?:;|Tilde;)|ilibrium;)|s(?:cr;|im;)|ta;|uml;?|x(?:ists;|ponentialE;))|F(?:cy;|fr;|illed(?:SmallSquare;|VerySmallSquare;)|o(?:pf;|rAll;|uriertrf;)|scr;)|G(?:Jcy;|T;?|amma(?:;|d;)|breve;|c(?:edil;|irc;|y;)|dot;|fr;|g;|opf;|reater(?:Equal(?:;|Less;)|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|scr;|t;)|H(?:ARDcy;|a(?:cek;|t;)|circ;|fr;|ilbertSpace;|o(?:pf;|rizontalLine;)|s(?:cr;|trok;)|ump(?:DownHump;|Equal;))|I(?:Ecy;|Jlig;|Ocy;|acute;?|c(?:irc;?|y;)|dot;|fr;|grave;?|m(?:;|a(?:cr;|ginaryI;)|plies;)|n(?:t(?:;|e(?:gral;|rsection;))|visible(?:Comma;|Times;))|o(?:gon;|pf;|ta;)|scr;|tilde;|u(?:kcy;|ml;?))|J(?:c(?:irc;|y;)|fr;|opf;|s(?:cr;|ercy;)|ukcy;)|K(?:Hcy;|Jcy;|appa;|c(?:edil;|y;)|fr;|opf;|scr;)|L(?:Jcy;|T;?|a(?:cute;|mbda;|ng;|placetrf;|rr;)|c(?:aron;|edil;|y;)|e(?:ft(?:A(?:ngleBracket;|rrow(?:;|Bar;|RightArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|Right(?:Arrow;|Vector;)|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;|rightarrow;)|ss(?:EqualGreater;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;))|fr;|l(?:;|eftarrow;)|midot;|o(?:ng(?:Left(?:Arrow;|RightArrow;)|RightArrow;|left(?:arrow;|rightarrow;)|rightarrow;)|pf;|wer(?:LeftArrow;|RightArrow;))|s(?:cr;|h;|trok;)|t;)|M(?:ap;|cy;|e(?:diumSpace;|llintrf;)|fr;|inusPlus;|opf;|scr;|u;)|N(?:Jcy;|acute;|c(?:aron;|edil;|y;)|e(?:gative(?:MediumSpace;|Thi(?:ckSpace;|nSpace;)|VeryThinSpace;)|sted(?:GreaterGreater;|LessLess;)|wLine;)|fr;|o(?:Break;|nBreakingSpace;|pf;|t(?:;|C(?:ongruent;|upCap;)|DoubleVerticalBar;|E(?:lement;|qual(?:;|Tilde;)|xists;)|Greater(?:;|Equal;|FullEqual;|Greater;|Less;|SlantEqual;|Tilde;)|Hump(?:DownHump;|Equal;)|Le(?:ftTriangle(?:;|Bar;|Equal;)|ss(?:;|Equal;|Greater;|Less;|SlantEqual;|Tilde;))|Nested(?:GreaterGreater;|LessLess;)|Precedes(?:;|Equal;|SlantEqual;)|R(?:everseElement;|ightTriangle(?:;|Bar;|Equal;))|S(?:quareSu(?:bset(?:;|Equal;)|perset(?:;|Equal;))|u(?:bset(?:;|Equal;)|cceeds(?:;|Equal;|SlantEqual;|Tilde;)|perset(?:;|Equal;)))|Tilde(?:;|Equal;|FullEqual;|Tilde;)|VerticalBar;))|scr;|tilde;?|u;)|O(?:Elig;|acute;?|c(?:irc;?|y;)|dblac;|fr;|grave;?|m(?:acr;|ega;|icron;)|opf;|penCurly(?:DoubleQuote;|Quote;)|r;|s(?:cr;|lash;?)|ti(?:lde;?|mes;)|uml;?|ver(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;))|P(?:artialD;|cy;|fr;|hi;|i;|lusMinus;|o(?:incareplane;|pf;)|r(?:;|ecedes(?:;|Equal;|SlantEqual;|Tilde;)|ime;|o(?:duct;|portion(?:;|al;)))|s(?:cr;|i;))|Q(?:UOT;?|fr;|opf;|scr;)|R(?:Barr;|EG;?|a(?:cute;|ng;|rr(?:;|tl;))|c(?:aron;|edil;|y;)|e(?:;|verse(?:E(?:lement;|quilibrium;)|UpEquilibrium;))|fr;|ho;|ight(?:A(?:ngleBracket;|rrow(?:;|Bar;|LeftArrow;))|Ceiling;|Do(?:ubleBracket;|wn(?:TeeVector;|Vector(?:;|Bar;)))|Floor;|T(?:ee(?:;|Arrow;|Vector;)|riangle(?:;|Bar;|Equal;))|Up(?:DownVector;|TeeVector;|Vector(?:;|Bar;))|Vector(?:;|Bar;)|arrow;)|o(?:pf;|undImplies;)|rightarrow;|s(?:cr;|h;)|uleDelayed;)|S(?:H(?:CHcy;|cy;)|OFTcy;|acute;|c(?:;|aron;|edil;|irc;|y;)|fr;|hort(?:DownArrow;|LeftArrow;|RightArrow;|UpArrow;)|igma;|mallCircle;|opf;|q(?:rt;|uare(?:;|Intersection;|Su(?:bset(?:;|Equal;)|perset(?:;|Equal;))|Union;))|scr;|tar;|u(?:b(?:;|set(?:;|Equal;))|c(?:ceeds(?:;|Equal;|SlantEqual;|Tilde;)|hThat;)|m;|p(?:;|erset(?:;|Equal;)|set;)))|T(?:HORN;?|RADE;|S(?:Hcy;|cy;)|a(?:b;|u;)|c(?:aron;|edil;|y;)|fr;|h(?:e(?:refore;|ta;)|i(?:ckSpace;|nSpace;))|ilde(?:;|Equal;|FullEqual;|Tilde;)|opf;|ripleDot;|s(?:cr;|trok;))|U(?:a(?:cute;?|rr(?:;|ocir;))|br(?:cy;|eve;)|c(?:irc;?|y;)|dblac;|fr;|grave;?|macr;|n(?:der(?:B(?:ar;|rac(?:e;|ket;))|Parenthesis;)|ion(?:;|Plus;))|o(?:gon;|pf;)|p(?:Arrow(?:;|Bar;|DownArrow;)|DownArrow;|Equilibrium;|Tee(?:;|Arrow;)|arrow;|downarrow;|per(?:LeftArrow;|RightArrow;)|si(?:;|lon;))|ring;|scr;|tilde;|uml;?)|V(?:Dash;|bar;|cy;|dash(?:;|l;)|e(?:e;|r(?:bar;|t(?:;|ical(?:Bar;|Line;|Separator;|Tilde;))|yThinSpace;))|fr;|opf;|scr;|vdash;)|W(?:circ;|edge;|fr;|opf;|scr;)|X(?:fr;|i;|opf;|scr;)|Y(?:Acy;|Icy;|Ucy;|acute;?|c(?:irc;|y;)|fr;|opf;|scr;|uml;)|Z(?:Hcy;|acute;|c(?:aron;|y;)|dot;|e(?:roWidthSpace;|ta;)|fr;|opf;|scr;)|a(?:acute;?|breve;|c(?:;|E;|d;|irc;?|ute;?|y;)|elig;?|f(?:;|r;)|grave;?|l(?:e(?:fsym;|ph;)|pha;)|m(?:a(?:cr;|lg;)|p;?)|n(?:d(?:;|and;|d;|slope;|v;)|g(?:;|e;|le;|msd(?:;|a(?:a;|b;|c;|d;|e;|f;|g;|h;))|rt(?:;|vb(?:;|d;))|s(?:ph;|t;)|zarr;))|o(?:gon;|pf;)|p(?:;|E;|acir;|e;|id;|os;|prox(?:;|eq;))|ring;?|s(?:cr;|t;|ymp(?:;|eq;))|tilde;?|uml;?|w(?:conint;|int;))|b(?:Not;|a(?:ck(?:cong;|epsilon;|prime;|sim(?:;|eq;))|r(?:vee;|wed(?:;|ge;)))|brk(?:;|tbrk;)|c(?:ong;|y;)|dquo;|e(?:caus(?:;|e;)|mptyv;|psi;|rnou;|t(?:a;|h;|ween;))|fr;|ig(?:c(?:ap;|irc;|up;)|o(?:dot;|plus;|times;)|s(?:qcup;|tar;)|triangle(?:down;|up;)|uplus;|vee;|wedge;)|karow;|l(?:a(?:ck(?:lozenge;|square;|triangle(?:;|down;|left;|right;))|nk;)|k(?:1(?:2;|4;)|34;)|ock;)|n(?:e(?:;|quiv;)|ot;)|o(?:pf;|t(?:;|tom;)|wtie;|x(?:D(?:L;|R;|l;|r;)|H(?:;|D;|U;|d;|u;)|U(?:L;|R;|l;|r;)|V(?:;|H;|L;|R;|h;|l;|r;)|box;|d(?:L;|R;|l;|r;)|h(?:;|D;|U;|d;|u;)|minus;|plus;|times;|u(?:L;|R;|l;|r;)|v(?:;|H;|L;|R;|h;|l;|r;)))|prime;|r(?:eve;|vbar;?)|s(?:cr;|emi;|im(?:;|e;)|ol(?:;|b;|hsub;))|u(?:ll(?:;|et;)|mp(?:;|E;|e(?:;|q;))))|c(?:a(?:cute;|p(?:;|and;|brcup;|c(?:ap;|up;)|dot;|s;)|r(?:et;|on;))|c(?:a(?:ps;|ron;)|edil;?|irc;|ups(?:;|sm;))|dot;|e(?:dil;?|mptyv;|nt(?:;|erdot;|))|fr;|h(?:cy;|eck(?:;|mark;)|i;)|ir(?:;|E;|c(?:;|eq;|le(?:arrow(?:left;|right;)|d(?:R;|S;|ast;|circ;|dash;)))|e;|fnint;|mid;|scir;)|lubs(?:;|uit;)|o(?:lon(?:;|e(?:;|q;))|m(?:ma(?:;|t;)|p(?:;|fn;|le(?:ment;|xes;)))|n(?:g(?:;|dot;)|int;)|p(?:f;|rod;|y(?:;|sr;|)))|r(?:arr;|oss;)|s(?:cr;|u(?:b(?:;|e;)|p(?:;|e;)))|tdot;|u(?:darr(?:l;|r;)|e(?:pr;|sc;)|larr(?:;|p;)|p(?:;|brcap;|c(?:ap;|up;)|dot;|or;|s;)|r(?:arr(?:;|m;)|ly(?:eq(?:prec;|succ;)|vee;|wedge;)|ren;?|vearrow(?:left;|right;))|vee;|wed;)|w(?:conint;|int;)|ylcty;)|d(?:Arr;|Har;|a(?:gger;|leth;|rr;|sh(?:;|v;))|b(?:karow;|lac;)|c(?:aron;|y;)|d(?:;|a(?:gger;|rr;)|otseq;)|e(?:g;?|lta;|mptyv;)|f(?:isht;|r;)|har(?:l;|r;)|i(?:am(?:;|ond(?:;|suit;)|s;)|e;|gamma;|sin;|v(?:;|ide(?:;|ontimes;|)|onx;))|jcy;|lc(?:orn;|rop;)|o(?:llar;|pf;|t(?:;|eq(?:;|dot;)|minus;|plus;|square;)|ublebarwedge;|wn(?:arrow;|downarrows;|harpoon(?:left;|right;)))|r(?:bkarow;|c(?:orn;|rop;))|s(?:c(?:r;|y;)|ol;|trok;)|t(?:dot;|ri(?:;|f;))|u(?:arr;|har;)|wangle;|z(?:cy;|igrarr;))|e(?:D(?:Dot;|ot;)|a(?:cute;?|ster;)|c(?:aron;|ir(?:;|c;?)|olon;|y;)|dot;|e;|f(?:Dot;|r;)|g(?:;|rave;?|s(?:;|dot;))|l(?:;|inters;|l;|s(?:;|dot;))|m(?:acr;|pty(?:;|set;|v;)|sp(?:1(?:3;|4;)|;))|n(?:g;|sp;)|o(?:gon;|pf;)|p(?:ar(?:;|sl;)|lus;|si(?:;|lon;|v;))|q(?:c(?:irc;|olon;)|s(?:im;|lant(?:gtr;|less;))|u(?:als;|est;|iv(?:;|DD;))|vparsl;)|r(?:Dot;|arr;)|s(?:cr;|dot;|im;)|t(?:a;|h;?)|u(?:ml;?|ro;)|x(?:cl;|ist;|p(?:ectation;|onentiale;)))|f(?:allingdotseq;|cy;|emale;|f(?:ilig;|l(?:ig;|lig;)|r;)|ilig;|jlig;|l(?:at;|lig;|tns;)|nof;|o(?:pf;|r(?:all;|k(?:;|v;)))|partint;|r(?:a(?:c(?:1(?:2;?|3;|4;?|5;|6;|8;)|2(?:3;|5;)|3(?:4;?|5;|8;)|45;|5(?:6;|8;)|78;)|sl;)|own;)|scr;)|g(?:E(?:;|l;)|a(?:cute;|mma(?:;|d;)|p;)|breve;|c(?:irc;|y;)|dot;|e(?:;|l;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|l;))|l(?:;|es;)))|fr;|g(?:;|g;)|imel;|jcy;|l(?:;|E;|a;|j;)|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|opf;|rave;|s(?:cr;|im(?:;|e;|l;))|t(?:;|c(?:c;|ir;)|dot;|lPar;|quest;|r(?:a(?:pprox;|rr;)|dot;|eq(?:less;|qless;)|less;|sim;)|)|v(?:ertneqq;|nE;))|h(?:Arr;|a(?:irsp;|lf;|milt;|r(?:dcy;|r(?:;|cir;|w;)))|bar;|circ;|e(?:arts(?:;|uit;)|llip;|rcon;)|fr;|ks(?:earow;|warow;)|o(?:arr;|mtht;|ok(?:leftarrow;|rightarrow;)|pf;|rbar;)|s(?:cr;|lash;|trok;)|y(?:bull;|phen;))|i(?:acute;?|c(?:;|irc;?|y;)|e(?:cy;|xcl;?)|f(?:f;|r;)|grave;?|i(?:;|i(?:int;|nt;)|nfin;|ota;)|jlig;|m(?:a(?:cr;|g(?:e;|line;|part;)|th;)|of;|ped;)|n(?:;|care;|fin(?:;|tie;)|odot;|t(?:;|cal;|e(?:gers;|rcal;)|larhk;|prod;))|o(?:cy;|gon;|pf;|ta;)|prod;|quest;?|s(?:cr;|in(?:;|E;|dot;|s(?:;|v;)|v;))|t(?:;|ilde;)|u(?:kcy;|ml;?))|j(?:c(?:irc;|y;)|fr;|math;|opf;|s(?:cr;|ercy;)|ukcy;)|k(?:appa(?:;|v;)|c(?:edil;|y;)|fr;|green;|hcy;|jcy;|opf;|scr;)|l(?:A(?:arr;|rr;|tail;)|Barr;|E(?:;|g;)|Har;|a(?:cute;|emptyv;|gran;|mbda;|ng(?:;|d;|le;)|p;|quo;?|rr(?:;|b(?:;|fs;)|fs;|hk;|lp;|pl;|sim;|tl;)|t(?:;|ail;|e(?:;|s;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|quo(?:;|r;)|r(?:dhar;|ushar;)|sh;)|e(?:;|ft(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|leftarrows;|right(?:arrow(?:;|s;)|harpoons;|squigarrow;)|threetimes;)|g;|q(?:;|q;|slant;)|s(?:;|cc;|dot(?:;|o(?:;|r;))|g(?:;|es;)|s(?:approx;|dot;|eq(?:gtr;|qgtr;)|gtr;|sim;)))|f(?:isht;|loor;|r;)|g(?:;|E;)|h(?:ar(?:d;|u(?:;|l;))|blk;)|jcy;|l(?:;|arr;|corner;|hard;|tri;)|m(?:idot;|oust(?:;|ache;))|n(?:E;|ap(?:;|prox;)|e(?:;|q(?:;|q;))|sim;)|o(?:a(?:ng;|rr;)|brk;|ng(?:left(?:arrow;|rightarrow;)|mapsto;|rightarrow;)|oparrow(?:left;|right;)|p(?:ar;|f;|lus;)|times;|w(?:ast;|bar;)|z(?:;|enge;|f;))|par(?:;|lt;)|r(?:arr;|corner;|har(?:;|d;)|m;|tri;)|s(?:aquo;|cr;|h;|im(?:;|e;|g;)|q(?:b;|uo(?:;|r;))|trok;)|t(?:;|c(?:c;|ir;)|dot;|hree;|imes;|larr;|quest;|r(?:Par;|i(?:;|e;|f;))|)|ur(?:dshar;|uhar;)|v(?:ertneqq;|nE;))|m(?:DDot;|a(?:cr;?|l(?:e;|t(?:;|ese;))|p(?:;|sto(?:;|down;|left;|up;))|rker;)|c(?:omma;|y;)|dash;|easuredangle;|fr;|ho;|i(?:cro;?|d(?:;|ast;|cir;|dot;?)|nus(?:;|b;|d(?:;|u;)))|l(?:cp;|dr;)|nplus;|o(?:dels;|pf;)|p;|s(?:cr;|tpos;)|u(?:;|ltimap;|map;))|n(?:G(?:g;|t(?:;|v;))|L(?:eft(?:arrow;|rightarrow;)|l;|t(?:;|v;))|Rightarrow;|V(?:Dash;|dash;)|a(?:bla;|cute;|ng;|p(?:;|E;|id;|os;|prox;)|tur(?:;|al(?:;|s;)))|b(?:sp;?|ump(?:;|e;))|c(?:a(?:p;|ron;)|edil;|ong(?:;|dot;)|up;|y;)|dash;|e(?:;|Arr;|ar(?:hk;|r(?:;|ow;))|dot;|quiv;|s(?:ear;|im;)|xist(?:;|s;))|fr;|g(?:E;|e(?:;|q(?:;|q;|slant;)|s;)|sim;|t(?:;|r;))|h(?:Arr;|arr;|par;)|i(?:;|s(?:;|d;)|v;)|jcy;|l(?:Arr;|E;|arr;|dr;|e(?:;|ft(?:arrow;|rightarrow;)|q(?:;|q;|slant;)|s(?:;|s;))|sim;|t(?:;|ri(?:;|e;)))|mid;|o(?:pf;|t(?:;|in(?:;|E;|dot;|v(?:a;|b;|c;))|ni(?:;|v(?:a;|b;|c;))|))|p(?:ar(?:;|allel;|sl;|t;)|olint;|r(?:;|cue;|e(?:;|c(?:;|eq;))))|r(?:Arr;|arr(?:;|c;|w;)|ightarrow;|tri(?:;|e;))|s(?:c(?:;|cue;|e;|r;)|hort(?:mid;|parallel;)|im(?:;|e(?:;|q;))|mid;|par;|qsu(?:be;|pe;)|u(?:b(?:;|E;|e;|set(?:;|eq(?:;|q;)))|cc(?:;|eq;)|p(?:;|E;|e;|set(?:;|eq(?:;|q;)))))|t(?:gl;|ilde;?|lg;|riangle(?:left(?:;|eq;)|right(?:;|eq;)))|u(?:;|m(?:;|ero;|sp;))|v(?:Dash;|Harr;|ap;|dash;|g(?:e;|t;)|infin;|l(?:Arr;|e;|t(?:;|rie;))|r(?:Arr;|trie;)|sim;)|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|near;))|o(?:S;|a(?:cute;?|st;)|c(?:ir(?:;|c;?)|y;)|d(?:ash;|blac;|iv;|ot;|sold;)|elig;|f(?:cir;|r;)|g(?:on;|rave;?|t;)|h(?:bar;|m;)|int;|l(?:arr;|c(?:ir;|ross;)|ine;|t;)|m(?:acr;|ega;|i(?:cron;|d;|nus;))|opf;|p(?:ar;|erp;|lus;)|r(?:;|arr;|d(?:;|er(?:;|of;)|f;?|m;?)|igof;|or;|slope;|v;)|s(?:cr;|lash;?|ol;)|ti(?:lde;?|mes(?:;|as;))|uml;?|vbar;)|p(?:ar(?:;|a(?:;|llel;|)|s(?:im;|l;)|t;)|cy;|er(?:cnt;|iod;|mil;|p;|tenk;)|fr;|h(?:i(?:;|v;)|mmat;|one;)|i(?:;|tchfork;|v;)|l(?:an(?:ck(?:;|h;)|kv;)|us(?:;|acir;|b;|cir;|d(?:o;|u;)|e;|mn;?|sim;|two;))|m;|o(?:intint;|pf;|und;?)|r(?:;|E;|ap;|cue;|e(?:;|c(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;))|ime(?:;|s;)|n(?:E;|ap;|sim;)|o(?:d;|f(?:alar;|line;|surf;)|p(?:;|to;))|sim;|urel;)|s(?:cr;|i;)|uncsp;)|q(?:fr;|int;|opf;|prime;|scr;|u(?:at(?:ernions;|int;)|est(?:;|eq;)|ot;?))|r(?:A(?:arr;|rr;|tail;)|Barr;|Har;|a(?:c(?:e;|ute;)|dic;|emptyv;|ng(?:;|d;|e;|le;)|quo;?|rr(?:;|ap;|b(?:;|fs;)|c;|fs;|hk;|lp;|pl;|sim;|tl;|w;)|t(?:ail;|io(?:;|nals;)))|b(?:arr;|brk;|r(?:ac(?:e;|k;)|k(?:e;|sl(?:d;|u;))))|c(?:aron;|e(?:dil;|il;)|ub;|y;)|d(?:ca;|ldhar;|quo(?:;|r;)|sh;)|e(?:al(?:;|ine;|part;|s;)|ct;|g;?)|f(?:isht;|loor;|r;)|h(?:ar(?:d;|u(?:;|l;))|o(?:;|v;))|i(?:ght(?:arrow(?:;|tail;)|harpoon(?:down;|up;)|left(?:arrows;|harpoons;)|rightarrows;|squigarrow;|threetimes;)|ng;|singdotseq;)|l(?:arr;|har;|m;)|moust(?:;|ache;)|nmid;|o(?:a(?:ng;|rr;)|brk;|p(?:ar;|f;|lus;)|times;)|p(?:ar(?:;|gt;)|polint;)|rarr;|s(?:aquo;|cr;|h;|q(?:b;|uo(?:;|r;)))|t(?:hree;|imes;|ri(?:;|e;|f;|ltri;))|uluhar;|x;)|s(?:acute;|bquo;|c(?:;|E;|a(?:p;|ron;)|cue;|e(?:;|dil;)|irc;|n(?:E;|ap;|sim;)|polint;|sim;|y;)|dot(?:;|b;|e;)|e(?:Arr;|ar(?:hk;|r(?:;|ow;))|ct;?|mi;|swar;|tm(?:inus;|n;)|xt;)|fr(?:;|own;)|h(?:arp;|c(?:hcy;|y;)|ort(?:mid;|parallel;)|y;?)|i(?:gma(?:;|f;|v;)|m(?:;|dot;|e(?:;|q;)|g(?:;|E;)|l(?:;|E;)|ne;|plus;|rarr;))|larr;|m(?:a(?:llsetminus;|shp;)|eparsl;|i(?:d;|le;)|t(?:;|e(?:;|s;)))|o(?:ftcy;|l(?:;|b(?:;|ar;))|pf;)|pa(?:des(?:;|uit;)|r;)|q(?:c(?:ap(?:;|s;)|up(?:;|s;))|su(?:b(?:;|e;|set(?:;|eq;))|p(?:;|e;|set(?:;|eq;)))|u(?:;|ar(?:e;|f;)|f;))|rarr;|s(?:cr;|etmn;|mile;|tarf;)|t(?:ar(?:;|f;)|r(?:aight(?:epsilon;|phi;)|ns;))|u(?:b(?:;|E;|dot;|e(?:;|dot;)|mult;|n(?:E;|e;)|plus;|rarr;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;)))|cc(?:;|approx;|curlyeq;|eq;|n(?:approx;|eqq;|sim;)|sim;)|m;|ng;|p(?:1;?|2;?|3;?|;|E;|d(?:ot;|sub;)|e(?:;|dot;)|hs(?:ol;|ub;)|larr;|mult;|n(?:E;|e;)|plus;|s(?:et(?:;|eq(?:;|q;)|neq(?:;|q;))|im;|u(?:b;|p;))))|w(?:Arr;|ar(?:hk;|r(?:;|ow;))|nwar;)|zlig;?)|t(?:a(?:rget;|u;)|brk;|c(?:aron;|edil;|y;)|dot;|elrec;|fr;|h(?:e(?:re(?:4;|fore;)|ta(?:;|sym;|v;))|i(?:ck(?:approx;|sim;)|nsp;)|k(?:ap;|sim;)|orn;?)|i(?:lde;|mes(?:;|b(?:;|ar;)|d;|)|nt;)|o(?:ea;|p(?:;|bot;|cir;|f(?:;|ork;))|sa;)|prime;|r(?:ade;|i(?:angle(?:;|down;|left(?:;|eq;)|q;|right(?:;|eq;))|dot;|e;|minus;|plus;|sb;|time;)|pezium;)|s(?:c(?:r;|y;)|hcy;|trok;)|w(?:ixt;|ohead(?:leftarrow;|rightarrow;)))|u(?:Arr;|Har;|a(?:cute;?|rr;)|br(?:cy;|eve;)|c(?:irc;?|y;)|d(?:arr;|blac;|har;)|f(?:isht;|r;)|grave;?|h(?:ar(?:l;|r;)|blk;)|l(?:c(?:orn(?:;|er;)|rop;)|tri;)|m(?:acr;|l;?)|o(?:gon;|pf;)|p(?:arrow;|downarrow;|harpoon(?:left;|right;)|lus;|si(?:;|h;|lon;)|uparrows;)|r(?:c(?:orn(?:;|er;)|rop;)|ing;|tri;)|scr;|t(?:dot;|ilde;|ri(?:;|f;))|u(?:arr;|ml;?)|wangle;)|v(?:Arr;|Bar(?:;|v;)|Dash;|a(?:ngrt;|r(?:epsilon;|kappa;|nothing;|p(?:hi;|i;|ropto;)|r(?:;|ho;)|s(?:igma;|u(?:bsetneq(?:;|q;)|psetneq(?:;|q;)))|t(?:heta;|riangle(?:left;|right;))))|cy;|dash;|e(?:e(?:;|bar;|eq;)|llip;|r(?:bar;|t;))|fr;|ltri;|nsu(?:b;|p;)|opf;|prop;|rtri;|s(?:cr;|u(?:bn(?:E;|e;)|pn(?:E;|e;)))|zigzag;)|w(?:circ;|e(?:d(?:bar;|ge(?:;|q;))|ierp;)|fr;|opf;|p;|r(?:;|eath;)|scr;)|x(?:c(?:ap;|irc;|up;)|dtri;|fr;|h(?:Arr;|arr;)|i;|l(?:Arr;|arr;)|map;|nis;|o(?:dot;|p(?:f;|lus;)|time;)|r(?:Arr;|arr;)|s(?:cr;|qcup;)|u(?:plus;|tri;)|vee;|wedge;)|y(?:ac(?:ute;?|y;)|c(?:irc;|y;)|en;?|fr;|icy;|opf;|scr;|u(?:cy;|ml;?))|z(?:acute;|c(?:aron;|y;)|dot;|e(?:etrf;|ta;)|fr;|hcy;|igrarr;|opf;|scr;|w(?:j;|nj;)))|[\s\S]/g; + +var NAMEDCHARREF_MAXLEN = 32; + +// Regular expression constants used by the tokenizer and parser + +// Note that \r is included in all of these regexps because it will need +// to be converted to LF by the scanChars() function. +var DBLQUOTEATTRVAL = /[^\r"&\u0000]+/g; +var SINGLEQUOTEATTRVAL = /[^\r'&\u0000]+/g; +var UNQUOTEDATTRVAL = /[^\r\t\n\f &>\u0000]+/g; +var TAGNAME = /[^\r\t\n\f \/>A-Z\u0000]+/g; +var ATTRNAME = /[^\r\t\n\f \/=>A-Z\u0000]+/g; + +var CDATATEXT = /[^\]\r\u0000\uffff]*/g; +var DATATEXT = /[^&<\r\u0000\uffff]*/g; +var RAWTEXT = /[^<\r\u0000\uffff]*/g; +var PLAINTEXT = /[^\r\u0000\uffff]*/g; +// Since we don't have the 'sticky tag', add '|.' to the end of SIMPLETAG +// and SIMPLEATTR so that we are guaranteed to always match. This prevents +// us from scanning past the lastIndex set. (Note that the desired matches +// are always greater than 1 char long, so longest-match will ensure that . +// is not matched unless the desired match fails.) +var SIMPLETAG = /(?:(\/)?([a-z]+)>)|[\s\S]/g; +var SIMPLEATTR = /(?:([-a-z]+)[ \t\n\f]*=[ \t\n\f]*('[^'&\r\u0000]*'|"[^"&\r\u0000]*"|[^\t\n\r\f "&'\u0000>][^&> \t\n\r\f\u0000]*[ \t\n\f]))|[\s\S]/g; + +var NONWS = /[^\x09\x0A\x0C\x0D\x20]/; +var ALLNONWS = /[^\x09\x0A\x0C\x0D\x20]/g; // like above, with g flag +var NONWSNONNUL = /[^\x00\x09\x0A\x0C\x0D\x20]/; // don't allow NUL either +var LEADINGWS = /^[\x09\x0A\x0C\x0D\x20]+/; +var NULCHARS = /\x00/g; + +/*** + * These are utility functions that don't use any of the parser's + * internal state. + */ +function buf2str(buf) { + var CHUNKSIZE=16384; + if (buf.length < CHUNKSIZE) { + return String.fromCharCode.apply(String, buf); + } + // special case for large strings, to avoid busting the stack. + var result = ''; + for (var i = 0; i < buf.length; i += CHUNKSIZE) { + result += String.fromCharCode.apply(String, buf.slice(i, i+CHUNKSIZE)); + } + return result; +} + +function str2buf(s) { + var result = []; + for (var i=0; i 0; i--) { + var e = this.elements[i]; + if (isA(e, tag)) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Pop elements off the stack up to and including the first +// element that is an instance of the specified type +HTMLParser.ElementStack.prototype.popElementType = function(type) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] instanceof type) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Pop elements off the stack up to and including the element e. +// Note that this is very different from removeElement() +// This requires that e is on the stack. +HTMLParser.ElementStack.prototype.popElement = function(e) { + for(var i = this.elements.length-1; i > 0; i--) { + if (this.elements[i] === e) break; + } + this.elements.length = i; + this.top = this.elements[i-1]; +}; + +// Remove a specific element from the stack. +// Do nothing if the element is not on the stack +HTMLParser.ElementStack.prototype.removeElement = function(e) { + if (this.top === e) this.pop(); + else { + var idx = this.elements.lastIndexOf(e); + if (idx !== -1) + this.elements.splice(idx, 1); + } +}; + +HTMLParser.ElementStack.prototype.clearToContext = function(set) { + // Note that we don't loop to 0. Never pop the elt off. + for(var i = this.elements.length-1; i > 0; i--) { + if (isA(this.elements[i], set)) break; + } + this.elements.length = i+1; + this.top = this.elements[i]; +}; + +HTMLParser.ElementStack.prototype.contains = function(tag) { + return this.inSpecificScope(tag, Object.create(null)); +}; + +HTMLParser.ElementStack.prototype.inSpecificScope = function(tag, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (isA(elt, tag)) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +// Like the above, but for a specific element, not a tagname +HTMLParser.ElementStack.prototype.elementInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt === target) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +// Like the above, but for an element interface, not a tagname +HTMLParser.ElementStack.prototype.elementTypeInSpecificScope = function(target, set) { + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt instanceof target) return true; + if (isA(elt, set)) return false; + } + return false; +}; + +HTMLParser.ElementStack.prototype.inScope = function(tag) { + return this.inSpecificScope(tag, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.elementInScope = function(e) { + return this.elementInSpecificScope(e, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.elementTypeInScope = function(type) { + return this.elementTypeInSpecificScope(type, inScopeSet); +}; + +HTMLParser.ElementStack.prototype.inButtonScope = function(tag) { + return this.inSpecificScope(tag, inButtonScopeSet); +}; + +HTMLParser.ElementStack.prototype.inListItemScope = function(tag) { + return this.inSpecificScope(tag, inListItemScopeSet); +}; + +HTMLParser.ElementStack.prototype.inTableScope = function(tag) { + return this.inSpecificScope(tag, inTableScopeSet); +}; + +HTMLParser.ElementStack.prototype.inSelectScope = function(tag) { + // Can't implement this one with inSpecificScope, since it involves + // a set defined by inverting another set. So implement manually. + for(var i = this.elements.length-1; i >= 0; i--) { + var elt = this.elements[i]; + if (elt.namespaceURI !== NAMESPACE.HTML) return false; + var localname = elt.localName; + if (localname === tag) return true; + if (localname !== "optgroup" && localname !== "option") + return false; + } + return false; +}; + +HTMLParser.ElementStack.prototype.generateImpliedEndTags = function(butnot, thorough) { + var endTagSet = thorough ? thoroughImpliedEndTagsSet : impliedEndTagsSet; + for(var i = this.elements.length-1; i >= 0; i--) { + var e = this.elements[i]; + if (butnot && isA(e, butnot)) break; + if (!isA(this.elements[i], endTagSet)) break; + } + + this.elements.length = i+1; + this.top = this.elements[i]; +}; + +/*** + * The ActiveFormattingElements class + */ +HTMLParser.ActiveFormattingElements = function AFE() { + this.list = []; // elements + this.attrs = []; // attribute tokens for cloning +}; + +HTMLParser.ActiveFormattingElements.prototype.MARKER = { localName: "|" }; + +/* +// For debugging +HTMLParser.ActiveFormattingElements.prototype.toString = function() { + return "AFE: " + + this.list.map(function(e) { return e.localName; }).join("-"); +} +*/ + +HTMLParser.ActiveFormattingElements.prototype.insertMarker = function() { + this.list.push(this.MARKER); + this.attrs.push(this.MARKER); +}; + +HTMLParser.ActiveFormattingElements.prototype.push = function(elt, attrs) { + // Scan backwards: if there are already 3 copies of this element + // before we encounter a marker, then drop the last one + var count = 0; + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + // equal() is defined below + if (equal(elt, this.list[i], this.attrs[i])) { + count++; + if (count === 3) { + this.list.splice(i, 1); + this.attrs.splice(i, 1); + break; + } + } + } + + + // Now push the element onto the list + this.list.push(elt); + + // Copy the attributes and push those on, too + var attrcopy = []; + for(var ii = 0; ii < attrs.length; ii++) { + attrcopy[ii] = attrs[ii]; + } + + this.attrs.push(attrcopy); + + // This function defines equality of two elements for the purposes + // of the AFE list. Note that it compares the new elements + // attributes to the saved array of attributes associated with + // the old element because a script could have changed the + // old element's set of attributes + function equal(newelt, oldelt, oldattrs) { + if (newelt.localName !== oldelt.localName) return false; + if (newelt._numattrs !== oldattrs.length) return false; + for(var i = 0, n = oldattrs.length; i < n; i++) { + var oldname = oldattrs[i][0]; + var oldval = oldattrs[i][1]; + if (!newelt.hasAttribute(oldname)) return false; + if (newelt.getAttribute(oldname) !== oldval) return false; + } + return true; + } +}; + +HTMLParser.ActiveFormattingElements.prototype.clearToMarker = function() { + for(var i = this.list.length-1; i >= 0; i--) { + if (this.list[i] === this.MARKER) break; + } + if (i < 0) i = 0; + this.list.length = i; + this.attrs.length = i; +}; + +// Find and return the last element with the specified tag between the +// end of the list and the last marker on the list. +// Used when parsing in_body_mode() +HTMLParser.ActiveFormattingElements.prototype.findElementByTag = function(tag) { + for(var i = this.list.length-1; i >= 0; i--) { + var elt = this.list[i]; + if (elt === this.MARKER) break; + if (elt.localName === tag) return elt; + } + return null; +}; + +HTMLParser.ActiveFormattingElements.prototype.indexOf = function(e) { + return this.list.lastIndexOf(e); +}; + +// Find the element e in the list and remove it +// Used when parsing in_body() +HTMLParser.ActiveFormattingElements.prototype.remove = function(e) { + var idx = this.list.lastIndexOf(e); + if (idx !== -1) { + this.list.splice(idx, 1); + this.attrs.splice(idx, 1); + } +}; + +// Find element a in the list and replace it with element b +// XXX: Do I need to handle attributes here? +HTMLParser.ActiveFormattingElements.prototype.replace = function(a, b, attrs) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list[idx] = b; + this.attrs[idx] = attrs; + } +}; + +// Find a in the list and insert b after it +// This is only used for insert a bookmark object, so the +// attrs array doesn't really matter +HTMLParser.ActiveFormattingElements.prototype.insertAfter = function(a,b) { + var idx = this.list.lastIndexOf(a); + if (idx !== -1) { + this.list.splice(idx, 0, b); + this.attrs.splice(idx, 0, b); + } +}; + + + + +/*** + * This is the parser factory function. It is the return value of + * the outer closure that it is defined within. Most of the parser + * implementation details are inside this function. + */ +function HTMLParser(address, fragmentContext, options) { + /*** + * These are the parser's state variables + */ + // Scanner state + var chars = null; + var numchars = 0; // Length of chars + var nextchar = 0; // Index of next char + var input_complete = false; // Becomes true when end() called. + var scanner_skip_newline = false; // If previous char was CR + var reentrant_invocations = 0; + var saved_scanner_state = []; + var leftovers = ""; + var first_batch = true; + var paused = 0; // Becomes non-zero while loading scripts + + + // Tokenizer state + var tokenizer = data_state; // Current tokenizer state + var return_state; + var character_reference_code; + var tagnamebuf = ""; + var lasttagname = ""; // holds the target end tag for text states + var tempbuf = []; + var attrnamebuf = ""; + var attrvaluebuf = ""; + var commentbuf = []; + var doctypenamebuf = []; + var doctypepublicbuf = []; + var doctypesystembuf = []; + var attributes = []; + var is_end_tag = false; + + // Tree builder state + var parser = initial_mode; // Current insertion mode + var originalInsertionMode = null; // A saved insertion mode + var templateInsertionModes = []; // Stack of template insertion modes. + var stack = new HTMLParser.ElementStack(); // Stack of open elements + var afe = new HTMLParser.ActiveFormattingElements(); // mis-nested tags + var fragment = (fragmentContext!==undefined); // For innerHTML, etc. + var head_element_pointer = null; + var form_element_pointer = null; + var scripting_enabled = true; + if (fragmentContext) { + scripting_enabled = fragmentContext.ownerDocument._scripting_enabled; + } + if (options && options.scripting_enabled === false) + scripting_enabled = false; + var frameset_ok = true; + var force_quirks = false; + var pending_table_text; + var text_integration_mode; // XXX a spec bug workaround? + + // A single run of characters, buffered up to be sent to + // the parser as a single string. + var textrun = []; + var textIncludesNUL = false; + var ignore_linefeed = false; + + /*** + * This is the parser object that will be the return value of this + * factory function, which is some 5000 lines below. + * Note that the variable "parser" is the current state of the + * parser's state machine. This variable "htmlparser" is the + * return value and defines the public API of the parser + */ + var htmlparser = { + document: function() { + return doc; + }, + + // Convenience function for internal use. Can only be called once, + // as it removes the nodes from `doc` to add them to fragment. + _asDocumentFragment: function() { + var frag = doc.createDocumentFragment(); + var root = doc.firstChild; + while(root.hasChildNodes()) { + frag.appendChild(root.firstChild); + } + return frag; + }, + + // Internal function used from HTMLScriptElement to pause the + // parser while a script is being loaded from the network + pause: function() { + // print("pausing parser"); + paused++; + }, + + // Called when a script finishes loading + resume: function() { + // print("resuming parser"); + paused--; + // XXX: added this to force a resumption. + // Is this the right thing to do? + this.parse(""); + }, + + // Parse the HTML text s. + // The second argument should be true if there is no more + // text to be parsed, and should be false or omitted otherwise. + // The second argument must not be set for recursive invocations + // from document.write() + parse: function(s, end, shouldPauseFunc) { + var moreToDo; + + // If we're paused, remember the text to parse, but + // don't parse it now. + // (Don't invoke shouldPauseFunc because we haven't handled 'end' yet.) + if (paused > 0) { + leftovers += s; + return true; // more to do + } + + + if (reentrant_invocations === 0) { + // A normal, top-level invocation + if (leftovers) { + s = leftovers + s; + leftovers = ""; + } + + // Add a special marker character to the end of + // the buffer. If the scanner is at the end of + // the buffer and input_complete is set, then this + // character will transform into an EOF token. + // Having an actual character that represents EOF + // in the character buffer makes lookahead regexp + // matching work more easily, and this is + // important for character references. + if (end) { + s += "\uFFFF"; + input_complete = true; // Makes scanChars() send EOF + } + + chars = s; + numchars = s.length; + nextchar = 0; + + if (first_batch) { + // We skip a leading Byte Order Mark (\uFEFF) + // on first batch of text we're given + first_batch = false; + if (chars.charCodeAt(0) === 0xFEFF) nextchar = 1; + } + + reentrant_invocations++; + moreToDo = scanChars(shouldPauseFunc); + leftovers = chars.substring(nextchar, numchars); + reentrant_invocations--; + } + else { + // This is the re-entrant case, which we have to + // handle a little differently. + reentrant_invocations++; + + // Save current scanner state + saved_scanner_state.push(chars, numchars, nextchar); + + // Set new scanner state + chars = s; + numchars = s.length; + nextchar = 0; + + // Now scan as many of these new chars as we can + scanChars(); + moreToDo = false; + + leftovers = chars.substring(nextchar, numchars); + + // restore old scanner state + nextchar = saved_scanner_state.pop(); + numchars = saved_scanner_state.pop(); + chars = saved_scanner_state.pop(); + + // If there were leftover chars from this invocation + // insert them into the pending invocation's buffer + // and trim already processed chars at the same time + if (leftovers) { + chars = leftovers + chars.substring(nextchar); + numchars = chars.length; + nextchar = 0; + leftovers = ""; + } + + // Decrement the counter + reentrant_invocations--; + } + return moreToDo; + } + }; + + + // This is the document we'll be building up + var doc = new Document(true, address); + + // The document needs to know about the parser, for document.write(). + // This _parser property will be deleted when we're done parsing. + doc._parser = htmlparser; + + // XXX I think that any document we use this parser on should support + // scripts. But I may need to configure that through a parser parameter + // Only documents with windows ("browsing contexts" to be precise) + // allow scripting. + doc._scripting_enabled = scripting_enabled; + + + /*** + * The actual code of the HTMLParser() factory function begins here. + */ + + if (fragmentContext) { // for innerHTML parsing + if (fragmentContext.ownerDocument._quirks) + doc._quirks = true; + if (fragmentContext.ownerDocument._limitedQuirks) + doc._limitedQuirks = true; + + // Set the initial tokenizer state + if (fragmentContext.namespaceURI === NAMESPACE.HTML) { + switch(fragmentContext.localName) { + case "title": + case "textarea": + tokenizer = rcdata_state; + break; + case "style": + case "xmp": + case "iframe": + case "noembed": + case "noframes": + case "script": + case "plaintext": + tokenizer = plaintext_state; + break; + } + } + + var root = doc.createElement("html"); + doc._appendChild(root); + stack.push(root); + if (fragmentContext instanceof impl.HTMLTemplateElement) { + templateInsertionModes.push(in_template_mode); + } + resetInsertionMode(); + + for(var e = fragmentContext; e !== null; e = e.parentElement) { + if (e instanceof impl.HTMLFormElement) { + form_element_pointer = e; + break; + } + } + } + + /*** + * Scanner functions + */ + // Loop through the characters in chars, and pass them one at a time + // to the tokenizer FSM. Return when no more characters can be processed + // (This may leave 1 or more characters in the buffer: like a CR + // waiting to see if the next char is LF, or for states that require + // lookahead...) + function scanChars(shouldPauseFunc) { + var codepoint, s, pattern, eof; + + while(nextchar < numchars) { + + // If we just tokenized a tag, then the paused flag + // may have been set to tell us to stop tokenizing while + // the script is loading + if (paused > 0 || (shouldPauseFunc && shouldPauseFunc())) { + return true; + } + + + switch(typeof tokenizer.lookahead) { + case 'undefined': + codepoint = chars.charCodeAt(nextchar++); + if (scanner_skip_newline) { + scanner_skip_newline = false; + if (codepoint === 0x000A) { + nextchar++; + continue; + } + } + switch(codepoint) { + case 0x000D: + // CR always turns into LF, but if the next character + // is LF, then that second LF is skipped. + if (nextchar < numchars) { + if (chars.charCodeAt(nextchar) === 0x000A) + nextchar++; + } + else { + // We don't know the next char right now, so we + // can't check if it is a LF. So set a flag + scanner_skip_newline = true; + } + + // In either case, emit a LF + tokenizer(0x000A); + + break; + case 0xFFFF: + if (input_complete && nextchar === numchars) { + tokenizer(EOF); // codepoint will be 0xFFFF here + break; + } + /* falls through */ + default: + tokenizer(codepoint); + break; + } + break; + + case 'number': + codepoint = chars.charCodeAt(nextchar); + + // The only tokenizer states that require fixed lookahead + // only consume alphanum characters, so we don't have + // to worry about CR and LF in this case + + // tokenizer wants n chars of lookahead + var n = tokenizer.lookahead; + var needsString = true; + if (n < 0) { + needsString = false; + n = -n; + } + + if (n < numchars - nextchar) { + // If we can look ahead that far + s = needsString ? chars.substring(nextchar, nextchar+n) : null; + eof = false; + } + else { // if we don't have that many characters + if (input_complete) { // If no more are coming + // Just return what we have + s = needsString ? chars.substring(nextchar, numchars) : null; + eof = true; + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + } + else { + // Return now and wait for more chars later + return true; + } + } + tokenizer(codepoint, s, eof); + break; + case 'string': + codepoint = chars.charCodeAt(nextchar); + + // tokenizer wants characters up to a matching string + pattern = tokenizer.lookahead; + var pos = chars.indexOf(pattern, nextchar); + if (pos !== -1) { + s = chars.substring(nextchar, pos + pattern.length); + eof = false; + } + else { // No match + // If more characters coming, wait for them + if (!input_complete) return true; + + // Otherwise, we've got to return what we've got + s = chars.substring(nextchar, numchars); + if (codepoint === 0xFFFF && nextchar === numchars-1) + codepoint = EOF; + eof = true; + } + + // The tokenizer states that require this kind of + // lookahead have to be careful to handle CR characters + // correctly + tokenizer(codepoint, s, eof); + break; + } + } + return false; // no more characters to scan! + } + + + /*** + * Tokenizer utility functions + */ + function addAttribute(name,value) { + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return; + } + + if (value !== undefined) { + attributes.push([name, value]); + } + else { + attributes.push([name]); + } + } + + // Shortcut for simple attributes + function handleSimpleAttribute() { + SIMPLEATTR.lastIndex = nextchar-1; + var matched = SIMPLEATTR.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) return false; + var value = matched[2]; + var len = value.length; + switch(value[0]) { + case '"': + case "'": + value = value.substring(1, len-1); + nextchar += (matched[0].length-1); + tokenizer = after_attribute_value_quoted_state; + break; + default: + tokenizer = before_attribute_name_state; + nextchar += (matched[0].length-1); + value = value.substring(0, len-1); + break; + } + + // Make sure there isn't already an attribute with this name + // If there is, ignore this one. + for(var i = 0; i < attributes.length; i++) { + if (attributes[i][0] === name) return true; + } + + attributes.push([name, value]); + return true; + } + + function beginTagName() { + is_end_tag = false; + tagnamebuf = ""; + attributes.length = 0; + } + function beginEndTagName() { + is_end_tag = true; + tagnamebuf = ""; + attributes.length = 0; + } + + function beginTempBuf() { tempbuf.length = 0; } + function beginAttrName() { attrnamebuf = ""; } + function beginAttrValue() { attrvaluebuf = ""; } + function beginComment() { commentbuf.length = 0; } + function beginDoctype() { + doctypenamebuf.length = 0; + doctypepublicbuf = null; + doctypesystembuf = null; + } + function beginDoctypePublicId() { doctypepublicbuf = []; } + function beginDoctypeSystemId() { doctypesystembuf = []; } + function forcequirks() { force_quirks = true; } + function cdataAllowed() { + return stack.top && + stack.top.namespaceURI !== "http://www.w3.org/1999/xhtml"; + } + + // Return true if the codepoints in the specified buffer match the + // characters of lasttagname + function appropriateEndTag(buf) { + return lasttagname === buf; + } + + function flushText() { + if (textrun.length > 0) { + var s = buf2str(textrun); + textrun.length = 0; + + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; + } + + insertToken(TEXT, s); + textIncludesNUL = false; + } + ignore_linefeed = false; + } + + // Consume chars matched by the pattern and return them as a string. Starts + // matching at the current position, so users should drop the current char + // otherwise. + function getMatchingChars(pattern) { + pattern.lastIndex = nextchar - 1; + var match = pattern.exec(chars); + if (match && match.index === nextchar - 1) { + match = match[0]; + nextchar += match.length - 1; + /* Careful! Make sure we haven't matched the EOF character! */ + if (input_complete && nextchar === numchars) { + // Oops, backup one. + match = match.slice(0, -1); + nextchar--; + } + return match; + } else { + throw new Error("should never happen"); + } + } + + // emit a string of chars that match a regexp + // Returns false if no chars matched. + function emitCharsWhile(pattern) { + pattern.lastIndex = nextchar-1; + var match = pattern.exec(chars)[0]; + if (!match) return false; + emitCharString(match); + nextchar += match.length - 1; + return true; + } + + // This is used by CDATA sections + function emitCharString(s) { + if (textrun.length > 0) flushText(); + + if (ignore_linefeed) { + ignore_linefeed = false; + if (s[0] === "\n") s = s.substring(1); + if (s.length === 0) return; + } + + insertToken(TEXT, s); + } + + function emitTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf); + else { + // Remember the last open tag we emitted + var tagname = tagnamebuf; + tagnamebuf = ""; + lasttagname = tagname; + insertToken(TAG, tagname, attributes); + } + } + + + // A shortcut: look ahead and if this is a open or close tag + // in lowercase with no spaces and no attributes, just emit it now. + function emitSimpleTag() { + if (nextchar === numchars) { return false; /* not even 1 char left */ } + SIMPLETAG.lastIndex = nextchar; + var matched = SIMPLETAG.exec(chars); + if (!matched) throw new Error("should never happen"); + var tagname = matched[2]; + if (!tagname) return false; + var endtag = matched[1]; + if (endtag) { + nextchar += (tagname.length+2); + insertToken(ENDTAG, tagname); + } + else { + nextchar += (tagname.length+1); + lasttagname = tagname; + insertToken(TAG, tagname, NOATTRS); + } + return true; + } + + function emitSelfClosingTag() { + if (is_end_tag) insertToken(ENDTAG, tagnamebuf, null, true); + else { + insertToken(TAG, tagnamebuf, attributes, true); + } + } + + function emitDoctype() { + insertToken(DOCTYPE, + buf2str(doctypenamebuf), + doctypepublicbuf ? buf2str(doctypepublicbuf) : undefined, + doctypesystembuf ? buf2str(doctypesystembuf) : undefined); + } + + function emitEOF() { + flushText(); + parser(EOF); // EOF never goes to insertForeignContent() + doc.modclock = 1; // Start tracking modifications + } + + // Insert a token, either using the current parser insertion mode + // (for HTML stuff) or using the insertForeignToken() method. + var insertToken = htmlparser.insertToken = function insertToken(t, value, arg3, arg4) { + flushText(); + var current = stack.top; + + if (!current || current.namespaceURI === NAMESPACE.HTML) { + // This is the common case + parser(t, value, arg3, arg4); + } + else { + // Otherwise we may need to insert this token as foreign content + if (t !== TAG && t !== TEXT) { + insertForeignToken(t, value, arg3, arg4); + } + else { + // But in some cases we treat it as regular content + if ((isMathmlTextIntegrationPoint(current) && + (t === TEXT || + (t === TAG && + value !== "mglyph" && value !== "malignmark"))) || + (t === TAG && + value === "svg" && + current.namespaceURI === NAMESPACE.MATHML && + current.localName === "annotation-xml") || + isHTMLIntegrationPoint(current)) { + + // XXX: the text_integration_mode stuff is an + // attempted bug workaround of mine + text_integration_mode = true; + parser(t, value, arg3, arg4); + text_integration_mode = false; + } + // Otherwise it is foreign content + else { + insertForeignToken(t, value, arg3, arg4); + } + } + } + }; + + + /*** + * Tree building utility functions + */ + function insertComment(data) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createComment(data); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + parent._appendChild(parent.ownerDocument.createComment(data)); + } + } + + function insertText(s) { + var parent = stack.top; + if (foster_parent_mode && isA(parent, tablesectionrowSet)) { + fosterParent(function(doc) { return doc.createTextNode(s); }); + } else { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + // "If there is a Text node immediately before the adjusted insertion + // location, then append data to that Text node's data." + var lastChild = parent.lastChild; + if (lastChild && lastChild.nodeType === Node.TEXT_NODE) { + lastChild.appendData(s); + } else { + parent._appendChild(parent.ownerDocument.createTextNode(s)); + } + } + } + + function createHTMLElt(doc, name, attrs) { + // Create the element this way, rather than with + // doc.createElement because createElement() does error + // checking on the element name that we need to avoid here. + var elt = html.createElement(doc, name, null); + + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + // Use the _ version to avoid testing the validity + // of the attribute name + elt._setAttribute(attrs[i][0], attrs[i][1]); + } + } + // XXX + // If the element is a resettable form element, + // run its reset algorithm now + // XXX + // handle case where form-element-pointer is not null + return elt; + } + + // The in_table insertion mode turns on this flag, and that makes + // insertHTMLElement use the foster parenting algorithm for elements + // tags inside a table + var foster_parent_mode = false; + + function insertHTMLElement(name, attrs) { + var elt = insertElement(function(doc) { + return createHTMLElt(doc, name, attrs); + }); + + // XXX + // If this is a form element, set its form attribute property here + if (isA(elt, formassociatedSet)) { + elt._form = form_element_pointer; + } + + return elt; + } + + // Insert the element into the open element or foster parent it + function insertElement(eltFunc) { + var elt; + if (foster_parent_mode && isA(stack.top, tablesectionrowSet)) { + elt = fosterParent(eltFunc); + } + else if (stack.top instanceof impl.HTMLTemplateElement) { + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + elt = eltFunc(stack.top.content.ownerDocument); + stack.top.content._appendChild(elt); + } else { + elt = eltFunc(stack.top.ownerDocument); + stack.top._appendChild(elt); + } + + stack.push(elt); + return elt; + } + + function insertForeignElement(name, attrs, ns) { + return insertElement(function(doc) { + // We need to prevent createElementNS from trying to parse `name` as a + // `qname`, so use an internal Document#_createElementNS() interface. + var elt = doc._createElementNS(name, ns, null); + if (attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + var attr = attrs[i]; + if (attr.length === 2) + elt._setAttribute(attr[0], attr[1]); + else { + elt._setAttributeNS(attr[2], attr[0], attr[1]); + } + } + } + return elt; + }); + } + + function lastElementOfType(type) { + for(var i = stack.elements.length-1; i >= 0; i--) { + if (stack.elements[i] instanceof type) { + return i; + } + } + return -1; + } + + function fosterParent(eltFunc) { + var parent, before, lastTable = -1, lastTemplate = -1, elt; + + lastTable = lastElementOfType(impl.HTMLTableElement); + lastTemplate = lastElementOfType(impl.HTMLTemplateElement); + + if (lastTemplate >= 0 && (lastTable < 0 || lastTemplate > lastTable)) { + parent = stack.elements[lastTemplate]; + } else if (lastTable >= 0) { + parent = stack.elements[lastTable].parentNode; + if (parent) { + before = stack.elements[lastTable]; + } else { + parent = stack.elements[lastTable - 1]; + } + } + if (!parent) parent = stack.elements[0]; // the `html` element. + + // "If the adjusted insertion location is inside a template element, + // let it instead be inside the template element's template contents" + if (parent instanceof impl.HTMLTemplateElement) { + parent = parent.content; + } + // Create element in the appropriate document. + elt = eltFunc(parent.ownerDocument); + + if (elt.nodeType === Node.TEXT_NODE) { + var prev; + if (before) prev = before.previousSibling; + else prev = parent.lastChild; + if (prev && prev.nodeType === Node.TEXT_NODE) { + prev.appendData(elt.data); + return elt; + } + } + if (before) + parent.insertBefore(elt, before); + else + parent._appendChild(elt); + return elt; + } + + + function resetInsertionMode() { + var last = false; + for(var i = stack.elements.length-1; i >= 0; i--) { + var node = stack.elements[i]; + if (i === 0) { + last = true; + if (fragment) { + node = fragmentContext; + } + } + if (node.namespaceURI === NAMESPACE.HTML) { + var tag = node.localName; + switch(tag) { + case "select": + for(var j = i; j > 0; ) { + var ancestor = stack.elements[--j]; + if (ancestor instanceof impl.HTMLTemplateElement) { + break; + } else if (ancestor instanceof impl.HTMLTableElement) { + parser = in_select_in_table_mode; + return; + } + } + parser = in_select_mode; + return; + case "tr": + parser = in_row_mode; + return; + case "tbody": + case "tfoot": + case "thead": + parser = in_table_body_mode; + return; + case "caption": + parser = in_caption_mode; + return; + case "colgroup": + parser = in_column_group_mode; + return; + case "table": + parser = in_table_mode; + return; + case "template": + parser = templateInsertionModes[templateInsertionModes.length-1]; + return; + case "body": + parser = in_body_mode; + return; + case "frameset": + parser = in_frameset_mode; + return; + case "html": + if (head_element_pointer === null) { + parser = before_head_mode; + } else { + parser = after_head_mode; + } + return; + default: + if (!last) { + if (tag === "head") { + parser = in_head_mode; + return; + } + if (tag === "td" || tag === "th") { + parser = in_cell_mode; + return; + } + } + } + } + if (last) { + parser = in_body_mode; + return; + } + } + } + + + function parseRawText(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rawtext_state; + originalInsertionMode = parser; + parser = text_mode; + } + + function parseRCDATA(name, attrs) { + insertHTMLElement(name, attrs); + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + } + + // Make a copy of element i on the list of active formatting + // elements, using its original attributes, not current + // attributes (which may have been modified by a script) + function afeclone(doc, i) { + return { + elt: createHTMLElt(doc, afe.list[i].localName, afe.attrs[i]), + attrs: afe.attrs[i], + }; + } + + + function afereconstruct() { + if (afe.list.length === 0) return; + var entry = afe.list[afe.list.length-1]; + // If the last is a marker , do nothing + if (entry === afe.MARKER) return; + // Or if it is an open element, do nothing + if (stack.elements.lastIndexOf(entry) !== -1) return; + + // Loop backward through the list until we find a marker or an + // open element, and then move forward one from there. + for(var i = afe.list.length-2; i >= 0; i--) { + entry = afe.list[i]; + if (entry === afe.MARKER) break; + if (stack.elements.lastIndexOf(entry) !== -1) break; + } + + // Now loop forward, starting from the element after the current + // one, recreating formatting elements and pushing them back onto + // the list of open elements + for(i = i+1; i < afe.list.length; i++) { + var newelt = insertElement(function(doc) { return afeclone(doc, i).elt; }); + afe.list[i] = newelt; + } + } + + // Used by the adoptionAgency() function + var BOOKMARK = {localName:"BM"}; + + function adoptionAgency(tag) { + // If the current node is an HTML element whose tag name is subject, + // and the current node is not in the list of active formatting + // elements, then pop the current node off the stack of open + // elements and abort these steps. + if (isA(stack.top, tag) && afe.indexOf(stack.top) === -1) { + stack.pop(); + return true; // no more handling required + } + + // Let outer loop counter be zero. + var outer = 0; + + // Outer loop: If outer loop counter is greater than or + // equal to eight, then abort these steps. + while(outer < 8) { + // Increment outer loop counter by one. + outer++; + + // Let the formatting element be the last element in the list + // of active formatting elements that: is between the end of + // the list and the last scope marker in the list, if any, or + // the start of the list otherwise, and has the same tag name + // as the token. + var fmtelt = afe.findElementByTag(tag); + + // If there is no such node, then abort these steps and instead + // act as described in the "any other end tag" entry below. + if (!fmtelt) { + return false; // false means handle by the default case + } + + // Otherwise, if there is such a node, but that node is not in + // the stack of open elements, then this is a parse error; + // remove the element from the list, and abort these steps. + var index = stack.elements.lastIndexOf(fmtelt); + if (index === -1) { + afe.remove(fmtelt); + return true; // true means no more handling required + } + + // Otherwise, if there is such a node, and that node is also in + // the stack of open elements, but the element is not in scope, + // then this is a parse error; ignore the token, and abort + // these steps. + if (!stack.elementInScope(fmtelt)) { + return true; + } + + // Let the furthest block be the topmost node in the stack of + // open elements that is lower in the stack than the formatting + // element, and is an element in the special category. There + // might not be one. + var furthestblock = null, furthestblockindex; + for(var i = index+1; i < stack.elements.length; i++) { + if (isA(stack.elements[i], specialSet)) { + furthestblock = stack.elements[i]; + furthestblockindex = i; + break; + } + } + + // If there is no furthest block, then the UA must skip the + // subsequent steps and instead just pop all the nodes from the + // bottom of the stack of open elements, from the current node + // up to and including the formatting element, and remove the + // formatting element from the list of active formatting + // elements. + if (!furthestblock) { + stack.popElement(fmtelt); + afe.remove(fmtelt); + return true; + } + else { + // Let the common ancestor be the element immediately above + // the formatting element in the stack of open elements. + var ancestor = stack.elements[index-1]; + + // Let a bookmark note the position of the formatting + // element in the list of active formatting elements + // relative to the elements on either side of it in the + // list. + afe.insertAfter(fmtelt, BOOKMARK); + + // Let node and last node be the furthest block. + var node = furthestblock; + var lastnode = furthestblock; + var nodeindex = furthestblockindex; + var nodeafeindex; + + // Let inner loop counter be zero. + var inner = 0; + + while (true) { + + // Increment inner loop counter by one. + inner++; + + // Let node be the element immediately above node in + // the stack of open elements, or if node is no longer + // in the stack of open elements (e.g. because it got + // removed by this algorithm), the element that was + // immediately above node in the stack of open elements + // before node was removed. + node = stack.elements[--nodeindex]; + + // If node is the formatting element, then go + // to the next step in the overall algorithm. + if (node === fmtelt) break; + + // If the inner loop counter is greater than three and node + // is in the list of active formatting elements, then remove + // node from the list of active formatting elements. + nodeafeindex = afe.indexOf(node); + if (inner > 3 && nodeafeindex !== -1) { + afe.remove(node); + nodeafeindex = -1; + } + + // If node is not in the list of active formatting + // elements, then remove node from the stack of open + // elements and then go back to the step labeled inner + // loop. + if (nodeafeindex === -1) { + stack.removeElement(node); + continue; + } + + // Create an element for the token for which the + // element node was created with common ancestor as + // the intended parent, replace the entry for node + // in the list of active formatting elements with an + // entry for the new element, replace the entry for + // node in the stack of open elements with an entry for + // the new element, and let node be the new element. + var newelt = afeclone(ancestor.ownerDocument, nodeafeindex); + afe.replace(node, newelt.elt, newelt.attrs); + stack.elements[nodeindex] = newelt.elt; + node = newelt.elt; + + // If last node is the furthest block, then move the + // aforementioned bookmark to be immediately after the + // new node in the list of active formatting elements. + if (lastnode === furthestblock) { + afe.remove(BOOKMARK); + afe.insertAfter(newelt.elt, BOOKMARK); + } + + // Insert last node into node, first removing it from + // its previous parent node if any. + node._appendChild(lastnode); + + // Let last node be node. + lastnode = node; + } + + // If the common ancestor node is a table, tbody, tfoot, + // thead, or tr element, then, foster parent whatever last + // node ended up being in the previous step, first removing + // it from its previous parent node if any. + if (foster_parent_mode && isA(ancestor, tablesectionrowSet)) { + fosterParent(function() { return lastnode; }); + } + // Otherwise, append whatever last node ended up being in + // the previous step to the common ancestor node, first + // removing it from its previous parent node if any. + else if (ancestor instanceof impl.HTMLTemplateElement) { + ancestor.content._appendChild(lastnode); + } else { + ancestor._appendChild(lastnode); + } + + // Create an element for the token for which the + // formatting element was created, with furthest block + // as the intended parent. + var newelt2 = afeclone(furthestblock.ownerDocument, afe.indexOf(fmtelt)); + + // Take all of the child nodes of the furthest block and + // append them to the element created in the last step. + while(furthestblock.hasChildNodes()) { + newelt2.elt._appendChild(furthestblock.firstChild); + } + + // Append that new element to the furthest block. + furthestblock._appendChild(newelt2.elt); + + // Remove the formatting element from the list of active + // formatting elements, and insert the new element into the + // list of active formatting elements at the position of + // the aforementioned bookmark. + afe.remove(fmtelt); + afe.replace(BOOKMARK, newelt2.elt, newelt2.attrs); + + // Remove the formatting element from the stack of open + // elements, and insert the new element into the stack of + // open elements immediately below the position of the + // furthest block in that stack. + stack.removeElement(fmtelt); + var pos = stack.elements.lastIndexOf(furthestblock); + stack.elements.splice(pos+1, 0, newelt2.elt); + } + } + + return true; + } + + // We do this when we get /script in in_text_mode + function handleScriptEnd() { + // XXX: + // This is just a stub implementation right now and doesn't run scripts. + // Getting this method right involves the event loop, URL resolution + // script fetching etc. For now I just want to be able to parse + // documents and test the parser. + + //var script = stack.top; + stack.pop(); + parser = originalInsertionMode; + //script._prepare(); + return; + + // XXX: here is what this method is supposed to do + + // Provide a stable state. + + // Let script be the current node (which will be a script + // element). + + // Pop the current node off the stack of open elements. + + // Switch the insertion mode to the original insertion mode. + + // Let the old insertion point have the same value as the current + // insertion point. Let the insertion point be just before the + // next input character. + + // Increment the parser's script nesting level by one. + + // Prepare the script. This might cause some script to execute, + // which might cause new characters to be inserted into the + // tokenizer, and might cause the tokenizer to output more tokens, + // resulting in a reentrant invocation of the parser. + + // Decrement the parser's script nesting level by one. If the + // parser's script nesting level is zero, then set the parser + // pause flag to false. + + // Let the insertion point have the value of the old insertion + // point. (In other words, restore the insertion point to its + // previous value. This value might be the "undefined" value.) + + // At this stage, if there is a pending parsing-blocking script, + // then: + + // If the script nesting level is not zero: + + // Set the parser pause flag to true, and abort the processing + // of any nested invocations of the tokenizer, yielding + // control back to the caller. (Tokenization will resume when + // the caller returns to the "outer" tree construction stage.) + + // The tree construction stage of this particular parser is + // being called reentrantly, say from a call to + // document.write(). + + // Otherwise: + + // Run these steps: + + // Let the script be the pending parsing-blocking + // script. There is no longer a pending + // parsing-blocking script. + + // Block the tokenizer for this instance of the HTML + // parser, such that the event loop will not run tasks + // that invoke the tokenizer. + + // If the parser's Document has a style sheet that is + // blocking scripts or the script's "ready to be + // parser-executed" flag is not set: spin the event + // loop until the parser's Document has no style sheet + // that is blocking scripts and the script's "ready to + // be parser-executed" flag is set. + + // Unblock the tokenizer for this instance of the HTML + // parser, such that tasks that invoke the tokenizer + // can again be run. + + // Let the insertion point be just before the next + // input character. + + // Increment the parser's script nesting level by one + // (it should be zero before this step, so this sets + // it to one). + + // Execute the script. + + // Decrement the parser's script nesting level by + // one. If the parser's script nesting level is zero + // (which it always should be at this point), then set + // the parser pause flag to false. + + // Let the insertion point be undefined again. + + // If there is once again a pending parsing-blocking + // script, then repeat these steps from step 1. + + + } + + function stopParsing() { + // XXX This is just a temporary implementation to get the parser working. + // A full implementation involves scripts and events and the event loop. + + // Remove the link from document to parser. + // This is instead of "set the insertion point to undefined". + // It means that document.write() can't write into the doc anymore. + delete doc._parser; + + stack.elements.length = 0; // pop everything off + + // If there is a window object associated with the document + // then trigger an load event on it + if (doc.defaultView) { + doc.defaultView.dispatchEvent(new impl.Event("load",{})); + } + + } + + /**** + * Tokenizer states + */ + + /** + * This file was partially mechanically generated from + * http://www.whatwg.org/specs/web-apps/current-work/multipage/tokenization.html + * + * After mechanical conversion, it was further converted from + * prose to JS by hand, but the intent is that it is a very + * faithful rendering of the HTML tokenization spec in + * JavaScript. + * + * It is not a goal of this tokenizer to detect or report + * parse errors. + * + * XXX The tokenizer is supposed to work with straight UTF32 + * codepoints. But I don't think it has any dependencies on + * any character outside of the BMP so I think it is safe to + * pass it UTF16 characters. I don't think it will ever change + * state in the middle of a surrogate pair. + */ + + /* + * Each state is represented by a function. For most states, the + * scanner simply passes the next character (as an integer + * codepoint) to the current state function and automatically + * consumes the character. If the state function can't process + * the character it can call pushback() to push it back to the + * scanner. + * + * Some states require lookahead, though. If a state function has + * a lookahead property, then it is invoked differently. In this + * case, the scanner invokes the function with 3 arguments: 1) the + * next codepoint 2) a string of lookahead text 3) a boolean that + * is true if the lookahead goes all the way to the EOF. (XXX + * actually maybe this third is not necessary... the lookahead + * could just include \uFFFF?) + * + * If the lookahead property of a state function is an integer, it + * specifies the number of characters required. If it is a string, + * then the scanner will scan for that string and return all + * characters up to and including that sequence, or up to EOF. If + * the lookahead property is a regexp, then the scanner will match + * the regexp at the current point and return the matching string. + * + * States that require lookahead are responsible for explicitly + * consuming the characters they process. They do this by + * incrementing nextchar by the number of processed characters. + */ + function reconsume(c, new_state) { + tokenizer = new_state; + nextchar--; // pushback + } + + function data_state(c) { + switch(c) { + case 0x0026: // AMPERSAND + return_state = data_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + if (emitSimpleTag()) // Shortcut for

    ,

    , etc. + break; + tokenizer = tag_open_state; + break; + case 0x0000: // NULL + // Usually null characters emitted by the tokenizer will be + // ignored by the tree builder, but sometimes they'll be + // converted to \uFFFD. I don't want to have the search every + // string emitted to replace NULs, so I'll set a flag + // if I've emitted a NUL. + textrun.push(c); + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(DATATEXT) || textrun.push(c); + break; + } + } + + function rcdata_state(c) { + // Save the open tag so we can find a matching close tag + switch(c) { + case 0x0026: // AMPERSAND + return_state = rcdata_state; + tokenizer = character_reference_state; + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = rcdata_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + textIncludesNUL = true; + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function rawtext_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = rawtext_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function script_data_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(RAWTEXT) || textrun.push(c); + break; + } + } + + function plaintext_state(c) { + switch(c) { + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + /*jshint -W030 */ + emitCharsWhile(PLAINTEXT) || textrun.push(c); + break; + } + } + + function tag_open_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + tokenizer = markup_declaration_open_state; + break; + case 0x002F: // SOLIDUS + tokenizer = end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTagName(); + reconsume(c, tag_name_state); + break; + case 0x003F: // QUESTION MARK + reconsume(c, bogus_comment_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, data_state); + break; + } + } + + function end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, tag_name_state); + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + break; + case -1: // EOF + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + emitEOF(); + break; + default: + reconsume(c, bogus_comment_state); + break; + } + } + + function tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + tagnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + default: + tagnamebuf += getMatchingChars(TAGNAME); + break; + } + } + + function rcdata_less_than_sign_state(c) { + /* identical to the RAWTEXT less-than sign state, except s/RAWTEXT/RCDATA/g */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rcdata_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rcdata_state); + } + } + + function rcdata_end_tag_open_state(c) { + /* identical to the RAWTEXT (and Script data) end tag open state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rcdata_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rcdata_state); + break; + } + } + + function rcdata_end_tag_name_state(c) { + /* identical to the RAWTEXT (and Script data) end tag name state, except s/RAWTEXT/RCDATA/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun, tempbuf); + reconsume(c, rcdata_state); + } + + function rawtext_less_than_sign_state(c) { + /* identical to the RCDATA less-than sign state, except s/RCDATA/RAWTEXT/g + */ + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = rawtext_end_tag_open_state; + } + else { + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, rawtext_state); + } + } + + function rawtext_end_tag_open_state(c) { + /* identical to the RCDATA (and Script data) end tag open state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, rawtext_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, rawtext_state); + break; + } + } + + function rawtext_end_tag_name_state(c) { + /* identical to the RCDATA (and Script data) end tag name state, except s/RCDATA/RAWTEXT/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, rawtext_state); + } + + function script_data_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_end_tag_open_state; + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = script_data_escape_start_state; + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x0021); // EXCLAMATION MARK + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_open_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag open state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_state); + break; + } + } + + function script_data_end_tag_name_state(c) { + /* identical to the RCDATA (and RAWTEXT) end tag name state, except s/RCDATA/Script data/g */ + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // If we don't return in one of the cases above, then this was not + // an appropriately matching close tag, so back out by emitting all + // the characters as text + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_state); + } + + function script_data_escape_start_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escape_start_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + } + else { + reconsume(c, script_data_state); + } + } + + function script_data_escape_start_dash_state(c) { + if (c === 0x002D) { // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + } + else { + reconsume(c, script_data_state); + } + } + + function script_data_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_escaped_less_than_sign_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_escaped_less_than_sign_state(c) { + switch(c) { + case 0x002F: // SOLIDUS + beginTempBuf(); + tokenizer = script_data_escaped_end_tag_open_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginTempBuf(); + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_double_escape_start_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_open_state(c) { + switch(c) { + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + beginEndTagName(); + reconsume(c, script_data_escaped_end_tag_name_state); + break; + default: + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_escaped_end_tag_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + if (appropriateEndTag(tagnamebuf)) { + tokenizer = before_attribute_name_state; + return; + } + break; + case 0x002F: // SOLIDUS + if (appropriateEndTag(tagnamebuf)) { + tokenizer = self_closing_start_tag_state; + return; + } + break; + case 0x003E: // GREATER-THAN SIGN + if (appropriateEndTag(tagnamebuf)) { + tokenizer = data_state; + emitTag(); + return; + } + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tagnamebuf += String.fromCharCode(c + 0x0020); + tempbuf.push(c); + return; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tagnamebuf += String.fromCharCode(c); + tempbuf.push(c); + return; + default: + break; + } + + // We get here in the default case, and if the closing tagname + // is not an appropriate tagname. + textrun.push(0x003C); // LESS-THAN SIGN + textrun.push(0x002F); // SOLIDUS + pushAll(textrun,tempbuf); + reconsume(c, script_data_escaped_state); + } + + function script_data_double_escape_start_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_double_escaped_state; + } + else { + tokenizer = script_data_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_escaped_state); + break; + } + } + + function script_data_double_escaped_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = script_data_double_escaped_dash_dash_state; + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_dash_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + textrun.push(0x002D); // HYPHEN-MINUS + break; + case 0x003C: // LESS-THAN SIGN + tokenizer = script_data_double_escaped_less_than_sign_state; + textrun.push(0x003C); // LESS-THAN SIGN + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = script_data_state; + textrun.push(0x003E); // GREATER-THAN SIGN + break; + case 0x0000: // NULL + tokenizer = script_data_double_escaped_state; + textrun.push(0xFFFD); // REPLACEMENT CHARACTER + break; + case -1: // EOF + emitEOF(); + break; + default: + tokenizer = script_data_double_escaped_state; + textrun.push(c); + break; + } + } + + function script_data_double_escaped_less_than_sign_state(c) { + if (c === 0x002F) { // SOLIDUS + beginTempBuf(); + tokenizer = script_data_double_escape_end_state; + textrun.push(0x002F); // SOLIDUS + } + else { + reconsume(c, script_data_double_escaped_state); + } + } + + function script_data_double_escape_end_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + if (buf2str(tempbuf) === "script") { + tokenizer = script_data_escaped_state; + } + else { + tokenizer = script_data_double_escaped_state; + } + textrun.push(c); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + tempbuf.push(c + 0x0020); + textrun.push(c); + break; + case 0x0061: // [a-z] + case 0x0062:case 0x0063:case 0x0064:case 0x0065:case 0x0066: + case 0x0067:case 0x0068:case 0x0069:case 0x006A:case 0x006B: + case 0x006C:case 0x006D:case 0x006E:case 0x006F:case 0x0070: + case 0x0071:case 0x0072:case 0x0073:case 0x0074:case 0x0075: + case 0x0076:case 0x0077:case 0x0078:case 0x0079:case 0x007A: + tempbuf.push(c); + textrun.push(c); + break; + default: + reconsume(c, script_data_double_escaped_state); + break; + } + } + + function before_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + // For SOLIDUS, GREATER-THAN SIGN, and EOF, spec says "reconsume in + // the after attribute name state", but in our implementation that + // state always has an active attribute in attrnamebuf. Just clone + // the rules here, without the addAttribute business. + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + case 0x003D: // EQUALS SIGN + beginAttrName(); + attrnamebuf += String.fromCharCode(c); + tokenizer = attribute_name_state; + break; + default: + if (handleSimpleAttribute()) break; + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + // beginAttrName() must have been called before this point + // There is an active attribute in attrnamebuf (but not attrvaluebuf) + function attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + case 0x002F: // SOLIDUS + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, after_attribute_name_state); + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + attrnamebuf += String.fromCharCode(c + 0x0020); + break; + case 0x0000: // NULL + attrnamebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + /* falls through */ + default: + attrnamebuf += getMatchingChars(ATTRNAME); + break; + } + } + + // There is an active attribute in attrnamebuf, but not yet in attrvaluebuf. + function after_attribute_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x002F: // SOLIDUS + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + tokenizer = self_closing_start_tag_state; + break; + case 0x003D: // EQUALS SIGN + tokenizer = before_attribute_value_state; + break; + case 0x003E: // GREATER-THAN SIGN + // Keep in sync with before_attribute_name_state. + tokenizer = data_state; + addAttribute(attrnamebuf); + emitTag(); + break; + case -1: // EOF + // Keep in sync with before_attribute_name_state. + addAttribute(attrnamebuf); + emitEOF(); + break; + default: + addAttribute(attrnamebuf); + beginAttrName(); + reconsume(c, attribute_name_state); + break; + } + } + + function before_attribute_value_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginAttrValue(); + tokenizer = attribute_value_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginAttrValue(); + tokenizer = attribute_value_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + /* falls through */ + default: + beginAttrValue(); + reconsume(c, attribute_value_unquoted_state); + break; + } + } + + function attribute_value_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_double_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(DBLQUOTEATTRVAL); + break; + } + } + + function attribute_value_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = after_attribute_value_quoted_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_single_quoted_state; + tokenizer = character_reference_state; + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + emitEOF(); + break; + case 0x000A: // LF + // this could be a converted \r, so don't use getMatchingChars + attrvaluebuf += String.fromCharCode(c); + break; + default: + attrvaluebuf += getMatchingChars(SINGLEQUOTEATTRVAL); + break; + } + } + + function attribute_value_unquoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = before_attribute_name_state; + break; + case 0x0026: // AMPERSAND + return_state = attribute_value_unquoted_state; + tokenizer = character_reference_state; + break; + case 0x003E: // GREATER-THAN SIGN + addAttribute(attrnamebuf, attrvaluebuf); + tokenizer = data_state; + emitTag(); + break; + case 0x0000: // NULL + attrvaluebuf += String.fromCharCode(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + nextchar--; // pushback + tokenizer = data_state; + break; + case 0x0022: // QUOTATION MARK + case 0x0027: // APOSTROPHE + case 0x003C: // LESS-THAN SIGN + case 0x003D: // EQUALS SIGN + case 0x0060: // GRAVE ACCENT + /* falls through */ + default: + attrvaluebuf += getMatchingChars(UNQUOTEDATTRVAL); + break; + } + } + + function after_attribute_value_quoted_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_attribute_name_state; + break; + case 0x002F: // SOLIDUS + tokenizer = self_closing_start_tag_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitTag(); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function self_closing_start_tag_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + // Set the self-closing flag of the current tag token. + tokenizer = data_state; + emitSelfClosingTag(true); + break; + case -1: // EOF + emitEOF(); + break; + default: + reconsume(c, before_attribute_name_state); + break; + } + } + + function bogus_comment_state(c, lookahead, eof) { + var len = lookahead.length; + + if (eof) { + nextchar += len-1; // don't consume the eof + } + else { + nextchar += len; + } + + var comment = lookahead.substring(0, len-1); + + comment = comment.replace(/\u0000/g,"\uFFFD"); + comment = comment.replace(/\u000D\u000A/g,"\u000A"); + comment = comment.replace(/\u000D/g,"\u000A"); + + insertToken(COMMENT, comment); + tokenizer = data_state; + } + bogus_comment_state.lookahead = ">"; + + function markup_declaration_open_state(c, lookahead, eof) { + if (lookahead[0] === "-" && lookahead[1] === "-") { + nextchar += 2; + beginComment(); + tokenizer = comment_start_state; + return; + } + + if (lookahead.toUpperCase() === "DOCTYPE") { + nextchar += 7; + tokenizer = doctype_state; + } + else if (lookahead === "[CDATA[" && cdataAllowed()) { + nextchar += 7; + tokenizer = cdata_section_state; + } + else { + tokenizer = bogus_comment_state; + } + } + markup_declaration_open_state.lookahead = 7; + + function comment_start_state(c) { + beginComment(); + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_start_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; /* see comment in comment end state */ + default: + reconsume(c, comment_state); + break; + } + } + + function comment_start_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_state(c) { + switch(c) { + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + tokenizer = comment_less_than_sign_state; + break; + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_dash_state; + break; + case 0x0000: // NULL + commentbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(c); + break; + } + } + + function comment_less_than_sign_state(c) { + switch(c) { + case 0x0021: // EXCLAMATION MARK + commentbuf.push(c); + tokenizer = comment_less_than_sign_bang_state; + break; + case 0x003C: // LESS-THAN SIGN + commentbuf.push(c); + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_state; + break; + default: + reconsume(c, comment_state); + break; + } + } + + function comment_less_than_sign_bang_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_less_than_sign_bang_dash_dash_state; + break; + default: + reconsume(c, comment_end_dash_state); + break; + } + } + + function comment_less_than_sign_bang_dash_dash_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + case -1: // EOF + reconsume(c, comment_end_state); + break; + default: + // parse error + reconsume(c, comment_end_state); + break; + } + } + + function comment_end_dash_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + tokenizer = comment_end_state; + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D /* HYPHEN-MINUS */); + reconsume(c, comment_state); + break; + } + } + + function comment_end_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case 0x0021: // EXCLAMATION MARK + tokenizer = comment_end_bang_state; + break; + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* For security reasons: otherwise, hostile user could put a script in a comment e.g. in a blog comment and then DOS the server so that the end tag isn't read, and then the commented script tag would be treated as live code */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + reconsume(c, comment_state); + break; + } + } + + function comment_end_bang_state(c) { + switch(c) { + case 0x002D: // HYPHEN-MINUS + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + tokenizer = comment_end_dash_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + insertToken(COMMENT, buf2str(commentbuf)); + break; + case -1: // EOF + insertToken(COMMENT, buf2str(commentbuf)); + emitEOF(); + break; /* see comment in comment end state */ + default: + commentbuf.push(0x002D); + commentbuf.push(0x002D); + commentbuf.push(0x0021); + reconsume(c, comment_state); + break; + } + } + + function doctype_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_name_state; + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + reconsume(c, before_doctype_name_state); + break; + } + } + + function before_doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + beginDoctype(); + doctypenamebuf.push(c + 0x0020); + tokenizer = doctype_name_state; + break; + case 0x0000: // NULL + beginDoctype(); + doctypenamebuf.push(0xFFFD); + tokenizer = doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + beginDoctype(); + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + beginDoctype(); + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + beginDoctype(); + doctypenamebuf.push(c); + tokenizer = doctype_name_state; + break; + } + } + + function doctype_name_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = after_doctype_name_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0041: // [A-Z] + case 0x0042:case 0x0043:case 0x0044:case 0x0045:case 0x0046: + case 0x0047:case 0x0048:case 0x0049:case 0x004A:case 0x004B: + case 0x004C:case 0x004D:case 0x004E:case 0x004F:case 0x0050: + case 0x0051:case 0x0052:case 0x0053:case 0x0054:case 0x0055: + case 0x0056:case 0x0057:case 0x0058:case 0x0059:case 0x005A: + doctypenamebuf.push(c + 0x0020); + break; + case 0x0000: // NULL + doctypenamebuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypenamebuf.push(c); + break; + } + } + + function after_doctype_name_state(c, lookahead, eof) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + nextchar += 1; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + nextchar += 1; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + lookahead = lookahead.toUpperCase(); + if (lookahead === "PUBLIC") { + nextchar += 6; + tokenizer = after_doctype_public_keyword_state; + } + else if (lookahead === "SYSTEM") { + nextchar += 6; + tokenizer = after_doctype_system_keyword_state; + } + else { + forcequirks(); + tokenizer = bogus_doctype_state; + } + break; + } + } + after_doctype_name_state.lookahead = 6; + + function after_doctype_public_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_public_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x0022: // QUOTATION MARK + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypePublicId(); + tokenizer = doctype_public_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_public_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function doctype_public_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_public_identifier_state; + break; + case 0x0000: // NULL + doctypepublicbuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypepublicbuf.push(c); + break; + } + } + + function after_doctype_public_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = between_doctype_public_and_system_identifiers_state; + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function between_doctype_public_and_system_identifiers_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function after_doctype_system_keyword_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + tokenizer = before_doctype_system_identifier_state; + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function before_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE Ignore the character. + break; + case 0x0022: // QUOTATION MARK + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_double_quoted_state; + break; + case 0x0027: // APOSTROPHE + beginDoctypeSystemId(); + tokenizer = doctype_system_identifier_single_quoted_state; + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + forcequirks(); + tokenizer = bogus_doctype_state; + break; + } + } + + function doctype_system_identifier_double_quoted_state(c) { + switch(c) { + case 0x0022: // QUOTATION MARK + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function doctype_system_identifier_single_quoted_state(c) { + switch(c) { + case 0x0027: // APOSTROPHE + tokenizer = after_doctype_system_identifier_state; + break; + case 0x0000: // NULL + doctypesystembuf.push(0xFFFD /* REPLACEMENT CHARACTER */); + break; + case 0x003E: // GREATER-THAN SIGN + forcequirks(); + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + doctypesystembuf.push(c); + break; + } + } + + function after_doctype_system_identifier_state(c) { + switch(c) { + case 0x0009: // CHARACTER TABULATION (tab) + case 0x000A: // LINE FEED (LF) + case 0x000C: // FORM FEED (FF) + case 0x0020: // SPACE + /* Ignore the character. */ + break; + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + forcequirks(); + emitDoctype(); + emitEOF(); + break; + default: + tokenizer = bogus_doctype_state; + /* This does *not* set the DOCTYPE token's force-quirks flag. */ + break; + } + } + + function bogus_doctype_state(c) { + switch(c) { + case 0x003E: // GREATER-THAN SIGN + tokenizer = data_state; + emitDoctype(); + break; + case -1: // EOF + emitDoctype(); + emitEOF(); + break; + default: + /* Ignore the character. */ + break; + } + } + + function cdata_section_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_bracket_state; + break; + case -1: // EOF + emitEOF(); + break; + case 0x0000: // NULL + textIncludesNUL = true; + /* fall through */ + default: + // Instead of just pushing a single character and then + // coming back to the very same place, lookahead and + // emit everything we can at once. + /*jshint -W030 */ + emitCharsWhile(CDATATEXT) || textrun.push(c); + break; + } + } + + function cdata_section_bracket_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + tokenizer = cdata_section_end_state; + break; + default: + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function cdata_section_end_state(c) { + switch(c) { + case 0x005D: // RIGHT SQUARE BRACKET + textrun.push(0x005D); + break; + case 0x003E: // GREATER-THAN SIGN + flushText(); + tokenizer = data_state; + break; + default: + textrun.push(0x005D); + textrun.push(0x005D); + reconsume(c, cdata_section_state); + break; + } + } + + function character_reference_state(c) { + beginTempBuf(); + tempbuf.push(0x0026); + switch(c) { + case 0x0009: // TAB + case 0x000A: // LINE FEED + case 0x000C: // FORM FEED + case 0x0020: // SPACE + case 0x003C: // LESS-THAN SIGN + case 0x0026: // AMPERSAND + case -1: // EOF + reconsume(c, character_reference_end_state); + break; + case 0x0023: // NUMBER SIGN + tempbuf.push(c); + tokenizer = numeric_character_reference_state; + break; + default: + reconsume(c, named_character_reference_state); + break; + } + } + + function named_character_reference_state(c) { + NAMEDCHARREF.lastIndex = nextchar; // w/ lookahead no char has been consumed + var matched = NAMEDCHARREF.exec(chars); + if (!matched) throw new Error("should never happen"); + var name = matched[1]; + if (!name) { + // If no match can be made, switch to the character reference end state + tokenizer = character_reference_end_state; + return; + } + + // Consume the matched characters and append them to temporary buffer + nextchar += name.length; + pushAll(tempbuf, str2buf(name)); + + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // If the character reference was consumed as part of an attribute... + if (name[name.length-1] !== ';') { // ...and the last char is not ; + if (/[=A-Za-z0-9]/.test(chars[nextchar])) { + tokenizer = character_reference_end_state; + return; + } + } + break; + default: + break; + } + + beginTempBuf(); + var rv = namedCharRefs[name]; + if (typeof rv === 'number') { + tempbuf.push(rv); + } else { + pushAll(tempbuf, rv); + } + tokenizer = character_reference_end_state; + } + // We might need to pause tokenization until we have enough characters + // in the buffer for longest possible character reference. + named_character_reference_state.lookahead = -NAMEDCHARREF_MAXLEN; + + function numeric_character_reference_state(c) { + character_reference_code = 0; + switch(c) { + case 0x0078: // x + case 0x0058: // X + tempbuf.push(c); + tokenizer = hexadecimal_character_reference_start_state; + break; + default: + reconsume(c, decimal_character_reference_start_state); + break; + } + } + + function hexadecimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + reconsume(c, hexadecimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function decimal_character_reference_start_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + reconsume(c, decimal_character_reference_state); + break; + default: + reconsume(c, character_reference_end_state); + break; + } + } + + function hexadecimal_character_reference_state(c) { + switch(c) { + case 0x0041: case 0x0042: case 0x0043: case 0x0044: case 0x0045: + case 0x0046: // [A-F] + character_reference_code *= 16; + character_reference_code += (c - 0x0037); + break; + case 0x0061: case 0x0062: case 0x0063: case 0x0064: case 0x0065: + case 0x0066: // [a-f] + character_reference_code *= 16; + character_reference_code += (c - 0x0057); + break; + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 16; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function decimal_character_reference_state(c) { + switch(c) { + case 0x0030: case 0x0031: case 0x0032: case 0x0033: case 0x0034: + case 0x0035: case 0x0036: case 0x0037: case 0x0038: case 0x0039: // [0-9] + character_reference_code *= 10; + character_reference_code += (c - 0x0030); + break; + case 0x003B: // SEMICOLON + tokenizer = numeric_character_reference_end_state; + break; + default: + reconsume(c, numeric_character_reference_end_state); + break; + } + } + + function numeric_character_reference_end_state(c) { + if (character_reference_code in numericCharRefReplacements) { + character_reference_code = numericCharRefReplacements[character_reference_code]; + } else if (character_reference_code > 0x10FFFF || (character_reference_code >= 0xD800 && character_reference_code < 0xE000)) { + character_reference_code = 0xFFFD; + } + + beginTempBuf(); + if (character_reference_code <= 0xFFFF) { + tempbuf.push(character_reference_code); + } else { + character_reference_code = character_reference_code - 0x10000; + /* jshint bitwise: false */ + tempbuf.push(0xD800 + (character_reference_code >> 10)); + tempbuf.push(0xDC00 + (character_reference_code & 0x03FF)); + } + reconsume(c, character_reference_end_state); + } + + function character_reference_end_state(c) { + switch(return_state) { + case attribute_value_double_quoted_state: + case attribute_value_single_quoted_state: + case attribute_value_unquoted_state: + // append each character to the current attribute's value + attrvaluebuf += buf2str(tempbuf); + break; + default: + pushAll(textrun, tempbuf); + break; + } + reconsume(c, return_state); + } + + /*** + * The tree builder insertion modes + */ + + // 11.2.5.4.1 The "initial" insertion mode + function initial_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + var name = value; + var publicid = arg3; + var systemid = arg4; + // Use the constructor directly instead of + // implementation.createDocumentType because the create + // function throws errors on invalid characters, and + // we don't want the parser to throw them. + doc.appendChild(new DocumentType(doc, name, publicid, systemid)); + + // Note that there is no public API for setting quirks mode We can + // do this here because we have access to implementation details + if (force_quirks || + name.toLowerCase() !== "html" || + quirkyPublicIds.test(publicid) || + (systemid && systemid.toLowerCase() === quirkySystemId) || + (systemid === undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._quirks = true; + else if (limitedQuirkyPublicIds.test(publicid) || + (systemid !== undefined && + conditionallyQuirkyPublicIds.test(publicid))) + doc._limitedQuirks = true; + parser = before_html_mode; + return; + } + + // tags or non-whitespace text + doc._quirks = true; + parser = before_html_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.2 The "before html" insertion mode + function before_html_mode(t,value,arg3,arg4) { + var elt; + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 2: // TAG + if (value === "html") { + elt = createHTMLElt(doc, value, arg3); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; // fall through on these + default: + return; // ignore most end tags + } + } + + // Anything that didn't get handled above is handled like this: + elt = createHTMLElt(doc, "html", null); + stack.push(elt); + doc.appendChild(elt); + // XXX: handle application cache here + parser = before_head_mode; + parser(t,value,arg3,arg4); + } + + // 11.2.5.4.3 The "before head" insertion mode + function before_head_mode(t,value,arg3,arg4) { + switch(t) { + case 1: // TEXT + value = value.replace(LEADINGWS, ""); // Ignore spaces + if (value.length === 0) return; // Are we done? + break; // Handle anything non-space text below + case 5: // DOCTYPE + /* ignore the token */ + return; + case 4: // COMMENT + insertComment(value); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t,value,arg3,arg4); + return; + case "head": + var elt = insertHTMLElement(value, arg3); + head_element_pointer = elt; + parser = in_head_mode; + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "html": + case "head": + case "body": + case "br": + break; + default: + return; // ignore most end tags + } + } + + // If not handled explicitly above + before_head_mode(TAG, "head", null); // create a head tag + parser(t, value, arg3, arg4); // then try again with this token + } + + function in_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "meta": + // XXX: + // May need to change the encoding based on this tag + /* falls through */ + case "base": + case "basefont": + case "bgsound": + case "link": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "title": + parseRCDATA(value, arg3); + return; + case "noscript": + if (!scripting_enabled) { + insertHTMLElement(value, arg3); + parser = in_head_noscript_mode; + return; + } + // Otherwise, if scripting is enabled... + /* falls through */ + case "noframes": + case "style": + parseRawText(value,arg3); + return; + case "script": + insertElement(function(doc) { + var elt = createHTMLElt(doc, value, arg3); + elt._parser_inserted = true; + elt._force_async = false; + if (fragment) elt._already_started = true; + flushText(); + return elt; + }); + tokenizer = script_data_state; + originalInsertionMode = parser; + parser = text_mode; + return; + case "template": + insertHTMLElement(value, arg3); + afe.insertMarker(); + frameset_ok = false; + parser = in_template_mode; + templateInsertionModes.push(parser); + return; + case "head": + return; // ignore it + } + break; + case 3: // ENDTAG + switch(value) { + case "head": + stack.pop(); + parser = after_head_mode; + return; + case "body": + case "html": + case "br": + break; // handle these at the bottom of the function + case "template": + if (!stack.contains("template")) { + return; + } + stack.generateImpliedEndTags(null, "thorough"); + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + return; + default: + // ignore any other end tag + return; + } + break; + } + + // If not handled above + in_head_mode(ENDTAG, "head", null); // synthetic + parser(t, value, arg3, arg4); // Then redo this one + } + + // 13.2.5.4.5 The "in head noscript" insertion mode + function in_head_noscript_mode(t, value, arg3, arg4) { + switch(t) { + case 5: // DOCTYPE + return; + case 4: // COMMENT + in_head_mode(t, value); + return; + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + in_head_mode(t, ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; // no more text + break; // Handle non-whitespace below + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "style": + in_head_mode(t, value, arg3); + return; + case "head": + case "noscript": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "noscript": + stack.pop(); + parser = in_head_mode; + return; + case "br": + break; // goes to the outer default + default: + return; // ignore other end tags + } + break; + } + + // If not handled above + in_head_noscript_mode(ENDTAG, "noscript", null); + parser(t, value, arg3, arg4); + } + + function after_head_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "body": + insertHTMLElement(value, arg3); + frameset_ok = false; + parser = in_body_mode; + return; + case "frameset": + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + stack.push(head_element_pointer); + in_head_mode(TAG, value, arg3); + stack.removeElement(head_element_pointer); + return; + case "head": + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "template": + return in_head_mode(t, value, arg3, arg4); + case "body": + case "html": + case "br": + break; + default: + return; // ignore any other end tag + } + break; + } + + after_head_mode(TAG, "body", null); + frameset_ok = true; + parser(t, value, arg3, arg4); + } + + // 13.2.5.4.7 The "in body" insertion mode + function in_body_mode(t,value,arg3,arg4) { + var body, i, node, elt; + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + // If any non-space characters + if (frameset_ok && NONWS.test(value)) + frameset_ok = false; + afereconstruct(); + insertText(value); + return; + case 5: // DOCTYPE + return; + case 4: // COMMENT + insertComment(value); + return; + case -1: // EOF + if (templateInsertionModes.length) { + return in_template_mode(t); + } + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + if (stack.contains("template")) { + return; + } + transferAttributes(arg3, stack.elements[0]); + return; + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(TAG, value, arg3); + return; + case "body": + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement) || + stack.contains("template")) + return; + frameset_ok = false; + transferAttributes(arg3, body); + return; + case "frameset": + if (!frameset_ok) return; + body = stack.elements[1]; + if (!body || !(body instanceof impl.HTMLBodyElement)) + return; + if (body.parentNode) body.parentNode.removeChild(body); + while(!(stack.top instanceof impl.HTMLHtmlElement)) + stack.pop(); + insertHTMLElement(value, arg3); + parser = in_frameset_mode; + return; + + case "address": + case "article": + case "aside": + case "blockquote": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "main": + case "nav": + case "ol": + case "p": + case "section": + case "summary": + case "ul": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "menu": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + insertHTMLElement(value, arg3); + return; + + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (stack.top instanceof impl.HTMLHeadingElement) + stack.pop(); + insertHTMLElement(value, arg3); + return; + + case "pre": + case "listing": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + ignore_linefeed = true; + frameset_ok = false; + return; + + case "form": + if (form_element_pointer && !stack.contains("template")) return; + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + elt = insertHTMLElement(value, arg3); + if (!stack.contains("template")) + form_element_pointer = elt; + return; + + case "li": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (node instanceof impl.HTMLLIElement) { + in_body_mode(ENDTAG, "li"); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "dd": + case "dt": + frameset_ok = false; + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, dddtSet)) { + in_body_mode(ENDTAG, node.localName); + break; + } + if (isA(node, specialSet) && !isA(node, addressdivpSet)) + break; + } + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + return; + + case "plaintext": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + insertHTMLElement(value, arg3); + tokenizer = plaintext_state; + return; + + case "button": + if (stack.inScope("button")) { + in_body_mode(ENDTAG, "button"); + parser(t, value, arg3, arg4); + } + else { + afereconstruct(); + insertHTMLElement(value, arg3); + frameset_ok = false; + } + return; + + case "a": + var activeElement = afe.findElementByTag("a"); + if (activeElement) { + in_body_mode(ENDTAG, value); + afe.remove(activeElement); + stack.removeElement(activeElement); + } + /* falls through */ + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + afereconstruct(); + afe.push(insertHTMLElement(value,arg3), arg3); + return; + + case "nobr": + afereconstruct(); + + if (stack.inScope(value)) { + in_body_mode(ENDTAG, value); + afereconstruct(); + } + afe.push(insertHTMLElement(value,arg3), arg3); + return; + + case "applet": + case "marquee": + case "object": + afereconstruct(); + insertHTMLElement(value,arg3); + afe.insertMarker(); + frameset_ok = false; + return; + + case "table": + if (!doc._quirks && stack.inButtonScope("p")) { + in_body_mode(ENDTAG, "p"); + } + insertHTMLElement(value,arg3); + frameset_ok = false; + parser = in_table_mode; + return; + + case "area": + case "br": + case "embed": + case "img": + case "keygen": + case "wbr": + afereconstruct(); + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; + + case "input": + afereconstruct(); + elt = insertHTMLElement(value,arg3); + stack.pop(); + var type = elt.getAttribute("type"); + if (!type || type.toLowerCase() !== "hidden") + frameset_ok = false; + return; + + case "param": + case "source": + case "track": + insertHTMLElement(value,arg3); + stack.pop(); + return; + + case "hr": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + insertHTMLElement(value,arg3); + stack.pop(); + frameset_ok = false; + return; + + case "image": + in_body_mode(TAG, "img", arg3, arg4); + return; + + case "textarea": + insertHTMLElement(value,arg3); + ignore_linefeed = true; + frameset_ok = false; + tokenizer = rcdata_state; + originalInsertionMode = parser; + parser = text_mode; + return; + + case "xmp": + if (stack.inButtonScope("p")) in_body_mode(ENDTAG, "p"); + afereconstruct(); + frameset_ok = false; + parseRawText(value, arg3); + return; + + case "iframe": + frameset_ok = false; + parseRawText(value, arg3); + return; + + case "noembed": + parseRawText(value,arg3); + return; + + case "select": + afereconstruct(); + insertHTMLElement(value,arg3); + frameset_ok = false; + if (parser === in_table_mode || + parser === in_caption_mode || + parser === in_table_body_mode || + parser === in_row_mode || + parser === in_cell_mode) + parser = in_select_in_table_mode; + else + parser = in_select_mode; + return; + + case "optgroup": + case "option": + if (stack.top instanceof impl.HTMLOptionElement) { + in_body_mode(ENDTAG, "option"); + } + afereconstruct(); + insertHTMLElement(value,arg3); + return; + + case "menuitem": + if (isA(stack.top, 'menuitem')) { + stack.pop(); + } + afereconstruct(); + insertHTMLElement(value, arg3); + return; + + case "rb": + case "rtc": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags(); + } + insertHTMLElement(value,arg3); + return; + + case "rp": + case "rt": + if (stack.inScope("ruby")) { + stack.generateImpliedEndTags("rtc"); + } + insertHTMLElement(value,arg3); + return; + + case "math": + afereconstruct(); + adjustMathMLAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.MATHML); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "svg": + afereconstruct(); + adjustSVGAttributes(arg3); + adjustForeignAttributes(arg3); + insertForeignElement(value, arg3, NAMESPACE.SVG); + if (arg4) // self-closing flag + stack.pop(); + return; + + case "caption": + case "col": + case "colgroup": + case "frame": + case "head": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + // Ignore table tags if we're not in_table mode + return; + } + + // Handle any other start tag here + // (and also noscript tags when scripting is disabled) + afereconstruct(); + insertHTMLElement(value,arg3); + return; + + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(ENDTAG, value, arg3); + return; + case "body": + if (!stack.inScope("body")) return; + parser = after_body_mode; + return; + case "html": + if (!stack.inScope("body")) return; + parser = after_body_mode; + parser(t, value, arg3); + return; + + case "address": + case "article": + case "aside": + case "blockquote": + case "button": + case "center": + case "details": + case "dialog": + case "dir": + case "div": + case "dl": + case "fieldset": + case "figcaption": + case "figure": + case "footer": + case "header": + case "hgroup": + case "listing": + case "main": + case "menu": + case "nav": + case "ol": + case "pre": + case "section": + case "summary": + case "ul": + // Ignore if there is not a matching open tag + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + return; + + case "form": + if (!stack.contains("template")) { + var openform = form_element_pointer; + form_element_pointer = null; + if (!openform || !stack.elementInScope(openform)) return; + stack.generateImpliedEndTags(); + stack.removeElement(openform); + } else { + if (!stack.inScope("form")) return; + stack.generateImpliedEndTags(); + stack.popTag("form"); + } + return; + + case "p": + if (!stack.inButtonScope(value)) { + in_body_mode(TAG, value, null); + parser(t, value, arg3, arg4); + } + else { + stack.generateImpliedEndTags(value); + stack.popTag(value); + } + return; + + case "li": + if (!stack.inListItemScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; + + case "dd": + case "dt": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(value); + stack.popTag(value); + return; + + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + if (!stack.elementTypeInScope(impl.HTMLHeadingElement)) return; + stack.generateImpliedEndTags(); + stack.popElementType(impl.HTMLHeadingElement); + return; + + case "sarcasm": + // Take a deep breath, and then: + break; + + case "a": + case "b": + case "big": + case "code": + case "em": + case "font": + case "i": + case "nobr": + case "s": + case "small": + case "strike": + case "strong": + case "tt": + case "u": + var result = adoptionAgency(value); + if (result) return; // If we did something we're done + break; // Go to the "any other end tag" case + + case "applet": + case "marquee": + case "object": + if (!stack.inScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + return; + + case "br": + in_body_mode(TAG, value, null); // Turn
    into
    + return; + } + + // Any other end tag goes here + for(i = stack.elements.length-1; i >= 0; i--) { + node = stack.elements[i]; + if (isA(node, value)) { + stack.generateImpliedEndTags(value); + stack.popElement(node); + break; + } + else if (isA(node, specialSet)) { + return; + } + } + + return; + } + } + + function text_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + insertText(value); + return; + case -1: // EOF + if (stack.top instanceof impl.HTMLScriptElement) + stack.top._already_started = true; + stack.pop(); + parser = originalInsertionMode; + parser(t); + return; + case 3: // ENDTAG + if (value === "script") { + handleScriptEnd(); + } + else { + stack.pop(); + parser = originalInsertionMode; + } + return; + default: + // We should never get any other token types + return; + } + } + + function in_table_mode(t, value, arg3, arg4) { + function getTypeAttr(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + if (attrs[i][0] === "type") + return attrs[i][1].toLowerCase(); + } + return null; + } + + switch(t) { + case 1: // TEXT + // XXX the text_integration_mode stuff is + // just a hack I made up + if (text_integration_mode) { + in_body_mode(t, value, arg3, arg4); + return; + } + else if (isA(stack.top, tablesectionrowSet)) { + pending_table_text = []; + originalInsertionMode = parser; + parser = in_table_text_mode; + parser(t, value, arg3, arg4); + return; + } + break; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "caption": + stack.clearToContext(tableContextSet); + afe.insertMarker(); + insertHTMLElement(value,arg3); + parser = in_caption_mode; + return; + case "colgroup": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_column_group_mode; + return; + case "col": + in_table_mode(TAG, "colgroup", null); + parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + stack.clearToContext(tableContextSet); + insertHTMLElement(value,arg3); + parser = in_table_body_mode; + return; + case "td": + case "th": + case "tr": + in_table_mode(TAG, "tbody", null); + parser(t, value, arg3, arg4); + return; + + case "table": + if (!stack.inTableScope(value)) { + return; // Ignore the token + } + in_table_mode(ENDTAG, value); + parser(t, value, arg3, arg4); + return; + + case "style": + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; + + case "input": + var type = getTypeAttr(arg3); + if (type !== "hidden") break; // to the anything else case + insertHTMLElement(value,arg3); + stack.pop(); + return; + + case "form": + if (form_element_pointer || stack.contains("template")) return; + form_element_pointer = insertHTMLElement(value, arg3); + stack.popElement(form_element_pointer); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + if (!stack.inTableScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + } + + // This is the anything else case + foster_parent_mode = true; + in_body_mode(t, value, arg3, arg4); + foster_parent_mode = false; + } + + function in_table_text_mode(t, value, arg3, arg4) { + if (t === TEXT) { + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + pending_table_text.push(value); + } + else { + var s = pending_table_text.join(""); + pending_table_text.length = 0; + if (NONWS.test(s)) { // If any non-whitespace characters + // This must be the same code as the "anything else" + // case of the in_table mode above. + foster_parent_mode = true; + in_body_mode(TEXT, s); + foster_parent_mode = false; + } + else { + insertText(s); + } + parser = originalInsertionMode; + parser(t, value, arg3, arg4); + } + } + + + function in_caption_mode(t, value, arg3, arg4) { + function end_caption() { + if (!stack.inTableScope("caption")) return false; + stack.generateImpliedEndTags(); + stack.popTag("caption"); + afe.clearToMarker(); + parser = in_table_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (end_caption()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "caption": + end_caption(); + return; + case "table": + if (end_caption()) parser(t, value, arg3, arg4); + return; + case "body": + case "col": + case "colgroup": + case "html": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + return; + } + break; + } + + // The Anything Else case + in_body_mode(t, value, arg3, arg4); + } + + function in_column_group_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + var ws = value.match(LEADINGWS); + if (ws) { + insertText(ws[0]); + value = value.substring(ws[0].length); + } + if (value.length === 0) return; + break; // Handle non-whitespace below + + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "col": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "colgroup": + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + stack.pop(); + parser = in_table_mode; + return; + case "col": + return; + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + } + + // Anything else + if (!isA(stack.top, 'colgroup')) { + return; // Ignore the token. + } + in_column_group_mode(ENDTAG, "colgroup"); + parser(t, value, arg3, arg4); + } + + function in_table_body_mode(t, value, arg3, arg4) { + function endsect() { + if (!stack.inTableScope("tbody") && + !stack.inTableScope("thead") && + !stack.inTableScope("tfoot")) + return; + stack.clearToContext(tableBodyContextSet); + in_table_body_mode(ENDTAG, stack.top.localName, null); + parser(t, value, arg3, arg4); + } + + switch(t) { + case 2: // TAG + switch(value) { + case "tr": + stack.clearToContext(tableBodyContextSet); + insertHTMLElement(value, arg3); + parser = in_row_mode; + return; + case "th": + case "td": + in_table_body_mode(TAG, "tr", null); + parser(t, value, arg3, arg4); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + endsect(); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "table": + endsect(); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + stack.clearToContext(tableBodyContextSet); + stack.pop(); + parser = in_table_mode; + } + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + case "tr": + return; + } + break; + } + + // Anything else: + in_table_mode(t, value, arg3, arg4); + } + + function in_row_mode(t, value, arg3, arg4) { + function endrow() { + if (!stack.inTableScope("tr")) return false; + stack.clearToContext(tableRowContextSet); + stack.pop(); + parser = in_table_body_mode; + return true; + } + + switch(t) { + case 2: // TAG + switch(value) { + case "th": + case "td": + stack.clearToContext(tableRowContextSet); + insertHTMLElement(value, arg3); + parser = in_cell_mode; + afe.insertMarker(); + return; + case "caption": + case "col": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (endrow()) parser(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "tr": + endrow(); + return; + case "table": + if (endrow()) parser(t, value, arg3, arg4); + return; + case "tbody": + case "tfoot": + case "thead": + if (stack.inTableScope(value)) { + if (endrow()) parser(t, value, arg3, arg4); + } + return; + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + case "td": + case "th": + return; + } + break; + } + + // anything else + in_table_mode(t, value, arg3, arg4); + } + + function in_cell_mode(t, value, arg3, arg4) { + switch(t) { + case 2: // TAG + switch(value) { + case "caption": + case "col": + case "colgroup": + case "tbody": + case "td": + case "tfoot": + case "th": + case "thead": + case "tr": + if (stack.inTableScope("td")) { + in_cell_mode(ENDTAG, "td"); + parser(t, value, arg3, arg4); + } + else if (stack.inTableScope("th")) { + in_cell_mode(ENDTAG, "th"); + parser(t, value, arg3, arg4); + } + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "td": + case "th": + if (!stack.inTableScope(value)) return; + stack.generateImpliedEndTags(); + stack.popTag(value); + afe.clearToMarker(); + parser = in_row_mode; + return; + + case "body": + case "caption": + case "col": + case "colgroup": + case "html": + return; + + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + if (!stack.inTableScope(value)) return; + in_cell_mode(ENDTAG, stack.inTableScope("td") ? "td" : "th"); + parser(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + in_body_mode(t, value, arg3, arg4); + } + + function in_select_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + if (textIncludesNUL) { + value = value.replace(NULCHARS, ""); + if (value.length === 0) return; + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + in_body_mode(t, value, arg3, arg4); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement) + in_select_mode(ENDTAG, "option"); + if (stack.top instanceof impl.HTMLOptGroupElement) + in_select_mode(ENDTAG, value); + insertHTMLElement(value, arg3); + return; + case "select": + in_select_mode(ENDTAG, value); // treat it as a close tag + return; + + case "input": + case "keygen": + case "textarea": + if (!stack.inSelectScope("select")) return; + in_select_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + + case "script": + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + switch(value) { + case "optgroup": + if (stack.top instanceof impl.HTMLOptionElement && + stack.elements[stack.elements.length-2] instanceof + impl.HTMLOptGroupElement) { + in_select_mode(ENDTAG, "option"); + } + if (stack.top instanceof impl.HTMLOptGroupElement) + stack.pop(); + + return; + + case "option": + if (stack.top instanceof impl.HTMLOptionElement) + stack.pop(); + return; + + case "select": + if (!stack.inSelectScope(value)) return; + stack.popTag(value); + resetInsertionMode(); + return; + + case "template": + in_head_mode(t, value, arg3, arg4); + return; + } + + break; + } + + // anything else: just ignore the token + } + + function in_select_in_table_mode(t, value, arg3, arg4) { + switch(value) { + case "caption": + case "table": + case "tbody": + case "tfoot": + case "thead": + case "tr": + case "td": + case "th": + switch(t) { + case 2: // TAG + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + return; + case 3: // ENDTAG + if (stack.inTableScope(value)) { + in_select_in_table_mode(ENDTAG, "select"); + parser(t, value, arg3, arg4); + } + return; + } + } + + // anything else + in_select_mode(t, value, arg3, arg4); + } + + function in_template_mode(t, value, arg3, arg4) { + function switchModeAndReprocess(mode) { + parser = mode; + templateInsertionModes[templateInsertionModes.length-1] = parser; + parser(t, value, arg3, arg4); + } + switch(t) { + case 1: // TEXT + case 4: // COMMENT + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + if (!stack.contains("template")) { + stopParsing(); + } else { + stack.popTag("template"); + afe.clearToMarker(); + templateInsertionModes.pop(); + resetInsertionMode(); + parser(t, value, arg3, arg4); + } + return; + case 2: // TAG + switch(value) { + case "base": + case "basefont": + case "bgsound": + case "link": + case "meta": + case "noframes": + case "script": + case "style": + case "template": + case "title": + in_head_mode(t, value, arg3, arg4); + return; + case "caption": + case "colgroup": + case "tbody": + case "tfoot": + case "thead": + switchModeAndReprocess(in_table_mode); + return; + case "col": + switchModeAndReprocess(in_column_group_mode); + return; + case "tr": + switchModeAndReprocess(in_table_body_mode); + return; + case "td": + case "th": + switchModeAndReprocess(in_row_mode); + return; + } + switchModeAndReprocess(in_body_mode); + return; + case 3: // ENDTAG + switch(value) { + case "template": + in_head_mode(t, value, arg3, arg4); + return; + default: + return; + } + } + } + + function after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value); + return; + case 4: // COMMENT + // Append it to the element + stack.elements[0]._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; // for any other tags + case 3: // ENDTAG + if (value === "html") { + if (fragment) return; + parser = after_after_body_mode; + return; + } + break; // for any other tags + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function in_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "frameset": + insertHTMLElement(value, arg3); + return; + case "frame": + insertHTMLElement(value, arg3); + stack.pop(); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "frameset") { + if (fragment && stack.top instanceof impl.HTMLHtmlElement) + return; + stack.pop(); + if (!fragment && + !(stack.top instanceof impl.HTMLFrameSetElement)) + parser = after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + case 3: // ENDTAG + if (value === "html") { + parser = after_after_frameset_mode; + return; + } + break; + } + + // ignore anything else + } + + function after_after_body_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // If any non-space chars, handle below + if (NONWS.test(value)) break; + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + if (value === "html") { + in_body_mode(t, value, arg3, arg4); + return; + } + break; + } + + // anything else + parser = in_body_mode; + parser(t, value, arg3, arg4); + } + + function after_after_frameset_mode(t, value, arg3, arg4) { + switch(t) { + case 1: // TEXT + // Ignore any non-space characters + value = value.replace(ALLNONWS, ""); + if (value.length > 0) + in_body_mode(t, value, arg3, arg4); + return; + case 4: // COMMENT + doc._appendChild(doc.createComment(value)); + return; + case 5: // DOCTYPE + in_body_mode(t, value, arg3, arg4); + return; + case -1: // EOF + stopParsing(); + return; + case 2: // TAG + switch(value) { + case "html": + in_body_mode(t, value, arg3, arg4); + return; + case "noframes": + in_head_mode(t, value, arg3, arg4); + return; + } + break; + } + + // ignore anything else + } + + + // 13.2.5.5 The rules for parsing tokens in foreign content + // + // This is like one of the insertion modes above, but is + // invoked somewhat differently when the current token is not HTML. + // See the insertToken() function. + function insertForeignToken(t, value, arg3, arg4) { + // A tag is an HTML font tag if it has a color, font, or size + // attribute. Otherwise we assume it is foreign content + function isHTMLFont(attrs) { + for(var i = 0, n = attrs.length; i < n; i++) { + switch(attrs[i][0]) { + case "color": + case "face": + case "size": + return true; + } + } + return false; + } + + var current; + + switch(t) { + case 1: // TEXT + // If any non-space, non-nul characters + if (frameset_ok && NONWSNONNUL.test(value)) + frameset_ok = false; + if (textIncludesNUL) { + value = value.replace(NULCHARS, "\uFFFD"); + } + insertText(value); + return; + case 4: // COMMENT + insertComment(value); + return; + case 5: // DOCTYPE + // ignore it + return; + case 2: // TAG + switch(value) { + case "font": + if (!isHTMLFont(arg3)) break; + /* falls through */ + case "b": + case "big": + case "blockquote": + case "body": + case "br": + case "center": + case "code": + case "dd": + case "div": + case "dl": + case "dt": + case "em": + case "embed": + case "h1": + case "h2": + case "h3": + case "h4": + case "h5": + case "h6": + case "head": + case "hr": + case "i": + case "img": + case "li": + case "listing": + case "menu": + case "meta": + case "nobr": + case "ol": + case "p": + case "pre": + case "ruby": + case "s": + case "small": + case "span": + case "strong": + case "strike": + case "sub": + case "sup": + case "table": + case "tt": + case "u": + case "ul": + case "var": + if (fragment) { + break; + } + do { + stack.pop(); + current = stack.top; + } while(current.namespaceURI !== NAMESPACE.HTML && + !isMathmlTextIntegrationPoint(current) && + !isHTMLIntegrationPoint(current)); + + insertToken(t, value, arg3, arg4); // reprocess + return; + } + + // Any other start tag case goes here + current = (stack.elements.length===1 && fragment) ? fragmentContext : + stack.top; + if (current.namespaceURI === NAMESPACE.MATHML) { + adjustMathMLAttributes(arg3); + } + else if (current.namespaceURI === NAMESPACE.SVG) { + value = adjustSVGTagName(value); + adjustSVGAttributes(arg3); + } + adjustForeignAttributes(arg3); + + insertForeignElement(value, arg3, current.namespaceURI); + if (arg4) { // the self-closing flag + if (value === 'script' && current.namespaceURI === NAMESPACE.SVG) { + // XXX deal with SVG scripts here + } + stack.pop(); + } + return; + + case 3: // ENDTAG + current = stack.top; + if (value === "script" && + current.namespaceURI === NAMESPACE.SVG && + current.localName === "script") { + + stack.pop(); + + // XXX + // Deal with SVG scripts here + } + else { + // The any other end tag case + var i = stack.elements.length-1; + var node = stack.elements[i]; + for(;;) { + if (node.localName.toLowerCase() === value) { + stack.popElement(node); + break; + } + node = stack.elements[--i]; + // If non-html, keep looping + if (node.namespaceURI !== NAMESPACE.HTML) + continue; + // Otherwise process the end tag as html + parser(t, value, arg3, arg4); + break; + } + } + return; + } + } + + /*** + * Finally, this is the end of the HTMLParser() factory function. + * It returns the htmlparser object with the append() and end() methods. + */ + + // Sneak another method into the htmlparser object to allow us to run + // tokenizer tests. This can be commented out in production code. + // This is a hook for testing the tokenizer. It has to be here + // because the tokenizer details are all hidden away within the closure. + // It should return an array of tokens generated while parsing the + // input string. + htmlparser.testTokenizer = function(input, initialState, lastStartTag, charbychar) { + var tokens = []; + + switch(initialState) { + case "PCDATA state": + tokenizer = data_state; + break; + case "RCDATA state": + tokenizer = rcdata_state; + break; + case "RAWTEXT state": + tokenizer = rawtext_state; + break; + case "PLAINTEXT state": + tokenizer = plaintext_state; + break; + } + + if (lastStartTag) { + lasttagname = lastStartTag; + } + + insertToken = function(t, value, arg3, arg4) { + flushText(); + switch(t) { + case 1: // TEXT + if (tokens.length > 0 && + tokens[tokens.length-1][0] === "Character") { + tokens[tokens.length-1][1] += value; + } + else tokens.push(["Character", value]); + break; + case 4: // COMMENT + tokens.push(["Comment", value]); + break; + case 5: // DOCTYPE + tokens.push(["DOCTYPE", value, + arg3 === undefined ? null : arg3, + arg4 === undefined ? null : arg4, + !force_quirks]); + break; + case 2: // TAG + var attrs = Object.create(null); + for(var i = 0; i < arg3.length; i++) { + // XXX: does attribute order matter? + var a = arg3[i]; + if (a.length === 1) { + attrs[a[0]] = ""; + } + else { + attrs[a[0]] = a[1]; + } + } + var token = ["StartTag", value, attrs]; + if (arg4) token.push(true); + tokens.push(token); + break; + case 3: // ENDTAG + tokens.push(["EndTag", value]); + break; + case -1: // EOF + break; + } + }; + + if (!charbychar) { + this.parse(input, true); + } + else { + for(var i = 0; i < input.length; i++) { + this.parse(input[i]); + } + this.parse("", true); + } + return tokens; + }; + + // Return the parser object from the HTMLParser() factory function + return htmlparser; +} + + +/***/ }), + +/***/ 31204: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Leaf; + +var Node = __webpack_require__(20576); +var NodeList = __webpack_require__(45192); +var utils = __webpack_require__(91995); +var HierarchyRequestError = utils.HierarchyRequestError; +var NotFoundError = utils.NotFoundError; + +// This class defines common functionality for node subtypes that +// can never have children +function Leaf() { + Node.call(this); +} + +Leaf.prototype = Object.create(Node.prototype, { + hasChildNodes: { value: function() { return false; }}, + firstChild: { value: null }, + lastChild: { value: null }, + insertBefore: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + replaceChild: { value: function(node, child) { + if (!node.nodeType) throw new TypeError('not a node'); + HierarchyRequestError(); + }}, + removeChild: { value: function(node) { + if (!node.nodeType) throw new TypeError('not a node'); + NotFoundError(); + }}, + removeChildren: { value: function() { /* no op */ }}, + childNodes: { get: function() { + if (!this._childNodes) this._childNodes = new NodeList(); + return this._childNodes; + }} +}); + + +/***/ }), + +/***/ 81757: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(91995); + +var LinkedList = module.exports = { + // basic validity tests on a circular linked list a + valid: function(a) { + utils.assert(a, "list falsy"); + utils.assert(a._previousSibling, "previous falsy"); + utils.assert(a._nextSibling, "next falsy"); + // xxx check that list is actually circular + return true; + }, + // insert a before b + insertBefore: function(a, b) { + utils.assert(LinkedList.valid(a) && LinkedList.valid(b)); + var a_first = a, a_last = a._previousSibling; + var b_first = b, b_last = b._previousSibling; + a_first._previousSibling = b_last; + a_last._nextSibling = b_first; + b_last._nextSibling = a_first; + b_first._previousSibling = a_last; + utils.assert(LinkedList.valid(a) && LinkedList.valid(b)); + }, + // replace a single node a with a list b (which could be null) + replace: function(a, b) { + utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b))); + if (b!==null) { + LinkedList.insertBefore(b, a); + } + LinkedList.remove(a); + utils.assert(LinkedList.valid(a) && (b===null || LinkedList.valid(b))); + }, + // remove single node a from its list + remove: function(a) { + utils.assert(LinkedList.valid(a)); + var prev = a._previousSibling; + if (prev === a) { return; } + var next = a._nextSibling; + prev._nextSibling = next; + next._previousSibling = prev; + a._previousSibling = a._nextSibling = a; + utils.assert(LinkedList.valid(a)); + } +}; + + +/***/ }), + +/***/ 73851: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var URL = __webpack_require__(40747); +var URLUtils = __webpack_require__(22554); + +module.exports = Location; + +function Location(window, href) { + this._window = window; + this._href = href; +} + +Location.prototype = Object.create(URLUtils.prototype, { + constructor: { value: Location }, + + // Special behavior when href is set + href: { + get: function() { return this._href; }, + set: function(v) { this.assign(v); } + }, + + assign: { value: function(url) { + // Resolve the new url against the current one + // XXX: + // This is not actually correct. It should be resolved against + // the URL of the document of the script. For now, though, I only + // support a single window and there is only one base url. + // So this is good enough for now. + var current = new URL(this._href); + var newurl = current.resolve(url); + + // Save the new url + this._href = newurl; + + // Start loading the new document! + // XXX + // This is just something hacked together. + // The real algorithm is: http://www.whatwg.org/specs/web-apps/current-work/multipage/history.html#navigate + }}, + + replace: { value: function(url) { + // XXX + // Since we aren't tracking history yet, replace is the same as assign + this.assign(url); + }}, + + reload: { value: function() { + // XXX: + // Actually, the spec is a lot more complicated than this + this.assign(this.href); + }}, + + toString: { value: function() { + return this.href; + }} + +}); + + +/***/ }), + +/***/ 6421: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var UIEvent = __webpack_require__(45280); + +module.exports = MouseEvent; + +function MouseEvent() { + // Just use the superclass constructor to initialize + UIEvent.call(this); + + this.screenX = this.screenY = this.clientX = this.clientY = 0; + this.ctrlKey = this.altKey = this.shiftKey = this.metaKey = false; + this.button = 0; + this.buttons = 1; + this.relatedTarget = null; +} +MouseEvent.prototype = Object.create(UIEvent.prototype, { + constructor: { value: MouseEvent }, + initMouseEvent: { value: function(type, bubbles, cancelable, + view, detail, + screenX, screenY, clientX, clientY, + ctrlKey, altKey, shiftKey, metaKey, + button, relatedTarget) { + + this.initEvent(type, bubbles, cancelable, view, detail); + this.screenX = screenX; + this.screenY = screenY; + this.clientX = clientX; + this.clientY = clientY; + this.ctrlKey = ctrlKey; + this.altKey = altKey; + this.shiftKey = shiftKey; + this.metaKey = metaKey; + this.button = button; + switch(button) { + case 0: this.buttons = 1; break; + case 1: this.buttons = 4; break; + case 2: this.buttons = 2; break; + default: this.buttons = 0; break; + } + this.relatedTarget = relatedTarget; + }}, + + getModifierState: { value: function(key) { + switch(key) { + case "Alt": return this.altKey; + case "Control": return this.ctrlKey; + case "Shift": return this.shiftKey; + case "Meta": return this.metaKey; + default: return false; + } + }} +}); + + +/***/ }), + +/***/ 92078: +/***/ ((module) => { + +"use strict"; + +module.exports = { + VALUE: 1, // The value of a Text, Comment or PI node changed + ATTR: 2, // A new attribute was added or an attribute value and/or prefix changed + REMOVE_ATTR: 3, // An attribute was removed + REMOVE: 4, // A node was removed + MOVE: 5, // A node was moved + INSERT: 6 // A node (or a subtree of nodes) was inserted +}; + +/***/ }), + +/***/ 49: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = NamedNodeMap; + +var utils = __webpack_require__(91995); + +/* This is a hacky implementation of NamedNodeMap, intended primarily to + * satisfy clients (like dompurify and the web-platform-tests) which check + * to ensure that Node#attributes instanceof NamedNodeMap. */ + +function NamedNodeMap(element) { + this.element = element; +} +Object.defineProperties(NamedNodeMap.prototype, { + length: { get: utils.shouldOverride }, + item: { value: utils.shouldOverride }, + + getNamedItem: { value: function getNamedItem(qualifiedName) { + return this.element.getAttributeNode(qualifiedName); + } }, + getNamedItemNS: { value: function getNamedItemNS(namespace, localName) { + return this.element.getAttributeNodeNS(namespace, localName); + } }, + setNamedItem: { value: utils.nyi }, + setNamedItemNS: { value: utils.nyi }, + removeNamedItem: { value: function removeNamedItem(qualifiedName) { + var attr = this.element.getAttributeNode(qualifiedName); + if (attr) { + this.element.removeAttribute(qualifiedName); + return attr; + } + utils.NotFoundError(); + } }, + removeNamedItemNS: { value: function removeNamedItemNS(ns, lname) { + var attr = this.element.getAttributeNodeNS(ns, lname); + if (attr) { + this.element.removeAttributeNS(ns, lname); + return attr; + } + utils.NotFoundError(); + } }, +}); + + +/***/ }), + +/***/ 69162: +/***/ ((module) => { + +"use strict"; + + +// https://html.spec.whatwg.org/multipage/webappapis.html#navigatorid +var NavigatorID = Object.create(null, { + appCodeName: { value: "Mozilla" }, + appName: { value: "Netscape" }, + appVersion: { value: "4.0" }, + platform: { value: "" }, + product: { value: "Gecko" }, + productSub: { value: "20100101" }, + userAgent: { value: "" }, + vendor: { value: "" }, + vendorSub: { value: "" }, + taintEnabled: { value: function() { return false; } } +}); + +module.exports = NavigatorID; + + +/***/ }), + +/***/ 20576: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Node; + +var EventTarget = __webpack_require__(91283); +var LinkedList = __webpack_require__(81757); +var NodeUtils = __webpack_require__(80859); +var utils = __webpack_require__(91995); + +// All nodes have a nodeType and an ownerDocument. +// Once inserted, they also have a parentNode. +// This is an abstract class; all nodes in a document are instances +// of a subtype, so all the properties are defined by more specific +// constructors. +function Node() { + EventTarget.call(this); + this.parentNode = null; + this._nextSibling = this._previousSibling = this; + this._index = undefined; +} + +var ELEMENT_NODE = Node.ELEMENT_NODE = 1; +var ATTRIBUTE_NODE = Node.ATTRIBUTE_NODE = 2; +var TEXT_NODE = Node.TEXT_NODE = 3; +var CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE = 4; +var ENTITY_REFERENCE_NODE = Node.ENTITY_REFERENCE_NODE = 5; +var ENTITY_NODE = Node.ENTITY_NODE = 6; +var PROCESSING_INSTRUCTION_NODE = Node.PROCESSING_INSTRUCTION_NODE = 7; +var COMMENT_NODE = Node.COMMENT_NODE = 8; +var DOCUMENT_NODE = Node.DOCUMENT_NODE = 9; +var DOCUMENT_TYPE_NODE = Node.DOCUMENT_TYPE_NODE = 10; +var DOCUMENT_FRAGMENT_NODE = Node.DOCUMENT_FRAGMENT_NODE = 11; +var NOTATION_NODE = Node.NOTATION_NODE = 12; + +var DOCUMENT_POSITION_DISCONNECTED = Node.DOCUMENT_POSITION_DISCONNECTED = 0x01; +var DOCUMENT_POSITION_PRECEDING = Node.DOCUMENT_POSITION_PRECEDING = 0x02; +var DOCUMENT_POSITION_FOLLOWING = Node.DOCUMENT_POSITION_FOLLOWING = 0x04; +var DOCUMENT_POSITION_CONTAINS = Node.DOCUMENT_POSITION_CONTAINS = 0x08; +var DOCUMENT_POSITION_CONTAINED_BY = Node.DOCUMENT_POSITION_CONTAINED_BY = 0x10; +var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = Node.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20; + +Node.prototype = Object.create(EventTarget.prototype, { + + // Node that are not inserted into the tree inherit a null parent + + // XXX: the baseURI attribute is defined by dom core, but + // a correct implementation of it requires HTML features, so + // we'll come back to this later. + baseURI: { get: utils.nyi }, + + parentElement: { get: function() { + return (this.parentNode && this.parentNode.nodeType===ELEMENT_NODE) ? this.parentNode : null; + }}, + + hasChildNodes: { value: utils.shouldOverride }, + + firstChild: { get: utils.shouldOverride }, + + lastChild: { get: utils.shouldOverride }, + + isConnected: { + get: function () { + let node = this; + while (node != null) { + if (node.nodeType === Node.DOCUMENT_NODE) { + return true; + } + + node = node.parentNode; + if (node != null && node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) { + node = node.host; + } + } + return false; + }, + }, + + previousSibling: { get: function() { + var parent = this.parentNode; + if (!parent) return null; + if (this === parent.firstChild) return null; + return this._previousSibling; + }}, + + nextSibling: { get: function() { + var parent = this.parentNode, next = this._nextSibling; + if (!parent) return null; + if (next === parent.firstChild) return null; + return next; + }}, + + textContent: { + // Should override for DocumentFragment/Element/Attr/Text/PI/Comment + get: function() { return null; }, + set: function(v) { /* do nothing */ }, + }, + + innerText: { + // Should override for DocumentFragment/Element/Attr/Text/PI/Comment + get: function() { return null; }, + set: function(v) { /* do nothing */ }, + }, + + _countChildrenOfType: { value: function(type) { + var sum = 0; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === type) sum++; + } + return sum; + }}, + + _ensureInsertValid: { value: function _ensureInsertValid(node, child, isPreinsert) { + var parent = this, i, kid; + if (!node.nodeType) throw new TypeError('not a node'); + // 1. If parent is not a Document, DocumentFragment, or Element + // node, throw a HierarchyRequestError. + switch (parent.nodeType) { + case DOCUMENT_NODE: + case DOCUMENT_FRAGMENT_NODE: + case ELEMENT_NODE: + break; + default: utils.HierarchyRequestError(); + } + // 2. If node is a host-including inclusive ancestor of parent, + // throw a HierarchyRequestError. + if (node.isAncestor(parent)) utils.HierarchyRequestError(); + // 3. If child is not null and its parent is not parent, then + // throw a NotFoundError. (replaceChild omits the 'child is not null' + // and throws a TypeError here if child is null.) + if (child !== null || !isPreinsert) { + if (child.parentNode !== parent) utils.NotFoundError(); + } + // 4. If node is not a DocumentFragment, DocumentType, Element, + // Text, ProcessingInstruction, or Comment node, throw a + // HierarchyRequestError. + switch (node.nodeType) { + case DOCUMENT_FRAGMENT_NODE: + case DOCUMENT_TYPE_NODE: + case ELEMENT_NODE: + case TEXT_NODE: + case PROCESSING_INSTRUCTION_NODE: + case COMMENT_NODE: + break; + default: utils.HierarchyRequestError(); + } + // 5. If either node is a Text node and parent is a document, or + // node is a doctype and parent is not a document, throw a + // HierarchyRequestError. + // 6. If parent is a document, and any of the statements below, switched + // on node, are true, throw a HierarchyRequestError. + if (parent.nodeType === DOCUMENT_NODE) { + switch (node.nodeType) { + case TEXT_NODE: + utils.HierarchyRequestError(); + break; + case DOCUMENT_FRAGMENT_NODE: + // 6a1. If node has more than one element child or has a Text + // node child. + if (node._countChildrenOfType(TEXT_NODE) > 0) + utils.HierarchyRequestError(); + switch (node._countChildrenOfType(ELEMENT_NODE)) { + case 0: + break; + case 1: + // 6a2. Otherwise, if node has one element child and either + // parent has an element child, child is a doctype, or child + // is not null and a doctype is following child. [preinsert] + // 6a2. Otherwise, if node has one element child and either + // parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + default: // 6a1, continued. (more than one Element child) + utils.HierarchyRequestError(); + } + break; + case ELEMENT_NODE: + // 6b. parent has an element child, child is a doctype, or + // child is not null and a doctype is following child. [preinsert] + // 6b. parent has an element child that is not child or a + // doctype is following child. [replaceWith] + if (child !== null /* always true here for replaceWith */) { + if (isPreinsert && child.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + for (kid = child.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === DOCUMENT_TYPE_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(ELEMENT_NODE); + if (isPreinsert) { + // "parent has an element child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an element child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== ELEMENT_NODE)) + utils.HierarchyRequestError(); + } + break; + case DOCUMENT_TYPE_NODE: + // 6c. parent has a doctype child, child is non-null and an + // element is preceding child, or child is null and parent has + // an element child. [preinsert] + // 6c. parent has a doctype child that is not child, or an + // element is preceding child. [replaceWith] + if (child === null) { + if (parent._countChildrenOfType(ELEMENT_NODE)) + utils.HierarchyRequestError(); + } else { + // child is always non-null for [replaceWith] case + for (kid = parent.firstChild; kid !== null; kid = kid.nextSibling) { + if (kid === child) break; + if (kid.nodeType === ELEMENT_NODE) + utils.HierarchyRequestError(); + } + } + i = parent._countChildrenOfType(DOCUMENT_TYPE_NODE); + if (isPreinsert) { + // "parent has an doctype child" + if (i > 0) + utils.HierarchyRequestError(); + } else { + // "parent has an doctype child that is not child" + if (i > 1 || (i === 1 && child.nodeType !== DOCUMENT_TYPE_NODE)) + utils.HierarchyRequestError(); + } + break; + } + } else { + // 5, continued: (parent is not a document) + if (node.nodeType === DOCUMENT_TYPE_NODE) utils.HierarchyRequestError(); + } + }}, + + insertBefore: { value: function insertBefore(node, child) { + var parent = this; + // 1. Ensure pre-insertion validity + parent._ensureInsertValid(node, child, true); + // 2. Let reference child be child. + var refChild = child; + // 3. If reference child is node, set it to node's next sibling + if (refChild === node) { refChild = node.nextSibling; } + // 4. Adopt node into parent's node document. + parent.doc.adoptNode(node); + // 5. Insert node into parent before reference child. + node._insertOrReplace(parent, refChild, false); + // 6. Return node + return node; + }}, + + + appendChild: { value: function(child) { + // This invokes _appendChild after doing validity checks. + return this.insertBefore(child, null); + }}, + + _appendChild: { value: function(child) { + child._insertOrReplace(this, null, false); + }}, + + removeChild: { value: function removeChild(child) { + var parent = this; + if (!child.nodeType) throw new TypeError('not a node'); + if (child.parentNode !== parent) utils.NotFoundError(); + child.remove(); + return child; + }}, + + // To replace a `child` with `node` within a `parent` (this) + replaceChild: { value: function replaceChild(node, child) { + var parent = this; + // Ensure validity (slight differences from pre-insertion check) + parent._ensureInsertValid(node, child, false); + // Adopt node into parent's node document. + if (node.doc !== parent.doc) { + // XXX adoptNode has side-effect of removing node from its parent + // and generating a mutation event, thus causing the _insertOrReplace + // to generate two deletes and an insert instead of a 'move' + // event. It looks like the new MutationObserver stuff avoids + // this problem, but for now let's only adopt (ie, remove `node` + // from its parent) here if we need to. + parent.doc.adoptNode(node); + } + // Do the replace. + node._insertOrReplace(parent, child, true); + return child; + }}, + + // See: http://ejohn.org/blog/comparing-document-position/ + contains: { value: function contains(node) { + if (node === null) { return false; } + if (this === node) { return true; /* inclusive descendant */ } + /* jshint bitwise: false */ + return (this.compareDocumentPosition(node) & + DOCUMENT_POSITION_CONTAINED_BY) !== 0; + }}, + + compareDocumentPosition: { value: function compareDocumentPosition(that){ + // Basic algorithm for finding the relative position of two nodes. + // Make a list the ancestors of each node, starting with the + // document element and proceeding down to the nodes themselves. + // Then, loop through the lists, looking for the first element + // that differs. The order of those two elements give the + // order of their descendant nodes. Or, if one list is a prefix + // of the other one, then that node contains the other. + + if (this === that) return 0; + + // If they're not owned by the same document or if one is rooted + // and one is not, then they're disconnected. + if (this.doc !== that.doc || + this.rooted !== that.rooted) + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + // Get arrays of ancestors for this and that + var these = [], those = []; + for(var n = this; n !== null; n = n.parentNode) these.push(n); + for(n = that; n !== null; n = n.parentNode) those.push(n); + these.reverse(); // So we start with the outermost + those.reverse(); + + if (these[0] !== those[0]) // No common ancestor + return (DOCUMENT_POSITION_DISCONNECTED + + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC); + + n = Math.min(these.length, those.length); + for(var i = 1; i < n; i++) { + if (these[i] !== those[i]) { + // We found two different ancestors, so compare + // their positions + if (these[i].index < those[i].index) + return DOCUMENT_POSITION_FOLLOWING; + else + return DOCUMENT_POSITION_PRECEDING; + } + } + + // If we get to here, then one of the nodes (the one with the + // shorter list of ancestors) contains the other one. + if (these.length < those.length) + return (DOCUMENT_POSITION_FOLLOWING + + DOCUMENT_POSITION_CONTAINED_BY); + else + return (DOCUMENT_POSITION_PRECEDING + + DOCUMENT_POSITION_CONTAINS); + }}, + + isSameNode: {value : function isSameNode(node) { + return this === node; + }}, + + + // This method implements the generic parts of node equality testing + // and defers to the (non-recursive) type-specific isEqual() method + // defined by subclasses + isEqualNode: { value: function isEqualNode(node) { + if (!node) return false; + if (node.nodeType !== this.nodeType) return false; + + // Check type-specific properties for equality + if (!this.isEqual(node)) return false; + + // Now check children for number and equality + for (var c1 = this.firstChild, c2 = node.firstChild; + c1 && c2; + c1 = c1.nextSibling, c2 = c2.nextSibling) { + if (!c1.isEqualNode(c2)) return false; + } + return c1 === null && c2 === null; + }}, + + // This method delegates shallow cloning to a clone() method + // that each concrete subclass must implement + cloneNode: { value: function(deep) { + // Clone this node + var clone = this.clone(); + + // Handle the recursive case if necessary + if (deep) { + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + clone._appendChild(kid.cloneNode(true)); + } + } + + return clone; + }}, + + lookupPrefix: { value: function lookupPrefix(ns) { + var e; + if (ns === '' || ns === null || ns === undefined) return null; + switch(this.nodeType) { + case ELEMENT_NODE: + return this._lookupNamespacePrefix(ns, this); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.lookupPrefix(ns) : null; + case ENTITY_NODE: + case NOTATION_NODE: + case DOCUMENT_FRAGMENT_NODE: + case DOCUMENT_TYPE_NODE: + return null; + case ATTRIBUTE_NODE: + e = this.ownerElement; + return e ? e.lookupPrefix(ns) : null; + default: + e = this.parentElement; + return e ? e.lookupPrefix(ns) : null; + } + }}, + + + lookupNamespaceURI: {value: function lookupNamespaceURI(prefix) { + if (prefix === '' || prefix === undefined) { prefix = null; } + var e; + switch(this.nodeType) { + case ELEMENT_NODE: + return utils.shouldOverride(); + case DOCUMENT_NODE: + e = this.documentElement; + return e ? e.lookupNamespaceURI(prefix) : null; + case ENTITY_NODE: + case NOTATION_NODE: + case DOCUMENT_TYPE_NODE: + case DOCUMENT_FRAGMENT_NODE: + return null; + case ATTRIBUTE_NODE: + e = this.ownerElement; + return e ? e.lookupNamespaceURI(prefix) : null; + default: + e = this.parentElement; + return e ? e.lookupNamespaceURI(prefix) : null; + } + }}, + + isDefaultNamespace: { value: function isDefaultNamespace(ns) { + if (ns === '' || ns === undefined) { ns = null; } + var defaultNamespace = this.lookupNamespaceURI(null); + return (defaultNamespace === ns); + }}, + + // Utility methods for nodes. Not part of the DOM + + // Return the index of this node in its parent. + // Throw if no parent, or if this node is not a child of its parent + index: { get: function() { + var parent = this.parentNode; + if (this === parent.firstChild) return 0; // fast case + var kids = parent.childNodes; + if (this._index === undefined || kids[this._index] !== this) { + // Ensure that we don't have an O(N^2) blowup if none of the + // kids have defined indices yet and we're traversing via + // nextSibling or previousSibling + for (var i=0; i 2 ? spliceArgs[2] : null); + } else if (len > 2 && n !== null) { + LinkedList.insertBefore(spliceArgs[2], n); + } + if (parent._childNodes) { + spliceArgs[0] = (before === null) ? + parent._childNodes.length : before._index; + parent._childNodes.splice.apply(parent._childNodes, spliceArgs); + for (i=2; i 2) { + parent._firstChild = spliceArgs[2]; + } else if (isReplace) { + parent._firstChild = null; + } + } + // Remove all nodes from the document fragment + if (child._childNodes) { + child._childNodes.length = 0; + } else { + child._firstChild = null; + } + // Call the mutation handlers + // Use spliceArgs since the original array has been destroyed. The + // liveness guarantee requires us to clone the array so that + // references to the childNodes of the DocumentFragment will be empty + // when the insertion handlers are called. + if (parent.rooted) { + parent.modify(); + for (i = 2; i < len; i++) { + parent.doc.mutateInsert(spliceArgs[i]); + } + } + } else { + if (before === child) { return; } + if (bothRooted) { + // Remove the child from its current position in the tree + // without calling remove(), since we don't want to uproot it. + child._remove(); + } else if (child.parentNode) { + child.remove(); + } + + // Insert it as a child of its new parent + child.parentNode = parent; + if (isReplace) { + LinkedList.replace(n, child); + if (parent._childNodes) { + child._index = before_index; + parent._childNodes[before_index] = child; + } else if (parent._firstChild === before) { + parent._firstChild = child; + } + } else { + if (n !== null) { + LinkedList.insertBefore(child, n); + } + if (parent._childNodes) { + child._index = before_index; + parent._childNodes.splice(before_index, 0, child); + } else if (parent._firstChild === before) { + parent._firstChild = child; + } + } + if (bothRooted) { + parent.modify(); + // Generate a move mutation event + parent.doc.mutateMove(child); + } else if (parent.rooted) { + parent.modify(); + parent.doc.mutateInsert(child); + } + } + }}, + + + // Return the lastModTime value for this node. (For use as a + // cache invalidation mechanism. If the node does not already + // have one, initialize it from the owner document's modclock + // property. (Note that modclock does not return the actual + // time; it is simply a counter incremented on each document + // modification) + lastModTime: { get: function() { + if (!this._lastModTime) { + this._lastModTime = this.doc.modclock; + } + return this._lastModTime; + }}, + + // Increment the owner document's modclock and use the new + // value to update the lastModTime value for this node and + // all of its ancestors. Nodes that have never had their + // lastModTime value queried do not need to have a + // lastModTime property set on them since there is no + // previously queried value to ever compare the new value + // against, so only update nodes that already have a + // _lastModTime property. + modify: { value: function() { + if (this.doc.modclock) { // Skip while doc.modclock == 0 + var time = ++this.doc.modclock; + for(var n = this; n; n = n.parentElement) { + if (n._lastModTime) { + n._lastModTime = time; + } + } + } + }}, + + // This attribute is not part of the DOM but is quite helpful. + // It returns the document with which a node is associated. Usually + // this is the ownerDocument. But ownerDocument is null for the + // document object itself, so this is a handy way to get the document + // regardless of the node type + doc: { get: function() { + return this.ownerDocument || this; + }}, + + + // If the node has a nid (node id), then it is rooted in a document + rooted: { get: function() { + return !!this._nid; + }}, + + normalize: { value: function() { + var next; + for (var child=this.firstChild; child !== null; child=next) { + next = child.nextSibling; + + if (child.normalize) { + child.normalize(); + } + + if (child.nodeType !== Node.TEXT_NODE) { + continue; + } + + if (child.nodeValue === "") { + this.removeChild(child); + continue; + } + + var prevChild = child.previousSibling; + if (prevChild === null) { + continue; + } else if (prevChild.nodeType === Node.TEXT_NODE) { + // merge this with previous and remove the child + prevChild.appendData(child.nodeValue); + this.removeChild(child); + } + } + }}, + + // Convert the children of a node to an HTML string. + // This is used by the innerHTML getter + // The serialization spec is at: + // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-end.html#serializing-html-fragments + // + // The serialization logic is intentionally implemented in a separate + // `NodeUtils` helper instead of the more obvious choice of a private + // `_serializeOne()` method on the `Node.prototype` in order to avoid + // the megamorphic `this._serializeOne` property access, which reduces + // performance unnecessarily. If you need specialized behavior for a + // certain subclass, you'll need to implement that in `NodeUtils`. + // See https://github.com/fgnass/domino/pull/142 for more information. + serialize: { value: function() { + if (this._innerHTML) { + return this._innerHTML; + } + var s = ''; + for (var kid = this.firstChild; kid !== null; kid = kid.nextSibling) { + s += NodeUtils.serializeOne(kid, this); + } + return s; + }}, + + // Non-standard, but often useful for debugging. + outerHTML: { + get: function() { + return NodeUtils.serializeOne(this, { nodeType: 0 }); + }, + set: utils.nyi, + }, + + // mirror node type properties in the prototype, so they are present + // in instances of Node (and subclasses) + ELEMENT_NODE: { value: ELEMENT_NODE }, + ATTRIBUTE_NODE: { value: ATTRIBUTE_NODE }, + TEXT_NODE: { value: TEXT_NODE }, + CDATA_SECTION_NODE: { value: CDATA_SECTION_NODE }, + ENTITY_REFERENCE_NODE: { value: ENTITY_REFERENCE_NODE }, + ENTITY_NODE: { value: ENTITY_NODE }, + PROCESSING_INSTRUCTION_NODE: { value: PROCESSING_INSTRUCTION_NODE }, + COMMENT_NODE: { value: COMMENT_NODE }, + DOCUMENT_NODE: { value: DOCUMENT_NODE }, + DOCUMENT_TYPE_NODE: { value: DOCUMENT_TYPE_NODE }, + DOCUMENT_FRAGMENT_NODE: { value: DOCUMENT_FRAGMENT_NODE }, + NOTATION_NODE: { value: NOTATION_NODE }, + + DOCUMENT_POSITION_DISCONNECTED: { value: DOCUMENT_POSITION_DISCONNECTED }, + DOCUMENT_POSITION_PRECEDING: { value: DOCUMENT_POSITION_PRECEDING }, + DOCUMENT_POSITION_FOLLOWING: { value: DOCUMENT_POSITION_FOLLOWING }, + DOCUMENT_POSITION_CONTAINS: { value: DOCUMENT_POSITION_CONTAINS }, + DOCUMENT_POSITION_CONTAINED_BY: { value: DOCUMENT_POSITION_CONTAINED_BY }, + DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC: { value: DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC }, +}); + + +/***/ }), + +/***/ 46870: +/***/ ((module) => { + +"use strict"; + +var NodeFilter = { + // Constants for acceptNode() + FILTER_ACCEPT: 1, + FILTER_REJECT: 2, + FILTER_SKIP: 3, + + // Constants for whatToShow + SHOW_ALL: 0xFFFFFFFF, + SHOW_ELEMENT: 0x1, + SHOW_ATTRIBUTE: 0x2, // historical + SHOW_TEXT: 0x4, + SHOW_CDATA_SECTION: 0x8, // historical + SHOW_ENTITY_REFERENCE: 0x10, // historical + SHOW_ENTITY: 0x20, // historical + SHOW_PROCESSING_INSTRUCTION: 0x40, + SHOW_COMMENT: 0x80, + SHOW_DOCUMENT: 0x100, + SHOW_DOCUMENT_TYPE: 0x200, + SHOW_DOCUMENT_FRAGMENT: 0x400, + SHOW_NOTATION: 0x800 // historical +}; + +module.exports = (NodeFilter.constructor = NodeFilter.prototype = NodeFilter); + + +/***/ }), + +/***/ 39722: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = NodeIterator; + +var NodeFilter = __webpack_require__(46870); +var NodeTraversal = __webpack_require__(11256); +var utils = __webpack_require__(91995); + +/* Private methods and helpers */ + +/** + * @based on WebKit's NodeIterator::moveToNext and NodeIterator::moveToPrevious + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeIterator.cpp?rev=186279#L51 + */ +function move(node, stayWithin, directionIsNext) { + if (directionIsNext) { + return NodeTraversal.next(node, stayWithin); + } else { + if (node === stayWithin) { + return null; + } + return NodeTraversal.previous(node, null); + } +} + +function isInclusiveAncestor(node, possibleChild) { + for ( ; possibleChild; possibleChild = possibleChild.parentNode) { + if (node === possibleChild) { return true; } + } + return false; +} + +/** + * @spec http://www.w3.org/TR/dom/#concept-nodeiterator-traverse + * @method + * @access private + * @param {NodeIterator} ni + * @param {string} direction One of 'next' or 'previous'. + * @return {Node|null} + */ +function traverse(ni, directionIsNext) { + var node, beforeNode; + node = ni._referenceNode; + beforeNode = ni._pointerBeforeReferenceNode; + while (true) { + if (beforeNode === directionIsNext) { + beforeNode = !beforeNode; + } else { + node = move(node, ni._root, directionIsNext); + if (node === null) { + return null; + } + } + var result = ni._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + break; + } + } + ni._referenceNode = node; + ni._pointerBeforeReferenceNode = beforeNode; + return node; +} + +/* Public API */ + +/** + * Implemented version: http://www.w3.org/TR/2015/WD-dom-20150618/#nodeiterator + * Latest version: http://www.w3.org/TR/dom/#nodeiterator + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function NodeIterator(root, whatToShow, filter) { + if (!root || !root.nodeType) { + utils.NotSupportedError(); + } + + // Read-only properties + this._root = root; + this._referenceNode = root; + this._pointerBeforeReferenceNode = true; + this._whatToShow = Number(whatToShow) || 0; + this._filter = filter || null; + this._active = false; + // Record active node iterators in the document, in order to perform + // "node iterator pre-removal steps". + root.doc._attachNodeIterator(this); +} + +Object.defineProperties(NodeIterator.prototype, { + root: { get: function root() { + return this._root; + } }, + referenceNode: { get: function referenceNode() { + return this._referenceNode; + } }, + pointerBeforeReferenceNode: { get: function pointerBeforeReferenceNode() { + return this._pointerBeforeReferenceNode; + } }, + whatToShow: { get: function whatToShow() { + return this._whatToShow; + } }, + filter: { get: function filter() { + return this._filter; + } }, + + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + _internalFilter: { value: function _internalFilter(node) { + /* jshint bitwise: false */ + var result, filter; + if (this._active) { + utils.InvalidStateError(); + } + + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) { + return NodeFilter.FILTER_SKIP; + } + + filter = this._filter; + if (filter === null) { + result = NodeFilter.FILTER_ACCEPT; + } else { + this._active = true; + try { + if (typeof filter === 'function') { + result = filter(node); + } else { + result = filter.acceptNode(node); + } + } finally { + this._active = false; + } + } + + // Note that coercing to a number means that + // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT) + // `false` becomes `0` (neither accept, reject, or skip) + return (+result); + } }, + + /** + * @spec https://dom.spec.whatwg.org/#nodeiterator-pre-removing-steps + * @method + * @return void + */ + _preremove: { value: function _preremove(toBeRemovedNode) { + if (isInclusiveAncestor(toBeRemovedNode, this._root)) { return; } + if (!isInclusiveAncestor(toBeRemovedNode, this._referenceNode)) { return; } + if (this._pointerBeforeReferenceNode) { + var next = toBeRemovedNode; + while (next.lastChild) { + next = next.lastChild; + } + next = NodeTraversal.next(next, this.root); + if (next) { + this._referenceNode = next; + return; + } + this._pointerBeforeReferenceNode = false; + // fall through + } + if (toBeRemovedNode.previousSibling === null) { + this._referenceNode = toBeRemovedNode.parentNode; + } else { + this._referenceNode = toBeRemovedNode.previousSibling; + var lastChild; + for (lastChild = this._referenceNode.lastChild; + lastChild; + lastChild = this._referenceNode.lastChild) { + this._referenceNode = lastChild; + } + } + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-nextnode + * @method + * @return {Node|null} + */ + nextNode: { value: function nextNode() { + return traverse(this, true); + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-previousnode + * @method + * @return {Node|null} + */ + previousNode: { value: function previousNode() { + return traverse(this, false); + } }, + + /** + * @spec http://www.w3.org/TR/dom/#dom-nodeiterator-detach + * @method + * @return void + */ + detach: { value: function detach() { + /* "The detach() method must do nothing. + * Its functionality (disabling a NodeIterator object) was removed, + * but the method itself is preserved for compatibility. + */ + } }, + + /** For compatibility with web-platform-tests. */ + toString: { value: function toString() { + return "[object NodeIterator]"; + } }, +}); + + +/***/ }), + +/***/ 20513: +/***/ ((module) => { + +"use strict"; + + +// No support for subclassing array, return an actual Array object. +function item(i) { + /* jshint validthis: true */ + return this[i] || null; +} + +function NodeList(a) { + if (!a) a = []; + a.item = item; + return a; +} + +module.exports = NodeList; + + +/***/ }), + +/***/ 67592: +/***/ ((module) => { + +"use strict"; +/* jshint esversion: 6 */ + + +module.exports = class NodeList extends Array { + constructor(a) { + super((a && a.length) || 0); + if (a) { + for (var idx in a) { this[idx] = a[idx]; } + } + } + item(i) { return this[i] || null; } +}; + + +/***/ }), + +/***/ 45192: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var NodeList; + +try { + // Attempt to use ES6-style Array subclass if possible. + NodeList = __webpack_require__(67592); +} catch (e) { + // No support for subclassing array, return an actual Array object. + NodeList = __webpack_require__(20513); +} + +module.exports = NodeList; + + +/***/ }), + +/***/ 11256: +/***/ ((module) => { + +"use strict"; + +/* exported NodeTraversal */ +var NodeTraversal = module.exports = { + nextSkippingChildren: nextSkippingChildren, + nextAncestorSibling: nextAncestorSibling, + next: next, + previous: previous, + deepLastChild: deepLastChild +}; + +/** + * @based on WebKit's NodeTraversal::nextSkippingChildren + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L109 + */ +function nextSkippingChildren(node, stayWithin) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + return nextAncestorSibling(node, stayWithin); +} + +/** + * @based on WebKit's NodeTraversal::nextAncestorSibling + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L93 + */ +function nextAncestorSibling(node, stayWithin) { + for (node = node.parentNode; node !== null; node = node.parentNode) { + if (node === stayWithin) { + return null; + } + if (node.nextSibling !== null) { + return node.nextSibling; + } + } + return null; +} + +/** + * @based on WebKit's NodeTraversal::next + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L99 + */ +function next(node, stayWithin) { + var n; + n = node.firstChild; + if (n !== null) { + return n; + } + if (node === stayWithin) { + return null; + } + n = node.nextSibling; + if (n !== null) { + return n; + } + return nextAncestorSibling(node, stayWithin); +} + +/** + * @based on WebKit's NodeTraversal::deepLastChild + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.cpp?rev=179143#L116 + */ +function deepLastChild(node) { + while (node.lastChild) { + node = node.lastChild; + } + return node; +} + +/** + * @based on WebKit's NodeTraversal::previous + * https://trac.webkit.org/browser/trunk/Source/WebCore/dom/NodeTraversal.h?rev=179143#L121 + */ +function previous(node, stayWithin) { + var p; + p = node.previousSibling; + if (p !== null) { + return deepLastChild(p); + } + p = node.parentNode; + if (p === stayWithin) { + return null; + } + return p; +} + + +/***/ }), + +/***/ 80859: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = { + // NOTE: The `serializeOne()` function used to live on the `Node.prototype` + // as a private method `Node#_serializeOne(child)`, however that requires + // a megamorphic property access `this._serializeOne` just to get to the + // method, and this is being done on lots of different `Node` subclasses, + // which puts a lot of pressure on V8's megamorphic stub cache. So by + // moving the helper off of the `Node.prototype` and into a separate + // function in this helper module, we get a monomorphic property access + // `NodeUtils.serializeOne` to get to the function and reduce pressure + // on the megamorphic stub cache. + // See https://github.com/fgnass/domino/pull/142 for more information. + serializeOne: serializeOne, + + // Export util functions so that we can run extra test for them. + // Note: we prefix function names with `ɵ`, similar to what we do + // with internal functions in Angular packages. + ɵescapeMatchingClosingTag: escapeMatchingClosingTag, + ɵescapeClosingCommentTag: escapeClosingCommentTag, + ɵescapeProcessingInstructionContent: escapeProcessingInstructionContent +}; + +var utils = __webpack_require__(91995); +var NAMESPACE = utils.NAMESPACE; + +var hasRawContent = { + STYLE: true, + SCRIPT: true, + XMP: true, + IFRAME: true, + NOEMBED: true, + NOFRAMES: true, + PLAINTEXT: true +}; + +var emptyElements = { + area: true, + base: true, + basefont: true, + bgsound: true, + br: true, + col: true, + embed: true, + frame: true, + hr: true, + img: true, + input: true, + keygen: true, + link: true, + meta: true, + param: true, + source: true, + track: true, + wbr: true +}; + +var extraNewLine = { + /* Removed in https://github.com/whatwg/html/issues/944 + pre: true, + textarea: true, + listing: true + */ +}; + +const ESCAPE_REGEXP = /[&<>\u00A0]/g; +const ESCAPE_ATTR_REGEXP = /[&"<>\u00A0]/g; + +function escape(s) { + if (!ESCAPE_REGEXP.test(s)) { + // nothing to do, fast path + return s; + } + + return s.replace(ESCAPE_REGEXP, (c) => { + switch (c) { + case "&": + return "&"; + case "<": + return "<"; + case ">": + return ">"; + case "\u00A0": + return " "; + } + }); +} + +function escapeAttr(s) { + if (!ESCAPE_ATTR_REGEXP.test(s)) { + // nothing to do, fast path + return s; + } + + return s.replace(ESCAPE_ATTR_REGEXP, (c) => { + switch (c) { + case "<": + return "<"; + case ">": + return ">"; + case "&": + return "&"; + case '"': + return """; + case "\u00A0": + return " "; + } + }); +} + +function attrname(a) { + var ns = a.namespaceURI; + if (!ns) + return a.localName; + if (ns === NAMESPACE.XML) + return 'xml:' + a.localName; + if (ns === NAMESPACE.XLINK) + return 'xlink:' + a.localName; + + if (ns === NAMESPACE.XMLNS) { + if (a.localName === 'xmlns') return 'xmlns'; + else return 'xmlns:' + a.localName; + } + return a.name; +} + +/** + * Escapes matching closing tag in a raw text. + * + * For example, given `)`, + * the parent tag would by "style" and the raw text is + * "". If we come across a matching closing tag + * (in out case ``) - replace `<` with `<` to avoid unexpected + * and unsafe behavior after de-serialization. + */ +function escapeMatchingClosingTag(rawText, parentTag) { + const parentClosingTag = '/; + +/** + * Escapes closing comment tag in a comment content. + * + * For example, given `#comment('-->')`, the content of a comment would be + * updated to `-->` to avoid unexpected and unsafe behavior after + * de-serialization. + */ +function escapeClosingCommentTag(rawContent) { + if (!CLOSING_COMMENT_REGEXP.test(rawContent)) { + return rawContent; // fast path + } + return rawContent.replace(/(--\!?)>/g, '$1>'); +} + +/** + * Escapes processing instruction content by replacing `>` with `>`. + */ +function escapeProcessingInstructionContent(rawContent) { + return rawContent.includes('>') + ? rawContent.replaceAll('>', '>') + : rawContent; +} + +function serializeOne(kid, parent) { + var s = ''; + switch(kid.nodeType) { + case 1: //ELEMENT_NODE + var ns = kid.namespaceURI; + var html = ns === NAMESPACE.HTML; + var tagname = (html || ns === NAMESPACE.SVG || ns === NAMESPACE.MATHML) ? kid.localName : kid.tagName; + + s += '<' + tagname; + + for(var j = 0, k = kid._numattrs; j < k; j++) { + var a = kid._attr(j); + s += ' ' + attrname(a); + if (a.value !== undefined) s += '="' + escapeAttr(a.value) + '"'; + } + s += '>'; + + if (!(html && emptyElements[tagname])) { + var ss = kid.serialize(); + // If an element can have raw content, this content may + // potentially require escaping to avoid XSS. + if (hasRawContent[tagname.toUpperCase()]) { + ss = escapeMatchingClosingTag(ss, tagname); + } + if (html && extraNewLine[tagname] && ss.charAt(0)==='\n') s += '\n'; + // Serialize children and add end tag for all others + s += ss; + s += ''; + } + break; + case 3: //TEXT_NODE + case 4: //CDATA_SECTION_NODE + var parenttag; + if (parent.nodeType === 1 /*ELEMENT_NODE*/ && + parent.namespaceURI === NAMESPACE.HTML) + parenttag = parent.tagName; + else + parenttag = ''; + + if (hasRawContent[parenttag] || + (parenttag==='NOSCRIPT' && parent.ownerDocument._scripting_enabled)) { + s += kid.data; + } else { + s += escape(kid.data); + } + break; + case 8: //COMMENT_NODE + s += ''; + break; + case 7: //PROCESSING_INSTRUCTION_NODE + const content = escapeProcessingInstructionContent(kid.data); + s += ''; + break; + case 10: //DOCUMENT_TYPE_NODE + s += ''; + break; + default: + utils.InvalidStateError(); + } + return s; +} + + +/***/ }), + +/***/ 39804: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Node = __webpack_require__(20576); + +var NonDocumentTypeChildNode = { + + nextElementSibling: { get: function() { + if (this.parentNode) { + for (var kid = this.nextSibling; kid !== null; kid = kid.nextSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + } + return null; + }}, + + previousElementSibling: { get: function() { + if (this.parentNode) { + for (var kid = this.previousSibling; kid !== null; kid = kid.previousSibling) { + if (kid.nodeType === Node.ELEMENT_NODE) return kid; + } + } + return null; + }} + +}; + +module.exports = NonDocumentTypeChildNode; + + +/***/ }), + +/***/ 68159: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = ProcessingInstruction; + +var Node = __webpack_require__(20576); +var CharacterData = __webpack_require__(28277); + +function ProcessingInstruction(doc, target, data) { + CharacterData.call(this); + this.nodeType = Node.PROCESSING_INSTRUCTION_NODE; + this.ownerDocument = doc; + this.target = target; + this._data = data; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + this._data = v; + if (this.rooted) this.ownerDocument.mutateValue(this); + } +}; + +ProcessingInstruction.prototype = Object.create(CharacterData.prototype, { + nodeName: { get: function() { return this.target; }}, + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + // Utility methods + clone: { value: function clone() { + return new ProcessingInstruction(this.ownerDocument, this.target, this._data); + }}, + isEqual: { value: function isEqual(n) { + return this.target === n.target && this._data === n._data; + }} + +}); + + +/***/ }), + +/***/ 57995: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = Text; + +var utils = __webpack_require__(91995); +var Node = __webpack_require__(20576); +var CharacterData = __webpack_require__(28277); + +function Text(doc, data) { + CharacterData.call(this); + this.nodeType = Node.TEXT_NODE; + this.ownerDocument = doc; + this._data = data; + this._index = undefined; +} + +var nodeValue = { + get: function() { return this._data; }, + set: function(v) { + if (v === null || v === undefined) { v = ''; } else { v = String(v); } + if (v === this._data) return; + this._data = v; + if (this.rooted) + this.ownerDocument.mutateValue(this); + if (this.parentNode && + this.parentNode._textchangehook) + this.parentNode._textchangehook(this); + } +}; + +Text.prototype = Object.create(CharacterData.prototype, { + nodeName: { value: "#text" }, + // These three attributes are all the same. + // The data attribute has a [TreatNullAs=EmptyString] but we'll + // implement that at the interface level + nodeValue: nodeValue, + textContent: nodeValue, + innerText: nodeValue, + data: { + get: nodeValue.get, + set: function(v) { + nodeValue.set.call(this, v===null ? '' : String(v)); + }, + }, + + splitText: { value: function splitText(offset) { + if (offset > this._data.length || offset < 0) utils.IndexSizeError(); + + var newdata = this._data.substring(offset), + newnode = this.ownerDocument.createTextNode(newdata); + this.data = this.data.substring(0, offset); + + var parent = this.parentNode; + if (parent !== null) + parent.insertBefore(newnode, this.nextSibling); + + return newnode; + }}, + + wholeText: { get: function wholeText() { + var result = this.textContent; + for (var next = this.nextSibling; next; next = next.nextSibling) { + if (next.nodeType !== Node.TEXT_NODE) { break; } + result += next.textContent; + } + return result; + }}, + // Obsolete, removed from spec. + replaceWholeText: { value: utils.nyi }, + + // Utility methods + clone: { value: function clone() { + return new Text(this.ownerDocument, this._data); + }}, + +}); + + +/***/ }), + +/***/ 25718: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = TreeWalker; + +var Node = __webpack_require__(20576); +var NodeFilter = __webpack_require__(46870); +var NodeTraversal = __webpack_require__(11256); +var utils = __webpack_require__(91995); + +var mapChild = { + first: 'firstChild', + last: 'lastChild', + next: 'firstChild', + previous: 'lastChild' +}; + +var mapSibling = { + first: 'nextSibling', + last: 'previousSibling', + next: 'nextSibling', + previous: 'previousSibling' +}; + +/* Private methods and helpers */ + +/** + * @spec https://dom.spec.whatwg.org/#concept-traverse-children + * @method + * @access private + * @param {TreeWalker} tw + * @param {string} type One of 'first' or 'last'. + * @return {Node|null} + */ +function traverseChildren(tw, type) { + var child, node, parent, result, sibling; + node = tw._currentNode[mapChild[type]]; + while (node !== null) { + result = tw._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw._currentNode = node; + return node; + } + if (result === NodeFilter.FILTER_SKIP) { + child = node[mapChild[type]]; + if (child !== null) { + node = child; + continue; + } + } + while (node !== null) { + sibling = node[mapSibling[type]]; + if (sibling !== null) { + node = sibling; + break; + } + parent = node.parentNode; + if (parent === null || parent === tw.root || parent === tw._currentNode) { + return null; + } else { + node = parent; + } + } + } + return null; +} + +/** + * @spec https://dom.spec.whatwg.org/#concept-traverse-siblings + * @method + * @access private + * @param {TreeWalker} tw + * @param {TreeWalker} type One of 'next' or 'previous'. + * @return {Node|nul} + */ +function traverseSiblings(tw, type) { + var node, result, sibling; + node = tw._currentNode; + if (node === tw.root) { + return null; + } + while (true) { + sibling = node[mapSibling[type]]; + while (sibling !== null) { + node = sibling; + result = tw._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + tw._currentNode = node; + return node; + } + sibling = node[mapChild[type]]; + if (result === NodeFilter.FILTER_REJECT || sibling === null) { + sibling = node[mapSibling[type]]; + } + } + node = node.parentNode; + if (node === null || node === tw.root) { + return null; + } + if (tw._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + return null; + } + } +} + + +/* Public API */ + +/** + * Latest version: https://dom.spec.whatwg.org/#treewalker + * + * @constructor + * @param {Node} root + * @param {number} whatToShow [optional] + * @param {Function|NodeFilter} filter [optional] + * @throws Error + */ +function TreeWalker(root, whatToShow, filter) { + if (!root || !root.nodeType) { + utils.NotSupportedError(); + } + + // Read-only properties + this._root = root; + this._whatToShow = Number(whatToShow) || 0; + this._filter = filter || null; + this._active = false; + // Read-write property + this._currentNode = root; +} + +Object.defineProperties(TreeWalker.prototype, { + root: { get: function() { return this._root; } }, + whatToShow: { get: function() { return this._whatToShow; } }, + filter: { get: function() { return this._filter; } }, + + currentNode: { + get: function currentNode() { + return this._currentNode; + }, + set: function setCurrentNode(v) { + if (!(v instanceof Node)) { + throw new TypeError("Not a Node"); // `null` is also not a node + } + this._currentNode = v; + }, + }, + + /** + * @method + * @param {Node} node + * @return {Number} Constant NodeFilter.FILTER_ACCEPT, + * NodeFilter.FILTER_REJECT or NodeFilter.FILTER_SKIP. + */ + _internalFilter: { value: function _internalFilter(node) { + /* jshint bitwise: false */ + var result, filter; + if (this._active) { + utils.InvalidStateError(); + } + + // Maps nodeType to whatToShow + if (!(((1 << (node.nodeType - 1)) & this._whatToShow))) { + return NodeFilter.FILTER_SKIP; + } + + filter = this._filter; + if (filter === null) { + result = NodeFilter.FILTER_ACCEPT; + } else { + this._active = true; + try { + if (typeof filter === 'function') { + result = filter(node); + } else { + result = filter.acceptNode(node); + } + } finally { + this._active = false; + } + } + + // Note that coercing to a number means that + // `true` becomes `1` (which is NodeFilter.FILTER_ACCEPT) + // `false` becomes `0` (neither accept, reject, or skip) + return (+result); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-parentnode + * @based on WebKit's TreeWalker::parentNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L50 + * @method + * @return {Node|null} + */ + parentNode: { value: function parentNode() { + var node = this._currentNode; + while (node !== this.root) { + node = node.parentNode; + if (node === null) { + return null; + } + if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + return null; + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-firstchild + * @method + * @return {Node|null} + */ + firstChild: { value: function firstChild() { + return traverseChildren(this, 'first'); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-lastchild + * @method + * @return {Node|null} + */ + lastChild: { value: function lastChild() { + return traverseChildren(this, 'last'); + }}, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-previoussibling + * @method + * @return {Node|null} + */ + previousSibling: { value: function previousSibling() { + return traverseSiblings(this, 'previous'); + }}, + + /** + * @spec http://www.w3.org/TR/dom/#dom-treewalker-nextsibling + * @method + * @return {Node|null} + */ + nextSibling: { value: function nextSibling() { + return traverseSiblings(this, 'next'); + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-previousnode + * @based on WebKit's TreeWalker::previousNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L181 + * @method + * @return {Node|null} + */ + previousNode: { value: function previousNode() { + var node, result, previousSibling, lastChild; + node = this._currentNode; + while (node !== this._root) { + for (previousSibling = node.previousSibling; + previousSibling; + previousSibling = node.previousSibling) { + node = previousSibling; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_REJECT) { + continue; + } + for (lastChild = node.lastChild; + lastChild; + lastChild = node.lastChild) { + node = lastChild; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_REJECT) { + break; + } + } + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + if (node === this.root || node.parentNode === null) { + return null; + } + node = node.parentNode; + if (this._internalFilter(node) === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } + } + return null; + }}, + + /** + * @spec https://dom.spec.whatwg.org/#dom-treewalker-nextnode + * @based on WebKit's TreeWalker::nextNode + * https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/dom/TreeWalker.cpp?rev=220453#L228 + * @method + * @return {Node|null} + */ + nextNode: { value: function nextNode() { + var node, result, firstChild, nextSibling; + node = this._currentNode; + result = NodeFilter.FILTER_ACCEPT; + + CHILDREN: + while (true) { + for (firstChild = node.firstChild; + firstChild; + firstChild = node.firstChild) { + node = firstChild; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } else if (result === NodeFilter.FILTER_REJECT) { + break; + } + } + for (nextSibling = NodeTraversal.nextSkippingChildren(node, this.root); + nextSibling; + nextSibling = NodeTraversal.nextSkippingChildren(node, this.root)) { + node = nextSibling; + result = this._internalFilter(node); + if (result === NodeFilter.FILTER_ACCEPT) { + this._currentNode = node; + return node; + } else if (result === NodeFilter.FILTER_SKIP) { + continue CHILDREN; + } + } + return null; + } + }}, + + /** For compatibility with web-platform-tests. */ + toString: { value: function toString() { + return "[object TreeWalker]"; + }}, +}); + + +/***/ }), + +/***/ 45280: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var Event = __webpack_require__(79778); + +module.exports = UIEvent; + +function UIEvent() { + // Just use the superclass constructor to initialize + Event.call(this); + this.view = null; // FF uses the current window + this.detail = 0; +} +UIEvent.prototype = Object.create(Event.prototype, { + constructor: { value: UIEvent }, + initUIEvent: { value: function(type, bubbles, cancelable, view, detail) { + this.initEvent(type, bubbles, cancelable); + this.view = view; + this.detail = detail; + }} +}); + + +/***/ }), + +/***/ 40747: +/***/ ((module) => { + +"use strict"; + +module.exports = URL; + +function URL(url) { + if (!url) return Object.create(URL.prototype); + // Can't use String.trim() since it defines whitespace differently than HTML + this.url = url.replace(/^[ \t\n\r\f]+|[ \t\n\r\f]+$/g, ""); + + // See http://tools.ietf.org/html/rfc3986#appendix-B + // and https://url.spec.whatwg.org/#parsing + var match = URL.pattern.exec(this.url); + if (match) { + if (match[2]) this.scheme = match[2]; + if (match[4]) { + // parse username/password + var userinfo = match[4].match(URL.userinfoPattern); + if (userinfo) { + this.username = userinfo[1]; + this.password = userinfo[3]; + match[4] = match[4].substring(userinfo[0].length); + } + if (match[4].match(URL.portPattern)) { + var pos = match[4].lastIndexOf(':'); + this.host = match[4].substring(0, pos); + this.port = match[4].substring(pos+1); + } + else { + this.host = match[4]; + } + } + if (match[5]) this.path = match[5]; + if (match[6]) this.query = match[7]; + if (match[8]) this.fragment = match[9]; + } +} + +URL.pattern = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?$/; +URL.userinfoPattern = /^([^@:]*)(:([^@]*))?@/; +URL.portPattern = /:\d+$/; +URL.authorityPattern = /^[^:\/?#]+:\/\//; +URL.hierarchyPattern = /^[^:\/?#]+:\//; + +// Return a percentEncoded version of s. +// S should be a single-character string +// XXX: needs to do utf-8 encoding? +URL.percentEncode = function percentEncode(s) { + var c = s.charCodeAt(0); + if (c < 256) return "%" + c.toString(16); + else throw Error("can't percent-encode codepoints > 255 yet"); +}; + +URL.prototype = { + constructor: URL, + + // XXX: not sure if this is the precise definition of absolute + isAbsolute: function() { return !!this.scheme; }, + isAuthorityBased: function() { + return URL.authorityPattern.test(this.url); + }, + isHierarchical: function() { + return URL.hierarchyPattern.test(this.url); + }, + + toString: function() { + var s = ""; + if (this.scheme !== undefined) s += this.scheme + ":"; + if (this.isAbsolute()) { + s += '//'; + if (this.username || this.password) { + s += this.username || ''; + if (this.password) { + s += ':' + this.password; + } + s += '@'; + } + if (this.host) { + s += this.host; + } + } + if (this.port !== undefined) s += ":" + this.port; + if (this.path !== undefined) s += this.path; + if (this.query !== undefined) s += "?" + this.query; + if (this.fragment !== undefined) s += "#" + this.fragment; + return s; + }, + + // See: http://tools.ietf.org/html/rfc3986#section-5.2 + // and https://url.spec.whatwg.org/#constructors + resolve: function(relative) { + var base = this; // The base url we're resolving against + var r = new URL(relative); // The relative reference url to resolve + var t = new URL(); // The absolute target url we will return + + if (r.scheme !== undefined) { + t.scheme = r.scheme; + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.scheme = base.scheme; + if (r.host !== undefined) { + t.username = r.username; + t.password = r.password; + t.host = r.host; + t.port = r.port; + t.path = remove_dot_segments(r.path); + t.query = r.query; + } + else { + t.username = base.username; + t.password = base.password; + t.host = base.host; + t.port = base.port; + if (!r.path) { // undefined or empty + t.path = base.path; + if (r.query !== undefined) + t.query = r.query; + else + t.query = base.query; + } + else { + if (r.path.charAt(0) === "/") { + t.path = remove_dot_segments(r.path); + } + else { + t.path = merge(base.path, r.path); + t.path = remove_dot_segments(t.path); + } + t.query = r.query; + } + } + } + t.fragment = r.fragment; + + return t.toString(); + + + function merge(basepath, refpath) { + if (base.host !== undefined && !base.path) + return "/" + refpath; + + var lastslash = basepath.lastIndexOf("/"); + if (lastslash === -1) + return refpath; + else + return basepath.substring(0, lastslash+1) + refpath; + } + + function remove_dot_segments(path) { + if (!path) return path; // For "" or undefined + + var output = ""; + while(path.length > 0) { + if (path === "." || path === "..") { + path = ""; + break; + } + + var twochars = path.substring(0,2); + var threechars = path.substring(0,3); + var fourchars = path.substring(0,4); + if (threechars === "../") { + path = path.substring(3); + } + else if (twochars === "./") { + path = path.substring(2); + } + else if (threechars === "/./") { + path = "/" + path.substring(3); + } + else if (twochars === "/." && path.length === 2) { + path = "/"; + } + else if (fourchars === "/../" || + (threechars === "/.." && path.length === 3)) { + path = "/" + path.substring(4); + + output = output.replace(/\/?[^\/]*$/, ""); + } + else { + var segment = path.match(/(\/?([^\/]*))/)[0]; + output += segment; + path = path.substring(segment.length); + } + } + + return output; + } + }, +}; + + +/***/ }), + +/***/ 22554: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var URL = __webpack_require__(40747); + +module.exports = URLUtils; + +// Allow the `x == null` pattern. This is eslint's "null: 'ignore'" option, +// but jshint doesn't support this. +/* jshint eqeqeq: false */ + +// This is an abstract superclass for Location, HTMLAnchorElement and +// other types that have the standard complement of "URL decomposition +// IDL attributes". This is now standardized as URLUtils, see: +// https://url.spec.whatwg.org/#urlutils +// Subclasses must define a getter/setter on href. +// The getter and setter methods parse and rebuild the URL on each +// invocation; there is no attempt to cache the value and be more efficient +function URLUtils() {} +URLUtils.prototype = Object.create(Object.prototype, { + + _url: { get: function() { + // XXX: this should do the "Reinitialize url" steps, and "null" should + // be a valid return value. + return new URL(this.href); + } }, + + protocol: { + get: function() { + var url = this._url; + if (url && url.scheme) return url.scheme + ":"; + else return ":"; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/:+$/, ""); + v = v.replace(/[^-+\.a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.scheme = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + host: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host + (url.port ? (":" + url.port) : ""); + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + delete url.port; + output = url.toString(); + } + } + this.href = output; + }, + }, + + hostname: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased()) + return url.host; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = v.replace(/^\/+/, ""); + v = v.replace(/[^-+\._~!$&'()*,;:=a-zA-Z0-9]/g, URL.percentEncode); + if (v.length > 0) { + url.host = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + port: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isAuthorityBased() && url.port!==undefined) + return url.port; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isAuthorityBased()) { + v = '' + v; + v = v.replace(/[^0-9].*$/, ""); + v = v.replace(/^0+/, ""); + if (v.length === 0) v = "0"; + if (parseInt(v, 10) <= 65535) { + url.port = v; + output = url.toString(); + } + } + this.href = output; + }, + }, + + pathname: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isHierarchical()) + return url.path; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) !== "/") + v = "/" + v; + v = v.replace(/[^-+\._~!$&'()*,;:=@\/a-zA-Z0-9]/g, URL.percentEncode); + url.path = v; + output = url.toString(); + } + this.href = output; + }, + }, + + search: { + get: function() { + var url = this._url; + if (url.isAbsolute() && url.isHierarchical() && url.query!==undefined) + return "?" + url.query; + else + return ""; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute() && url.isHierarchical()) { + if (v.charAt(0) === "?") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.query = v; + output = url.toString(); + } + this.href = output; + }, + }, + + hash: { + get: function() { + var url = this._url; + if (url == null || url.fragment == null || url.fragment === '') { + return ""; + } else { + return "#" + url.fragment; + } + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + + if (v.charAt(0) === "#") v = v.substring(1); + v = v.replace(/[^-+\._~!$&'()*,;:=@\/?a-zA-Z0-9]/g, URL.percentEncode); + url.fragment = v; + output = url.toString(); + + this.href = output; + }, + }, + + username: { + get: function() { + var url = this._url; + return url.username || ''; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\:]/g, URL.percentEncode); + url.username = v; + output = url.toString(); + } + this.href = output; + }, + }, + + password: { + get: function() { + var url = this._url; + return url.password || ''; + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + if (url.isAbsolute()) { + if (v==='') { + url.password = null; + } else { + v = v.replace(/[\x00-\x1F\x7F-\uFFFF "#<>?`\/@\\]/g, URL.percentEncode); + url.password = v; + } + output = url.toString(); + } + this.href = output; + }, + }, + + origin: { get: function() { + var url = this._url; + if (url == null) { return ''; } + var originForPort = function(defaultPort) { + var origin = [url.scheme, url.host, +url.port || defaultPort]; + // XXX should be "unicode serialization" + return origin[0] + '://' + origin[1] + + (origin[2] === defaultPort ? '' : (':' + origin[2])); + }; + switch (url.scheme) { + case 'ftp': + return originForPort(21); + case 'gopher': + return originForPort(70); + case 'http': + case 'ws': + return originForPort(80); + case 'https': + case 'wss': + return originForPort(443); + default: + // this is what chrome does + return url.scheme + '://'; + } + } }, + + /* + searchParams: { + get: function() { + var url = this._url; + // XXX + }, + set: function(v) { + var output = this.href; + var url = new URL(output); + // XXX + this.href = output; + }, + }, + */ +}); + +URLUtils._inherit = function(proto) { + // copy getters/setters from URLUtils to o. + Object.getOwnPropertyNames(URLUtils.prototype).forEach(function(p) { + if (p==='constructor' || p==='href') { return; } + var desc = Object.getOwnPropertyDescriptor(URLUtils.prototype, p); + Object.defineProperty(proto, p, desc); + }); +}; + + +/***/ }), + +/***/ 98352: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +var DOMImplementation = __webpack_require__(94008); +var EventTarget = __webpack_require__(91283); +var Location = __webpack_require__(73851); +var utils = __webpack_require__(91995); + +module.exports = Window; + +function Window(document) { + this.document = document || new DOMImplementation(null).createHTMLDocument(""); + this.document._scripting_enabled = true; + this.document.defaultView = this; + this.location = new Location(this, this.document._address || 'about:blank'); +} + +Window.prototype = Object.create(EventTarget.prototype, { + console: { value: console }, + history: { value: { + back: utils.nyi, + forward: utils.nyi, + go: utils.nyi + }}, + navigator: { value: __webpack_require__(69162) }, + + // Self-referential properties + window: { get: function() { return this; }}, + self: { get: function() { return this; }}, + frames: { get: function() { return this; }}, + + // Self-referential properties for a top-level window + parent: { get: function() { return this; }}, + top: { get: function() { return this; }}, + + // We don't support any other windows for now + length: { value: 0 }, // no frames + frameElement: { value: null }, // not part of a frame + opener: { value: null }, // not opened by another window + + // The onload event handler. + // XXX: need to support a bunch of other event types, too, + // and have them interoperate with document.body. + + onload: { + get: function() { + return this._getEventHandler("load"); + }, + set: function(v) { + this._setEventHandler("load", v); + } + }, + + // XXX This is a completely broken implementation + getComputedStyle: { value: function getComputedStyle(elt) { + return elt.style; + }} + +}); + +utils.expose(__webpack_require__(33690), Window); +utils.expose(__webpack_require__(57102), Window); + + +/***/ }), + +/***/ 33690: +/***/ ((module) => { + +"use strict"; + + +// https://html.spec.whatwg.org/multipage/webappapis.html#windowtimers +var WindowTimers = { + setTimeout: setTimeout, + clearTimeout: clearTimeout, + setInterval: setInterval, + clearInterval: clearInterval +}; + +module.exports = WindowTimers; + + +/***/ }), + +/***/ 57673: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(91995); + +exports.property = function(attr) { + if (Array.isArray(attr.type)) { + var valid = Object.create(null); + attr.type.forEach(function(val) { + valid[val.value || val] = val.alias || val; + }); + var missingValueDefault = attr.missing; + if (missingValueDefault===undefined) { missingValueDefault = null; } + var invalidValueDefault = attr.invalid; + if (invalidValueDefault===undefined) { invalidValueDefault = missingValueDefault; } + return { + get: function() { + var v = this._getattr(attr.name); + if (v === null) return missingValueDefault; + + v = valid[v.toLowerCase()]; + if (v !== undefined) return v; + if (invalidValueDefault !== null) return invalidValueDefault; + return v; + }, + set: function(v) { + this._setattr(attr.name, v); + } + }; + } + else if (attr.type === Boolean) { + return { + get: function() { + return this.hasAttribute(attr.name); + }, + set: function(v) { + if (v) { + this._setattr(attr.name, ''); + } + else { + this.removeAttribute(attr.name); + } + } + }; + } + else if (attr.type === Number || + attr.type === "long" || + attr.type === "unsigned long" || + attr.type === "limited unsigned long with fallback") { + return numberPropDesc(attr); + } + else if (!attr.type || attr.type === String) { + return { + get: function() { return this._getattr(attr.name) || ''; }, + set: function(v) { + if (attr.treatNullAsEmptyString && v === null) { v = ''; } + this._setattr(attr.name, v); + } + }; + } + else if (typeof attr.type === 'function') { + return attr.type(attr.name, attr); + } + throw new Error('Invalid attribute definition'); +}; + +// See http://www.whatwg.org/specs/web-apps/current-work/#reflect +// +// defval is the default value. If it is a function, then that function +// will be invoked as a method of the element to obtain the default. +// If no default is specified for a given attribute, then the default +// depends on the type of the attribute, but since this function handles +// 4 integer cases, you must specify the default value in each call +// +// min and max define a valid range for getting the attribute. +// +// setmin defines a minimum value when setting. If the value is less +// than that, then throw INDEX_SIZE_ERR. +// +// Conveniently, JavaScript's parseInt function appears to be +// compatible with HTML's 'rules for parsing integers' +function numberPropDesc(a) { + var def; + if(typeof a.default === 'function') { + def = a.default; + } + else if(typeof a.default === 'number') { + def = function() { return a.default; }; + } + else { + def = function() { utils.assert(false, typeof a.default); }; + } + var unsigned_long = (a.type === 'unsigned long'); + var signed_long = (a.type === 'long'); + var unsigned_fallback = (a.type === 'limited unsigned long with fallback'); + var min = a.min, max = a.max, setmin = a.setmin; + if (min === undefined) { + if (unsigned_long) min = 0; + if (signed_long) min = -0x80000000; + if (unsigned_fallback) min = 1; + } + if (max === undefined) { + if (unsigned_long || signed_long || unsigned_fallback) max = 0x7FFFFFFF; + } + + return { + get: function() { + var v = this._getattr(a.name); + var n = a.float ? parseFloat(v) : parseInt(v, 10); + if (v === null || !isFinite(n) || (min !== undefined && n < min) || (max !== undefined && n > max)) { + return def.call(this); + } + if (unsigned_long || signed_long || unsigned_fallback) { + if (!/^[ \t\n\f\r]*[-+]?[0-9]/.test(v)) { return def.call(this); } + n = n|0; // jshint ignore:line + } + return n; + }, + set: function(v) { + if (!a.float) { v = Math.floor(v); } + if (setmin !== undefined && v < setmin) { + utils.IndexSizeError(a.name + ' set to ' + v); + } + if (unsigned_long) { + v = (v < 0 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (unsigned_fallback) { + v = (v < 1 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } else if (signed_long) { + v = (v < -0x80000000 || v > 0x7FFFFFFF) ? def.call(this) : + (v|0); // jshint ignore:line + } + this._setattr(a.name, String(v)); + } + }; +} + +// This is a utility function for setting up change handler functions +// for attributes like 'id' that require special handling when they change. +exports.registerChangeHandler = function(c, name, handler) { + var p = c.prototype; + + // If p does not already have its own _attributeChangeHandlers + // then create one for it, inheriting from the inherited + // _attributeChangeHandlers. At the top (for the Element class) the + // _attributeChangeHandlers object will be created with a null prototype. + if (!Object.prototype.hasOwnProperty.call(p, '_attributeChangeHandlers')) { + p._attributeChangeHandlers = + Object.create(p._attributeChangeHandlers || null); + } + + p._attributeChangeHandlers[name] = handler; +}; + + +/***/ }), + +/***/ 6978: +/***/ ((__unused_webpack_module, exports) => { + +/* + * This file defines Domino behaviour that can be externally configured. + * To change these settings, set the relevant global property *before* + * you call `require("domino")`. + */ + +exports.h = !globalThis.__domino_frozen__; + + +/***/ }), + +/***/ 47679: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var attributes = __webpack_require__(57673); +var isApiWritable = (__webpack_require__(6978)/* .isApiWritable */ .h); + +module.exports = function(spec, defaultConstructor, tagList, tagNameToImpl) { + var c = spec.ctor; + if (c) { + var props = spec.props || {}; + + if (spec.attributes) { + for (var n in spec.attributes) { + var attr = spec.attributes[n]; + if (typeof attr !== 'object' || Array.isArray(attr)) attr = {type: attr}; + if (!attr.name) attr.name = n.toLowerCase(); + props[n] = attributes.property(attr); + } + } + + props.constructor = { value : c, writable: isApiWritable }; + c.prototype = Object.create((spec.superclass || defaultConstructor).prototype, props); + if (spec.events) { + addEventHandlers(c, spec.events); + } + tagList[spec.name] = c; + } + else { + c = defaultConstructor; + } + + (spec.tags || spec.tag && [spec.tag] || []).forEach(function(tag) { + tagNameToImpl[tag] = c; + }); + + return c; +}; + +function EventHandlerBuilder(body, document, form, element) { + this.body = body; + this.document = document; + this.form = form; + this.element = element; +} + +EventHandlerBuilder.prototype.build = function () { + return () => {}; +}; + +function EventHandlerChangeHandler(elt, name, oldval, newval) { + var doc = elt.ownerDocument || Object.create(null); + var form = elt.form || Object.create(null); + elt[name] = new EventHandlerBuilder(newval, doc, form, elt).build(); +} + +function addEventHandlers(c, eventHandlerTypes) { + var p = c.prototype; + eventHandlerTypes.forEach(function(type) { + // Define the event handler registration IDL attribute for this type + Object.defineProperty(p, "on" + type, { + get: function() { + return this._getEventHandler(type); + }, + set: function(v) { + this._setEventHandler(type, v); + }, + }); + + // Define special behavior for the content attribute as well + attributes.registerChangeHandler(c, "on" + type, EventHandlerChangeHandler); + }); +} + + +/***/ }), + +/***/ 86817: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +module.exports = { + Event: __webpack_require__(79778), + UIEvent: __webpack_require__(45280), + MouseEvent: __webpack_require__(6421), + CustomEvent: __webpack_require__(58575) +}; + + +/***/ }), + +/***/ 41537: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Node = __webpack_require__(20576); +var Element = __webpack_require__(67262); +var CSSStyleDeclaration = __webpack_require__(36142); +var utils = __webpack_require__(91995); +var URLUtils = __webpack_require__(22554); +var defineElement = __webpack_require__(47679); + +var htmlElements = exports.elements = {}; +var htmlNameToImpl = Object.create(null); + +exports.createElement = function(doc, localName, prefix) { + var impl = htmlNameToImpl[localName] || HTMLUnknownElement; + return new impl(doc, localName, prefix); +}; + +function define(spec) { + return defineElement(spec, HTMLElement, htmlElements, htmlNameToImpl); +} + +function URL(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return ''; } + var url = this.doc._resolve(v); + return (url === null) ? v : url; + }, + set: function(value) { + this._setattr(attr, value); + } + }; +} + +function CORS(attr) { + return { + get: function() { + var v = this._getattr(attr); + if (v === null) { return null; } + if (v.toLowerCase() === 'use-credentials') { return 'use-credentials'; } + return 'anonymous'; + }, + set: function(value) { + if (value===null || value===undefined) { + this.removeAttribute(attr); + } else { + this._setattr(attr, value); + } + } + }; +} + +const REFERRER = { + type: ["", "no-referrer", "no-referrer-when-downgrade", "same-origin", "origin", "strict-origin", "origin-when-cross-origin", "strict-origin-when-cross-origin", "unsafe-url"], + missing: '', +}; + + +// XXX: the default value for tabIndex should be 0 if the element is +// focusable and -1 if it is not. But the full definition of focusable +// is actually hard to compute, so for now, I'll follow Firefox and +// just base the default value on the type of the element. +var focusableElements = { + "A":true, "LINK":true, "BUTTON":true, "INPUT":true, + "SELECT":true, "TEXTAREA":true, "COMMAND":true +}; + +var HTMLFormElement = function(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._form = null; // Prevent later deoptimization +}; + +var HTMLElement = exports.HTMLElement = define({ + superclass: Element, + name: 'HTMLElement', + ctor: function HTMLElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.HTML, prefix); + }, + props: { + dangerouslySetInnerHTML: { + set: function (v) { + this._innerHTML = v; + }, + }, + innerHTML: { + get: function() { + return this.serialize(); + }, + set: function(v) { + var parser = this.ownerDocument.implementation.mozHTMLParser( + this.ownerDocument._address, + this); + parser.parse(v===null ? '' : String(v), true); + + // Remove any existing children of this node + var target = (this instanceof htmlNameToImpl.template) ? + this.content : this; + while(target.hasChildNodes()) + target.removeChild(target.firstChild); + + // Now copy newly parsed children to this node + target.appendChild(parser._asDocumentFragment()); + } + }, + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }, set: function(v) { + if (v===null||v===undefined) { v = ''; } + this._setattr('style', String(v)); + }}, + + // These can't really be implemented server-side in a reasonable way. + blur: { value: function() {}}, + focus: { value: function() {}}, + forceSpellCheck: { value: function() {}}, + + click: { value: function() { + if (this._click_in_progress) return; + this._click_in_progress = true; + try { + if (this._pre_click_activation_steps) + this._pre_click_activation_steps(); + + var event = this.ownerDocument.createEvent("MouseEvent"); + event.initMouseEvent("click", true, true, + this.ownerDocument.defaultView, 1, + 0, 0, 0, 0, + // These 4 should be initialized with + // the actually current keyboard state + // somehow... + false, false, false, false, + 0, null + ); + + // Dispatch this as an untrusted event since it is synthetic + var success = this.dispatchEvent(event); + + if (success) { + if (this._post_click_activation_steps) + this._post_click_activation_steps(event); + } + else { + if (this._cancelled_activation_steps) + this._cancelled_activation_steps(); + } + } + finally { + this._click_in_progress = false; + } + }}, + submit: { value: utils.nyi }, + }, + attributes: { + title: String, + lang: String, + dir: {type: ["ltr", "rtl", "auto"], missing: ''}, + draggable: {type: ["true", "false"], treatNullAsEmptyString: true }, + spellcheck: {type: ["true", "false"], missing: ''}, + enterKeyHint: {type: ["enter", "done", "go", "next", "previous", "search", "send"], missing: ''}, + autoCapitalize: {type: ["off", "on", "none", "sentences", "words", "characters"], missing: '' }, + autoFocus: Boolean, + accessKey: String, + nonce: String, + hidden: Boolean, + translate: {type: ["no", "yes"], missing: '' }, + tabIndex: {type: "long", default: function() { + if (this.tagName in focusableElements || + this.contentEditable) + return 0; + else + return -1; + }} + }, + events: [ + "abort", "canplay", "canplaythrough", "change", "click", "contextmenu", + "cuechange", "dblclick", "drag", "dragend", "dragenter", "dragleave", + "dragover", "dragstart", "drop", "durationchange", "emptied", "ended", + "input", "invalid", "keydown", "keypress", "keyup", "loadeddata", + "loadedmetadata", "loadstart", "mousedown", "mousemove", "mouseout", + "mouseover", "mouseup", "mousewheel", "pause", "play", "playing", + "progress", "ratechange", "readystatechange", "reset", "seeked", + "seeking", "select", "show", "stalled", "submit", "suspend", + "timeupdate", "volumechange", "waiting", + + // These last 5 event types will be overriden by HTMLBodyElement + "blur", "error", "focus", "load", "scroll" + ] +}); + + +// XXX: reflect contextmenu as contextMenu, with element type + + +// style: the spec doesn't call this a reflected attribute. +// may want to handle it manually. + +// contentEditable: enumerated, not clear if it is actually +// reflected or requires custom getter/setter. Not listed as +// "limited to known values". Raises syntax_err on bad setting, +// so I think this is custom. + +// contextmenu: content is element id, idl type is an element +// draggable: boolean, but not a reflected attribute +// dropzone: reflected SettableTokenList, experimental, so don't +// implement it right away. + +// data-* attributes: need special handling in setAttribute? +// Or maybe that isn't necessary. Can I just scan the attribute list +// when building the dataset? Liveness and caching issues? + +// microdata attributes: many are simple reflected attributes, but +// I'm not going to implement this now. + + +var HTMLUnknownElement = define({ + name: 'HTMLUnknownElement', + ctor: function HTMLUnknownElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + + +var formAssociatedProps = { + // See http://www.w3.org/TR/html5/association-of-controls-and-forms.html#form-owner + form: { get: function() { + return this._form; + }} +}; + +define({ + tag: 'a', + name: 'HTMLAnchorElement', + ctor: function HTMLAnchorElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + _post_click_activation_steps: { value: function(e) { + if (this.href) { + // Follow the link + // XXX: this is just a quick hack + // XXX: the HTML spec probably requires more than this + this.ownerDocument.defaultView.location = this.href; + } + }}, + }, + attributes: { + href: URL, + ping: String, + download: String, + target: String, + rel: String, + media: String, + hreflang: String, + type: String, + referrerPolicy: REFERRER, + // Obsolete + coords: String, + charset: String, + name: String, + rev: String, + shape: String, + } +}); +// Latest WhatWG spec says these methods come via HTMLHyperlinkElementUtils +URLUtils._inherit(htmlNameToImpl.a.prototype); + +define({ + tag: 'area', + name: 'HTMLAreaElement', + ctor: function HTMLAreaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + target: String, + download: String, + rel: String, + media: String, + href: URL, + hreflang: String, + type: String, + shape: String, + coords: String, + ping: String, + // XXX: also reflect relList + referrerPolicy: REFERRER, + // Obsolete + noHref: Boolean, + } +}); +// Latest WhatWG spec says these methods come via HTMLHyperlinkElementUtils +URLUtils._inherit(htmlNameToImpl.area.prototype); + +define({ + tag: 'br', + name: 'HTMLBRElement', + ctor: function HTMLBRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + clear: String + }, +}); + +define({ + tag: 'base', + name: 'HTMLBaseElement', + ctor: function HTMLBaseElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "target": String + } +}); + + +define({ + tag: 'body', + name: 'HTMLBodyElement', + ctor: function HTMLBodyElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + // Certain event handler attributes on a tag actually set + // handlers for the window rather than just that element. Define + // getters and setters for those here. Note that some of these override + // properties on HTMLElement.prototype. + // XXX: If I add support for , these have to go there, too + // XXX + // When the Window object is implemented, these attribute will have + // to work with the same-named attributes on the Window. + events: [ + "afterprint", "beforeprint", "beforeunload", "blur", "error", + "focus","hashchange", "load", "message", "offline", "online", + "pagehide", "pageshow","popstate","resize","scroll","storage","unload", + ], + attributes: { + // Obsolete + text: { type: String, treatNullAsEmptyString: true }, + link: { type: String, treatNullAsEmptyString: true }, + vLink: { type: String, treatNullAsEmptyString: true }, + aLink: { type: String, treatNullAsEmptyString: true }, + bgColor: { type: String, treatNullAsEmptyString: true }, + background: String, + } +}); + +define({ + tag: 'button', + name: 'HTMLButtonElement', + ctor: function HTMLButtonElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + value: String, + disabled: Boolean, + autofocus: Boolean, + type: { type:["submit", "reset", "button", "menu"], missing: 'submit' }, + formTarget: String, + formAction: URL, + formNoValidate: Boolean, + formMethod: { type: ["get", "post", "dialog"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + } +}); + +define({ + tag: 'dl', + name: 'HTMLDListElement', + ctor: function HTMLDListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'data', + name: 'HTMLDataElement', + ctor: function HTMLDataElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: String, + } +}); + +define({ + tag: 'datalist', + name: 'HTMLDataListElement', + ctor: function HTMLDataListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'details', + name: 'HTMLDetailsElement', + ctor: function HTMLDetailsElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + "open": Boolean + } +}); + +define({ + tag: 'div', + name: 'HTMLDivElement', + ctor: function HTMLDivElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); + +define({ + tag: 'embed', + name: 'HTMLEmbedElement', + ctor: function HTMLEmbedElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + type: String, + width: String, + height: String, + // Obsolete + align: String, + name: String, + } +}); + +define({ + tag: 'fieldset', + name: 'HTMLFieldSetElement', + ctor: function HTMLFieldSetElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + disabled: Boolean, + name: String + } +}); + +define({ + tag: 'form', + name: 'HTMLFormElement', + ctor: function HTMLFormElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + action: String, + autocomplete: {type:['on', 'off'], missing: 'on'}, + name: String, + acceptCharset: {name: "accept-charset"}, + target: String, + noValidate: Boolean, + method: { type: ["get", "post", "dialog"], invalid: 'get', missing: 'get' }, + // Both enctype and encoding reflect the enctype content attribute + enctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + encoding: {name: 'enctype', type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: "application/x-www-form-urlencoded" }, + } +}); + +define({ + tag: 'hr', + name: 'HTMLHRElement', + ctor: function HTMLHRElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + color: String, + noShade: Boolean, + size: String, + width: String, + }, +}); + +define({ + tag: 'head', + name: 'HTMLHeadElement', + ctor: function HTMLHeadElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tags: ['h1','h2','h3','h4','h5','h6'], + name: 'HTMLHeadingElement', + ctor: function HTMLHeadingElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + }, +}); + +define({ + tag: 'html', + name: 'HTMLHtmlElement', + ctor: function HTMLHtmlElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + xmlns: URL, + // Obsolete + version: String + } +}); + +define({ + tag: 'iframe', + name: 'HTMLIFrameElement', + ctor: function HTMLIFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + srcdoc: String, + name: String, + width: String, + height: String, + // XXX: sandbox is a reflected settable token list + seamless: Boolean, + allow: Boolean, + allowFullscreen: Boolean, + allowUserMedia: Boolean, + allowPaymentRequest: Boolean, + referrerPolicy: REFERRER, + loading: { type:['eager','lazy'], treatNullAsEmptyString: true }, + // Obsolete + align: String, + scrolling: String, + frameBorder: String, + longDesc: URL, + marginHeight: { type: String, treatNullAsEmptyString: true }, + marginWidth: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'img', + name: 'HTMLImageElement', + ctor: function HTMLImageElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + alt: String, + src: URL, + srcset: String, + crossOrigin: CORS, + useMap: String, + isMap: Boolean, + sizes: String, + height: { type: "unsigned long", default: 0 }, + width: { type: "unsigned long", default: 0 }, + referrerPolicy: REFERRER, + loading: { type:['eager','lazy'], missing: '' }, + // Obsolete: + name: String, + lowsrc: URL, + align: String, + hspace: { type: "unsigned long", default: 0 }, + vspace: { type: "unsigned long", default: 0 }, + longDesc: URL, + border: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'input', + name: 'HTMLInputElement', + ctor: function HTMLInputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + _post_click_activation_steps: { value: function(e) { + if (this.type === 'checkbox') { + this.checked = !this.checked; + } + else if (this.type === 'radio') { + var group = this.form.getElementsByName(this.name); + for (var i=group.length-1; i >= 0; i--) { + var el = group[i]; + el.checked = (el === this); + } + } + }}, + }, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + accept: String, + alt: String, + max: String, + min: String, + pattern: String, + placeholder: String, + step: String, + dirName: String, + defaultValue: {name: 'value'}, + multiple: Boolean, + required: Boolean, + readOnly: Boolean, + checked: Boolean, + value: String, + src: URL, + defaultChecked: {name: 'checked', type: Boolean}, + size: {type: 'unsigned long', default: 20, min: 1, setmin: 1}, + width: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, + height: {type: 'unsigned long', min: 0, setmin: 0, default: 0}, + minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + autocomplete: String, // It's complicated + type: { type: + ["text", "hidden", "search", "tel", "url", "email", "password", + "datetime", "date", "month", "week", "time", "datetime-local", + "number", "range", "color", "checkbox", "radio", "file", "submit", + "image", "reset", "button"], + missing: 'text' }, + formTarget: String, + formNoValidate: Boolean, + formMethod: { type: ["get", "post"], invalid: 'get', missing: '' }, + formEnctype: { type: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalid: "application/x-www-form-urlencoded", missing: '' }, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + // Obsolete + align: String, + useMap: String, + } +}); + +define({ + tag: 'keygen', + name: 'HTMLKeygenElement', + ctor: function HTMLKeygenElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + name: String, + disabled: Boolean, + autofocus: Boolean, + challenge: String, + keytype: { type:["rsa"], missing: '' }, + } +}); + +define({ + tag: 'li', + name: 'HTMLLIElement', + ctor: function HTMLLIElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + value: {type: "long", default: 0}, + // Obsolete + type: String, + } +}); + +define({ + tag: 'label', + name: 'HTMLLabelElement', + ctor: function HTMLLabelElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + htmlFor: {name: 'for', type: String} + } +}); + +define({ + tag: 'legend', + name: 'HTMLLegendElement', + ctor: function HTMLLegendElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + }, +}); + +define({ + tag: 'link', + name: 'HTMLLinkElement', + ctor: function HTMLLinkElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX Reflect DOMSettableTokenList sizes also DOMTokenList relList + href: URL, + rel: String, + media: String, + hreflang: String, + type: String, + crossOrigin: CORS, + nonce: String, + integrity: String, + referrerPolicy: REFERRER, + imageSizes: String, + imageSrcset: String, + // Obsolete + charset: String, + rev: String, + target: String, + } +}); + +define({ + tag: 'map', + name: 'HTMLMapElement', + ctor: function HTMLMapElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String + } +}); + +define({ + tag: 'menu', + name: 'HTMLMenuElement', + ctor: function HTMLMenuElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // XXX: not quite right, default should be popup if parent element is + // popup. + type: { type: [ 'context', 'popup', 'toolbar' ], missing: 'toolbar' }, + label: String, + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'meta', + name: 'HTMLMetaElement', + ctor: function HTMLMetaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + content: String, + httpEquiv: {name: 'http-equiv', type: String}, + // Obsolete + scheme: String, + } +}); + +define({ + tag: 'meter', + name: 'HTMLMeterElement', + ctor: function HTMLMeterElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps +}); + +define({ + tags: ['ins', 'del'], + name: 'HTMLModElement', + ctor: function HTMLModElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL, + dateTime: String + } +}); + +define({ + tag: 'ol', + name: 'HTMLOListElement', + ctor: function HTMLOListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // Utility function (see the start attribute default value). Returns + // the number of
  • children of this element + _numitems: { get: function() { + var items = 0; + this.childNodes.forEach(function(n) { + if (n.nodeType === Node.ELEMENT_NODE && n.tagName === "LI") + items++; + }); + return items; + }} + }, + attributes: { + type: String, + reversed: Boolean, + start: { + type: "long", + default: function() { + // The default value of the start attribute is 1 unless the list is + // reversed. Then it is the # of li children + if (this.reversed) + return this._numitems; + else + return 1; + } + }, + // Obsolete + compact: Boolean, + } +}); + +define({ + tag: 'object', + name: 'HTMLObjectElement', + ctor: function HTMLObjectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + data: URL, + type: String, + name: String, + useMap: String, + typeMustMatch: Boolean, + width: String, + height: String, + // Obsolete + align: String, + archive: String, + code: String, + declare: Boolean, + hspace: { type: "unsigned long", default: 0 }, + standby: String, + vspace: { type: "unsigned long", default: 0 }, + codeBase: URL, + codeType: String, + border: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'optgroup', + name: 'HTMLOptGroupElement', + ctor: function HTMLOptGroupElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + disabled: Boolean, + label: String + } +}); + +define({ + tag: 'option', + name: 'HTMLOptionElement', + ctor: function HTMLOptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + form: { get: function() { + var p = this.parentNode; + while (p && p.nodeType === Node.ELEMENT_NODE) { + if (p.localName === 'select') return p.form; + p = p.parentNode; + } + }}, + value: { + get: function() { return this._getattr('value') || this.text; }, + set: function(v) { this._setattr('value', v); }, + }, + text: { + get: function() { + // Strip and collapse whitespace + return this.textContent.replace(/[ \t\n\f\r]+/g, ' ').trim(); + }, + set: function(v) { this.textContent = v; }, + }, + // missing: index + }, + attributes: { + disabled: Boolean, + defaultSelected: {name: 'selected', type: Boolean}, + label: String, + } +}); + +define({ + tag: 'output', + name: 'HTMLOutputElement', + ctor: function HTMLOutputElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + // XXX Reflect for/htmlFor as a settable token list + name: String + } +}); + +define({ + tag: 'p', + name: 'HTMLParagraphElement', + ctor: function HTMLParagraphElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String + } +}); + +define({ + tag: 'param', + name: 'HTMLParamElement', + ctor: function HTMLParamElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + name: String, + value: String, + // Obsolete + type: String, + valueType: String, + } +}); + +define({ + tags: ['pre',/*legacy elements:*/'listing','xmp'], + name: 'HTMLPreElement', + ctor: function HTMLPreElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + width: { type: "long", default: 0 }, + } +}); + +define({ + tag: 'progress', + name: 'HTMLProgressElement', + ctor: function HTMLProgressElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: formAssociatedProps, + attributes: { + max: {type: Number, float: true, default: 1.0, min: 0} + } +}); + +define({ + tags: ['q', 'blockquote'], + name: 'HTMLQuoteElement', + ctor: function HTMLQuoteElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + cite: URL + } +}); + +define({ + tag: 'script', + name: 'HTMLScriptElement', + ctor: function HTMLScriptElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { + get: function() { + var s = ""; + for(var i = 0, n = this.childNodes.length; i < n; i++) { + var child = this.childNodes[i]; + if (child.nodeType === Node.TEXT_NODE) + s += child._data; + } + return s; + }, + set: function(value) { + this.removeChildren(); + if (value !== null && value !== "") { + this.appendChild(this.ownerDocument.createTextNode(value)); + } + } + } + }, + attributes: { + src: URL, + type: String, + charset: String, + referrerPolicy: REFERRER, + defer: Boolean, + async: Boolean, + nomodule: Boolean, + crossOrigin: CORS, + nonce: String, + integrity: String, + } +}); + +define({ + tag: 'select', + name: 'HTMLSelectElement', + ctor: function HTMLSelectElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + options: { get: function() { + return this.getElementsByTagName('option'); + }} + }, + attributes: { + autocomplete: String, // It's complicated + name: String, + disabled: Boolean, + autofocus: Boolean, + multiple: Boolean, + required: Boolean, + size: {type: "unsigned long", default: 0} + } +}); + +define({ + tag: 'span', + name: 'HTMLSpanElement', + ctor: function HTMLSpanElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'style', + name: 'HTMLStyleElement', + ctor: function HTMLStyleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + media: String, + type: String, + scoped: Boolean + } +}); + +define({ + tag: 'caption', + name: 'HTMLTableCaptionElement', + ctor: function HTMLTableCaptionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + // Obsolete + align: String, + } +}); + + +define({ + name: 'HTMLTableCellElement', + ctor: function HTMLTableCellElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + colSpan: {type: "unsigned long", default: 1}, + rowSpan: {type: "unsigned long", default: 1}, + //XXX Also reflect settable token list headers + scope: { type: ['row','col','rowgroup','colgroup'], missing: '' }, + abbr: String, + // Obsolete + align: String, + axis: String, + height: String, + width: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + noWrap: Boolean, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tags: ['col', 'colgroup'], + name: 'HTMLTableColElement', + ctor: function HTMLTableColElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + span: {type: 'limited unsigned long with fallback', default: 1, min: 1}, + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + width: String, + } +}); + +define({ + tag: 'table', + name: 'HTMLTableElement', + ctor: function HTMLTableElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + border: String, + frame: String, + rules: String, + summary: String, + width: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + cellPadding: { type: String, treatNullAsEmptyString: true }, + cellSpacing: { type: String, treatNullAsEmptyString: true }, + } +}); + +define({ + tag: 'template', + name: 'HTMLTemplateElement', + ctor: function HTMLTemplateElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + this._contentFragment = doc._templateDoc.createDocumentFragment(); + }, + props: { + content: { get: function() { return this._contentFragment; } }, + serialize: { value: function() { return this.content.serialize(); } } + } +}); + +define({ + tag: 'tr', + name: 'HTMLTableRowElement', + ctor: function HTMLTableRowElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + cells: { get: function() { + return this.querySelectorAll('td,th'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + bgColor: { type: String, treatNullAsEmptyString: true }, + }, +}); + +define({ + tags: ['thead', 'tfoot', 'tbody'], + name: 'HTMLTableSectionElement', + ctor: function HTMLTableSectionElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + rows: { get: function() { + return this.getElementsByTagName('tr'); + }} + }, + attributes: { + // Obsolete + align: String, + ch: { name: 'char', type: String }, + chOff: { name: 'charoff', type: String }, + vAlign: String, + } +}); + +define({ + tag: 'textarea', + name: 'HTMLTextAreaElement', + ctor: function HTMLTextAreaElement(doc, localName, prefix) { + HTMLFormElement.call(this, doc, localName, prefix); + }, + props: { + form: formAssociatedProps.form, + type: { get: function() { return 'textarea'; } }, + defaultValue: { + get: function() { return this.textContent; }, + set: function(v) { this.textContent = v; }, + }, + value: { + get: function() { return this.defaultValue; /* never dirty */ }, + set: function(v) { + // This isn't completely correct: according to the spec, this + // should "dirty" the API value, and result in + // `this.value !== this.defaultValue`. But for most of what + // folks want to do, this implementation should be fine: + this.defaultValue = v; + }, + }, + textLength: { get: function() { return this.value.length; } }, + }, + attributes: { + autocomplete: String, // It's complicated + name: String, + disabled: Boolean, + autofocus: Boolean, + placeholder: String, + wrap: String, + dirName: String, + required: Boolean, + readOnly: Boolean, + rows: {type: 'limited unsigned long with fallback', default: 2 }, + cols: {type: 'limited unsigned long with fallback', default: 20 }, + maxLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + minLength: {type: 'unsigned long', min: 0, setmin: 0, default: -1}, + inputMode: { type: [ "verbatim", "latin", "latin-name", "latin-prose", "full-width-latin", "kana", "kana-name", "katakana", "numeric", "tel", "email", "url" ], missing: '' }, + } +}); + +define({ + tag: 'time', + name: 'HTMLTimeElement', + ctor: function HTMLTimeElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + dateTime: String, + pubDate: Boolean + } +}); + +define({ + tag: 'title', + name: 'HTMLTitleElement', + ctor: function HTMLTitleElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + text: { get: function() { + return this.textContent; + }} + } +}); + +define({ + tag: 'ul', + name: 'HTMLUListElement', + ctor: function HTMLUListElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + type: String, + // Obsolete + compact: Boolean, + } +}); + +define({ + name: 'HTMLMediaElement', + ctor: function HTMLMediaElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + crossOrigin: CORS, + preload: { type:["metadata", "none", "auto", {value: "", alias: "auto"}], missing: 'auto' }, + loop: Boolean, + autoplay: Boolean, + mediaGroup: String, + controls: Boolean, + defaultMuted: {name: "muted", type: Boolean} + } +}); + +define({ + name: 'HTMLAudioElement', + tag: 'audio', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLAudioElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + } +}); + +define({ + name: 'HTMLVideoElement', + tag: 'video', + superclass: htmlElements.HTMLMediaElement, + ctor: function HTMLVideoElement(doc, localName, prefix) { + htmlElements.HTMLMediaElement.call(this, doc, localName, prefix); + }, + attributes: { + poster: URL, + width: {type: "unsigned long", min: 0, default: 0 }, + height: {type: "unsigned long", min: 0, default: 0 } + } +}); + +define({ + tag: 'td', + name: 'HTMLTableDataCellElement', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableDataCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'th', + name: 'HTMLTableHeaderCellElement', + superclass: htmlElements.HTMLTableCellElement, + ctor: function HTMLTableHeaderCellElement(doc, localName, prefix) { + htmlElements.HTMLTableCellElement.call(this, doc, localName, prefix); + }, +}); + +define({ + tag: 'frameset', + name: 'HTMLFrameSetElement', + ctor: function HTMLFrameSetElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'frame', + name: 'HTMLFrameElement', + ctor: function HTMLFrameElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + } +}); + +define({ + tag: 'canvas', + name: 'HTMLCanvasElement', + ctor: function HTMLCanvasElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + getContext: { value: utils.nyi }, + probablySupportsContext: { value: utils.nyi }, + setContext: { value: utils.nyi }, + transferControlToProxy: { value: utils.nyi }, + toDataURL: { value: utils.nyi }, + toBlob: { value: utils.nyi } + }, + attributes: { + width: { type: "unsigned long", default: 300}, + height: { type: "unsigned long", default: 150} + } +}); + +define({ + tag: 'dialog', + name: 'HTMLDialogElement', + ctor: function HTMLDialogElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + show: { value: utils.nyi }, + showModal: { value: utils.nyi }, + close: { value: utils.nyi } + }, + attributes: { + open: Boolean, + returnValue: String + } +}); + +define({ + tag: 'menuitem', + name: 'HTMLMenuItemElement', + ctor: function HTMLMenuItemElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + props: { + // The menuitem's label + _label: { + get: function() { + var val = this._getattr('label'); + if (val !== null && val !== '') { return val; } + val = this.textContent; + // Strip and collapse whitespace + return val.replace(/[ \t\n\f\r]+/g, ' ').trim(); + } + }, + // The menuitem label IDL attribute + label: { + get: function() { + var val = this._getattr('label'); + if (val !== null) { return val; } + return this._label; + }, + set: function(v) { + this._setattr('label', v); + }, + } + }, + attributes: { + type: { type: ["command","checkbox","radio"], missing: 'command' }, + icon: URL, + disabled: Boolean, + checked: Boolean, + radiogroup: String, + default: Boolean + } +}); + +define({ + tag: 'source', + name: 'HTMLSourceElement', + ctor: function HTMLSourceElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + srcset: String, + sizes: String, + media: String, + src: URL, + type: String, + width: String, + height: String, + } +}); + +define({ + tag: 'track', + name: 'HTMLTrackElement', + ctor: function HTMLTrackElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + src: URL, + srclang: String, + label: String, + default: Boolean, + kind: { type: ["subtitles", "captions", "descriptions", "chapters", "metadata"], missing: 'subtitles', invalid: 'metadata' }, + }, + props: { + NONE: { get: function() { return 0; } }, + LOADING: { get: function() { return 1; } }, + LOADED: { get: function() { return 2; } }, + ERROR: { get: function() { return 3; } }, + readyState: { get: utils.nyi }, + track: { get: utils.nyi } + } +}); + +define({ + // obsolete + tag: 'font', + name: 'HTMLFontElement', + ctor: function HTMLFontElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + color: { type: String, treatNullAsEmptyString: true }, + face: { type: String }, + size: { type: String }, + }, +}); + +define({ + // obsolete + tag: 'dir', + name: 'HTMLDirectoryElement', + ctor: function HTMLDirectoryElement(doc, localName, prefix) { + HTMLElement.call(this, doc, localName, prefix); + }, + attributes: { + compact: Boolean, + }, +}); + +define({ + tags: [ + "abbr", "address", "article", "aside", "b", "bdi", "bdo", "cite", "content", "code", + "dd", "dfn", "dt", "em", "figcaption", "figure", "footer", "header", "hgroup", "i", "kbd", + "main", "mark", "nav", "noscript", "rb", "rp", "rt", "rtc", + "ruby", "s", "samp", "section", "small", "strong", "sub", "summary", "sup", "u", "var", "wbr", + // Legacy elements + "acronym", "basefont", "big", "center", "nobr", "noembed", "noframes", + "plaintext", "strike", "tt" + ] +}); + + +/***/ }), + +/***/ 57102: +/***/ ((module, exports, __webpack_require__) => { + +"use strict"; + +var utils = __webpack_require__(91995); + +exports = module.exports = { + CSSStyleDeclaration: __webpack_require__(36142), + CharacterData: __webpack_require__(28277), + Comment: __webpack_require__(21707), + DOMException: __webpack_require__(58149), + DOMImplementation: __webpack_require__(94008), + DOMTokenList: __webpack_require__(64365), + Document: __webpack_require__(88097), + DocumentFragment: __webpack_require__(9857), + DocumentType: __webpack_require__(47825), + Element: __webpack_require__(67262), + HTMLParser: __webpack_require__(24042), + NamedNodeMap: __webpack_require__(49), + Node: __webpack_require__(20576), + NodeList: __webpack_require__(45192), + NodeFilter: __webpack_require__(46870), + ProcessingInstruction: __webpack_require__(68159), + Text: __webpack_require__(57995), + Window: __webpack_require__(98352) +}; + +utils.merge(exports, __webpack_require__(86817)); +utils.merge(exports, (__webpack_require__(41537).elements)); +utils.merge(exports, (__webpack_require__(50380).elements)); + + +/***/ }), + +/***/ 72330: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var DOMImplementation = __webpack_require__(94008); +var HTMLParser = __webpack_require__(24042); +var Window = __webpack_require__(98352); +var impl = __webpack_require__(57102); + +exports.createDOMImplementation = function() { + return new DOMImplementation(null); +}; + +exports.createDocument = function(html, force) { + // Previous API couldn't let you pass '' as a document, and that + // yields a slightly different document than createHTMLDocument('') + // does. The new `force` parameter lets you pass '' if you want to. + if (html || force) { + var parser = new HTMLParser(); + parser.parse(html || '', true); + return parser.document(); + } + return new DOMImplementation(null).createHTMLDocument(""); +}; + +exports.createIncrementalHTMLParser = function() { + var parser = new HTMLParser(); + /** API for incremental parser. */ + return { + /** Provide an additional chunk of text to be parsed. */ + write: function(s) { + if (s.length > 0) { + parser.parse(s, false, function() { return true; }); + } + }, + /** + * Signal that we are done providing input text, optionally + * providing one last chunk as a parameter. + */ + end: function(s) { + parser.parse(s || '', true, function() { return true; }); + }, + /** + * Performs a chunk of parsing work, returning at the end of + * the next token as soon as shouldPauseFunc() returns true. + * Returns true iff there is more work to do. + * + * For example: + * ``` + * var incrParser = domino.createIncrementalHTMLParser(); + * incrParser.end('...long html document...'); + * while (true) { + * // Pause every 10ms + * var start = Date.now(); + * var pauseIn10 = function() { return (Date.now() - start) >= 10; }; + * if (!incrParser.process(pauseIn10)) { + * break; + * } + * ...yield to other tasks, do other housekeeping, etc... + * } + * ``` + */ + process: function(shouldPauseFunc) { + return parser.parse('', false, shouldPauseFunc); + }, + /** + * Returns the result of the incremental parse. Valid after + * `this.end()` has been called and `this.process()` has returned + * false. + */ + document: function() { + return parser.document(); + }, + }; +}; + +exports.createWindow = function(html, address) { + var document = exports.createDocument(html); + if (address !== undefined) { document._address = address; } + return new impl.Window(document); +}; + +exports.impl = impl; + +/***/ }), + +/***/ 5056: +/***/ ((module, exports) => { + +"use strict"; + +/* jshint eqnull: true */ +/** + * Zest (https://github.com/chjj/zest) + * A css selector engine. + * Copyright (c) 2011-2012, Christopher Jeffrey. (MIT Licensed) + * Domino version based on Zest v0.1.3 with bugfixes applied. + */ + +/** + * Helpers + */ + +var window = Object.create(null, { + location: { get: function() { + throw new Error('window.location is not supported.'); + } } +}); + +var compareDocumentPosition = function(a, b) { + return a.compareDocumentPosition(b); +}; + +var order = function(a, b) { + /* jshint bitwise: false */ + return compareDocumentPosition(a, b) & 2 ? 1 : -1; +}; + +var next = function(el) { + while ((el = el.nextSibling) + && el.nodeType !== 1); + return el; +}; + +var prev = function(el) { + while ((el = el.previousSibling) + && el.nodeType !== 1); + return el; +}; + +var child = function(el) { + /*jshint -W084 */ + if (el = el.firstChild) { + while (el.nodeType !== 1 + && (el = el.nextSibling)); + } + return el; +}; + +var lastChild = function(el) { + /*jshint -W084 */ + if (el = el.lastChild) { + while (el.nodeType !== 1 + && (el = el.previousSibling)); + } + return el; +}; + +var parentIsElement = function(n) { + if (!n.parentNode) { return false; } + var nodeType = n.parentNode.nodeType; + // The root `html` element can be a first- or last-child, too. + return nodeType === 1 || nodeType === 9; +}; + +var unquote = function(str) { + if (!str) return str; + var ch = str[0]; + if (ch === '"' || ch === '\'') { + if (str[str.length-1] === ch) { + str = str.slice(1, -1); + } else { + // bad string. + str = str.slice(1); + } + return str.replace(rules.str_escape, function(s) { + var m = /^\\(?:([0-9A-Fa-f]+)|([\r\n\f]+))/.exec(s); + if (!m) { return s.slice(1); } + if (m[2]) { return ''; /* escaped newlines are ignored in strings. */ } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); + } else if (rules.ident.test(str)) { + return decodeid(str); + } else { + // NUMBER, PERCENTAGE, DIMENSION, etc + return str; + } +}; + +var decodeid = function(str) { + return str.replace(rules.escape, function(s) { + var m = /^\\([0-9A-Fa-f]+)/.exec(s); + if (!m) { return s[1]; } + var cp = parseInt(m[1], 16); + return String.fromCodePoint ? String.fromCodePoint(cp) : + // Not all JavaScript implementations have String.fromCodePoint yet. + String.fromCharCode(cp); + }); +}; + +var indexOf = (function() { + if (Array.prototype.indexOf) { + return Array.prototype.indexOf; + } + return function(obj, item) { + var i = this.length; + while (i--) { + if (this[i] === item) return i; + } + return -1; + }; +})(); + +var makeInside = function(start, end) { + var regex = rules.inside.source + .replace(//g, end); + + return new RegExp(regex); +}; + +var replace = function(regex, name, val) { + regex = regex.source; + regex = regex.replace(name, val.source || val); + return new RegExp(regex); +}; + +var truncateUrl = function(url, num) { + return url + .replace(/^(?:\w+:\/\/|\/+)/, '') + .replace(/(?:\/+|\/*#.*?)$/, '') + .split('/', num) + .join('/'); +}; + +/** + * Handle `nth` Selectors + */ + +var parseNth = function(param_, test) { + var param = param_.replace(/\s+/g, '') + , cap; + + if (param === 'even') { + param = '2n+0'; + } else if (param === 'odd') { + param = '2n+1'; + } else if (param.indexOf('n') === -1) { + param = '0n' + param; + } + + cap = /^([+-])?(\d+)?n([+-])?(\d+)?$/.exec(param); + + return { + group: cap[1] === '-' + ? -(cap[2] || 1) + : +(cap[2] || 1), + offset: cap[4] + ? (cap[3] === '-' ? -cap[4] : +cap[4]) + : 0 + }; +}; + +var nth = function(param_, test, last) { + var param = parseNth(param_) + , group = param.group + , offset = param.offset + , find = !last ? child : lastChild + , advance = !last ? next : prev; + + return function(el) { + if (!parentIsElement(el)) return; + + var rel = find(el.parentNode) + , pos = 0; + + while (rel) { + if (test(rel, el)) pos++; + if (rel === el) { + pos -= offset; + return group && pos + ? (pos % group) === 0 && (pos < 0 === group < 0) + : !pos; + } + rel = advance(rel); + } + }; +}; + +/** + * Simple Selectors + */ + +var selectors = { + '*': (function() { + if (false/*function() { + var el = document.createElement('div'); + el.appendChild(document.createComment('')); + return !!el.getElementsByTagName('*')[0]; + }()*/) {} + return function() { + return true; + }; + })(), + 'type': function(type) { + type = type.toLowerCase(); + return function(el) { + return el.nodeName.toLowerCase() === type; + }; + }, + 'attr': function(key, op, val, i) { + op = operators[op]; + return function(el) { + var attr; + switch (key) { + case 'for': + attr = el.htmlFor; + break; + case 'class': + // className is '' when non-existent + // getAttribute('class') is null + attr = el.className; + if (attr === '' && el.getAttribute('class') == null) { + attr = null; + } + break; + case 'href': + case 'src': + attr = el.getAttribute(key, 2); + break; + case 'title': + // getAttribute('title') can be '' when non-existent sometimes? + attr = el.getAttribute('title') || null; + break; + // careful with attributes with special getter functions + case 'id': + case 'lang': + case 'dir': + case 'accessKey': + case 'hidden': + case 'tabIndex': + case 'style': + if (el.getAttribute) { + attr = el.getAttribute(key); + break; + } + /* falls through */ + default: + if (el.hasAttribute && !el.hasAttribute(key)) { + break; + } + attr = el[key] != null + ? el[key] + : el.getAttribute && el.getAttribute(key); + break; + } + if (attr == null) return; + attr = attr + ''; + if (i) { + attr = attr.toLowerCase(); + val = val.toLowerCase(); + } + return op(attr, val); + }; + }, + ':first-child': function(el) { + return !prev(el) && parentIsElement(el); + }, + ':last-child': function(el) { + return !next(el) && parentIsElement(el); + }, + ':only-child': function(el) { + return !prev(el) && !next(el) && parentIsElement(el); + }, + ':nth-child': function(param, last) { + return nth(param, function() { + return true; + }, last); + }, + ':nth-last-child': function(param) { + return selectors[':nth-child'](param, true); + }, + ':root': function(el) { + return el.ownerDocument.documentElement === el; + }, + ':empty': function(el) { + return !el.firstChild; + }, + ':not': function(sel) { + var test = compileGroup(sel); + return function(el) { + return !test(el); + }; + }, + ':first-of-type': function(el) { + if (!parentIsElement(el)) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = prev(el)) { + if (el.nodeName === type) return; + } + return true; + }, + ':last-of-type': function(el) { + if (!parentIsElement(el)) return; + var type = el.nodeName; + /*jshint -W084 */ + while (el = next(el)) { + if (el.nodeName === type) return; + } + return true; + }, + ':only-of-type': function(el) { + return selectors[':first-of-type'](el) + && selectors[':last-of-type'](el); + }, + ':nth-of-type': function(param, last) { + return nth(param, function(rel, el) { + return rel.nodeName === el.nodeName; + }, last); + }, + ':nth-last-of-type': function(param) { + return selectors[':nth-of-type'](param, true); + }, + ':checked': function(el) { + return !!(el.checked || el.selected); + }, + ':indeterminate': function(el) { + return !selectors[':checked'](el); + }, + ':enabled': function(el) { + return !el.disabled && el.type !== 'hidden'; + }, + ':disabled': function(el) { + return !!el.disabled; + }, + ':target': function(el) { + return el.id === window.location.hash.substring(1); + }, + ':focus': function(el) { + return el === el.ownerDocument.activeElement; + }, + ':is': function(sel) { + return compileGroup(sel); + }, + // :matches is an older name for :is; see + // https://github.com/w3c/csswg-drafts/issues/3258 + ':matches': function(sel) { + return selectors[':is'](sel); + }, + ':nth-match': function(param, last) { + var args = param.split(/\s*,\s*/) + , arg = args.shift() + , test = compileGroup(args.join(',')); + + return nth(arg, test, last); + }, + ':nth-last-match': function(param) { + return selectors[':nth-match'](param, true); + }, + ':links-here': function(el) { + return el + '' === window.location + ''; + }, + ':lang': function(param) { + return function(el) { + while (el) { + if (el.lang) return el.lang.indexOf(param) === 0; + el = el.parentNode; + } + }; + }, + ':dir': function(param) { + return function(el) { + while (el) { + if (el.dir) return el.dir === param; + el = el.parentNode; + } + }; + }, + ':scope': function(el, con) { + var context = con || el.ownerDocument; + if (context.nodeType === 9) { + return el === context.documentElement; + } + return el === context; + }, + ':any-link': function(el) { + return typeof el.href === 'string'; + }, + ':local-link': function(el) { + if (el.nodeName) { + return el.href && el.host === window.location.host; + } + var param = +el + 1; + return function(el) { + if (!el.href) return; + + var url = window.location + '' + , href = el + ''; + + return truncateUrl(url, param) === truncateUrl(href, param); + }; + }, + ':default': function(el) { + return !!el.defaultSelected; + }, + ':valid': function(el) { + return el.willValidate || (el.validity && el.validity.valid); + }, + ':invalid': function(el) { + return !selectors[':valid'](el); + }, + ':in-range': function(el) { + return el.value > el.min && el.value <= el.max; + }, + ':out-of-range': function(el) { + return !selectors[':in-range'](el); + }, + ':required': function(el) { + return !!el.required; + }, + ':optional': function(el) { + return !el.required; + }, + ':read-only': function(el) { + if (el.readOnly) return true; + + var attr = el.getAttribute('contenteditable') + , prop = el.contentEditable + , name = el.nodeName.toLowerCase(); + + name = name !== 'input' && name !== 'textarea'; + + return (name || el.disabled) && attr == null && prop !== 'true'; + }, + ':read-write': function(el) { + return !selectors[':read-only'](el); + }, + ':hover': function() { + throw new Error(':hover is not supported.'); + }, + ':active': function() { + throw new Error(':active is not supported.'); + }, + ':link': function() { + throw new Error(':link is not supported.'); + }, + ':visited': function() { + throw new Error(':visited is not supported.'); + }, + ':column': function() { + throw new Error(':column is not supported.'); + }, + ':nth-column': function() { + throw new Error(':nth-column is not supported.'); + }, + ':nth-last-column': function() { + throw new Error(':nth-last-column is not supported.'); + }, + ':current': function() { + throw new Error(':current is not supported.'); + }, + ':past': function() { + throw new Error(':past is not supported.'); + }, + ':future': function() { + throw new Error(':future is not supported.'); + }, + // Non-standard, for compatibility purposes. + ':contains': function(param) { + return function(el) { + var text = el.innerText || el.textContent || el.value || ''; + return text.indexOf(param) !== -1; + }; + }, + ':has': function(param) { + return function(el) { + return find(param, el).length > 0; + }; + } + // Potentially add more pseudo selectors for + // compatibility with sizzle and most other + // selector engines (?). +}; + +/** + * Attribute Operators + */ + +var operators = { + '-': function() { + return true; + }, + '=': function(attr, val) { + return attr === val; + }, + '*=': function(attr, val) { + return attr.indexOf(val) !== -1; + }, + '~=': function(attr, val) { + var i + , s + , f + , l; + + for (s = 0; true; s = i + 1) { + i = attr.indexOf(val, s); + if (i === -1) return false; + f = attr[i - 1]; + l = attr[i + val.length]; + if ((!f || f === ' ') && (!l || l === ' ')) return true; + } + }, + '|=': function(attr, val) { + var i = attr.indexOf(val) + , l; + + if (i !== 0) return; + l = attr[i + val.length]; + + return l === '-' || !l; + }, + '^=': function(attr, val) { + return attr.indexOf(val) === 0; + }, + '$=': function(attr, val) { + var i = attr.lastIndexOf(val); + return i !== -1 && i + val.length === attr.length; + }, + // non-standard + '!=': function(attr, val) { + return attr !== val; + } +}; + +/** + * Combinator Logic + */ + +var combinators = { + ' ': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = el.parentNode) { + if (test(el)) return el; + } + }; + }, + '>': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = el.parentNode) { + return test(el) && el; + } + }; + }, + '+': function(test) { + return function(el) { + /*jshint -W084 */ + if (el = prev(el)) { + return test(el) && el; + } + }; + }, + '~': function(test) { + return function(el) { + /*jshint -W084 */ + while (el = prev(el)) { + if (test(el)) return el; + } + }; + }, + 'noop': function(test) { + return function(el) { + return test(el) && el; + }; + }, + 'ref': function(test, name) { + var node; + + function ref(el) { + var doc = el.ownerDocument + , nodes = doc.getElementsByTagName('*') + , i = nodes.length; + + while (i--) { + node = nodes[i]; + if (ref.test(el)) { + node = null; + return true; + } + } + + node = null; + } + + ref.combinator = function(el) { + if (!node || !node.getAttribute) return; + + var attr = node.getAttribute(name) || ''; + if (attr[0] === '#') attr = attr.substring(1); + + if (attr === el.id && test(node)) { + return node; + } + }; + + return ref; + } +}; + +/** + * Grammar + */ + +var rules = { + escape: /\\(?:[^0-9A-Fa-f\r\n]|[0-9A-Fa-f]{1,6}[\r\n\t ]?)/g, + str_escape: /(escape)|\\(\n|\r\n?|\f)/g, + nonascii: /[\u00A0-\uFFFF]/, + cssid: /(?:(?!-?[0-9])(?:escape|nonascii|[-_a-zA-Z0-9])+)/, + qname: /^ *(cssid|\*)/, + simple: /^(?:([.#]cssid)|pseudo|attr)/, + ref: /^ *\/(cssid)\/ */, + combinator: /^(?: +([^ \w*.#\\]) +|( )+|([^ \w*.#\\]))(?! *$)/, + attr: /^\[(cssid)(?:([^\w]?=)(inside))?\]/, + pseudo: /^(:cssid)(?:\((inside)\))?/, + inside: /(?:"(?:\\"|[^"])*"|'(?:\\'|[^'])*'|<[^"'>]*>|\\["'>]|[^"'>])*/, + ident: /^(cssid)$/ +}; + +rules.cssid = replace(rules.cssid, 'nonascii', rules.nonascii); +rules.cssid = replace(rules.cssid, 'escape', rules.escape); +rules.qname = replace(rules.qname, 'cssid', rules.cssid); +rules.simple = replace(rules.simple, 'cssid', rules.cssid); +rules.ref = replace(rules.ref, 'cssid', rules.cssid); +rules.attr = replace(rules.attr, 'cssid', rules.cssid); +rules.pseudo = replace(rules.pseudo, 'cssid', rules.cssid); +rules.inside = replace(rules.inside, '[^"\'>]*', rules.inside); +rules.attr = replace(rules.attr, 'inside', makeInside('\\[', '\\]')); +rules.pseudo = replace(rules.pseudo, 'inside', makeInside('\\(', '\\)')); +rules.simple = replace(rules.simple, 'pseudo', rules.pseudo); +rules.simple = replace(rules.simple, 'attr', rules.attr); +rules.ident = replace(rules.ident, 'cssid', rules.cssid); +rules.str_escape = replace(rules.str_escape, 'escape', rules.escape); + +/** + * Compiling + */ + +var compile = function(sel_) { + var sel = sel_.replace(/^\s+|\s+$/g, '') + , test + , filter = [] + , buff = [] + , subject + , qname + , cap + , op + , ref; + + /*jshint -W084 */ + while (sel) { + if (cap = rules.qname.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = decodeid(cap[1]); + buff.push(tok(qname, true)); + } else if (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + qname = '*'; + buff.push(tok(qname, true)); + buff.push(tok(cap)); + } else { + throw new SyntaxError('Invalid selector.'); + } + + while (cap = rules.simple.exec(sel)) { + sel = sel.substring(cap[0].length); + buff.push(tok(cap)); + } + + if (sel[0] === '!') { + sel = sel.substring(1); + subject = makeSubject(); + subject.qname = qname; + buff.push(subject.simple); + } + + if (cap = rules.ref.exec(sel)) { + sel = sel.substring(cap[0].length); + ref = combinators.ref(makeSimple(buff), decodeid(cap[1])); + filter.push(ref.combinator); + buff = []; + continue; + } + + if (cap = rules.combinator.exec(sel)) { + sel = sel.substring(cap[0].length); + op = cap[1] || cap[2] || cap[3]; + if (op === ',') { + filter.push(combinators.noop(makeSimple(buff))); + break; + } + } else { + op = 'noop'; + } + + if (!combinators[op]) { throw new SyntaxError('Bad combinator.'); } + filter.push(combinators[op](makeSimple(buff))); + buff = []; + } + + test = makeTest(filter); + test.qname = qname; + test.sel = sel; + + if (subject) { + subject.lname = test.qname; + + subject.test = test; + subject.qname = subject.qname; + subject.sel = test.sel; + test = subject; + } + + if (ref) { + ref.test = test; + ref.qname = test.qname; + ref.sel = test.sel; + test = ref; + } + + return test; +}; + +var tok = function(cap, qname) { + // qname + if (qname) { + return cap === '*' + ? selectors['*'] + : selectors.type(cap); + } + + // class/id + if (cap[1]) { + return cap[1][0] === '.' + // XXX unescape here? or in attr? + ? selectors.attr('class', '~=', decodeid(cap[1].substring(1)), false) + : selectors.attr('id', '=', decodeid(cap[1].substring(1)), false); + } + + // pseudo-name + // inside-pseudo + if (cap[2]) { + return cap[3] + ? selectors[decodeid(cap[2])](unquote(cap[3])) + : selectors[decodeid(cap[2])]; + } + + // attr name + // attr op + // attr value + if (cap[4]) { + var value = cap[6]; + var i = /["'\s]\s*I$/i.test(value); + if (i) { + value = value.replace(/\s*I$/i, ''); + } + return selectors.attr(decodeid(cap[4]), cap[5] || '-', unquote(value), i); + } + + throw new SyntaxError('Unknown Selector.'); +}; + +var makeSimple = function(func) { + var l = func.length + , i; + + // Potentially make sure + // `el` is truthy. + if (l < 2) return func[0]; + + return function(el) { + if (!el) return; + for (i = 0; i < l; i++) { + if (!func[i](el)) return; + } + return true; + }; +}; + +var makeTest = function(func) { + if (func.length < 2) { + return function(el) { + return !!func[0](el); + }; + } + return function(el) { + var i = func.length; + while (i--) { + if (!(el = func[i](el))) return; + } + return true; + }; +}; + +var makeSubject = function() { + var target; + + function subject(el) { + var node = el.ownerDocument + , scope = node.getElementsByTagName(subject.lname) + , i = scope.length; + + while (i--) { + if (subject.test(scope[i]) && target === el) { + target = null; + return true; + } + } + + target = null; + } + + subject.simple = function(el) { + target = el; + return true; + }; + + return subject; +}; + +var compileGroup = function(sel) { + var test = compile(sel) + , tests = [ test ]; + + while (test.sel) { + test = compile(test.sel); + tests.push(test); + } + + if (tests.length < 2) return test; + + return function(el) { + var l = tests.length + , i = 0; + + for (; i < l; i++) { + if (tests[i](el)) return true; + } + }; +}; + +/** + * Selection + */ + +var find = function(sel, node) { + var results = [] + , test = compile(sel) + , scope = node.getElementsByTagName(test.qname) + , i = 0 + , el; + + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el)) results.push(el); + } + + if (test.sel) { + while (test.sel) { + test = compile(test.sel); + scope = node.getElementsByTagName(test.qname); + i = 0; + /*jshint -W084 */ + while (el = scope[i++]) { + if (test(el) && indexOf.call(results, el) === -1) { + results.push(el); + } + } + } + results.sort(order); + } + + return results; +}; + +/** + * Expose + */ + +module.exports = exports = function(sel, context) { + /* when context isn't a DocumentFragment and the selector is simple: */ + var id, r; + if (context.nodeType !== 11 && sel.indexOf(' ') === -1) { + if (sel[0] === '#' && context.rooted && /^#[A-Z_][-A-Z0-9_]*$/i.test(sel)) { + if (context.doc._hasMultipleElementsWithId) { + id = sel.substring(1); + if (!context.doc._hasMultipleElementsWithId(id)) { + r = context.doc.getElementById(id); + return r ? [r] : []; + } + } + } + if (sel[0] === '.' && /^\.\w+$/.test(sel)) { + return context.getElementsByClassName(sel.substring(1)); + } + if (/^\w+$/.test(sel)) { + return context.getElementsByTagName(sel); + } + } + /* do things the hard/slow way */ + return find(sel, context); +}; + +exports.selectors = selectors; +exports.operators = operators; +exports.combinators = combinators; + +exports.matches = function(el, sel) { + var test = { sel: sel }; + do { + test = compile(test.sel); + if (test(el)) { return true; } + } while (test.sel); + return false; +}; + + +/***/ }), + +/***/ 23929: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * @license + * Copyright Google LLC All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +// The below is a compiled copy of https://github.com/angular/angular/blob/92e41e9cb417223d9888a4c23b4c0e73188f87d0/packages/compiler/src/render3/view/style_parser.ts + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hyphenate = exports.parse = void 0; +/** + * Parses string representation of a style and converts it into object literal. + * + * @param value string representation of style as used in the `style` attribute in HTML. + * Example: `color: red; height: auto`. + * @returns An array of style property name and value pairs, e.g. `['color', 'red', 'height', + * 'auto']` + */ +function parse(value) { + // we use a string array here instead of a string map + // because a string-map is not guaranteed to retain the + // order of the entries whereas a string array can be + // constructed in a [key, value, key, value] format. + const styles = []; + let i = 0; + let parenDepth = 0; + let quote = 0; /* Char.QuoteNone */ + let valueStart = 0; + let propStart = 0; + let currentProp = null; + while (i < value.length) { + const token = value.charCodeAt(i++); + switch (token) { + case 40 /* Char.OpenParen */: + parenDepth++; + break; + case 41 /* Char.CloseParen */: + parenDepth--; + break; + case 39 /* Char.QuoteSingle */: + // valueStart needs to be there since prop values don't + // have quotes in CSS + if (quote === 0 /* Char.QuoteNone */) { + quote = 39 /* Char.QuoteSingle */; + } else if ( + quote === 39 /* Char.QuoteSingle */ && + value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */ + ) { + quote = 0 /* Char.QuoteNone */; + } + break; + case 34 /* Char.QuoteDouble */: + // same logic as above + if (quote === 0 /* Char.QuoteNone */) { + quote = 34 /* Char.QuoteDouble */; + } else if ( + quote === 34 /* Char.QuoteDouble */ && + value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */ + ) { + quote = 0 /* Char.QuoteNone */; + } + break; + case 58 /* Char.Colon */: + if ( + !currentProp && + parenDepth === 0 && + quote === 0 /* Char.QuoteNone */ + ) { + currentProp = hyphenate(value.substring(propStart, i - 1).trim()); + valueStart = i; + } + break; + case 59 /* Char.Semicolon */: + if ( + currentProp && + valueStart > 0 && + parenDepth === 0 && + quote === 0 /* Char.QuoteNone */ + ) { + const styleVal = value.substring(valueStart, i - 1).trim(); + styles.push(currentProp, styleVal); + propStart = i; + valueStart = 0; + currentProp = null; + } + break; + } + } + if (currentProp && valueStart) { + const styleVal = value.slice(valueStart).trim(); + styles.push(currentProp, styleVal); + } + return styles; +} +exports.parse = parse; +function hyphenate(value) { + return value + .replace(/[a-z][A-Z]/g, (v) => { + return v.charAt(0) + "-" + v.charAt(1); + }) + .toLowerCase(); +} +exports.hyphenate = hyphenate; + + +/***/ }), + +/***/ 50380: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var Element = __webpack_require__(67262); +var defineElement = __webpack_require__(47679); +var utils = __webpack_require__(91995); +var CSSStyleDeclaration = __webpack_require__(36142); + +var svgElements = exports.elements = {}; +var svgNameToImpl = Object.create(null); + +exports.createElement = function(doc, localName, prefix) { + var impl = svgNameToImpl[localName] || SVGElement; + return new impl(doc, localName, prefix); +}; + +function define(spec) { + return defineElement(spec, SVGElement, svgElements, svgNameToImpl); +} + +var SVGElement = define({ + superclass: Element, + name: 'SVGElement', + ctor: function SVGElement(doc, localName, prefix) { + Element.call(this, doc, localName, utils.NAMESPACE.SVG, prefix); + }, + props: { + style: { get: function() { + if (!this._style) + this._style = new CSSStyleDeclaration(this); + return this._style; + }} + } +}); + +define({ + name: 'SVGSVGElement', + ctor: function SVGSVGElement(doc, localName, prefix) { + SVGElement.call(this, doc, localName, prefix); + }, + tag: 'svg', + props: { + createSVGRect: { value: function () { + return exports.createElement(this.ownerDocument, 'rect', null); + } } + } +}); + +define({ + tags: [ + 'a', 'altGlyph', 'altGlyphDef', 'altGlyphItem', 'animate', 'animateColor', 'animateMotion', 'animateTransform', + 'circle', 'clipPath', 'color-profile', 'cursor', 'defs', 'desc', 'ellipse', 'feBlend', 'feColorMatrix', + 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', + 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', + 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence', 'filter', + 'font', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignObject', 'g', + 'glyph', 'glyphRef', 'hkern', 'image', 'line', 'linearGradient', 'marker', 'mask', 'metadata', 'missing-glyph', + 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'script', 'set', 'stop', 'style', + 'switch', 'symbol', 'text', 'textPath', 'title', 'tref', 'tspan', 'use', 'view', 'vkern' + ] +}); + + +/***/ }), + +/***/ 91995: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + +var DOMException = __webpack_require__(58149); +var ERR = DOMException; +var isApiWritable = (__webpack_require__(6978)/* .isApiWritable */ .h); + +exports.NAMESPACE = { + HTML: 'http://www.w3.org/1999/xhtml', + XML: 'http://www.w3.org/XML/1998/namespace', + XMLNS: 'http://www.w3.org/2000/xmlns/', + MATHML: 'http://www.w3.org/1998/Math/MathML', + SVG: 'http://www.w3.org/2000/svg', + XLINK: 'http://www.w3.org/1999/xlink' +}; + +// +// Shortcut functions for throwing errors of various types. +// +exports.IndexSizeError = function() { throw new DOMException(ERR.INDEX_SIZE_ERR); }; +exports.HierarchyRequestError = function() { throw new DOMException(ERR.HIERARCHY_REQUEST_ERR); }; +exports.WrongDocumentError = function() { throw new DOMException(ERR.WRONG_DOCUMENT_ERR); }; +exports.InvalidCharacterError = function() { throw new DOMException(ERR.INVALID_CHARACTER_ERR); }; +exports.NoModificationAllowedError = function() { throw new DOMException(ERR.NO_MODIFICATION_ALLOWED_ERR); }; +exports.NotFoundError = function() { throw new DOMException(ERR.NOT_FOUND_ERR); }; +exports.NotSupportedError = function() { throw new DOMException(ERR.NOT_SUPPORTED_ERR); }; +exports.InvalidStateError = function() { throw new DOMException(ERR.INVALID_STATE_ERR); }; +exports.SyntaxError = function() { throw new DOMException(ERR.SYNTAX_ERR); }; +exports.InvalidModificationError = function() { throw new DOMException(ERR.INVALID_MODIFICATION_ERR); }; +exports.NamespaceError = function() { throw new DOMException(ERR.NAMESPACE_ERR); }; +exports.InvalidAccessError = function() { throw new DOMException(ERR.INVALID_ACCESS_ERR); }; +exports.TypeMismatchError = function() { throw new DOMException(ERR.TYPE_MISMATCH_ERR); }; +exports.SecurityError = function() { throw new DOMException(ERR.SECURITY_ERR); }; +exports.NetworkError = function() { throw new DOMException(ERR.NETWORK_ERR); }; +exports.AbortError = function() { throw new DOMException(ERR.ABORT_ERR); }; +exports.UrlMismatchError = function() { throw new DOMException(ERR.URL_MISMATCH_ERR); }; +exports.QuotaExceededError = function() { throw new DOMException(ERR.QUOTA_EXCEEDED_ERR); }; +exports.TimeoutError = function() { throw new DOMException(ERR.TIMEOUT_ERR); }; +exports.InvalidNodeTypeError = function() { throw new DOMException(ERR.INVALID_NODE_TYPE_ERR); }; +exports.DataCloneError = function() { throw new DOMException(ERR.DATA_CLONE_ERR); }; + +exports.nyi = function() { + throw new Error("NotYetImplemented"); +}; + +exports.shouldOverride = function() { + throw new Error("Abstract function; should be overriding in subclass."); +}; + +exports.assert = function(expr, msg) { + if (!expr) { + throw new Error("Assertion failed: " + (msg || "") + "\n" + new Error().stack); + } +}; + +exports.expose = function(src, c) { + for (var n in src) { + Object.defineProperty(c.prototype, n, { value: src[n], writable: isApiWritable }); + } +}; + +exports.merge = function(a, b) { + for (var n in b) { + a[n] = b[n]; + } +}; + +// Compare two nodes based on their document order. This function is intended +// to be passed to sort(). Assumes that the array being sorted does not +// contain duplicates. And that all nodes are connected and comparable. +// Clever code by ppk via jeresig. +exports.documentOrder = function(n,m) { + /* jshint bitwise: false */ + return 3 - (n.compareDocumentPosition(m) & 6); +}; + +exports.toASCIILowerCase = function(s) { + return s.replace(/[A-Z]+/g, function(c) { + return c.toLowerCase(); + }); +}; + +exports.toASCIIUpperCase = function(s) { + return s.replace(/[a-z]+/g, function(c) { + return c.toUpperCase(); + }); +}; + + +/***/ }), + +/***/ 871: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// This grammar is from the XML and XML Namespace specs. It specifies whether +// a string (such as an element or attribute name) is a valid Name or QName. +// +// Name ::= NameStartChar (NameChar)* +// NameStartChar ::= ":" | [A-Z] | "_" | [a-z] | +// [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | +// [#x370-#x37D] | [#x37F-#x1FFF] | +// [#x200C-#x200D] | [#x2070-#x218F] | +// [#x2C00-#x2FEF] | [#x3001-#xD7FF] | +// [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | +// [#x10000-#xEFFFF] +// +// NameChar ::= NameStartChar | "-" | "." | [0-9] | +// #xB7 | [#x0300-#x036F] | [#x203F-#x2040] +// +// QName ::= PrefixedName| UnprefixedName +// PrefixedName ::= Prefix ':' LocalPart +// UnprefixedName ::= LocalPart +// Prefix ::= NCName +// LocalPart ::= NCName +// NCName ::= Name - (Char* ':' Char*) +// # An XML Name, minus the ":" +// + +exports.isValidName = isValidName; +exports.isValidQName = isValidQName; + +// Most names will be ASCII only. Try matching against simple regexps first +var simplename = /^[_:A-Za-z][-.:\w]+$/; +var simpleqname = /^([_A-Za-z][-.\w]+|[_A-Za-z][-.\w]+:[_A-Za-z][-.\w]+)$/; + +// If the regular expressions above fail, try more complex ones that work +// for any identifiers using codepoints from the Unicode BMP +var ncnamestartchars = "_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; +var ncnamechars = "-._A-Za-z0-9\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02ff\u0300-\u037D\u037F-\u1FFF\u200C\u200D\u203f\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD"; + +var ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +var namestartchars = ncnamestartchars + ":"; +var namechars = ncnamechars + ":"; +var name = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var qname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +// XML says that these characters are also legal: +// [#x10000-#xEFFFF]. So if the patterns above fail, and the +// target string includes surrogates, then try the following +// patterns that allow surrogates and then run an extra validation +// step to make sure that the surrogates are in valid pairs and in +// the right range. Note that since the characters \uf0000 to \u1f0000 +// are not allowed, it means that the high surrogate can only go up to +// \uDB7f instead of \uDBFF. +var hassurrogates = /[\uD800-\uDB7F\uDC00-\uDFFF]/; +var surrogatechars = /[\uD800-\uDB7F\uDC00-\uDFFF]/g; +var surrogatepairs = /[\uD800-\uDB7F][\uDC00-\uDFFF]/g; + +// Modify the variables above to allow surrogates +ncnamestartchars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncnamechars += "\uD800-\uDB7F\uDC00-\uDFFF"; +ncname = "[" + ncnamestartchars + "][" + ncnamechars + "]*"; +namestartchars = ncnamestartchars + ":"; +namechars = ncnamechars + ":"; + +// Build another set of regexps that include surrogates +var surrogatename = new RegExp("^[" + namestartchars + "]" + "[" + namechars + "]*$"); +var surrogateqname = new RegExp("^(" + ncname + "|" + ncname + ":" + ncname + ")$"); + +function isValidName(s) { + if (simplename.test(s)) return true; // Plain ASCII + if (name.test(s)) return true; // Unicode BMP + + // Maybe the tests above failed because s includes surrogate pairs + // Most likely, though, they failed for some more basic syntax problem + if (!hassurrogates.test(s)) return false; + + // Is the string a valid name if we allow surrogates? + if (!surrogatename.test(s)) return false; + + // Finally, are the surrogates all correctly paired up? + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + +function isValidQName(s) { + if (simpleqname.test(s)) return true; // Plain ASCII + if (qname.test(s)) return true; // Unicode BMP + + if (!hassurrogates.test(s)) return false; + if (!surrogateqname.test(s)) return false; + var chars = s.match(surrogatechars), pairs = s.match(surrogatepairs); + return pairs !== null && 2*pairs.length === chars.length; +} + + +/***/ }), + +/***/ 94083: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; +/* module decorator */ module = __webpack_require__.nmd(module); + + +const wrapAnsi16 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${code + offset}m`; +}; + +const wrapAnsi256 = (fn, offset) => (...args) => { + const code = fn(...args); + return `\u001B[${38 + offset};5;${code}m`; +}; + +const wrapAnsi16m = (fn, offset) => (...args) => { + const rgb = fn(...args); + return `\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`; +}; + +const ansi2ansi = n => n; +const rgb2rgb = (r, g, b) => [r, g, b]; + +const setLazyProperty = (object, property, get) => { + Object.defineProperty(object, property, { + get: () => { + const value = get(); + + Object.defineProperty(object, property, { + value, + enumerable: true, + configurable: true + }); + + return value; + }, + enumerable: true, + configurable: true + }); +}; + +/** @type {typeof import('color-convert')} */ +let colorConvert; +const makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => { + if (colorConvert === undefined) { + colorConvert = __webpack_require__(10734); + } + + const offset = isBackground ? 10 : 0; + const styles = {}; + + for (const [sourceSpace, suite] of Object.entries(colorConvert)) { + const name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace; + if (sourceSpace === targetSpace) { + styles[name] = wrap(identity, offset); + } else if (typeof suite === 'object') { + styles[name] = wrap(suite[targetSpace], offset); + } + } + + return styles; +}; + +function assembleStyles() { + const codes = new Map(); + const styles = { + modifier: { + reset: [0, 0], + // 21 isn't widely supported and 22 does the same thing + bold: [1, 22], + dim: [2, 22], + italic: [3, 23], + underline: [4, 24], + inverse: [7, 27], + hidden: [8, 28], + strikethrough: [9, 29] + }, + color: { + black: [30, 39], + red: [31, 39], + green: [32, 39], + yellow: [33, 39], + blue: [34, 39], + magenta: [35, 39], + cyan: [36, 39], + white: [37, 39], + + // Bright color + blackBright: [90, 39], + redBright: [91, 39], + greenBright: [92, 39], + yellowBright: [93, 39], + blueBright: [94, 39], + magentaBright: [95, 39], + cyanBright: [96, 39], + whiteBright: [97, 39] + }, + bgColor: { + bgBlack: [40, 49], + bgRed: [41, 49], + bgGreen: [42, 49], + bgYellow: [43, 49], + bgBlue: [44, 49], + bgMagenta: [45, 49], + bgCyan: [46, 49], + bgWhite: [47, 49], + + // Bright color + bgBlackBright: [100, 49], + bgRedBright: [101, 49], + bgGreenBright: [102, 49], + bgYellowBright: [103, 49], + bgBlueBright: [104, 49], + bgMagentaBright: [105, 49], + bgCyanBright: [106, 49], + bgWhiteBright: [107, 49] + } + }; + + // Alias bright black as gray (and grey) + styles.color.gray = styles.color.blackBright; + styles.bgColor.bgGray = styles.bgColor.bgBlackBright; + styles.color.grey = styles.color.blackBright; + styles.bgColor.bgGrey = styles.bgColor.bgBlackBright; + + for (const [groupName, group] of Object.entries(styles)) { + for (const [styleName, style] of Object.entries(group)) { + styles[styleName] = { + open: `\u001B[${style[0]}m`, + close: `\u001B[${style[1]}m` + }; + + group[styleName] = styles[styleName]; + + codes.set(style[0], style[1]); + } + + Object.defineProperty(styles, groupName, { + value: group, + enumerable: false + }); + } + + Object.defineProperty(styles, 'codes', { + value: codes, + enumerable: false + }); + + styles.color.close = '\u001B[39m'; + styles.bgColor.close = '\u001B[49m'; + + setLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false)); + setLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false)); + setLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true)); + setLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true)); + + return styles; +} + +// Make the export immutable +Object.defineProperty(module, 'exports', { + enumerable: true, + get: assembleStyles +}); + + +/***/ }), + +/***/ 21873: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +module.exports = +{ + parallel : __webpack_require__(18798), + serial : __webpack_require__(52081), + serialOrdered : __webpack_require__(90028) +}; + + +/***/ }), + +/***/ 74555: +/***/ ((module) => { + +// API +module.exports = abort; + +/** + * Aborts leftover active jobs + * + * @param {object} state - current state object + */ +function abort(state) +{ + Object.keys(state.jobs).forEach(clean.bind(state)); + + // reset leftover jobs + state.jobs = {}; +} + +/** + * Cleans up leftover job by invoking abort function for the provided job id + * + * @this state + * @param {string|number} key - job id to abort + */ +function clean(key) +{ + if (typeof this.jobs[key] == 'function') + { + this.jobs[key](); + } +} + + +/***/ }), + +/***/ 72313: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var defer = __webpack_require__(70405); + +// API +module.exports = async; + +/** + * Runs provided callback asynchronously + * even if callback itself is not + * + * @param {function} callback - callback to invoke + * @returns {function} - augmented callback + */ +function async(callback) +{ + var isAsync = false; + + // check if async happened + defer(function() { isAsync = true; }); + + return function async_callback(err, result) + { + if (isAsync) + { + callback(err, result); + } + else + { + defer(function nextTick_callback() + { + callback(err, result); + }); + } + }; +} + + +/***/ }), + +/***/ 70405: +/***/ ((module) => { + +module.exports = defer; + +/** + * Runs provided function on next iteration of the event loop + * + * @param {function} fn - function to run + */ +function defer(fn) +{ + var nextTick = typeof setImmediate == 'function' + ? setImmediate + : ( + typeof process == 'object' && typeof process.nextTick == 'function' + ? process.nextTick + : null + ); + + if (nextTick) + { + nextTick(fn); + } + else + { + setTimeout(fn, 0); + } +} + + +/***/ }), + +/***/ 78051: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var async = __webpack_require__(72313) + , abort = __webpack_require__(74555) + ; + +// API +module.exports = iterate; + +/** + * Iterates over each job object + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {object} state - current job status + * @param {function} callback - invoked when all elements processed + */ +function iterate(list, iterator, state, callback) +{ + // store current index + var key = state['keyedList'] ? state['keyedList'][state.index] : state.index; + + state.jobs[key] = runJob(iterator, key, list[key], function(error, output) + { + // don't repeat yourself + // skip secondary callbacks + if (!(key in state.jobs)) + { + return; + } + + // clean up jobs + delete state.jobs[key]; + + if (error) + { + // don't process rest of the results + // stop still active jobs + // and reset the list + abort(state); + } + else + { + state.results[key] = output; + } + + // return salvaged results + callback(error, state.results); + }); +} + +/** + * Runs iterator over provided job element + * + * @param {function} iterator - iterator to invoke + * @param {string|number} key - key/index of the element in the list of jobs + * @param {mixed} item - job description + * @param {function} callback - invoked after iterator is done with the job + * @returns {function|mixed} - job abort function or something else + */ +function runJob(iterator, key, item, callback) +{ + var aborter; + + // allow shortcut if iterator expects only two arguments + if (iterator.length == 2) + { + aborter = iterator(item, async(callback)); + } + // otherwise go with full three arguments + else + { + aborter = iterator(item, key, async(callback)); + } + + return aborter; +} + + +/***/ }), + +/***/ 19500: +/***/ ((module) => { + +// API +module.exports = state; + +/** + * Creates initial state object + * for iteration over list + * + * @param {array|object} list - list to iterate over + * @param {function|null} sortMethod - function to use for keys sort, + * or `null` to keep them as is + * @returns {object} - initial state object + */ +function state(list, sortMethod) +{ + var isNamedList = !Array.isArray(list) + , initState = + { + index : 0, + keyedList: isNamedList || sortMethod ? Object.keys(list) : null, + jobs : {}, + results : isNamedList ? {} : [], + size : isNamedList ? Object.keys(list).length : list.length + } + ; + + if (sortMethod) + { + // sort array keys based on it's values + // sort object's keys just on own merit + initState.keyedList.sort(isNamedList ? sortMethod : function(a, b) + { + return sortMethod(list[a], list[b]); + }); + } + + return initState; +} + + +/***/ }), + +/***/ 26276: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var abort = __webpack_require__(74555) + , async = __webpack_require__(72313) + ; + +// API +module.exports = terminator; + +/** + * Terminates jobs in the attached state context + * + * @this AsyncKitState# + * @param {function} callback - final callback to invoke after termination + */ +function terminator(callback) +{ + if (!Object.keys(this.jobs).length) + { + return; + } + + // fast forward iteration index + this.index = this.size; + + // abort jobs + abort(this); + + // send back results we have so far + async(callback)(null, this.results); +} + + +/***/ }), + +/***/ 18798: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var iterate = __webpack_require__(78051) + , initState = __webpack_require__(19500) + , terminator = __webpack_require__(26276) + ; + +// Public API +module.exports = parallel; + +/** + * Runs iterator over provided array elements in parallel + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function parallel(list, iterator, callback) +{ + var state = initState(list); + + while (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, function(error, result) + { + if (error) + { + callback(error, result); + return; + } + + // looks like it's the last one + if (Object.keys(state.jobs).length === 0) + { + callback(null, state.results); + return; + } + }); + + state.index++; + } + + return terminator.bind(state, callback); +} + + +/***/ }), + +/***/ 52081: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var serialOrdered = __webpack_require__(90028); + +// Public API +module.exports = serial; + +/** + * Runs iterator over provided array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serial(list, iterator, callback) +{ + return serialOrdered(list, iterator, null, callback); +} + + +/***/ }), + +/***/ 90028: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var iterate = __webpack_require__(78051) + , initState = __webpack_require__(19500) + , terminator = __webpack_require__(26276) + ; + +// Public API +module.exports = serialOrdered; +// sorting helpers +module.exports.ascending = ascending; +module.exports.descending = descending; + +/** + * Runs iterator over provided sorted array elements in series + * + * @param {array|object} list - array or object (named list) to iterate over + * @param {function} iterator - iterator to run + * @param {function} sortMethod - custom sort function + * @param {function} callback - invoked when all elements processed + * @returns {function} - jobs terminator + */ +function serialOrdered(list, iterator, sortMethod, callback) +{ + var state = initState(list, sortMethod); + + iterate(list, iterator, state, function iteratorHandler(error, result) + { + if (error) + { + callback(error, result); + return; + } + + state.index++; + + // are we there yet? + if (state.index < (state['keyedList'] || list).length) + { + iterate(list, iterator, state, iteratorHandler); + return; + } + + // done here + callback(null, state.results); + }); + + return terminator.bind(state, callback); +} + +/* + * -- Sort methods + */ + +/** + * sort helper to sort array elements in ascending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function ascending(a, b) +{ + return a < b ? -1 : a > b ? 1 : 0; +} + +/** + * sort helper to sort array elements in descending order + * + * @param {mixed} a - an item to compare + * @param {mixed} b - an item to compare + * @returns {number} - comparison result + */ +function descending(a, b) +{ + return -1 * ascending(a, b); +} + + +/***/ }), + +/***/ 8505: +/***/ ((module) => { + +"use strict"; + +module.exports = balanced; +function balanced(a, b, str) { + if (a instanceof RegExp) a = maybeMatch(a, str); + if (b instanceof RegExp) b = maybeMatch(b, str); + + var r = range(a, b, str); + + return r && { + start: r[0], + end: r[1], + pre: str.slice(0, r[0]), + body: str.slice(r[0] + a.length, r[1]), + post: str.slice(r[1] + b.length) + }; +} + +function maybeMatch(reg, str) { + var m = str.match(reg); + return m ? m[0] : null; +} + +balanced.range = range; +function range(a, b, str) { + var begs, beg, left, right, result; + var ai = str.indexOf(a); + var bi = str.indexOf(b, ai + 1); + var i = ai; + + if (ai >= 0 && bi > 0) { + if(a===b) { + return [ai, bi]; + } + begs = []; + left = str.length; + + while (i >= 0 && !result) { + if (i == ai) { + begs.push(i); + ai = str.indexOf(a, i + 1); + } else if (begs.length == 1) { + result = [ begs.pop(), bi ]; + } else { + beg = begs.pop(); + if (beg < left) { + left = beg; + right = bi; + } + + bi = str.indexOf(b, i + 1); + } + + i = ai < bi && ai >= 0 ? ai : bi; + } + + if (begs.length) { + result = [ left, right ]; + } + } + + return result; +} + + +/***/ }), + +/***/ 13144: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var bind = __webpack_require__(66743); + +var $apply = __webpack_require__(11002); +var $call = __webpack_require__(10076); +var $reflectApply = __webpack_require__(47119); + +/** @type {import('./actualApply')} */ +module.exports = $reflectApply || bind.call($call, $apply); + + +/***/ }), + +/***/ 11002: +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./functionApply')} */ +module.exports = Function.prototype.apply; + + +/***/ }), + +/***/ 10076: +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./functionCall')} */ +module.exports = Function.prototype.call; + + +/***/ }), + +/***/ 73126: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var bind = __webpack_require__(66743); +var $TypeError = __webpack_require__(69675); + +var $call = __webpack_require__(10076); +var $actualApply = __webpack_require__(13144); + +/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */ +module.exports = function callBindBasic(args) { + if (args.length < 1 || typeof args[0] !== 'function') { + throw new $TypeError('a function is required'); + } + return $actualApply(bind, $call, args); +}; + + +/***/ }), + +/***/ 47119: +/***/ ((module) => { + +"use strict"; + + +/** @type {import('./reflectApply')} */ +module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply; + + +/***/ }), + +/***/ 55248: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + +const ansiStyles = __webpack_require__(94083); +const {stdout: stdoutColor, stderr: stderrColor} = __webpack_require__(27687); +const { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +} = __webpack_require__(4058); + +// `supportsColor.level` → `ansiStyles.color[name]` mapping +const levelMapping = [ + 'ansi', + 'ansi', + 'ansi256', + 'ansi16m' +]; + +const styles = Object.create(null); + +const applyOptions = (object, options = {}) => { + if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) { + throw new Error('The `level` option should be an integer from 0 to 3'); + } + + // Detect level if not set manually + const colorLevel = stdoutColor ? stdoutColor.level : 0; + object.level = options.level === undefined ? colorLevel : options.level; +}; + +class ChalkClass { + constructor(options) { + // eslint-disable-next-line no-constructor-return + return chalkFactory(options); + } +} + +const chalkFactory = options => { + const chalk = {}; + applyOptions(chalk, options); + + chalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_); + + Object.setPrototypeOf(chalk, Chalk.prototype); + Object.setPrototypeOf(chalk.template, chalk); + + chalk.template.constructor = () => { + throw new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.'); + }; + + chalk.template.Instance = ChalkClass; + + return chalk.template; +}; + +function Chalk(options) { + return chalkFactory(options); +} + +for (const [styleName, style] of Object.entries(ansiStyles)) { + styles[styleName] = { + get() { + const builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty); + Object.defineProperty(this, styleName, {value: builder}); + return builder; + } + }; +} + +styles.visible = { + get() { + const builder = createBuilder(this, this._styler, true); + Object.defineProperty(this, 'visible', {value: builder}); + return builder; + } +}; + +const usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256']; + +for (const model of usedModels) { + styles[model] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} + +for (const model of usedModels) { + const bgModel = 'bg' + model[0].toUpperCase() + model.slice(1); + styles[bgModel] = { + get() { + const {level} = this; + return function (...arguments_) { + const styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler); + return createBuilder(this, styler, this._isEmpty); + }; + } + }; +} + +const proto = Object.defineProperties(() => {}, { + ...styles, + level: { + enumerable: true, + get() { + return this._generator.level; + }, + set(level) { + this._generator.level = level; + } + } +}); + +const createStyler = (open, close, parent) => { + let openAll; + let closeAll; + if (parent === undefined) { + openAll = open; + closeAll = close; + } else { + openAll = parent.openAll + open; + closeAll = close + parent.closeAll; + } + + return { + open, + close, + openAll, + closeAll, + parent + }; +}; + +const createBuilder = (self, _styler, _isEmpty) => { + const builder = (...arguments_) => { + // Single argument is hot path, implicit coercion is faster than anything + // eslint-disable-next-line no-implicit-coercion + return applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' ')); + }; + + // We alter the prototype because we must return a function, but there is + // no way to create a function with a different prototype + Object.setPrototypeOf(builder, proto); + + builder._generator = self; + builder._styler = _styler; + builder._isEmpty = _isEmpty; + + return builder; +}; + +const applyStyle = (self, string) => { + if (self.level <= 0 || !string) { + return self._isEmpty ? '' : string; + } + + let styler = self._styler; + + if (styler === undefined) { + return string; + } + + const {openAll, closeAll} = styler; + if (string.indexOf('\u001B') !== -1) { + while (styler !== undefined) { + // Replace any instances already present with a re-opening code + // otherwise only the part of the string until said closing code + // will be colored, and the rest will simply be 'plain'. + string = stringReplaceAll(string, styler.close, styler.open); + + styler = styler.parent; + } + } + + // We can move both next actions out of loop, because remaining actions in loop won't have + // any/visible effect on parts we add here. Close the styling before a linebreak and reopen + // after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92 + const lfIndex = string.indexOf('\n'); + if (lfIndex !== -1) { + string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex); + } + + return openAll + string + closeAll; +}; + +let template; +const chalkTag = (chalk, ...strings) => { + const [firstString] = strings; + + if (!Array.isArray(firstString)) { + // If chalk() was called by itself or with a string, + // return the string itself as a string. + return strings.join(' '); + } + + const arguments_ = strings.slice(1); + const parts = [firstString.raw[0]]; + + for (let i = 1; i < firstString.length; i++) { + parts.push( + String(arguments_[i - 1]).replace(/[{}\\]/g, '\\$&'), + String(firstString.raw[i]) + ); + } + + if (template === undefined) { + template = __webpack_require__(12991); + } + + return template(chalk, parts.join('')); +}; + +Object.defineProperties(Chalk.prototype, styles); + +const chalk = Chalk(); // eslint-disable-line new-cap +chalk.supportsColor = stdoutColor; +chalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap +chalk.stderr.supportsColor = stderrColor; + +module.exports = chalk; + + +/***/ }), + +/***/ 12991: +/***/ ((module) => { + +"use strict"; + +const TEMPLATE_REGEX = /(?:\\(u(?:[a-f\d]{4}|\{[a-f\d]{1,6}\})|x[a-f\d]{2}|.))|(?:\{(~)?(\w+(?:\([^)]*\))?(?:\.\w+(?:\([^)]*\))?)*)(?:[ \t]|(?=\r?\n)))|(\})|((?:.|[\r\n\f])+?)/gi; +const STYLE_REGEX = /(?:^|\.)(\w+)(?:\(([^)]*)\))?/g; +const STRING_REGEX = /^(['"])((?:\\.|(?!\1)[^\\])*)\1$/; +const ESCAPE_REGEX = /\\(u(?:[a-f\d]{4}|{[a-f\d]{1,6}})|x[a-f\d]{2}|.)|([^\\])/gi; + +const ESCAPES = new Map([ + ['n', '\n'], + ['r', '\r'], + ['t', '\t'], + ['b', '\b'], + ['f', '\f'], + ['v', '\v'], + ['0', '\0'], + ['\\', '\\'], + ['e', '\u001B'], + ['a', '\u0007'] +]); + +function unescape(c) { + const u = c[0] === 'u'; + const bracket = c[1] === '{'; + + if ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) { + return String.fromCharCode(parseInt(c.slice(1), 16)); + } + + if (u && bracket) { + return String.fromCodePoint(parseInt(c.slice(2, -1), 16)); + } + + return ESCAPES.get(c) || c; +} + +function parseArguments(name, arguments_) { + const results = []; + const chunks = arguments_.trim().split(/\s*,\s*/g); + let matches; + + for (const chunk of chunks) { + const number = Number(chunk); + if (!Number.isNaN(number)) { + results.push(number); + } else if ((matches = chunk.match(STRING_REGEX))) { + results.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character)); + } else { + throw new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`); + } + } + + return results; +} + +function parseStyle(style) { + STYLE_REGEX.lastIndex = 0; + + const results = []; + let matches; + + while ((matches = STYLE_REGEX.exec(style)) !== null) { + const name = matches[1]; + + if (matches[2]) { + const args = parseArguments(name, matches[2]); + results.push([name].concat(args)); + } else { + results.push([name]); + } + } + + return results; +} + +function buildStyle(chalk, styles) { + const enabled = {}; + + for (const layer of styles) { + for (const style of layer.styles) { + enabled[style[0]] = layer.inverse ? null : style.slice(1); + } + } + + let current = chalk; + for (const [styleName, styles] of Object.entries(enabled)) { + if (!Array.isArray(styles)) { + continue; + } + + if (!(styleName in current)) { + throw new Error(`Unknown Chalk style: ${styleName}`); + } + + current = styles.length > 0 ? current[styleName](...styles) : current[styleName]; + } + + return current; +} + +module.exports = (chalk, temporary) => { + const styles = []; + const chunks = []; + let chunk = []; + + // eslint-disable-next-line max-params + temporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => { + if (escapeCharacter) { + chunk.push(unescape(escapeCharacter)); + } else if (style) { + const string = chunk.join(''); + chunk = []; + chunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string)); + styles.push({inverse, styles: parseStyle(style)}); + } else if (close) { + if (styles.length === 0) { + throw new Error('Found extraneous } in Chalk template literal'); + } + + chunks.push(buildStyle(chalk, styles)(chunk.join(''))); + chunk = []; + styles.pop(); + } else { + chunk.push(character); + } + }); + + chunks.push(chunk.join('')); + + if (styles.length > 0) { + const errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\`}\`)`; + throw new Error(errMessage); + } + + return chunks.join(''); +}; + + +/***/ }), + +/***/ 4058: +/***/ ((module) => { + +"use strict"; + + +const stringReplaceAll = (string, substring, replacer) => { + let index = string.indexOf(substring); + if (index === -1) { + return string; + } + + const substringLength = substring.length; + let endIndex = 0; + let returnValue = ''; + do { + returnValue += string.substr(endIndex, index - endIndex) + substring + replacer; + endIndex = index + substringLength; + index = string.indexOf(substring, endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +const stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => { + let endIndex = 0; + let returnValue = ''; + do { + const gotCR = string[index - 1] === '\r'; + returnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\r\n' : '\n') + postfix; + endIndex = index + 1; + index = string.indexOf('\n', endIndex); + } while (index !== -1); + + returnValue += string.substr(endIndex); + return returnValue; +}; + +module.exports = { + stringReplaceAll, + stringEncaseCRLFWithFirstIndex +}; + + +/***/ }), + +/***/ 48917: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (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 __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.supportsLanguage = exports.listLanguages = exports.highlight = void 0; +var hljs = __importStar(__webpack_require__(50948)); +var parse5 = __importStar(__webpack_require__(62470)); +var parse5_htmlparser2_tree_adapter_1 = __importDefault(__webpack_require__(31191)); +var theme_1 = __webpack_require__(92332); +function colorizeNode(node, theme, context) { + if (theme === void 0) { theme = {}; } + switch (node.type) { + case 'text': { + var text = node.data; + if (context === undefined) { + return (theme.default || theme_1.DEFAULT_THEME.default || theme_1.plain)(text); + } + return text; + } + case 'tag': { + var hljsClass = /hljs-(\w+)/.exec(node.attribs.class); + if (hljsClass) { + var token_1 = hljsClass[1]; + var nodeData = node.childNodes + .map(function (node) { return colorizeNode(node, theme, token_1); }) + .join(''); + return (theme[token_1] || theme_1.DEFAULT_THEME[token_1] || theme_1.plain)(nodeData); + } + // Return the data itself when the class name isn't prefixed with a highlight.js token prefix. + // This is common in instances of sublanguages (JSX, Markdown Code Blocks, etc.) + return node.childNodes.map(function (node) { return colorizeNode(node, theme); }).join(''); + } + } + throw new Error('Invalid node type ' + node.type); +} +function colorize(code, theme) { + if (theme === void 0) { theme = {}; } + var fragment = parse5.parseFragment(code, { + treeAdapter: parse5_htmlparser2_tree_adapter_1.default, + }); + return fragment.childNodes.map(function (node) { return colorizeNode(node, theme); }).join(''); +} +/** + * Apply syntax highlighting to `code` with ASCII color codes. The language is automatically + * detected if not set. + * + * ```ts + * import {highlight} from 'cli-highlight'; + * import * as fs from 'fs'; + * + * fs.readFile('package.json', 'utf8', (err: any, json: string) => { + * console.log('package.json:'); + * console.log(highlight(json)); + * }); + * ``` + * + * @param code The code to highlight + * @param options Optional options + */ +function highlight(code, options) { + if (options === void 0) { options = {}; } + var html; + if (options.language) { + html = hljs.highlight(code, { language: options.language, ignoreIllegals: options.ignoreIllegals }).value; + } + else { + html = hljs.highlightAuto(code, options.languageSubset).value; + } + return colorize(html, options.theme); +} +exports.highlight = highlight; +/** + * Returns all supported languages + */ +function listLanguages() { + return hljs.listLanguages(); +} +exports.listLanguages = listLanguages; +/** + * Returns true if the language is supported + * @param name A language name, alias or file extension + */ +function supportsLanguage(name) { + return !!hljs.getLanguage(name); +} +exports.supportsLanguage = supportsLanguage; +exports["default"] = highlight; +__exportStar(__webpack_require__(92332), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 92332: +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parse = exports.stringify = exports.toJson = exports.fromJson = exports.DEFAULT_THEME = exports.plain = void 0; +var chalk_1 = __importDefault(__webpack_require__(55248)); +/** + * Identity function for tokens that should not be styled (returns the input string as-is). + * See [[Theme]] for an example. + */ +var plain = function (codePart) { return codePart; }; +exports.plain = plain; +/** + * The default theme. It is possible to override just individual keys. + */ +exports.DEFAULT_THEME = { + /** + * keyword in a regular Algol-style language + */ + keyword: chalk_1.default.blue, + /** + * built-in or library object (constant, class, function) + */ + built_in: chalk_1.default.cyan, + /** + * user-defined type in a language with first-class syntactically significant types, like + * Haskell + */ + type: chalk_1.default.cyan.dim, + /** + * special identifier for a built-in value ("true", "false", "null") + */ + literal: chalk_1.default.blue, + /** + * number, including units and modifiers, if any. + */ + number: chalk_1.default.green, + /** + * literal regular expression + */ + regexp: chalk_1.default.red, + /** + * literal string, character + */ + string: chalk_1.default.red, + /** + * parsed section inside a literal string + */ + subst: exports.plain, + /** + * symbolic constant, interned string, goto label + */ + symbol: exports.plain, + /** + * class or class-level declaration (interfaces, traits, modules, etc) + */ + class: chalk_1.default.blue, + /** + * function or method declaration + */ + function: chalk_1.default.yellow, + /** + * name of a class or a function at the place of declaration + */ + title: exports.plain, + /** + * block of function arguments (parameters) at the place of declaration + */ + params: exports.plain, + /** + * comment + */ + comment: chalk_1.default.green, + /** + * documentation markup within comments + */ + doctag: chalk_1.default.green, + /** + * flags, modifiers, annotations, processing instructions, preprocessor directive, etc + */ + meta: chalk_1.default.grey, + /** + * keyword or built-in within meta construct + */ + 'meta-keyword': exports.plain, + /** + * string within meta construct + */ + 'meta-string': exports.plain, + /** + * heading of a section in a config file, heading in text markup + */ + section: exports.plain, + /** + * XML/HTML tag + */ + tag: chalk_1.default.grey, + /** + * name of an XML tag, the first word in an s-expression + */ + name: chalk_1.default.blue, + /** + * s-expression name from the language standard library + */ + 'builtin-name': exports.plain, + /** + * name of an attribute with no language defined semantics (keys in JSON, setting names in + * .ini), also sub-attribute within another highlighted object, like XML tag + */ + attr: chalk_1.default.cyan, + /** + * name of an attribute followed by a structured value part, like CSS properties + */ + attribute: exports.plain, + /** + * variable in a config or a template file, environment var expansion in a script + */ + variable: exports.plain, + /** + * list item bullet in text markup + */ + bullet: exports.plain, + /** + * code block in text markup + */ + code: exports.plain, + /** + * emphasis in text markup + */ + emphasis: chalk_1.default.italic, + /** + * strong emphasis in text markup + */ + strong: chalk_1.default.bold, + /** + * mathematical formula in text markup + */ + formula: exports.plain, + /** + * hyperlink in text markup + */ + link: chalk_1.default.underline, + /** + * quotation in text markup + */ + quote: exports.plain, + /** + * tag selector in CSS + */ + 'selector-tag': exports.plain, + /** + * #id selector in CSS + */ + 'selector-id': exports.plain, + /** + * .class selector in CSS + */ + 'selector-class': exports.plain, + /** + * [attr] selector in CSS + */ + 'selector-attr': exports.plain, + /** + * :pseudo selector in CSS + */ + 'selector-pseudo': exports.plain, + /** + * tag of a template language + */ + 'template-tag': exports.plain, + /** + * variable in a template language + */ + 'template-variable': exports.plain, + /** + * added or changed line in a diff + */ + addition: chalk_1.default.green, + /** + * deleted line in a diff + */ + deletion: chalk_1.default.red, + /** + * things not matched by any token + */ + default: exports.plain, +}; +/** + * Converts a [[JsonTheme]] with string values to a [[Theme]] with formatter functions. Used by [[parse]]. + */ +function fromJson(json) { + var theme = {}; + for (var _i = 0, _a = Object.keys(json); _i < _a.length; _i++) { + var key = _a[_i]; + var style = json[key]; + if (Array.isArray(style)) { + ; + theme[key] = style.reduce(function (previous, current) { return (current === 'plain' ? exports.plain : previous[current]); }, chalk_1.default); + } + else { + ; + theme[key] = chalk_1.default[style]; + } + } + return theme; +} +exports.fromJson = fromJson; +/** + * Converts a [[Theme]] with formatter functions to a [[JsonTheme]] with string values. Used by [[stringify]]. + */ +function toJson(theme) { + var jsonTheme = {}; + for (var _i = 0, _a = Object.keys(jsonTheme); _i < _a.length; _i++) { + var key = _a[_i]; + var style = jsonTheme[key]; + jsonTheme[key] = style._styles; + } + return jsonTheme; +} +exports.toJson = toJson; +/** + * Stringifies a [[Theme]] with formatter functions to a JSON string. + * + * ```ts + * import chalk = require('chalk'); + * import {stringify} from 'cli-highlight'; + * import * as fs from 'fs'; + * + * const myTheme: Theme = { + * keyword: chalk.red.bold, + * addition: chalk.green, + * deletion: chalk.red.strikethrough, + * number: plain + * } + * const json = stringify(myTheme); + * fs.writeFile('mytheme.json', json, (err: any) => { + * if (err) throw err; + * console.log('Theme saved'); + * }); + * ``` + */ +function stringify(theme) { + return JSON.stringify(toJson(theme)); +} +exports.stringify = stringify; +/** + * Parses a JSON string into a [[Theme]] with formatter functions. + * + * ```ts + * import * as fs from 'fs'; + * import {parse, highlight} from 'cli-highlight'; + * + * fs.readFile('mytheme.json', 'utf8', (err: any, json: string) => { + * if (err) throw err; + * const code = highlight('SELECT * FROM table', {theme: parse(json)}); + * console.log(code); + * }); + * ``` + */ +function parse(json) { + return fromJson(JSON.parse(json)); +} +exports.parse = parse; +//# sourceMappingURL=theme.js.map + +/***/ }), + +/***/ 69732: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const { DOCUMENT_MODE } = __webpack_require__(7073); + +//Const +const VALID_DOCTYPE_NAME = 'html'; +const VALID_SYSTEM_ID = 'about:legacy-compat'; +const QUIRKS_MODE_SYSTEM_ID = 'http://www.ibm.com/data/dtd/v11/ibmxhtml1-transitional.dtd'; + +const QUIRKS_MODE_PUBLIC_ID_PREFIXES = [ + '+//silmaril//dtd html pro v0r11 19970101//', + '-//as//dtd html 3.0 aswedit + extensions//', + '-//advasoft ltd//dtd html 3.0 aswedit + extensions//', + '-//ietf//dtd html 2.0 level 1//', + '-//ietf//dtd html 2.0 level 2//', + '-//ietf//dtd html 2.0 strict level 1//', + '-//ietf//dtd html 2.0 strict level 2//', + '-//ietf//dtd html 2.0 strict//', + '-//ietf//dtd html 2.0//', + '-//ietf//dtd html 2.1e//', + '-//ietf//dtd html 3.0//', + '-//ietf//dtd html 3.2 final//', + '-//ietf//dtd html 3.2//', + '-//ietf//dtd html 3//', + '-//ietf//dtd html level 0//', + '-//ietf//dtd html level 1//', + '-//ietf//dtd html level 2//', + '-//ietf//dtd html level 3//', + '-//ietf//dtd html strict level 0//', + '-//ietf//dtd html strict level 1//', + '-//ietf//dtd html strict level 2//', + '-//ietf//dtd html strict level 3//', + '-//ietf//dtd html strict//', + '-//ietf//dtd html//', + '-//metrius//dtd metrius presentational//', + '-//microsoft//dtd internet explorer 2.0 html strict//', + '-//microsoft//dtd internet explorer 2.0 html//', + '-//microsoft//dtd internet explorer 2.0 tables//', + '-//microsoft//dtd internet explorer 3.0 html strict//', + '-//microsoft//dtd internet explorer 3.0 html//', + '-//microsoft//dtd internet explorer 3.0 tables//', + '-//netscape comm. corp.//dtd html//', + '-//netscape comm. corp.//dtd strict html//', + "-//o'reilly and associates//dtd html 2.0//", + "-//o'reilly and associates//dtd html extended 1.0//", + "-//o'reilly and associates//dtd html extended relaxed 1.0//", + '-//sq//dtd html 2.0 hotmetal + extensions//', + '-//softquad software//dtd hotmetal pro 6.0::19990601::extensions to html 4.0//', + '-//softquad//dtd hotmetal pro 4.0::19971010::extensions to html 4.0//', + '-//spyglass//dtd html 2.0 extended//', + '-//sun microsystems corp.//dtd hotjava html//', + '-//sun microsystems corp.//dtd hotjava strict html//', + '-//w3c//dtd html 3 1995-03-24//', + '-//w3c//dtd html 3.2 draft//', + '-//w3c//dtd html 3.2 final//', + '-//w3c//dtd html 3.2//', + '-//w3c//dtd html 3.2s draft//', + '-//w3c//dtd html 4.0 frameset//', + '-//w3c//dtd html 4.0 transitional//', + '-//w3c//dtd html experimental 19960712//', + '-//w3c//dtd html experimental 970421//', + '-//w3c//dtd w3 html//', + '-//w3o//dtd w3 html 3.0//', + '-//webtechs//dtd mozilla html 2.0//', + '-//webtechs//dtd mozilla html//' +]; + +const QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES = QUIRKS_MODE_PUBLIC_ID_PREFIXES.concat([ + '-//w3c//dtd html 4.01 frameset//', + '-//w3c//dtd html 4.01 transitional//' +]); + +const QUIRKS_MODE_PUBLIC_IDS = ['-//w3o//dtd w3 html strict 3.0//en//', '-/w3c/dtd html 4.0 transitional/en', 'html']; +const LIMITED_QUIRKS_PUBLIC_ID_PREFIXES = ['-//w3c//dtd xhtml 1.0 frameset//', '-//w3c//dtd xhtml 1.0 transitional//']; + +const LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES = LIMITED_QUIRKS_PUBLIC_ID_PREFIXES.concat([ + '-//w3c//dtd html 4.01 frameset//', + '-//w3c//dtd html 4.01 transitional//' +]); + +//Utils +function enquoteDoctypeId(id) { + const quote = id.indexOf('"') !== -1 ? "'" : '"'; + + return quote + id + quote; +} + +function hasPrefix(publicId, prefixes) { + for (let i = 0; i < prefixes.length; i++) { + if (publicId.indexOf(prefixes[i]) === 0) { + return true; + } + } + + return false; +} + +//API +exports.isConforming = function(token) { + return ( + token.name === VALID_DOCTYPE_NAME && + token.publicId === null && + (token.systemId === null || token.systemId === VALID_SYSTEM_ID) + ); +}; + +exports.getDocumentMode = function(token) { + if (token.name !== VALID_DOCTYPE_NAME) { + return DOCUMENT_MODE.QUIRKS; + } + + const systemId = token.systemId; + + if (systemId && systemId.toLowerCase() === QUIRKS_MODE_SYSTEM_ID) { + return DOCUMENT_MODE.QUIRKS; + } + + let publicId = token.publicId; + + if (publicId !== null) { + publicId = publicId.toLowerCase(); + + if (QUIRKS_MODE_PUBLIC_IDS.indexOf(publicId) > -1) { + return DOCUMENT_MODE.QUIRKS; + } + + let prefixes = systemId === null ? QUIRKS_MODE_NO_SYSTEM_ID_PUBLIC_ID_PREFIXES : QUIRKS_MODE_PUBLIC_ID_PREFIXES; + + if (hasPrefix(publicId, prefixes)) { + return DOCUMENT_MODE.QUIRKS; + } + + prefixes = + systemId === null ? LIMITED_QUIRKS_PUBLIC_ID_PREFIXES : LIMITED_QUIRKS_WITH_SYSTEM_ID_PUBLIC_ID_PREFIXES; + + if (hasPrefix(publicId, prefixes)) { + return DOCUMENT_MODE.LIMITED_QUIRKS; + } + } + + return DOCUMENT_MODE.NO_QUIRKS; +}; + +exports.serializeContent = function(name, publicId, systemId) { + let str = '!DOCTYPE '; + + if (name) { + str += name; + } + + if (publicId) { + str += ' PUBLIC ' + enquoteDoctypeId(publicId); + } else if (systemId) { + str += ' SYSTEM'; + } + + if (systemId !== null) { + str += ' ' + enquoteDoctypeId(systemId); + } + + return str; +}; + + +/***/ }), + +/***/ 77219: +/***/ ((module) => { + +"use strict"; + + +module.exports = { + controlCharacterInInputStream: 'control-character-in-input-stream', + noncharacterInInputStream: 'noncharacter-in-input-stream', + surrogateInInputStream: 'surrogate-in-input-stream', + nonVoidHtmlElementStartTagWithTrailingSolidus: 'non-void-html-element-start-tag-with-trailing-solidus', + endTagWithAttributes: 'end-tag-with-attributes', + endTagWithTrailingSolidus: 'end-tag-with-trailing-solidus', + unexpectedSolidusInTag: 'unexpected-solidus-in-tag', + unexpectedNullCharacter: 'unexpected-null-character', + unexpectedQuestionMarkInsteadOfTagName: 'unexpected-question-mark-instead-of-tag-name', + invalidFirstCharacterOfTagName: 'invalid-first-character-of-tag-name', + unexpectedEqualsSignBeforeAttributeName: 'unexpected-equals-sign-before-attribute-name', + missingEndTagName: 'missing-end-tag-name', + unexpectedCharacterInAttributeName: 'unexpected-character-in-attribute-name', + unknownNamedCharacterReference: 'unknown-named-character-reference', + missingSemicolonAfterCharacterReference: 'missing-semicolon-after-character-reference', + unexpectedCharacterAfterDoctypeSystemIdentifier: 'unexpected-character-after-doctype-system-identifier', + unexpectedCharacterInUnquotedAttributeValue: 'unexpected-character-in-unquoted-attribute-value', + eofBeforeTagName: 'eof-before-tag-name', + eofInTag: 'eof-in-tag', + missingAttributeValue: 'missing-attribute-value', + missingWhitespaceBetweenAttributes: 'missing-whitespace-between-attributes', + missingWhitespaceAfterDoctypePublicKeyword: 'missing-whitespace-after-doctype-public-keyword', + missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers: + 'missing-whitespace-between-doctype-public-and-system-identifiers', + missingWhitespaceAfterDoctypeSystemKeyword: 'missing-whitespace-after-doctype-system-keyword', + missingQuoteBeforeDoctypePublicIdentifier: 'missing-quote-before-doctype-public-identifier', + missingQuoteBeforeDoctypeSystemIdentifier: 'missing-quote-before-doctype-system-identifier', + missingDoctypePublicIdentifier: 'missing-doctype-public-identifier', + missingDoctypeSystemIdentifier: 'missing-doctype-system-identifier', + abruptDoctypePublicIdentifier: 'abrupt-doctype-public-identifier', + abruptDoctypeSystemIdentifier: 'abrupt-doctype-system-identifier', + cdataInHtmlContent: 'cdata-in-html-content', + incorrectlyOpenedComment: 'incorrectly-opened-comment', + eofInScriptHtmlCommentLikeText: 'eof-in-script-html-comment-like-text', + eofInDoctype: 'eof-in-doctype', + nestedComment: 'nested-comment', + abruptClosingOfEmptyComment: 'abrupt-closing-of-empty-comment', + eofInComment: 'eof-in-comment', + incorrectlyClosedComment: 'incorrectly-closed-comment', + eofInCdata: 'eof-in-cdata', + absenceOfDigitsInNumericCharacterReference: 'absence-of-digits-in-numeric-character-reference', + nullCharacterReference: 'null-character-reference', + surrogateCharacterReference: 'surrogate-character-reference', + characterReferenceOutsideUnicodeRange: 'character-reference-outside-unicode-range', + controlCharacterReference: 'control-character-reference', + noncharacterCharacterReference: 'noncharacter-character-reference', + missingWhitespaceBeforeDoctypeName: 'missing-whitespace-before-doctype-name', + missingDoctypeName: 'missing-doctype-name', + invalidCharacterSequenceAfterDoctypeName: 'invalid-character-sequence-after-doctype-name', + duplicateAttribute: 'duplicate-attribute', + nonConformingDoctype: 'non-conforming-doctype', + missingDoctype: 'missing-doctype', + misplacedDoctype: 'misplaced-doctype', + endTagWithoutMatchingOpenElement: 'end-tag-without-matching-open-element', + closingOfElementWithOpenChildElements: 'closing-of-element-with-open-child-elements', + disallowedContentInNoscriptInHead: 'disallowed-content-in-noscript-in-head', + openElementsLeftAfterEof: 'open-elements-left-after-eof', + abandonedHeadElementChild: 'abandoned-head-element-child', + misplacedStartTagForHeadElement: 'misplaced-start-tag-for-head-element', + nestedNoscriptInHead: 'nested-noscript-in-head', + eofInElementThatCanContainOnlyText: 'eof-in-element-that-can-contain-only-text' +}; + + +/***/ }), + +/***/ 59250: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const Tokenizer = __webpack_require__(80556); +const HTML = __webpack_require__(7073); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; +const ATTRS = HTML.ATTRS; + +//MIME types +const MIME_TYPES = { + TEXT_HTML: 'text/html', + APPLICATION_XML: 'application/xhtml+xml' +}; + +//Attributes +const DEFINITION_URL_ATTR = 'definitionurl'; +const ADJUSTED_DEFINITION_URL_ATTR = 'definitionURL'; +const SVG_ATTRS_ADJUSTMENT_MAP = { + attributename: 'attributeName', + attributetype: 'attributeType', + basefrequency: 'baseFrequency', + baseprofile: 'baseProfile', + calcmode: 'calcMode', + clippathunits: 'clipPathUnits', + diffuseconstant: 'diffuseConstant', + edgemode: 'edgeMode', + filterunits: 'filterUnits', + glyphref: 'glyphRef', + gradienttransform: 'gradientTransform', + gradientunits: 'gradientUnits', + kernelmatrix: 'kernelMatrix', + kernelunitlength: 'kernelUnitLength', + keypoints: 'keyPoints', + keysplines: 'keySplines', + keytimes: 'keyTimes', + lengthadjust: 'lengthAdjust', + limitingconeangle: 'limitingConeAngle', + markerheight: 'markerHeight', + markerunits: 'markerUnits', + markerwidth: 'markerWidth', + maskcontentunits: 'maskContentUnits', + maskunits: 'maskUnits', + numoctaves: 'numOctaves', + pathlength: 'pathLength', + patterncontentunits: 'patternContentUnits', + patterntransform: 'patternTransform', + patternunits: 'patternUnits', + pointsatx: 'pointsAtX', + pointsaty: 'pointsAtY', + pointsatz: 'pointsAtZ', + preservealpha: 'preserveAlpha', + preserveaspectratio: 'preserveAspectRatio', + primitiveunits: 'primitiveUnits', + refx: 'refX', + refy: 'refY', + repeatcount: 'repeatCount', + repeatdur: 'repeatDur', + requiredextensions: 'requiredExtensions', + requiredfeatures: 'requiredFeatures', + specularconstant: 'specularConstant', + specularexponent: 'specularExponent', + spreadmethod: 'spreadMethod', + startoffset: 'startOffset', + stddeviation: 'stdDeviation', + stitchtiles: 'stitchTiles', + surfacescale: 'surfaceScale', + systemlanguage: 'systemLanguage', + tablevalues: 'tableValues', + targetx: 'targetX', + targety: 'targetY', + textlength: 'textLength', + viewbox: 'viewBox', + viewtarget: 'viewTarget', + xchannelselector: 'xChannelSelector', + ychannelselector: 'yChannelSelector', + zoomandpan: 'zoomAndPan' +}; + +const XML_ATTRS_ADJUSTMENT_MAP = { + 'xlink:actuate': { prefix: 'xlink', name: 'actuate', namespace: NS.XLINK }, + 'xlink:arcrole': { prefix: 'xlink', name: 'arcrole', namespace: NS.XLINK }, + 'xlink:href': { prefix: 'xlink', name: 'href', namespace: NS.XLINK }, + 'xlink:role': { prefix: 'xlink', name: 'role', namespace: NS.XLINK }, + 'xlink:show': { prefix: 'xlink', name: 'show', namespace: NS.XLINK }, + 'xlink:title': { prefix: 'xlink', name: 'title', namespace: NS.XLINK }, + 'xlink:type': { prefix: 'xlink', name: 'type', namespace: NS.XLINK }, + 'xml:base': { prefix: 'xml', name: 'base', namespace: NS.XML }, + 'xml:lang': { prefix: 'xml', name: 'lang', namespace: NS.XML }, + 'xml:space': { prefix: 'xml', name: 'space', namespace: NS.XML }, + xmlns: { prefix: '', name: 'xmlns', namespace: NS.XMLNS }, + 'xmlns:xlink': { prefix: 'xmlns', name: 'xlink', namespace: NS.XMLNS } +}; + +//SVG tag names adjustment map +const SVG_TAG_NAMES_ADJUSTMENT_MAP = (exports.SVG_TAG_NAMES_ADJUSTMENT_MAP = { + altglyph: 'altGlyph', + altglyphdef: 'altGlyphDef', + altglyphitem: 'altGlyphItem', + animatecolor: 'animateColor', + animatemotion: 'animateMotion', + animatetransform: 'animateTransform', + clippath: 'clipPath', + feblend: 'feBlend', + fecolormatrix: 'feColorMatrix', + fecomponenttransfer: 'feComponentTransfer', + fecomposite: 'feComposite', + feconvolvematrix: 'feConvolveMatrix', + fediffuselighting: 'feDiffuseLighting', + fedisplacementmap: 'feDisplacementMap', + fedistantlight: 'feDistantLight', + feflood: 'feFlood', + fefunca: 'feFuncA', + fefuncb: 'feFuncB', + fefuncg: 'feFuncG', + fefuncr: 'feFuncR', + fegaussianblur: 'feGaussianBlur', + feimage: 'feImage', + femerge: 'feMerge', + femergenode: 'feMergeNode', + femorphology: 'feMorphology', + feoffset: 'feOffset', + fepointlight: 'fePointLight', + fespecularlighting: 'feSpecularLighting', + fespotlight: 'feSpotLight', + fetile: 'feTile', + feturbulence: 'feTurbulence', + foreignobject: 'foreignObject', + glyphref: 'glyphRef', + lineargradient: 'linearGradient', + radialgradient: 'radialGradient', + textpath: 'textPath' +}); + +//Tags that causes exit from foreign content +const EXITS_FOREIGN_CONTENT = { + [$.B]: true, + [$.BIG]: true, + [$.BLOCKQUOTE]: true, + [$.BODY]: true, + [$.BR]: true, + [$.CENTER]: true, + [$.CODE]: true, + [$.DD]: true, + [$.DIV]: true, + [$.DL]: true, + [$.DT]: true, + [$.EM]: true, + [$.EMBED]: true, + [$.H1]: true, + [$.H2]: true, + [$.H3]: true, + [$.H4]: true, + [$.H5]: true, + [$.H6]: true, + [$.HEAD]: true, + [$.HR]: true, + [$.I]: true, + [$.IMG]: true, + [$.LI]: true, + [$.LISTING]: true, + [$.MENU]: true, + [$.META]: true, + [$.NOBR]: true, + [$.OL]: true, + [$.P]: true, + [$.PRE]: true, + [$.RUBY]: true, + [$.S]: true, + [$.SMALL]: true, + [$.SPAN]: true, + [$.STRONG]: true, + [$.STRIKE]: true, + [$.SUB]: true, + [$.SUP]: true, + [$.TABLE]: true, + [$.TT]: true, + [$.U]: true, + [$.UL]: true, + [$.VAR]: true +}; + +//Check exit from foreign content +exports.causesExit = function(startTagToken) { + const tn = startTagToken.tagName; + const isFontWithAttrs = + tn === $.FONT && + (Tokenizer.getTokenAttr(startTagToken, ATTRS.COLOR) !== null || + Tokenizer.getTokenAttr(startTagToken, ATTRS.SIZE) !== null || + Tokenizer.getTokenAttr(startTagToken, ATTRS.FACE) !== null); + + return isFontWithAttrs ? true : EXITS_FOREIGN_CONTENT[tn]; +}; + +//Token adjustments +exports.adjustTokenMathMLAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + if (token.attrs[i].name === DEFINITION_URL_ATTR) { + token.attrs[i].name = ADJUSTED_DEFINITION_URL_ATTR; + break; + } + } +}; + +exports.adjustTokenSVGAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + const adjustedAttrName = SVG_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; + + if (adjustedAttrName) { + token.attrs[i].name = adjustedAttrName; + } + } +}; + +exports.adjustTokenXMLAttrs = function(token) { + for (let i = 0; i < token.attrs.length; i++) { + const adjustedAttrEntry = XML_ATTRS_ADJUSTMENT_MAP[token.attrs[i].name]; + + if (adjustedAttrEntry) { + token.attrs[i].prefix = adjustedAttrEntry.prefix; + token.attrs[i].name = adjustedAttrEntry.name; + token.attrs[i].namespace = adjustedAttrEntry.namespace; + } + } +}; + +exports.adjustTokenSVGTagName = function(token) { + const adjustedTagName = SVG_TAG_NAMES_ADJUSTMENT_MAP[token.tagName]; + + if (adjustedTagName) { + token.tagName = adjustedTagName; + } +}; + +//Integration points +function isMathMLTextIntegrationPoint(tn, ns) { + return ns === NS.MATHML && (tn === $.MI || tn === $.MO || tn === $.MN || tn === $.MS || tn === $.MTEXT); +} + +function isHtmlIntegrationPoint(tn, ns, attrs) { + if (ns === NS.MATHML && tn === $.ANNOTATION_XML) { + for (let i = 0; i < attrs.length; i++) { + if (attrs[i].name === ATTRS.ENCODING) { + const value = attrs[i].value.toLowerCase(); + + return value === MIME_TYPES.TEXT_HTML || value === MIME_TYPES.APPLICATION_XML; + } + } + } + + return ns === NS.SVG && (tn === $.FOREIGN_OBJECT || tn === $.DESC || tn === $.TITLE); +} + +exports.isIntegrationPoint = function(tn, ns, attrs, foreignNS) { + if ((!foreignNS || foreignNS === NS.HTML) && isHtmlIntegrationPoint(tn, ns, attrs)) { + return true; + } + + if ((!foreignNS || foreignNS === NS.MATHML) && isMathMLTextIntegrationPoint(tn, ns)) { + return true; + } + + return false; +}; + + +/***/ }), + +/***/ 7073: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +const NS = (exports.NAMESPACES = { + HTML: 'http://www.w3.org/1999/xhtml', + MATHML: 'http://www.w3.org/1998/Math/MathML', + SVG: 'http://www.w3.org/2000/svg', + XLINK: 'http://www.w3.org/1999/xlink', + XML: 'http://www.w3.org/XML/1998/namespace', + XMLNS: 'http://www.w3.org/2000/xmlns/' +}); + +exports.ATTRS = { + TYPE: 'type', + ACTION: 'action', + ENCODING: 'encoding', + PROMPT: 'prompt', + NAME: 'name', + COLOR: 'color', + FACE: 'face', + SIZE: 'size' +}; + +exports.DOCUMENT_MODE = { + NO_QUIRKS: 'no-quirks', + QUIRKS: 'quirks', + LIMITED_QUIRKS: 'limited-quirks' +}; + +const $ = (exports.TAG_NAMES = { + A: 'a', + ADDRESS: 'address', + ANNOTATION_XML: 'annotation-xml', + APPLET: 'applet', + AREA: 'area', + ARTICLE: 'article', + ASIDE: 'aside', + + B: 'b', + BASE: 'base', + BASEFONT: 'basefont', + BGSOUND: 'bgsound', + BIG: 'big', + BLOCKQUOTE: 'blockquote', + BODY: 'body', + BR: 'br', + BUTTON: 'button', + + CAPTION: 'caption', + CENTER: 'center', + CODE: 'code', + COL: 'col', + COLGROUP: 'colgroup', + + DD: 'dd', + DESC: 'desc', + DETAILS: 'details', + DIALOG: 'dialog', + DIR: 'dir', + DIV: 'div', + DL: 'dl', + DT: 'dt', + + EM: 'em', + EMBED: 'embed', + + FIELDSET: 'fieldset', + FIGCAPTION: 'figcaption', + FIGURE: 'figure', + FONT: 'font', + FOOTER: 'footer', + FOREIGN_OBJECT: 'foreignObject', + FORM: 'form', + FRAME: 'frame', + FRAMESET: 'frameset', + + H1: 'h1', + H2: 'h2', + H3: 'h3', + H4: 'h4', + H5: 'h5', + H6: 'h6', + HEAD: 'head', + HEADER: 'header', + HGROUP: 'hgroup', + HR: 'hr', + HTML: 'html', + + I: 'i', + IMG: 'img', + IMAGE: 'image', + INPUT: 'input', + IFRAME: 'iframe', + + KEYGEN: 'keygen', + + LABEL: 'label', + LI: 'li', + LINK: 'link', + LISTING: 'listing', + + MAIN: 'main', + MALIGNMARK: 'malignmark', + MARQUEE: 'marquee', + MATH: 'math', + MENU: 'menu', + META: 'meta', + MGLYPH: 'mglyph', + MI: 'mi', + MO: 'mo', + MN: 'mn', + MS: 'ms', + MTEXT: 'mtext', + + NAV: 'nav', + NOBR: 'nobr', + NOFRAMES: 'noframes', + NOEMBED: 'noembed', + NOSCRIPT: 'noscript', + + OBJECT: 'object', + OL: 'ol', + OPTGROUP: 'optgroup', + OPTION: 'option', + + P: 'p', + PARAM: 'param', + PLAINTEXT: 'plaintext', + PRE: 'pre', + + RB: 'rb', + RP: 'rp', + RT: 'rt', + RTC: 'rtc', + RUBY: 'ruby', + + S: 's', + SCRIPT: 'script', + SECTION: 'section', + SELECT: 'select', + SOURCE: 'source', + SMALL: 'small', + SPAN: 'span', + STRIKE: 'strike', + STRONG: 'strong', + STYLE: 'style', + SUB: 'sub', + SUMMARY: 'summary', + SUP: 'sup', + + TABLE: 'table', + TBODY: 'tbody', + TEMPLATE: 'template', + TEXTAREA: 'textarea', + TFOOT: 'tfoot', + TD: 'td', + TH: 'th', + THEAD: 'thead', + TITLE: 'title', + TR: 'tr', + TRACK: 'track', + TT: 'tt', + + U: 'u', + UL: 'ul', + + SVG: 'svg', + + VAR: 'var', + + WBR: 'wbr', + + XMP: 'xmp' +}); + +exports.SPECIAL_ELEMENTS = { + [NS.HTML]: { + [$.ADDRESS]: true, + [$.APPLET]: true, + [$.AREA]: true, + [$.ARTICLE]: true, + [$.ASIDE]: true, + [$.BASE]: true, + [$.BASEFONT]: true, + [$.BGSOUND]: true, + [$.BLOCKQUOTE]: true, + [$.BODY]: true, + [$.BR]: true, + [$.BUTTON]: true, + [$.CAPTION]: true, + [$.CENTER]: true, + [$.COL]: true, + [$.COLGROUP]: true, + [$.DD]: true, + [$.DETAILS]: true, + [$.DIR]: true, + [$.DIV]: true, + [$.DL]: true, + [$.DT]: true, + [$.EMBED]: true, + [$.FIELDSET]: true, + [$.FIGCAPTION]: true, + [$.FIGURE]: true, + [$.FOOTER]: true, + [$.FORM]: true, + [$.FRAME]: true, + [$.FRAMESET]: true, + [$.H1]: true, + [$.H2]: true, + [$.H3]: true, + [$.H4]: true, + [$.H5]: true, + [$.H6]: true, + [$.HEAD]: true, + [$.HEADER]: true, + [$.HGROUP]: true, + [$.HR]: true, + [$.HTML]: true, + [$.IFRAME]: true, + [$.IMG]: true, + [$.INPUT]: true, + [$.LI]: true, + [$.LINK]: true, + [$.LISTING]: true, + [$.MAIN]: true, + [$.MARQUEE]: true, + [$.MENU]: true, + [$.META]: true, + [$.NAV]: true, + [$.NOEMBED]: true, + [$.NOFRAMES]: true, + [$.NOSCRIPT]: true, + [$.OBJECT]: true, + [$.OL]: true, + [$.P]: true, + [$.PARAM]: true, + [$.PLAINTEXT]: true, + [$.PRE]: true, + [$.SCRIPT]: true, + [$.SECTION]: true, + [$.SELECT]: true, + [$.SOURCE]: true, + [$.STYLE]: true, + [$.SUMMARY]: true, + [$.TABLE]: true, + [$.TBODY]: true, + [$.TD]: true, + [$.TEMPLATE]: true, + [$.TEXTAREA]: true, + [$.TFOOT]: true, + [$.TH]: true, + [$.THEAD]: true, + [$.TITLE]: true, + [$.TR]: true, + [$.TRACK]: true, + [$.UL]: true, + [$.WBR]: true, + [$.XMP]: true + }, + [NS.MATHML]: { + [$.MI]: true, + [$.MO]: true, + [$.MN]: true, + [$.MS]: true, + [$.MTEXT]: true, + [$.ANNOTATION_XML]: true + }, + [NS.SVG]: { + [$.TITLE]: true, + [$.FOREIGN_OBJECT]: true, + [$.DESC]: true + } +}; + + +/***/ }), + +/***/ 67649: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +const UNDEFINED_CODE_POINTS = [ + 0xfffe, + 0xffff, + 0x1fffe, + 0x1ffff, + 0x2fffe, + 0x2ffff, + 0x3fffe, + 0x3ffff, + 0x4fffe, + 0x4ffff, + 0x5fffe, + 0x5ffff, + 0x6fffe, + 0x6ffff, + 0x7fffe, + 0x7ffff, + 0x8fffe, + 0x8ffff, + 0x9fffe, + 0x9ffff, + 0xafffe, + 0xaffff, + 0xbfffe, + 0xbffff, + 0xcfffe, + 0xcffff, + 0xdfffe, + 0xdffff, + 0xefffe, + 0xeffff, + 0xffffe, + 0xfffff, + 0x10fffe, + 0x10ffff +]; + +exports.REPLACEMENT_CHARACTER = '\uFFFD'; + +exports.CODE_POINTS = { + EOF: -1, + NULL: 0x00, + TABULATION: 0x09, + CARRIAGE_RETURN: 0x0d, + LINE_FEED: 0x0a, + FORM_FEED: 0x0c, + SPACE: 0x20, + EXCLAMATION_MARK: 0x21, + QUOTATION_MARK: 0x22, + NUMBER_SIGN: 0x23, + AMPERSAND: 0x26, + APOSTROPHE: 0x27, + HYPHEN_MINUS: 0x2d, + SOLIDUS: 0x2f, + DIGIT_0: 0x30, + DIGIT_9: 0x39, + SEMICOLON: 0x3b, + LESS_THAN_SIGN: 0x3c, + EQUALS_SIGN: 0x3d, + GREATER_THAN_SIGN: 0x3e, + QUESTION_MARK: 0x3f, + LATIN_CAPITAL_A: 0x41, + LATIN_CAPITAL_F: 0x46, + LATIN_CAPITAL_X: 0x58, + LATIN_CAPITAL_Z: 0x5a, + RIGHT_SQUARE_BRACKET: 0x5d, + GRAVE_ACCENT: 0x60, + LATIN_SMALL_A: 0x61, + LATIN_SMALL_F: 0x66, + LATIN_SMALL_X: 0x78, + LATIN_SMALL_Z: 0x7a, + REPLACEMENT_CHARACTER: 0xfffd +}; + +exports.CODE_POINT_SEQUENCES = { + DASH_DASH_STRING: [0x2d, 0x2d], //-- + DOCTYPE_STRING: [0x44, 0x4f, 0x43, 0x54, 0x59, 0x50, 0x45], //DOCTYPE + CDATA_START_STRING: [0x5b, 0x43, 0x44, 0x41, 0x54, 0x41, 0x5b], //[CDATA[ + SCRIPT_STRING: [0x73, 0x63, 0x72, 0x69, 0x70, 0x74], //script + PUBLIC_STRING: [0x50, 0x55, 0x42, 0x4c, 0x49, 0x43], //PUBLIC + SYSTEM_STRING: [0x53, 0x59, 0x53, 0x54, 0x45, 0x4d] //SYSTEM +}; + +//Surrogates +exports.isSurrogate = function(cp) { + return cp >= 0xd800 && cp <= 0xdfff; +}; + +exports.isSurrogatePair = function(cp) { + return cp >= 0xdc00 && cp <= 0xdfff; +}; + +exports.getSurrogatePairCodePoint = function(cp1, cp2) { + return (cp1 - 0xd800) * 0x400 + 0x2400 + cp2; +}; + +//NOTE: excluding NULL and ASCII whitespace +exports.isControlCodePoint = function(cp) { + return ( + (cp !== 0x20 && cp !== 0x0a && cp !== 0x0d && cp !== 0x09 && cp !== 0x0c && cp >= 0x01 && cp <= 0x1f) || + (cp >= 0x7f && cp <= 0x9f) + ); +}; + +exports.isUndefinedCodePoint = function(cp) { + return (cp >= 0xfdd0 && cp <= 0xfdef) || UNDEFINED_CODE_POINTS.indexOf(cp) > -1; +}; + + +/***/ }), + +/***/ 89366: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(26189); + +class ErrorReportingMixinBase extends Mixin { + constructor(host, opts) { + super(host); + + this.posTracker = null; + this.onParseError = opts.onParseError; + } + + _setErrorLocation(err) { + err.startLine = err.endLine = this.posTracker.line; + err.startCol = err.endCol = this.posTracker.col; + err.startOffset = err.endOffset = this.posTracker.offset; + } + + _reportError(code) { + const err = { + code: code, + startLine: -1, + startCol: -1, + startOffset: -1, + endLine: -1, + endCol: -1, + endOffset: -1 + }; + + this._setErrorLocation(err); + this.onParseError(err); + } + + _getOverriddenMethods(mxn) { + return { + _err(code) { + mxn._reportError(code); + } + }; + } +} + +module.exports = ErrorReportingMixinBase; + + +/***/ }), + +/***/ 62728: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(89366); +const ErrorReportingTokenizerMixin = __webpack_require__(11350); +const LocationInfoTokenizerMixin = __webpack_require__(59077); +const Mixin = __webpack_require__(26189); + +class ErrorReportingParserMixin extends ErrorReportingMixinBase { + constructor(parser, opts) { + super(parser, opts); + + this.opts = opts; + this.ctLoc = null; + this.locBeforeToken = false; + } + + _setErrorLocation(err) { + if (this.ctLoc) { + err.startLine = this.ctLoc.startLine; + err.startCol = this.ctLoc.startCol; + err.startOffset = this.ctLoc.startOffset; + + err.endLine = this.locBeforeToken ? this.ctLoc.startLine : this.ctLoc.endLine; + err.endCol = this.locBeforeToken ? this.ctLoc.startCol : this.ctLoc.endCol; + err.endOffset = this.locBeforeToken ? this.ctLoc.startOffset : this.ctLoc.endOffset; + } + } + + _getOverriddenMethods(mxn, orig) { + return { + _bootstrap(document, fragmentContext) { + orig._bootstrap.call(this, document, fragmentContext); + + Mixin.install(this.tokenizer, ErrorReportingTokenizerMixin, mxn.opts); + Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); + }, + + _processInputToken(token) { + mxn.ctLoc = token.location; + + orig._processInputToken.call(this, token); + }, + + _err(code, options) { + mxn.locBeforeToken = options && options.beforeToken; + mxn._reportError(code); + } + }; + } +} + +module.exports = ErrorReportingParserMixin; + + +/***/ }), + +/***/ 68636: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(89366); +const PositionTrackingPreprocessorMixin = __webpack_require__(57458); +const Mixin = __webpack_require__(26189); + +class ErrorReportingPreprocessorMixin extends ErrorReportingMixinBase { + constructor(preprocessor, opts) { + super(preprocessor, opts); + + this.posTracker = Mixin.install(preprocessor, PositionTrackingPreprocessorMixin); + this.lastErrOffset = -1; + } + + _reportError(code) { + //NOTE: avoid reporting error twice on advance/retreat + if (this.lastErrOffset !== this.posTracker.offset) { + this.lastErrOffset = this.posTracker.offset; + super._reportError(code); + } + } +} + +module.exports = ErrorReportingPreprocessorMixin; + + +/***/ }), + +/***/ 11350: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const ErrorReportingMixinBase = __webpack_require__(89366); +const ErrorReportingPreprocessorMixin = __webpack_require__(68636); +const Mixin = __webpack_require__(26189); + +class ErrorReportingTokenizerMixin extends ErrorReportingMixinBase { + constructor(tokenizer, opts) { + super(tokenizer, opts); + + const preprocessorMixin = Mixin.install(tokenizer.preprocessor, ErrorReportingPreprocessorMixin, opts); + + this.posTracker = preprocessorMixin.posTracker; + } +} + +module.exports = ErrorReportingTokenizerMixin; + + +/***/ }), + +/***/ 31242: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(26189); + +class LocationInfoOpenElementStackMixin extends Mixin { + constructor(stack, opts) { + super(stack); + + this.onItemPop = opts.onItemPop; + } + + _getOverriddenMethods(mxn, orig) { + return { + pop() { + mxn.onItemPop(this.current); + orig.pop.call(this); + }, + + popAllUpToHtmlElement() { + for (let i = this.stackTop; i > 0; i--) { + mxn.onItemPop(this.items[i]); + } + + orig.popAllUpToHtmlElement.call(this); + }, + + remove(element) { + mxn.onItemPop(this.current); + orig.remove.call(this, element); + } + }; + } +} + +module.exports = LocationInfoOpenElementStackMixin; + + +/***/ }), + +/***/ 62733: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(26189); +const Tokenizer = __webpack_require__(80556); +const LocationInfoTokenizerMixin = __webpack_require__(59077); +const LocationInfoOpenElementStackMixin = __webpack_require__(31242); +const HTML = __webpack_require__(7073); + +//Aliases +const $ = HTML.TAG_NAMES; + +class LocationInfoParserMixin extends Mixin { + constructor(parser) { + super(parser); + + this.parser = parser; + this.treeAdapter = this.parser.treeAdapter; + this.posTracker = null; + this.lastStartTagToken = null; + this.lastFosterParentingLocation = null; + this.currentToken = null; + } + + _setStartLocation(element) { + let loc = null; + + if (this.lastStartTagToken) { + loc = Object.assign({}, this.lastStartTagToken.location); + loc.startTag = this.lastStartTagToken.location; + } + + this.treeAdapter.setNodeSourceCodeLocation(element, loc); + } + + _setEndLocation(element, closingToken) { + const loc = this.treeAdapter.getNodeSourceCodeLocation(element); + + if (loc) { + if (closingToken.location) { + const ctLoc = closingToken.location; + const tn = this.treeAdapter.getTagName(element); + + // NOTE: For cases like

    - First 'p' closes without a closing + // tag and for cases like

    - 'p' closes without a closing tag. + const isClosingEndTag = closingToken.type === Tokenizer.END_TAG_TOKEN && tn === closingToken.tagName; + + if (isClosingEndTag) { + loc.endTag = Object.assign({}, ctLoc); + loc.endLine = ctLoc.endLine; + loc.endCol = ctLoc.endCol; + loc.endOffset = ctLoc.endOffset; + } else { + loc.endLine = ctLoc.startLine; + loc.endCol = ctLoc.startCol; + loc.endOffset = ctLoc.startOffset; + } + } + } + } + + _getOverriddenMethods(mxn, orig) { + return { + _bootstrap(document, fragmentContext) { + orig._bootstrap.call(this, document, fragmentContext); + + mxn.lastStartTagToken = null; + mxn.lastFosterParentingLocation = null; + mxn.currentToken = null; + + const tokenizerMixin = Mixin.install(this.tokenizer, LocationInfoTokenizerMixin); + + mxn.posTracker = tokenizerMixin.posTracker; + + Mixin.install(this.openElements, LocationInfoOpenElementStackMixin, { + onItemPop: function(element) { + mxn._setEndLocation(element, mxn.currentToken); + } + }); + }, + + _runParsingLoop(scriptHandler) { + orig._runParsingLoop.call(this, scriptHandler); + + // NOTE: generate location info for elements + // that remains on open element stack + for (let i = this.openElements.stackTop; i >= 0; i--) { + mxn._setEndLocation(this.openElements.items[i], mxn.currentToken); + } + }, + + //Token processing + _processTokenInForeignContent(token) { + mxn.currentToken = token; + orig._processTokenInForeignContent.call(this, token); + }, + + _processToken(token) { + mxn.currentToken = token; + orig._processToken.call(this, token); + + //NOTE: and are never popped from the stack, so we need to updated + //their end location explicitly. + const requireExplicitUpdate = + token.type === Tokenizer.END_TAG_TOKEN && + (token.tagName === $.HTML || (token.tagName === $.BODY && this.openElements.hasInScope($.BODY))); + + if (requireExplicitUpdate) { + for (let i = this.openElements.stackTop; i >= 0; i--) { + const element = this.openElements.items[i]; + + if (this.treeAdapter.getTagName(element) === token.tagName) { + mxn._setEndLocation(element, token); + break; + } + } + } + }, + + //Doctype + _setDocumentType(token) { + orig._setDocumentType.call(this, token); + + const documentChildren = this.treeAdapter.getChildNodes(this.document); + const cnLength = documentChildren.length; + + for (let i = 0; i < cnLength; i++) { + const node = documentChildren[i]; + + if (this.treeAdapter.isDocumentTypeNode(node)) { + this.treeAdapter.setNodeSourceCodeLocation(node, token.location); + break; + } + } + }, + + //Elements + _attachElementToTree(element) { + //NOTE: _attachElementToTree is called from _appendElement, _insertElement and _insertTemplate methods. + //So we will use token location stored in this methods for the element. + mxn._setStartLocation(element); + mxn.lastStartTagToken = null; + orig._attachElementToTree.call(this, element); + }, + + _appendElement(token, namespaceURI) { + mxn.lastStartTagToken = token; + orig._appendElement.call(this, token, namespaceURI); + }, + + _insertElement(token, namespaceURI) { + mxn.lastStartTagToken = token; + orig._insertElement.call(this, token, namespaceURI); + }, + + _insertTemplate(token) { + mxn.lastStartTagToken = token; + orig._insertTemplate.call(this, token); + + const tmplContent = this.treeAdapter.getTemplateContent(this.openElements.current); + + this.treeAdapter.setNodeSourceCodeLocation(tmplContent, null); + }, + + _insertFakeRootElement() { + orig._insertFakeRootElement.call(this); + this.treeAdapter.setNodeSourceCodeLocation(this.openElements.current, null); + }, + + //Comments + _appendCommentNode(token, parent) { + orig._appendCommentNode.call(this, token, parent); + + const children = this.treeAdapter.getChildNodes(parent); + const commentNode = children[children.length - 1]; + + this.treeAdapter.setNodeSourceCodeLocation(commentNode, token.location); + }, + + //Text + _findFosterParentingLocation() { + //NOTE: store last foster parenting location, so we will be able to find inserted text + //in case of foster parenting + mxn.lastFosterParentingLocation = orig._findFosterParentingLocation.call(this); + + return mxn.lastFosterParentingLocation; + }, + + _insertCharacters(token) { + orig._insertCharacters.call(this, token); + + const hasFosterParent = this._shouldFosterParentOnInsertion(); + + const parent = + (hasFosterParent && mxn.lastFosterParentingLocation.parent) || + this.openElements.currentTmplContent || + this.openElements.current; + + const siblings = this.treeAdapter.getChildNodes(parent); + + const textNodeIdx = + hasFosterParent && mxn.lastFosterParentingLocation.beforeElement + ? siblings.indexOf(mxn.lastFosterParentingLocation.beforeElement) - 1 + : siblings.length - 1; + + const textNode = siblings[textNodeIdx]; + + //NOTE: if we have location assigned by another token, then just update end position + const tnLoc = this.treeAdapter.getNodeSourceCodeLocation(textNode); + + if (tnLoc) { + tnLoc.endLine = token.location.endLine; + tnLoc.endCol = token.location.endCol; + tnLoc.endOffset = token.location.endOffset; + } else { + this.treeAdapter.setNodeSourceCodeLocation(textNode, token.location); + } + } + }; + } +} + +module.exports = LocationInfoParserMixin; + + +/***/ }), + +/***/ 59077: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(26189); +const Tokenizer = __webpack_require__(80556); +const PositionTrackingPreprocessorMixin = __webpack_require__(57458); + +class LocationInfoTokenizerMixin extends Mixin { + constructor(tokenizer) { + super(tokenizer); + + this.tokenizer = tokenizer; + this.posTracker = Mixin.install(tokenizer.preprocessor, PositionTrackingPreprocessorMixin); + this.currentAttrLocation = null; + this.ctLoc = null; + } + + _getCurrentLocation() { + return { + startLine: this.posTracker.line, + startCol: this.posTracker.col, + startOffset: this.posTracker.offset, + endLine: -1, + endCol: -1, + endOffset: -1 + }; + } + + _attachCurrentAttrLocationInfo() { + this.currentAttrLocation.endLine = this.posTracker.line; + this.currentAttrLocation.endCol = this.posTracker.col; + this.currentAttrLocation.endOffset = this.posTracker.offset; + + const currentToken = this.tokenizer.currentToken; + const currentAttr = this.tokenizer.currentAttr; + + if (!currentToken.location.attrs) { + currentToken.location.attrs = Object.create(null); + } + + currentToken.location.attrs[currentAttr.name] = this.currentAttrLocation; + } + + _getOverriddenMethods(mxn, orig) { + const methods = { + _createStartTagToken() { + orig._createStartTagToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createEndTagToken() { + orig._createEndTagToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createCommentToken() { + orig._createCommentToken.call(this); + this.currentToken.location = mxn.ctLoc; + }, + + _createDoctypeToken(initialName) { + orig._createDoctypeToken.call(this, initialName); + this.currentToken.location = mxn.ctLoc; + }, + + _createCharacterToken(type, ch) { + orig._createCharacterToken.call(this, type, ch); + this.currentCharacterToken.location = mxn.ctLoc; + }, + + _createEOFToken() { + orig._createEOFToken.call(this); + this.currentToken.location = mxn._getCurrentLocation(); + }, + + _createAttr(attrNameFirstCh) { + orig._createAttr.call(this, attrNameFirstCh); + mxn.currentAttrLocation = mxn._getCurrentLocation(); + }, + + _leaveAttrName(toState) { + orig._leaveAttrName.call(this, toState); + mxn._attachCurrentAttrLocationInfo(); + }, + + _leaveAttrValue(toState) { + orig._leaveAttrValue.call(this, toState); + mxn._attachCurrentAttrLocationInfo(); + }, + + _emitCurrentToken() { + const ctLoc = this.currentToken.location; + + //NOTE: if we have pending character token make it's end location equal to the + //current token's start location. + if (this.currentCharacterToken) { + this.currentCharacterToken.location.endLine = ctLoc.startLine; + this.currentCharacterToken.location.endCol = ctLoc.startCol; + this.currentCharacterToken.location.endOffset = ctLoc.startOffset; + } + + if (this.currentToken.type === Tokenizer.EOF_TOKEN) { + ctLoc.endLine = ctLoc.startLine; + ctLoc.endCol = ctLoc.startCol; + ctLoc.endOffset = ctLoc.startOffset; + } else { + ctLoc.endLine = mxn.posTracker.line; + ctLoc.endCol = mxn.posTracker.col + 1; + ctLoc.endOffset = mxn.posTracker.offset + 1; + } + + orig._emitCurrentToken.call(this); + }, + + _emitCurrentCharacterToken() { + const ctLoc = this.currentCharacterToken && this.currentCharacterToken.location; + + //NOTE: if we have character token and it's location wasn't set in the _emitCurrentToken(), + //then set it's location at the current preprocessor position. + //We don't need to increment preprocessor position, since character token + //emission is always forced by the start of the next character token here. + //So, we already have advanced position. + if (ctLoc && ctLoc.endOffset === -1) { + ctLoc.endLine = mxn.posTracker.line; + ctLoc.endCol = mxn.posTracker.col; + ctLoc.endOffset = mxn.posTracker.offset; + } + + orig._emitCurrentCharacterToken.call(this); + } + }; + + //NOTE: patch initial states for each mode to obtain token start position + Object.keys(Tokenizer.MODE).forEach(modeName => { + const state = Tokenizer.MODE[modeName]; + + methods[state] = function(cp) { + mxn.ctLoc = mxn._getCurrentLocation(); + orig[state].call(this, cp); + }; + }); + + return methods; + } +} + +module.exports = LocationInfoTokenizerMixin; + + +/***/ }), + +/***/ 57458: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Mixin = __webpack_require__(26189); + +class PositionTrackingPreprocessorMixin extends Mixin { + constructor(preprocessor) { + super(preprocessor); + + this.preprocessor = preprocessor; + this.isEol = false; + this.lineStartPos = 0; + this.droppedBufferSize = 0; + + this.offset = 0; + this.col = 0; + this.line = 1; + } + + _getOverriddenMethods(mxn, orig) { + return { + advance() { + const pos = this.pos + 1; + const ch = this.html[pos]; + + //NOTE: LF should be in the last column of the line + if (mxn.isEol) { + mxn.isEol = false; + mxn.line++; + mxn.lineStartPos = pos; + } + + if (ch === '\n' || (ch === '\r' && this.html[pos + 1] !== '\n')) { + mxn.isEol = true; + } + + mxn.col = pos - mxn.lineStartPos + 1; + mxn.offset = mxn.droppedBufferSize + pos; + + return orig.advance.call(this); + }, + + retreat() { + orig.retreat.call(this); + + mxn.isEol = false; + mxn.col = this.pos - mxn.lineStartPos + 1; + }, + + dropParsedChunk() { + const prevPos = this.pos; + + orig.dropParsedChunk.call(this); + + const reduction = prevPos - this.pos; + + mxn.lineStartPos -= reduction; + mxn.droppedBufferSize += reduction; + mxn.offset = mxn.droppedBufferSize + this.pos; + } + }; + } +} + +module.exports = PositionTrackingPreprocessorMixin; + + +/***/ }), + +/***/ 62470: +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { + +"use strict"; + + +const Parser = __webpack_require__(43232); +const Serializer = __webpack_require__(79983); + +// Shorthands +exports.parse = function parse(html, options) { + const parser = new Parser(options); + + return parser.parse(html); +}; + +exports.parseFragment = function parseFragment(fragmentContext, html, options) { + if (typeof fragmentContext === 'string') { + options = html; + html = fragmentContext; + fragmentContext = null; + } + + const parser = new Parser(options); + + return parser.parseFragment(html, fragmentContext); +}; + +exports.serialize = function(node, options) { + const serializer = new Serializer(node, options); + + return serializer.serialize(); +}; + + +/***/ }), + +/***/ 9297: +/***/ ((module) => { + +"use strict"; + + +//Const +const NOAH_ARK_CAPACITY = 3; + +//List of formatting elements +class FormattingElementList { + constructor(treeAdapter) { + this.length = 0; + this.entries = []; + this.treeAdapter = treeAdapter; + this.bookmark = null; + } + + //Noah Ark's condition + //OPTIMIZATION: at first we try to find possible candidates for exclusion using + //lightweight heuristics without thorough attributes check. + _getNoahArkConditionCandidates(newElement) { + const candidates = []; + + if (this.length >= NOAH_ARK_CAPACITY) { + const neAttrsLength = this.treeAdapter.getAttrList(newElement).length; + const neTagName = this.treeAdapter.getTagName(newElement); + const neNamespaceURI = this.treeAdapter.getNamespaceURI(newElement); + + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + break; + } + + const element = entry.element; + const elementAttrs = this.treeAdapter.getAttrList(element); + + const isCandidate = + this.treeAdapter.getTagName(element) === neTagName && + this.treeAdapter.getNamespaceURI(element) === neNamespaceURI && + elementAttrs.length === neAttrsLength; + + if (isCandidate) { + candidates.push({ idx: i, attrs: elementAttrs }); + } + } + } + + return candidates.length < NOAH_ARK_CAPACITY ? [] : candidates; + } + + _ensureNoahArkCondition(newElement) { + const candidates = this._getNoahArkConditionCandidates(newElement); + let cLength = candidates.length; + + if (cLength) { + const neAttrs = this.treeAdapter.getAttrList(newElement); + const neAttrsLength = neAttrs.length; + const neAttrsMap = Object.create(null); + + //NOTE: build attrs map for the new element so we can perform fast lookups + for (let i = 0; i < neAttrsLength; i++) { + const neAttr = neAttrs[i]; + + neAttrsMap[neAttr.name] = neAttr.value; + } + + for (let i = 0; i < neAttrsLength; i++) { + for (let j = 0; j < cLength; j++) { + const cAttr = candidates[j].attrs[i]; + + if (neAttrsMap[cAttr.name] !== cAttr.value) { + candidates.splice(j, 1); + cLength--; + } + + if (candidates.length < NOAH_ARK_CAPACITY) { + return; + } + } + } + + //NOTE: remove bottommost candidates until Noah's Ark condition will not be met + for (let i = cLength - 1; i >= NOAH_ARK_CAPACITY - 1; i--) { + this.entries.splice(candidates[i].idx, 1); + this.length--; + } + } + } + + //Mutations + insertMarker() { + this.entries.push({ type: FormattingElementList.MARKER_ENTRY }); + this.length++; + } + + pushElement(element, token) { + this._ensureNoahArkCondition(element); + + this.entries.push({ + type: FormattingElementList.ELEMENT_ENTRY, + element: element, + token: token + }); + + this.length++; + } + + insertElementAfterBookmark(element, token) { + let bookmarkIdx = this.length - 1; + + for (; bookmarkIdx >= 0; bookmarkIdx--) { + if (this.entries[bookmarkIdx] === this.bookmark) { + break; + } + } + + this.entries.splice(bookmarkIdx + 1, 0, { + type: FormattingElementList.ELEMENT_ENTRY, + element: element, + token: token + }); + + this.length++; + } + + removeEntry(entry) { + for (let i = this.length - 1; i >= 0; i--) { + if (this.entries[i] === entry) { + this.entries.splice(i, 1); + this.length--; + break; + } + } + } + + clearToLastMarker() { + while (this.length) { + const entry = this.entries.pop(); + + this.length--; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + break; + } + } + } + + //Search + getElementEntryInScopeWithTagName(tagName) { + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.MARKER_ENTRY) { + return null; + } + + if (this.treeAdapter.getTagName(entry.element) === tagName) { + return entry; + } + } + + return null; + } + + getElementEntry(element) { + for (let i = this.length - 1; i >= 0; i--) { + const entry = this.entries[i]; + + if (entry.type === FormattingElementList.ELEMENT_ENTRY && entry.element === element) { + return entry; + } + } + + return null; + } +} + +//Entry types +FormattingElementList.MARKER_ENTRY = 'MARKER_ENTRY'; +FormattingElementList.ELEMENT_ENTRY = 'ELEMENT_ENTRY'; + +module.exports = FormattingElementList; + + +/***/ }), + +/***/ 43232: +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +const Tokenizer = __webpack_require__(80556); +const OpenElementStack = __webpack_require__(59254); +const FormattingElementList = __webpack_require__(9297); +const LocationInfoParserMixin = __webpack_require__(62733); +const ErrorReportingParserMixin = __webpack_require__(62728); +const Mixin = __webpack_require__(26189); +const defaultTreeAdapter = __webpack_require__(23475); +const mergeOptions = __webpack_require__(9119); +const doctype = __webpack_require__(69732); +const foreignContent = __webpack_require__(59250); +const ERR = __webpack_require__(77219); +const unicode = __webpack_require__(67649); +const HTML = __webpack_require__(7073); + +//Aliases +const $ = HTML.TAG_NAMES; +const NS = HTML.NAMESPACES; +const ATTRS = HTML.ATTRS; + +const DEFAULT_OPTIONS = { + scriptingEnabled: true, + sourceCodeLocationInfo: false, + onParseError: null, + treeAdapter: defaultTreeAdapter +}; + +//Misc constants +const HIDDEN_INPUT_TYPE = 'hidden'; + +//Adoption agency loops iteration count +const AA_OUTER_LOOP_ITER = 8; +const AA_INNER_LOOP_ITER = 3; + +//Insertion modes +const INITIAL_MODE = 'INITIAL_MODE'; +const BEFORE_HTML_MODE = 'BEFORE_HTML_MODE'; +const BEFORE_HEAD_MODE = 'BEFORE_HEAD_MODE'; +const IN_HEAD_MODE = 'IN_HEAD_MODE'; +const IN_HEAD_NO_SCRIPT_MODE = 'IN_HEAD_NO_SCRIPT_MODE'; +const AFTER_HEAD_MODE = 'AFTER_HEAD_MODE'; +const IN_BODY_MODE = 'IN_BODY_MODE'; +const TEXT_MODE = 'TEXT_MODE'; +const IN_TABLE_MODE = 'IN_TABLE_MODE'; +const IN_TABLE_TEXT_MODE = 'IN_TABLE_TEXT_MODE'; +const IN_CAPTION_MODE = 'IN_CAPTION_MODE'; +const IN_COLUMN_GROUP_MODE = 'IN_COLUMN_GROUP_MODE'; +const IN_TABLE_BODY_MODE = 'IN_TABLE_BODY_MODE'; +const IN_ROW_MODE = 'IN_ROW_MODE'; +const IN_CELL_MODE = 'IN_CELL_MODE'; +const IN_SELECT_MODE = 'IN_SELECT_MODE'; +const IN_SELECT_IN_TABLE_MODE = 'IN_SELECT_IN_TABLE_MODE'; +const IN_TEMPLATE_MODE = 'IN_TEMPLATE_MODE'; +const AFTER_BODY_MODE = 'AFTER_BODY_MODE'; +const IN_FRAMESET_MODE = 'IN_FRAMESET_MODE'; +const AFTER_FRAMESET_MODE = 'AFTER_FRAMESET_MODE'; +const AFTER_AFTER_BODY_MODE = 'AFTER_AFTER_BODY_MODE'; +const AFTER_AFTER_FRAMESET_MODE = 'AFTER_AFTER_FRAMESET_MODE'; + +//Insertion mode reset map +const INSERTION_MODE_RESET_MAP = { + [$.TR]: IN_ROW_MODE, + [$.TBODY]: IN_TABLE_BODY_MODE, + [$.THEAD]: IN_TABLE_BODY_MODE, + [$.TFOOT]: IN_TABLE_BODY_MODE, + [$.CAPTION]: IN_CAPTION_MODE, + [$.COLGROUP]: IN_COLUMN_GROUP_MODE, + [$.TABLE]: IN_TABLE_MODE, + [$.BODY]: IN_BODY_MODE, + [$.FRAMESET]: IN_FRAMESET_MODE +}; + +//Template insertion mode switch map +const TEMPLATE_INSERTION_MODE_SWITCH_MAP = { + [$.CAPTION]: IN_TABLE_MODE, + [$.COLGROUP]: IN_TABLE_MODE, + [$.TBODY]: IN_TABLE_MODE, + [$.TFOOT]: IN_TABLE_MODE, + [$.THEAD]: IN_TABLE_MODE, + [$.COL]: IN_COLUMN_GROUP_MODE, + [$.TR]: IN_TABLE_BODY_MODE, + [$.TD]: IN_ROW_MODE, + [$.TH]: IN_ROW_MODE +}; + +//Token handlers map for insertion modes +const TOKEN_HANDLERS = { + [INITIAL_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInInitialMode, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInInitialMode, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: doctypeInInitialMode, + [Tokenizer.START_TAG_TOKEN]: tokenInInitialMode, + [Tokenizer.END_TAG_TOKEN]: tokenInInitialMode, + [Tokenizer.EOF_TOKEN]: tokenInInitialMode + }, + [BEFORE_HTML_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHtml, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHtml, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagBeforeHtml, + [Tokenizer.END_TAG_TOKEN]: endTagBeforeHtml, + [Tokenizer.EOF_TOKEN]: tokenBeforeHtml + }, + [BEFORE_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenBeforeHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenBeforeHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagBeforeHead, + [Tokenizer.END_TAG_TOKEN]: endTagBeforeHead, + [Tokenizer.EOF_TOKEN]: tokenBeforeHead + }, + [IN_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagInHead, + [Tokenizer.END_TAG_TOKEN]: endTagInHead, + [Tokenizer.EOF_TOKEN]: tokenInHead + }, + [IN_HEAD_NO_SCRIPT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInHeadNoScript, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInHeadNoScript, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagInHeadNoScript, + [Tokenizer.END_TAG_TOKEN]: endTagInHeadNoScript, + [Tokenizer.EOF_TOKEN]: tokenInHeadNoScript + }, + [AFTER_HEAD_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterHead, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterHead, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: misplacedDoctype, + [Tokenizer.START_TAG_TOKEN]: startTagAfterHead, + [Tokenizer.END_TAG_TOKEN]: endTagAfterHead, + [Tokenizer.EOF_TOKEN]: tokenAfterHead + }, + [IN_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInBody, + [Tokenizer.END_TAG_TOKEN]: endTagInBody, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [TEXT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: ignoreToken, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: ignoreToken, + [Tokenizer.END_TAG_TOKEN]: endTagInText, + [Tokenizer.EOF_TOKEN]: eofInText + }, + [IN_TABLE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTable, + [Tokenizer.END_TAG_TOKEN]: endTagInTable, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TABLE_TEXT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTableText, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInTableText, + [Tokenizer.COMMENT_TOKEN]: tokenInTableText, + [Tokenizer.DOCTYPE_TOKEN]: tokenInTableText, + [Tokenizer.START_TAG_TOKEN]: tokenInTableText, + [Tokenizer.END_TAG_TOKEN]: tokenInTableText, + [Tokenizer.EOF_TOKEN]: tokenInTableText + }, + [IN_CAPTION_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInCaption, + [Tokenizer.END_TAG_TOKEN]: endTagInCaption, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_COLUMN_GROUP_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenInColumnGroup, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenInColumnGroup, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInColumnGroup, + [Tokenizer.END_TAG_TOKEN]: endTagInColumnGroup, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TABLE_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTableBody, + [Tokenizer.END_TAG_TOKEN]: endTagInTableBody, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_ROW_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInTable, + [Tokenizer.NULL_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: characterInTable, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInRow, + [Tokenizer.END_TAG_TOKEN]: endTagInRow, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_CELL_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInCell, + [Tokenizer.END_TAG_TOKEN]: endTagInCell, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_SELECT_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInSelect, + [Tokenizer.END_TAG_TOKEN]: endTagInSelect, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_SELECT_IN_TABLE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInSelectInTable, + [Tokenizer.END_TAG_TOKEN]: endTagInSelectInTable, + [Tokenizer.EOF_TOKEN]: eofInBody + }, + [IN_TEMPLATE_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: characterInBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInTemplate, + [Tokenizer.END_TAG_TOKEN]: endTagInTemplate, + [Tokenizer.EOF_TOKEN]: eofInTemplate + }, + [AFTER_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterBody, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToRootHtmlElement, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterBody, + [Tokenizer.END_TAG_TOKEN]: endTagAfterBody, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [IN_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagInFrameset, + [Tokenizer.END_TAG_TOKEN]: endTagInFrameset, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: insertCharacters, + [Tokenizer.COMMENT_TOKEN]: appendComment, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterFrameset, + [Tokenizer.END_TAG_TOKEN]: endTagAfterFrameset, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_AFTER_BODY_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: tokenAfterAfterBody, + [Tokenizer.NULL_CHARACTER_TOKEN]: tokenAfterAfterBody, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterBody, + [Tokenizer.END_TAG_TOKEN]: tokenAfterAfterBody, + [Tokenizer.EOF_TOKEN]: stopParsing + }, + [AFTER_AFTER_FRAMESET_MODE]: { + [Tokenizer.CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.NULL_CHARACTER_TOKEN]: ignoreToken, + [Tokenizer.WHITESPACE_CHARACTER_TOKEN]: whitespaceCharacterInBody, + [Tokenizer.COMMENT_TOKEN]: appendCommentToDocument, + [Tokenizer.DOCTYPE_TOKEN]: ignoreToken, + [Tokenizer.START_TAG_TOKEN]: startTagAfterAfterFrameset, + [Tokenizer.END_TAG_TOKEN]: ignoreToken, + [Tokenizer.EOF_TOKEN]: stopParsing + } +}; + +//Parser +class Parser { + constructor(options) { + this.options = mergeOptions(DEFAULT_OPTIONS, options); + + this.treeAdapter = this.options.treeAdapter; + this.pendingScript = null; + + if (this.options.sourceCodeLocationInfo) { + Mixin.install(this, LocationInfoParserMixin); + } + + if (this.options.onParseError) { + Mixin.install(this, ErrorReportingParserMixin, { onParseError: this.options.onParseError }); + } + } + + // API + parse(html) { + const document = this.treeAdapter.createDocument(); + + this._bootstrap(document, null); + this.tokenizer.write(html, true); + this._runParsingLoop(null); + + return document; + } + + parseFragment(html, fragmentContext) { + //NOTE: use