{"version":3,"file":"framework/index.mjs","sources":["../../../../../node_modules/.pnpm/ansi-styles@4.3.0/node_modules/ansi-styles/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/index.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/templates.js","../../../../../node_modules/.pnpm/chalk@4.1.2/node_modules/chalk/source/util.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/conversions.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/index.js","../../../../../node_modules/.pnpm/color-convert@2.0.1/node_modules/color-convert/route.js","../../../../../node_modules/.pnpm/color-name@1.1.4/node_modules/color-name/index.js","../../../../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js","../../../../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js","webpack/runtime/compat_get_default_export","webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/node_module_decorator","../../../src/execution-summary.ts","../../../src/yaml-batch-error.ts","../../../../../node_modules/.pnpm/yocto-queue@1.2.1/node_modules/yocto-queue/index.js","../../../../../node_modules/.pnpm/p-limit@6.2.0/node_modules/p-limit/index.js","../../../src/create-yaml-player.ts","../../../src/printer.ts","../../../../../node_modules/.pnpm/mimic-function@5.0.1/node_modules/mimic-function/index.js","../../../../../node_modules/.pnpm/onetime@7.0.0/node_modules/onetime/index.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js","../../../../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js","../../../../../node_modules/.pnpm/restore-cursor@5.1.0/node_modules/restore-cursor/index.js","../../../src/tty-renderer.ts","../../../src/yaml-batch-executor.ts","../../../src/batch-runner.ts","../../../src/framework/rstest-dependencies.ts","../../../src/framework/rstest-project.ts","../../../src/framework/progress-reporter.ts","../../../src/framework/rstest-contract.ts","../../../src/framework/rstest-runner.ts","../../../src/framework/command.ts","../../../src/framework/yaml-batch.ts","../../../src/framework/yaml-case.ts","../../../src/framework/rstest-entry.ts"],"sourcesContent":["'use strict';\n\nconst wrapAnsi16 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${code + offset}m`;\n};\n\nconst wrapAnsi256 = (fn, offset) => (...args) => {\n\tconst code = fn(...args);\n\treturn `\\u001B[${38 + offset};5;${code}m`;\n};\n\nconst wrapAnsi16m = (fn, offset) => (...args) => {\n\tconst rgb = fn(...args);\n\treturn `\\u001B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;\n};\n\nconst ansi2ansi = n => n;\nconst rgb2rgb = (r, g, b) => [r, g, b];\n\nconst setLazyProperty = (object, property, get) => {\n\tObject.defineProperty(object, property, {\n\t\tget: () => {\n\t\t\tconst value = get();\n\n\t\t\tObject.defineProperty(object, property, {\n\t\t\t\tvalue,\n\t\t\t\tenumerable: true,\n\t\t\t\tconfigurable: true\n\t\t\t});\n\n\t\t\treturn value;\n\t\t},\n\t\tenumerable: true,\n\t\tconfigurable: true\n\t});\n};\n\n/** @type {typeof import('color-convert')} */\nlet colorConvert;\nconst makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {\n\tif (colorConvert === undefined) {\n\t\tcolorConvert = require('color-convert');\n\t}\n\n\tconst offset = isBackground ? 10 : 0;\n\tconst styles = {};\n\n\tfor (const [sourceSpace, suite] of Object.entries(colorConvert)) {\n\t\tconst name = sourceSpace === 'ansi16' ? 'ansi' : sourceSpace;\n\t\tif (sourceSpace === targetSpace) {\n\t\t\tstyles[name] = wrap(identity, offset);\n\t\t} else if (typeof suite === 'object') {\n\t\t\tstyles[name] = wrap(suite[targetSpace], offset);\n\t\t}\n\t}\n\n\treturn styles;\n};\n\nfunction assembleStyles() {\n\tconst codes = new Map();\n\tconst styles = {\n\t\tmodifier: {\n\t\t\treset: [0, 0],\n\t\t\t// 21 isn't widely supported and 22 does the same thing\n\t\t\tbold: [1, 22],\n\t\t\tdim: [2, 22],\n\t\t\titalic: [3, 23],\n\t\t\tunderline: [4, 24],\n\t\t\tinverse: [7, 27],\n\t\t\thidden: [8, 28],\n\t\t\tstrikethrough: [9, 29]\n\t\t},\n\t\tcolor: {\n\t\t\tblack: [30, 39],\n\t\t\tred: [31, 39],\n\t\t\tgreen: [32, 39],\n\t\t\tyellow: [33, 39],\n\t\t\tblue: [34, 39],\n\t\t\tmagenta: [35, 39],\n\t\t\tcyan: [36, 39],\n\t\t\twhite: [37, 39],\n\n\t\t\t// Bright color\n\t\t\tblackBright: [90, 39],\n\t\t\tredBright: [91, 39],\n\t\t\tgreenBright: [92, 39],\n\t\t\tyellowBright: [93, 39],\n\t\t\tblueBright: [94, 39],\n\t\t\tmagentaBright: [95, 39],\n\t\t\tcyanBright: [96, 39],\n\t\t\twhiteBright: [97, 39]\n\t\t},\n\t\tbgColor: {\n\t\t\tbgBlack: [40, 49],\n\t\t\tbgRed: [41, 49],\n\t\t\tbgGreen: [42, 49],\n\t\t\tbgYellow: [43, 49],\n\t\t\tbgBlue: [44, 49],\n\t\t\tbgMagenta: [45, 49],\n\t\t\tbgCyan: [46, 49],\n\t\t\tbgWhite: [47, 49],\n\n\t\t\t// Bright color\n\t\t\tbgBlackBright: [100, 49],\n\t\t\tbgRedBright: [101, 49],\n\t\t\tbgGreenBright: [102, 49],\n\t\t\tbgYellowBright: [103, 49],\n\t\t\tbgBlueBright: [104, 49],\n\t\t\tbgMagentaBright: [105, 49],\n\t\t\tbgCyanBright: [106, 49],\n\t\t\tbgWhiteBright: [107, 49]\n\t\t}\n\t};\n\n\t// Alias bright black as gray (and grey)\n\tstyles.color.gray = styles.color.blackBright;\n\tstyles.bgColor.bgGray = styles.bgColor.bgBlackBright;\n\tstyles.color.grey = styles.color.blackBright;\n\tstyles.bgColor.bgGrey = styles.bgColor.bgBlackBright;\n\n\tfor (const [groupName, group] of Object.entries(styles)) {\n\t\tfor (const [styleName, style] of Object.entries(group)) {\n\t\t\tstyles[styleName] = {\n\t\t\t\topen: `\\u001B[${style[0]}m`,\n\t\t\t\tclose: `\\u001B[${style[1]}m`\n\t\t\t};\n\n\t\t\tgroup[styleName] = styles[styleName];\n\n\t\t\tcodes.set(style[0], style[1]);\n\t\t}\n\n\t\tObject.defineProperty(styles, groupName, {\n\t\t\tvalue: group,\n\t\t\tenumerable: false\n\t\t});\n\t}\n\n\tObject.defineProperty(styles, 'codes', {\n\t\tvalue: codes,\n\t\tenumerable: false\n\t});\n\n\tstyles.color.close = '\\u001B[39m';\n\tstyles.bgColor.close = '\\u001B[49m';\n\n\tsetLazyProperty(styles.color, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, false));\n\tsetLazyProperty(styles.color, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, false));\n\tsetLazyProperty(styles.bgColor, 'ansi', () => makeDynamicStyles(wrapAnsi16, 'ansi16', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi256', () => makeDynamicStyles(wrapAnsi256, 'ansi256', ansi2ansi, true));\n\tsetLazyProperty(styles.bgColor, 'ansi16m', () => makeDynamicStyles(wrapAnsi16m, 'rgb', rgb2rgb, true));\n\n\treturn styles;\n}\n\n// Make the export immutable\nObject.defineProperty(module, 'exports', {\n\tenumerable: true,\n\tget: assembleStyles\n});\n","'use strict';\nconst ansiStyles = require('ansi-styles');\nconst {stdout: stdoutColor, stderr: stderrColor} = require('supports-color');\nconst {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n} = require('./util');\n\nconst {isArray} = Array;\n\n// `supportsColor.level` → `ansiStyles.color[name]` mapping\nconst levelMapping = [\n\t'ansi',\n\t'ansi',\n\t'ansi256',\n\t'ansi16m'\n];\n\nconst styles = Object.create(null);\n\nconst applyOptions = (object, options = {}) => {\n\tif (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {\n\t\tthrow new Error('The `level` option should be an integer from 0 to 3');\n\t}\n\n\t// Detect level if not set manually\n\tconst colorLevel = stdoutColor ? stdoutColor.level : 0;\n\tobject.level = options.level === undefined ? colorLevel : options.level;\n};\n\nclass ChalkClass {\n\tconstructor(options) {\n\t\t// eslint-disable-next-line no-constructor-return\n\t\treturn chalkFactory(options);\n\t}\n}\n\nconst chalkFactory = options => {\n\tconst chalk = {};\n\tapplyOptions(chalk, options);\n\n\tchalk.template = (...arguments_) => chalkTag(chalk.template, ...arguments_);\n\n\tObject.setPrototypeOf(chalk, Chalk.prototype);\n\tObject.setPrototypeOf(chalk.template, chalk);\n\n\tchalk.template.constructor = () => {\n\t\tthrow new Error('`chalk.constructor()` is deprecated. Use `new chalk.Instance()` instead.');\n\t};\n\n\tchalk.template.Instance = ChalkClass;\n\n\treturn chalk.template;\n};\n\nfunction Chalk(options) {\n\treturn chalkFactory(options);\n}\n\nfor (const [styleName, style] of Object.entries(ansiStyles)) {\n\tstyles[styleName] = {\n\t\tget() {\n\t\t\tconst builder = createBuilder(this, createStyler(style.open, style.close, this._styler), this._isEmpty);\n\t\t\tObject.defineProperty(this, styleName, {value: builder});\n\t\t\treturn builder;\n\t\t}\n\t};\n}\n\nstyles.visible = {\n\tget() {\n\t\tconst builder = createBuilder(this, this._styler, true);\n\t\tObject.defineProperty(this, 'visible', {value: builder});\n\t\treturn builder;\n\t}\n};\n\nconst usedModels = ['rgb', 'hex', 'keyword', 'hsl', 'hsv', 'hwb', 'ansi', 'ansi256'];\n\nfor (const model of usedModels) {\n\tstyles[model] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.color[levelMapping[level]][model](...arguments_), ansiStyles.color.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nfor (const model of usedModels) {\n\tconst bgModel = 'bg' + model[0].toUpperCase() + model.slice(1);\n\tstyles[bgModel] = {\n\t\tget() {\n\t\t\tconst {level} = this;\n\t\t\treturn function (...arguments_) {\n\t\t\t\tconst styler = createStyler(ansiStyles.bgColor[levelMapping[level]][model](...arguments_), ansiStyles.bgColor.close, this._styler);\n\t\t\t\treturn createBuilder(this, styler, this._isEmpty);\n\t\t\t};\n\t\t}\n\t};\n}\n\nconst proto = Object.defineProperties(() => {}, {\n\t...styles,\n\tlevel: {\n\t\tenumerable: true,\n\t\tget() {\n\t\t\treturn this._generator.level;\n\t\t},\n\t\tset(level) {\n\t\t\tthis._generator.level = level;\n\t\t}\n\t}\n});\n\nconst createStyler = (open, close, parent) => {\n\tlet openAll;\n\tlet closeAll;\n\tif (parent === undefined) {\n\t\topenAll = open;\n\t\tcloseAll = close;\n\t} else {\n\t\topenAll = parent.openAll + open;\n\t\tcloseAll = close + parent.closeAll;\n\t}\n\n\treturn {\n\t\topen,\n\t\tclose,\n\t\topenAll,\n\t\tcloseAll,\n\t\tparent\n\t};\n};\n\nconst createBuilder = (self, _styler, _isEmpty) => {\n\tconst builder = (...arguments_) => {\n\t\tif (isArray(arguments_[0]) && isArray(arguments_[0].raw)) {\n\t\t\t// Called as a template literal, for example: chalk.red`2 + 3 = {bold ${2+3}}`\n\t\t\treturn applyStyle(builder, chalkTag(builder, ...arguments_));\n\t\t}\n\n\t\t// Single argument is hot path, implicit coercion is faster than anything\n\t\t// eslint-disable-next-line no-implicit-coercion\n\t\treturn applyStyle(builder, (arguments_.length === 1) ? ('' + arguments_[0]) : arguments_.join(' '));\n\t};\n\n\t// We alter the prototype because we must return a function, but there is\n\t// no way to create a function with a different prototype\n\tObject.setPrototypeOf(builder, proto);\n\n\tbuilder._generator = self;\n\tbuilder._styler = _styler;\n\tbuilder._isEmpty = _isEmpty;\n\n\treturn builder;\n};\n\nconst applyStyle = (self, string) => {\n\tif (self.level <= 0 || !string) {\n\t\treturn self._isEmpty ? '' : string;\n\t}\n\n\tlet styler = self._styler;\n\n\tif (styler === undefined) {\n\t\treturn string;\n\t}\n\n\tconst {openAll, closeAll} = styler;\n\tif (string.indexOf('\\u001B') !== -1) {\n\t\twhile (styler !== undefined) {\n\t\t\t// Replace any instances already present with a re-opening code\n\t\t\t// otherwise only the part of the string until said closing code\n\t\t\t// will be colored, and the rest will simply be 'plain'.\n\t\t\tstring = stringReplaceAll(string, styler.close, styler.open);\n\n\t\t\tstyler = styler.parent;\n\t\t}\n\t}\n\n\t// We can move both next actions out of loop, because remaining actions in loop won't have\n\t// any/visible effect on parts we add here. Close the styling before a linebreak and reopen\n\t// after next line to fix a bleed issue on macOS: https://github.com/chalk/chalk/pull/92\n\tconst lfIndex = string.indexOf('\\n');\n\tif (lfIndex !== -1) {\n\t\tstring = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);\n\t}\n\n\treturn openAll + string + closeAll;\n};\n\nlet template;\nconst chalkTag = (chalk, ...strings) => {\n\tconst [firstString] = strings;\n\n\tif (!isArray(firstString) || !isArray(firstString.raw)) {\n\t\t// If chalk() was called by itself or with a string,\n\t\t// return the string itself as a string.\n\t\treturn strings.join(' ');\n\t}\n\n\tconst arguments_ = strings.slice(1);\n\tconst parts = [firstString.raw[0]];\n\n\tfor (let i = 1; i < firstString.length; i++) {\n\t\tparts.push(\n\t\t\tString(arguments_[i - 1]).replace(/[{}\\\\]/g, '\\\\$&'),\n\t\t\tString(firstString.raw[i])\n\t\t);\n\t}\n\n\tif (template === undefined) {\n\t\ttemplate = require('./templates');\n\t}\n\n\treturn template(chalk, parts.join(''));\n};\n\nObject.defineProperties(Chalk.prototype, styles);\n\nconst chalk = Chalk(); // eslint-disable-line new-cap\nchalk.supportsColor = stdoutColor;\nchalk.stderr = Chalk({level: stderrColor ? stderrColor.level : 0}); // eslint-disable-line new-cap\nchalk.stderr.supportsColor = stderrColor;\n\nmodule.exports = chalk;\n","'use strict';\nconst 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;\nconst STYLE_REGEX = /(?:^|\\.)(\\w+)(?:\\(([^)]*)\\))?/g;\nconst STRING_REGEX = /^(['\"])((?:\\\\.|(?!\\1)[^\\\\])*)\\1$/;\nconst ESCAPE_REGEX = /\\\\(u(?:[a-f\\d]{4}|{[a-f\\d]{1,6}})|x[a-f\\d]{2}|.)|([^\\\\])/gi;\n\nconst ESCAPES = new Map([\n\t['n', '\\n'],\n\t['r', '\\r'],\n\t['t', '\\t'],\n\t['b', '\\b'],\n\t['f', '\\f'],\n\t['v', '\\v'],\n\t['0', '\\0'],\n\t['\\\\', '\\\\'],\n\t['e', '\\u001B'],\n\t['a', '\\u0007']\n]);\n\nfunction unescape(c) {\n\tconst u = c[0] === 'u';\n\tconst bracket = c[1] === '{';\n\n\tif ((u && !bracket && c.length === 5) || (c[0] === 'x' && c.length === 3)) {\n\t\treturn String.fromCharCode(parseInt(c.slice(1), 16));\n\t}\n\n\tif (u && bracket) {\n\t\treturn String.fromCodePoint(parseInt(c.slice(2, -1), 16));\n\t}\n\n\treturn ESCAPES.get(c) || c;\n}\n\nfunction parseArguments(name, arguments_) {\n\tconst results = [];\n\tconst chunks = arguments_.trim().split(/\\s*,\\s*/g);\n\tlet matches;\n\n\tfor (const chunk of chunks) {\n\t\tconst number = Number(chunk);\n\t\tif (!Number.isNaN(number)) {\n\t\t\tresults.push(number);\n\t\t} else if ((matches = chunk.match(STRING_REGEX))) {\n\t\t\tresults.push(matches[2].replace(ESCAPE_REGEX, (m, escape, character) => escape ? unescape(escape) : character));\n\t\t} else {\n\t\t\tthrow new Error(`Invalid Chalk template style argument: ${chunk} (in style '${name}')`);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction parseStyle(style) {\n\tSTYLE_REGEX.lastIndex = 0;\n\n\tconst results = [];\n\tlet matches;\n\n\twhile ((matches = STYLE_REGEX.exec(style)) !== null) {\n\t\tconst name = matches[1];\n\n\t\tif (matches[2]) {\n\t\t\tconst args = parseArguments(name, matches[2]);\n\t\t\tresults.push([name].concat(args));\n\t\t} else {\n\t\t\tresults.push([name]);\n\t\t}\n\t}\n\n\treturn results;\n}\n\nfunction buildStyle(chalk, styles) {\n\tconst enabled = {};\n\n\tfor (const layer of styles) {\n\t\tfor (const style of layer.styles) {\n\t\t\tenabled[style[0]] = layer.inverse ? null : style.slice(1);\n\t\t}\n\t}\n\n\tlet current = chalk;\n\tfor (const [styleName, styles] of Object.entries(enabled)) {\n\t\tif (!Array.isArray(styles)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (!(styleName in current)) {\n\t\t\tthrow new Error(`Unknown Chalk style: ${styleName}`);\n\t\t}\n\n\t\tcurrent = styles.length > 0 ? current[styleName](...styles) : current[styleName];\n\t}\n\n\treturn current;\n}\n\nmodule.exports = (chalk, temporary) => {\n\tconst styles = [];\n\tconst chunks = [];\n\tlet chunk = [];\n\n\t// eslint-disable-next-line max-params\n\ttemporary.replace(TEMPLATE_REGEX, (m, escapeCharacter, inverse, style, close, character) => {\n\t\tif (escapeCharacter) {\n\t\t\tchunk.push(unescape(escapeCharacter));\n\t\t} else if (style) {\n\t\t\tconst string = chunk.join('');\n\t\t\tchunk = [];\n\t\t\tchunks.push(styles.length === 0 ? string : buildStyle(chalk, styles)(string));\n\t\t\tstyles.push({inverse, styles: parseStyle(style)});\n\t\t} else if (close) {\n\t\t\tif (styles.length === 0) {\n\t\t\t\tthrow new Error('Found extraneous } in Chalk template literal');\n\t\t\t}\n\n\t\t\tchunks.push(buildStyle(chalk, styles)(chunk.join('')));\n\t\t\tchunk = [];\n\t\t\tstyles.pop();\n\t\t} else {\n\t\t\tchunk.push(character);\n\t\t}\n\t});\n\n\tchunks.push(chunk.join(''));\n\n\tif (styles.length > 0) {\n\t\tconst errMessage = `Chalk template literal is missing ${styles.length} closing bracket${styles.length === 1 ? '' : 's'} (\\`}\\`)`;\n\t\tthrow new Error(errMessage);\n\t}\n\n\treturn chunks.join('');\n};\n","'use strict';\n\nconst stringReplaceAll = (string, substring, replacer) => {\n\tlet index = string.indexOf(substring);\n\tif (index === -1) {\n\t\treturn string;\n\t}\n\n\tconst substringLength = substring.length;\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\treturnValue += string.substr(endIndex, index - endIndex) + substring + replacer;\n\t\tendIndex = index + substringLength;\n\t\tindex = string.indexOf(substring, endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nconst stringEncaseCRLFWithFirstIndex = (string, prefix, postfix, index) => {\n\tlet endIndex = 0;\n\tlet returnValue = '';\n\tdo {\n\t\tconst gotCR = string[index - 1] === '\\r';\n\t\treturnValue += string.substr(endIndex, (gotCR ? index - 1 : index) - endIndex) + prefix + (gotCR ? '\\r\\n' : '\\n') + postfix;\n\t\tendIndex = index + 1;\n\t\tindex = string.indexOf('\\n', endIndex);\n\t} while (index !== -1);\n\n\treturnValue += string.substr(endIndex);\n\treturn returnValue;\n};\n\nmodule.exports = {\n\tstringReplaceAll,\n\tstringEncaseCRLFWithFirstIndex\n};\n","/* MIT license */\n/* eslint-disable no-mixed-operators */\nconst cssKeywords = require('color-name');\n\n// NOTE: conversions should only return primitive values (i.e. arrays, or\n//       values that give correct `typeof` results).\n//       do not use box values types (i.e. Number(), String(), etc.)\n\nconst reverseKeywords = {};\nfor (const key of Object.keys(cssKeywords)) {\n\treverseKeywords[cssKeywords[key]] = key;\n}\n\nconst convert = {\n\trgb: {channels: 3, labels: 'rgb'},\n\thsl: {channels: 3, labels: 'hsl'},\n\thsv: {channels: 3, labels: 'hsv'},\n\thwb: {channels: 3, labels: 'hwb'},\n\tcmyk: {channels: 4, labels: 'cmyk'},\n\txyz: {channels: 3, labels: 'xyz'},\n\tlab: {channels: 3, labels: 'lab'},\n\tlch: {channels: 3, labels: 'lch'},\n\thex: {channels: 1, labels: ['hex']},\n\tkeyword: {channels: 1, labels: ['keyword']},\n\tansi16: {channels: 1, labels: ['ansi16']},\n\tansi256: {channels: 1, labels: ['ansi256']},\n\thcg: {channels: 3, labels: ['h', 'c', 'g']},\n\tapple: {channels: 3, labels: ['r16', 'g16', 'b16']},\n\tgray: {channels: 1, labels: ['gray']}\n};\n\nmodule.exports = convert;\n\n// Hide .channels and .labels properties\nfor (const model of Object.keys(convert)) {\n\tif (!('channels' in convert[model])) {\n\t\tthrow new Error('missing channels property: ' + model);\n\t}\n\n\tif (!('labels' in convert[model])) {\n\t\tthrow new Error('missing channel labels property: ' + model);\n\t}\n\n\tif (convert[model].labels.length !== convert[model].channels) {\n\t\tthrow new Error('channel and label counts mismatch: ' + model);\n\t}\n\n\tconst {channels, labels} = convert[model];\n\tdelete convert[model].channels;\n\tdelete convert[model].labels;\n\tObject.defineProperty(convert[model], 'channels', {value: channels});\n\tObject.defineProperty(convert[model], 'labels', {value: labels});\n}\n\nconvert.rgb.hsl = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst min = Math.min(r, g, b);\n\tconst max = Math.max(r, g, b);\n\tconst delta = max - min;\n\tlet h;\n\tlet s;\n\n\tif (max === min) {\n\t\th = 0;\n\t} else if (r === max) {\n\t\th = (g - b) / delta;\n\t} else if (g === max) {\n\t\th = 2 + (b - r) / delta;\n\t} else if (b === max) {\n\t\th = 4 + (r - g) / delta;\n\t}\n\n\th = Math.min(h * 60, 360);\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst l = (min + max) / 2;\n\n\tif (max === min) {\n\t\ts = 0;\n\t} else if (l <= 0.5) {\n\t\ts = delta / (max + min);\n\t} else {\n\t\ts = delta / (2 - max - min);\n\t}\n\n\treturn [h, s * 100, l * 100];\n};\n\nconvert.rgb.hsv = function (rgb) {\n\tlet rdif;\n\tlet gdif;\n\tlet bdif;\n\tlet h;\n\tlet s;\n\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst v = Math.max(r, g, b);\n\tconst diff = v - Math.min(r, g, b);\n\tconst diffc = function (c) {\n\t\treturn (v - c) / 6 / diff + 1 / 2;\n\t};\n\n\tif (diff === 0) {\n\t\th = 0;\n\t\ts = 0;\n\t} else {\n\t\ts = diff / v;\n\t\trdif = diffc(r);\n\t\tgdif = diffc(g);\n\t\tbdif = diffc(b);\n\n\t\tif (r === v) {\n\t\t\th = bdif - gdif;\n\t\t} else if (g === v) {\n\t\t\th = (1 / 3) + rdif - bdif;\n\t\t} else if (b === v) {\n\t\t\th = (2 / 3) + gdif - rdif;\n\t\t}\n\n\t\tif (h < 0) {\n\t\t\th += 1;\n\t\t} else if (h > 1) {\n\t\t\th -= 1;\n\t\t}\n\t}\n\n\treturn [\n\t\th * 360,\n\t\ts * 100,\n\t\tv * 100\n\t];\n};\n\nconvert.rgb.hwb = function (rgb) {\n\tconst r = rgb[0];\n\tconst g = rgb[1];\n\tlet b = rgb[2];\n\tconst h = convert.rgb.hsl(rgb)[0];\n\tconst w = 1 / 255 * Math.min(r, Math.min(g, b));\n\n\tb = 1 - 1 / 255 * Math.max(r, Math.max(g, b));\n\n\treturn [h, w * 100, b * 100];\n};\n\nconvert.rgb.cmyk = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\n\tconst k = Math.min(1 - r, 1 - g, 1 - b);\n\tconst c = (1 - r - k) / (1 - k) || 0;\n\tconst m = (1 - g - k) / (1 - k) || 0;\n\tconst y = (1 - b - k) / (1 - k) || 0;\n\n\treturn [c * 100, m * 100, y * 100, k * 100];\n};\n\nfunction comparativeDistance(x, y) {\n\t/*\n\t\tSee https://en.m.wikipedia.org/wiki/Euclidean_distance#Squared_Euclidean_distance\n\t*/\n\treturn (\n\t\t((x[0] - y[0]) ** 2) +\n\t\t((x[1] - y[1]) ** 2) +\n\t\t((x[2] - y[2]) ** 2)\n\t);\n}\n\nconvert.rgb.keyword = function (rgb) {\n\tconst reversed = reverseKeywords[rgb];\n\tif (reversed) {\n\t\treturn reversed;\n\t}\n\n\tlet currentClosestDistance = Infinity;\n\tlet currentClosestKeyword;\n\n\tfor (const keyword of Object.keys(cssKeywords)) {\n\t\tconst value = cssKeywords[keyword];\n\n\t\t// Compute comparative distance\n\t\tconst distance = comparativeDistance(rgb, value);\n\n\t\t// Check if its less, if so set as closest\n\t\tif (distance < currentClosestDistance) {\n\t\t\tcurrentClosestDistance = distance;\n\t\t\tcurrentClosestKeyword = keyword;\n\t\t}\n\t}\n\n\treturn currentClosestKeyword;\n};\n\nconvert.keyword.rgb = function (keyword) {\n\treturn cssKeywords[keyword];\n};\n\nconvert.rgb.xyz = function (rgb) {\n\tlet r = rgb[0] / 255;\n\tlet g = rgb[1] / 255;\n\tlet b = rgb[2] / 255;\n\n\t// Assume sRGB\n\tr = r > 0.04045 ? (((r + 0.055) / 1.055) ** 2.4) : (r / 12.92);\n\tg = g > 0.04045 ? (((g + 0.055) / 1.055) ** 2.4) : (g / 12.92);\n\tb = b > 0.04045 ? (((b + 0.055) / 1.055) ** 2.4) : (b / 12.92);\n\n\tconst x = (r * 0.4124) + (g * 0.3576) + (b * 0.1805);\n\tconst y = (r * 0.2126) + (g * 0.7152) + (b * 0.0722);\n\tconst z = (r * 0.0193) + (g * 0.1192) + (b * 0.9505);\n\n\treturn [x * 100, y * 100, z * 100];\n};\n\nconvert.rgb.lab = function (rgb) {\n\tconst xyz = convert.rgb.xyz(rgb);\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.hsl.rgb = function (hsl) {\n\tconst h = hsl[0] / 360;\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\tlet t2;\n\tlet t3;\n\tlet val;\n\n\tif (s === 0) {\n\t\tval = l * 255;\n\t\treturn [val, val, val];\n\t}\n\n\tif (l < 0.5) {\n\t\tt2 = l * (1 + s);\n\t} else {\n\t\tt2 = l + s - l * s;\n\t}\n\n\tconst t1 = 2 * l - t2;\n\n\tconst rgb = [0, 0, 0];\n\tfor (let i = 0; i < 3; i++) {\n\t\tt3 = h + 1 / 3 * -(i - 1);\n\t\tif (t3 < 0) {\n\t\t\tt3++;\n\t\t}\n\n\t\tif (t3 > 1) {\n\t\t\tt3--;\n\t\t}\n\n\t\tif (6 * t3 < 1) {\n\t\t\tval = t1 + (t2 - t1) * 6 * t3;\n\t\t} else if (2 * t3 < 1) {\n\t\t\tval = t2;\n\t\t} else if (3 * t3 < 2) {\n\t\t\tval = t1 + (t2 - t1) * (2 / 3 - t3) * 6;\n\t\t} else {\n\t\t\tval = t1;\n\t\t}\n\n\t\trgb[i] = val * 255;\n\t}\n\n\treturn rgb;\n};\n\nconvert.hsl.hsv = function (hsl) {\n\tconst h = hsl[0];\n\tlet s = hsl[1] / 100;\n\tlet l = hsl[2] / 100;\n\tlet smin = s;\n\tconst lmin = Math.max(l, 0.01);\n\n\tl *= 2;\n\ts *= (l <= 1) ? l : 2 - l;\n\tsmin *= lmin <= 1 ? lmin : 2 - lmin;\n\tconst v = (l + s) / 2;\n\tconst sv = l === 0 ? (2 * smin) / (lmin + smin) : (2 * s) / (l + s);\n\n\treturn [h, sv * 100, v * 100];\n};\n\nconvert.hsv.rgb = function (hsv) {\n\tconst h = hsv[0] / 60;\n\tconst s = hsv[1] / 100;\n\tlet v = hsv[2] / 100;\n\tconst hi = Math.floor(h) % 6;\n\n\tconst f = h - Math.floor(h);\n\tconst p = 255 * v * (1 - s);\n\tconst q = 255 * v * (1 - (s * f));\n\tconst t = 255 * v * (1 - (s * (1 - f)));\n\tv *= 255;\n\n\tswitch (hi) {\n\t\tcase 0:\n\t\t\treturn [v, t, p];\n\t\tcase 1:\n\t\t\treturn [q, v, p];\n\t\tcase 2:\n\t\t\treturn [p, v, t];\n\t\tcase 3:\n\t\t\treturn [p, q, v];\n\t\tcase 4:\n\t\t\treturn [t, p, v];\n\t\tcase 5:\n\t\t\treturn [v, p, q];\n\t}\n};\n\nconvert.hsv.hsl = function (hsv) {\n\tconst h = hsv[0];\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\tconst vmin = Math.max(v, 0.01);\n\tlet sl;\n\tlet l;\n\n\tl = (2 - s) * v;\n\tconst lmin = (2 - s) * vmin;\n\tsl = s * vmin;\n\tsl /= (lmin <= 1) ? lmin : 2 - lmin;\n\tsl = sl || 0;\n\tl /= 2;\n\n\treturn [h, sl * 100, l * 100];\n};\n\n// http://dev.w3.org/csswg/css-color/#hwb-to-rgb\nconvert.hwb.rgb = function (hwb) {\n\tconst h = hwb[0] / 360;\n\tlet wh = hwb[1] / 100;\n\tlet bl = hwb[2] / 100;\n\tconst ratio = wh + bl;\n\tlet f;\n\n\t// Wh + bl cant be > 1\n\tif (ratio > 1) {\n\t\twh /= ratio;\n\t\tbl /= ratio;\n\t}\n\n\tconst i = Math.floor(6 * h);\n\tconst v = 1 - bl;\n\tf = 6 * h - i;\n\n\tif ((i & 0x01) !== 0) {\n\t\tf = 1 - f;\n\t}\n\n\tconst n = wh + f * (v - wh); // Linear interpolation\n\n\tlet r;\n\tlet g;\n\tlet b;\n\t/* eslint-disable max-statements-per-line,no-multi-spaces */\n\tswitch (i) {\n\t\tdefault:\n\t\tcase 6:\n\t\tcase 0: r = v;  g = n;  b = wh; break;\n\t\tcase 1: r = n;  g = v;  b = wh; break;\n\t\tcase 2: r = wh; g = v;  b = n; break;\n\t\tcase 3: r = wh; g = n;  b = v; break;\n\t\tcase 4: r = n;  g = wh; b = v; break;\n\t\tcase 5: r = v;  g = wh; b = n; break;\n\t}\n\t/* eslint-enable max-statements-per-line,no-multi-spaces */\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.cmyk.rgb = function (cmyk) {\n\tconst c = cmyk[0] / 100;\n\tconst m = cmyk[1] / 100;\n\tconst y = cmyk[2] / 100;\n\tconst k = cmyk[3] / 100;\n\n\tconst r = 1 - Math.min(1, c * (1 - k) + k);\n\tconst g = 1 - Math.min(1, m * (1 - k) + k);\n\tconst b = 1 - Math.min(1, y * (1 - k) + k);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.rgb = function (xyz) {\n\tconst x = xyz[0] / 100;\n\tconst y = xyz[1] / 100;\n\tconst z = xyz[2] / 100;\n\tlet r;\n\tlet g;\n\tlet b;\n\n\tr = (x * 3.2406) + (y * -1.5372) + (z * -0.4986);\n\tg = (x * -0.9689) + (y * 1.8758) + (z * 0.0415);\n\tb = (x * 0.0557) + (y * -0.2040) + (z * 1.0570);\n\n\t// Assume sRGB\n\tr = r > 0.0031308\n\t\t? ((1.055 * (r ** (1.0 / 2.4))) - 0.055)\n\t\t: r * 12.92;\n\n\tg = g > 0.0031308\n\t\t? ((1.055 * (g ** (1.0 / 2.4))) - 0.055)\n\t\t: g * 12.92;\n\n\tb = b > 0.0031308\n\t\t? ((1.055 * (b ** (1.0 / 2.4))) - 0.055)\n\t\t: b * 12.92;\n\n\tr = Math.min(Math.max(0, r), 1);\n\tg = Math.min(Math.max(0, g), 1);\n\tb = Math.min(Math.max(0, b), 1);\n\n\treturn [r * 255, g * 255, b * 255];\n};\n\nconvert.xyz.lab = function (xyz) {\n\tlet x = xyz[0];\n\tlet y = xyz[1];\n\tlet z = xyz[2];\n\n\tx /= 95.047;\n\ty /= 100;\n\tz /= 108.883;\n\n\tx = x > 0.008856 ? (x ** (1 / 3)) : (7.787 * x) + (16 / 116);\n\ty = y > 0.008856 ? (y ** (1 / 3)) : (7.787 * y) + (16 / 116);\n\tz = z > 0.008856 ? (z ** (1 / 3)) : (7.787 * z) + (16 / 116);\n\n\tconst l = (116 * y) - 16;\n\tconst a = 500 * (x - y);\n\tconst b = 200 * (y - z);\n\n\treturn [l, a, b];\n};\n\nconvert.lab.xyz = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet x;\n\tlet y;\n\tlet z;\n\n\ty = (l + 16) / 116;\n\tx = a / 500 + y;\n\tz = y - b / 200;\n\n\tconst y2 = y ** 3;\n\tconst x2 = x ** 3;\n\tconst z2 = z ** 3;\n\ty = y2 > 0.008856 ? y2 : (y - 16 / 116) / 7.787;\n\tx = x2 > 0.008856 ? x2 : (x - 16 / 116) / 7.787;\n\tz = z2 > 0.008856 ? z2 : (z - 16 / 116) / 7.787;\n\n\tx *= 95.047;\n\ty *= 100;\n\tz *= 108.883;\n\n\treturn [x, y, z];\n};\n\nconvert.lab.lch = function (lab) {\n\tconst l = lab[0];\n\tconst a = lab[1];\n\tconst b = lab[2];\n\tlet h;\n\n\tconst hr = Math.atan2(b, a);\n\th = hr * 360 / 2 / Math.PI;\n\n\tif (h < 0) {\n\t\th += 360;\n\t}\n\n\tconst c = Math.sqrt(a * a + b * b);\n\n\treturn [l, c, h];\n};\n\nconvert.lch.lab = function (lch) {\n\tconst l = lch[0];\n\tconst c = lch[1];\n\tconst h = lch[2];\n\n\tconst hr = h / 360 * 2 * Math.PI;\n\tconst a = c * Math.cos(hr);\n\tconst b = c * Math.sin(hr);\n\n\treturn [l, a, b];\n};\n\nconvert.rgb.ansi16 = function (args, saturation = null) {\n\tconst [r, g, b] = args;\n\tlet value = saturation === null ? convert.rgb.hsv(args)[2] : saturation; // Hsv -> ansi16 optimization\n\n\tvalue = Math.round(value / 50);\n\n\tif (value === 0) {\n\t\treturn 30;\n\t}\n\n\tlet ansi = 30\n\t\t+ ((Math.round(b / 255) << 2)\n\t\t| (Math.round(g / 255) << 1)\n\t\t| Math.round(r / 255));\n\n\tif (value === 2) {\n\t\tansi += 60;\n\t}\n\n\treturn ansi;\n};\n\nconvert.hsv.ansi16 = function (args) {\n\t// Optimization here; we already know the value and don't need to get\n\t// it converted for us.\n\treturn convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);\n};\n\nconvert.rgb.ansi256 = function (args) {\n\tconst r = args[0];\n\tconst g = args[1];\n\tconst b = args[2];\n\n\t// We use the extended greyscale palette here, with the exception of\n\t// black and white. normal palette only has 4 greyscale shades.\n\tif (r === g && g === b) {\n\t\tif (r < 8) {\n\t\t\treturn 16;\n\t\t}\n\n\t\tif (r > 248) {\n\t\t\treturn 231;\n\t\t}\n\n\t\treturn Math.round(((r - 8) / 247) * 24) + 232;\n\t}\n\n\tconst ansi = 16\n\t\t+ (36 * Math.round(r / 255 * 5))\n\t\t+ (6 * Math.round(g / 255 * 5))\n\t\t+ Math.round(b / 255 * 5);\n\n\treturn ansi;\n};\n\nconvert.ansi16.rgb = function (args) {\n\tlet color = args % 10;\n\n\t// Handle greyscale\n\tif (color === 0 || color === 7) {\n\t\tif (args > 50) {\n\t\t\tcolor += 3.5;\n\t\t}\n\n\t\tcolor = color / 10.5 * 255;\n\n\t\treturn [color, color, color];\n\t}\n\n\tconst mult = (~~(args > 50) + 1) * 0.5;\n\tconst r = ((color & 1) * mult) * 255;\n\tconst g = (((color >> 1) & 1) * mult) * 255;\n\tconst b = (((color >> 2) & 1) * mult) * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.ansi256.rgb = function (args) {\n\t// Handle greyscale\n\tif (args >= 232) {\n\t\tconst c = (args - 232) * 10 + 8;\n\t\treturn [c, c, c];\n\t}\n\n\targs -= 16;\n\n\tlet rem;\n\tconst r = Math.floor(args / 36) / 5 * 255;\n\tconst g = Math.floor((rem = args % 36) / 6) / 5 * 255;\n\tconst b = (rem % 6) / 5 * 255;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hex = function (args) {\n\tconst integer = ((Math.round(args[0]) & 0xFF) << 16)\n\t\t+ ((Math.round(args[1]) & 0xFF) << 8)\n\t\t+ (Math.round(args[2]) & 0xFF);\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.hex.rgb = function (args) {\n\tconst match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);\n\tif (!match) {\n\t\treturn [0, 0, 0];\n\t}\n\n\tlet colorString = match[0];\n\n\tif (match[0].length === 3) {\n\t\tcolorString = colorString.split('').map(char => {\n\t\t\treturn char + char;\n\t\t}).join('');\n\t}\n\n\tconst integer = parseInt(colorString, 16);\n\tconst r = (integer >> 16) & 0xFF;\n\tconst g = (integer >> 8) & 0xFF;\n\tconst b = integer & 0xFF;\n\n\treturn [r, g, b];\n};\n\nconvert.rgb.hcg = function (rgb) {\n\tconst r = rgb[0] / 255;\n\tconst g = rgb[1] / 255;\n\tconst b = rgb[2] / 255;\n\tconst max = Math.max(Math.max(r, g), b);\n\tconst min = Math.min(Math.min(r, g), b);\n\tconst chroma = (max - min);\n\tlet grayscale;\n\tlet hue;\n\n\tif (chroma < 1) {\n\t\tgrayscale = min / (1 - chroma);\n\t} else {\n\t\tgrayscale = 0;\n\t}\n\n\tif (chroma <= 0) {\n\t\thue = 0;\n\t} else\n\tif (max === r) {\n\t\thue = ((g - b) / chroma) % 6;\n\t} else\n\tif (max === g) {\n\t\thue = 2 + (b - r) / chroma;\n\t} else {\n\t\thue = 4 + (r - g) / chroma;\n\t}\n\n\thue /= 6;\n\thue %= 1;\n\n\treturn [hue * 360, chroma * 100, grayscale * 100];\n};\n\nconvert.hsl.hcg = function (hsl) {\n\tconst s = hsl[1] / 100;\n\tconst l = hsl[2] / 100;\n\n\tconst c = l < 0.5 ? (2.0 * s * l) : (2.0 * s * (1.0 - l));\n\n\tlet f = 0;\n\tif (c < 1.0) {\n\t\tf = (l - 0.5 * c) / (1.0 - c);\n\t}\n\n\treturn [hsl[0], c * 100, f * 100];\n};\n\nconvert.hsv.hcg = function (hsv) {\n\tconst s = hsv[1] / 100;\n\tconst v = hsv[2] / 100;\n\n\tconst c = s * v;\n\tlet f = 0;\n\n\tif (c < 1.0) {\n\t\tf = (v - c) / (1 - c);\n\t}\n\n\treturn [hsv[0], c * 100, f * 100];\n};\n\nconvert.hcg.rgb = function (hcg) {\n\tconst h = hcg[0] / 360;\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tif (c === 0.0) {\n\t\treturn [g * 255, g * 255, g * 255];\n\t}\n\n\tconst pure = [0, 0, 0];\n\tconst hi = (h % 1) * 6;\n\tconst v = hi % 1;\n\tconst w = 1 - v;\n\tlet mg = 0;\n\n\t/* eslint-disable max-statements-per-line */\n\tswitch (Math.floor(hi)) {\n\t\tcase 0:\n\t\t\tpure[0] = 1; pure[1] = v; pure[2] = 0; break;\n\t\tcase 1:\n\t\t\tpure[0] = w; pure[1] = 1; pure[2] = 0; break;\n\t\tcase 2:\n\t\t\tpure[0] = 0; pure[1] = 1; pure[2] = v; break;\n\t\tcase 3:\n\t\t\tpure[0] = 0; pure[1] = w; pure[2] = 1; break;\n\t\tcase 4:\n\t\t\tpure[0] = v; pure[1] = 0; pure[2] = 1; break;\n\t\tdefault:\n\t\t\tpure[0] = 1; pure[1] = 0; pure[2] = w;\n\t}\n\t/* eslint-enable max-statements-per-line */\n\n\tmg = (1.0 - c) * g;\n\n\treturn [\n\t\t(c * pure[0] + mg) * 255,\n\t\t(c * pure[1] + mg) * 255,\n\t\t(c * pure[2] + mg) * 255\n\t];\n};\n\nconvert.hcg.hsv = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst v = c + g * (1.0 - c);\n\tlet f = 0;\n\n\tif (v > 0.0) {\n\t\tf = c / v;\n\t}\n\n\treturn [hcg[0], f * 100, v * 100];\n};\n\nconvert.hcg.hsl = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\n\tconst l = g * (1.0 - c) + 0.5 * c;\n\tlet s = 0;\n\n\tif (l > 0.0 && l < 0.5) {\n\t\ts = c / (2 * l);\n\t} else\n\tif (l >= 0.5 && l < 1.0) {\n\t\ts = c / (2 * (1 - l));\n\t}\n\n\treturn [hcg[0], s * 100, l * 100];\n};\n\nconvert.hcg.hwb = function (hcg) {\n\tconst c = hcg[1] / 100;\n\tconst g = hcg[2] / 100;\n\tconst v = c + g * (1.0 - c);\n\treturn [hcg[0], (v - c) * 100, (1 - v) * 100];\n};\n\nconvert.hwb.hcg = function (hwb) {\n\tconst w = hwb[1] / 100;\n\tconst b = hwb[2] / 100;\n\tconst v = 1 - b;\n\tconst c = v - w;\n\tlet g = 0;\n\n\tif (c < 1) {\n\t\tg = (v - c) / (1 - c);\n\t}\n\n\treturn [hwb[0], c * 100, g * 100];\n};\n\nconvert.apple.rgb = function (apple) {\n\treturn [(apple[0] / 65535) * 255, (apple[1] / 65535) * 255, (apple[2] / 65535) * 255];\n};\n\nconvert.rgb.apple = function (rgb) {\n\treturn [(rgb[0] / 255) * 65535, (rgb[1] / 255) * 65535, (rgb[2] / 255) * 65535];\n};\n\nconvert.gray.rgb = function (args) {\n\treturn [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];\n};\n\nconvert.gray.hsl = function (args) {\n\treturn [0, 0, args[0]];\n};\n\nconvert.gray.hsv = convert.gray.hsl;\n\nconvert.gray.hwb = function (gray) {\n\treturn [0, 100, gray[0]];\n};\n\nconvert.gray.cmyk = function (gray) {\n\treturn [0, 0, 0, gray[0]];\n};\n\nconvert.gray.lab = function (gray) {\n\treturn [gray[0], 0, 0];\n};\n\nconvert.gray.hex = function (gray) {\n\tconst val = Math.round(gray[0] / 100 * 255) & 0xFF;\n\tconst integer = (val << 16) + (val << 8) + val;\n\n\tconst string = integer.toString(16).toUpperCase();\n\treturn '000000'.substring(string.length) + string;\n};\n\nconvert.rgb.gray = function (rgb) {\n\tconst val = (rgb[0] + rgb[1] + rgb[2]) / 3;\n\treturn [val / 255 * 100];\n};\n","const conversions = require('./conversions');\nconst route = require('./route');\n\nconst convert = {};\n\nconst models = Object.keys(conversions);\n\nfunction wrapRaw(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\treturn fn(args);\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nfunction wrapRounded(fn) {\n\tconst wrappedFn = function (...args) {\n\t\tconst arg0 = args[0];\n\n\t\tif (arg0 === undefined || arg0 === null) {\n\t\t\treturn arg0;\n\t\t}\n\n\t\tif (arg0.length > 1) {\n\t\t\targs = arg0;\n\t\t}\n\n\t\tconst result = fn(args);\n\n\t\t// We're assuming the result is an array here.\n\t\t// see notice in conversions.js; don't use box types\n\t\t// in conversion functions.\n\t\tif (typeof result === 'object') {\n\t\t\tfor (let len = result.length, i = 0; i < len; i++) {\n\t\t\t\tresult[i] = Math.round(result[i]);\n\t\t\t}\n\t\t}\n\n\t\treturn result;\n\t};\n\n\t// Preserve .conversion property if there is one\n\tif ('conversion' in fn) {\n\t\twrappedFn.conversion = fn.conversion;\n\t}\n\n\treturn wrappedFn;\n}\n\nmodels.forEach(fromModel => {\n\tconvert[fromModel] = {};\n\n\tObject.defineProperty(convert[fromModel], 'channels', {value: conversions[fromModel].channels});\n\tObject.defineProperty(convert[fromModel], 'labels', {value: conversions[fromModel].labels});\n\n\tconst routes = route(fromModel);\n\tconst routeModels = Object.keys(routes);\n\n\trouteModels.forEach(toModel => {\n\t\tconst fn = routes[toModel];\n\n\t\tconvert[fromModel][toModel] = wrapRounded(fn);\n\t\tconvert[fromModel][toModel].raw = wrapRaw(fn);\n\t});\n});\n\nmodule.exports = convert;\n","const conversions = require('./conversions');\n\n/*\n\tThis function routes a model to all other models.\n\n\tall functions that are routed have a property `.conversion` attached\n\tto the returned synthetic function. This property is an array\n\tof strings, each with the steps in between the 'from' and 'to'\n\tcolor models (inclusive).\n\n\tconversions that are not possible simply are not included.\n*/\n\nfunction buildGraph() {\n\tconst graph = {};\n\t// https://jsperf.com/object-keys-vs-for-in-with-closure/3\n\tconst models = Object.keys(conversions);\n\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tgraph[models[i]] = {\n\t\t\t// http://jsperf.com/1-vs-infinity\n\t\t\t// micro-opt, but this is simple.\n\t\t\tdistance: -1,\n\t\t\tparent: null\n\t\t};\n\t}\n\n\treturn graph;\n}\n\n// https://en.wikipedia.org/wiki/Breadth-first_search\nfunction deriveBFS(fromModel) {\n\tconst graph = buildGraph();\n\tconst queue = [fromModel]; // Unshift -> queue -> pop\n\n\tgraph[fromModel].distance = 0;\n\n\twhile (queue.length) {\n\t\tconst current = queue.pop();\n\t\tconst adjacents = Object.keys(conversions[current]);\n\n\t\tfor (let len = adjacents.length, i = 0; i < len; i++) {\n\t\t\tconst adjacent = adjacents[i];\n\t\t\tconst node = graph[adjacent];\n\n\t\t\tif (node.distance === -1) {\n\t\t\t\tnode.distance = graph[current].distance + 1;\n\t\t\t\tnode.parent = current;\n\t\t\t\tqueue.unshift(adjacent);\n\t\t\t}\n\t\t}\n\t}\n\n\treturn graph;\n}\n\nfunction link(from, to) {\n\treturn function (args) {\n\t\treturn to(from(args));\n\t};\n}\n\nfunction wrapConversion(toModel, graph) {\n\tconst path = [graph[toModel].parent, toModel];\n\tlet fn = conversions[graph[toModel].parent][toModel];\n\n\tlet cur = graph[toModel].parent;\n\twhile (graph[cur].parent) {\n\t\tpath.unshift(graph[cur].parent);\n\t\tfn = link(conversions[graph[cur].parent][cur], fn);\n\t\tcur = graph[cur].parent;\n\t}\n\n\tfn.conversion = path;\n\treturn fn;\n}\n\nmodule.exports = function (fromModel) {\n\tconst graph = deriveBFS(fromModel);\n\tconst conversion = {};\n\n\tconst models = Object.keys(graph);\n\tfor (let len = models.length, i = 0; i < len; i++) {\n\t\tconst toModel = models[i];\n\t\tconst node = graph[toModel];\n\n\t\tif (node.parent === null) {\n\t\t\t// No possible conversion, or this node is the source model.\n\t\t\tcontinue;\n\t\t}\n\n\t\tconversion[toModel] = wrapConversion(toModel, graph);\n\t}\n\n\treturn conversion;\n};\n\n","'use strict'\r\n\r\nmodule.exports = {\r\n\t\"aliceblue\": [240, 248, 255],\r\n\t\"antiquewhite\": [250, 235, 215],\r\n\t\"aqua\": [0, 255, 255],\r\n\t\"aquamarine\": [127, 255, 212],\r\n\t\"azure\": [240, 255, 255],\r\n\t\"beige\": [245, 245, 220],\r\n\t\"bisque\": [255, 228, 196],\r\n\t\"black\": [0, 0, 0],\r\n\t\"blanchedalmond\": [255, 235, 205],\r\n\t\"blue\": [0, 0, 255],\r\n\t\"blueviolet\": [138, 43, 226],\r\n\t\"brown\": [165, 42, 42],\r\n\t\"burlywood\": [222, 184, 135],\r\n\t\"cadetblue\": [95, 158, 160],\r\n\t\"chartreuse\": [127, 255, 0],\r\n\t\"chocolate\": [210, 105, 30],\r\n\t\"coral\": [255, 127, 80],\r\n\t\"cornflowerblue\": [100, 149, 237],\r\n\t\"cornsilk\": [255, 248, 220],\r\n\t\"crimson\": [220, 20, 60],\r\n\t\"cyan\": [0, 255, 255],\r\n\t\"darkblue\": [0, 0, 139],\r\n\t\"darkcyan\": [0, 139, 139],\r\n\t\"darkgoldenrod\": [184, 134, 11],\r\n\t\"darkgray\": [169, 169, 169],\r\n\t\"darkgreen\": [0, 100, 0],\r\n\t\"darkgrey\": [169, 169, 169],\r\n\t\"darkkhaki\": [189, 183, 107],\r\n\t\"darkmagenta\": [139, 0, 139],\r\n\t\"darkolivegreen\": [85, 107, 47],\r\n\t\"darkorange\": [255, 140, 0],\r\n\t\"darkorchid\": [153, 50, 204],\r\n\t\"darkred\": [139, 0, 0],\r\n\t\"darksalmon\": [233, 150, 122],\r\n\t\"darkseagreen\": [143, 188, 143],\r\n\t\"darkslateblue\": [72, 61, 139],\r\n\t\"darkslategray\": [47, 79, 79],\r\n\t\"darkslategrey\": [47, 79, 79],\r\n\t\"darkturquoise\": [0, 206, 209],\r\n\t\"darkviolet\": [148, 0, 211],\r\n\t\"deeppink\": [255, 20, 147],\r\n\t\"deepskyblue\": [0, 191, 255],\r\n\t\"dimgray\": [105, 105, 105],\r\n\t\"dimgrey\": [105, 105, 105],\r\n\t\"dodgerblue\": [30, 144, 255],\r\n\t\"firebrick\": [178, 34, 34],\r\n\t\"floralwhite\": [255, 250, 240],\r\n\t\"forestgreen\": [34, 139, 34],\r\n\t\"fuchsia\": [255, 0, 255],\r\n\t\"gainsboro\": [220, 220, 220],\r\n\t\"ghostwhite\": [248, 248, 255],\r\n\t\"gold\": [255, 215, 0],\r\n\t\"goldenrod\": [218, 165, 32],\r\n\t\"gray\": [128, 128, 128],\r\n\t\"green\": [0, 128, 0],\r\n\t\"greenyellow\": [173, 255, 47],\r\n\t\"grey\": [128, 128, 128],\r\n\t\"honeydew\": [240, 255, 240],\r\n\t\"hotpink\": [255, 105, 180],\r\n\t\"indianred\": [205, 92, 92],\r\n\t\"indigo\": [75, 0, 130],\r\n\t\"ivory\": [255, 255, 240],\r\n\t\"khaki\": [240, 230, 140],\r\n\t\"lavender\": [230, 230, 250],\r\n\t\"lavenderblush\": [255, 240, 245],\r\n\t\"lawngreen\": [124, 252, 0],\r\n\t\"lemonchiffon\": [255, 250, 205],\r\n\t\"lightblue\": [173, 216, 230],\r\n\t\"lightcoral\": [240, 128, 128],\r\n\t\"lightcyan\": [224, 255, 255],\r\n\t\"lightgoldenrodyellow\": [250, 250, 210],\r\n\t\"lightgray\": [211, 211, 211],\r\n\t\"lightgreen\": [144, 238, 144],\r\n\t\"lightgrey\": [211, 211, 211],\r\n\t\"lightpink\": [255, 182, 193],\r\n\t\"lightsalmon\": [255, 160, 122],\r\n\t\"lightseagreen\": [32, 178, 170],\r\n\t\"lightskyblue\": [135, 206, 250],\r\n\t\"lightslategray\": [119, 136, 153],\r\n\t\"lightslategrey\": [119, 136, 153],\r\n\t\"lightsteelblue\": [176, 196, 222],\r\n\t\"lightyellow\": [255, 255, 224],\r\n\t\"lime\": [0, 255, 0],\r\n\t\"limegreen\": [50, 205, 50],\r\n\t\"linen\": [250, 240, 230],\r\n\t\"magenta\": [255, 0, 255],\r\n\t\"maroon\": [128, 0, 0],\r\n\t\"mediumaquamarine\": [102, 205, 170],\r\n\t\"mediumblue\": [0, 0, 205],\r\n\t\"mediumorchid\": [186, 85, 211],\r\n\t\"mediumpurple\": [147, 112, 219],\r\n\t\"mediumseagreen\": [60, 179, 113],\r\n\t\"mediumslateblue\": [123, 104, 238],\r\n\t\"mediumspringgreen\": [0, 250, 154],\r\n\t\"mediumturquoise\": [72, 209, 204],\r\n\t\"mediumvioletred\": [199, 21, 133],\r\n\t\"midnightblue\": [25, 25, 112],\r\n\t\"mintcream\": [245, 255, 250],\r\n\t\"mistyrose\": [255, 228, 225],\r\n\t\"moccasin\": [255, 228, 181],\r\n\t\"navajowhite\": [255, 222, 173],\r\n\t\"navy\": [0, 0, 128],\r\n\t\"oldlace\": [253, 245, 230],\r\n\t\"olive\": [128, 128, 0],\r\n\t\"olivedrab\": [107, 142, 35],\r\n\t\"orange\": [255, 165, 0],\r\n\t\"orangered\": [255, 69, 0],\r\n\t\"orchid\": [218, 112, 214],\r\n\t\"palegoldenrod\": [238, 232, 170],\r\n\t\"palegreen\": [152, 251, 152],\r\n\t\"paleturquoise\": [175, 238, 238],\r\n\t\"palevioletred\": [219, 112, 147],\r\n\t\"papayawhip\": [255, 239, 213],\r\n\t\"peachpuff\": [255, 218, 185],\r\n\t\"peru\": [205, 133, 63],\r\n\t\"pink\": [255, 192, 203],\r\n\t\"plum\": [221, 160, 221],\r\n\t\"powderblue\": [176, 224, 230],\r\n\t\"purple\": [128, 0, 128],\r\n\t\"rebeccapurple\": [102, 51, 153],\r\n\t\"red\": [255, 0, 0],\r\n\t\"rosybrown\": [188, 143, 143],\r\n\t\"royalblue\": [65, 105, 225],\r\n\t\"saddlebrown\": [139, 69, 19],\r\n\t\"salmon\": [250, 128, 114],\r\n\t\"sandybrown\": [244, 164, 96],\r\n\t\"seagreen\": [46, 139, 87],\r\n\t\"seashell\": [255, 245, 238],\r\n\t\"sienna\": [160, 82, 45],\r\n\t\"silver\": [192, 192, 192],\r\n\t\"skyblue\": [135, 206, 235],\r\n\t\"slateblue\": [106, 90, 205],\r\n\t\"slategray\": [112, 128, 144],\r\n\t\"slategrey\": [112, 128, 144],\r\n\t\"snow\": [255, 250, 250],\r\n\t\"springgreen\": [0, 255, 127],\r\n\t\"steelblue\": [70, 130, 180],\r\n\t\"tan\": [210, 180, 140],\r\n\t\"teal\": [0, 128, 128],\r\n\t\"thistle\": [216, 191, 216],\r\n\t\"tomato\": [255, 99, 71],\r\n\t\"turquoise\": [64, 224, 208],\r\n\t\"violet\": [238, 130, 238],\r\n\t\"wheat\": [245, 222, 179],\r\n\t\"white\": [255, 255, 255],\r\n\t\"whitesmoke\": [245, 245, 245],\r\n\t\"yellow\": [255, 255, 0],\r\n\t\"yellowgreen\": [154, 205, 50]\r\n};\r\n","'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n","'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n","// getDefaultExport function for compatibility with non-ESM modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};\n","__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n        if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n            Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n        }\n    }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","__webpack_require__.nmd = (module) => {\n  module.paths = [];\n  if (!module.children) module.children = [];\n  return module;\n};","import { createHash } from 'node:crypto';\nimport {\n  copyFileSync,\n  cpSync,\n  existsSync,\n  mkdirSync,\n  rmSync,\n  unlinkSync,\n  writeFileSync,\n} from 'node:fs';\nimport { basename, dirname, extname, join, relative, resolve } from 'node:path';\nimport type {\n  MidsceneYamlConfigAttempt,\n  MidsceneYamlConfigResult,\n  MidsceneYamlScriptEnv,\n  TestStatus,\n} from '@midscene/core';\nimport { ReportMergingTool } from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport { getDebug } from '@midscene/shared/logger';\n\nconst warnRetryReport = getDebug('execution-summary', { console: true });\n\nexport interface ExecutionPlanConfig {\n  files: string[];\n  setup?: string;\n  concurrent: number;\n  continueOnError: boolean;\n  retry?: number;\n  summary: string;\n  shareBrowserContext?: boolean;\n  headed: boolean;\n  keepWindow: boolean;\n}\n\nexport interface ExecutionSummary {\n  total: number;\n  successful: number;\n  failed: number;\n  partialFailed: number;\n  notExecuted: number;\n  totalDuration: number;\n}\n\ntype ResultType = MidsceneYamlConfigResult['resultType'];\n\nexport const notExecutedError = 'Not executed (previous task failed)';\n\nexport function createNotExecutedYamlResult(\n  file: string,\n): MidsceneYamlConfigResult {\n  return {\n    file,\n    success: false,\n    executed: false,\n    output: undefined,\n    report: undefined,\n    duration: 0,\n    resultType: 'notExecuted',\n    error: notExecutedError,\n  };\n}\n\nexport function createUnexpectedYamlResult(options: {\n  file: string;\n  error: Error;\n  duration: number;\n  player?: ScriptPlayer<MidsceneYamlScriptEnv>;\n}): MidsceneYamlConfigResult {\n  const { file, error, duration, player } = options;\n  const output = player?.output;\n\n  return {\n    file,\n    success: false,\n    executed: true,\n    output: output && existsSync(output) ? output : undefined,\n    report: player?.reportFile || undefined,\n    duration,\n    resultType: 'failed',\n    error: error.message,\n  };\n}\n\nexport function isYamlPlayerSuccessful(\n  player: ScriptPlayer<MidsceneYamlScriptEnv>,\n): boolean {\n  return (\n    player.status !== 'error' &&\n    !player.taskStatusList?.some((task) => task.status === 'error')\n  );\n}\n\nexport function createExecutedYamlResult(options: {\n  file: string;\n  player: ScriptPlayer<MidsceneYamlScriptEnv>;\n  duration: number;\n}): MidsceneYamlConfigResult {\n  const { file, player, duration } = options;\n  const hasPlayerError = player.status === 'error';\n  const hasFailedTasks = !isYamlPlayerSuccessful(player) && !hasPlayerError;\n\n  let success: boolean;\n  let resultType: 'success' | 'failed' | 'partialFailed';\n\n  if (hasPlayerError) {\n    success = false;\n    resultType = 'failed';\n  } else if (hasFailedTasks) {\n    success = false;\n    resultType = 'partialFailed';\n  } else {\n    success = true;\n    resultType = 'success';\n  }\n\n  let outputPath: string | undefined = player.output || undefined;\n  if (outputPath && !existsSync(outputPath)) {\n    outputPath = undefined;\n  }\n\n  let errorMessage: string | undefined;\n  if (player.errorInSetup?.message) {\n    errorMessage = player.errorInSetup.message;\n  } else if (hasPlayerError || hasFailedTasks) {\n    const taskErrors = player.taskStatusList\n      ?.filter((task) => task.status === 'error' && task.error?.message)\n      .map((task) => task.error!.message);\n    if (taskErrors && taskErrors.length > 0) {\n      errorMessage = taskErrors.join('; ');\n    } else if (hasPlayerError) {\n      errorMessage = 'Execution failed';\n    } else {\n      errorMessage = 'Some tasks failed';\n    }\n  }\n\n  return {\n    file,\n    success,\n    executed: true,\n    output: outputPath,\n    report: player.reportFile || undefined,\n    duration,\n    resultType,\n    error: errorMessage,\n  };\n}\n\nexport function resolveYamlMaxAttempts(retry?: number): number {\n  if (!Number.isFinite(retry) || !retry || retry < 1) return 1;\n  return Math.floor(retry) + 1;\n}\n\nexport function createYamlAttempt(\n  result: MidsceneYamlConfigResult,\n  attempt: number,\n): MidsceneYamlConfigAttempt {\n  return {\n    attempt,\n    success: result.success,\n    output: result.output,\n    report: result.report,\n    error: result.error,\n    duration: result.duration,\n    resultType: result.resultType,\n  };\n}\n\nexport function getYamlAttemptsDuration(\n  attempts: MidsceneYamlConfigAttempt[],\n): number {\n  return attempts.reduce(\n    (total, attempt) => total + (attempt.duration ?? 0),\n    0,\n  );\n}\n\nconst retryAttemptReportPath = (\n  reportFile: string,\n  attempt: number,\n): string => {\n  if (basename(reportFile) === 'index.html') {\n    const reportDir = dirname(reportFile);\n    return join(\n      dirname(reportDir),\n      `${basename(reportDir)}-attempt-${attempt}`,\n      'index.html',\n    );\n  }\n\n  const extension = extname(reportFile);\n  const stem = basename(reportFile, extension);\n  return join(dirname(reportFile), `${stem}-attempt-${attempt}${extension}`);\n};\n\n/**\n * Move a completed attempt's report aside before a stable, user-configured\n * reportFileName is reused by the next attempt.\n */\nexport function preserveYamlAttemptReport(\n  attempt: MidsceneYamlConfigAttempt,\n): MidsceneYamlConfigAttempt {\n  const source = attempt.report;\n  if (!source || !existsSync(source)) return attempt;\n\n  const target = retryAttemptReportPath(source, attempt.attempt);\n  if (basename(source) === 'index.html') {\n    const sourceDir = dirname(source);\n    const targetDir = dirname(target);\n    rmSync(targetDir, { recursive: true, force: true });\n    cpSync(sourceDir, targetDir, { recursive: true });\n    rmSync(sourceDir, { recursive: true, force: true });\n  } else {\n    copyFileSync(source, target);\n    unlinkSync(source);\n  }\n\n  return { ...attempt, report: target };\n}\n\nexport function getExecutionSummary(\n  results: MidsceneYamlConfigResult[],\n): ExecutionSummary {\n  return {\n    total: results.length,\n    successful: getResultsByType(results, 'success').length,\n    failed: getResultsByType(results, 'failed').length,\n    partialFailed: getResultsByType(results, 'partialFailed').length,\n    notExecuted: getResultsByType(results, 'notExecuted').length,\n    totalDuration: results.reduce((sum, r) => sum + (r.duration || 0), 0),\n  };\n}\n\nexport function getResultsByType(\n  results: MidsceneYamlConfigResult[],\n  resultType: ResultType,\n): MidsceneYamlConfigResult[] {\n  return results.filter((result) => result.resultType === resultType);\n}\n\nexport function getResultFilesByType(\n  results: MidsceneYamlConfigResult[],\n  resultType: ResultType,\n): string[] {\n  return getResultsByType(results, resultType).map((result) => result.file);\n}\n\nexport function getSummaryAbsolutePath(summary: string): string {\n  return resolve(getMidsceneRunSubDir('output'), summary);\n}\n\nconst toOutputRelativePath = (outputDir: string, filePath: string): string => {\n  const relativePath = relative(outputDir, filePath);\n  return relativePath.startsWith('.') ? relativePath : `./${relativePath}`;\n};\n\nconst toTestStatus = (\n  attempt: Pick<MidsceneYamlConfigAttempt, 'success' | 'resultType'>,\n): TestStatus => {\n  if (attempt.success) return 'passed';\n  if (attempt.resultType === 'notExecuted') return 'skipped';\n  return 'failed';\n};\n\nconst safeReportNamePart = (value: string): string =>\n  value.replace(/[:*?\"<>|# ]/g, '-');\n\nconst createRetryReportName = (file: string): string => {\n  const fileName = basename(file, extname(file)) || 'yaml';\n  const fileHash = createHash('sha1')\n    .update(resolve(file))\n    .digest('hex')\n    .slice(0, 8);\n  return `${safeReportNamePart(fileName)}-${fileHash}-retry-attempts`;\n};\n\nconst createRetryAttemptReport = (\n  result: MidsceneYamlConfigResult,\n): string | undefined => {\n  const attemptsWithReports = result.attempts?.filter(\n    (attempt) => attempt.report && existsSync(attempt.report),\n  );\n  if (!attemptsWithReports || attemptsWithReports.length <= 1) {\n    return undefined;\n  }\n\n  const tool = new ReportMergingTool();\n  for (const attempt of attemptsWithReports) {\n    const status = toTestStatus(attempt);\n    tool.append({\n      reportFilePath: attempt.report!,\n      reportAttributes: {\n        testDuration: attempt.duration ?? 0,\n        testStatus: status,\n        testTitle: `Attempt ${attempt.attempt}: ${status} - ${basename(result.file)}`,\n        testId: `${safeReportNamePart(basename(result.file))}-attempt-${attempt.attempt}`,\n        testDescription:\n          attempt.error ??\n          (attempt.success ? 'YAML attempt passed' : 'YAML attempt failed'),\n      },\n    });\n  }\n\n  return (\n    tool.mergeReports(createRetryReportName(result.file), {\n      outputDir: getMidsceneRunSubDir('report'),\n      overwrite: true,\n    }) || undefined\n  );\n};\n\nconst errorMessageOf = (error: unknown): string =>\n  error instanceof Error ? error.message : String(error);\n\nconst warnRetryReportFailure = (message: string): void => {\n  try {\n    mkdirSync(getMidsceneRunSubDir('log'), { recursive: true });\n    warnRetryReport(message);\n  } catch {\n    // Summary output is more important than warning output.\n  }\n};\n\nconst createRetryAttemptReportSafely = (\n  result: MidsceneYamlConfigResult,\n): { report?: string; failed: boolean } => {\n  try {\n    return {\n      report: createRetryAttemptReport(result),\n      failed: false,\n    };\n  } catch (error) {\n    warnRetryReportFailure(\n      `Failed to merge retry attempt report for ${result.file}: ${errorMessageOf(\n        error,\n      )}`,\n    );\n    return { failed: true };\n  }\n};\n\nexport function writeExecutionSummaryFile(\n  summary: string,\n  results: MidsceneYamlConfigResult[],\n): string {\n  const indexPath = getSummaryAbsolutePath(summary);\n  const outputDir = dirname(indexPath);\n  mkdirSync(outputDir, { recursive: true });\n\n  const executionSummary = getExecutionSummary(results);\n  const indexData = {\n    summary: {\n      ...executionSummary,\n      generatedAt: new Date().toLocaleString(),\n    },\n    results: results.map((result) => {\n      const retryReport = createRetryAttemptReportSafely(result);\n\n      return {\n        script: relative(outputDir, result.file),\n        success: result.success,\n        resultType: result.resultType,\n        output: result.output\n          ? toOutputRelativePath(outputDir, result.output)\n          : undefined,\n        report: result.report ? relative(outputDir, result.report) : undefined,\n        retryReport: retryReport.report\n          ? relative(outputDir, retryReport.report)\n          : !retryReport.failed && result.retryReport\n            ? relative(outputDir, result.retryReport)\n            : undefined,\n        attempts: result.attempts?.map((attempt) => ({\n          attempt: attempt.attempt,\n          success: attempt.success,\n          resultType: attempt.resultType,\n          output: attempt.output\n            ? toOutputRelativePath(outputDir, attempt.output)\n            : undefined,\n          report: attempt.report\n            ? relative(outputDir, attempt.report)\n            : undefined,\n          error: attempt.error,\n          duration: attempt.duration,\n        })),\n        error: result.error,\n        duration: result.duration,\n      };\n    }),\n  };\n\n  writeFileSync(indexPath, JSON.stringify(indexData, null, 2));\n  return indexPath;\n}\n\nexport function printExecutionPlan(config: ExecutionPlanConfig): void {\n  if (config.setup) {\n    console.log('   Setup script:');\n    console.log(`     - ${config.setup}`);\n  }\n  console.log('   Scripts:');\n  for (const file of config.files) {\n    console.log(`     - ${file}`);\n  }\n  console.log('📋 Execution plan');\n  console.log(`   Concurrency: ${config.concurrent}`);\n  console.log(`   Keep window: ${config.keepWindow}`);\n  console.log(`   Headed: ${config.headed}`);\n  console.log(`   Continue on error: ${config.continueOnError}`);\n  console.log(`   Retry: ${config.retry ?? 0}`);\n  console.log(\n    `   Share browser context: ${config.shareBrowserContext ?? false}`,\n  );\n  console.log(`   Summary output: ${config.summary}`);\n}\n\nexport function printExecutionFinished(): void {\n  console.log('Execution finished:');\n}\n\nconst printResultArtifacts = (result: MidsceneYamlConfigResult): void => {\n  if (result.report) {\n    console.log(`     Report: ${result.report}`);\n  }\n  if (result.output) {\n    console.log(`     Output: ${result.output}`);\n  }\n};\n\nexport function printExecutionSummary(\n  results: MidsceneYamlConfigResult[],\n  summaryPath: string,\n): boolean {\n  const summary = getExecutionSummary(results);\n  const successfulFiles = getResultsByType(results, 'success');\n  const failedFiles = getResultsByType(results, 'failed');\n  const partialFailedFiles = getResultsByType(results, 'partialFailed');\n  const notExecutedFiles = getResultsByType(results, 'notExecuted');\n  const success =\n    summary.failed === 0 &&\n    summary.partialFailed === 0 &&\n    summary.notExecuted === 0;\n\n  console.log('\\n📊 Execution Summary:');\n  console.log(`   Total files: ${summary.total}`);\n  console.log(`   Successful: ${summary.successful}`);\n  console.log(`   Failed: ${summary.failed}`);\n  console.log(`   Partial failed: ${summary.partialFailed}`);\n  console.log(`   Not executed: ${summary.notExecuted}`);\n  console.log(`   Duration: ${(summary.totalDuration / 1000).toFixed(2)}s`);\n  console.log(`   Summary: ${summaryPath}`);\n\n  if (successfulFiles.length > 0) {\n    console.log('\\n✅ Successful files:');\n    successfulFiles.forEach((result) => {\n      console.log(`   ${result.file}`);\n      printResultArtifacts(result);\n    });\n  }\n\n  if (failedFiles.length > 0) {\n    console.log('\\n❌ Failed files');\n    failedFiles.forEach((result) => {\n      console.log(`   ${result.file}`);\n      if (result.error) {\n        console.log(`     Error: ${result.error}`);\n      }\n    });\n  }\n\n  if (partialFailedFiles.length > 0) {\n    console.log(\n      '\\n⚠️  Partial failed files (some tasks failed with continueOnError)',\n    );\n    partialFailedFiles.forEach((result) => {\n      console.log(`   ${result.file}`);\n      if (result.error) {\n        console.log(`     Error: ${result.error}`);\n      }\n    });\n  }\n\n  if (notExecutedFiles.length > 0) {\n    console.log('\\n⏸️ Not executed files');\n    notExecutedFiles.forEach((result) => {\n      console.log(`   ${result.file}`);\n    });\n  }\n\n  if (success) {\n    console.log('\\n🎉 All files executed successfully!');\n  } else {\n    console.log('\\n⚠️ Some files failed or were not executed.');\n  }\n\n  return success;\n}\n","import type { MidsceneYamlConfigResult } from '@midscene/core';\n\nexport interface YamlBatchErrorOccurrence {\n  caseId: string;\n  result: MidsceneYamlConfigResult;\n}\n\nconst normalizeBatchError = (error: unknown): Error =>\n  error instanceof Error\n    ? error\n    : new Error('Unexpected YAML execution failure', { cause: error });\n\nexport class YamlBatchExecutionError extends Error {\n  readonly results: MidsceneYamlConfigResult[];\n  readonly occurrences: YamlBatchErrorOccurrence[];\n\n  constructor(error: unknown, occurrences: YamlBatchErrorOccurrence[]) {\n    const cause = normalizeBatchError(error);\n    super(cause.message, { cause });\n    this.name = 'YamlBatchExecutionError';\n    this.occurrences = occurrences.map(({ caseId, result }) => ({\n      caseId,\n      result,\n    }));\n    this.results = this.occurrences.map(({ result }) => result);\n  }\n}\n\nexport function isYamlBatchExecutionError(\n  error: unknown,\n): error is YamlBatchExecutionError {\n  return error instanceof YamlBatchExecutionError;\n}\n","/*\nHow it works:\n`this.#head` is an instance of `Node` which keeps track of its current value and nests another instance of `Node` that keeps the value that comes after it. When a value is provided to `.enqueue()`, the code needs to iterate through `this.#head`, going deeper and deeper to find the last value. However, iterating through every single item is slow. This problem is solved by saving a reference to the last value as `this.#tail` so that it can reference it to add a new value.\n*/\n\nclass Node {\n\tvalue;\n\tnext;\n\n\tconstructor(value) {\n\t\tthis.value = value;\n\t}\n}\n\nexport default class Queue {\n\t#head;\n\t#tail;\n\t#size;\n\n\tconstructor() {\n\t\tthis.clear();\n\t}\n\n\tenqueue(value) {\n\t\tconst node = new Node(value);\n\n\t\tif (this.#head) {\n\t\t\tthis.#tail.next = node;\n\t\t\tthis.#tail = node;\n\t\t} else {\n\t\t\tthis.#head = node;\n\t\t\tthis.#tail = node;\n\t\t}\n\n\t\tthis.#size++;\n\t}\n\n\tdequeue() {\n\t\tconst current = this.#head;\n\t\tif (!current) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.#head = this.#head.next;\n\t\tthis.#size--;\n\t\treturn current.value;\n\t}\n\n\tpeek() {\n\t\tif (!this.#head) {\n\t\t\treturn;\n\t\t}\n\n\t\treturn this.#head.value;\n\n\t\t// TODO: Node.js 18.\n\t\t// return this.#head?.value;\n\t}\n\n\tclear() {\n\t\tthis.#head = undefined;\n\t\tthis.#tail = undefined;\n\t\tthis.#size = 0;\n\t}\n\n\tget size() {\n\t\treturn this.#size;\n\t}\n\n\t* [Symbol.iterator]() {\n\t\tlet current = this.#head;\n\n\t\twhile (current) {\n\t\t\tyield current.value;\n\t\t\tcurrent = current.next;\n\t\t}\n\t}\n\n\t* drain() {\n\t\twhile (this.#head) {\n\t\t\tyield this.dequeue();\n\t\t}\n\t}\n}\n","import Queue from 'yocto-queue';\n\nexport default function pLimit(concurrency) {\n\tvalidateConcurrency(concurrency);\n\n\tconst queue = new Queue();\n\tlet activeCount = 0;\n\n\tconst resumeNext = () => {\n\t\tif (activeCount < concurrency && queue.size > 0) {\n\t\t\tqueue.dequeue()();\n\t\t\t// Since `pendingCount` has been decreased by one, increase `activeCount` by one.\n\t\t\tactiveCount++;\n\t\t}\n\t};\n\n\tconst next = () => {\n\t\tactiveCount--;\n\n\t\tresumeNext();\n\t};\n\n\tconst run = async (function_, resolve, arguments_) => {\n\t\tconst result = (async () => function_(...arguments_))();\n\n\t\tresolve(result);\n\n\t\ttry {\n\t\t\tawait result;\n\t\t} catch {}\n\n\t\tnext();\n\t};\n\n\tconst enqueue = (function_, resolve, arguments_) => {\n\t\t// Queue `internalResolve` instead of the `run` function\n\t\t// to preserve asynchronous context.\n\t\tnew Promise(internalResolve => {\n\t\t\tqueue.enqueue(internalResolve);\n\t\t}).then(\n\t\t\trun.bind(undefined, function_, resolve, arguments_),\n\t\t);\n\n\t\t(async () => {\n\t\t\t// This function needs to wait until the next microtask before comparing\n\t\t\t// `activeCount` to `concurrency`, because `activeCount` is updated asynchronously\n\t\t\t// after the `internalResolve` function is dequeued and called. The comparison in the if-statement\n\t\t\t// needs to happen asynchronously as well to get an up-to-date value for `activeCount`.\n\t\t\tawait Promise.resolve();\n\n\t\t\tif (activeCount < concurrency) {\n\t\t\t\tresumeNext();\n\t\t\t}\n\t\t})();\n\t};\n\n\tconst generator = (function_, ...arguments_) => new Promise(resolve => {\n\t\tenqueue(function_, resolve, arguments_);\n\t});\n\n\tObject.defineProperties(generator, {\n\t\tactiveCount: {\n\t\t\tget: () => activeCount,\n\t\t},\n\t\tpendingCount: {\n\t\t\tget: () => queue.size,\n\t\t},\n\t\tclearQueue: {\n\t\t\tvalue() {\n\t\t\t\tqueue.clear();\n\t\t\t},\n\t\t},\n\t\tconcurrency: {\n\t\t\tget: () => concurrency,\n\n\t\t\tset(newConcurrency) {\n\t\t\t\tvalidateConcurrency(newConcurrency);\n\t\t\t\tconcurrency = newConcurrency;\n\n\t\t\t\tqueueMicrotask(() => {\n\t\t\t\t\t// eslint-disable-next-line no-unmodified-loop-condition\n\t\t\t\t\twhile (activeCount < concurrency && queue.size > 0) {\n\t\t\t\t\t\tresumeNext();\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t},\n\t\t},\n\t});\n\n\treturn generator;\n}\n\nexport function limitFunction(function_, option) {\n\tconst {concurrency} = option;\n\tconst limit = pLimit(concurrency);\n\n\treturn (...arguments_) => limit(() => function_(...arguments_));\n}\n\nfunction validateConcurrency(concurrency) {\n\tif (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {\n\t\tthrow new TypeError('Expected `concurrency` to be a number from 1 and up');\n\t}\n}\n","import { readFileSync } from 'node:fs';\nimport path, { basename, extname, join } from 'node:path';\nimport {\n  ScriptPlayer,\n  parseYamlScript,\n  resolveWebTarget,\n} from '@midscene/core/yaml';\nimport { createServer } from 'http-server';\n\nimport assert from 'node:assert';\nimport type {\n  AgentOpt,\n  FreeFn,\n  MidsceneYamlScript,\n  MidsceneYamlScriptAgentOpt,\n  MidsceneYamlScriptEnv,\n  MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { createAgent, getReportFileName } from '@midscene/core/agent';\nimport type { AbstractInterface } from '@midscene/core/device';\nimport { processCacheConfig } from '@midscene/core/utils';\nimport { getDebug } from '@midscene/shared/logger';\nimport { AgentOverChromeBridge } from '@midscene/web/bridge-mode';\nimport {\n  buildDownloadBehavior,\n  puppeteerAgentForTarget,\n} from '@midscene/web/puppeteer-agent-launcher';\nimport type { Browser, BrowserContext, Page } from 'puppeteer';\nimport puppeteer from 'puppeteer';\n\nexport interface SingleYamlExecutionResult {\n  success: boolean;\n  file: string;\n  player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\nexport interface CreateYamlPlayerOptions {\n  headed?: boolean;\n  keepWindow?: boolean;\n  browser?: Browser;\n  page?: Page;\n  browserContext?: BrowserContext;\n  testId?: string;\n}\n\nconst debug = getDebug('create-yaml-player');\nconst cleanupWarning = getDebug('create-yaml-player', { console: true });\n\nasync function cleanupFailedPlayerSetup(freeFn: FreeFn[]): Promise<void> {\n  for (const cleanup of [...freeFn].reverse()) {\n    try {\n      await cleanup.fn();\n    } catch (error) {\n      cleanupWarning(\n        `failed to run ${cleanup.name} after YAML player setup failed`,\n        error,\n      );\n    }\n  }\n}\n\nexport const launchServer = async (\n  dir: string,\n): Promise<ReturnType<typeof createServer>> => {\n  // https://github.com/http-party/http-server/blob/master/bin/http-server\n  return new Promise((resolve) => {\n    const server = createServer({\n      root: dir,\n    });\n    server.listen(0, '127.0.0.1', () => {\n      resolve(server);\n    });\n  });\n};\n\n/**\n * Resolves reportFileName with proper priority handling.\n * Priority: YAML reportFileName > CLI testId (legacy) > YAML testId (legacy) > fileName\n * Explicit YAML reportFileName is treated as the exact output name. Generated\n * legacy fallbacks include a unique suffix to avoid overwriting.\n */\nfunction resolveReportFileName(\n  yamlReportFileName: string | undefined,\n  cliTestId: string | undefined,\n  yamlTestId: string | undefined,\n  fileName: string,\n): string {\n  if (yamlReportFileName !== undefined) {\n    return yamlReportFileName;\n  }\n  const baseName = cliTestId ?? yamlTestId ?? fileName;\n  return getReportFileName(baseName);\n}\n\n/**\n * Builds agent options by merging YAML agent config with processed cache and report name.\n * Handles the spread of agent options and ensures proper cache configuration.\n */\nfunction buildAgentOptions(\n  yamlAgent: MidsceneYamlScriptAgentOpt | undefined,\n  reportFileName: string,\n  fileName: string,\n): Partial<AgentOpt> {\n  return {\n    ...(yamlAgent || {}),\n    cache: processCacheConfig(yamlAgent?.cache, fileName),\n    reportFileName,\n  };\n}\n\nexport async function createYamlPlayer(\n  file: string,\n  script?: MidsceneYamlScript,\n  options?: CreateYamlPlayerOptions,\n): Promise<ScriptPlayer<MidsceneYamlScriptEnv>> {\n  const yamlScript =\n    script || parseYamlScript(readFileSync(file, 'utf-8'), file);\n\n  // Deep clone the script to avoid mutation issues when the same file is executed multiple times\n  // This ensures each ScriptPlayer instance has its own independent copy of the YAML data\n  const clonedYamlScript = structuredClone(yamlScript);\n\n  const fileName = basename(file, extname(file));\n  const preference = {\n    headed: options?.headed,\n    keepWindow: options?.keepWindow,\n    reportFileName: resolveReportFileName(\n      clonedYamlScript.agent?.reportFileName,\n      options?.testId,\n      clonedYamlScript.agent?.testId,\n      fileName,\n    ),\n  };\n\n  const player = new ScriptPlayer(\n    clonedYamlScript,\n    async () => {\n      const freeFn: FreeFn[] = [];\n      try {\n        const resolvedWebTarget = resolveWebTarget(clonedYamlScript);\n        const webTarget = resolvedWebTarget?.target as\n          | MidsceneYamlScriptWebEnv\n          | undefined;\n\n        // Validate that only one target type is specified\n        const targetCount = [\n          typeof resolvedWebTarget !== 'undefined',\n          typeof clonedYamlScript.android !== 'undefined',\n          typeof clonedYamlScript.ios !== 'undefined',\n          typeof clonedYamlScript.harmony !== 'undefined',\n          typeof clonedYamlScript.computer !== 'undefined',\n          typeof clonedYamlScript.interface !== 'undefined',\n        ].filter(Boolean).length;\n\n        if (targetCount > 1) {\n          const specifiedTargets = [\n            resolvedWebTarget?.source ?? null,\n            typeof clonedYamlScript.android !== 'undefined' ? 'android' : null,\n            typeof clonedYamlScript.ios !== 'undefined' ? 'ios' : null,\n            typeof clonedYamlScript.harmony !== 'undefined' ? 'harmony' : null,\n            typeof clonedYamlScript.computer !== 'undefined'\n              ? 'computer'\n              : null,\n            typeof clonedYamlScript.interface !== 'undefined'\n              ? 'interface'\n              : null,\n          ].filter(Boolean);\n\n          throw new Error(\n            `Only one target type can be specified, but found multiple: ${specifiedTargets.join(', ')}. Please specify only one of: page, browser, web, android, ios, harmony, computer, or interface.`,\n          );\n        }\n\n        // handle new web config\n        if (typeof webTarget !== 'undefined') {\n          if (resolvedWebTarget?.source === 'target') {\n            console.warn(\n              'target is deprecated, please use page or browser instead. See https://midscenejs.com/automate-with-scripts-in-yaml for more information. Sorry for the inconvenience.',\n            );\n          }\n\n          // launch local server if needed\n          let localServer: Awaited<ReturnType<typeof launchServer>> | undefined;\n          let urlToVisit: string | undefined;\n          if (webTarget.serve) {\n            assert(\n              typeof webTarget.url === 'string',\n              'url is required in serve mode',\n            );\n            localServer = await launchServer(webTarget.serve);\n            const serverAddress = localServer.server.address();\n            freeFn.push({\n              name: 'local_server',\n              fn: async () => {\n                if (!localServer) {\n                  return;\n                }\n                await new Promise<void>((resolve, reject) => {\n                  localServer?.server.close((error?: Error) => {\n                    if (error) {\n                      reject(error);\n                    } else {\n                      resolve();\n                    }\n                  });\n                });\n              },\n            });\n            if (webTarget.url.startsWith('/')) {\n              urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}${webTarget.url}`;\n            } else {\n              urlToVisit = `http://${serverAddress?.address}:${serverAddress?.port}/${webTarget.url}`;\n            }\n            webTarget.url = urlToVisit;\n          }\n\n          // Validate: cdpEndpoint and bridgeMode are mutually exclusive\n          if (webTarget.cdpEndpoint && webTarget.bridgeMode) {\n            throw new Error(\n              'cdpEndpoint and bridgeMode are mutually exclusive. Please specify only one.',\n            );\n          }\n\n          if (webTarget.mode === 'browser' && webTarget.bridgeMode) {\n            throw new Error(\n              '[midscene] browser mode does not support bridgeMode. Use page: or web.mode: page for bridge mode.',\n            );\n          }\n\n          // CDP mode: connect to an existing browser via Chrome DevTools Protocol\n          if (webTarget.cdpEndpoint) {\n            // Use the shared browser from batch-runner if available (shareBrowserContext),\n            // otherwise connect via CDP endpoint\n            const ownsCdpBrowser = !options?.browser;\n            const cdpBrowser =\n              options?.browser ??\n              (await puppeteer.connect({\n                browserWSEndpoint: webTarget.cdpEndpoint,\n                defaultViewport: null,\n                downloadBehavior: buildDownloadBehavior(webTarget.downloadPath),\n              }));\n            // Warn about options that don't apply to an already-running browser\n            if (webTarget.chromeArgs) {\n              console.warn(\n                'chromeArgs are not supported in CDP mode (browser is already running). They will be ignored.',\n              );\n            }\n\n            // Reuse puppeteerAgentForTarget which handles page setup (userAgent, viewport,\n            // cookie, waitForNetworkIdle, etc.) — pass the CDP browser as the browser param\n            let launchedAgent: Awaited<\n              ReturnType<typeof puppeteerAgentForTarget>\n            >;\n            try {\n              launchedAgent = await puppeteerAgentForTarget(\n                webTarget,\n                {\n                  ...preference,\n                  ...buildAgentOptions(\n                    clonedYamlScript.agent,\n                    preference.reportFileName,\n                    fileName,\n                  ),\n                },\n                cdpBrowser as Browser,\n                options?.page,\n                options?.browserContext,\n              );\n            } catch (error) {\n              if (ownsCdpBrowser) {\n                try {\n                  cdpBrowser.disconnect();\n                } catch (cleanupError) {\n                  cleanupWarning(\n                    'failed to disconnect the CDP browser after agent setup failed',\n                    cleanupError,\n                  );\n                }\n              }\n              throw error;\n            }\n            const { agent, freeFn: newFreeFn } = launchedAgent;\n\n            // Replace the default browser close with disconnect for CDP\n            const cleanFreeFn = newFreeFn.filter(\n              (f) => f.name !== 'puppeteer_browser',\n            );\n            freeFn.push(...cleanFreeFn);\n            if (ownsCdpBrowser) {\n              freeFn.push({\n                name: 'cdp_browser_disconnect',\n                fn: () => cdpBrowser.disconnect(),\n              });\n            }\n\n            return { agent, freeFn };\n          }\n\n          if (!webTarget.bridgeMode) {\n            // use puppeteer\n            const { agent, freeFn: newFreeFn } = await puppeteerAgentForTarget(\n              webTarget,\n              {\n                ...preference,\n                ...buildAgentOptions(\n                  clonedYamlScript.agent,\n                  preference.reportFileName,\n                  fileName,\n                ),\n              },\n              options?.browser,\n              options?.page,\n              options?.browserContext,\n            );\n            freeFn.push(...newFreeFn);\n\n            return { agent, freeFn };\n          }\n          assert(\n            webTarget.bridgeMode === 'newTabWithUrl' ||\n              webTarget.bridgeMode === 'currentTab',\n            `bridgeMode config value must be either \"newTabWithUrl\" or \"currentTab\", but got ${webTarget.bridgeMode}`,\n          );\n\n          const bridgeUnsupportedKeys: (keyof MidsceneYamlScriptWebEnv)[] = [\n            'userAgent',\n            'viewportWidth',\n            'viewportHeight',\n            'deviceScaleFactor',\n            'waitForNetworkIdle',\n            'cookie',\n            'extraHTTPHeaders',\n            'downloadPath',\n            'chromeArgs',\n          ];\n          const ignoredKeys = bridgeUnsupportedKeys.filter(\n            (key) => webTarget[key] != null,\n          );\n          if (ignoredKeys.length > 0) {\n            console.warn(\n              `puppeteer options (${ignoredKeys.join(', ')}) are not supported in bridge mode. They will be ignored.`,\n            );\n          }\n\n          const agent = new AgentOverChromeBridge({\n            closeNewTabsAfterDisconnect: webTarget.closeNewTabsAfterDisconnect,\n            closeConflictServer: true,\n            ...buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          });\n\n          if (webTarget.bridgeMode === 'newTabWithUrl') {\n            await agent.connectNewTabWithUrl(webTarget.url);\n          } else {\n            if (webTarget.url) {\n              console.warn(\n                'url will be ignored in bridge mode with \"currentTab\"',\n              );\n            }\n            await agent.connectCurrentTab();\n          }\n          freeFn.push({\n            name: 'destroy_agent_over_chrome_bridge',\n            fn: () => agent.destroy(),\n          });\n          return {\n            agent,\n            freeFn,\n          };\n        }\n\n        // handle android\n        if (typeof clonedYamlScript.android !== 'undefined') {\n          const androidTarget = clonedYamlScript.android;\n          const { agentFromAdbDevice } = await import('@midscene/android');\n          const agent = await agentFromAdbDevice(androidTarget?.deviceId, {\n            ...androidTarget, // Pass all Android config options\n            ...buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          });\n\n          if (androidTarget?.launch) {\n            await agent.launch(androidTarget.launch);\n          }\n\n          freeFn.push({\n            name: 'destroy_android_agent',\n            fn: () => agent.destroy(),\n          });\n\n          return { agent, freeFn };\n        }\n\n        // handle iOS\n        if (typeof clonedYamlScript.ios !== 'undefined') {\n          const iosTarget = clonedYamlScript.ios;\n          const { agentFromWebDriverAgent } = await import('@midscene/ios');\n          const agent = await agentFromWebDriverAgent({\n            ...iosTarget, // Pass all iOS config options\n            ...buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          });\n\n          if (iosTarget?.launch) {\n            await agent.launch(iosTarget.launch);\n          }\n\n          freeFn.push({\n            name: 'destroy_ios_agent',\n            fn: () => agent.destroy(),\n          });\n\n          return { agent, freeFn };\n        }\n\n        // handle harmony\n        if (typeof clonedYamlScript.harmony !== 'undefined') {\n          const harmonyTarget = clonedYamlScript.harmony;\n          const { agentFromHdcDevice } = await import('@midscene/harmony');\n          const agent = await agentFromHdcDevice(harmonyTarget?.deviceId, {\n            ...harmonyTarget, // Pass all HarmonyOS config options\n            ...buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          });\n\n          if (harmonyTarget?.launch) {\n            await agent.launch(harmonyTarget.launch);\n          }\n\n          freeFn.push({\n            name: 'destroy_harmony_agent',\n            fn: () => agent.destroy(),\n          });\n\n          return { agent, freeFn };\n        }\n\n        // handle computer\n        if (typeof clonedYamlScript.computer !== 'undefined') {\n          const computerTarget = clonedYamlScript.computer;\n          const { agentForComputer } = await import('@midscene/computer');\n          const agent = await agentForComputer({\n            ...computerTarget,\n            ...buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          });\n\n          freeFn.push({\n            name: 'destroy_computer_agent',\n            fn: () => agent.destroy(),\n          });\n\n          return { agent, freeFn };\n        }\n\n        // handle general interface\n        if (typeof clonedYamlScript.interface !== 'undefined') {\n          const interfaceTarget = clonedYamlScript.interface;\n\n          const moduleSpecifier = interfaceTarget.module;\n          let finalModuleSpecifier: string;\n          if (\n            moduleSpecifier.startsWith('./') ||\n            moduleSpecifier.startsWith('../') ||\n            path.isAbsolute(moduleSpecifier)\n          ) {\n            const resolvedPath = join(process.cwd(), moduleSpecifier);\n            finalModuleSpecifier = resolvedPath;\n          } else {\n            finalModuleSpecifier = moduleSpecifier;\n          }\n\n          // import the module dynamically\n          debug(\n            'importing module config',\n            interfaceTarget.module,\n            'with export config',\n            interfaceTarget.export,\n            'final module specifier',\n            finalModuleSpecifier,\n          );\n\n          const importedModule = await import(finalModuleSpecifier);\n\n          // get the specific export or use default export\n          const DeviceClass = interfaceTarget.export\n            ? importedModule[interfaceTarget.export]\n            : importedModule.default || importedModule;\n\n          debug(\n            'DeviceClass',\n            DeviceClass,\n            'with param',\n            interfaceTarget.param,\n          );\n\n          // create device instance with parameters\n          const device: AbstractInterface = new DeviceClass(\n            interfaceTarget.param || {},\n          );\n\n          // create agent from device\n          debug('creating agent from device', device);\n          const agent = createAgent(\n            device,\n            buildAgentOptions(\n              clonedYamlScript.agent,\n              preference.reportFileName,\n              fileName,\n            ),\n          );\n\n          freeFn.push({\n            name: 'destroy_general_interface_agent',\n            fn: () => {\n              agent.destroy();\n            },\n          });\n\n          return { agent, freeFn };\n        }\n\n        throw new Error(\n          'No valid interface configuration found in the yaml script, should be either \"web\", \"android\", \"ios\", \"harmony\", \"computer\", or \"interface\"',\n        );\n      } catch (error) {\n        await cleanupFailedPlayerSetup(freeFn);\n        throw error;\n      }\n    },\n    undefined,\n    file,\n  );\n\n  return player;\n}\n","import { basename, dirname, relative } from 'node:path';\nimport type {\n  MidsceneYamlScriptEnv,\n  ScriptPlayerStatusValue,\n  ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport type { ScriptPlayer } from '@midscene/core/yaml';\nimport chalk from 'chalk';\n\nexport interface MidsceneYamlFileContext {\n  file: string;\n  player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}\n\n/**\n * Decide whether the interactive (spinner / in-place redraw) renderer is safe\n * to use. Besides a real TTY, we honor well-known \"I'm not an interactive\n * terminal\" signals so that CI pipelines and Kubernetes pods do not get their\n * stream-based log collectors (Fluentd / Filebeat) flooded with raw\n * `\\x1b[1A\\x1b[2K` cursor-control sequences.\n *\n * - `MIDSCENE_CLI_LOG_ON_NON_TTY`: explicit opt-out (existing flag).\n * - `NO_COLOR`: https://no-color.org convention.\n * - `TERM=dumb`: terminal that cannot handle cursor movement.\n * - `CI`: generic CI flag set by virtually every CI provider; relevant when the\n *   environment still allocates a pseudo-TTY (e.g. `kubectl exec -t`).\n */\nexport function resolveIsTTY(\n  env: NodeJS.ProcessEnv = process.env,\n  stdoutIsTTY: boolean | undefined = process.stdout.isTTY,\n): boolean {\n  if (\n    env.MIDSCENE_CLI_LOG_ON_NON_TTY ||\n    env.NO_COLOR ||\n    env.TERM === 'dumb' ||\n    env.CI\n  ) {\n    return false;\n  }\n  return Boolean(stdoutIsTTY);\n}\n\nexport const isTTY = resolveIsTTY();\nexport const indent = '  ';\nexport const spinnerInterval = 80;\nexport const spinnerFrames = ['◰', '◳', '◲', '◱']; // https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json\nexport const currentSpinningFrame = () => {\n  return spinnerFrames[\n    Math.floor(Date.now() / spinnerInterval) % spinnerFrames.length\n  ];\n};\n\n// status: init / running / done / error\nfunction indicatorForStatus(status: ScriptPlayerStatusValue) {\n  if (status === 'init') {\n    return chalk.gray('◌');\n  }\n  if (status === 'running') {\n    return chalk.yellowBright(currentSpinningFrame());\n  }\n  if (status === 'done') {\n    return chalk.green('✔︎');\n  }\n  if (status === 'error') {\n    return chalk.red('✘');\n  }\n}\n\nexport const contextInfo = (context: MidsceneYamlFileContext) => {\n  const filePath = context.file;\n  const filePathToShow = relative(process.cwd(), filePath);\n  const fileNameToPrint = `${chalk.gray(`${filePathToShow}`)}`;\n  const fileStatusText = indicatorForStatus(context.player.status);\n  const contextActionText =\n    typeof context.player.currentTaskIndex === 'undefined' &&\n    context.player.status === 'running'\n      ? chalk.gray('(navigating)')\n      : '';\n\n  // error: ...\n  const errorText = context.player.errorInSetup\n    ? `\\n${indent}${chalk.red('error:')} ${context.player.errorInSetup?.message}\\n${indent}${indent}${context.player.errorInSetup?.stack}`\n    : '';\n\n  // output: ...\n  const outputFile = context.player.output;\n  const outputText =\n    outputFile && Object.keys(context.player.result || {}).length > 0\n      ? `\\n${indent}${chalk.gray(`output: ${outputFile}`)}`\n      : '';\n\n  // report: ...\n  const reportFile = context.player.reportFile;\n  const reportText = reportFile\n    ? `\\n${indent}${chalk.gray(`report: ${reportFile}`)}`\n    : '';\n\n  // agent status: ...\n  const agentStatusTip = context.player.agentStatusTip;\n  const agentStatusText = agentStatusTip\n    ? `\\n${indent}${chalk.gray(`agent status: ${agentStatusTip}`)}`\n    : '';\n\n  const mergedText =\n    `${fileStatusText} ${fileNameToPrint} ${contextActionText}${outputText}${reportText}${errorText}${agentStatusText}`.trim();\n\n  return {\n    fileNameToPrint,\n    fileStatusText,\n    contextActionText,\n    outputText,\n    reportText,\n    mergedText,\n  };\n};\n\nexport const singleTaskInfo = (task: ScriptPlayerTaskStatus) => {\n  let stepText = '';\n  if (task.status === 'init') {\n    stepText = '';\n  } else if (task.status === 'running' || task.status === 'error') {\n    if (typeof task.currentStep === 'undefined') {\n      stepText = chalk.gray('(navigating)');\n    } else if (typeof task.currentStep === 'number') {\n      const actionText = ''; // taskBrief ? `, ${taskBrief}` : '';\n      stepText = chalk.gray(\n        `(task ${task.currentStep + 1}/${task.totalSteps}${actionText})`.trim(),\n      );\n    } else {\n      stepText = chalk.gray('(unknown task)');\n    }\n  }\n\n  const errorText =\n    task.status === 'error'\n      ? `\\n${indent}${chalk.gray('error:')}\\n${indent}${indent}${task.error?.message}`\n      : '';\n\n  const statusText = indicatorForStatus(task.status);\n  const mergedLine = `${statusText} ${task.name} ${stepText}${errorText}`;\n  return {\n    nameText: task.name,\n    stepText,\n    errorText,\n    itemStatusText: statusText,\n    mergedLine,\n  };\n};\n\nfunction paddingLines(lines: string[]) {\n  return lines.map((line) => {\n    return `${indent}${line}`;\n  });\n}\n\nexport const contextTaskListSummary = (\n  taskStatusArray: ScriptPlayerTaskStatus[],\n  context: MidsceneYamlFileContext,\n) => {\n  const prefixLines: string[] = [];\n  const currentLine: string[] = [];\n  const suffixText: string[] = [];\n  const { mergedText: fileInfo } = contextInfo(context);\n  if (!context.player.errorInSetup) {\n    for (const task of taskStatusArray) {\n      const { mergedLine } = singleTaskInfo(task);\n\n      if (context.player.status === 'init') {\n        suffixText.push(mergedLine);\n      } else if (context.player.status === 'running') {\n        currentLine.push(mergedLine);\n      } else if (context.player.status === 'done') {\n        prefixLines.push(mergedLine);\n      } else if (context.player.status === 'error') {\n        prefixLines.push(mergedLine);\n      }\n    }\n  }\n  const lines: string[] = [fileInfo];\n  if (prefixLines.length > 0) lines.push(...paddingLines(prefixLines));\n  if (currentLine.length > 0) lines.push(...paddingLines(currentLine));\n  if (suffixText.length > 0) lines.push(...paddingLines(suffixText));\n  return lines.join('\\n');\n};\n\nexport const formatYamlProgressSnapshot = (\n  message: string,\n  attempt: number,\n  totalAttempts: number,\n): string =>\n  totalAttempts > 1\n    ? `Attempt ${attempt}/${totalAttempts}\\n${message}`\n    : message;\n","const copyProperty = (to, from, property, ignoreNonConfigurable) => {\n\t// `Function#length` should reflect the parameters of `to` not `from` since we keep its body.\n\t// `Function#prototype` is non-writable and non-configurable so can never be modified.\n\tif (property === 'length' || property === 'prototype') {\n\t\treturn;\n\t}\n\n\t// `Function#arguments` and `Function#caller` should not be copied. They were reported to be present in `Reflect.ownKeys` for some devices in React Native (#41), so we explicitly ignore them here.\n\tif (property === 'arguments' || property === 'caller') {\n\t\treturn;\n\t}\n\n\tconst toDescriptor = Object.getOwnPropertyDescriptor(to, property);\n\tconst fromDescriptor = Object.getOwnPropertyDescriptor(from, property);\n\n\tif (!canCopyProperty(toDescriptor, fromDescriptor) && ignoreNonConfigurable) {\n\t\treturn;\n\t}\n\n\tObject.defineProperty(to, property, fromDescriptor);\n};\n\n// `Object.defineProperty()` throws if the property exists, is not configurable and either:\n// - one its descriptors is changed\n// - it is non-writable and its value is changed\nconst canCopyProperty = function (toDescriptor, fromDescriptor) {\n\treturn toDescriptor === undefined || toDescriptor.configurable || (\n\t\ttoDescriptor.writable === fromDescriptor.writable\n\t\t&& toDescriptor.enumerable === fromDescriptor.enumerable\n\t\t&& toDescriptor.configurable === fromDescriptor.configurable\n\t\t&& (toDescriptor.writable || toDescriptor.value === fromDescriptor.value)\n\t);\n};\n\nconst changePrototype = (to, from) => {\n\tconst fromPrototype = Object.getPrototypeOf(from);\n\tif (fromPrototype === Object.getPrototypeOf(to)) {\n\t\treturn;\n\t}\n\n\tObject.setPrototypeOf(to, fromPrototype);\n};\n\nconst wrappedToString = (withName, fromBody) => `/* Wrapped ${withName}*/\\n${fromBody}`;\n\nconst toStringDescriptor = Object.getOwnPropertyDescriptor(Function.prototype, 'toString');\nconst toStringName = Object.getOwnPropertyDescriptor(Function.prototype.toString, 'name');\n\n// We call `from.toString()` early (not lazily) to ensure `from` can be garbage collected.\n// We use `bind()` instead of a closure for the same reason.\n// Calling `from.toString()` early also allows caching it in case `to.toString()` is called several times.\nconst changeToString = (to, from, name) => {\n\tconst withName = name === '' ? '' : `with ${name.trim()}() `;\n\tconst newToString = wrappedToString.bind(null, withName, from.toString());\n\t// Ensure `to.toString.toString` is non-enumerable and has the same `same`\n\tObject.defineProperty(newToString, 'name', toStringName);\n\tconst {writable, enumerable, configurable} = toStringDescriptor; // We destructue to avoid a potential `get` descriptor.\n\tObject.defineProperty(to, 'toString', {value: newToString, writable, enumerable, configurable});\n};\n\nexport default function mimicFunction(to, from, {ignoreNonConfigurable = false} = {}) {\n\tconst {name} = to;\n\n\tfor (const property of Reflect.ownKeys(from)) {\n\t\tcopyProperty(to, from, property, ignoreNonConfigurable);\n\t}\n\n\tchangePrototype(to, from);\n\tchangeToString(to, from, name);\n\n\treturn to;\n}\n","import mimicFunction from 'mimic-function';\n\nconst calledFunctions = new WeakMap();\n\nconst onetime = (function_, options = {}) => {\n\tif (typeof function_ !== 'function') {\n\t\tthrow new TypeError('Expected a function');\n\t}\n\n\tlet returnValue;\n\tlet callCount = 0;\n\tconst functionName = function_.displayName || function_.name || '<anonymous>';\n\n\tconst onetime = function (...arguments_) {\n\t\tcalledFunctions.set(onetime, ++callCount);\n\n\t\tif (callCount === 1) {\n\t\t\treturnValue = function_.apply(this, arguments_);\n\t\t\tfunction_ = undefined;\n\t\t} else if (options.throw === true) {\n\t\t\tthrow new Error(`Function \\`${functionName}\\` can only be called once`);\n\t\t}\n\n\t\treturn returnValue;\n\t};\n\n\tmimicFunction(onetime, function_);\n\tcalledFunctions.set(onetime, callCount);\n\n\treturn onetime;\n};\n\nonetime.callCount = function_ => {\n\tif (!calledFunctions.has(function_)) {\n\t\tthrow new Error(`The given function \\`${function_.name}\\` is not wrapped by the \\`onetime\\` package`);\n\t}\n\n\treturn calledFunctions.get(function_);\n};\n\nexport default onetime;\n","/**\n * This is not the set of all possible signals.\n *\n * It IS, however, the set of all signals that trigger\n * an exit on either Linux or BSD systems.  Linux is a\n * superset of the signal names supported on BSD, and\n * the unknown signals just fail to register, so we can\n * catch that easily enough.\n *\n * Windows signals are a different set, since there are\n * signals that terminate Windows processes, but don't\n * terminate (or don't even exist) on Posix systems.\n *\n * Don't bother with SIGKILL.  It's uncatchable, which\n * means that we can't fire any callbacks anyway.\n *\n * If a user does happen to register a handler on a non-\n * fatal signal like SIGWINCH or something, and then\n * exit, it'll end up firing `process.emit('exit')`, so\n * the handler will be fired anyway.\n *\n * SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised\n * artificially, inherently leave the process in a\n * state from which it is not safe to try and enter JS\n * listeners.\n */\nexport const signals = [];\nsignals.push('SIGHUP', 'SIGINT', 'SIGTERM');\nif (process.platform !== 'win32') {\n    signals.push('SIGALRM', 'SIGABRT', 'SIGVTALRM', 'SIGXCPU', 'SIGXFSZ', 'SIGUSR2', 'SIGTRAP', 'SIGSYS', 'SIGQUIT', 'SIGIOT'\n    // should detect profiler and enable/disable accordingly.\n    // see #21\n    // 'SIGPROF'\n    );\n}\nif (process.platform === 'linux') {\n    signals.push('SIGIO', 'SIGPOLL', 'SIGPWR', 'SIGSTKFLT');\n}\n//# sourceMappingURL=signals.js.map","// Note: since nyc uses this module to output coverage, any lines\n// that are in the direct sync flow of nyc's outputCoverage are\n// ignored, since we can never get coverage for them.\n// grab a reference to node's real process object right away\nimport { signals } from './signals.js';\nexport { signals };\nconst processOk = (process) => !!process &&\n    typeof process === 'object' &&\n    typeof process.removeListener === 'function' &&\n    typeof process.emit === 'function' &&\n    typeof process.reallyExit === 'function' &&\n    typeof process.listeners === 'function' &&\n    typeof process.kill === 'function' &&\n    typeof process.pid === 'number' &&\n    typeof process.on === 'function';\nconst kExitEmitter = Symbol.for('signal-exit emitter');\nconst global = globalThis;\nconst ObjectDefineProperty = Object.defineProperty.bind(Object);\n// teeny special purpose ee\nclass Emitter {\n    emitted = {\n        afterExit: false,\n        exit: false,\n    };\n    listeners = {\n        afterExit: [],\n        exit: [],\n    };\n    count = 0;\n    id = Math.random();\n    constructor() {\n        if (global[kExitEmitter]) {\n            return global[kExitEmitter];\n        }\n        ObjectDefineProperty(global, kExitEmitter, {\n            value: this,\n            writable: false,\n            enumerable: false,\n            configurable: false,\n        });\n    }\n    on(ev, fn) {\n        this.listeners[ev].push(fn);\n    }\n    removeListener(ev, fn) {\n        const list = this.listeners[ev];\n        const i = list.indexOf(fn);\n        /* c8 ignore start */\n        if (i === -1) {\n            return;\n        }\n        /* c8 ignore stop */\n        if (i === 0 && list.length === 1) {\n            list.length = 0;\n        }\n        else {\n            list.splice(i, 1);\n        }\n    }\n    emit(ev, code, signal) {\n        if (this.emitted[ev]) {\n            return false;\n        }\n        this.emitted[ev] = true;\n        let ret = false;\n        for (const fn of this.listeners[ev]) {\n            ret = fn(code, signal) === true || ret;\n        }\n        if (ev === 'exit') {\n            ret = this.emit('afterExit', code, signal) || ret;\n        }\n        return ret;\n    }\n}\nclass SignalExitBase {\n}\nconst signalExitWrap = (handler) => {\n    return {\n        onExit(cb, opts) {\n            return handler.onExit(cb, opts);\n        },\n        load() {\n            return handler.load();\n        },\n        unload() {\n            return handler.unload();\n        },\n    };\n};\nclass SignalExitFallback extends SignalExitBase {\n    onExit() {\n        return () => { };\n    }\n    load() { }\n    unload() { }\n}\nclass SignalExit extends SignalExitBase {\n    // \"SIGHUP\" throws an `ENOSYS` error on Windows,\n    // so use a supported signal instead\n    /* c8 ignore start */\n    #hupSig = process.platform === 'win32' ? 'SIGINT' : 'SIGHUP';\n    /* c8 ignore stop */\n    #emitter = new Emitter();\n    #process;\n    #originalProcessEmit;\n    #originalProcessReallyExit;\n    #sigListeners = {};\n    #loaded = false;\n    constructor(process) {\n        super();\n        this.#process = process;\n        // { <signal>: <listener fn>, ... }\n        this.#sigListeners = {};\n        for (const sig of signals) {\n            this.#sigListeners[sig] = () => {\n                // If there are no other listeners, an exit is coming!\n                // Simplest way: remove us and then re-send the signal.\n                // We know that this will kill the process, so we can\n                // safely emit now.\n                const listeners = this.#process.listeners(sig);\n                let { count } = this.#emitter;\n                // This is a workaround for the fact that signal-exit v3 and signal\n                // exit v4 are not aware of each other, and each will attempt to let\n                // the other handle it, so neither of them do. To correct this, we\n                // detect if we're the only handler *except* for previous versions\n                // of signal-exit, and increment by the count of listeners it has\n                // created.\n                /* c8 ignore start */\n                const p = process;\n                if (typeof p.__signal_exit_emitter__ === 'object' &&\n                    typeof p.__signal_exit_emitter__.count === 'number') {\n                    count += p.__signal_exit_emitter__.count;\n                }\n                /* c8 ignore stop */\n                if (listeners.length === count) {\n                    this.unload();\n                    const ret = this.#emitter.emit('exit', null, sig);\n                    /* c8 ignore start */\n                    const s = sig === 'SIGHUP' ? this.#hupSig : sig;\n                    if (!ret)\n                        process.kill(process.pid, s);\n                    /* c8 ignore stop */\n                }\n            };\n        }\n        this.#originalProcessReallyExit = process.reallyExit;\n        this.#originalProcessEmit = process.emit;\n    }\n    onExit(cb, opts) {\n        /* c8 ignore start */\n        if (!processOk(this.#process)) {\n            return () => { };\n        }\n        /* c8 ignore stop */\n        if (this.#loaded === false) {\n            this.load();\n        }\n        const ev = opts?.alwaysLast ? 'afterExit' : 'exit';\n        this.#emitter.on(ev, cb);\n        return () => {\n            this.#emitter.removeListener(ev, cb);\n            if (this.#emitter.listeners['exit'].length === 0 &&\n                this.#emitter.listeners['afterExit'].length === 0) {\n                this.unload();\n            }\n        };\n    }\n    load() {\n        if (this.#loaded) {\n            return;\n        }\n        this.#loaded = true;\n        // This is the number of onSignalExit's that are in play.\n        // It's important so that we can count the correct number of\n        // listeners on signals, and don't wait for the other one to\n        // handle it instead of us.\n        this.#emitter.count += 1;\n        for (const sig of signals) {\n            try {\n                const fn = this.#sigListeners[sig];\n                if (fn)\n                    this.#process.on(sig, fn);\n            }\n            catch (_) { }\n        }\n        this.#process.emit = (ev, ...a) => {\n            return this.#processEmit(ev, ...a);\n        };\n        this.#process.reallyExit = (code) => {\n            return this.#processReallyExit(code);\n        };\n    }\n    unload() {\n        if (!this.#loaded) {\n            return;\n        }\n        this.#loaded = false;\n        signals.forEach(sig => {\n            const listener = this.#sigListeners[sig];\n            /* c8 ignore start */\n            if (!listener) {\n                throw new Error('Listener not defined for signal: ' + sig);\n            }\n            /* c8 ignore stop */\n            try {\n                this.#process.removeListener(sig, listener);\n                /* c8 ignore start */\n            }\n            catch (_) { }\n            /* c8 ignore stop */\n        });\n        this.#process.emit = this.#originalProcessEmit;\n        this.#process.reallyExit = this.#originalProcessReallyExit;\n        this.#emitter.count -= 1;\n    }\n    #processReallyExit(code) {\n        /* c8 ignore start */\n        if (!processOk(this.#process)) {\n            return 0;\n        }\n        this.#process.exitCode = code || 0;\n        /* c8 ignore stop */\n        this.#emitter.emit('exit', this.#process.exitCode, null);\n        return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);\n    }\n    #processEmit(ev, ...args) {\n        const og = this.#originalProcessEmit;\n        if (ev === 'exit' && processOk(this.#process)) {\n            if (typeof args[0] === 'number') {\n                this.#process.exitCode = args[0];\n                /* c8 ignore start */\n            }\n            /* c8 ignore start */\n            const ret = og.call(this.#process, ev, ...args);\n            /* c8 ignore start */\n            this.#emitter.emit('exit', this.#process.exitCode, null);\n            /* c8 ignore stop */\n            return ret;\n        }\n        else {\n            return og.call(this.#process, ev, ...args);\n        }\n    }\n}\nconst process = globalThis.process;\n// wrap so that we call the method on the actual handler, without\n// exporting it directly.\nexport const { \n/**\n * Called when the process is exiting, whether via signal, explicit\n * exit, or running out of stuff to do.\n *\n * If the global process object is not suitable for instrumentation,\n * then this will be a no-op.\n *\n * Returns a function that may be used to unload signal-exit.\n */\nonExit, \n/**\n * Load the listeners.  Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nload, \n/**\n * Unload the listeners.  Likely you never need to call this, unless\n * doing a rather deep integration with signal-exit functionality.\n * Mostly exposed for the benefit of testing.\n *\n * @internal\n */\nunload, } = signalExitWrap(processOk(process) ? new SignalExit(process) : new SignalExitFallback());\n//# sourceMappingURL=index.js.map","import process from 'node:process';\nimport onetime from 'onetime';\nimport {onExit} from 'signal-exit';\n\nconst terminal = process.stderr.isTTY\n\t? process.stderr\n\t: (process.stdout.isTTY ? process.stdout : undefined);\n\nconst restoreCursor = terminal ? onetime(() => {\n\tonExit(() => {\n\t\tterminal.write('\\u001B[?25h');\n\t}, {alwaysLast: true});\n}) : () => {};\n\nexport default restoreCursor;\n","import { appendFileSync } from 'node:fs';\nimport type { Writable } from 'node:stream';\nimport { stripVTControlCharacters } from 'node:util';\nimport restoreCursor from 'restore-cursor';\n\nconst DEFAULT_RENDER_INTERVAL = 160;\n\nconst ESC = '\\x1B[';\nconst CLEAR_LINE = `${ESC}K`;\nconst MOVE_CURSOR_ONE_ROW_UP = `${ESC}1A`;\nconst HIDE_CURSOR = `${ESC}?25l`;\nconst SHOW_CURSOR = `${ESC}?25h`;\nconst SYNC_START = `${ESC}?2026h`;\nconst SYNC_END = `${ESC}?2026l`;\n\ninterface Options {\n  outputStream: Writable;\n  errorStream: Writable;\n  interval?: number;\n  getWindow: () => string[];\n}\n\ntype StreamType = 'output' | 'error';\n\n/**\n * Renders content of `getWindow` at the bottom of the terminal and\n * forwards all other intercepted `stdout` and `stderr` logs above it.\n */\nexport class TTYWindowRenderer {\n  private options: Required<Options>;\n  private streams!: Record<StreamType, Writable['write']>;\n  private buffer: { type: StreamType; message: string }[] = [];\n  private renderInterval: NodeJS.Timeout | undefined = undefined;\n\n  private windowHeight = 0;\n  private finished = false;\n  private cleanups: (() => void)[] = [];\n\n  constructor(options: Options) {\n    this.options = {\n      interval: DEFAULT_RENDER_INTERVAL,\n      ...options,\n    };\n\n    this.streams = {\n      output: options.outputStream.write.bind(options.outputStream),\n      error: options.errorStream.write.bind(options.errorStream),\n    };\n\n    this.cleanups.push(\n      this.interceptStream(process.stdout, 'output'),\n      this.interceptStream(process.stderr, 'error'),\n    );\n\n    restoreCursor();\n    this.write(HIDE_CURSOR, 'output');\n\n    this.start();\n  }\n\n  start() {\n    this.finished = false;\n    this.renderInterval = setInterval(\n      () => this.flushBuffer(),\n      this.options.interval,\n    );\n  }\n\n  stop() {\n    this.flushBuffer();\n    // this.clearWindow();\n    this.write(SHOW_CURSOR, 'output');\n    this.cleanups.splice(0).map((fn) => fn());\n    clearInterval(this.renderInterval);\n  }\n\n  /**\n   * Write all buffered output and stop buffering.\n   * All intercepted writes are forwarded to actual write after this.\n   */\n  finish() {\n    this.finished = true;\n    this.flushBuffer();\n    clearInterval(this.renderInterval);\n  }\n\n  private flushBuffer() {\n    if (this.buffer.length === 0) {\n      return this.render();\n    }\n\n    let current;\n\n    // Concatenate same types into a single render\n    for (const next of this.buffer.splice(0)) {\n      if (!current) {\n        current = next;\n        continue;\n      }\n\n      if (current.type !== next.type) {\n        this.render(current.message, current.type);\n        current = next;\n        continue;\n      }\n\n      current.message += next.message;\n    }\n\n    if (current) {\n      this.render(current?.message, current?.type);\n    }\n  }\n\n  private render(message?: string, type: StreamType = 'output') {\n    if (this.finished) {\n      this.clearWindow();\n      return this.write(message || '', type);\n    }\n\n    const windowContent = this.options.getWindow();\n    const rowCount = getRenderedRowCount(\n      windowContent,\n      this.options.outputStream,\n    );\n    let padding = this.windowHeight - rowCount;\n\n    if (padding > 0 && message) {\n      padding -= getRenderedRowCount([message], this.options.outputStream);\n    }\n\n    this.write(SYNC_START);\n    this.clearWindow();\n\n    if (message) {\n      this.write(message, type);\n    }\n\n    if (padding > 0) {\n      this.write('\\n'.repeat(padding));\n    }\n\n    this.write(windowContent.join('\\n'));\n    this.write(SYNC_END);\n\n    this.windowHeight = rowCount + Math.max(0, padding);\n  }\n\n  private clearWindow() {\n    if (this.windowHeight === 0) {\n      return;\n    }\n\n    this.write(CLEAR_LINE);\n\n    for (let i = 1; i < this.windowHeight; i++) {\n      this.write(`${MOVE_CURSOR_ONE_ROW_UP}${CLEAR_LINE}`);\n    }\n\n    this.windowHeight = 0;\n  }\n\n  private interceptStream(stream: NodeJS.WriteStream, type: StreamType) {\n    const original = stream.write;\n\n    // @ts-expect-error -- not sure how 2 overloads should be typed\n    stream.write = (chunk, _, callback) => {\n      if (chunk) {\n        if (this.finished) {\n          this.write(chunk.toString(), type);\n        } else {\n          this.buffer.push({ type, message: chunk.toString() });\n        }\n      }\n      callback?.();\n    };\n\n    return function restore() {\n      stream.write = original;\n    };\n  }\n\n  private write(message: string, type: 'output' | 'error' = 'output') {\n    (this.streams[type] as Writable['write'])(message);\n  }\n}\n\n/** Calculate the actual row count needed to render `rows` into `stream` */\nfunction getRenderedRowCount(\n  contents: string[],\n  stream: Options['outputStream'],\n) {\n  let count = 0;\n  const columns = 'columns' in stream ? (stream.columns as number) : 80;\n\n  for (const content of contents) {\n    const rows = content.split('\\n');\n    for (const row of rows) {\n      const text = stripVTControlCharacters(row);\n      count += Math.max(1, Math.ceil(text.length / columns));\n    }\n  }\n\n  return count;\n}\n","import { readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type {\n  MidsceneYamlConfigAttempt,\n  MidsceneYamlConfigResult,\n  MidsceneYamlScript,\n  MidsceneYamlScriptAndroidEnv,\n  MidsceneYamlScriptIOSEnv,\n  MidsceneYamlScriptWebEnv,\n} from '@midscene/core';\nimport { parseYamlScript, resolveWebTarget } from '@midscene/core/yaml';\nimport { getDebug } from '@midscene/shared/logger';\nimport {\n  buildChromeArgs,\n  buildDownloadBehavior,\n  defaultViewportHeight,\n  defaultViewportWidth,\n} from '@midscene/web/puppeteer-agent-launcher';\n\nimport merge from 'lodash.merge';\nimport pLimit from 'p-limit';\nimport puppeteer, {\n  type Browser,\n  type BrowserContext,\n  type BrowserContextOptions,\n} from 'puppeteer';\nimport { createYamlPlayer } from './create-yaml-player';\nimport {\n  createExecutedYamlResult,\n  createNotExecutedYamlResult,\n  createUnexpectedYamlResult,\n  createYamlAttempt,\n  getYamlAttemptsDuration,\n  preserveYamlAttemptReport,\n  printExecutionFinished,\n  printExecutionPlan,\n  resolveYamlMaxAttempts,\n  writeExecutionSummaryFile,\n} from './execution-summary';\nimport {\n  type MidsceneYamlFileContext,\n  contextInfo,\n  contextTaskListSummary,\n  formatYamlProgressSnapshot,\n  isTTY,\n  spinnerInterval,\n} from './printer';\nimport { TTYWindowRenderer } from './tty-renderer';\nimport { YamlBatchExecutionError } from './yaml-batch-error';\n\nconst batchWarning = getDebug('yaml-batch-executor', { console: true });\n\nconst normalizeExecutionError = (error: unknown): Error =>\n  error instanceof Error\n    ? error\n    : new Error('Unexpected YAML execution failure', { cause: error });\n\nexport interface BatchRunnerConfig {\n  files: string[];\n  /**\n   * A setup yaml file executed before the main `files`. A setup failure aborts\n   * the batch and leaves the main files not executed. Puppeteer Web setup uses\n   * `shareBrowserContext` to pass its successful browser state to the main\n   * files. Other targets run setup in their own target environment without\n   * browser-context sharing.\n   */\n  setup?: string;\n  concurrent: number;\n  continueOnError: boolean;\n  /**\n   * Number of extra attempts for a failed yaml file. The batch executor owns\n   * retries so it can re-execute only failed files. Puppeteer Web setup retries\n   * receive a clean browser context; other targets receive a new player/Agent\n   * while their underlying device or external session may retain state.\n   * Main-file retries preserve the successful setup environment. Defaults to 0\n   * (no retry).\n   */\n  retry?: number;\n  summary: string;\n  /** Share one BrowserContext across Puppeteer Web yaml files. */\n  shareBrowserContext: boolean;\n  globalConfig?: {\n    page?: Partial<MidsceneYamlScriptWebEnv>;\n    browser?: Partial<MidsceneYamlScriptWebEnv>;\n    web?: Partial<MidsceneYamlScriptWebEnv>;\n    android?: Partial<MidsceneYamlScriptAndroidEnv>;\n    ios?: Partial<MidsceneYamlScriptIOSEnv>;\n    target?: Partial<MidsceneYamlScriptWebEnv>;\n  };\n  headed: boolean;\n  keepWindow: boolean;\n  dotenvOverride: boolean;\n  dotenvDebug: boolean;\n}\n\ninterface BatchFileContext {\n  caseId: string;\n  file: string;\n  sourceConfig: MidsceneYamlScript;\n  executionConfig: MidsceneYamlScript;\n  outputPath?: string;\n  options: {\n    headed?: boolean;\n    keepWindow?: boolean;\n    browser?: Browser;\n    browserContext?: BrowserContext;\n  };\n}\n\ntype BatchRuntimeTarget =\n  | 'puppeteer-web'\n  | 'bridge-web'\n  | 'android'\n  | 'ios'\n  | 'harmony'\n  | 'computer'\n  | 'interface';\n\nconst batchRuntimeTargetLabel: Record<BatchRuntimeTarget, string> = {\n  'puppeteer-web': 'Puppeteer Web',\n  'bridge-web': 'Web bridge mode',\n  android: 'Android',\n  ios: 'iOS',\n  harmony: 'HarmonyOS',\n  computer: 'Computer',\n  interface: 'Interface',\n};\n\n/**\n * Resolve a target only when the script has one unambiguous target family.\n * Structural target errors remain owned by createYamlPlayer, which provides\n * the canonical validation messages for missing or conflicting targets.\n */\nconst resolveBatchRuntimeTarget = (\n  config: MidsceneYamlScript,\n): BatchRuntimeTarget | undefined => {\n  const webTarget = resolveWebTarget(config);\n  const targets: BatchRuntimeTarget[] = [];\n  if (webTarget) {\n    targets.push(webTarget.target.bridgeMode ? 'bridge-web' : 'puppeteer-web');\n  }\n  if (typeof config.android !== 'undefined') targets.push('android');\n  if (typeof config.ios !== 'undefined') targets.push('ios');\n  if (typeof config.harmony !== 'undefined') targets.push('harmony');\n  if (typeof config.computer !== 'undefined') targets.push('computer');\n  if (typeof config.interface !== 'undefined') targets.push('interface');\n\n  return targets.length === 1 ? targets[0] : undefined;\n};\n\nconst assertBrowserContextUsage = (\n  setupContext: BatchFileContext | undefined,\n  allContexts: BatchFileContext[],\n  shareBrowserContext: boolean,\n): void => {\n  const resolvedTargets = allContexts.map((context) => ({\n    context,\n    target: resolveBatchRuntimeTarget(context.executionConfig),\n  }));\n\n  if (shareBrowserContext) {\n    const unsupported = resolvedTargets.find(\n      ({ target }) => target && target !== 'puppeteer-web',\n    );\n    if (unsupported?.target) {\n      throw new Error(\n        `shareBrowserContext only supports Puppeteer Web targets, but \"${unsupported.context.file}\" uses ${batchRuntimeTargetLabel[unsupported.target]}. Remove shareBrowserContext or use a Puppeteer Web target.`,\n      );\n    }\n\n    const browserCreationOptions = [\n      'cdpEndpoint',\n      'chromeArgs',\n      'acceptInsecureCerts',\n      'downloadPath',\n    ] as const;\n    for (const { context, target } of resolvedTargets) {\n      if (target !== 'puppeteer-web') continue;\n      const fileWebConfig = resolveWebTarget(context.sourceConfig)?.target;\n      const misplacedOptions = browserCreationOptions.filter(\n        (option) => typeof fileWebConfig?.[option] !== 'undefined',\n      );\n      if (misplacedOptions.length > 0) {\n        throw new Error(\n          `shareBrowserContext creates one browser from the batch global config, so browser-level option(s) ${misplacedOptions.map((option) => `\"${option}\"`).join(', ')} in \"${context.file}\" would be ignored. Move them to the batch config's global Web target.`,\n        );\n      }\n    }\n  }\n\n  if (\n    setupContext &&\n    !shareBrowserContext &&\n    resolveBatchRuntimeTarget(setupContext.executionConfig) === 'puppeteer-web'\n  ) {\n    throw new Error(\n      `Puppeteer Web setup \"${setupContext.file}\" requires shareBrowserContext: true so its browser state can be shared with the main files.`,\n    );\n  }\n};\n\ninterface ExecutedBatchFileContext extends MidsceneYamlFileContext {\n  caseId: string;\n  duration: number;\n  yamlResult: MidsceneYamlConfigResult;\n}\n\ninterface NotExecutedBatchFileContext {\n  caseId: string;\n  file: string;\n  player: null;\n}\n\ninterface UnexpectedBatchFileContext {\n  caseId: string;\n  file: string;\n  error: Error;\n  yamlResult: MidsceneYamlConfigResult;\n}\n\ntype FileExecutionOutcome =\n  | { kind: 'executed'; context: ExecutedBatchFileContext }\n  | { kind: 'unexpected'; context: UnexpectedBatchFileContext };\n\nexport interface YamlBatchOccurrenceResult {\n  caseId: string;\n  result: MidsceneYamlConfigResult;\n}\n\ninterface SharedBrowserRuntime {\n  browserContext: BrowserContext;\n}\n\nconst createSharedBrowserRuntime = async (\n  browser: Browser,\n  browserContextOptions?: BrowserContextOptions,\n): Promise<SharedBrowserRuntime> => {\n  const browserContext = await browser.createBrowserContext(\n    browserContextOptions,\n  );\n  return { browserContext };\n};\n\nexport interface RunYamlBatchOptions {\n  generateSummary?: boolean;\n  printExecutionPlan?: boolean;\n  /**\n   * Receives complete, line-oriented progress snapshots. When provided, the\n   * caller owns progress delivery and direct terminal rendering is disabled.\n   */\n  onProgress?: (message: string) => void;\n}\n\nclass YamlBatchExecutor {\n  private config: BatchRunnerConfig;\n  private caseIds: string[];\n  private results: YamlBatchOccurrenceResult[] = [];\n\n  constructor(config: BatchRunnerConfig, caseIds?: string[]) {\n    this.config = config;\n    const occurrenceCount = config.files.length + (config.setup ? 1 : 0);\n    this.caseIds =\n      caseIds ??\n      Array.from(\n        { length: occurrenceCount },\n        (_, index) => `batch-occurrence-${index + 1}`,\n      );\n    if (this.caseIds.length !== occurrenceCount) {\n      throw new Error(\n        `Batch occurrence identity mismatch: expected ${occurrenceCount} case ID(s), received ${this.caseIds.length}`,\n      );\n    }\n    if (new Set(this.caseIds).size !== this.caseIds.length) {\n      throw new Error('Batch occurrence case IDs must be unique');\n    }\n  }\n\n  async run(\n    options: RunYamlBatchOptions = {},\n  ): Promise<YamlBatchOccurrenceResult[]> {\n    const generateSummary = options.generateSummary ?? true;\n    const shouldPrintExecutionPlan = options.printExecutionPlan ?? true;\n    const { keepWindow, headed } = this.config;\n    const setup = this.config.setup;\n\n    // Print execution plan\n    if (shouldPrintExecutionPlan) {\n      printExecutionPlan(this.config);\n    }\n\n    // Prepare file contexts\n    let setupContext: BatchFileContext | undefined;\n    const fileContextList: BatchFileContext[] = [];\n    let browser: Browser | null = null;\n    const sharedRuntime = { current: null as SharedBrowserRuntime | null };\n    let caseIndex = 0;\n    let executionError: unknown;\n\n    try {\n      // Create the setup context (prerequisite) before the main files so the\n      // TTY plan lists it first and its successful state can be handed off.\n      if (setup) {\n        const fileConfig = await this.loadFileConfig(setup);\n        setupContext = await this.createFileContext(\n          setup,\n          fileConfig,\n          { headed, keepWindow },\n          this.caseIds[caseIndex++],\n        );\n      }\n\n      // First, create all file contexts without a browser instance\n      for (const file of this.config.files) {\n        const fileConfig = await this.loadFileConfig(file);\n        const context = await this.createFileContext(\n          file,\n          fileConfig,\n          { headed, keepWindow },\n          this.caseIds[caseIndex++],\n        );\n        fileContextList.push(context);\n      }\n\n      // A yaml file cannot be both the setup prerequisite and a main case.\n      // Reject the ambiguous configuration explicitly.\n      if (setupContext) {\n        const setupPath = resolve(setupContext.file);\n        const conflict = fileContextList.find(\n          (ctx) => resolve(ctx.file) === setupPath,\n        );\n        if (conflict) {\n          throw new Error(\n            `\"${conflict.file}\" is used as both the setup file and a main file; a yaml file cannot be both`,\n          );\n        }\n      }\n\n      const allContexts = setupContext\n        ? [setupContext, ...fileContextList]\n        : fileContextList;\n\n      assertBrowserContextUsage(\n        setupContext,\n        allContexts,\n        this.config.shareBrowserContext,\n      );\n\n      // Now, check if any of the tasks require a web browser\n      const needsBrowser = allContexts.some(\n        (ctx) => typeof resolveWebTarget(ctx.executionConfig) !== 'undefined',\n      );\n      let resetSetupRuntime: (() => Promise<void>) | undefined;\n\n      if (needsBrowser && this.config.shareBrowserContext) {\n        const globalWebConfig = resolveWebTarget(\n          this.config.globalConfig ?? {},\n        )?.target;\n        const downloadBehavior = buildDownloadBehavior(\n          globalWebConfig?.downloadPath,\n        );\n        const browserContextOptions = downloadBehavior\n          ? { downloadBehavior }\n          : undefined;\n\n        if (globalWebConfig?.cdpEndpoint) {\n          // CDP mode: connect to an existing browser\n          browser = await puppeteer.connect({\n            browserWSEndpoint: globalWebConfig.cdpEndpoint,\n            defaultViewport: null,\n            downloadBehavior,\n          });\n        } else {\n          // Extract viewport dimensions from global config or use defaults\n          // This should match the logic in launchPuppeteerPage\n          const width = globalWebConfig?.viewportWidth ?? defaultViewportWidth;\n          const height =\n            globalWebConfig?.viewportHeight ?? defaultViewportHeight;\n\n          const args = buildChromeArgs({\n            userAgent: globalWebConfig?.userAgent,\n            // Only pass windowSize in headed mode; in headless mode, defaultViewport takes precedence\n            windowSize: headed ? { width, height } : undefined,\n            chromeArgs: globalWebConfig?.chromeArgs,\n          });\n\n          browser = await puppeteer.launch({\n            headless: !headed,\n            defaultViewport: headed ? null : { width, height },\n            downloadBehavior,\n            args,\n            acceptInsecureCerts: globalWebConfig?.acceptInsecureCerts,\n          });\n        }\n\n        resetSetupRuntime = async () => {\n          if (!browser) {\n            throw new Error('Cannot create a shared runtime without a browser');\n          }\n\n          if (sharedRuntime.current) {\n            const staleRuntime = sharedRuntime.current;\n            sharedRuntime.current = null;\n            await staleRuntime.browserContext.close();\n          }\n\n          sharedRuntime.current = await createSharedBrowserRuntime(\n            browser,\n            browserContextOptions,\n          );\n          for (const context of allContexts) {\n            context.options.browser = browser;\n            context.options.browserContext =\n              sharedRuntime.current.browserContext;\n          }\n        };\n\n        await resetSetupRuntime();\n      }\n\n      // A failed setup attempt replaces the shared runtime; main-file retries\n      // keep using the successful setup runtime.\n      const {\n        executedResults,\n        unexpectedResults,\n        notExecutedContexts,\n        unexpectedError,\n      } = await this.executeFiles(setupContext, fileContextList, {\n        onProgress: options.onProgress,\n        resetSetupRuntime,\n      });\n\n      this.results = await this.processResults(\n        executedResults,\n        unexpectedResults,\n        notExecutedContexts,\n      );\n      executionError = unexpectedError;\n    } catch (error) {\n      executionError = error;\n    } finally {\n      if (browser && !this.config.keepWindow) {\n        try {\n          if (sharedRuntime.current) {\n            await sharedRuntime.current.browserContext.close();\n            sharedRuntime.current = null;\n          }\n        } catch (error) {\n          if (executionError) {\n            batchWarning(\n              'failed to close the shared browser context after execution had already failed; preserving the original error',\n              error,\n            );\n          } else {\n            executionError = error;\n          }\n        }\n\n        try {\n          // For CDP mode, disconnect instead of closing the externally managed browser.\n          const isCdp = !!resolveWebTarget(this.config.globalConfig ?? {})\n            ?.target.cdpEndpoint;\n          if (isCdp) {\n            browser.disconnect();\n          } else {\n            await browser.close();\n          }\n        } catch (error) {\n          if (executionError) {\n            batchWarning(\n              'failed to clean up the shared browser after execution had already failed; preserving the original error',\n              error,\n            );\n          } else {\n            executionError = error;\n          }\n        }\n      }\n      if (generateSummary) {\n        await this.generateOutputIndex();\n      }\n    }\n\n    if (executionError) {\n      throw new YamlBatchExecutionError(executionError, this.results);\n    }\n\n    return this.results;\n  }\n\n  private async createFileContext(\n    file: string,\n    fileConfig: MidsceneYamlScript,\n    options: { headed?: boolean; keepWindow?: boolean; browser?: Browser },\n    caseId: string,\n  ): Promise<BatchFileContext> {\n    const { globalConfig } = this.config;\n\n    // Deep clone to avoid mutation\n    const clonedFileConfig = JSON.parse(JSON.stringify(fileConfig));\n\n    // Start with the file's config, then merge the global config from the index file,\n    // which has already been merged with command-line options.\n    const executionConfig = merge(clonedFileConfig, globalConfig);\n\n    return {\n      caseId,\n      file,\n      sourceConfig: fileConfig,\n      executionConfig,\n      options,\n    };\n  }\n\n  private async executeFiles(\n    setupContext: BatchFileContext | undefined,\n    fileContextList: BatchFileContext[],\n    options: {\n      onProgress?: (message: string) => void;\n      resetSetupRuntime?: () => Promise<void>;\n    },\n  ): Promise<{\n    executedResults: ExecutedBatchFileContext[];\n    unexpectedResults: UnexpectedBatchFileContext[];\n    notExecutedContexts: NotExecutedBatchFileContext[];\n    unexpectedError?: Error;\n  }> {\n    const { onProgress, resetSetupRuntime } = options;\n    const executedResults: ExecutedBatchFileContext[] = [];\n    const unexpectedResults: UnexpectedBatchFileContext[] = [];\n    const notExecutedContexts: NotExecutedBatchFileContext[] = [];\n\n    // Create the setup player first. Main-file players are deferred until the\n    // setup succeeds so they never retain a page from a discarded setup attempt.\n    const allFileContexts: MidsceneYamlFileContext[] = [];\n    const fileContextsByCaseId = new Map<string, MidsceneYamlFileContext>();\n    const createFilePlayerContext = async (\n      context: BatchFileContext,\n    ): Promise<MidsceneYamlFileContext> => {\n      const fileContext = {\n        file: context.file,\n        player: await createYamlPlayer(\n          context.file,\n          context.executionConfig,\n          context.options,\n        ),\n      };\n      fileContextsByCaseId.set(context.caseId, fileContext);\n      return fileContext;\n    };\n    const initialContexts = setupContext ? [setupContext] : fileContextList;\n    for (const context of initialContexts) {\n      allFileContexts.push(await createFilePlayerContext(context));\n    }\n\n    // Setup TTY renderer\n    let ttyRenderer: TTYWindowRenderer | undefined;\n    if (isTTY && !onProgress) {\n      const summaryContents = () => {\n        const summary: string[] = [''];\n        for (const context of allFileContexts) {\n          summary.push(\n            contextTaskListSummary(context.player.taskStatusList, context),\n          );\n        }\n        summary.push('');\n        return summary;\n      };\n      ttyRenderer = new TTYWindowRenderer({\n        outputStream: process.stdout,\n        errorStream: process.stderr,\n        getWindow: summaryContents,\n        interval: spinnerInterval,\n      });\n      ttyRenderer.start();\n    }\n\n    const reportProgressSnapshot = (\n      context: MidsceneYamlFileContext,\n      attempt: number,\n      totalAttempts: number,\n    ) => {\n      const summary = contextTaskListSummary(\n        context.player.taskStatusList,\n        context,\n      );\n      onProgress?.(formatYamlProgressSnapshot(summary, attempt, totalAttempts));\n    };\n\n    let unexpectedError: Error | undefined;\n\n    try {\n      // Helper function to execute a single file\n      const executeFile = async (\n        context: BatchFileContext,\n        beforeRetry?: () => Promise<void>,\n      ): Promise<FileExecutionOutcome> => {\n        const allFileContext = fileContextsByCaseId.get(context.caseId);\n        let lastAttemptStartTime: number | undefined;\n\n        try {\n          if (!allFileContext) {\n            throw new Error(`Player not found for file: ${context.file}`);\n          }\n\n          const totalAttempts = resolveYamlMaxAttempts(this.config.retry);\n          const attempts: MidsceneYamlConfigAttempt[] = [];\n          let executedContext: ExecutedBatchFileContext | undefined;\n\n          for (let attempt = 1; attempt <= totalAttempts; attempt++) {\n            if (attempt > 1) {\n              if (context.executionConfig.agent?.reportFileName) {\n                attempts[attempts.length - 1] = preserveYamlAttemptReport(\n                  attempts[attempts.length - 1],\n                );\n              }\n              await beforeRetry?.();\n              allFileContext.player = await createYamlPlayer(\n                context.file,\n                context.executionConfig,\n                context.options,\n              );\n            }\n\n            if (onProgress) {\n              reportProgressSnapshot(allFileContext, attempt, totalAttempts);\n            } else if (!isTTY) {\n              const { mergedText } = contextInfo(allFileContext);\n              console.log(mergedText);\n            }\n\n            if (context.outputPath) {\n              allFileContext.player.output = context.outputPath;\n            }\n\n            const startTime = Date.now();\n            lastAttemptStartTime = startTime;\n            await allFileContext.player.run();\n            const duration = Date.now() - startTime;\n            const attemptResult = createExecutedYamlResult({\n              file: context.file,\n              player: allFileContext.player,\n              duration,\n            });\n            attempts.push(createYamlAttempt(attemptResult, attempt));\n            const totalDuration = getYamlAttemptsDuration(attempts);\n\n            const yamlResult: MidsceneYamlConfigResult = {\n              ...attemptResult,\n              duration: totalDuration,\n              attempts: [...attempts],\n            };\n            executedContext = {\n              caseId: context.caseId,\n              file: context.file,\n              player: allFileContext.player,\n              duration: totalDuration,\n              yamlResult,\n            };\n\n            if (onProgress) {\n              reportProgressSnapshot(executedContext, attempt, totalAttempts);\n            } else if (!isTTY) {\n              console.log(\n                contextTaskListSummary(\n                  allFileContext.player.taskStatusList,\n                  executedContext,\n                ),\n              );\n            }\n\n            if (yamlResult.success) break;\n          }\n\n          if (!executedContext) {\n            throw new Error(`No attempts executed for file: ${context.file}`);\n          }\n          return { kind: 'executed', context: executedContext };\n        } catch (error) {\n          const normalizedError = normalizeExecutionError(error);\n          return {\n            kind: 'unexpected',\n            context: {\n              caseId: context.caseId,\n              file: context.file,\n              error: normalizedError,\n              yamlResult: createUnexpectedYamlResult({\n                file: context.file,\n                error: normalizedError,\n                duration:\n                  lastAttemptStartTime === undefined\n                    ? 0\n                    : Date.now() - lastAttemptStartTime,\n                player: allFileContext?.player,\n              }),\n            },\n          };\n        }\n      };\n\n      // Run the setup file first, if any. A setup failure aborts the batch:\n      // every main file is marked as not executed. This holds regardless of\n      // `continueOnError`, since the main files rely on the prerequisite state\n      // the setup file establishes.\n      let setupFailed = false;\n      if (setupContext) {\n        const outcome = await executeFile(setupContext, resetSetupRuntime);\n        if (outcome.kind === 'unexpected') {\n          unexpectedResults.push(outcome.context);\n          unexpectedError = outcome.context.error;\n          setupFailed = true;\n        } else {\n          executedResults.push(outcome.context);\n          setupFailed = !outcome.context.yamlResult.success;\n        }\n      }\n\n      if (setupFailed) {\n        for (const context of fileContextList) {\n          notExecutedContexts.push({\n            caseId: context.caseId,\n            file: context.file,\n            player: null,\n          });\n        }\n      } else {\n        if (setupContext) {\n          for (const context of fileContextList) {\n            allFileContexts.push(await createFilePlayerContext(context));\n          }\n        }\n        // Execute based on concurrency and error handling settings\n        unexpectedError = await this.executeConcurrently(\n          fileContextList,\n          executeFile,\n          executedResults,\n          unexpectedResults,\n          notExecutedContexts,\n        );\n      }\n\n      // Print final summary for non-TTY mode\n      if (!isTTY && !onProgress) {\n        console.log('\\n📋 Execution Results:');\n        for (const context of executedResults) {\n          console.log(\n            contextTaskListSummary(context.player.taskStatusList, context),\n          );\n        }\n      }\n    } finally {\n      if (ttyRenderer) {\n        ttyRenderer.stop();\n      }\n    }\n\n    return {\n      executedResults,\n      unexpectedResults,\n      notExecutedContexts,\n      unexpectedError,\n    };\n  }\n\n  private async executeConcurrently(\n    fileContextList: BatchFileContext[],\n    executeFile: (context: BatchFileContext) => Promise<FileExecutionOutcome>,\n    executedResults: ExecutedBatchFileContext[],\n    unexpectedResults: UnexpectedBatchFileContext[],\n    notExecutedContexts: NotExecutedBatchFileContext[],\n  ): Promise<Error | undefined> {\n    const limit = pLimit(this.config.concurrent);\n    let unexpectedError: Error | undefined;\n    const recordOutcome = (outcome: FileExecutionOutcome) => {\n      if (outcome.kind === 'unexpected') {\n        unexpectedResults.push(outcome.context);\n        unexpectedError ??= outcome.context.error;\n      } else {\n        executedResults.push(outcome.context);\n      }\n    };\n\n    if (this.config.continueOnError) {\n      // Execute all tasks with concurrency\n      const tasks = fileContextList.map((context) =>\n        limit(async () => {\n          recordOutcome(await executeFile(context));\n        }),\n      );\n      await Promise.all(tasks);\n    } else {\n      // Execute with concurrency but stop new tasks when failure occurs\n      let shouldStop = false;\n      const stopLock = { value: false };\n\n      const tasks = fileContextList.map((context) =>\n        limit(async () => {\n          if (stopLock.value) {\n            notExecutedContexts.push({\n              caseId: context.caseId,\n              file: context.file,\n              player: null,\n            });\n            return;\n          }\n\n          const outcome = await executeFile(context);\n          recordOutcome(outcome);\n\n          if (\n            (outcome.kind === 'unexpected' ||\n              !outcome.context.yamlResult.success) &&\n            !stopLock.value\n          ) {\n            stopLock.value = true;\n            shouldStop = true;\n          }\n        }),\n      );\n\n      await Promise.all(tasks);\n\n      // Handle not executed contexts\n      if (shouldStop) {\n        for (const context of fileContextList) {\n          if (\n            !executedResults.some((r) => r.caseId === context.caseId) &&\n            !unexpectedResults.some((r) => r.caseId === context.caseId) &&\n            !notExecutedContexts.some((ctx) => ctx.caseId === context.caseId)\n          ) {\n            notExecutedContexts.push({\n              caseId: context.caseId,\n              file: context.file,\n              player: null,\n            });\n          }\n        }\n      }\n    }\n\n    return unexpectedError;\n  }\n\n  private async processResults(\n    executedContexts: ExecutedBatchFileContext[],\n    unexpectedContexts: UnexpectedBatchFileContext[],\n    notExecutedContexts: NotExecutedBatchFileContext[],\n  ): Promise<YamlBatchOccurrenceResult[]> {\n    const resultsByCaseId = new Map<string, MidsceneYamlConfigResult>();\n\n    for (const context of executedContexts) {\n      resultsByCaseId.set(context.caseId, context.yamlResult);\n    }\n\n    for (const context of unexpectedContexts) {\n      resultsByCaseId.set(context.caseId, context.yamlResult);\n    }\n\n    for (const context of notExecutedContexts) {\n      resultsByCaseId.set(\n        context.caseId,\n        createNotExecutedYamlResult(context.file),\n      );\n    }\n\n    return this.caseIds.map((caseId) => {\n      const result = resultsByCaseId.get(caseId);\n      if (!result) {\n        throw new Error(`Batch result missing for case ID: ${caseId}`);\n      }\n      return { caseId, result };\n    });\n  }\n\n  private async loadFileConfig(file: string): Promise<MidsceneYamlScript> {\n    const content = readFileSync(file, 'utf8');\n    return parseYamlScript(content, file);\n  }\n\n  private async generateOutputIndex(): Promise<void> {\n    try {\n      writeExecutionSummaryFile(\n        this.config.summary,\n        this.results.map(({ result }) => result),\n      );\n      printExecutionFinished();\n    } catch (error) {\n      console.error('Failed to generate output index:', error);\n    }\n  }\n}\n\nexport async function runYamlBatch(\n  config: BatchRunnerConfig,\n  options: RunYamlBatchOptions = {},\n): Promise<MidsceneYamlConfigResult[]> {\n  const results = await new YamlBatchExecutor(config).run(options);\n  return results.map(({ result }) => result);\n}\n\nexport async function runYamlBatchWithCaseIds(\n  config: BatchRunnerConfig,\n  caseIds: string[],\n  options: RunYamlBatchOptions = {},\n): Promise<YamlBatchOccurrenceResult[]> {\n  return new YamlBatchExecutor(config, caseIds).run(options);\n}\n","import type { MidsceneYamlConfigResult } from '@midscene/core';\nimport {\n  type ExecutionSummary,\n  getExecutionSummary,\n  getResultFilesByType,\n  getSummaryAbsolutePath,\n  printExecutionSummary,\n} from './execution-summary';\nimport { isYamlBatchExecutionError } from './yaml-batch-error';\nimport {\n  type BatchRunnerConfig,\n  type RunYamlBatchOptions,\n  runYamlBatch,\n} from './yaml-batch-executor';\n\nclass BatchRunner {\n  private results: MidsceneYamlConfigResult[] = [];\n\n  constructor(private config: BatchRunnerConfig) {}\n\n  async run(\n    options: RunYamlBatchOptions = {},\n  ): Promise<MidsceneYamlConfigResult[]> {\n    this.results = [];\n    try {\n      this.results = await runYamlBatch(this.config, options);\n      return this.results;\n    } catch (error) {\n      if (isYamlBatchExecutionError(error)) {\n        this.results = [...error.results];\n      }\n      throw error;\n    }\n  }\n\n  getExecutionSummary(): ExecutionSummary {\n    return getExecutionSummary(this.results);\n  }\n\n  getFailedFiles(): string[] {\n    return getResultFilesByType(this.results, 'failed');\n  }\n\n  getPartialFailedFiles(): string[] {\n    return getResultFilesByType(this.results, 'partialFailed');\n  }\n\n  getNotExecutedFiles(): string[] {\n    return getResultFilesByType(this.results, 'notExecuted');\n  }\n\n  getSuccessfulFiles(): string[] {\n    return getResultFilesByType(this.results, 'success');\n  }\n\n  getResults(): MidsceneYamlConfigResult[] {\n    return [...this.results];\n  }\n\n  printExecutionSummary(): boolean {\n    return printExecutionSummary(\n      this.results,\n      getSummaryAbsolutePath(this.config.summary),\n    );\n  }\n}\n\nexport { BatchRunner };\nexport type { BatchRunnerConfig, RunYamlBatchOptions };\n","import { createRequire } from 'node:module';\nimport { join, resolve } from 'node:path';\n\n// `@rstest/core` and `@rsbuild/core` are direct dependencies of `@midscene/cli`,\n// so they always sit on the resolution path of the CLI's own files. Anchor the\n// lookup to this module's location (`__dirname` of the bundled output) rather\n// than `process.argv[1]`: the command-line entry can be a wrapper script, a\n// symlinked bin, an `npx` cache path, or some other launcher whose `node_modules`\n// chain does not include `@rstest/core`. Anchoring on `process.argv[1]` is what\n// caused YAML runs to fail with \"Cannot find module '@rstest/core/package.json'\"\n// in environments where the launcher differs from the install location.\nconst requireFromCliPackage = () => {\n  if (typeof __dirname !== 'undefined') {\n    return createRequire(join(__dirname, 'index.js'));\n  }\n  // ESM consumers of the bundled output have no `__dirname`; fall back to the\n  // command-line entry so programmatic usage keeps working.\n  const entry = process.argv[1]\n    ? resolve(process.argv[1])\n    : join(process.cwd(), 'midscene-cli.js');\n  return createRequire(entry);\n};\n\nexport const resolvePackageFromRstestCore = (packageName: string): string => {\n  const require = requireFromCliPackage();\n  const rstestPackageJsonPath = require.resolve('@rstest/core/package.json');\n  return createRequire(rstestPackageJsonPath).resolve(packageName);\n};\n\nexport function resolveRstestCoreImportPath(): string {\n  const require = requireFromCliPackage();\n  return require.resolve('@rstest/core');\n}\n","import { existsSync, mkdirSync, rmSync } from 'node:fs';\nimport {\n  basename,\n  dirname,\n  extname,\n  join,\n  relative,\n  resolve,\n  sep,\n} from 'node:path';\nimport { getMidsceneRunSubDir } from '@midscene/shared/common';\nimport type { BatchRunnerConfig } from '../batch-runner';\nimport type {\n  DefineYamlBatchTestOptions,\n  DefineYamlCaseTestOptions,\n  RstestYamlCaseOptions,\n  WebYamlRuntimeOptions,\n} from './rstest-contract';\nimport { resolveRstestCoreImportPath } from './rstest-dependencies';\n\nexport type {\n  RstestYamlCaseOptions,\n  WebYamlRuntimeOptions,\n} from './rstest-contract';\n\nexport const DEFAULT_YAML_TEST_TIMEOUT = 0;\nexport const RSTEST_YAML_BATCH_TEST_MODULE =\n  'virtual:midscene-yaml/batch.test.ts';\nexport const RSTEST_YAML_BATCH_TEST_NAME = 'midscene yaml batch';\nexport const RSTEST_YAML_SEQUENTIAL_TEST_MODULE =\n  'virtual:midscene-yaml/sequential.test.ts';\n\nexport interface CreateRstestYamlProjectOptions {\n  files: string[];\n  projectDir?: string;\n  outputDir?: string;\n  resultDir?: string;\n  frameworkImport?: string;\n  caseOptions?: Record<string, RstestYamlCaseOptions>;\n  webRuntimeOptions?: Record<string, WebYamlRuntimeOptions>;\n  maxConcurrency?: number;\n  testTimeout?: number;\n  bail?: number;\n  retry?: number;\n  batchConfig?: BatchRunnerConfig;\n  rstestCoreImport?: string;\n}\n\nexport type GeneratedYamlTestCase = DefineYamlCaseTestOptions;\n\nexport interface GeneratedRstestYamlModule {\n  id: string;\n  source: string;\n  caseIds: string[];\n}\n\nexport interface GeneratedRstestYamlProject {\n  projectDir: string;\n  outputDir: string;\n  resultDir: string;\n  modules: GeneratedRstestYamlModule[];\n  cases: GeneratedYamlTestCase[];\n  maxConcurrency?: number;\n  testTimeout: number;\n  bail?: number;\n  retry?: number;\n}\n\nconst toPosixPath = (value: string): string => value.split(sep).join('/');\n\nconst toImportLiteral = (value: string): string =>\n  JSON.stringify(toPosixPath(value));\n\nconst toVirtualModuleId = (fileStem: string): string =>\n  `virtual:midscene-yaml/${fileStem}.test.ts`;\n\nconst safeFileStem = (file: string, index: number): string => {\n  const base = basename(file, extname(file))\n    .replace(/[^a-zA-Z0-9._-]+/g, '-')\n    .replace(/^-+|-+$/g, '');\n  return `${String(index + 1).padStart(3, '0')}-${base || 'case'}`;\n};\n\nexport const resolveTestName = (\n  projectDir: string,\n  yamlFile: string,\n): string => {\n  const relativePath = relative(projectDir, yamlFile);\n  return toPosixPath(relativePath.startsWith('..') ? yamlFile : relativePath);\n};\n\nconst createGeneratedCaseTestContent = (options: {\n  rstestCoreImport: string;\n  frameworkImport: string;\n  testOptions: DefineYamlCaseTestOptions[];\n  sequential: boolean;\n}): string => `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlCaseTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptionsList = ${JSON.stringify(options.testOptions, null, 2)};\n\nfor (const testOptions of testOptionsList) {\n  defineYamlCaseTest(${options.sequential ? 'test.sequential' : 'test'}, testOptions);\n}\n`;\n\nconst createGeneratedBatchTestContent = (options: {\n  rstestCoreImport: string;\n  frameworkImport: string;\n  testOptions: DefineYamlBatchTestOptions;\n}): string => {\n  return `import { test } from ${toImportLiteral(options.rstestCoreImport)};\nimport { defineYamlBatchTest } from ${toImportLiteral(options.frameworkImport)};\n\nconst testOptions = ${JSON.stringify(options.testOptions, null, 2)};\n\ndefineYamlBatchTest(test, testOptions);\n`;\n};\n\n// Anchor the framework entry on this bundle's own directory rather than\n// `process.argv[1]`. The command-line entry can be a `.bin` symlink, an\n// `npx` cache path, or a wrapper script whose directory does not lead to the\n// compiled `framework/index.js`. In those cases the argv-based lookup below\n// falls through to the bare specifier `@midscene/cli/dist/lib/framework/\n// index.js`, which the generated virtual test module then fails to resolve\n// from the user's CWD (\"Cannot find module ...\"), silently turning every run\n// into \"not executed\". `__dirname` always points at the installed CLI output\n// (this mirrors `requireFromCliPackage` in rstest-runner.ts). Resolve to an\n// absolute path so the virtual module imports it regardless of CWD.\n// `moduleDir` is injectable so tests can exercise the resolution order without\n// depending on the dist layout.\nexport const resolveDefaultFrameworkImport = (moduleDir?: string): string => {\n  const anchorDir =\n    moduleDir ?? (typeof __dirname !== 'undefined' ? __dirname : undefined);\n  const candidates = [\n    anchorDir ? join(anchorDir, 'framework', 'index.js') : '',\n  ];\n\n  const entry = process.argv[1] ? resolve(process.argv[1]) : '';\n  if (entry) {\n    candidates.push(join(dirname(entry), 'framework', 'index.js'));\n    candidates.push(\n      join(dirname(entry), '..', 'dist', 'lib', 'framework', 'index.js'),\n    );\n  }\n\n  const matched = candidates\n    .filter(Boolean)\n    .find((candidate) => existsSync(candidate));\n  return matched || '@midscene/cli/dist/lib/framework/index.js';\n};\n\nexport function createRstestYamlProject(\n  options: CreateRstestYamlProjectOptions,\n): GeneratedRstestYamlProject {\n  const projectDir = resolve(options.projectDir || process.cwd());\n  const outputDir =\n    options.outputDir ||\n    join(getMidsceneRunSubDir('tmp'), `rstest-yaml-${Date.now()}`);\n  const resultDir = options.resultDir || join(outputDir, 'results');\n  const frameworkImport =\n    options.frameworkImport || resolveDefaultFrameworkImport();\n  const rstestCoreImport =\n    options.rstestCoreImport || resolveRstestCoreImportPath();\n  const testTimeout = options.testTimeout ?? DEFAULT_YAML_TEST_TIMEOUT;\n\n  rmSync(outputDir, { recursive: true, force: true });\n  mkdirSync(resultDir, { recursive: true });\n\n  // The batch executor reports setup as a first-class result. Reserve a result\n  // file for it too, otherwise the parent process drops it from the terminal\n  // and JSON summaries even though it ran inside the Rstest worker.\n  const resultYamlFiles = options.batchConfig\n    ? [\n        ...(options.batchConfig.setup ? [options.batchConfig.setup] : []),\n        ...options.batchConfig.files,\n      ]\n    : options.files;\n  const cases: GeneratedYamlTestCase[] = resultYamlFiles.map((file, index) => {\n    const yamlFile = resolve(file);\n    const testName = resolveTestName(projectDir, yamlFile);\n    const caseId = safeFileStem(yamlFile, index);\n    const resultFile = join(resultDir, `${caseId}.json`);\n    return {\n      caseId,\n      yamlFile,\n      resultFile,\n      testName,\n      retry: options.retry,\n      ...(options.caseOptions?.[yamlFile]\n        ? { caseOptions: options.caseOptions[yamlFile] }\n        : {}),\n      ...(options.webRuntimeOptions?.[yamlFile]\n        ? { webRuntimeOptions: options.webRuntimeOptions[yamlFile] }\n        : {}),\n    };\n  });\n\n  const baseProject = {\n    projectDir,\n    outputDir,\n    resultDir,\n    cases,\n    testTimeout,\n    bail: options.bail,\n  };\n\n  if (options.batchConfig) {\n    const testOptions: DefineYamlBatchTestOptions = {\n      caseIds: cases.map((item) => item.caseId),\n      testName: RSTEST_YAML_BATCH_TEST_NAME,\n      config: options.batchConfig,\n      resultTargets: cases.map(({ caseId, yamlFile, resultFile }) => ({\n        caseId,\n        yamlFile,\n        resultFile,\n      })),\n    };\n    return {\n      ...baseProject,\n      modules: [\n        {\n          id: RSTEST_YAML_BATCH_TEST_MODULE,\n          caseIds: testOptions.caseIds,\n          source: createGeneratedBatchTestContent({\n            rstestCoreImport,\n            frameworkImport,\n            testOptions,\n          }),\n        },\n      ],\n      maxConcurrency: 1,\n    };\n  }\n\n  // Rstest limits concurrency but does not guarantee that separate test files\n  // start in `include` order. Put serial YAML cases in one virtual module so\n  // Rstest executes their tests in declaration order. This keeps retries and\n  // per-case reporting in Rstest while making `concurrent: 1` actually honor\n  // the order of the config file's `files` array.\n  if (options.maxConcurrency === 1) {\n    const caseIds = cases.map((item) => item.caseId);\n    return {\n      ...baseProject,\n      modules: [\n        {\n          id: RSTEST_YAML_SEQUENTIAL_TEST_MODULE,\n          caseIds,\n          source: createGeneratedCaseTestContent({\n            rstestCoreImport,\n            frameworkImport,\n            testOptions: cases,\n            sequential: true,\n          }),\n        },\n      ],\n      maxConcurrency: 1,\n      retry: options.retry,\n    };\n  }\n\n  return {\n    ...baseProject,\n    modules: cases.map((item) => {\n      const id = toVirtualModuleId(item.caseId);\n      return {\n        id,\n        caseIds: [item.caseId],\n        source: createGeneratedCaseTestContent({\n          rstestCoreImport,\n          frameworkImport,\n          testOptions: [item],\n          sequential: false,\n        }),\n      };\n    }),\n    maxConcurrency: options.maxConcurrency,\n    retry: options.retry,\n  };\n}\n","import type { Reporter } from '@rstest/core/api';\n\n/** @internal Prefix used to identify Midscene progress in worker console logs. */\nexport const yamlProgressLogPrefix = '__MIDSCENE_YAML_PROGRESS__:';\n\n/**\n * Send YAML progress through Rstest's intercepted console channel. The parent\n * process reporter below only forwards messages with this prefix, keeping\n * Rstest's own reporter noise suppressed.\n */\nexport const emitYamlProgress = (message: string): void => {\n  console.log(`${yamlProgressLogPrefix}${message}`);\n};\n\n/** @internal Creates the parent-side reporter that forwards YAML progress. */\nexport const createYamlProgressReporter = (): Reporter => ({\n  onUserConsoleLog(log) {\n    if (!log.content.startsWith(yamlProgressLogPrefix)) return;\n\n    const message = log.content.slice(yamlProgressLogPrefix.length);\n    console.log(message.replace(/\\r?\\n$/, ''));\n  },\n});\n","import type { BatchRunnerConfig } from '../batch-runner';\nimport type { RunYamlCaseOptions } from './yaml-case';\n\nexport const RSTEST_YAML_CASE_IDS_META_KEY = 'midsceneYamlCaseIds';\n\nexport type RstestYamlCaseOptions = Omit<\n  RunYamlCaseOptions,\n  'file' | 'headed' | 'keepWindow'\n>;\n\nexport type WebYamlRuntimeOptions = Pick<\n  RunYamlCaseOptions,\n  'headed' | 'keepWindow'\n>;\n\nexport interface DefineYamlCaseTestOptions {\n  caseId: string;\n  testName: string;\n  yamlFile: string;\n  resultFile: string;\n  retry?: number;\n  caseOptions?: RstestYamlCaseOptions;\n  webRuntimeOptions?: WebYamlRuntimeOptions;\n}\n\nexport interface DefineYamlBatchTestOptions {\n  caseIds: string[];\n  testName: string;\n  config: BatchRunnerConfig;\n  resultTargets: Array<{\n    caseId: string;\n    yamlFile: string;\n    resultFile: string;\n  }>;\n}\n","import { existsSync, mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport type { RstestUserConfig, TestRunResult } from '@rstest/core/api';\nimport { createYamlProgressReporter } from './progress-reporter';\nimport { RSTEST_YAML_CASE_IDS_META_KEY } from './rstest-contract';\nimport { resolvePackageFromRstestCore } from './rstest-dependencies';\nimport type { GeneratedRstestYamlProject } from './rstest-project';\n\nexport { resolveRstestCoreImportPath } from './rstest-dependencies';\n\nexport interface RunRstestYamlProjectOptions {\n  project: GeneratedRstestYamlProject;\n  cwd?: string;\n  stdio?: 'inherit' | 'pipe';\n}\n\nconst formatRunError = (\n  error: TestRunResult['unhandledErrors'][number],\n): string => error.stack || `${error.name}: ${error.message}`;\n\n// Collect every failure rstest surfaced, not just `unhandledErrors`. A failing\n// YAML case shows up as a file-level error (e.g. a module that cannot be\n// loaded) or a test-level error under `files[].results[]`; `unhandledErrors`\n// only covers worker crashes and config-load failures. Reporting just the\n// latter is why a failed run printed nothing and looked like \"not executed\".\nconst collectRunErrors = (result: TestRunResult): string[] => {\n  const messages: string[] = [];\n  const push = (\n    error: TestRunResult['unhandledErrors'][number],\n    label?: string,\n  ) => {\n    const formatted = formatRunError(error);\n    messages.push(label ? `${label}: ${formatted}` : formatted);\n  };\n\n  for (const file of result.files ?? []) {\n    for (const error of file.errors ?? []) {\n      push(error, file.name || file.testPath);\n    }\n    for (const testResult of file.results ?? []) {\n      for (const error of testResult.errors ?? []) {\n        push(error, testResult.name);\n      }\n    }\n  }\n  for (const error of result.unhandledErrors ?? []) {\n    push(error);\n  }\n\n  return Array.from(new Set(messages));\n};\n\nconst errorMessage = (\n  error: TestRunResult['unhandledErrors'][number],\n): string => error.message || error.name || 'YAML case failed';\n\n// Attribute each rstest failure back to the YAML occurrence it came from.\n// Test-level failures carry stable case IDs in Rstest metadata. File-level\n// failures belong to every case owned by that generated module.\nconst mapRunErrorsToCases = (\n  project: GeneratedRstestYamlProject,\n  result: TestRunResult,\n): Map<string, string> => {\n  const casesById = new Map(project.cases.map((item) => [item.caseId, item]));\n  const knownCaseIds = new Set(casesById.keys());\n  const errors = new Map<string, string>();\n  const add = (caseId: string, message: string) => {\n    if (knownCaseIds.has(caseId) && message && !errors.has(caseId)) {\n      errors.set(caseId, message);\n    }\n  };\n  const addCases = (caseIds: string[], message: string) => {\n    for (const caseId of caseIds) {\n      add(caseId, message);\n    }\n  };\n  const findModuleCaseIds = (\n    file: TestRunResult['files'][number],\n  ): string[] => {\n    for (const key of [file.name, file.testPath]) {\n      if (!key) continue;\n      const matched = project.modules.find(\n        (item) => key === item.id || key.includes(item.id),\n      );\n      if (matched) return matched.caseIds;\n    }\n    return [];\n  };\n  const metadataCaseIds = (\n    testResult: TestRunResult['files'][number]['results'][number],\n  ): string[] => {\n    const value = testResult.meta?.[RSTEST_YAML_CASE_IDS_META_KEY];\n    return Array.isArray(value)\n      ? value.filter((item): item is string => typeof item === 'string')\n      : [];\n  };\n\n  for (const file of result.files ?? []) {\n    const moduleCaseIds = findModuleCaseIds(file);\n    for (const error of file.errors ?? []) {\n      addCases(moduleCaseIds, errorMessage(error));\n    }\n    for (const testResult of file.results ?? []) {\n      const caseIds = metadataCaseIds(testResult);\n      for (const error of testResult.errors ?? []) {\n        addCases(caseIds.length ? caseIds : moduleCaseIds, errorMessage(error));\n      }\n    }\n  }\n\n  // With one generated module, a worker/config failure belongs to cases that\n  // have not already persisted a result. Preserve completed case results, but\n  // let the unhandled error replace broad module-level attribution for pending\n  // cases so a later worker crash is not reported as merely \"not executed\".\n  if (project.modules.length === 1 && result.unhandledErrors?.length) {\n    const message = errorMessage(result.unhandledErrors[0]);\n    for (const caseId of project.modules[0].caseIds) {\n      const item = casesById.get(caseId);\n      if (!errors.has(caseId) || (item && !existsSync(item.resultFile))) {\n        errors.set(caseId, message);\n      }\n    }\n  }\n\n  return errors;\n};\n\n// When a case fails before it can write its own result file (module load\n// failure, crash before `writeResultFile`, ...), the batch reader would treat\n// it as \"not executed\" with no error. Persist a failed result carrying the real\n// error so the failure — and its cause — is visible in the summary JSON.\nconst recordUnreportedCaseFailures = (\n  project: GeneratedRstestYamlProject,\n  result: TestRunResult,\n): void => {\n  if (!project.cases.length) return;\n  const caseErrors = mapRunErrorsToCases(project, result);\n  for (const item of project.cases) {\n    if (existsSync(item.resultFile)) continue;\n    const error = caseErrors.get(item.caseId);\n    if (!error) continue;\n    const failure: MidsceneYamlConfigResult = {\n      file: item.yamlFile,\n      success: false,\n      executed: true,\n      output: undefined,\n      report: undefined,\n      duration: 0,\n      resultType: 'failed',\n      error,\n    };\n    mkdirSync(dirname(item.resultFile), { recursive: true });\n    writeFileSync(item.resultFile, JSON.stringify(failure, null, 2));\n  }\n};\n\nexport async function runRstestYamlProject(\n  options: RunRstestYamlProjectOptions,\n): Promise<number> {\n  const [{ runRstest }, { rspack }] = await Promise.all([\n    import('@rstest/core/api'),\n    import(pathToFileURL(resolvePackageFromRstestCore('@rsbuild/core')).href),\n  ]);\n  const { project } = options;\n  const maxConcurrency =\n    project.maxConcurrency !== undefined\n      ? Math.max(1, project.maxConcurrency)\n      : undefined;\n  const inlineConfig: RstestUserConfig = {\n    root: project.projectDir,\n    include: project.modules.map((item) => item.id),\n    testEnvironment: 'node',\n    testTimeout: project.testTimeout,\n    ...(maxConcurrency !== undefined ? { maxConcurrency } : {}),\n    ...(maxConcurrency !== undefined\n      ? { pool: { maxWorkers: maxConcurrency } }\n      : {}),\n    ...(project.bail !== undefined ? { bail: project.bail } : {}),\n    ...(project.retry !== undefined && project.retry > 0\n      ? { retry: project.retry }\n      : {}),\n    reporters: options.stdio === 'pipe' ? [] : [createYamlProgressReporter()],\n    tools: {\n      rspack: (_config, { appendPlugins }) => {\n        appendPlugins(\n          new rspack.experiments.VirtualModulesPlugin(\n            Object.fromEntries(\n              project.modules.map((item) => [item.id, item.source]),\n            ),\n          ),\n        );\n      },\n    },\n  };\n\n  const result = await runRstest({\n    cwd: options.cwd || project.projectDir,\n    inlineConfig,\n  });\n\n  if (!result.ok) {\n    recordUnreportedCaseFailures(project, result);\n    if (options.stdio !== 'pipe') {\n      const runErrors = collectRunErrors(result);\n      if (runErrors.length) {\n        console.error(`\\nYAML execution failed:\\n${runErrors.join('\\n\\n')}`);\n      }\n    }\n  }\n\n  return result.ok ? 0 : 1;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport { BatchRunner, type BatchRunnerConfig } from '../batch-runner';\nimport {\n  createNotExecutedYamlResult,\n  getSummaryAbsolutePath,\n  printExecutionFinished,\n  printExecutionPlan,\n  printExecutionSummary,\n  writeExecutionSummaryFile,\n} from '../execution-summary';\nimport {\n  type GeneratedRstestYamlProject,\n  type RstestYamlCaseOptions,\n  type WebYamlRuntimeOptions,\n  createRstestYamlProject,\n} from './rstest-project';\nimport { runRstestYamlProject } from './rstest-runner';\n\ninterface WebRuntimeOptions {\n  headed?: boolean;\n  keepWindow?: boolean;\n}\n\nexport interface FrameworkTestCommandOptions extends WebRuntimeOptions {\n  projectDir?: string;\n  files?: string[];\n  concurrent?: number;\n  outputDir?: string;\n  frameworkImport?: string;\n  stdio?: 'inherit' | 'pipe';\n  rstestRunner?: typeof runRstestYamlProject;\n  /**\n   * In-process executor used for the `keepWindow` path. Injectable so tests can\n   * exercise the routing without launching a real browser. Defaults to the\n   * legacy {@link BatchRunner}.\n   */\n  inProcessRunner?: (\n    config: BatchRunnerConfig,\n  ) => Promise<MidsceneYamlConfigResult[]>;\n}\n\nconst defaultInProcessRunner = (\n  config: BatchRunnerConfig,\n): Promise<MidsceneYamlConfigResult[]> => new BatchRunner(config).run();\n\n// `keepWindow` keeps the browser open after the run finishes, which is only\n// possible when the browser is owned by this long-lived CLI process. The Rstest\n// framework runs each case in a disposable worker whose teardown kills the\n// browser, so route keepWindow (a debug-only flow) through the in-process batch\n// executor instead. It owns the browser in this process and renders the live\n// per-step progress that the Rstest path does not surface — the two reasons to\n// pass --keep-window in the first place.\nasync function runConfigInMainProcess(\n  config: BatchRunnerConfig,\n  commandOptions: FrameworkTestCommandOptions,\n): Promise<number> {\n  const runner = commandOptions.inProcessRunner ?? defaultInProcessRunner;\n  const results = await runner(config);\n  const success = printExecutionSummary(\n    results,\n    getSummaryAbsolutePath(config.summary),\n  );\n  return success ? 0 : 1;\n}\n\nconst createCaseOptions = (\n  config: BatchRunnerConfig,\n): Record<string, RstestYamlCaseOptions> => {\n  const caseOptions: Record<string, RstestYamlCaseOptions> = {};\n  for (const file of config.files) {\n    caseOptions[resolve(file)] = {\n      globalConfig: config.globalConfig,\n    };\n  }\n  return caseOptions;\n};\n\nconst createWebRuntimeOptions = (\n  config: BatchRunnerConfig,\n  runtimeOptions: WebRuntimeOptions,\n): Record<string, WebYamlRuntimeOptions> => {\n  const caseOptions: Record<string, WebYamlRuntimeOptions> = {};\n  for (const file of config.files) {\n    caseOptions[resolve(file)] = {\n      headed: runtimeOptions.headed ?? config.headed,\n      keepWindow: runtimeOptions.keepWindow ?? config.keepWindow,\n    };\n  }\n  return caseOptions;\n};\n\nconst readProjectResults = (\n  project: GeneratedRstestYamlProject,\n): MidsceneYamlConfigResult[] =>\n  project.cases.map((item) => {\n    if (existsSync(item.resultFile)) {\n      return JSON.parse(\n        readFileSync(item.resultFile, 'utf8'),\n      ) as MidsceneYamlConfigResult;\n    }\n\n    return createNotExecutedYamlResult(item.yamlFile);\n  });\n\nexport async function runFrameworkTestConfig(\n  config: BatchRunnerConfig,\n  commandOptions: FrameworkTestCommandOptions = {},\n): Promise<number> {\n  if (config.keepWindow) {\n    return runConfigInMainProcess(config, commandOptions);\n  }\n\n  printExecutionPlan(config);\n\n  const projectDir = resolve(commandOptions.projectDir || process.cwd());\n  const project = createRstestYamlProject({\n    files: config.files,\n    projectDir,\n    outputDir: commandOptions.outputDir,\n    frameworkImport: commandOptions.frameworkImport,\n    caseOptions: createCaseOptions(config),\n    webRuntimeOptions: createWebRuntimeOptions(config, commandOptions),\n    maxConcurrency: commandOptions.concurrent ?? config.concurrent,\n    bail: config.continueOnError ? 0 : 1,\n    retry: config.retry,\n    // setup requires one orchestrated batch even when its target does not use\n    // a shared Puppeteer BrowserContext (for example Android or Computer).\n    batchConfig:\n      config.shareBrowserContext || config.setup ? config : undefined,\n  });\n\n  const runner = commandOptions.rstestRunner || runRstestYamlProject;\n  const exitCode = await runner({\n    project,\n    cwd: projectDir,\n    stdio: commandOptions.stdio,\n  });\n\n  const results = readProjectResults(project);\n  const summaryPath = writeExecutionSummaryFile(config.summary, results);\n  printExecutionFinished();\n  const success = printExecutionSummary(results, summaryPath);\n\n  return success ? exitCode : 1;\n}\n","import { mkdirSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type { MidsceneYamlConfigResult } from '@midscene/core';\nimport { isYamlBatchExecutionError } from '../yaml-batch-error';\nimport {\n  type BatchRunnerConfig,\n  type YamlBatchOccurrenceResult,\n  runYamlBatchWithCaseIds,\n} from '../yaml-batch-executor';\nimport { emitYamlProgress } from './progress-reporter';\n\nexport interface RunYamlBatchInRstestOptions {\n  config: BatchRunnerConfig;\n  resultTargets: Array<{\n    caseId: string;\n    yamlFile: string;\n    resultFile: string;\n  }>;\n}\n\nconst writeResultFile = (\n  resultFile: string,\n  data: MidsceneYamlConfigResult,\n) => {\n  mkdirSync(dirname(resultFile), { recursive: true });\n  writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst batchFailureMessage = (results: MidsceneYamlConfigResult[]): string => {\n  const failed = results.filter((result) => !result.success);\n  return failed\n    .map((result) => `${result.file}: ${result.error || result.resultType}`)\n    .join('\\n');\n};\n\nexport async function runYamlBatchInRstest(\n  options: RunYamlBatchInRstestOptions,\n): Promise<MidsceneYamlConfigResult[]> {\n  const resultTargetsByCaseId = new Map<\n    string,\n    RunYamlBatchInRstestOptions['resultTargets'][number]\n  >();\n  for (const target of options.resultTargets) {\n    if (resultTargetsByCaseId.has(target.caseId)) {\n      throw new Error(\n        `Duplicate batch result target case ID: ${target.caseId}`,\n      );\n    }\n    resultTargetsByCaseId.set(target.caseId, target);\n  }\n\n  let executionError: unknown;\n  let occurrenceResults: YamlBatchOccurrenceResult[];\n  try {\n    occurrenceResults = await runYamlBatchWithCaseIds(\n      options.config,\n      options.resultTargets.map(({ caseId }) => caseId),\n      {\n        generateSummary: false,\n        printExecutionPlan: false,\n        onProgress: emitYamlProgress,\n      },\n    );\n  } catch (error) {\n    if (!isYamlBatchExecutionError(error)) {\n      throw error;\n    }\n    executionError = error;\n    occurrenceResults = error.occurrences;\n  }\n\n  const unmappedResults: string[] = [];\n  for (const { caseId, result } of occurrenceResults) {\n    const target = resultTargetsByCaseId.get(caseId);\n    if (!target || resolve(target.yamlFile) !== resolve(result.file)) {\n      unmappedResults.push(caseId);\n      continue;\n    }\n    writeResultFile(target.resultFile, result);\n    resultTargetsByCaseId.delete(caseId);\n  }\n\n  if (executionError) {\n    throw executionError;\n  }\n\n  const unwrittenTargets = Array.from(resultTargetsByCaseId.keys());\n  if (unmappedResults.length || unwrittenTargets.length) {\n    throw new Error(\n      `Batch result mapping mismatch: ${unmappedResults.length} result(s) had no target and ${unwrittenTargets.length} target(s) had no result`,\n    );\n  }\n\n  const results = occurrenceResults.map(({ result }) => result);\n  if (results.some((result) => !result.success)) {\n    throw new Error(batchFailureMessage(results));\n  }\n\n  return results;\n}\n","import { existsSync, readFileSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport type {\n  MidsceneYamlConfigResult,\n  MidsceneYamlScript,\n  MidsceneYamlScriptAndroidEnv,\n  MidsceneYamlScriptEnv,\n  MidsceneYamlScriptIOSEnv,\n  MidsceneYamlScriptWebEnv,\n  ScriptPlayerTaskStatus,\n} from '@midscene/core';\nimport { type ScriptPlayer, parseYamlScript } from '@midscene/core/yaml';\nimport merge from 'lodash.merge';\nimport { createYamlPlayer } from '../create-yaml-player';\n\nexport interface RunYamlCaseGlobalConfig {\n  page?: Partial<MidsceneYamlScriptWebEnv>;\n  browser?: Partial<MidsceneYamlScriptWebEnv>;\n  web?: Partial<MidsceneYamlScriptWebEnv>;\n  android?: Partial<MidsceneYamlScriptAndroidEnv>;\n  ios?: Partial<MidsceneYamlScriptIOSEnv>;\n  target?: Partial<MidsceneYamlScriptWebEnv>;\n}\n\nexport interface RunYamlCaseOptions {\n  file: string;\n  executionConfig?: MidsceneYamlScript;\n  globalConfig?: RunYamlCaseGlobalConfig;\n  headed?: boolean;\n  keepWindow?: boolean;\n}\n\n/** @internal Used by the Rstest worker to forward player state snapshots. */\nexport type YamlPlayerSnapshotHandler = (context: {\n  file: string;\n  player: ScriptPlayer<MidsceneYamlScriptEnv>;\n}) => void;\n\nexport interface RunYamlCaseResult {\n  file: string;\n  output?: string;\n  report?: string | null;\n  duration: number;\n}\n\nconst taskErrorMessage = (task: ScriptPlayerTaskStatus): string | undefined => {\n  if (task.error?.message) {\n    return task.error.message;\n  }\n\n  if (task.status === 'error') {\n    return `Task \"${task.name}\" failed`;\n  }\n\n  return undefined;\n};\n\nconst cloneJson = <T>(value: T): T => JSON.parse(JSON.stringify(value)) as T;\n\nconst normalizeTargetConfig = (\n  config: MidsceneYamlScript | RunYamlCaseGlobalConfig,\n) => {\n  if (config.target) {\n    config.web = {\n      ...config.target,\n      ...config.web,\n    };\n    config.target = undefined;\n  }\n};\n\nconst createExecutionConfig = (\n  file: string,\n  globalConfig: RunYamlCaseGlobalConfig,\n): MidsceneYamlScript => {\n  const content = readFileSync(file, 'utf8');\n  const fileConfig = cloneJson(parseYamlScript(content, file));\n  normalizeTargetConfig(fileConfig);\n\n  const clonedGlobalConfig = cloneJson(globalConfig);\n  normalizeTargetConfig(clonedGlobalConfig);\n\n  return merge(fileConfig, clonedGlobalConfig);\n};\n\nexport const getYamlPlayerFailure = (\n  player: ScriptPlayer<MidsceneYamlScriptEnv>,\n): Error | undefined => {\n  if (player.errorInSetup) {\n    return player.errorInSetup;\n  }\n\n  const failedMessages =\n    player.taskStatusList?.map(taskErrorMessage).filter(Boolean) || [];\n\n  if (player.status === 'error' || failedMessages.length > 0) {\n    const details = failedMessages.length\n      ? failedMessages.join('; ')\n      : 'YAML case failed';\n    const reportLine = player.reportFile\n      ? `\\nReport: ${player.reportFile}`\n      : '';\n    const outputLine = player.output ? `\\nOutput: ${player.output}` : '';\n    return new Error(`${details}${reportLine}${outputLine}`);\n  }\n\n  return undefined;\n};\n\nexport const createYamlCaseResult = (\n  file: string,\n  player: ScriptPlayer<MidsceneYamlScriptEnv>,\n  duration: number,\n): MidsceneYamlConfigResult => {\n  const hasFailedTasks =\n    player.taskStatusList?.some((task) => task.status === 'error') ?? false;\n  const hasPlayerError = player.status === 'error';\n\n  const outputPath =\n    player.output && existsSync(player.output) ? player.output : undefined;\n  const reportFile = player.reportFile || undefined;\n\n  let errorMessage: string | undefined;\n  if (player.errorInSetup?.message) {\n    errorMessage = player.errorInSetup.message;\n  } else if (hasPlayerError || hasFailedTasks) {\n    const taskErrors = player.taskStatusList\n      ?.filter((task) => task.status === 'error' && task.error?.message)\n      .map((task) => task.error!.message);\n    if (taskErrors && taskErrors.length > 0) {\n      errorMessage = taskErrors.join('; ');\n    } else if (hasPlayerError) {\n      errorMessage = 'Execution failed';\n    } else {\n      errorMessage = 'Some tasks failed';\n    }\n  }\n\n  const resultType = hasPlayerError\n    ? 'failed'\n    : hasFailedTasks\n      ? 'partialFailed'\n      : 'success';\n\n  return {\n    file,\n    success: resultType === 'success',\n    executed: true,\n    output: outputPath,\n    report: reportFile,\n    duration,\n    resultType,\n    error: errorMessage,\n  };\n};\n\nexport const createYamlCaseFailure = (\n  result: MidsceneYamlConfigResult,\n): Error => {\n  const reportLine = result.report ? `\\nReport: ${result.report}` : '';\n  const outputLine = result.output ? `\\nOutput: ${result.output}` : '';\n  return new Error(\n    `${result.error || 'YAML case failed'}${reportLine}${outputLine}`,\n  );\n};\n\nconst executeYamlCaseResult = async (\n  options: RunYamlCaseOptions,\n  onPlayerSnapshot?: YamlPlayerSnapshotHandler,\n): Promise<MidsceneYamlConfigResult> => {\n  const file = resolve(options.file);\n  const startTime = Date.now();\n  const executionConfig =\n    options.executionConfig ||\n    (options.globalConfig\n      ? createExecutionConfig(file, options.globalConfig)\n      : undefined);\n  const player = await createYamlPlayer(file, executionConfig, {\n    headed: options.headed,\n    keepWindow: options.keepWindow,\n  });\n\n  const reportSnapshot = () => {\n    onPlayerSnapshot?.({ file, player });\n  };\n\n  reportSnapshot();\n  try {\n    await player.run();\n  } finally {\n    reportSnapshot();\n  }\n\n  return createYamlCaseResult(file, player, Date.now() - startTime);\n};\n\n/** @internal Used by the generated Rstest entry to observe player state. */\nexport function runYamlCaseResultWithSnapshots(\n  options: RunYamlCaseOptions,\n  onPlayerSnapshot: YamlPlayerSnapshotHandler,\n): Promise<MidsceneYamlConfigResult> {\n  return executeYamlCaseResult(options, onPlayerSnapshot);\n}\n\nexport function runYamlCaseResult(\n  options: RunYamlCaseOptions,\n): Promise<MidsceneYamlConfigResult> {\n  return executeYamlCaseResult(options);\n}\n\nexport async function runYamlCase(\n  options: RunYamlCaseOptions,\n): Promise<RunYamlCaseResult> {\n  const result = await runYamlCaseResult(options);\n  if (!result.success) {\n    throw createYamlCaseFailure(result);\n  }\n\n  return {\n    file: result.file,\n    output: result.output || undefined,\n    report: result.report,\n    duration: result.duration || 0,\n  };\n}\n","import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';\nimport { dirname, resolve } from 'node:path';\nimport type {\n  MidsceneYamlConfigAttempt,\n  MidsceneYamlConfigResult,\n} from '@midscene/core';\nimport { parseYamlScript } from '@midscene/core/yaml';\nimport type { test as rstestTest } from '@rstest/core';\nimport {\n  createYamlAttempt,\n  getYamlAttemptsDuration,\n  preserveYamlAttemptReport,\n  resolveYamlMaxAttempts,\n} from '../execution-summary';\nimport { contextTaskListSummary, formatYamlProgressSnapshot } from '../printer';\nimport { emitYamlProgress } from './progress-reporter';\nimport {\n  type DefineYamlBatchTestOptions,\n  type DefineYamlCaseTestOptions,\n  RSTEST_YAML_CASE_IDS_META_KEY,\n} from './rstest-contract';\nimport { runYamlBatchInRstest } from './yaml-batch';\nimport {\n  type YamlPlayerSnapshotHandler,\n  createYamlCaseFailure,\n  runYamlCaseResultWithSnapshots,\n} from './yaml-case';\n\nexport type RstestTest = typeof rstestTest;\n\nconst errorMessageOf = (error: unknown): string =>\n  error instanceof Error ? error.message : String(error);\n\nconst writeResultFile = (\n  resultFile: string,\n  data: MidsceneYamlConfigResult,\n) => {\n  mkdirSync(dirname(resultFile), { recursive: true });\n  writeFileSync(resultFile, JSON.stringify(data, null, 2));\n};\n\nconst attemptHistoryFileFor = (resultFile: string): string =>\n  `${resultFile}.attempts.json`;\n\nconst readAttemptHistory = (\n  resultFile: string,\n): MidsceneYamlConfigAttempt[] => {\n  const attemptHistoryFile = attemptHistoryFileFor(resultFile);\n  if (!existsSync(attemptHistoryFile)) return [];\n\n  return JSON.parse(\n    readFileSync(attemptHistoryFile, 'utf8'),\n  ) as MidsceneYamlConfigAttempt[];\n};\n\nconst appendAttemptHistory = (\n  resultFile: string,\n  result: MidsceneYamlConfigResult,\n  attempts: MidsceneYamlConfigAttempt[],\n): MidsceneYamlConfigResult => {\n  const nextAttempts = [\n    ...attempts,\n    createYamlAttempt(result, attempts.length + 1),\n  ];\n\n  mkdirSync(dirname(resultFile), { recursive: true });\n  writeFileSync(\n    attemptHistoryFileFor(resultFile),\n    JSON.stringify(nextAttempts, null, 2),\n  );\n\n  return {\n    ...result,\n    duration: getYamlAttemptsDuration(nextAttempts),\n    attempts: nextAttempts,\n  };\n};\n\nconst hasExplicitReportFileName = (\n  file: string,\n  caseOptions: DefineYamlCaseTestOptions['caseOptions'],\n): boolean => {\n  if (caseOptions?.executionConfig) {\n    return Boolean(caseOptions.executionConfig.agent?.reportFileName);\n  }\n\n  const script = parseYamlScript(readFileSync(file, 'utf8'), file);\n  return Boolean(script.agent?.reportFileName);\n};\n\nconst prepareAttemptHistory = (\n  resultFile: string,\n  attempts: MidsceneYamlConfigAttempt[],\n  preserveReport: boolean,\n): MidsceneYamlConfigAttempt[] => {\n  if (!preserveReport || attempts.length === 0) return attempts;\n\n  const nextAttempts = [...attempts];\n  nextAttempts[nextAttempts.length - 1] = preserveYamlAttemptReport(\n    nextAttempts[nextAttempts.length - 1],\n  );\n  writeFileSync(\n    attemptHistoryFileFor(resultFile),\n    JSON.stringify(nextAttempts, null, 2),\n  );\n  return nextAttempts;\n};\n\nconst createRuntimeFailureResult = (\n  file: string,\n  startTime: number,\n  error: unknown,\n): MidsceneYamlConfigResult => ({\n  file,\n  success: false,\n  executed: true,\n  duration: Date.now() - startTime,\n  resultType: 'failed',\n  error: errorMessageOf(error),\n});\n\nconst createYamlPlayerProgressReporter =\n  (attempt: number, totalAttempts: number): YamlPlayerSnapshotHandler =>\n  ({ file, player }) => {\n    const summary = contextTaskListSummary(player.taskStatusList, {\n      file,\n      player,\n    });\n    emitYamlProgress(\n      formatYamlProgressSnapshot(summary, attempt, totalAttempts),\n    );\n  };\n\nexport const defineYamlCaseTest = (\n  test: RstestTest,\n  options: DefineYamlCaseTestOptions,\n) => {\n  test(\n    options.testName,\n    {\n      meta: {\n        [RSTEST_YAML_CASE_IDS_META_KEY]: [options.caseId],\n      },\n    },\n    async () => {\n      const file = resolve(options.yamlFile);\n      const startTime = Date.now();\n      let attempts = readAttemptHistory(options.resultFile);\n      const attempt = attempts.length + 1;\n      const totalAttempts = resolveYamlMaxAttempts(options.retry);\n      let result: MidsceneYamlConfigResult | undefined;\n\n      try {\n        if (attempt > 1) {\n          attempts = prepareAttemptHistory(\n            options.resultFile,\n            attempts,\n            hasExplicitReportFileName(file, options.caseOptions),\n          );\n        }\n        result = await runYamlCaseResultWithSnapshots(\n          {\n            ...options.caseOptions,\n            ...options.webRuntimeOptions,\n            file,\n          },\n          createYamlPlayerProgressReporter(attempt, totalAttempts),\n        );\n        result = appendAttemptHistory(options.resultFile, result, attempts);\n        writeResultFile(options.resultFile, result);\n\n        if (!result.success) {\n          throw createYamlCaseFailure(result);\n        }\n      } catch (error) {\n        if (!result) {\n          const failureResult = appendAttemptHistory(\n            options.resultFile,\n            createRuntimeFailureResult(file, startTime, error),\n            attempts,\n          );\n          writeResultFile(options.resultFile, failureResult);\n        }\n        throw error;\n      }\n    },\n  );\n};\n\nexport const defineYamlBatchTest = (\n  test: RstestTest,\n  options: DefineYamlBatchTestOptions,\n) => {\n  test(\n    options.testName,\n    {\n      meta: {\n        [RSTEST_YAML_CASE_IDS_META_KEY]: options.caseIds,\n      },\n    },\n    async () => {\n      await runYamlBatchInRstest({\n        config: options.config,\n        resultTargets: options.resultTargets,\n      });\n    },\n  );\n};\n"],"names":["wrapAnsi16","fn","offset","args","code","wrapAnsi256","wrapAnsi16m","rgb","ansi2ansi","n","rgb2rgb","r","g","b","setLazyProperty","object","property","get","Object","value","colorConvert","makeDynamicStyles","wrap","targetSpace","identity","isBackground","styles","sourceSpace","suite","name","assembleStyles","codes","Map","groupName","group","styleName","style","module","ansiStyles","stdoutColor","stderrColor","stringReplaceAll","stringEncaseCRLFWithFirstIndex","isArray","Array","levelMapping","applyOptions","options","Number","Error","colorLevel","ChalkClass","chalkFactory","chalk","arguments_","chalkTag","Chalk","builder","createBuilder","createStyler","usedModels","model","level","styler","bgModel","proto","open","close","parent","openAll","closeAll","self","_styler","_isEmpty","applyStyle","string","lfIndex","template","strings","firstString","parts","i","String","TEMPLATE_REGEX","STYLE_REGEX","STRING_REGEX","ESCAPE_REGEX","ESCAPES","unescape","c","u","bracket","parseInt","parseArguments","results","chunks","matches","chunk","number","m","escape","character","parseStyle","buildStyle","enabled","layer","current","temporary","escapeCharacter","inverse","errMessage","substring","replacer","index","substringLength","endIndex","returnValue","prefix","postfix","gotCR","cssKeywords","reverseKeywords","key","convert","channels","labels","min","Math","max","delta","h","s","l","rdif","gdif","bdif","v","diff","diffc","w","k","y","comparativeDistance","x","reversed","currentClosestDistance","currentClosestKeyword","keyword","distance","z","xyz","a","hsl","t2","t3","val","t1","smin","lmin","sv","hsv","hi","f","p","q","t","vmin","sl","hwb","wh","bl","ratio","cmyk","lab","y2","x2","z2","hr","lch","saturation","ansi","color","mult","rem","integer","match","colorString","char","chroma","grayscale","hue","hcg","pure","mg","apple","gray","conversions","route","models","wrapRaw","wrappedFn","arg0","wrapRounded","result","len","fromModel","routes","routeModels","toModel","buildGraph","graph","deriveBFS","queue","adjacents","adjacent","node","link","from","to","wrapConversion","path","cur","conversion","flag","argv","process","position","terminatorPosition","os","tty","hasFlag","env","forceColor","translateLevel","supportsColor","haveStream","streamIsTTY","osRelease","sign","version","getSupportLevel","stream","__webpack_require__","getter","exports","definition","obj","prop","warnRetryReport","getDebug","notExecutedError","createNotExecutedYamlResult","file","undefined","createUnexpectedYamlResult","error","duration","player","output","existsSync","isYamlPlayerSuccessful","task","createExecutedYamlResult","hasPlayerError","hasFailedTasks","success","resultType","outputPath","errorMessage","taskErrors","resolveYamlMaxAttempts","retry","createYamlAttempt","attempt","getYamlAttemptsDuration","attempts","total","retryAttemptReportPath","reportFile","basename","reportDir","dirname","join","extension","extname","stem","preserveYamlAttemptReport","source","target","sourceDir","targetDir","rmSync","cpSync","copyFileSync","unlinkSync","getExecutionSummary","getResultsByType","sum","getResultFilesByType","getSummaryAbsolutePath","summary","resolve","getMidsceneRunSubDir","toOutputRelativePath","outputDir","filePath","relativePath","relative","toTestStatus","safeReportNamePart","createRetryReportName","fileName","fileHash","createHash","createRetryAttemptReport","attemptsWithReports","tool","ReportMergingTool","status","errorMessageOf","warnRetryReportFailure","message","mkdirSync","createRetryAttemptReportSafely","writeExecutionSummaryFile","indexPath","executionSummary","indexData","Date","retryReport","writeFileSync","JSON","printExecutionPlan","config","console","printExecutionFinished","printResultArtifacts","printExecutionSummary","summaryPath","successfulFiles","failedFiles","partialFailedFiles","notExecutedFiles","normalizeBatchError","YamlBatchExecutionError","occurrences","cause","caseId","isYamlBatchExecutionError","Node","Queue","Symbol","pLimit","concurrency","validateConcurrency","activeCount","resumeNext","next","run","function_","enqueue","Promise","internalResolve","generator","newConcurrency","queueMicrotask","TypeError","debug","cleanupWarning","cleanupFailedPlayerSetup","freeFn","cleanup","launchServer","dir","server","createServer","resolveReportFileName","yamlReportFileName","cliTestId","yamlTestId","baseName","getReportFileName","buildAgentOptions","yamlAgent","reportFileName","processCacheConfig","createYamlPlayer","script","yamlScript","parseYamlScript","readFileSync","clonedYamlScript","structuredClone","preference","ScriptPlayer","resolvedWebTarget","resolveWebTarget","webTarget","targetCount","Boolean","specifiedTargets","localServer","urlToVisit","assert","serverAddress","reject","ownsCdpBrowser","cdpBrowser","puppeteer","buildDownloadBehavior","launchedAgent","puppeteerAgentForTarget","cleanupError","agent","newFreeFn","cleanFreeFn","bridgeUnsupportedKeys","ignoredKeys","AgentOverChromeBridge","androidTarget","agentFromAdbDevice","iosTarget","agentFromWebDriverAgent","harmonyTarget","agentFromHdcDevice","computerTarget","agentForComputer","interfaceTarget","moduleSpecifier","finalModuleSpecifier","resolvedPath","importedModule","DeviceClass","device","createAgent","resolveIsTTY","stdoutIsTTY","isTTY","indent","spinnerInterval","spinnerFrames","currentSpinningFrame","indicatorForStatus","contextInfo","context","filePathToShow","fileNameToPrint","fileStatusText","contextActionText","errorText","outputFile","outputText","reportText","agentStatusTip","agentStatusText","mergedText","singleTaskInfo","stepText","actionText","statusText","mergedLine","paddingLines","lines","line","contextTaskListSummary","taskStatusArray","prefixLines","currentLine","suffixText","fileInfo","formatYamlProgressSnapshot","totalAttempts","copyProperty","ignoreNonConfigurable","toDescriptor","fromDescriptor","canCopyProperty","changePrototype","fromPrototype","wrappedToString","withName","fromBody","toStringDescriptor","Function","toStringName","changeToString","newToString","writable","enumerable","configurable","mimicFunction","Reflect","calledFunctions","WeakMap","callCount","functionName","onetime","signals","processOk","kExitEmitter","global","globalThis","ObjectDefineProperty","Emitter","ev","list","signal","ret","SignalExitBase","signalExitWrap","handler","cb","opts","SignalExitFallback","SignalExit","sig","listeners","count","_","listener","og","onExit","load","unload","terminal","restoreCursor","DEFAULT_RENDER_INTERVAL","ESC","CLEAR_LINE","MOVE_CURSOR_ONE_ROW_UP","HIDE_CURSOR","SHOW_CURSOR","SYNC_START","SYNC_END","TTYWindowRenderer","setInterval","clearInterval","type","windowContent","rowCount","getRenderedRowCount","padding","original","callback","contents","columns","content","rows","row","text","stripVTControlCharacters","batchWarning","normalizeExecutionError","batchRuntimeTargetLabel","resolveBatchRuntimeTarget","targets","assertBrowserContextUsage","setupContext","allContexts","shareBrowserContext","resolvedTargets","unsupported","browserCreationOptions","fileWebConfig","misplacedOptions","option","createSharedBrowserRuntime","browser","browserContextOptions","browserContext","YamlBatchExecutor","generateSummary","shouldPrintExecutionPlan","keepWindow","headed","setup","fileContextList","sharedRuntime","caseIndex","executionError","fileConfig","setupPath","conflict","ctx","needsBrowser","resetSetupRuntime","globalWebConfig","downloadBehavior","width","defaultViewportWidth","height","defaultViewportHeight","buildChromeArgs","staleRuntime","executedResults","unexpectedResults","notExecutedContexts","unexpectedError","isCdp","globalConfig","clonedFileConfig","executionConfig","merge","onProgress","allFileContexts","fileContextsByCaseId","createFilePlayerContext","fileContext","initialContexts","ttyRenderer","summaryContents","reportProgressSnapshot","executeFile","beforeRetry","allFileContext","lastAttemptStartTime","executedContext","startTime","attemptResult","totalDuration","yamlResult","normalizedError","setupFailed","outcome","limit","recordOutcome","tasks","shouldStop","stopLock","executedContexts","unexpectedContexts","resultsByCaseId","caseIds","occurrenceCount","Set","runYamlBatch","runYamlBatchWithCaseIds","BatchRunner","requireFromCliPackage","__dirname","createRequire","entry","resolvePackageFromRstestCore","packageName","require","rstestPackageJsonPath","resolveRstestCoreImportPath","DEFAULT_YAML_TEST_TIMEOUT","RSTEST_YAML_BATCH_TEST_MODULE","RSTEST_YAML_BATCH_TEST_NAME","RSTEST_YAML_SEQUENTIAL_TEST_MODULE","toPosixPath","sep","toImportLiteral","toVirtualModuleId","fileStem","safeFileStem","base","resolveTestName","projectDir","yamlFile","createGeneratedCaseTestContent","createGeneratedBatchTestContent","resolveDefaultFrameworkImport","moduleDir","anchorDir","candidates","matched","candidate","createRstestYamlProject","resultDir","frameworkImport","rstestCoreImport","testTimeout","resultYamlFiles","cases","testName","resultFile","baseProject","testOptions","item","id","yamlProgressLogPrefix","emitYamlProgress","createYamlProgressReporter","log","RSTEST_YAML_CASE_IDS_META_KEY","formatRunError","collectRunErrors","messages","push","label","formatted","testResult","mapRunErrorsToCases","project","casesById","knownCaseIds","errors","add","addCases","findModuleCaseIds","metadataCaseIds","moduleCaseIds","recordUnreportedCaseFailures","caseErrors","failure","runRstestYamlProject","runRstest","rspack","pathToFileURL","maxConcurrency","inlineConfig","_config","appendPlugins","runErrors","defaultInProcessRunner","runConfigInMainProcess","commandOptions","runner","createCaseOptions","caseOptions","createWebRuntimeOptions","runtimeOptions","readProjectResults","runFrameworkTestConfig","exitCode","writeResultFile","data","batchFailureMessage","failed","runYamlBatchInRstest","resultTargetsByCaseId","occurrenceResults","unmappedResults","unwrittenTargets","taskErrorMessage","cloneJson","normalizeTargetConfig","createExecutionConfig","clonedGlobalConfig","getYamlPlayerFailure","failedMessages","details","reportLine","outputLine","createYamlCaseResult","createYamlCaseFailure","executeYamlCaseResult","onPlayerSnapshot","reportSnapshot","runYamlCaseResultWithSnapshots","runYamlCaseResult","runYamlCase","attemptHistoryFileFor","readAttemptHistory","attemptHistoryFile","appendAttemptHistory","nextAttempts","hasExplicitReportFileName","prepareAttemptHistory","preserveReport","createRuntimeFailureResult","createYamlPlayerProgressReporter","defineYamlCaseTest","test","failureResult","defineYamlBatchTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;QAEA,MAAMA,aAAa,CAACC,IAAIC,SAAW,CAAC,GAAGC;gBACtC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAEC,OAAOF,OAAO,CAAC,CAAC;YAClC;QAEA,MAAMG,cAAc,CAACJ,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMC,OAAOH,MAAME;gBACnB,OAAO,CAAC,OAAO,EAAE,KAAKD,OAAO,GAAG,EAAEE,KAAK,CAAC,CAAC;YAC1C;QAEA,MAAME,cAAc,CAACL,IAAIC,SAAW,CAAC,GAAGC;gBACvC,MAAMI,MAAMN,MAAME;gBAClB,OAAO,CAAC,OAAO,EAAE,KAAKD,OAAO,GAAG,EAAEK,GAAG,CAAC,EAAE,CAAC,CAAC,EAAEA,GAAG,CAAC,EAAE,CAAC,CAAC,EAAEA,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;YAChE;QAEA,MAAMC,YAAYC,CAAAA,IAAKA;QACvB,MAAMC,UAAU,CAACC,GAAGC,GAAGC,IAAM;gBAACF;gBAAGC;gBAAGC;aAAE;QAEtC,MAAMC,kBAAkB,CAACC,QAAQC,UAAUC;YAC1CC,OAAO,cAAc,CAACH,QAAQC,UAAU;gBACvC,KAAK;oBACJ,MAAMG,QAAQF;oBAEdC,OAAO,cAAc,CAACH,QAAQC,UAAU;wBACvCG;wBACA,YAAY;wBACZ,cAAc;oBACf;oBAEA,OAAOA;gBACR;gBACA,YAAY;gBACZ,cAAc;YACf;QACD;QAGA,IAAIC;QACJ,MAAMC,oBAAoB,CAACC,MAAMC,aAAaC,UAAUC;YACvD,IAAIL,AAAiB,WAAjBA,cACHA,eAAe,oBAAQ;YAGxB,MA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