1 |
- {"version":3,"file":"mapperTab.js","sources":["../../node_modules/zod/lib/helpers/util.js","../../node_modules/zod/lib/ZodError.js","../../node_modules/zod/lib/locales/en.js","../../node_modules/zod/lib/errors.js","../../node_modules/zod/lib/helpers/parseUtil.js","../../node_modules/zod/lib/helpers/typeAliases.js","../../node_modules/zod/lib/helpers/errorUtil.js","../../node_modules/zod/lib/types.js","../../node_modules/zod/lib/external.js","../../node_modules/zod/lib/index.js","../cjs/protocol/protocol.js","../cjs/protocol-parser/protocol-parser.js","../cjs/utils/EventEmitter.js","../../node_modules/mitt/dist/mitt.js","../cjs/utils/log.js","../cjs/utils/processingQueue.js","../cjs/utils/assert.js","../cjs/utils/Mutex.js","../cjs/bidiMapper/domains/input/InputSource.js","../cjs/bidiMapper/domains/input/InputState.js","../cjs/bidiMapper/domains/input/InputStateManager.js","../cjs/bidiMapper/domains/input/USKeyboardLayout.js","../cjs/bidiMapper/domains/input/keyUtils.js","../cjs/bidiMapper/domains/input/ActionDispatcher.js","../cjs/bidiMapper/domains/context/PreloadScriptStorage.js","../cjs/utils/unitConversions.js","../cjs/utils/deferred.js","../cjs/utils/uuid.js","../cjs/bidiMapper/domains/script/channelProxy.js","../cjs/bidiMapper/domains/script/scriptEvaluator.js","../cjs/bidiMapper/domains/script/realm.js","../cjs/bidiMapper/domains/context/browsingContextImpl.js","../cjs/bidiMapper/domains/log/logHelper.js","../cjs/bidiMapper/domains/log/logManager.js","../cjs/utils/DefaultMap.js","../cjs/bidiMapper/domains/network/networkRequest.js","../cjs/bidiMapper/domains/network/networkProcessor.js","../cjs/bidiMapper/domains/context/cdpTarget.js","../cjs/bidiMapper/domains/context/bidiPreloadScript.js","../cjs/bidiMapper/domains/context/browsingContextProcessor.js","../cjs/bidiMapper/OutgoingBidiMessage.js","../cjs/bidiMapper/CommandProcessor.js","../cjs/bidiMapper/domains/context/browsingContextStorage.js","../cjs/utils/buffer.js","../cjs/utils/idWrapper.js","../cjs/bidiMapper/domains/events/SubscriptionManager.js","../cjs/bidiMapper/domains/events/EventManager.js","../cjs/bidiMapper/domains/script/realmStorage.js","../cjs/bidiMapper/BidiServer.js","../cjs/bidiMapper/bidiMapper.js","../cjs/cdp/cdpClient.js","../cjs/cdp/cdpConnection.js","../cjs/bidiTab/mapperTabPage.js","../cjs/bidiTab/bidiTab.js"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getParsedType = exports.ZodParsedType = exports.objectUtil = exports.util = void 0;\nvar util;\n(function (util) {\n util.assertEqual = (val) => val;\n function assertIs(_arg) { }\n util.assertIs = assertIs;\n function assertNever(_x) {\n throw new Error();\n }\n util.assertNever = assertNever;\n util.arrayToEnum = (items) => {\n const obj = {};\n for (const item of items) {\n obj[item] = item;\n }\n return obj;\n };\n util.getValidEnumValues = (obj) => {\n const validKeys = util.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== \"number\");\n const filtered = {};\n for (const k of validKeys) {\n filtered[k] = obj[k];\n }\n return util.objectValues(filtered);\n };\n util.objectValues = (obj) => {\n return util.objectKeys(obj).map(function (e) {\n return obj[e];\n });\n };\n util.objectKeys = typeof Object.keys === \"function\"\n ? (obj) => Object.keys(obj)\n : (object) => {\n const keys = [];\n for (const key in object) {\n if (Object.prototype.hasOwnProperty.call(object, key)) {\n keys.push(key);\n }\n }\n return keys;\n };\n util.find = (arr, checker) => {\n for (const item of arr) {\n if (checker(item))\n return item;\n }\n return undefined;\n };\n util.isInteger = typeof Number.isInteger === \"function\"\n ? (val) => Number.isInteger(val)\n : (val) => typeof val === \"number\" && isFinite(val) && Math.floor(val) === val;\n function joinValues(array, separator = \" | \") {\n return array\n .map((val) => (typeof val === \"string\" ? `'${val}'` : val))\n .join(separator);\n }\n util.joinValues = joinValues;\n util.jsonStringifyReplacer = (_, value) => {\n if (typeof value === \"bigint\") {\n return value.toString();\n }\n return value;\n };\n})(util = exports.util || (exports.util = {}));\nvar objectUtil;\n(function (objectUtil) {\n objectUtil.mergeShapes = (first, second) => {\n return {\n ...first,\n ...second,\n };\n };\n})(objectUtil = exports.objectUtil || (exports.objectUtil = {}));\nexports.ZodParsedType = util.arrayToEnum([\n \"string\",\n \"nan\",\n \"number\",\n \"integer\",\n \"float\",\n \"boolean\",\n \"date\",\n \"bigint\",\n \"symbol\",\n \"function\",\n \"undefined\",\n \"null\",\n \"array\",\n \"object\",\n \"unknown\",\n \"promise\",\n \"void\",\n \"never\",\n \"map\",\n \"set\",\n]);\nconst getParsedType = (data) => {\n const t = typeof data;\n switch (t) {\n case \"undefined\":\n return exports.ZodParsedType.undefined;\n case \"string\":\n return exports.ZodParsedType.string;\n case \"number\":\n return isNaN(data) ? exports.ZodParsedType.nan : exports.ZodParsedType.number;\n case \"boolean\":\n return exports.ZodParsedType.boolean;\n case \"function\":\n return exports.ZodParsedType.function;\n case \"bigint\":\n return exports.ZodParsedType.bigint;\n case \"symbol\":\n return exports.ZodParsedType.symbol;\n case \"object\":\n if (Array.isArray(data)) {\n return exports.ZodParsedType.array;\n }\n if (data === null) {\n return exports.ZodParsedType.null;\n }\n if (data.then &&\n typeof data.then === \"function\" &&\n data.catch &&\n typeof data.catch === \"function\") {\n return exports.ZodParsedType.promise;\n }\n if (typeof Map !== \"undefined\" && data instanceof Map) {\n return exports.ZodParsedType.map;\n }\n if (typeof Set !== \"undefined\" && data instanceof Set) {\n return exports.ZodParsedType.set;\n }\n if (typeof Date !== \"undefined\" && data instanceof Date) {\n return exports.ZodParsedType.date;\n }\n return exports.ZodParsedType.object;\n default:\n return exports.ZodParsedType.unknown;\n }\n};\nexports.getParsedType = getParsedType;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ZodError = exports.quotelessJson = exports.ZodIssueCode = void 0;\nconst util_1 = require(\"./helpers/util\");\nexports.ZodIssueCode = util_1.util.arrayToEnum([\n \"invalid_type\",\n \"invalid_literal\",\n \"custom\",\n \"invalid_union\",\n \"invalid_union_discriminator\",\n \"invalid_enum_value\",\n \"unrecognized_keys\",\n \"invalid_arguments\",\n \"invalid_return_type\",\n \"invalid_date\",\n \"invalid_string\",\n \"too_small\",\n \"too_big\",\n \"invalid_intersection_types\",\n \"not_multiple_of\",\n \"not_finite\",\n]);\nconst quotelessJson = (obj) => {\n const json = JSON.stringify(obj, null, 2);\n return json.replace(/\"([^\"]+)\":/g, \"$1:\");\n};\nexports.quotelessJson = quotelessJson;\nclass ZodError extends Error {\n constructor(issues) {\n super();\n this.issues = [];\n this.addIssue = (sub) => {\n this.issues = [...this.issues, sub];\n };\n this.addIssues = (subs = []) => {\n this.issues = [...this.issues, ...subs];\n };\n const actualProto = new.target.prototype;\n if (Object.setPrototypeOf) {\n Object.setPrototypeOf(this, actualProto);\n }\n else {\n this.__proto__ = actualProto;\n }\n this.name = \"ZodError\";\n this.issues = issues;\n }\n get errors() {\n return this.issues;\n }\n format(_mapper) {\n const mapper = _mapper ||\n function (issue) {\n return issue.message;\n };\n const fieldErrors = { _errors: [] };\n const processError = (error) => {\n for (const issue of error.issues) {\n if (issue.code === \"invalid_union\") {\n issue.unionErrors.map(processError);\n }\n else if (issue.code === \"invalid_return_type\") {\n processError(issue.returnTypeError);\n }\n else if (issue.code === \"invalid_arguments\") {\n processError(issue.argumentsError);\n }\n else if (issue.path.length === 0) {\n fieldErrors._errors.push(mapper(issue));\n }\n else {\n let curr = fieldErrors;\n let i = 0;\n while (i < issue.path.length) {\n const el = issue.path[i];\n const terminal = i === issue.path.length - 1;\n if (!terminal) {\n curr[el] = curr[el] || { _errors: [] };\n }\n else {\n curr[el] = curr[el] || { _errors: [] };\n curr[el]._errors.push(mapper(issue));\n }\n curr = curr[el];\n i++;\n }\n }\n }\n };\n processError(this);\n return fieldErrors;\n }\n toString() {\n return this.message;\n }\n get message() {\n return JSON.stringify(this.issues, util_1.util.jsonStringifyReplacer, 2);\n }\n get isEmpty() {\n return this.issues.length === 0;\n }\n flatten(mapper = (issue) => issue.message) {\n const fieldErrors = {};\n const formErrors = [];\n for (const sub of this.issues) {\n if (sub.path.length > 0) {\n fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];\n fieldErrors[sub.path[0]].push(mapper(sub));\n }\n else {\n formErrors.push(mapper(sub));\n }\n }\n return { formErrors, fieldErrors };\n }\n get formErrors() {\n return this.flatten();\n }\n}\nexports.ZodError = ZodError;\nZodError.create = (issues) => {\n const error = new ZodError(issues);\n return error;\n};\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"../helpers/util\");\nconst ZodError_1 = require(\"../ZodError\");\nconst errorMap = (issue, _ctx) => {\n let message;\n switch (issue.code) {\n case ZodError_1.ZodIssueCode.invalid_type:\n if (issue.received === util_1.ZodParsedType.undefined) {\n message = \"Required\";\n }\n else {\n message = `Expected ${issue.expected}, received ${issue.received}`;\n }\n break;\n case ZodError_1.ZodIssueCode.invalid_literal:\n message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util_1.util.jsonStringifyReplacer)}`;\n break;\n case ZodError_1.ZodIssueCode.unrecognized_keys:\n message = `Unrecognized key(s) in object: ${util_1.util.joinValues(issue.keys, \", \")}`;\n break;\n case ZodError_1.ZodIssueCode.invalid_union:\n message = `Invalid input`;\n break;\n case ZodError_1.ZodIssueCode.invalid_union_discriminator:\n message = `Invalid discriminator value. Expected ${util_1.util.joinValues(issue.options)}`;\n break;\n case ZodError_1.ZodIssueCode.invalid_enum_value:\n message = `Invalid enum value. Expected ${util_1.util.joinValues(issue.options)}, received '${issue.received}'`;\n break;\n case ZodError_1.ZodIssueCode.invalid_arguments:\n message = `Invalid function arguments`;\n break;\n case ZodError_1.ZodIssueCode.invalid_return_type:\n message = `Invalid function return type`;\n break;\n case ZodError_1.ZodIssueCode.invalid_date:\n message = `Invalid date`;\n break;\n case ZodError_1.ZodIssueCode.invalid_string:\n if (typeof issue.validation === \"object\") {\n if (\"includes\" in issue.validation) {\n message = `Invalid input: must include \"${issue.validation.includes}\"`;\n if (typeof issue.validation.position === \"number\") {\n message = `${message} at one or more positions greater than or equal to ${issue.validation.position}`;\n }\n }\n else if (\"startsWith\" in issue.validation) {\n message = `Invalid input: must start with \"${issue.validation.startsWith}\"`;\n }\n else if (\"endsWith\" in issue.validation) {\n message = `Invalid input: must end with \"${issue.validation.endsWith}\"`;\n }\n else {\n util_1.util.assertNever(issue.validation);\n }\n }\n else if (issue.validation !== \"regex\") {\n message = `Invalid ${issue.validation}`;\n }\n else {\n message = \"Invalid\";\n }\n break;\n case ZodError_1.ZodIssueCode.too_small:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? \"exactly\" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${issue.minimum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly equal to `\n : issue.inclusive\n ? `greater than or equal to `\n : `greater than `}${new Date(Number(issue.minimum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodError_1.ZodIssueCode.too_big:\n if (issue.type === \"array\")\n message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;\n else if (issue.type === \"string\")\n message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;\n else if (issue.type === \"number\")\n message = `Number must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"bigint\")\n message = `BigInt must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `less than or equal to`\n : `less than`} ${issue.maximum}`;\n else if (issue.type === \"date\")\n message = `Date must be ${issue.exact\n ? `exactly`\n : issue.inclusive\n ? `smaller than or equal to`\n : `smaller than`} ${new Date(Number(issue.maximum))}`;\n else\n message = \"Invalid input\";\n break;\n case ZodError_1.ZodIssueCode.custom:\n message = `Invalid input`;\n break;\n case ZodError_1.ZodIssueCode.invalid_intersection_types:\n message = `Intersection results could not be merged`;\n break;\n case ZodError_1.ZodIssueCode.not_multiple_of:\n message = `Number must be a multiple of ${issue.multipleOf}`;\n break;\n case ZodError_1.ZodIssueCode.not_finite:\n message = \"Number must be finite\";\n break;\n default:\n message = _ctx.defaultError;\n util_1.util.assertNever(issue);\n }\n return { message };\n};\nexports.default = errorMap;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getErrorMap = exports.setErrorMap = exports.defaultErrorMap = void 0;\nconst en_1 = __importDefault(require(\"./locales/en\"));\nexports.defaultErrorMap = en_1.default;\nlet overrideErrorMap = en_1.default;\nfunction setErrorMap(map) {\n overrideErrorMap = map;\n}\nexports.setErrorMap = setErrorMap;\nfunction getErrorMap() {\n return overrideErrorMap;\n}\nexports.getErrorMap = getErrorMap;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isAsync = exports.isValid = exports.isDirty = exports.isAborted = exports.OK = exports.DIRTY = exports.INVALID = exports.ParseStatus = exports.addIssueToContext = exports.EMPTY_PATH = exports.makeIssue = void 0;\nconst errors_1 = require(\"../errors\");\nconst en_1 = __importDefault(require(\"../locales/en\"));\nconst makeIssue = (params) => {\n const { data, path, errorMaps, issueData } = params;\n const fullPath = [...path, ...(issueData.path || [])];\n const fullIssue = {\n ...issueData,\n path: fullPath,\n };\n let errorMessage = \"\";\n const maps = errorMaps\n .filter((m) => !!m)\n .slice()\n .reverse();\n for (const map of maps) {\n errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;\n }\n return {\n ...issueData,\n path: fullPath,\n message: issueData.message || errorMessage,\n };\n};\nexports.makeIssue = makeIssue;\nexports.EMPTY_PATH = [];\nfunction addIssueToContext(ctx, issueData) {\n const issue = (0, exports.makeIssue)({\n issueData: issueData,\n data: ctx.data,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n (0, errors_1.getErrorMap)(),\n en_1.default,\n ].filter((x) => !!x),\n });\n ctx.common.issues.push(issue);\n}\nexports.addIssueToContext = addIssueToContext;\nclass ParseStatus {\n constructor() {\n this.value = \"valid\";\n }\n dirty() {\n if (this.value === \"valid\")\n this.value = \"dirty\";\n }\n abort() {\n if (this.value !== \"aborted\")\n this.value = \"aborted\";\n }\n static mergeArray(status, results) {\n const arrayValue = [];\n for (const s of results) {\n if (s.status === \"aborted\")\n return exports.INVALID;\n if (s.status === \"dirty\")\n status.dirty();\n arrayValue.push(s.value);\n }\n return { status: status.value, value: arrayValue };\n }\n static async mergeObjectAsync(status, pairs) {\n const syncPairs = [];\n for (const pair of pairs) {\n syncPairs.push({\n key: await pair.key,\n value: await pair.value,\n });\n }\n return ParseStatus.mergeObjectSync(status, syncPairs);\n }\n static mergeObjectSync(status, pairs) {\n const finalObject = {};\n for (const pair of pairs) {\n const { key, value } = pair;\n if (key.status === \"aborted\")\n return exports.INVALID;\n if (value.status === \"aborted\")\n return exports.INVALID;\n if (key.status === \"dirty\")\n status.dirty();\n if (value.status === \"dirty\")\n status.dirty();\n if (typeof value.value !== \"undefined\" || pair.alwaysSet) {\n finalObject[key.value] = value.value;\n }\n }\n return { status: status.value, value: finalObject };\n }\n}\nexports.ParseStatus = ParseStatus;\nexports.INVALID = Object.freeze({\n status: \"aborted\",\n});\nconst DIRTY = (value) => ({ status: \"dirty\", value });\nexports.DIRTY = DIRTY;\nconst OK = (value) => ({ status: \"valid\", value });\nexports.OK = OK;\nconst isAborted = (x) => x.status === \"aborted\";\nexports.isAborted = isAborted;\nconst isDirty = (x) => x.status === \"dirty\";\nexports.isDirty = isDirty;\nconst isValid = (x) => x.status === \"valid\";\nexports.isValid = isValid;\nconst isAsync = (x) => typeof Promise !== \"undefined\" && x instanceof Promise;\nexports.isAsync = isAsync;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.errorUtil = void 0;\nvar errorUtil;\n(function (errorUtil) {\n errorUtil.errToObj = (message) => typeof message === \"string\" ? { message } : message || {};\n errorUtil.toString = (message) => typeof message === \"string\" ? message : message === null || message === void 0 ? void 0 : message.message;\n})(errorUtil = exports.errorUtil || (exports.errorUtil = {}));\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.discriminatedUnion = exports.date = exports.boolean = exports.bigint = exports.array = exports.any = exports.coerce = exports.ZodFirstPartyTypeKind = exports.late = exports.ZodSchema = exports.Schema = exports.custom = exports.ZodPipeline = exports.ZodBranded = exports.BRAND = exports.ZodNaN = exports.ZodCatch = exports.ZodDefault = exports.ZodNullable = exports.ZodOptional = exports.ZodTransformer = exports.ZodEffects = exports.ZodPromise = exports.ZodNativeEnum = exports.ZodEnum = exports.ZodLiteral = exports.ZodLazy = exports.ZodFunction = exports.ZodSet = exports.ZodMap = exports.ZodRecord = exports.ZodTuple = exports.ZodIntersection = exports.ZodDiscriminatedUnion = exports.ZodUnion = exports.ZodObject = exports.ZodArray = exports.ZodVoid = exports.ZodNever = exports.ZodUnknown = exports.ZodAny = exports.ZodNull = exports.ZodUndefined = exports.ZodSymbol = exports.ZodDate = exports.ZodBoolean = exports.ZodBigInt = exports.ZodNumber = exports.ZodString = exports.ZodType = void 0;\nexports.NEVER = exports.void = exports.unknown = exports.union = exports.undefined = exports.tuple = exports.transformer = exports.symbol = exports.string = exports.strictObject = exports.set = exports.record = exports.promise = exports.preprocess = exports.pipeline = exports.ostring = exports.optional = exports.onumber = exports.oboolean = exports.object = exports.number = exports.nullable = exports.null = exports.never = exports.nativeEnum = exports.nan = exports.map = exports.literal = exports.lazy = exports.intersection = exports.instanceof = exports.function = exports.enum = exports.effect = void 0;\nconst errors_1 = require(\"./errors\");\nconst errorUtil_1 = require(\"./helpers/errorUtil\");\nconst parseUtil_1 = require(\"./helpers/parseUtil\");\nconst util_1 = require(\"./helpers/util\");\nconst ZodError_1 = require(\"./ZodError\");\nclass ParseInputLazyPath {\n constructor(parent, value, path, key) {\n this._cachedPath = [];\n this.parent = parent;\n this.data = value;\n this._path = path;\n this._key = key;\n }\n get path() {\n if (!this._cachedPath.length) {\n if (this._key instanceof Array) {\n this._cachedPath.push(...this._path, ...this._key);\n }\n else {\n this._cachedPath.push(...this._path, this._key);\n }\n }\n return this._cachedPath;\n }\n}\nconst handleResult = (ctx, result) => {\n if ((0, parseUtil_1.isValid)(result)) {\n return { success: true, data: result.value };\n }\n else {\n if (!ctx.common.issues.length) {\n throw new Error(\"Validation failed but no issues detected.\");\n }\n return {\n success: false,\n get error() {\n if (this._error)\n return this._error;\n const error = new ZodError_1.ZodError(ctx.common.issues);\n this._error = error;\n return this._error;\n },\n };\n }\n};\nfunction processCreateParams(params) {\n if (!params)\n return {};\n const { errorMap, invalid_type_error, required_error, description } = params;\n if (errorMap && (invalid_type_error || required_error)) {\n throw new Error(`Can't use \"invalid_type_error\" or \"required_error\" in conjunction with custom error map.`);\n }\n if (errorMap)\n return { errorMap: errorMap, description };\n const customMap = (iss, ctx) => {\n if (iss.code !== \"invalid_type\")\n return { message: ctx.defaultError };\n if (typeof ctx.data === \"undefined\") {\n return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };\n }\n return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };\n };\n return { errorMap: customMap, description };\n}\nclass ZodType {\n constructor(def) {\n this.spa = this.safeParseAsync;\n this._def = def;\n this.parse = this.parse.bind(this);\n this.safeParse = this.safeParse.bind(this);\n this.parseAsync = this.parseAsync.bind(this);\n this.safeParseAsync = this.safeParseAsync.bind(this);\n this.spa = this.spa.bind(this);\n this.refine = this.refine.bind(this);\n this.refinement = this.refinement.bind(this);\n this.superRefine = this.superRefine.bind(this);\n this.optional = this.optional.bind(this);\n this.nullable = this.nullable.bind(this);\n this.nullish = this.nullish.bind(this);\n this.array = this.array.bind(this);\n this.promise = this.promise.bind(this);\n this.or = this.or.bind(this);\n this.and = this.and.bind(this);\n this.transform = this.transform.bind(this);\n this.brand = this.brand.bind(this);\n this.default = this.default.bind(this);\n this.catch = this.catch.bind(this);\n this.describe = this.describe.bind(this);\n this.pipe = this.pipe.bind(this);\n this.isNullable = this.isNullable.bind(this);\n this.isOptional = this.isOptional.bind(this);\n }\n get description() {\n return this._def.description;\n }\n _getType(input) {\n return (0, util_1.getParsedType)(input.data);\n }\n _getOrReturnCtx(input, ctx) {\n return (ctx || {\n common: input.parent.common,\n data: input.data,\n parsedType: (0, util_1.getParsedType)(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n });\n }\n _processInputParams(input) {\n return {\n status: new parseUtil_1.ParseStatus(),\n ctx: {\n common: input.parent.common,\n data: input.data,\n parsedType: (0, util_1.getParsedType)(input.data),\n schemaErrorMap: this._def.errorMap,\n path: input.path,\n parent: input.parent,\n },\n };\n }\n _parseSync(input) {\n const result = this._parse(input);\n if ((0, parseUtil_1.isAsync)(result)) {\n throw new Error(\"Synchronous parse encountered promise.\");\n }\n return result;\n }\n _parseAsync(input) {\n const result = this._parse(input);\n return Promise.resolve(result);\n }\n parse(data, params) {\n const result = this.safeParse(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n safeParse(data, params) {\n var _a;\n const ctx = {\n common: {\n issues: [],\n async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: (0, util_1.getParsedType)(data),\n };\n const result = this._parseSync({ data, path: ctx.path, parent: ctx });\n return handleResult(ctx, result);\n }\n async parseAsync(data, params) {\n const result = await this.safeParseAsync(data, params);\n if (result.success)\n return result.data;\n throw result.error;\n }\n async safeParseAsync(data, params) {\n const ctx = {\n common: {\n issues: [],\n contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,\n async: true,\n },\n path: (params === null || params === void 0 ? void 0 : params.path) || [],\n schemaErrorMap: this._def.errorMap,\n parent: null,\n data,\n parsedType: (0, util_1.getParsedType)(data),\n };\n const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });\n const result = await ((0, parseUtil_1.isAsync)(maybeAsyncResult)\n ? maybeAsyncResult\n : Promise.resolve(maybeAsyncResult));\n return handleResult(ctx, result);\n }\n refine(check, message) {\n const getIssueProperties = (val) => {\n if (typeof message === \"string\" || typeof message === \"undefined\") {\n return { message };\n }\n else if (typeof message === \"function\") {\n return message(val);\n }\n else {\n return message;\n }\n };\n return this._refinement((val, ctx) => {\n const result = check(val);\n const setError = () => ctx.addIssue({\n code: ZodError_1.ZodIssueCode.custom,\n ...getIssueProperties(val),\n });\n if (typeof Promise !== \"undefined\" && result instanceof Promise) {\n return result.then((data) => {\n if (!data) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n if (!result) {\n setError();\n return false;\n }\n else {\n return true;\n }\n });\n }\n refinement(check, refinementData) {\n return this._refinement((val, ctx) => {\n if (!check(val)) {\n ctx.addIssue(typeof refinementData === \"function\"\n ? refinementData(val, ctx)\n : refinementData);\n return false;\n }\n else {\n return true;\n }\n });\n }\n _refinement(refinement) {\n return new ZodEffects({\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"refinement\", refinement },\n });\n }\n superRefine(refinement) {\n return this._refinement(refinement);\n }\n optional() {\n return ZodOptional.create(this, this._def);\n }\n nullable() {\n return ZodNullable.create(this, this._def);\n }\n nullish() {\n return this.nullable().optional();\n }\n array() {\n return ZodArray.create(this, this._def);\n }\n promise() {\n return ZodPromise.create(this, this._def);\n }\n or(option) {\n return ZodUnion.create([this, option], this._def);\n }\n and(incoming) {\n return ZodIntersection.create(this, incoming, this._def);\n }\n transform(transform) {\n return new ZodEffects({\n ...processCreateParams(this._def),\n schema: this,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect: { type: \"transform\", transform },\n });\n }\n default(def) {\n const defaultValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodDefault({\n ...processCreateParams(this._def),\n innerType: this,\n defaultValue: defaultValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n });\n }\n brand() {\n return new ZodBranded({\n typeName: ZodFirstPartyTypeKind.ZodBranded,\n type: this,\n ...processCreateParams(this._def),\n });\n }\n catch(def) {\n const catchValueFunc = typeof def === \"function\" ? def : () => def;\n return new ZodCatch({\n ...processCreateParams(this._def),\n innerType: this,\n catchValue: catchValueFunc,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n });\n }\n describe(description) {\n const This = this.constructor;\n return new This({\n ...this._def,\n description,\n });\n }\n pipe(target) {\n return ZodPipeline.create(this, target);\n }\n isOptional() {\n return this.safeParse(undefined).success;\n }\n isNullable() {\n return this.safeParse(null).success;\n }\n}\nexports.ZodType = ZodType;\nexports.Schema = ZodType;\nexports.ZodSchema = ZodType;\nconst cuidRegex = /^c[^\\s-]{8,}$/i;\nconst cuid2Regex = /^[a-z][a-z0-9]*$/;\nconst ulidRegex = /[0-9A-HJKMNP-TV-Z]{26}/;\nconst uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;\nconst emailRegex = /^(([^<>()[\\]\\\\.,;:\\s@\\\"]+(\\.[^<>()[\\]\\\\.,;:\\s@\\\"]+)*)|(\\\".+\\\"))@((\\[(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\])|(\\[IPv6:(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))\\])|([A-Za-z0-9]([A-Za-z0-9-]*[A-Za-z0-9])*(\\.[A-Za-z]{2,})+))$/;\nconst emojiRegex = /^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$/u;\nconst ipv4Regex = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;\nconst ipv6Regex = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;\nconst datetimeRegex = (args) => {\n if (args.precision) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}\\\\.\\\\d{${args.precision}}Z$`);\n }\n }\n else if (args.precision === 0) {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}Z$`);\n }\n }\n else {\n if (args.offset) {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?(([+-]\\\\d{2}(:?\\\\d{2})?)|Z)$`);\n }\n else {\n return new RegExp(`^\\\\d{4}-\\\\d{2}-\\\\d{2}T\\\\d{2}:\\\\d{2}:\\\\d{2}(\\\\.\\\\d+)?Z$`);\n }\n }\n};\nfunction isValidIP(ip, version) {\n if ((version === \"v4\" || !version) && ipv4Regex.test(ip)) {\n return true;\n }\n if ((version === \"v6\" || !version) && ipv6Regex.test(ip)) {\n return true;\n }\n return false;\n}\nclass ZodString extends ZodType {\n constructor() {\n super(...arguments);\n this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {\n validation,\n code: ZodError_1.ZodIssueCode.invalid_string,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n this.nonempty = (message) => this.min(1, errorUtil_1.errorUtil.errToObj(message));\n this.trim = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"trim\" }],\n });\n this.toLowerCase = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toLowerCase\" }],\n });\n this.toUpperCase = () => new ZodString({\n ...this._def,\n checks: [...this._def.checks, { kind: \"toUpperCase\" }],\n });\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = String(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.string) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.string,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const status = new parseUtil_1.ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.length < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.length > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"length\") {\n const tooBig = input.data.length > check.value;\n const tooSmall = input.data.length < check.value;\n if (tooBig || tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n if (tooBig) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n else if (tooSmall) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: check.value,\n type: \"string\",\n inclusive: true,\n exact: true,\n message: check.message,\n });\n }\n status.dirty();\n }\n }\n else if (check.kind === \"email\") {\n if (!emailRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"email\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"emoji\") {\n if (!emojiRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"emoji\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"uuid\") {\n if (!uuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"uuid\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid\") {\n if (!cuidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"cuid\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"cuid2\") {\n if (!cuid2Regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"cuid2\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ulid\") {\n if (!ulidRegex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"ulid\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"url\") {\n try {\n new URL(input.data);\n }\n catch (_a) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"url\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"regex\") {\n check.regex.lastIndex = 0;\n const testResult = check.regex.test(input.data);\n if (!testResult) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"regex\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"trim\") {\n input.data = input.data.trim();\n }\n else if (check.kind === \"includes\") {\n if (!input.data.includes(check.value, check.position)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_string,\n validation: { includes: check.value, position: check.position },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"toLowerCase\") {\n input.data = input.data.toLowerCase();\n }\n else if (check.kind === \"toUpperCase\") {\n input.data = input.data.toUpperCase();\n }\n else if (check.kind === \"startsWith\") {\n if (!input.data.startsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_string,\n validation: { startsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"endsWith\") {\n if (!input.data.endsWith(check.value)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_string,\n validation: { endsWith: check.value },\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"datetime\") {\n const regex = datetimeRegex(check);\n if (!regex.test(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_string,\n validation: \"datetime\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"ip\") {\n if (!isValidIP(input.data, check.version)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n validation: \"ip\",\n code: ZodError_1.ZodIssueCode.invalid_string,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util_1.util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n _addCheck(check) {\n return new ZodString({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n email(message) {\n return this._addCheck({ kind: \"email\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n url(message) {\n return this._addCheck({ kind: \"url\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n emoji(message) {\n return this._addCheck({ kind: \"emoji\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n uuid(message) {\n return this._addCheck({ kind: \"uuid\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n cuid(message) {\n return this._addCheck({ kind: \"cuid\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n cuid2(message) {\n return this._addCheck({ kind: \"cuid2\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n ulid(message) {\n return this._addCheck({ kind: \"ulid\", ...errorUtil_1.errorUtil.errToObj(message) });\n }\n ip(options) {\n return this._addCheck({ kind: \"ip\", ...errorUtil_1.errorUtil.errToObj(options) });\n }\n datetime(options) {\n var _a;\n if (typeof options === \"string\") {\n return this._addCheck({\n kind: \"datetime\",\n precision: null,\n offset: false,\n message: options,\n });\n }\n return this._addCheck({\n kind: \"datetime\",\n precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === \"undefined\" ? null : options === null || options === void 0 ? void 0 : options.precision,\n offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,\n ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n regex(regex, message) {\n return this._addCheck({\n kind: \"regex\",\n regex: regex,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n includes(value, options) {\n return this._addCheck({\n kind: \"includes\",\n value: value,\n position: options === null || options === void 0 ? void 0 : options.position,\n ...errorUtil_1.errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message),\n });\n }\n startsWith(value, message) {\n return this._addCheck({\n kind: \"startsWith\",\n value: value,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n endsWith(value, message) {\n return this._addCheck({\n kind: \"endsWith\",\n value: value,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n min(minLength, message) {\n return this._addCheck({\n kind: \"min\",\n value: minLength,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n max(maxLength, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxLength,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n length(len, message) {\n return this._addCheck({\n kind: \"length\",\n value: len,\n ...errorUtil_1.errorUtil.errToObj(message),\n });\n }\n get isDatetime() {\n return !!this._def.checks.find((ch) => ch.kind === \"datetime\");\n }\n get isEmail() {\n return !!this._def.checks.find((ch) => ch.kind === \"email\");\n }\n get isURL() {\n return !!this._def.checks.find((ch) => ch.kind === \"url\");\n }\n get isEmoji() {\n return !!this._def.checks.find((ch) => ch.kind === \"emoji\");\n }\n get isUUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"uuid\");\n }\n get isCUID() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid\");\n }\n get isCUID2() {\n return !!this._def.checks.find((ch) => ch.kind === \"cuid2\");\n }\n get isULID() {\n return !!this._def.checks.find((ch) => ch.kind === \"ulid\");\n }\n get isIP() {\n return !!this._def.checks.find((ch) => ch.kind === \"ip\");\n }\n get minLength() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxLength() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nexports.ZodString = ZodString;\nZodString.create = (params) => {\n var _a;\n return new ZodString({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodString,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\nfunction floatSafeRemainder(val, step) {\n const valDecCount = (val.toString().split(\".\")[1] || \"\").length;\n const stepDecCount = (step.toString().split(\".\")[1] || \"\").length;\n const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;\n const valInt = parseInt(val.toFixed(decCount).replace(\".\", \"\"));\n const stepInt = parseInt(step.toFixed(decCount).replace(\".\", \"\"));\n return (valInt % stepInt) / Math.pow(10, decCount);\n}\nclass ZodNumber extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n this.step = this.multipleOf;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = Number(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.number) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.number,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n let ctx = undefined;\n const status = new parseUtil_1.ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"int\") {\n if (!util_1.util.isInteger(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: \"integer\",\n received: \"float\",\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: check.value,\n type: \"number\",\n inclusive: check.inclusive,\n exact: false,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (floatSafeRemainder(input.data, check.value) !== 0) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"finite\") {\n if (!Number.isFinite(input.data)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.not_finite,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util_1.util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil_1.errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil_1.errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil_1.errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil_1.errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodNumber({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil_1.errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodNumber({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n int(message) {\n return this._addCheck({\n kind: \"int\",\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: false,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: false,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: 0,\n inclusive: true,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: 0,\n inclusive: true,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value: value,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n finite(message) {\n return this._addCheck({\n kind: \"finite\",\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n safe(message) {\n return this._addCheck({\n kind: \"min\",\n inclusive: true,\n value: Number.MIN_SAFE_INTEGER,\n message: errorUtil_1.errorUtil.toString(message),\n })._addCheck({\n kind: \"max\",\n inclusive: true,\n value: Number.MAX_SAFE_INTEGER,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n get isInt() {\n return !!this._def.checks.find((ch) => ch.kind === \"int\" ||\n (ch.kind === \"multipleOf\" && util_1.util.isInteger(ch.value)));\n }\n get isFinite() {\n let max = null, min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"finite\" ||\n ch.kind === \"int\" ||\n ch.kind === \"multipleOf\") {\n return true;\n }\n else if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n else if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return Number.isFinite(min) && Number.isFinite(max);\n }\n}\nexports.ZodNumber = ZodNumber;\nZodNumber.create = (params) => {\n return new ZodNumber({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodNumber,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodBigInt extends ZodType {\n constructor() {\n super(...arguments);\n this.min = this.gte;\n this.max = this.lte;\n }\n _parse(input) {\n if (this._def.coerce) {\n input.data = BigInt(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.bigint) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.bigint,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n let ctx = undefined;\n const status = new parseUtil_1.ParseStatus();\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n const tooSmall = check.inclusive\n ? input.data < check.value\n : input.data <= check.value;\n if (tooSmall) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n type: \"bigint\",\n minimum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n const tooBig = check.inclusive\n ? input.data > check.value\n : input.data >= check.value;\n if (tooBig) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n type: \"bigint\",\n maximum: check.value,\n inclusive: check.inclusive,\n message: check.message,\n });\n status.dirty();\n }\n }\n else if (check.kind === \"multipleOf\") {\n if (input.data % check.value !== BigInt(0)) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.not_multiple_of,\n multipleOf: check.value,\n message: check.message,\n });\n status.dirty();\n }\n }\n else {\n util_1.util.assertNever(check);\n }\n }\n return { status: status.value, value: input.data };\n }\n gte(value, message) {\n return this.setLimit(\"min\", value, true, errorUtil_1.errorUtil.toString(message));\n }\n gt(value, message) {\n return this.setLimit(\"min\", value, false, errorUtil_1.errorUtil.toString(message));\n }\n lte(value, message) {\n return this.setLimit(\"max\", value, true, errorUtil_1.errorUtil.toString(message));\n }\n lt(value, message) {\n return this.setLimit(\"max\", value, false, errorUtil_1.errorUtil.toString(message));\n }\n setLimit(kind, value, inclusive, message) {\n return new ZodBigInt({\n ...this._def,\n checks: [\n ...this._def.checks,\n {\n kind,\n value,\n inclusive,\n message: errorUtil_1.errorUtil.toString(message),\n },\n ],\n });\n }\n _addCheck(check) {\n return new ZodBigInt({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n positive(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n negative(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: false,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n nonpositive(message) {\n return this._addCheck({\n kind: \"max\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n nonnegative(message) {\n return this._addCheck({\n kind: \"min\",\n value: BigInt(0),\n inclusive: true,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n multipleOf(value, message) {\n return this._addCheck({\n kind: \"multipleOf\",\n value,\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n get minValue() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min;\n }\n get maxValue() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max;\n }\n}\nexports.ZodBigInt = ZodBigInt;\nZodBigInt.create = (params) => {\n var _a;\n return new ZodBigInt({\n checks: [],\n typeName: ZodFirstPartyTypeKind.ZodBigInt,\n coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,\n ...processCreateParams(params),\n });\n};\nclass ZodBoolean extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = Boolean(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.boolean) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.boolean,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodBoolean = ZodBoolean;\nZodBoolean.create = (params) => {\n return new ZodBoolean({\n typeName: ZodFirstPartyTypeKind.ZodBoolean,\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n ...processCreateParams(params),\n });\n};\nclass ZodDate extends ZodType {\n _parse(input) {\n if (this._def.coerce) {\n input.data = new Date(input.data);\n }\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.date) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.date,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n if (isNaN(input.data.getTime())) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_date,\n });\n return parseUtil_1.INVALID;\n }\n const status = new parseUtil_1.ParseStatus();\n let ctx = undefined;\n for (const check of this._def.checks) {\n if (check.kind === \"min\") {\n if (input.data.getTime() < check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n message: check.message,\n inclusive: true,\n exact: false,\n minimum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else if (check.kind === \"max\") {\n if (input.data.getTime() > check.value) {\n ctx = this._getOrReturnCtx(input, ctx);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n message: check.message,\n inclusive: true,\n exact: false,\n maximum: check.value,\n type: \"date\",\n });\n status.dirty();\n }\n }\n else {\n util_1.util.assertNever(check);\n }\n }\n return {\n status: status.value,\n value: new Date(input.data.getTime()),\n };\n }\n _addCheck(check) {\n return new ZodDate({\n ...this._def,\n checks: [...this._def.checks, check],\n });\n }\n min(minDate, message) {\n return this._addCheck({\n kind: \"min\",\n value: minDate.getTime(),\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n max(maxDate, message) {\n return this._addCheck({\n kind: \"max\",\n value: maxDate.getTime(),\n message: errorUtil_1.errorUtil.toString(message),\n });\n }\n get minDate() {\n let min = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"min\") {\n if (min === null || ch.value > min)\n min = ch.value;\n }\n }\n return min != null ? new Date(min) : null;\n }\n get maxDate() {\n let max = null;\n for (const ch of this._def.checks) {\n if (ch.kind === \"max\") {\n if (max === null || ch.value < max)\n max = ch.value;\n }\n }\n return max != null ? new Date(max) : null;\n }\n}\nexports.ZodDate = ZodDate;\nZodDate.create = (params) => {\n return new ZodDate({\n checks: [],\n coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,\n typeName: ZodFirstPartyTypeKind.ZodDate,\n ...processCreateParams(params),\n });\n};\nclass ZodSymbol extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.symbol) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.symbol,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodSymbol = ZodSymbol;\nZodSymbol.create = (params) => {\n return new ZodSymbol({\n typeName: ZodFirstPartyTypeKind.ZodSymbol,\n ...processCreateParams(params),\n });\n};\nclass ZodUndefined extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.undefined,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodUndefined = ZodUndefined;\nZodUndefined.create = (params) => {\n return new ZodUndefined({\n typeName: ZodFirstPartyTypeKind.ZodUndefined,\n ...processCreateParams(params),\n });\n};\nclass ZodNull extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.null) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.null,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodNull = ZodNull;\nZodNull.create = (params) => {\n return new ZodNull({\n typeName: ZodFirstPartyTypeKind.ZodNull,\n ...processCreateParams(params),\n });\n};\nclass ZodAny extends ZodType {\n constructor() {\n super(...arguments);\n this._any = true;\n }\n _parse(input) {\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodAny = ZodAny;\nZodAny.create = (params) => {\n return new ZodAny({\n typeName: ZodFirstPartyTypeKind.ZodAny,\n ...processCreateParams(params),\n });\n};\nclass ZodUnknown extends ZodType {\n constructor() {\n super(...arguments);\n this._unknown = true;\n }\n _parse(input) {\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodUnknown = ZodUnknown;\nZodUnknown.create = (params) => {\n return new ZodUnknown({\n typeName: ZodFirstPartyTypeKind.ZodUnknown,\n ...processCreateParams(params),\n });\n};\nclass ZodNever extends ZodType {\n _parse(input) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.never,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n}\nexports.ZodNever = ZodNever;\nZodNever.create = (params) => {\n return new ZodNever({\n typeName: ZodFirstPartyTypeKind.ZodNever,\n ...processCreateParams(params),\n });\n};\nclass ZodVoid extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.undefined) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.void,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n}\nexports.ZodVoid = ZodVoid;\nZodVoid.create = (params) => {\n return new ZodVoid({\n typeName: ZodFirstPartyTypeKind.ZodVoid,\n ...processCreateParams(params),\n });\n};\nclass ZodArray extends ZodType {\n _parse(input) {\n const { ctx, status } = this._processInputParams(input);\n const def = this._def;\n if (ctx.parsedType !== util_1.ZodParsedType.array) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.array,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n if (def.exactLength !== null) {\n const tooBig = ctx.data.length > def.exactLength.value;\n const tooSmall = ctx.data.length < def.exactLength.value;\n if (tooBig || tooSmall) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: tooBig ? ZodError_1.ZodIssueCode.too_big : ZodError_1.ZodIssueCode.too_small,\n minimum: (tooSmall ? def.exactLength.value : undefined),\n maximum: (tooBig ? def.exactLength.value : undefined),\n type: \"array\",\n inclusive: true,\n exact: true,\n message: def.exactLength.message,\n });\n status.dirty();\n }\n }\n if (def.minLength !== null) {\n if (ctx.data.length < def.minLength.value) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: def.minLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.minLength.message,\n });\n status.dirty();\n }\n }\n if (def.maxLength !== null) {\n if (ctx.data.length > def.maxLength.value) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: def.maxLength.value,\n type: \"array\",\n inclusive: true,\n exact: false,\n message: def.maxLength.message,\n });\n status.dirty();\n }\n }\n if (ctx.common.async) {\n return Promise.all([...ctx.data].map((item, i) => {\n return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n })).then((result) => {\n return parseUtil_1.ParseStatus.mergeArray(status, result);\n });\n }\n const result = [...ctx.data].map((item, i) => {\n return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));\n });\n return parseUtil_1.ParseStatus.mergeArray(status, result);\n }\n get element() {\n return this._def.type;\n }\n min(minLength, message) {\n return new ZodArray({\n ...this._def,\n minLength: { value: minLength, message: errorUtil_1.errorUtil.toString(message) },\n });\n }\n max(maxLength, message) {\n return new ZodArray({\n ...this._def,\n maxLength: { value: maxLength, message: errorUtil_1.errorUtil.toString(message) },\n });\n }\n length(len, message) {\n return new ZodArray({\n ...this._def,\n exactLength: { value: len, message: errorUtil_1.errorUtil.toString(message) },\n });\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nexports.ZodArray = ZodArray;\nZodArray.create = (schema, params) => {\n return new ZodArray({\n type: schema,\n minLength: null,\n maxLength: null,\n exactLength: null,\n typeName: ZodFirstPartyTypeKind.ZodArray,\n ...processCreateParams(params),\n });\n};\nfunction deepPartialify(schema) {\n if (schema instanceof ZodObject) {\n const newShape = {};\n for (const key in schema.shape) {\n const fieldSchema = schema.shape[key];\n newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));\n }\n return new ZodObject({\n ...schema._def,\n shape: () => newShape,\n });\n }\n else if (schema instanceof ZodArray) {\n return new ZodArray({\n ...schema._def,\n type: deepPartialify(schema.element),\n });\n }\n else if (schema instanceof ZodOptional) {\n return ZodOptional.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodNullable) {\n return ZodNullable.create(deepPartialify(schema.unwrap()));\n }\n else if (schema instanceof ZodTuple) {\n return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));\n }\n else {\n return schema;\n }\n}\nclass ZodObject extends ZodType {\n constructor() {\n super(...arguments);\n this._cached = null;\n this.nonstrict = this.passthrough;\n this.augment = this.extend;\n }\n _getCached() {\n if (this._cached !== null)\n return this._cached;\n const shape = this._def.shape();\n const keys = util_1.util.objectKeys(shape);\n return (this._cached = { shape, keys });\n }\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.object) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.object,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const { status, ctx } = this._processInputParams(input);\n const { shape, keys: shapeKeys } = this._getCached();\n const extraKeys = [];\n if (!(this._def.catchall instanceof ZodNever &&\n this._def.unknownKeys === \"strip\")) {\n for (const key in ctx.data) {\n if (!shapeKeys.includes(key)) {\n extraKeys.push(key);\n }\n }\n }\n const pairs = [];\n for (const key of shapeKeys) {\n const keyValidator = shape[key];\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n if (this._def.catchall instanceof ZodNever) {\n const unknownKeys = this._def.unknownKeys;\n if (unknownKeys === \"passthrough\") {\n for (const key of extraKeys) {\n pairs.push({\n key: { status: \"valid\", value: key },\n value: { status: \"valid\", value: ctx.data[key] },\n });\n }\n }\n else if (unknownKeys === \"strict\") {\n if (extraKeys.length > 0) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.unrecognized_keys,\n keys: extraKeys,\n });\n status.dirty();\n }\n }\n else if (unknownKeys === \"strip\") {\n }\n else {\n throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);\n }\n }\n else {\n const catchall = this._def.catchall;\n for (const key of extraKeys) {\n const value = ctx.data[key];\n pairs.push({\n key: { status: \"valid\", value: key },\n value: catchall._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),\n alwaysSet: key in ctx.data,\n });\n }\n }\n if (ctx.common.async) {\n return Promise.resolve()\n .then(async () => {\n const syncPairs = [];\n for (const pair of pairs) {\n const key = await pair.key;\n syncPairs.push({\n key,\n value: await pair.value,\n alwaysSet: pair.alwaysSet,\n });\n }\n return syncPairs;\n })\n .then((syncPairs) => {\n return parseUtil_1.ParseStatus.mergeObjectSync(status, syncPairs);\n });\n }\n else {\n return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get shape() {\n return this._def.shape();\n }\n strict(message) {\n errorUtil_1.errorUtil.errToObj;\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strict\",\n ...(message !== undefined\n ? {\n errorMap: (issue, ctx) => {\n var _a, _b, _c, _d;\n const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;\n if (issue.code === \"unrecognized_keys\")\n return {\n message: (_d = errorUtil_1.errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError,\n };\n return {\n message: defaultError,\n };\n },\n }\n : {}),\n });\n }\n strip() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"strip\",\n });\n }\n passthrough() {\n return new ZodObject({\n ...this._def,\n unknownKeys: \"passthrough\",\n });\n }\n extend(augmentation) {\n return new ZodObject({\n ...this._def,\n shape: () => ({\n ...this._def.shape(),\n ...augmentation,\n }),\n });\n }\n merge(merging) {\n const merged = new ZodObject({\n unknownKeys: merging._def.unknownKeys,\n catchall: merging._def.catchall,\n shape: () => ({\n ...this._def.shape(),\n ...merging._def.shape(),\n }),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n });\n return merged;\n }\n setKey(key, schema) {\n return this.augment({ [key]: schema });\n }\n catchall(index) {\n return new ZodObject({\n ...this._def,\n catchall: index,\n });\n }\n pick(mask) {\n const shape = {};\n util_1.util.objectKeys(mask).forEach((key) => {\n if (mask[key] && this.shape[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n omit(mask) {\n const shape = {};\n util_1.util.objectKeys(this.shape).forEach((key) => {\n if (!mask[key]) {\n shape[key] = this.shape[key];\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => shape,\n });\n }\n deepPartial() {\n return deepPartialify(this);\n }\n partial(mask) {\n const newShape = {};\n util_1.util.objectKeys(this.shape).forEach((key) => {\n const fieldSchema = this.shape[key];\n if (mask && !mask[key]) {\n newShape[key] = fieldSchema;\n }\n else {\n newShape[key] = fieldSchema.optional();\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n required(mask) {\n const newShape = {};\n util_1.util.objectKeys(this.shape).forEach((key) => {\n if (mask && !mask[key]) {\n newShape[key] = this.shape[key];\n }\n else {\n const fieldSchema = this.shape[key];\n let newField = fieldSchema;\n while (newField instanceof ZodOptional) {\n newField = newField._def.innerType;\n }\n newShape[key] = newField;\n }\n });\n return new ZodObject({\n ...this._def,\n shape: () => newShape,\n });\n }\n keyof() {\n return createZodEnum(util_1.util.objectKeys(this.shape));\n }\n}\nexports.ZodObject = ZodObject;\nZodObject.create = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.strictCreate = (shape, params) => {\n return new ZodObject({\n shape: () => shape,\n unknownKeys: \"strict\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nZodObject.lazycreate = (shape, params) => {\n return new ZodObject({\n shape,\n unknownKeys: \"strip\",\n catchall: ZodNever.create(),\n typeName: ZodFirstPartyTypeKind.ZodObject,\n ...processCreateParams(params),\n });\n};\nclass ZodUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const options = this._def.options;\n function handleResults(results) {\n for (const result of results) {\n if (result.result.status === \"valid\") {\n return result.result;\n }\n }\n for (const result of results) {\n if (result.result.status === \"dirty\") {\n ctx.common.issues.push(...result.ctx.common.issues);\n return result.result;\n }\n }\n const unionErrors = results.map((result) => new ZodError_1.ZodError(result.ctx.common.issues));\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_union,\n unionErrors,\n });\n return parseUtil_1.INVALID;\n }\n if (ctx.common.async) {\n return Promise.all(options.map(async (option) => {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n return {\n result: await option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n }),\n ctx: childCtx,\n };\n })).then(handleResults);\n }\n else {\n let dirty = undefined;\n const issues = [];\n for (const option of options) {\n const childCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n parent: null,\n };\n const result = option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: childCtx,\n });\n if (result.status === \"valid\") {\n return result;\n }\n else if (result.status === \"dirty\" && !dirty) {\n dirty = { result, ctx: childCtx };\n }\n if (childCtx.common.issues.length) {\n issues.push(childCtx.common.issues);\n }\n }\n if (dirty) {\n ctx.common.issues.push(...dirty.ctx.common.issues);\n return dirty.result;\n }\n const unionErrors = issues.map((issues) => new ZodError_1.ZodError(issues));\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_union,\n unionErrors,\n });\n return parseUtil_1.INVALID;\n }\n }\n get options() {\n return this._def.options;\n }\n}\nexports.ZodUnion = ZodUnion;\nZodUnion.create = (types, params) => {\n return new ZodUnion({\n options: types,\n typeName: ZodFirstPartyTypeKind.ZodUnion,\n ...processCreateParams(params),\n });\n};\nconst getDiscriminator = (type) => {\n if (type instanceof ZodLazy) {\n return getDiscriminator(type.schema);\n }\n else if (type instanceof ZodEffects) {\n return getDiscriminator(type.innerType());\n }\n else if (type instanceof ZodLiteral) {\n return [type.value];\n }\n else if (type instanceof ZodEnum) {\n return type.options;\n }\n else if (type instanceof ZodNativeEnum) {\n return Object.keys(type.enum);\n }\n else if (type instanceof ZodDefault) {\n return getDiscriminator(type._def.innerType);\n }\n else if (type instanceof ZodUndefined) {\n return [undefined];\n }\n else if (type instanceof ZodNull) {\n return [null];\n }\n else {\n return null;\n }\n};\nclass ZodDiscriminatedUnion extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.object) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.object,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const discriminator = this.discriminator;\n const discriminatorValue = ctx.data[discriminator];\n const option = this.optionsMap.get(discriminatorValue);\n if (!option) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_union_discriminator,\n options: Array.from(this.optionsMap.keys()),\n path: [discriminator],\n });\n return parseUtil_1.INVALID;\n }\n if (ctx.common.async) {\n return option._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n else {\n return option._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n get discriminator() {\n return this._def.discriminator;\n }\n get options() {\n return this._def.options;\n }\n get optionsMap() {\n return this._def.optionsMap;\n }\n static create(discriminator, options, params) {\n const optionsMap = new Map();\n for (const type of options) {\n const discriminatorValues = getDiscriminator(type.shape[discriminator]);\n if (!discriminatorValues) {\n throw new Error(`A discriminator value for key \\`${discriminator}\\` could not be extracted from all schema options`);\n }\n for (const value of discriminatorValues) {\n if (optionsMap.has(value)) {\n throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);\n }\n optionsMap.set(value, type);\n }\n }\n return new ZodDiscriminatedUnion({\n typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,\n discriminator,\n options,\n optionsMap,\n ...processCreateParams(params),\n });\n }\n}\nexports.ZodDiscriminatedUnion = ZodDiscriminatedUnion;\nfunction mergeValues(a, b) {\n const aType = (0, util_1.getParsedType)(a);\n const bType = (0, util_1.getParsedType)(b);\n if (a === b) {\n return { valid: true, data: a };\n }\n else if (aType === util_1.ZodParsedType.object && bType === util_1.ZodParsedType.object) {\n const bKeys = util_1.util.objectKeys(b);\n const sharedKeys = util_1.util\n .objectKeys(a)\n .filter((key) => bKeys.indexOf(key) !== -1);\n const newObj = { ...a, ...b };\n for (const key of sharedKeys) {\n const sharedValue = mergeValues(a[key], b[key]);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newObj[key] = sharedValue.data;\n }\n return { valid: true, data: newObj };\n }\n else if (aType === util_1.ZodParsedType.array && bType === util_1.ZodParsedType.array) {\n if (a.length !== b.length) {\n return { valid: false };\n }\n const newArray = [];\n for (let index = 0; index < a.length; index++) {\n const itemA = a[index];\n const itemB = b[index];\n const sharedValue = mergeValues(itemA, itemB);\n if (!sharedValue.valid) {\n return { valid: false };\n }\n newArray.push(sharedValue.data);\n }\n return { valid: true, data: newArray };\n }\n else if (aType === util_1.ZodParsedType.date &&\n bType === util_1.ZodParsedType.date &&\n +a === +b) {\n return { valid: true, data: a };\n }\n else {\n return { valid: false };\n }\n}\nclass ZodIntersection extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const handleParsed = (parsedLeft, parsedRight) => {\n if ((0, parseUtil_1.isAborted)(parsedLeft) || (0, parseUtil_1.isAborted)(parsedRight)) {\n return parseUtil_1.INVALID;\n }\n const merged = mergeValues(parsedLeft.value, parsedRight.value);\n if (!merged.valid) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_intersection_types,\n });\n return parseUtil_1.INVALID;\n }\n if ((0, parseUtil_1.isDirty)(parsedLeft) || (0, parseUtil_1.isDirty)(parsedRight)) {\n status.dirty();\n }\n return { status: status.value, value: merged.data };\n };\n if (ctx.common.async) {\n return Promise.all([\n this._def.left._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n this._def.right._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }),\n ]).then(([left, right]) => handleParsed(left, right));\n }\n else {\n return handleParsed(this._def.left._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }), this._def.right._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n }));\n }\n }\n}\nexports.ZodIntersection = ZodIntersection;\nZodIntersection.create = (left, right, params) => {\n return new ZodIntersection({\n left: left,\n right: right,\n typeName: ZodFirstPartyTypeKind.ZodIntersection,\n ...processCreateParams(params),\n });\n};\nclass ZodTuple extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.array) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.array,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n if (ctx.data.length < this._def.items.length) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n return parseUtil_1.INVALID;\n }\n const rest = this._def.rest;\n if (!rest && ctx.data.length > this._def.items.length) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: this._def.items.length,\n inclusive: true,\n exact: false,\n type: \"array\",\n });\n status.dirty();\n }\n const items = [...ctx.data]\n .map((item, itemIndex) => {\n const schema = this._def.items[itemIndex] || this._def.rest;\n if (!schema)\n return null;\n return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));\n })\n .filter((x) => !!x);\n if (ctx.common.async) {\n return Promise.all(items).then((results) => {\n return parseUtil_1.ParseStatus.mergeArray(status, results);\n });\n }\n else {\n return parseUtil_1.ParseStatus.mergeArray(status, items);\n }\n }\n get items() {\n return this._def.items;\n }\n rest(rest) {\n return new ZodTuple({\n ...this._def,\n rest,\n });\n }\n}\nexports.ZodTuple = ZodTuple;\nZodTuple.create = (schemas, params) => {\n if (!Array.isArray(schemas)) {\n throw new Error(\"You must pass an array of schemas to z.tuple([ ... ])\");\n }\n return new ZodTuple({\n items: schemas,\n typeName: ZodFirstPartyTypeKind.ZodTuple,\n rest: null,\n ...processCreateParams(params),\n });\n};\nclass ZodRecord extends ZodType {\n get keySchema() {\n return this._def.keyType;\n }\n get valueSchema() {\n return this._def.valueType;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.object) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.object,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const pairs = [];\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n for (const key in ctx.data) {\n pairs.push({\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),\n value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key)),\n });\n }\n if (ctx.common.async) {\n return parseUtil_1.ParseStatus.mergeObjectAsync(status, pairs);\n }\n else {\n return parseUtil_1.ParseStatus.mergeObjectSync(status, pairs);\n }\n }\n get element() {\n return this._def.valueType;\n }\n static create(first, second, third) {\n if (second instanceof ZodType) {\n return new ZodRecord({\n keyType: first,\n valueType: second,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(third),\n });\n }\n return new ZodRecord({\n keyType: ZodString.create(),\n valueType: first,\n typeName: ZodFirstPartyTypeKind.ZodRecord,\n ...processCreateParams(second),\n });\n }\n}\nexports.ZodRecord = ZodRecord;\nclass ZodMap extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.map) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.map,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const keyType = this._def.keyType;\n const valueType = this._def.valueType;\n const pairs = [...ctx.data.entries()].map(([key, value], index) => {\n return {\n key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, \"key\"])),\n value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, \"value\"])),\n };\n });\n if (ctx.common.async) {\n const finalMap = new Map();\n return Promise.resolve().then(async () => {\n for (const pair of pairs) {\n const key = await pair.key;\n const value = await pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return parseUtil_1.INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n });\n }\n else {\n const finalMap = new Map();\n for (const pair of pairs) {\n const key = pair.key;\n const value = pair.value;\n if (key.status === \"aborted\" || value.status === \"aborted\") {\n return parseUtil_1.INVALID;\n }\n if (key.status === \"dirty\" || value.status === \"dirty\") {\n status.dirty();\n }\n finalMap.set(key.value, value.value);\n }\n return { status: status.value, value: finalMap };\n }\n }\n}\nexports.ZodMap = ZodMap;\nZodMap.create = (keyType, valueType, params) => {\n return new ZodMap({\n valueType,\n keyType,\n typeName: ZodFirstPartyTypeKind.ZodMap,\n ...processCreateParams(params),\n });\n};\nclass ZodSet extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.set) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.set,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const def = this._def;\n if (def.minSize !== null) {\n if (ctx.data.size < def.minSize.value) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_small,\n minimum: def.minSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.minSize.message,\n });\n status.dirty();\n }\n }\n if (def.maxSize !== null) {\n if (ctx.data.size > def.maxSize.value) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.too_big,\n maximum: def.maxSize.value,\n type: \"set\",\n inclusive: true,\n exact: false,\n message: def.maxSize.message,\n });\n status.dirty();\n }\n }\n const valueType = this._def.valueType;\n function finalizeSet(elements) {\n const parsedSet = new Set();\n for (const element of elements) {\n if (element.status === \"aborted\")\n return parseUtil_1.INVALID;\n if (element.status === \"dirty\")\n status.dirty();\n parsedSet.add(element.value);\n }\n return { status: status.value, value: parsedSet };\n }\n const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));\n if (ctx.common.async) {\n return Promise.all(elements).then((elements) => finalizeSet(elements));\n }\n else {\n return finalizeSet(elements);\n }\n }\n min(minSize, message) {\n return new ZodSet({\n ...this._def,\n minSize: { value: minSize, message: errorUtil_1.errorUtil.toString(message) },\n });\n }\n max(maxSize, message) {\n return new ZodSet({\n ...this._def,\n maxSize: { value: maxSize, message: errorUtil_1.errorUtil.toString(message) },\n });\n }\n size(size, message) {\n return this.min(size, message).max(size, message);\n }\n nonempty(message) {\n return this.min(1, message);\n }\n}\nexports.ZodSet = ZodSet;\nZodSet.create = (valueType, params) => {\n return new ZodSet({\n valueType,\n minSize: null,\n maxSize: null,\n typeName: ZodFirstPartyTypeKind.ZodSet,\n ...processCreateParams(params),\n });\n};\nclass ZodFunction extends ZodType {\n constructor() {\n super(...arguments);\n this.validate = this.implement;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.function) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.function,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n function makeArgsIssue(args, error) {\n return (0, parseUtil_1.makeIssue)({\n data: args,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n (0, errors_1.getErrorMap)(),\n errors_1.defaultErrorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodError_1.ZodIssueCode.invalid_arguments,\n argumentsError: error,\n },\n });\n }\n function makeReturnsIssue(returns, error) {\n return (0, parseUtil_1.makeIssue)({\n data: returns,\n path: ctx.path,\n errorMaps: [\n ctx.common.contextualErrorMap,\n ctx.schemaErrorMap,\n (0, errors_1.getErrorMap)(),\n errors_1.defaultErrorMap,\n ].filter((x) => !!x),\n issueData: {\n code: ZodError_1.ZodIssueCode.invalid_return_type,\n returnTypeError: error,\n },\n });\n }\n const params = { errorMap: ctx.common.contextualErrorMap };\n const fn = ctx.data;\n if (this._def.returns instanceof ZodPromise) {\n return (0, parseUtil_1.OK)(async (...args) => {\n const error = new ZodError_1.ZodError([]);\n const parsedArgs = await this._def.args\n .parseAsync(args, params)\n .catch((e) => {\n error.addIssue(makeArgsIssue(args, e));\n throw error;\n });\n const result = await fn(...parsedArgs);\n const parsedReturns = await this._def.returns._def.type\n .parseAsync(result, params)\n .catch((e) => {\n error.addIssue(makeReturnsIssue(result, e));\n throw error;\n });\n return parsedReturns;\n });\n }\n else {\n return (0, parseUtil_1.OK)((...args) => {\n const parsedArgs = this._def.args.safeParse(args, params);\n if (!parsedArgs.success) {\n throw new ZodError_1.ZodError([makeArgsIssue(args, parsedArgs.error)]);\n }\n const result = fn(...parsedArgs.data);\n const parsedReturns = this._def.returns.safeParse(result, params);\n if (!parsedReturns.success) {\n throw new ZodError_1.ZodError([makeReturnsIssue(result, parsedReturns.error)]);\n }\n return parsedReturns.data;\n });\n }\n }\n parameters() {\n return this._def.args;\n }\n returnType() {\n return this._def.returns;\n }\n args(...items) {\n return new ZodFunction({\n ...this._def,\n args: ZodTuple.create(items).rest(ZodUnknown.create()),\n });\n }\n returns(returnType) {\n return new ZodFunction({\n ...this._def,\n returns: returnType,\n });\n }\n implement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n strictImplement(func) {\n const validatedFunc = this.parse(func);\n return validatedFunc;\n }\n static create(args, returns, params) {\n return new ZodFunction({\n args: (args\n ? args\n : ZodTuple.create([]).rest(ZodUnknown.create())),\n returns: returns || ZodUnknown.create(),\n typeName: ZodFirstPartyTypeKind.ZodFunction,\n ...processCreateParams(params),\n });\n }\n}\nexports.ZodFunction = ZodFunction;\nclass ZodLazy extends ZodType {\n get schema() {\n return this._def.getter();\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const lazySchema = this._def.getter();\n return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });\n }\n}\nexports.ZodLazy = ZodLazy;\nZodLazy.create = (getter, params) => {\n return new ZodLazy({\n getter: getter,\n typeName: ZodFirstPartyTypeKind.ZodLazy,\n ...processCreateParams(params),\n });\n};\nclass ZodLiteral extends ZodType {\n _parse(input) {\n if (input.data !== this._def.value) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n received: ctx.data,\n code: ZodError_1.ZodIssueCode.invalid_literal,\n expected: this._def.value,\n });\n return parseUtil_1.INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n get value() {\n return this._def.value;\n }\n}\nexports.ZodLiteral = ZodLiteral;\nZodLiteral.create = (value, params) => {\n return new ZodLiteral({\n value: value,\n typeName: ZodFirstPartyTypeKind.ZodLiteral,\n ...processCreateParams(params),\n });\n};\nfunction createZodEnum(values, params) {\n return new ZodEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodEnum,\n ...processCreateParams(params),\n });\n}\nclass ZodEnum extends ZodType {\n _parse(input) {\n if (typeof input.data !== \"string\") {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n (0, parseUtil_1.addIssueToContext)(ctx, {\n expected: util_1.util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodError_1.ZodIssueCode.invalid_type,\n });\n return parseUtil_1.INVALID;\n }\n if (this._def.values.indexOf(input.data) === -1) {\n const ctx = this._getOrReturnCtx(input);\n const expectedValues = this._def.values;\n (0, parseUtil_1.addIssueToContext)(ctx, {\n received: ctx.data,\n code: ZodError_1.ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n get options() {\n return this._def.values;\n }\n get enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Values() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n get Enum() {\n const enumValues = {};\n for (const val of this._def.values) {\n enumValues[val] = val;\n }\n return enumValues;\n }\n extract(values) {\n return ZodEnum.create(values);\n }\n exclude(values) {\n return ZodEnum.create(this.options.filter((opt) => !values.includes(opt)));\n }\n}\nexports.ZodEnum = ZodEnum;\nZodEnum.create = createZodEnum;\nclass ZodNativeEnum extends ZodType {\n _parse(input) {\n const nativeEnumValues = util_1.util.getValidEnumValues(this._def.values);\n const ctx = this._getOrReturnCtx(input);\n if (ctx.parsedType !== util_1.ZodParsedType.string &&\n ctx.parsedType !== util_1.ZodParsedType.number) {\n const expectedValues = util_1.util.objectValues(nativeEnumValues);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n expected: util_1.util.joinValues(expectedValues),\n received: ctx.parsedType,\n code: ZodError_1.ZodIssueCode.invalid_type,\n });\n return parseUtil_1.INVALID;\n }\n if (nativeEnumValues.indexOf(input.data) === -1) {\n const expectedValues = util_1.util.objectValues(nativeEnumValues);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n received: ctx.data,\n code: ZodError_1.ZodIssueCode.invalid_enum_value,\n options: expectedValues,\n });\n return parseUtil_1.INVALID;\n }\n return (0, parseUtil_1.OK)(input.data);\n }\n get enum() {\n return this._def.values;\n }\n}\nexports.ZodNativeEnum = ZodNativeEnum;\nZodNativeEnum.create = (values, params) => {\n return new ZodNativeEnum({\n values: values,\n typeName: ZodFirstPartyTypeKind.ZodNativeEnum,\n ...processCreateParams(params),\n });\n};\nclass ZodPromise extends ZodType {\n unwrap() {\n return this._def.type;\n }\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n if (ctx.parsedType !== util_1.ZodParsedType.promise &&\n ctx.common.async === false) {\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.promise,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n const promisified = ctx.parsedType === util_1.ZodParsedType.promise\n ? ctx.data\n : Promise.resolve(ctx.data);\n return (0, parseUtil_1.OK)(promisified.then((data) => {\n return this._def.type.parseAsync(data, {\n path: ctx.path,\n errorMap: ctx.common.contextualErrorMap,\n });\n }));\n }\n}\nexports.ZodPromise = ZodPromise;\nZodPromise.create = (schema, params) => {\n return new ZodPromise({\n type: schema,\n typeName: ZodFirstPartyTypeKind.ZodPromise,\n ...processCreateParams(params),\n });\n};\nclass ZodEffects extends ZodType {\n innerType() {\n return this._def.schema;\n }\n sourceType() {\n return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects\n ? this._def.schema.sourceType()\n : this._def.schema;\n }\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n const effect = this._def.effect || null;\n if (effect.type === \"preprocess\") {\n const processed = effect.transform(ctx.data);\n if (ctx.common.async) {\n return Promise.resolve(processed).then((processed) => {\n return this._def.schema._parseAsync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n });\n }\n else {\n return this._def.schema._parseSync({\n data: processed,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n const checkCtx = {\n addIssue: (arg) => {\n (0, parseUtil_1.addIssueToContext)(ctx, arg);\n if (arg.fatal) {\n status.abort();\n }\n else {\n status.dirty();\n }\n },\n get path() {\n return ctx.path;\n },\n };\n checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);\n if (effect.type === \"refinement\") {\n const executeRefinement = (acc) => {\n const result = effect.refinement(acc, checkCtx);\n if (ctx.common.async) {\n return Promise.resolve(result);\n }\n if (result instanceof Promise) {\n throw new Error(\"Async refinement encountered during synchronous parse operation. Use .parseAsync instead.\");\n }\n return acc;\n };\n if (ctx.common.async === false) {\n const inner = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inner.status === \"aborted\")\n return parseUtil_1.INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n executeRefinement(inner.value);\n return { status: status.value, value: inner.value };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((inner) => {\n if (inner.status === \"aborted\")\n return parseUtil_1.INVALID;\n if (inner.status === \"dirty\")\n status.dirty();\n return executeRefinement(inner.value).then(() => {\n return { status: status.value, value: inner.value };\n });\n });\n }\n }\n if (effect.type === \"transform\") {\n if (ctx.common.async === false) {\n const base = this._def.schema._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (!(0, parseUtil_1.isValid)(base))\n return base;\n const result = effect.transform(base.value, checkCtx);\n if (result instanceof Promise) {\n throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);\n }\n return { status: status.value, value: result };\n }\n else {\n return this._def.schema\n ._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx })\n .then((base) => {\n if (!(0, parseUtil_1.isValid)(base))\n return base;\n return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));\n });\n }\n }\n util_1.util.assertNever(effect);\n }\n}\nexports.ZodEffects = ZodEffects;\nexports.ZodTransformer = ZodEffects;\nZodEffects.create = (schema, effect, params) => {\n return new ZodEffects({\n schema,\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n effect,\n ...processCreateParams(params),\n });\n};\nZodEffects.createWithPreprocess = (preprocess, schema, params) => {\n return new ZodEffects({\n schema,\n effect: { type: \"preprocess\", transform: preprocess },\n typeName: ZodFirstPartyTypeKind.ZodEffects,\n ...processCreateParams(params),\n });\n};\nclass ZodOptional extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === util_1.ZodParsedType.undefined) {\n return (0, parseUtil_1.OK)(undefined);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nexports.ZodOptional = ZodOptional;\nZodOptional.create = (type, params) => {\n return new ZodOptional({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodOptional,\n ...processCreateParams(params),\n });\n};\nclass ZodNullable extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType === util_1.ZodParsedType.null) {\n return (0, parseUtil_1.OK)(null);\n }\n return this._def.innerType._parse(input);\n }\n unwrap() {\n return this._def.innerType;\n }\n}\nexports.ZodNullable = ZodNullable;\nZodNullable.create = (type, params) => {\n return new ZodNullable({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodNullable,\n ...processCreateParams(params),\n });\n};\nclass ZodDefault extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n let data = ctx.data;\n if (ctx.parsedType === util_1.ZodParsedType.undefined) {\n data = this._def.defaultValue();\n }\n return this._def.innerType._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n removeDefault() {\n return this._def.innerType;\n }\n}\nexports.ZodDefault = ZodDefault;\nZodDefault.create = (type, params) => {\n return new ZodDefault({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodDefault,\n defaultValue: typeof params.default === \"function\"\n ? params.default\n : () => params.default,\n ...processCreateParams(params),\n });\n};\nclass ZodCatch extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const newCtx = {\n ...ctx,\n common: {\n ...ctx.common,\n issues: [],\n },\n };\n const result = this._def.innerType._parse({\n data: newCtx.data,\n path: newCtx.path,\n parent: {\n ...newCtx,\n },\n });\n if ((0, parseUtil_1.isAsync)(result)) {\n return result.then((result) => {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError_1.ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n });\n }\n else {\n return {\n status: \"valid\",\n value: result.status === \"valid\"\n ? result.value\n : this._def.catchValue({\n get error() {\n return new ZodError_1.ZodError(newCtx.common.issues);\n },\n input: newCtx.data,\n }),\n };\n }\n }\n removeCatch() {\n return this._def.innerType;\n }\n}\nexports.ZodCatch = ZodCatch;\nZodCatch.create = (type, params) => {\n return new ZodCatch({\n innerType: type,\n typeName: ZodFirstPartyTypeKind.ZodCatch,\n catchValue: typeof params.catch === \"function\" ? params.catch : () => params.catch,\n ...processCreateParams(params),\n });\n};\nclass ZodNaN extends ZodType {\n _parse(input) {\n const parsedType = this._getType(input);\n if (parsedType !== util_1.ZodParsedType.nan) {\n const ctx = this._getOrReturnCtx(input);\n (0, parseUtil_1.addIssueToContext)(ctx, {\n code: ZodError_1.ZodIssueCode.invalid_type,\n expected: util_1.ZodParsedType.nan,\n received: ctx.parsedType,\n });\n return parseUtil_1.INVALID;\n }\n return { status: \"valid\", value: input.data };\n }\n}\nexports.ZodNaN = ZodNaN;\nZodNaN.create = (params) => {\n return new ZodNaN({\n typeName: ZodFirstPartyTypeKind.ZodNaN,\n ...processCreateParams(params),\n });\n};\nexports.BRAND = Symbol(\"zod_brand\");\nclass ZodBranded extends ZodType {\n _parse(input) {\n const { ctx } = this._processInputParams(input);\n const data = ctx.data;\n return this._def.type._parse({\n data,\n path: ctx.path,\n parent: ctx,\n });\n }\n unwrap() {\n return this._def.type;\n }\n}\nexports.ZodBranded = ZodBranded;\nclass ZodPipeline extends ZodType {\n _parse(input) {\n const { status, ctx } = this._processInputParams(input);\n if (ctx.common.async) {\n const handleAsync = async () => {\n const inResult = await this._def.in._parseAsync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return parseUtil_1.INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return (0, parseUtil_1.DIRTY)(inResult.value);\n }\n else {\n return this._def.out._parseAsync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n };\n return handleAsync();\n }\n else {\n const inResult = this._def.in._parseSync({\n data: ctx.data,\n path: ctx.path,\n parent: ctx,\n });\n if (inResult.status === \"aborted\")\n return parseUtil_1.INVALID;\n if (inResult.status === \"dirty\") {\n status.dirty();\n return {\n status: \"dirty\",\n value: inResult.value,\n };\n }\n else {\n return this._def.out._parseSync({\n data: inResult.value,\n path: ctx.path,\n parent: ctx,\n });\n }\n }\n }\n static create(a, b) {\n return new ZodPipeline({\n in: a,\n out: b,\n typeName: ZodFirstPartyTypeKind.ZodPipeline,\n });\n }\n}\nexports.ZodPipeline = ZodPipeline;\nconst custom = (check, params = {}, fatal) => {\n if (check)\n return ZodAny.create().superRefine((data, ctx) => {\n var _a, _b;\n if (!check(data)) {\n const p = typeof params === \"function\"\n ? params(data)\n : typeof params === \"string\"\n ? { message: params }\n : params;\n const _fatal = (_b = (_a = p.fatal) !== null && _a !== void 0 ? _a : fatal) !== null && _b !== void 0 ? _b : true;\n const p2 = typeof p === \"string\" ? { message: p } : p;\n ctx.addIssue({ code: \"custom\", ...p2, fatal: _fatal });\n }\n });\n return ZodAny.create();\n};\nexports.custom = custom;\nexports.late = {\n object: ZodObject.lazycreate,\n};\nvar ZodFirstPartyTypeKind;\n(function (ZodFirstPartyTypeKind) {\n ZodFirstPartyTypeKind[\"ZodString\"] = \"ZodString\";\n ZodFirstPartyTypeKind[\"ZodNumber\"] = \"ZodNumber\";\n ZodFirstPartyTypeKind[\"ZodNaN\"] = \"ZodNaN\";\n ZodFirstPartyTypeKind[\"ZodBigInt\"] = \"ZodBigInt\";\n ZodFirstPartyTypeKind[\"ZodBoolean\"] = \"ZodBoolean\";\n ZodFirstPartyTypeKind[\"ZodDate\"] = \"ZodDate\";\n ZodFirstPartyTypeKind[\"ZodSymbol\"] = \"ZodSymbol\";\n ZodFirstPartyTypeKind[\"ZodUndefined\"] = \"ZodUndefined\";\n ZodFirstPartyTypeKind[\"ZodNull\"] = \"ZodNull\";\n ZodFirstPartyTypeKind[\"ZodAny\"] = \"ZodAny\";\n ZodFirstPartyTypeKind[\"ZodUnknown\"] = \"ZodUnknown\";\n ZodFirstPartyTypeKind[\"ZodNever\"] = \"ZodNever\";\n ZodFirstPartyTypeKind[\"ZodVoid\"] = \"ZodVoid\";\n ZodFirstPartyTypeKind[\"ZodArray\"] = \"ZodArray\";\n ZodFirstPartyTypeKind[\"ZodObject\"] = \"ZodObject\";\n ZodFirstPartyTypeKind[\"ZodUnion\"] = \"ZodUnion\";\n ZodFirstPartyTypeKind[\"ZodDiscriminatedUnion\"] = \"ZodDiscriminatedUnion\";\n ZodFirstPartyTypeKind[\"ZodIntersection\"] = \"ZodIntersection\";\n ZodFirstPartyTypeKind[\"ZodTuple\"] = \"ZodTuple\";\n ZodFirstPartyTypeKind[\"ZodRecord\"] = \"ZodRecord\";\n ZodFirstPartyTypeKind[\"ZodMap\"] = \"ZodMap\";\n ZodFirstPartyTypeKind[\"ZodSet\"] = \"ZodSet\";\n ZodFirstPartyTypeKind[\"ZodFunction\"] = \"ZodFunction\";\n ZodFirstPartyTypeKind[\"ZodLazy\"] = \"ZodLazy\";\n ZodFirstPartyTypeKind[\"ZodLiteral\"] = \"ZodLiteral\";\n ZodFirstPartyTypeKind[\"ZodEnum\"] = \"ZodEnum\";\n ZodFirstPartyTypeKind[\"ZodEffects\"] = \"ZodEffects\";\n ZodFirstPartyTypeKind[\"ZodNativeEnum\"] = \"ZodNativeEnum\";\n ZodFirstPartyTypeKind[\"ZodOptional\"] = \"ZodOptional\";\n ZodFirstPartyTypeKind[\"ZodNullable\"] = \"ZodNullable\";\n ZodFirstPartyTypeKind[\"ZodDefault\"] = \"ZodDefault\";\n ZodFirstPartyTypeKind[\"ZodCatch\"] = \"ZodCatch\";\n ZodFirstPartyTypeKind[\"ZodPromise\"] = \"ZodPromise\";\n ZodFirstPartyTypeKind[\"ZodBranded\"] = \"ZodBranded\";\n ZodFirstPartyTypeKind[\"ZodPipeline\"] = \"ZodPipeline\";\n})(ZodFirstPartyTypeKind = exports.ZodFirstPartyTypeKind || (exports.ZodFirstPartyTypeKind = {}));\nclass Class {\n constructor(..._) { }\n}\nconst instanceOfType = (cls, params = {\n message: `Input not instance of ${cls.name}`,\n}) => (0, exports.custom)((data) => data instanceof cls, params);\nexports.instanceof = instanceOfType;\nconst stringType = ZodString.create;\nexports.string = stringType;\nconst numberType = ZodNumber.create;\nexports.number = numberType;\nconst nanType = ZodNaN.create;\nexports.nan = nanType;\nconst bigIntType = ZodBigInt.create;\nexports.bigint = bigIntType;\nconst booleanType = ZodBoolean.create;\nexports.boolean = booleanType;\nconst dateType = ZodDate.create;\nexports.date = dateType;\nconst symbolType = ZodSymbol.create;\nexports.symbol = symbolType;\nconst undefinedType = ZodUndefined.create;\nexports.undefined = undefinedType;\nconst nullType = ZodNull.create;\nexports.null = nullType;\nconst anyType = ZodAny.create;\nexports.any = anyType;\nconst unknownType = ZodUnknown.create;\nexports.unknown = unknownType;\nconst neverType = ZodNever.create;\nexports.never = neverType;\nconst voidType = ZodVoid.create;\nexports.void = voidType;\nconst arrayType = ZodArray.create;\nexports.array = arrayType;\nconst objectType = ZodObject.create;\nexports.object = objectType;\nconst strictObjectType = ZodObject.strictCreate;\nexports.strictObject = strictObjectType;\nconst unionType = ZodUnion.create;\nexports.union = unionType;\nconst discriminatedUnionType = ZodDiscriminatedUnion.create;\nexports.discriminatedUnion = discriminatedUnionType;\nconst intersectionType = ZodIntersection.create;\nexports.intersection = intersectionType;\nconst tupleType = ZodTuple.create;\nexports.tuple = tupleType;\nconst recordType = ZodRecord.create;\nexports.record = recordType;\nconst mapType = ZodMap.create;\nexports.map = mapType;\nconst setType = ZodSet.create;\nexports.set = setType;\nconst functionType = ZodFunction.create;\nexports.function = functionType;\nconst lazyType = ZodLazy.create;\nexports.lazy = lazyType;\nconst literalType = ZodLiteral.create;\nexports.literal = literalType;\nconst enumType = ZodEnum.create;\nexports.enum = enumType;\nconst nativeEnumType = ZodNativeEnum.create;\nexports.nativeEnum = nativeEnumType;\nconst promiseType = ZodPromise.create;\nexports.promise = promiseType;\nconst effectsType = ZodEffects.create;\nexports.effect = effectsType;\nexports.transformer = effectsType;\nconst optionalType = ZodOptional.create;\nexports.optional = optionalType;\nconst nullableType = ZodNullable.create;\nexports.nullable = nullableType;\nconst preprocessType = ZodEffects.createWithPreprocess;\nexports.preprocess = preprocessType;\nconst pipelineType = ZodPipeline.create;\nexports.pipeline = pipelineType;\nconst ostring = () => stringType().optional();\nexports.ostring = ostring;\nconst onumber = () => numberType().optional();\nexports.onumber = onumber;\nconst oboolean = () => booleanType().optional();\nexports.oboolean = oboolean;\nexports.coerce = {\n string: ((arg) => ZodString.create({ ...arg, coerce: true })),\n number: ((arg) => ZodNumber.create({ ...arg, coerce: true })),\n boolean: ((arg) => ZodBoolean.create({\n ...arg,\n coerce: true,\n })),\n bigint: ((arg) => ZodBigInt.create({ ...arg, coerce: true })),\n date: ((arg) => ZodDate.create({ ...arg, coerce: true })),\n};\nexports.NEVER = parseUtil_1.INVALID;\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n__exportStar(require(\"./errors\"), exports);\n__exportStar(require(\"./helpers/parseUtil\"), exports);\n__exportStar(require(\"./helpers/typeAliases\"), exports);\n__exportStar(require(\"./helpers/util\"), exports);\n__exportStar(require(\"./types\"), exports);\n__exportStar(require(\"./ZodError\"), exports);\n","\"use strict\";\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __exportStar = (this && this.__exportStar) || function(m, exports) {\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.z = void 0;\nconst z = __importStar(require(\"./external\"));\nexports.z = z;\n__exportStar(require(\"./external\"), exports);\nexports.default = z;\n","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Input = exports.Network = exports.Log = exports.BrowsingContext = exports.Script = exports.Message = void 0;\n// keep-sorted end\nvar Message;\n(function (Message) {\n // keep-sorted end\n let ErrorCode;\n (function (ErrorCode) {\n // keep-sorted start\n ErrorCode[\"InvalidArgument\"] = \"invalid argument\";\n ErrorCode[\"InvalidSessionId\"] = \"invalid session id\";\n ErrorCode[\"MoveTargetOutOfBounds\"] = \"move target out of bounds\";\n ErrorCode[\"NoSuchAlert\"] = \"no such alert\";\n ErrorCode[\"NoSuchElement\"] = \"no such element\";\n ErrorCode[\"NoSuchFrame\"] = \"no such frame\";\n ErrorCode[\"NoSuchHandle\"] = \"no such handle\";\n ErrorCode[\"NoSuchNode\"] = \"no such node\";\n ErrorCode[\"NoSuchScript\"] = \"no such script\";\n ErrorCode[\"SessionNotCreated\"] = \"session not created\";\n ErrorCode[\"UnknownCommand\"] = \"unknown command\";\n ErrorCode[\"UnknownError\"] = \"unknown error\";\n ErrorCode[\"UnsupportedOperation\"] = \"unsupported operation\";\n // keep-sorted end\n })(ErrorCode = Message.ErrorCode || (Message.ErrorCode = {}));\n class ErrorResponse {\n error;\n message;\n stacktrace;\n constructor(error, message, stacktrace) {\n this.error = error;\n this.message = message;\n this.stacktrace = stacktrace;\n }\n toErrorResponse(commandId) {\n return {\n id: commandId,\n error: this.error,\n message: this.message,\n stacktrace: this.stacktrace,\n };\n }\n }\n Message.ErrorResponse = ErrorResponse;\n class InvalidArgumentException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.InvalidArgument, message, stacktrace);\n }\n }\n Message.InvalidArgumentException = InvalidArgumentException;\n class MoveTargetOutOfBoundsException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.MoveTargetOutOfBounds, message, stacktrace);\n }\n }\n Message.MoveTargetOutOfBoundsException = MoveTargetOutOfBoundsException;\n class NoSuchHandleException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.NoSuchHandle, message, stacktrace);\n }\n }\n Message.NoSuchHandleException = NoSuchHandleException;\n class InvalidSessionIdException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.InvalidSessionId, message, stacktrace);\n }\n }\n Message.InvalidSessionIdException = InvalidSessionIdException;\n class NoSuchAlertException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.NoSuchAlert, message, stacktrace);\n }\n }\n Message.NoSuchAlertException = NoSuchAlertException;\n class NoSuchFrameException extends ErrorResponse {\n constructor(message) {\n super(ErrorCode.NoSuchFrame, message);\n }\n }\n Message.NoSuchFrameException = NoSuchFrameException;\n class NoSuchNodeException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.NoSuchNode, message, stacktrace);\n }\n }\n Message.NoSuchNodeException = NoSuchNodeException;\n class NoSuchElementException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.NoSuchElement, message, stacktrace);\n }\n }\n Message.NoSuchElementException = NoSuchElementException;\n class NoSuchScriptException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.NoSuchScript, message, stacktrace);\n }\n }\n Message.NoSuchScriptException = NoSuchScriptException;\n class SessionNotCreatedException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.SessionNotCreated, message, stacktrace);\n }\n }\n Message.SessionNotCreatedException = SessionNotCreatedException;\n class UnknownCommandException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.UnknownCommand, message, stacktrace);\n }\n }\n Message.UnknownCommandException = UnknownCommandException;\n class UnknownErrorException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.UnknownError, message, stacktrace);\n }\n }\n Message.UnknownErrorException = UnknownErrorException;\n class UnsupportedOperationException extends ErrorResponse {\n constructor(message, stacktrace) {\n super(ErrorCode.UnsupportedOperation, message, stacktrace);\n }\n }\n Message.UnsupportedOperationException = UnsupportedOperationException;\n})(Message = exports.Message || (exports.Message = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-script */\nvar Script;\n(function (Script) {\n let EventNames;\n (function (EventNames) {\n // keep-sorted start\n EventNames[\"MessageEvent\"] = \"script.message\";\n EventNames[\"RealmCreated\"] = \"script.realmCreated\";\n EventNames[\"RealmDestroyed\"] = \"script.realmDestroyed\";\n // keep-sorted end\n })(EventNames = Script.EventNames || (Script.EventNames = {}));\n Script.AllEvents = 'script';\n})(Script = exports.Script || (exports.Script = {}));\n// https://w3c.github.io/webdriver-bidi/#module-browsingContext\nvar BrowsingContext;\n(function (BrowsingContext) {\n let EventNames;\n (function (EventNames) {\n // keep-sorted start\n EventNames[\"ContextCreatedEvent\"] = \"browsingContext.contextCreated\";\n EventNames[\"ContextDestroyedEvent\"] = \"browsingContext.contextDestroyed\";\n EventNames[\"DomContentLoadedEvent\"] = \"browsingContext.domContentLoaded\";\n EventNames[\"FragmentNavigated\"] = \"browsingContext.fragmentNavigated\";\n EventNames[\"LoadEvent\"] = \"browsingContext.load\";\n EventNames[\"NavigationStarted\"] = \"browsingContext.navigationStarted\";\n // keep-sorted end\n })(EventNames = BrowsingContext.EventNames || (BrowsingContext.EventNames = {}));\n BrowsingContext.AllEvents = 'browsingContext';\n})(BrowsingContext = exports.BrowsingContext || (exports.BrowsingContext = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-log */\nvar Log;\n(function (Log) {\n Log.AllEvents = 'log';\n let EventNames;\n (function (EventNames) {\n EventNames[\"LogEntryAddedEvent\"] = \"log.entryAdded\";\n })(EventNames = Log.EventNames || (Log.EventNames = {}));\n})(Log = exports.Log || (exports.Log = {}));\nvar Network;\n(function (Network) {\n Network.AllEvents = 'network';\n let EventNames;\n (function (EventNames) {\n EventNames[\"BeforeRequestSentEvent\"] = \"network.beforeRequestSent\";\n EventNames[\"FetchErrorEvent\"] = \"network.fetchError\";\n EventNames[\"ResponseStartedEvent\"] = \"network.responseStarted\";\n EventNames[\"ResponseCompletedEvent\"] = \"network.responseCompleted\";\n })(EventNames = Network.EventNames || (Network.EventNames = {}));\n})(Network = exports.Network || (exports.Network = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-input */\nvar Input;\n(function (Input) {\n let SourceActionsType;\n (function (SourceActionsType) {\n SourceActionsType[\"None\"] = \"none\";\n SourceActionsType[\"Key\"] = \"key\";\n SourceActionsType[\"Pointer\"] = \"pointer\";\n SourceActionsType[\"Wheel\"] = \"wheel\";\n })(SourceActionsType = Input.SourceActionsType || (Input.SourceActionsType = {}));\n let PointerType;\n (function (PointerType) {\n PointerType[\"Mouse\"] = \"mouse\";\n PointerType[\"Pen\"] = \"pen\";\n PointerType[\"Touch\"] = \"touch\";\n })(PointerType = Input.PointerType || (Input.PointerType = {}));\n let ActionType;\n (function (ActionType) {\n ActionType[\"Pause\"] = \"pause\";\n ActionType[\"KeyDown\"] = \"keyDown\";\n ActionType[\"KeyUp\"] = \"keyUp\";\n ActionType[\"PointerUp\"] = \"pointerUp\";\n ActionType[\"PointerDown\"] = \"pointerDown\";\n ActionType[\"PointerMove\"] = \"pointerMove\";\n ActionType[\"Scroll\"] = \"scroll\";\n })(ActionType = Input.ActionType || (Input.ActionType = {}));\n})(Input = exports.Input || (exports.Input = {}));\n//# sourceMappingURL=protocol.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Input = exports.Session = exports.Cdp = exports.BrowsingContext = exports.Script = exports.CommonDataTypes = exports.parseObject = void 0;\n/**\n * @fileoverview Provides parsing and validator for WebDriver BiDi protocol.\n * Parser types should match the `../protocol` types.\n */\nconst zod_1 = require(\"zod\");\nconst protocol_js_1 = require(\"../protocol/protocol.js\");\nconst MAX_INT = 9007199254740991;\nfunction parseObject(obj, schema) {\n const parseResult = schema.safeParse(obj);\n if (parseResult.success) {\n return parseResult.data;\n }\n const errorMessage = parseResult.error.errors\n .map((e) => `${e.message} in ` +\n `${e.path.map((p) => JSON.stringify(p)).join('/')}.`)\n .join(' ');\n throw new protocol_js_1.Message.InvalidArgumentException(errorMessage);\n}\nexports.parseObject = parseObject;\nconst UnicodeCharacterSchema = zod_1.z.string().refine((value) => {\n // The spread is a little hack so JS gives us an array of unicode characters\n // to measure.\n return [...value].length === 1;\n});\nvar CommonDataTypes;\n(function (CommonDataTypes) {\n CommonDataTypes.SharedReferenceSchema = zod_1.z.object({\n sharedId: zod_1.z.string().min(1),\n handle: zod_1.z.string().optional(),\n });\n CommonDataTypes.RemoteReferenceSchema = zod_1.z.object({\n handle: zod_1.z.string().min(1),\n });\n // UndefinedValue = {\n // type: \"undefined\",\n // }\n const UndefinedValueSchema = zod_1.z.object({ type: zod_1.z.literal('undefined') });\n // NullValue = {\n // type: \"null\",\n // }\n const NullValueSchema = zod_1.z.object({ type: zod_1.z.literal('null') });\n // StringValue = {\n // type: \"string\",\n // value: text,\n // }\n const StringValueSchema = zod_1.z.object({\n type: zod_1.z.literal('string'),\n value: zod_1.z.string(),\n });\n // SpecialNumber = \"NaN\" / \"-0\" / \"Infinity\" / \"-Infinity\";\n const SpecialNumberSchema = zod_1.z.enum(['NaN', '-0', 'Infinity', '-Infinity']);\n // NumberValue = {\n // type: \"number\",\n // value: number / SpecialNumber,\n // }\n const NumberValueSchema = zod_1.z.object({\n type: zod_1.z.literal('number'),\n value: zod_1.z.union([SpecialNumberSchema, zod_1.z.number()]),\n });\n // BooleanValue = {\n // type: \"boolean\",\n // value: bool,\n // }\n const BooleanValueSchema = zod_1.z.object({\n type: zod_1.z.literal('boolean'),\n value: zod_1.z.boolean(),\n });\n // BigIntValue = {\n // type: \"bigint\",\n // value: text,\n // }\n const BigIntValueSchema = zod_1.z.object({\n type: zod_1.z.literal('bigint'),\n value: zod_1.z.string(),\n });\n const PrimitiveProtocolValueSchema = zod_1.z.union([\n UndefinedValueSchema,\n NullValueSchema,\n StringValueSchema,\n NumberValueSchema,\n BooleanValueSchema,\n BigIntValueSchema,\n ]);\n CommonDataTypes.LocalValueSchema = zod_1.z.lazy(() => zod_1.z.union([\n PrimitiveProtocolValueSchema,\n ArrayLocalValueSchema,\n DateLocalValueSchema,\n MapLocalValueSchema,\n ObjectLocalValueSchema,\n RegExpLocalValueSchema,\n SetLocalValueSchema,\n ]));\n // Order is important, as `parse` is processed in the same order.\n // `SharedReferenceSchema`->`RemoteReferenceSchema`->`LocalValueSchema`.\n const LocalOrRemoteValueSchema = zod_1.z.union([\n CommonDataTypes.SharedReferenceSchema,\n CommonDataTypes.RemoteReferenceSchema,\n CommonDataTypes.LocalValueSchema,\n ]);\n // ListLocalValue = [*LocalValue];\n const ListLocalValueSchema = zod_1.z.array(LocalOrRemoteValueSchema);\n // ArrayLocalValue = {\n // type: \"array\",\n // value: ListLocalValue,\n // }\n const ArrayLocalValueSchema = zod_1.z.object({\n type: zod_1.z.literal('array'),\n value: ListLocalValueSchema,\n });\n // DateLocalValue = {\n // type: \"date\",\n // value: text\n // }\n const DateLocalValueSchema = zod_1.z.object({\n type: zod_1.z.literal('date'),\n value: zod_1.z.string().min(1),\n });\n // MappingLocalValue = [*[(LocalValue / text), LocalValue]];\n const MappingLocalValueSchema = zod_1.z.tuple([\n zod_1.z.union([zod_1.z.string(), LocalOrRemoteValueSchema]),\n LocalOrRemoteValueSchema,\n ]);\n // MapLocalValue = {\n // type: \"map\",\n // value: MappingLocalValue,\n // }\n const MapLocalValueSchema = zod_1.z.object({\n type: zod_1.z.literal('map'),\n value: zod_1.z.array(MappingLocalValueSchema),\n });\n // ObjectLocalValue = {\n // type: \"object\",\n // value: MappingLocalValue,\n // }\n const ObjectLocalValueSchema = zod_1.z.object({\n type: zod_1.z.literal('object'),\n value: zod_1.z.array(MappingLocalValueSchema),\n });\n // RegExpLocalValue = {\n // type: \"regexp\",\n // value: RegExpValue,\n // }\n const RegExpLocalValueSchema = zod_1.z.object({\n type: zod_1.z.literal('regexp'),\n value: zod_1.z.object({\n pattern: zod_1.z.string(),\n flags: zod_1.z.string().optional(),\n }),\n });\n // SetLocalValue = {\n // type: \"set\",\n // value: ListLocalValue,\n // }\n const SetLocalValueSchema = zod_1.z.lazy(() => zod_1.z.object({\n type: zod_1.z.literal('set'),\n value: ListLocalValueSchema,\n }));\n // BrowsingContext = text;\n CommonDataTypes.BrowsingContextSchema = zod_1.z.string();\n CommonDataTypes.MaxDepthSchema = zod_1.z.number().int().nonnegative().max(MAX_INT);\n})(CommonDataTypes = exports.CommonDataTypes || (exports.CommonDataTypes = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-script */\nvar Script;\n(function (Script) {\n const RealmTypeSchema = zod_1.z.enum([\n 'window',\n 'dedicated-worker',\n 'shared-worker',\n 'service-worker',\n 'worker',\n 'paint-worklet',\n 'audio-worklet',\n 'worklet',\n ]);\n Script.GetRealmsParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema.optional(),\n type: RealmTypeSchema.optional(),\n });\n function parseGetRealmsParams(params) {\n return parseObject(params, Script.GetRealmsParametersSchema);\n }\n Script.parseGetRealmsParams = parseGetRealmsParams;\n // ContextTarget = {\n // context: BrowsingContext,\n // ?sandbox: text\n // }\n const ContextTargetSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n sandbox: zod_1.z.string().optional(),\n });\n // RealmTarget = {realm: Realm};\n const RealmTargetSchema = zod_1.z.object({\n realm: zod_1.z.string().min(1),\n });\n // Target = (\n // RealmTarget //\n // ContextTarget\n // );\n // Order is important, as `parse` is processed in the same order.\n // `RealmTargetSchema` has higher priority.\n const TargetSchema = zod_1.z.union([RealmTargetSchema, ContextTargetSchema]);\n // ResultOwnership = \"root\" / \"none\"\n const ResultOwnershipSchema = zod_1.z.enum(['root', 'none']);\n // SerializationOptions = {\n // ?maxDomDepth: (js-uint / null) .default 0,\n // ?maxObjectDepth: (js-uint / null) .default null,\n // ?includeShadowTree: (\"none\" / \"open\" / \"all\") .default \"none\",\n // }\n const SerializationOptionsSchema = zod_1.z.object({\n maxDomDepth: zod_1.z\n .union([zod_1.z.null(), zod_1.z.number().int().nonnegative()])\n .optional(),\n maxObjectDepth: zod_1.z\n .union([zod_1.z.null(), zod_1.z.number().int().nonnegative().max(MAX_INT)])\n .optional(),\n includeShadowTree: zod_1.z.enum(['none', 'open', 'all']).optional(),\n });\n // script.EvaluateParameters = {\n // expression: text,\n // target: script.Target,\n // awaitPromise: bool,\n // ?resultOwnership: script.ResultOwnership,\n // ?serializationOptions: script.SerializationOptions,\n // }\n const EvaluateParametersSchema = zod_1.z.object({\n expression: zod_1.z.string(),\n awaitPromise: zod_1.z.boolean(),\n target: TargetSchema,\n resultOwnership: ResultOwnershipSchema.optional(),\n serializationOptions: SerializationOptionsSchema.optional(),\n });\n function parseEvaluateParams(params) {\n return parseObject(params, EvaluateParametersSchema);\n }\n Script.parseEvaluateParams = parseEvaluateParams;\n // DisownParameters = {\n // handles: [Handle]\n // target: script.Target;\n // }\n const DisownParametersSchema = zod_1.z.object({\n target: TargetSchema,\n handles: zod_1.z.array(zod_1.z.string()),\n });\n function parseDisownParams(params) {\n return parseObject(params, DisownParametersSchema);\n }\n Script.parseDisownParams = parseDisownParams;\n const ChannelSchema = zod_1.z.string();\n const ChannelPropertiesSchema = zod_1.z.object({\n channel: ChannelSchema,\n serializationOptions: SerializationOptionsSchema.optional(),\n ownership: ResultOwnershipSchema.optional(),\n });\n Script.ChannelValueSchema = zod_1.z.object({\n type: zod_1.z.literal('channel'),\n value: ChannelPropertiesSchema,\n });\n Script.PreloadScriptSchema = zod_1.z.string();\n Script.AddPreloadScriptParametersSchema = zod_1.z.object({\n functionDeclaration: zod_1.z.string(),\n arguments: zod_1.z.array(Script.ChannelValueSchema).optional(),\n sandbox: zod_1.z.string().optional(),\n context: CommonDataTypes.BrowsingContextSchema.optional(),\n });\n function parseAddPreloadScriptParams(params) {\n return parseObject(params, Script.AddPreloadScriptParametersSchema);\n }\n Script.parseAddPreloadScriptParams = parseAddPreloadScriptParams;\n Script.RemovePreloadScriptParametersSchema = zod_1.z.object({\n script: Script.PreloadScriptSchema,\n });\n function parseRemovePreloadScriptParams(params) {\n return parseObject(params, Script.RemovePreloadScriptParametersSchema);\n }\n Script.parseRemovePreloadScriptParams = parseRemovePreloadScriptParams;\n // ArgumentValue = (\n // RemoteReference //\n // LocalValue //\n // script.Channel\n // );\n const ArgumentValueSchema = zod_1.z.union([\n CommonDataTypes.RemoteReferenceSchema,\n CommonDataTypes.SharedReferenceSchema,\n CommonDataTypes.LocalValueSchema,\n Script.ChannelValueSchema,\n ]);\n // CallFunctionParameters = {\n // functionDeclaration: text,\n // awaitPromise: bool,\n // target: script.Target,\n // ?arguments: [*script.ArgumentValue],\n // ?resultOwnership: script.ResultOwnership,\n // ?serializationOptions: script.SerializationOptions,\n // ?this: script.ArgumentValue,\n // }\n const CallFunctionParametersSchema = zod_1.z.object({\n functionDeclaration: zod_1.z.string(),\n awaitPromise: zod_1.z.boolean(),\n target: TargetSchema,\n arguments: zod_1.z.array(ArgumentValueSchema).optional(),\n resultOwnership: ResultOwnershipSchema.optional(),\n serializationOptions: SerializationOptionsSchema.optional(),\n this: ArgumentValueSchema.optional(),\n });\n function parseCallFunctionParams(params) {\n return parseObject(params, CallFunctionParametersSchema);\n }\n Script.parseCallFunctionParams = parseCallFunctionParams;\n})(Script = exports.Script || (exports.Script = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-browsingContext */\nvar BrowsingContext;\n(function (BrowsingContext) {\n // GetTreeParameters = {\n // ?maxDepth: js-uint,\n // ?root: browsingContext.BrowsingContext,\n // }\n const GetTreeParametersSchema = zod_1.z.object({\n maxDepth: CommonDataTypes.MaxDepthSchema.optional(),\n root: CommonDataTypes.BrowsingContextSchema.optional(),\n });\n function parseGetTreeParams(params) {\n return parseObject(params, GetTreeParametersSchema);\n }\n BrowsingContext.parseGetTreeParams = parseGetTreeParams;\n // ReadinessState = \"none\" / \"interactive\" / \"complete\"\n const ReadinessStateSchema = zod_1.z.enum(['none', 'interactive', 'complete']);\n // BrowsingContextNavigateParameters = {\n // context: BrowsingContext,\n // url: text,\n // ?wait: ReadinessState,\n // }\n // ReadinessState = \"none\" / \"interactive\" / \"complete\"\n const NavigateParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n url: zod_1.z.string().url(),\n wait: ReadinessStateSchema.optional(),\n });\n function parseNavigateParams(params) {\n return parseObject(params, NavigateParametersSchema);\n }\n BrowsingContext.parseNavigateParams = parseNavigateParams;\n const ReloadParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n ignoreCache: zod_1.z.boolean().optional(),\n wait: ReadinessStateSchema.optional(),\n });\n function parseReloadParams(params) {\n return parseObject(params, ReloadParametersSchema);\n }\n BrowsingContext.parseReloadParams = parseReloadParams;\n // BrowsingContextCreateType = \"tab\" / \"window\"\n // BrowsingContextCreateParameters = {\n // type: BrowsingContextCreateType\n // }\n const CreateParametersSchema = zod_1.z.object({\n type: zod_1.z.enum(['tab', 'window']),\n referenceContext: CommonDataTypes.BrowsingContextSchema.optional(),\n });\n function parseCreateParams(params) {\n return parseObject(params, CreateParametersSchema);\n }\n BrowsingContext.parseCreateParams = parseCreateParams;\n // BrowsingContextCloseParameters = {\n // context: BrowsingContext\n // }\n const CloseParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n });\n function parseCloseParams(params) {\n return parseObject(params, CloseParametersSchema);\n }\n BrowsingContext.parseCloseParams = parseCloseParams;\n // browsingContext.CaptureScreenshotParameters = {\n // context: browsingContext.BrowsingContext\n // }\n const CaptureScreenshotParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n });\n function parseCaptureScreenshotParams(params) {\n return parseObject(params, CaptureScreenshotParametersSchema);\n }\n BrowsingContext.parseCaptureScreenshotParams = parseCaptureScreenshotParams;\n // All units are in cm.\n // PrintPageParameters = {\n // ?height: (float .ge 0.0) .default 27.94,\n // ?width: (float .ge 0.0) .default 21.59,\n // }\n const PrintPageParametersSchema = zod_1.z.object({\n height: zod_1.z.number().nonnegative().optional(),\n width: zod_1.z.number().nonnegative().optional(),\n });\n // All units are in cm.\n // PrintMarginParameters = {\n // ?bottom: (float .ge 0.0) .default 1.0,\n // ?left: (float .ge 0.0) .default 1.0,\n // ?right: (float .ge 0.0) .default 1.0,\n // ?top: (float .ge 0.0) .default 1.0,\n // }\n const PrintMarginParametersSchema = zod_1.z.object({\n bottom: zod_1.z.number().nonnegative().optional(),\n left: zod_1.z.number().nonnegative().optional(),\n right: zod_1.z.number().nonnegative().optional(),\n top: zod_1.z.number().nonnegative().optional(),\n });\n /** @see https://w3c.github.io/webdriver/#dfn-parse-a-page-range */\n const PrintPageRangesSchema = zod_1.z\n .array(zod_1.z.union([zod_1.z.string().min(1), zod_1.z.number().int().nonnegative()]))\n .refine((pageRanges) => {\n return pageRanges.every((pageRange) => {\n const match = String(pageRange).match(\n // matches: '2' | '2-' | '-2' | '2-4'\n /^(?:(?:\\d+)|(?:\\d+[-])|(?:[-]\\d+)|(?:(?<start>\\d+)[-](?<end>\\d+)))$/);\n // If a page range is specified, validate start <= end.\n const { start, end } = match?.groups ?? {};\n if (start && end && Number(start) > Number(end)) {\n return false;\n }\n return match;\n });\n });\n // PrintParameters = {\n // context: browsingContext.BrowsingContext,\n // ?background: bool .default false,\n // ?margin: browsingContext.PrintMarginParameters,\n // ?orientation: (\"portrait\" / \"landscape\") .default \"portrait\",\n // ?page: browsingContext.PrintPageParameters,\n // ?pageRanges: [*(js-uint / text)],\n // ?scale: 0.1..2.0 .default 1.0,\n // ?shrinkToFit: bool .default true,\n // }\n const PrintParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n background: zod_1.z.boolean().optional(),\n margin: PrintMarginParametersSchema.optional(),\n orientation: zod_1.z.enum(['portrait', 'landscape']).optional(),\n page: PrintPageParametersSchema.optional(),\n pageRanges: PrintPageRangesSchema.optional(),\n scale: zod_1.z.number().min(0.1).max(2.0).optional(),\n shrinkToFit: zod_1.z.boolean().optional(),\n });\n function parsePrintParams(params) {\n return parseObject(params, PrintParametersSchema);\n }\n BrowsingContext.parsePrintParams = parsePrintParams;\n // browsingContext.Viewport = {\n // width: js-uint,\n // height: js-uint,\n // }\n const ViewportSchema = zod_1.z.object({\n width: zod_1.z.number().int().nonnegative(),\n height: zod_1.z.number().int().nonnegative(),\n });\n // browsingContext.SetViewportParameters = {\n // context: browsingContext.BrowsingContext,\n // viewport: emulation.Viewport / null\n // }\n const SetViewportActionSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n viewport: zod_1.z.union([zod_1.z.null(), ViewportSchema]),\n });\n function parseSetViewportParams(params) {\n return parseObject(params, SetViewportActionSchema);\n }\n BrowsingContext.parseSetViewportParams = parseSetViewportParams;\n})(BrowsingContext = exports.BrowsingContext || (exports.BrowsingContext = {}));\nvar Cdp;\n(function (Cdp) {\n const SendCommandParamsSchema = zod_1.z.object({\n // Allowing any cdpMethod, and casting to proper type later on.\n method: zod_1.z.string(),\n // `passthrough` allows object to have any fields.\n // https://github.com/colinhacks/zod#passthrough\n params: zod_1.z.object({}).passthrough().optional(),\n session: zod_1.z.string().optional(),\n });\n function parseSendCommandParams(params) {\n return parseObject(params, SendCommandParamsSchema);\n }\n Cdp.parseSendCommandParams = parseSendCommandParams;\n const GetSessionParamsSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n });\n function parseGetSessionParams(params) {\n return parseObject(params, GetSessionParamsSchema);\n }\n Cdp.parseGetSessionParams = parseGetSessionParams;\n})(Cdp = exports.Cdp || (exports.Cdp = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-session */\nvar Session;\n(function (Session) {\n const BiDiSubscriptionRequestParametersEventsSchema = zod_1.z.enum([\n protocol_js_1.BrowsingContext.AllEvents,\n ...Object.values(protocol_js_1.BrowsingContext.EventNames),\n protocol_js_1.Log.AllEvents,\n ...Object.values(protocol_js_1.Log.EventNames),\n protocol_js_1.Network.AllEvents,\n ...Object.values(protocol_js_1.Network.EventNames),\n protocol_js_1.Script.AllEvents,\n ...Object.values(protocol_js_1.Script.EventNames),\n ]);\n // BiDi+ events\n const CdpSubscriptionRequestParametersEventsSchema = zod_1.z.custom((value) => {\n return typeof value === 'string' && value.startsWith('cdp.');\n }, 'Not a CDP event');\n const SubscriptionRequestParametersEventsSchema = zod_1.z.union([\n BiDiSubscriptionRequestParametersEventsSchema,\n CdpSubscriptionRequestParametersEventsSchema,\n ]);\n // SessionSubscriptionRequest = {\n // events: [*text],\n // ?contexts: [*BrowsingContext],\n // }\n const SubscriptionRequestParametersSchema = zod_1.z.object({\n events: zod_1.z.array(SubscriptionRequestParametersEventsSchema),\n contexts: zod_1.z.array(CommonDataTypes.BrowsingContextSchema).optional(),\n });\n function parseSubscribeParams(params) {\n return parseObject(params, SubscriptionRequestParametersSchema);\n }\n Session.parseSubscribeParams = parseSubscribeParams;\n})(Session = exports.Session || (exports.Session = {}));\n/** @see https://w3c.github.io/webdriver-bidi/#module-input */\nvar Input;\n(function (Input) {\n // input.ElementOrigin = {\n // type: \"element\",\n // element: script.SharedReference\n // }\n const ElementOriginSchema = zod_1.z.object({\n type: zod_1.z.literal('element'),\n element: CommonDataTypes.SharedReferenceSchema,\n });\n // input.Origin = \"viewport\" / \"pointer\" / input.ElementOrigin\n const OriginSchema = zod_1.z.union([\n zod_1.z.literal('viewport'),\n zod_1.z.literal('pointer'),\n ElementOriginSchema,\n ]);\n // input.PauseAction = {\n // type: \"pause\",\n // ? duration: js-uint\n // }\n const PauseActionSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.Pause),\n duration: zod_1.z.number().nonnegative().int().optional(),\n });\n // input.KeyDownAction = {\n // type: \"keyDown\",\n // value: text\n // }\n const KeyDownActionSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.KeyDown),\n value: UnicodeCharacterSchema,\n });\n // input.KeyUpAction = {\n // type: \"keyUp\",\n // value: text\n // }\n const KeyUpActionSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.KeyUp),\n value: UnicodeCharacterSchema,\n });\n // input.TiltProperties = (\n // ? tiltX: -90..90 .default 0,\n // ? tiltY: -90..90 .default 0,\n // )\n const TiltPropertiesSchema = zod_1.z.object({\n tiltX: zod_1.z.number().min(-90).max(90).int().default(0).optional(),\n tiltY: zod_1.z.number().min(-90).max(90).int().default(0).optional(),\n });\n // input.AngleProperties = (\n // ? altitudeAngle: float .default 0.0,\n // ? azimuthAngle: float .default 0.0,\n // )\n const AnglePropertiesSchema = zod_1.z.object({\n altitudeAngle: zod_1.z\n .number()\n .nonnegative()\n .max(Math.PI / 2)\n .default(0.0)\n .optional(),\n azimuthAngle: zod_1.z\n .number()\n .nonnegative()\n .max(2 * Math.PI)\n .default(0.0)\n .optional(),\n });\n // input.PointerCommonProperties = (\n // ? width: js-uint .default 1,\n // ? height: js-uint .default 1,\n // ? pressure: float .default 0.0,\n // ? tangentialPressure: float .default 0.0,\n // ? twist: 0..359 .default 0,\n // (input.TiltProperties // input.AngleProperties)\n // )\n const PointerCommonPropertiesSchema = zod_1.z\n .object({\n width: zod_1.z.number().nonnegative().int().default(1),\n height: zod_1.z.number().nonnegative().int().default(1),\n pressure: zod_1.z.number().min(0.0).max(1.0).default(0.0),\n tangentialPressure: zod_1.z.number().min(-1.0).max(1.0).default(0.0),\n twist: zod_1.z.number().nonnegative().max(359).int().default(0),\n })\n .and(zod_1.z.union([TiltPropertiesSchema, AnglePropertiesSchema]));\n // input.PointerUpAction = {\n // type: \"pointerUp\",\n // button: js-uint,\n // input.PointerCommonProperties\n // }\n const PointerUpActionSchema = zod_1.z\n .object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.PointerUp),\n button: zod_1.z.number().nonnegative().int(),\n })\n .and(PointerCommonPropertiesSchema);\n // input.PointerDownAction = {\n // type: \"pointerDown\",\n // button: js-uint,\n // input.PointerCommonProperties\n // }\n const PointerDownActionSchema = zod_1.z\n .object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.PointerDown),\n button: zod_1.z.number().nonnegative().int(),\n })\n .and(PointerCommonPropertiesSchema);\n // input.PointerMoveAction = {\n // type: \"pointerMove\",\n // x: js-int,\n // y: js-int,\n // ? duration: js-uint,\n // ? origin: input.Origin,\n // input.PointerCommonProperties\n // }\n const PointerMoveActionSchema = zod_1.z\n .object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.PointerMove),\n x: zod_1.z.number().int(),\n y: zod_1.z.number().int(),\n duration: zod_1.z.number().nonnegative().int().optional(),\n origin: OriginSchema.optional().default('viewport'),\n })\n .and(PointerCommonPropertiesSchema);\n // input.WheelScrollAction = {\n // type: \"scroll\",\n // x: js-int,\n // y: js-int,\n // deltaX: js-int,\n // deltaY: js-int,\n // ? duration: js-uint,\n // ? origin: input.Origin .default \"viewport\",\n // }\n const WheelScrollActionSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.ActionType.Scroll),\n x: zod_1.z.number().int(),\n y: zod_1.z.number().int(),\n deltaX: zod_1.z.number().int(),\n deltaY: zod_1.z.number().int(),\n duration: zod_1.z.number().nonnegative().int().optional(),\n origin: OriginSchema.optional().default('viewport'),\n });\n // input.WheelSourceAction = (\n // input.PauseAction //\n // input.WheelScrollAction\n // )\n const WheelSourceActionSchema = zod_1.z.discriminatedUnion('type', [\n PauseActionSchema,\n WheelScrollActionSchema,\n ]);\n // input.WheelSourceActions = {\n // type: \"wheel\",\n // id: text,\n // actions: [*input.WheelSourceAction]\n // }\n const WheelSourceActionsSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.SourceActionsType.Wheel),\n id: zod_1.z.string(),\n actions: zod_1.z.array(WheelSourceActionSchema),\n });\n // input.PointerSourceAction = (\n // input.PauseAction //\n // input.PointerDownAction //\n // input.PointerUpAction //\n // input.PointerMoveAction\n // )\n const PointerSourceActionSchema = zod_1.z.union([\n PauseActionSchema,\n PointerDownActionSchema,\n PointerUpActionSchema,\n PointerMoveActionSchema,\n ]);\n // input.PointerType = \"mouse\" / \"pen\" / \"touch\"\n const PointerTypeSchema = zod_1.z.nativeEnum(protocol_js_1.Input.PointerType);\n // input.PointerParameters = {\n // ? pointerType: input.PointerType .default \"mouse\"\n // }\n const PointerParametersSchema = zod_1.z.object({\n pointerType: PointerTypeSchema.optional().default(protocol_js_1.Input.PointerType.Mouse),\n });\n // input.PointerSourceActions = {\n // type: \"pointer\",\n // id: text,\n // ? parameters: input.PointerParameters,\n // actions: [*input.PointerSourceAction]\n // }\n const PointerSourceActionsSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.SourceActionsType.Pointer),\n id: zod_1.z.string(),\n parameters: PointerParametersSchema.optional(),\n actions: zod_1.z.array(PointerSourceActionSchema),\n });\n // input.KeySourceAction = (\n // input.PauseAction //\n // input.KeyDownAction //\n // input.KeyUpAction\n // )\n const KeySourceActionSchema = zod_1.z.discriminatedUnion('type', [\n PauseActionSchema,\n KeyDownActionSchema,\n KeyUpActionSchema,\n ]);\n // input.KeySourceActions = {\n // type: \"key\",\n // id: text,\n // actions: [*input.KeySourceAction]\n // }\n const KeySourceActionsSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.SourceActionsType.Key),\n id: zod_1.z.string(),\n actions: zod_1.z.array(KeySourceActionSchema),\n });\n // input.NoneSourceAction = input.PauseAction\n const NoneSourceActionSchema = PauseActionSchema;\n // input.NoneSourceActions = {\n // type: \"none\",\n // id: text,\n // actions: [*input.NoneSourceAction]\n // }\n const NoneSourceActionsSchema = zod_1.z.object({\n type: zod_1.z.literal(protocol_js_1.Input.SourceActionsType.None),\n id: zod_1.z.string(),\n actions: zod_1.z.array(NoneSourceActionSchema),\n });\n // input.SourceActions = (\n // input.NoneSourceActions //\n // input.KeySourceActions //\n // input.PointerSourceActions //\n // input.WheelSourceActions\n // )\n const SourceActionsSchema = zod_1.z.discriminatedUnion('type', [\n NoneSourceActionsSchema,\n KeySourceActionsSchema,\n PointerSourceActionsSchema,\n WheelSourceActionsSchema,\n ]);\n // input.PerformActionsParameters = {\n // context: browsingContext.BrowsingContext,\n // actions: [*input.SourceActions]\n // }\n const PerformActionsParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n actions: zod_1.z.array(SourceActionsSchema),\n });\n function parsePerformActionsParams(params) {\n return parseObject(params, PerformActionsParametersSchema);\n }\n Input.parsePerformActionsParams = parsePerformActionsParams;\n // input.ReleaseActionsParameters = {\n // context: browsingContext.BrowsingContext,\n // }\n const ReleaseActionsParametersSchema = zod_1.z.object({\n context: CommonDataTypes.BrowsingContextSchema,\n });\n function parseReleaseActionsParams(params) {\n return parseObject(params, ReleaseActionsParametersSchema);\n }\n Input.parseReleaseActionsParams = parseReleaseActionsParams;\n})(Input = exports.Input || (exports.Input = {}));\n//# sourceMappingURL=protocol-parser.js.map","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EventEmitter = void 0;\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst mitt_1 = __importDefault(require(\"mitt\"));\nclass EventEmitter {\n #emitter = (0, mitt_1.default)();\n on(type, handler) {\n this.#emitter.on(type, handler);\n return this;\n }\n /**\n * Like `on` but the listener will only be fired once and then it will be removed.\n * @param event The event you'd like to listen to\n * @param handler The handler function to run when the event occurs\n * @return `this` to enable chaining method calls.\n */\n once(event, handler) {\n const onceHandler = (eventData) => {\n handler(eventData);\n this.off(event, onceHandler);\n };\n return this.on(event, onceHandler);\n }\n off(type, handler) {\n this.#emitter.off(type, handler);\n return this;\n }\n /**\n * Emits an event and call any associated listeners.\n *\n * @param event The event to emit.\n * @param eventData Any data to emit with the event.\n * @return `true` if there are any listeners, `false` otherwise.\n */\n emit(event, eventData) {\n this.#emitter.emit(event, eventData);\n }\n}\nexports.EventEmitter = EventEmitter;\n//# sourceMappingURL=EventEmitter.js.map","module.exports=function(n){return{all:n=n||new Map,on:function(e,t){var i=n.get(e);i?i.push(t):n.set(e,[t])},off:function(e,t){var i=n.get(e);i&&(t?i.splice(i.indexOf(t)>>>0,1):n.set(e,[]))},emit:function(e,t){var i=n.get(e);i&&i.slice().map(function(n){n(t)}),(i=n.get(\"*\"))&&i.slice().map(function(n){n(e,t)})}}};\n//# sourceMappingURL=mitt.js.map\n","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LogType = void 0;\nvar LogType;\n(function (LogType) {\n // keep-sorted start\n LogType[\"bidi\"] = \"BiDi Messages\";\n LogType[\"browsingContexts\"] = \"Browsing Contexts\";\n LogType[\"cdp\"] = \"CDP\";\n LogType[\"system\"] = \"System\";\n // keep-sorted end\n})(LogType = exports.LogType || (exports.LogType = {}));\n//# sourceMappingURL=log.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ProcessingQueue = void 0;\nconst log_js_1 = require(\"./log.js\");\nclass ProcessingQueue {\n #logger;\n #processor;\n #queue = [];\n // Flag to keep only 1 active processor.\n #isProcessing = false;\n constructor(processor, logger) {\n this.#processor = processor;\n this.#logger = logger;\n }\n add(entry) {\n this.#queue.push(entry);\n // No need in waiting. Just initialise processor if needed.\n void this.#processIfNeeded();\n }\n async #processIfNeeded() {\n if (this.#isProcessing) {\n return;\n }\n this.#isProcessing = true;\n while (this.#queue.length > 0) {\n const entryPromise = this.#queue.shift();\n if (entryPromise !== undefined) {\n await entryPromise\n .then((entry) => this.#processor(entry))\n .catch((e) => {\n this.#logger?.(log_js_1.LogType.system, 'Event was not processed:', e);\n });\n }\n }\n this.#isProcessing = false;\n }\n}\nexports.ProcessingQueue = ProcessingQueue;\n//# sourceMappingURL=processingQueue.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.assert = void 0;\nfunction assert(predicate) {\n if (!predicate) {\n throw new Error('Internal assertion failed.');\n }\n}\nexports.assert = assert;\n//# sourceMappingURL=assert.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n * Copyright 2022 The Chromium Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Mutex = void 0;\n/**\n * Use Mutex class to coordinate local concurrent operations.\n * Once `acquire` promise resolves, you hold the lock and must\n * call `release` function returned by `acquire` to release the\n * lock. Failing to `release` the lock may lead to deadlocks.\n */\nclass Mutex {\n #locked = false;\n #acquirers = [];\n // This is FIFO.\n acquire() {\n const state = { resolved: false };\n if (this.#locked) {\n return new Promise((resolve) => {\n this.#acquirers.push(() => resolve(this.#release.bind(this, state)));\n });\n }\n this.#locked = true;\n return Promise.resolve(this.#release.bind(this, state));\n }\n #release(state) {\n if (state.resolved) {\n throw new Error('Cannot release more than once.');\n }\n state.resolved = true;\n const resolve = this.#acquirers.shift();\n if (!resolve) {\n this.#locked = false;\n return;\n }\n resolve();\n }\n async run(action) {\n const release = await this.acquire();\n try {\n // Note we need to await here because we want the await to release AFTER\n // that await happens. Returning action() will trigger the release\n // immediately which is counter to what we want.\n const result = await action();\n return result;\n }\n finally {\n release();\n }\n }\n}\nexports.Mutex = Mutex;\n//# sourceMappingURL=Mutex.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.WheelSource = exports.PointerSource = exports.KeySource = exports.NoneSource = exports.SourceType = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nexports.SourceType = protocol_js_1.Input.SourceActionsType;\nclass NoneSource {\n type = exports.SourceType.None;\n}\nexports.NoneSource = NoneSource;\nclass KeySource {\n type = exports.SourceType.Key;\n pressed = new Set();\n // This is a bitfield that matches the modifiers parameter of\n // https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchKeyEvent\n #modifiers = 0;\n get modifiers() {\n return this.#modifiers;\n }\n get alt() {\n return (this.#modifiers & 1) === 1;\n }\n set alt(value) {\n this.#setModifier(value, 1);\n }\n get ctrl() {\n return (this.#modifiers & 2) === 2;\n }\n set ctrl(value) {\n this.#setModifier(value, 2);\n }\n get meta() {\n return (this.#modifiers & 4) === 4;\n }\n set meta(value) {\n this.#setModifier(value, 4);\n }\n get shift() {\n return (this.#modifiers & 8) === 8;\n }\n set shift(value) {\n this.#setModifier(value, 8);\n }\n #setModifier(value, bit) {\n if (value) {\n this.#modifiers |= bit;\n }\n else {\n this.#modifiers &= ~bit;\n }\n }\n}\nexports.KeySource = KeySource;\nclass PointerSource {\n type = exports.SourceType.Pointer;\n subtype;\n pointerId;\n pressed = new Set();\n x = 0;\n y = 0;\n constructor(id, subtype) {\n this.pointerId = id;\n this.subtype = subtype;\n }\n // This is a bitfield that matches the buttons parameter of\n // https://chromedevtools.github.io/devtools-protocol/tot/Input/#method-dispatchMouseEvent\n get buttons() {\n let buttons = 0;\n for (const button of this.pressed) {\n switch (button) {\n case 0:\n buttons |= 1;\n break;\n case 1:\n buttons |= 4;\n break;\n case 2:\n buttons |= 2;\n break;\n case 3:\n buttons |= 8;\n break;\n case 4:\n buttons |= 16;\n break;\n }\n }\n return buttons;\n }\n // --- Platform-specific state starts here ---\n // Input.dispatchMouseEvent doesn't know the concept of double click, so we\n // need to create it like for OSes:\n // https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:ui/events/event.cc;l=479\n static #DOUBLE_CLICK_TIME_MS = 500;\n static #MAX_DOUBLE_CLICK_RADIUS = 2;\n #clickCount = 0;\n #lastClick;\n setClickCount(context) {\n if (!this.#lastClick ||\n // The click needs to be within a certain amount of ms.\n context.timeStamp - this.#lastClick.timeStamp >\n PointerSource.#DOUBLE_CLICK_TIME_MS ||\n // The click needs to be within a square radius.\n Math.abs(this.#lastClick.x - context.x) >\n PointerSource.#MAX_DOUBLE_CLICK_RADIUS ||\n Math.abs(this.#lastClick.y - context.y) >\n PointerSource.#MAX_DOUBLE_CLICK_RADIUS) {\n this.#clickCount = 0;\n }\n ++this.#clickCount;\n this.#lastClick = context;\n }\n get clickCount() {\n return this.#clickCount;\n }\n}\nexports.PointerSource = PointerSource;\nclass WheelSource {\n type = exports.SourceType.Wheel;\n}\nexports.WheelSource = WheelSource;\n//# sourceMappingURL=InputSource.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InputState = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst Mutex_js_1 = require(\"../../../utils/Mutex.js\");\nconst InputSource_js_1 = require(\"./InputSource.js\");\nclass InputState {\n cancelList = [];\n #sources = new Map();\n #mutex = new Mutex_js_1.Mutex();\n getOrCreate(id, type, subtype) {\n let source = this.#sources.get(id);\n if (!source) {\n switch (type) {\n case InputSource_js_1.SourceType.None:\n source = new InputSource_js_1.NoneSource();\n break;\n case InputSource_js_1.SourceType.Key:\n source = new InputSource_js_1.KeySource();\n break;\n case InputSource_js_1.SourceType.Pointer: {\n let pointerId = subtype === protocol_js_1.Input.PointerType.Mouse ? 0 : 2;\n const pointerIds = new Set();\n for (const [, source] of this.#sources) {\n if (source.type === InputSource_js_1.SourceType.Pointer) {\n pointerIds.add(source.pointerId);\n }\n }\n while (pointerIds.has(pointerId)) {\n ++pointerId;\n }\n source = new InputSource_js_1.PointerSource(pointerId, subtype);\n break;\n }\n case InputSource_js_1.SourceType.Wheel:\n source = new InputSource_js_1.WheelSource();\n break;\n default:\n throw new protocol_js_1.Message.InvalidArgumentException(`Expected \"${InputSource_js_1.SourceType.None}\", \"${InputSource_js_1.SourceType.Key}\", \"${InputSource_js_1.SourceType.Pointer}\", or \"${InputSource_js_1.SourceType.Wheel}\". Found unknown source type ${type}.`);\n }\n this.#sources.set(id, source);\n return source;\n }\n if (source.type !== type) {\n throw new protocol_js_1.Message.InvalidArgumentException(`Input source type of ${id} is ${source.type}, but received ${type}.`);\n }\n return source;\n }\n get(id) {\n const source = this.#sources.get(id);\n if (!source) {\n throw new protocol_js_1.Message.UnknownErrorException(`Internal error.`);\n }\n return source;\n }\n getGlobalKeyState() {\n const state = new InputSource_js_1.KeySource();\n for (const [, source] of this.#sources) {\n if (source.type !== InputSource_js_1.SourceType.Key) {\n continue;\n }\n for (const pressed of source.pressed) {\n state.pressed.add(pressed);\n }\n state.alt ||= source.alt;\n state.ctrl ||= source.ctrl;\n state.meta ||= source.meta;\n state.shift ||= source.shift;\n }\n return state;\n }\n get queue() {\n return this.#mutex;\n }\n}\nexports.InputState = InputState;\n//# sourceMappingURL=InputState.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.InputStateManager = void 0;\nconst assert_js_1 = require(\"../../../utils/assert.js\");\nconst InputState_js_1 = require(\"./InputState.js\");\nclass InputStateManager {\n // We use a weak map here as specified here:\n // https://www.w3.org/TR/webdriver/#dfn-browsing-context-input-state-map\n #states = new WeakMap();\n get(context) {\n (0, assert_js_1.assert)(context.isTopLevelContext());\n let state = this.#states.get(context);\n if (!state) {\n state = new InputState_js_1.InputState();\n this.#states.set(context, state);\n }\n return state;\n }\n delete(context) {\n this.#states.delete(context);\n }\n}\nexports.InputStateManager = InputStateManager;\n//# sourceMappingURL=InputStateManager.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.KeyToKeyCode = void 0;\n// TODO: Remove this once https://crrev.com/c/4548290 is stably in Chromium.\n// `Input.dispatchKeyboardEvent` will automatically handle these conversions.\nexports.KeyToKeyCode = {\n '0': 48,\n '1': 49,\n '2': 50,\n '3': 51,\n '4': 52,\n '5': 53,\n '6': 54,\n '7': 55,\n '8': 56,\n '9': 57,\n Abort: 3,\n Help: 6,\n Backspace: 8,\n Tab: 9,\n Numpad5: 12,\n NumpadEnter: 13,\n Enter: 13,\n '\\\\r': 13,\n '\\\\n': 13,\n ShiftLeft: 16,\n ShiftRight: 16,\n ControlLeft: 17,\n ControlRight: 17,\n AltLeft: 18,\n AltRight: 18,\n Pause: 19,\n CapsLock: 20,\n Escape: 27,\n Convert: 28,\n NonConvert: 29,\n Space: 32,\n Numpad9: 33,\n PageUp: 33,\n Numpad3: 34,\n PageDown: 34,\n End: 35,\n Numpad1: 35,\n Home: 36,\n Numpad7: 36,\n ArrowLeft: 37,\n Numpad4: 37,\n Numpad8: 38,\n ArrowUp: 38,\n ArrowRight: 39,\n Numpad6: 39,\n Numpad2: 40,\n ArrowDown: 40,\n Select: 41,\n Open: 43,\n PrintScreen: 44,\n Insert: 45,\n Numpad0: 45,\n Delete: 46,\n NumpadDecimal: 46,\n Digit0: 48,\n Digit1: 49,\n Digit2: 50,\n Digit3: 51,\n Digit4: 52,\n Digit5: 53,\n Digit6: 54,\n Digit7: 55,\n Digit8: 56,\n Digit9: 57,\n KeyA: 65,\n KeyB: 66,\n KeyC: 67,\n KeyD: 68,\n KeyE: 69,\n KeyF: 70,\n KeyG: 71,\n KeyH: 72,\n KeyI: 73,\n KeyJ: 74,\n KeyK: 75,\n KeyL: 76,\n KeyM: 77,\n KeyN: 78,\n KeyO: 79,\n KeyP: 80,\n KeyQ: 81,\n KeyR: 82,\n KeyS: 83,\n KeyT: 84,\n KeyU: 85,\n KeyV: 86,\n KeyW: 87,\n KeyX: 88,\n KeyY: 89,\n KeyZ: 90,\n MetaLeft: 91,\n MetaRight: 92,\n ContextMenu: 93,\n NumpadMultiply: 106,\n NumpadAdd: 107,\n NumpadSubtract: 109,\n NumpadDivide: 111,\n F1: 112,\n F2: 113,\n F3: 114,\n F4: 115,\n F5: 116,\n F6: 117,\n F7: 118,\n F8: 119,\n F9: 120,\n F10: 121,\n F11: 122,\n F12: 123,\n F13: 124,\n F14: 125,\n F15: 126,\n F16: 127,\n F17: 128,\n F18: 129,\n F19: 130,\n F20: 131,\n F21: 132,\n F22: 133,\n F23: 134,\n F24: 135,\n NumLock: 144,\n ScrollLock: 145,\n AudioVolumeMute: 173,\n AudioVolumeDown: 174,\n AudioVolumeUp: 175,\n MediaTrackNext: 176,\n MediaTrackPrevious: 177,\n MediaStop: 178,\n MediaPlayPause: 179,\n Semicolon: 186,\n Equal: 187,\n NumpadEqual: 187,\n Comma: 188,\n Minus: 189,\n Period: 190,\n Slash: 191,\n Backquote: 192,\n BracketLeft: 219,\n Backslash: 220,\n BracketRight: 221,\n Quote: 222,\n AltGraph: 225,\n Props: 247,\n Cancel: 3,\n Clear: 12,\n Shift: 16,\n Control: 17,\n Alt: 18,\n Accept: 30,\n ModeChange: 31,\n ' ': 32,\n Print: 42,\n Execute: 43,\n '\\\\u0000': 46,\n a: 65,\n b: 66,\n c: 67,\n d: 68,\n e: 69,\n f: 70,\n g: 71,\n h: 72,\n i: 73,\n j: 74,\n k: 75,\n l: 76,\n m: 77,\n n: 78,\n o: 79,\n p: 80,\n q: 81,\n r: 82,\n s: 83,\n t: 84,\n u: 85,\n v: 86,\n w: 87,\n x: 88,\n y: 89,\n z: 90,\n Meta: 91,\n '*': 106,\n '+': 107,\n '-': 109,\n '/': 111,\n ';': 186,\n '=': 187,\n ',': 188,\n '.': 190,\n '`': 192,\n '[': 219,\n '\\\\\\\\': 220,\n ']': 221,\n \"'\": 222,\n Attn: 246,\n CrSel: 247,\n ExSel: 248,\n EraseEof: 249,\n Play: 250,\n ZoomOut: 251,\n ')': 48,\n '!': 49,\n '@': 50,\n '#': 51,\n $: 52,\n '%': 53,\n '^': 54,\n '&': 55,\n '(': 57,\n A: 65,\n B: 66,\n C: 67,\n D: 68,\n E: 69,\n F: 70,\n G: 71,\n H: 72,\n I: 73,\n J: 74,\n K: 75,\n L: 76,\n M: 77,\n N: 78,\n O: 79,\n P: 80,\n Q: 81,\n R: 82,\n S: 83,\n T: 84,\n U: 85,\n V: 86,\n W: 87,\n X: 88,\n Y: 89,\n Z: 90,\n ':': 186,\n '<': 188,\n _: 189,\n '>': 190,\n '?': 191,\n '~': 192,\n '{': 219,\n '|': 220,\n '}': 221,\n '\"': 222,\n Camera: 44,\n EndCall: 95,\n VolumeDown: 182,\n VolumeUp: 183,\n};\n//# sourceMappingURL=USKeyboardLayout.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getKeyLocation = exports.getKeyCode = exports.getNormalizedKey = void 0;\nfunction getNormalizedKey(value) {\n switch (value) {\n case '\\uE000':\n return 'Unidentified';\n case '\\uE001':\n return 'Cancel';\n case '\\uE002':\n return 'Help';\n case '\\uE003':\n return 'Backspace';\n case '\\uE004':\n return 'Tab';\n case '\\uE005':\n return 'Clear';\n case '\\uE006':\n return 'Return';\n case '\\uE007':\n return 'Enter';\n case '\\uE008':\n return 'Shift';\n case '\\uE009':\n return 'Control';\n case '\\uE00A':\n return 'Alt';\n case '\\uE00B':\n return 'Pause';\n case '\\uE00C':\n return 'Escape';\n case '\\uE00D':\n return ' ';\n case '\\uE00E':\n return 'PageUp';\n case '\\uE00F':\n return 'PageDown';\n case '\\uE010':\n return 'End';\n case '\\uE011':\n return 'Home';\n case '\\uE012':\n return 'ArrowLeft';\n case '\\uE013':\n return 'ArrowUp';\n case '\\uE014':\n return 'ArrowRight';\n case '\\uE015':\n return 'ArrowDown';\n case '\\uE016':\n return 'Insert';\n case '\\uE017':\n return 'Delete';\n case '\\uE018':\n return ';';\n case '\\uE019':\n return '=';\n case '\\uE01A':\n return '0';\n case '\\uE01B':\n return '1';\n case '\\uE01C':\n return '2';\n case '\\uE01D':\n return '3';\n case '\\uE01E':\n return '4';\n case '\\uE01F':\n return '5';\n case '\\uE020':\n return '6';\n case '\\uE021':\n return '7';\n case '\\uE022':\n return '8';\n case '\\uE023':\n return '9';\n case '\\uE024':\n return '*';\n case '\\uE025':\n return '+';\n case '\\uE026':\n return ',';\n case '\\uE027':\n return '-';\n case '\\uE028':\n return '.';\n case '\\uE029':\n return '/';\n case '\\uE031':\n return 'F1';\n case '\\uE032':\n return 'F2';\n case '\\uE033':\n return 'F3';\n case '\\uE034':\n return 'F4';\n case '\\uE035':\n return 'F5';\n case '\\uE036':\n return 'F6';\n case '\\uE037':\n return 'F7';\n case '\\uE038':\n return 'F8';\n case '\\uE039':\n return 'F9';\n case '\\uE03A':\n return 'F10';\n case '\\uE03B':\n return 'F11';\n case '\\uE03C':\n return 'F12';\n case '\\uE03D':\n return 'Meta';\n case '\\uE040':\n return 'ZenkakuHankaku';\n case '\\uE050':\n return 'Shift';\n case '\\uE051':\n return 'Control';\n case '\\uE052':\n return 'Alt';\n case '\\uE053':\n return 'Meta';\n case '\\uE054':\n return 'PageUp';\n case '\\uE055':\n return 'PageDown';\n case '\\uE056':\n return 'End';\n case '\\uE057':\n return 'Home';\n case '\\uE058':\n return 'ArrowLeft';\n case '\\uE059':\n return 'ArrowUp';\n case '\\uE05A':\n return 'ArrowRight';\n case '\\uE05B':\n return 'ArrowDown';\n case '\\uE05C':\n return 'Insert';\n case '\\uE05D':\n return 'Delete';\n default:\n return value;\n }\n}\nexports.getNormalizedKey = getNormalizedKey;\nfunction getKeyCode(key) {\n switch (key) {\n case '`':\n case '~':\n return 'Backquote';\n case '\\\\':\n case '|':\n return 'Backslash';\n case '\\uE003':\n return 'Backspace';\n case '[':\n case '{':\n return 'BracketLeft';\n case ']':\n case '}':\n return 'BracketRight';\n case ',':\n case '<':\n return 'Comma';\n case '0':\n case ')':\n return 'Digit0';\n case '1':\n case '!':\n return 'Digit1';\n case '2':\n case '@':\n return 'Digit2';\n case '3':\n case '#':\n return 'Digit3';\n case '4':\n case '$':\n return 'Digit4';\n case '5':\n case '%':\n return 'Digit5';\n case '6':\n case '^':\n return 'Digit6';\n case '7':\n case '&':\n return 'Digit7';\n case '8':\n case '*':\n return 'Digit8';\n case '9':\n case '(':\n return 'Digit9';\n case '=':\n case '+':\n return 'Equal';\n case 'a':\n case 'A':\n return 'KeyA';\n case 'b':\n case 'B':\n return 'KeyB';\n case 'c':\n case 'C':\n return 'KeyC';\n case 'd':\n case 'D':\n return 'KeyD';\n case 'e':\n case 'E':\n return 'KeyE';\n case 'f':\n case 'F':\n return 'KeyF';\n case 'g':\n case 'G':\n return 'KeyG';\n case 'h':\n case 'H':\n return 'KeyH';\n case 'i':\n case 'I':\n return 'KeyI';\n case 'j':\n case 'J':\n return 'KeyJ';\n case 'k':\n case 'K':\n return 'KeyK';\n case 'l':\n case 'L':\n return 'KeyL';\n case 'm':\n case 'M':\n return 'KeyM';\n case 'n':\n case 'N':\n return 'KeyN';\n case 'o':\n case 'O':\n return 'KeyO';\n case 'p':\n case 'P':\n return 'KeyP';\n case 'q':\n case 'Q':\n return 'KeyQ';\n case 'r':\n case 'R':\n return 'KeyR';\n case 's':\n case 'S':\n return 'KeyS';\n case 't':\n case 'T':\n return 'KeyT';\n case 'u':\n case 'U':\n return 'KeyU';\n case 'v':\n case 'V':\n return 'KeyV';\n case 'w':\n case 'W':\n return 'KeyW';\n case 'x':\n case 'X':\n return 'KeyX';\n case 'y':\n case 'Y':\n return 'KeyY';\n case 'z':\n case 'Z':\n return 'KeyZ';\n case '-':\n case '_':\n return 'Minus';\n case '.':\n return 'Period';\n case \"'\":\n case '\"':\n return 'Quote';\n case ';':\n case ':':\n return 'Semicolon';\n case '/':\n case '?':\n return 'Slash';\n case '\\uE00A':\n return 'AltLeft';\n case '\\uE052':\n return 'AltRight';\n case '\\uE009':\n return 'ControlLeft';\n case '\\uE051':\n return 'ControlRight';\n case '\\uE006':\n return 'Enter';\n case '\\uE03D':\n return 'MetaLeft';\n case '\\uE053':\n return 'MetaRight';\n case '\\uE008':\n return 'ShiftLeft';\n case '\\uE050':\n return 'ShiftRight';\n case ' ':\n case '\\uE00D':\n return 'Space';\n case '\\uE004':\n return 'Tab';\n case '\\uE017':\n return 'Delete';\n case '\\uE010':\n return 'End';\n case '\\uE002':\n return 'Help';\n case '\\uE011':\n return 'Home';\n case '\\uE016':\n return 'Insert';\n case '\\uE00F':\n return 'PageDown';\n case '\\uE00E':\n return 'PageUp';\n case '\\uE015':\n return 'ArrowDown';\n case '\\uE012':\n return 'ArrowLeft';\n case '\\uE014':\n return 'ArrowRight';\n case '\\uE013':\n return 'ArrowUp';\n case '\\uE00C':\n return 'Escape';\n case '\\uE031':\n return 'F1';\n case '\\uE032':\n return 'F2';\n case '\\uE033':\n return 'F3';\n case '\\uE034':\n return 'F4';\n case '\\uE035':\n return 'F5';\n case '\\uE036':\n return 'F6';\n case '\\uE037':\n return 'F7';\n case '\\uE038':\n return 'F8';\n case '\\uE039':\n return 'F9';\n case '\\uE03A':\n return 'F10';\n case '\\uE03B':\n return 'F11';\n case '\\uE03C':\n return 'F12';\n case '\\uE01A':\n case '\\uE05C':\n return 'Numpad0';\n case '\\uE01B':\n case '\\uE056':\n return 'Numpad1';\n case '\\uE01C':\n case '\\uE05B':\n return 'Numpad2';\n case '\\uE01D':\n case '\\uE055':\n return 'Numpad3';\n case '\\uE01E':\n case '\\uE058':\n return 'Numpad4';\n case '\\uE01F':\n return 'Numpad5';\n case '\\uE020':\n case '\\uE05A':\n return 'Numpad6';\n case '\\uE021':\n case '\\uE057':\n return 'Numpad7';\n case '\\uE022':\n case '\\uE059':\n return 'Numpad8';\n case '\\uE023':\n case '\\uE054':\n return 'Numpad9';\n case '\\uE025':\n return 'NumpadAdd';\n case '\\uE026':\n return 'NumpadComma';\n case '\\uE028':\n case '\\uE05D':\n return 'NumpadDecimal';\n case '\\uE029':\n return 'NumpadDivide';\n case '\\uE007':\n return 'NumpadEnter';\n case '\\uE024':\n return 'NumpadMultiply';\n case '\\uE027':\n return 'NumpadSubtract';\n default:\n return;\n }\n}\nexports.getKeyCode = getKeyCode;\nfunction getKeyLocation(key) {\n switch (key) {\n case '\\uE007':\n case '\\uE008':\n case '\\uE009':\n case '\\uE00A':\n case '\\uE03D':\n return 1;\n case '\\uE01A':\n case '\\uE01B':\n case '\\uE01C':\n case '\\uE01D':\n case '\\uE01E':\n case '\\uE01F':\n case '\\uE020':\n case '\\uE021':\n case '\\uE022':\n case '\\uE023':\n case '\\uE024':\n case '\\uE025':\n case '\\uE026':\n case '\\uE027':\n case '\\uE028':\n case '\\uE029':\n case '\\uE054':\n case '\\uE055':\n case '\\uE056':\n case '\\uE057':\n case '\\uE058':\n case '\\uE059':\n case '\\uE05A':\n case '\\uE05B':\n case '\\uE05C':\n case '\\uE05D':\n return 3;\n case '\\uE050':\n case '\\uE051':\n case '\\uE052':\n case '\\uE053':\n return 2;\n default:\n return 0;\n }\n}\nexports.getKeyLocation = getKeyLocation;\n//# sourceMappingURL=keyUtils.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ActionDispatcher = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst assert_js_1 = require(\"../../../utils/assert.js\");\nconst USKeyboardLayout_js_1 = require(\"./USKeyboardLayout.js\");\nconst keyUtils_js_1 = require(\"./keyUtils.js\");\n/** https://w3c.github.io/webdriver/#dfn-center-point */\nconst CALCULATE_IN_VIEW_CENTER_PT_DECL = ((i) => {\n const t = i.getClientRects()[0], e = Math.max(0, Math.min(t.x, t.x + t.width)), n = Math.min(window.innerWidth, Math.max(t.x, t.x + t.width)), h = Math.max(0, Math.min(t.y, t.y + t.height)), m = Math.min(window.innerHeight, Math.max(t.y, t.y + t.height));\n return [e + ((n - e) >> 1), h + ((m - h) >> 1)];\n}).toString();\nconst IS_MAC_DECL = (() => {\n return navigator.platform.toLowerCase().includes('mac');\n}).toString();\nasync function getElementCenter(context, element) {\n const { result } = await (await context.getOrCreateSandbox(undefined)).callFunction(CALCULATE_IN_VIEW_CENTER_PT_DECL, { type: 'undefined' }, [element], false, 'none', {});\n if (result.type === 'exception') {\n throw new protocol_js_1.Message.NoSuchElementException(`Origin element ${element.sharedId} was not found`);\n }\n (0, assert_js_1.assert)(result.result.type === 'array');\n (0, assert_js_1.assert)(result.result.value?.[0]?.type === 'number');\n (0, assert_js_1.assert)(result.result.value?.[1]?.type === 'number');\n const { result: { value: [{ value: x }, { value: y }], }, } = result;\n return { x: x, y: y };\n}\nclass ActionDispatcher {\n static isMacOS = async (context) => {\n const { result } = await (await context.getOrCreateSandbox(undefined)).callFunction(IS_MAC_DECL, { type: 'undefined' }, [], false, 'none', {});\n (0, assert_js_1.assert)(result.type !== 'exception');\n (0, assert_js_1.assert)(result.result.type === 'boolean');\n return result.result.value;\n };\n #tickStart = 0;\n #tickDuration = 0;\n #inputState;\n #context;\n #isMacOS;\n constructor(inputState, context, isMacOS) {\n this.#inputState = inputState;\n this.#context = context;\n this.#isMacOS = isMacOS;\n }\n async dispatchActions(optionsByTick) {\n await this.#inputState.queue.run(async () => {\n for (const options of optionsByTick) {\n await this.dispatchTickActions(options);\n }\n });\n }\n async dispatchTickActions(options) {\n this.#tickStart = performance.now();\n this.#tickDuration = 0;\n for (const { action } of options) {\n if ('duration' in action && action.duration !== undefined) {\n this.#tickDuration = Math.max(this.#tickDuration, action.duration);\n }\n }\n const promises = [\n new Promise((resolve) => setTimeout(resolve, this.#tickDuration)),\n ];\n for (const option of options) {\n promises.push(this.#dispatchAction(option));\n }\n await Promise.all(promises);\n }\n async #dispatchAction({ id, action }) {\n const source = this.#inputState.get(id);\n const keyState = this.#inputState.getGlobalKeyState();\n switch (action.type) {\n case protocol_js_1.Input.ActionType.KeyDown: {\n // SAFETY: The source is validated before.\n await this.#dispatchKeyDownAction(source, action);\n this.#inputState.cancelList.push({\n id,\n action: {\n ...action,\n type: protocol_js_1.Input.ActionType.KeyUp,\n },\n });\n break;\n }\n case protocol_js_1.Input.ActionType.KeyUp: {\n // SAFETY: The source is validated before.\n await this.#dispatchKeyUpAction(source, action);\n break;\n }\n case protocol_js_1.Input.ActionType.Pause: {\n // TODO: Implement waiting on the input source.\n break;\n }\n case protocol_js_1.Input.ActionType.PointerDown: {\n // SAFETY: The source is validated before.\n await this.#dispatchPointerDownAction(source, keyState, action);\n this.#inputState.cancelList.push({\n id,\n action: {\n ...action,\n type: protocol_js_1.Input.ActionType.PointerUp,\n },\n });\n break;\n }\n case protocol_js_1.Input.ActionType.PointerMove: {\n // SAFETY: The source is validated before.\n await this.#dispatchPointerMoveAction(source, keyState, action);\n break;\n }\n case protocol_js_1.Input.ActionType.PointerUp: {\n // SAFETY: The source is validated before.\n await this.#dispatchPointerUpAction(source, keyState, action);\n break;\n }\n case protocol_js_1.Input.ActionType.Scroll: {\n // SAFETY: The source is validated before.\n await this.#dispatchScrollAction(source, keyState, action);\n break;\n }\n }\n }\n #dispatchPointerDownAction(source, keyState, action) {\n const { button } = action;\n if (source.pressed.has(button)) {\n return;\n }\n source.pressed.add(button);\n const { x, y, subtype: pointerType } = source;\n const { width, height, pressure, twist, tangentialPressure } = action;\n const { tiltX, tiltY } = 'tiltX' in action ? action : {};\n // TODO: Implement azimuth/altitude angle.\n // --- Platform-specific code begins here ---\n const { modifiers } = keyState;\n switch (pointerType) {\n case protocol_js_1.Input.PointerType.Mouse:\n case protocol_js_1.Input.PointerType.Pen:\n source.setClickCount({ x, y, timeStamp: performance.now() });\n // TODO: Implement width and height when available.\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {\n type: 'mousePressed',\n x,\n y,\n modifiers,\n button: (() => {\n switch (button) {\n case 0:\n return 'left';\n case 1:\n return 'middle';\n case 2:\n return 'right';\n case 3:\n return 'back';\n case 4:\n return 'forward';\n default:\n return 'none';\n }\n })(),\n buttons: source.buttons,\n clickCount: source.clickCount,\n pointerType,\n tangentialPressure,\n tiltX,\n tiltY,\n twist,\n force: pressure,\n });\n case protocol_js_1.Input.PointerType.Touch:\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchTouchEvent', {\n type: 'touchStart',\n touchPoints: [\n {\n x,\n y,\n radiusX: width,\n radiusY: height,\n tangentialPressure,\n tiltX,\n tiltY,\n twist,\n force: pressure,\n id: source.pointerId,\n },\n ],\n modifiers,\n });\n }\n // --- Platform-specific code ends here ---\n }\n #dispatchPointerUpAction(source, keyState, action) {\n const { button } = action;\n if (!source.pressed.has(button)) {\n return;\n }\n source.pressed.delete(button);\n const { x, y, subtype: pointerType } = source;\n // --- Platform-specific code begins here ---\n const { modifiers } = keyState;\n switch (pointerType) {\n case protocol_js_1.Input.PointerType.Mouse:\n case protocol_js_1.Input.PointerType.Pen:\n // TODO: Implement width and height when available.\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {\n type: 'mouseReleased',\n x,\n y,\n modifiers,\n button: (() => {\n switch (button) {\n case 0:\n return 'left';\n case 1:\n return 'middle';\n case 2:\n return 'right';\n case 3:\n return 'back';\n case 4:\n return 'forward';\n default:\n return 'none';\n }\n })(),\n buttons: source.buttons,\n clickCount: source.clickCount,\n pointerType,\n });\n case protocol_js_1.Input.PointerType.Touch:\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchTouchEvent', {\n type: 'touchEnd',\n touchPoints: [\n {\n x,\n y,\n id: source.pointerId,\n },\n ],\n modifiers,\n });\n }\n // --- Platform-specific code ends here ---\n }\n async #dispatchPointerMoveAction(source, keyState, action) {\n const { x: startX, y: startY, subtype: pointerType } = source;\n const { width, height, pressure, twist, tangentialPressure, x: offsetX, y: offsetY, origin = 'viewport', duration = this.#tickDuration, } = action;\n const { tiltX, tiltY } = 'tiltX' in action ? action : {};\n // TODO: Implement azimuth/altitude angle.\n const { targetX, targetY } = await this.#getCoordinateFromOrigin(origin, offsetX, offsetY, startX, startY);\n if (targetX < 0 || targetY < 0) {\n throw new protocol_js_1.Message.MoveTargetOutOfBoundsException(`Cannot move beyond viewport (x: ${targetX}, y: ${targetY})`);\n }\n let last;\n do {\n const ratio = duration > 0 ? (performance.now() - this.#tickStart) / duration : 1;\n last = ratio >= 1;\n let x;\n let y;\n if (last) {\n x = targetX;\n y = targetY;\n }\n else {\n x = Math.round(ratio * (targetX - startX) + startX);\n y = Math.round(ratio * (targetY - startY) + startY);\n }\n if (source.x !== x || source.y !== y) {\n // --- Platform-specific code begins here ---\n const { modifiers } = keyState;\n switch (pointerType) {\n case protocol_js_1.Input.PointerType.Mouse:\n case protocol_js_1.Input.PointerType.Pen:\n // TODO: Implement width and height when available.\n await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {\n type: 'mouseMoved',\n x,\n y,\n modifiers,\n clickCount: 0,\n buttons: source.buttons,\n pointerType,\n tangentialPressure,\n tiltX,\n tiltY,\n twist,\n force: pressure,\n });\n break;\n case protocol_js_1.Input.PointerType.Touch:\n await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchTouchEvent', {\n type: 'touchMove',\n touchPoints: [\n {\n x,\n y,\n radiusX: width,\n radiusY: height,\n tangentialPressure,\n tiltX,\n tiltY,\n twist,\n force: pressure,\n id: source.pointerId,\n },\n ],\n modifiers,\n });\n break;\n }\n // --- Platform-specific code ends here ---\n source.x = x;\n source.y = y;\n }\n } while (!last);\n }\n async #getCoordinateFromOrigin(origin, offsetX, offsetY, startX, startY) {\n let targetX;\n let targetY;\n switch (origin) {\n case 'viewport':\n targetX = offsetX;\n targetY = offsetY;\n break;\n case 'pointer':\n targetX = startX + offsetX;\n targetY = startY + offsetY;\n break;\n default: {\n const { x: posX, y: posY } = await getElementCenter(this.#context, origin.element);\n // SAFETY: These can never be special numbers.\n targetX = posX + offsetX;\n targetY = posY + offsetY;\n break;\n }\n }\n return { targetX, targetY };\n }\n async #dispatchScrollAction(_source, keyState, action) {\n const { deltaX: targetDeltaX, deltaY: targetDeltaY, x: offsetX, y: offsetY, origin = 'viewport', duration = this.#tickDuration, } = action;\n if (origin === 'pointer') {\n throw new protocol_js_1.Message.InvalidArgumentException('\"pointer\" origin is invalid for scrolling.');\n }\n const { targetX, targetY } = await this.#getCoordinateFromOrigin(origin, offsetX, offsetY, 0, 0);\n if (targetX < 0 || targetY < 0) {\n throw new protocol_js_1.Message.MoveTargetOutOfBoundsException(`Cannot move beyond viewport (x: ${targetX}, y: ${targetY})`);\n }\n let currentDeltaX = 0;\n let currentDeltaY = 0;\n let last;\n do {\n const ratio = duration > 0 ? (performance.now() - this.#tickStart) / duration : 1;\n last = ratio >= 1;\n let deltaX;\n let deltaY;\n if (last) {\n deltaX = targetDeltaX - currentDeltaX;\n deltaY = targetDeltaY - currentDeltaY;\n }\n else {\n deltaX = Math.round(ratio * targetDeltaX - currentDeltaX);\n deltaY = Math.round(ratio * targetDeltaY - currentDeltaY);\n }\n if (deltaX !== 0 || deltaY !== 0) {\n // --- Platform-specific code begins here ---\n const { modifiers } = keyState;\n await this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchMouseEvent', {\n type: 'mouseWheel',\n deltaX,\n deltaY,\n x: targetX,\n y: targetY,\n modifiers,\n });\n // --- Platform-specific code ends here ---\n currentDeltaX += deltaX;\n currentDeltaY += deltaY;\n }\n } while (!last);\n }\n #dispatchKeyDownAction(source, action) {\n const rawKey = action.value;\n const key = (0, keyUtils_js_1.getNormalizedKey)(rawKey);\n const repeat = source.pressed.has(key);\n const code = (0, keyUtils_js_1.getKeyCode)(rawKey);\n const location = (0, keyUtils_js_1.getKeyLocation)(rawKey);\n switch (key) {\n case 'Alt':\n source.alt = true;\n break;\n case 'Shift':\n source.shift = true;\n break;\n case 'Control':\n source.ctrl = true;\n break;\n case 'Meta':\n source.meta = true;\n break;\n }\n source.pressed.add(key);\n const { modifiers } = source;\n // --- Platform-specific code begins here ---\n // The spread is a little hack so JS gives us an array of unicode characters\n // to measure.\n const unmodifiedText = getKeyEventUnmodifiedText(key, source);\n const text = getKeyEventText(code ?? '', source) ?? unmodifiedText;\n let command;\n // The following commands need to be declared because Chromium doesn't\n // handle them. See\n // https://source.chromium.org/chromium/chromium/src/+/refs/heads/main:third_party/blink/renderer/core/editing/editing_behavior.cc;l=169;drc=b8143cf1dfd24842890fcd831c4f5d909bef4fc4;bpv=0;bpt=1.\n if (this.#isMacOS && source.meta) {\n switch (code) {\n case 'KeyA':\n command = 'SelectAll';\n break;\n case 'KeyC':\n command = 'Copy';\n break;\n case 'KeyV':\n command = source.shift ? 'PasteAndMatchStyle' : 'Paste';\n break;\n case 'KeyX':\n command = 'Cut';\n break;\n case 'KeyZ':\n command = source.shift ? 'Redo' : 'Undo';\n break;\n default:\n }\n }\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchKeyEvent', {\n type: text ? 'keyDown' : 'rawKeyDown',\n windowsVirtualKeyCode: USKeyboardLayout_js_1.KeyToKeyCode[key],\n key,\n code,\n text,\n unmodifiedText,\n autoRepeat: repeat,\n isSystemKey: source.alt || undefined,\n location: location < 3 ? location : undefined,\n isKeypad: location === 3,\n modifiers,\n commands: command ? [command] : undefined,\n });\n // --- Platform-specific code ends here ---\n }\n #dispatchKeyUpAction(source, action) {\n const rawKey = action.value;\n const key = (0, keyUtils_js_1.getNormalizedKey)(rawKey);\n if (!source.pressed.has(key)) {\n return;\n }\n const code = (0, keyUtils_js_1.getKeyCode)(rawKey);\n const location = (0, keyUtils_js_1.getKeyLocation)(rawKey);\n switch (key) {\n case 'Alt':\n source.alt = false;\n break;\n case 'Shift':\n source.shift = false;\n break;\n case 'Control':\n source.ctrl = false;\n break;\n case 'Meta':\n source.meta = false;\n break;\n }\n source.pressed.delete(key);\n const { modifiers } = source;\n // --- Platform-specific code begins here ---\n // The spread is a little hack so JS gives us an array of unicode characters\n // to measure.\n const unmodifiedText = getKeyEventUnmodifiedText(key, source);\n const text = getKeyEventText(code ?? '', source) ?? unmodifiedText;\n return this.#context.cdpTarget.cdpClient.sendCommand('Input.dispatchKeyEvent', {\n type: 'keyUp',\n windowsVirtualKeyCode: USKeyboardLayout_js_1.KeyToKeyCode[key],\n key,\n code,\n text,\n unmodifiedText,\n location: location < 3 ? location : undefined,\n isSystemKey: source.alt || undefined,\n isKeypad: location === 3,\n modifiers,\n });\n // --- Platform-specific code ends here ---\n }\n}\nexports.ActionDispatcher = ActionDispatcher;\nconst getKeyEventUnmodifiedText = (key, source) => {\n if (key === 'Enter') {\n return '\\r';\n }\n return [...key].length === 1\n ? source.shift\n ? key.toLocaleUpperCase('en-US')\n : key\n : undefined;\n};\nconst getKeyEventText = (code, source) => {\n if (source.ctrl) {\n switch (code) {\n case 'Digit2':\n if (source.shift) {\n return '\\x00';\n }\n break;\n case 'KeyA':\n return '\\x01';\n case 'KeyB':\n return '\\x02';\n case 'KeyC':\n return '\\x03';\n case 'KeyD':\n return '\\x04';\n case 'KeyE':\n return '\\x05';\n case 'KeyF':\n return '\\x06';\n case 'KeyG':\n return '\\x07';\n case 'KeyH':\n return '\\x08';\n case 'KeyI':\n return '\\x09';\n case 'KeyJ':\n return '\\x0A';\n case 'KeyK':\n return '\\x0B';\n case 'KeyL':\n return '\\x0C';\n case 'KeyM':\n return '\\x0D';\n case 'KeyN':\n return '\\x0E';\n case 'KeyO':\n return '\\x0F';\n case 'KeyP':\n return '\\x10';\n case 'KeyQ':\n return '\\x11';\n case 'KeyR':\n return '\\x12';\n case 'KeyS':\n return '\\x13';\n case 'KeyT':\n return '\\x14';\n case 'KeyU':\n return '\\x15';\n case 'KeyV':\n return '\\x16';\n case 'KeyW':\n return '\\x17';\n case 'KeyX':\n return '\\x18';\n case 'KeyY':\n return '\\x19';\n case 'KeyZ':\n return '\\x1A';\n case 'BracketLeft':\n return '\\x1B';\n case 'Backslash':\n return '\\x1C';\n case 'BracketRight':\n return '\\x1D';\n case 'Digit6':\n if (source.shift) {\n return '\\x1E';\n }\n break;\n case 'Minus':\n return '\\x1F';\n }\n return '';\n }\n if (source.alt) {\n return '';\n }\n return;\n};\n//# sourceMappingURL=ActionDispatcher.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.PreloadScriptStorage = void 0;\n/**\n * Container class for preload scripts.\n */\nclass PreloadScriptStorage {\n /** Tracks all BiDi preload scripts. */\n #scripts = new Set();\n /** Finds all entries that match the given filter. */\n findPreloadScripts(filter) {\n if (!filter) {\n return [...this.#scripts];\n }\n return [...this.#scripts].filter((script) => {\n if (filter.id !== undefined && filter.id !== script.id) {\n return false;\n }\n if (filter.contextId !== undefined &&\n filter.contextId !== script.contextId) {\n return false;\n }\n if (filter.contextIds !== undefined &&\n !filter.contextIds.includes(script.contextId)) {\n return false;\n }\n if (filter.targetId !== undefined &&\n !script.targetIds.has(filter.targetId)) {\n return false;\n }\n return true;\n });\n }\n addPreloadScript(preloadScript) {\n this.#scripts.add(preloadScript);\n }\n /** Deletes all BiDi preload script entries that match the given filter. */\n removeBiDiPreloadScripts(filter) {\n for (const preloadScript of this.findPreloadScripts(filter)) {\n this.#scripts.delete(preloadScript);\n }\n }\n}\nexports.PreloadScriptStorage = PreloadScriptStorage;\n//# sourceMappingURL=PreloadScriptStorage.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.inchesFromCm = void 0;\n/** @return Given an input in cm, convert it to inches. */\nfunction inchesFromCm(cm) {\n return cm / 2.54;\n}\nexports.inchesFromCm = inchesFromCm;\n//# sourceMappingURL=unitConversions.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Deferred = void 0;\nclass Deferred {\n #isFinished = false;\n #promise;\n #resolve;\n #reject;\n get isFinished() {\n return this.#isFinished;\n }\n constructor() {\n this.#promise = new Promise((resolve, reject) => {\n this.#resolve = resolve;\n this.#reject = reject;\n });\n // Needed to avoid `Uncaught (in promise)`. The promises returned by `then`\n // and `catch` will be rejected anyway.\n this.#promise.catch((_error) => {\n // Intentionally empty.\n });\n }\n then(onFulfilled, onRejected) {\n return this.#promise.then(onFulfilled, onRejected);\n }\n catch(onRejected) {\n return this.#promise.catch(onRejected);\n }\n resolve(value) {\n this.#isFinished = true;\n this.#resolve?.(value);\n }\n reject(reason) {\n this.#isFinished = true;\n this.#reject?.(reason);\n }\n finally(onFinally) {\n return this.#promise.finally(onFinally);\n }\n [Symbol.toStringTag] = 'Promise';\n}\nexports.Deferred = Deferred;\n//# sourceMappingURL=deferred.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.uuidv4 = void 0;\n/**\n * Generates a random v4 UUID, as specified in RFC4122.\n *\n * Uses the native Web Crypto API if available, otherwise falls back to a\n * polyfill.\n *\n * Example: '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'\n */\nfunction uuidv4() {\n // Available only in secure contexts\n // https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API\n if ('crypto' in globalThis && 'randomUUID' in globalThis.crypto) {\n // Node with\n // https://nodejs.org/dist/latest-v20.x/docs/api/globals.html#crypto_1 or\n // secure browser context.\n return globalThis.crypto.randomUUID();\n }\n const randomValues = new Uint8Array(16);\n if ('crypto' in globalThis && 'getRandomValues' in globalThis.crypto) {\n // Node with\n // https://nodejs.org/dist/latest-v20.x/docs/api/globals.html#crypto_1 or\n // browser.\n globalThis.crypto.getRandomValues(randomValues);\n }\n else {\n // Node without\n // https://nodejs.org/dist/latest-v20.x/docs/api/globals.html#crypto_1.\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n require('crypto').webcrypto.getRandomValues(randomValues);\n }\n // Set version (4) and variant (RFC4122) bits.\n randomValues[6] = (randomValues[6] & 0x0f) | 0x40;\n randomValues[8] = (randomValues[8] & 0x3f) | 0x80;\n const bytesToHex = (bytes) => bytes.reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n return [\n bytesToHex(randomValues.subarray(0, 4)),\n bytesToHex(randomValues.subarray(4, 6)),\n bytesToHex(randomValues.subarray(6, 8)),\n bytesToHex(randomValues.subarray(8, 10)),\n bytesToHex(randomValues.subarray(10, 16)),\n ].join('-');\n}\nexports.uuidv4 = uuidv4;\n//# sourceMappingURL=uuid.js.map","\"use strict\";\n/*\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ChannelProxy = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst uuid_1 = require(\"../../../utils/uuid\");\n/**\n * Used to send messages from realm to BiDi user.\n */\nclass ChannelProxy {\n #properties;\n #id = (0, uuid_1.uuidv4)();\n constructor(channel) {\n if (![0, null, undefined].includes(channel.serializationOptions?.maxDomDepth)) {\n throw new Error('serializationOptions.maxDomDepth other than 0 or null is not supported');\n }\n if (![undefined, 'none'].includes(channel.serializationOptions?.includeShadowTree)) {\n throw new Error('serializationOptions.includeShadowTree other than \"none\" is not supported');\n }\n this.#properties = channel;\n }\n /**\n * Creates a channel proxy in the given realm, initialises listener and\n * returns a handle to `sendMessage` delegate.\n */\n async init(realm, eventManager) {\n const channelHandle = await ChannelProxy.#createAndGetHandleInRealm(realm);\n const sendMessageHandle = await ChannelProxy.#createSendMessageHandle(realm, channelHandle);\n void this.#startListener(realm, channelHandle, eventManager);\n return sendMessageHandle;\n }\n /** Gets a ChannelProxy from window and returns its handle. */\n async startListenerFromWindow(realm, eventManager) {\n const channelHandle = await this.#getHandleFromWindow(realm);\n void this.#startListener(realm, channelHandle, eventManager);\n }\n /**\n * Evaluation string which creates a ChannelProxy object on the client side.\n */\n static #createChannelProxyEvalStr() {\n const functionStr = String(() => {\n const queue = [];\n let queueNonEmptyResolver = null;\n return {\n /**\n * Gets a promise, which is resolved as soon as a message occurs\n * in the queue.\n */\n async getMessage() {\n const onMessage = queue.length > 0\n ? Promise.resolve()\n : new Promise((resolve) => {\n queueNonEmptyResolver = resolve;\n });\n await onMessage;\n return queue.shift();\n },\n /**\n * Adds a message to the queue.\n * Resolves the pending promise if needed.\n */\n sendMessage(message) {\n queue.push(message);\n if (queueNonEmptyResolver !== null) {\n queueNonEmptyResolver();\n queueNonEmptyResolver = null;\n }\n },\n };\n });\n return `(${functionStr})()`;\n }\n /** Creates a ChannelProxy in the given realm. */\n static async #createAndGetHandleInRealm(realm) {\n const createChannelHandleResult = await realm.cdpClient.sendCommand('Runtime.evaluate', {\n expression: this.#createChannelProxyEvalStr(),\n contextId: realm.executionContextId,\n serializationOptions: {\n serialization: 'idOnly',\n },\n });\n if (createChannelHandleResult.exceptionDetails ||\n createChannelHandleResult.result.objectId === undefined) {\n throw new Error(`Cannot create channel`);\n }\n return createChannelHandleResult.result.objectId;\n }\n /** Gets a handle to `sendMessage` delegate from the ChannelProxy handle. */\n static async #createSendMessageHandle(realm, channelHandle) {\n const sendMessageArgResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((channelHandle) => {\n return channelHandle.sendMessage;\n }),\n arguments: [{ objectId: channelHandle }],\n executionContextId: realm.executionContextId,\n serializationOptions: {\n serialization: 'idOnly',\n },\n });\n // TODO: check for exceptionDetails.\n return sendMessageArgResult.result.objectId;\n }\n /** Starts listening for the channel events of the provided ChannelProxy. */\n async #startListener(realm, channelHandle, eventManager) {\n // TODO(#294): Remove this loop after the realm is destroyed.\n // Rely on the CDP throwing exception in such a case.\n // noinspection InfiniteLoopJS\n for (;;) {\n const message = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String(async (channelHandle) => channelHandle.getMessage()),\n arguments: [\n {\n objectId: channelHandle,\n },\n ],\n awaitPromise: true,\n executionContextId: realm.executionContextId,\n serializationOptions: {\n serialization: 'deep',\n ...(this.#properties.serializationOptions?.maxObjectDepth ===\n undefined ||\n this.#properties.serializationOptions.maxObjectDepth === null\n ? {}\n : {\n maxDepth: this.#properties.serializationOptions.maxObjectDepth,\n }),\n },\n });\n if (message.exceptionDetails) {\n // TODO: add logging.\n // TODO: check if a error should be thrown.\n return;\n }\n eventManager.registerEvent({\n method: protocol_js_1.Script.EventNames.MessageEvent,\n params: {\n channel: this.#properties.channel,\n data: realm.cdpToBidiValue(message, this.#properties.ownership ?? 'none'),\n source: {\n realm: realm.realmId,\n context: realm.browsingContextId,\n },\n },\n }, realm.browsingContextId);\n }\n }\n /**\n * Returns a handle of ChannelProxy from window's property which was set there\n * by `getEvalInWindowStr`. If window property is not set yet, sets a promise\n * resolver to the window property, so that `getEvalInWindowStr` can resolve\n * the promise later on with the channel.\n * This is needed because `getEvalInWindowStr` can be called before or\n * after this method.\n */\n async #getHandleFromWindow(realm) {\n const channelHandleResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((id) => {\n const w = window;\n if (w[id] === undefined) {\n // The channelProxy is not created yet. Create a promise, put the\n // resolver to window property and return the promise.\n // `getEvalInWindowStr` will resolve the promise later.\n return new Promise((resolve) => (w[id] = resolve));\n }\n // The channelProxy is already created by `getEvalInWindowStr` and\n // is set into window property. Return it.\n const channelProxy = w[id];\n delete w[id];\n return channelProxy;\n }),\n arguments: [{ value: this.#id }],\n executionContextId: realm.executionContextId,\n awaitPromise: true,\n serializationOptions: {\n serialization: 'idOnly',\n },\n });\n if (channelHandleResult.exceptionDetails !== undefined ||\n channelHandleResult.result.objectId === undefined) {\n throw new Error(`ChannelHandle not found in window[\"${this.#id}\"]`);\n }\n return channelHandleResult.result.objectId;\n }\n /**\n * String to be evaluated to create a ProxyChannel and put it to window.\n * Returns the delegate `sendMessage`. Used to provide an argument for preload\n * script. Does the following:\n * 1. Creates a ChannelProxy.\n * 2. Puts the ChannelProxy to window['${this.#id}'] or resolves the promise\n * by calling delegate stored in window['${this.#id}'].\n * This is needed because `#getHandleFromWindow` can be called before or\n * after this method.\n * 3. Returns the delegate `sendMessage` of the created ChannelProxy.\n */\n getEvalInWindowStr() {\n const delegate = String((id, channelProxy) => {\n const w = window;\n if (w[id] === undefined) {\n // `#getHandleFromWindow` is not initialized yet, and will get the\n // channelProxy later.\n w[id] = channelProxy;\n }\n else {\n // `#getHandleFromWindow` is already set a delegate to window property\n // and is waiting for it to be called with the channelProxy.\n w[id](channelProxy);\n delete w[id];\n }\n return channelProxy.sendMessage;\n });\n const channelProxyEval = ChannelProxy.#createChannelProxyEvalStr();\n return `(${delegate})('${this.#id}',${channelProxyEval})`;\n }\n}\nexports.ChannelProxy = ChannelProxy;\n//# sourceMappingURL=channelProxy.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.ScriptEvaluator = exports.SHARED_ID_DIVIDER = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst channelProxy_js_1 = require(\"./channelProxy.js\");\n// As `script.evaluate` wraps call into serialization script, `lineNumber`\n// should be adjusted.\nconst CALL_FUNCTION_STACKTRACE_LINE_OFFSET = 1;\nconst EVALUATE_STACKTRACE_LINE_OFFSET = 0;\nexports.SHARED_ID_DIVIDER = '_element_';\nclass ScriptEvaluator {\n #eventManager;\n constructor(eventManager) {\n this.#eventManager = eventManager;\n }\n /**\n * Gets the string representation of an object. This is equivalent to\n * calling toString() on the object value.\n * @param cdpObject CDP remote object representing an object.\n * @param realm\n * @return string The stringified object.\n */\n static async stringifyObject(cdpObject, realm) {\n const stringifyResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((obj) => {\n return String(obj);\n }),\n awaitPromise: false,\n arguments: [cdpObject],\n returnByValue: true,\n executionContextId: realm.executionContextId,\n });\n return stringifyResult.result.value;\n }\n /**\n * Serializes a given CDP object into BiDi, keeping references in the\n * target's `globalThis`.\n * @param cdpRemoteObject CDP remote object to be serialized.\n * @param resultOwnership Indicates desired ResultOwnership.\n * @param realm\n */\n async serializeCdpObject(cdpRemoteObject, resultOwnership, realm) {\n const arg = ScriptEvaluator.#cdpRemoteObjectToCallArgument(cdpRemoteObject);\n const cdpWebDriverValue = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((obj) => obj),\n awaitPromise: false,\n arguments: [arg],\n serializationOptions: {\n serialization: 'deep',\n },\n executionContextId: realm.executionContextId,\n });\n return realm.cdpToBidiValue(cdpWebDriverValue, resultOwnership);\n }\n async scriptEvaluate(realm, expression, awaitPromise, resultOwnership, serializationOptions) {\n if (![0, null, undefined].includes(serializationOptions.maxDomDepth))\n throw new Error('serializationOptions.maxDomDepth other than 0 or null is not supported');\n const cdpEvaluateResult = await realm.cdpClient.sendCommand('Runtime.evaluate', {\n contextId: realm.executionContextId,\n expression,\n awaitPromise,\n serializationOptions: {\n serialization: 'deep',\n ...(serializationOptions.maxObjectDepth === undefined ||\n serializationOptions.maxObjectDepth === null\n ? {}\n : { maxDepth: serializationOptions.maxObjectDepth }),\n },\n });\n if (cdpEvaluateResult.exceptionDetails) {\n // Serialize exception details.\n return {\n exceptionDetails: await this.#serializeCdpExceptionDetails(cdpEvaluateResult.exceptionDetails, EVALUATE_STACKTRACE_LINE_OFFSET, resultOwnership, realm),\n type: 'exception',\n realm: realm.realmId,\n };\n }\n return {\n type: 'success',\n result: realm.cdpToBidiValue(cdpEvaluateResult, resultOwnership),\n realm: realm.realmId,\n };\n }\n async callFunction(realm, functionDeclaration, _this, _arguments, awaitPromise, resultOwnership, serializationOptions) {\n if (![0, null, undefined].includes(serializationOptions.maxDomDepth))\n throw new Error('serializationOptions.maxDomDepth other than 0 or null is not supported');\n const callFunctionAndSerializeScript = `(...args)=>{ return _callFunction((\\n${functionDeclaration}\\n), args);\n function _callFunction(f, args) {\n const deserializedThis = args.shift();\n const deserializedArgs = args;\n return f.apply(deserializedThis, deserializedArgs);\n }}`;\n const thisAndArgumentsList = [\n await this.#deserializeToCdpArg(_this, realm),\n ];\n thisAndArgumentsList.push(...(await Promise.all(_arguments.map(async (a) => {\n return this.#deserializeToCdpArg(a, realm);\n }))));\n let cdpCallFunctionResult;\n try {\n cdpCallFunctionResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: callFunctionAndSerializeScript,\n awaitPromise,\n arguments: thisAndArgumentsList,\n serializationOptions: {\n serialization: 'deep',\n ...(serializationOptions.maxObjectDepth === undefined ||\n serializationOptions.maxObjectDepth === null\n ? {}\n : { maxDepth: serializationOptions.maxObjectDepth }),\n },\n executionContextId: realm.executionContextId,\n });\n }\n catch (e) {\n // Heuristic to determine if the problem is in the argument.\n // The check can be done on the `deserialization` step, but this approach\n // helps to save round-trips.\n if (e.code === -32000 &&\n [\n 'Could not find object with given id',\n 'Argument should belong to the same JavaScript world as target object',\n 'Invalid remote object id',\n ].includes(e.message)) {\n throw new protocol_js_1.Message.NoSuchHandleException('Handle was not found.');\n }\n throw e;\n }\n if (cdpCallFunctionResult.exceptionDetails) {\n // Serialize exception details.\n return {\n exceptionDetails: await this.#serializeCdpExceptionDetails(cdpCallFunctionResult.exceptionDetails, CALL_FUNCTION_STACKTRACE_LINE_OFFSET, resultOwnership, realm),\n type: 'exception',\n realm: realm.realmId,\n };\n }\n return {\n type: 'success',\n result: realm.cdpToBidiValue(cdpCallFunctionResult, resultOwnership),\n realm: realm.realmId,\n };\n }\n static #cdpRemoteObjectToCallArgument(cdpRemoteObject) {\n if (cdpRemoteObject.objectId !== undefined) {\n return { objectId: cdpRemoteObject.objectId };\n }\n if (cdpRemoteObject.unserializableValue !== undefined) {\n return { unserializableValue: cdpRemoteObject.unserializableValue };\n }\n return { value: cdpRemoteObject.value };\n }\n async #deserializeToCdpArg(argumentValue, realm) {\n if ('sharedId' in argumentValue) {\n const [navigableId, rawBackendNodeId] = argumentValue.sharedId.split(exports.SHARED_ID_DIVIDER);\n const backendNodeId = parseInt(rawBackendNodeId ?? '');\n if (isNaN(backendNodeId) ||\n backendNodeId === undefined ||\n navigableId === undefined) {\n throw new protocol_js_1.Message.NoSuchNodeException(`SharedId \"${argumentValue.sharedId}\" was not found.`);\n }\n if (realm.navigableId !== navigableId) {\n throw new protocol_js_1.Message.NoSuchNodeException(`SharedId \"${argumentValue.sharedId}\" belongs to different document. Current document is ${realm.navigableId}.`);\n }\n try {\n const obj = await realm.cdpClient.sendCommand('DOM.resolveNode', {\n backendNodeId,\n executionContextId: realm.executionContextId,\n });\n // TODO(#375): Release `obj.object.objectId` after using.\n return { objectId: obj.object.objectId };\n }\n catch (e) {\n // Heuristic to detect \"no such node\" exception. Based on the specific\n // CDP implementation.\n if (e.code === -32000 && e.message === 'No node with given id found') {\n throw new protocol_js_1.Message.NoSuchNodeException(`SharedId \"${argumentValue.sharedId}\" was not found.`);\n }\n throw e;\n }\n }\n if ('handle' in argumentValue) {\n return { objectId: argumentValue.handle };\n }\n switch (argumentValue.type) {\n // Primitive Protocol Value\n // https://w3c.github.io/webdriver-bidi/#data-types-protocolValue-primitiveProtocolValue\n case 'undefined':\n return { unserializableValue: 'undefined' };\n case 'null':\n return { unserializableValue: 'null' };\n case 'string':\n return { value: argumentValue.value };\n case 'number':\n if (argumentValue.value === 'NaN') {\n return { unserializableValue: 'NaN' };\n }\n else if (argumentValue.value === '-0') {\n return { unserializableValue: '-0' };\n }\n else if (argumentValue.value === 'Infinity') {\n return { unserializableValue: 'Infinity' };\n }\n else if (argumentValue.value === '-Infinity') {\n return { unserializableValue: '-Infinity' };\n }\n return {\n value: argumentValue.value,\n };\n case 'boolean':\n return { value: Boolean(argumentValue.value) };\n case 'bigint':\n return {\n unserializableValue: `BigInt(${JSON.stringify(argumentValue.value)})`,\n };\n case 'date':\n return {\n unserializableValue: `new Date(Date.parse(${JSON.stringify(argumentValue.value)}))`,\n };\n case 'regexp':\n return {\n unserializableValue: `new RegExp(${JSON.stringify(argumentValue.value.pattern)}, ${JSON.stringify(argumentValue.value.flags)})`,\n };\n case 'map': {\n // TODO: If none of the nested keys and values has a remote\n // reference, serialize to `unserializableValue` without CDP roundtrip.\n const keyValueArray = await this.#flattenKeyValuePairs(argumentValue.value, realm);\n const argEvalResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((...args) => {\n const result = new Map();\n for (let i = 0; i < args.length; i += 2) {\n result.set(args[i], args[i + 1]);\n }\n return result;\n }),\n awaitPromise: false,\n arguments: keyValueArray,\n returnByValue: false,\n executionContextId: realm.executionContextId,\n });\n // TODO(#375): Release `argEvalResult.result.objectId` after using.\n return { objectId: argEvalResult.result.objectId };\n }\n case 'object': {\n // TODO: If none of the nested keys and values has a remote\n // reference, serialize to `unserializableValue` without CDP roundtrip.\n const keyValueArray = await this.#flattenKeyValuePairs(argumentValue.value, realm);\n const argEvalResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((...args) => {\n const result = {};\n for (let i = 0; i < args.length; i += 2) {\n // Key should be either `string`, `number`, or `symbol`.\n const key = args[i];\n result[key] = args[i + 1];\n }\n return result;\n }),\n awaitPromise: false,\n arguments: keyValueArray,\n returnByValue: false,\n executionContextId: realm.executionContextId,\n });\n // TODO(#375): Release `argEvalResult.result.objectId` after using.\n return { objectId: argEvalResult.result.objectId };\n }\n case 'array': {\n // TODO: If none of the nested items has a remote reference,\n // serialize to `unserializableValue` without CDP roundtrip.\n const args = await this.#flattenValueList(argumentValue.value, realm);\n const argEvalResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((...args) => {\n return args;\n }),\n awaitPromise: false,\n arguments: args,\n returnByValue: false,\n executionContextId: realm.executionContextId,\n });\n // TODO(#375): Release `argEvalResult.result.objectId` after using.\n return { objectId: argEvalResult.result.objectId };\n }\n case 'set': {\n // TODO: if none of the nested items has a remote reference,\n // serialize to `unserializableValue` without CDP roundtrip.\n const args = await this.#flattenValueList(argumentValue.value, realm);\n const argEvalResult = await realm.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String((...args) => {\n return new Set(args);\n }),\n awaitPromise: false,\n arguments: args,\n returnByValue: false,\n executionContextId: realm.executionContextId,\n });\n // TODO(#375): Release `argEvalResult.result.objectId` after using.\n return { objectId: argEvalResult.result.objectId };\n }\n case 'channel': {\n const channelProxy = new channelProxy_js_1.ChannelProxy(argumentValue.value);\n const channelProxySendMessageHandle = await channelProxy.init(realm, this.#eventManager);\n return { objectId: channelProxySendMessageHandle };\n }\n // TODO(#375): Dispose of nested objects.\n default:\n throw new Error(`Value ${JSON.stringify(argumentValue)} is not deserializable.`);\n }\n }\n async #flattenKeyValuePairs(mapping, realm) {\n const keyValueArray = [];\n for (const [key, value] of mapping) {\n let keyArg;\n if (typeof key === 'string') {\n // Key is a string.\n keyArg = { value: key };\n }\n else {\n // Key is a serialized value.\n keyArg = await this.#deserializeToCdpArg(key, realm);\n }\n const valueArg = await this.#deserializeToCdpArg(value, realm);\n keyValueArray.push(keyArg);\n keyValueArray.push(valueArg);\n }\n return keyValueArray;\n }\n async #flattenValueList(list, realm) {\n return Promise.all(list.map((value) => this.#deserializeToCdpArg(value, realm)));\n }\n async #serializeCdpExceptionDetails(cdpExceptionDetails, lineOffset, resultOwnership, realm) {\n const callFrames = cdpExceptionDetails.stackTrace?.callFrames.map((frame) => ({\n url: frame.url,\n functionName: frame.functionName,\n // As `script.evaluate` wraps call into serialization script, so\n // `lineNumber` should be adjusted.\n lineNumber: frame.lineNumber - lineOffset,\n columnNumber: frame.columnNumber,\n }));\n const exception = await this.serializeCdpObject(\n // Exception should always be there.\n cdpExceptionDetails.exception, resultOwnership, realm);\n const text = await ScriptEvaluator.stringifyObject(cdpExceptionDetails.exception, realm);\n return {\n exception,\n columnNumber: cdpExceptionDetails.columnNumber,\n // As `script.evaluate` wraps call into serialization script, so\n // `lineNumber` should be adjusted.\n lineNumber: cdpExceptionDetails.lineNumber - lineOffset,\n stackTrace: {\n callFrames: callFrames ?? [],\n },\n text: text || cdpExceptionDetails.text,\n };\n }\n}\nexports.ScriptEvaluator = ScriptEvaluator;\n//# sourceMappingURL=scriptEvaluator.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Realm = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst log_js_1 = require(\"../../../utils/log.js\");\nconst scriptEvaluator_js_1 = require(\"./scriptEvaluator.js\");\nclass Realm {\n #realmStorage;\n #browsingContextStorage;\n #realmId;\n #browsingContextId;\n #executionContextId;\n #origin;\n #type;\n #cdpClient;\n #eventManager;\n #scriptEvaluator;\n sandbox;\n cdpSessionId;\n #logger;\n constructor(realmStorage, browsingContextStorage, realmId, browsingContextId, executionContextId, origin, type, sandbox, cdpSessionId, cdpClient, eventManager, logger) {\n this.#realmId = realmId;\n this.#browsingContextId = browsingContextId;\n this.#executionContextId = executionContextId;\n this.sandbox = sandbox;\n this.#origin = origin;\n this.#type = type;\n this.cdpSessionId = cdpSessionId;\n this.#cdpClient = cdpClient;\n this.#realmStorage = realmStorage;\n this.#browsingContextStorage = browsingContextStorage;\n this.#eventManager = eventManager;\n this.#scriptEvaluator = new scriptEvaluator_js_1.ScriptEvaluator(this.#eventManager);\n this.#realmStorage.addRealm(this);\n this.#logger = logger;\n this.#eventManager.registerEvent({\n method: protocol_js_1.Script.EventNames.RealmCreated,\n params: this.toBiDi(),\n }, this.browsingContextId);\n }\n async #releaseObject(handle) {\n try {\n await this.cdpClient.sendCommand('Runtime.releaseObject', {\n objectId: handle,\n });\n }\n catch (e) {\n // Heuristic to determine if the problem is in the unknown handler.\n // Ignore the error if so.\n if (!(e.code === -32000 && e.message === 'Invalid remote object id')) {\n throw e;\n }\n }\n }\n async disown(handle) {\n // Disowning an object from different realm does nothing.\n if (this.#realmStorage.knownHandlesToRealm.get(handle) !== this.realmId) {\n return;\n }\n await this.#releaseObject(handle);\n this.#realmStorage.knownHandlesToRealm.delete(handle);\n }\n cdpToBidiValue(cdpValue, resultOwnership) {\n const deepSerializedValue = cdpValue.result.deepSerializedValue;\n const bidiValue = this.deepSerializedToBiDi(deepSerializedValue);\n if (cdpValue.result.objectId) {\n const objectId = cdpValue.result.objectId;\n if (resultOwnership === 'root') {\n // Extend BiDi value with `handle` based on required `resultOwnership`\n // and CDP response but not on the actual BiDi type.\n bidiValue.handle = objectId;\n // Remember all the handles sent to client.\n this.#realmStorage.knownHandlesToRealm.set(objectId, this.realmId);\n }\n else {\n // No need in awaiting for the object to be released.\n void this.#releaseObject(objectId).catch((error) => this.#logger?.(log_js_1.LogType.system, error));\n }\n }\n return bidiValue;\n }\n deepSerializedToBiDi(webDriverValue) {\n // This relies on the CDP to implement proper BiDi serialization, except\n // backendNodeId/sharedId and `platformobject`.\n const result = webDriverValue;\n if (Object.hasOwn(result, 'weakLocalObjectReference')) {\n result.internalId = `${result.weakLocalObjectReference}`;\n delete result['weakLocalObjectReference'];\n }\n // Platform object is a special case. It should have only `{type: object}`\n // without `value` field.\n if (result.type === 'platformobject') {\n return { type: 'object' };\n }\n const bidiValue = result.value;\n if (bidiValue === undefined) {\n return result;\n }\n if (result.type === 'node') {\n if (Object.hasOwn(bidiValue, 'backendNodeId')) {\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n result.sharedId = `${this.navigableId}${scriptEvaluator_js_1.SHARED_ID_DIVIDER}${bidiValue.backendNodeId}`;\n delete bidiValue['backendNodeId'];\n }\n if (Object.hasOwn(bidiValue, 'children')) {\n for (const i in bidiValue.children) {\n bidiValue.children[i] = this.deepSerializedToBiDi(bidiValue.children[i]);\n }\n }\n }\n // Recursively update the nested values.\n if (['array', 'set'].includes(webDriverValue.type)) {\n for (const i in bidiValue) {\n bidiValue[i] = this.deepSerializedToBiDi(bidiValue[i]);\n }\n }\n if (['object', 'map'].includes(webDriverValue.type)) {\n for (const i in bidiValue) {\n bidiValue[i] = [\n this.deepSerializedToBiDi(bidiValue[i][0]),\n this.deepSerializedToBiDi(bidiValue[i][1]),\n ];\n }\n }\n return result;\n }\n toBiDi() {\n return {\n realm: this.realmId,\n origin: this.origin,\n type: this.type,\n context: this.browsingContextId,\n ...(this.sandbox === undefined ? {} : { sandbox: this.sandbox }),\n };\n }\n get realmId() {\n return this.#realmId;\n }\n get navigableId() {\n return (this.#browsingContextStorage.findContext(this.#browsingContextId)\n ?.navigableId ?? 'UNKNOWN');\n }\n get browsingContextId() {\n return this.#browsingContextId;\n }\n get executionContextId() {\n return this.#executionContextId;\n }\n get origin() {\n return this.#origin;\n }\n get type() {\n return this.#type;\n }\n get cdpClient() {\n return this.#cdpClient;\n }\n async callFunction(functionDeclaration, _this, _arguments, awaitPromise, resultOwnership, serializationOptions) {\n const context = this.#browsingContextStorage.getContext(this.browsingContextId);\n await context.awaitUnblocked();\n return {\n result: await this.#scriptEvaluator.callFunction(this, functionDeclaration, _this, _arguments, awaitPromise, resultOwnership, serializationOptions),\n };\n }\n async scriptEvaluate(expression, awaitPromise, resultOwnership, serializationOptions) {\n const context = this.#browsingContextStorage.getContext(this.browsingContextId);\n await context.awaitUnblocked();\n return {\n result: await this.#scriptEvaluator.scriptEvaluate(this, expression, awaitPromise, resultOwnership, serializationOptions),\n };\n }\n /**\n * Serializes a given CDP object into BiDi, keeping references in the\n * target's `globalThis`.\n * @param cdpObject CDP remote object to be serialized.\n * @param resultOwnership Indicates desired ResultOwnership.\n */\n async serializeCdpObject(cdpObject, resultOwnership) {\n return this.#scriptEvaluator.serializeCdpObject(cdpObject, resultOwnership, this);\n }\n /**\n * Gets the string representation of an object. This is equivalent to\n * calling toString() on the object value.\n * @param cdpObject CDP remote object representing an object.\n * @return string The stringified object.\n */\n async stringifyObject(cdpObject) {\n return scriptEvaluator_js_1.ScriptEvaluator.stringifyObject(cdpObject, this);\n }\n delete() {\n this.#eventManager.registerEvent({\n method: protocol_js_1.Script.EventNames.RealmDestroyed,\n params: {\n realm: this.realmId,\n },\n }, this.browsingContextId);\n }\n}\nexports.Realm = Realm;\n//# sourceMappingURL=realm.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowsingContextImpl = void 0;\nconst unitConversions_js_1 = require(\"../../../utils/unitConversions.js\");\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst log_js_1 = require(\"../../../utils/log.js\");\nconst deferred_js_1 = require(\"../../../utils/deferred.js\");\nconst realm_js_1 = require(\"../script/realm.js\");\nclass BrowsingContextImpl {\n /** The ID of this browsing context. */\n #id;\n /**\n * The ID of the parent browsing context.\n * If null, this is a top-level context.\n */\n #parentId;\n /** Direct children browsing contexts. */\n #children = new Set();\n #browsingContextStorage;\n #deferreds = {\n documentInitialized: new deferred_js_1.Deferred(),\n Page: {\n navigatedWithinDocument: new deferred_js_1.Deferred(),\n lifecycleEvent: {\n DOMContentLoaded: new deferred_js_1.Deferred(),\n load: new deferred_js_1.Deferred(),\n },\n },\n };\n #url = 'about:blank';\n #eventManager;\n #realmStorage;\n #loaderId;\n #cdpTarget;\n #maybeDefaultRealm;\n #isNavigating = false;\n #logger;\n constructor(cdpTarget, realmStorage, id, parentId, eventManager, browsingContextStorage, logger) {\n this.#cdpTarget = cdpTarget;\n this.#realmStorage = realmStorage;\n this.#id = id;\n this.#parentId = parentId;\n this.#eventManager = eventManager;\n this.#browsingContextStorage = browsingContextStorage;\n this.#logger = logger;\n }\n static create(cdpTarget, realmStorage, id, parentId, eventManager, browsingContextStorage, logger) {\n const context = new BrowsingContextImpl(cdpTarget, realmStorage, id, parentId, eventManager, browsingContextStorage, logger);\n context.#initListeners();\n browsingContextStorage.addContext(context);\n if (!context.isTopLevelContext()) {\n context.parent.addChild(context.id);\n }\n eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.ContextCreatedEvent,\n params: context.serializeToBidiValue(),\n }, context.id);\n return context;\n }\n static getTimestamp() {\n // `timestamp` from the event is MonotonicTime, not real time, so\n // the best Mapper can do is to set the timestamp to the epoch time\n // of the event arrived.\n // https://chromedevtools.github.io/devtools-protocol/tot/Network/#type-MonotonicTime\n return new Date().getTime();\n }\n /**\n * @see https://html.spec.whatwg.org/multipage/document-sequences.html#navigable\n */\n get navigableId() {\n return this.#loaderId;\n }\n delete() {\n this.#deleteAllChildren();\n this.#realmStorage.deleteRealms({\n browsingContextId: this.id,\n });\n // Remove context from the parent.\n if (!this.isTopLevelContext()) {\n this.parent.#children.delete(this.id);\n }\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.ContextDestroyedEvent,\n params: this.serializeToBidiValue(),\n }, this.id);\n this.#browsingContextStorage.deleteContextById(this.id);\n }\n /** Returns the ID of this context. */\n get id() {\n return this.#id;\n }\n /** Returns the parent context ID. */\n get parentId() {\n return this.#parentId;\n }\n /** Returns the parent context. */\n get parent() {\n if (this.parentId === null) {\n return null;\n }\n return this.#browsingContextStorage.getContext(this.parentId);\n }\n /** Returns all direct children contexts. */\n get directChildren() {\n return [...this.#children].map((id) => this.#browsingContextStorage.getContext(id));\n }\n /** Returns all children contexts, flattened. */\n get allChildren() {\n const children = this.directChildren;\n return children.concat(...children.map((child) => child.allChildren));\n }\n /**\n * Returns true if this is a top-level context.\n * This is the case whenever the parent context ID is null.\n */\n isTopLevelContext() {\n return this.#parentId === null;\n }\n get top() {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n let topContext = this;\n let parent = topContext.parent;\n while (parent) {\n topContext = parent;\n parent = topContext.parent;\n }\n return topContext;\n }\n addChild(childId) {\n this.#children.add(childId);\n }\n #deleteAllChildren() {\n this.directChildren.map((child) => child.delete());\n }\n get #defaultRealm() {\n if (this.#maybeDefaultRealm === undefined) {\n throw new Error(`No default realm for browsing context ${this.#id}`);\n }\n return this.#maybeDefaultRealm;\n }\n get cdpTarget() {\n return this.#cdpTarget;\n }\n updateCdpTarget(cdpTarget) {\n this.#cdpTarget = cdpTarget;\n this.#initListeners();\n }\n get url() {\n return this.#url;\n }\n async awaitLoaded() {\n await this.#deferreds.Page.lifecycleEvent.load;\n }\n awaitUnblocked() {\n return this.#cdpTarget.targetUnblocked;\n }\n async getOrCreateSandbox(sandbox) {\n if (sandbox === undefined || sandbox === '') {\n return this.#defaultRealm;\n }\n let maybeSandboxes = this.#realmStorage.findRealms({\n browsingContextId: this.id,\n sandbox,\n });\n if (maybeSandboxes.length === 0) {\n await this.#cdpTarget.cdpClient.sendCommand('Page.createIsolatedWorld', {\n frameId: this.id,\n worldName: sandbox,\n });\n // `Runtime.executionContextCreated` should be emitted by the time the\n // previous command is done.\n maybeSandboxes = this.#realmStorage.findRealms({\n browsingContextId: this.id,\n sandbox,\n });\n }\n if (maybeSandboxes.length !== 1) {\n throw Error(`Sandbox ${sandbox} wasn't created.`);\n }\n return maybeSandboxes[0];\n }\n serializeToBidiValue(maxDepth = 0, addParentField = true) {\n return {\n context: this.#id,\n url: this.url,\n children: maxDepth > 0\n ? this.directChildren.map((c) => c.serializeToBidiValue(maxDepth - 1, false))\n : null,\n ...(addParentField ? { parent: this.#parentId } : {}),\n };\n }\n onTargetInfoChanged(params) {\n this.#url = params.targetInfo.url;\n if (this.#isNavigating) {\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.NavigationStarted,\n params: {\n context: this.id,\n // TODO: The network event is send before the CDP Page.frameStartedLoading\n // It theory there should be a way to get the data.\n navigation: null,\n timestamp: BrowsingContextImpl.getTimestamp(),\n url: this.#url,\n },\n }, this.id);\n this.#isNavigating = false;\n }\n }\n #initListeners() {\n this.#cdpTarget.cdpClient.on('Page.frameNavigated', (params) => {\n if (this.id !== params.frame.id) {\n return;\n }\n const timestamp = BrowsingContextImpl.getTimestamp();\n this.#url = params.frame.url + (params.frame.urlFragment ?? '');\n // At the point the page is initialized, all the nested iframes from the\n // previous page are detached and realms are destroyed.\n // Remove children from context.\n this.#deleteAllChildren();\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.FragmentNavigated,\n params: {\n context: this.id,\n navigation: this.#loaderId ?? null,\n timestamp,\n url: this.#url,\n },\n }, this.id);\n });\n this.#cdpTarget.cdpClient.on('Page.navigatedWithinDocument', (params) => {\n if (this.id !== params.frameId) {\n return;\n }\n const timestamp = BrowsingContextImpl.getTimestamp();\n this.#url = params.url;\n this.#deferreds.Page.navigatedWithinDocument.resolve(params);\n // TODO: Remove this once History event for BiDi are added\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.FragmentNavigated,\n params: {\n context: this.id,\n navigation: null,\n timestamp,\n url: this.#url,\n },\n }, this.id);\n });\n this.#cdpTarget.cdpClient.on('Page.frameStartedLoading', (params) => {\n if (this.id !== params.frameId) {\n return;\n }\n this.#isNavigating = true;\n });\n this.#cdpTarget.cdpClient.on('Page.frameStoppedLoading', (params) => {\n if (this.id !== params.frameId) {\n return;\n }\n this.#isNavigating = false;\n });\n this.#cdpTarget.cdpClient.on('Page.lifecycleEvent', (params) => {\n if (this.id !== params.frameId) {\n return;\n }\n if (params.name === 'init') {\n this.#documentChanged(params.loaderId);\n this.#deferreds.documentInitialized.resolve();\n return;\n }\n if (params.name === 'commit') {\n this.#loaderId = params.loaderId;\n return;\n }\n // Ignore event from not current navigation.\n if (params.loaderId !== this.#loaderId) {\n return;\n }\n const timestamp = BrowsingContextImpl.getTimestamp();\n switch (params.name) {\n case 'DOMContentLoaded':\n this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.resolve(params);\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.DomContentLoadedEvent,\n params: {\n context: this.id,\n navigation: this.#loaderId ?? null,\n timestamp,\n url: this.#url,\n },\n }, this.id);\n break;\n case 'load':\n this.#deferreds.Page.lifecycleEvent.load.resolve(params);\n this.#eventManager.registerEvent({\n method: protocol_js_1.BrowsingContext.EventNames.LoadEvent,\n params: {\n context: this.id,\n navigation: this.#loaderId ?? null,\n timestamp,\n url: this.#url,\n },\n }, this.id);\n break;\n }\n });\n this.#cdpTarget.cdpClient.on('Runtime.executionContextCreated', (params) => {\n if (params.context.auxData.frameId !== this.id) {\n return;\n }\n // Only this execution contexts are supported for now.\n if (!['default', 'isolated'].includes(params.context.auxData.type)) {\n return;\n }\n const realm = new realm_js_1.Realm(this.#realmStorage, this.#browsingContextStorage, params.context.uniqueId, this.id, params.context.id, this.#getOrigin(params), \n // XXX: differentiate types.\n 'window', \n // Sandbox name for isolated world.\n params.context.auxData.type === 'isolated'\n ? params.context.name\n : undefined, this.#cdpTarget.cdpSessionId, this.#cdpTarget.cdpClient, this.#eventManager, this.#logger);\n if (params.context.auxData.isDefault) {\n this.#maybeDefaultRealm = realm;\n // Initialize ChannelProxy listeners for all the channels of all the\n // preload scripts related to this BrowsingContext.\n // TODO: extend for not default realms by the sandbox name.\n void Promise.all(this.#cdpTarget\n .getChannels(this.id)\n .map((channel) => channel.startListenerFromWindow(realm, this.#eventManager)));\n }\n });\n this.#cdpTarget.cdpClient.on('Runtime.executionContextDestroyed', (params) => {\n this.#realmStorage.deleteRealms({\n cdpSessionId: this.#cdpTarget.cdpSessionId,\n executionContextId: params.executionContextId,\n });\n });\n this.#cdpTarget.cdpClient.on('Runtime.executionContextsCleared', () => {\n this.#realmStorage.deleteRealms({\n cdpSessionId: this.#cdpTarget.cdpSessionId,\n });\n });\n }\n #getOrigin(params) {\n if (params.context.auxData.type === 'isolated') {\n // Sandbox should have the same origin as the context itself, but in CDP\n // it has an empty one.\n return this.#defaultRealm.origin;\n }\n // https://html.spec.whatwg.org/multipage/origin.html#ascii-serialisation-of-an-origin\n return ['://', ''].includes(params.context.origin)\n ? 'null'\n : params.context.origin;\n }\n #documentChanged(loaderId) {\n // Same document navigation.\n if (loaderId === undefined || this.#loaderId === loaderId) {\n if (this.#deferreds.Page.navigatedWithinDocument.isFinished) {\n this.#deferreds.Page.navigatedWithinDocument =\n new deferred_js_1.Deferred();\n }\n else {\n this.#logger?.(log_js_1.LogType.browsingContexts, 'Document changed (navigatedWithinDocument)');\n }\n return;\n }\n this.#resetDeferredsIfFinished();\n this.#loaderId = loaderId;\n }\n #resetDeferredsIfFinished() {\n if (this.#deferreds.documentInitialized.isFinished) {\n this.#deferreds.documentInitialized = new deferred_js_1.Deferred();\n }\n else {\n this.#logger?.(log_js_1.LogType.browsingContexts, 'Document changed (document initialized)');\n }\n if (this.#deferreds.Page.lifecycleEvent.DOMContentLoaded.isFinished) {\n this.#deferreds.Page.lifecycleEvent.DOMContentLoaded =\n new deferred_js_1.Deferred();\n }\n else {\n this.#logger?.(log_js_1.LogType.browsingContexts, 'Document changed (DOMContentLoaded)');\n }\n if (this.#deferreds.Page.lifecycleEvent.load.isFinished) {\n this.#deferreds.Page.lifecycleEvent.load =\n new deferred_js_1.Deferred();\n }\n else {\n this.#logger?.(log_js_1.LogType.browsingContexts, 'Document changed (load)');\n }\n }\n async navigate(url, wait) {\n await this.awaitUnblocked();\n // TODO: handle loading errors.\n const cdpNavigateResult = await this.#cdpTarget.cdpClient.sendCommand('Page.navigate', {\n url,\n frameId: this.id,\n });\n if (cdpNavigateResult.errorText) {\n throw new protocol_js_1.Message.UnknownErrorException(cdpNavigateResult.errorText);\n }\n this.#documentChanged(cdpNavigateResult.loaderId);\n switch (wait) {\n case 'none':\n break;\n case 'interactive':\n // No `loaderId` means same-document navigation.\n if (cdpNavigateResult.loaderId === undefined) {\n await this.#deferreds.Page.navigatedWithinDocument;\n }\n else {\n await this.#deferreds.Page.lifecycleEvent.DOMContentLoaded;\n }\n break;\n case 'complete':\n // No `loaderId` means same-document navigation.\n if (cdpNavigateResult.loaderId === undefined) {\n await this.#deferreds.Page.navigatedWithinDocument;\n }\n else {\n await this.awaitLoaded();\n }\n break;\n }\n return {\n result: {\n navigation: cdpNavigateResult.loaderId ?? null,\n url,\n },\n };\n }\n async reload(ignoreCache, wait) {\n await this.awaitUnblocked();\n await this.#cdpTarget.cdpClient.sendCommand('Page.reload', {\n ignoreCache,\n });\n this.#resetDeferredsIfFinished();\n switch (wait) {\n case 'none':\n break;\n case 'interactive':\n await this.#deferreds.Page.lifecycleEvent.DOMContentLoaded;\n break;\n case 'complete':\n await this.awaitLoaded();\n break;\n }\n return { result: {} };\n }\n async setViewport(viewport) {\n if (viewport === null) {\n await this.#cdpTarget.cdpClient.sendCommand('Emulation.clearDeviceMetricsOverride');\n }\n else {\n try {\n await this.#cdpTarget.cdpClient.sendCommand('Emulation.setDeviceMetricsOverride', {\n width: viewport.width,\n height: viewport.height,\n deviceScaleFactor: 0,\n mobile: false,\n dontSetVisibleSize: true,\n });\n }\n catch (err) {\n if (err.message.startsWith(\n // https://crsrc.org/c/content/browser/devtools/protocol/emulation_handler.cc;l=257;drc=2f6eee84cf98d4227e7c41718dd71b82f26d90ff\n 'Width and height values must be positive')) {\n throw new protocol_js_1.Message.UnsupportedOperationException('Provided viewport dimensions are not supported');\n }\n throw err;\n }\n }\n }\n async captureScreenshot() {\n // XXX: Focus the original tab after the screenshot is taken.\n // This is needed because the screenshot gets blocked until the active tab gets focus.\n await this.#cdpTarget.cdpClient.sendCommand('Page.bringToFront');\n let clip;\n if (this.isTopLevelContext()) {\n const { cssContentSize, cssLayoutViewport } = await this.#cdpTarget.cdpClient.sendCommand('Page.getLayoutMetrics');\n clip = {\n x: cssContentSize.x,\n y: cssContentSize.y,\n width: cssLayoutViewport.clientWidth,\n height: cssLayoutViewport.clientHeight,\n };\n }\n else {\n const { result: { value: iframeDocRect }, } = await this.#cdpTarget.cdpClient.sendCommand('Runtime.callFunctionOn', {\n functionDeclaration: String(() => {\n const docRect = globalThis.document.documentElement.getBoundingClientRect();\n return JSON.stringify({\n x: docRect.x,\n y: docRect.y,\n width: docRect.width,\n height: docRect.height,\n });\n }),\n executionContextId: this.#defaultRealm.executionContextId,\n });\n clip = JSON.parse(iframeDocRect);\n }\n const result = await this.#cdpTarget.cdpClient.sendCommand('Page.captureScreenshot', {\n clip: {\n ...clip,\n scale: 1.0,\n },\n });\n return {\n result: {\n data: result.data,\n },\n };\n }\n async print(params) {\n const cdpParams = {};\n if (params.background !== undefined) {\n cdpParams.printBackground = params.background;\n }\n if (params.margin?.bottom !== undefined) {\n cdpParams.marginBottom = (0, unitConversions_js_1.inchesFromCm)(params.margin.bottom);\n }\n if (params.margin?.left !== undefined) {\n cdpParams.marginLeft = (0, unitConversions_js_1.inchesFromCm)(params.margin.left);\n }\n if (params.margin?.right !== undefined) {\n cdpParams.marginRight = (0, unitConversions_js_1.inchesFromCm)(params.margin.right);\n }\n if (params.margin?.top !== undefined) {\n cdpParams.marginTop = (0, unitConversions_js_1.inchesFromCm)(params.margin.top);\n }\n if (params.orientation !== undefined) {\n cdpParams.landscape = params.orientation === 'landscape';\n }\n if (params.page?.height !== undefined) {\n cdpParams.paperHeight = (0, unitConversions_js_1.inchesFromCm)(params.page.height);\n }\n if (params.page?.width !== undefined) {\n cdpParams.paperWidth = (0, unitConversions_js_1.inchesFromCm)(params.page.width);\n }\n if (params.pageRanges !== undefined) {\n cdpParams.pageRanges = params.pageRanges.join(',');\n }\n if (params.scale !== undefined) {\n cdpParams.scale = params.scale;\n }\n if (params.shrinkToFit !== undefined) {\n cdpParams.preferCSSPageSize = !params.shrinkToFit;\n }\n const result = await this.#cdpTarget.cdpClient.sendCommand('Page.printToPDF', cdpParams);\n return {\n result: {\n data: result.data,\n },\n };\n }\n}\nexports.BrowsingContextImpl = BrowsingContextImpl;\n//# sourceMappingURL=browsingContextImpl.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getRemoteValuesText = exports.logMessageFormatter = void 0;\nconst specifiers = ['%s', '%d', '%i', '%f', '%o', '%O', '%c'];\nfunction isFormmatSpecifier(str) {\n return specifiers.some((spec) => str.includes(spec));\n}\n/**\n * @param args input remote values to be format printed\n * @return parsed text of the remote values in specific format\n */\nfunction logMessageFormatter(args) {\n let output = '';\n const argFormat = args[0].value.toString();\n const argValues = args.slice(1, undefined);\n const tokens = argFormat.split(new RegExp(specifiers.map((spec) => `(${spec})`).join('|'), 'g'));\n for (const token of tokens) {\n if (token === undefined || token === '') {\n continue;\n }\n if (isFormmatSpecifier(token)) {\n const arg = argValues.shift();\n // raise an exception when less value is provided\n if (arg === undefined) {\n throw new Error(`Less value is provided: \"${getRemoteValuesText(args, false)}\"`);\n }\n if (token === '%s') {\n output += stringFromArg(arg);\n }\n else if (token === '%d' || token === '%i') {\n if (arg.type === 'bigint' ||\n arg.type === 'number' ||\n arg.type === 'string') {\n output += parseInt(arg.value.toString(), 10);\n }\n else {\n output += 'NaN';\n }\n }\n else if (token === '%f') {\n if (arg.type === 'bigint' ||\n arg.type === 'number' ||\n arg.type === 'string') {\n output += parseFloat(arg.value.toString());\n }\n else {\n output += 'NaN';\n }\n }\n else {\n // %o, %O, %c\n output += toJson(arg);\n }\n }\n else {\n output += token;\n }\n }\n // raise an exception when more value is provided\n if (argValues.length > 0) {\n throw new Error(`More value is provided: \"${getRemoteValuesText(args, false)}\"`);\n }\n return output;\n}\nexports.logMessageFormatter = logMessageFormatter;\n/**\n * @param arg input remote value to be parsed\n * @return parsed text of the remote value\n *\n * input: {\"type\": \"number\", \"value\": 1}\n * output: 1\n *\n * input: {\"type\": \"string\", \"value\": \"abc\"}\n * output: \"abc\"\n *\n * input: {\"type\": \"object\", \"value\": [[\"id\", {\"type\": \"number\", \"value\": 1}]]}\n * output: '{\"id\": 1}'\n *\n * input: {\"type\": \"object\", \"value\": [[\"font-size\", {\"type\": \"string\", \"value\": \"20px\"}]]}\n * output: '{\"font-size\": \"20px\"}'\n */\nfunction toJson(arg) {\n // arg type validation\n if (arg.type !== 'array' &&\n arg.type !== 'bigint' &&\n arg.type !== 'date' &&\n arg.type !== 'number' &&\n arg.type !== 'object' &&\n arg.type !== 'string') {\n return stringFromArg(arg);\n }\n if (arg.type === 'bigint') {\n return `${arg.value.toString()}n`;\n }\n if (arg.type === 'number') {\n return arg.value.toString();\n }\n if (['date', 'string'].includes(arg.type)) {\n return JSON.stringify(arg.value);\n }\n if (arg.type === 'object') {\n return `{${arg.value\n .map((pair) => {\n return `${JSON.stringify(pair[0])}:${toJson(pair[1])}`;\n })\n .join(',')}}`;\n }\n if (arg.type === 'array') {\n return `[${arg.value?.map((val) => toJson(val)).join(',') ?? ''}]`;\n }\n throw Error(`Invalid value type: ${arg.toString()}`);\n}\nfunction stringFromArg(arg) {\n if (!Object.hasOwn(arg, 'value')) {\n return arg.type;\n }\n switch (arg.type) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'bigint':\n return String(arg.value);\n case 'regexp':\n return `/${arg.value.pattern}/${arg.value.flags ?? ''}`;\n case 'date':\n return new Date(arg.value).toString();\n case 'object':\n return `Object(${arg.value?.length ?? ''})`;\n case 'array':\n return `Array(${arg.value?.length ?? ''})`;\n case 'map':\n return `Map(${arg.value.length})`;\n case 'set':\n return `Set(${arg.value.length})`;\n case 'node':\n return 'node';\n default:\n return arg.type;\n }\n}\nfunction getRemoteValuesText(args, formatText) {\n const arg = args[0];\n if (!arg) {\n return '';\n }\n // if args[0] is a format specifier, format the args as output\n if (arg.type === 'string' &&\n isFormmatSpecifier(arg.value.toString()) &&\n formatText) {\n return logMessageFormatter(args);\n }\n // if args[0] is not a format specifier, just join the args with \\u0020 (unicode 'SPACE')\n return args\n .map((arg) => {\n return stringFromArg(arg);\n })\n .join('\\u0020');\n}\nexports.getRemoteValuesText = getRemoteValuesText;\n//# sourceMappingURL=logHelper.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.LogManager = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst logHelper_js_1 = require(\"./logHelper.js\");\n/** Converts CDP StackTrace object to BiDi StackTrace object. */\nfunction getBidiStackTrace(cdpStackTrace) {\n const stackFrames = cdpStackTrace?.callFrames.map((callFrame) => {\n return {\n columnNumber: callFrame.columnNumber,\n functionName: callFrame.functionName,\n lineNumber: callFrame.lineNumber,\n url: callFrame.url,\n };\n });\n return stackFrames ? { callFrames: stackFrames } : undefined;\n}\nfunction getLogLevel(consoleApiType) {\n if (['assert', 'error'].includes(consoleApiType)) {\n return 'error';\n }\n if (['debug', 'trace'].includes(consoleApiType)) {\n return 'debug';\n }\n if (['warn', 'warning'].includes(consoleApiType)) {\n return 'warn';\n }\n return 'info';\n}\nclass LogManager {\n #eventManager;\n #realmStorage;\n #cdpTarget;\n constructor(cdpTarget, realmStorage, eventManager) {\n this.#cdpTarget = cdpTarget;\n this.#realmStorage = realmStorage;\n this.#eventManager = eventManager;\n }\n static create(cdpTarget, realmStorage, eventManager) {\n const logManager = new LogManager(cdpTarget, realmStorage, eventManager);\n logManager.#initialize();\n return logManager;\n }\n #initialize() {\n this.#initializeLogEntryAddedEventListener();\n }\n #initializeLogEntryAddedEventListener() {\n this.#cdpTarget.cdpClient.on('Runtime.consoleAPICalled', (params) => {\n // Try to find realm by `cdpSessionId` and `executionContextId`,\n // if provided.\n const realm = this.#realmStorage.findRealm({\n cdpSessionId: this.#cdpTarget.cdpSessionId,\n executionContextId: params.executionContextId,\n });\n const argsPromise = realm === undefined\n ? Promise.resolve(params.args)\n : // Properly serialize arguments if possible.\n Promise.all(params.args.map((arg) => {\n return realm.serializeCdpObject(arg, 'none');\n }));\n this.#eventManager.registerPromiseEvent(argsPromise.then((args) => ({\n method: protocol_js_1.Log.EventNames.LogEntryAddedEvent,\n params: {\n level: getLogLevel(params.type),\n source: {\n realm: realm?.realmId ?? 'UNKNOWN',\n context: realm?.browsingContextId ?? 'UNKNOWN',\n },\n text: (0, logHelper_js_1.getRemoteValuesText)(args, true),\n timestamp: Math.round(params.timestamp),\n stackTrace: getBidiStackTrace(params.stackTrace),\n type: 'console',\n // Console method is `warn`, not `warning`.\n method: params.type === 'warning' ? 'warn' : params.type,\n args,\n },\n })), realm?.browsingContextId ?? 'UNKNOWN', protocol_js_1.Log.EventNames.LogEntryAddedEvent);\n });\n this.#cdpTarget.cdpClient.on('Runtime.exceptionThrown', (params) => {\n // Try to find realm by `cdpSessionId` and `executionContextId`,\n // if provided.\n const realm = this.#realmStorage.findRealm({\n cdpSessionId: this.#cdpTarget.cdpSessionId,\n executionContextId: params.exceptionDetails.executionContextId,\n });\n // Try all the best to get the exception text.\n const textPromise = (async () => {\n if (!params.exceptionDetails.exception) {\n return params.exceptionDetails.text;\n }\n if (realm === undefined) {\n return JSON.stringify(params.exceptionDetails.exception);\n }\n return realm.stringifyObject(params.exceptionDetails.exception);\n })();\n this.#eventManager.registerPromiseEvent(textPromise.then((text) => ({\n method: protocol_js_1.Log.EventNames.LogEntryAddedEvent,\n params: {\n level: 'error',\n source: {\n realm: realm?.realmId ?? 'UNKNOWN',\n context: realm?.browsingContextId ?? 'UNKNOWN',\n },\n text,\n timestamp: Math.round(params.timestamp),\n stackTrace: getBidiStackTrace(params.exceptionDetails.stackTrace),\n type: 'javascript',\n },\n })), realm?.browsingContextId ?? 'UNKNOWN', protocol_js_1.Log.EventNames.LogEntryAddedEvent);\n });\n }\n}\nexports.LogManager = LogManager;\n//# sourceMappingURL=logManager.js.map","\"use strict\";\n/**\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DefaultMap = void 0;\n/**\n * A subclass of Map whose functionality is almost the same as its parent\n * except for the fact that DefaultMap never returns undefined. It provides a\n * default value for keys that do not exist.\n */\nclass DefaultMap extends Map {\n /** The default value to return whenever a key is not present in the map. */\n #getDefaultValue;\n constructor(getDefaultValue, entries) {\n super(entries);\n this.#getDefaultValue = getDefaultValue;\n }\n get(key) {\n if (!this.has(key)) {\n this.set(key, this.#getDefaultValue(key));\n }\n return super.get(key);\n }\n}\nexports.DefaultMap = DefaultMap;\n//# sourceMappingURL=DefaultMap.js.map","\"use strict\";\n/*\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NetworkRequest = void 0;\nconst deferred_js_1 = require(\"../../../utils/deferred.js\");\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nclass NetworkRequest {\n static #unknown = 'UNKNOWN';\n /**\n * Each network request has an associated request id, which is a string\n * uniquely identifying that request.\n *\n * The identifier for a request resulting from a redirect matches that of the\n * request that initiated it.\n */\n requestId;\n #servedFromCache = false;\n #redirectCount;\n #eventManager;\n #requestWillBeSentEvent;\n #requestWillBeSentExtraInfoEvent;\n #responseReceivedEvent;\n #responseReceivedExtraInfoEvent;\n #beforeRequestSentDeferred = new deferred_js_1.Deferred();\n #responseReceivedDeferred = new deferred_js_1.Deferred();\n constructor(requestId, eventManager) {\n this.requestId = requestId;\n this.#redirectCount = 0;\n this.#eventManager = eventManager;\n }\n onRequestWillBeSentEvent(event) {\n if (this.#requestWillBeSentEvent !== undefined) {\n // TODO: Handle redirect event, requestId is same for the redirect chain\n return;\n }\n this.#requestWillBeSentEvent = event;\n if (this.#requestWillBeSentExtraInfoEvent !== undefined) {\n this.#beforeRequestSentDeferred.resolve();\n }\n this.#sendBeforeRequestEvent();\n }\n onRequestWillBeSentExtraInfoEvent(event) {\n if (this.#requestWillBeSentExtraInfoEvent !== undefined) {\n // TODO: Handle redirect event, requestId is same for the redirect chain\n return;\n }\n this.#requestWillBeSentExtraInfoEvent = event;\n if (this.#requestWillBeSentEvent !== undefined) {\n this.#beforeRequestSentDeferred.resolve();\n }\n }\n onResponseReceivedEventExtraInfo(event) {\n if (this.#responseReceivedExtraInfoEvent !== undefined) {\n // TODO: Handle redirect event, requestId is same for the redirect chain\n return;\n }\n this.#responseReceivedExtraInfoEvent = event;\n if (this.#responseReceivedEvent !== undefined) {\n this.#responseReceivedDeferred.resolve();\n }\n }\n onResponseReceivedEvent(responseReceivedEvent) {\n if (this.#responseReceivedEvent !== undefined) {\n // TODO: Handle redirect event, requestId is same for the redirect chain\n return;\n }\n this.#responseReceivedEvent = responseReceivedEvent;\n if (!responseReceivedEvent.hasExtraInfo &&\n !this.#beforeRequestSentDeferred.isFinished) {\n this.#beforeRequestSentDeferred.resolve();\n }\n if (!responseReceivedEvent.hasExtraInfo ||\n this.#responseReceivedExtraInfoEvent !== undefined ||\n this.#servedFromCache) {\n this.#responseReceivedDeferred.resolve();\n }\n this.#sendResponseReceivedEvent();\n }\n onServedFromCache() {\n if (this.#requestWillBeSentEvent !== undefined) {\n this.#beforeRequestSentDeferred.resolve();\n }\n if (this.#responseReceivedEvent !== undefined) {\n this.#responseReceivedDeferred.resolve();\n }\n this.#servedFromCache = true;\n }\n onLoadingFailedEvent(event) {\n this.#beforeRequestSentDeferred.resolve();\n this.#responseReceivedDeferred.reject(event);\n this.#eventManager.registerEvent({\n method: protocol_js_1.Network.EventNames.FetchErrorEvent,\n params: {\n ...this.#getBaseEventParams(),\n errorText: event.errorText,\n },\n }, this.#requestWillBeSentEvent?.frameId ?? null);\n }\n #getBaseEventParams() {\n return {\n context: this.#requestWillBeSentEvent?.frameId ?? null,\n navigation: this.#getNavigationId(),\n // TODO: implement.\n redirectCount: this.#redirectCount,\n request: this.#getRequestData(),\n // Timestamp should be in milliseconds, while CDP provides it in seconds.\n timestamp: Math.round((this.#requestWillBeSentEvent?.wallTime ?? 0) * 1000),\n };\n }\n #getNavigationId() {\n if (!this.#requestWillBeSentEvent ||\n !this.#requestWillBeSentEvent.loaderId ||\n // When we navigate all CDP network events have `loaderId`\n // CDP's `loaderId` and `requestId` match when\n // that request triggered the loading\n this.#requestWillBeSentEvent.loaderId !==\n this.#requestWillBeSentEvent.requestId) {\n return null;\n }\n return this.#requestWillBeSentEvent.loaderId;\n }\n #getRequestData() {\n const cookies = this.#requestWillBeSentExtraInfoEvent\n ? NetworkRequest.#getCookies(this.#requestWillBeSentExtraInfoEvent.associatedCookies)\n : [];\n return {\n request: this.#requestWillBeSentEvent?.requestId ?? NetworkRequest.#unknown,\n url: this.#requestWillBeSentEvent?.request.url ?? NetworkRequest.#unknown,\n method: this.#requestWillBeSentEvent?.request.method ?? NetworkRequest.#unknown,\n headers: NetworkRequest.#getHeaders(this.#requestWillBeSentEvent?.request.headers),\n cookies,\n // TODO: implement.\n headersSize: -1,\n // TODO: implement.\n bodySize: 0,\n timings: {\n // TODO: implement.\n timeOrigin: 0,\n // TODO: implement.\n requestTime: 0,\n // TODO: implement.\n redirectStart: 0,\n // TODO: implement.\n redirectEnd: 0,\n // TODO: implement.\n fetchStart: 0,\n // TODO: implement.\n dnsStart: 0,\n // TODO: implement.\n dnsEnd: 0,\n // TODO: implement.\n connectStart: 0,\n // TODO: implement.\n connectEnd: 0,\n // TODO: implement.\n tlsStart: 0,\n // TODO: implement.\n requestStart: 0,\n // TODO: implement.\n responseStart: 0,\n // TODO: implement.\n responseEnd: 0,\n },\n };\n }\n #sendBeforeRequestEvent() {\n if (!this.#isIgnoredEvent()) {\n this.#eventManager.registerPromiseEvent(this.#beforeRequestSentDeferred.then(() => this.#getBeforeRequestEvent()), this.#requestWillBeSentEvent?.frameId ?? null, protocol_js_1.Network.EventNames.BeforeRequestSentEvent);\n }\n }\n #getBeforeRequestEvent() {\n if (this.#requestWillBeSentEvent === undefined) {\n throw new Error('RequestWillBeSentEvent is not set');\n }\n return {\n method: protocol_js_1.Network.EventNames.BeforeRequestSentEvent,\n params: {\n ...this.#getBaseEventParams(),\n initiator: {\n type: NetworkRequest.#getInitiatorType(this.#requestWillBeSentEvent.initiator.type),\n },\n },\n };\n }\n #sendResponseReceivedEvent() {\n if (!this.#isIgnoredEvent()) {\n this.#eventManager.registerPromiseEvent(this.#responseReceivedDeferred.then(() => this.#getResponseReceivedEvent()), this.#responseReceivedEvent?.frameId ?? null, protocol_js_1.Network.EventNames.ResponseCompletedEvent);\n }\n }\n #getResponseReceivedEvent() {\n if (this.#requestWillBeSentEvent === undefined) {\n throw new Error('RequestWillBeSentEvent is not set');\n }\n if (this.#responseReceivedEvent === undefined) {\n throw new Error('ResponseReceivedEvent is not set');\n }\n // Chromium sends wrong extraInfo events for responses served from cache.\n // See https://github.com/puppeteer/puppeteer/issues/9965 and\n // https://crbug.com/1340398.\n if (this.#responseReceivedEvent.response.fromDiskCache) {\n this.#responseReceivedExtraInfoEvent = undefined;\n }\n const headers = NetworkRequest.#getHeaders(this.#responseReceivedEvent.response.headers);\n return {\n method: protocol_js_1.Network.EventNames.ResponseCompletedEvent,\n params: {\n ...this.#getBaseEventParams(),\n response: {\n url: this.#responseReceivedEvent.response.url,\n protocol: this.#responseReceivedEvent.response.protocol ?? '',\n status: this.#responseReceivedExtraInfoEvent?.statusCode ??\n this.#responseReceivedEvent.response.status,\n statusText: this.#responseReceivedEvent.response.statusText,\n fromCache: this.#responseReceivedEvent.response.fromDiskCache ||\n this.#responseReceivedEvent.response.fromPrefetchCache ||\n this.#servedFromCache,\n headers,\n mimeType: this.#responseReceivedEvent.response.mimeType,\n bytesReceived: this.#responseReceivedEvent.response.encodedDataLength,\n headersSize: this.#computeResponseHeadersSize(headers),\n // TODO: consider removing from spec.\n bodySize: 0,\n content: {\n // TODO: consider removing from spec.\n size: 0,\n },\n },\n },\n };\n }\n #computeResponseHeadersSize(headers) {\n return headers.reduce((total, header) => {\n return total + header.name.length + (header.value?.length ?? 0) + 4; // 4 = ': ' + '\\r\\n'\n }, 0);\n }\n #isIgnoredEvent() {\n return (this.#requestWillBeSentEvent?.request.url.endsWith('/favicon.ico') ??\n false);\n }\n static #getHeaders(headers) {\n if (!headers) {\n return [];\n }\n return Object.entries(headers).map(([name, value]) => ({\n name,\n value,\n }));\n }\n static #getInitiatorType(initiatorType) {\n switch (initiatorType) {\n case 'parser':\n case 'script':\n case 'preflight':\n return initiatorType;\n default:\n return 'other';\n }\n }\n static #getCookies(associatedCookies) {\n return associatedCookies.map((cookieInfo) => {\n return {\n name: cookieInfo.cookie.name,\n value: cookieInfo.cookie.value,\n domain: cookieInfo.cookie.domain,\n path: cookieInfo.cookie.path,\n expires: cookieInfo.cookie.expires,\n size: cookieInfo.cookie.size,\n httpOnly: cookieInfo.cookie.httpOnly,\n secure: cookieInfo.cookie.secure,\n sameSite: NetworkRequest.#getCookiesSameSite(cookieInfo.cookie.sameSite),\n };\n });\n }\n static #getCookiesSameSite(cdpSameSiteValue) {\n switch (cdpSameSiteValue) {\n case 'Strict':\n return 'strict';\n case 'Lax':\n return 'lax';\n default:\n return 'none';\n }\n }\n}\nexports.NetworkRequest = NetworkRequest;\n//# sourceMappingURL=networkRequest.js.map","\"use strict\";\n/*\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.NetworkProcessor = void 0;\nconst DefaultMap_js_1 = require(\"../../../utils/DefaultMap.js\");\nconst networkRequest_js_1 = require(\"./networkRequest.js\");\nclass NetworkProcessor {\n #eventManager;\n /**\n * Map of request ID to NetworkRequest objects. Needed as long as information\n * about requests comes from different events.\n */\n #requestMap;\n constructor(eventManager) {\n this.#eventManager = eventManager;\n this.#requestMap = new DefaultMap_js_1.DefaultMap((requestId) => new networkRequest_js_1.NetworkRequest(requestId, this.#eventManager));\n }\n static async create(cdpClient, eventManager) {\n const networkProcessor = new NetworkProcessor(eventManager);\n cdpClient.on('Network.requestWillBeSent', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onRequestWillBeSentEvent(params);\n });\n cdpClient.on('Network.requestWillBeSentExtraInfo', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onRequestWillBeSentExtraInfoEvent(params);\n });\n cdpClient.on('Network.responseReceived', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onResponseReceivedEvent(params);\n });\n cdpClient.on('Network.responseReceivedExtraInfo', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onResponseReceivedEventExtraInfo(params);\n });\n cdpClient.on('Network.loadingFailed', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onLoadingFailedEvent(params);\n });\n cdpClient.on('Network.requestServedFromCache', (params) => {\n networkProcessor\n .#getOrCreateNetworkRequest(params.requestId)\n .onServedFromCache();\n });\n await cdpClient.sendCommand('Network.enable');\n return networkProcessor;\n }\n #getOrCreateNetworkRequest(requestId) {\n return this.#requestMap.get(requestId);\n }\n}\nexports.NetworkProcessor = NetworkProcessor;\n//# sourceMappingURL=networkProcessor.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CdpTarget = void 0;\nconst logManager_js_1 = require(\"../log/logManager.js\");\nconst deferred_js_1 = require(\"../../../utils/deferred.js\");\nconst networkProcessor_js_1 = require(\"../network/networkProcessor.js\");\nclass CdpTarget {\n #targetId;\n #parentTargetId;\n #cdpClient;\n #cdpSessionId;\n #eventManager;\n #preloadScriptStorage;\n #targetUnblocked;\n #networkDomainActivated;\n static create(targetId, parentTargetId, cdpClient, cdpSessionId, realmStorage, eventManager, preloadScriptStorage) {\n const cdpTarget = new CdpTarget(targetId, parentTargetId, cdpClient, cdpSessionId, eventManager, preloadScriptStorage);\n logManager_js_1.LogManager.create(cdpTarget, realmStorage, eventManager);\n cdpTarget.#setEventListeners();\n // No need to await.\n // Deferred will be resolved when the target is unblocked.\n void cdpTarget.#unblock();\n return cdpTarget;\n }\n constructor(targetId, parentTargetId, cdpClient, cdpSessionId, eventManager, preloadScriptStorage) {\n this.#targetId = targetId;\n this.#parentTargetId = parentTargetId;\n this.#cdpClient = cdpClient;\n this.#cdpSessionId = cdpSessionId;\n this.#eventManager = eventManager;\n this.#preloadScriptStorage = preloadScriptStorage;\n this.#networkDomainActivated = false;\n this.#targetUnblocked = new deferred_js_1.Deferred();\n }\n /** Returns a promise that resolves when the target is unblocked. */\n get targetUnblocked() {\n return this.#targetUnblocked;\n }\n get targetId() {\n return this.#targetId;\n }\n get cdpClient() {\n return this.#cdpClient;\n }\n /**\n * Needed for CDP escape path.\n */\n get cdpSessionId() {\n return this.#cdpSessionId;\n }\n /**\n * Enables all the required CDP domains and unblocks the target.\n */\n async #unblock() {\n try {\n // Enable Network domain, if it is enabled globally.\n // TODO: enable Network domain for OOPiF targets.\n if (this.#eventManager.isNetworkDomainEnabled) {\n await this.enableNetworkDomain();\n }\n await this.#cdpClient.sendCommand('Runtime.enable');\n await this.#cdpClient.sendCommand('Page.enable');\n await this.#cdpClient.sendCommand('Page.setLifecycleEventsEnabled', {\n enabled: true,\n });\n await this.#cdpClient.sendCommand('Target.setAutoAttach', {\n autoAttach: true,\n waitForDebuggerOnStart: true,\n flatten: true,\n });\n await this.#initAndEvaluatePreloadScripts();\n await this.#cdpClient.sendCommand('Runtime.runIfWaitingForDebugger');\n }\n catch (error) {\n // The target might have been closed before the initialization finished.\n if (!this.#cdpClient.isCloseError(error)) {\n throw error;\n }\n }\n this.#targetUnblocked.resolve();\n }\n /**\n * Enables the Network domain (creates NetworkProcessor on the target's cdp\n * client) if it is not enabled yet.\n */\n async enableNetworkDomain() {\n if (!this.#networkDomainActivated) {\n this.#networkDomainActivated = true;\n await networkProcessor_js_1.NetworkProcessor.create(this.cdpClient, this.#eventManager);\n }\n }\n #setEventListeners() {\n this.#cdpClient.on('*', (event, params) => {\n // We may encounter uses for EventEmitter other than CDP events,\n // which we want to skip.\n if (typeof event !== 'string') {\n return;\n }\n this.#eventManager.registerEvent({\n method: `cdp.${event}`,\n params: {\n event,\n params: params,\n session: this.#cdpSessionId,\n },\n }, null);\n });\n }\n /**\n * All the ProxyChannels from all the preload scripts of the given\n * BrowsingContext.\n */\n getChannels(contextId) {\n return this.#preloadScriptStorage\n .findPreloadScripts({\n contextIds: [null, contextId],\n })\n .flatMap((script) => script.channels);\n }\n /** Loads all top-level and parent preload scripts. */\n async #initAndEvaluatePreloadScripts() {\n for (const script of this.#preloadScriptStorage.findPreloadScripts({\n contextIds: [null, this.#parentTargetId],\n })) {\n await script.initInTarget(this);\n // Upon attaching to a new target, schedule running preload scripts right\n // after `Runtime.runIfWaitingForDebugger`, but don't wait for the result.\n script.scheduleEvaluateInTarget(this);\n }\n }\n}\nexports.CdpTarget = CdpTarget;\n//# sourceMappingURL=cdpTarget.js.map","\"use strict\";\n/*\n * Copyright 2023 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BidiPreloadScript = void 0;\nconst uuid_js_1 = require(\"../../../utils/uuid.js\");\nconst channelProxy_js_1 = require(\"../script/channelProxy.js\");\n/**\n * BiDi IDs are generated by the server and are unique within the context.\n *\n * CDP preload script IDs are generated by the client and are unique\n * within the session.\n *\n * The mapping between BiDi and CDP preload script IDs is 1:many.\n * BiDi IDs are needed by the mapper to keep track of potential multiple CDP IDs\n * in the client.\n */\nclass BidiPreloadScript {\n /** BiDi ID, an automatically generated UUID. */\n #id = (0, uuid_js_1.uuidv4)();\n /** CDP preload scripts. */\n #cdpPreloadScripts = [];\n /** The script itself, in a format expected by the spec i.e. a function. */\n #functionDeclaration;\n /** Browsing context ID. */\n #contextId;\n /** Targets, in which the preload script is initialized. */\n #targetIds = new Set();\n /** Channels to be added as arguments to functionDeclaration. */\n #channels;\n get id() {\n return this.#id;\n }\n get contextId() {\n return this.#contextId;\n }\n get targetIds() {\n return this.#targetIds;\n }\n constructor(params) {\n if (params.sandbox !== undefined) {\n // TODO: Handle sandbox.\n throw new Error('Sandbox is not supported yet');\n }\n this.#channels =\n params.arguments?.map((a) => new channelProxy_js_1.ChannelProxy(a.value)) ?? [];\n this.#functionDeclaration = params.functionDeclaration;\n this.#contextId = params.context ?? null;\n }\n /** Channels of the preload script. */\n get channels() {\n return this.#channels;\n }\n /**\n * Adds the script to the given CDP targets by calling the\n * `Page.addScriptToEvaluateOnNewDocument` command.\n */\n async initInTargets(cdpTargets) {\n await Promise.all(Array.from(cdpTargets).map((cdpTarget) => this.initInTarget(cdpTarget)));\n }\n /**\n * String to be evaluated. Wraps user-provided function so that the following\n * steps are run:\n * 1. Create channels.\n * 2. Store the created channels in window.\n * 3. Call the user-provided function with channels as arguments.\n */\n #getEvaluateString() {\n const channelsArgStr = `[${this.channels\n .map((c) => c.getEvalInWindowStr())\n .join(', ')}]`;\n return `(()=>{(${this.#functionDeclaration})(...${channelsArgStr})})()`;\n }\n /**\n * Adds the script to the given CDP target by calling the\n * `Page.addScriptToEvaluateOnNewDocument` command.\n */\n async initInTarget(cdpTarget) {\n const addCdpPreloadScriptResult = await cdpTarget.cdpClient.sendCommand('Page.addScriptToEvaluateOnNewDocument', {\n source: this.#getEvaluateString(),\n });\n this.#cdpPreloadScripts.push({\n target: cdpTarget,\n preloadScriptId: addCdpPreloadScriptResult.identifier,\n });\n this.#targetIds.add(cdpTarget.targetId);\n }\n /**\n * Schedules the script to be run right after\n * `Runtime.runIfWaitingForDebugger`, but does not wait for result.\n */\n scheduleEvaluateInTarget(cdpTarget) {\n void cdpTarget.cdpClient.sendCommand('Runtime.evaluate', {\n expression: this.#getEvaluateString(),\n });\n }\n /**\n * Removes this script from all CDP targets.\n */\n async remove() {\n for (const cdpPreloadScript of this.#cdpPreloadScripts) {\n const cdpTarget = cdpPreloadScript.target;\n const cdpPreloadScriptId = cdpPreloadScript.preloadScriptId;\n await cdpTarget.cdpClient.sendCommand('Page.removeScriptToEvaluateOnNewDocument', {\n identifier: cdpPreloadScriptId,\n });\n }\n }\n /**\n * Removes the provided cdp target from the list of cdp preload scripts.\n */\n cdpTargetIsGone(cdpTargetId) {\n this.#cdpPreloadScripts = this.#cdpPreloadScripts.filter((cdpPreloadScript) => cdpPreloadScript.target?.targetId !== cdpTargetId);\n this.#targetIds.delete(cdpTargetId);\n }\n}\nexports.BidiPreloadScript = BidiPreloadScript;\n//# sourceMappingURL=bidiPreloadScript.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowsingContextProcessor = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst log_js_1 = require(\"../../../utils/log.js\");\nconst InputStateManager_js_1 = require(\"../input/InputStateManager.js\");\nconst ActionDispatcher_js_1 = require(\"../input/ActionDispatcher.js\");\nconst PreloadScriptStorage_js_1 = require(\"./PreloadScriptStorage.js\");\nconst browsingContextImpl_js_1 = require(\"./browsingContextImpl.js\");\nconst cdpTarget_js_1 = require(\"./cdpTarget.js\");\nconst bidiPreloadScript_1 = require(\"./bidiPreloadScript\");\nclass BrowsingContextProcessor {\n #browsingContextStorage;\n #cdpConnection;\n #eventManager;\n #logger;\n #realmStorage;\n #selfTargetId;\n #preloadScriptStorage = new PreloadScriptStorage_js_1.PreloadScriptStorage();\n #inputStateManager = new InputStateManager_js_1.InputStateManager();\n constructor(cdpConnection, selfTargetId, eventManager, browsingContextStorage, realmStorage, logger) {\n this.#cdpConnection = cdpConnection;\n this.#selfTargetId = selfTargetId;\n this.#eventManager = eventManager;\n this.#browsingContextStorage = browsingContextStorage;\n this.#realmStorage = realmStorage;\n this.#logger = logger;\n this.#setEventListeners(this.#cdpConnection.browserClient());\n }\n /**\n * This method is called for each CDP session, since this class is responsible\n * for creating and destroying all targets and browsing contexts.\n */\n #setEventListeners(cdpClient) {\n cdpClient.on('Target.attachedToTarget', (params) => {\n this.#handleAttachedToTargetEvent(params, cdpClient);\n });\n cdpClient.on('Target.detachedFromTarget', (params) => {\n this.#handleDetachedFromTargetEvent(params);\n });\n cdpClient.on('Target.targetInfoChanged', (params) => {\n this.#handleTargetInfoChangedEvent(params);\n });\n cdpClient.on('Page.frameAttached', (params) => {\n this.#handleFrameAttachedEvent(params);\n });\n cdpClient.on('Page.frameDetached', (params) => {\n this.#handleFrameDetachedEvent(params);\n });\n }\n #handleFrameAttachedEvent(params) {\n const parentBrowsingContext = this.#browsingContextStorage.findContext(params.parentFrameId);\n if (parentBrowsingContext !== undefined) {\n browsingContextImpl_js_1.BrowsingContextImpl.create(parentBrowsingContext.cdpTarget, this.#realmStorage, params.frameId, params.parentFrameId, this.#eventManager, this.#browsingContextStorage, this.#logger);\n }\n }\n #handleFrameDetachedEvent(params) {\n // In case of OOPiF no need in deleting BrowsingContext.\n if (params.reason === 'swap') {\n return;\n }\n this.#browsingContextStorage.findContext(params.frameId)?.delete();\n }\n #handleAttachedToTargetEvent(params, parentSessionCdpClient) {\n const { sessionId, targetInfo } = params;\n const targetCdpClient = this.#cdpConnection.getCdpClient(sessionId);\n if (!this.#isValidTarget(targetInfo)) {\n // DevTools or some other not supported by BiDi target. Just release\n // debugger and ignore them.\n targetCdpClient\n .sendCommand('Runtime.runIfWaitingForDebugger')\n .then(() => parentSessionCdpClient.sendCommand('Target.detachFromTarget', params))\n .catch((error) => this.#logger?.(log_js_1.LogType.system, error));\n return;\n }\n this.#logger?.(log_js_1.LogType.browsingContexts, 'AttachedToTarget event received:', JSON.stringify(params, null, 2));\n this.#setEventListeners(targetCdpClient);\n const maybeContext = this.#browsingContextStorage.findContext(targetInfo.targetId);\n const cdpTarget = cdpTarget_js_1.CdpTarget.create(targetInfo.targetId, maybeContext?.parentId ?? null, targetCdpClient, sessionId, this.#realmStorage, this.#eventManager, this.#preloadScriptStorage);\n if (maybeContext) {\n // OOPiF.\n maybeContext.updateCdpTarget(cdpTarget);\n }\n else {\n // New context.\n browsingContextImpl_js_1.BrowsingContextImpl.create(cdpTarget, this.#realmStorage, targetInfo.targetId, null, this.#eventManager, this.#browsingContextStorage, this.#logger);\n }\n }\n #handleDetachedFromTargetEvent(params) {\n // XXX: params.targetId is deprecated. Update this class to track using\n // params.sessionId instead.\n // https://github.com/GoogleChromeLabs/chromium-bidi/issues/60\n const contextId = params.targetId;\n this.#browsingContextStorage.findContext(contextId)?.delete();\n this.#preloadScriptStorage\n .findPreloadScripts({ targetId: contextId })\n .map((preloadScript) => preloadScript.cdpTargetIsGone(contextId));\n }\n #handleTargetInfoChangedEvent(params) {\n const contextId = params.targetInfo.targetId;\n this.#browsingContextStorage\n .findContext(contextId)\n ?.onTargetInfoChanged(params);\n }\n async #getRealm(target) {\n if ('realm' in target) {\n return this.#realmStorage.getRealm({\n realmId: target.realm,\n });\n }\n const context = this.#browsingContextStorage.getContext(target.context);\n return context.getOrCreateSandbox(target.sandbox);\n }\n process_browsingContext_getTree(params) {\n const resultContexts = params.root === undefined\n ? this.#browsingContextStorage.getTopLevelContexts()\n : [this.#browsingContextStorage.getContext(params.root)];\n return {\n result: {\n contexts: resultContexts.map((c) => c.serializeToBidiValue(params.maxDepth ?? Number.MAX_VALUE)),\n },\n };\n }\n async process_browsingContext_create(params) {\n const browserCdpClient = this.#cdpConnection.browserClient();\n let referenceContext;\n if (params.referenceContext !== undefined) {\n referenceContext = this.#browsingContextStorage.getContext(params.referenceContext);\n if (!referenceContext.isTopLevelContext()) {\n throw new protocol_js_1.Message.InvalidArgumentException(`referenceContext should be a top-level context`);\n }\n }\n let result;\n switch (params.type) {\n case 'tab':\n result = await browserCdpClient.sendCommand('Target.createTarget', {\n url: 'about:blank',\n newWindow: false,\n });\n break;\n case 'window':\n result = await browserCdpClient.sendCommand('Target.createTarget', {\n url: 'about:blank',\n newWindow: true,\n });\n break;\n }\n // Wait for the new tab to be loaded to avoid race conditions in the\n // `browsingContext` events, when the `browsingContext.domContentLoaded` and\n // `browsingContext.load` events from the initial `about:blank` navigation\n // are emitted after the next navigation is started.\n // Details: https://github.com/web-platform-tests/wpt/issues/35846\n const contextId = result.targetId;\n const context = this.#browsingContextStorage.getContext(contextId);\n await context.awaitLoaded();\n return {\n result: {\n context: context.id,\n },\n };\n }\n process_browsingContext_navigate(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n return context.navigate(params.url, params.wait ?? 'none');\n }\n process_browsingContext_reload(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n return context.reload(params.ignoreCache ?? false, params.wait ?? 'none');\n }\n async process_browsingContext_captureScreenshot(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n return context.captureScreenshot();\n }\n async process_browsingContext_print(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n return context.print(params);\n }\n async process_script_addPreloadScript(params) {\n const preloadScript = new bidiPreloadScript_1.BidiPreloadScript(params);\n this.#preloadScriptStorage.addPreloadScript(preloadScript);\n const cdpTargets = new Set(\n // TODO: The unique target can be in a non-top-level browsing context.\n // We need all the targets.\n // To get them, we can walk through all the contexts and collect their targets into the set.\n params.context === undefined || params.context === null\n ? this.#browsingContextStorage\n .getTopLevelContexts()\n .map((context) => context.cdpTarget)\n : [this.#browsingContextStorage.getContext(params.context).cdpTarget]);\n await preloadScript.initInTargets(cdpTargets);\n return {\n result: {\n script: preloadScript.id,\n },\n };\n }\n async process_script_removePreloadScript(params) {\n const bidiId = params.script;\n const scripts = this.#preloadScriptStorage.findPreloadScripts({\n id: bidiId,\n });\n if (scripts.length === 0) {\n throw new protocol_js_1.Message.NoSuchScriptException(`No preload script with BiDi ID '${bidiId}'`);\n }\n await Promise.all(scripts.map((script) => script.remove()));\n this.#preloadScriptStorage.removeBiDiPreloadScripts({\n id: bidiId,\n });\n return { result: {} };\n }\n async process_script_evaluate(params) {\n const realm = await this.#getRealm(params.target);\n return realm.scriptEvaluate(params.expression, params.awaitPromise, params.resultOwnership ?? 'none', params.serializationOptions ?? {});\n }\n process_script_getRealms(params) {\n if (params.context !== undefined) {\n // Make sure the context is known.\n this.#browsingContextStorage.getContext(params.context);\n }\n const realms = this.#realmStorage\n .findRealms({\n browsingContextId: params.context,\n type: params.type,\n })\n .map((realm) => realm.toBiDi());\n return { result: { realms } };\n }\n async process_script_callFunction(params) {\n const realm = await this.#getRealm(params.target);\n return realm.callFunction(params.functionDeclaration, params.this ?? {\n type: 'undefined',\n }, // `this` is `undefined` by default.\n params.arguments ?? [], // `arguments` is `[]` by default.\n params.awaitPromise, params.resultOwnership ?? 'none', params.serializationOptions ?? {});\n }\n async process_script_disown(params) {\n const realm = await this.#getRealm(params.target);\n await Promise.all(params.handles.map(async (h) => realm.disown(h)));\n return { result: {} };\n }\n async process_input_performActions(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n const inputState = this.#inputStateManager.get(context.top);\n const actionsByTick = this.#getActionsByTick(params, inputState);\n const dispatcher = new ActionDispatcher_js_1.ActionDispatcher(inputState, context, await ActionDispatcher_js_1.ActionDispatcher.isMacOS(context).catch(() => false));\n await dispatcher.dispatchActions(actionsByTick);\n return { result: {} };\n }\n #getActionsByTick(params, inputState) {\n const actionsByTick = [];\n for (const action of params.actions) {\n switch (action.type) {\n case protocol_js_1.Input.SourceActionsType.Pointer: {\n action.parameters ??= { pointerType: protocol_js_1.Input.PointerType.Mouse };\n action.parameters.pointerType ??= protocol_js_1.Input.PointerType.Mouse;\n const source = inputState.getOrCreate(action.id, protocol_js_1.Input.SourceActionsType.Pointer, action.parameters.pointerType);\n if (source.subtype !== action.parameters.pointerType) {\n throw new protocol_js_1.Message.InvalidArgumentException(`Expected input source ${action.id} to be ${source.subtype}; got ${action.parameters.pointerType}.`);\n }\n break;\n }\n default:\n inputState.getOrCreate(action.id, action.type);\n }\n const actions = action.actions.map((item) => ({\n id: action.id,\n action: item,\n }));\n for (let i = 0; i < actions.length; i++) {\n if (actionsByTick.length === i) {\n actionsByTick.push([]);\n }\n actionsByTick[i].push(actions[i]);\n }\n }\n return actionsByTick;\n }\n async process_input_releaseActions(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n const topContext = context.top;\n const inputState = this.#inputStateManager.get(topContext);\n const dispatcher = new ActionDispatcher_js_1.ActionDispatcher(inputState, context, await ActionDispatcher_js_1.ActionDispatcher.isMacOS(context).catch(() => false));\n await dispatcher.dispatchTickActions(inputState.cancelList.reverse());\n this.#inputStateManager.delete(topContext);\n return { result: {} };\n }\n async process_browsingContext_setViewport(params) {\n const context = this.#browsingContextStorage.getContext(params.context);\n if (!context.isTopLevelContext()) {\n throw new protocol_js_1.Message.InvalidArgumentException('Emulating viewport is only supported on the top-level context');\n }\n await context.setViewport(params.viewport);\n return { result: {} };\n }\n async process_browsingContext_close(commandParams) {\n const browserCdpClient = this.#cdpConnection.browserClient();\n const context = this.#browsingContextStorage.getContext(commandParams.context);\n if (!context.isTopLevelContext()) {\n throw new protocol_js_1.Message.InvalidArgumentException('A top-level browsing context cannot be closed.');\n }\n const detachedFromTargetPromise = new Promise((resolve) => {\n const onContextDestroyed = (eventParams) => {\n if (eventParams.targetId === commandParams.context) {\n browserCdpClient.off('Target.detachedFromTarget', onContextDestroyed);\n resolve();\n }\n };\n browserCdpClient.on('Target.detachedFromTarget', onContextDestroyed);\n });\n await browserCdpClient.sendCommand('Target.closeTarget', {\n targetId: commandParams.context,\n });\n // Sometimes CDP command finishes before `detachedFromTarget` event,\n // sometimes after. Wait for the CDP command to be finished, and then wait\n // for `detachedFromTarget` if it hasn't emitted.\n await detachedFromTargetPromise;\n return { result: {} };\n }\n #isValidTarget(target) {\n if (target.targetId === this.#selfTargetId) {\n return false;\n }\n return ['page', 'iframe'].includes(target.type);\n }\n async process_cdp_sendCommand(params) {\n const client = params.session\n ? this.#cdpConnection.getCdpClient(params.session)\n : this.#cdpConnection.browserClient();\n const sendCdpCommandResult = await client.sendCommand(params.method, params.params);\n return {\n result: sendCdpCommandResult,\n session: params.session,\n };\n }\n process_cdp_getSession(params) {\n const context = params.context;\n const sessionId = this.#browsingContextStorage.getContext(context).cdpTarget.cdpSessionId;\n if (sessionId === undefined) {\n return { result: { session: null } };\n }\n return { result: { session: sessionId } };\n }\n}\nexports.BrowsingContextProcessor = BrowsingContextProcessor;\n//# sourceMappingURL=browsingContextProcessor.js.map","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OutgoingBidiMessage = void 0;\nclass OutgoingBidiMessage {\n #message;\n #channel;\n constructor(message, channel) {\n this.#message = message;\n this.#channel = channel;\n }\n static async createFromPromise(messagePromise, channel) {\n return messagePromise.then((message) => new OutgoingBidiMessage(message, channel));\n }\n static createResolved(message, channel) {\n return Promise.resolve(new OutgoingBidiMessage(message, channel));\n }\n get message() {\n return this.#message;\n }\n get channel() {\n return this.#channel;\n }\n}\nexports.OutgoingBidiMessage = OutgoingBidiMessage;\n//# sourceMappingURL=OutgoingBidiMessage.js.map","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CommandProcessor = void 0;\nconst protocol_js_1 = require(\"../protocol/protocol.js\");\nconst log_js_1 = require(\"../utils/log.js\");\nconst EventEmitter_js_1 = require(\"../utils/EventEmitter.js\");\nconst browsingContextProcessor_js_1 = require(\"./domains/context/browsingContextProcessor.js\");\nconst OutgoingBidiMessage_js_1 = require(\"./OutgoingBidiMessage.js\");\nclass BidiNoOpParser {\n parseAddPreloadScriptParams(params) {\n return params;\n }\n parseRemovePreloadScriptParams(params) {\n return params;\n }\n parseGetRealmsParams(params) {\n return params;\n }\n parseCallFunctionParams(params) {\n return params;\n }\n parseEvaluateParams(params) {\n return params;\n }\n parseDisownParams(params) {\n return params;\n }\n parseSendCommandParams(params) {\n return params;\n }\n parseGetSessionParams(params) {\n return params;\n }\n parseSubscribeParams(params) {\n return params;\n }\n parseNavigateParams(params) {\n return params;\n }\n parseReloadParams(params) {\n return params;\n }\n parseGetTreeParams(params) {\n return params;\n }\n parseCreateParams(params) {\n return params;\n }\n parseCloseParams(params) {\n return params;\n }\n parseCaptureScreenshotParams(params) {\n return params;\n }\n parsePrintParams(params) {\n return params;\n }\n parsePerformActionsParams(params) {\n return params;\n }\n parseReleaseActionsParams(params) {\n return params;\n }\n parseSetViewportParams(params) {\n return params;\n }\n}\nclass CommandProcessor extends EventEmitter_js_1.EventEmitter {\n #contextProcessor;\n #eventManager;\n #parser;\n #logger;\n constructor(cdpConnection, eventManager, selfTargetId, parser = new BidiNoOpParser(), browsingContextStorage, realmStorage, logger) {\n super();\n this.#eventManager = eventManager;\n this.#logger = logger;\n this.#contextProcessor = new browsingContextProcessor_js_1.BrowsingContextProcessor(cdpConnection, selfTargetId, eventManager, browsingContextStorage, realmStorage, logger);\n this.#parser = parser;\n }\n static #process_session_status() {\n return { result: { ready: false, message: 'already connected' } };\n }\n async #process_session_subscribe(params, channel) {\n await this.#eventManager.subscribe(params.events, params.contexts ?? [null], channel);\n return { result: {} };\n }\n async #process_session_unsubscribe(params, channel) {\n await this.#eventManager.unsubscribe(params.events, params.contexts ?? [null], channel);\n return { result: {} };\n }\n async #processCommand(commandData) {\n switch (commandData.method) {\n case 'session.status':\n return CommandProcessor.#process_session_status();\n case 'session.subscribe':\n return this.#process_session_subscribe(this.#parser.parseSubscribeParams(commandData.params), commandData.channel ?? null);\n case 'session.unsubscribe':\n return this.#process_session_unsubscribe(this.#parser.parseSubscribeParams(commandData.params), commandData.channel ?? null);\n case 'browsingContext.create':\n return this.#contextProcessor.process_browsingContext_create(this.#parser.parseCreateParams(commandData.params));\n case 'browsingContext.close':\n return this.#contextProcessor.process_browsingContext_close(this.#parser.parseCloseParams(commandData.params));\n case 'browsingContext.getTree':\n return this.#contextProcessor.process_browsingContext_getTree(this.#parser.parseGetTreeParams(commandData.params));\n case 'browsingContext.navigate':\n return this.#contextProcessor.process_browsingContext_navigate(this.#parser.parseNavigateParams(commandData.params));\n case 'browsingContext.captureScreenshot':\n return this.#contextProcessor.process_browsingContext_captureScreenshot(this.#parser.parseCaptureScreenshotParams(commandData.params));\n case 'browsingContext.print':\n return this.#contextProcessor.process_browsingContext_print(this.#parser.parsePrintParams(commandData.params));\n case 'browsingContext.reload':\n return this.#contextProcessor.process_browsingContext_reload(this.#parser.parseReloadParams(commandData.params));\n case 'browsingContext.setViewport':\n return this.#contextProcessor.process_browsingContext_setViewport(this.#parser.parseSetViewportParams(commandData.params));\n case 'script.addPreloadScript':\n return this.#contextProcessor.process_script_addPreloadScript(this.#parser.parseAddPreloadScriptParams(commandData.params));\n case 'script.removePreloadScript':\n return this.#contextProcessor.process_script_removePreloadScript(this.#parser.parseRemovePreloadScriptParams(commandData.params));\n case 'script.getRealms':\n return this.#contextProcessor.process_script_getRealms(this.#parser.parseGetRealmsParams(commandData.params));\n case 'script.callFunction':\n return this.#contextProcessor.process_script_callFunction(this.#parser.parseCallFunctionParams(commandData.params));\n case 'script.evaluate':\n return this.#contextProcessor.process_script_evaluate(this.#parser.parseEvaluateParams(commandData.params));\n case 'script.disown':\n return this.#contextProcessor.process_script_disown(this.#parser.parseDisownParams(commandData.params));\n case 'input.performActions':\n return this.#contextProcessor.process_input_performActions(this.#parser.parsePerformActionsParams(commandData.params));\n case 'input.releaseActions':\n return this.#contextProcessor.process_input_releaseActions(this.#parser.parseReleaseActionsParams(commandData.params));\n case 'cdp.sendCommand':\n return this.#contextProcessor.process_cdp_sendCommand(this.#parser.parseSendCommandParams(commandData.params));\n case 'cdp.getSession':\n return this.#contextProcessor.process_cdp_getSession(this.#parser.parseGetSessionParams(commandData.params));\n }\n // Intentionally kept outside of the switch statement to ensure that\n // ESLint @typescript-eslint/switch-exhaustiveness-check triggers if a new\n // command is added.\n throw new protocol_js_1.Message.UnknownCommandException(`Unknown command '${commandData.method}'.`);\n }\n async processCommand(command) {\n try {\n const result = await this.#processCommand(command);\n const response = {\n id: command.id,\n ...result,\n };\n this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(response, command.channel ?? null));\n }\n catch (e) {\n if (e instanceof protocol_js_1.Message.ErrorResponse) {\n const errorResponse = e;\n this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(errorResponse.toErrorResponse(command.id), command.channel ?? null));\n }\n else {\n const error = e;\n this.#logger?.(log_js_1.LogType.bidi, error);\n this.emit('response', OutgoingBidiMessage_js_1.OutgoingBidiMessage.createResolved(new protocol_js_1.Message.UnknownErrorException(error.message).toErrorResponse(command.id), command.channel ?? null));\n }\n }\n }\n}\nexports.CommandProcessor = CommandProcessor;\n//# sourceMappingURL=CommandProcessor.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BrowsingContextStorage = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\n/** Container class for browsing contexts. */\nclass BrowsingContextStorage {\n /** Map from context ID to context implementation. */\n #contexts = new Map();\n /** Gets all top-level contexts, i.e. those with no parent. */\n getTopLevelContexts() {\n return this.getAllContexts().filter((context) => context.isTopLevelContext());\n }\n /** Gets all contexts. */\n getAllContexts() {\n return Array.from(this.#contexts.values());\n }\n /** Deletes the context with the given ID. */\n deleteContextById(id) {\n this.#contexts.delete(id);\n }\n /** Deletes the given context. */\n deleteContext(context) {\n this.#contexts.delete(context.id);\n }\n /** Tracks the given context. */\n addContext(context) {\n this.#contexts.set(context.id, context);\n }\n /** Returns true whether there is an existing context with the given ID. */\n hasContext(id) {\n return this.#contexts.has(id);\n }\n /** Gets the context with the given ID, if any. */\n findContext(id) {\n return this.#contexts.get(id);\n }\n /** Returns the top-level context ID of the given context, if any. */\n findTopLevelContextId(id) {\n if (id === null) {\n return null;\n }\n const maybeContext = this.findContext(id);\n const parentId = maybeContext?.parentId ?? null;\n if (parentId === null) {\n return id;\n }\n return this.findTopLevelContextId(parentId);\n }\n /** Gets the context with the given ID, if any, otherwise throws. */\n getContext(id) {\n const result = this.findContext(id);\n if (result === undefined) {\n throw new protocol_js_1.Message.NoSuchFrameException(`Context ${id} not found`);\n }\n return result;\n }\n}\nexports.BrowsingContextStorage = BrowsingContextStorage;\n//# sourceMappingURL=browsingContextStorage.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Buffer = void 0;\n/**\n * Implements a FIFO buffer with a fixed size.\n */\nclass Buffer {\n #capacity;\n #entries = [];\n #onItemRemoved;\n /**\n * @param capacity\n * @param onItemRemoved optional delegate called for each removed element.\n */\n constructor(capacity, onItemRemoved) {\n this.#capacity = capacity;\n this.#onItemRemoved = onItemRemoved;\n }\n get() {\n return this.#entries;\n }\n add(value) {\n this.#entries.push(value);\n while (this.#entries.length > this.#capacity) {\n const item = this.#entries.shift();\n if (item !== undefined) {\n this.#onItemRemoved?.(item);\n }\n }\n }\n}\nexports.Buffer = Buffer;\n//# sourceMappingURL=buffer.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.IdWrapper = void 0;\n/**\n * Creates an object with a positive unique incrementing id.\n */\nclass IdWrapper {\n static #counter = 0;\n #id;\n constructor() {\n this.#id = ++IdWrapper.#counter;\n }\n get id() {\n return this.#id;\n }\n}\nexports.IdWrapper = IdWrapper;\n//# sourceMappingURL=idWrapper.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SubscriptionManager = exports.unrollEvents = exports.cartesianProduct = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\n/**\n * Returns the cartesian product of the given arrays.\n *\n * Example:\n * cartesian([1, 2], ['a', 'b']); => [[1, 'a'], [1, 'b'], [2, 'a'], [2, 'b']]\n */\nfunction cartesianProduct(...a) {\n return a.reduce((a, b) => a.flatMap((d) => b.map((e) => [d, e].flat())));\n}\nexports.cartesianProduct = cartesianProduct;\n/** Expands \"AllEvents\" events into atomic events. */\nfunction unrollEvents(events) {\n const allEvents = new Set();\n function addEvents(events) {\n for (const event of events) {\n allEvents.add(event);\n }\n }\n for (const event of events) {\n switch (event) {\n case protocol_js_1.BrowsingContext.AllEvents:\n addEvents(Object.values(protocol_js_1.BrowsingContext.EventNames));\n break;\n case protocol_js_1.Log.AllEvents:\n addEvents(Object.values(protocol_js_1.Log.EventNames));\n break;\n case protocol_js_1.Network.AllEvents:\n addEvents(Object.values(protocol_js_1.Network.EventNames));\n break;\n case protocol_js_1.Script.AllEvents:\n addEvents(Object.values(protocol_js_1.Script.EventNames));\n break;\n default:\n allEvents.add(event);\n }\n }\n return [...allEvents.values()];\n}\nexports.unrollEvents = unrollEvents;\nclass SubscriptionManager {\n #subscriptionPriority = 0;\n // BrowsingContext `null` means the event has subscription across all the\n // browsing contexts.\n // Channel `null` means no `channel` should be added.\n #channelToContextToEventMap = new Map();\n #browsingContextStorage;\n constructor(browsingContextStorage) {\n this.#browsingContextStorage = browsingContextStorage;\n }\n getChannelsSubscribedToEvent(eventMethod, contextId) {\n const prioritiesAndChannels = Array.from(this.#channelToContextToEventMap.keys())\n .map((channel) => ({\n priority: this.#getEventSubscriptionPriorityForChannel(eventMethod, contextId, channel),\n channel,\n }))\n .filter(({ priority }) => priority !== null);\n // Sort channels by priority.\n return prioritiesAndChannels\n .sort((a, b) => a.priority - b.priority)\n .map(({ channel }) => channel);\n }\n #getEventSubscriptionPriorityForChannel(eventMethod, contextId, channel) {\n const contextToEventMap = this.#channelToContextToEventMap.get(channel);\n if (contextToEventMap === undefined) {\n return null;\n }\n const maybeTopLevelContextId = this.#browsingContextStorage.findTopLevelContextId(contextId);\n // `null` covers global subscription.\n const relevantContexts = [...new Set([null, maybeTopLevelContextId])];\n // Get all the subscription priorities.\n const priorities = relevantContexts\n .map((c) => contextToEventMap.get(c)?.get(eventMethod))\n .filter((p) => p !== undefined);\n if (priorities.length === 0) {\n // Not subscribed, return null.\n return null;\n }\n // Return minimal priority.\n return Math.min(...priorities);\n }\n subscribe(event, contextId, channel) {\n // All the subscriptions are handled on the top-level contexts.\n contextId = this.#browsingContextStorage.findTopLevelContextId(contextId);\n if (event === protocol_js_1.BrowsingContext.AllEvents) {\n Object.values(protocol_js_1.BrowsingContext.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));\n return;\n }\n if (event === protocol_js_1.Log.AllEvents) {\n Object.values(protocol_js_1.Log.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));\n return;\n }\n if (event === protocol_js_1.Network.AllEvents) {\n Object.values(protocol_js_1.Network.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));\n return;\n }\n if (event === protocol_js_1.Script.AllEvents) {\n Object.values(protocol_js_1.Script.EventNames).map((specificEvent) => this.subscribe(specificEvent, contextId, channel));\n return;\n }\n if (!this.#channelToContextToEventMap.has(channel)) {\n this.#channelToContextToEventMap.set(channel, new Map());\n }\n const contextToEventMap = this.#channelToContextToEventMap.get(channel);\n if (!contextToEventMap.has(contextId)) {\n contextToEventMap.set(contextId, new Map());\n }\n const eventMap = contextToEventMap.get(contextId);\n // Do not re-subscribe to events to keep the priority.\n if (eventMap.has(event)) {\n return;\n }\n eventMap.set(event, this.#subscriptionPriority++);\n }\n /**\n * Unsubscribes atomically from all events in the given contexts and channel.\n */\n unsubscribeAll(events, contextIds, channel) {\n // Assert all contexts are known.\n for (const contextId of contextIds) {\n if (contextId !== null) {\n this.#browsingContextStorage.getContext(contextId);\n }\n }\n const eventContextPairs = cartesianProduct(unrollEvents(events), contextIds);\n // Assert all unsubscriptions are valid.\n // If any of the unsubscriptions are invalid, do not unsubscribe from anything.\n eventContextPairs\n .map(([event, contextId]) => this.#checkUnsubscribe(event, contextId, channel))\n .forEach((unsubscribe) => unsubscribe());\n }\n /**\n * Unsubscribes from the event in the given context and channel.\n * Syntactic sugar for \"unsubscribeAll\".\n */\n unsubscribe(eventName, contextId, channel) {\n this.unsubscribeAll([eventName], [contextId], channel);\n }\n #checkUnsubscribe(event, contextId, channel) {\n // All the subscriptions are handled on the top-level contexts.\n contextId = this.#browsingContextStorage.findTopLevelContextId(contextId);\n if (!this.#channelToContextToEventMap.has(channel)) {\n throw new protocol_js_1.Message.InvalidArgumentException(`Cannot unsubscribe from ${event}, ${contextId === null ? 'null' : contextId}. No subscription found.`);\n }\n const contextToEventMap = this.#channelToContextToEventMap.get(channel);\n if (!contextToEventMap.has(contextId)) {\n throw new protocol_js_1.Message.InvalidArgumentException(`Cannot unsubscribe from ${event}, ${contextId === null ? 'null' : contextId}. No subscription found.`);\n }\n const eventMap = contextToEventMap.get(contextId);\n if (!eventMap.has(event)) {\n throw new protocol_js_1.Message.InvalidArgumentException(`Cannot unsubscribe from ${event}, ${contextId === null ? 'null' : contextId}. No subscription found.`);\n }\n return () => {\n eventMap.delete(event);\n // Clean up maps if empty.\n if (eventMap.size === 0) {\n contextToEventMap.delete(event);\n }\n if (contextToEventMap.size === 0) {\n this.#channelToContextToEventMap.delete(channel);\n }\n };\n }\n}\nexports.SubscriptionManager = SubscriptionManager;\n//# sourceMappingURL=SubscriptionManager.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.EventManager = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\nconst buffer_js_1 = require(\"../../../utils/buffer.js\");\nconst idWrapper_js_1 = require(\"../../../utils/idWrapper.js\");\nconst OutgoingBidiMessage_js_1 = require(\"../../OutgoingBidiMessage.js\");\nconst DefaultMap_js_1 = require(\"../../../utils/DefaultMap.js\");\nconst SubscriptionManager_js_1 = require(\"./SubscriptionManager.js\");\nclass EventWrapper {\n #idWrapper = new idWrapper_js_1.IdWrapper();\n #contextId;\n #event;\n constructor(event, contextId) {\n this.#event = event;\n this.#contextId = contextId;\n }\n get id() {\n return this.#idWrapper.id;\n }\n get contextId() {\n return this.#contextId;\n }\n get event() {\n return this.#event;\n }\n}\n/**\n * Maps event name to a desired buffer length.\n */\nconst eventBufferLength = new Map([\n [protocol_js_1.Log.EventNames.LogEntryAddedEvent, 100],\n]);\nclass EventManager {\n static #NETWORK_DOMAIN_PREFIX = 'network';\n /**\n * Maps event name to a set of contexts where this event already happened.\n * Needed for getting buffered events from all the contexts in case of\n * subscripting to all contexts.\n */\n #eventToContextsMap = new DefaultMap_js_1.DefaultMap(() => new Set());\n /**\n * Maps `eventName` + `browsingContext` to buffer. Used to get buffered events\n * during subscription. Channel-agnostic.\n */\n #eventBuffers = new Map();\n /**\n * Maps `eventName` + `browsingContext` + `channel` to last sent event id.\n * Used to avoid sending duplicated events when user\n * subscribes -> unsubscribes -> subscribes.\n */\n #lastMessageSent = new Map();\n #subscriptionManager;\n #bidiServer;\n #isNetworkDomainEnabled;\n constructor(bidiServer) {\n this.#bidiServer = bidiServer;\n this.#subscriptionManager = new SubscriptionManager_js_1.SubscriptionManager(bidiServer.getBrowsingContextStorage());\n this.#isNetworkDomainEnabled = false;\n }\n get isNetworkDomainEnabled() {\n return this.#isNetworkDomainEnabled;\n }\n /**\n * Returns consistent key to be used to access value maps.\n */\n static #getMapKey(eventName, browsingContext, channel) {\n return JSON.stringify({ eventName, browsingContext, channel });\n }\n registerEvent(event, contextId) {\n this.registerPromiseEvent(Promise.resolve(event), contextId, event.method);\n }\n registerPromiseEvent(event, contextId, eventName) {\n const eventWrapper = new EventWrapper(event, contextId);\n const sortedChannels = this.#subscriptionManager.getChannelsSubscribedToEvent(eventName, contextId);\n this.#bufferEvent(eventWrapper, eventName);\n // Send events to channels in the subscription priority.\n for (const channel of sortedChannels) {\n this.#bidiServer.emitOutgoingMessage(OutgoingBidiMessage_js_1.OutgoingBidiMessage.createFromPromise(event, channel));\n this.#markEventSent(eventWrapper, channel, eventName);\n }\n }\n async subscribe(eventNames, contextIds, channel) {\n // First check if all the contexts are known.\n for (const contextId of contextIds) {\n if (contextId !== null) {\n // Assert the context is known. Throw exception otherwise.\n this.#bidiServer.getBrowsingContextStorage().getContext(contextId);\n }\n }\n for (const eventName of eventNames) {\n for (const contextId of contextIds) {\n await this.#handleDomains(eventName, contextId);\n this.#subscriptionManager.subscribe(eventName, contextId, channel);\n for (const eventWrapper of this.#getBufferedEvents(eventName, contextId, channel)) {\n // The order of the events is important.\n this.#bidiServer.emitOutgoingMessage(OutgoingBidiMessage_js_1.OutgoingBidiMessage.createFromPromise(eventWrapper.event, channel));\n this.#markEventSent(eventWrapper, channel, eventName);\n }\n }\n }\n }\n /**\n * Enables domains for the subscribed event in the required contexts or\n * globally.\n */\n async #handleDomains(eventName, contextId) {\n // Enable network domain if user subscribed to any of network events.\n if (eventName.startsWith(EventManager.#NETWORK_DOMAIN_PREFIX)) {\n // Enable for all the contexts.\n if (contextId === null) {\n this.#isNetworkDomainEnabled = true;\n await Promise.all(this.#bidiServer\n .getBrowsingContextStorage()\n .getAllContexts()\n .map((context) => context.cdpTarget.enableNetworkDomain()));\n }\n else {\n await this.#bidiServer\n .getBrowsingContextStorage()\n .getContext(contextId)\n .cdpTarget.enableNetworkDomain();\n }\n }\n }\n unsubscribe(eventNames, contextIds, channel) {\n this.#subscriptionManager.unsubscribeAll(eventNames, contextIds, channel);\n }\n /**\n * If the event is buffer-able, put it in the buffer.\n */\n #bufferEvent(eventWrapper, eventName) {\n if (!eventBufferLength.has(eventName)) {\n // Do nothing if the event is no buffer-able.\n return;\n }\n const bufferMapKey = EventManager.#getMapKey(eventName, eventWrapper.contextId);\n if (!this.#eventBuffers.has(bufferMapKey)) {\n this.#eventBuffers.set(bufferMapKey, new buffer_js_1.Buffer(eventBufferLength.get(eventName)));\n }\n this.#eventBuffers.get(bufferMapKey).add(eventWrapper);\n // Add the context to the list of contexts having `eventName` events.\n this.#eventToContextsMap.get(eventName).add(eventWrapper.contextId);\n }\n /**\n * If the event is buffer-able, mark it as sent to the given contextId and channel.\n */\n #markEventSent(eventWrapper, channel, eventName) {\n if (!eventBufferLength.has(eventName)) {\n // Do nothing if the event is no buffer-able.\n return;\n }\n const lastSentMapKey = EventManager.#getMapKey(eventName, eventWrapper.contextId, channel);\n this.#lastMessageSent.set(lastSentMapKey, Math.max(this.#lastMessageSent.get(lastSentMapKey) ?? 0, eventWrapper.id));\n }\n /**\n * Returns events which are buffered and not yet sent to the given channel events.\n */\n #getBufferedEvents(eventName, contextId, channel) {\n const bufferMapKey = EventManager.#getMapKey(eventName, contextId);\n const lastSentMapKey = EventManager.#getMapKey(eventName, contextId, channel);\n const lastSentMessageId = this.#lastMessageSent.get(lastSentMapKey) ?? -Infinity;\n const result = this.#eventBuffers\n .get(bufferMapKey)\n ?.get()\n .filter((wrapper) => wrapper.id > lastSentMessageId) ?? [];\n if (contextId === null) {\n // For global subscriptions, events buffered in each context should be sent back.\n Array.from(this.#eventToContextsMap.get(eventName).keys())\n .filter((_contextId) => \n // Events without context are already in the result.\n _contextId !== null &&\n // Events from deleted contexts should not be sent.\n this.#bidiServer.getBrowsingContextStorage().hasContext(_contextId))\n .map((_contextId) => this.#getBufferedEvents(eventName, _contextId, channel))\n .forEach((events) => result.push(...events));\n }\n return result.sort((e1, e2) => e1.id - e2.id);\n }\n}\nexports.EventManager = EventManager;\n//# sourceMappingURL=EventManager.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.RealmStorage = void 0;\nconst protocol_js_1 = require(\"../../../protocol/protocol.js\");\n/** Container class for browsing realms. */\nclass RealmStorage {\n /** Tracks handles and their realms sent to the client. */\n #knownHandlesToRealm = new Map();\n /** Map from realm ID to Realm. */\n #realmMap = new Map();\n get knownHandlesToRealm() {\n return this.#knownHandlesToRealm;\n }\n addRealm(realm) {\n this.#realmMap.set(realm.realmId, realm);\n }\n /** Finds all realms that match the given filter. */\n findRealms(filter) {\n return Array.from(this.#realmMap.values()).filter((realm) => {\n if (filter.realmId !== undefined && filter.realmId !== realm.realmId) {\n return false;\n }\n if (filter.browsingContextId !== undefined &&\n filter.browsingContextId !== realm.browsingContextId) {\n return false;\n }\n if (filter.navigableId !== undefined &&\n filter.navigableId !== realm.navigableId) {\n return false;\n }\n if (filter.executionContextId !== undefined &&\n filter.executionContextId !== realm.executionContextId) {\n return false;\n }\n if (filter.origin !== undefined && filter.origin !== realm.origin) {\n return false;\n }\n if (filter.type !== undefined && filter.type !== realm.type) {\n return false;\n }\n if (filter.sandbox !== undefined && filter.sandbox !== realm.sandbox) {\n return false;\n }\n if (filter.cdpSessionId !== undefined &&\n filter.cdpSessionId !== realm.cdpSessionId) {\n return false;\n }\n return true;\n });\n }\n findRealm(filter) {\n const maybeRealms = this.findRealms(filter);\n if (maybeRealms.length !== 1) {\n return undefined;\n }\n return maybeRealms[0];\n }\n /** Gets the only realm that matches the given filter, if any, otherwise throws. */\n getRealm(filter) {\n const maybeRealm = this.findRealm(filter);\n if (maybeRealm === undefined) {\n throw new protocol_js_1.Message.NoSuchFrameException(`Realm ${JSON.stringify(filter)} not found`);\n }\n return maybeRealm;\n }\n /** Deletes all realms that match the given filter. */\n deleteRealms(filter) {\n this.findRealms(filter).map((realm) => {\n realm.delete();\n this.#realmMap.delete(realm.realmId);\n Array.from(this.knownHandlesToRealm.entries())\n .filter(([, r]) => r === realm.realmId)\n .map(([handle]) => this.knownHandlesToRealm.delete(handle));\n });\n }\n}\nexports.RealmStorage = RealmStorage;\n//# sourceMappingURL=realmStorage.js.map","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.BidiServer = void 0;\nconst EventEmitter_js_1 = require(\"../utils/EventEmitter.js\");\nconst log_js_1 = require(\"../utils/log.js\");\nconst processingQueue_js_1 = require(\"../utils/processingQueue.js\");\nconst CommandProcessor_js_1 = require(\"./CommandProcessor.js\");\nconst browsingContextStorage_js_1 = require(\"./domains/context/browsingContextStorage.js\");\nconst EventManager_js_1 = require(\"./domains/events/EventManager.js\");\nconst realmStorage_js_1 = require(\"./domains/script/realmStorage.js\");\nclass BidiServer extends EventEmitter_js_1.EventEmitter {\n #messageQueue;\n #transport;\n #commandProcessor;\n #browsingContextStorage = new browsingContextStorage_js_1.BrowsingContextStorage();\n #realmStorage = new realmStorage_js_1.RealmStorage();\n #logger;\n #handleIncomingMessage = (message) => {\n void this.#commandProcessor.processCommand(message).catch((error) => {\n this.#logger?.(log_js_1.LogType.system, error);\n });\n };\n #processOutgoingMessage = async (messageEntry) => {\n const message = messageEntry.message;\n if (messageEntry.channel !== null) {\n message['channel'] = messageEntry.channel;\n }\n await this.#transport.sendMessage(message);\n };\n constructor(bidiTransport, cdpConnection, selfTargetId, parser, logger) {\n super();\n this.#logger = logger;\n this.#messageQueue = new processingQueue_js_1.ProcessingQueue(this.#processOutgoingMessage, this.#logger);\n this.#transport = bidiTransport;\n this.#transport.setOnMessage(this.#handleIncomingMessage);\n this.#commandProcessor = new CommandProcessor_js_1.CommandProcessor(cdpConnection, new EventManager_js_1.EventManager(this), selfTargetId, parser, this.#browsingContextStorage, this.#realmStorage, this.#logger);\n this.#commandProcessor.on('response', (response) => {\n this.emitOutgoingMessage(response);\n });\n }\n static async createAndStart(bidiTransport, cdpConnection, selfTargetId, parser, logger) {\n const server = new BidiServer(bidiTransport, cdpConnection, selfTargetId, parser, logger);\n const cdpClient = cdpConnection.browserClient();\n // Needed to get events about new targets.\n await cdpClient.sendCommand('Target.setDiscoverTargets', { discover: true });\n // Needed to automatically attach to new targets.\n await cdpClient.sendCommand('Target.setAutoAttach', {\n autoAttach: true,\n waitForDebuggerOnStart: true,\n flatten: true,\n });\n await server.topLevelContextsLoaded();\n return server;\n }\n async topLevelContextsLoaded() {\n await Promise.all(this.#browsingContextStorage\n .getTopLevelContexts()\n .map((c) => c.awaitLoaded()));\n }\n /**\n * Sends BiDi message.\n */\n emitOutgoingMessage(messageEntry) {\n this.#messageQueue.add(messageEntry);\n }\n close() {\n this.#transport.close();\n }\n getBrowsingContextStorage() {\n return this.#browsingContextStorage;\n }\n}\nexports.BidiServer = BidiServer;\n//# sourceMappingURL=BidiServer.js.map","\"use strict\";\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.OutgoingBidiMessage = exports.EventEmitter = exports.BidiServer = void 0;\n/**\n * @fileoverview The entry point to the BiDi Mapper namespace.\n * Other modules should only access exports defined in this file.\n * XXX: Add ESlint rule for this (https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-restricted-paths.md)\n */\nvar BidiServer_js_1 = require(\"./BidiServer.js\");\nObject.defineProperty(exports, \"BidiServer\", { enumerable: true, get: function () { return BidiServer_js_1.BidiServer; } });\nvar EventEmitter_js_1 = require(\"../utils/EventEmitter.js\");\nObject.defineProperty(exports, \"EventEmitter\", { enumerable: true, get: function () { return EventEmitter_js_1.EventEmitter; } });\nvar OutgoingBidiMessage_js_1 = require(\"./OutgoingBidiMessage.js\");\nObject.defineProperty(exports, \"OutgoingBidiMessage\", { enumerable: true, get: function () { return OutgoingBidiMessage_js_1.OutgoingBidiMessage; } });\n//# sourceMappingURL=bidiMapper.js.map","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CdpClient = exports.CloseError = void 0;\nconst EventEmitter_js_1 = require(\"../utils/EventEmitter.js\");\n/** A error that will be thrown if/when the connection is closed. */\nclass CloseError extends Error {\n}\nexports.CloseError = CloseError;\n/** Represents a high-level CDP connection to the browser. */\nclass CdpClient extends EventEmitter_js_1.EventEmitter {\n #cdpConnection;\n #sessionId;\n constructor(cdpConnection, sessionId) {\n super();\n this.#cdpConnection = cdpConnection;\n this.#sessionId = sessionId;\n }\n sendCommand(method, ...params) {\n return this.#cdpConnection.sendCommand(method, params[0], this.#sessionId);\n }\n isCloseError(error) {\n return error instanceof CloseError;\n }\n}\nexports.CdpClient = CdpClient;\n//# sourceMappingURL=cdpClient.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.CdpConnection = void 0;\nconst log_js_1 = require(\"../utils/log.js\");\nconst cdpClient_js_1 = require(\"./cdpClient.js\");\n/**\n * Represents a high-level CDP connection to the browser backend.\n * Manages a CdpClient instance for each active CDP session.\n */\nclass CdpConnection {\n #transport;\n /** The CdpClient object attached to the root browser session. */\n #browserCdpClient;\n /** Map from session ID to CdpClient. */\n #sessionCdpClients = new Map();\n #commandCallbacks = new Map();\n #logger;\n #nextId = 0;\n constructor(transport, logger) {\n this.#transport = transport;\n this.#logger = logger;\n this.#transport.setOnMessage(this.#onMessage);\n this.#browserCdpClient = new cdpClient_js_1.CdpClient(this, undefined);\n }\n /** Closes the connection to the browser. */\n close() {\n this.#transport.close();\n for (const [, { reject, error }] of this.#commandCallbacks) {\n reject(error);\n }\n this.#commandCallbacks.clear();\n this.#sessionCdpClients.clear();\n }\n /** The CdpClient object attached to the root browser session. */\n browserClient() {\n return this.#browserCdpClient;\n }\n /**\n * Gets a CdpClient instance attached to the given session ID,\n * or null if the session is not attached.\n */\n getCdpClient(sessionId) {\n const cdpClient = this.#sessionCdpClients.get(sessionId);\n if (!cdpClient) {\n throw new Error('Unknown CDP session ID');\n }\n return cdpClient;\n }\n sendCommand(method, params, sessionId) {\n return new Promise((resolve, reject) => {\n const id = this.#nextId++;\n this.#commandCallbacks.set(id, {\n resolve,\n reject,\n error: new cdpClient_js_1.CloseError(`${method} ${JSON.stringify(params)} ${sessionId ?? ''} call rejected because the connection has been closed.`),\n });\n const cdpMessage = { id, method, params };\n if (sessionId) {\n cdpMessage.sessionId = sessionId;\n }\n const cdpMessageStr = JSON.stringify(cdpMessage);\n void this.#transport.sendMessage(cdpMessageStr)?.catch((error) => {\n this.#logger?.(`${log_js_1.LogType.cdp}:ERROR`, error);\n this.#transport.close();\n });\n this.#logger?.(`${log_js_1.LogType.cdp}:SEND ▸`, JSON.stringify(cdpMessage, null, 2));\n });\n }\n #onMessage = (message) => {\n const messageParsed = JSON.parse(message);\n const messagePretty = JSON.stringify(messageParsed, null, 2);\n this.#logger?.(`${log_js_1.LogType.cdp}:RECV ◂`, messagePretty);\n // Update client map if a session is attached or detached.\n // Listen for these events on every session.\n if (messageParsed.method === 'Target.attachedToTarget') {\n const { sessionId } = messageParsed.params;\n this.#sessionCdpClients.set(sessionId, new cdpClient_js_1.CdpClient(this, sessionId));\n }\n else if (messageParsed.method === 'Target.detachedFromTarget') {\n const { sessionId } = messageParsed.params;\n const client = this.#sessionCdpClients.get(sessionId);\n if (client) {\n this.#sessionCdpClients.delete(sessionId);\n }\n }\n if (messageParsed.id !== undefined) {\n // Handle command response.\n const callbacks = this.#commandCallbacks.get(messageParsed.id);\n this.#commandCallbacks.delete(messageParsed.id);\n if (callbacks) {\n if (messageParsed.result) {\n callbacks.resolve(messageParsed.result);\n }\n else if (messageParsed.error) {\n callbacks.reject(messageParsed.error);\n }\n }\n }\n else if (messageParsed.method) {\n const client = messageParsed.sessionId\n ? this.#sessionCdpClients.get(messageParsed.sessionId)\n : this.#browserCdpClient;\n client?.emit(messageParsed.method, messageParsed.params || {});\n }\n };\n}\nexports.CdpConnection = CdpConnection;\n//# sourceMappingURL=cdpConnection.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.log = exports.generatePage = void 0;\n/**\n * Copyright 2022 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst log_js_1 = require(\"../utils/log.js\");\n/** HTML source code for the user-facing Mapper tab. */\nconst mapperPageSource = '<!DOCTYPE html><title>BiDi-CDP Mapper</title><style>body{font-family: Roboto, serif; font-size: 13px; color: #202124;}.log{padding: 12px; font-family: Menlo, Consolas, Monaco, Liberation Mono, Lucida Console, monospace; font-size: 11px; line-height: 180%; background: #f1f3f4; border-radius: 4px;}.pre{overflow-wrap: break-word; padding: 10px;}.card{margin: 60px auto; padding: 2px 0; max-width: 900px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15), 0 1px 6px rgba(0, 0, 0, 0.2); border-radius: 8px;}.divider{height: 1px; background: #f0f0f0;}.item{padding: 16px 20px;}</style><div class=\"card\"><div class=\"item\"><h1>BiDi-CDP Mapper is controlling this tab</h1><p>Closing or reloading it will stop the BiDi process. <a target=\"_blank\" title=\"BiDi-CDP Mapper GitHub Repository\" href=\"https://github.com/GoogleChromeLabs/chromium-bidi\">Details.</a></p></div><div class=\"divider\"></div><details id=\"details\"><summary class=\"item\">Debug information</summary></details></div>';\n/**\n * The following piece of HTML should be added to the `debug` element:\n *\n * <div class=\"divider\"></div>\n * <div class=\"item\">\n * <h3>${name}</h3>\n * <div id=\"${name}_log\" class=\"log\">\n */\nfunction findOrCreateTypeLogContainer(logType) {\n const containerId = `${logType}_log`;\n const existingContainer = document.getElementById(containerId);\n if (existingContainer) {\n return existingContainer;\n }\n const debugElement = document.getElementById('details');\n const divider = document.createElement('div');\n divider.className = 'divider';\n debugElement.appendChild(divider);\n const htmlItem = document.createElement('div');\n htmlItem.className = 'item';\n htmlItem.innerHTML = `<h3>${logType}</h3><div id=\"${containerId}\" class=\"log\"></div>`;\n debugElement.appendChild(htmlItem);\n return document.getElementById(containerId);\n}\nfunction generatePage() {\n // If run not in browser (e.g. unit test), do nothing.\n if (!globalThis.document.documentElement) {\n return;\n }\n globalThis.document.documentElement.innerHTML = mapperPageSource;\n // Create main log containers in proper order.\n findOrCreateTypeLogContainer(log_js_1.LogType.system);\n findOrCreateTypeLogContainer(log_js_1.LogType.bidi);\n findOrCreateTypeLogContainer(log_js_1.LogType.browsingContexts);\n findOrCreateTypeLogContainer(log_js_1.LogType.cdp);\n}\nexports.generatePage = generatePage;\nfunction log(logType, ...messages) {\n // If run not in browser (e.g. unit test), do nothing.\n if (!globalThis.document.documentElement) {\n return;\n }\n // If `sendDebugMessage` is defined, send the log message there.\n global.window?.sendDebugMessage?.(JSON.stringify({ logType, messages }));\n const typeLogContainer = findOrCreateTypeLogContainer(logType);\n // This piece of HTML should be added:\n // <div class=\"pre\">...log message...</div>\n const lineElement = document.createElement('div');\n lineElement.className = 'pre';\n lineElement.textContent = messages.join(' ');\n typeLogContainer.appendChild(lineElement);\n}\nexports.log = log;\n//# sourceMappingURL=mapperTabPage.js.map","\"use strict\";\n/**\n * Copyright 2021 Google LLC.\n * Copyright (c) Microsoft Corporation.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n * @license\n */\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst Parser = __importStar(require(\"../protocol-parser/protocol-parser.js\"));\nconst protocol_1 = require(\"../protocol/protocol\");\nconst bidiMapper_js_1 = require(\"../bidiMapper/bidiMapper.js\");\nconst cdpConnection_js_1 = require(\"../cdp/cdpConnection.js\");\nconst log_js_1 = require(\"../utils/log.js\");\nconst mapperTabPage_js_1 = require(\"./mapperTabPage.js\");\n// Initiate `setSelfTargetId` as soon as possible to prevent race condition.\nconst waitSelfTargetIdPromise = waitSelfTargetId();\nvoid (async () => {\n (0, mapperTabPage_js_1.generatePage)();\n // Needed to filter out info related to BiDi target.\n const selfTargetId = await waitSelfTargetIdPromise;\n const bidiServer = await createBidiServer(selfTargetId);\n (0, mapperTabPage_js_1.log)(log_js_1.LogType.system, 'Launched');\n bidiServer.emitOutgoingMessage(bidiMapper_js_1.OutgoingBidiMessage.createResolved({ launched: true }, null));\n})();\nfunction createCdpConnection() {\n /**\n * A CdpTransport implementation that uses the window.cdp bindings\n * injected by Target.exposeDevToolsProtocol.\n */\n class WindowCdpTransport {\n #onMessage = null;\n constructor() {\n window.cdp.onmessage = (message) => {\n this.#onMessage?.call(null, message);\n };\n }\n setOnMessage(onMessage) {\n this.#onMessage = onMessage;\n }\n sendMessage(message) {\n window.cdp.send(message);\n }\n close() {\n this.#onMessage = null;\n window.cdp.onmessage = null;\n }\n }\n return new cdpConnection_js_1.CdpConnection(new WindowCdpTransport(), mapperTabPage_js_1.log);\n}\nfunction createBidiServer(selfTargetId) {\n class WindowBidiTransport {\n #onMessage = null;\n constructor() {\n window.onBidiMessage = (messageStr) => {\n (0, mapperTabPage_js_1.log)(`${log_js_1.LogType.bidi}:RECV ◂`, messageStr);\n let messageObject;\n try {\n messageObject = WindowBidiTransport.#parseBidiMessage(messageStr);\n }\n catch (e) {\n // Transport-level error does not provide channel.\n this.#respondWithError(messageStr, protocol_1.Message.ErrorCode.InvalidArgument, e.message, null);\n return;\n }\n this.#onMessage?.call(null, messageObject);\n };\n }\n setOnMessage(onMessage) {\n this.#onMessage = onMessage;\n }\n sendMessage(message) {\n const messageStr = JSON.stringify(message);\n window.sendBidiResponse(messageStr);\n (0, mapperTabPage_js_1.log)(`${log_js_1.LogType.bidi}:SEND ▸`, messageStr);\n }\n close() {\n this.#onMessage = null;\n window.onBidiMessage = null;\n }\n #respondWithError(plainCommandData, errorCode, errorMessage, channel) {\n const errorResponse = WindowBidiTransport.#getErrorResponse(plainCommandData, errorCode, errorMessage);\n if (channel) {\n // XXX: get rid of any, same code existed in BidiServer.\n this.sendMessage({\n ...errorResponse,\n channel,\n });\n }\n else {\n this.sendMessage(errorResponse);\n }\n }\n static #getJsonType(value) {\n if (value === null) {\n return 'null';\n }\n if (Array.isArray(value)) {\n return 'array';\n }\n return typeof value;\n }\n static #getErrorResponse(messageStr, errorCode, errorMessage) {\n // XXX: this is bizarre per spec. We reparse the payload and\n // extract the ID, regardless of what kind of value it was.\n let messageId;\n try {\n const messageObj = JSON.parse(messageStr);\n if (WindowBidiTransport.#getJsonType(messageObj) === 'object' &&\n 'id' in messageObj) {\n messageId = messageObj.id;\n }\n }\n catch { }\n return {\n id: messageId,\n error: errorCode,\n message: errorMessage,\n // XXX: optional stacktrace field.\n };\n }\n static #parseBidiMessage(messageStr) {\n let messageObject;\n try {\n messageObject = JSON.parse(messageStr);\n }\n catch {\n throw new Error('Cannot parse data as JSON');\n }\n const parsedType = WindowBidiTransport.#getJsonType(messageObject);\n if (parsedType !== 'object') {\n throw new Error(`Expected JSON object but got ${parsedType}`);\n }\n // Extract and validate id, method and params.\n const { id, method, params } = messageObject;\n const idType = WindowBidiTransport.#getJsonType(id);\n if (idType !== 'number' || !Number.isInteger(id) || id < 0) {\n // TODO: should uint64_t be the upper limit?\n // https://tools.ietf.org/html/rfc7049#section-2.1\n throw new Error(`Expected unsigned integer but got ${idType}`);\n }\n const methodType = WindowBidiTransport.#getJsonType(method);\n if (methodType !== 'string') {\n throw new Error(`Expected string method but got ${methodType}`);\n }\n const paramsType = WindowBidiTransport.#getJsonType(params);\n if (paramsType !== 'object') {\n throw new Error(`Expected object params but got ${paramsType}`);\n }\n let channel = messageObject.channel;\n if (channel !== undefined) {\n const channelType = WindowBidiTransport.#getJsonType(channel);\n if (channelType !== 'string') {\n throw new Error(`Expected string channel but got ${channelType}`);\n }\n // Empty string channel is considered as no channel provided.\n if (channel === '') {\n channel = undefined;\n }\n }\n return { id, method, params, channel };\n }\n }\n return bidiMapper_js_1.BidiServer.createAndStart(new WindowBidiTransport(), createCdpConnection(), selfTargetId, new BidiParserImpl(), mapperTabPage_js_1.log);\n}\nclass BidiParserImpl {\n parseAddPreloadScriptParams(params) {\n return Parser.Script.parseAddPreloadScriptParams(params);\n }\n parseRemovePreloadScriptParams(params) {\n return Parser.Script.parseRemovePreloadScriptParams(params);\n }\n parseGetRealmsParams(params) {\n return Parser.Script.parseGetRealmsParams(params);\n }\n parseCallFunctionParams(params) {\n return Parser.Script.parseCallFunctionParams(params);\n }\n parseEvaluateParams(params) {\n return Parser.Script.parseEvaluateParams(params);\n }\n parseDisownParams(params) {\n return Parser.Script.parseDisownParams(params);\n }\n parseSendCommandParams(params) {\n return Parser.Cdp.parseSendCommandParams(params);\n }\n parseGetSessionParams(params) {\n return Parser.Cdp.parseGetSessionParams(params);\n }\n parseSubscribeParams(params) {\n return Parser.Session.parseSubscribeParams(params);\n }\n parseNavigateParams(params) {\n return Parser.BrowsingContext.parseNavigateParams(params);\n }\n parseReloadParams(params) {\n return Parser.BrowsingContext.parseReloadParams(params);\n }\n parseGetTreeParams(params) {\n return Parser.BrowsingContext.parseGetTreeParams(params);\n }\n parseCreateParams(params) {\n return Parser.BrowsingContext.parseCreateParams(params);\n }\n parseCloseParams(params) {\n return Parser.BrowsingContext.parseCloseParams(params);\n }\n parseCaptureScreenshotParams(params) {\n return Parser.BrowsingContext.parseCaptureScreenshotParams(params);\n }\n parsePrintParams(params) {\n return Parser.BrowsingContext.parsePrintParams(params);\n }\n parsePerformActionsParams(params) {\n return Parser.Input.parsePerformActionsParams(params);\n }\n parseReleaseActionsParams(params) {\n return Parser.Input.parseReleaseActionsParams(params);\n }\n parseSetViewportParams(params) {\n return Parser.BrowsingContext.parseSetViewportParams(params);\n }\n}\n// Needed to filter out info related to BiDi target.\nasync function waitSelfTargetId() {\n return new Promise((resolve) => {\n window.setSelfTargetId = (targetId) => {\n (0, mapperTabPage_js_1.log)(log_js_1.LogType.system, 'Current target ID:', targetId);\n resolve(targetId);\n };\n });\n}\n//# sourceMappingURL=bidiTab.js.map"],"names":["util","Object","defineProperty","exports","value","getParsedType","ZodParsedType","objectUtil","assertEqual","val","assertIs","_arg","assertNever","_x","Error","arrayToEnum","items","obj","item","getValidEnumValues","validKeys","objectKeys","filter","k","filtered","objectValues","map","e","keys","object","key","prototype","hasOwnProperty","call","push","find","arr","checker","isInteger","Number","isFinite","Math","floor","joinValues","array","separator","join","jsonStringifyReplacer","_","toString","mergeShapes","first","second","data","undefined","string","isNaN","nan","number","boolean","function","bigint","symbol","Array","isArray","null","then","catch","promise","Map","Set","set","Date","date","unknown","ZodError_1","ZodError","quotelessJson","util_1","require$$0","ZodError$1","ZodIssueCode","JSON","stringify","replace","constructor","issues","super","this","addIssue","sub","addIssues","subs","actualProto","setPrototypeOf","__proto__","name","errors","format","_mapper","mapper","issue","message","fieldErrors","_errors","processError","error","code","unionErrors","returnTypeError","argumentsError","path","length","curr","i","el","isEmpty","flatten","formErrors","create","en","require$$1","default","_ctx","invalid_type","received","expected","invalid_literal","unrecognized_keys","invalid_union","invalid_union_discriminator","options","invalid_enum_value","invalid_arguments","invalid_return_type","invalid_date","invalid_string","validation","includes","position","startsWith","endsWith","too_small","type","exact","inclusive","minimum","too_big","maximum","custom","invalid_intersection_types","not_multiple_of","multipleOf","not_finite","defaultError","__importDefault","mod","__esModule","getErrorMap","setErrorMap","en_1","defaultErrorMap","overrideErrorMap","isAsync","isValid","isDirty","isAborted","OK","DIRTY","INVALID","ParseStatus","addIssueToContext","EMPTY_PATH","makeIssue","errors_1","params","errorMaps","issueData","fullPath","fullIssue","errorMessage","maps","m","slice","reverse","ctx","common","contextualErrorMap","schemaErrorMap","x","dirty","abort","static","status","results","arrayValue","s","pairs","syncPairs","pair","mergeObjectSync","finalObject","alwaysSet","freeze","Promise","typeAliases","errorUtil","errToObj","discriminatedUnion","coerce","ZodFirstPartyTypeKind","late","ZodSchema","Schema","ZodBranded","BRAND","ZodNaN","ZodCatch","ZodDefault","ZodNullable","ZodTransformer","ZodEffects","ZodPromise","ZodNativeEnum","ZodEnum","ZodLiteral","ZodFunction","ZodSet","ZodMap","ZodRecord","ZodTuple","ZodIntersection","ZodUnion","ZodObject","ZodArray","ZodVoid","ZodNever","ZodUnknown","ZodNull","ZodUndefined","ZodSymbol","ZodDate","ZodBoolean","ZodBigInt","ZodString","ZodType","NEVER","void","union","transformer","strictObject","record","preprocess","pipeline","optional","onumber","oboolean","nullable","never","nativeEnum","literal","lazy","intersection","enum","effect","errorUtil_1","parseUtil_1","require$$2","require$$3","require$$4","ParseInputLazyPath","parent","_cachedPath","_path","_key","handleResult","result","success","_error","processCreateParams","errorMap","invalid_type_error","required_error","description","iss","def","spa","safeParseAsync","_def","parse","bind","safeParse","parseAsync","refine","refinement","superRefine","nullish","or","and","transform","brand","describe","pipe","isNullable","isOptional","_getType","input","_getOrReturnCtx","parsedType","_processInputParams","_parseSync","_parse","_parseAsync","resolve","_a","async","maybeAsyncResult","check","getIssueProperties","_refinement","setError","refinementData","schema","typeName","ZodOptional","option","incoming","defaultValueFunc","innerType","defaultValue","catchValueFunc","catchValue","This","target","ZodPipeline","cuidRegex","cuid2Regex","ulidRegex","uuidRegex","emailRegex","emojiRegex","ipv4Regex","ipv6Regex","arguments","_regex","regex","test","nonempty","min","trim","checks","kind","toLowerCase","toUpperCase","String","tooBig","tooSmall","URL","lastIndex","args","precision","offset","RegExp","ip","version","_addCheck","email","url","emoji","uuid","cuid","cuid2","ulid","datetime","minLength","max","maxLength","len","isDatetime","ch","isEmail","isURL","isEmoji","isUUID","isCUID","isCUID2","isULID","isIP","floatSafeRemainder","step","valDecCount","split","stepDecCount","decCount","parseInt","toFixed","pow","ZodNumber","gte","lte","setLimit","gt","lt","int","positive","negative","nonpositive","nonnegative","finite","safe","MIN_SAFE_INTEGER","MAX_SAFE_INTEGER","minValue","maxValue","isInt","BigInt","Boolean","getTime","minDate","maxDate","ZodAny","_any","_unknown","exactLength","all","mergeArray","element","deepPartialify","newShape","shape","fieldSchema","unwrap","_cached","nonstrict","passthrough","augment","extend","_getCached","shapeKeys","extraKeys","catchall","unknownKeys","keyValidator","strict","_b","_c","_d","strip","augmentation","merge","merging","setKey","index","pick","mask","forEach","omit","deepPartial","partial","required","newField","keyof","createZodEnum","strictCreate","lazycreate","childCtx","types","getDiscriminator","ZodLazy","ZodDiscriminatedUnion","discriminator","discriminatorValue","optionsMap","get","from","discriminatorValues","has","mergeValues","a","b","aType","bType","valid","bKeys","sharedKeys","indexOf","newObj","sharedValue","newArray","handleParsed","parsedLeft","parsedRight","merged","left","right","rest","itemIndex","schemas","keySchema","keyType","valueSchema","valueType","mergeObjectAsync","third","entries","finalMap","minSize","size","maxSize","finalizeSet","elements","parsedSet","add","values","validate","implement","makeArgsIssue","makeReturnsIssue","returns","fn","parsedArgs","parsedReturns","parameters","returnType","func","strictImplement","getter","expectedValues","enumValues","Values","Enum","extract","exclude","opt","nativeEnumValues","promisified","sourceType","processed","checkCtx","arg","fatal","executeRefinement","acc","inner","base","createWithPreprocess","removeDefault","newCtx","removeCatch","Symbol","inResult","in","out","handleAsync","p","_fatal","p2","instanceof","cls","stringType","numberType","nanType","bigIntType","booleanType","dateType","symbolType","undefinedType","nullType","anyType","any","unknownType","neverType","voidType","arrayType","objectType","strictObjectType","unionType","discriminatedUnionType","intersectionType","tupleType","tuple","recordType","mapType","setType","functionType","lazyType","literalType","enumType","nativeEnumType","promiseType","effectsType","optionalType","nullableType","preprocessType","pipelineType","ostring","__createBinding","o","k2","enumerable","__exportStar","require$$5","__setModuleDefault","v","__importStar","z","Script","EventNames","BrowsingContext","Log","Network","Input","SourceActionsType","PointerType","ActionType","Message","ErrorCode","ErrorResponse","stacktrace","toErrorResponse","commandId","id","InvalidArgumentException","InvalidArgument","MoveTargetOutOfBoundsException","MoveTargetOutOfBounds","NoSuchHandleException","NoSuchHandle","InvalidSessionIdException","InvalidSessionId","NoSuchAlertException","NoSuchAlert","NoSuchFrameException","NoSuchFrame","NoSuchNodeException","NoSuchNode","NoSuchElementException","NoSuchElement","NoSuchScriptException","NoSuchScript","SessionNotCreatedException","SessionNotCreated","UnknownCommandException","UnknownCommand","UnknownErrorException","UnknownError","UnsupportedOperationException","UnsupportedOperation","AllEvents","Session","parseObject","zod_1","protocol_js_1","MAX_INT","parseResult","UnicodeCharacterSchema","CommonDataTypes","SharedReferenceSchema","sharedId","handle","RemoteReferenceSchema","UndefinedValueSchema","NullValueSchema","StringValueSchema","SpecialNumberSchema","NumberValueSchema","BooleanValueSchema","BigIntValueSchema","PrimitiveProtocolValueSchema","LocalValueSchema","ArrayLocalValueSchema","DateLocalValueSchema","MapLocalValueSchema","ObjectLocalValueSchema","RegExpLocalValueSchema","SetLocalValueSchema","LocalOrRemoteValueSchema","ListLocalValueSchema","MappingLocalValueSchema","pattern","flags","BrowsingContextSchema","MaxDepthSchema","RealmTypeSchema","GetRealmsParametersSchema","context","parseGetRealmsParams","ContextTargetSchema","sandbox","RealmTargetSchema","realm","TargetSchema","ResultOwnershipSchema","SerializationOptionsSchema","maxDomDepth","maxObjectDepth","includeShadowTree","EvaluateParametersSchema","expression","awaitPromise","resultOwnership","serializationOptions","parseEvaluateParams","DisownParametersSchema","handles","parseDisownParams","ChannelSchema","ChannelPropertiesSchema","channel","ownership","ChannelValueSchema","PreloadScriptSchema","AddPreloadScriptParametersSchema","functionDeclaration","parseAddPreloadScriptParams","RemovePreloadScriptParametersSchema","script","parseRemovePreloadScriptParams","ArgumentValueSchema","CallFunctionParametersSchema","parseCallFunctionParams","GetTreeParametersSchema","maxDepth","root","parseGetTreeParams","ReadinessStateSchema","NavigateParametersSchema","wait","parseNavigateParams","ReloadParametersSchema","ignoreCache","parseReloadParams","CreateParametersSchema","referenceContext","parseCreateParams","CloseParametersSchema","parseCloseParams","CaptureScreenshotParametersSchema","parseCaptureScreenshotParams","PrintPageParametersSchema","height","width","PrintMarginParametersSchema","bottom","top","PrintPageRangesSchema","pageRanges","every","pageRange","match","start","end","groups","PrintParametersSchema","background","margin","orientation","page","scale","shrinkToFit","parsePrintParams","ViewportSchema","SetViewportActionSchema","viewport","parseSetViewportParams","Cdp","SendCommandParamsSchema","method","session","parseSendCommandParams","GetSessionParamsSchema","parseGetSessionParams","BiDiSubscriptionRequestParametersEventsSchema","CdpSubscriptionRequestParametersEventsSchema","SubscriptionRequestParametersEventsSchema","SubscriptionRequestParametersSchema","events","contexts","parseSubscribeParams","ElementOriginSchema","OriginSchema","PauseActionSchema","Pause","duration","KeyDownActionSchema","KeyDown","KeyUpActionSchema","KeyUp","TiltPropertiesSchema","tiltX","tiltY","AnglePropertiesSchema","altitudeAngle","PI","azimuthAngle","PointerCommonPropertiesSchema","pressure","tangentialPressure","twist","PointerUpActionSchema","PointerUp","button","PointerDownActionSchema","PointerDown","PointerMoveActionSchema","PointerMove","y","origin","WheelScrollActionSchema","Scroll","deltaX","deltaY","WheelSourceActionSchema","WheelSourceActionsSchema","Wheel","actions","PointerSourceActionSchema","PointerTypeSchema","PointerParametersSchema","pointerType","Mouse","PointerSourceActionsSchema","Pointer","KeySourceActionSchema","KeySourceActionsSchema","Key","NoneSourceActionSchema","NoneSourceActionsSchema","None","SourceActionsSchema","PerformActionsParametersSchema","parsePerformActionsParams","ReleaseActionsParametersSchema","parseReleaseActionsParams","EventEmitter_1","EventEmitter","mitt_1","n","on","t","off","splice","emit","EventEmitter$1","emitter","handler","once","event","onceHandler","eventData","LogType","processingQueue","ProcessingQueue","log_js_1","logger","processor","queue","isProcessing","entry","processIfNeeded","entryPromise","shift","system","assert_1","assert","assert$1","predicate","Mutex_1","Mutex","Mutex$1","locked","acquirers","acquire","state","resolved","release","action","WheelSource","KeySource","NoneSource","SourceType","pressed","modifiers","alt","setModifier","ctrl","meta","bit","PointerSource","subtype","pointerId","buttons","clickCount","lastClick","setClickCount","timeStamp","DOUBLE_CLICK_TIME_MS","abs","MAX_DOUBLE_CLICK_RADIUS","InputState_1","InputState","Mutex_js_1","InputSource_js_1","InputState$1","cancelList","sources","mutex","getOrCreate","source","pointerIds","getGlobalKeyState","InputStateManager_1","InputStateManager","assert_js_1","InputState_js_1","InputStateManager$1","states","WeakMap","isTopLevelContext","delete","USKeyboardLayout","KeyToKeyCode","Abort","Help","Backspace","Tab","Numpad5","NumpadEnter","Enter","ShiftLeft","ShiftRight","ControlLeft","ControlRight","AltLeft","AltRight","CapsLock","Escape","Convert","NonConvert","Space","Numpad9","PageUp","Numpad3","PageDown","End","Numpad1","Home","Numpad7","ArrowLeft","Numpad4","Numpad8","ArrowUp","ArrowRight","Numpad6","Numpad2","ArrowDown","Select","Open","PrintScreen","Insert","Numpad0","Delete","NumpadDecimal","Digit0","Digit1","Digit2","Digit3","Digit4","Digit5","Digit6","Digit7","Digit8","Digit9","KeyA","KeyB","KeyC","KeyD","KeyE","KeyF","KeyG","KeyH","KeyI","KeyJ","KeyK","KeyL","KeyM","KeyN","KeyO","KeyP","KeyQ","KeyR","KeyS","KeyT","KeyU","KeyV","KeyW","KeyX","KeyY","KeyZ","MetaLeft","MetaRight","ContextMenu","NumpadMultiply","NumpadAdd","NumpadSubtract","NumpadDivide","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","NumLock","ScrollLock","AudioVolumeMute","AudioVolumeDown","AudioVolumeUp","MediaTrackNext","MediaTrackPrevious","MediaStop","MediaPlayPause","Semicolon","Equal","NumpadEqual","Comma","Minus","Period","Slash","Backquote","BracketLeft","Backslash","BracketRight","Quote","AltGraph","Props","Cancel","Clear","Shift","Control","Alt","Accept","ModeChange","Print","Execute","c","d","f","g","h","j","l","q","r","u","w","Meta","Attn","CrSel","ExSel","EraseEof","Play","ZoomOut","$","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","Camera","EndCall","VolumeDown","VolumeUp","keyUtils","getKeyLocation","getKeyCode","getNormalizedKey","ActionDispatcher_1","ActionDispatcher","USKeyboardLayout_js_1","keyUtils_js_1","CALCULATE_IN_VIEW_CENTER_PT_DECL","getClientRects","window","innerWidth","innerHeight","IS_MAC_DECL","navigator","platform","getOrCreateSandbox","callFunction","tickStart","tickDuration","inputState","isMacOS","optionsByTick","run","dispatchTickActions","performance","now","promises","setTimeout","dispatchAction","keyState","dispatchKeyDownAction","dispatchKeyUpAction","dispatchPointerDownAction","dispatchPointerMoveAction","dispatchPointerUpAction","dispatchScrollAction","Pen","cdpTarget","cdpClient","sendCommand","force","Touch","touchPoints","radiusX","radiusY","startX","startY","offsetX","offsetY","targetX","targetY","getCoordinateFromOrigin","last","ratio","round","posX","posY","getElementCenter","_source","targetDeltaX","targetDeltaY","currentDeltaX","currentDeltaY","rawKey","repeat","location","unmodifiedText","getKeyEventUnmodifiedText","text","getKeyEventText","command","windowsVirtualKeyCode","autoRepeat","isSystemKey","isKeypad","commands","toLocaleUpperCase","PreloadScriptStorage_1","PreloadScriptStorage","PreloadScriptStorage$1","scripts","findPreloadScripts","contextId","contextIds","targetId","targetIds","addPreloadScript","preloadScript","removeBiDiPreloadScripts","unitConversions","inchesFromCm","cm","deferred","Deferred","isFinished","reject","onFulfilled","onRejected","reason","finally","onFinally","toStringTag","uuidv4","globalThis","crypto","randomUUID","randomValues","Uint8Array","getRandomValues","require","webcrypto","bytesToHex","bytes","reduce","str","byte","padStart","subarray","channelProxy","ChannelProxy","uuid_1","properties","eventManager","channelHandle","createAndGetHandleInRealm","sendMessageHandle","createSendMessageHandle","startListener","getHandleFromWindow","queueNonEmptyResolver","onMessage","sendMessage","createChannelHandleResult","createChannelProxyEvalStr","executionContextId","serialization","exceptionDetails","objectId","getMessage","registerEvent","MessageEvent","cdpToBidiValue","realmId","browsingContextId","channelHandleResult","getEvalInWindowStr","delegate","channelProxyEval","ScriptEvaluator","SHARED_ID_DIVIDER","channelProxy_js_1","cdpObject","returnByValue","cdpRemoteObject","cdpRemoteObjectToCallArgument","cdpWebDriverValue","cdpEvaluateResult","serializeCdpExceptionDetails","_this","_arguments","callFunctionAndSerializeScript","thisAndArgumentsList","deserializeToCdpArg","cdpCallFunctionResult","unserializableValue","argumentValue","navigableId","rawBackendNodeId","backendNodeId","keyValueArray","flattenKeyValuePairs","flattenValueList","init","mapping","keyArg","valueArg","list","cdpExceptionDetails","lineOffset","callFrames","stackTrace","frame","functionName","lineNumber","columnNumber","exception","serializeCdpObject","stringifyObject","Realm","scriptEvaluator_js_1","realmStorage","browsingContextStorage","scriptEvaluator","cdpSessionId","addRealm","RealmCreated","toBiDi","knownHandlesToRealm","releaseObject","cdpValue","deepSerializedValue","bidiValue","deepSerializedToBiDi","webDriverValue","hasOwn","internalId","weakLocalObjectReference","children","findContext","getContext","awaitUnblocked","scriptEvaluate","RealmDestroyed","browsingContextImpl","BrowsingContextImpl","unitConversions_js_1","deferred_js_1","realm_js_1","parentId","deferreds","documentInitialized","Page","navigatedWithinDocument","lifecycleEvent","DOMContentLoaded","load","loaderId","maybeDefaultRealm","isNavigating","initListeners","addContext","addChild","ContextCreatedEvent","serializeToBidiValue","deleteAllChildren","deleteRealms","ContextDestroyedEvent","deleteContextById","directChildren","allChildren","concat","child","topContext","childId","defaultRealm","updateCdpTarget","targetUnblocked","maybeSandboxes","findRealms","frameId","worldName","addParentField","onTargetInfoChanged","targetInfo","NavigationStarted","navigation","timestamp","getTimestamp","urlFragment","FragmentNavigated","documentChanged","DomContentLoadedEvent","LoadEvent","auxData","uniqueId","getOrigin","isDefault","getChannels","startListenerFromWindow","resetDeferredsIfFinished","browsingContexts","cdpNavigateResult","errorText","awaitLoaded","deviceScaleFactor","mobile","dontSetVisibleSize","err","clip","cssContentSize","cssLayoutViewport","clientWidth","clientHeight","iframeDocRect","docRect","document","documentElement","getBoundingClientRect","cdpParams","printBackground","marginBottom","marginLeft","marginRight","marginTop","landscape","paperHeight","paperWidth","preferCSSPageSize","logHelper","getRemoteValuesText","logMessageFormatter","specifiers","isFormmatSpecifier","some","spec","output","argFormat","argValues","tokens","token","stringFromArg","parseFloat","toJson","formatText","logManager","LogManager","logHelper_js_1","getBidiStackTrace","cdpStackTrace","stackFrames","callFrame","initialize","initializeLogEntryAddedEventListener","findRealm","argsPromise","registerPromiseEvent","LogEntryAddedEvent","level","consoleApiType","textPromise","DefaultMap_1","DefaultMap","getDefaultValue","DefaultMap$1","networkRequest","NetworkRequest","requestId","servedFromCache","redirectCount","requestWillBeSentEvent","requestWillBeSentExtraInfoEvent","responseReceivedEvent","responseReceivedExtraInfoEvent","beforeRequestSentDeferred","responseReceivedDeferred","onRequestWillBeSentEvent","sendBeforeRequestEvent","onRequestWillBeSentExtraInfoEvent","onResponseReceivedEventExtraInfo","onResponseReceivedEvent","hasExtraInfo","sendResponseReceivedEvent","onServedFromCache","onLoadingFailedEvent","FetchErrorEvent","getBaseEventParams","getNavigationId","request","getRequestData","wallTime","cookies","getCookies","associatedCookies","headers","getHeaders","headersSize","bodySize","timings","timeOrigin","requestTime","redirectStart","redirectEnd","fetchStart","dnsStart","dnsEnd","connectStart","connectEnd","tlsStart","requestStart","responseStart","responseEnd","isIgnoredEvent","getBeforeRequestEvent","BeforeRequestSentEvent","initiator","getInitiatorType","getResponseReceivedEvent","ResponseCompletedEvent","response","fromDiskCache","protocol","statusCode","statusText","fromCache","fromPrefetchCache","mimeType","bytesReceived","encodedDataLength","computeResponseHeadersSize","content","total","header","initiatorType","cookieInfo","cookie","domain","expires","httpOnly","secure","sameSite","getCookiesSameSite","cdpSameSiteValue","networkProcessor","NetworkProcessor","DefaultMap_js_1","networkRequest_js_1","requestMap","getOrCreateNetworkRequest","CdpTarget","logManager_js_1","networkProcessor_js_1","parentTargetId","preloadScriptStorage","networkDomainActivated","setEventListeners","unblock","isNetworkDomainEnabled","enableNetworkDomain","enabled","autoAttach","waitForDebuggerOnStart","initAndEvaluatePreloadScripts","isCloseError","flatMap","channels","initInTarget","scheduleEvaluateInTarget","bidiPreloadScript","BidiPreloadScript","uuid_js_1","cdpPreloadScripts","cdpTargets","getEvaluateString","channelsArgStr","addCdpPreloadScriptResult","preloadScriptId","identifier","cdpPreloadScript","cdpPreloadScriptId","cdpTargetIsGone","cdpTargetId","browsingContextProcessor","BrowsingContextProcessor","InputStateManager_js_1","ActionDispatcher_js_1","PreloadScriptStorage_js_1","browsingContextImpl_js_1","cdpTarget_js_1","require$$6","bidiPreloadScript_1","require$$7","cdpConnection","selfTargetId","inputStateManager","browserClient","handleAttachedToTargetEvent","handleDetachedFromTargetEvent","handleTargetInfoChangedEvent","handleFrameAttachedEvent","handleFrameDetachedEvent","parentBrowsingContext","parentFrameId","parentSessionCdpClient","sessionId","targetCdpClient","getCdpClient","isValidTarget","maybeContext","getRealm","process_browsingContext_getTree","getTopLevelContexts","MAX_VALUE","browserCdpClient","newWindow","process_browsingContext_navigate","navigate","process_browsingContext_reload","reload","captureScreenshot","print","initInTargets","bidiId","remove","process_script_getRealms","realms","disown","actionsByTick","getActionsByTick","dispatcher","dispatchActions","setViewport","commandParams","detachedFromTargetPromise","onContextDestroyed","eventParams","client","process_cdp_getSession","OutgoingBidiMessage_1","OutgoingBidiMessage","messagePromise","OutgoingBidiMessage$1","CommandProcessor_1","CommandProcessor","EventEmitter_js_1","browsingContextProcessor_js_1","OutgoingBidiMessage_js_1","BidiNoOpParser","contextProcessor","parser","ready","subscribe","unsubscribe","commandData","process_session_status","process_session_subscribe","process_session_unsubscribe","process_browsingContext_create","process_browsingContext_close","process_browsingContext_captureScreenshot","process_browsingContext_print","process_browsingContext_setViewport","process_script_addPreloadScript","process_script_removePreloadScript","process_script_callFunction","process_script_evaluate","process_script_disown","process_input_performActions","process_input_releaseActions","process_cdp_sendCommand","processCommand","createResolved","errorResponse","bidi","CommandProcessor$1","BrowsingContextStorage","getAllContexts","deleteContext","hasContext","findTopLevelContextId","buffer","Buffer","capacity","onItemRemoved","idWrapper","IdWrapper","counter","SubscriptionManager_1","SubscriptionManager","unrollEvents","cartesianProduct","flat","allEvents","addEvents","SubscriptionManager$1","subscriptionPriority","channelToContextToEventMap","getChannelsSubscribedToEvent","eventMethod","priority","getEventSubscriptionPriorityForChannel","sort","contextToEventMap","maybeTopLevelContextId","priorities","specificEvent","eventMap","unsubscribeAll","checkUnsubscribe","eventName","EventManager_1","EventManager","buffer_js_1","idWrapper_js_1","SubscriptionManager_js_1","EventWrapper","eventBufferLength","eventToContextsMap","eventBuffers","lastMessageSent","subscriptionManager","bidiServer","getBrowsingContextStorage","browsingContext","eventWrapper","sortedChannels","bufferEvent","emitOutgoingMessage","createFromPromise","markEventSent","eventNames","handleDomains","getBufferedEvents","NETWORK_DOMAIN_PREFIX","bufferMapKey","getMapKey","lastSentMapKey","lastSentMessageId","Infinity","wrapper","_contextId","e1","e2","EventManager$1","RealmStorage","realmMap","maybeRealms","maybeRealm","BidiServer_1","BidiServer","processingQueue_js_1","CommandProcessor_js_1","browsingContextStorage_js_1","EventManager_js_1","realmStorage_js_1","messageQueue","transport","commandProcessor","handleIncomingMessage","processOutgoingMessage","messageEntry","bidiTransport","setOnMessage","server","discover","topLevelContextsLoaded","close","BidiServer$1","BidiServer_js_1","CdpClient","CloseError","CdpConnection","cdpClient_js_1","sessionCdpClients","commandCallbacks","nextId","clear","cdpMessage","cdpMessageStr","cdp","messageParsed","messagePretty","callbacks","mapperTabPage","log","generatePage","findOrCreateTypeLogContainer","logType","containerId","existingContainer","getElementById","debugElement","divider","createElement","className","appendChild","htmlItem","innerHTML","messages","global","sendDebugMessage","typeLogContainer","lineElement","textContent","desc","getOwnPropertyDescriptor","writable","configurable","bidiTab","Parser","protocol_1","bidiMapper_js_1","cdpConnection_js_1","mapperTabPage_js_1","waitSelfTargetIdPromise","setSelfTargetId","waitSelfTargetId","WindowBidiTransport","onBidiMessage","messageStr","messageObject","parseBidiMessage","respondWithError","sendBidiResponse","plainCommandData","errorCode","getErrorResponse","messageId","messageObj","getJsonType","idType","methodType","paramsType","channelType","createAndStart","WindowCdpTransport","onmessage","send","createCdpConnection","BidiParserImpl","createBidiServer","launched"],"mappings":"2OAGA,IAAIA,EAFJC,OAAOC,eAAcC,EAAU,aAAc,CAAEC,OAAO,IACtDD,EAAAE,cAAwBF,EAAwBG,cAAAH,EAAAI,WAAqBJ,EAAeH,UAAA,EAEpF,SAAWA,GACPA,EAAKQ,YAAeC,GAAQA,EAE5BT,EAAKU,SADL,SAAkBC,GAAS,EAK3BX,EAAKY,YAHL,SAAqBC,GACjB,MAAM,IAAIC,KACb,EAEDd,EAAKe,YAAeC,IAChB,MAAMC,EAAM,CAAA,EACZ,IAAK,MAAMC,KAAQF,EACfC,EAAIC,GAAQA,EAEhB,OAAOD,CAAG,EAEdjB,EAAKmB,mBAAsBF,IACvB,MAAMG,EAAYpB,EAAKqB,WAAWJ,GAAKK,QAAQC,GAA6B,iBAAhBN,EAAIA,EAAIM,MAC9DC,EAAW,CAAA,EACjB,IAAK,MAAMD,KAAKH,EACZI,EAASD,GAAKN,EAAIM,GAEtB,OAAOvB,EAAKyB,aAAaD,EAAS,EAEtCxB,EAAKyB,aAAgBR,GACVjB,EAAKqB,WAAWJ,GAAKS,KAAI,SAAUC,GACtC,OAAOV,EAAIU,EACvB,IAEI3B,EAAK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ACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,IACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,MACX,IAAK,SAUL,IAAK,SACD,MAAO,OATX,IAAK,SACD,MAAO,iBA6BX,QACI,OAAOA,EAEnB,EAyQkBmlC,EAAAE,WAvQlB,SAAoB3jC,GAChB,OAAQA,GACJ,IAAK,IACL,IAAK,IACD,MAAO,YACX,IAAK,KACL,IAAK,IACD,MAAO,YACX,IAAK,SACD,MAAO,YACX,IAAK,IACL,IAAK,IACD,MAAO,cACX,IAAK,IACL,IAAK,IACD,MAAO,eACX,IAAK,IACL,IAAK,IACD,MAAO,QACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,QACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,OACX,IAAK,IACL,IAAK,IACD,MAAO,QACX,IAAK,IACD,MAAO,SACX,IAAK,IACL,IAAK,IACD,MAAO,QACX,IAAK,IACL,IAAK,IACD,MAAO,YACX,IAAK,IACL,IAAK,IACD,MAAO,QACX,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,WACX,IAAK,SACD,MAAO,cACX,IAAK,SACD,MAAO,eACX,IAAK,SACD,MAAO,QACX,IAAK,SACD,MAAO,WACX,IAAK,SACD,MAAO,YACX,IAAK,SACD,MAAO,YACX,IAAK,SACD,MAAO,aACX,IAAK,IACL,IAAK,SACD,MAAO,QACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,SACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,OACX,IAAK,SACD,MAAO,OACX,IAAK,SACD,MAAO,SACX,IAAK,SACD,MAAO,WACX,IAAK,SACD,MAAO,SACX,IAAK,SACD,MAAO,YACX,IAAK,SACD,MAAO,YACX,IAAK,SACD,MAAO,aACX,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,SACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,KACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,MACX,IAAK,SACD,MAAO,MACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACL,IAAK,SACD,MAAO,UACX,IAAK,SACD,MAAO,YACX,IAAK,SACD,MAAO,cACX,IAAK,SACL,IAAK,SACD,MAAO,gBACX,IAAK,SACD,MAAO,eACX,IAAK,SACD,MAAO,cACX,IAAK,SACD,MAAO,iBACX,IAAK,SACD,MAAO,iBACX,QACI,OAEZ,EA8CsByjC,EAAAC,eA5CtB,SAAwB1jC,GACpB,OAAQA,GACJ,IAAK,SACL,IAAK,SACL,IAAK,SACL,IAAK,SACL,IAAK,SACD,OAAO,EACX,IAAK,SACL,IAAK,SACL,IAAK,SACL,IAAK,SACL,IAAK,SAC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