@midscene/web 1.12.9-beta-20260917120835.0 → 1.12.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/dist/es/bridge-mode/io-client.mjs +1 -1
  2. package/dist/es/bridge-mode/io-server.mjs +2 -2
  3. package/dist/es/bridge-mode/io-server.mjs.map +1 -1
  4. package/dist/es/bridge-mode/page-browser-side.mjs +1 -1
  5. package/dist/es/bridge-mode/page-browser-side.mjs.map +1 -1
  6. package/dist/es/cli.mjs +1 -1
  7. package/dist/es/playwright/test-runner/cookies.mjs +136 -5
  8. package/dist/es/playwright/test-runner/cookies.mjs.map +1 -1
  9. package/dist/es/playwright/test-runner/utils.mjs +21 -1
  10. package/dist/es/playwright/test-runner/utils.mjs.map +1 -1
  11. package/dist/es/puppeteer/browser-agent.mjs +1 -9
  12. package/dist/es/puppeteer/browser-agent.mjs.map +1 -1
  13. package/dist/es/puppeteer/page-agent.mjs +1 -19
  14. package/dist/es/puppeteer/page-agent.mjs.map +1 -1
  15. package/dist/lib/bridge-mode/io-client.js +1 -1
  16. package/dist/lib/bridge-mode/io-server.js +2 -2
  17. package/dist/lib/bridge-mode/io-server.js.map +1 -1
  18. package/dist/lib/bridge-mode/page-browser-side.js +1 -1
  19. package/dist/lib/bridge-mode/page-browser-side.js.map +1 -1
  20. package/dist/lib/cli.js +1 -1
  21. package/dist/lib/playwright/test-runner/cookies.js +137 -6
  22. package/dist/lib/playwright/test-runner/cookies.js.map +1 -1
  23. package/dist/lib/playwright/test-runner/utils.js +24 -4
  24. package/dist/lib/playwright/test-runner/utils.js.map +1 -1
  25. package/dist/lib/puppeteer/browser-agent.js +1 -9
  26. package/dist/lib/puppeteer/browser-agent.js.map +1 -1
  27. package/dist/lib/puppeteer/page-agent.js +1 -19
  28. package/dist/lib/puppeteer/page-agent.js.map +1 -1
  29. package/dist/types/playwright/test-runner/cookies.d.ts +31 -4
  30. package/dist/types/playwright/test-runner/types.d.ts +14 -4
  31. package/dist/types/playwright/test-runner/utils.d.ts +2 -1
  32. package/dist/types/puppeteer/browser-agent.d.ts +0 -5
  33. package/dist/types/puppeteer/index.d.ts +1 -1
  34. package/dist/types/puppeteer/page-agent.d.ts +1 -8
  35. package/package.json +4 -9
  36. package/dist/es/common/test-runner/cookies.mjs +0 -133
  37. package/dist/es/common/test-runner/cookies.mjs.map +0 -1
  38. package/dist/es/common/test-runner/utils.mjs +0 -24
  39. package/dist/es/common/test-runner/utils.mjs.map +0 -1
  40. package/dist/es/puppeteer/test-runner/agent-nodes.mjs +0 -13
  41. package/dist/es/puppeteer/test-runner/agent-nodes.mjs.map +0 -1
  42. package/dist/es/puppeteer/test-runner/clear-cookies.mjs +0 -36
  43. package/dist/es/puppeteer/test-runner/clear-cookies.mjs.map +0 -1
  44. package/dist/es/puppeteer/test-runner/cookies.mjs +0 -31
  45. package/dist/es/puppeteer/test-runner/cookies.mjs.map +0 -1
  46. package/dist/es/puppeteer/test-runner/goto-url.mjs +0 -57
  47. package/dist/es/puppeteer/test-runner/goto-url.mjs.map +0 -1
  48. package/dist/es/puppeteer/test-runner/index.mjs +0 -6
  49. package/dist/es/puppeteer/test-runner/types.mjs +0 -0
  50. package/dist/es/puppeteer/test-runner/utils.mjs +0 -8
  51. package/dist/es/puppeteer/test-runner/utils.mjs.map +0 -1
  52. package/dist/es/puppeteer/test-runner/viewport.mjs +0 -39
  53. package/dist/es/puppeteer/test-runner/viewport.mjs.map +0 -1
  54. package/dist/lib/common/test-runner/cookies.js +0 -170
  55. package/dist/lib/common/test-runner/cookies.js.map +0 -1
  56. package/dist/lib/common/test-runner/utils.js +0 -61
  57. package/dist/lib/common/test-runner/utils.js.map +0 -1
  58. package/dist/lib/puppeteer/test-runner/agent-nodes.js +0 -47
  59. package/dist/lib/puppeteer/test-runner/agent-nodes.js.map +0 -1
  60. package/dist/lib/puppeteer/test-runner/clear-cookies.js +0 -73
  61. package/dist/lib/puppeteer/test-runner/clear-cookies.js.map +0 -1
  62. package/dist/lib/puppeteer/test-runner/cookies.js +0 -68
  63. package/dist/lib/puppeteer/test-runner/cookies.js.map +0 -1
  64. package/dist/lib/puppeteer/test-runner/goto-url.js +0 -94
  65. package/dist/lib/puppeteer/test-runner/goto-url.js.map +0 -1
  66. package/dist/lib/puppeteer/test-runner/index.js +0 -54
  67. package/dist/lib/puppeteer/test-runner/index.js.map +0 -1
  68. package/dist/lib/puppeteer/test-runner/types.js +0 -20
  69. package/dist/lib/puppeteer/test-runner/types.js.map +0 -1
  70. package/dist/lib/puppeteer/test-runner/utils.js +0 -48
  71. package/dist/lib/puppeteer/test-runner/utils.js.map +0 -1
  72. package/dist/lib/puppeteer/test-runner/viewport.js +0 -76
  73. package/dist/lib/puppeteer/test-runner/viewport.js.map +0 -1
  74. package/dist/types/common/test-runner/cookies.d.ts +0 -51
  75. package/dist/types/common/test-runner/utils.d.ts +0 -2
  76. package/dist/types/puppeteer/test-runner/agent-nodes.d.ts +0 -2
  77. package/dist/types/puppeteer/test-runner/clear-cookies.d.ts +0 -11
  78. package/dist/types/puppeteer/test-runner/cookies.d.ts +0 -5
  79. package/dist/types/puppeteer/test-runner/goto-url.d.ts +0 -19
  80. package/dist/types/puppeteer/test-runner/index.d.ts +0 -10
  81. package/dist/types/puppeteer/test-runner/types.d.ts +0 -18
  82. package/dist/types/puppeteer/test-runner/utils.d.ts +0 -3
  83. package/dist/types/puppeteer/test-runner/viewport.d.ts +0 -11
@@ -1 +0,0 @@
1
- {"version":3,"file":"puppeteer/test-runner/viewport.mjs","sources":["../../../../src/puppeteer/test-runner/viewport.ts"],"sourcesContent":["import type { AgentTestRunnerNodeDefinition } from '@midscene/core/agent';\nimport { z } from 'zod/v4';\nimport { requirePuppeteerAgent, throwIfAborted } from './utils';\n\nexport const setViewportSizeInputSchema = z.strictObject({\n width: z.number().int().positive().describe('Viewport width in CSS pixels.'),\n height: z\n .number()\n .int()\n .positive()\n .describe('Viewport height in CSS pixels.'),\n});\n\nexport type SetViewportSizeNodeInput = z.infer<\n typeof setViewportSizeInputSchema\n>;\n\nexport const setViewportSizeNode: AgentTestRunnerNodeDefinition<\n z.output<typeof setViewportSizeInputSchema>,\n { width: number; height: number }\n> = {\n name: 'setViewportSize',\n title: 'Set the browser viewport size',\n description:\n 'Set the current Puppeteer Page viewport size in CSS pixels and return the effective size.',\n stringInputKey: false,\n inputSchema: setViewportSizeInputSchema,\n async execute(agent, input, executionContext) {\n const ctx = {\n ...executionContext,\n input,\n context: requirePuppeteerAgent(agent),\n };\n throwIfAborted(ctx.signal, 'setViewportSize');\n const page = ctx.context.interface.underlyingPage;\n await page.setViewport({ width: input.width, height: input.height });\n const viewport = page.viewport();\n if (!viewport) {\n throw new Error('Puppeteer did not report an effective viewport size.');\n }\n const result = { width: viewport.width, height: viewport.height };\n return {\n summary: `Set viewport to ${result.width}x${result.height}`,\n data: result,\n };\n },\n};\n"],"names":["setViewportSizeInputSchema","z","setViewportSizeNode","agent","input","executionContext","ctx","requirePuppeteerAgent","throwIfAborted","page","viewport","Error","result"],"mappings":";;AAIO,MAAMA,6BAA6BC,EAAE,YAAY,CAAC;IACvD,OAAOA,EAAE,MAAM,GAAG,GAAG,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC5C,QAAQA,EAAAA,MACC,GACN,GAAG,GACH,QAAQ,GACR,QAAQ,CAAC;AACd;AAMO,MAAMC,sBAGT;IACF,MAAM;IACN,OAAO;IACP,aACE;IACF,gBAAgB;IAChB,aAAaF;IACb,MAAM,SAAQG,KAAK,EAAEC,KAAK,EAAEC,gBAAgB;QAC1C,MAAMC,MAAM;YACV,GAAGD,gBAAgB;YACnBD;YACA,SAASG,sBAAsBJ;QACjC;QACAK,eAAeF,IAAI,MAAM,EAAE;QAC3B,MAAMG,OAAOH,IAAI,OAAO,CAAC,SAAS,CAAC,cAAc;QACjD,MAAMG,KAAK,WAAW,CAAC;YAAE,OAAOL,MAAM,KAAK;YAAE,QAAQA,MAAM,MAAM;QAAC;QAClE,MAAMM,WAAWD,KAAK,QAAQ;QAC9B,IAAI,CAACC,UACH,MAAM,IAAIC,MAAM;QAElB,MAAMC,SAAS;YAAE,OAAOF,SAAS,KAAK;YAAE,QAAQA,SAAS,MAAM;QAAC;QAChE,OAAO;YACL,SAAS,CAAC,gBAAgB,EAAEE,OAAO,KAAK,CAAC,CAAC,EAAEA,OAAO,MAAM,EAAE;YAC3D,MAAMA;QACR;IACF;AACF"}
@@ -1,170 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- resolveCookieInput: ()=>resolveCookieInput,
28
- setCookiesInputSchema: ()=>setCookiesInputSchema
29
- });
30
- const promises_namespaceObject = require("node:fs/promises");
31
- const external_node_path_namespaceObject = require("node:path");
32
- const v4_namespaceObject = require("zod/v4");
33
- const external_utils_js_namespaceObject = require("./utils.js");
34
- const setCookiesInputSchema = v4_namespaceObject.z.strictObject({
35
- cookiesEnv: v4_namespaceObject.z.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/).optional().describe('The environment variable containing a Cookie header, cookie array JSON, or browser storage-state JSON.'),
36
- profile: v4_namespaceObject.z.string().regex(/\S/).optional().describe('A cookie profile resolved by getCookieProfile().'),
37
- storageStatePath: v4_namespaceObject.z.string().regex(/\S/).optional().describe('A path to a browser storage-state JSON file.'),
38
- url: v4_namespaceObject.z.string().url().optional().describe('The HTTP(S) URL used to scope Cookie-header values or cookies without domain/path.')
39
- }).superRefine((input, ctx)=>{
40
- const sourceCount = [
41
- input.cookiesEnv,
42
- input.profile,
43
- input.storageStatePath
44
- ].filter((value)=>void 0 !== value).length;
45
- if (1 !== sourceCount) ctx.addIssue({
46
- code: 'custom',
47
- message: 'exactly one of cookiesEnv, profile, and storageStatePath is required'
48
- });
49
- });
50
- const toCookieSourceReference = (input)=>{
51
- if (void 0 !== input.cookiesEnv) return {
52
- kind: 'env',
53
- name: input.cookiesEnv
54
- };
55
- if (void 0 !== input.profile) return {
56
- kind: 'profile',
57
- name: input.profile
58
- };
59
- if (void 0 !== input.storageStatePath) return {
60
- kind: 'storage-state',
61
- name: input.storageStatePath
62
- };
63
- throw new TypeError('setCookies requires one cookie source.');
64
- };
65
- const parseCookieHeader = (raw, url)=>{
66
- if (void 0 === url) throw new TypeError('setCookies.url is required when cookiesEnv contains a Cookie header.');
67
- const segments = raw.split(';').map((segment)=>segment.trim()).filter(Boolean);
68
- if (0 === segments.length) throw new TypeError('setCookies Cookie header contains no cookies.');
69
- return segments.map((segment)=>{
70
- const separator = segment.indexOf('=');
71
- if (separator <= 0) throw new TypeError('setCookies Cookie header contains an invalid name/value pair.');
72
- const name = segment.slice(0, separator).trim();
73
- const value = segment.slice(separator + 1).trim();
74
- if (!name) throw new TypeError('setCookies Cookie header contains an empty name.');
75
- return {
76
- name,
77
- value,
78
- url
79
- };
80
- });
81
- };
82
- const parseCookieJson = (raw)=>{
83
- try {
84
- return JSON.parse(raw);
85
- } catch {
86
- throw new TypeError('setCookies source must contain valid JSON or a Cookie header.');
87
- }
88
- };
89
- const normalizeCookie = (candidate, defaultUrl, index)=>{
90
- if (!candidate || 'object' != typeof candidate || Array.isArray(candidate)) throw new TypeError(`setCookies cookie at index ${index} must be an object.`);
91
- const cookie = candidate;
92
- if ('string' != typeof cookie.name || !cookie.name.trim()) throw new TypeError(`setCookies cookie at index ${index} requires a non-blank name.`);
93
- if ('string' != typeof cookie.value) throw new TypeError(`setCookies cookie at index ${index} requires a string value.`);
94
- const normalized = {
95
- ...cookie
96
- };
97
- const hasUrl = 'string' == typeof cookie.url && cookie.url.length > 0;
98
- const hasDomain = 'string' == typeof cookie.domain && cookie.domain.length > 0;
99
- if (!hasUrl && !hasDomain) {
100
- if (void 0 === defaultUrl) throw new TypeError(`setCookies cookie at index ${index} requires url or domain, or setCookies.url must be provided.`);
101
- normalized.url = defaultUrl;
102
- }
103
- if (hasDomain && 'string' != typeof cookie.path) normalized.path = '/';
104
- return normalized;
105
- };
106
- const normalizeCookies = (source, defaultUrl)=>{
107
- const candidates = Array.isArray(source) ? source : source && 'object' == typeof source && Array.isArray(source.cookies) ? source.cookies : void 0;
108
- if (!candidates) throw new TypeError('setCookies JSON must be a cookie array or an object with a cookies array.');
109
- if (0 === candidates.length) throw new TypeError('setCookies source contains no cookies.');
110
- return candidates.map((cookie, index)=>normalizeCookie(cookie, defaultUrl, index));
111
- };
112
- const resolveCookieInput = async (input, ctx, options)=>{
113
- const defaultUrl = void 0 === input.url ? void 0 : (0, external_utils_js_namespaceObject.resolveWebUrl)(input.url, void 0, 'setCookies.url');
114
- const reference = toCookieSourceReference(input);
115
- let source;
116
- switch(reference.kind){
117
- case 'env':
118
- {
119
- let env;
120
- try {
121
- env = await options.getEnv?.(ctx) ?? process.env;
122
- } catch {
123
- throw new Error(`Failed to resolve cookie environment ${reference.name}; the original error was redacted because it may contain cookie values.`);
124
- }
125
- const raw = env[reference.name];
126
- if (!raw?.trim()) throw new Error(`Environment variable ${reference.name} is missing or blank.`);
127
- const trimmed = raw.trim();
128
- source = /^[\[{]/.test(trimmed) ? parseCookieJson(trimmed) : parseCookieHeader(trimmed, defaultUrl);
129
- break;
130
- }
131
- case 'profile':
132
- if (!options.getCookieProfile) throw new Error('setCookies.profile requires a configured getCookieProfile callback.');
133
- try {
134
- source = await options.getCookieProfile({
135
- profile: reference.name,
136
- context: ctx.context,
137
- signal: ctx.signal
138
- });
139
- } catch {
140
- throw new Error(`Failed to resolve cookie profile ${reference.name}; the original error was redacted because it may contain cookie values.`);
141
- }
142
- break;
143
- case 'storage-state':
144
- {
145
- const path = options.resolveStorageStatePath ? await options.resolveStorageStatePath(reference.name, ctx) : (0, external_node_path_namespaceObject.resolve)(process.cwd(), reference.name);
146
- source = parseCookieJson(await (0, promises_namespaceObject.readFile)(path, 'utf8'));
147
- break;
148
- }
149
- }
150
- const cookies = normalizeCookies(source, defaultUrl);
151
- return {
152
- cookies,
153
- result: {
154
- source: reference.kind,
155
- sourceName: reference.name,
156
- count: cookies.length
157
- }
158
- };
159
- };
160
- exports.resolveCookieInput = __webpack_exports__.resolveCookieInput;
161
- exports.setCookiesInputSchema = __webpack_exports__.setCookiesInputSchema;
162
- for(var __rspack_i in __webpack_exports__)if (-1 === [
163
- "resolveCookieInput",
164
- "setCookiesInputSchema"
165
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
166
- Object.defineProperty(exports, '__esModule', {
167
- value: true
168
- });
169
-
170
- //# sourceMappingURL=cookies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common/test-runner/cookies.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/common/test-runner/cookies.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { readFile } from 'node:fs/promises';\nimport { resolve } from 'node:path';\nimport { z } from 'zod/v4';\nimport { resolveWebUrl } from './utils';\n\ntype Awaitable<T> = T | Promise<T>;\n\nexport type CookieSourceReference =\n | { kind: 'env'; name: string }\n | { kind: 'profile'; name: string }\n | { kind: 'storage-state'; name: string };\n\nexport interface WebNodeContext<TContext> {\n input: unknown;\n context: TContext;\n signal: AbortSignal;\n}\n\nexport interface CookieProfileContext<TContext> {\n profile: string;\n context: TContext;\n signal: AbortSignal;\n}\n\nexport interface WebCookieSourceOptions<TAgent> {\n getEnv?(\n ctx: WebNodeContext<TAgent>,\n ): Awaitable<Readonly<Record<string, string | undefined>>>;\n getCookieProfile?(input: CookieProfileContext<TAgent>): Awaitable<unknown>;\n resolveStorageStatePath?(\n path: string,\n ctx: WebNodeContext<TAgent>,\n ): Awaitable<string>;\n}\n\nexport interface PortableWebCookie extends Record<string, unknown> {\n name: string;\n value: string;\n url?: string;\n domain?: string;\n path?: string;\n}\n\nexport const setCookiesInputSchema = z\n .strictObject({\n cookiesEnv: z\n .string()\n .regex(/^[A-Za-z_][A-Za-z0-9_]*$/)\n .optional()\n .describe(\n 'The environment variable containing a Cookie header, cookie array JSON, or browser storage-state JSON.',\n ),\n profile: z\n .string()\n .regex(/\\S/)\n .optional()\n .describe('A cookie profile resolved by getCookieProfile().'),\n storageStatePath: z\n .string()\n .regex(/\\S/)\n .optional()\n .describe('A path to a browser storage-state JSON file.'),\n url: z\n .string()\n .url()\n .optional()\n .describe(\n 'The HTTP(S) URL used to scope Cookie-header values or cookies without domain/path.',\n ),\n })\n .superRefine((input, ctx) => {\n const sourceCount = [\n input.cookiesEnv,\n input.profile,\n input.storageStatePath,\n ].filter((value) => value !== undefined).length;\n if (sourceCount !== 1) {\n ctx.addIssue({\n code: 'custom',\n message:\n 'exactly one of cookiesEnv, profile, and storageStatePath is required',\n });\n }\n });\n\nexport type SetCookiesNodeInput = z.infer<typeof setCookiesInputSchema>;\n\nexport interface SetCookiesNodeResult {\n source: CookieSourceReference['kind'];\n sourceName: string;\n count: number;\n}\n\nconst toCookieSourceReference = (\n input: SetCookiesNodeInput,\n): CookieSourceReference => {\n if (input.cookiesEnv !== undefined) {\n return { kind: 'env', name: input.cookiesEnv };\n }\n if (input.profile !== undefined) {\n return { kind: 'profile', name: input.profile };\n }\n if (input.storageStatePath !== undefined) {\n return { kind: 'storage-state', name: input.storageStatePath };\n }\n throw new TypeError('setCookies requires one cookie source.');\n};\n\nconst parseCookieHeader = (raw: string, url: string | undefined) => {\n if (url === undefined) {\n throw new TypeError(\n 'setCookies.url is required when cookiesEnv contains a Cookie header.',\n );\n }\n const segments = raw\n .split(';')\n .map((segment) => segment.trim())\n .filter(Boolean);\n if (segments.length === 0) {\n throw new TypeError('setCookies Cookie header contains no cookies.');\n }\n return segments.map((segment) => {\n const separator = segment.indexOf('=');\n if (separator <= 0) {\n throw new TypeError(\n 'setCookies Cookie header contains an invalid name/value pair.',\n );\n }\n const name = segment.slice(0, separator).trim();\n const value = segment.slice(separator + 1).trim();\n if (!name) {\n throw new TypeError('setCookies Cookie header contains an empty name.');\n }\n return { name, value, url } satisfies PortableWebCookie;\n });\n};\n\nconst parseCookieJson = (raw: string): unknown => {\n try {\n return JSON.parse(raw);\n } catch {\n throw new TypeError(\n 'setCookies source must contain valid JSON or a Cookie header.',\n );\n }\n};\n\nconst normalizeCookie = (\n candidate: unknown,\n defaultUrl: string | undefined,\n index: number,\n): PortableWebCookie => {\n if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) {\n throw new TypeError(\n `setCookies cookie at index ${index} must be an object.`,\n );\n }\n const cookie = candidate as Record<string, unknown>;\n if (typeof cookie.name !== 'string' || !cookie.name.trim()) {\n throw new TypeError(\n `setCookies cookie at index ${index} requires a non-blank name.`,\n );\n }\n if (typeof cookie.value !== 'string') {\n throw new TypeError(\n `setCookies cookie at index ${index} requires a string value.`,\n );\n }\n\n const normalized = { ...cookie } as PortableWebCookie;\n const hasUrl = typeof cookie.url === 'string' && cookie.url.length > 0;\n const hasDomain =\n typeof cookie.domain === 'string' && cookie.domain.length > 0;\n if (!hasUrl && !hasDomain) {\n if (defaultUrl === undefined) {\n throw new TypeError(\n `setCookies cookie at index ${index} requires url or domain, or setCookies.url must be provided.`,\n );\n }\n normalized.url = defaultUrl;\n }\n if (hasDomain && typeof cookie.path !== 'string') normalized.path = '/';\n return normalized;\n};\n\nconst normalizeCookies = (\n source: unknown,\n defaultUrl: string | undefined,\n): PortableWebCookie[] => {\n const candidates = Array.isArray(source)\n ? source\n : source &&\n typeof source === 'object' &&\n Array.isArray((source as { cookies?: unknown }).cookies)\n ? (source as { cookies: unknown[] }).cookies\n : undefined;\n if (!candidates) {\n throw new TypeError(\n 'setCookies JSON must be a cookie array or an object with a cookies array.',\n );\n }\n if (candidates.length === 0) {\n throw new TypeError('setCookies source contains no cookies.');\n }\n return candidates.map((cookie, index) =>\n normalizeCookie(cookie, defaultUrl, index),\n );\n};\n\nexport const resolveCookieInput = async <TAgent>(\n input: SetCookiesNodeInput,\n ctx: WebNodeContext<TAgent>,\n options: WebCookieSourceOptions<TAgent>,\n): Promise<{\n cookies: PortableWebCookie[];\n result: SetCookiesNodeResult;\n}> => {\n const defaultUrl =\n input.url === undefined\n ? undefined\n : resolveWebUrl(input.url, undefined, 'setCookies.url');\n const reference = toCookieSourceReference(input);\n let source: unknown;\n switch (reference.kind) {\n case 'env': {\n let env: Readonly<Record<string, string | undefined>>;\n try {\n env = (await options.getEnv?.(ctx)) ?? process.env;\n } catch {\n throw new Error(\n `Failed to resolve cookie environment ${reference.name}; the original error was redacted because it may contain cookie values.`,\n );\n }\n const raw = env[reference.name];\n if (!raw?.trim()) {\n throw new Error(\n `Environment variable ${reference.name} is missing or blank.`,\n );\n }\n const trimmed = raw.trim();\n source = /^[\\[{]/.test(trimmed)\n ? parseCookieJson(trimmed)\n : parseCookieHeader(trimmed, defaultUrl);\n break;\n }\n case 'profile': {\n if (!options.getCookieProfile) {\n throw new Error(\n 'setCookies.profile requires a configured getCookieProfile callback.',\n );\n }\n try {\n source = await options.getCookieProfile({\n profile: reference.name,\n context: ctx.context,\n signal: ctx.signal,\n });\n } catch {\n throw new Error(\n `Failed to resolve cookie profile ${reference.name}; the original error was redacted because it may contain cookie values.`,\n );\n }\n break;\n }\n case 'storage-state': {\n const path = options.resolveStorageStatePath\n ? await options.resolveStorageStatePath(reference.name, ctx)\n : resolve(process.cwd(), reference.name);\n source = parseCookieJson(await readFile(path, 'utf8'));\n break;\n }\n }\n const cookies = normalizeCookies(source, defaultUrl);\n return {\n cookies,\n result: {\n source: reference.kind,\n sourceName: reference.name,\n count: cookies.length,\n },\n };\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","setCookiesInputSchema","z","input","ctx","sourceCount","value","undefined","toCookieSourceReference","TypeError","parseCookieHeader","raw","url","segments","segment","Boolean","separator","name","parseCookieJson","JSON","normalizeCookie","candidate","defaultUrl","index","Array","cookie","normalized","hasUrl","hasDomain","normalizeCookies","source","candidates","resolveCookieInput","options","resolveWebUrl","reference","env","process","Error","trimmed","path","resolve","readFile","cookies"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEt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ACR,MAAM,IAAI2B,MACR,CAAC,qBAAqB,EAAEH,UAAU,IAAI,CAAC,qBAAqB,CAAC;gBAGjE,MAAMI,UAAU5B,IAAI,IAAI;gBACxBmB,SAAS,SAAS,IAAI,CAACS,WACnBrB,gBAAgBqB,WAChB7B,kBAAkB6B,SAASjB;gBAC/B;YACF;QACA,KAAK;YACH,IAAI,CAACW,QAAQ,gBAAgB,EAC3B,MAAM,IAAIK,MACR;YAGJ,IAAI;gBACFR,SAAS,MAAMG,QAAQ,gBAAgB,CAAC;oBACtC,SAASE,UAAU,IAAI;oBACvB,SAAS/B,IAAI,OAAO;oBACpB,QAAQA,IAAI,MAAM;gBACpB;YACF,EAAE,OAAM;gBACN,MAAM,IAAIkC,MACR,CAAC,iCAAiC,EAAEH,UAAU,IAAI,CAAC,uEAAuE,CAAC;YAE/H;YACA;QAEF,KAAK;YAAiB;gBACpB,MAAMK,OAAOP,QAAQ,uBAAuB,GACxC,MAAMA,QAAQ,uBAAuB,CAACE,UAAU,IAAI,EAAE/B,OACtDqC,AAAAA,IAAAA,mCAAAA,OAAAA,AAAAA,EAAQJ,QAAQ,GAAG,IAAIF,UAAU,IAAI;gBACzCL,SAASZ,gBAAgB,MAAMwB,AAAAA,IAAAA,yBAAAA,QAAAA,AAAAA,EAASF,MAAM;gBAC9C;YACF;IACF;IACA,MAAMG,UAAUd,iBAAiBC,QAAQR;IACzC,OAAO;QACLqB;QACA,QAAQ;YACN,QAAQR,UAAU,IAAI;YACtB,YAAYA,UAAU,IAAI;YAC1B,OAAOQ,QAAQ,MAAM;QACvB;IACF;AACF"}
@@ -1,61 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- resolveWebUrl: ()=>resolveWebUrl,
28
- throwIfAborted: ()=>throwIfAborted
29
- });
30
- const SUPPORTED_WEB_PROTOCOLS = new Set([
31
- 'http:',
32
- 'https:'
33
- ]);
34
- const throwIfAborted = (signal, operation)=>{
35
- if (signal.aborted) throw signal.reason ?? new Error(`${operation} aborted.`);
36
- };
37
- const resolveWebUrl = (target, baseUrl, label)=>{
38
- const trimmed = target.trim();
39
- if (!trimmed) throw new TypeError(`${label} must not be blank.`);
40
- let resolved;
41
- try {
42
- resolved = void 0 === baseUrl ? new URL(trimmed) : new URL(trimmed, baseUrl);
43
- } catch (error) {
44
- throw new TypeError(void 0 === baseUrl ? `${label} must be an absolute HTTP(S) URL.` : `${label} is not a valid URL.`, {
45
- cause: error
46
- });
47
- }
48
- if (!SUPPORTED_WEB_PROTOCOLS.has(resolved.protocol)) throw new TypeError(`${label} does not support the ${resolved.protocol} protocol.`);
49
- return resolved.toString();
50
- };
51
- exports.resolveWebUrl = __webpack_exports__.resolveWebUrl;
52
- exports.throwIfAborted = __webpack_exports__.throwIfAborted;
53
- for(var __rspack_i in __webpack_exports__)if (-1 === [
54
- "resolveWebUrl",
55
- "throwIfAborted"
56
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
57
- Object.defineProperty(exports, '__esModule', {
58
- value: true
59
- });
60
-
61
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common/test-runner/utils.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/common/test-runner/utils.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const SUPPORTED_WEB_PROTOCOLS = new Set(['http:', 'https:']);\n\nexport const throwIfAborted = (signal: AbortSignal, operation: string) => {\n if (signal.aborted) {\n throw signal.reason ?? new Error(`${operation} aborted.`);\n }\n};\n\nexport const resolveWebUrl = (\n target: string,\n baseUrl: string | undefined,\n label: string,\n): string => {\n const trimmed = target.trim();\n if (!trimmed) throw new TypeError(`${label} must not be blank.`);\n\n let resolved: URL;\n try {\n resolved =\n baseUrl === undefined ? new URL(trimmed) : new URL(trimmed, baseUrl);\n } catch (error) {\n throw new TypeError(\n baseUrl === undefined\n ? `${label} must be an absolute HTTP(S) URL.`\n : `${label} is not a valid URL.`,\n { cause: error },\n );\n }\n if (!SUPPORTED_WEB_PROTOCOLS.has(resolved.protocol)) {\n throw new TypeError(\n `${label} does not support the ${resolved.protocol} protocol.`,\n );\n }\n return resolved.toString();\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","SUPPORTED_WEB_PROTOCOLS","Set","throwIfAborted","signal","operation","Error","resolveWebUrl","target","baseUrl","label","trimmed","TypeError","resolved","undefined","URL","error"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oB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 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- puppeteerAgentTestRunnerNodeDefinitions: ()=>puppeteerAgentTestRunnerNodeDefinitions
28
- });
29
- const external_clear_cookies_js_namespaceObject = require("./clear-cookies.js");
30
- const external_cookies_js_namespaceObject = require("./cookies.js");
31
- const external_goto_url_js_namespaceObject = require("./goto-url.js");
32
- const external_viewport_js_namespaceObject = require("./viewport.js");
33
- const puppeteerAgentTestRunnerNodeDefinitions = [
34
- external_goto_url_js_namespaceObject.gotoUrlNode,
35
- external_cookies_js_namespaceObject.setCookiesNode,
36
- external_clear_cookies_js_namespaceObject.clearCookiesNode,
37
- external_viewport_js_namespaceObject.setViewportSizeNode
38
- ];
39
- exports.puppeteerAgentTestRunnerNodeDefinitions = __webpack_exports__.puppeteerAgentTestRunnerNodeDefinitions;
40
- for(var __rspack_i in __webpack_exports__)if (-1 === [
41
- "puppeteerAgentTestRunnerNodeDefinitions"
42
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
43
- Object.defineProperty(exports, '__esModule', {
44
- value: true
45
- });
46
-
47
- //# sourceMappingURL=agent-nodes.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"puppeteer/test-runner/agent-nodes.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/puppeteer/test-runner/agent-nodes.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { AgentTestRunnerNodeDefinition } from '@midscene/core/agent';\nimport { clearCookiesNode } from './clear-cookies';\nimport { setCookiesNode } from './cookies';\nimport { gotoUrlNode } from './goto-url';\nimport { setViewportSizeNode } from './viewport';\n\nexport const puppeteerAgentTestRunnerNodeDefinitions: readonly AgentTestRunnerNodeDefinition[] =\n [gotoUrlNode, setCookiesNode, clearCookiesNode, setViewportSizeNode];\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","puppeteerAgentTestRunnerNodeDefinitions","gotoUrlNode","setCookiesNode","clearCookiesNode","setViewportSizeNode"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;;ACAO,MAAMI,0CACX;IAACC,qCAAAA,WAAWA;IAAEC,oCAAAA,cAAcA;IAAEC,0CAAAA,gBAAgBA;IAAEC,qCAAAA,mBAAmBA;CAAC"}
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- clearCookiesInputSchema: ()=>clearCookiesInputSchema,
28
- clearCookiesNode: ()=>clearCookiesNode
29
- });
30
- const v4_namespaceObject = require("zod/v4");
31
- const external_utils_js_namespaceObject = require("./utils.js");
32
- const clearCookiesInputSchema = v4_namespaceObject.z.strictObject({
33
- name: v4_namespaceObject.z.string().regex(/\S/).optional().describe('Cookie name to clear.'),
34
- domain: v4_namespaceObject.z.string().regex(/\S/).optional().describe('Cookie domain to clear.'),
35
- path: v4_namespaceObject.z.string().regex(/\S/).optional().describe('Cookie path to clear.')
36
- });
37
- const clearCookiesNode = {
38
- name: 'clearCookies',
39
- title: 'Clear browser cookies',
40
- description: 'Clear all cookies from the current Puppeteer BrowserContext, or only cookies matching name, domain, or path.',
41
- stringInputKey: false,
42
- inputSchema: clearCookiesInputSchema,
43
- async execute (agent, input, executionContext) {
44
- const ctx = {
45
- ...executionContext,
46
- input,
47
- context: (0, external_utils_js_namespaceObject.requirePuppeteerAgent)(agent)
48
- };
49
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'clearCookies');
50
- const browserContext = ctx.context.interface.underlyingPage.browserContext();
51
- const cookies = (await browserContext.cookies()).filter((cookie)=>(void 0 === input.name || cookie.name === input.name) && (void 0 === input.domain || cookie.domain === input.domain) && (void 0 === input.path || cookie.path === input.path));
52
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'clearCookies');
53
- if (cookies.length > 0) await browserContext.deleteCookie(...cookies);
54
- const filterNames = Object.keys(input);
55
- return {
56
- summary: 0 === filterNames.length ? `Cleared ${cookies.length} browser cookie(s)` : `Cleared ${cookies.length} browser cookie(s) matching ${filterNames.join(', ')}`,
57
- data: {
58
- filters: input
59
- }
60
- };
61
- }
62
- };
63
- exports.clearCookiesInputSchema = __webpack_exports__.clearCookiesInputSchema;
64
- exports.clearCookiesNode = __webpack_exports__.clearCookiesNode;
65
- for(var __rspack_i in __webpack_exports__)if (-1 === [
66
- "clearCookiesInputSchema",
67
- "clearCookiesNode"
68
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
69
- Object.defineProperty(exports, '__esModule', {
70
- value: true
71
- });
72
-
73
- //# sourceMappingURL=clear-cookies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"puppeteer/test-runner/clear-cookies.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/puppeteer/test-runner/clear-cookies.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { AgentTestRunnerNodeDefinition } from '@midscene/core/agent';\nimport { z } from 'zod/v4';\nimport { requirePuppeteerAgent, throwIfAborted } from './utils';\n\nexport const clearCookiesInputSchema = z.strictObject({\n name: z.string().regex(/\\S/).optional().describe('Cookie name to clear.'),\n domain: z.string().regex(/\\S/).optional().describe('Cookie domain to clear.'),\n path: z.string().regex(/\\S/).optional().describe('Cookie path to clear.'),\n});\n\nexport type ClearCookiesNodeInput = z.infer<typeof clearCookiesInputSchema>;\n\nexport const clearCookiesNode: AgentTestRunnerNodeDefinition<\n z.output<typeof clearCookiesInputSchema>,\n { filters: ClearCookiesNodeInput }\n> = {\n name: 'clearCookies',\n title: 'Clear browser cookies',\n description:\n 'Clear all cookies from the current Puppeteer BrowserContext, or only cookies matching name, domain, or path.',\n stringInputKey: false,\n inputSchema: clearCookiesInputSchema,\n async execute(agent, input, executionContext) {\n const ctx = {\n ...executionContext,\n input,\n context: requirePuppeteerAgent(agent),\n };\n throwIfAborted(ctx.signal, 'clearCookies');\n const browserContext =\n ctx.context.interface.underlyingPage.browserContext();\n const cookies = (await browserContext.cookies()).filter(\n (cookie) =>\n (input.name === undefined || cookie.name === input.name) &&\n (input.domain === undefined || cookie.domain === input.domain) &&\n (input.path === undefined || cookie.path === input.path),\n );\n throwIfAborted(ctx.signal, 'clearCookies');\n if (cookies.length > 0) await browserContext.deleteCookie(...cookies);\n const filterNames = Object.keys(input);\n return {\n summary:\n filterNames.length === 0\n ? `Cleared ${cookies.length} browser cookie(s)`\n : `Cleared ${cookies.length} browser cookie(s) matching ${filterNames.join(', ')}`,\n data: { filters: input },\n };\n },\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","clearCookiesInputSchema","z","clearCookiesNode","agent","input","executionContext","ctx","requirePuppeteerAgent","throwIfAborted","browserContext","cookies","cookie","undefined","filterNames"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;ACFO,MAAMI,0BAA0BC,mBAAAA,CAAAA,CAAAA,YAAc,CAAC;IACpD,MAAMA,mBAAAA,CAAAA,CAAAA,MAAQ,GAAG,KAAK,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;IACjD,QAAQA,mBAAAA,CAAAA,CAAAA,MAAQ,GAAG,KAAK,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;IACnD,MAAMA,mBAAAA,CAAAA,CAAAA,MAAQ,GAAG,KAAK,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC;AACnD;AAIO,MAAMC,mBAGT;IACF,MAAM;IACN,OAAO;IACP,aACE;IACF,gBAAgB;IAChB,aAAaF;IACb,MAAM,SAAQG,KAAK,EAAEC,KAAK,EAAEC,gBAAgB;QAC1C,MAAMC,MAAM;YACV,GAAGD,gBAAgB;YACnBD;YACA,SAASG,AAAAA,IAAAA,kCAAAA,qBAAAA,AAAAA,EAAsBJ;QACjC;QACAK,IAAAA,kCAAAA,cAAAA,AAAAA,EAAeF,IAAI,MAAM,EAAE;QAC3B,MAAMG,iBACJH,IAAI,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,cAAc;QACrD,MAAMI,UAAW,OAAMD,eAAe,OAAO,EAAC,EAAG,MAAM,CACrD,CAACE,SACEP,AAAAA,CAAAA,AAAeQ,WAAfR,MAAM,IAAI,IAAkBO,OAAO,IAAI,KAAKP,MAAM,IAAG,KACrDA,CAAAA,AAAiBQ,WAAjBR,MAAM,MAAM,IAAkBO,OAAO,MAAM,KAAKP,MAAM,MAAK,KAC3DA,CAAAA,AAAeQ,WAAfR,MAAM,IAAI,IAAkBO,OAAO,IAAI,KAAKP,MAAM,IAAG;QAE1DI,IAAAA,kCAAAA,cAAAA,AAAAA,EAAeF,IAAI,MAAM,EAAE;QAC3B,IAAII,QAAQ,MAAM,GAAG,GAAG,MAAMD,eAAe,YAAY,IAAIC;QAC7D,MAAMG,cAAcjB,OAAO,IAAI,CAACQ;QAChC,OAAO;YACL,SACES,AAAuB,MAAvBA,YAAY,MAAM,GACd,CAAC,QAAQ,EAAEH,QAAQ,MAAM,CAAC,kBAAkB,CAAC,GAC7C,CAAC,QAAQ,EAAEA,QAAQ,MAAM,CAAC,4BAA4B,EAAEG,YAAY,IAAI,CAAC,OAAO;YACtF,MAAM;gBAAE,SAAST;YAAM;QACzB;IACF;AACF"}
@@ -1,68 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- setCookiesNode: ()=>setCookiesNode,
28
- setCookiesInputSchema: ()=>cookies_js_namespaceObject.setCookiesInputSchema
29
- });
30
- const cookies_js_namespaceObject = require("../../common/test-runner/cookies.js");
31
- const external_utils_js_namespaceObject = require("./utils.js");
32
- const setCookiesNode = {
33
- name: 'setCookies',
34
- title: 'Set browser cookies',
35
- description: 'Load cookies from an environment variable, configured profile, or browser storage-state file without persisting cookie values in workflow input or output.',
36
- stringInputKey: false,
37
- inputSchema: cookies_js_namespaceObject.setCookiesInputSchema,
38
- async execute (agent, input, executionContext) {
39
- const ctx = {
40
- ...executionContext,
41
- input,
42
- context: (0, external_utils_js_namespaceObject.requirePuppeteerAgent)(agent)
43
- };
44
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'setCookies');
45
- const { cookies, result } = await (0, cookies_js_namespaceObject.resolveCookieInput)(input, ctx, ctx.context.testRunner ?? {});
46
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'setCookies');
47
- try {
48
- await ctx.context.interface.underlyingPage.setCookie(...cookies);
49
- } catch {
50
- throw new Error(`Failed to set ${cookies.length} browser cookie(s); the browser error was redacted because it may contain cookie values.`);
51
- }
52
- return {
53
- summary: `Set ${result.count} browser cookie(s) from ${result.source} source ${result.sourceName}`,
54
- data: result
55
- };
56
- }
57
- };
58
- exports.setCookiesInputSchema = __webpack_exports__.setCookiesInputSchema;
59
- exports.setCookiesNode = __webpack_exports__.setCookiesNode;
60
- for(var __rspack_i in __webpack_exports__)if (-1 === [
61
- "setCookiesInputSchema",
62
- "setCookiesNode"
63
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
64
- Object.defineProperty(exports, '__esModule', {
65
- value: true
66
- });
67
-
68
- //# sourceMappingURL=cookies.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"puppeteer/test-runner/cookies.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/puppeteer/test-runner/cookies.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import {\n type SetCookiesNodeInput,\n type SetCookiesNodeResult,\n resolveCookieInput,\n setCookiesInputSchema,\n} from '@/common/test-runner/cookies';\nimport type { AgentTestRunnerNodeDefinition } from '@midscene/core/agent';\nimport type { CookieParam } from 'puppeteer';\nimport { requirePuppeteerAgent, throwIfAborted } from './utils';\n\nexport { setCookiesInputSchema };\nexport type { SetCookiesNodeInput, SetCookiesNodeResult };\n\nexport const setCookiesNode: AgentTestRunnerNodeDefinition<\n SetCookiesNodeInput,\n SetCookiesNodeResult\n> = {\n name: 'setCookies',\n title: 'Set browser cookies',\n description:\n 'Load cookies from an environment variable, configured profile, or browser storage-state file without persisting cookie values in workflow input or output.',\n stringInputKey: false,\n inputSchema: setCookiesInputSchema,\n async execute(agent, input, executionContext) {\n const ctx = {\n ...executionContext,\n input,\n context: requirePuppeteerAgent(agent),\n };\n throwIfAborted(ctx.signal, 'setCookies');\n const { cookies, result } = await resolveCookieInput(\n input,\n ctx,\n ctx.context.testRunner ?? {},\n );\n\n throwIfAborted(ctx.signal, 'setCookies');\n try {\n await ctx.context.interface.underlyingPage.setCookie(\n ...(cookies as CookieParam[]),\n );\n } catch {\n throw new Error(\n `Failed to set ${cookies.length} browser cookie(s); the browser error was redacted because it may contain cookie values.`,\n );\n }\n return {\n summary: `Set ${result.count} browser cookie(s) from ${result.source} source ${result.sourceName}`,\n data: result,\n };\n },\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","setCookiesNode","setCookiesInputSchema","agent","input","executionContext","ctx","requirePuppeteerAgent","throwIfAborted","cookies","result","resolveCookieInput","Error"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UAA0BA,OAAO,WAAW,EACrDH,OAAO,cAAc,CAAC,UAASG,OAAO,WAAW,EAAE;YAAE,OAAO;QAAS;QAEtEH,OAAO,cAAc,CAAC,UAAS,cAAc;YAAE,OAAO;QAAK;IAC5D;;;;;;;;;;ACOO,MAAMI,iBAGT;IACF,MAAM;IACN,OAAO;IACP,aACE;IACF,gBAAgB;IAChB,aAAaC,2BAAAA,qBAAqBA;IAClC,MAAM,SAAQC,KAAK,EAAEC,KAAK,EAAEC,gBAAgB;QAC1C,MAAMC,MAAM;YACV,GAAGD,gBAAgB;YACnBD;YACA,SAASG,AAAAA,IAAAA,kCAAAA,qBAAAA,AAAAA,EAAsBJ;QACjC;QACAK,IAAAA,kCAAAA,cAAAA,AAAAA,EAAeF,IAAI,MAAM,EAAE;QAC3B,MAAM,EAAEG,OAAO,EAAEC,MAAM,EAAE,GAAG,MAAMC,AAAAA,IAAAA,2BAAAA,kBAAAA,AAAAA,EAChCP,OACAE,KACAA,IAAI,OAAO,CAAC,UAAU,IAAI,CAAC;QAG7BE,IAAAA,kCAAAA,cAAAA,AAAAA,EAAeF,IAAI,MAAM,EAAE;QAC3B,IAAI;YACF,MAAMA,IAAI,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,SAAS,IAC9CG;QAER,EAAE,OAAM;YACN,MAAM,IAAIG,MACR,CAAC,cAAc,EAAEH,QAAQ,MAAM,CAAC,wFAAwF,CAAC;QAE7H;QACA,OAAO;YACL,SAAS,CAAC,IAAI,EAAEC,OAAO,KAAK,CAAC,wBAAwB,EAAEA,OAAO,MAAM,CAAC,QAAQ,EAAEA,OAAO,UAAU,EAAE;YAClG,MAAMA;QACR;IACF;AACF"}
@@ -1,94 +0,0 @@
1
- "use strict";
2
- var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
10
- })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
13
- })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
23
- })();
24
- var __webpack_exports__ = {};
25
- __webpack_require__.r(__webpack_exports__);
26
- __webpack_require__.d(__webpack_exports__, {
27
- gotoUrlInputSchema: ()=>gotoUrlInputSchema,
28
- gotoUrlNode: ()=>gotoUrlNode
29
- });
30
- const v4_namespaceObject = require("zod/v4");
31
- const external_utils_js_namespaceObject = require("./utils.js");
32
- const DEFAULT_NAVIGATION_TIMEOUT_MS = 60000;
33
- const DEFAULT_WAIT_UNTIL = 'domcontentloaded';
34
- const gotoUrlInputSchema = v4_namespaceObject.z.strictObject({
35
- url: v4_namespaceObject.z.string().min(1).describe('An absolute HTTP(S) URL or a path relative to Puppeteer baseURL or the current page URL.'),
36
- waitUntil: v4_namespaceObject.z["enum"]([
37
- 'domcontentloaded',
38
- 'load',
39
- 'networkidle0',
40
- 'networkidle2'
41
- ]).default(DEFAULT_WAIT_UNTIL).describe('The Puppeteer navigation lifecycle event to wait for.'),
42
- timeoutMs: v4_namespaceObject.z.number().positive().default(DEFAULT_NAVIGATION_TIMEOUT_MS).describe('The navigation timeout in milliseconds.')
43
- });
44
- const resolveNavigationUrl = (target, page, configuredBase)=>{
45
- const trimmed = target.trim();
46
- if (!trimmed) throw new TypeError('gotoUrl.url must not be blank.');
47
- if (/^[a-z][a-z\d+.-]*:/i.test(trimmed)) return (0, external_utils_js_namespaceObject.resolveWebUrl)(trimmed, void 0, 'gotoUrl.url');
48
- if (void 0 !== configuredBase) return (0, external_utils_js_namespaceObject.resolveWebUrl)(trimmed, configuredBase, 'gotoUrl.url');
49
- const currentUrl = page.url();
50
- if (!/^https?:\/\//i.test(currentUrl)) throw new TypeError(`gotoUrl.url cannot resolve a relative URL from ${JSON.stringify(currentUrl)}. Use an absolute HTTP(S) URL for the first navigation or configure Puppeteer testRunner.baseURL.`);
51
- return (0, external_utils_js_namespaceObject.resolveWebUrl)(trimmed, currentUrl, 'gotoUrl.url');
52
- };
53
- const gotoUrlNode = {
54
- name: 'gotoUrl',
55
- title: 'Open a Web URL',
56
- description: 'Navigate the current Puppeteer Page to an absolute HTTP(S) URL or a path relative to testRunner.baseURL or the current page URL.',
57
- stringInputKey: 'url',
58
- inputSchema: gotoUrlInputSchema,
59
- async execute (agent, input, executionContext) {
60
- const ctx = {
61
- ...executionContext,
62
- input,
63
- context: (0, external_utils_js_namespaceObject.requirePuppeteerAgent)(agent)
64
- };
65
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'gotoUrl');
66
- const page = ctx.context.interface.underlyingPage;
67
- const url = resolveNavigationUrl(ctx.input.url, page, ctx.context.testRunner?.baseURL);
68
- const response = await page.goto(url, {
69
- waitUntil: ctx.input.waitUntil,
70
- timeout: ctx.input.timeoutMs
71
- });
72
- (0, external_utils_js_namespaceObject.throwIfAborted)(ctx.signal, 'gotoUrl');
73
- const result = {
74
- url: page.url(),
75
- status: response?.status() ?? null,
76
- title: await page.title()
77
- };
78
- return {
79
- summary: `Navigated to ${result.url}`,
80
- data: result
81
- };
82
- }
83
- };
84
- exports.gotoUrlInputSchema = __webpack_exports__.gotoUrlInputSchema;
85
- exports.gotoUrlNode = __webpack_exports__.gotoUrlNode;
86
- for(var __rspack_i in __webpack_exports__)if (-1 === [
87
- "gotoUrlInputSchema",
88
- "gotoUrlNode"
89
- ].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
90
- Object.defineProperty(exports, '__esModule', {
91
- value: true
92
- });
93
-
94
- //# sourceMappingURL=goto-url.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"puppeteer/test-runner/goto-url.js","sources":["webpack/runtime/define_property_getters","webpack/runtime/has_own_property","webpack/runtime/make_namespace_object","../../../../src/puppeteer/test-runner/goto-url.ts"],"sourcesContent":["__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n }\n }\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import type { AgentTestRunnerNodeDefinition } from '@midscene/core/agent';\nimport type { Page } from 'puppeteer';\nimport { z } from 'zod/v4';\nimport { requirePuppeteerAgent, resolveWebUrl, throwIfAborted } from './utils';\n\nconst DEFAULT_NAVIGATION_TIMEOUT_MS = 60_000;\nconst DEFAULT_WAIT_UNTIL = 'domcontentloaded' as const;\n\nexport const gotoUrlInputSchema = z.strictObject({\n url: z\n .string()\n .min(1)\n .describe(\n 'An absolute HTTP(S) URL or a path relative to Puppeteer baseURL or the current page URL.',\n ),\n waitUntil: z\n .enum(['domcontentloaded', 'load', 'networkidle0', 'networkidle2'])\n .default(DEFAULT_WAIT_UNTIL)\n .describe('The Puppeteer navigation lifecycle event to wait for.'),\n timeoutMs: z\n .number()\n .positive()\n .default(DEFAULT_NAVIGATION_TIMEOUT_MS)\n .describe('The navigation timeout in milliseconds.'),\n});\n\nexport type GotoUrlNodeInput = z.infer<typeof gotoUrlInputSchema>;\n\nexport interface GotoUrlNodeResult {\n url: string;\n status: number | null;\n title: string;\n}\n\nconst resolveNavigationUrl = (\n target: string,\n page: Page,\n configuredBase: string | undefined,\n): string => {\n const trimmed = target.trim();\n if (!trimmed) throw new TypeError('gotoUrl.url must not be blank.');\n if (/^[a-z][a-z\\d+.-]*:/i.test(trimmed)) {\n return resolveWebUrl(trimmed, undefined, 'gotoUrl.url');\n }\n if (configuredBase !== undefined) {\n return resolveWebUrl(trimmed, configuredBase, 'gotoUrl.url');\n }\n const currentUrl = page.url();\n if (!/^https?:\\/\\//i.test(currentUrl)) {\n throw new TypeError(\n `gotoUrl.url cannot resolve a relative URL from ${JSON.stringify(currentUrl)}. Use an absolute HTTP(S) URL for the first navigation or configure Puppeteer testRunner.baseURL.`,\n );\n }\n return resolveWebUrl(trimmed, currentUrl, 'gotoUrl.url');\n};\n\nexport const gotoUrlNode: AgentTestRunnerNodeDefinition<\n z.output<typeof gotoUrlInputSchema>,\n GotoUrlNodeResult\n> = {\n name: 'gotoUrl',\n title: 'Open a Web URL',\n description:\n 'Navigate the current Puppeteer Page to an absolute HTTP(S) URL or a path relative to testRunner.baseURL or the current page URL.',\n stringInputKey: 'url',\n inputSchema: gotoUrlInputSchema,\n async execute(agent, input, executionContext) {\n const ctx = {\n ...executionContext,\n input,\n context: requirePuppeteerAgent(agent),\n };\n throwIfAborted(ctx.signal, 'gotoUrl');\n const page = ctx.context.interface.underlyingPage;\n const url = resolveNavigationUrl(\n ctx.input.url,\n page,\n ctx.context.testRunner?.baseURL,\n );\n const response = await page.goto(url, {\n waitUntil: ctx.input.waitUntil,\n timeout: ctx.input.timeoutMs,\n });\n throwIfAborted(ctx.signal, 'gotoUrl');\n const result = {\n url: page.url(),\n status: response?.status() ?? null,\n title: await page.title(),\n };\n return { summary: `Navigated to ${result.url}`, data: result };\n },\n};\n"],"names":["__webpack_require__","definition","key","Object","obj","prop","Symbol","DEFAULT_NAVIGATION_TIMEOUT_MS","DEFAULT_WAIT_UNTIL","gotoUrlInputSchema","z","resolveNavigationUrl","target","page","configuredBase","trimmed","TypeError","resolveWebUrl","undefined","currentUrl","JSON","gotoUrlNode","agent","input","executionContext","ctx","requirePuppeteerAgent","throwIfAborted","url","response","result"],"mappings":";;;IAAAA,oBAAoB,CAAC,GAAG,CAAC,UAASC;QACjC,IAAI,IAAIC,OAAOD,WACR,IAAGD,oBAAoB,CAAC,CAACC,YAAYC,QAAQ,CAACF,oBAAoB,CAAC,CAAC,UAASE,MACzEC,OAAO,cAAc,CAAC,UAASD,KAAK;YAAE,YAAY;YAAM,KAAKD,UAAU,CAACC,IAAI;QAAC;IAGzF;;;ICNAF,oBAAoB,CAAC,GAAG,CAACI,KAAKC,OAAUF,OAAO,SAAS,CAAC,cAAc,CAAC,IAAI,CAACC,KAAKC;;;ICClFL,oBAAoB,CAAC,GAAG,CAAC;QACxB,IAAG,AAAkB,eAAlB,OAAOM,UA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